summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2009-06-05 10:18:20 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-06-05 10:18:20 -0700
commit9e4590dff72b8739e787da7f0d86c7066f179186 (patch)
tree4ef7b4001ecbcc91af24ceeb555863e8e8994f25 /src/gallium
parent4c034441a8f12e4bf60b8c5f58202d5ae00ff31d (diff)
r300-gallium: Improve vs emit.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r300/r300_emit.c20
-rw-r--r--src/gallium/drivers/r300/r300_reg.h2
2 files changed, 14 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 61b416663b..4a70f3afde 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -372,17 +372,22 @@ void r300_emit_vertex_shader(struct r300_context* r300,
}
if (constants->count) {
- BEGIN_CS(16 + (vs->instruction_count * 4) + (constants->count * 4));
+ BEGIN_CS(14 + (vs->instruction_count * 4) + (constants->count * 4));
} else {
- BEGIN_CS(13 + (vs->instruction_count * 4));
+ BEGIN_CS(11 + (vs->instruction_count * 4));
}
- OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) |
+ /* R300_VAP_PVS_CODE_CNTL_0
+ * R300_VAP_PVS_CONST_CNTL
+ * R300_VAP_PVS_CODE_CNTL_1
+ * See the r5xx docs for instructions on how to use these.
+ * XXX these could be optimized to select better values... */
+ OUT_CS_REG_SEQ(R300_VAP_PVS_CODE_CNTL_0, 3);
+ OUT_CS(R300_PVS_FIRST_INST(0) |
+ R300_PVS_XYZW_VALID_INST(vs->instruction_count - 1) |
R300_PVS_LAST_INST(vs->instruction_count - 1));
- OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, vs->instruction_count - 1);
-
- /* XXX */
- OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x0);
+ OUT_CS(R300_PVS_MAX_CONST_ADDR(constants->count - 1));
+ OUT_CS(vs->instruction_count - 1);
OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0);
OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, vs->instruction_count * 4);
@@ -412,7 +417,6 @@ void r300_emit_vertex_shader(struct r300_context* r300,
R300_PVS_VF_MAX_VTX_NUM(12));
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
END_CS;
-
}
void r300_emit_viewport_state(struct r300_context* r300,
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 920584a59e..3bb9bc47b5 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -511,11 +511,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_PVS_XYZW_VALID_INST_SHIFT 10
# define R300_PVS_LAST_INST_SHIFT 20
# define R300_PVS_FIRST_INST(x) ((x) << 0)
+# define R300_PVS_XYZW_VALID_INST(x) ((x) << 10)
# define R300_PVS_LAST_INST(x) ((x) << 20)
/* Addresses are relative the the vertex program parameters area. */
#define R300_VAP_PVS_CONST_CNTL 0x22D4
# define R300_PVS_CONST_BASE_OFFSET_SHIFT 0
# define R300_PVS_MAX_CONST_ADDR_SHIFT 16
+# define R300_PVS_MAX_CONST_ADDR(x) ((x) << 16)
#define R300_VAP_PVS_CODE_CNTL_1 0x22D8
# define R300_PVS_LAST_VTX_SRC_INST_SHIFT 0
#define R300_VAP_PVS_FLOW_CNTL_OPC 0x22DC