Skip to content

Commit

Permalink
WIP cube
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Jan 18, 2025
1 parent c1c2b84 commit 1d4acf4
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 165 deletions.
1 change: 1 addition & 0 deletions extensions/pl_graphics_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ typedef struct _plTextureViewDesc
uint32_t uBaseLayer;
uint32_t uLayerCount;
plTextureHandle tTexture;
plTextureType tType;
const char* pcDebugName; // default: "unnamed texture view"
} plTextureViewDesc;

Expand Down
1 change: 1 addition & 0 deletions extensions/pl_graphics_metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,7 @@
ptNewTexture->tView = *ptViewDesc;
ptNewTexture->tDesc.uMips = ptViewDesc->uMips;
ptNewTexture->tDesc.uLayers = ptViewDesc->uLayerCount;
ptNewTexture->tDesc.tType = ptViewDesc->tType;
ptNewTexture->tView.uBaseMip = 0;
ptNewTexture->tView.uBaseLayer = 0;

Expand Down
9 changes: 5 additions & 4 deletions extensions/pl_graphics_vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,18 +1265,19 @@ pl_create_texture_view(plDevice* ptDevice, const plTextureViewDesc* ptViewDesc)
plTexture* ptOriginalTexture = pl__get_texture(ptDevice, ptViewDesc->tTexture);
plTexture* ptNewTexture = pl__get_texture(ptDevice, ptViewDesc->tTexture);
ptNewTexture->tDesc = ptOriginalTexture->tDesc;
ptNewTexture->tDesc.tType = ptViewDesc->tType;
ptNewTexture->tView = *ptViewDesc;
plVulkanTexture* ptOldVulkanTexture = &ptDevice->sbtTexturesHot[ptViewDesc->tTexture.uIndex];
plVulkanTexture* ptNewVulkanTexture = &ptDevice->sbtTexturesHot[tHandle.uIndex];

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~create view~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VkImageViewType tImageViewType = 0;
if (ptOriginalTexture->tDesc.tType == PL_TEXTURE_TYPE_CUBE)
if (ptNewTexture->tDesc.tType == PL_TEXTURE_TYPE_CUBE)
tImageViewType = VK_IMAGE_VIEW_TYPE_CUBE;
else if (ptOriginalTexture->tDesc.tType == PL_TEXTURE_TYPE_2D)
else if (ptNewTexture->tDesc.tType == PL_TEXTURE_TYPE_2D)
tImageViewType = VK_IMAGE_VIEW_TYPE_2D;
else if (ptOriginalTexture->tDesc.tType == PL_TEXTURE_TYPE_2D_ARRAY)
else if (ptNewTexture->tDesc.tType == PL_TEXTURE_TYPE_2D_ARRAY)
tImageViewType = VK_IMAGE_VIEW_TYPE_2D; // VK_IMAGE_VIEW_TYPE_2D_ARRAY;
else
{
Expand Down Expand Up @@ -4329,7 +4330,7 @@ pl__fill_common_render_pass_data(plRenderPassLayoutDesc* ptDesc, plRenderPassLay
.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT,
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT,
.dependencyFlags = 0
.dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT
};

ptDataOut->atSubpassDependencies[1] = (VkSubpassDependency){
Expand Down
Loading

0 comments on commit 1d4acf4

Please sign in to comment.