Fix compiling pixel history shaders on GLES breaking

This commit is contained in:
baldurk committed 2025-04-29 12:09:38 +01:00
1 parent 395d8079e6
commit 8e86f79c72
2 files changed
+18 -11

No files matched your search

@@ -72,7 +72,7 @@ void main()
float depth = 0.0;
if(hasDepth == 1)
depth = texelFetch(depthMS, loc, currentSample).r;
uint stencil = 0;
uint stencil = 0u;
if(hasStencil == 1)
stencil = texelFetch(stencilMS, loc, currentSample).r;
dest.result[dstOffset] = uvec4(floatBitsToUint(depth), stencil, 0, 0);
+17 -10
View File
@@ -584,29 +584,36 @@ bool PixelHistorySetupResources(WrappedOpenGL *driver, GLPixelHistoryResources &
// If the GLSL version is greater than or equal to 330, we can use IntBitsToFloat, otherwise we
// need to write the float value directly.
ShaderType shaderType = IsGLES ? ShaderType::GLSLES : ShaderType::GLSL;
rdcstr glslSource;
if(glslVersion >= 330)
if(glslVersion >= 330 || (IsGLES && glslVersion >= 300))
{
glslSource = GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_primid_frag),
ShaderType::GLSL, glslVersion);
glslSource = GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_primid_frag), shaderType,
glslVersion);
}
else
{
glslSource =
GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_primid_frag), ShaderType::GLSL,
glslVersion, "#define INT_BITS_TO_FLOAT_NOT_SUPPORTED\n");
glslSource = GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_primid_frag), shaderType,
glslVersion, "#define INT_BITS_TO_FLOAT_NOT_SUPPORTED\n");
}
// SPIR-V shaders are always generated as desktop GL 430, for ease
rdcstr spirvSource = GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_primid_frag),
ShaderType::GLSPIRV, 430);
rdcstr msCopySource =
GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_mscopy_comp), ShaderType::GLSL, 430);
rdcstr msCopySource = GenerateGLSLShader(GetEmbeddedResource(glsl_pixelhistory_mscopy_comp),
shaderType, glslVersion);
rdcstr msCopySourceDepth = GenerateGLSLShader(
GetEmbeddedResource(glsl_pixelhistory_mscopy_depth_comp), ShaderType::GLSL, 430);
resources.primitiveIdFragmentShaderSPIRV = CreateSPIRVShader(eGL_FRAGMENT_SHADER, spirvSource);
GetEmbeddedResource(glsl_pixelhistory_mscopy_depth_comp), shaderType, glslVersion);
if(HasExt[ARB_gl_spirv])
resources.primitiveIdFragmentShaderSPIRV = CreateSPIRVShader(eGL_FRAGMENT_SHADER, spirvSource);
resources.primitiveIdFragmentShader = CreateShader(eGL_FRAGMENT_SHADER, glslSource);
resources.msCopyComputeProgram = CreateCShaderProgram(msCopySource);
resources.msCopyDepthComputeProgram = CreateCShaderProgram(msCopySourceDepth);
return true;
}