3
0
Fork 0
forked from suyu/suyu

gl_shader_decompiler: Fix TXQ types

TXQ returns integer types. Shaders usually do:

R0 = TXQ(); // => int
R0 = static_cast<float>(R0);

If we don't treat it as an integer, it will cast a binary float value as
float - resulting in a corrupted number.
This commit is contained in:
ReinUsesLisp 2019-04-04 20:07:11 -03:00
parent a6d5ff05dc
commit 88a3c05b7b

View file

@ -1196,11 +1196,12 @@ private:
switch (meta->element) {
case 0:
case 1:
return "textureSize(" + sampler + ", " + lod + ')' + GetSwizzle(meta->element);
return "itof(int(textureSize(" + sampler + ", " + lod + ')' +
GetSwizzle(meta->element) + "))";
case 2:
return "0";
case 3:
return "textureQueryLevels(" + sampler + ')';
return "itof(textureQueryLevels(" + sampler + "))";
}
UNREACHABLE();
return "0";