corechecks: Rename shader_module state class
Renamed to SHADER_MODULE_STATE.
Change-Id: I4682d9b4b2e0a9e8aab92bb94547a7f9cbe9d370
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index b9fcb47..4496280 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -756,7 +756,7 @@
return &it->second;
}
-shader_module const *CoreChecks::GetShaderModuleState(VkShaderModule module) {
+SHADER_MODULE_STATE const *CoreChecks::GetShaderModuleState(VkShaderModule module) {
auto it = shaderModuleMap.find(module);
if (it == shaderModuleMap.end()) {
return nullptr;
diff --git a/layers/core_validation.h b/layers/core_validation.h
index ea42fa2..bdf3061 100644
--- a/layers/core_validation.h
+++ b/layers/core_validation.h
@@ -176,7 +176,7 @@
unordered_map<VkPipeline, std::unique_ptr<PIPELINE_STATE>> pipelineMap;
unordered_map<VkDeviceMemory, std::unique_ptr<DEVICE_MEMORY_STATE>> memObjMap;
unordered_map<VkFramebuffer, std::unique_ptr<FRAMEBUFFER_STATE>> frameBufferMap;
- unordered_map<VkShaderModule, std::unique_ptr<shader_module>> shaderModuleMap;
+ unordered_map<VkShaderModule, std::unique_ptr<SHADER_MODULE_STATE>> shaderModuleMap;
unordered_map<VkDescriptorUpdateTemplateKHR, std::unique_ptr<TEMPLATE_STATE>> desc_template_map;
unordered_map<VkSwapchainKHR, std::unique_ptr<SWAPCHAIN_NODE>> swapchainMap;
@@ -253,7 +253,7 @@
std::shared_ptr<RENDER_PASS_STATE> GetRenderPassStateSharedPtr(VkRenderPass renderpass);
FRAMEBUFFER_STATE* GetFramebufferState(VkFramebuffer framebuffer);
COMMAND_POOL_NODE* GetCommandPoolNode(VkCommandPool pool);
- shader_module const* GetShaderModuleState(VkShaderModule module);
+ SHADER_MODULE_STATE const* GetShaderModuleState(VkShaderModule module);
FENCE_NODE* GetFenceNode(VkFence fence);
EVENT_STATE* GetEventNode(VkEvent event);
QUERY_POOL_NODE* GetQueryPoolNode(VkQueryPool query_pool);
@@ -583,15 +583,16 @@
const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule, VkResult result,
void* csm_state);
bool ValidatePipelineShaderStage(VkPipelineShaderStageCreateInfo const* pStage, PIPELINE_STATE* pipeline,
- shader_module const** out_module, spirv_inst_iter* out_entrypoint, bool check_point_size);
- bool ValidatePointListShaderState(const PIPELINE_STATE* pipeline, shader_module const* src, spirv_inst_iter entrypoint,
+ SHADER_MODULE_STATE const** out_module, spirv_inst_iter* out_entrypoint,
+ bool check_point_size);
+ bool ValidatePointListShaderState(const PIPELINE_STATE* pipeline, SHADER_MODULE_STATE const* src, spirv_inst_iter entrypoint,
VkShaderStageFlagBits stage);
- bool ValidateShaderCapabilities(shader_module const* src, VkShaderStageFlagBits stage, bool has_writable_descriptor);
- bool ValidateShaderStageInputOutputLimits(shader_module const* src, VkPipelineShaderStageCreateInfo const* pStage,
+ bool ValidateShaderCapabilities(SHADER_MODULE_STATE const* src, VkShaderStageFlagBits stage, bool has_writable_descriptor);
+ bool ValidateShaderStageInputOutputLimits(SHADER_MODULE_STATE const* src, VkPipelineShaderStageCreateInfo const* pStage,
PIPELINE_STATE* pipeline);
- bool ValidateCooperativeMatrix(shader_module const* src, VkPipelineShaderStageCreateInfo const* pStage,
+ bool ValidateCooperativeMatrix(SHADER_MODULE_STATE const* src, VkPipelineShaderStageCreateInfo const* pStage,
PIPELINE_STATE* pipeline);
- bool ValidateExecutionModes(shader_module const* src, spirv_inst_iter entrypoint);
+ bool ValidateExecutionModes(SHADER_MODULE_STATE const* src, spirv_inst_iter entrypoint);
// Gpu Validation Functions
void GpuPreCallRecordCreateDevice(VkPhysicalDevice gpu, std::unique_ptr<safe_VkDeviceCreateInfo>& modified_create_info,
@@ -1535,7 +1536,7 @@
const VkAllocationCallbacks* pAllocator);
bool PreCallValidateGetBufferDeviceAddressEXT(VkDevice device, const VkBufferDeviceAddressInfoEXT* pInfo);
bool PreCallValidateCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask);
- bool ValidateComputeWorkGroupSizes(const shader_module* shader);
+ bool ValidateComputeWorkGroupSizes(const SHADER_MODULE_STATE* shader);
bool ValidateComputeWorkGroupInvocations(GLOBAL_CB_NODE* cb_state, uint32_t groupCountX, uint32_t groupCountY,
uint32_t groupCountZ);
#ifdef VK_USE_PLATFORM_ANDROID_KHR
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h
index 38b92ea..628b9de 100644
--- a/layers/core_validation_types.h
+++ b/layers/core_validation_types.h
@@ -1560,7 +1560,7 @@
: framebuffer(fb), createInfo(pCreateInfo), rp_state(rpstate){};
};
-struct shader_module;
+struct SHADER_MODULE_STATE;
struct DeviceExtensions;
struct DeviceFeatures {
diff --git a/layers/gpu_validation.cpp b/layers/gpu_validation.cpp
index 9f6f923..f4cb473 100644
--- a/layers/gpu_validation.cpp
+++ b/layers/gpu_validation.cpp
@@ -447,7 +447,7 @@
if (replace_shaders) {
for (uint32_t stage = 0; stage < pCreateInfos[pipeline].stageCount; ++stage) {
- const shader_module *shader = GetShaderModuleState(pCreateInfos[pipeline].pStages[stage].module);
+ const SHADER_MODULE_STATE *shader = GetShaderModuleState(pCreateInfos[pipeline].pStages[stage].module);
VkShaderModuleCreateInfo create_info = {};
VkShaderModule shader_module;
create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
@@ -658,7 +658,8 @@
// Read the contents of the SPIR-V OpSource instruction and any following continuation instructions.
// Split the single string into a vector of strings, one for each line, for easier processing.
-static void ReadOpSource(const shader_module &shader, const uint32_t reported_file_id, std::vector<std::string> &opsource_lines) {
+static void ReadOpSource(const SHADER_MODULE_STATE &shader, const uint32_t reported_file_id,
+ std::vector<std::string> &opsource_lines) {
for (auto insn : shader) {
if ((insn.opcode() == spv::OpSource) && (insn.len() >= 5) && (insn.word(3) == reported_file_id)) {
std::istringstream in_stream;
@@ -760,7 +761,7 @@
using namespace spvtools;
std::ostringstream filename_stream;
std::ostringstream source_stream;
- shader_module shader;
+ SHADER_MODULE_STATE shader;
shader.words = pgm;
// Find the OpLine just before the failing instruction indicated by the debug info.
// SPIR-V can only be iterated in the forward direction due to its opcode/length encoding.
diff --git a/layers/shader_validation.cpp b/layers/shader_validation.cpp
index 2180f64..76e9f13 100644
--- a/layers/shader_validation.cpp
+++ b/layers/shader_validation.cpp
@@ -72,7 +72,7 @@
};
// SPIRV utility functions
-void shader_module::BuildDefIndex() {
+void SHADER_MODULE_STATE::BuildDefIndex() {
for (auto insn : *this) {
switch (insn.opcode()) {
// Types
@@ -172,7 +172,7 @@
}
}
-static spirv_inst_iter FindEntrypoint(shader_module const *src, char const *name, VkShaderStageFlagBits stageBits) {
+static spirv_inst_iter FindEntrypoint(SHADER_MODULE_STATE const *src, char const *name, VkShaderStageFlagBits stageBits) {
for (auto insn : *src) {
if (insn.opcode() == spv::OpEntryPoint) {
auto entrypointName = (char const *)&insn.word(3);
@@ -222,7 +222,7 @@
}
// Get the value of an integral constant
-unsigned GetConstantValue(shader_module const *src, unsigned id) {
+unsigned GetConstantValue(SHADER_MODULE_STATE const *src, unsigned id) {
auto value = src->get_def(id);
assert(value != src->end());
@@ -235,7 +235,7 @@
return value.word(3);
}
-static void DescribeTypeInner(std::ostringstream &ss, shader_module const *src, unsigned type) {
+static void DescribeTypeInner(std::ostringstream &ss, SHADER_MODULE_STATE const *src, unsigned type) {
auto insn = src->get_def(type);
assert(insn != src->end());
@@ -300,7 +300,7 @@
}
}
-static std::string DescribeType(shader_module const *src, unsigned type) {
+static std::string DescribeType(SHADER_MODULE_STATE const *src, unsigned type) {
std::ostringstream ss;
DescribeTypeInner(ss, src, type);
return ss.str();
@@ -311,7 +311,7 @@
return type.word(2) < 64;
}
-static bool TypesMatch(shader_module const *a, shader_module const *b, unsigned a_type, unsigned b_type, bool a_arrayed,
+static bool TypesMatch(SHADER_MODULE_STATE const *a, SHADER_MODULE_STATE const *b, unsigned a_type, unsigned b_type, bool a_arrayed,
bool b_arrayed, bool relaxed) {
// Walk two type trees together, and complain about differences
auto a_insn = a->get_def(a_type);
@@ -403,7 +403,7 @@
return it->second;
}
-static unsigned GetLocationsConsumedByType(shader_module const *src, unsigned type, bool strip_array_level) {
+static unsigned GetLocationsConsumedByType(SHADER_MODULE_STATE const *src, unsigned type, bool strip_array_level) {
auto insn = src->get_def(type);
assert(insn != src->end());
@@ -437,7 +437,7 @@
}
}
-static unsigned GetComponentsConsumedByType(shader_module const *src, unsigned type, bool strip_array_level) {
+static unsigned GetComponentsConsumedByType(SHADER_MODULE_STATE const *src, unsigned type, bool strip_array_level) {
auto insn = src->get_def(type);
assert(insn != src->end());
@@ -510,7 +510,7 @@
// characterizes a SPIR-V type appearing in an interface to a FF stage, for comparison to a VkFormat's characterization above.
// also used for input attachments, as we statically know their format.
-static unsigned GetFundamentalType(shader_module const *src, unsigned type) {
+static unsigned GetFundamentalType(SHADER_MODULE_STATE const *src, unsigned type) {
auto insn = src->get_def(type);
assert(insn != src->end());
@@ -538,7 +538,7 @@
return bit_pos - 1;
}
-static spirv_inst_iter GetStructType(shader_module const *src, spirv_inst_iter def, bool is_array_of_verts) {
+static spirv_inst_iter GetStructType(SHADER_MODULE_STATE const *src, spirv_inst_iter def, bool is_array_of_verts) {
while (true) {
if (def.opcode() == spv::OpTypePointer) {
def = src->get_def(def.word(3));
@@ -553,7 +553,7 @@
}
}
-static bool CollectInterfaceBlockMembers(shader_module const *src, std::map<location_t, interface_var> *out,
+static bool CollectInterfaceBlockMembers(SHADER_MODULE_STATE const *src, std::map<location_t, interface_var> *out,
std::unordered_map<unsigned, unsigned> const &blocks, bool is_array_of_verts, uint32_t id,
uint32_t type_id, bool is_patch, int /*first_location*/) {
// Walk down the type_id presented, trying to determine whether it's actually an interface block.
@@ -636,7 +636,7 @@
return interfaces;
}
-static std::map<location_t, interface_var> CollectInterfaceByLocation(shader_module const *src, spirv_inst_iter entrypoint,
+static std::map<location_t, interface_var> CollectInterfaceByLocation(SHADER_MODULE_STATE const *src, spirv_inst_iter entrypoint,
spv::StorageClass sinterface, bool is_array_of_verts) {
std::unordered_map<unsigned, unsigned> var_locations;
std::unordered_map<unsigned, unsigned> var_builtins;
@@ -717,7 +717,7 @@
return out;
}
-static std::vector<uint32_t> CollectBuiltinBlockMembers(shader_module const *src, spirv_inst_iter entrypoint,
+static std::vector<uint32_t> CollectBuiltinBlockMembers(SHADER_MODULE_STATE const *src, spirv_inst_iter entrypoint,
uint32_t storageClass) {
std::vector<uint32_t> variables;
std::vector<uint32_t> builtinStructMembers;
@@ -798,7 +798,7 @@
}
static std::vector<std::pair<uint32_t, interface_var>> CollectInterfaceByInputAttachmentIndex(
- shader_module const *src, std::unordered_set<uint32_t> const &accessible_ids) {
+ SHADER_MODULE_STATE const *src, std::unordered_set<uint32_t> const &accessible_ids) {
std::vector<std::pair<uint32_t, interface_var>> out;
for (auto insn : *src) {
@@ -829,7 +829,7 @@
return out;
}
-static bool IsWritableDescriptorType(shader_module const *module, uint32_t type_id, bool is_storage_buffer) {
+static bool IsWritableDescriptorType(SHADER_MODULE_STATE const *module, uint32_t type_id, bool is_storage_buffer) {
auto type = module->get_def(type_id);
// Strip off any array or ptrs. Where we remove array levels, adjust the descriptor count for each dimension.
@@ -873,7 +873,7 @@
}
static std::vector<std::pair<descriptor_slot_t, interface_var>> CollectInterfaceByDescriptorSlot(
- debug_report_data const *report_data, shader_module const *src, std::unordered_set<uint32_t> const &accessible_ids,
+ debug_report_data const *report_data, SHADER_MODULE_STATE const *src, std::unordered_set<uint32_t> const &accessible_ids,
bool *has_writable_descriptor) {
std::unordered_map<unsigned, unsigned> var_sets;
std::unordered_map<unsigned, unsigned> var_bindings;
@@ -949,7 +949,7 @@
}
static bool ValidateViAgainstVsInputs(debug_report_data const *report_data, VkPipelineVertexInputStateCreateInfo const *vi,
- shader_module const *vs, spirv_inst_iter entrypoint) {
+ SHADER_MODULE_STATE const *vs, spirv_inst_iter entrypoint) {
bool skip = false;
auto inputs = CollectInterfaceByLocation(vs, entrypoint, spv::StorageClassInput, false);
@@ -1010,7 +1010,7 @@
return skip;
}
-static bool ValidateFsOutputsAgainstRenderPass(debug_report_data const *report_data, shader_module const *fs,
+static bool ValidateFsOutputsAgainstRenderPass(debug_report_data const *report_data, SHADER_MODULE_STATE const *fs,
spirv_inst_iter entrypoint, PIPELINE_STATE const *pipeline, uint32_t subpass_index) {
auto rpci = pipeline->rp_state->createInfo.ptr();
@@ -1097,7 +1097,7 @@
// For PointSize analysis we need to know if the variable decorated with the PointSize built-in was actually written to.
// This function examines instructions in the static call tree for a write to this variable.
-static bool IsPointSizeWritten(shader_module const *src, spirv_inst_iter builtin_instr, spirv_inst_iter entrypoint) {
+static bool IsPointSizeWritten(SHADER_MODULE_STATE const *src, spirv_inst_iter builtin_instr, spirv_inst_iter entrypoint) {
auto type = builtin_instr.opcode();
uint32_t target_id = builtin_instr.word(1);
bool init_complete = false;
@@ -1178,7 +1178,7 @@
//
// TODO: The set of interesting opcodes here was determined by eyeballing the SPIRV spec. It might be worth
// converting parts of this to be generated from the machine-readable spec instead.
-static std::unordered_set<uint32_t> MarkAccessibleIds(shader_module const *src, spirv_inst_iter entrypoint) {
+static std::unordered_set<uint32_t> MarkAccessibleIds(SHADER_MODULE_STATE const *src, spirv_inst_iter entrypoint) {
std::unordered_set<uint32_t> ids;
std::unordered_set<uint32_t> worklist;
worklist.insert(entrypoint.word(2));
@@ -1291,7 +1291,8 @@
static bool ValidatePushConstantBlockAgainstPipeline(debug_report_data const *report_data,
std::vector<VkPushConstantRange> const *push_constant_ranges,
- shader_module const *src, spirv_inst_iter type, VkShaderStageFlagBits stage) {
+ SHADER_MODULE_STATE const *src, spirv_inst_iter type,
+ VkShaderStageFlagBits stage) {
bool skip = false;
// Strip off ptrs etc
@@ -1336,7 +1337,7 @@
}
static bool ValidatePushConstantUsage(debug_report_data const *report_data,
- std::vector<VkPushConstantRange> const *push_constant_ranges, shader_module const *src,
+ std::vector<VkPushConstantRange> const *push_constant_ranges, SHADER_MODULE_STATE const *src,
std::unordered_set<uint32_t> accessible_ids, VkShaderStageFlagBits stage) {
bool skip = false;
@@ -1375,7 +1376,7 @@
}
// TODO (jbolz): Can this return a const reference?
-static std::set<uint32_t> TypeToDescriptorTypeSet(shader_module const *module, uint32_t type_id, unsigned &descriptor_count) {
+static std::set<uint32_t> TypeToDescriptorTypeSet(SHADER_MODULE_STATE const *module, uint32_t type_id, unsigned &descriptor_count) {
auto type = module->get_def(type_id);
bool is_storage_buffer = false;
descriptor_count = 1;
@@ -1511,7 +1512,8 @@
return false;
}
-bool CoreChecks::ValidateShaderCapabilities(shader_module const *src, VkShaderStageFlagBits stage, bool has_writable_descriptor) {
+bool CoreChecks::ValidateShaderCapabilities(SHADER_MODULE_STATE const *src, VkShaderStageFlagBits stage,
+ bool has_writable_descriptor) {
bool skip = false;
struct FeaturePointer {
@@ -1717,7 +1719,7 @@
return skip;
}
-static bool VariableIsBuiltIn(shader_module const *src, const uint32_t ID, std::vector<uint32_t> const &builtInBlockIDs,
+static bool VariableIsBuiltIn(SHADER_MODULE_STATE const *src, const uint32_t ID, std::vector<uint32_t> const &builtInBlockIDs,
std::vector<uint32_t> const &builtInIDs) {
auto insn = src->get_def(ID);
@@ -1753,7 +1755,7 @@
return false;
}
-bool CoreChecks::ValidateShaderStageInputOutputLimits(shader_module const *src, VkPipelineShaderStageCreateInfo const *pStage,
+bool CoreChecks::ValidateShaderStageInputOutputLimits(SHADER_MODULE_STATE const *src, VkPipelineShaderStageCreateInfo const *pStage,
PIPELINE_STATE *pipeline) {
if (pStage->stage == VK_SHADER_STAGE_COMPUTE_BIT || pStage->stage == VK_SHADER_STAGE_ALL_GRAPHICS ||
pStage->stage == VK_SHADER_STAGE_ALL) {
@@ -1946,7 +1948,7 @@
// Fill in value with the constant or specialization constant value, if available.
// Returns true if the value has been accurately filled out.
-static bool GetIntConstantValue(spirv_inst_iter insn, shader_module const *src, VkPipelineShaderStageCreateInfo const *pStage,
+static bool GetIntConstantValue(spirv_inst_iter insn, SHADER_MODULE_STATE const *src, VkPipelineShaderStageCreateInfo const *pStage,
const std::unordered_map<uint32_t, uint32_t> &id_to_spec_id, uint32_t *value) {
auto type_id = src->get_def(insn.word(1));
if (type_id.opcode() != spv::OpTypeInt || type_id.word(2) != 32) {
@@ -1966,7 +1968,7 @@
}
// Map SPIR-V type to VK_COMPONENT_TYPE enum
-VkComponentTypeNV GetComponentType(spirv_inst_iter insn, shader_module const *src) {
+VkComponentTypeNV GetComponentType(spirv_inst_iter insn, SHADER_MODULE_STATE const *src) {
switch (insn.opcode()) {
case spv::OpTypeInt:
switch (insn.word(2)) {
@@ -1999,7 +2001,7 @@
// Validate SPV_NV_cooperative_matrix behavior that can't be statically validated
// in SPIRV-Tools (e.g. due to specialization constant usage).
-bool CoreChecks::ValidateCooperativeMatrix(shader_module const *src, VkPipelineShaderStageCreateInfo const *pStage,
+bool CoreChecks::ValidateCooperativeMatrix(SHADER_MODULE_STATE const *src, VkPipelineShaderStageCreateInfo const *pStage,
PIPELINE_STATE *pipeline) {
bool skip = false;
@@ -2015,7 +2017,7 @@
CoopMatType() : scope(0), rows(0), cols(0), component_type(VK_COMPONENT_TYPE_MAX_ENUM_NV), all_constant(false) {}
- void Init(uint32_t id, shader_module const *src, VkPipelineShaderStageCreateInfo const *pStage,
+ void Init(uint32_t id, SHADER_MODULE_STATE const *src, VkPipelineShaderStageCreateInfo const *pStage,
const std::unordered_map<uint32_t, uint32_t> &id_to_spec_id) {
spirv_inst_iter insn = src->get_def(id);
uint32_t component_type_id = insn.word(2);
@@ -2203,7 +2205,7 @@
return skip;
}
-bool CoreChecks::ValidateExecutionModes(shader_module const *src, spirv_inst_iter entrypoint) {
+bool CoreChecks::ValidateExecutionModes(SHADER_MODULE_STATE const *src, spirv_inst_iter entrypoint) {
auto entrypoint_id = entrypoint.word(2);
// The first denorm execution mode encountered, along with its bit width.
@@ -2336,7 +2338,7 @@
return skip;
}
-static uint32_t DescriptorTypeToReqs(shader_module const *module, uint32_t type_id) {
+static uint32_t DescriptorTypeToReqs(SHADER_MODULE_STATE const *module, uint32_t type_id) {
auto type = module->get_def(type_id);
while (true) {
@@ -2407,7 +2409,7 @@
return pipelineLayout->set_layouts[slot.first]->GetDescriptorSetLayoutBindingPtrFromBinding(slot.second);
}
-static bool FindLocalSize(shader_module const *src, uint32_t &local_size_x, uint32_t &local_size_y, uint32_t &local_size_z) {
+static bool FindLocalSize(SHADER_MODULE_STATE const *src, uint32_t &local_size_x, uint32_t &local_size_y, uint32_t &local_size_z) {
for (auto insn : *src) {
if (insn.opcode() == spv::OpEntryPoint) {
auto executionModel = insn.word(1);
@@ -2429,7 +2431,7 @@
return false;
}
-static void ProcessExecutionModes(shader_module const *src, spirv_inst_iter entrypoint, PIPELINE_STATE *pipeline) {
+static void ProcessExecutionModes(SHADER_MODULE_STATE const *src, spirv_inst_iter entrypoint, PIPELINE_STATE *pipeline) {
auto entrypoint_id = entrypoint.word(2);
bool is_point_mode = false;
@@ -2469,8 +2471,8 @@
// * gl_PointSize must be written in the final geometry stage
// - If shaderTessellationAndGeometryPointSize feature is disabled:
// * gl_PointSize must NOT be written and a default of 1.0 is assumed
-bool CoreChecks::ValidatePointListShaderState(const PIPELINE_STATE *pipeline, shader_module const *src, spirv_inst_iter entrypoint,
- VkShaderStageFlagBits stage) {
+bool CoreChecks::ValidatePointListShaderState(const PIPELINE_STATE *pipeline, SHADER_MODULE_STATE const *src,
+ spirv_inst_iter entrypoint, VkShaderStageFlagBits stage) {
if (pipeline->topology_at_rasterizer != VK_PRIMITIVE_TOPOLOGY_POINT_LIST) {
return false;
}
@@ -2518,7 +2520,7 @@
}
bool CoreChecks::ValidatePipelineShaderStage(VkPipelineShaderStageCreateInfo const *pStage, PIPELINE_STATE *pipeline,
- shader_module const **out_module, spirv_inst_iter *out_entrypoint,
+ SHADER_MODULE_STATE const **out_module, spirv_inst_iter *out_entrypoint,
bool check_point_size) {
bool skip = false;
auto module = *out_module = GetShaderModuleState(pStage->module);
@@ -2622,9 +2624,9 @@
return skip;
}
-static bool ValidateInterfaceBetweenStages(debug_report_data const *report_data, shader_module const *producer,
+static bool ValidateInterfaceBetweenStages(debug_report_data const *report_data, SHADER_MODULE_STATE const *producer,
spirv_inst_iter producer_entrypoint, shader_stage_attributes const *producer_stage,
- shader_module const *consumer, spirv_inst_iter consumer_entrypoint,
+ SHADER_MODULE_STATE const *consumer, spirv_inst_iter consumer_entrypoint,
shader_stage_attributes const *consumer_stage) {
bool skip = false;
@@ -2745,7 +2747,7 @@
int vertex_stage = GetShaderStageId(VK_SHADER_STAGE_VERTEX_BIT);
int fragment_stage = GetShaderStageId(VK_SHADER_STAGE_FRAGMENT_BIT);
- shader_module const *shaders[32];
+ SHADER_MODULE_STATE const *shaders[32];
memset(shaders, 0, sizeof(shaders));
spirv_inst_iter entrypoints[32];
memset(entrypoints, 0, sizeof(entrypoints));
@@ -2805,7 +2807,7 @@
bool CoreChecks::ValidateComputePipeline(PIPELINE_STATE *pipeline) {
auto pCreateInfo = pipeline->computePipelineCI.ptr();
- shader_module const *module;
+ SHADER_MODULE_STATE const *module;
spirv_inst_iter entrypoint;
return ValidatePipelineShaderStage(&pCreateInfo->stage, pipeline, &module, &entrypoint, false);
@@ -2814,7 +2816,7 @@
bool CoreChecks::ValidateRayTracingPipelineNV(PIPELINE_STATE *pipeline) {
auto pCreateInfo = pipeline->raytracingPipelineCI.ptr();
- shader_module const *module;
+ SHADER_MODULE_STATE const *module;
spirv_inst_iter entrypoint;
return ValidatePipelineShaderStage(pCreateInfo->pStages, pipeline, &module, &entrypoint, false);
@@ -2910,13 +2912,13 @@
spv_target_env spirv_environment = ((api_version >= VK_API_VERSION_1_1) ? SPV_ENV_VULKAN_1_1 : SPV_ENV_VULKAN_1_0);
bool is_spirv = (pCreateInfo->pCode[0] == spv::MagicNumber);
- std::unique_ptr<shader_module> new_shader_module(
- is_spirv ? new shader_module(pCreateInfo, *pShaderModule, spirv_environment, csm_state->unique_shader_id)
- : new shader_module());
+ std::unique_ptr<SHADER_MODULE_STATE> new_shader_module(
+ is_spirv ? new SHADER_MODULE_STATE(pCreateInfo, *pShaderModule, spirv_environment, csm_state->unique_shader_id)
+ : new SHADER_MODULE_STATE());
shaderModuleMap[*pShaderModule] = std::move(new_shader_module);
}
-bool CoreChecks::ValidateComputeWorkGroupSizes(const shader_module *shader) {
+bool CoreChecks::ValidateComputeWorkGroupSizes(const SHADER_MODULE_STATE *shader) {
bool skip = false;
uint32_t local_size_x = 0;
uint32_t local_size_y = 0;
@@ -2980,7 +2982,8 @@
auto pCreateInfo = pPipe->computePipelineCI.ptr();
if (!pCreateInfo) return false;
- unordered_map<VkShaderModule, std::unique_ptr<shader_module>>::iterator it = shaderModuleMap.find(pCreateInfo->stage.module);
+ unordered_map<VkShaderModule, std::unique_ptr<SHADER_MODULE_STATE>>::iterator it =
+ shaderModuleMap.find(pCreateInfo->stage.module);
if (it != shaderModuleMap.end()) {
uint32_t local_size_x = 0;
uint32_t local_size_y = 0;
diff --git a/layers/shader_validation.h b/layers/shader_validation.h
index 2c189af..36f54b0 100644
--- a/layers/shader_validation.h
+++ b/layers/shader_validation.h
@@ -69,7 +69,7 @@
spirv_inst_iter const &operator*() const { return *this; }
};
-struct shader_module {
+struct SHADER_MODULE_STATE {
// The spirv image itself
std::vector<uint32_t> words;
// A mapping of <id> to the first word of its def. this is useful because walking type
@@ -124,8 +124,8 @@
return src;
}
- shader_module(VkShaderModuleCreateInfo const *pCreateInfo, VkShaderModule shaderModule, spv_target_env env,
- uint32_t unique_shader_id)
+ SHADER_MODULE_STATE(VkShaderModuleCreateInfo const *pCreateInfo, VkShaderModule shaderModule, spv_target_env env,
+ uint32_t unique_shader_id)
: words(PreprocessShaderBinary((uint32_t *)pCreateInfo->pCode, pCreateInfo->codeSize, env)),
def_index(),
has_valid_spirv(true),
@@ -134,7 +134,7 @@
BuildDefIndex();
}
- shader_module() : has_valid_spirv(false), vk_shader_module(VK_NULL_HANDLE) {}
+ SHADER_MODULE_STATE() : has_valid_spirv(false), vk_shader_module(VK_NULL_HANDLE) {}
// Expose begin() / end() to enable range-based for
spirv_inst_iter begin() const { return spirv_inst_iter(words.begin(), words.begin() + 5); } // First insn