MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / Decode

Method Decode

layers/state_tracker/subresource_adapter.cpp:420–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420void ImageRangeEncoder::Decode(const VkImageSubresource& subres, const IndexType& encode, uint32_t& out_layer,
421 VkOffset3D& out_offset) const {
422 uint32_t subres_index = GetSubresourceIndex(LowerBoundFromMask(subres.aspectMask), subres.mipLevel);
423 const auto& subres_layout = GetSubresourceInfo(subres_index).layout;
424 IndexType decode = encode - subres_layout.offset;
425 out_layer = static_cast<uint32_t>(decode / subres_layout.arrayPitch);
426 decode -= (out_layer * subres_layout.arrayPitch);
427 out_offset.z = static_cast<int32_t>(decode / subres_layout.depthPitch);
428 decode -= (out_offset.z * subres_layout.depthPitch);
429 out_offset.y = static_cast<int32_t>(decode / subres_layout.rowPitch);
430 decode -= (out_offset.y * subres_layout.rowPitch);
431 out_offset.x = static_cast<int32_t>(static_cast<double>(decode) / texel_sizes_[LowerBoundFromMask(subres.aspectMask)]);
432}
433
434inline VkImageSubresourceRange GetRemaining(const VkImageSubresourceRange& full_range, VkImageSubresourceRange subres_range) {
435 subres_range.levelCount = GetEffectiveLevelCount(subres_range, full_range.levelCount);

Calls

no outgoing calls

Tested by

no test coverage detected