X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgallium%2Fauxiliary%2Ftgsi%2Ftgsi_transform.c;h=ae875f29abfb23334a42fa5c55d42d6461909455;hb=e2dded78ea9209a11897e178d5f585f66262ce1e;hp=bc9c18fd4a725df628b7b64f57a60c405cca832b;hpb=221b30d595ab2f97fd0518c761615dd28f3ef5ca;p=mesa.git diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c index bc9c18fd4a7..ae875f29abf 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_transform.c +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c @@ -79,6 +79,19 @@ emit_immediate(struct tgsi_transform_context *ctx, } +static void +emit_property(struct tgsi_transform_context *ctx, + const struct tgsi_full_property *prop) +{ + uint ti = ctx->ti; + + ti += tgsi_build_full_property(prop, + ctx->tokens_out + ti, + ctx->header, + ctx->max_tokens_out - ti); + ctx->ti = ti; +} + /** * Apply user-defined transformations to the input shader to produce @@ -110,6 +123,7 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in, ctx->emit_instruction = emit_instruction; ctx->emit_declaration = emit_declaration; ctx->emit_immediate = emit_immediate; + ctx->emit_property = emit_property; ctx->tokens_out = tokens_out; ctx->max_tokens_out = max_tokens_out; @@ -130,15 +144,13 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in, /** ** Setup output shader **/ - *(struct tgsi_version *) &tokens_out[0] = tgsi_build_version(); - - ctx->header = (struct tgsi_header *) (tokens_out + 1); + ctx->header = (struct tgsi_header *)tokens_out; *ctx->header = tgsi_build_header(); - processor = (struct tgsi_processor *) (tokens_out + 2); + processor = (struct tgsi_processor *) (tokens_out + 1); *processor = tgsi_build_processor( procType, ctx->header ); - ctx->ti = 3; + ctx->ti = 2; /** @@ -184,6 +196,17 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in, ctx->emit_immediate(ctx, fullimm); } break; + case TGSI_TOKEN_TYPE_PROPERTY: + { + struct tgsi_full_property *fullprop + = &parse.FullToken.FullProperty; + + if (ctx->transform_property) + ctx->transform_property(ctx, fullprop); + else + ctx->emit_property(ctx, fullprop); + } + break; default: assert( 0 ); @@ -215,7 +238,7 @@ tgsi_transform_foo( struct tgsi_token *tokens_out, uint max_tokens_out ) { const char *text = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], COLOR, CONSTANT\n" "DCL OUT[0], COLOR\n" " 0: MOV OUT[0], IN[0]\n"