Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy committed May 10, 2023
1 parent 45c616a commit 059f6fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/back/hlsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,9 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {

if let Some(offset) = offset {
write!(self.out, ", ")?;
write!(self.out, "int2(")?; // work around https://github.com/microsoft/DirectXShaderCompiler/issues/5082#issuecomment-1540147807
self.write_const_expression(module, offset)?;
write!(self.out, ")")?;
}

write!(self.out, ")")?;
Expand Down
10 changes: 5 additions & 5 deletions tests/out/hlsl/image.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ float4 texture_sample() : SV_Target0
float2 tc = (0.5).xx;
float4 s1d = image_1d.Sample(sampler_reg, 0.5);
float4 s2d = image_2d.Sample(sampler_reg, tc);
float4 s2d_offset = image_2d.Sample(sampler_reg, tc, int2(3, 1));
float4 s2d_offset = image_2d.Sample(sampler_reg, tc, int2(int2(3, 1)));
float4 s2d_level = image_2d.SampleLevel(sampler_reg, tc, 2.3);
float4 s2d_level_offset = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(3, 1));
float4 s2d_bias_offset = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(3, 1));
float4 s2d_level_offset = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(int2(3, 1)));
float4 s2d_bias_offset = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(int2(3, 1)));
return ((((s1d + s2d) + s2d_offset) + s2d_level) + s2d_level_offset);
}

Expand All @@ -262,9 +262,9 @@ float4 gather() : SV_Target0
{
float2 tc_2 = (0.5).xx;
float4 s2d_1 = image_2d.GatherGreen(sampler_reg, tc_2);
float4 s2d_offset_1 = image_2d.GatherAlpha(sampler_reg, tc_2, int2(3, 1));
float4 s2d_offset_1 = image_2d.GatherAlpha(sampler_reg, tc_2, int2(int2(3, 1)));
float4 s2d_depth_1 = image_2d_depth.GatherCmp(sampler_cmp, tc_2, 0.5);
float4 s2d_depth_offset = image_2d_depth.GatherCmp(sampler_cmp, tc_2, 0.5, (3).xx);
float4 s2d_depth_offset = image_2d_depth.GatherCmp(sampler_cmp, tc_2, 0.5, int2((3).xx));
uint4 u = image_2d_u32_.Gather(sampler_reg, tc_2);
int4 i = image_2d_i32_.Gather(sampler_reg, tc_2);
float4 f = (float4(u) + float4(i));
Expand Down

0 comments on commit 059f6fb

Please sign in to comment.