@@ -119,12 +119,11 @@ impl<
119
119
/// Fetch a single texel with a sampler set at compile time
120
120
#[ crate :: macros:: gpu_only]
121
121
#[ doc( alias = "OpImageFetch" ) ]
122
- pub fn fetch < V , I > ( & self , coordinate : impl ImageCoordinate < I , DIM , ARRAYED > ) -> V
122
+ pub fn fetch < I > ( & self , coordinate : impl ImageCoordinate < I , DIM , ARRAYED > ) -> SampledType :: Vec4
123
123
where
124
- V : Vector < SampledType , 4 > ,
125
124
I : Integer ,
126
125
{
127
- let mut result = V :: default ( ) ;
126
+ let mut result = Default :: default ( ) ;
128
127
unsafe {
129
128
asm ! {
130
129
"%image = OpLoad _ {this}" ,
@@ -154,18 +153,17 @@ impl<
154
153
#[ crate :: macros:: gpu_only]
155
154
#[ doc( alias = "OpImageGather" ) ]
156
155
#[ inline]
157
- pub fn gather < F , V > (
156
+ pub fn gather < F > (
158
157
& self ,
159
158
sampler : Sampler ,
160
159
coordinate : impl ImageCoordinate < F , DIM , ARRAYED > ,
161
160
component : u32 ,
162
- ) -> V
161
+ ) -> SampledType :: Vec4
163
162
where
164
163
Self : HasGather ,
165
164
F : Float ,
166
- V : Vector < SampledType , 4 > ,
167
165
{
168
- let mut result = V :: default ( ) ;
166
+ let mut result = Default :: default ( ) ;
169
167
unsafe {
170
168
asm ! {
171
169
"%typeSampledImage = OpTypeSampledImage typeof*{this}" ,
@@ -187,10 +185,13 @@ impl<
187
185
188
186
/// Sample texels at `coord` from the image using `sampler`.
189
187
#[ crate :: macros:: gpu_only]
190
- pub fn sample < F , V > ( & self , sampler : Sampler , coord : impl ImageCoordinate < F , DIM , ARRAYED > ) -> V
188
+ pub fn sample < F > (
189
+ & self ,
190
+ sampler : Sampler ,
191
+ coord : impl ImageCoordinate < F , DIM , ARRAYED > ,
192
+ ) -> SampledType :: Vec4
191
193
where
192
194
F : Float ,
193
- V : Vector < SampledType , 4 > ,
194
195
{
195
196
unsafe {
196
197
let mut result = Default :: default ( ) ;
@@ -214,15 +215,14 @@ impl<
214
215
/// Sample texels at `coord` from the image using `sampler`, after adding the input bias to the
215
216
/// implicit level of detail.
216
217
#[ crate :: macros:: gpu_only]
217
- pub fn sample_bias < F , V > (
218
+ pub fn sample_bias < F > (
218
219
& self ,
219
220
sampler : Sampler ,
220
221
coord : impl ImageCoordinate < F , DIM , ARRAYED > ,
221
222
bias : f32 ,
222
- ) -> V
223
+ ) -> SampledType :: Vec4
223
224
where
224
225
F : Float ,
225
- V : Vector < SampledType , 4 > ,
226
226
{
227
227
unsafe {
228
228
let mut result = Default :: default ( ) ;
@@ -248,15 +248,14 @@ impl<
248
248
#[ crate :: macros:: gpu_only]
249
249
#[ doc( alias = "OpImageSampleExplicitLod" ) ]
250
250
/// Sample the image at a coordinate by a lod
251
- pub fn sample_by_lod < F , V > (
251
+ pub fn sample_by_lod < F > (
252
252
& self ,
253
253
sampler : Sampler ,
254
254
coordinate : impl ImageCoordinate < F , DIM , ARRAYED > ,
255
255
lod : f32 ,
256
- ) -> V
256
+ ) -> SampledType :: Vec4
257
257
where
258
258
F : Float ,
259
- V : Vector < SampledType , 4 > ,
260
259
{
261
260
let mut result = Default :: default ( ) ;
262
261
unsafe {
@@ -281,16 +280,15 @@ impl<
281
280
#[ crate :: macros:: gpu_only]
282
281
#[ doc( alias = "OpImageSampleExplicitLod" ) ]
283
282
/// Sample the image based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
284
- pub fn sample_by_gradient < F , V > (
283
+ pub fn sample_by_gradient < F > (
285
284
& self ,
286
285
sampler : Sampler ,
287
286
coordinate : impl ImageCoordinate < F , DIM , ARRAYED > ,
288
287
gradient_dx : impl ImageCoordinate < F , DIM , { Arrayed :: False as u32 } > ,
289
288
gradient_dy : impl ImageCoordinate < F , DIM , { Arrayed :: False as u32 } > ,
290
- ) -> V
289
+ ) -> SampledType :: Vec4
291
290
where
292
291
F : Float ,
293
- V : Vector < SampledType , 4 > ,
294
292
{
295
293
let mut result = Default :: default ( ) ;
296
294
unsafe {
@@ -441,14 +439,13 @@ impl<
441
439
/// Sample the image with a project coordinate
442
440
#[ crate :: macros:: gpu_only]
443
441
#[ doc( alias = "OpImageSampleProjImplicitLod" ) ]
444
- pub fn sample_with_project_coordinate < F , V > (
442
+ pub fn sample_with_project_coordinate < F > (
445
443
& self ,
446
444
sampler : Sampler ,
447
445
project_coordinate : impl ImageCoordinate < F , DIM , { Arrayed :: True as u32 } > ,
448
- ) -> V
446
+ ) -> SampledType :: Vec4
449
447
where
450
448
F : Float ,
451
- V : Vector < SampledType , 4 > ,
452
449
{
453
450
unsafe {
454
451
let mut result = Default :: default ( ) ;
@@ -471,15 +468,14 @@ impl<
471
468
#[ crate :: macros:: gpu_only]
472
469
#[ doc( alias = "OpImageSampleProjExplicitLod" ) ]
473
470
/// Sample the image with a project coordinate by a lod
474
- pub fn sample_with_project_coordinate_by_lod < F , V > (
471
+ pub fn sample_with_project_coordinate_by_lod < F > (
475
472
& self ,
476
473
sampler : Sampler ,
477
474
project_coordinate : impl ImageCoordinate < F , DIM , { Arrayed :: True as u32 } > ,
478
475
lod : f32 ,
479
- ) -> V
476
+ ) -> SampledType :: Vec4
480
477
where
481
478
F : Float ,
482
- V : Vector < SampledType , 4 > ,
483
479
{
484
480
let mut result = Default :: default ( ) ;
485
481
unsafe {
@@ -504,16 +500,15 @@ impl<
504
500
#[ crate :: macros:: gpu_only]
505
501
#[ doc( alias = "OpImageSampleProjExplicitLod" ) ]
506
502
/// Sample the image with a project coordinate based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])
507
- pub fn sample_with_project_coordinate_by_gradient < F , V > (
503
+ pub fn sample_with_project_coordinate_by_gradient < F > (
508
504
& self ,
509
505
sampler : Sampler ,
510
506
project_coordinate : impl ImageCoordinate < F , DIM , { Arrayed :: True as u32 } > ,
511
507
gradient_dx : impl ImageCoordinate < F , DIM , { Arrayed :: False as u32 } > ,
512
508
gradient_dy : impl ImageCoordinate < F , DIM , { Arrayed :: False as u32 } > ,
513
- ) -> V
509
+ ) -> SampledType :: Vec4
514
510
where
515
511
F : Float ,
516
- V : Vector < SampledType , 4 > ,
517
512
{
518
513
let mut result = Default :: default ( ) ;
519
514
unsafe {
@@ -656,12 +651,11 @@ impl<
656
651
/// Read a texel from an image without a sampler.
657
652
#[ crate :: macros:: gpu_only]
658
653
#[ doc( alias = "OpImageRead" ) ]
659
- pub fn read < I , V , const N : usize > ( & self , coordinate : impl ImageCoordinate < I , DIM , ARRAYED > ) -> V
654
+ pub fn read < I > ( & self , coordinate : impl ImageCoordinate < I , DIM , ARRAYED > ) -> SampledType :: Vec4
660
655
where
661
656
I : Integer ,
662
- V : Vector < SampledType , N > ,
663
657
{
664
- let mut result = V :: default ( ) ;
658
+ let mut result = Default :: default ( ) ;
665
659
666
660
unsafe {
667
661
asm ! {
@@ -712,12 +706,11 @@ impl<
712
706
/// Read a texel from an image without a sampler.
713
707
#[ crate :: macros:: gpu_only]
714
708
#[ doc( alias = "OpImageRead" ) ]
715
- pub fn read < I , V , const N : usize > ( & self , coordinate : impl ImageCoordinate < I , DIM , ARRAYED > ) -> V
709
+ pub fn read < I > ( & self , coordinate : impl ImageCoordinate < I , DIM , ARRAYED > ) -> SampledType :: Vec4
716
710
where
717
711
I : Integer ,
718
- V : Vector < SampledType , N > ,
719
712
{
720
- let mut result = V :: default ( ) ;
713
+ let mut result = Default :: default ( ) ;
721
714
722
715
unsafe {
723
716
asm ! {
@@ -777,15 +770,14 @@ impl<
777
770
/// Note: Vulkan only allows the read if the first two components of the coordinate are zero.
778
771
#[ crate :: macros:: gpu_only]
779
772
#[ doc( alias = "OpImageRead" ) ]
780
- pub fn read_subpass < I , V , const N : usize > (
773
+ pub fn read_subpass < I > (
781
774
& self ,
782
775
coordinate : impl ImageCoordinateSubpassData < I , ARRAYED > ,
783
- ) -> V
776
+ ) -> SampledType :: Vec4
784
777
where
785
778
I : Integer ,
786
- V : Vector < SampledType , N > ,
787
779
{
788
- let mut result = V :: default ( ) ;
780
+ let mut result = Default :: default ( ) ;
789
781
790
782
unsafe {
791
783
asm ! {
@@ -838,11 +830,11 @@ impl<
838
830
/// detail relative to the base level.
839
831
#[ crate :: macros:: gpu_only]
840
832
#[ doc( alias = "OpImageQueryLod" ) ]
841
- pub fn query_lod < V : Vector < f32 , 2 > > (
833
+ pub fn query_lod (
842
834
& self ,
843
835
sampler : Sampler ,
844
836
coord : impl ImageCoordinate < f32 , DIM , { Arrayed :: False as u32 } > ,
845
- ) -> V
837
+ ) -> SampledType :: Vec2
846
838
where
847
839
Self : HasQueryLevels ,
848
840
{
@@ -988,10 +980,12 @@ impl<
988
980
/// Sampling with a type (`S`) that doesn't match the image's image format
989
981
/// will result in undefined behaviour.
990
982
#[ crate :: macros:: gpu_only]
991
- pub unsafe fn sample < F , V > ( & self , coord : impl ImageCoordinate < F , DIM , ARRAYED > ) -> V
983
+ pub unsafe fn sample < F > (
984
+ & self ,
985
+ coord : impl ImageCoordinate < F , DIM , ARRAYED > ,
986
+ ) -> SampledType :: Vec4
992
987
where
993
988
F : Float ,
994
- V : Vector < SampledType , 4 > ,
995
989
{
996
990
let mut result = Default :: default ( ) ;
997
991
asm ! (
@@ -1012,14 +1006,13 @@ impl<
1012
1006
/// Sampling with a type (`S`) that doesn't match the image's image format
1013
1007
/// will result in undefined behaviour.
1014
1008
#[ crate :: macros:: gpu_only]
1015
- pub unsafe fn sample_by_lod < F , V > (
1009
+ pub unsafe fn sample_by_lod < F > (
1016
1010
& self ,
1017
1011
coord : impl ImageCoordinate < F , DIM , ARRAYED > ,
1018
1012
lod : f32 ,
1019
- ) -> V
1013
+ ) -> SampledType :: Vec4
1020
1014
where
1021
1015
F : Float ,
1022
- V : Vector < SampledType , 4 > ,
1023
1016
{
1024
1017
let mut result = Default :: default ( ) ;
1025
1018
asm ! (
0 commit comments