#ifndef CONTEXT_H
#define CONTEXT_H
#include "glapi.h"
#include "imports.h"
#include "mtypes.h"
extern GLvisual *
_mesa_create_visual( GLboolean rgbFlag,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint greenBits,
GLint blueBits,
GLint alphaBits,
GLint indexBits,
GLint depthBits,
GLint stencilBits,
GLint accumRedBits,
GLint accumGreenBits,
GLint accumBlueBits,
GLint accumAlphaBits,
GLint numSamples );
extern GLboolean
_mesa_initialize_visual( GLvisual *v,
GLboolean rgbFlag,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint greenBits,
GLint blueBits,
GLint alphaBits,
GLint indexBits,
GLint depthBits,
GLint stencilBits,
GLint accumRedBits,
GLint accumGreenBits,
GLint accumBlueBits,
GLint accumAlphaBits,
GLint numSamples );
extern void
_mesa_destroy_visual( GLvisual *vis );
extern GLcontext *
_mesa_create_context( const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext );
extern GLboolean
_mesa_initialize_context( GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext );
extern void
_mesa_free_context_data( GLcontext *ctx );
extern void
_mesa_destroy_context( GLcontext *ctx );
extern void
_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
extern void
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer );
extern GLboolean
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
extern GLcontext *
_mesa_get_current_context(void);
extern void
_mesa_notifySwapBuffers(__GLcontext *gc);
extern struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx);
extern void
_mesa_record_error( GLcontext *ctx, GLenum error );
extern void GLAPIENTRY
_mesa_Finish( void );
extern void GLAPIENTRY
_mesa_Flush( void );
#define FLUSH_VERTICES(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
ctx->NewState |= newstate; \
} while (0)
#define FLUSH_CURRENT(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
do { \
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
_mesa_error(ctx, GL_INVALID_OPERATION, "Inside glBegin/glEnd"); \
return retval; \
} \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
do { \
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
_mesa_error(ctx, GL_INVALID_OPERATION, "Inside glBegin/glEnd"); \
return; \
} \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
do { \
ASSERT_OUTSIDE_BEGIN_END(ctx); \
FLUSH_VERTICES(ctx, 0); \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
do { \
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
FLUSH_VERTICES(ctx, 0); \
} while (0)
#define NEED_SECONDARY_COLOR(CTX) \
(((CTX)->Light.Enabled && \
(CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
|| (CTX)->Fog.ColorSumEnabled \
|| ((CTX)->VertexProgram._Current && \
((CTX)->VertexProgram._Current != (CTX)->VertexProgram._TnlProgram) && \
((CTX)->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1)) \
|| ((CTX)->FragmentProgram._Current && \
((CTX)->FragmentProgram._Current != (CTX)->FragmentProgram._TexEnvProgram) && \
((CTX)->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) \
)
#define RGBA_LOGICOP_ENABLED(CTX) \
((CTX)->Color.ColorLogicOpEnabled || \
((CTX)->Color.BlendEnabled && (CTX)->Color.BlendEquationRGB == GL_LOGIC_OP))
#endif