Moved check for depth texture and shadowXY emission completely to legacy_tex_op()

This commit is contained in:
Sidney Just 2018-06-22 01:40:01 -07:00
parent 447a253ce7
commit 0f62b5dc1e

View File

@ -3542,47 +3542,43 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp
require_extension_internal("GL_ARB_shader_texture_lod"); require_extension_internal("GL_ARB_shader_texture_lod");
} }
// texture std::string type_prefix = imgtype.image.depth ? "shadow" : "texture";
if (op == "texture") if (op == "texture")
return join("texture", type); return join(type_prefix, type);
else if (op == "textureLod") else if (op == "textureLod")
{ {
if (use_explicit_lod) if (use_explicit_lod)
return join("texture", type, is_legacy_es() ? "LodEXT" : "Lod"); return join(type_prefix, type, is_legacy_es() ? "LodEXT" : "Lod");
else else
return join("texture", type); return join(type_prefix, type);
} }
else if (op == "textureProj") else if (op == "textureProj")
return join("texture", type, "Proj"); return join(type_prefix, type, "Proj");
else if (op == "textureGrad") else if (op == "textureGrad")
return join("texture", type, is_legacy_es() ? "GradEXT" : is_legacy_desktop() ? "GradARB" : "Grad"); return join(type_prefix, type, is_legacy_es() ? "GradEXT" : is_legacy_desktop() ? "GradARB" : "Grad");
else if (op == "textureProjLod") else if (op == "textureProjLod")
{ {
if (use_explicit_lod) if (use_explicit_lod)
return join("texture", type, is_legacy_es() ? "ProjLodEXT" : "ProjLod"); return join(type_prefix, type, is_legacy_es() ? "ProjLodEXT" : "ProjLod");
else else
return join("texture", type); return join(type_prefix, type);
} }
// shadow else if (op == "textureLodOffset")
else if (op == "shadow")
return join("shadow", type);
else if (op == "shadowLodOffset")
{ {
if (use_explicit_lod) if (use_explicit_lod)
return join("shadow", type, "LodOffset"); return join(type_prefix, type, "LodOffset");
else else
return join("shadow", type); return join(type_prefix, type);
} }
else if (op == "shadowProjGrad") else if (op == "textureProjGrad")
return join("shadow", type, "ProjGrad"); return join(type_prefix, type, "ProjGrad");
else if (op == "shadowGrad") else if (op == "textureProjLodOffset")
return join("shadow", type, "Grad");
else if (op == "shadowProjLodOffset")
{ {
if (use_explicit_lod) if (use_explicit_lod)
return join("shadow", type, "ProjLodOffset"); return join(type_prefix, type, "ProjLodOffset");
else else
return join("shadow", type); return join(type_prefix, type);
} }
else else
{ {
@ -3994,10 +3990,7 @@ string CompilerGLSL::to_function_name(uint32_t, const SPIRType &imgtype, bool is
fname += "texelFetch"; fname += "texelFetch";
else else
{ {
if (is_legacy() && ((imgtype.basetype == SPIRType::SampledImage) || (imgtype.basetype == SPIRType::Sampler)) && imgtype.image.depth) fname += "texture";
fname += "shadow";
else
fname += "texture";
if (is_gather) if (is_gather)
fname += "Gather"; fname += "Gather";