summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2006-11-02 12:02:13 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2006-11-02 12:02:13 +0000
commit6d104cb932080c5c0d951fbc0ec6d30fb7ebef45 (patch)
tree17207f566d6eda4d3884ec03dfff6cdb5a1965ea /src/mesa/drivers/dri/r300
parent18d52f96bb1f20b1887b67e87506835bca05d73a (diff)
merge current trunk into vbo branch
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.c102
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.h3
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c5
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c1
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.c28
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.h10
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.c44
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.c62
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.h2
11 files changed, 168 insertions, 92 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index 2d947dea3a..91ec4f855c 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -82,7 +82,8 @@ static const struct {
{ "LG2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_LG2 },
{ "RCP", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RCP },
{ "RSQ", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RSQ },
- { "REPL_ALPHA", 1, R300_FPI0_OUTC_REPL_ALPHA, PFS_INVAL }
+ { "REPL_ALPHA", 1, R300_FPI0_OUTC_REPL_ALPHA, PFS_INVAL },
+ { "CMPH", 3, R300_FPI0_OUTC_CMPH, PFS_INVAL },
};
#define MAKE_SWZ3(x, y, z) (MAKE_SWIZZLE4(SWIZZLE_##x, \
@@ -180,7 +181,7 @@ static const pfs_reg_t undef = {
valid: GL_FALSE
};
-/* constant zero source */
+/* constant one source */
static const pfs_reg_t pfs_one = {
type: REG_TYPE_CONST,
index: 0,
@@ -189,7 +190,16 @@ static const pfs_reg_t pfs_one = {
valid: GL_TRUE
};
-/* constant one source */
+/* constant half source */
+static const pfs_reg_t pfs_half = {
+ type: REG_TYPE_CONST,
+ index: 0,
+ v_swz: SWIZZLE_HHH,
+ s_swz: SWIZZLE_HALF,
+ valid: GL_TRUE
+};
+
+/* constant zero source */
static const pfs_reg_t pfs_zero = {
type: REG_TYPE_CONST,
index: 0,
@@ -319,7 +329,6 @@ static pfs_reg_t emit_param4fv(struct r300_fragment_program *rp,
return r;
}
-#if 0
static pfs_reg_t emit_const4fv(struct r300_fragment_program *rp, GLfloat *cp)
{
pfs_reg_t r = undef;
@@ -330,13 +339,11 @@ static pfs_reg_t emit_const4fv(struct r300_fragment_program *rp, GLfloat *cp)
ERROR("Out of hw constants!\n");
return r;
}
-
- COPY_4V(rp->constant[r.index], cp);
+ COPY_4V(rp->constant[r.index], cp);
r.valid = GL_TRUE;
return r;
}
-#endif
static __inline pfs_reg_t negate(pfs_reg_t r)
{
@@ -773,13 +780,15 @@ static void emit_tex(struct r300_fragment_program *rp,
cs->dest_in_node = 0;
}
- if (rp->cur_node == 0) rp->first_node_has_tex = 1;
+ if (rp->cur_node == 0)
+ rp->first_node_has_tex = 1;
- rp->tex.inst[rp->tex.length++] = 0
- | (hwsrc << R300_FPITX_SRC_SHIFT)
- | (hwdest << R300_FPITX_DST_SHIFT)
- | (unit << R300_FPITX_IMAGE_SHIFT)
- | (opcode << R300_FPITX_OPCODE_SHIFT); /* not entirely sure about this */
+ rp->tex.inst[rp->tex.length++] = 0
+ | (hwsrc << R300_FPITX_SRC_SHIFT)
+ | (hwdest << R300_FPITX_DST_SHIFT)
+ | (unit << R300_FPITX_IMAGE_SHIFT)
+ /* not entirely sure about this */
+ | (opcode << R300_FPITX_OPCODE_SHIFT);
cs->dest_in_node |= (1 << hwdest);
if (coord.type != REG_TYPE_CONST)
@@ -884,7 +893,7 @@ static void emit_arith(struct r300_fragment_program *rp, int op,
vop = r300_fpop[op].v_op;
sop = r300_fpop[op].s_op;
- argc = r300_fpop[op].argc;
+ argc = r300_fpop[op].argc;
if ((mask & WRITEMASK_XYZ) || vop == R300_FPI0_OUTC_DP3)
emit_vop = GL_TRUE;
@@ -1039,7 +1048,9 @@ static GLboolean parse_program(struct r300_fragment_program *rp)
const struct prog_instruction *inst = mp->Base.Instructions;
struct prog_instruction *fpi;
pfs_reg_t src[3], dest, temp;
+ pfs_reg_t cnst;
int flags, mask = 0;
+ GLfloat cnstv[4] = {0.0, 0.0, 0.0, 0.0};
if (!inst || inst[0].Opcode == OPCODE_END) {
ERROR("empty program?\n");
@@ -1179,7 +1190,66 @@ static GLboolean parse_program(struct r300_fragment_program *rp)
flags);
break;
case OPCODE_LIT:
- ERROR("LIT not implemented\n");
+ /* LIT
+ * if (s.x < 0) t.x = 0; else t.x = s.x;
+ * if (s.y < 0) t.y = 0; else t.y = s.y;
+ * if (s.w > 128.0) t.w = 128.0; else t.w = s.w;
+ * if (s.w < -128.0) t.w = -128.0; else t.w = s.w;
+ * r.x = 1.0
+ * if (t.x > 0) r.y = pow(t.y, t.w); else r.y = 0;
+ * Also r.y = 0 if t.y < 0
+ * For the t.x > 0 FGLRX use the CMPH opcode which
+ * change the compare to (t.x + 0.5) > 0.5 we may
+ * save one instruction by doing CMP -t.x
+ */
+ cnstv[0] = cnstv[1] = cnstv[2] = cnstv[4] = 0.50001;
+ src[0] = t_src(rp, fpi->SrcReg[0]);
+ temp = get_temp_reg(rp);
+ cnst = emit_const4fv(rp, cnstv);
+ emit_arith(rp, PFS_OP_CMP, temp,
+ WRITEMASK_X | WRITEMASK_Y,
+ src[0], pfs_zero, src[0], flags);
+ emit_arith(rp, PFS_OP_MIN, temp, WRITEMASK_Z,
+ swizzle(keep(src[0]), W, W, W, W),
+ cnst, undef, flags);
+ emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W,
+ swizzle(temp, Y, Y, Y, Y),
+ undef, undef, flags);
+ emit_arith(rp, PFS_OP_MAX, temp, WRITEMASK_Z,
+ temp, negate(cnst), undef, flags);
+ emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W,
+ temp, swizzle(temp, Z, Z, Z, Z),
+ pfs_zero, flags);
+ emit_arith(rp, PFS_OP_EX2, temp, WRITEMASK_W,
+ temp, undef, undef, flags);
+ emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_Y,
+ swizzle(keep(temp), X, X, X, X),
+ pfs_one, pfs_zero, flags);
+#if 0
+ emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X,
+ temp, pfs_one, pfs_half, flags);
+ emit_arith(rp, PFS_OP_CMPH, temp, WRITEMASK_Z,
+ swizzle(keep(temp), W, W, W, W),
+ pfs_zero, swizzle(keep(temp), X, X, X, X),
+ flags);
+#else
+ emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_Z,
+ pfs_zero,
+ swizzle(keep(temp), W, W, W, W),
+ negate(swizzle(keep(temp), X, X, X, X)),
+ flags);
+#endif
+ emit_arith(rp, PFS_OP_CMP, dest, WRITEMASK_Z,
+ pfs_zero, temp,
+ negate(swizzle(keep(temp), Y, Y, Y, Y)),
+ flags);
+ emit_arith(rp, PFS_OP_MAD, dest,
+ WRITEMASK_X | WRITEMASK_W,
+ pfs_one,
+ pfs_one,
+ pfs_zero,
+ flags);
+ free_temp(rp, temp);
break;
case OPCODE_LRP:
src[0] = t_src(rp, fpi->SrcReg[0]);
@@ -1345,7 +1415,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)
return GL_FALSE;
}
-
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h
index e7dbaf973e..4bbaa07e01 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.h
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.h
@@ -78,7 +78,8 @@ typedef struct r300_fragment_program_swizzle {
#define PFS_OP_RCP 9
#define PFS_OP_RSQ 10
#define PFS_OP_REPL_ALPHA 11
-#define MAX_PFS_OP 11
+#define PFS_OP_CMPH 12
+#define MAX_PFS_OP 12
#define PFS_FLAG_SAT (1 << 0)
#define PFS_FLAG_ABS (1 << 1)
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index 7775ca96e4..87276a11ae 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -477,8 +477,7 @@ static void r300EmitClearState(GLcontext * ctx)
/**
* Buffer clear
*/
-static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean allFoo,
- GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
+static void r300Clear(GLcontext * ctx, GLbitfield mask)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
@@ -520,7 +519,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean allFoo,
if (RADEON_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "%s: swrast clear, mask: %x\n",
__FUNCTION__, mask);
- _swrast_Clear(ctx, mask, 0, 0, 0, 0, 0);
+ _swrast_Clear(ctx, mask);
}
swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index f3d8fa60f5..9f636ec1d2 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -1001,6 +1001,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* - DP4: Use OUTC_DP4, OUTA_DP4
* - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands
* - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands
+ * - CMPH: If ARG2 > 0.5, return ARG0, else return ARG1
* - CMP: If ARG2 < 0, return ARG1, else return ARG0
* - FLR: use FRC+MAD
* - XPD: use MAD+MAD
@@ -1138,6 +1139,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_FPI0_OUTC_DP4 (2 << 23)
# define R300_FPI0_OUTC_MIN (4 << 23)
# define R300_FPI0_OUTC_MAX (5 << 23)
+# define R300_FPI0_OUTC_CMPH (7 << 23)
# define R300_FPI0_OUTC_CMP (8 << 23)
# define R300_FPI0_OUTC_FRC (9 << 23)
# define R300_FPI0_OUTC_REPL_ALPHA (10 << 23)
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 5a98226300..6aff04fd27 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -460,7 +460,6 @@ static void update_depth(GLcontext* ctx)
static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- uint32_t newval;
if (RADEON_DEBUG & DEBUG_STATE)
fprintf(stderr, "%s( %s = %s )\n", __FUNCTION__,
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 1d78918a2b..cc356afb23 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -171,7 +171,6 @@ static void r300SetTexImages(r300ContextPtr rmesa,
GLint i, texelBytes;
GLint numLevels;
GLint log2Width, log2Height, log2Depth;
- const GLuint ui = 1;
/* Set the hardware texture format
*/
diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c
index 09321126d6..62a6e1e5f7 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.c
+++ b/src/mesa/drivers/dri/r300/radeon_context.c
@@ -98,27 +98,11 @@ static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name)
}
}
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize(GLframebuffer * buffer,
- GLuint * width, GLuint * height)
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE(radeon);
- *width = radeon->dri.drawable->w;
- *height = radeon->dri.drawable->h;
- UNLOCK_HARDWARE(radeon);
-}
-
-
/* Initialize the driver's misc functions.
*/
static void radeonInitDriverFuncs(struct dd_function_table *functions)
{
- functions->GetBufferSize = radeonGetBufferSize;
+ functions->GetBufferSize = NULL;
functions->GetString = radeonGetString;
}
@@ -158,7 +142,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
/* DRI fields */
radeon->dri.context = driContextPriv;
radeon->dri.screen = sPriv;
- radeon->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
+ radeon->dri.drawable = NULL;
+ radeon->dri.readable = NULL;
radeon->dri.hwContext = driContextPriv->hHWContext;
radeon->dri.hwLock = &sPriv->pSAREA->lock;
radeon->dri.fd = sPriv->fd;
@@ -282,12 +267,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
radeon->glCtx);
- if (radeon->dri.drawable != driDrawPriv) {
+ if ( (radeon->dri.drawable != driDrawPriv)
+ || (radeon->dri.readable != driReadPriv) ) {
+
driDrawableInitVBlank(driDrawPriv,
radeon->vblank_flags,
&radeon->vbl_seq);
radeon->dri.drawable = driDrawPriv;
-
+ radeon->dri.readable = driReadPriv;
+
r300UpdateWindow(radeon->glCtx);
r300UpdateViewportOffset(radeon->glCtx);
}
diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h
index 0ec6466e44..07a0c7cbd6 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.h
+++ b/src/mesa/drivers/dri/r300/radeon_context.h
@@ -120,7 +120,15 @@ extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
struct radeon_dri_mirror {
__DRIcontextPrivate *context; /* DRI context */
__DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
+ /**
+ * DRI drawable bound to this context for drawing.
+ */
+ __DRIdrawablePrivate *drawable;
+
+ /**
+ * DRI drawable bound to this context for reading.
+ */
+ __DRIdrawablePrivate *readable;
drm_context_t hwContext;
drm_hw_lock_t *hwLock;
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c
index 0e1e6512db..a00da6c8bc 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.c
+++ b/src/mesa/drivers/dri/r300/radeon_lock.c
@@ -75,34 +75,30 @@ static void radeonUpdatePageFlipping(radeonContextPtr radeon)
* Called by radeonGetLock() after the lock has been obtained.
*/
static void r300RegainedLock(radeonContextPtr radeon)
-{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
+{
int i;
+ __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
r300ContextPtr r300 = (r300ContextPtr)radeon;
+ drm_radeon_sarea_t *sarea = radeon->sarea;
- if (radeon->lastStamp != dPriv->lastStamp) {
- _mesa_resize_framebuffer(radeon->glCtx,
- (GLframebuffer*)dPriv->driverPrivate,
- dPriv->w, dPriv->h);
-
+ if ( radeon->lastStamp != drawable->lastStamp ) {
radeonUpdatePageFlipping(radeon);
-
- if (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- radeonSetCliprects(radeon, GL_BACK_LEFT);
- else
- radeonSetCliprects(radeon, GL_FRONT_LEFT);
-
+ radeonSetCliprects(radeon);
#if 1
r300UpdateViewportOffset( radeon->glCtx );
- driUpdateFramebufferSize(radeon->glCtx, dPriv);
+ driUpdateFramebufferSize(radeon->glCtx, drawable);
#else
radeonUpdateScissor(radeon->glCtx);
#endif
- radeon->lastStamp = dPriv->lastStamp;
+ radeon->lastStamp = drawable->lastStamp;
}
- for (i = 0; i < r300->nr_heaps; i++) {
- DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+ if (sarea->ctx_owner != radeon->dri.hwContext) {
+ sarea->ctx_owner = radeon->dri.hwContext;
+
+ for (i = 0; i < r300->nr_heaps; i++) {
+ DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+ }
}
}
@@ -116,11 +112,11 @@ static void r300RegainedLock(radeonContextPtr radeon)
*/
void radeonGetLock(radeonContextPtr radeon, GLuint flags)
{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
+ __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
+ __DRIdrawablePrivate *const readable = radeon->dri.readable;
__DRIscreenPrivate *sPriv = radeon->dri.screen;
- drm_radeon_sarea_t *sarea = radeon->sarea;
- assert (dPriv != NULL);
+ assert (drawable != NULL);
drmGetLock(radeon->dri.fd, radeon->dri.hwContext, flags);
@@ -132,10 +128,10 @@ void radeonGetLock(radeonContextPtr radeon, GLuint flags)
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
- if (sarea->ctx_owner != radeon->dri.hwContext)
- sarea->ctx_owner = radeon->dri.hwContext;
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, drawable );
+ if (drawable != readable) {
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, readable );
+ }
if (IS_R300_CLASS(radeon->radeonScreen))
r300RegainedLock(radeon);
diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c
index 7726c22f42..1b1ec3df3c 100644
--- a/src/mesa/drivers/dri/r300/radeon_state.c
+++ b/src/mesa/drivers/dri/r300/radeon_state.c
@@ -49,7 +49,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_ioctl.h"
#include "radeon_state.h"
#include "r300_ioctl.h"
-
+#include "framebuffer.h"
/* =============================================================
* Scissoring
@@ -137,7 +137,6 @@ static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h
if (ctx->Scissor.Enabled) {
/* We don't pipeline cliprect changes */
r300Flush(ctx);
-
radeonUpdateScissor(ctx);
}
}
@@ -146,31 +145,46 @@ static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h
/**
* Update cliprects and scissors.
*/
-void radeonSetCliprects(radeonContextPtr radeon, GLenum mode)
+void radeonSetCliprects(radeonContextPtr radeon)
{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
-
- switch (mode) {
- case GL_FRONT_LEFT:
- radeon->numClipRects = dPriv->numClipRects;
- radeon->pClipRects = dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if (dPriv->numBackClipRects == 0 || radeon->doPageFlip) {
- radeon->numClipRects = dPriv->numClipRects;
- radeon->pClipRects = dPriv->pClipRects;
+ __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
+ __DRIdrawablePrivate *const readable = radeon->dri.readable;
+ GLframebuffer *const draw_fb = (GLframebuffer*)drawable->driverPrivate;
+ GLframebuffer *const read_fb = (GLframebuffer*)readable->driverPrivate;
+
+ if (draw_fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
+ /* Can't ignore 2d windows if we are page flipping. */
+ if (drawable->numBackClipRects == 0 || radeon->doPageFlip) {
+ radeon->numClipRects = drawable->numClipRects;
+ radeon->pClipRects = drawable->pClipRects;
} else {
- radeon->numClipRects = dPriv->numBackClipRects;
- radeon->pClipRects = dPriv->pBackClipRects;
+ radeon->numClipRects = drawable->numBackClipRects;
+ radeon->pClipRects = drawable->pBackClipRects;
+ }
+ } else {
+ /* front buffer (or none, or multiple buffers */
+ radeon->numClipRects = drawable->numClipRects;
+ radeon->pClipRects = drawable->pClipRects;
+ }
+
+ if ((draw_fb->Width != drawable->w) ||
+ (draw_fb->Height != drawable->h)) {
+ printf("w,h %d %d\n",
+ radeon->glCtx->DrawBuffer->Width,
+ radeon->glCtx->DrawBuffer->Height);
+
+ _mesa_resize_framebuffer(radeon->glCtx, draw_fb,
+ drawable->w, drawable->h);
+ draw_fb->Initialized = GL_TRUE;
+ }
+
+ if (drawable != readable) {
+ if ((read_fb->Width != readable->w) ||
+ (read_fb->Height != readable->h)) {
+ _mesa_resize_framebuffer(radeon->glCtx, read_fb,
+ readable->w, readable->h);
+ read_fb->Initialized = GL_TRUE;
}
- break;
- default:
- fprintf(stderr, "bad mode in radeonSetCliprects\n");
- radeon->numClipRects = 0;
- radeon->pClipRects = 0;
- return;
}
if (radeon->state.scissor.enabled)
diff --git a/src/mesa/drivers/dri/r300/radeon_state.h b/src/mesa/drivers/dri/r300/radeon_state.h
index 636bf5d008..c2d041eb4a 100644
--- a/src/mesa/drivers/dri/r300/radeon_state.h
+++ b/src/mesa/drivers/dri/r300/radeon_state.h
@@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_context.h"
extern void radeonRecalcScissorRects(radeonContextPtr radeon);
-extern void radeonSetCliprects(radeonContextPtr radeon, GLenum mode);
+extern void radeonSetCliprects(radeonContextPtr radeon);
extern void radeonUpdateScissor(GLcontext* ctx);
extern void radeonEnable(GLcontext* ctx, GLenum cap, GLboolean state);