Skip to content

Commit

Permalink
mantle: added storing parent image handle for image views and subreso…
Browse files Browse the repository at this point in the history
…urceRange for render target image views
  • Loading branch information
Cherser-s committed Nov 30, 2021
1 parent bd522c1 commit 312fe04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mantle/mantle_image_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ GR_RESULT GR_STDCALL grCreateImageView(
GrImageView* grImageView = malloc(sizeof(GrImageView));
*grImageView = (GrImageView) {
.grObj = { GR_OBJ_TYPE_IMAGE_VIEW, grDevice },
.grParentImage = grImage,
.imageView = vkImageView,
.format = createInfo.format,
};
Expand Down Expand Up @@ -166,13 +167,15 @@ GR_RESULT GR_STDCALL grCreateColorTargetView(
GrColorTargetView* grColorTargetView = malloc(sizeof(GrColorTargetView));
*grColorTargetView = (GrColorTargetView) {
.grObj = { GR_OBJ_TYPE_COLOR_TARGET_VIEW, grDevice },
.grParentImage = grImage,
.imageView = vkImageView,
.extent = {
MIP(grImage->extent.width, pCreateInfo->mipLevel),
MIP(grImage->extent.height, pCreateInfo->mipLevel),
pCreateInfo->arraySize,
},
.format = createInfo.format,
.subresourceRange = createInfo.subresourceRange,
};

*pView = (GR_COLOR_TARGET_VIEW)grColorTargetView;
Expand Down Expand Up @@ -252,13 +255,15 @@ GR_RESULT GR_STDCALL grCreateDepthStencilView(
GrDepthStencilView* grDepthStencilView = malloc(sizeof(GrDepthStencilView));
*grDepthStencilView = (GrDepthStencilView) {
.grObj = { GR_OBJ_TYPE_DEPTH_STENCIL_VIEW, grDevice },
.grParentImage = grImage,
.imageView = vkImageView,
.extent = {
MIP(grImage->extent.width, pCreateInfo->mipLevel),
MIP(grImage->extent.height, pCreateInfo->mipLevel),
pCreateInfo->arraySize,
},
.format = createInfo.format,
.subresourceRange = createInfo.subresourceRange,
};

*pView = (GR_DEPTH_STENCIL_VIEW)grDepthStencilView;
Expand Down
7 changes: 7 additions & 0 deletions src/mantle/mantle_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,15 @@ typedef struct _GrColorBlendStateObject {
float blendConstants[4];
} GrColorBlendStateObject;

typedef struct _GrImage GrImage;

typedef struct _GrColorTargetView {
GrObject grObj;
GrImage* grParentImage;
VkImageView imageView;
VkExtent3D extent;
VkFormat format;
VkImageSubresourceRange subresourceRange;
} GrColorTargetView;

typedef struct _GrDepthStencilStateObject {
Expand All @@ -202,9 +206,11 @@ typedef struct _GrDepthStencilStateObject {

typedef struct _GrDepthStencilView {
GrObject grObj;
GrImage* grParentImage;
VkImageView imageView;
VkExtent3D extent;
VkFormat format;
VkImageSubresourceRange subresourceRange;
} GrDepthStencilView;

typedef struct _GrDescriptorSet {
Expand Down Expand Up @@ -262,6 +268,7 @@ typedef struct _GrImage {

typedef struct _GrImageView {
GrObject grObj;
GrImage* grParentImage;
VkImageView imageView;
VkFormat format;
} GrImageView;
Expand Down

0 comments on commit 312fe04

Please sign in to comment.