1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-01 13:24:20 +01:00

fixed clear values

now they are tied to markers
This commit is contained in:
Unknown 2020-02-25 21:18:14 +00:00
parent 3f86e18ff6
commit 020ab465dc
9 changed files with 57 additions and 52 deletions

View File

@ -73,6 +73,10 @@ void clInsertNewCLMarker(ControlList* cl,
marker.readMSAAimage = readMSAAimage;
marker.readMSAAdepthStencilImage = readMSAAdepthStencilImage;
marker.perfmonID = 0;
marker.clearColor[0] = 0;
marker.clearColor[1] = 0;
marker.clearDepth = 0;
marker.clearStencil = 0;
marker.handlesSize = 0;
marker.shaderRecSize = 0;
marker.uniformsSize = 0;

View File

@ -28,6 +28,8 @@ typedef struct CLMarker
uint32_t readMSAAimage;
uint32_t readMSAAdepthStencilImage;
void* perfmonID;
uint32_t clearColor[2];
uint32_t clearDepth, clearStencil;
//pointers that point to where all the other CL data is
//plus sizes

View File

@ -364,9 +364,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
{
submitCl.color_write.bits |= VC4_RENDER_CONFIG_MS_MODE_4X | VC4_RENDER_CONFIG_DECIMATE_MODE_4X;
}
submitCl.clear_color[0] = writeImage->clearColor[0];
submitCl.clear_color[1] = writeImage->clearColor[1];
}
if(writeMSAAimage)
@ -375,9 +372,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
submitCl.msaa_color_write.offset = 0;
submitCl.msaa_color_write.flags = 0;
submitCl.msaa_color_write.bits = VC4_RENDER_CONFIG_MS_MODE_4X;
submitCl.clear_color[0] = writeMSAAimage->clearColor[0];
submitCl.clear_color[1] = writeMSAAimage->clearColor[1];
}
if(readImage)
@ -395,10 +389,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
submitCl.zs_write.offset = 0;
submitCl.zs_write.flags = 0;
submitCl.zs_write.bits = VC4_SET_FIELD(VC4_LOADSTORE_TILE_BUFFER_ZS, VC4_LOADSTORE_TILE_BUFFER_BUFFER) |
VC4_SET_FIELD(writeDepthStencilImage->tiling, VC4_LOADSTORE_TILE_BUFFER_TILING);
submitCl.clear_z = writeDepthStencilImage->clearColor[0]; //0...1 -> 0...0xffffff
submitCl.clear_s = writeDepthStencilImage->clearColor[1]; //0...0xff
VC4_SET_FIELD(writeDepthStencilImage->tiling, VC4_LOADSTORE_TILE_BUFFER_TILING);
}
if(writeMSAAdepthStencilImage)
@ -407,9 +398,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
submitCl.msaa_zs_write.offset = 0;
submitCl.msaa_zs_write.flags = 0;
submitCl.msaa_zs_write.bits = VC4_RENDER_CONFIG_MS_MODE_4X;
submitCl.clear_z = writeMSAAdepthStencilImage->clearColor[0]; //0...1 -> 0...0xffffff
submitCl.clear_s = writeMSAAdepthStencilImage->clearColor[1]; //0...0xff
}
if(readDepthStencilImage)
@ -421,6 +409,13 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
VC4_SET_FIELD(readDepthStencilImage->tiling, VC4_RENDER_CONFIG_MEMORY_FORMAT);
}
submitCl.clear_color[0] = marker->clearColor[0];
submitCl.clear_color[1] = marker->clearColor[1];
submitCl.clear_z = marker->clearDepth; //0...1 -> 0...0xffffff
submitCl.clear_s = marker->clearStencil; //0...0xff
// fprintf(stderr, "submitCl.clear_color[0]: %u\n", submitCl.clear_color[0]);
// fprintf(stderr, "submitCl.clear_color[1]: %u\n", submitCl.clear_color[1]);
// fprintf(stderr, "submitCl.clear_z: %u\n", submitCl.clear_z);

View File

@ -196,8 +196,6 @@ typedef struct VkImage_T
uint32_t format;
uint32_t imageSpace;
uint32_t tiling; //T or LT
uint32_t needToClear;
uint32_t clearColor[2];
uint32_t layout;
_deviceMemory* boundMem;
uint32_t boundOffset;

View File

@ -67,24 +67,6 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
readMSAAimage = 1;
}
}
if(rp->attachments[rp->subpasses[0].pColorAttachments[0].attachment].loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
{
flags |= VC4_SUBMIT_CL_USE_CLEAR_COLOR;
if(!rp->subpasses[0].pResolveAttachments)
{
fb->attachmentViews[rp->subpasses[0].pColorAttachments[0].attachment].image->clearColor[0] =
fb->attachmentViews[rp->subpasses[0].pColorAttachments[0].attachment].image->clearColor[1] =
packVec4IntoABGR8(pRenderPassBegin->pClearValues[rp->subpasses[0].pColorAttachments[0].attachment].color.float32);
}
else
{
fb->attachmentViews[rp->subpasses[0].pResolveAttachments[0].attachment].image->clearColor[0] =
fb->attachmentViews[rp->subpasses[0].pResolveAttachments[0].attachment].image->clearColor[1] =
packVec4IntoABGR8(pRenderPassBegin->pClearValues[rp->subpasses[0].pColorAttachments[0].attachment].color.float32);
}
}
}
if(rp->subpasses[0].pResolveAttachments &&
@ -120,18 +102,6 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
readMSAAdepthStencilImage = 1;
}
}
if(rp->attachments[rp->subpasses[0].pDepthStencilAttachment->attachment].loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
{
fb->attachmentViews[rp->subpasses[0].pDepthStencilAttachment->attachment].image->clearColor[0] =
(uint32_t)(pRenderPassBegin->pClearValues[rp->subpasses[0].pDepthStencilAttachment->attachment].depthStencil.depth * 0xffffff) & 0xffffff;
}
if(rp->attachments[rp->subpasses[0].pDepthStencilAttachment->attachment].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
{
fb->attachmentViews[rp->subpasses[0].pDepthStencilAttachment->attachment].image->clearColor[1] =
pRenderPassBegin->pClearValues[rp->subpasses[0].pDepthStencilAttachment->attachment].depthStencil.stencil & 0xff;
}
}
@ -140,8 +110,47 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
writeImage, readImage, writeDepthStencilImage, readDepthStencilImage, writeMSAAimage, writeMSAAdepthStencilImage,
performResolve, readMSAAimage, readMSAAdepthStencilImage);
if(rp->subpasses[0].colorAttachmentCount > 0)
{
if(rp->subpasses[0].pColorAttachments)
{
if(rp->attachments[rp->subpasses[0].pColorAttachments[0].attachment].loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
{
flags |= VC4_SUBMIT_CL_USE_CLEAR_COLOR;
if(!rp->subpasses[0].pResolveAttachments)
{
cb->binCl.currMarker->clearColor[0] =
cb->binCl.currMarker->clearColor[1] =
packVec4IntoABGR8(pRenderPassBegin->pClearValues[rp->subpasses[0].pColorAttachments[0].attachment].color.float32);
}
else
{
cb->binCl.currMarker->clearColor[0] =
cb->binCl.currMarker->clearColor[1] =
packVec4IntoABGR8(pRenderPassBegin->pClearValues[rp->subpasses[0].pColorAttachments[0].attachment].color.float32);
}
}
}
}
cb->binCl.currMarker->flags = flags;
if(rp->subpasses[0].pDepthStencilAttachment)
{
if(rp->attachments[rp->subpasses[0].pDepthStencilAttachment->attachment].loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
{
cb->binCl.currMarker->clearDepth =
(uint32_t)(pRenderPassBegin->pClearValues[rp->subpasses[0].pDepthStencilAttachment->attachment].depthStencil.depth * 0xffffff) & 0xffffff;
}
if(rp->attachments[rp->subpasses[0].pDepthStencilAttachment->attachment].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
{
cb->binCl.currMarker->clearStencil =
pRenderPassBegin->pClearValues[rp->subpasses[0].pDepthStencilAttachment->attachment].depthStencil.stencil & 0xff;
}
}
//insert relocs
if(writeImage)

View File

@ -212,8 +212,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
i->format = pCreateInfo->format;
i->imageSpace = 0;
i->tiling = pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR ? VC4_TILING_FORMAT_LT : VC4_TILING_FORMAT_T;
i->needToClear = 0;
i->clearColor[0] = i->clearColor[1] = 0;
i->layout = pCreateInfo->initialLayout;
i->boundMem = 0;
i->boundOffset = 0;

View File

@ -132,7 +132,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearColorImage(
clFit(commandBuffer, &commandBuffer->binCl, V3D21_FLUSH_length);
clInsertFlush(&commandBuffer->binCl);
i->clearColor[0] = i->clearColor[1] = packVec4IntoABGR8(pColor->float32);
commandBuffer->binCl.currMarker->clearColor[0] = commandBuffer->binCl.currMarker->clearColor[1] = packVec4IntoABGR8(pColor->float32);
commandBuffer->binCl.currMarker->flags |= VC4_SUBMIT_CL_USE_CLEAR_COLOR;
}
}

View File

@ -186,10 +186,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdPipelineBarrier(
_image* i = pImageMemoryBarriers[c].image;
if(srcStageMask & VK_PIPELINE_STAGE_TRANSFER_BIT &&
pImageMemoryBarriers[c].srcAccessMask & VK_ACCESS_TRANSFER_WRITE_BIT &&
i->needToClear)
pImageMemoryBarriers[c].srcAccessMask & VK_ACCESS_TRANSFER_WRITE_BIT)
{
assert(i->layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
assert(i->layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
}
//transition to new layout

View File

@ -88,7 +88,7 @@ void setupVulkan() {
void mainLoop() {
//while (!glfwWindowShouldClose(window)) {
for(int c = 0; c < 2; ++c){
for(int c = 0; c < 300; ++c){
//for(int c = 0; c < 1; ++c){
draw();