mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 01:16:31 +00:00
Workaround for ARM bug if declaring UBOs with larger binding than set
* If the descriptor set only declares bindings 0 and 1, then a declared UBO with binding 2 - even if unused by the shader - will crash the driver. * As a workaround for now we just #define out these UBOs unless compiling a pipeline that requires them. * On OpenGL we just define the macro always, since this isn't needed.
This commit is contained in:
@@ -74,6 +74,9 @@ struct Vec4u
|
||||
|
||||
#define OPENGL 1
|
||||
|
||||
#define FONT_UBOS
|
||||
#define HISTOGRAM_UBOS
|
||||
|
||||
#ifdef GL_ES
|
||||
#define OPENGL_ES 1
|
||||
#endif
|
||||
@@ -96,23 +99,6 @@ precision PRECISION int;
|
||||
|
||||
#endif
|
||||
|
||||
BINDING(2) uniform HistogramUBOData
|
||||
{
|
||||
uint HistogramChannels;
|
||||
float HistogramMin;
|
||||
float HistogramMax;
|
||||
uint HistogramFlags;
|
||||
|
||||
float HistogramSlice;
|
||||
int HistogramMip;
|
||||
int HistogramSample;
|
||||
int HistogramNumSamples;
|
||||
|
||||
vec3 HistogramTextureResolution;
|
||||
float Padding3;
|
||||
}
|
||||
INST_NAME(histogram_minmax);
|
||||
|
||||
BINDING(0) uniform MeshUBOData
|
||||
{
|
||||
mat4 mvp;
|
||||
@@ -136,6 +122,32 @@ BINDING(0) uniform OutlineUBOData
|
||||
}
|
||||
INST_NAME(outline);
|
||||
|
||||
BINDING(0) uniform TexDisplayUBOData
|
||||
{
|
||||
vec2 Position;
|
||||
float Scale;
|
||||
float HDRMul;
|
||||
|
||||
vec4 Channels;
|
||||
|
||||
float RangeMinimum;
|
||||
float InverseRangeSize;
|
||||
int MipLevel;
|
||||
int FlipY;
|
||||
|
||||
vec3 TextureResolutionPS;
|
||||
int OutputDisplayFormat;
|
||||
|
||||
vec2 OutputRes;
|
||||
int RawOutput;
|
||||
float Slice;
|
||||
|
||||
int SampleIdx;
|
||||
float MipShift;
|
||||
vec2 Padding;
|
||||
}
|
||||
INST_NAME(texdisplay);
|
||||
|
||||
BINDING(0) uniform FontUBOData
|
||||
{
|
||||
vec2 TextPosition;
|
||||
@@ -166,6 +178,11 @@ BINDING(0) uniform MeshPickUBOData
|
||||
}
|
||||
INST_NAME(meshpick);
|
||||
|
||||
// the ARM driver is buggy and crashes if we declare UBOs that don't correspond to descriptors,
|
||||
// even if they are completely unused. So we need to #define out these global UBOs
|
||||
|
||||
#if defined(FONT_UBOS) || defined(__cplusplus)
|
||||
|
||||
struct FontGlyphData
|
||||
{
|
||||
vec4 posdata;
|
||||
@@ -189,31 +206,28 @@ BINDING(2) uniform StringUBOData
|
||||
}
|
||||
INST_NAME(str);
|
||||
|
||||
BINDING(0) uniform TexDisplayUBOData
|
||||
#endif
|
||||
|
||||
#if defined(HISTOGRAM_UBOS) || defined(__cplusplus)
|
||||
|
||||
BINDING(2) uniform HistogramUBOData
|
||||
{
|
||||
vec2 Position;
|
||||
float Scale;
|
||||
float HDRMul;
|
||||
uint HistogramChannels;
|
||||
float HistogramMin;
|
||||
float HistogramMax;
|
||||
uint HistogramFlags;
|
||||
|
||||
vec4 Channels;
|
||||
float HistogramSlice;
|
||||
int HistogramMip;
|
||||
int HistogramSample;
|
||||
int HistogramNumSamples;
|
||||
|
||||
float RangeMinimum;
|
||||
float InverseRangeSize;
|
||||
int MipLevel;
|
||||
int FlipY;
|
||||
|
||||
vec3 TextureResolutionPS;
|
||||
int OutputDisplayFormat;
|
||||
|
||||
vec2 OutputRes;
|
||||
int RawOutput;
|
||||
float Slice;
|
||||
|
||||
int SampleIdx;
|
||||
float MipShift;
|
||||
vec2 Padding;
|
||||
vec3 HistogramTextureResolution;
|
||||
float Padding3;
|
||||
}
|
||||
INST_NAME(texdisplay);
|
||||
INST_NAME(histogram_minmax);
|
||||
|
||||
#endif
|
||||
|
||||
// some constants available to both C++ and GLSL for configuring display
|
||||
#define CUBEMAP_FACE_POS_X 0
|
||||
|
||||
@@ -2238,6 +2238,7 @@ void VulkanReplay::HistogramMinMax::Init(WrappedVulkan *driver, VkDescriptorPool
|
||||
defines += string("#define SHADER_RESTYPE ") + ToStr(t) + "\n";
|
||||
defines += string("#define UINT_TEX ") + (f == 1 ? "1" : "0") + "\n";
|
||||
defines += string("#define SINT_TEX ") + (f == 2 ? "1" : "0") + "\n";
|
||||
defines += "#define HISTOGRAM_UBOS\n";
|
||||
|
||||
GenerateGLSLShader(sources, eShaderVulkan, defines, GetEmbeddedResource(glsl_histogram_comp),
|
||||
430);
|
||||
|
||||
@@ -154,6 +154,9 @@ VulkanShaderCache::VulkanShaderCache(WrappedVulkan *driver)
|
||||
if(driverVersion.TexelFetchBrokenDriver())
|
||||
defines += "#define NO_TEXEL_FETCH\n";
|
||||
|
||||
if(config.builtin == BuiltinShader::TextVS || config.builtin == BuiltinShader::TextFS)
|
||||
defines += "#define FONT_UBOS\n";
|
||||
|
||||
GenerateGLSLShader(sources, eShaderVulkan, defines, GetDynamicEmbeddedResource(config.resource),
|
||||
430, config.uniforms);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user