File tree Expand file tree Collapse file tree
src/graphics/backend_wgpu Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,12 +111,13 @@ impl Pipeline {
111111 } ) ;
112112
113113 let vertices = device. create_buffer ( & wgpu:: BufferDescriptor {
114- size : Self :: INITIAL_BUFFER_SIZE ,
114+ size : mem:: size_of :: < Vertex > ( ) as u32
115+ * Self :: INITIAL_BUFFER_SIZE as u32 ,
115116 usage : wgpu:: BufferUsageFlags :: VERTEX ,
116117 } ) ;
117118
118119 let indices = device. create_buffer ( & wgpu:: BufferDescriptor {
119- size : Self :: INITIAL_BUFFER_SIZE ,
120+ size : Self :: INITIAL_BUFFER_SIZE * 2 ,
120121 usage : wgpu:: BufferUsageFlags :: INDEX ,
121122 } ) ;
122123
@@ -163,12 +164,12 @@ impl Pipeline {
163164 let new_size = vertices. len ( ) . max ( indices. len ( ) ) as u32 ;
164165
165166 self . vertices = device. create_buffer ( & wgpu:: BufferDescriptor {
166- size : new_size,
167+ size : mem :: size_of :: < Vertex > ( ) as u32 * new_size,
167168 usage : wgpu:: BufferUsageFlags :: VERTEX ,
168169 } ) ;
169170
170171 self . indices = device. create_buffer ( & wgpu:: BufferDescriptor {
171- size : new_size,
172+ size : new_size * 2 ,
172173 usage : wgpu:: BufferUsageFlags :: INDEX ,
173174 } ) ;
174175
You can’t perform that action at this time.
0 commit comments