1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
// Copyright (c) 2024-2025 The Khronos Group Inc.
// Copyright (c) 2024-2025 Valve Corporation
// Copyright (c) 2024-2025 LunarG, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// NOTE: This file doesn't contain any entrypoints and should be compiled with the --no-link option for glslang
#version 450
#extension GL_GOOGLE_include_directive : enable
#include "common_descriptor_sets.h"
#include "error_payload.h"
layout(buffer_reference, buffer_reference_align = 8, scalar) buffer DescriptorSetType {
// struct glsl::DescriptorState {
// x: id
// y: extra data depending on the descriptor type
// }
uvec2 data[];
};
layout(buffer_reference, buffer_reference_align = 8, scalar) buffer UnusedInitializedStatus;
layout(set = kInstDefaultDescriptorSet, binding = kBindingInstDescriptorIndexingOOB, scalar) buffer BoundDescriptorSetsStateSSBO {
UnusedInitializedStatus unused_initialized_status;
DescriptorSetType descriptor_set_types[kDebugInputBindlessMaxDescSets];
} gpuav;
// Matches the vvl::DescriptorClass::TexelBuffer
void inst_descriptor_class_texel_buffer(const uint inst_offset, const uint desc_set, const uint desc_index, const uint byte_offset, const uint binding_layout_offset) {
DescriptorSetType descriptor_set_type = gpuav.descriptor_set_types[desc_set];
const uint global_descriptor_index = binding_layout_offset + desc_index;
// check that the offset is in bounds
uint resource_size = descriptor_set_type.data[global_descriptor_index].y;
if (byte_offset >= resource_size) {
error_payload = ErrorPayload(
inst_offset,
SpecConstantLinkShaderId | (kErrorGroupInstDescriptorClass << kErrorGroupShift) | (kErrorSubCodeDescriptorClassTexelBufferBounds << kErrorSubCodeShift),
(desc_set << kInstDescriptorIndexingSetShift) | global_descriptor_index,
byte_offset,
resource_size
);
}
}
|