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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/* Copyright (c) 2020-2025 The Khronos Group Inc.
* Copyright (c) 2020-2025 Valve Corporation
* Copyright (c) 2020-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.
*/
#pragma once
#include <vulkan/vulkan.h>
#include "state_tracker/vertex_index_buffer_state.h"
#include <string>
#include <vector>
#include <optional>
#include <limits>
struct Location;
struct LastBound;
struct LogObjectList;
namespace vvl {
struct LabelCommand;
class DescriptorSet;
}
namespace gpuav {
class Validator;
class CommandBufferSubState;
class Queue;
struct InstrumentationErrorBlob;
void UpdateInstrumentationDescSet(Validator& gpuav, CommandBufferSubState& cb_state, VkPipelineBindPoint bind_point,
VkDescriptorSet instrumentation_desc_set, const Location& loc,
InstrumentationErrorBlob& out_instrumentation_error_blob);
void PreCallSetupShaderInstrumentationResources(Validator& gpuav, CommandBufferSubState& cb_state, VkPipelineBindPoint bind_point,
const Location& loc);
void PostCallSetupShaderInstrumentationResources(Validator& gpuav, CommandBufferSubState& cb_state, const LastBound& last_bound,
const Location& loc);
struct VertexAttributeFetchLimit {
// Default value indicates that no vertex buffer attribute fetching will be OOB
VkDeviceSize max_vertex_attributes_count = std::numeric_limits<VkDeviceSize>::max();
vvl::VertexBufferBinding binding_info{};
VkVertexInputAttributeDescription attribute{};
uint32_t instance_rate_divisor = std::numeric_limits<uint32_t>::max();
};
// This is data we capture in our lambda at command buffer recording time.
// We use this later upon an error to help hold information needed print the message
struct InstrumentationErrorBlob {
std::optional<VertexAttributeFetchLimit> vertex_attribute_fetch_limit_vertex_input_rate{};
std::optional<VertexAttributeFetchLimit> vertex_attribute_fetch_limit_instance_input_rate{};
std::optional<vvl::IndexBufferBinding> index_buffer_binding;
// indexing into the VkDebugUtilsLabelEXT
uint32_t label_command_i;
// used to know which action command this occured at
uint32_t operation_index;
// Used to know if from draw, dispatch, or traceRays
VkPipelineBindPoint pipeline_bind_point;
// Used pick which VUID to report
bool uses_shader_object;
// index into the last vkCmdBindDescriptors prior to a draw/dispatch
uint32_t descriptor_binding_index;
};
// Return true iff an error has been found
bool LogInstrumentationError(Validator& gpuav, const CommandBufferSubState& cb_state, const LogObjectList& objlist,
const InstrumentationErrorBlob& instrumentation_error_blob,
const std::vector<std::string>& initial_label_stack, const uint32_t* error_record,
const Location& loc);
// Return true iff an error has been found in error_record, among the list of errors this function manages
bool LogMessageInstDescriptorIndexingOOB(Validator& gpuav, const CommandBufferSubState& cb_state, const uint32_t* error_record,
std::string& out_error_msg, std::string& out_vuid_msg, const Location& loc,
const InstrumentationErrorBlob& instrumentation_error_blob);
bool LogMessageInstDescriptorClass(Validator& gpuav, const CommandBufferSubState& cb_state, const uint32_t* error_record,
std::string& out_error_msg, std::string& out_vuid_msg, const Location& loc,
const InstrumentationErrorBlob& instrumentation_error_blob);
bool LogMessageInstBufferDeviceAddress(const uint32_t* error_record, std::string& out_error_msg, std::string& out_vuid_msg);
bool LogMessageInstRayQuery(const uint32_t* error_record, std::string& out_error_msg, std::string& out_vuid_msg);
} // namespace gpuav
|