1
1
use super :: { shader_module, Options } ;
2
+ use core:: num:: NonZeroU64 ;
2
3
3
4
fn create_device_queue ( ) -> ( wgpu:: Device , wgpu:: Queue ) {
4
5
async fn create_device_queue_async ( ) -> ( wgpu:: Device , wgpu:: Queue ) {
@@ -40,7 +41,20 @@ pub fn start(options: &Options) {
40
41
41
42
let bind_group_layout = device. create_bind_group_layout ( & wgpu:: BindGroupLayoutDescriptor {
42
43
label : None ,
43
- entries : & [ ] ,
44
+ entries : & [
45
+ // XXX - some graphics cards do not support empty bind layout groups, so
46
+ // create a dummy entry.
47
+ wgpu:: BindGroupLayoutEntry {
48
+ binding : 0 ,
49
+ count : None ,
50
+ visibility : wgpu:: ShaderStage :: COMPUTE ,
51
+ ty : wgpu:: BindingType :: StorageBuffer {
52
+ dynamic : false ,
53
+ min_binding_size : Some ( NonZeroU64 :: new ( 1 ) . unwrap ( ) ) ,
54
+ readonly : false ,
55
+ } ,
56
+ } ,
57
+ ] ,
44
58
} ) ;
45
59
46
60
let pipeline_layout = device. create_pipeline_layout ( & wgpu:: PipelineLayoutDescriptor {
@@ -58,10 +72,20 @@ pub fn start(options: &Options) {
58
72
} ,
59
73
} ) ;
60
74
75
+ let buf = device. create_buffer ( & wgpu:: BufferDescriptor {
76
+ label : None ,
77
+ size : 1 ,
78
+ usage : wgpu:: BufferUsage :: STORAGE ,
79
+ mapped_at_creation : false ,
80
+ } ) ;
81
+
61
82
let bind_group = device. create_bind_group ( & wgpu:: BindGroupDescriptor {
62
83
label : None ,
63
84
layout : & bind_group_layout,
64
- entries : & [ ] ,
85
+ entries : & [ wgpu:: BindGroupEntry {
86
+ binding : 0 ,
87
+ resource : wgpu:: BindingResource :: Buffer ( buf. slice ( ..) ) ,
88
+ } ] ,
65
89
} ) ;
66
90
67
91
let mut encoder =
0 commit comments