[Mesa-dev] TGSI declarations missing type info

Christoph Bumiller e0425955 at student.tuwien.ac.at
Sun Nov 13 08:32:30 PST 2011


On 13.11.2011 17:10, Marek Olšák wrote:
> I am guessing there is no type info because TGSI shaders are allowed
> to use uint, sint, and float instructions on the same register without
> type conversions (it would be possible to generate such usage with
> GL_ARB_shader_bit_enconding, also GL_NV_gpu_program4 has typeless
> registers too). I think GLSL has types because it's a typed language,
> not because it's needed for the underlying implementation. Do all
> drivers need such info or is it just llvmpipe that would make use of
> it?

If you don't have typed values in your backend IR and the hardware
doesn't have dedicated integer and float registers, you don't need type
info.

With llvm you have both typed values and, for x86, different registers
for integers and floats, so it seems it would be very helpful not to
destroy all that information (gallium's favourite thing to do) before
passing shaders to the driver.

For nv50 and nvc0 I don't need to know the type ... for ints and floats.

*But* for doubles (any kind of value that occupies multiple TGSI
register components) the driver's internal IR will give me the same
headache that you will have for llvmpipe when you can't be sure whether
you need 1 or 2 IR values for TEMP[i].xy.

So, an issue with types will come up for other drivers, too, eventually.

The SM4 IR does the same as TGSI though and also doesn't provide type
information, so the problem should be solveable, but the solution might
not be pretty.

> It's like you said: Right now TGSI temporaries are like unions in C.
> Only the instructions are typed (MAX vs IMAX vs UMAX).
>
> Marek
>
> On Sun, Nov 13, 2011 at 4:06 PM, Dave Airlie <airlied at gmail.com> wrote:
>> Hi guys,
>>
>> Just been looking at llvmpipe integer support and it seems like we
>> lose some information about the type of data stored into temporaries,
>>
>> after st_glsl_to_cpp we no longer know what type the temporaries are,
>> and llvm would really like to know and I can't see any reason that
>> TGSI doesn't contain the info. Having untyped temp decls means we'd
>> have to allocate some sort of "union" via aliases I guess in llvmpipe
>> for all temps so we can store int/float in them.
>>
>> I've attached a run of glsl-vs-loop from llvmpipe with integer opcodes
>> forced on. (llvmpipe-int-test branch of my repo).
>>
>> Dave.
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list