Compare commits

...

9 Commits

Author SHA1 Message Date
Keith Whitwell
bcc4804410 When clearing, refresh the cx/y/w/h values as they may have been
invalidated by a new window position or size picked up when we did
LOCK_HARDWARE above.  The values passed by mesa are not reliable.
2006-06-06 11:35:17 +00:00
Keith Whitwell
a03b239041 Add fgl_glxgears to makefile 2006-06-06 11:31:02 +00:00
Brian Paul
4890c7ed87 set per-context GL_DRAW_BUFFER state regardless of currently bound FBO 2006-06-02 12:53:08 +00:00
Brian Paul
17c33d6f04 fix depth-component test to allow rectangular textures 2006-06-02 12:44:36 +00:00
Keith Whitwell
5ab599600e Additional flushing. 2006-05-23 09:36:53 +00:00
Keith Whitwell
db4b6fd759 Copying overlapping rects works if they are in different buffers... 2006-05-23 09:36:16 +00:00
Keith Whitwell
dbb2f30ad3 Fix culling calculations for FBOs 2006-05-23 09:34:09 +00:00
Brian Paul
9c84dfe156 glPopAttrib() GL_DRAW_BUFFER state fix, from trunk 2006-04-18 16:28:16 +00:00
Brian Paul
8d86325516 remove a debug message 2006-04-05 13:29:35 +00:00
9 changed files with 99 additions and 24 deletions

View File

@@ -11,6 +11,7 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME)
PROGS = glthreads \
glxdemo \
glxgears \
fgl_glxgears \
glxgears_fbconfig \
glxcontexts \
glxheads \

View File

@@ -395,7 +395,8 @@ static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
GLuint mode;
if (INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
fprintf(stderr, "%s %d\n", __FUNCTION__,
ctx->DrawBuffer ? ctx->DrawBuffer->Name : 0);
if (!ctx->Polygon.CullFlag) {
mode = S4_CULLMODE_NONE;
@@ -403,6 +404,8 @@ static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
mode = S4_CULLMODE_CW;
if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
if (ctx->Polygon.CullFaceMode == GL_FRONT)
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
if (ctx->Polygon.FrontFace != GL_CCW)

View File

@@ -323,6 +323,18 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_clip_rect_t clear;
int i;
/* Refresh the cx/y/w/h values as they may have been invalidated
* by a new window position or size picked up when we did
* LOCK_HARDWARE above. The values passed by mesa are not
* reliable.
*/
{
cx = ctx->DrawBuffer->_Xmin;
cy = ctx->DrawBuffer->_Ymin;
ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
}
if (intel->ctx.DrawBuffer->Name == 0) {
/* clearing a window */

View File

@@ -282,7 +282,20 @@ static void intelClearWithTris(struct intel_context *intel,
intel->vtbl.install_meta_state(intel);
/* note: regardless of 'all', cx, cy, cw, ch are correct */
/* Refresh the cx/y/w/h values as they may have been invalidated
* by a new window position or size picked up when we did
* LOCK_HARDWARE above. The values passed by mesa are not
* reliable.
*/
{
cx = ctx->DrawBuffer->_Xmin;
cy = ctx->DrawBuffer->_Ymin;
ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
}
/* note: regardless of 'all', cx, cy, cw, ch are now correct */
clear.x1 = cx;
clear.y1 = cy;
clear.x2 = cx + cw;
@@ -558,7 +571,7 @@ intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
/* this may occur when we're called by glBindFrameBuffer() during
* the process of someone setting up renderbuffers, etc.
*/
_mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");
/*_mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");*/
return;
}
@@ -615,6 +628,14 @@ intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
colorRegion = (irb && irb->region) ? irb->region : NULL;
}
/* Update culling direction which changes depending on the
* orientation of the buffer:
*/
if (ctx->Driver.FrontFace)
ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
else
ctx->NewState |= _NEW_POLYGON;
if (!colorRegion) {
FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
}

View File

@@ -99,23 +99,24 @@ static GLboolean do_texture_copypixels( GLcontext *ctx,
*
* XXX: do a copy to a temporary.
*/
if (src->buffer == dst->buffer)
{
drm_clip_rect_t src;
drm_clip_rect_t dst;
drm_clip_rect_t srcbox;
drm_clip_rect_t dstbox;
drm_clip_rect_t tmp;
src.x1 = srcx;
src.y1 = srcy;
src.x2 = srcx + width;
src.y2 = srcy + height;
srcbox.x1 = srcx;
srcbox.y1 = srcy;
srcbox.x2 = srcx + width;
srcbox.y2 = srcy + height;
dst.x1 = dstx;
dst.y1 = dsty;
dst.x1 = dstx + width * ctx->Pixel.ZoomX;
dst.y2 = dsty + height * ctx->Pixel.ZoomY;
dstbox.x1 = dstx;
dstbox.y1 = dsty;
dstbox.x1 = dstx + width * ctx->Pixel.ZoomX;
dstbox.y2 = dsty + height * ctx->Pixel.ZoomY;
if (intel_intersect_cliprects(&tmp, &src, &dst)) {
if (intel_intersect_cliprects(&tmp, &srcbox, &dstbox)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: regions overlap\n", __FUNCTION__);
return GL_FALSE;

View File

@@ -848,8 +848,19 @@ _mesa_PopAttrib(void)
(GLboolean) (color->ColorMask[1] != 0),
(GLboolean) (color->ColorMask[2] != 0),
(GLboolean) (color->ColorMask[3] != 0));
_mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers,
color->DrawBuffer, NULL);
/* Call the API_level functions, not _mesa_drawbuffers() since
* we need to do error checking on the pop'd GL_DRAW_BUFFER.
* Ex: if GL_FRONT were pushed, but we're popping with a user
* FBO bound, GL_FRONT will be illegal and we'll need to
* record that error. Per OpenGL ARB decision.
*/
if (ctx->Extensions.ARB_draw_buffers) {
_mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers,
color->DrawBuffer);
}
else {
_mesa_DrawBuffer(color->DrawBuffer[0]);
}
_mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
_mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef);
_mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled);

View File

@@ -459,16 +459,14 @@ set_color_output(GLcontext *ctx, GLuint output, GLenum buffer,
ASSERT(output < ctx->Const.MaxDrawBuffers);
/* Set per-FBO state */
fb->ColorDrawBuffer[output] = buffer;
fb->_ColorDrawBufferMask[output] = destMask;
if (fb->Name == 0) {
/* Set traditional state var */
ctx->Color.DrawBuffer[output] = buffer;
}
/* not really needed, will be set later */
fb->_NumColorDrawBuffers[output] = 0;
/* Set traditional state var */
ctx->Color.DrawBuffer[output] = buffer;
}

View File

@@ -587,6 +587,11 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
if (renderbuffer) {
newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
@@ -995,6 +1000,11 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
if (framebuffer) {
/* Binding a user-created framebuffer object */
newFb = _mesa_lookup_framebuffer(ctx, framebuffer);
@@ -1079,6 +1089,10 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
for (i = 0; i < n; i++) {
if (framebuffers[i] > 0) {
@@ -1299,6 +1313,10 @@ framebuffer_texture(GLuint dims, GLenum target, GLenum attachment,
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
_glthread_LOCK_MUTEX(fb->Mutex);
if (texObj) {
@@ -1417,6 +1435,10 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
assert(ctx->Driver.FramebufferRenderbuffer);
ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
@@ -1480,6 +1502,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:

View File

@@ -1448,11 +1448,13 @@ texture_error_check( GLcontext *ctx, GLenum target,
/* additional checks for depth textures */
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
/* Only 1D and 2D textures supported */
/* Only 1D, 2D and rectangular textures supported, not 3D or cubes */
if (target != GL_TEXTURE_1D &&
target != GL_PROXY_TEXTURE_1D &&
target != GL_TEXTURE_2D &&
target != GL_PROXY_TEXTURE_2D) {
target != GL_PROXY_TEXTURE_2D &&
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
if (!isProxy)
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage(target/internalFormat)");