mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Rename GPU_SUPPORTS_ to GPU_USE_
This commit is contained in:
1 parent
daca0b2109
commit
9b8a5d1db3
25 files changed
+121
-121
No files matched your search
@@ -537,7 +537,7 @@ u32 DrawEngineCommon::NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inPtr,
|
||||
}
|
||||
|
||||
void DrawEngineCommon::ApplyFramebufferRead(FBOTexState *fboTexState) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH)) {
|
||||
if (gstate_c.Use(GPU_USE_ANY_FRAMEBUFFER_FETCH)) {
|
||||
*fboTexState = FBO_TEX_READ_FRAMEBUFFER;
|
||||
} else {
|
||||
gpuStats.numCopiesForShaderBlend++;
|
||||
|
||||
@@ -137,8 +137,8 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
||||
|
||||
bool needFramebufferRead = replaceBlend == REPLACE_BLEND_READ_FRAMEBUFFER || colorWriteMask || replaceLogicOp;
|
||||
|
||||
bool fetchFramebuffer = needFramebufferRead && gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH);
|
||||
bool readFramebufferTex = needFramebufferRead && !gstate_c.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH);
|
||||
bool fetchFramebuffer = needFramebufferRead && gstate_c.Use(GPU_USE_ANY_FRAMEBUFFER_FETCH);
|
||||
bool readFramebufferTex = needFramebufferRead && !gstate_c.Use(GPU_USE_ANY_FRAMEBUFFER_FETCH);
|
||||
|
||||
bool needFragCoord = readFramebufferTex || gstate_c.Use(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
bool writeDepth = gstate_c.Use(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
@@ -1177,7 +1177,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
||||
const double scale = DepthSliceFactor() * 65535.0;
|
||||
|
||||
WRITE(p, " highp float z = gl_FragCoord.z;\n");
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (gstate_c.Use(GPU_USE_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) {
|
||||
|
||||
@@ -183,7 +183,7 @@ ReplaceAlphaType ReplaceAlphaWithStencil(ReplaceBlendType replaceBlend) {
|
||||
if (nonAlphaSrcFactors[gstate.getBlendFuncA()] && nonAlphaDestFactors[gstate.getBlendFuncB()]) {
|
||||
return REPLACE_ALPHA_YES;
|
||||
} else {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_DUALSOURCE_BLEND)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_BLEND_MINMAX)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH))
|
||||
if (gstate_c.Use(GPU_USE_ANY_FRAMEBUFFER_FETCH))
|
||||
return REPLACE_BLEND_READ_FRAMEBUFFER;
|
||||
return REPLACE_BLEND_2X_ALPHA;
|
||||
}
|
||||
@@ -497,7 +497,7 @@ float DepthSliceFactor() {
|
||||
if (gstate_c.Use(GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT)) {
|
||||
return DEPTH_SLICE_FACTOR_16BIT;
|
||||
}
|
||||
if (gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP)) {
|
||||
if (gstate_c.Use(GPU_USE_DEPTH_CLAMP)) {
|
||||
return 1.0f;
|
||||
}
|
||||
return DEPTH_SLICE_FACTOR_HIGH;
|
||||
@@ -505,7 +505,7 @@ 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.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_USE_ACCURATE_DEPTH)) {
|
||||
return z * (1.0f / 65535.0f);
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ float ToScaledDepthFromIntegerScale(float z) {
|
||||
// See struct DepthScaleFactors for how to apply.
|
||||
DepthScaleFactors GetDepthScaleFactors() {
|
||||
DepthScaleFactors factors;
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_LOGIC_OP) && gstate.isLogicOpEnabled()) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_BLEND_MINMAX)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_LOGIC_OP), shaderBitOpsSuppported, maskState.applyFramebufferRead);
|
||||
ConvertLogicOpState(logicState, gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
bool clipClampedDepth = gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (clipClampedDepth && vertexRangeCulling && !gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_VS_RANGE_CULLING) &&
|
||||
bool vertexRangeCulling = gstate_c.Use(GPU_USE_VS_RANGE_CULLING) &&
|
||||
!isModeThrough && gstate_c.submitType == SubmitType::DRAW; // neither hw nor sw spline/bezier. See #11692
|
||||
|
||||
VShaderID id;
|
||||
@@ -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.Use(GPU_SUPPORTS_DEPTH_CLAMP) && !gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
bool clipClampedDepth = gstate_c.Use(GPU_USE_DEPTH_CLAMP) && !gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_GS_CULLING)) {
|
||||
if ((!vertexRangeCulling && !clipClampedDepth) || isModeThrough || !isTriangle || !gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CULL_DISTANCE) && vertexCount > 0 && !throughmode) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_DEPTH_TEXTURE)) {
|
||||
if (channel == RASTER_DEPTH && !gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_TEXTURE_NPOT)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_16BIT_FORMATS) || dstFmt == Draw::DataFormat::R8G8B8A8_UNORM) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_DEPTH_CLAMP) && !id.Bit(VS_BIT_IS_THROUGH);
|
||||
bool useClamp = gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_DEPTH_CLAMP) && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
bool clipClampedDepth = !isModeThrough && gstate_c.Use(GPU_USE_DEPTH_CLAMP) && gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CLIP_DISTANCE);
|
||||
bool clipRange = vertexRangeCulling && gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CULL_DISTANCE)) {
|
||||
if (vertexRangeCulling && gstate_c.Use(GPU_USE_CULL_DISTANCE)) {
|
||||
WRITE(p, " float2 gl_CullDistance : SV_CullDistance0;\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.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_CULL_DISTANCE)) {
|
||||
if (gstate_c.Use(GPU_USE_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);
|
||||
|
||||
@@ -106,23 +106,23 @@ u32 GPU_D3D11::CheckGPUFeatures() const {
|
||||
// Accurate depth is required because the Direct3D API does not support inverse Z.
|
||||
// So we cannot incorrectly use the viewport transform as the depth range on Direct3D.
|
||||
// TODO: Breaks text in PaRappa for some reason?
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_ACCURATE_DEPTH;
|
||||
|
||||
if (draw_->GetDeviceCaps().depthClampSupported)
|
||||
features |= GPU_SUPPORTS_DEPTH_CLAMP;
|
||||
features |= GPU_USE_DEPTH_CLAMP;
|
||||
|
||||
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
|
||||
features |= GPU_SUPPORTS_INSTANCE_RENDERING;
|
||||
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
|
||||
features |= GPU_USE_TEXTURE_FLOAT;
|
||||
features |= GPU_USE_INSTANCE_RENDERING;
|
||||
features |= GPU_USE_TEXTURE_LOD_CONTROL;
|
||||
|
||||
uint32_t fmt4444 = draw_->GetDataFormatSupport(Draw::DataFormat::A4R4G4B4_UNORM_PACK16);
|
||||
uint32_t fmt1555 = draw_->GetDataFormatSupport(Draw::DataFormat::A1R5G5B5_UNORM_PACK16);
|
||||
uint32_t fmt565 = draw_->GetDataFormatSupport(Draw::DataFormat::R5G6B5_UNORM_PACK16);
|
||||
if ((fmt4444 & Draw::FMT_TEXTURE) && (fmt565 & Draw::FMT_TEXTURE) && (fmt1555 & Draw::FMT_TEXTURE)) {
|
||||
features |= GPU_SUPPORTS_16BIT_FORMATS;
|
||||
features |= GPU_USE_16BIT_FORMATS;
|
||||
}
|
||||
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_USE_ACCURATE_DEPTH) != 0) {
|
||||
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
||||
} else if (PSP_CoreParameter().compat.flags().PixelDepthRounding) {
|
||||
// Use fragment rounding on desktop and GLES3, most accurate.
|
||||
@@ -132,7 +132,7 @@ u32 GPU_D3D11::CheckGPUFeatures() const {
|
||||
}
|
||||
|
||||
// The Phantasy Star hack :(
|
||||
if (PSP_CoreParameter().compat.flags().DepthRangeHack && (features & GPU_SUPPORTS_ACCURATE_DEPTH) == 0) {
|
||||
if (PSP_CoreParameter().compat.flags().DepthRangeHack && (features & GPU_USE_ACCURATE_DEPTH) == 0) {
|
||||
features |= GPU_USE_DEPTH_RANGE_HACK;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
dynState_.useBlendColor = false;
|
||||
}
|
||||
|
||||
if (gstate_c.Use(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
keys_.raster.depthClipEnable = !gstate.isDepthClampEnabled() || !gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_16BIT_FORMATS)) {
|
||||
if (!gstate_c.Use(GPU_USE_16BIT_FORMATS)) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,13 +100,13 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
|
||||
u32 GPU_DX9::CheckGPUFeatures() const {
|
||||
u32 features = GPUCommon::CheckGPUFeatures();
|
||||
features |= GPU_SUPPORTS_16BIT_FORMATS;
|
||||
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
|
||||
features |= GPU_USE_16BIT_FORMATS;
|
||||
features |= GPU_USE_TEXTURE_LOD_CONTROL;
|
||||
|
||||
// Accurate depth is required because the Direct3D API does not support inverse Z.
|
||||
// So we cannot incorrectly use the viewport transform as the depth range on Direct3D.
|
||||
// TODO: Breaks text in PaRappa for some reason?
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_ACCURATE_DEPTH;
|
||||
|
||||
auto vendor = draw_->GetDeviceCaps().vendor;
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ void TextureCacheDX9::StartFrame() {
|
||||
Decimate();
|
||||
}
|
||||
|
||||
if (gstate_c.Use(GPU_SUPPORTS_ANISOTROPY)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_USE_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;
|
||||
|
||||
@@ -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.UseAll(GPU_SUPPORTS_VERTEX_TEXTURE_FETCH | GPU_SUPPORTS_TEXTURE_FLOAT | GPU_SUPPORTS_INSTANCE_RENDERING);
|
||||
return hasTexelFetch && gstate_c.UseAll(GPU_USE_VERTEX_TEXTURE_FETCH | GPU_USE_TEXTURE_FLOAT | GPU_USE_INSTANCE_RENDERING);
|
||||
}
|
||||
|
||||
bool DrawEngineGLES::UpdateUseHWTessellation(bool enable) {
|
||||
|
||||
@@ -151,29 +151,29 @@ GPU_GLES::~GPU_GLES() {
|
||||
u32 GPU_GLES::CheckGPUFeatures() const {
|
||||
u32 features = GPUCommon::CheckGPUFeatures();
|
||||
|
||||
features |= GPU_SUPPORTS_16BIT_FORMATS;
|
||||
features |= GPU_USE_16BIT_FORMATS;
|
||||
|
||||
if ((gl_extensions.gpuVendor == GPU_VENDOR_NVIDIA) || (gl_extensions.gpuVendor == GPU_VENDOR_AMD))
|
||||
features |= GPU_PREFER_REVERSE_COLOR_ORDER;
|
||||
|
||||
if (gl_extensions.GLES3 || !gl_extensions.IsGLES)
|
||||
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
|
||||
features |= GPU_USE_TEXTURE_LOD_CONTROL;
|
||||
|
||||
bool canUseInstanceID = gl_extensions.EXT_draw_instanced || gl_extensions.ARB_draw_instanced;
|
||||
bool canDefInstanceID = gl_extensions.IsGLES || gl_extensions.EXT_gpu_shader4 || gl_extensions.VersionGEThan(3, 1);
|
||||
bool instanceRendering = gl_extensions.GLES3 || (canUseInstanceID && canDefInstanceID);
|
||||
if (instanceRendering)
|
||||
features |= GPU_SUPPORTS_INSTANCE_RENDERING;
|
||||
features |= GPU_USE_INSTANCE_RENDERING;
|
||||
|
||||
int maxVertexTextureImageUnits = gl_extensions.maxVertexTextureUnits;
|
||||
if (maxVertexTextureImageUnits >= 3) // At least 3 for hardware tessellation
|
||||
features |= GPU_SUPPORTS_VERTEX_TEXTURE_FETCH;
|
||||
features |= GPU_USE_VERTEX_TEXTURE_FETCH;
|
||||
|
||||
if (gl_extensions.ARB_texture_float || gl_extensions.OES_texture_float)
|
||||
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
|
||||
features |= GPU_USE_TEXTURE_FLOAT;
|
||||
|
||||
if (draw_->GetDeviceCaps().depthClampSupported) {
|
||||
features |= GPU_SUPPORTS_DEPTH_CLAMP | GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_DEPTH_CLAMP | GPU_USE_ACCURATE_DEPTH;
|
||||
// Our implementation of depth texturing needs simple Z range, so can't
|
||||
// use the extension hacks (yet).
|
||||
}
|
||||
@@ -181,13 +181,13 @@ u32 GPU_GLES::CheckGPUFeatures() const {
|
||||
// If we already have a 16-bit depth buffer, we don't need to round.
|
||||
bool prefer24 = draw_->GetDeviceCaps().preferredDepthBufferFormat == Draw::DataFormat::D24_S8;
|
||||
if (prefer24) {
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_USE_ACCURATE_DEPTH) != 0) {
|
||||
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
||||
} else if (PSP_CoreParameter().compat.flags().PixelDepthRounding) {
|
||||
if (!gl_extensions.IsGLES || gl_extensions.GLES3) {
|
||||
// Use fragment rounding on desktop and GLES3, most accurate.
|
||||
features |= GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT;
|
||||
} else if (prefer24 && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
} else if (prefer24 && (features & GPU_USE_ACCURATE_DEPTH) != 0) {
|
||||
// Here we can simulate a 16 bit depth buffer by scaling.
|
||||
// Note that the depth buffer is fixed point, not floating, so dividing by 256 is pretty good.
|
||||
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
||||
@@ -201,7 +201,7 @@ u32 GPU_GLES::CheckGPUFeatures() const {
|
||||
}
|
||||
|
||||
// The Phantasy Star hack :(
|
||||
if (PSP_CoreParameter().compat.flags().DepthRangeHack && (features & GPU_SUPPORTS_ACCURATE_DEPTH) == 0) {
|
||||
if (PSP_CoreParameter().compat.flags().DepthRangeHack && (features & GPU_USE_ACCURATE_DEPTH) == 0) {
|
||||
features |= GPU_USE_DEPTH_RANGE_HACK;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.useFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) != 0;
|
||||
if (!VSID.Bit(VS_BIT_IS_THROUGH) && gstate_c.Use(GPU_SUPPORTS_DEPTH_CLAMP)) {
|
||||
flags.supportDualSource = (gstate_c.useFlags & GPU_USE_DUALSOURCE_BLEND) != 0;
|
||||
if (!VSID.Bit(VS_BIT_IS_THROUGH) && gstate_c.Use(GPU_USE_DEPTH_CLAMP)) {
|
||||
flags.useClipDistance0 = true;
|
||||
if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE))
|
||||
if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_USE_CLIP_DISTANCE))
|
||||
flags.useClipDistance1 = true;
|
||||
} else if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_SUPPORTS_CLIP_DISTANCE)) {
|
||||
} else if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_USE_CLIP_DISTANCE)) {
|
||||
flags.useClipDistance0 = true;
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBu
|
||||
float viewZScale = halfActualZRange;
|
||||
float viewZCenter = minz + halfActualZRange;
|
||||
|
||||
if (!gstate_c.Use(GPU_SUPPORTS_ACCURATE_DEPTH)) {
|
||||
if (!gstate_c.Use(GPU_USE_ACCURATE_DEPTH)) {
|
||||
viewZScale = vpZScale;
|
||||
viewZCenter = vpZCenter;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
|
||||
// TODO: Get rid of the ifdef
|
||||
#ifndef USING_GLES2
|
||||
if (gstate_c.Use(GPU_SUPPORTS_LOGIC_OP)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Use(GPU_USE_DEPTH_CLAMP);
|
||||
} else {
|
||||
// We just want to clip in this case, the clamp would be clipped anyway.
|
||||
depthClampEnable = false;
|
||||
|
||||
@@ -105,7 +105,7 @@ static const GLuint MagFiltGL[2] = {
|
||||
};
|
||||
|
||||
void TextureCacheGLES::ApplySamplingParams(const SamplerCacheKey &key) {
|
||||
if (gstate_c.Use(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
|
||||
if (!gstate_c.Use(GPU_USE_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
|
||||
|
||||
+10
-10
@@ -3285,44 +3285,44 @@ size_t GPUCommon::FormatGPUStatsCommon(char *buffer, size_t size) {
|
||||
u32 GPUCommon::CheckGPUFeatures() const {
|
||||
u32 features = 0;
|
||||
if (draw_->GetDeviceCaps().logicOpSupported) {
|
||||
features |= GPU_SUPPORTS_LOGIC_OP;
|
||||
features |= GPU_USE_LOGIC_OP;
|
||||
}
|
||||
if (draw_->GetDeviceCaps().anisoSupported) {
|
||||
features |= GPU_SUPPORTS_ANISOTROPY;
|
||||
features |= GPU_USE_ANISOTROPY;
|
||||
}
|
||||
if (draw_->GetDeviceCaps().textureNPOTFullySupported) {
|
||||
features |= GPU_SUPPORTS_TEXTURE_NPOT;
|
||||
features |= GPU_USE_TEXTURE_NPOT;
|
||||
}
|
||||
if (draw_->GetDeviceCaps().dualSourceBlend) {
|
||||
if (!g_Config.bVendorBugChecksEnabled || !draw_->GetBugs().Has(Draw::Bugs::DUAL_SOURCE_BLENDING_BROKEN)) {
|
||||
features |= GPU_SUPPORTS_DUALSOURCE_BLEND;
|
||||
features |= GPU_USE_DUALSOURCE_BLEND;
|
||||
}
|
||||
}
|
||||
if (draw_->GetDeviceCaps().blendMinMaxSupported) {
|
||||
features |= GPU_SUPPORTS_BLEND_MINMAX;
|
||||
features |= GPU_USE_BLEND_MINMAX;
|
||||
}
|
||||
|
||||
if (draw_->GetDeviceCaps().clipDistanceSupported) {
|
||||
features |= GPU_SUPPORTS_CLIP_DISTANCE;
|
||||
features |= GPU_USE_CLIP_DISTANCE;
|
||||
}
|
||||
|
||||
if (draw_->GetDeviceCaps().cullDistanceSupported) {
|
||||
features |= GPU_SUPPORTS_CULL_DISTANCE;
|
||||
features |= GPU_USE_CULL_DISTANCE;
|
||||
}
|
||||
|
||||
if (draw_->GetDeviceCaps().textureDepthSupported) {
|
||||
features |= GPU_SUPPORTS_DEPTH_TEXTURE;
|
||||
features |= GPU_USE_DEPTH_TEXTURE;
|
||||
}
|
||||
|
||||
bool canClipOrCull = draw_->GetDeviceCaps().clipDistanceSupported || draw_->GetDeviceCaps().cullDistanceSupported;
|
||||
bool canDiscardVertex = draw_->GetBugs().Has(Draw::Bugs::BROKEN_NAN_IN_CONDITIONAL);
|
||||
if (canClipOrCull || canDiscardVertex) {
|
||||
// We'll dynamically use the parts that are supported, to reduce artifacts as much as possible.
|
||||
features |= GPU_SUPPORTS_VS_RANGE_CULLING;
|
||||
features |= GPU_USE_VS_RANGE_CULLING;
|
||||
}
|
||||
|
||||
if (draw_->GetDeviceCaps().framebufferFetchSupported) {
|
||||
features |= GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH;
|
||||
features |= GPU_USE_ANY_FRAMEBUFFER_FETCH;
|
||||
}
|
||||
|
||||
if (draw_->GetShaderLanguageDesc().bitwiseOps) {
|
||||
|
||||
+18
-18
@@ -471,35 +471,35 @@ struct UVScale {
|
||||
// to centralize into flags like this. They're also fast to check since the cache line
|
||||
// will be hot.
|
||||
enum {
|
||||
GPU_SUPPORTS_DUALSOURCE_BLEND = FLAG_BIT(0),
|
||||
GPU_USE_DUALSOURCE_BLEND = FLAG_BIT(0),
|
||||
GPU_USE_LIGHT_UBERSHADER = FLAG_BIT(1),
|
||||
GPU_USE_FRAGMENT_TEST_CACHE = FLAG_BIT(2),
|
||||
GPU_SUPPORTS_VS_RANGE_CULLING = FLAG_BIT(3),
|
||||
GPU_SUPPORTS_BLEND_MINMAX = FLAG_BIT(4),
|
||||
GPU_SUPPORTS_LOGIC_OP = FLAG_BIT(5),
|
||||
GPU_USE_VS_RANGE_CULLING = FLAG_BIT(3),
|
||||
GPU_USE_BLEND_MINMAX = FLAG_BIT(4),
|
||||
GPU_USE_LOGIC_OP = FLAG_BIT(5),
|
||||
GPU_USE_DEPTH_RANGE_HACK = FLAG_BIT(6),
|
||||
// Free bit: 7
|
||||
GPU_SUPPORTS_ANISOTROPY = FLAG_BIT(8),
|
||||
GPU_USE_ANISOTROPY = FLAG_BIT(8),
|
||||
GPU_USE_CLEAR_RAM_HACK = FLAG_BIT(9),
|
||||
GPU_SUPPORTS_INSTANCE_RENDERING = FLAG_BIT(10),
|
||||
GPU_SUPPORTS_VERTEX_TEXTURE_FETCH = FLAG_BIT(11),
|
||||
GPU_SUPPORTS_TEXTURE_FLOAT = FLAG_BIT(12),
|
||||
GPU_SUPPORTS_16BIT_FORMATS = FLAG_BIT(13),
|
||||
GPU_SUPPORTS_DEPTH_CLAMP = FLAG_BIT(14),
|
||||
GPU_USE_INSTANCE_RENDERING = FLAG_BIT(10),
|
||||
GPU_USE_VERTEX_TEXTURE_FETCH = FLAG_BIT(11),
|
||||
GPU_USE_TEXTURE_FLOAT = FLAG_BIT(12),
|
||||
GPU_USE_16BIT_FORMATS = FLAG_BIT(13),
|
||||
GPU_USE_DEPTH_CLAMP = FLAG_BIT(14),
|
||||
// Free bit: 15
|
||||
GPU_SUPPORTS_DEPTH_TEXTURE = FLAG_BIT(16),
|
||||
GPU_SUPPORTS_ACCURATE_DEPTH = FLAG_BIT(17),
|
||||
GPU_SUPPORTS_GS_CULLING = FLAG_BIT(18), // Geometry shader
|
||||
GPU_USE_DEPTH_TEXTURE = FLAG_BIT(16),
|
||||
GPU_USE_ACCURATE_DEPTH = FLAG_BIT(17),
|
||||
GPU_USE_GS_CULLING = FLAG_BIT(18), // Geometry shader
|
||||
// Free bit: 19
|
||||
GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH = FLAG_BIT(20),
|
||||
GPU_USE_ANY_FRAMEBUFFER_FETCH = FLAG_BIT(20),
|
||||
GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT = FLAG_BIT(21),
|
||||
GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT = FLAG_BIT(22),
|
||||
GPU_ROUND_DEPTH_TO_16BIT = FLAG_BIT(23), // Can be disabled either per game or if we use a real 16-bit depth buffer
|
||||
GPU_SUPPORTS_TEXTURE_LOD_CONTROL = FLAG_BIT(24),
|
||||
GPU_USE_TEXTURE_LOD_CONTROL = FLAG_BIT(24),
|
||||
// Free bits: 25-27
|
||||
GPU_SUPPORTS_TEXTURE_NPOT = FLAG_BIT(28),
|
||||
GPU_SUPPORTS_CLIP_DISTANCE = FLAG_BIT(29),
|
||||
GPU_SUPPORTS_CULL_DISTANCE = FLAG_BIT(30),
|
||||
GPU_USE_TEXTURE_NPOT = FLAG_BIT(28),
|
||||
GPU_USE_CLIP_DISTANCE = FLAG_BIT(29),
|
||||
GPU_USE_CULL_DISTANCE = FLAG_BIT(30),
|
||||
GPU_PREFER_REVERSE_COLOR_ORDER = FLAG_BIT(31),
|
||||
};
|
||||
|
||||
|
||||
@@ -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.Use(GPU_SUPPORTS_GS_CULLING))
|
||||
if (gstate_c.Use(GPU_USE_GS_CULLING))
|
||||
bindings[3].stageFlags |= VK_SHADER_STAGE_GEOMETRY_BIT;
|
||||
bindings[3].binding = DRAW_BINDING_DYNUBO_BASE;
|
||||
bindings[4].descriptorCount = 1;
|
||||
|
||||
+15
-15
@@ -190,11 +190,11 @@ u32 GPU_Vulkan::CheckGPUFeatures() const {
|
||||
switch (vulkan->GetPhysicalDeviceProperties().properties.vendorID) {
|
||||
case VULKAN_VENDOR_AMD:
|
||||
// Accurate depth is required on AMD (due to reverse-Z driver bug) so we ignore the compat flag to disable it on those. See #9545
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_ACCURATE_DEPTH;
|
||||
break;
|
||||
case VULKAN_VENDOR_QUALCOMM:
|
||||
// Accurate depth is required on Adreno too (seems to also have a reverse-Z driver bug).
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_ACCURATE_DEPTH;
|
||||
break;
|
||||
case VULKAN_VENDOR_ARM:
|
||||
{
|
||||
@@ -206,40 +206,40 @@ u32 GPU_Vulkan::CheckGPUFeatures() const {
|
||||
|| VK_VERSION_MAJOR(vulkan->GetPhysicalDeviceProperties().properties.driverVersion) < 14;
|
||||
|
||||
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth || driverTooOld) {
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_ACCURATE_DEPTH;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth) {
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
features |= GPU_USE_ACCURATE_DEPTH;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Might enable this later - in the first round we are mostly looking at depth/stencil/discard.
|
||||
// if (!g_Config.bEnableVendorBugChecks)
|
||||
// features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
// features |= GPU_USE_ACCURATE_DEPTH;
|
||||
|
||||
// Mandatory features on Vulkan, which may be checked in "centralized" code
|
||||
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
|
||||
features |= GPU_SUPPORTS_INSTANCE_RENDERING;
|
||||
features |= GPU_SUPPORTS_VERTEX_TEXTURE_FETCH;
|
||||
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
|
||||
features |= GPU_USE_TEXTURE_LOD_CONTROL;
|
||||
features |= GPU_USE_INSTANCE_RENDERING;
|
||||
features |= GPU_USE_VERTEX_TEXTURE_FETCH;
|
||||
features |= GPU_USE_TEXTURE_FLOAT;
|
||||
|
||||
auto &enabledFeatures = vulkan->GetDeviceFeatures().enabled;
|
||||
if (enabledFeatures.depthClamp) {
|
||||
features |= GPU_SUPPORTS_DEPTH_CLAMP;
|
||||
features |= GPU_USE_DEPTH_CLAMP;
|
||||
}
|
||||
|
||||
// Fall back to geometry shader culling if we can't do vertex range culling.
|
||||
if (enabledFeatures.geometryShader) {
|
||||
const bool useGeometry = g_Config.bUseGeometryShader && !draw_->GetBugs().Has(Draw::Bugs::GEOMETRY_SHADERS_SLOW_OR_BROKEN);
|
||||
const bool vertexSupported = draw_->GetDeviceCaps().clipDistanceSupported && draw_->GetDeviceCaps().cullDistanceSupported;
|
||||
if (useGeometry && (!vertexSupported || (features & GPU_SUPPORTS_VS_RANGE_CULLING) == 0)) {
|
||||
if (useGeometry && (!vertexSupported || (features & GPU_USE_VS_RANGE_CULLING) == 0)) {
|
||||
// Switch to culling via the geometry shader if not fully supported in vertex.
|
||||
features |= GPU_SUPPORTS_GS_CULLING;
|
||||
features &= ~GPU_SUPPORTS_VS_RANGE_CULLING;
|
||||
features |= GPU_USE_GS_CULLING;
|
||||
features &= ~GPU_USE_VS_RANGE_CULLING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,12 +252,12 @@ u32 GPU_Vulkan::CheckGPUFeatures() const {
|
||||
// if it's not available, for simplicity.
|
||||
uint32_t fmt565 = draw_->GetDataFormatSupport(Draw::DataFormat::B5G6R5_UNORM_PACK16);
|
||||
if ((fmt4444 & Draw::FMT_TEXTURE) && (fmt565 & Draw::FMT_TEXTURE) && (fmt1555 & Draw::FMT_TEXTURE)) {
|
||||
features |= GPU_SUPPORTS_16BIT_FORMATS;
|
||||
features |= GPU_USE_16BIT_FORMATS;
|
||||
} else {
|
||||
INFO_LOG(G3D, "Deficient texture format support: 4444: %d 1555: %d 565: %d", fmt4444, fmt1555, fmt565);
|
||||
}
|
||||
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_USE_ACCURATE_DEPTH) != 0) {
|
||||
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
||||
}
|
||||
else if (PSP_CoreParameter().compat.flags().PixelDepthRounding) {
|
||||
|
||||
@@ -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.Use(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
key.depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_16BIT_FORMATS)) {
|
||||
if (!gstate_c.Use(GPU_USE_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.Use(GPU_SUPPORTS_16BIT_FORMATS) || scaleFactor > 1 || dstFmt == VULKAN_8888_FORMAT) {
|
||||
if (!gstate_c.Use(GPU_USE_16BIT_FORMATS) || scaleFactor > 1 || dstFmt == VULKAN_8888_FORMAT) {
|
||||
texDecFlags |= TexDecodeFlags::EXPAND32;
|
||||
}
|
||||
if (entry.status & TexCacheEntry::STATUS_CLUT_GPU) {
|
||||
|
||||
Reference in new issue
Block a user