summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAndre Maasikas <[email protected]>2009-12-04 16:36:41 +0200
committerAndre Maasikas <[email protected]>2009-12-08 15:39:39 +0200
commit50ab51101e4c5e64ab92c260c324fb66a98851a8 (patch)
treea405eb43013a74d06c6296da44cc508e708da5a4 /src/mesa
parent94723b60cf3dd838dfaf505450db8ef2e089399c (diff)
r600: glsl - allow specifying texture sampler via uniforms
looks kinda hackish, should rethink later
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c2
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.h1
-rw-r--r--src/mesa/drivers/dri/r600/r700_fragprog.c5
-rw-r--r--src/mesa/drivers/dri/r600/r700_vertprog.c4
4 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 3738edbc2f9..158c5fa5491 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -4840,7 +4840,7 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm)
pAsm->need_tex_barrier = GL_TRUE;
}
// Set src1 to tex unit id
- pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit;
+ pAsm->S[1].src.reg = pAsm->SamplerUnits[pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit];
pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
//No sw info from mesa compiler, so hard code here.
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index ef1f924add9..48ffef501f4 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -416,6 +416,7 @@ typedef struct r700_AssemblerBase
SHADER_PIPE_TYPE currentShaderType;
struct prog_instruction * pILInst;
GLuint uiCurInst;
+ GLubyte SamplerUnits[MAX_SAMPLERS];
GLboolean bR6xx;
/* helper to decide which type of instruction to assemble */
GLboolean is_tex;
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index 0cb9707ee6f..8eb439a9519 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -308,6 +308,7 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
GLuint number_of_colors_exported;
GLboolean z_enabled = GL_FALSE;
GLuint unBit;
+ int i;
//Init_Program
Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) );
@@ -320,6 +321,10 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
InitShaderProgram(&(fp->r700AsmCode));
+ for(i=0; i < MAX_SAMPLERS; i++)
+ {
+ fp->r700AsmCode.SamplerUnits[i] = fp->mesa_program.Base.SamplerUnits[i];
+ }
if( GL_FALSE == AssembleInstr(0,
mesa_fp->Base.NumInstructions,
&(mesa_fp->Base.Instructions[0]),
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index d3d1da79592..759b74dc7e9 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -337,6 +337,10 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
InitShaderProgram(&(vp->r700AsmCode));
+ for(i=0; i < MAX_SAMPLERS; i++)
+ {
+ vp->r700AsmCode.SamplerUnits[i] = vp->mesa_program->Base.SamplerUnits[i];
+ }
if(GL_FALSE == AssembleInstr(0,
vp->mesa_program->Base.NumInstructions,
&(vp->mesa_program->Base.Instructions[0]),