Rename _mesa_update_buffers() to _mesa_update_draw_buffer_bounds() and do
additional checks. Replace _mesa_init_buffers() with _mesa_init_scissor() and _mesa_init_multisample().
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.1
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2005 Brian Paul 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"),
|
||||
@@ -645,33 +645,47 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
/** \name State management */
|
||||
/*@{*/
|
||||
|
||||
|
||||
/**
|
||||
* Update screen bounds.
|
||||
*
|
||||
* \param ctx GL context.
|
||||
*
|
||||
* Update gl_frame_buffer::_Xmin, and etc.
|
||||
* Update the context's current drawing buffer's Xmin, Xmax, Ymin, Ymax fields.
|
||||
* These values are computed from the buffer's width and height and
|
||||
* the scissor box, if it's enabled.
|
||||
* \param ctx the GL context.
|
||||
*/
|
||||
void _mesa_update_buffers( GLcontext *ctx )
|
||||
void
|
||||
_mesa_update_draw_buffer_bounds(GLcontext *ctx)
|
||||
{
|
||||
ctx->DrawBuffer->_Xmin = 0;
|
||||
ctx->DrawBuffer->_Ymin = 0;
|
||||
ctx->DrawBuffer->_Xmax = ctx->DrawBuffer->Width;
|
||||
ctx->DrawBuffer->_Ymax = ctx->DrawBuffer->Height;
|
||||
GLframebuffer *buffer = ctx->DrawBuffer;
|
||||
|
||||
buffer->_Xmin = 0;
|
||||
buffer->_Ymin = 0;
|
||||
buffer->_Xmax = buffer->Width;
|
||||
buffer->_Ymax = buffer->Height;
|
||||
|
||||
if (ctx->Scissor.Enabled) {
|
||||
if (ctx->Scissor.X > ctx->DrawBuffer->_Xmin) {
|
||||
ctx->DrawBuffer->_Xmin = ctx->Scissor.X;
|
||||
if (ctx->Scissor.X > buffer->_Xmin) {
|
||||
buffer->_Xmin = ctx->Scissor.X;
|
||||
}
|
||||
if (ctx->Scissor.Y > ctx->DrawBuffer->_Ymin) {
|
||||
ctx->DrawBuffer->_Ymin = ctx->Scissor.Y;
|
||||
if (ctx->Scissor.Y > buffer->_Ymin) {
|
||||
buffer->_Ymin = ctx->Scissor.Y;
|
||||
}
|
||||
if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->_Xmax) {
|
||||
ctx->DrawBuffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width;
|
||||
if (ctx->Scissor.X + ctx->Scissor.Width < buffer->_Xmax) {
|
||||
buffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width;
|
||||
}
|
||||
if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->_Ymax) {
|
||||
ctx->DrawBuffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
|
||||
if (ctx->Scissor.Y + ctx->Scissor.Height < buffer->_Ymax) {
|
||||
buffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
|
||||
}
|
||||
/* finally, check for empty region */
|
||||
if (buffer->_Xmin > buffer->_Xmax) {
|
||||
buffer->_Xmin = buffer->_Xmax;
|
||||
}
|
||||
if (buffer->_Ymin > buffer->_Ymax) {
|
||||
buffer->_Ymin = buffer->_Ymax;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(buffer->_Xmin <= buffer->_Xmax);
|
||||
ASSERT(buffer->_Ymin <= buffer->_Ymax);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
@@ -682,14 +696,11 @@ void _mesa_update_buffers( GLcontext *ctx )
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Initialize the context scissor data.
|
||||
*
|
||||
* \param ctx GL context.
|
||||
*
|
||||
* Initializes the __GLcontextRec::Scissor and __GLcontextRec::Multisample
|
||||
* attribute groups, and related constants in __GLcontextRec::Const.
|
||||
* Initialize the context's scissor state.
|
||||
* \param ctx the GL context.
|
||||
*/
|
||||
void _mesa_init_buffers( GLcontext * ctx )
|
||||
void
|
||||
_mesa_init_scissor(GLcontext *ctx)
|
||||
{
|
||||
/* Scissor group */
|
||||
ctx->Scissor.Enabled = GL_FALSE;
|
||||
@@ -697,15 +708,22 @@ void _mesa_init_buffers( GLcontext * ctx )
|
||||
ctx->Scissor.Y = 0;
|
||||
ctx->Scissor.Width = 0;
|
||||
ctx->Scissor.Height = 0;
|
||||
}
|
||||
|
||||
/* Multisample */
|
||||
|
||||
/**
|
||||
* Initialize the context's multisample state.
|
||||
* \param ctx the GL context.
|
||||
*/
|
||||
void
|
||||
_mesa_init_multisample(GLcontext *ctx)
|
||||
{
|
||||
ctx->Multisample.Enabled = GL_FALSE;
|
||||
ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
|
||||
ctx->Multisample.SampleAlphaToOne = GL_FALSE;
|
||||
ctx->Multisample.SampleCoverage = GL_FALSE;
|
||||
ctx->Multisample.SampleCoverageValue = 1.0;
|
||||
ctx->Multisample.SampleCoverageInvert = GL_FALSE;
|
||||
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
@@ -5,9 +5,9 @@
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2005 Brian Paul 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"),
|
||||
@@ -65,9 +65,13 @@ extern void GLAPIENTRY
|
||||
_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
|
||||
|
||||
extern void
|
||||
_mesa_init_buffers( GLcontext * ctx );
|
||||
_mesa_update_draw_buffer_bounds(GLcontext *ctx);
|
||||
|
||||
extern void
|
||||
_mesa_update_buffers( GLcontext *ctx );
|
||||
_mesa_init_scissor(GLcontext *ctx);
|
||||
|
||||
extern void
|
||||
_mesa_init_multisample(GLcontext *ctx);
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -1194,7 +1194,6 @@ init_attrib_groups( GLcontext *ctx )
|
||||
/* Attribute Groups */
|
||||
_mesa_init_accum( ctx );
|
||||
_mesa_init_attrib( ctx );
|
||||
_mesa_init_buffers( ctx );
|
||||
_mesa_init_buffer_objects( ctx );
|
||||
_mesa_init_color( ctx );
|
||||
_mesa_init_colortables( ctx );
|
||||
@@ -1210,12 +1209,14 @@ init_attrib_groups( GLcontext *ctx )
|
||||
_mesa_init_line( ctx );
|
||||
_mesa_init_lighting( ctx );
|
||||
_mesa_init_matrix( ctx );
|
||||
_mesa_init_multisample( ctx );
|
||||
_mesa_init_occlude( ctx );
|
||||
_mesa_init_pixel( ctx );
|
||||
_mesa_init_point( ctx );
|
||||
_mesa_init_polygon( ctx );
|
||||
_mesa_init_program( ctx );
|
||||
_mesa_init_rastpos( ctx );
|
||||
_mesa_init_scissor( ctx );
|
||||
_mesa_init_shaderobjects (ctx);
|
||||
_mesa_init_stencil( ctx );
|
||||
_mesa_init_transform( ctx );
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2005 Brian Paul 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"),
|
||||
@@ -935,20 +935,21 @@ update_program(GLcontext *ctx)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* If __GLcontextRec::NewState is non-zero then this function \b must be called
|
||||
* before rendering any primitive. Basically, function pointers and
|
||||
* miscellaneous flags are updated to reflect the current state of the state
|
||||
* machine.
|
||||
*
|
||||
* Calls dd_function_table::UpdateState to perform any internal state management
|
||||
* necessary.
|
||||
* Calls dd_function_table::UpdateState to perform any internal state
|
||||
* management necessary.
|
||||
*
|
||||
* \sa _mesa_update_modelview_project(), _mesa_update_texture(),
|
||||
* _mesa_update_buffers(), _mesa_update_polygon(), _mesa_update_lighting() and
|
||||
* _mesa_update_tnl_spaces().
|
||||
* _mesa_update_buffer_bounds(), _mesa_update_polygon(),
|
||||
* _mesa_update_lighting() and _mesa_update_tnl_spaces().
|
||||
*/
|
||||
void _mesa_update_state( GLcontext *ctx )
|
||||
void
|
||||
_mesa_update_state( GLcontext *ctx )
|
||||
{
|
||||
GLuint new_state = ctx->NewState;
|
||||
|
||||
@@ -965,7 +966,7 @@ void _mesa_update_state( GLcontext *ctx )
|
||||
_mesa_update_texture( ctx, new_state );
|
||||
|
||||
if (new_state & (_NEW_SCISSOR|_NEW_BUFFERS))
|
||||
_mesa_update_buffers( ctx );
|
||||
_mesa_update_draw_buffer_bounds( ctx );
|
||||
|
||||
if (new_state & _NEW_POLYGON)
|
||||
_mesa_update_polygon( ctx );
|
||||
|
Reference in New Issue
Block a user