Created new intel_buffers.h file with appropriate prototypes.

Moved body of intelDrawBuffer() into new intel_draw_buffer() which will do
additional things in future.
This commit is contained in:
Brian Paul 2006-03-20 23:53:29 +00:00
parent a7252f42ae
commit 315396ac6c
10 changed files with 92 additions and 42 deletions

View file

@ -35,6 +35,7 @@
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_context.h"
#include "intel_fbo.h"
#include "intel_reg.h"

View file

@ -28,6 +28,7 @@
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_fbo.h"
#include "intel_tris.h"
#include "intel_regions.h"
@ -501,19 +502,19 @@ void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
/**
* Called via glDrawBuffer, glBindFramebufferEXT, MakeCurrent, and from
* various places within the driver.
* Note: mode parameter is not used.
* Update the hardware state for drawing into a window or framebuffer object.
* Called by glDrawBuffer, glBindFramebufferEXT, MakeCurrent, and other
* places within the driver.
*/
static void
intelDrawBuffer(GLcontext *ctx, GLenum mode)
void
intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
struct intel_context *intel = intel_context(ctx);
struct intel_renderbuffer *irb;
struct intel_region *colorRegion, *depthRegion;
int front = 0; /* drawing to front color buffer? */
if (!ctx->DrawBuffer) {
if (!fb) {
/* this can happen during the initial context initialization */
return;
}
@ -528,7 +529,7 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
_mesa_update_draw_buffer_bounds(ctx);
}
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
/* this may occur when we're called by glBindFrameBuffer() during
* the process of someone setting up renderbuffers, etc.
*/
@ -539,10 +540,10 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
/*
* How many color buffers are we drawing into?
*/
if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1
if (fb->_NumColorDrawBuffers[0] != 1
#if 0
/* XXX FBO temporary - always use software rendering */
|| ctx->DrawBuffer->Name != 0
|| fb->Name != 0
#endif
) {
/* writing to 0 or 2 or 4 color buffers */
@ -554,7 +555,7 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
/* draw to exactly one color buffer */
/*_mesa_debug(ctx, "Hardware rendering\n");*/
FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
if (ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
front = 1;
}
}
@ -563,7 +564,7 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
* Get the intel_renderbuffer we're drawing into.
* And set up cliprects.
*/
if (ctx->DrawBuffer->Name == 0) {
if (fb->Name == 0) {
/* drawing to window system buffer */
if (intel->sarea->pf_current_page == 1 ) {
/* page flipped back/front */
@ -571,19 +572,17 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
}
if (front) {
intelSetFrontClipRects( intel );
irb = intel_renderbuffer(ctx->DrawBuffer->
Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
irb = intel_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
}
else {
intelSetBackClipRects( intel );
irb = intel_renderbuffer(ctx->DrawBuffer->
Attachment[BUFFER_BACK_LEFT].Renderbuffer);
irb = intel_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
}
}
else {
/* drawing to user-created FBO */
intelSetRenderbufferClipRects(intel);
irb = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]);
irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
ASSERT(irb);
}
@ -606,7 +605,7 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
/*
* Get depth buffer region
*/
irb = intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer);
irb = intel_renderbuffer(fb->_DepthBuffer);
if (irb && irb->region)
depthRegion = irb->region;
else
@ -624,7 +623,15 @@ intelDrawBuffer(GLcontext *ctx, GLenum mode)
}
static void intelReadBuffer( GLcontext *ctx, GLenum mode )
static void
intelDrawBuffer(GLcontext *ctx, GLenum mode)
{
intel_draw_buffer(ctx, ctx->DrawBuffer);
}
static void
intelReadBuffer( GLcontext *ctx, GLenum mode )
{
/* Nothing.
* The functions which do framebuffer reads (glReadPixels, glCopyPixels,
@ -633,7 +640,6 @@ static void intelReadBuffer( GLcontext *ctx, GLenum mode )
}
void intelInitBufferFuncs( struct dd_function_table *functions )
{
functions->Clear = intelClear;

View file

@ -0,0 +1,58 @@
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef INTEL_BUFFERS_H
#define INTEL_BUFFERS_H
struct intel_context;
extern GLboolean
intel_intersect_cliprects(drm_clip_rect_t *dest,
const drm_clip_rect_t *a,
const drm_clip_rect_t *b);
extern struct intel_region *
intel_readbuf_region(struct intel_context *intel);
extern struct intel_region *
intel_drawbuf_region(struct intel_context *intel);
extern void
intelSwapBuffers( __DRIdrawablePrivate *dPriv);
extern void
intelWindowMoved(struct intel_context *intel);
extern void
intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
extern void
intelInitBufferFuncs(struct dd_function_table *functions);;
#endif /* INTEL_BUFFERS_H */

View file

@ -49,6 +49,7 @@
#include "i830_dri.h"
#include "i830_common.h"
#include "intel_buffers.h"
#include "intel_tex.h"
#include "intel_span.h"
#include "intel_tris.h"
@ -448,7 +449,6 @@ GLboolean intelInitContext( struct intel_context *intel,
debug_control );
#endif
if (getenv("INTEL_NO_RAST")) {
fprintf(stderr, "disabling 3D rasterization\n");
FALLBACK(intel, INTEL_FALLBACK_USER, 1);

View file

@ -214,9 +214,9 @@ struct intel_context
GLubyte *verts; /* points to tnl->clipspace.vertex_buf */
struct intel_region *front_region;
struct intel_region *back_region;
struct intel_region *draw_region;
struct intel_region *front_region; /* XXX FBO: obsolete */
struct intel_region *back_region; /* XXX FBO: obsolete */
struct intel_region *draw_region; /* XXX FBO: rename to color_region */
struct intel_region *depth_region;
@ -520,22 +520,6 @@ extern int intel_translate_blend_factor( GLenum factor );
extern int intel_translate_logic_op( GLenum opcode );
/* ================================================================
* intel_buffers.c:
*/
void intelInitBufferFuncs( struct dd_function_table *functions );
struct intel_region *intel_readbuf_region( struct intel_context *intel );
struct intel_region *intel_drawbuf_region( struct intel_context *intel );
extern void intelWindowMoved( struct intel_context *intel );
extern GLboolean intel_intersect_cliprects( drm_clip_rect_t *dest,
const drm_clip_rect_t *a,
const drm_clip_rect_t *b );
/*======================================================================
* Inline conversion functions.
* These are better-typed than the macros used previously:

View file

@ -36,6 +36,7 @@
#include "intel_context.h"
#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_buffers.h"
#include "intel_blit.h"
#include "intel_regions.h"
#include "intel_tris.h"

View file

@ -38,6 +38,7 @@
#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_buffer_objects.h"

View file

@ -37,6 +37,7 @@
#include "intel_screen.h"
#include "intel_buffers.h"
#include "intel_tex.h"
#include "intel_span.h"
#include "intel_tris.h"

View file

@ -87,7 +87,4 @@ intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv);
extern void
intelSwapBuffers( __DRIdrawablePrivate *dPriv);
#endif

View file

@ -34,6 +34,7 @@
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_batchbuffer.h"
#include "intel_buffers.h"
#include "intel_mipmap_tree.h"
#include "intel_regions.h"
#include "intel_fbo.h"