blob: 7672988f7d86d92c1a66e68c3d9954db13c2d2dc [file] [log] [blame]
sfricke-samsungef15e482022-01-26 11:32:49 -08001/* Copyright (c) 2020-2022 The Khronos Group Inc.
2 * Copyright (c) 2020-2022 Valve Corporation
3 * Copyright (c) 2020-2022 LunarG, Inc.
Tony-LunarG1dce2392019-10-23 16:49:29 -06004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Author: Tony Barbour <tony@lunarg.com>
18 */
19#pragma once
20#include "chassis.h"
21#include "shader_validation.h"
Jeremy Gebben159b3cc2021-06-03 09:09:03 -060022#include "cmd_buffer_state.h"
Jeremy Gebben5160e032022-03-28 14:57:43 -060023#include "state_tracker.h"
24#include "vk_mem_alloc.h"
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -060025#include "queue_state.h"
Jeremy Gebben5160e032022-03-28 14:57:43 -060026
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -060027class GpuAssistedBase;
Jeremy Gebben159b3cc2021-06-03 09:09:03 -060028
Tony-LunarGb5fae462020-03-05 12:43:25 -070029class UtilDescriptorSetManager {
Tony-LunarG1dce2392019-10-23 16:49:29 -060030 public:
Tony-LunarGb5fae462020-03-05 12:43:25 -070031 UtilDescriptorSetManager(VkDevice device, uint32_t numBindingsInSet);
32 ~UtilDescriptorSetManager();
Tony-LunarG1dce2392019-10-23 16:49:29 -060033
34 VkResult GetDescriptorSet(VkDescriptorPool *desc_pool, VkDescriptorSetLayout ds_layout, VkDescriptorSet *desc_sets);
35 VkResult GetDescriptorSets(uint32_t count, VkDescriptorPool *pool, VkDescriptorSetLayout ds_layout,
36 std::vector<VkDescriptorSet> *desc_sets);
37 void PutBackDescriptorSet(VkDescriptorPool desc_pool, VkDescriptorSet desc_set);
38
39 private:
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -060040 std::unique_lock<std::mutex> Lock() const { return std::unique_lock<std::mutex>(lock_); }
41
Tony-LunarG1dce2392019-10-23 16:49:29 -060042 static const uint32_t kItemsPerChunk = 512;
43 struct PoolTracker {
44 uint32_t size;
45 uint32_t used;
46 };
47 VkDevice device;
48 uint32_t numBindingsInSet;
Jeremy Gebbencbf22862021-03-03 12:01:22 -070049 layer_data::unordered_map<VkDescriptorPool, struct PoolTracker> desc_pool_map_;
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -060050 mutable std::mutex lock_;
Tony-LunarG1dce2392019-10-23 16:49:29 -060051};
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -060052
53namespace gpu_utils_state {
54class Queue : public QUEUE_STATE {
55 public:
56 Queue(GpuAssistedBase &state, VkQueue q, uint32_t index, VkDeviceQueueCreateFlags flags);
57 virtual ~Queue();
58 void SubmitBarrier();
59
60 private:
61 GpuAssistedBase &state_;
62 VkCommandPool barrier_command_pool_{VK_NULL_HANDLE};
63 VkCommandBuffer barrier_command_buffer_{VK_NULL_HANDLE};
Tony-LunarG1dce2392019-10-23 16:49:29 -060064};
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -060065} // namespace gpu_utils_state
66VALSTATETRACK_DERIVED_STATE_OBJECT(VkQueue, gpu_utils_state::Queue, QUEUE_STATE);
67
Tony-LunarGb5fae462020-03-05 12:43:25 -070068VkResult UtilInitializeVma(VkPhysicalDevice physical_device, VkDevice device, VmaAllocator *pAllocator);
Tony-LunarG1dce2392019-10-23 16:49:29 -060069template <typename ObjectType>
Tony-LunarGb5fae462020-03-05 12:43:25 -070070void UtilPreCallRecordCreatePipelineLayout(create_pipeline_layout_api_state *cpl_state, ObjectType *object_ptr,
71 const VkPipelineLayoutCreateInfo *pCreateInfo) {
Tony-LunarG1dce2392019-10-23 16:49:29 -060072 // Modify the pipeline layout by:
73 // 1. Copying the caller's descriptor set desc_layouts
74 // 2. Fill in dummy descriptor layouts up to the max binding
75 // 3. Fill in with the debug descriptor layout at the max binding slot
76 cpl_state->new_layouts.reserve(object_ptr->adjusted_max_desc_sets);
77 cpl_state->new_layouts.insert(cpl_state->new_layouts.end(), &pCreateInfo->pSetLayouts[0],
78 &pCreateInfo->pSetLayouts[pCreateInfo->setLayoutCount]);
79 for (uint32_t i = pCreateInfo->setLayoutCount; i < object_ptr->adjusted_max_desc_sets - 1; ++i) {
80 cpl_state->new_layouts.push_back(object_ptr->dummy_desc_layout);
81 }
82 cpl_state->new_layouts.push_back(object_ptr->debug_desc_layout);
83 cpl_state->modified_create_info.pSetLayouts = cpl_state->new_layouts.data();
84 cpl_state->modified_create_info.setLayoutCount = object_ptr->adjusted_max_desc_sets;
85}
86
87template <typename CreateInfo>
88struct CreatePipelineTraits {};
89template <>
90struct CreatePipelineTraits<VkGraphicsPipelineCreateInfo> {
91 using SafeType = safe_VkGraphicsPipelineCreateInfo;
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -070092 static const SafeType &GetPipelineCI(const PIPELINE_STATE *pipeline_state) {
93 return pipeline_state->GetUnifiedCreateInfo().graphics;
94 }
Tony-LunarG1dce2392019-10-23 16:49:29 -060095 static uint32_t GetStageCount(const VkGraphicsPipelineCreateInfo &createInfo) { return createInfo.stageCount; }
96 static VkShaderModule GetShaderModule(const VkGraphicsPipelineCreateInfo &createInfo, uint32_t stage) {
97 return createInfo.pStages[stage].module;
98 }
99 static void SetShaderModule(SafeType *createInfo, VkShaderModule shader_module, uint32_t stage) {
100 createInfo->pStages[stage].module = shader_module;
101 }
102};
103
104template <>
105struct CreatePipelineTraits<VkComputePipelineCreateInfo> {
106 using SafeType = safe_VkComputePipelineCreateInfo;
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700107 static const SafeType &GetPipelineCI(const PIPELINE_STATE *pipeline_state) {
108 return pipeline_state->GetUnifiedCreateInfo().compute;
109 }
Tony-LunarG1dce2392019-10-23 16:49:29 -0600110 static uint32_t GetStageCount(const VkComputePipelineCreateInfo &createInfo) { return 1; }
111 static VkShaderModule GetShaderModule(const VkComputePipelineCreateInfo &createInfo, uint32_t stage) {
112 return createInfo.stage.module;
113 }
114 static void SetShaderModule(SafeType *createInfo, VkShaderModule shader_module, uint32_t stage) {
115 assert(stage == 0);
116 createInfo->stage.module = shader_module;
117 }
118};
119
120template <>
121struct CreatePipelineTraits<VkRayTracingPipelineCreateInfoNV> {
122 using SafeType = safe_VkRayTracingPipelineCreateInfoCommon;
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700123 static const SafeType &GetPipelineCI(const PIPELINE_STATE *pipeline_state) {
124 return pipeline_state->GetUnifiedCreateInfo().raytracing;
125 }
Tony-LunarG1dce2392019-10-23 16:49:29 -0600126 static uint32_t GetStageCount(const VkRayTracingPipelineCreateInfoNV &createInfo) { return createInfo.stageCount; }
127 static VkShaderModule GetShaderModule(const VkRayTracingPipelineCreateInfoNV &createInfo, uint32_t stage) {
128 return createInfo.pStages[stage].module;
129 }
130 static void SetShaderModule(SafeType *createInfo, VkShaderModule shader_module, uint32_t stage) {
131 createInfo->pStages[stage].module = shader_module;
132 }
133};
134
135template <>
136struct CreatePipelineTraits<VkRayTracingPipelineCreateInfoKHR> {
137 using SafeType = safe_VkRayTracingPipelineCreateInfoCommon;
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700138 static const SafeType &GetPipelineCI(const PIPELINE_STATE *pipeline_state) {
139 return pipeline_state->GetUnifiedCreateInfo().raytracing;
140 }
Tony-LunarG1dce2392019-10-23 16:49:29 -0600141 static uint32_t GetStageCount(const VkRayTracingPipelineCreateInfoKHR &createInfo) { return createInfo.stageCount; }
142 static VkShaderModule GetShaderModule(const VkRayTracingPipelineCreateInfoKHR &createInfo, uint32_t stage) {
143 return createInfo.pStages[stage].module;
144 }
145 static void SetShaderModule(SafeType *createInfo, VkShaderModule shader_module, uint32_t stage) {
146 createInfo->pStages[stage].module = shader_module;
147 }
148};
149
150// Examine the pipelines to see if they use the debug descriptor set binding index.
151// If any do, create new non-instrumented shader modules and use them to replace the instrumented
152// shaders in the pipeline. Return the (possibly) modified create infos to the caller.
153template <typename CreateInfo, typename SafeCreateInfo, typename ObjectType>
Tony-LunarGb5fae462020-03-05 12:43:25 -0700154void UtilPreCallRecordPipelineCreations(uint32_t count, const CreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator,
155 VkPipeline *pPipelines, std::vector<std::shared_ptr<PIPELINE_STATE>> &pipe_state,
156 std::vector<SafeCreateInfo> *new_pipeline_create_infos,
157 const VkPipelineBindPoint bind_point, ObjectType *object_ptr) {
Tony-LunarG1dce2392019-10-23 16:49:29 -0600158 using Accessor = CreatePipelineTraits<CreateInfo>;
159 if (bind_point != VK_PIPELINE_BIND_POINT_GRAPHICS && bind_point != VK_PIPELINE_BIND_POINT_COMPUTE &&
160 bind_point != VK_PIPELINE_BIND_POINT_RAY_TRACING_NV) {
161 return;
162 }
163
164 // Walk through all the pipelines, make a copy of each and flag each pipeline that contains a shader that uses the debug
165 // descriptor set index.
166 for (uint32_t pipeline = 0; pipeline < count; ++pipeline) {
167 uint32_t stageCount = Accessor::GetStageCount(pCreateInfos[pipeline]);
168 new_pipeline_create_infos->push_back(Accessor::GetPipelineCI(pipe_state[pipeline].get()));
Nathaniel Cesariobcb79682022-03-31 21:13:52 -0600169 const auto &pipe = pipe_state[pipeline];
Tony-LunarG1dce2392019-10-23 16:49:29 -0600170
Nathaniel Cesariobcb79682022-03-31 21:13:52 -0600171 if (!pipe->IsGraphicsLibrary()) {
172 bool replace_shaders = false;
173 if (pipe->active_slots.find(object_ptr->desc_set_bind_index) != pipe->active_slots.end()) {
174 replace_shaders = true;
175 }
176 // If the app requests all available sets, the pipeline layout was not modified at pipeline layout creation and the
177 // already instrumented shaders need to be replaced with uninstrumented shaders
178 const auto pipeline_layout = pipe->PipelineLayoutState();
179 if (pipeline_layout->set_layouts.size() >= object_ptr->adjusted_max_desc_sets) {
180 replace_shaders = true;
181 }
Tony-LunarG1dce2392019-10-23 16:49:29 -0600182
Nathaniel Cesariobcb79682022-03-31 21:13:52 -0600183 if (replace_shaders) {
184 for (uint32_t stage = 0; stage < stageCount; ++stage) {
185 const auto module_state =
186 object_ptr->template Get<SHADER_MODULE_STATE>(Accessor::GetShaderModule(pCreateInfos[pipeline], stage));
Tony-LunarG1dce2392019-10-23 16:49:29 -0600187
Nathaniel Cesariobcb79682022-03-31 21:13:52 -0600188 VkShaderModule shader_module;
189 auto create_info = LvlInitStruct<VkShaderModuleCreateInfo>();
190 create_info.pCode = module_state->words.data();
191 create_info.codeSize = module_state->words.size() * sizeof(uint32_t);
192 VkResult result = DispatchCreateShaderModule(object_ptr->device, &create_info, pAllocator, &shader_module);
193 if (result == VK_SUCCESS) {
194 Accessor::SetShaderModule(&(*new_pipeline_create_infos)[pipeline], shader_module, stage);
195 } else {
196 object_ptr->ReportSetupProblem(object_ptr->device,
197 "Unable to replace instrumented shader with non-instrumented one. "
198 "Device could become unstable.");
199 }
Tony-LunarG1dce2392019-10-23 16:49:29 -0600200 }
201 }
202 }
203 }
204}
205// For every pipeline:
206// - For every shader in a pipeline:
207// - If the shader had to be replaced in PreCallRecord (because the pipeline is using the debug desc set index):
208// - Destroy it since it has been bound into the pipeline by now. This is our only chance to delete it.
209// - Track the shader in the shader_map
210// - Save the shader binary if it contains debug code
211template <typename CreateInfo, typename ObjectType>
Tony-LunarGb5fae462020-03-05 12:43:25 -0700212void UtilPostCallRecordPipelineCreations(const uint32_t count, const CreateInfo *pCreateInfos,
aitor-lunarg3c145292022-03-25 17:30:11 +0100213 const VkAllocationCallbacks *pAllocator, const VkPipeline *pPipelines,
Tony-LunarGb5fae462020-03-05 12:43:25 -0700214 const VkPipelineBindPoint bind_point, ObjectType *object_ptr) {
Tony-LunarG1dce2392019-10-23 16:49:29 -0600215 using Accessor = CreatePipelineTraits<CreateInfo>;
216 if (bind_point != VK_PIPELINE_BIND_POINT_GRAPHICS && bind_point != VK_PIPELINE_BIND_POINT_COMPUTE &&
217 bind_point != VK_PIPELINE_BIND_POINT_RAY_TRACING_NV) {
218 return;
219 }
220 for (uint32_t pipeline = 0; pipeline < count; ++pipeline) {
Jeremy Gebbenb20a8242021-11-05 15:14:43 -0600221 auto pipeline_state = object_ptr->template Get<PIPELINE_STATE>(pPipelines[pipeline]);
Nathaniel Cesariobcb79682022-03-31 21:13:52 -0600222 if (!pipeline_state || pipeline_state->IsGraphicsLibrary()) continue;
Tony-LunarG1dce2392019-10-23 16:49:29 -0600223
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700224 const uint32_t stageCount = static_cast<uint32_t>(pipeline_state->stage_state.size());
225 assert(stageCount > 0);
Tony-LunarG1dce2392019-10-23 16:49:29 -0600226
227 for (uint32_t stage = 0; stage < stageCount; ++stage) {
228 if (pipeline_state->active_slots.find(object_ptr->desc_set_bind_index) != pipeline_state->active_slots.end()) {
229 DispatchDestroyShaderModule(object_ptr->device, Accessor::GetShaderModule(pCreateInfos[pipeline], stage),
230 pAllocator);
231 }
232
sfricke-samsungef15e482022-01-26 11:32:49 -0800233 std::shared_ptr<const SHADER_MODULE_STATE> module_state;
Tony-LunarG1dce2392019-10-23 16:49:29 -0600234 if (bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS) {
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700235 module_state = object_ptr->template Get<SHADER_MODULE_STATE>(
236 pipeline_state->GetUnifiedCreateInfo().graphics.pStages[stage].module);
Tony-LunarG1dce2392019-10-23 16:49:29 -0600237 } else if (bind_point == VK_PIPELINE_BIND_POINT_COMPUTE) {
238 assert(stage == 0);
sfricke-samsungef15e482022-01-26 11:32:49 -0800239 module_state =
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700240 object_ptr->template Get<SHADER_MODULE_STATE>(pipeline_state->GetUnifiedCreateInfo().compute.stage.module);
241 } else if (bind_point == VK_PIPELINE_BIND_POINT_RAY_TRACING_NV) {
242 module_state = object_ptr->template Get<SHADER_MODULE_STATE>(
243 pipeline_state->GetUnifiedCreateInfo().raytracing.pStages[stage].module);
Tony-LunarG1dce2392019-10-23 16:49:29 -0600244 } else {
245 assert(false);
246 }
247
248 std::vector<unsigned int> code;
249 // Save the shader binary
250 // The core_validation ShaderModule tracker saves the binary too, but discards it when the ShaderModule
251 // is destroyed. Applications may destroy ShaderModules after they are placed in a pipeline and before
252 // the pipeline is used, so we have to keep another copy.
sfricke-samsungef15e482022-01-26 11:32:49 -0800253 if (module_state && module_state->has_valid_spirv) code = module_state->words;
Tony-LunarG1dce2392019-10-23 16:49:29 -0600254
sfricke-samsungef15e482022-01-26 11:32:49 -0800255 object_ptr->shader_map[module_state->gpu_validation_shader_id].pipeline = pipeline_state->pipeline();
Tony-LunarG1dce2392019-10-23 16:49:29 -0600256 // Be careful to use the originally bound (instrumented) shader here, even if PreCallRecord had to back it
257 // out with a non-instrumented shader. The non-instrumented shader (found in pCreateInfo) was destroyed above.
258 VkShaderModule shader_module = VK_NULL_HANDLE;
259 if (bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS) {
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700260 shader_module = pipeline_state->GetUnifiedCreateInfo().graphics.pStages[stage].module;
Tony-LunarG1dce2392019-10-23 16:49:29 -0600261 } else if (bind_point == VK_PIPELINE_BIND_POINT_COMPUTE) {
262 assert(stage == 0);
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700263 shader_module = pipeline_state->GetUnifiedCreateInfo().compute.stage.module;
Tony-LunarG1dce2392019-10-23 16:49:29 -0600264 } else if (bind_point == VK_PIPELINE_BIND_POINT_RAY_TRACING_NV) {
Nathaniel Cesario3fd4f762022-02-16 16:07:06 -0700265 shader_module = pipeline_state->GetUnifiedCreateInfo().raytracing.pStages[stage].module;
Tony-LunarG1dce2392019-10-23 16:49:29 -0600266 } else {
267 assert(false);
268 }
sfricke-samsungef15e482022-01-26 11:32:49 -0800269 object_ptr->shader_map[module_state->gpu_validation_shader_id].shader_module = shader_module;
270 object_ptr->shader_map[module_state->gpu_validation_shader_id].pgm = std::move(code);
Tony-LunarG1dce2392019-10-23 16:49:29 -0600271 }
272 }
273}
Tony-LunarGc876c6e2020-09-09 15:19:43 -0600274template <typename CreateInfos, typename SafeCreateInfos>
275void UtilCopyCreatePipelineFeedbackData(const uint32_t count, CreateInfos *pCreateInfos, SafeCreateInfos *pSafeCreateInfos) {
276 for (uint32_t i = 0; i < count; i++) {
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700277 auto src_feedback_struct = LvlFindInChain<VkPipelineCreationFeedbackCreateInfoEXT>(pSafeCreateInfos[i].pNext);
Tony-LunarGc876c6e2020-09-09 15:19:43 -0600278 if (!src_feedback_struct) return;
279 auto dst_feedback_struct = const_cast<VkPipelineCreationFeedbackCreateInfoEXT *>(
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700280 LvlFindInChain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext));
Tony-LunarGc876c6e2020-09-09 15:19:43 -0600281 *dst_feedback_struct->pPipelineCreationFeedback = *src_feedback_struct->pPipelineCreationFeedback;
282 for (uint32_t j = 0; j < src_feedback_struct->pipelineStageCreationFeedbackCount; j++) {
283 dst_feedback_struct->pPipelineStageCreationFeedbacks[j] = src_feedback_struct->pPipelineStageCreationFeedbacks[j];
284 }
285 }
286}
287
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -0600288VkResult UtilInitializeVma(VkPhysicalDevice physical_device, VkDevice device, VmaAllocator *pAllocator);
Tony-LunarG1dce2392019-10-23 16:49:29 -0600289
Tony-LunarGb5fae462020-03-05 12:43:25 -0700290void UtilGenerateStageMessage(const uint32_t *debug_record, std::string &msg);
291void UtilGenerateCommonMessage(const debug_report_data *report_data, const VkCommandBuffer commandBuffer,
292 const uint32_t *debug_record, const VkShaderModule shader_module_handle,
293 const VkPipeline pipeline_handle, const VkPipelineBindPoint pipeline_bind_point,
294 const uint32_t operation_index, std::string &msg);
sfricke-samsung7fac88a2022-01-26 11:44:22 -0800295void UtilGenerateSourceMessages(const std::vector<uint32_t> &pgm, const uint32_t *debug_record, bool from_printf,
Tony-LunarGb5fae462020-03-05 12:43:25 -0700296 std::string &filename_msg, std::string &source_msg);
Jeremy Gebben5160e032022-03-28 14:57:43 -0600297
298struct GpuAssistedShaderTracker {
299 VkPipeline pipeline;
300 VkShaderModule shader_module;
301 std::vector<uint32_t> pgm;
302};
303
304class GpuAssistedBase : public ValidationStateTracker {
305 public:
Jeremy Gebben33717862022-03-28 15:53:56 -0600306 void PreCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
307 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, void *modified_create_info) override;
308 void CreateDevice(const VkDeviceCreateInfo *pCreateInfo) override;
309
310 void PreCallRecordDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) override;
311
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -0600312 void PostCallRecordQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence,
313 VkResult result) override;
314 void RecordQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2KHR *pSubmits, VkFence fence, VkResult result);
315 void PostCallRecordQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2KHR *pSubmits, VkFence fence,
316 VkResult result) override;
317 void PostCallRecordQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits, VkFence fence,
318 VkResult result) override;
Jeremy Gebben33717862022-03-28 15:53:56 -0600319 template <typename T>
320 void ReportSetupProblem(T object, const char *const specific_message) const {
321 LogError(object, setup_vuid, "Setup Error. Detail: (%s)", specific_message);
322 }
323
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -0600324 protected:
325 virtual bool CommandBufferNeedsProcessing(VkCommandBuffer command_buffer) = 0;
326 virtual void ProcessCommandBuffer(VkQueue queue, VkCommandBuffer command_buffer) = 0;
327
328 void SubmitBarrier(VkQueue queue) {
329 auto queue_state = Get<gpu_utils_state::Queue>(queue);
330 if (queue_state) {
331 queue_state->SubmitBarrier();
332 }
333 }
334
335 std::shared_ptr<QUEUE_STATE> CreateQueue(VkQueue q, uint32_t index, VkDeviceQueueCreateFlags flags) override {
336 return std::static_pointer_cast<QUEUE_STATE>(std::make_shared<gpu_utils_state::Queue>(*this, q, index, flags));
337 }
338
339 public:
Jeremy Gebben5160e032022-03-28 14:57:43 -0600340 bool aborted = false;
Jeremy Gebbenfcfc33c2022-03-28 15:31:29 -0600341 PFN_vkSetDeviceLoaderData vkSetDeviceLoaderData;
Jeremy Gebben5160e032022-03-28 14:57:43 -0600342 const char *setup_vuid;
343 VkPhysicalDeviceFeatures supported_features{};
344 VkPhysicalDeviceFeatures desired_features{};
345 uint32_t adjusted_max_desc_sets = 0;
346 uint32_t unique_shader_module_id = 0;
347 uint32_t output_buffer_size = 0;
348 VkDescriptorSetLayout debug_desc_layout = VK_NULL_HANDLE;
349 VkDescriptorSetLayout dummy_desc_layout = VK_NULL_HANDLE;
350 uint32_t desc_set_bind_index = 0;
351 VmaAllocator vmaAllocator = {};
Jeremy Gebben5160e032022-03-28 14:57:43 -0600352 std::unique_ptr<UtilDescriptorSetManager> desc_set_manager;
Jeremy Gebben5160e032022-03-28 14:57:43 -0600353 layer_data::unordered_map<uint32_t, GpuAssistedShaderTracker> shader_map;
354 std::vector<VkDescriptorSetLayoutBinding> bindings_;
355};
356