From 93d81966e3da15fc824a0e8b468723623e38a9a4 Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Sun, 8 Jun 2025 15:26:06 -0400 Subject: [PATCH] allow binding uniform at set --- .../metal/src/core/commands/commands/metal_commands.m | 2 +- rendering_api/vulkan/src/commands/commands/vulkan_commands.c | 4 ++-- src/core/command/commands/gryphn_command.c | 4 ++-- src/core/command/commands/gryphn_command.h | 2 +- src/core/gryphn_platform_functions.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rendering_api/metal/src/core/commands/commands/metal_commands.m b/rendering_api/metal/src/core/commands/commands/metal_commands.m index a5892eb..b4be150 100644 --- a/rendering_api/metal/src/core/commands/commands/metal_commands.m +++ b/rendering_api/metal/src/core/commands/commands/metal_commands.m @@ -114,7 +114,7 @@ void gnCommandDrawIndexedFn(gnCommandBufferHandle buffer, gnIndexType type, int ]; } -void gnCommandBindUniformFn(gnCommandBufferHandle buffer, gnUniform uniform) { +void gnCommandBindUniformFn(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) { id encoder = (id)buffer->commandBuffer->encoder; if (uniform->uniform->type == GN_UNIFORM_BUFFER_DESCRIPTOR) { gnBufferUniformInfo info = *(gnBufferUniformInfo*)uniform->uniform->data; diff --git a/rendering_api/vulkan/src/commands/commands/vulkan_commands.c b/rendering_api/vulkan/src/commands/commands/vulkan_commands.c index 00b39ff..beb44a2 100644 --- a/rendering_api/vulkan/src/commands/commands/vulkan_commands.c +++ b/rendering_api/vulkan/src/commands/commands/vulkan_commands.c @@ -75,11 +75,11 @@ void gnCommandDrawIndexedFn(gnCommandBufferHandle buffer, gnIndexType type, int buffer->commandBuffer->changedBuffer = gnFalse; } -void gnCommandBindUniformFn(gnCommandBufferHandle buffer, gnUniform uniform) { +void gnCommandBindUniformFn(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) { vkCmdBindDescriptorSets( buffer->commandBuffer->buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, - buffer->commandBuffer->boundGraphicsPipeline->graphicsPipeline->pipelineLayout, 0, 1, + buffer->commandBuffer->boundGraphicsPipeline->graphicsPipeline->pipelineLayout, set, 1, &uniform->uniform->set, 0, NULL ); } diff --git a/src/core/command/commands/gryphn_command.c b/src/core/command/commands/gryphn_command.c index bc0d23b..275168a 100644 --- a/src/core/command/commands/gryphn_command.c +++ b/src/core/command/commands/gryphn_command.c @@ -17,8 +17,8 @@ void gnCommandSetViewport(struct gnCommandBuffer_t* buffer, struct gnViewport_t void gnCommandSetScissor(struct gnCommandBuffer_t* buffer, struct gnScissor_t scissor) { buffer->commandPool->commandFunctions->_gnCommandSetScissor(buffer, scissor); } -void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform) { - buffer->commandPool->commandFunctions->_gnCommandBindUniform(buffer, uniform); +void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) { + buffer->commandPool->commandFunctions->_gnCommandBindUniform(buffer, uniform, set); } void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) { buffer->commandPool->commandFunctions->_gnCommandBindBuffer(buffer, bufferToBind, type); diff --git a/src/core/command/commands/gryphn_command.h b/src/core/command/commands/gryphn_command.h index 93820f9..b2ecb4a 100644 --- a/src/core/command/commands/gryphn_command.h +++ b/src/core/command/commands/gryphn_command.h @@ -8,7 +8,7 @@ void gnCommandEndRenderPass(gnCommandBufferHandle buffer); void gnCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline); void gnCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport); void gnCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor); -void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform); +void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set); #include "core/buffers/gryphn_buffer.h" void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type); diff --git a/src/core/gryphn_platform_functions.h b/src/core/gryphn_platform_functions.h index 18a8ea0..21425dd 100644 --- a/src/core/gryphn_platform_functions.h +++ b/src/core/gryphn_platform_functions.h @@ -118,7 +118,7 @@ typedef struct gnCommandFunctions_t { void (*_gnCommandBindGraphicsPipeline)(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline); void (*_gnCommandSetViewport)(gnCommandBufferHandle buffer, gnViewport viewport); void (*_gnCommandSetScissor)(gnCommandBufferHandle buffer, gnScissor scissor); - void (*_gnCommandBindUniform)(gnCommandBufferHandle buffer, gnUniform uniform); + void (*_gnCommandBindUniform)(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set); void (*_gnCommandBindBuffer)(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type); void (*_gnCommandDraw)(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance);