@@ -1327,6 +1327,8 @@ pl_graphics_create_texture(plDevice* ptDevice, const plTextureDesc* ptDesc, plTe
13271327 VkImageViewType tImageViewType = 0 ;
13281328 if (tDesc .eType == PL_TEXTURE_TYPE_CUBE )
13291329 tImageViewType = VK_IMAGE_VIEW_TYPE_CUBE ;
1330+ else if (tDesc .eType == PL_TEXTURE_TYPE_3D )
1331+ tImageViewType = VK_IMAGE_VIEW_TYPE_3D ;
13301332 else if (tDesc .eType == PL_TEXTURE_TYPE_2D )
13311333 tImageViewType = VK_IMAGE_VIEW_TYPE_2D ;
13321334 else if (tDesc .eType == PL_TEXTURE_TYPE_2D_ARRAY )
@@ -1350,7 +1352,7 @@ pl_graphics_create_texture(plDevice* ptDevice, const plTextureDesc* ptDesc, plTe
13501352
13511353 const VkImageCreateInfo tImageInfo = {
13521354 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO ,
1353- .imageType = VK_IMAGE_TYPE_2D ,
1355+ .imageType = tDesc . eType == PL_TEXTURE_TYPE_3D ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D ,
13541356 .extent .width = (uint32_t )tDesc .tDimensions .x ,
13551357 .extent .height = (uint32_t )tDesc .tDimensions .y ,
13561358 .extent .depth = (uint32_t )tDesc .tDimensions .z ,
@@ -1410,6 +1412,8 @@ pl_graphics_bind_texture_to_memory(plDevice* ptDevice, plTextureHandle tHandle,
14101412 tImageViewType = VK_IMAGE_VIEW_TYPE_2D ;
14111413 else if (ptTexture -> tDesc .eType == PL_TEXTURE_TYPE_2D_ARRAY )
14121414 tImageViewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY ;
1415+ else if (ptTexture -> tDesc .eType == PL_TEXTURE_TYPE_3D )
1416+ tImageViewType = VK_IMAGE_VIEW_TYPE_3D ;
14131417 else
14141418 {
14151419 PL_ASSERT (false && "unsupported texture type" );
@@ -1530,6 +1534,8 @@ pl_graphics_create_texture_view(plDevice* ptDevice, const plTextureViewDesc* ptV
15301534 tImageViewType = VK_IMAGE_VIEW_TYPE_CUBE ;
15311535 else if (ptNewTexture -> tDesc .eType == PL_TEXTURE_TYPE_2D )
15321536 tImageViewType = VK_IMAGE_VIEW_TYPE_2D ;
1537+ else if (ptNewTexture -> tDesc .eType == PL_TEXTURE_TYPE_3D )
1538+ tImageViewType = VK_IMAGE_VIEW_TYPE_3D ;
15331539 else if (ptNewTexture -> tDesc .eType == PL_TEXTURE_TYPE_2D_ARRAY )
15341540 tImageViewType = VK_IMAGE_VIEW_TYPE_2D ; // VK_IMAGE_VIEW_TYPE_2D_ARRAY;
15351541 else
@@ -4274,7 +4280,7 @@ pl_graphics_begin_compute_pass(plCommandBuffer* ptCmdBuffer, const plPassResourc
42744280 }
42754281 if (ptTexture -> tDesc .eUsage & PL_TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT )
42764282 {
4277- // tSrcStageFlags |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT ; // TODO: does depth go here?
4283+ tSrcStageFlags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT ; // TODO: does depth go here?
42784284 tBarrier .srcAccessMask |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT ;
42794285 }
42804286 }
@@ -4363,6 +4369,7 @@ pl_graphics_end_compute_pass(plCommandBuffer* ptCmdBuffer)
43634369 if (ptTexture -> tDesc .eUsage & PL_TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT )
43644370 {
43654371 // tDstStageFlags |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; // TODO: does depth go here?
4372+ tDstStageFlags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT ;
43664373 tBarrier .dstAccessMask |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT ;
43674374 }
43684375 }
0 commit comments