Reviewed-by: Roland Scheidegger <[email protected]>
Am 13.05.2014 19:12, schrieb Ilia Mirkin: > ping? ran into this when trying to feed text shaders into > nouveau_compiler that had texture offsets... > > On Wed, May 7, 2014 at 9:25 PM, Ilia Mirkin <[email protected]> wrote: >> Signed-off-by: Ilia Mirkin <[email protected]> >> --- >> src/gallium/auxiliary/tgsi/tgsi_text.c | 53 >> ++++++++++++++++++++++++++++++---- >> 1 file changed, 48 insertions(+), 5 deletions(-) >> >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c >> b/src/gallium/auxiliary/tgsi/tgsi_text.c >> index 2b2e7d5..7e50d8d 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c >> @@ -735,8 +735,9 @@ parse_dst_operand( >> static boolean >> parse_optional_swizzle( >> struct translate_ctx *ctx, >> - uint swizzle[4], >> - boolean *parsed_swizzle ) >> + uint *swizzle, >> + boolean *parsed_swizzle, >> + int components) >> { >> const char *cur = ctx->cur; >> >> @@ -748,7 +749,7 @@ parse_optional_swizzle( >> >> cur++; >> eat_opt_white( &cur ); >> - for (i = 0; i < 4; i++) { >> + for (i = 0; i < components; i++) { >> if (uprcase( *cur ) == 'X') >> swizzle[i] = TGSI_SWIZZLE_X; >> else if (uprcase( *cur ) == 'Y') >> @@ -816,7 +817,7 @@ parse_src_operand( >> >> /* Parse optional swizzle. >> */ >> - if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle )) { >> + if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle, 4 )) { >> if (parsed_swizzle) { >> src->Register.SwizzleX = swizzle[0]; >> src->Register.SwizzleY = swizzle[1]; >> @@ -839,6 +840,35 @@ parse_src_operand( >> } >> >> static boolean >> +parse_texoffset_operand( >> + struct translate_ctx *ctx, >> + struct tgsi_texture_offset *src ) >> +{ >> + uint file; >> + uint swizzle[3]; >> + boolean parsed_swizzle; >> + struct parsed_bracket bracket; >> + >> + if (!parse_register_src(ctx, &file, &bracket)) >> + return FALSE; >> + >> + src->File = file; >> + src->Index = bracket.index; >> + >> + /* Parse optional swizzle. >> + */ >> + if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle, 3 )) { >> + if (parsed_swizzle) { >> + src->SwizzleX = swizzle[0]; >> + src->SwizzleY = swizzle[1]; >> + src->SwizzleZ = swizzle[2]; >> + } >> + } >> + >> + return TRUE; >> +} >> + >> +static boolean >> match_inst(const char **pcur, >> unsigned *saturate, >> const struct tgsi_opcode_info *info) >> @@ -904,7 +934,7 @@ parse_instruction( >> if (!parse_register_1d( ctx, &file, &index )) >> return FALSE; >> >> - if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle )) { >> + if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle, 4 )) { >> if (parsed_swizzle) { >> inst.Predicate.SwizzleX = swizzle[0]; >> inst.Predicate.SwizzleY = swizzle[1]; >> @@ -1003,6 +1033,19 @@ parse_instruction( >> >> cur = ctx->cur; >> eat_opt_white( &cur ); >> + for (i = 0; info->is_tex && *cur == ','; i++) { >> + cur++; >> + eat_opt_white( &cur ); >> + ctx->cur = cur; >> + if (!parse_texoffset_operand( ctx, &inst.TexOffsets[i] )) >> + return FALSE; >> + cur = ctx->cur; >> + eat_opt_white( &cur ); >> + } >> + inst.Texture.NumOffsets = i; >> + >> + cur = ctx->cur; >> + eat_opt_white( &cur ); >> if (info->is_branch && *cur == ':') { >> uint target; >> >> -- >> 1.8.3.2 >> > _______________________________________________ > mesa-dev mailing list > [email protected] > https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=ORxpbHHoDwi1ik7s5giXNFhTQcdA3cY51AQn3zSzlVE%3D%0A&s=2511af27d2323756268f8cd3dde0edf680794eb2bcbbe5b6d3ed773921abc347 > _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
