Workaround ARM driver bug, hide UBOs unless they're used. Closes #1225

This commit is contained in:
baldurk
2019-01-04 12:26:30 +00:00
parent b0ff17ba08
commit 18958fedd0
2 changed files with 27 additions and 18 deletions
+23 -18
View File
@@ -70,6 +70,7 @@
#define OPENGL 1
#define HISTOGRAM_UBOS
#define HEATMAP_UBO
#ifdef GL_ES
#define OPENGL_ES 1
@@ -146,24 +147,6 @@ BINDING(0) uniform TexDisplayUBOData
}
INST_NAME(texdisplay);
#define HEATMAP_DISABLED 0
#define HEATMAP_LINEAR 1
#define HEATMAP_TRISIZE 2
#define HEATMAP_RAMPSIZE 22
BINDING(1) uniform HeatmapData
{
int HeatmapMode;
int DummyA;
int DummyB;
int DummyC;
// must match size of colorRamp on C++ side
vec4 ColorRamp[22];
}
INST_NAME(heatmap);
BINDING(0) uniform FontUBOData
{
vec2 TextPosition;
@@ -224,6 +207,28 @@ INST_NAME(str);
#endif
#define HEATMAP_DISABLED 0
#define HEATMAP_LINEAR 1
#define HEATMAP_TRISIZE 2
#define HEATMAP_RAMPSIZE 22
#if defined(HEATMAP_UBO) || defined(__cplusplus)
BINDING(1) uniform HeatmapData
{
int HeatmapMode;
int DummyA;
int DummyB;
int DummyC;
// must match size of colorRamp on C++ side
vec4 ColorRamp[22];
}
INST_NAME(heatmap);
#endif
#if defined(HISTOGRAM_UBOS) || defined(__cplusplus)
BINDING(2) uniform HistogramUBOData
@@ -170,9 +170,13 @@ VulkanShaderCache::VulkanShaderCache(WrappedVulkan *driver)
if(driverVersion.TexelFetchBrokenDriver())
defines += "#define NO_TEXEL_FETCH\n";
// add UBO definitions as needed, to workaround ARM bug
if(config.builtin == BuiltinShader::TextVS || config.builtin == BuiltinShader::TextFS)
defines += "#define FONT_UBOS\n";
if(config.builtin == BuiltinShader::TexDisplayFS)
defines += "#define HEATMAP_UBO\n";
GenerateGLSLShader(sources, eShaderVulkan, defines, GetDynamicEmbeddedResource(config.resource),
430, config.uniforms);