r300g: rename aos to vertex arrays
This commit is contained in:
@@ -613,8 +613,8 @@ struct r300_context {
|
|||||||
int vs_const_base;
|
int vs_const_base;
|
||||||
|
|
||||||
/* AOS (PACKET3_3D_LOAD_VBPNTR) command buffer for the case offset=0. */
|
/* AOS (PACKET3_3D_LOAD_VBPNTR) command buffer for the case offset=0. */
|
||||||
uint32_t aos_cb[(16 * 3 + 1) / 2];
|
uint32_t vertex_arrays_cb[(16 * 3 + 1) / 2];
|
||||||
boolean aos_dirty;
|
boolean vertex_arrays_dirty;
|
||||||
|
|
||||||
/* Whether any buffer (FB, textures, VBOs) has been set, but buffers
|
/* Whether any buffer (FB, textures, VBOs) has been set, but buffers
|
||||||
* haven't been validated yet. */
|
* haven't been validated yet. */
|
||||||
|
@@ -816,17 +816,17 @@ void r300_emit_textures_state(struct r300_context *r300,
|
|||||||
END_CS;
|
END_CS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void r300_update_aos_cb(struct r300_context *r300, unsigned packet_size)
|
static void r300_update_vertex_arrays_cb(struct r300_context *r300, unsigned packet_size)
|
||||||
{
|
{
|
||||||
struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer;
|
struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer;
|
||||||
struct pipe_vertex_element *velem = r300->velems->velem;
|
struct pipe_vertex_element *velem = r300->velems->velem;
|
||||||
unsigned *hw_format_size = r300->velems->hw_format_size;
|
unsigned *hw_format_size = r300->velems->hw_format_size;
|
||||||
unsigned size1, size2, aos_count = r300->velems->count;
|
unsigned size1, size2, vertex_array_count = r300->velems->count;
|
||||||
int i;
|
int i;
|
||||||
CB_LOCALS;
|
CB_LOCALS;
|
||||||
|
|
||||||
BEGIN_CB(r300->aos_cb, packet_size);
|
BEGIN_CB(r300->vertex_arrays_cb, packet_size);
|
||||||
for (i = 0; i < aos_count - 1; i += 2) {
|
for (i = 0; i < vertex_array_count - 1; i += 2) {
|
||||||
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
||||||
vb2 = &vbuf[velem[i+1].vertex_buffer_index];
|
vb2 = &vbuf[velem[i+1].vertex_buffer_index];
|
||||||
size1 = hw_format_size[i];
|
size1 = hw_format_size[i];
|
||||||
@@ -838,7 +838,7 @@ static void r300_update_aos_cb(struct r300_context *r300, unsigned packet_size)
|
|||||||
OUT_CB(vb2->buffer_offset + velem[i+1].src_offset);
|
OUT_CB(vb2->buffer_offset + velem[i+1].src_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aos_count & 1) {
|
if (vertex_array_count & 1) {
|
||||||
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
||||||
size1 = hw_format_size[i];
|
size1 = hw_format_size[i];
|
||||||
|
|
||||||
@@ -847,34 +847,34 @@ static void r300_update_aos_cb(struct r300_context *r300, unsigned packet_size)
|
|||||||
}
|
}
|
||||||
END_CB;
|
END_CB;
|
||||||
|
|
||||||
r300->aos_dirty = FALSE;
|
r300->vertex_arrays_dirty = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void r300_emit_aos(struct r300_context* r300, int offset, boolean indexed)
|
void r300_emit_vertex_arrays(struct r300_context* r300, int offset, boolean indexed)
|
||||||
{
|
{
|
||||||
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
|
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
|
||||||
struct pipe_vertex_element *velem = r300->velems->velem;
|
struct pipe_vertex_element *velem = r300->velems->velem;
|
||||||
struct r300_buffer *buf;
|
struct r300_buffer *buf;
|
||||||
int i;
|
int i;
|
||||||
unsigned aos_count = r300->velems->count;
|
unsigned vertex_array_count = r300->velems->count;
|
||||||
unsigned packet_size = (aos_count * 3 + 1) / 2;
|
unsigned packet_size = (vertex_array_count * 3 + 1) / 2;
|
||||||
CS_LOCALS(r300);
|
CS_LOCALS(r300);
|
||||||
|
|
||||||
BEGIN_CS(2 + packet_size + aos_count * 2);
|
BEGIN_CS(2 + packet_size + vertex_array_count * 2);
|
||||||
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
|
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
|
||||||
OUT_CS(aos_count | (!indexed ? R300_VC_FORCE_PREFETCH : 0));
|
OUT_CS(vertex_array_count | (!indexed ? R300_VC_FORCE_PREFETCH : 0));
|
||||||
|
|
||||||
if (!offset) {
|
if (!offset) {
|
||||||
if (r300->aos_dirty) {
|
if (r300->vertex_arrays_dirty) {
|
||||||
r300_update_aos_cb(r300, packet_size);
|
r300_update_vertex_arrays_cb(r300, packet_size);
|
||||||
}
|
}
|
||||||
OUT_CS_TABLE(r300->aos_cb, packet_size);
|
OUT_CS_TABLE(r300->vertex_arrays_cb, packet_size);
|
||||||
} else {
|
} else {
|
||||||
struct pipe_vertex_buffer *vb1, *vb2;
|
struct pipe_vertex_buffer *vb1, *vb2;
|
||||||
unsigned *hw_format_size = r300->velems->hw_format_size;
|
unsigned *hw_format_size = r300->velems->hw_format_size;
|
||||||
unsigned size1, size2;
|
unsigned size1, size2;
|
||||||
|
|
||||||
for (i = 0; i < aos_count - 1; i += 2) {
|
for (i = 0; i < vertex_array_count - 1; i += 2) {
|
||||||
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
||||||
vb2 = &vbuf[velem[i+1].vertex_buffer_index];
|
vb2 = &vbuf[velem[i+1].vertex_buffer_index];
|
||||||
size1 = hw_format_size[i];
|
size1 = hw_format_size[i];
|
||||||
@@ -886,7 +886,7 @@ void r300_emit_aos(struct r300_context* r300, int offset, boolean indexed)
|
|||||||
OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride);
|
OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aos_count & 1) {
|
if (vertex_array_count & 1) {
|
||||||
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
||||||
size1 = hw_format_size[i];
|
size1 = hw_format_size[i];
|
||||||
|
|
||||||
@@ -895,14 +895,14 @@ void r300_emit_aos(struct r300_context* r300, int offset, boolean indexed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < aos_count; i++) {
|
for (i = 0; i < vertex_array_count; i++) {
|
||||||
buf = r300_buffer(vbuf[velem[i].vertex_buffer_index].buffer);
|
buf = r300_buffer(vbuf[velem[i].vertex_buffer_index].buffer);
|
||||||
OUT_CS_BUF_RELOC_NO_OFFSET(&buf->b.b, buf->domain, 0);
|
OUT_CS_BUF_RELOC_NO_OFFSET(&buf->b.b, buf->domain, 0);
|
||||||
}
|
}
|
||||||
END_CS;
|
END_CS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed)
|
void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, boolean indexed)
|
||||||
{
|
{
|
||||||
CS_LOCALS(r300);
|
CS_LOCALS(r300);
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ struct r300_vertex_program_code;
|
|||||||
|
|
||||||
uint32_t pack_float24(float f);
|
uint32_t pack_float24(float f);
|
||||||
|
|
||||||
void r300_emit_aos(struct r300_context* r300, int offset, boolean indexed);
|
void r300_emit_vertex_arrays(struct r300_context* r300, int offset, boolean indexed);
|
||||||
|
|
||||||
void r300_emit_blend_state(struct r300_context* r300,
|
void r300_emit_blend_state(struct r300_context* r300,
|
||||||
unsigned size, void* state);
|
unsigned size, void* state);
|
||||||
@@ -86,7 +86,7 @@ void r300_emit_scissor_state(struct r300_context* r300,
|
|||||||
void r300_emit_textures_state(struct r300_context *r300,
|
void r300_emit_textures_state(struct r300_context *r300,
|
||||||
unsigned size, void *state);
|
unsigned size, void *state);
|
||||||
|
|
||||||
void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed);
|
void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, boolean indexed);
|
||||||
|
|
||||||
void r300_emit_vap_invariant_state(struct r300_context *r300,
|
void r300_emit_vap_invariant_state(struct r300_context *r300,
|
||||||
unsigned size, void *state);
|
unsigned size, void *state);
|
||||||
|
@@ -130,7 +130,7 @@ void r500_emit_index_bias(struct r300_context *r300, int index_bias)
|
|||||||
|
|
||||||
/* This function splits the index bias value into two parts:
|
/* This function splits the index bias value into two parts:
|
||||||
* - buffer_offset: the value that can be safely added to buffer offsets
|
* - buffer_offset: the value that can be safely added to buffer offsets
|
||||||
* in r300_emit_aos (it must yield a positive offset when added to
|
* in r300_emit_vertex_arrays (it must yield a positive offset when added to
|
||||||
* a vertex buffer offset)
|
* a vertex buffer offset)
|
||||||
* - index_offset: the value that must be manually subtracted from indices
|
* - index_offset: the value that must be manually subtracted from indices
|
||||||
* in an index buffer to achieve negative offsets. */
|
* in an index buffer to achieve negative offsets. */
|
||||||
@@ -166,8 +166,8 @@ static void r300_split_index_bias(struct r300_context *r300, int index_bias,
|
|||||||
enum r300_prepare_flags {
|
enum r300_prepare_flags {
|
||||||
PREP_FIRST_DRAW = (1 << 0), /* call emit_dirty_state and friends? */
|
PREP_FIRST_DRAW = (1 << 0), /* call emit_dirty_state and friends? */
|
||||||
PREP_VALIDATE_VBOS = (1 << 1), /* validate VBOs? */
|
PREP_VALIDATE_VBOS = (1 << 1), /* validate VBOs? */
|
||||||
PREP_EMIT_AOS = (1 << 2), /* call emit_aos? */
|
PREP_EMIT_AOS = (1 << 2), /* call emit_vertex_arrays? */
|
||||||
PREP_EMIT_AOS_SWTCL = (1 << 3), /* call emit_aos_swtcl? */
|
PREP_EMIT_AOS_SWTCL = (1 << 3), /* call emit_vertex_arrays_swtcl? */
|
||||||
PREP_INDEXED = (1 << 4) /* is this draw_elements? */
|
PREP_INDEXED = (1 << 4) /* is this draw_elements? */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -185,8 +185,8 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
|
|||||||
{
|
{
|
||||||
boolean flushed = FALSE;
|
boolean flushed = FALSE;
|
||||||
boolean first_draw = flags & PREP_FIRST_DRAW;
|
boolean first_draw = flags & PREP_FIRST_DRAW;
|
||||||
boolean emit_aos = flags & PREP_EMIT_AOS;
|
boolean emit_vertex_arrays = flags & PREP_EMIT_AOS;
|
||||||
boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
|
boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_AOS_SWTCL;
|
||||||
|
|
||||||
/* Add dirty state, index offset, and AOS. */
|
/* Add dirty state, index offset, and AOS. */
|
||||||
if (first_draw) {
|
if (first_draw) {
|
||||||
@@ -195,11 +195,11 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
|
|||||||
if (r300->screen->caps.index_bias_supported)
|
if (r300->screen->caps.index_bias_supported)
|
||||||
cs_dwords += 2; /* emit_index_offset */
|
cs_dwords += 2; /* emit_index_offset */
|
||||||
|
|
||||||
if (emit_aos)
|
if (emit_vertex_arrays)
|
||||||
cs_dwords += 55; /* emit_aos */
|
cs_dwords += 55; /* emit_vertex_arrays */
|
||||||
|
|
||||||
if (emit_aos_swtcl)
|
if (emit_vertex_arrays_swtcl)
|
||||||
cs_dwords += 7; /* emit_aos_swtcl */
|
cs_dwords += 7; /* emit_vertex_arrays_swtcl */
|
||||||
}
|
}
|
||||||
|
|
||||||
cs_dwords += r300_get_num_cs_end_dwords(r300);
|
cs_dwords += r300_get_num_cs_end_dwords(r300);
|
||||||
@@ -218,19 +218,19 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
|
|||||||
* \param r300 The context.
|
* \param r300 The context.
|
||||||
* \param flags See r300_prepare_flags.
|
* \param flags See r300_prepare_flags.
|
||||||
* \param index_buffer The index buffer to validate. The parameter may be NULL.
|
* \param index_buffer The index buffer to validate. The parameter may be NULL.
|
||||||
* \param aos_offset The offset passed to emit_aos.
|
* \param buffer_offset The offset passed to emit_vertex_arrays.
|
||||||
* \param index_bias The index bias to emit.
|
* \param index_bias The index bias to emit.
|
||||||
* \return TRUE if rendering should be skipped
|
* \return TRUE if rendering should be skipped
|
||||||
*/
|
*/
|
||||||
static boolean r300_emit_states(struct r300_context *r300,
|
static boolean r300_emit_states(struct r300_context *r300,
|
||||||
enum r300_prepare_flags flags,
|
enum r300_prepare_flags flags,
|
||||||
struct pipe_resource *index_buffer,
|
struct pipe_resource *index_buffer,
|
||||||
int aos_offset,
|
int buffer_offset,
|
||||||
int index_bias)
|
int index_bias)
|
||||||
{
|
{
|
||||||
boolean first_draw = flags & PREP_FIRST_DRAW;
|
boolean first_draw = flags & PREP_FIRST_DRAW;
|
||||||
boolean emit_aos = flags & PREP_EMIT_AOS;
|
boolean emit_vertex_arrays = flags & PREP_EMIT_AOS;
|
||||||
boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
|
boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_AOS_SWTCL;
|
||||||
boolean indexed = flags & PREP_INDEXED;
|
boolean indexed = flags & PREP_INDEXED;
|
||||||
boolean validate_vbos = flags & PREP_VALIDATE_VBOS;
|
boolean validate_vbos = flags & PREP_VALIDATE_VBOS;
|
||||||
|
|
||||||
@@ -264,11 +264,11 @@ static boolean r300_emit_states(struct r300_context *r300,
|
|||||||
r500_emit_index_bias(r300, 0);
|
r500_emit_index_bias(r300, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emit_aos)
|
if (emit_vertex_arrays)
|
||||||
r300_emit_aos(r300, aos_offset, indexed);
|
r300_emit_vertex_arrays(r300, buffer_offset, indexed);
|
||||||
|
|
||||||
if (emit_aos_swtcl)
|
if (emit_vertex_arrays_swtcl)
|
||||||
r300_emit_aos_swtcl(r300, indexed);
|
r300_emit_vertex_arrays_swtcl(r300, indexed);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -281,7 +281,7 @@ static boolean r300_emit_states(struct r300_context *r300,
|
|||||||
* \param flags See r300_prepare_flags.
|
* \param flags See r300_prepare_flags.
|
||||||
* \param index_buffer The index buffer to validate. The parameter may be NULL.
|
* \param index_buffer The index buffer to validate. The parameter may be NULL.
|
||||||
* \param cs_dwords The number of dwords to reserve in CS.
|
* \param cs_dwords The number of dwords to reserve in CS.
|
||||||
* \param aos_offset The offset passed to emit_aos.
|
* \param buffer_offset The offset passed to emit_vertex_arrays.
|
||||||
* \param index_bias The index bias to emit.
|
* \param index_bias The index bias to emit.
|
||||||
* \return TRUE if rendering should be skipped
|
* \return TRUE if rendering should be skipped
|
||||||
*/
|
*/
|
||||||
@@ -289,13 +289,13 @@ static boolean r300_prepare_for_rendering(struct r300_context *r300,
|
|||||||
enum r300_prepare_flags flags,
|
enum r300_prepare_flags flags,
|
||||||
struct pipe_resource *index_buffer,
|
struct pipe_resource *index_buffer,
|
||||||
unsigned cs_dwords,
|
unsigned cs_dwords,
|
||||||
int aos_offset,
|
int buffer_offset,
|
||||||
int index_bias)
|
int index_bias)
|
||||||
{
|
{
|
||||||
if (r300_reserve_cs_dwords(r300, flags, cs_dwords))
|
if (r300_reserve_cs_dwords(r300, flags, cs_dwords))
|
||||||
flags |= PREP_FIRST_DRAW;
|
flags |= PREP_FIRST_DRAW;
|
||||||
|
|
||||||
return r300_emit_states(r300, flags, index_buffer, aos_offset, index_bias);
|
return r300_emit_states(r300, flags, index_buffer, buffer_offset, index_bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean immd_is_good_idea(struct r300_context *r300,
|
static boolean immd_is_good_idea(struct r300_context *r300,
|
||||||
|
@@ -90,7 +90,7 @@ void r300_upload_user_buffers(struct r300_context *r300)
|
|||||||
&vb->buffer_offset, &vb->buffer);
|
&vb->buffer_offset, &vb->buffer);
|
||||||
|
|
||||||
r300->validate_buffers = TRUE;
|
r300->validate_buffers = TRUE;
|
||||||
r300->aos_dirty = TRUE;
|
r300->vertex_arrays_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1527,7 +1527,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
|
|||||||
|
|
||||||
r300->any_user_vbs = any_user_buffer;
|
r300->any_user_vbs = any_user_buffer;
|
||||||
r300->vertex_buffer_max_index = max_index;
|
r300->vertex_buffer_max_index = max_index;
|
||||||
r300->aos_dirty = TRUE;
|
r300->vertex_arrays_dirty = TRUE;
|
||||||
r300->validate_buffers = TRUE;
|
r300->validate_buffers = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* SW TCL. */
|
/* SW TCL. */
|
||||||
@@ -1735,7 +1735,7 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
|
|||||||
|
|
||||||
UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
|
UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
|
||||||
r300->vertex_stream_state.size = (1 + velems->vertex_stream.count) * 2;
|
r300->vertex_stream_state.size = (1 + velems->vertex_stream.count) * 2;
|
||||||
r300->aos_dirty = TRUE;
|
r300->vertex_arrays_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
|
static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
|
||||||
|
Reference in New Issue
Block a user