Skip to content

zink: Cap PIPE_SHADER_CAP_MAX_CONST_BUFFERS to 32

PIPE_MAX_CONSTANT_BUFFERS is 32, however many Vulkan implementations has maxPerStageDescriptorUniformBuffers that exceeds it, for example:

radv 8388606, anv 64 nvidia 1048580 for RTX 2000 and up.

and, together with the current zink logic, the returned value will exceed the maximum allowed value for the cap.

This causes cso_destroy_context to pass big values back to zink (via zink_set_constant_buffer), resulting in access beyond end of allocated buffer for all UBOs.

Cap the cap to PIPE_MAX_CONSTANT_BUFFERS (32), not INT_MAX.

Add an assert to verify future drivers.

Edited by Witold Baryluk

Merge request reports