@@ -107,69 +107,59 @@ macro_rules! launch {
107107#[ derive( Debug , Clone , PartialEq , Eq ) ]
108108pub struct GridSize {
109109 /// Width of grid in blocks
110- pub x : u32 ,
110+ pub x : usize ,
111111 /// Height of grid in blocks
112- pub y : u32 ,
112+ pub y : usize ,
113113 /// Depth of grid in blocks
114- pub z : u32 ,
114+ pub z : usize ,
115115}
116116impl GridSize {
117117 /// Create a one-dimensional grid of `x` blocks
118118 #[ inline]
119- pub fn x ( x : u32 ) -> GridSize {
119+ pub fn x ( x : usize ) -> GridSize {
120120 GridSize { x, y : 1 , z : 1 }
121121 }
122122
123123 /// Create a two-dimensional grid of `x * y` blocks
124124 #[ inline]
125- pub fn xy ( x : u32 , y : u32 ) -> GridSize {
125+ pub fn xy ( x : usize , y : usize ) -> GridSize {
126126 GridSize { x, y, z : 1 }
127127 }
128128
129129 /// Create a three-dimensional grid of `x * y * z` blocks
130130 #[ inline]
131- pub fn xyz ( x : u32 , y : u32 , z : u32 ) -> GridSize {
131+ pub fn xyz ( x : usize , y : usize , z : usize ) -> GridSize {
132132 GridSize { x, y, z }
133133 }
134134}
135- impl From < u32 > for GridSize {
136- fn from ( x : u32 ) -> GridSize {
135+ impl From < usize > for GridSize {
136+ fn from ( x : usize ) -> GridSize {
137137 GridSize :: x ( x)
138138 }
139139}
140- impl From < ( u32 , u32 ) > for GridSize {
141- fn from ( ( x, y) : ( u32 , u32 ) ) -> GridSize {
140+ impl From < ( usize , usize ) > for GridSize {
141+ fn from ( ( x, y) : ( usize , usize ) ) -> GridSize {
142142 GridSize :: xy ( x, y)
143143 }
144144}
145- impl From < ( u32 , u32 , u32 ) > for GridSize {
146- fn from ( ( x, y, z) : ( u32 , u32 , u32 ) ) -> GridSize {
145+ impl From < ( usize , usize , usize ) > for GridSize {
146+ fn from ( ( x, y, z) : ( usize , usize , usize ) ) -> GridSize {
147147 GridSize :: xyz ( x, y, z)
148148 }
149149}
150- impl < ' a > From < & ' a GridSize > for GridSize {
150+ impl From < & GridSize > for GridSize {
151151 fn from ( other : & GridSize ) -> GridSize {
152152 other. clone ( )
153153 }
154154}
155- impl From < glam:: UVec2 > for GridSize {
156- fn from ( vec : glam:: UVec2 ) -> Self {
157- GridSize :: xy ( vec. x , vec. y )
158- }
159- }
160- impl From < glam:: UVec3 > for GridSize {
161- fn from ( vec : glam:: UVec3 ) -> Self {
162- GridSize :: xyz ( vec. x , vec. y , vec. z )
163- }
164- }
165155impl From < glam:: USizeVec2 > for GridSize {
166156 fn from ( vec : glam:: USizeVec2 ) -> Self {
167- GridSize :: xy ( vec. x as u32 , vec. y as u32 )
157+ GridSize :: xy ( vec. x , vec. y )
168158 }
169159}
170160impl From < glam:: USizeVec3 > for GridSize {
171161 fn from ( vec : glam:: USizeVec3 ) -> Self {
172- GridSize :: xyz ( vec. x as u32 , vec. y as u32 , vec. z as u32 )
162+ GridSize :: xyz ( vec. x , vec. y , vec. z )
173163 }
174164}
175165
@@ -183,68 +173,58 @@ impl From<glam::USizeVec3> for GridSize {
183173#[ derive( Debug , Clone , PartialEq , Eq ) ]
184174pub struct BlockSize {
185175 /// X dimension of each thread block
186- pub x : u32 ,
176+ pub x : usize ,
187177 /// Y dimension of each thread block
188- pub y : u32 ,
178+ pub y : usize ,
189179 /// Z dimension of each thread block
190- pub z : u32 ,
180+ pub z : usize ,
191181}
192182impl BlockSize {
193183 /// Create a one-dimensional block of `x` threads
194184 #[ inline]
195- pub fn x ( x : u32 ) -> BlockSize {
185+ pub fn x ( x : usize ) -> BlockSize {
196186 BlockSize { x, y : 1 , z : 1 }
197187 }
198188
199189 /// Create a two-dimensional block of `x * y` threads
200190 #[ inline]
201- pub fn xy ( x : u32 , y : u32 ) -> BlockSize {
191+ pub fn xy ( x : usize , y : usize ) -> BlockSize {
202192 BlockSize { x, y, z : 1 }
203193 }
204194
205195 /// Create a three-dimensional block of `x * y * z` threads
206196 #[ inline]
207- pub fn xyz ( x : u32 , y : u32 , z : u32 ) -> BlockSize {
197+ pub fn xyz ( x : usize , y : usize , z : usize ) -> BlockSize {
208198 BlockSize { x, y, z }
209199 }
210200}
211- impl From < u32 > for BlockSize {
212- fn from ( x : u32 ) -> BlockSize {
201+ impl From < usize > for BlockSize {
202+ fn from ( x : usize ) -> BlockSize {
213203 BlockSize :: x ( x)
214204 }
215205}
216- impl From < ( u32 , u32 ) > for BlockSize {
217- fn from ( ( x, y) : ( u32 , u32 ) ) -> BlockSize {
206+ impl From < ( usize , usize ) > for BlockSize {
207+ fn from ( ( x, y) : ( usize , usize ) ) -> BlockSize {
218208 BlockSize :: xy ( x, y)
219209 }
220210}
221- impl From < ( u32 , u32 , u32 ) > for BlockSize {
222- fn from ( ( x, y, z) : ( u32 , u32 , u32 ) ) -> BlockSize {
211+ impl From < ( usize , usize , usize ) > for BlockSize {
212+ fn from ( ( x, y, z) : ( usize , usize , usize ) ) -> BlockSize {
223213 BlockSize :: xyz ( x, y, z)
224214 }
225215}
226- impl < ' a > From < & ' a BlockSize > for BlockSize {
216+ impl From < & BlockSize > for BlockSize {
227217 fn from ( other : & BlockSize ) -> BlockSize {
228218 other. clone ( )
229219 }
230220}
231- impl From < glam:: UVec2 > for BlockSize {
232- fn from ( vec : glam:: UVec2 ) -> Self {
233- BlockSize :: xy ( vec. x , vec. y )
234- }
235- }
236- impl From < glam:: UVec3 > for BlockSize {
237- fn from ( vec : glam:: UVec3 ) -> Self {
238- BlockSize :: xyz ( vec. x , vec. y , vec. z )
239- }
240- }
241221impl From < glam:: USizeVec2 > for BlockSize {
242222 fn from ( vec : glam:: USizeVec2 ) -> Self {
243- BlockSize :: xy ( vec. x as u32 , vec. y as u32 )
223+ BlockSize :: xy ( vec. x , vec. y )
244224 }
245225}
246226impl From < glam:: USizeVec3 > for BlockSize {
247227 fn from ( vec : glam:: USizeVec3 ) -> Self {
248- BlockSize :: xyz ( vec. x as u32 , vec. y as u32 , vec. z as u32 )
228+ BlockSize :: xyz ( vec. x , vec. y , vec. z )
249229 }
250230}
0 commit comments