Skip to content

Commit 00021f7

Browse files
gpuav: Use underscore in long GLSL names
1 parent 0f6964a commit 00021f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+562
-566
lines changed

layers/gpuav/debug_printf/debug_printf.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2020-2025 The Khronos Group Inc.
2-
* Copyright (c) 2020-2025 Valve Corporation
3-
* Copyright (c) 2020-2025 LunarG, Inc.
1+
/* Copyright (c) 2020-2026 The Khronos Group Inc.
2+
* Copyright (c) 2020-2026 Valve Corporation
3+
* Copyright (c) 2020-2026 LunarG, Inc.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -206,10 +206,10 @@ struct DebugPrintfCbState {
206206

207207
void AnalyzeAndGenerateMessage(Validator &gpuav, VkCommandBuffer command_buffer, DebugPrintfBufferInfo &buffer_info,
208208
uint32_t *const debug_output_buffer, const Location &loc) {
209-
uint32_t output_buffer_dwords_counts = debug_output_buffer[gpuav::kDebugPrintfOutputBufferDWordsCount];
209+
uint32_t output_buffer_dwords_counts = debug_output_buffer[gpuav::kDebugPrintf_OutputBuffer_DWordsCount];
210210
if (!output_buffer_dwords_counts) return;
211211

212-
uint32_t output_record_i = gpuav::kDebugPrintfOutputBufferData; // get first OutputRecord index
212+
uint32_t output_record_i = gpuav::kDebugPrintf_OutputBuffer_Data; // get first OutputRecord index
213213
while (debug_output_buffer[output_record_i]) {
214214
std::ostringstream shader_message;
215215

@@ -380,7 +380,7 @@ void AnalyzeAndGenerateMessage(Validator &gpuav, VkCommandBuffer command_buffer,
380380
}
381381
output_record_i += debug_record->size;
382382
}
383-
if ((output_record_i - gpuav::kDebugPrintfOutputBufferData) < output_buffer_dwords_counts) {
383+
if ((output_record_i - gpuav::kDebugPrintf_OutputBuffer_Data) < output_buffer_dwords_counts) {
384384
// Originally we had this to log a warning, but if using the default settings, warnings are hidden.
385385
// We report this information the same we report the "real" debug printf message so we know it is seen
386386
std::ostringstream message;
@@ -398,8 +398,8 @@ void AnalyzeAndGenerateMessage(Validator &gpuav, VkCommandBuffer command_buffer,
398398

399399
// Only memset what is needed, in case we are only using a small portion of a large buffer_size.
400400
// At the same time we want to make sure we don't memset past the actual VkBuffer allocation
401-
uint32_t clear_size =
402-
sizeof(uint32_t) * (debug_output_buffer[gpuav::kDebugPrintfOutputBufferDWordsCount] + gpuav::kDebugPrintfOutputBufferData);
401+
uint32_t clear_size = sizeof(uint32_t) * (debug_output_buffer[gpuav::kDebugPrintf_OutputBuffer_DWordsCount] +
402+
gpuav::kDebugPrintf_OutputBuffer_Data);
403403
clear_size = std::min(gpuav.gpuav_settings.debug_printf_buffer_size, clear_size);
404404
memset(debug_output_buffer, 0, clear_size);
405405
}

layers/gpuav/instrumentation/buffer_device_address.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2024-2025 LunarG, Inc.
1+
/* Copyright (c) 2024-2026 LunarG, Inc.
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -43,24 +43,24 @@ void RegisterBufferDeviceAddressValidation(Validator& gpuav, CommandBufferSubSta
4343
std::string& out_vuid_msg) {
4444
using namespace glsl;
4545
bool error_found = false;
46-
if (GetErrorGroup(error_record) != kErrorGroupInstBufferDeviceAddress) {
46+
if (GetErrorGroup(error_record) != kErrorGroup_InstBufferDeviceAddress) {
4747
return error_found;
4848
}
4949
error_found = true;
5050

5151
std::ostringstream strm;
5252

53-
const uint32_t payload = error_record[kInstLogErrorParameterOffset_2];
54-
const bool is_write = ((payload >> kInstBuffAddrAccessPayloadShiftIsWrite) & 1) != 0;
55-
const bool is_struct = ((payload >> kInstBuffAddrAccessPayloadShiftIsStruct) & 1) != 0;
53+
const uint32_t payload = error_record[kInst_LogError_ParameterOffset_2];
54+
const bool is_write = ((payload >> kInst_BuffAddrAccess_PayloadShiftIsWrite) & 1) != 0;
55+
const bool is_struct = ((payload >> kInst_BuffAddrAccess_PayloadShiftIsStruct) & 1) != 0;
5656

57-
const uint64_t address = *reinterpret_cast<const uint64_t*>(error_record + kInstLogErrorParameterOffset_0);
57+
const uint64_t address = *reinterpret_cast<const uint64_t*>(error_record + kInst_LogError_ParameterOffset_0);
5858

5959
const uint32_t error_sub_code = GetSubError(error_record);
6060
switch (error_sub_code) {
61-
case kErrorSubCodeBufferDeviceAddressUnallocRef: {
61+
case kErrorSubCode_BufferDeviceAddress_UnallocRef: {
6262
const char* access_type = is_write ? "written" : "read";
63-
const uint32_t byte_size = payload & kInstBuffAddrAccessPayloadMaskAccessInfo;
63+
const uint32_t byte_size = payload & kInst_BuffAddrAccess_PayloadMaskAccessInfo;
6464
strm << "Out of bounds access: " << byte_size << " bytes " << access_type << " at buffer device address 0x"
6565
<< std::hex << address << '.';
6666
if (is_struct) {
@@ -73,9 +73,9 @@ void RegisterBufferDeviceAddressValidation(Validator& gpuav, CommandBufferSubSta
7373
out_vuid_msg = "VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819";
7474

7575
} break;
76-
case kErrorSubCodeBufferDeviceAddressAlignment: {
76+
case kErrorSubCode_BufferDeviceAddress_Alignment: {
7777
const char* access_type = is_write ? "OpStore" : "OpLoad";
78-
const uint32_t alignment = (payload & kInstBuffAddrAccessPayloadMaskAccessInfo);
78+
const uint32_t alignment = (payload & kInst_BuffAddrAccess_PayloadMaskAccessInfo);
7979
strm << "Unaligned pointer access: The " << access_type << " at buffer device address 0x" << std::hex << address
8080
<< " is not aligned to the instruction Aligned operand of " << std::dec << alignment << '.';
8181
out_vuid_msg = "VUID-RuntimeSpirv-PhysicalStorageBuffer64-06315";

layers/gpuav/instrumentation/descriptor_checks.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2024-2025 LunarG, Inc.
1+
/* Copyright (c) 2024-2026 LunarG, Inc.
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -135,7 +135,7 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
135135
using namespace glsl;
136136

137137
bool error_found = false;
138-
if (GetErrorGroup(error_record) != kErrorGroupInstDescriptorIndexingOOB) {
138+
if (GetErrorGroup(error_record) != kErrorGroup_InstDescriptorIndexingOOB) {
139139
return error_found;
140140
}
141141
error_found = true;
@@ -152,25 +152,25 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
152152
desc_set_bindings.descriptor_set_binding_commands[descriptor_binding_index].bound_descriptor_sets;
153153

154154
// Currently we only encode the descriptor index here and save the binding in a parameter slot
155-
// The issue becomes if the user has kErrorSubCodeDescriptorIndexingBounds then we can't back track to the exact binding
156-
// because they have gone over it
157-
const uint32_t encoded_set_index = error_record[kInstDescriptorIndexingSetAndIndexOffset];
158-
const uint32_t set_num = encoded_set_index >> kInstDescriptorIndexingSetShift;
159-
const uint32_t descriptor_index = encoded_set_index & kInstDescriptorIndexingIndexMask;
160-
const uint32_t binding_num = error_record[kInstDescriptorIndexingParamOffset_1];
155+
// The issue becomes if the user has kErrorSubCode_DescriptorIndexing_Bounds then we can't back track to the exact
156+
// binding because they have gone over it
157+
const uint32_t encoded_set_index = error_record[kInst_LogError_ParameterOffset_0];
158+
const uint32_t set_num = encoded_set_index >> kInst_DescriptorIndexing_SetShift;
159+
const uint32_t descriptor_index = encoded_set_index & kInst_DescriptorIndexing_IndexMask;
160+
const uint32_t binding_num = error_record[kInst_LogError_ParameterOffset_2];
161161

162-
const uint32_t array_length = error_record[kInstDescriptorIndexingParamOffset_0];
162+
const uint32_t array_length = error_record[kInst_LogError_ParameterOffset_1];
163163

164164
const uint32_t error_sub_code = GetSubError(error_record);
165165
switch (error_sub_code) {
166-
case kErrorSubCodeDescriptorIndexingBounds: {
166+
case kErrorSubCode_DescriptorIndexing_Bounds: {
167167
strm << "(set = " << set_num << ", binding = " << binding_num << ") Index of " << descriptor_index
168168
<< " used to index descriptor array of length " << array_length << ".";
169169
out_vuid_msg = vuid.descriptor_index_oob_10068;
170170
error_found = true;
171171
} break;
172172

173-
case kErrorSubCodeDescriptorIndexingUninitialized: {
173+
case kErrorSubCode_DescriptorIndexing_Uninitialized: {
174174
const auto& dsl = descriptor_sets[set_num]->Layout();
175175
strm << "(set = " << set_num << ", binding = " << binding_num << ") Descriptor index " << descriptor_index
176176
<< " is uninitialized.";
@@ -194,7 +194,7 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
194194
error_found = true;
195195
} break;
196196

197-
case kErrorSubCodeDescriptorIndexingDestroyed: {
197+
case kErrorSubCode_DescriptorIndexing_Destroyed: {
198198
strm << "(set = " << set_num << ", binding = " << binding_num << ") Descriptor index " << descriptor_index
199199
<< " references a resource that was destroyed.";
200200

@@ -233,7 +233,7 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
233233
std::string& out_vuid_msg) {
234234
using namespace glsl;
235235
bool error_found = false;
236-
if (GetErrorGroup(error_record) != kErrorGroupInstDescriptorClass) {
236+
if (GetErrorGroup(error_record) != kErrorGroup_InstDescriptorClass) {
237237
return error_found;
238238
}
239239
error_found = true;
@@ -248,9 +248,9 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
248248
const auto& descriptor_sets =
249249
desc_set_bindings.descriptor_set_binding_commands[descriptor_binding_index].bound_descriptor_sets;
250250

251-
const uint32_t encoded_set_index = error_record[kInstDescriptorIndexingSetAndIndexOffset];
252-
const uint32_t set_num = encoded_set_index >> kInstDescriptorIndexingSetShift;
253-
const uint32_t global_descriptor_index = encoded_set_index & kInstDescriptorIndexingIndexMask;
251+
const uint32_t encoded_set_index = error_record[kInst_LogError_ParameterOffset_0];
252+
const uint32_t set_num = encoded_set_index >> kInst_DescriptorIndexing_SetShift;
253+
const uint32_t global_descriptor_index = encoded_set_index & kInst_DescriptorIndexing_IndexMask;
254254

255255
const auto descriptor_set_state = descriptor_sets[set_num];
256256
auto [binding_num, desc_index] = descriptor_set_state->GetBindingAndIndex(global_descriptor_index);
@@ -261,17 +261,17 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
261261

262262
const uint32_t error_sub_code = GetSubError(error_record);
263263
switch (error_sub_code) {
264-
case kErrorSubCodeDescriptorClassGeneralBufferBounds:
265-
case kErrorSubCodeDescriptorClassGeneralBufferCoopMatBounds: {
264+
case kErrorSubCode_DescriptorClass_GeneralBufferBounds:
265+
case kErrorSubCode_DescriptorClass_GeneralBufferCoopMatBounds: {
266266
if (binding_state->descriptor_class != vvl::DescriptorClass::GeneralBuffer) {
267267
assert(false);
268268
return false;
269269
}
270270
const vvl::Buffer* buffer_state =
271271
static_cast<const vvl::BufferBinding*>(binding_state)->descriptors[desc_index].GetBufferState();
272272
if (buffer_state) {
273-
const uint32_t byte_offset = error_record[kInstDescriptorIndexingParamOffset_0];
274-
const uint32_t resource_size = error_record[kInstDescriptorIndexingParamOffset_1];
273+
const uint32_t byte_offset = error_record[kInst_LogError_ParameterOffset_1];
274+
const uint32_t resource_size = error_record[kInst_LogError_ParameterOffset_2];
275275
strm << " access out of bounds. The descriptor buffer (" << gpuav.FormatHandle(buffer_state->Handle())
276276
<< ") size is " << buffer_state->create_info.size << " bytes, " << resource_size
277277
<< " bytes were bound, and the highest out of bounds access was at [" << byte_offset << "] bytes";
@@ -281,7 +281,7 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
281281
"for "
282282
"this descriptor. ";
283283
}
284-
if (error_sub_code == kErrorSubCodeDescriptorClassGeneralBufferCoopMatBounds) {
284+
if (error_sub_code == kErrorSubCode_DescriptorClass_GeneralBufferCoopMatBounds) {
285285
strm << "\nFor VK_KHR_cooperative_matrix this is invalid unless cooperativeMatrixRobustBufferAccess is "
286286
"enabled.";
287287
}
@@ -294,7 +294,7 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
294294
}
295295
} break;
296296

297-
case kErrorSubCodeDescriptorClassTexelBufferBounds: {
297+
case kErrorSubCode_DescriptorClass_TexelBufferBounds: {
298298
if (binding_state->descriptor_class != vvl::DescriptorClass::TexelBuffer) {
299299
assert(false);
300300
return false;
@@ -303,8 +303,8 @@ void RegisterDescriptorChecksValidation(Validator& gpuav, CommandBufferSubState&
303303
const vvl::BufferView* buffer_view_state =
304304
static_cast<const vvl::TexelBinding*>(binding_state)->descriptors[desc_index].GetBufferViewState();
305305
if (buffer_view_state) {
306-
const uint32_t byte_offset = error_record[kInstDescriptorIndexingParamOffset_0];
307-
const uint32_t resource_size = error_record[kInstDescriptorIndexingParamOffset_1];
306+
const uint32_t byte_offset = error_record[kInst_LogError_ParameterOffset_1];
307+
const uint32_t resource_size = error_record[kInst_LogError_ParameterOffset_2];
308308

309309
strm << " access out of bounds. The descriptor texel buffer ("
310310
<< gpuav.FormatHandle(buffer_view_state->Handle()) << ") size is " << resource_size

layers/gpuav/instrumentation/gpuav_instrumentation.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2020-2025 The Khronos Group Inc.
2-
* Copyright (c) 2020-2025 Valve Corporation
3-
* Copyright (c) 2020-2025 LunarG, Inc.
1+
/* Copyright (c) 2020-2026 The Khronos Group Inc.
2+
* Copyright (c) 2020-2026 Valve Corporation
3+
* Copyright (c) 2020-2026 LunarG, Inc.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -348,18 +348,19 @@ bool LogInstrumentationError(Validator &gpuav, const CommandBufferSubState &cb_s
348348
// Lookup the VkShaderModule handle and SPIR-V code used to create the shader, using the unique shader ID value returned
349349
// by the instrumented shader.
350350
const InstrumentedShader *instrumented_shader = nullptr;
351-
const uint32_t shader_id = error_record[glsl::kHeaderShaderIdErrorOffset] & glsl::kShaderIdMask;
351+
const uint32_t shader_id = error_record[glsl::kHeader_ShaderIdErrorOffset] & glsl::kShaderIdMask;
352352
auto it = gpuav.instrumented_shaders_map_.find(shader_id);
353353
if (it != gpuav.instrumented_shaders_map_.end()) {
354354
instrumented_shader = &it->second;
355355
}
356356

357-
const uint32_t stage_id = error_record[glsl::kHeaderStageInstructionIdOffset] >> glsl::kStageIdShift;
358-
const uint32_t instruction_position_offset = error_record[glsl::kHeaderStageInstructionIdOffset] & glsl::kInstructionIdMask;
357+
const uint32_t stage_id = error_record[glsl::kHeader_StageInstructionIdOffset] >> glsl::kStageId_Shift;
358+
const uint32_t instruction_position_offset =
359+
error_record[glsl::kHeader_StageInstructionIdOffset] & glsl::kInstructionId_Mask;
359360
GpuShaderInstrumentor::ShaderMessageInfo shader_info{stage_id,
360-
error_record[glsl::kHeaderStageInfoOffset_0],
361-
error_record[glsl::kHeaderStageInfoOffset_1],
362-
error_record[glsl::kHeaderStageInfoOffset_2],
361+
error_record[glsl::kHeader_StageInfoOffset_0],
362+
error_record[glsl::kHeader_StageInfoOffset_1],
363+
error_record[glsl::kHeader_StageInfoOffset_2],
363364
instruction_position_offset,
364365
shader_id};
365366
std::string debug_info_message = gpuav.GenerateDebugInfoMessage(

0 commit comments

Comments
 (0)