From 1f7196f5b89983cf9a25638a17f05c78b635e1f6 Mon Sep 17 00:00:00 2001 From: yours3lf <0.tamas.marton@gmail.com> Date: Tue, 19 May 2020 22:30:29 +0100 Subject: [PATCH] don't need to memcpy the whole buf --- driver/stateChange.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/driver/stateChange.c b/driver/stateChange.c index 5be7a6f..dfe2a42 100644 --- a/driver/stateChange.c +++ b/driver/stateChange.c @@ -627,8 +627,8 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)( oldPipeline = cmdBuf->graphicsPipeline; memcpy(oldVertexBufferOffsets, cmdBuf->vertexBufferOffsets, sizeof(oldVertexBufferOffsets)); memcpy(oldVertexBuffers, cmdBuf->vertexBuffers, sizeof(oldVertexBuffers)); - memcpy(oldPushConstantBufferVertex, cmdBuf->pushConstantBufferVertex, sizeof(oldPushConstantBufferVertex)); - memcpy(oldPushConstantBufferPixel, cmdBuf->pushConstantBufferPixel, sizeof(oldPushConstantBufferPixel)); + memcpy(oldPushConstantBufferVertex, cmdBuf->pushConstantBufferVertex, sizeof(uint32_t) * 10); + memcpy(oldPushConstantBufferPixel, cmdBuf->pushConstantBufferPixel, sizeof(uint32_t) * 10); for(uint32_t c = 0; c < attachmentCount; ++c) { @@ -667,6 +667,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)( dsci.front.passOp = VK_STENCIL_OP_REPLACE; dsci.back = dsci.front; + //TODO cache pipeline, don't create it each occasion createClearPipeline(device, &dsci, clearColor ? device->emulClearShaderModule : device->emulClearNoColorShaderModule, device->emulClearDsl, &blitPipelineLayout, cmdBuf->currRenderPass, &blitPipeline); RPIFUNC(vkCmdBindPipeline)(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, blitPipeline); @@ -726,8 +727,8 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)( cmdBuf->graphicsPipeline = oldPipeline; memcpy(cmdBuf->vertexBufferOffsets, oldVertexBufferOffsets, sizeof(oldVertexBufferOffsets)); memcpy(cmdBuf->vertexBuffers, oldVertexBuffers, sizeof(oldVertexBuffers)); - memcpy(cmdBuf->pushConstantBufferVertex, oldPushConstantBufferVertex, sizeof(oldPushConstantBufferVertex)); - memcpy(cmdBuf->pushConstantBufferPixel, oldPushConstantBufferPixel, sizeof(oldPushConstantBufferPixel)); + memcpy(cmdBuf->pushConstantBufferVertex, oldPushConstantBufferVertex, sizeof(uint32_t) * 10); + memcpy(cmdBuf->pushConstantBufferPixel, oldPushConstantBufferPixel, sizeof(uint32_t) * 10); PROFILEEND(RPIFUNC(vkCmdClearAttachments)); }