[Mesa-dev] [PATCH 1/7] gallium: add CONSTBUF type to tgsi_file_type
Ilia Mirkin
imirkin at alum.mit.edu
Tue Aug 22 23:42:43 UTC 2017
On Tue, Aug 22, 2017 at 7:41 PM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>
>
> On 23/08/17 09:28, Ilia Mirkin wrote:
>>
>> On Tue, Aug 22, 2017 at 7:25 PM, Timothy Arceri <tarceri at itsqueeze.com>
>> wrote:
>>>
>>>
>>>
>>> On 23/08/17 09:08, Ilia Mirkin wrote:
>>>>
>>>>
>>>> On Tue, Aug 22, 2017 at 6:55 PM, Timothy Arceri <tarceri at itsqueeze.com>
>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 23/08/17 00:56, Ilia Mirkin wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Aug 22, 2017 at 10:51 AM, Roland Scheidegger
>>>>>> <sroland at vmware.com>
>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I am probably missing something here, but why do you need a new
>>>>>>> register
>>>>>>> file? Since you couldn't use LOAD with TGSI_FILE_CONSTANT before,
>>>>>>> can't
>>>>>>> you just allow LOAD with TGSI_FILE_CONSTANT and achieve the same
>>>>>>> thing?
>>>>>>> Or do you need to know how it's going to be accessed in advance?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> With bindless, LOAD can take a CONST I believe [which contains the
>>>>>> value of the bindless id]. I think it's nice to keep those concepts
>>>>>> separate... having CONST sometimes mean the value and other times mean
>>>>>> the address is a bit weird. This way CONSTBUF[0] is the address of the
>>>>>> 0th constbuf.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Yeah. I think we also may need another type for bindless as I'm
>>>>> planning
>>>>> to
>>>>> use TGSI_FILE_CONSTANT for regular uniforms. The plan is to use LOAD
>>>>> for
>>>>> supporting packed uniforms rather than padding everything to vec4.
>>>>
>>>>
>>>>
>>>> Shouldn't be necessary... we can think of CONST (and TEMP and IMM) as
>>>> "value" registers, and MEMORY/IMAGE/BUFFER/CONSTBUF as "address"
>>>> registers. If LOAD receives a value, then it's a bindless image
>>>> handle, otherwise it should work based on which of the address
>>>> registers it receives.
>>>
>>>
>>>
>>> But how do you tell the difference between a bindless image handle and a
>>> non-indirect uniform where the "value" is just the index of the uniform?
>>
>>
>> Easy - if the first arg is a CONSTBUF[], it's a uniform load. If it's
>> a value, then it's a bindless image handle. A uniform load becomes
>>
>> LOAD dst, CONSTBUF[1], IMM[0].x
>>
>> which would be identical to doing
>>
>> MOV dst, CONST[1][5] (if IMM[0].x == 5)
>>
>
> I'm talking about using:
>
> CONSTBUF for UBOs
>
> CONSTANT for uniforms
>
> SOMETHINGELSE for bindless images
>
> As far as I can tell we need to differentiate between uniforms and ubos, and
> there doesn't seem to be anything else to help with that.
Gallium doesn't differentiate between uniform and UBO. In practice,
st/mesa sticks uniforms in the zero const slot.
More information about the mesa-dev
mailing list