vk oit: work around adreno 600 driver regression
Android 11 adreno 600 driver v502: PixelBuffer.pixels.length() is returning 0 in some cases. Issue #361
This commit is contained in:
parent
22947af854
commit
d75072362a
|
@ -262,6 +262,8 @@ bool OITDrawer::Draw(const Texture *fogTexture, const Texture *paletteTexture)
|
|||
|
||||
OITDescriptorSets::FragmentShaderUniforms fragUniforms = MakeFragmentUniforms<OITDescriptorSets::FragmentShaderUniforms>();
|
||||
fragUniforms.shade_scale_factor = FPU_SHAD_SCALE.scale_factor / 256.f;
|
||||
// sizeof(Pixel) == 16
|
||||
fragUniforms.pixelBufferSize = std::min<u64>(config::PixelBufferSize, GetContext()->GetMaxMemoryAllocationSize()) / 16;
|
||||
|
||||
currentScissor = vk::Rect2D();
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
float cp_AlphaTestValue;
|
||||
float sp_FOG_DENSITY;
|
||||
float shade_scale_factor; // new for OIT
|
||||
u32 pixelBufferSize;
|
||||
};
|
||||
|
||||
struct PushConstants
|
||||
|
|
|
@ -69,6 +69,7 @@ layout (std140, set = 0, binding = 1) uniform FragmentShaderUniforms
|
|||
float cp_AlphaTestValue;
|
||||
float sp_FOG_DENSITY;
|
||||
float shade_scale_factor;
|
||||
uint pixelBufferSize;
|
||||
} uniformBuffer;
|
||||
|
||||
layout(set = 3, binding = 2, r32ui) uniform coherent restrict uimage2D abufferPointerImg;
|
||||
|
@ -87,7 +88,10 @@ layout (set = 3, binding = 0, std430) coherent restrict buffer PixelBuffer_ {
|
|||
uint getNextPixelIndex()
|
||||
{
|
||||
uint index = atomicAdd(PixelCounter.buffer_index, 1);
|
||||
if (index >= PixelBuffer.pixels.length())
|
||||
// we should be able to simply use PixelBuffer.pixels.length()
|
||||
// but a regression in the adreno 600 driver (v502) forces us
|
||||
// to use a uniform.
|
||||
if (index >= uniformBuffer.pixelBufferSize)
|
||||
// Buffer overflow
|
||||
discard;
|
||||
|
||||
|
|
Loading…
Reference in New Issue