Conditionally disable use of texelFetch() in shaders

This commit is contained in:
baldurk
2016-02-10 17:07:54 +01:00
parent 814dfddf0d
commit 3db724294f
2 changed files with 14 additions and 4 deletions
+10 -2
View File
@@ -48,6 +48,9 @@ vec4 SampleTextureFloat4(int type, vec2 pos, float slice, int mipLevel, int samp
}
else if (type == RESTYPE_TEX2DMS)
{
col = vec4(0, 0, 0, 0);
#ifndef NO_TEXEL_FETCH
if(sampleIdx < 0)
{
int sampleCount = -sampleIdx;
@@ -64,6 +67,7 @@ vec4 SampleTextureFloat4(int type, vec2 pos, float slice, int mipLevel, int samp
{
col = texelFetch(tex2DMS, ivec2(pos), sampleIdx);
}
#endif
}
return col;
@@ -79,8 +83,9 @@ layout (binding = 14) uniform usampler2DMS texUInt2DMS;
uvec4 SampleTextureUInt4(int type, vec2 pos, float slice, int mipLevel, int sampleIdx, vec3 texRes)
{
uvec4 col;
uvec4 col = uvec4(0, 0, 0, 0);
#ifndef NO_TEXEL_FETCH
if (type == RESTYPE_TEX1D)
{
col = texelFetch(texUInt1DArray, ivec2(pos.x, slice), mipLevel);
@@ -100,6 +105,7 @@ uvec4 SampleTextureUInt4(int type, vec2 pos, float slice, int mipLevel, int samp
col = texelFetch(texUInt2DMS, ivec2(pos), sampleIdx);
}
#endif
return col;
}
@@ -114,8 +120,9 @@ layout (binding = 19) uniform isampler2DMS texSInt2DMS;
ivec4 SampleTextureSInt4(int type, vec2 pos, float slice, int mipLevel, int sampleIdx, vec3 texRes)
{
ivec4 col;
ivec4 col = ivec4(0, 0, 0, 0);
#ifndef NO_TEXEL_FETCH
if (type == RESTYPE_TEX1D)
{
col = texelFetch(texSInt1DArray, ivec2(pos.x, slice), mipLevel);
@@ -135,6 +142,7 @@ ivec4 SampleTextureSInt4(int type, vec2 pos, float slice, int mipLevel, int samp
col = texelFetch(texSInt2DMS, ivec2(pos), sampleIdx);
}
#endif
return col;
}
+4 -2
View File
@@ -720,9 +720,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev)
RDCASSERT(err.empty() && m_FixedColSPIRV);
sources.resize(4);
sources[0] = "#version 430 core\n";
sources[1] = GetEmbeddedResource(spv_debuguniforms_h);
sources[2] = ""; // #defines/#includes
for(size_t i=0; i < ARRAY_COUNT(module); i++)
{
@@ -731,6 +729,8 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev)
continue;
sources[0] = "#version 430 core\n";
if(m_pDriver->IsAMD())
sources[0] += "#define NO_TEXEL_FETCH\n";
sources[2] = "";
sources[3] = shaderSources[i];
@@ -997,6 +997,8 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev)
sources.resize(5);
sources[0] = "#version 430 core\n";
if(m_pDriver->IsAMD())
sources[0] += "#define NO_TEXEL_FETCH\n";
sources[1] = GetEmbeddedResource(spv_debuguniforms_h);
sources[2] = GetEmbeddedResource(spv_texsample_h);