Rename gstate_c.Supports to gstate_c.Use
This commit is contained in:
parent
c5bdc6152f
commit
daca0b2109
29 changed files with 97 additions and 96 deletions
|
@ -537,7 +537,7 @@ u32 DrawEngineCommon::NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inPtr,
|
|||
}
|
||||
|
||||
void DrawEngineCommon::ApplyFramebufferRead(FBOTexState *fboTexState) {
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH)) {
|
||||
*fboTexState = FBO_TEX_READ_FRAMEBUFFER;
|
||||
} else {
|
||||
gpuStats.numCopiesForShaderBlend++;
|
||||
|
|
|
@ -45,7 +45,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
|
||||
bool highpFog = false;
|
||||
bool highpTexcoord = false;
|
||||
bool enableFragmentTestCache = gstate_c.Supports(GPU_USE_FRAGMENT_TEST_CACHE);
|
||||
bool enableFragmentTestCache = gstate_c.Use(GPU_USE_FRAGMENT_TEST_CACHE);
|
||||
|
||||
if (compat.gles) {
|
||||
// PowerVR needs highp to do the fog in MHU correctly.
|
||||
|
@ -137,11 +137,11 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
|
||||
bool needFramebufferRead = replaceBlend == REPLACE_BLEND_READ_FRAMEBUFFER || colorWriteMask || replaceLogicOp;
|
||||
|
||||
bool fetchFramebuffer = needFramebufferRead && gstate_c.Supports(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH);
|
||||
bool readFramebufferTex = needFramebufferRead && !gstate_c.Supports(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH);
|
||||
bool fetchFramebuffer = needFramebufferRead && gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH);
|
||||
bool readFramebufferTex = needFramebufferRead && !gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH);
|
||||
|
||||
bool needFragCoord = readFramebufferTex || gstate_c.Supports(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
bool writeDepth = gstate_c.Supports(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
bool needFragCoord = readFramebufferTex || gstate_c.Use(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
bool writeDepth = gstate_c.Use(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
|
||||
if (shaderDepalMode != ShaderDepalMode::OFF && !doTexture) {
|
||||
*errorString = "depal requires a texture";
|
||||
|
@ -149,7 +149,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
}
|
||||
|
||||
if (compat.shaderLanguage == ShaderLanguage::GLSL_VULKAN) {
|
||||
if (useDiscardStencilBugWorkaround && !gstate_c.Supports(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT)) {
|
||||
if (useDiscardStencilBugWorkaround && !gstate_c.Use(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT)) {
|
||||
WRITE(p, "layout (depth_unchanged) out float gl_FragDepth;\n");
|
||||
}
|
||||
|
||||
|
@ -1173,11 +1173,11 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
WRITE(p, " %s = vec4(0.0, 0.0, 0.0, %s.z); // blue to alpha\n", compat.fragColor0, compat.fragColor0);
|
||||
}
|
||||
|
||||
if (gstate_c.Supports(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT)) {
|
||||
if (gstate_c.Use(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT)) {
|
||||
const double scale = DepthSliceFactor() * 65535.0;
|
||||
|
||||
WRITE(p, " highp float z = gl_FragCoord.z;\n");
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
// We center the depth with an offset, but only its fraction matters.
|
||||
// When (DepthSliceFactor() - 1) is odd, it will be 0.5, otherwise 0.
|
||||
if (((int)(DepthSliceFactor() - 1.0f) & 1) == 1) {
|
||||
|
|
|
@ -2532,7 +2532,7 @@ bool FramebufferManagerCommon::GetDepthbuffer(u32 fb_address, int fb_stride, u32
|
|||
}
|
||||
|
||||
bool flipY = (GetGPUBackend() == GPUBackend::OPENGL && !useBufferedRendering_) ? true : false;
|
||||
if (gstate_c.Supports(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
if (gstate_c.Use(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
buffer.Allocate(w, h, GPU_DBG_FORMAT_FLOAT_DIV_256, flipY);
|
||||
} else {
|
||||
buffer.Allocate(w, h, GPU_DBG_FORMAT_FLOAT, flipY);
|
||||
|
|
|
@ -183,7 +183,7 @@ ReplaceAlphaType ReplaceAlphaWithStencil(ReplaceBlendType replaceBlend) {
|
|||
if (nonAlphaSrcFactors[gstate.getBlendFuncA()] && nonAlphaDestFactors[gstate.getBlendFuncB()]) {
|
||||
return REPLACE_ALPHA_YES;
|
||||
} else {
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_DUALSOURCE_BLEND)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_DUALSOURCE_BLEND)) {
|
||||
return REPLACE_ALPHA_DUALSOURCE;
|
||||
} else {
|
||||
return REPLACE_ALPHA_NO;
|
||||
|
@ -275,7 +275,7 @@ ReplaceBlendType ReplaceBlendWithShader(GEBufferFormat bufferFormat) {
|
|||
|
||||
case GE_BLENDMODE_MIN:
|
||||
case GE_BLENDMODE_MAX:
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_BLEND_MINMAX)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_BLEND_MINMAX)) {
|
||||
return REPLACE_BLEND_STANDARD;
|
||||
} else {
|
||||
return REPLACE_BLEND_READ_FRAMEBUFFER;
|
||||
|
@ -312,7 +312,7 @@ ReplaceBlendType ReplaceBlendWithShader(GEBufferFormat bufferFormat) {
|
|||
case GE_DSTBLEND_DOUBLESRCALPHA:
|
||||
// We can't technically do this correctly (due to clamping) without reading the dst color.
|
||||
// Using a copy isn't accurate either, though, when there's overlap.
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
return REPLACE_BLEND_READ_FRAMEBUFFER;
|
||||
return REPLACE_BLEND_PRE_SRC_2X_ALPHA;
|
||||
|
||||
|
@ -454,14 +454,14 @@ ReplaceBlendType ReplaceBlendWithShader(GEBufferFormat bufferFormat) {
|
|||
case GE_DSTBLEND_DOUBLESRCALPHA:
|
||||
if (funcA == GE_SRCBLEND_SRCALPHA || funcA == GE_SRCBLEND_INVSRCALPHA) {
|
||||
// Can't safely double alpha, will clamp. However, a copy may easily be worse due to overlap.
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
return REPLACE_BLEND_READ_FRAMEBUFFER;
|
||||
return REPLACE_BLEND_PRE_SRC_2X_ALPHA;
|
||||
} else {
|
||||
// This means dst alpha/color is used in the src factor.
|
||||
// Unfortunately, copying here causes overlap problems in Silent Hill games (it seems?)
|
||||
// We will just hope that doubling alpha for the dst factor will not clamp too badly.
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
return REPLACE_BLEND_READ_FRAMEBUFFER;
|
||||
return REPLACE_BLEND_2X_ALPHA;
|
||||
}
|
||||
|
@ -494,10 +494,10 @@ static const float DEPTH_SLICE_FACTOR_HIGH = 4.0f;
|
|||
static const float DEPTH_SLICE_FACTOR_16BIT = 256.0f;
|
||||
|
||||
float DepthSliceFactor() {
|
||||
if (gstate_c.Supports(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
if (gstate_c.Use(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
return DEPTH_SLICE_FACTOR_16BIT;
|
||||
}
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP)) {
|
||||
return 1.0f;
|
||||
}
|
||||
return DEPTH_SLICE_FACTOR_HIGH;
|
||||
|
@ -505,12 +505,12 @@ float DepthSliceFactor() {
|
|||
|
||||
// This is used for float values which might not be integers, but are in the integer scale of 65535.
|
||||
float ToScaledDepthFromIntegerScale(float z) {
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
return z * (1.0f / 65535.0f);
|
||||
}
|
||||
|
||||
const float depthSliceFactor = DepthSliceFactor();
|
||||
if (gstate_c.Supports(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
if (gstate_c.Use(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
const double doffset = 0.5 * (depthSliceFactor - 1.0) * (1.0 / depthSliceFactor);
|
||||
// Use one bit for each value, rather than 1.0 / (25535.0 * 256.0).
|
||||
return (float)((double)z * (1.0 / 16777215.0) + doffset);
|
||||
|
@ -523,7 +523,7 @@ float ToScaledDepthFromIntegerScale(float z) {
|
|||
// See struct DepthScaleFactors for how to apply.
|
||||
DepthScaleFactors GetDepthScaleFactors() {
|
||||
DepthScaleFactors factors;
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
factors.offset = 0;
|
||||
factors.scale = 65535.0f;
|
||||
return factors;
|
||||
|
@ -728,7 +728,7 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo
|
|||
// This adjusts the center from halfActualZRange to vpZCenter.
|
||||
out.zOffset = halfActualZRange < std::numeric_limits<float>::epsilon() ? 0.0f : (vpZCenter - (minz + halfActualZRange)) / halfActualZRange;
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
out.depthScale = 1.0f;
|
||||
out.zOffset = 0.0f;
|
||||
out.depthRangeMin = ToScaledDepthFromIntegerScale(vpZCenter - vpZScale);
|
||||
|
@ -863,7 +863,7 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend
|
|||
|
||||
// Note: our shader solution applies logic ops BEFORE blending, not correctly after.
|
||||
// This is however fine for the most common ones, like CLEAR/NOOP/SET, etc.
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
switch (gstate.getLogicOp()) {
|
||||
case GE_LOGIC_CLEAR:
|
||||
srcBlend = BlendFactor::ZERO;
|
||||
|
@ -944,7 +944,7 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend
|
|||
|
||||
// Choose the shader part of the above logic op fallback simulation.
|
||||
SimulateLogicOpType SimulateLogicOpShaderTypeIfNeeded() {
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP) && gstate.isLogicOpEnabled()) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_LOGIC_OP) && gstate.isLogicOpEnabled()) {
|
||||
switch (gstate.getLogicOp()) {
|
||||
case GE_LOGIC_COPY_INVERTED:
|
||||
case GE_LOGIC_AND_INVERTED:
|
||||
|
@ -1275,7 +1275,7 @@ static void ConvertBlendState(GenericBlendState &blendState, bool forceReplaceBl
|
|||
|
||||
// At this point, through all paths above, glBlendFuncA and glBlendFuncB will be set right somehow.
|
||||
BlendEq colorEq;
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_BLEND_MINMAX)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_BLEND_MINMAX)) {
|
||||
colorEq = eqLookup[blendFuncEq];
|
||||
} else {
|
||||
colorEq = eqLookupNoMinMax[blendFuncEq];
|
||||
|
@ -1597,7 +1597,7 @@ void ComputedPipelineState::Convert(bool shaderBitOpsSuppported) {
|
|||
// Passing on the previous applyFramebufferRead as forceFrameBuffer read in the next one,
|
||||
// thus propagating forward.
|
||||
ConvertMaskState(maskState, shaderBitOpsSuppported);
|
||||
ConvertLogicOpState(logicState, gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP), shaderBitOpsSuppported, maskState.applyFramebufferRead);
|
||||
ConvertLogicOpState(logicState, gstate_c.Use(GPU_SUPPORTS_LOGIC_OP), shaderBitOpsSuppported, maskState.applyFramebufferRead);
|
||||
ConvertBlendState(blendState, logicState.applyFramebufferRead);
|
||||
|
||||
// Note: If the blend state decided it had to use framebuffer reads,
|
||||
|
|
|
@ -46,11 +46,11 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu
|
|||
}
|
||||
}
|
||||
bool vertexRangeCulling = !id.Bit(GS_BIT_CURVE);
|
||||
bool clipClampedDepth = gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
bool clipClampedDepth = gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
|
||||
ShaderWriter p(buffer, compat, ShaderStage::Geometry, gl_exts.data(), gl_exts.size());
|
||||
p.C("layout(triangles) in;\n");
|
||||
if (clipClampedDepth && vertexRangeCulling && !gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (clipClampedDepth && vertexRangeCulling && !gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
p.C("layout(triangle_strip, max_vertices = 12) out;\n");
|
||||
} else {
|
||||
p.C("layout(triangle_strip, max_vertices = 6) out;\n");
|
||||
|
@ -85,7 +85,7 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu
|
|||
p.C(" bool anyInside = false;\n");
|
||||
}
|
||||
// And apply manual clipping if necessary.
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
p.C(" float clip0[3];\n");
|
||||
if (clipClampedDepth) {
|
||||
p.C(" float clip1[3];\n");
|
||||
|
@ -117,7 +117,7 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu
|
|||
p.C(" }\n");
|
||||
}
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
// This is basically the same value as gl_ClipDistance would take, z + w.
|
||||
if (vertexRangeCulling) {
|
||||
p.C(" clip0[i] = projZ * outPos.w + outPos.w;\n");
|
||||
|
@ -156,7 +156,7 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu
|
|||
p.C(" }\n");
|
||||
}
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
// Clipping against one half-space cuts a triangle (17/27), culls (7/27), or creates two triangles (3/27).
|
||||
// We clip against two, so we can generate up to 4 triangles, a polygon with 6 points.
|
||||
p.C(" int indices[6];\n");
|
||||
|
@ -290,7 +290,7 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu
|
|||
p.F(" gl_ClipDistance%s = projZ * outPos.w + outPos.w;\n", clipSuffix0);
|
||||
}
|
||||
p.C(" gl_Position = outPos;\n");
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < varyings.size(); i++) {
|
||||
|
|
|
@ -83,7 +83,7 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform,
|
|||
}
|
||||
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled() && !isModeThrough && !gstate.isModeClear();
|
||||
bool vertexRangeCulling = gstate_c.Supports(GPU_SUPPORTS_VS_RANGE_CULLING) &&
|
||||
bool vertexRangeCulling = gstate_c.Use(GPU_SUPPORTS_VS_RANGE_CULLING) &&
|
||||
!isModeThrough && gstate_c.submitType == SubmitType::DRAW; // neither hw nor sw spline/bezier. See #11692
|
||||
|
||||
VShaderID id;
|
||||
|
@ -124,7 +124,7 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform,
|
|||
if (gstate.isLightingEnabled()) {
|
||||
// doShadeMapping is stored as UVGenMode, and light type doesn't matter for shade mapping.
|
||||
id.SetBit(VS_BIT_LIGHTING_ENABLE);
|
||||
if (gstate_c.Supports(GPU_USE_LIGHT_UBERSHADER)) {
|
||||
if (gstate_c.Use(GPU_USE_LIGHT_UBERSHADER)) {
|
||||
id.SetBit(VS_BIT_LIGHT_UBERSHADER);
|
||||
} else {
|
||||
id.SetBits(VS_BIT_MATERIAL_UPDATE, 3, gstate.getMaterialUpdate());
|
||||
|
@ -390,11 +390,11 @@ void ComputeGeometryShaderID(GShaderID *id_out, const Draw::Bugs &bugs, int prim
|
|||
bool isTriangle = prim == GE_PRIM_TRIANGLES || prim == GE_PRIM_TRIANGLE_FAN || prim == GE_PRIM_TRIANGLE_STRIP;
|
||||
|
||||
bool vertexRangeCulling = !isCurve;
|
||||
bool clipClampedDepth = gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP) && !gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
bool clipClampedDepth = gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP) && !gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
|
||||
// If we're not using GS culling, return a zero ID.
|
||||
// Also, only use this for triangle primitives.
|
||||
if ((!vertexRangeCulling && !clipClampedDepth) || isModeThrough || !isTriangle || !gstate_c.Supports(GPU_SUPPORTS_GS_CULLING)) {
|
||||
if ((!vertexRangeCulling && !clipClampedDepth) || isModeThrough || !isTriangle || !gstate_c.Use(GPU_SUPPORTS_GS_CULLING)) {
|
||||
*id_out = id;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -639,7 +639,7 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
|
|||
result->drawIndexed = true;
|
||||
|
||||
// If we don't support custom cull in the shader, process it here.
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_CULL_DISTANCE) && vertexCount > 0 && !throughmode) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_CULL_DISTANCE) && vertexCount > 0 && !throughmode) {
|
||||
const u16 *indsIn = (const u16 *)inds;
|
||||
u16 *newInds = inds + vertexCount;
|
||||
u16 *indsOut = newInds;
|
||||
|
|
|
@ -197,7 +197,7 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac
|
|||
key.maxLevel = maxLevel * 256;
|
||||
key.minLevel = 0;
|
||||
key.lodBias = (int)(lodBias * 256.0f);
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
|
||||
key.aniso = true;
|
||||
}
|
||||
break;
|
||||
|
@ -281,7 +281,7 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac
|
|||
key.mipFilt = 1;
|
||||
key.maxLevel = 9 * 256;
|
||||
key.lodBias = 0.0f;
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
|
||||
key.aniso = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1103,7 +1103,7 @@ void TextureCacheCommon::SetTextureFramebuffer(const AttachCandidate &candidate)
|
|||
gstate_c.SetNeedShaderTexclamp(true);
|
||||
}
|
||||
|
||||
if (channel == RASTER_DEPTH && !gstate_c.Supports(GPU_SUPPORTS_DEPTH_TEXTURE)) {
|
||||
if (channel == RASTER_DEPTH && !gstate_c.Use(GPU_SUPPORTS_DEPTH_TEXTURE)) {
|
||||
WARN_LOG_ONCE(ndepthtex, G3D, "Depth textures not supported, not binding");
|
||||
// Flag to bind a null texture if we can't support depth textures.
|
||||
// Should only happen on old OpenGL.
|
||||
|
@ -1202,7 +1202,7 @@ bool TextureCacheCommon::GetCurrentFramebufferTextureDebug(GPUDebugBuffer &buffe
|
|||
void TextureCacheCommon::NotifyConfigChanged() {
|
||||
int scaleFactor = g_Config.iTexScalingLevel;
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_TEXTURE_NPOT)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_TEXTURE_NPOT)) {
|
||||
// Reduce the scale factor to a power of two (e.g. 2 or 4) if textures must be a power of two.
|
||||
// TODO: In addition we should probably remove these options from the UI in this case.
|
||||
while ((scaleFactor & (scaleFactor - 1)) != 0) {
|
||||
|
@ -2581,7 +2581,7 @@ bool TextureCacheCommon::PrepareBuildTexture(BuildTexturePlan &plan, TexCacheEnt
|
|||
int lastW = gstate.getTextureWidth(i - 1);
|
||||
int lastH = gstate.getTextureHeight(i - 1);
|
||||
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (tw != 1 && tw != (lastW >> 1))
|
||||
plan.badMipSizes = true;
|
||||
else if (th != 1 && th != (lastH >> 1))
|
||||
|
@ -2782,7 +2782,7 @@ void TextureCacheCommon::LoadTextureLevel(TexCacheEntry &entry, uint8_t *data, i
|
|||
decPitch = stride;
|
||||
}
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_16BIT_FORMATS) || dstFmt == Draw::DataFormat::R8G8B8A8_UNORM) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_16BIT_FORMATS) || dstFmt == Draw::DataFormat::R8G8B8A8_UNORM) {
|
||||
texDecFlags |= TexDecodeFlags::EXPAND32;
|
||||
}
|
||||
if (entry.status & TexCacheEntry::STATUS_CLUT_GPU) {
|
||||
|
|
|
@ -139,7 +139,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
if (gl_extensions.EXT_gpu_shader4) {
|
||||
gl_exts.push_back("#extension GL_EXT_gpu_shader4 : enable");
|
||||
}
|
||||
bool useClamp = gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP) && !id.Bit(VS_BIT_IS_THROUGH);
|
||||
bool useClamp = gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP) && !id.Bit(VS_BIT_IS_THROUGH);
|
||||
if (gl_extensions.EXT_clip_cull_distance && (id.Bit(VS_BIT_VERTEX_RANGE_CULLING) || useClamp)) {
|
||||
gl_exts.push_back("#extension GL_EXT_clip_cull_distance : enable");
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
bool texCoordInVec3 = false;
|
||||
|
||||
bool vertexRangeCulling = id.Bit(VS_BIT_VERTEX_RANGE_CULLING) && !isModeThrough;
|
||||
bool clipClampedDepth = !isModeThrough && gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP) && gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
bool clipClampedDepth = !isModeThrough && gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP) && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
const char *clipClampedDepthSuffix = "[0]";
|
||||
const char *vertexRangeClipSuffix = clipClampedDepth ? "[1]" : "[0]";
|
||||
|
||||
|
@ -416,7 +416,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
WRITE(p, " vec4 gl_Position : POSITION;\n");
|
||||
} else {
|
||||
WRITE(p, " vec4 gl_Position : SV_Position;\n");
|
||||
bool clipRange = vertexRangeCulling && gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
bool clipRange = vertexRangeCulling && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
if (clipClampedDepth && clipRange) {
|
||||
WRITE(p, " float2 gl_ClipDistance : SV_ClipDistance;\n");
|
||||
clipClampedDepthSuffix = ".x";
|
||||
|
@ -426,7 +426,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
clipClampedDepthSuffix = "";
|
||||
vertexRangeClipSuffix = "";
|
||||
}
|
||||
if (vertexRangeCulling && gstate_c.Supports(GPU_SUPPORTS_CULL_DISTANCE)) {
|
||||
if (vertexRangeCulling && gstate_c.Use(GPU_SUPPORTS_CULL_DISTANCE)) {
|
||||
WRITE(p, " float2 gl_CullDistance : SV_CullDistance0;\n");
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
}
|
||||
|
||||
// See comment above this function (GenerateVertexShader).
|
||||
if (!isModeThrough && gstate_c.Supports(GPU_ROUND_DEPTH_TO_16BIT)) {
|
||||
if (!isModeThrough && gstate_c.Use(GPU_ROUND_DEPTH_TO_16BIT)) {
|
||||
// Apply the projection and viewport to get the Z buffer value, floor to integer, undo the viewport and projection.
|
||||
WRITE(p, "\nvec4 depthRoundZVP(vec4 v) {\n");
|
||||
WRITE(p, " float z = v.z / v.w;\n");
|
||||
|
@ -847,7 +847,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
}
|
||||
|
||||
// The viewport is used in this case, so need to compensate for that.
|
||||
if (gstate_c.Supports(GPU_ROUND_DEPTH_TO_16BIT)) {
|
||||
if (gstate_c.Use(GPU_ROUND_DEPTH_TO_16BIT)) {
|
||||
WRITE(p, " vec4 outPos = depthRoundZVP(pos);\n");
|
||||
} else {
|
||||
WRITE(p, " vec4 outPos = pos;\n");
|
||||
|
@ -927,7 +927,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
WRITE(p, " vec4 viewPos = vec4(mul(vec4(worldpos, 1.0), u_view%s).xyz, 1.0);\n", matrixPostfix.c_str());
|
||||
|
||||
// Final view and projection transforms.
|
||||
if (gstate_c.Supports(GPU_ROUND_DEPTH_TO_16BIT)) {
|
||||
if (gstate_c.Use(GPU_ROUND_DEPTH_TO_16BIT)) {
|
||||
if (IsVRBuild()) {
|
||||
WRITE(p, " vec4 outPos = depthRoundZVP(mul(u_proj_lens%s, viewPos));\n", matrixPostfix.c_str());
|
||||
WRITE(p, " vec4 orgPos = depthRoundZVP(mul(u_proj, viewPos));\n");
|
||||
|
@ -1306,11 +1306,11 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
|
||||
const char *cull0 = compat.shaderLanguage == HLSL_D3D11 ? ".x" : "[0]";
|
||||
const char *cull1 = compat.shaderLanguage == HLSL_D3D11 ? ".y" : "[1]";
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
// TODO: Ignore triangles from GE_PRIM_RECTANGLES in transform mode, which should not clip to neg z.
|
||||
WRITE(p, " %sgl_ClipDistance%s = projZ * outPos.w + outPos.w;\n", compat.vsOutPrefix, vertexRangeClipSuffix);
|
||||
}
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_CULL_DISTANCE)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_CULL_DISTANCE)) {
|
||||
// Cull any triangle fully outside in the same direction when depth clamp enabled.
|
||||
WRITE(p, " if (u_cullRangeMin.w > 0.0) {\n");
|
||||
WRITE(p, " %sgl_CullDistance%s = projPos.z - u_cullRangeMin.z;\n", compat.vsOutPrefix, cull0);
|
||||
|
|
|
@ -701,7 +701,7 @@ rotateVBO:
|
|||
uint8_t clearStencil = clearColor >> 24;
|
||||
draw_->Clear(clearFlag, clearColor, clearDepth, clearStencil);
|
||||
|
||||
if ((gstate_c.featureFlags & GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
if ((gstate_c.useFlags & GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
int scissorY1 = gstate.getScissorY1();
|
||||
int scissorX2 = gstate.getScissorX2() + 1;
|
||||
|
|
|
@ -82,7 +82,7 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
|||
// No need to flush before the tex scale/offset commands if we are baking
|
||||
// the tex scale/offset into the vertices anyway.
|
||||
UpdateCmdInfo();
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
|
||||
BuildReportingInfo();
|
||||
|
||||
|
@ -174,7 +174,7 @@ void GPU_D3D11::BeginHostFrame() {
|
|||
GPUCommon::BeginHostFrame();
|
||||
UpdateCmdInfo();
|
||||
if (resized_) {
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.Resized();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
|
|
|
@ -202,7 +202,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
|||
dynState_.useBlendColor = false;
|
||||
}
|
||||
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
// Logic Ops
|
||||
if (gstate.isLogicOpEnabled() && gstate.getLogicOp() != GE_LOGIC_COPY) {
|
||||
keys_.blend.blendEnable = false; // Can't have both blend & logic op - although I think the PSP can!
|
||||
|
@ -229,7 +229,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
|||
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
|
||||
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
|
||||
// But the alternate is not clamping in either direction...
|
||||
keys_.raster.depthClipEnable = !gstate.isDepthClampEnabled() || !gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
keys_.raster.depthClipEnable = !gstate.isDepthClampEnabled() || !gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
} else {
|
||||
// We just want to clip in this case, the clamp would be clipped anyway.
|
||||
keys_.raster.depthClipEnable = 1;
|
||||
|
|
|
@ -428,7 +428,7 @@ DXGI_FORMAT GetClutDestFormatD3D11(GEPaletteFormat format) {
|
|||
}
|
||||
|
||||
DXGI_FORMAT TextureCacheD3D11::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const {
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_16BIT_FORMATS)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_16BIT_FORMATS)) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
}
|
||||
|
||||
|
|
|
@ -645,7 +645,7 @@ rotateVBO:
|
|||
|
||||
device_->Clear(0, NULL, mask, SwapRB(clearColor), clearDepth, clearColor >> 24);
|
||||
|
||||
if ((gstate_c.featureFlags & GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
if (gstate_c.Use(GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
int scissorY1 = gstate.getScissorY1();
|
||||
int scissorX2 = gstate.getScissorX2() + 1;
|
||||
|
|
|
@ -81,7 +81,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
|||
// No need to flush before the tex scale/offset commands if we are baking
|
||||
// the tex scale/offset into the vertices anyway.
|
||||
UpdateCmdInfo();
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
|
||||
BuildReportingInfo();
|
||||
|
||||
|
@ -163,7 +163,7 @@ void GPU_DX9::BeginHostFrame() {
|
|||
GPUCommon::BeginHostFrame();
|
||||
UpdateCmdInfo();
|
||||
if (resized_) {
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.Resized();
|
||||
shaderManagerDX9_->DirtyShader();
|
||||
|
|
|
@ -170,7 +170,7 @@ void TextureCacheDX9::StartFrame() {
|
|||
Decimate();
|
||||
}
|
||||
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANISOTROPY)) {
|
||||
DWORD aniso = 1 << g_Config.iAnisotropyLevel;
|
||||
DWORD anisotropyLevel = aniso > maxAnisotropyLevel ? maxAnisotropyLevel : aniso;
|
||||
device_->SetSamplerState(0, D3DSAMP_MAXANISOTROPY, anisotropyLevel);
|
||||
|
|
|
@ -217,7 +217,7 @@ bool FramebufferManagerGLES::ReadbackDepthbufferSync(Draw::Framebuffer *fbo, int
|
|||
|
||||
DepthUB ub{};
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
// Don't scale anything, since we're not using factors outside accurate mode.
|
||||
ub.u_depthFactor[0] = 0.0f;
|
||||
ub.u_depthFactor[1] = 1.0f;
|
||||
|
|
|
@ -437,7 +437,7 @@ void DrawEngineGLES::DoFlush() {
|
|||
render_->Clear(clearColor, clearDepth, clearColor >> 24, target, rgbaMask, vpAndScissor.scissorX, vpAndScissor.scissorY, vpAndScissor.scissorW, vpAndScissor.scissorH);
|
||||
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);
|
||||
|
||||
if ((gstate_c.featureFlags & GPU_USE_CLEAR_RAM_HACK) && colorMask && (alphaMask || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
if (gstate_c.Use(GPU_USE_CLEAR_RAM_HACK) && colorMask && (alphaMask || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
int scissorY1 = gstate.getScissorY1();
|
||||
int scissorX2 = gstate.getScissorX2() + 1;
|
||||
|
@ -476,7 +476,7 @@ bool DrawEngineGLES::IsCodePtrVertexDecoder(const u8 *ptr) const {
|
|||
|
||||
bool DrawEngineGLES::SupportsHWTessellation() const {
|
||||
bool hasTexelFetch = gl_extensions.GLES3 || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 3, 0)) || gl_extensions.EXT_gpu_shader4;
|
||||
return hasTexelFetch && gstate_c.SupportsAll(GPU_SUPPORTS_VERTEX_TEXTURE_FETCH | GPU_SUPPORTS_TEXTURE_FLOAT | GPU_SUPPORTS_INSTANCE_RENDERING);
|
||||
return hasTexelFetch && gstate_c.UseAll(GPU_SUPPORTS_VERTEX_TEXTURE_FETCH | GPU_SUPPORTS_TEXTURE_FLOAT | GPU_SUPPORTS_INSTANCE_RENDERING);
|
||||
}
|
||||
|
||||
bool DrawEngineGLES::UpdateUseHWTessellation(bool enable) {
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw) {
|
||||
UpdateVsyncInterval(true);
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
|
||||
shaderManagerGL_ = new ShaderManagerGLES(draw);
|
||||
framebufferManagerGL_ = new FramebufferManagerGLES(draw);
|
||||
|
@ -281,7 +281,7 @@ void GPU_GLES::BeginHostFrame() {
|
|||
GPUCommon::BeginHostFrame();
|
||||
UpdateCmdInfo();
|
||||
if (resized_) {
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.Resized();
|
||||
shaderManagerGL_->DirtyShader();
|
||||
|
|
|
@ -196,12 +196,12 @@ LinkedShader::LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs,
|
|||
initialize.push_back({ &u_tess_weights_v, 0, TEX_SLOT_SPLINE_WEIGHTS_V });
|
||||
|
||||
GLRProgramFlags flags{};
|
||||
flags.supportDualSource = (gstate_c.featureFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) != 0;
|
||||
if (!VSID.Bit(VS_BIT_IS_THROUGH) && gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP)) {
|
||||
flags.supportDualSource = (gstate_c.useFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) != 0;
|
||||
if (!VSID.Bit(VS_BIT_IS_THROUGH) && gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP)) {
|
||||
flags.useClipDistance0 = true;
|
||||
if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE))
|
||||
if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE))
|
||||
flags.useClipDistance1 = true;
|
||||
} else if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
} else if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
flags.useClipDistance0 = true;
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ static inline void FlipProjMatrix(Matrix4x4 &in, bool useBufferedRendering) {
|
|||
|
||||
// In Phantasy Star Portable 2, depth range sometimes goes negative and is clamped by glDepthRange to 0,
|
||||
// causing graphics clipping glitch (issue #1788). This hack modifies the projection matrix to work around it.
|
||||
if (gstate_c.Supports(GPU_USE_DEPTH_RANGE_HACK)) {
|
||||
if (gstate_c.Use(GPU_USE_DEPTH_RANGE_HACK)) {
|
||||
float zScale = gstate.getViewportZScale() / 65535.0f;
|
||||
float zCenter = gstate.getViewportZCenter() / 65535.0f;
|
||||
|
||||
|
@ -564,7 +564,7 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBu
|
|||
float viewZScale = halfActualZRange;
|
||||
float viewZCenter = minz + halfActualZRange;
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
viewZScale = vpZScale;
|
||||
viewZCenter = vpZCenter;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ std::string ShaderManagerGLES::DebugGetShaderString(std::string id, DebugShaderT
|
|||
struct CacheHeader {
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
uint32_t featureFlags;
|
||||
uint32_t useFlags;
|
||||
uint32_t reserved;
|
||||
int numVertexShaders;
|
||||
int numFragmentShaders;
|
||||
|
@ -957,7 +957,7 @@ void ShaderManagerGLES::Load(const Path &filename) {
|
|||
if (!f.ReadArray(&header, 1)) {
|
||||
return;
|
||||
}
|
||||
if (header.magic != CACHE_HEADER_MAGIC || header.version != CACHE_VERSION || header.featureFlags != gstate_c.featureFlags) {
|
||||
if (header.magic != CACHE_HEADER_MAGIC || header.version != CACHE_VERSION || header.useFlags != gstate_c.useFlags) {
|
||||
return;
|
||||
}
|
||||
diskCachePending_.start = time_now_d();
|
||||
|
@ -1113,7 +1113,7 @@ void ShaderManagerGLES::Save(const Path &filename) {
|
|||
header.magic = CACHE_HEADER_MAGIC;
|
||||
header.version = CACHE_VERSION;
|
||||
header.reserved = 0;
|
||||
header.featureFlags = gstate_c.featureFlags;
|
||||
header.useFlags = gstate_c.useFlags;
|
||||
header.numVertexShaders = GetNumVertexShaders();
|
||||
header.numFragmentShaders = GetNumFragmentShaders();
|
||||
header.numLinkedPrograms = GetNumPrograms();
|
||||
|
|
|
@ -209,7 +209,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
|||
|
||||
// TODO: Get rid of the ifdef
|
||||
#ifndef USING_GLES2
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
renderManager->SetLogicOp(logicState.logicOpEnabled, logicOps[(int)logicState.logicOp]);
|
||||
}
|
||||
#endif
|
||||
|
@ -232,7 +232,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
|||
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
|
||||
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
|
||||
// But the alternate is not clamping in either direction...
|
||||
depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
} else {
|
||||
// We just want to clip in this case, the clamp would be clipped anyway.
|
||||
depthClampEnable = false;
|
||||
|
@ -304,7 +304,7 @@ void DrawEngineGLES::ApplyDrawStateLate(bool setStencilValue, int stencilValue)
|
|||
|
||||
// At this point, we know if the vertices are full alpha or not.
|
||||
// TODO: Set the nearest/linear here (since we correctly know if alpha/color tests are needed)?
|
||||
if (!gstate.isModeClear() && gstate_c.Supports(GPU_USE_FRAGMENT_TEST_CACHE)) {
|
||||
if (!gstate.isModeClear() && gstate_c.Use(GPU_USE_FRAGMENT_TEST_CACHE)) {
|
||||
// Apply last, once we know the alpha params of the texture.
|
||||
if (gstate.isAlphaTestEnabled() || gstate.isColorTestEnabled()) {
|
||||
fragmentTestCache_->BindTestTexture(TEX_SLOT_ALPHATEST);
|
||||
|
|
|
@ -105,7 +105,7 @@ static const GLuint MagFiltGL[2] = {
|
|||
};
|
||||
|
||||
void TextureCacheGLES::ApplySamplingParams(const SamplerCacheKey &key) {
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
float minLod = (float)key.minLevel / 256.0f;
|
||||
float maxLod = (float)key.maxLevel / 256.0f;
|
||||
float lodBias = (float)key.lodBias / 256.0f;
|
||||
|
@ -286,7 +286,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
// If the mip chain is not full..
|
||||
if (plan.levelsToCreate != plan.maxPossibleLevels) {
|
||||
// We need to avoid creating mips at all, or generate them all - can't be incomplete
|
||||
|
|
|
@ -454,7 +454,7 @@ void GPUCommon::UpdateCmdInfo() {
|
|||
|
||||
// Reconfigure for light ubershader or not.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (gstate_c.Supports(GPU_USE_LIGHT_UBERSHADER)) {
|
||||
if (gstate_c.Use(GPU_USE_LIGHT_UBERSHADER)) {
|
||||
cmdInfo_[GE_CMD_LIGHTENABLE0 + i].RemoveDirty(DIRTY_VERTEXSHADER_STATE);
|
||||
cmdInfo_[GE_CMD_LIGHTENABLE0 + i].AddDirty(DIRTY_LIGHT_CONTROL);
|
||||
cmdInfo_[GE_CMD_LIGHTTYPE0 + i].RemoveDirty(DIRTY_VERTEXSHADER_STATE);
|
||||
|
@ -467,7 +467,7 @@ void GPUCommon::UpdateCmdInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
if (gstate_c.Supports(GPU_USE_LIGHT_UBERSHADER)) {
|
||||
if (gstate_c.Use(GPU_USE_LIGHT_UBERSHADER)) {
|
||||
cmdInfo_[GE_CMD_MATERIALUPDATE].RemoveDirty(DIRTY_VERTEXSHADER_STATE);
|
||||
cmdInfo_[GE_CMD_MATERIALUPDATE].AddDirty(DIRTY_LIGHT_CONTROL);
|
||||
} else {
|
||||
|
|
|
@ -519,8 +519,9 @@ enum class SubmitType {
|
|||
};
|
||||
|
||||
struct GPUStateCache {
|
||||
bool Supports(u32 flags) { return (featureFlags & flags) != 0; } // Return true if ANY of flags are true.
|
||||
bool SupportsAll(u32 flags) { return (featureFlags & flags) == flags; } // Return true if ALL flags are true.
|
||||
bool Use(u32 flags) { return (useFlags & flags) != 0; } // Return true if ANY of flags are true.
|
||||
bool UseAll(u32 flags) { return (useFlags & flags) == flags; } // Return true if ALL flags are true.
|
||||
|
||||
uint64_t GetDirtyUniforms() { return dirty & DIRTY_ALL_UNIFORMS; }
|
||||
void Dirty(u64 what) {
|
||||
dirty |= what;
|
||||
|
@ -561,7 +562,7 @@ struct GPUStateCache {
|
|||
}
|
||||
}
|
||||
|
||||
u32 featureFlags;
|
||||
u32 useFlags;
|
||||
|
||||
u32 vertexAddr;
|
||||
u32 indexAddr;
|
||||
|
|
|
@ -112,7 +112,7 @@ void DrawEngineVulkan::InitDeviceObjects() {
|
|||
bindings[3].descriptorCount = 1;
|
||||
bindings[3].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
||||
bindings[3].stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
if (gstate_c.Supports(GPU_SUPPORTS_GS_CULLING))
|
||||
if (gstate_c.Use(GPU_SUPPORTS_GS_CULLING))
|
||||
bindings[3].stageFlags |= VK_SHADER_STAGE_GEOMETRY_BIT;
|
||||
bindings[3].binding = DRAW_BINDING_DYNUBO_BASE;
|
||||
bindings[4].descriptorCount = 1;
|
||||
|
@ -973,7 +973,7 @@ void DrawEngineVulkan::DoFlush() {
|
|||
// If non-buffered though, it'll just do a plain clear.
|
||||
framebufferManager_->NotifyClear(gstate.isClearModeColorMask(), gstate.isClearModeAlphaMask(), gstate.isClearModeDepthMask(), result.color, result.depth);
|
||||
|
||||
if (gstate_c.Supports(GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate.FrameBufFormat() == GE_FORMAT_565)) {
|
||||
if (gstate_c.Use(GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate.FrameBufFormat() == GE_FORMAT_565)) {
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
int scissorY1 = gstate.getScissorY1();
|
||||
int scissorX2 = gstate.getScissorX2() + 1;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw) {
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
drawEngine_.InitDeviceObjects();
|
||||
|
||||
VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext();
|
||||
|
@ -276,7 +276,7 @@ void GPU_Vulkan::BeginHostFrame() {
|
|||
UpdateCmdInfo();
|
||||
|
||||
if (resized_) {
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
// In case the GPU changed.
|
||||
BuildReportingInfo();
|
||||
framebufferManager_->Resized();
|
||||
|
@ -515,7 +515,7 @@ void GPU_Vulkan::DeviceRestore() {
|
|||
GPUCommon::DeviceRestore();
|
||||
InitDeviceObjects();
|
||||
|
||||
gstate_c.featureFlags = CheckGPUFeatures();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
BuildReportingInfo();
|
||||
UpdateCmdInfo();
|
||||
|
||||
|
|
|
@ -486,7 +486,7 @@ VulkanGeometryShader *ShaderManagerVulkan::GetGeometryShaderFromModule(VkShaderM
|
|||
struct VulkanCacheHeader {
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
uint32_t featureFlags;
|
||||
uint32_t useFlags;
|
||||
uint32_t reserved;
|
||||
int numVertexShaders;
|
||||
int numFragmentShaders;
|
||||
|
@ -500,7 +500,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
|
|||
return false;
|
||||
if (header.version != CACHE_VERSION)
|
||||
return false;
|
||||
if (header.featureFlags != gstate_c.featureFlags)
|
||||
if (header.useFlags != gstate_c.useFlags)
|
||||
return false;
|
||||
|
||||
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
|
@ -563,7 +563,7 @@ void ShaderManagerVulkan::SaveCache(FILE *f) {
|
|||
VulkanCacheHeader header{};
|
||||
header.magic = CACHE_HEADER_MAGIC;
|
||||
header.version = CACHE_VERSION;
|
||||
header.featureFlags = gstate_c.featureFlags;
|
||||
header.useFlags = gstate_c.useFlags;
|
||||
header.reserved = 0;
|
||||
header.numVertexShaders = (int)vsCache_.size();
|
||||
header.numFragmentShaders = (int)fsCache_.size();
|
||||
|
|
|
@ -232,7 +232,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
|
|||
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
|
||||
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
|
||||
// But the alternate is not clamping in either direction...
|
||||
key.depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
key.depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
} else {
|
||||
// We just want to clip in this case, the clamp would be clipped anyway.
|
||||
key.depthClampEnable = false;
|
||||
|
|
|
@ -685,7 +685,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
|||
}
|
||||
|
||||
VkFormat TextureCacheVulkan::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const {
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_16BIT_FORMATS)) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_16BIT_FORMATS)) {
|
||||
return VK_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
switch (format) {
|
||||
|
@ -726,7 +726,7 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
|||
int decPitch;
|
||||
|
||||
TexDecodeFlags texDecFlags{};
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_16BIT_FORMATS) || scaleFactor > 1 || dstFmt == VULKAN_8888_FORMAT) {
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_16BIT_FORMATS) || scaleFactor > 1 || dstFmt == VULKAN_8888_FORMAT) {
|
||||
texDecFlags |= TexDecodeFlags::EXPAND32;
|
||||
}
|
||||
if (entry.status & TexCacheEntry::STATUS_CLUT_GPU) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue