From: Richard Li Date: Sun, 29 Aug 2010 23:27:46 +0000 (-0400) Subject: evergreen : fix shader const allocation and instruction bugs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3d41844c7704a4b937f4eb5925e71f35547cd4a;p=mesa.git evergreen : fix shader const allocation and instruction bugs. --- diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 9568f446daa..b53ff424a01 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -501,9 +501,7 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) (ctx->FragmentProgram._Current); r700_AssemblerBase *pAsm = &(fp->r700AsmCode); - struct gl_fragment_program *mesa_fp = &(fp->mesa_program); - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; + struct gl_fragment_program *mesa_fp = &(fp->mesa_program); unsigned int ui, i; unsigned int unNumOfReg; unsigned int unBit; @@ -742,7 +740,22 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) } exportCount = (evergreen->SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); - + + return GL_TRUE; +} + +GLboolean evergreenSetupFPconstants(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) + (ctx->FragmentProgram._Current); + r700_AssemblerBase *pAsm = &(fp->r700AsmCode); + + struct gl_program_parameter_list *paramList; + unsigned int unNumParamData; + unsigned int ui; + /* sent out shader constants. */ paramList = fp->mesa_program.Base.Parameters; @@ -801,7 +814,4 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) } unConstOffset += pCompiledSub->NumParameters; } - - return GL_TRUE; -} - +} \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.h b/src/mesa/drivers/dri/r600/evergreen_fragprog.h index 0547d1f63dd..0e200bf3833 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.h @@ -68,6 +68,8 @@ extern void evergreenSelectFragmentShader(GLcontext *ctx); extern GLboolean evergreenSetupFragmentProgram(GLcontext * ctx); +extern GLboolean evergreenSetupFPconstants(GLcontext * ctx); + extern void * evergreenGetActiveFpShaderBo(GLcontext * ctx); extern void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx); diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 7f9c95e7655..85b2f9d6ab7 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -839,6 +839,10 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, GLuint emit_end = evergreenPredictRenderSize(ctx, prim, ib, nr_prims) + context->radeon.cmdbuf.cs->cdw; + /* evergreenPredictRenderSize will call radeonReleaseDmaRegions, so update VP/FP const buf after it. */ + evergreenSetupVPconstants(ctx); + evergreenSetupFPconstants(ctx); + evergreenSetupIndexBuffer(ctx, ib); evergreenSetupStreams(ctx, arrays, max_index + 1); @@ -849,16 +853,12 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, for (i = 0; i < nr_prims; ++i) { -/* richard test disable */ -#if 0 if (context->ind_buf.bo) evergreenRunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, prim[i].mode); else -#endif //0 -//------------- evergreenRunRenderPrimitiveImmediate(ctx, prim[i].start, prim[i].start + prim[i].count, diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 5e4844edf9f..4f3db00c7d2 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -599,10 +599,6 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); struct evergreen_vertex_program *vp = context->selected_vp; - struct gl_program_parameter_list *paramList; - unsigned int unNumParamData; - unsigned int ui; - if(GL_FALSE == vp->loaded) { if(vp->r700Shader.bNeedsAssembly == GL_TRUE) @@ -655,6 +651,19 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) CLEARbit(evergreen->SPI_PS_IN_CONTROL_0.u32All, LINEAR_GRADIENT_ENA_bit); */ + return GL_TRUE; +} + +GLboolean evergreenSetupVPconstants(GLcontext * ctx) +{ + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + struct evergreen_vertex_program *vp = context->selected_vp; + + struct gl_program_parameter_list *paramList; + unsigned int unNumParamData; + unsigned int ui; + /* sent out shader constants. */ paramList = vp->mesa_program->Base.Parameters; @@ -724,6 +733,4 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) } unConstOffset += pCompiledSub->NumParameters; } - - return GL_TRUE; -} +} \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.h b/src/mesa/drivers/dri/r600/evergreen_vertprog.h index 4c2626de770..58539021152 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.h @@ -98,6 +98,8 @@ extern void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_arra extern GLboolean evergreenSetupVertexProgram(GLcontext * ctx); +extern GLboolean evergreenSetupVPconstants(GLcontext * ctx); + extern void * evergreenGetActiveVpShaderBo(GLcontext * ctx); extern void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index fbd8c45d25d..45ff9c06249 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4408,7 +4408,14 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */ - pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; + if(8 == pAsm->unAsic) + { + pAsm->D.dst.opcode = EG_OP3_INST_MUL_LIT; + } + else + { + pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; + } pAsm->D.dst.math = 1; pAsm->D.dst.op3 = 1; pAsm->D.dst.rtype = DST_REG_TEMPORARY;