summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/compiler
diff options
context:
space:
mode:
authorDavid Heidelberg <[email protected]>2014-12-19 14:11:21 +0100
committerMarek Olšák <[email protected]>2014-12-21 20:34:19 +0100
commitfbfe2918f4e48d0315983b24352e9d3ce7c382f1 (patch)
treefa36a7f05595172c2272ba86c0f9dea4b781ab54 /src/gallium/drivers/r300/compiler
parentaa6415b4852557ed91b4f31065a79b2a6c987c53 (diff)
r300g: implement ARR opcode
Same as ARL, just has extra rounding. Useful for st/nine. Tested-by: Pavel Ondračka <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: David Heidelberg <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r300/compiler')
-rw-r--r--src/gallium/drivers/r300/compiler/r3xx_vertprog.c7
-rw-r--r--src/gallium/drivers/r300/compiler/radeon_opcodes.c7
-rw-r--r--src/gallium/drivers/r300/compiler/radeon_opcodes.h4
3 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
index fd4f6f4045e..2ff6db54637 100644
--- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
+++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
@@ -405,6 +405,7 @@ static void translate_vertex_program(struct radeon_compiler *c, void *user)
switch (vpi->Opcode) {
case RC_OPCODE_ADD: ei_vector2(compiler->code, VE_ADD, vpi, inst); break;
case RC_OPCODE_ARL: ei_vector1(compiler->code, VE_FLT2FIX_DX, vpi, inst); break;
+ case RC_OPCODE_ARR: ei_vector1(compiler->code, VE_FLT2FIX_DX_RND, vpi, inst); break;
case RC_OPCODE_COS: ei_math1(compiler->code, ME_COS, vpi, inst); break;
case RC_OPCODE_DP4: ei_vector2(compiler->code, VE_DOT_PRODUCT, vpi, inst); break;
case RC_OPCODE_DST: ei_vector2(compiler->code, VE_DISTANCE_VECTOR, vpi, inst); break;
@@ -798,7 +799,7 @@ static void transform_negative_addressing(struct r300_vertex_program_compiler *c
struct rc_instruction *inst, *add;
unsigned const_swizzle;
- /* Transform ARL */
+ /* Transform ARL/ARR */
add = rc_insert_new_instruction(&c->Base, arl->Prev);
add->U.I.Opcode = RC_OPCODE_ADD;
add->U.I.DstReg.File = RC_FILE_TEMPORARY;
@@ -833,7 +834,7 @@ static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, voi
for (inst = c->Base.Program.Instructions.Next; inst != &c->Base.Program.Instructions; inst = inst->Next) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
- if (inst->U.I.Opcode == RC_OPCODE_ARL) {
+ if (inst->U.I.Opcode == RC_OPCODE_ARL || inst->U.I.Opcode == RC_OPCODE_ARR) {
if (lastARL != NULL && min_offset < 0)
transform_negative_addressing(c, lastARL, inst, min_offset);
@@ -847,7 +848,7 @@ static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, voi
inst->U.I.SrcReg[i].Index < 0) {
/* ARL must precede any indirect addressing. */
if (lastARL == NULL) {
- rc_error(&c->Base, "Vertex shader: Found relative addressing without ARL.");
+ rc_error(&c->Base, "Vertex shader: Found relative addressing without ARL/ARR.");
return;
}
diff --git a/src/gallium/drivers/r300/compiler/radeon_opcodes.c b/src/gallium/drivers/r300/compiler/radeon_opcodes.c
index 916baa23608..a251bbe45d0 100644
--- a/src/gallium/drivers/r300/compiler/radeon_opcodes.c
+++ b/src/gallium/drivers/r300/compiler/radeon_opcodes.c
@@ -60,6 +60,12 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = {
.HasDstReg = 1
},
{
+ .Opcode = RC_OPCODE_ARR,
+ .Name = "ARR",
+ .NumSrcRegs = 1,
+ .HasDstReg = 1
+ },
+ {
.Opcode = RC_OPCODE_CEIL,
.Name = "CEIL",
.NumSrcRegs = 1,
@@ -546,6 +552,7 @@ void rc_compute_sources_for_writemask(
} else {
switch(opcode->Opcode) {
case RC_OPCODE_ARL:
+ case RC_OPCODE_ARR:
srcmasks[0] |= RC_MASK_X;
break;
case RC_OPCODE_DP2:
diff --git a/src/gallium/drivers/r300/compiler/radeon_opcodes.h b/src/gallium/drivers/r300/compiler/radeon_opcodes.h
index 0a70901a82f..1c425050727 100644
--- a/src/gallium/drivers/r300/compiler/radeon_opcodes.h
+++ b/src/gallium/drivers/r300/compiler/radeon_opcodes.h
@@ -47,6 +47,10 @@ typedef enum {
* dst.x = floor(src.x), where dst must be an address register */
RC_OPCODE_ARL,
+ /** special instruction: load address register with round
+ * dst.x = round(src.x), where dst must be an address register */
+ RC_OPCODE_ARR,
+
/** vec4 instruction: dst.c = ceil(src0.c) */
RC_OPCODE_CEIL,