From d0bca086ab6d032909e9a429720fea297c536f97 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 10 Oct 2007 15:45:57 -0600 Subject: [PATCH 1/1] fix get_result_vector() since fp output slots are not fixed anymore --- src/mesa/pipe/i915simple/i915_fpc.h | 3 ++ src/mesa/pipe/i915simple/i915_fpc_translate.c | 30 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/mesa/pipe/i915simple/i915_fpc.h b/src/mesa/pipe/i915simple/i915_fpc.h index 5fdc7ef27ea..c25f5abf0ea 100644 --- a/src/mesa/pipe/i915simple/i915_fpc.h +++ b/src/mesa/pipe/i915simple/i915_fpc.h @@ -54,6 +54,9 @@ struct i915_fp_compile { uint input_semantic_name[PIPE_MAX_SHADER_INPUTS]; uint input_semantic_index[PIPE_MAX_SHADER_INPUTS]; + uint output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; + uint output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; + /** points into the i915->current.constants array: */ float (*constants)[4]; uint num_constants; diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c index 24bb1d3e2a9..f34225bfedc 100644 --- a/src/mesa/pipe/i915simple/i915_fpc_translate.c +++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c @@ -240,14 +240,17 @@ get_result_vector(struct i915_fp_compile *p, { switch (dest->DstRegister.File) { case TGSI_FILE_OUTPUT: - switch (dest->DstRegister.Index) { - case 0: /**TGSI_ATTRIB_POS:**/ - return UREG(REG_TYPE_OD, 0); - case 1: /**TGSI_ATTRIB_COLOR0:**/ - return UREG(REG_TYPE_OC, 0); - default: - i915_program_error(p, "Bad inst->DstReg.Index"); - return 0; + { + uint sem_name = p->output_semantic_name[dest->DstRegister.Index]; + switch (sem_name) { + case TGSI_SEMANTIC_POSITION: + return UREG(REG_TYPE_OD, 0); + case TGSI_SEMANTIC_COLOR: + return UREG(REG_TYPE_OC, 0); + default: + i915_program_error(p, "Bad inst->DstReg.Index/semantics"); + return 0; + } } case TGSI_FILE_TEMPORARY: return UREG(REG_TYPE_R, dest->DstRegister.Index); @@ -867,6 +870,17 @@ i915_translate_instructions(struct i915_fp_compile *p, p->input_semantic_name[ind] = sem; p->input_semantic_index[ind] = semi; } + else if (parse.FullToken.FullDeclaration.Declaration.File + == TGSI_FILE_OUTPUT) { + /* save output register info for use in get_result_vector() */ + uint ind, sem, semi; + ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First; + sem = parse.FullToken.FullDeclaration.Semantic.SemanticName; + semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex; + /*printf("FS Output DECL [%u] sem %u\n", ind, sem);*/ + p->output_semantic_name[ind] = sem; + p->output_semantic_index[ind] = semi; + } break; case TGSI_TOKEN_TYPE_IMMEDIATE: -- 2.30.2