1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-02-26 23:54:17 +01:00

depth texture reading and buffer copying works now

This commit is contained in:
Unknown 2020-01-31 18:42:37 +00:00
parent 733aa0a25e
commit e7294b896e
3 changed files with 23 additions and 11 deletions

View File

@ -839,6 +839,9 @@ uint8_t getTextureDataType(VkFormat format)
return 8; //etc1
case VK_FORMAT_G8B8G8R8_422_UNORM:
return 17; //yuyv422r (raster format = not in T format, yuyv)
case VK_FORMAT_X8_D24_UNORM_PACK32:
case VK_FORMAT_D24_UNORM_S8_UINT:
return 0; //rgba8
case VK_FORMAT_UNDEFINED: //TODO
return -1;
default://
@ -917,8 +920,17 @@ uint32_t getRenderTargetFormatVC4(VkFormat format)
{
case VK_FORMAT_R16G16B16A16_SFLOAT: //HDR mode set in tile binning config mode, so just return a valid format
case VK_FORMAT_R8G8B8A8_UNORM:
//only here so we can do emulated buffer copies to depth textures
case VK_FORMAT_X8_D24_UNORM_PACK32:
case VK_FORMAT_D24_UNORM_S8_UINT:
return VC4_RENDER_CONFIG_FORMAT_RGBA8888;
case VK_FORMAT_B5G6R5_UNORM_PACK16:
//TODO
//case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
//case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
//case VK_FORMAT_R8G8_UNORM:
//case VK_FORMAT_R16_SFLOAT:
//case VK_FORMAT_R16_SINT:
return VC4_RENDER_CONFIG_FORMAT_BGR565;
default:
fprintf(stderr, "rendertarget format: %i\n", format);

View File

@ -41,20 +41,20 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
cb->currentSubpass = 0;
//TODO handle multiple attachments
_image* i = 0;
_image* dsI = 0;
for(uint32_t c = 0; c < cb->fbo->numAttachmentViews; ++c)
_renderpass* rp = pRenderPassBegin->renderPass;
for(uint32_t c = 0; c < rp->subpasses[cb->currentSubpass].colorAttachmentCount; ++c)
{
if(!isDepthStencilFormat(cb->fbo->attachmentViews[c].image->format))
{
i = cb->fbo->attachmentViews[c].image;
i = cb->fbo->attachmentViews[rp->subpasses[cb->currentSubpass].pColorAttachments[c].attachment].image;
break; //TODO handle multiple attachments
}
else
if(rp->subpasses[cb->currentSubpass].pDepthStencilAttachment)
{
dsI = cb->fbo->attachmentViews[c].image;
}
dsI = cb->fbo->attachmentViews[rp->subpasses[cb->currentSubpass].pDepthStencilAttachment->attachment].image;
}
clFit(commandBuffer, &commandBuffer->binCl, sizeof(CLMarker));

View File

@ -767,7 +767,7 @@ void CreateRenderPass()
subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpassDesc.colorAttachmentCount = 1;
subpassDesc.pColorAttachments = &attachRef;
subpassDesc.pDepthStencilAttachment = &depthAttachmentRef;
//subpassDesc.pDepthStencilAttachment = &depthAttachmentRef;
VkAttachmentDescription attachDesc[2];
attachDesc[0] = {};