Skip to content

Commit

Permalink
Shadergen fix for OpenGL
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Oct 27, 2022
1 parent 1da6d29 commit e058f8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions GPU/Common/FragmentShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
*errorString = "Invalid combination of 3D texture and array texture, shouldn't happen";
return false;
}
if (compat.shaderLanguage != ShaderLanguage::GLSL_VULKAN && arrayTexture) {
*errorString = "We only do array textures for framebuffers in Vulkan.";
return false;
}

bool flatBug = bugs.Has(Draw::Bugs::BROKEN_FLAT_IN_SHADER) && g_Config.bVendorBugChecksEnabled;

Expand Down Expand Up @@ -660,6 +664,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
WRITE(p, " vec4 t = %s(tex, vec3(%s.xy, u_mipBias));\n", compat.texture3D, texcoord);
}
} else if (arrayTexture) {
_dbg_assert_(compat.shaderLanguage == GLSL_VULKAN);
// Used for stereo rendering.
const char *arrayIndex = useStereo ? "float(gl_ViewIndex)" : "0.0";
if (doTextureProjection) {
Expand Down
4 changes: 2 additions & 2 deletions GPU/Common/ShaderId.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip
id.SetBit(FS_BIT_FLATSHADE, doFlatShading);
id.SetBit(FS_BIT_COLOR_WRITEMASK, colorWriteMask);

// All framebuffers are array textures now.
if (gstate_c.arrayTexture) {
// All framebuffers are array textures in Vulkan now.
if (gstate_c.arrayTexture && g_Config.iGPUBackend == (int)GPUBackend::VULKAN) {
id.SetBit(FS_BIT_SAMPLE_ARRAY_TEXTURE);
}

Expand Down

0 comments on commit e058f8a

Please sign in to comment.