File tree Expand file tree Collapse file tree 4 files changed +74
-2
lines changed
tests/tests/wgpu-gpu/ray_tracing Expand file tree Collapse file tree 4 files changed +74
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ By @Vecvec in [#7913](https://github.com/gfx-rs/wgpu/pull/7913).
55
55
56
56
### Changes
57
57
58
+ #### General
59
+
60
+ - Prevent resources for acceleration structures being created if acceleration structures are not enabled. By @Vecvec in [ #8036 ] ( https://github.com/gfx-rs/wgpu/pull/8036 ) .
61
+
58
62
#### Naga
59
63
60
64
Naga now requires that no type be larger than 1 GB. This limit may be lowered in the future; feedback on an appropriate value for the limit is welcome. By @andyleiserson in [ #7950 ] ( https://github.com/gfx-rs/wgpu/pull/7950 ) .
Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ use wgpu_macros::gpu_test;
9
9
use wgpu_test:: { fail, GpuTestConfiguration , TestParameters , TestingContext } ;
10
10
11
11
pub fn all_tests ( tests : & mut Vec < wgpu_test:: GpuTestInitializer > ) {
12
- tests. extend ( [ BLAS_INVALID_VERTEX_FORMAT , BLAS_MISMATCHED_INDEX ] ) ;
12
+ tests. extend ( [
13
+ BLAS_INVALID_VERTEX_FORMAT ,
14
+ BLAS_MISMATCHED_INDEX ,
15
+ UNSUPPORTED_ACCELERATION_STRUCTURE_RESOURCES ,
16
+ ] ) ;
13
17
}
14
18
15
19
#[ gpu_test]
@@ -124,3 +128,42 @@ fn mismatched_index_blas_create(ctx: TestingContext) {
124
128
None ,
125
129
) ;
126
130
}
131
+
132
+ #[ gpu_test]
133
+ static UNSUPPORTED_ACCELERATION_STRUCTURE_RESOURCES : GpuTestConfiguration =
134
+ GpuTestConfiguration :: new ( )
135
+ . parameters ( TestParameters :: default ( ) . test_features_limits ( ) )
136
+ . run_sync ( unsupported_acceleration_structure_resources) ;
137
+
138
+ fn unsupported_acceleration_structure_resources ( ctx : TestingContext ) {
139
+ fail (
140
+ & ctx. device ,
141
+ || {
142
+ ctx. device . create_buffer ( & wgpu:: BufferDescriptor {
143
+ label : None ,
144
+ size : 4 ,
145
+ usage : wgpu:: BufferUsages :: BLAS_INPUT ,
146
+ mapped_at_creation : false ,
147
+ } )
148
+ } ,
149
+ None ,
150
+ ) ;
151
+ fail (
152
+ & ctx. device ,
153
+ || {
154
+ ctx. device
155
+ . create_bind_group_layout ( & wgpu:: BindGroupLayoutDescriptor {
156
+ label : None ,
157
+ entries : & [ wgpu:: BindGroupLayoutEntry {
158
+ binding : 0 ,
159
+ visibility : wgpu:: ShaderStages :: COMPUTE ,
160
+ ty : wgpu:: BindingType :: AccelerationStructure {
161
+ vertex_return : false ,
162
+ } ,
163
+ count : None ,
164
+ } ] ,
165
+ } )
166
+ } ,
167
+ None ,
168
+ ) ;
169
+ }
Original file line number Diff line number Diff line change @@ -795,6 +795,13 @@ impl Device {
795
795
} ) ;
796
796
}
797
797
798
+ if desc
799
+ . usage
800
+ . intersects ( wgt:: BufferUsages :: BLAS_INPUT | wgt:: BufferUsages :: TLAS_INPUT )
801
+ {
802
+ self . require_features ( wgt:: Features :: EXPERIMENTAL_RAY_QUERY ) ?;
803
+ }
804
+
798
805
if desc. usage . contains ( wgt:: BufferUsages :: INDEX )
799
806
&& desc. usage . contains (
800
807
wgt:: BufferUsages :: VERTEX
@@ -2303,7 +2310,22 @@ impl Device {
2303
2310
} ,
2304
2311
)
2305
2312
}
2306
- Bt :: AccelerationStructure { .. } => ( None , WritableStorage :: No ) ,
2313
+ Bt :: AccelerationStructure { vertex_return } => {
2314
+ self . require_features ( wgt:: Features :: EXPERIMENTAL_RAY_QUERY )
2315
+ . map_err ( |e| binding_model:: CreateBindGroupLayoutError :: Entry {
2316
+ binding : entry. binding ,
2317
+ error : e. into ( ) ,
2318
+ } ) ?;
2319
+ if vertex_return {
2320
+ self . require_features ( wgt:: Features :: EXPERIMENTAL_RAY_HIT_VERTEX_RETURN )
2321
+ . map_err ( |e| binding_model:: CreateBindGroupLayoutError :: Entry {
2322
+ binding : entry. binding ,
2323
+ error : e. into ( ) ,
2324
+ } ) ?;
2325
+ }
2326
+
2327
+ ( None , WritableStorage :: No )
2328
+ }
2307
2329
Bt :: ExternalTexture => {
2308
2330
self . require_features ( wgt:: Features :: EXTERNAL_TEXTURE )
2309
2331
. map_err ( |e| binding_model:: CreateBindGroupLayoutError :: Entry {
Original file line number Diff line number Diff line change @@ -912,6 +912,8 @@ pub enum CreateBufferError {
912
912
MaxBufferSize { requested : u64 , maximum : u64 } ,
913
913
#[ error( transparent) ]
914
914
MissingDownlevelFlags ( #[ from] MissingDownlevelFlags ) ,
915
+ #[ error( transparent) ]
916
+ MissingFeatures ( #[ from] MissingFeatures ) ,
915
917
#[ error( "Failed to create bind group for indirect buffer validation: {0}" ) ]
916
918
IndirectValidationBindGroup ( DeviceError ) ,
917
919
}
@@ -929,6 +931,7 @@ impl WebGpuError for CreateBufferError {
929
931
Self :: AccessError ( e) => e,
930
932
Self :: MissingDownlevelFlags ( e) => e,
931
933
Self :: IndirectValidationBindGroup ( e) => e,
934
+ Self :: MissingFeatures ( e) => e,
932
935
933
936
Self :: UnalignedSize
934
937
| Self :: InvalidUsage ( _)
You can’t perform that action at this time.
0 commit comments