summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndre Maasikas <[email protected]>2010-08-18 14:14:38 +0300
committerAndre Maasikas <[email protected]>2010-08-18 14:27:43 +0300
commitd442a01ac14382d83cdaac87d2832315ceb3e963 (patch)
tree562248d95c6fceb2b5a861be0bb0a2fa002392ed /src
parent8690c6a6b4fb0b48e2ae75cd0f64de86b039081c (diff)
r600: implement SSG instruction
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c66
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.h1
2 files changed, 67 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 4902f7630ca..247617408c5 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -4369,6 +4369,65 @@ GLboolean assemble_SLT(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
+GLboolean assemble_SSG(r700_AssemblerBase *pAsm)
+{
+ checkop1(pAsm);
+
+ GLuint tmp = gethelpr(pAsm);
+ /* tmp = (src > 0 ? 1 : src) */
+ pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT;
+ pAsm->D.dst.op3 = 1;
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp;
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1);
+
+ if( GL_FALSE == assemble_src(pAsm, 0, 2) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ /* dst = (-tmp > 0 ? -1 : tmp) */
+ pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT;
+ pAsm->D.dst.op3 = 1;
+
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp;
+ noswizzle_PVSSRC(&(pAsm->S[0].src));
+ neg_PVSSRC(&(pAsm->S[0].src));
+
+ setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1);
+ neg_PVSSRC(&(pAsm->S[1].src));
+
+ setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE);
+ pAsm->S[2].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[2].src.reg = tmp;
+ noswizzle_PVSSRC(&(pAsm->S[2].src));
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
GLboolean assemble_STP(r700_AssemblerBase *pAsm)
{
return GL_TRUE;
@@ -5893,6 +5952,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
// return GL_FALSE;
// break;
+ case OPCODE_SSG:
+ if ( GL_FALSE == assemble_SSG(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
case OPCODE_SWZ:
if ( GL_FALSE == assemble_MOV(pR700AsmCode) )
{
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index ab954ec143e..f00f4da8474 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -625,6 +625,7 @@ GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode);
GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode);
GLboolean assemble_SLT(r700_AssemblerBase *pAsm);
+GLboolean assemble_SSG(r700_AssemblerBase *pAsm);
GLboolean assemble_STP(r700_AssemblerBase *pAsm);
GLboolean assemble_TEX(r700_AssemblerBase *pAsm);
GLboolean assemble_XPD(r700_AssemblerBase *pAsm);