Skip to content

Commit 83d96b8

Browse files
gpuav: Don't call vkGetPhysicalDeviceProperties2 constantly
1 parent 99299bd commit 83d96b8

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

layers/gpuav/validation_cmd/gpuav_trace_rays.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ void TraceRaysIndirect(Validator& gpuav, const Location& loc, CommandBufferSubSt
7777
const uint64_t ray_query_dimension_max_depth =
7878
static_cast<uint64_t>(gpuav.phys_dev_props.limits.maxComputeWorkGroupCount[2]) *
7979
static_cast<uint64_t>(gpuav.phys_dev_props.limits.maxComputeWorkGroupSize[2]);
80-
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rt_pipeline_props = vku::InitStructHelper();
81-
VkPhysicalDeviceProperties2 props2 = vku::InitStructHelper(&rt_pipeline_props);
82-
DispatchGetPhysicalDeviceProperties2(gpuav.physical_device, &props2);
8380

8481
TraceRaysValidationShader shader_resources;
8582
shader_resources.push_constants.indirect_data = indirect_data_address;
@@ -89,7 +86,8 @@ void TraceRaysIndirect(Validator& gpuav, const Location& loc, CommandBufferSubSt
8986
static_cast<uint32_t>(std::min<uint64_t>(ray_query_dimension_max_height, vvl::kU32Max));
9087
shader_resources.push_constants.trace_rays_depth_limit =
9188
static_cast<uint32_t>(std::min<uint64_t>(ray_query_dimension_max_depth, vvl::kU32Max));
92-
shader_resources.push_constants.max_ray_dispatch_invocation_count = rt_pipeline_props.maxRayDispatchInvocationCount;
89+
shader_resources.push_constants.max_ray_dispatch_invocation_count =
90+
gpuav.phys_dev_ext_props.ray_tracing_props_khr.maxRayDispatchInvocationCount;
9391

9492
if (!BindShaderResources(validation_pipeline, gpuav, cb_state, cb_state.compute_index,
9593
uint32_t(cb_state.command_error_loggers.size()), shader_resources)) {
@@ -151,10 +149,6 @@ void TraceRaysIndirect(Validator& gpuav, const Location& loc, CommandBufferSubSt
151149
break;
152150
}
153151
case kErrorSubCodePreTraceRaysLimitVolume: {
154-
VkPhysicalDeviceRayTracingPipelinePropertiesKHR rt_pipeline_props = vku::InitStructHelper();
155-
VkPhysicalDeviceProperties2 props2 = vku::InitStructHelper(&rt_pipeline_props);
156-
DispatchGetPhysicalDeviceProperties2(gpuav.physical_device, &props2);
157-
158152
const VkExtent3D trace_rays_extent = {error_record[kPreActionParamOffset_0], error_record[kPreActionParamOffset_1],
159153
error_record[kPreActionParamOffset_2]};
160154
const uint64_t rays_volume = trace_rays_extent.width * trace_rays_extent.height * trace_rays_extent.depth;
@@ -163,7 +157,8 @@ void TraceRaysIndirect(Validator& gpuav, const Location& loc, CommandBufferSubSt
163157
"Indirect trace rays of volume %" PRIu64
164158
" (%s) would exceed VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxRayDispatchInvocationCount "
165159
"limit of %" PRIu32 ".",
166-
rays_volume, string_VkExtent3D(trace_rays_extent).c_str(), rt_pipeline_props.maxRayDispatchInvocationCount);
160+
rays_volume, string_VkExtent3D(trace_rays_extent).c_str(),
161+
gpuav.phys_dev_ext_props.ray_tracing_props_khr.maxRayDispatchInvocationCount);
167162
break;
168163
}
169164
default:

0 commit comments

Comments
 (0)