mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Implement Op*Negate
This commit is contained in:
@@ -1147,6 +1147,27 @@ void ThreadState::StepNext(ShaderDebugState *state,
|
||||
SetDst(state, math.result, var);
|
||||
break;
|
||||
}
|
||||
case Op::FNegate:
|
||||
case Op::SNegate:
|
||||
{
|
||||
OpFNegate math(it);
|
||||
|
||||
ShaderVariable var = GetSrc(math.operand);
|
||||
|
||||
if(opdata.op == Op::FNegate)
|
||||
{
|
||||
for(uint8_t c = 0; c < var.columns; c++)
|
||||
var.value.fv[c] = -var.value.fv[c];
|
||||
}
|
||||
else if(opdata.op == Op::SNegate)
|
||||
{
|
||||
for(uint8_t c = 0; c < var.columns; c++)
|
||||
var.value.iv[c] = -var.value.iv[c];
|
||||
}
|
||||
|
||||
SetDst(state, math.result, var);
|
||||
break;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -407,6 +407,8 @@ void main()
|
||||
16 %test_16
|
||||
17 %test_17
|
||||
18 %test_18
|
||||
19 %test_19
|
||||
20 %test_20
|
||||
|
||||
; test OpVectorShuffle
|
||||
%test_0 = OpLabel
|
||||
@@ -565,6 +567,38 @@ void main()
|
||||
OpStore %Color %Color_18
|
||||
OpBranch %break
|
||||
|
||||
; test fnegate
|
||||
%test_19 = OpLabel
|
||||
%a_19 = OpFAdd %float %zerof %float_4
|
||||
%b_19 = OpFAdd %float %zerof %float_neg15
|
||||
%c_19 = OpFAdd %float %zerof %zerof
|
||||
%d_19 = OpFAdd %float %zerof %float_3
|
||||
%x_19 = OpFNegate %float %a_19
|
||||
%y_19 = OpFNegate %float %b_19
|
||||
%z_19 = OpFNegate %float %c_19
|
||||
%w_19 = OpFNegate %float %d_19
|
||||
%Color_19 = OpCompositeConstruct %float4 %x_19 %y_19 %z_19 %w_19
|
||||
OpStore %Color %Color_19
|
||||
OpBranch %break
|
||||
|
||||
; test snegate
|
||||
%test_20 = OpLabel
|
||||
%a_20 = OpIAdd %int %zeroi %int_4
|
||||
%b_20 = OpIAdd %int %zeroi %int_neg15
|
||||
%c_20 = OpIAdd %int %zeroi %zeroi
|
||||
%d_20 = OpIAdd %int %zeroi %int_7
|
||||
%x_20 = OpSNegate %int %a_20
|
||||
%y_20 = OpSNegate %int %b_20
|
||||
%z_20 = OpSNegate %int %c_20
|
||||
%w_20 = OpSNegate %int %d_20
|
||||
%xf_20 = OpConvertSToF %float %x_20
|
||||
%yf_20 = OpConvertSToF %float %y_20
|
||||
%zf_20 = OpConvertSToF %float %z_20
|
||||
%wf_20 = OpConvertSToF %float %w_20
|
||||
%Color_20 = OpCompositeConstruct %float4 %xf_20 %yf_20 %zf_20 %wf_20
|
||||
OpStore %Color %Color_20
|
||||
OpBranch %break
|
||||
|
||||
%default = OpLabel
|
||||
OpStore %Color %float_0000
|
||||
OpBranch %break
|
||||
|
||||
Reference in New Issue
Block a user