Implement OpDot

This commit is contained in:
baldurk
2020-04-08 18:39:02 +01:00
parent 59c3a2fbd9
commit 8a6dbd7045
2 changed files with 26 additions and 0 deletions
@@ -1168,6 +1168,25 @@ void ThreadState::StepNext(ShaderDebugState *state,
SetDst(state, math.result, var);
break;
}
case Op::Dot:
{
OpDot dot(it);
ShaderVariable var = GetSrc(dot.vector1);
ShaderVariable b = GetSrc(dot.vector2);
RDCASSERTEQUAL(var.columns, b.columns);
float ret = 0;
for(uint8_t c = 0; c < var.columns; c++)
ret += var.value.fv[c] * b.value.fv[c];
var.columns = 1;
var.value.f.x = ret;
SetDst(state, dot.result, var);
break;
}
case Op::VectorTimesScalar:
{
OpVectorTimesScalar mul(it);
@@ -264,6 +264,13 @@ void main()
Color = vec4(cross(a, b), 1.0f);
break;
}
case 25:
{
vec4 a = vec4(posone*2.5f, negone*1.8f, posone*8.5f, posone*3.9f);
vec4 b = vec4(negone*6.3f, posone*3.2f, negone*0.4f, zerof);
Color = vec4(dot(a.xyz, b.xyz), dot(a.w, b.w), dot(a, b), dot(a.wz, b.ww));
break;
}
default: break;
}
}