r300: when using cs path emit scissor in the cmdbuffer

This commit is contained in:
Jerome Glisse 2009-05-28 13:48:38 +02:00
parent 2f9189d538
commit 5dcbcbfca4
4 changed files with 43 additions and 0 deletions

View file

@ -209,6 +209,45 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom)
}
}
void r300_emit_scissor(GLcontext *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
BATCH_LOCALS(&r300->radeon);
unsigned x1, y1, x2, y2;
struct radeon_renderbuffer *rrb;
if (!r300->radeon.radeonScreen->driScreen->dri2.enabled) {
return;
}
rrb = radeon_get_colorbuffer(&r300->radeon);
if (!rrb || !rrb->bo) {
fprintf(stderr, "no rrb\n");
return;
}
if (r300->radeon.state.scissor.enabled) {
x1 = r300->radeon.state.scissor.rect.x1;
y1 = r300->radeon.state.scissor.rect.y1;
x2 = r300->radeon.state.scissor.rect.x2 - 1;
y2 = r300->radeon.state.scissor.rect.y2 - 1;
} else {
x1 = 0;
y1 = 0;
x2 = rrb->width - 1;
y2 = rrb->height - 1;
}
if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) {
x1 += R300_SCISSORS_OFFSET;
y1 += R300_SCISSORS_OFFSET;
x2 += R300_SCISSORS_OFFSET;
y2 += R300_SCISSORS_OFFSET;
}
BEGIN_BATCH_NO_AUTOSTATE(3);
OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2);
OUT_BATCH((x1 << R300_SCISSORS_X_SHIFT)|(y1 << R300_SCISSORS_Y_SHIFT));
OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT));
END_BATCH();
}
static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);

View file

@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_context.h"
extern void r300InitCmdBuf(r300ContextPtr r300);
void r300_emit_scissor(GLcontext *ctx);
void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom);
int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom);

View file

@ -189,6 +189,7 @@ static void r300FireEB(r300ContextPtr rmesa, int vertex_count, int type)
{
BATCH_LOCALS(&rmesa->radeon);
r300_emit_scissor(rmesa->radeon.glCtx);
if (vertex_count > 0) {
BEGIN_BATCH(10);
OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_INDX_2, 0);
@ -329,6 +330,7 @@ static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type)
{
BATCH_LOCALS(&rmesa->radeon);
r300_emit_scissor(rmesa->radeon.glCtx);
BEGIN_BATCH(3);
OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count << 16) | type);

View file

@ -683,6 +683,7 @@ void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
rmesa->radeon.hw.max_state_size + (12*sizeof(int)),
__FUNCTION__);
radeonEmitState(&rmesa->radeon);
r300_emit_scissor(ctx);
r300EmitVertexAOS(rmesa,
rmesa->radeon.swtcl.vertex_size,
rmesa->radeon.dma.current,