| 694 | } |
| 695 | |
| 696 | ImageRangeGen AttachmentViewGen::GetRangeGen(AttachmentViewGen::Gen type, uint32_t view_index) const { |
| 697 | // Restrict image view's subresource range to a specific multiview layer |
| 698 | if (view_index != vvl::kNoIndex32) { |
| 699 | VkImageSubresourceRange subresource = view_->normalized_subresource_range; |
| 700 | if (view_index >= subresource.layerCount) { |
| 701 | return {}; // invalid view index |
| 702 | } |
| 703 | subresource.baseArrayLayer += view_index; |
| 704 | subresource.layerCount = 1; |
| 705 | auto range_gen = SubState(*view_->image_state).MakeImageRangeGen(subresource, view_->is_depth_sliced); |
| 706 | return range_gen; |
| 707 | } |
| 708 | |
| 709 | // If a single aspect of depth-stencil attachment is requested, but the attachment actually |
| 710 | // consist of a single aspect, then the render area's range gen is what was requested |
| 711 | // (in this case we also don't cache separate depth/stencil-only range gens). |
| 712 | const bool asked_depth_aspect_for_depth_only = |
| 713 | (type == kDepthOnlyRenderArea) && vkuFormatIsDepthOnly(view_->create_info.format); |
| 714 | const bool asked_stencil_aspect_for_stencil_only = |
| 715 | (type == kStencilOnlyRenderArea) && vkuFormatIsStencilOnly(view_->create_info.format); |
| 716 | if (asked_depth_aspect_for_depth_only || asked_stencil_aspect_for_stencil_only) { |
| 717 | type = Gen::kRenderArea; |
| 718 | } |
| 719 | assert(gen_store_[type].has_value()); |
| 720 | return *gen_store_[type]; |
| 721 | } |
| 722 | |
| 723 | AttachmentViewGen::Gen AttachmentViewGen::GetDepthStencilRenderAreaGenType(bool depth_op, bool stencil_op) const { |
| 724 | assert(vkuFormatIsDepthOrStencil(view_->create_info.format)); |
no test coverage detected