@@ -1117,6 +1117,94 @@ impl<
1117
1117
}
1118
1118
result. truncate_into ( )
1119
1119
}
1120
+
1121
+ /// Query the dimensions of the image at the specified level of detail.
1122
+ #[ crate :: macros:: gpu_only]
1123
+ #[ doc( alias = "OpImageQuerySizeLod" ) ]
1124
+ pub fn query_size_lod < Size : ImageCoordinate < u32 , DIM , ARRAYED > + Default > (
1125
+ & self ,
1126
+ lod : u32 ,
1127
+ ) -> Size
1128
+ where
1129
+ Image <
1130
+ SampledType ,
1131
+ DIM ,
1132
+ DEPTH ,
1133
+ ARRAYED ,
1134
+ { Multisampled :: False as u32 } ,
1135
+ SAMPLED ,
1136
+ FORMAT ,
1137
+ COMPONENTS ,
1138
+ > : HasQuerySizeLod ,
1139
+ {
1140
+ let mut result: Size = Default :: default ( ) ;
1141
+ unsafe {
1142
+ asm ! {
1143
+ "%sampledImage = OpLoad _ {this}" ,
1144
+ "%image = OpImage _ %sampledImage" ,
1145
+ "%result = OpImageQuerySizeLod typeof*{result} %image {lod}" ,
1146
+ "OpStore {result} %result" ,
1147
+ this = in( reg) self ,
1148
+ lod = in( reg) lod,
1149
+ result = in( reg) & mut result,
1150
+ }
1151
+ }
1152
+ result
1153
+ }
1154
+ }
1155
+
1156
+ impl <
1157
+ SampledType : SampleType < FORMAT , COMPONENTS > ,
1158
+ const DIM : u32 ,
1159
+ const DEPTH : u32 ,
1160
+ const ARRAYED : u32 ,
1161
+ const SAMPLED : u32 ,
1162
+ const FORMAT : u32 ,
1163
+ const COMPONENTS : u32 ,
1164
+ >
1165
+ SampledImage <
1166
+ Image <
1167
+ SampledType ,
1168
+ DIM ,
1169
+ DEPTH ,
1170
+ ARRAYED ,
1171
+ { Multisampled :: True as u32 } ,
1172
+ SAMPLED ,
1173
+ FORMAT ,
1174
+ COMPONENTS ,
1175
+ > ,
1176
+ >
1177
+ {
1178
+ /// Query the dimensions of the image, with no level of detail.
1179
+ /// Available only for multisampled images.
1180
+ #[ crate :: macros:: gpu_only]
1181
+ #[ doc( alias = "OpImageQuerySize" ) ]
1182
+ pub fn query_size < Size : ImageCoordinate < u32 , DIM , ARRAYED > + Default > ( & self ) -> Size
1183
+ where
1184
+ Image <
1185
+ SampledType ,
1186
+ DIM ,
1187
+ DEPTH ,
1188
+ ARRAYED ,
1189
+ { Multisampled :: True as u32 } ,
1190
+ SAMPLED ,
1191
+ FORMAT ,
1192
+ COMPONENTS ,
1193
+ > : HasQuerySize ,
1194
+ {
1195
+ let mut result: Size = Default :: default ( ) ;
1196
+ unsafe {
1197
+ asm ! {
1198
+ "%sampledImage = OpLoad _ {this}" ,
1199
+ "%image = OpImage _ %sampledImage" ,
1200
+ "%result = OpImageQuerySize typeof*{result} %image" ,
1201
+ "OpStore {result} %result" ,
1202
+ this = in( reg) self ,
1203
+ result = in( reg) & mut result,
1204
+ }
1205
+ }
1206
+ result
1207
+ }
1120
1208
}
1121
1209
1122
1210
/// Helper trait that defines all `*_with` methods on an `Image` that use the extra image operands,
@@ -1633,6 +1721,25 @@ impl<
1633
1721
>
1634
1722
{
1635
1723
}
1724
+ impl <
1725
+ SampledType : SampleType < FORMAT , COMPONENTS > ,
1726
+ const DEPTH : u32 ,
1727
+ const FORMAT : u32 ,
1728
+ const ARRAYED : u32 ,
1729
+ const COMPONENTS : u32 ,
1730
+ > HasQuerySize
1731
+ for Image <
1732
+ SampledType ,
1733
+ { Dimensionality :: OneD as u32 } ,
1734
+ DEPTH ,
1735
+ ARRAYED ,
1736
+ { Multisampled :: False as u32 } ,
1737
+ { Sampled :: Yes as u32 } ,
1738
+ FORMAT ,
1739
+ COMPONENTS ,
1740
+ >
1741
+ {
1742
+ }
1636
1743
impl <
1637
1744
SampledType : SampleType < FORMAT , COMPONENTS > ,
1638
1745
const DEPTH : u32 ,
@@ -1691,6 +1798,25 @@ impl<
1691
1798
>
1692
1799
{
1693
1800
}
1801
+ impl <
1802
+ SampledType : SampleType < FORMAT , COMPONENTS > ,
1803
+ const DEPTH : u32 ,
1804
+ const FORMAT : u32 ,
1805
+ const ARRAYED : u32 ,
1806
+ const COMPONENTS : u32 ,
1807
+ > HasQuerySize
1808
+ for Image <
1809
+ SampledType ,
1810
+ { Dimensionality :: TwoD as u32 } ,
1811
+ DEPTH ,
1812
+ ARRAYED ,
1813
+ { Multisampled :: False as u32 } ,
1814
+ { Sampled :: Yes as u32 } ,
1815
+ FORMAT ,
1816
+ COMPONENTS ,
1817
+ >
1818
+ {
1819
+ }
1694
1820
impl <
1695
1821
SampledType : SampleType < FORMAT , COMPONENTS > ,
1696
1822
const DEPTH : u32 ,
@@ -1749,6 +1875,25 @@ impl<
1749
1875
>
1750
1876
{
1751
1877
}
1878
+ impl <
1879
+ SampledType : SampleType < FORMAT , COMPONENTS > ,
1880
+ const DEPTH : u32 ,
1881
+ const FORMAT : u32 ,
1882
+ const ARRAYED : u32 ,
1883
+ const COMPONENTS : u32 ,
1884
+ > HasQuerySize
1885
+ for Image <
1886
+ SampledType ,
1887
+ { Dimensionality :: ThreeD as u32 } ,
1888
+ DEPTH ,
1889
+ ARRAYED ,
1890
+ { Multisampled :: False as u32 } ,
1891
+ { Sampled :: Yes as u32 } ,
1892
+ FORMAT ,
1893
+ COMPONENTS ,
1894
+ >
1895
+ {
1896
+ }
1752
1897
impl <
1753
1898
SampledType : SampleType < FORMAT , COMPONENTS > ,
1754
1899
const DEPTH : u32 ,
@@ -1807,6 +1952,25 @@ impl<
1807
1952
>
1808
1953
{
1809
1954
}
1955
+ impl <
1956
+ SampledType : SampleType < FORMAT , COMPONENTS > ,
1957
+ const DEPTH : u32 ,
1958
+ const FORMAT : u32 ,
1959
+ const ARRAYED : u32 ,
1960
+ const COMPONENTS : u32 ,
1961
+ > HasQuerySize
1962
+ for Image <
1963
+ SampledType ,
1964
+ { Dimensionality :: Cube as u32 } ,
1965
+ DEPTH ,
1966
+ ARRAYED ,
1967
+ { Multisampled :: False as u32 } ,
1968
+ { Sampled :: Yes as u32 } ,
1969
+ FORMAT ,
1970
+ COMPONENTS ,
1971
+ >
1972
+ {
1973
+ }
1810
1974
impl <
1811
1975
SampledType : SampleType < FORMAT , COMPONENTS > ,
1812
1976
const DEPTH : u32 ,
0 commit comments