Skip to content

Commit

Permalink
support array views in allocate_texture
Browse files Browse the repository at this point in the history
  • Loading branch information
Hatrickek authored and martty committed Jan 10, 2024
1 parent 98c3ef8 commit 42cd182
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,16 +716,22 @@ namespace vuk {
ivci.subresourceRange.aspectMask = format_to_aspect(ici.format);
ivci.subresourceRange.baseArrayLayer = 0;
ivci.subresourceRange.baseMipLevel = 0;
ivci.subresourceRange.layerCount = 1;
ivci.subresourceRange.layerCount = ici.arrayLayers;
ivci.subresourceRange.levelCount = ici.mipLevels;
ivci.viewType = ici.imageType == ImageType::e3D ? ImageViewType::e3D : ici.imageType == ImageType::e2D ? ImageViewType::e2D : ImageViewType::e1D;
Texture tex{ std::move(dst), allocate_image_view(allocator, ivci, loc).value() }; // TODO: dropping error
tex.extent = ici.extent;
tex.format = ici.format;
tex.sample_count = ici.samples;
tex.layer_count = 1;
tex.level_count = ici.mipLevels;
return tex;
ivci.viewType = ici.imageType == ImageType::e3D
? ImageViewType::e3D
: ici.imageType == ImageType::e2D
? (ici.arrayLayers > 1 ? ImageViewType::e2DArray : ImageViewType::e2D)
: ImageViewType::e1D;
return Texture{
std::move(dst),
allocate_image_view(allocator, ivci, loc).value(), // TODO: dropping error
ici.extent,
ici.format,
ici.samples,
ici.arrayLayers,
ici.mipLevels
};
}

void Context::destroy(const DescriptorPool& dp) {
Expand Down

0 comments on commit 42cd182

Please sign in to comment.