[virglrenderer-devel] TGSI to GLSL translator type assumptions
Gurchetan Singh
gurchetansingh at chromium.org
Sat Apr 28 02:03:55 UTC 2018
I was wondering about the typing assumptions in vrend_shader. The
TGSI spec says that "all TGSI instructions, known as opcodes, operate
on arbitrary-precision floating-point four-component vectors."
http://gallium.readthedocs.io/en/latest/tgsi.html
However, some instructions such as UMAD / UMUL / ATOMIMIN have integer
source and destination registers, so I assume these instructions are
exceptions to the spec.
One assumption we make is all temporary registers
(TGSI_FILE_TEMPORARY) are a vector of floats. We do a lot work making
this assumption hold, with many conversions. For example, the
following TGSI:
https://pastebin.com/PN8eHDvZ
currently produces this GLSL:
https://pastebin.com/p90gevMA
I'm interested in the possibility of removing the
"float(uintBitsToFloat)" and "int(floatBitsToInt)" steps, since I've
found it to be a source of many bugs. I would like to produce a GLSL
like this:
https://pastebin.com/fJCqYEjj
By inferring the type of the declarations from the opcodes. We would
copy the tgsi_full_instruction(s) that are emitted in
iter_instruction, deduce the type of the declarations, and then emit
the declarations and instructions. Is this advisable?
More information about the virglrenderer-devel
mailing list