Fix OpImage on OpSampledImages in HLSL.
This commit is contained in:
parent
d1399f01ab
commit
988f00fe3c
@ -0,0 +1,30 @@
|
||||
Texture2D<float4> uTex : register(t0);
|
||||
SamplerState uSampler : register(s1);
|
||||
|
||||
static int2 FooOut;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
int2 FooOut : SV_Target0;
|
||||
};
|
||||
|
||||
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
|
||||
{
|
||||
uint2 ret;
|
||||
Tex.GetDimensions(Level, ret.x, ret.y, Param);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
uint _23_dummy_parameter;
|
||||
FooOut = int2(SPIRV_Cross_textureSize(uTex, uint(0), _23_dummy_parameter));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FooOut = FooOut;
|
||||
return stage_output;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
Texture2D<float4> uTex : register(t0);
|
||||
SamplerState uSampler : register(s1);
|
||||
|
||||
static int2 FooOut;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
int2 FooOut : SV_Target0;
|
||||
};
|
||||
|
||||
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
|
||||
{
|
||||
uint2 ret;
|
||||
Tex.GetDimensions(Level, ret.x, ret.y, Param);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
uint _23_dummy_parameter;
|
||||
FooOut = int2(SPIRV_Cross_textureSize(uTex, uint(0), _23_dummy_parameter));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FooOut = FooOut;
|
||||
return stage_output;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 450
|
||||
layout(set = 0, binding = 0) uniform texture2D uTex;
|
||||
layout(set = 0, binding = 1) uniform sampler uSampler;
|
||||
layout(location = 0) out ivec2 FooOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
FooOut = textureSize(sampler2D(uTex, uSampler), 0);
|
||||
}
|
@ -3088,8 +3088,11 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
||||
{
|
||||
uint32_t result_type = ops[0];
|
||||
uint32_t id = ops[1];
|
||||
emit_op(result_type, id, to_expression(ops[2]), true, true);
|
||||
// TODO: Maybe change this when separate samplers/images are supported
|
||||
auto *combined = maybe_get<SPIRCombinedImageSampler>(ops[2]);
|
||||
if (combined)
|
||||
emit_op(result_type, id, to_expression(combined->image), true, true);
|
||||
else
|
||||
emit_op(result_type, id, to_expression(ops[2]), true, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user