@@ -1117,6 +1117,94 @@ impl<
11171117 }
11181118 result. truncate_into ( )
11191119 }
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+ }
11201208}
11211209
11221210/// Helper trait that defines all `*_with` methods on an `Image` that use the extra image operands,
@@ -1633,6 +1721,25 @@ impl<
16331721 >
16341722{
16351723}
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+ }
16361743impl <
16371744 SampledType : SampleType < FORMAT , COMPONENTS > ,
16381745 const DEPTH : u32 ,
@@ -1691,6 +1798,25 @@ impl<
16911798 >
16921799{
16931800}
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+ }
16941820impl <
16951821 SampledType : SampleType < FORMAT , COMPONENTS > ,
16961822 const DEPTH : u32 ,
@@ -1749,6 +1875,25 @@ impl<
17491875 >
17501876{
17511877}
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+ }
17521897impl <
17531898 SampledType : SampleType < FORMAT , COMPONENTS > ,
17541899 const DEPTH : u32 ,
@@ -1807,6 +1952,25 @@ impl<
18071952 >
18081953{
18091954}
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+ }
18101974impl <
18111975 SampledType : SampleType < FORMAT , COMPONENTS > ,
18121976 const DEPTH : u32 ,
0 commit comments