~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/r300/radeon_state.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#include "tnl/t_pipeline.h"
47
47
#include "swrast_setup/swrast_setup.h"
48
48
 
49
 
#include "r200_context.h"
50
49
#include "radeon_ioctl.h"
51
50
#include "radeon_state.h"
52
 
#include "r200_state.h"
53
51
#include "r300_ioctl.h"
54
 
 
 
52
#include "framebuffer.h"
55
53
 
56
54
/* =============================================================
57
55
 * Scissoring
136
134
 
137
135
static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
138
136
{
139
 
        radeonContextPtr radeon = RADEON_CONTEXT(ctx);
140
 
 
141
137
        if (ctx->Scissor.Enabled) {
142
138
                /* We don't pipeline cliprect changes */
143
 
                if (IS_R200_CLASS(radeon->radeonScreen))
144
 
                        R200_FIREVERTICES((r200ContextPtr)radeon);
145
 
                else
146
 
                        r300Flush(ctx);
147
 
 
 
139
                r300Flush(ctx);
148
140
                radeonUpdateScissor(ctx);
149
141
        }
150
142
}
153
145
/**
154
146
 * Update cliprects and scissors.
155
147
 */
156
 
void radeonSetCliprects(radeonContextPtr radeon, GLenum mode)
 
148
void radeonSetCliprects(radeonContextPtr radeon)
157
149
{
158
 
        __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
 
150
        __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
 
151
        __DRIdrawablePrivate *const readable = radeon->dri.readable;
 
152
        GLframebuffer *const draw_fb = (GLframebuffer*)drawable->driverPrivate;
 
153
        GLframebuffer *const read_fb = (GLframebuffer*)readable->driverPrivate;
159
154
 
160
 
        switch (mode) {
161
 
        case GL_FRONT_LEFT:
162
 
                radeon->numClipRects = dPriv->numClipRects;
163
 
                radeon->pClipRects = dPriv->pClipRects;
164
 
                break;
165
 
        case GL_BACK_LEFT:
166
 
                /* Can't ignore 2d windows if we are page flipping.
167
 
                 */
168
 
                if (dPriv->numBackClipRects == 0 || radeon->doPageFlip) {
169
 
                        radeon->numClipRects = dPriv->numClipRects;
170
 
                        radeon->pClipRects = dPriv->pClipRects;
 
155
        if (draw_fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
 
156
                /* Can't ignore 2d windows if we are page flipping. */
 
157
                if (drawable->numBackClipRects == 0 || radeon->doPageFlip) {
 
158
                        radeon->numClipRects = drawable->numClipRects;
 
159
                        radeon->pClipRects = drawable->pClipRects;
171
160
                } else {
172
 
                        radeon->numClipRects = dPriv->numBackClipRects;
173
 
                        radeon->pClipRects = dPriv->pBackClipRects;
174
 
                }
175
 
                break;
176
 
        default:
177
 
                fprintf(stderr, "bad mode in radeonSetCliprects\n");
178
 
                radeon->numClipRects = 0;
179
 
                radeon->pClipRects = 0;
180
 
                return;
 
161
                        radeon->numClipRects = drawable->numBackClipRects;
 
162
                        radeon->pClipRects = drawable->pBackClipRects;
 
163
                }
 
164
        } else {
 
165
                /* front buffer (or none, or multiple buffers */
 
166
                radeon->numClipRects = drawable->numClipRects;
 
167
                radeon->pClipRects = drawable->pClipRects;
 
168
        }
 
169
 
 
170
        if ((draw_fb->Width != drawable->w) ||
 
171
            (draw_fb->Height != drawable->h)) {
 
172
                _mesa_resize_framebuffer(radeon->glCtx, draw_fb,
 
173
                                         drawable->w, drawable->h);
 
174
                draw_fb->Initialized = GL_TRUE;
 
175
        }
 
176
 
 
177
        if (drawable != readable) {
 
178
                if ((read_fb->Width != readable->w) ||
 
179
                    (read_fb->Height != readable->h)) {
 
180
                        _mesa_resize_framebuffer(radeon->glCtx, read_fb,
 
181
                                                 readable->w, readable->h);
 
182
                        read_fb->Initialized = GL_TRUE;
 
183
                }
181
184
        }
182
185
 
183
186
        if (radeon->state.scissor.enabled)
196
199
        switch(cap) {
197
200
        case GL_SCISSOR_TEST:
198
201
                /* We don't pipeline cliprect & scissor changes */
199
 
                if (IS_R200_CLASS(radeon->radeonScreen))
200
 
                        R200_FIREVERTICES((r200ContextPtr)radeon);
201
 
                else
202
 
                        r300Flush(ctx);
 
202
                r300Flush(ctx);
203
203
 
204
204
                radeon->state.scissor.enabled = state;
205
205
                radeonUpdateScissor(ctx);