mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 06:44:27 +08:00
GPU: Metal: Rebind storage buffers when changing the pipeline moves them.
This commit is contained in:
committed by
Sam Lantinga
parent
9092ddff3c
commit
73c9f25867
@@ -2409,6 +2409,7 @@ static void METAL_BindGraphicsPipeline(
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
|
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
|
||||||
|
MetalGraphicsPipeline *previousPipeline = metalCommandBuffer->graphics_pipeline;
|
||||||
MetalGraphicsPipeline *pipeline = (MetalGraphicsPipeline *)graphicsPipeline;
|
MetalGraphicsPipeline *pipeline = (MetalGraphicsPipeline *)graphicsPipeline;
|
||||||
SDL_GPURasterizerState *rast = &pipeline->rasterizerState;
|
SDL_GPURasterizerState *rast = &pipeline->rasterizerState;
|
||||||
Uint32 i;
|
Uint32 i;
|
||||||
@@ -2453,6 +2454,17 @@ static void METAL_BindGraphicsPipeline(
|
|||||||
metalCommandBuffer);
|
metalCommandBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (previousPipeline && previousPipeline != pipeline) {
|
||||||
|
// if the number of uniform buffers has changed, the storage buffers will move as well
|
||||||
|
// and need a rebind at their new locations
|
||||||
|
if (previousPipeline->header.num_vertex_uniform_buffers != pipeline->header.num_vertex_uniform_buffers) {
|
||||||
|
metalCommandBuffer->needVertexStorageBufferBind = true;
|
||||||
|
}
|
||||||
|
if (previousPipeline->header.num_fragment_uniform_buffers != pipeline->header.num_fragment_uniform_buffers) {
|
||||||
|
metalCommandBuffer->needFragmentStorageBufferBind = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user