summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2009-03-07 00:42:12 -0800
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-03-07 00:42:12 -0800
commitdcd7f1c0551812cf39ca6a3af9f1610ad84fb24e (patch)
treef62f7e1d77c706ba21e25c02a4d93add223f108c
parent67f2c6054c7303547c790f283ab3d124ac60a276 (diff)
r300-gallium: A bit more vertex format fixup.
-rw-r--r--src/gallium/drivers/r300/r300_reg.h8
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c63
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.h1
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h28
-rw-r--r--src/gallium/drivers/r300/r300_surface.c11
5 files changed, 57 insertions, 54 deletions
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index b0394f80c88..321f5873744 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -326,6 +326,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_WRITE_ENA_Z 4
# define R300_WRITE_ENA_W 8
# define R300_SWIZZLE1_SHIFT 16
+
+# define R300_VAP_SWIZZLE_XYZW \
+ ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
+ (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \
+ (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | \
+ (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | \
+ (0xf << R300_WRITE_ENA_SHIFT))
+
#define R300_VAP_PROG_STREAM_CNTL_EXT_1 0x21e4
#define R300_VAP_PROG_STREAM_CNTL_EXT_2 0x21e8
#define R300_VAP_PROG_STREAM_CNTL_EXT_3 0x21ec
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index b7fb36f6f98..d15b4ff2e1a 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -25,30 +25,6 @@
/* r300_state_derived: Various bits of state which are dependent upon
* currently bound CSO data. */
-static uint32_t translate_vertex_data_type(int type) {
- switch (type) {
- case EMIT_1F:
- case EMIT_1F_PSIZE:
- return R300_DATA_TYPE_FLOAT_1;
- break;
- case EMIT_2F:
- return R300_DATA_TYPE_FLOAT_2;
- break;
- case EMIT_3F:
- return R300_DATA_TYPE_FLOAT_3;
- break;
- case EMIT_4F:
- return R300_DATA_TYPE_FLOAT_4;
- break;
- default:
- debug_printf("r300: Implementation error: "
- "Bad vertex data type!\n");
- break;
- }
-
- return 0;
-}
-
/* Update the vertex_info struct in our r300_context.
*
* The vertex_info struct describes the post-TCL format of vertices. It is
@@ -156,42 +132,31 @@ static void r300_update_vertex_layout(struct r300_context* r300)
if (memcmp(&r300->vertex_info, &vinfo, sizeof(struct vertex_info))) {
uint32_t temp;
-
-#define BORING_SWIZZLE \
- ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \
- (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \
- (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | \
- (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | \
- (0xf << R300_WRITE_ENA_SHIFT))
+ debug_printf("attrib count: %d, fp input count: %d\n",
+ vinfo.num_attribs, info->num_inputs);
+ for (i = 0; i < vinfo.num_attribs; i++) {
+ debug_printf("attrib: offset %d, interp %d, size %d,"
+ " tab %d\n", vinfo.attrib[i].src_index,
+ vinfo.attrib[i].interp_mode, vinfo.attrib[i].emit,
+ tab[i]);
+ }
for (i = 0; i < vinfo.num_attribs; i++) {
/* Make sure we have a proper destination for our attribute */
- if (tab[i] == -1) {
- debug_printf("attrib count: %d, fp input count: %d\n",
- vinfo.num_attribs, info->num_inputs);
- for (i = 0; i < vinfo.num_attribs; i++) {
- debug_printf("attrib: offset %d, interp %d, size %d,"
- " tab %d\n", vinfo.attrib[i].src_index,
- vinfo.attrib[i].interp_mode, vinfo.attrib[i].emit,
- tab[i]);
- }
- assert(0);
- }
+ assert(tab[i] == -1);
temp = translate_vertex_data_type(vinfo.attrib[i].emit) |
- (tab[i] << R300_DST_VEC_LOC_SHIFT) | R300_SIGNED;
+ (tab[i] << R300_DST_VEC_LOC_SHIFT);
if (i & 1) {
- r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff;
- r300->vertex_info.vap_prog_stream_cntl[i >> 1] |=
- temp << 16;
+ r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0x0000ffff;
+ r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= temp << 16;
} else {
r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff0000;
- r300->vertex_info.vap_prog_stream_cntl[i >> 1] |=
- temp;
+ r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= temp;
}
r300->vertex_info.vap_prog_stream_cntl_ext[i >> 1] |=
- (BORING_SWIZZLE << (i & 1 ? 16 : 0));
+ (R300_VAP_SWIZZLE_XYZW << (i & 1 ? 16 : 0));
}
r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= (R300_LAST_VEC <<
(i & 1 ? 16 : 0));
diff --git a/src/gallium/drivers/r300/r300_state_derived.h b/src/gallium/drivers/r300/r300_state_derived.h
index 72ba6b928d6..63ae8eb8d08 100644
--- a/src/gallium/drivers/r300/r300_state_derived.h
+++ b/src/gallium/drivers/r300/r300_state_derived.h
@@ -27,6 +27,7 @@
#include "r300_context.h"
#include "r300_reg.h"
+#include "r300_state_inlines.h"
void r300_update_derived_state(struct r300_context* r300);
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 630ac3b2fc4..8d8b74dfc1d 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -344,4 +344,32 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
return 0;
}
+static uint32_t translate_vertex_data_type(int type) {
+ switch (type) {
+ case EMIT_1F:
+ case EMIT_1F_PSIZE:
+ return R300_DATA_TYPE_FLOAT_1 | R300_SIGNED;
+ break;
+ case EMIT_2F:
+ return R300_DATA_TYPE_FLOAT_2 | R300_SIGNED;
+ break;
+ case EMIT_3F:
+ return R300_DATA_TYPE_FLOAT_3 | R300_SIGNED;
+ break;
+ case EMIT_4F:
+ return R300_DATA_TYPE_FLOAT_4 | R300_SIGNED;
+ break;
+ case EMIT_4UB:
+ return R300_DATA_TYPE_BYTE;
+ break;
+ default:
+ debug_printf("r300: Implementation error: "
+ "Bad vertex data type!\n");
+ assert(0);
+ break;
+ }
+
+ return 0;
+}
+
#endif /* R300_STATE_INLINES_H */
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index 9f81e2e730c..2040967253f 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -72,7 +72,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
r300_emit_rs_block_state(r300, &r300_rs_block_clear_state);
}
- BEGIN_CS(112 + (caps->has_tcl ? 2 : 0));
+ BEGIN_CS(106 + (caps->has_tcl ? 2 : 0));
/* Flush PVS. */
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
@@ -80,8 +80,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
- /* Vertex size. */
- OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
/* Max and min vertex index clamp. */
OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF);
OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
@@ -145,11 +143,14 @@ static void r300_surface_fill(struct pipe_context* pipe,
((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
}
- OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, 0xF688F688);
+ OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
+ (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
+ (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
- OUT_CS_REG(R300_VAP_VTX_SIZE, 0x00000008);
+ /* Vertex size. */
+ OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, 0x00000003);
OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x00000000);