[Mesa-dev] [PATCH] r600g: fix range handling for tgsi input/output declarations
Christian König
deathsimple at vodafone.de
Fri Mar 29 02:56:03 PDT 2013
Am 28.03.2013 20:34, schrieb Vadim Girlin:
> On 03/28/2013 01:01 PM, � wrote:
>> Am 27.03.2013 20:37, schrieb Vadim Girlin:
>>> Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
>>> ---
>>> src/gallium/drivers/r600/r600_shader.c | 19 +++++++++++++++----
>>> 1 file changed, 15 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/r600/r600_shader.c
>>> b/src/gallium/drivers/r600/r600_shader.c
>>> index 29facf7..d4c9c03 100644
>>> --- a/src/gallium/drivers/r600/r600_shader.c
>>> +++ b/src/gallium/drivers/r600/r600_shader.c
>>> @@ -874,12 +874,12 @@ static int select_twoside_color(struct
>>> r600_shader_ctx *ctx, int front, int back
>>> static int tgsi_declaration(struct r600_shader_ctx *ctx)
>>> {
>>> struct tgsi_full_declaration *d =
>>> &ctx->parse.FullToken.FullDeclaration;
>>> - unsigned i;
>>> - int r;
>>> + int r, i, j, count = d->Range.Last - d->Range.First + 1;
>>> switch (d->Declaration.File) {
>>> case TGSI_FILE_INPUT:
>>> - i = ctx->shader->ninput++;
>>> + i = ctx->shader->ninput;
>>> + ctx->shader->ninput += count;
>>> ctx->shader->input[i].name = d->Semantic.Name;
>>> ctx->shader->input[i].sid = d->Semantic.Index;
>>> ctx->shader->input[i].interpolate = d->Interp.Interpolate;
>>> @@ -903,9 +903,15 @@ static int tgsi_declaration(struct
>>> r600_shader_ctx *ctx)
>>> return r;
>>> }
>>> }
>>> + for (j = 1; j < count; ++j) {
>>> + memcpy(&ctx->shader->input[i + j], &ctx->shader->input[i],
>>> + sizeof(struct r600_shader_io));
>>
>> Instead of memcpy, shouldn't an assignment do the trick here as well?
>
> Yes, assignment should work fine, I just used to use memcpy in such
> cases for some reason. I'll replace memcpy with assignment.
>
> Also I think second part (outputs handling) can be dropped for now -
> currently we only need to handle the inputs (for HUD shaders), and
> later when array declarations for inputs/outputs will be implemented
> in TGSI probably we'll need to update the parser in r600g anyway - I'm
> just not sure yet how the semantic indices should be handled for
> input/output arrays.
>
Yeah, the uncertainly about semantic IDs was one of the reasons I didn't
wanted to do Input/Output arrays in the initial array implementation.
When those changes are the only one then v2 of the patch is:
Reviewed-by: Christian König <christian.koenig at amd.com>
Christian.
More information about the mesa-dev
mailing list