Fix type info of texture dimensions function with texture cube parameter

This commit is contained in:
Gordon-F
2021-07-13 23:53:11 +03:00
committed by Dzmitry Malyshau
parent caa92ef7b9
commit ccf3fe9707
6 changed files with 24 additions and 24 deletions

View File

@@ -526,7 +526,7 @@ impl<W: Write> Writer<W> {
write!(self.out, ")")?;
}
crate::ImageDimension::Cube => {
write!(self.out, "int3(")?;
write!(self.out, "int2(")?;
self.put_image_query(image, "width", level, context)?;
write!(self.out, ")")?;
}

View File

@@ -1072,7 +1072,7 @@ impl<'w> BlockContext<'w> {
let id = self.gen_id();
let components = match dim {
// always pick the first component, and duplicate it for all 3 dimensions
Id::Cube => &[0u32, 0, 0][..],
Id::Cube => &[0u32, 0][..],
_ => &[0u32, 1, 2, 3][..dim_coords],
};
block.body.push(Instruction::vector_shuffle(

View File

@@ -395,12 +395,12 @@ impl<'a> ResolveContext<'a> {
kind: crate::ScalarKind::Sint,
width: 4,
},
crate::ImageDimension::D2 => Ti::Vector {
crate::ImageDimension::D2 | crate::ImageDimension::Cube => Ti::Vector {
size: crate::VectorSize::Bi,
kind: crate::ScalarKind::Sint,
width: 4,
},
crate::ImageDimension::D3 | crate::ImageDimension::Cube => Ti::Vector {
crate::ImageDimension::D3 => Ti::Vector {
size: crate::VectorSize::Tri,
kind: crate::ScalarKind::Sint,
width: 4,

View File

@@ -38,12 +38,12 @@ vertex queriesOutput queries(
int num_levels_2d_array = int(image_2d_array.get_num_mip_levels());
metal::int2 dim_2d_array_lod = int2(image_2d_array.get_width(1), image_2d_array.get_height(1));
int num_layers_2d = int(image_2d_array.get_array_size());
metal::int3 dim_cube = int3(image_cube.get_width());
metal::int2 dim_cube = int2(image_cube.get_width());
int num_levels_cube = int(image_cube.get_num_mip_levels());
metal::int3 dim_cube_lod = int3(image_cube.get_width(1));
metal::int3 dim_cube_array = int3(image_cube_array.get_width());
metal::int2 dim_cube_lod = int2(image_cube.get_width(1));
metal::int2 dim_cube_array = int2(image_cube_array.get_width());
int num_levels_cube_array = int(image_cube_array.get_num_mip_levels());
metal::int3 dim_cube_array_lod = int3(image_cube_array.get_width(1));
metal::int2 dim_cube_array_lod = int2(image_cube_array.get_width(1));
int num_layers_cube = int(image_cube_array.get_array_size());
metal::int3 dim_3d = int3(image_3d.get_width(), image_3d.get_height(), image_3d.get_depth());
int num_levels_3d = int(image_3d.get_num_mip_levels());

View File

@@ -168,13 +168,13 @@ OpBranch %81
%93 = OpImageQuerySizeLod %87 %76 %82
%94 = OpCompositeExtract %4 %93 2
%95 = OpImageQuerySizeLod %15 %77 %82
%96 = OpVectorShuffle %87 %95 %95 0 0 0
%97 = OpImageQueryLevels %4 %77
%98 = OpImageQuerySizeLod %15 %77 %6
%99 = OpVectorShuffle %87 %98 %98 0 0 0
%100 = OpImageQuerySizeLod %87 %78 %82
%101 = OpImageQueryLevels %4 %78
%102 = OpImageQuerySizeLod %87 %78 %6
%96 = OpImageQueryLevels %4 %77
%97 = OpImageQuerySizeLod %15 %77 %6
%98 = OpImageQuerySizeLod %87 %78 %82
%99 = OpVectorShuffle %15 %98 %98 0 0
%100 = OpImageQueryLevels %4 %78
%101 = OpImageQuerySizeLod %87 %78 %6
%102 = OpVectorShuffle %15 %101 %101 0 0
%103 = OpImageQuerySizeLod %87 %78 %82
%104 = OpCompositeExtract %4 %103 2
%105 = OpImageQuerySizeLod %87 %79 %82
@@ -190,11 +190,11 @@ OpBranch %81
%115 = OpCompositeExtract %4 %92 1
%116 = OpIAdd %4 %114 %115
%117 = OpIAdd %4 %116 %94
%118 = OpCompositeExtract %4 %96 1
%118 = OpCompositeExtract %4 %95 1
%119 = OpIAdd %4 %117 %118
%120 = OpCompositeExtract %4 %99 1
%120 = OpCompositeExtract %4 %97 1
%121 = OpIAdd %4 %119 %120
%122 = OpCompositeExtract %4 %100 1
%122 = OpCompositeExtract %4 %99 1
%123 = OpIAdd %4 %121 %122
%124 = OpCompositeExtract %4 %102 1
%125 = OpIAdd %4 %123 %124
@@ -207,8 +207,8 @@ OpBranch %81
%132 = OpIAdd %4 %131 %85
%133 = OpIAdd %4 %132 %90
%134 = OpIAdd %4 %133 %106
%135 = OpIAdd %4 %134 %97
%136 = OpIAdd %4 %135 %101
%135 = OpIAdd %4 %134 %96
%136 = OpIAdd %4 %135 %100
%137 = OpConvertSToF %8 %136
%138 = OpCompositeConstruct %23 %137 %137 %137 %137
OpStore %71 %138

View File

@@ -42,12 +42,12 @@ fn queries() -> [[builtin(position)]] vec4<f32> {
let num_levels_2d_array: i32 = textureNumLevels(image_2d_array);
let dim_2d_array_lod: vec2<i32> = textureDimensions(image_2d_array, 1);
let num_layers_2d: i32 = textureNumLayers(image_2d_array);
let dim_cube: vec3<i32> = textureDimensions(image_cube);
let dim_cube: vec2<i32> = textureDimensions(image_cube);
let num_levels_cube: i32 = textureNumLevels(image_cube);
let dim_cube_lod: vec3<i32> = textureDimensions(image_cube, 1);
let dim_cube_array: vec3<i32> = textureDimensions(image_cube_array);
let dim_cube_lod: vec2<i32> = textureDimensions(image_cube, 1);
let dim_cube_array: vec2<i32> = textureDimensions(image_cube_array);
let num_levels_cube_array: i32 = textureNumLevels(image_cube_array);
let dim_cube_array_lod: vec3<i32> = textureDimensions(image_cube_array, 1);
let dim_cube_array_lod: vec2<i32> = textureDimensions(image_cube_array, 1);
let num_layers_cube: i32 = textureNumLayers(image_cube_array);
let dim_3d: vec3<i32> = textureDimensions(image_3d);
let num_levels_3d: i32 = textureNumLevels(image_3d);