change shader uniform push to take pipelines instead of command buffers
continuous-integration/drone/push Build is passing Details

pull/1/head
cosmonaut 2021-02-05 19:59:29 -08:00
parent 7f3e89315e
commit 8f1cdf190f
4 changed files with 24 additions and 24 deletions

View File

@ -995,7 +995,7 @@ REFRESHAPI void Refresh_SetBufferData(
*/
REFRESHAPI uint32_t Refresh_PushVertexShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
);
@ -1012,7 +1012,7 @@ REFRESHAPI uint32_t Refresh_PushVertexShaderUniforms(
*/
REFRESHAPI uint32_t Refresh_PushFragmentShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
);
@ -1029,7 +1029,7 @@ REFRESHAPI uint32_t Refresh_PushFragmentShaderUniforms(
*/
REFRESHAPI uint32_t Refresh_PushComputeShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_ComputePipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
);

View File

@ -466,14 +466,14 @@ void Refresh_SetBufferData(
uint32_t Refresh_PushVertexShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
) {
if (device == NULL) { return 0; }
return device->PushVertexShaderUniforms(
device->driverData,
commandBuffer,
pipeline,
data,
dataLengthInBytes
);
@ -481,14 +481,14 @@ uint32_t Refresh_PushVertexShaderUniforms(
uint32_t Refresh_PushFragmentShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline * pipeline,
void *data,
uint32_t dataLengthInBytes
) {
if (device == NULL) { return 0; }
return device->PushFragmentShaderUniforms(
device->driverData,
commandBuffer,
pipeline,
data,
dataLengthInBytes
);
@ -496,14 +496,14 @@ uint32_t Refresh_PushFragmentShaderUniforms(
uint32_t Refresh_PushComputeShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_ComputePipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
) {
if (device == NULL) { return 0; }
return device->PushComputeShaderUniforms(
device->driverData,
commandBuffer,
pipeline,
data,
dataLengthInBytes
);

View File

@ -312,21 +312,21 @@ struct Refresh_Device
uint32_t(*PushVertexShaderUniforms)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline* pipeline,
void *data,
uint32_t dataLengthInBytes
);
uint32_t(*PushFragmentShaderUniforms)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
);
uint32_t (*PushComputeShaderUniforms)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_ComputePipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
);

View File

@ -6553,21 +6553,21 @@ static void VULKAN_SetBufferData(
static uint32_t VULKAN_PushVertexShaderUniforms(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
) {
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
VulkanGraphicsPipeline* graphicsPipeline = (VulkanGraphicsPipeline*) pipeline;
SDL_LockMutex(renderer->uniformBufferLock);
renderer->vertexUBOOffset += renderer->vertexUBOBlockIncrement;
renderer->vertexUBOBlockIncrement = vulkanCommandBuffer->currentGraphicsPipeline->vertexUBOBlockSize;
renderer->vertexUBOBlockIncrement = graphicsPipeline->vertexUBOBlockSize;
if (
renderer->vertexUBOOffset +
vulkanCommandBuffer->currentGraphicsPipeline->vertexUBOBlockSize >=
graphicsPipeline->vertexUBOBlockSize >=
UBO_BUFFER_SIZE * (renderer->frameIndex + 1)
) {
Refresh_LogError("Vertex UBO overflow!");
@ -6589,21 +6589,21 @@ static uint32_t VULKAN_PushVertexShaderUniforms(
static uint32_t VULKAN_PushFragmentShaderUniforms(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
) {
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
VulkanGraphicsPipeline* graphicsPipeline = (VulkanGraphicsPipeline*) pipeline;
SDL_LockMutex(renderer->uniformBufferLock);
renderer->fragmentUBOOffset += renderer->fragmentUBOBlockIncrement;
renderer->fragmentUBOBlockIncrement = vulkanCommandBuffer->currentGraphicsPipeline->fragmentUBOBlockSize;
renderer->fragmentUBOBlockIncrement = graphicsPipeline->fragmentUBOBlockSize;
if (
renderer->fragmentUBOOffset +
vulkanCommandBuffer->currentGraphicsPipeline->fragmentUBOBlockSize >=
graphicsPipeline->fragmentUBOBlockSize >=
UBO_BUFFER_SIZE * (renderer->frameIndex + 1)
) {
Refresh_LogError("Fragment UBO overflow!");
@ -6625,21 +6625,21 @@ static uint32_t VULKAN_PushFragmentShaderUniforms(
static uint32_t VULKAN_PushComputeShaderUniforms(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_ComputePipeline *pipeline,
void *data,
uint32_t dataLengthInBytes
) {
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
VulkanComputePipeline* computePipeline = (VulkanComputePipeline*) pipeline;
SDL_LockMutex(renderer->uniformBufferLock);
renderer->computeUBOOffset += renderer->computeUBOBlockIncrement;
renderer->computeUBOBlockIncrement = vulkanCommandBuffer->currentComputePipeline->computeUBOBlockSize;
renderer->computeUBOBlockIncrement = computePipeline->computeUBOBlockSize;
if (
renderer->computeUBOOffset +
vulkanCommandBuffer->currentComputePipeline->computeUBOBlockSize >=
computePipeline->computeUBOBlockSize >=
UBO_BUFFER_SIZE * (renderer->frameIndex + 1)
) {
Refresh_LogError("Compute UBO overflow!");