Make GL_ARB_draw_buffers mandatory

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Ian Romanick
2009-01-27 19:10:43 -08:00
committed by Ian Romanick
parent 474cda6fa9
commit 8aa209c766
30 changed files with 57 additions and 41 deletions

View File

@@ -179,6 +179,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
#define need_GL_ARB_draw_buffers
#define need_GL_ARB_multisample
#define need_GL_ARB_texture_compression
#define need_GL_ARB_transpose_matrix
@@ -202,6 +203,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
#include "extension_helper.h"
static const struct dri_extension all_mesa_extensions[] = {
{ "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions },
{ "GL_ARB_multisample", GL_ARB_multisample_functions },
{ "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
{ "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions },

View File

@@ -260,6 +260,8 @@ ffbCreateContext(const __GLcontextModes *mesaVis,
ctx->Const.MaxLineWidthAA = 1.0;
ctx->Const.LineWidthGranularity = 1.0;
ctx->Const.MaxDrawBuffers = 1;
/* Instead of having GCC emit these constants a zillion times
* everywhere in the driver, put them here.
*/

View File

@@ -133,6 +133,8 @@ GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxPointSizeAA = 16.0;
ctx->Const.PointSizeGranularity = 0.25;
ctx->Const.MaxDrawBuffers = 1;
gmesa->texHeap = mmInit( 0, gmesa->gammaScreen->textureSize );
make_empty_list(&gmesa->TexObjList);

View File

@@ -97,6 +97,8 @@ i830CreateContext(const __GLcontextModes * mesaVis,
ctx->Const.MaxTextureRectSize = (1 << 11);
ctx->Const.MaxTextureUnits = I830_TEX_UNITS;
ctx->Const.MaxDrawBuffers = 1;
_tnl_init_vertices(ctx, ctx->Const.MaxArrayLockSize + 12,
18 * sizeof(GLfloat));

View File

@@ -172,6 +172,8 @@ i915CreateContext(const __GLcontextModes * mesaVis,
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
ctx->Const.MaxDrawBuffers = 1;
driInitExtensions(ctx, i915_extensions, GL_FALSE);

View File

@@ -109,7 +109,6 @@ static const struct dri_extension card_extensions[] = {
/** i965-only extensions */
static const struct dri_extension brw_extensions[] = {
{ "GL_ARB_depth_texture", NULL },
{ "GL_ARB_draw_buffers", NULL },
{ "GL_ARB_fragment_program", NULL },
{ "GL_ARB_fragment_program_shadow", NULL },
{ "GL_ARB_fragment_shader", NULL },

View File

@@ -190,6 +190,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxTextureUnits = 2;
ctx->Const.MaxTextureImageUnits = 2;
ctx->Const.MaxTextureCoordUnits = 2;
ctx->Const.MaxDrawBuffers = 1;
heap = mach64Screen->IsPCI ? MACH64_CARD_HEAP : MACH64_AGP_HEAP;

View File

@@ -531,6 +531,8 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxLineWidthAA = 10.0;
ctx->Const.LineWidthGranularity = 1.0;
ctx->Const.MaxDrawBuffers = 1;
mmesa->texture_depth = driQueryOptioni (&mmesa->optionCache,
"texture_depth");
if (mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)

View File

@@ -223,6 +223,8 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxLineWidthAA = 1.0;
ctx->Const.LineWidthGranularity = 1.0;
ctx->Const.MaxDrawBuffers = 1;
#if ENABLE_PERF_BOXES
rmesa->boxes = driQueryOptionb(&rmesa->optionCache, "performance_boxes");
#endif

View File

@@ -403,6 +403,8 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
ctx->Const.VertexProgram.MaxNativeParameters = R200_VSF_MAX_PARAM;
ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
ctx->Const.MaxDrawBuffers = 1;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );

View File

@@ -311,6 +311,8 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
#endif
#endif
ctx->Const.MaxDrawBuffers = 1;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext(ctx);

View File

@@ -353,6 +353,8 @@ radeonCreateContext( const __GLcontextModes *glVisual,
rmesa->boxes = 0;
ctx->Const.MaxDrawBuffers = 1;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );

View File

@@ -108,6 +108,8 @@ GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
ctx->Const.MaxLineWidthAA = 1.0;
ctx->Const.LineWidthGranularity = 1.0;
ctx->Const.MaxDrawBuffers = 1;
vmesa->texHeap = mmInit( 0, vmesa->s3vScreen->textureSize );
DEBUG(("vmesa->s3vScreen->textureSize = 0x%x\n",
vmesa->s3vScreen->textureSize));

View File

@@ -345,6 +345,8 @@ savageCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.LineWidthGranularity = 1.0;
#endif
ctx->Const.MaxDrawBuffers = 1;
/* Dri stuff
*/
imesa->hHWContext = driContextPriv->hHWContext;

View File

@@ -309,6 +309,8 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxLineWidthAA = 1.0;
ctx->Const.LineWidthGranularity = 1.0;
ctx->Const.MaxDrawBuffers = 1;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );

View File

@@ -128,6 +128,8 @@ tridentCreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxPointSizeAA = 16.0;
ctx->Const.PointSizeGranularity = 0.25;
ctx->Const.MaxDrawBuffers = 1;
#if 0
tmesa->texHeap = mmInit( 0, tmesa->tridentScreen->textureSize );

View File

@@ -573,6 +573,8 @@ viaCreateContext(const __GLcontextModes *visual,
ctx->Const.MaxPointSizeAA = 1.0;
ctx->Const.PointSizeGranularity = 1.0;
ctx->Const.MaxDrawBuffers = 1;
ctx->Driver.GetString = viaGetString;
ctx->DriverCtx = (void *)vmesa;

View File

@@ -1773,6 +1773,8 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
ctx->Const.MaxTextureImageUnits = fxMesa->haveTwoTMUs ? 2 : 1;
ctx->Const.MaxTextureUnits = MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);
ctx->Const.MaxDrawBuffers = 1;
fxMesa->new_state = _NEW_ALL;
if (!fxMesa->haveHwStencil) {
/* don't touch stencil if there is none */

View File

@@ -1482,6 +1482,7 @@ SkipPrimaryCreate:
#else
lpCtx->glCtx->Const.MaxTextureSize = 1024;
#endif
lpCtx->glCtx->Const.MaxDrawBuffers = 1;
// Setup the Display Driver pointers
dglSetupDDPointers(lpCtx->glCtx);

View File

@@ -1422,6 +1422,8 @@ BOOL gldInitialiseMesa_DX(
lpCtx->glCtx->Const.MaxTextureUnits = 1;
}
lpCtx->glCtx->Const.MaxDrawBuffers = 1;
// max texture size
// MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth);
MaxTextureSize = min(gld->d3dCaps.dwMaxTextureHeight, gld->d3dCaps.dwMaxTextureWidth);

View File

@@ -1204,6 +1204,7 @@ BOOL gldInitialiseMesa_DX(
MaxTextureSize >>= 1;
}
lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
lpCtx->glCtx->Const.MaxDrawBuffers = 1;
IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE);
IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);

View File

@@ -1206,6 +1206,7 @@ BOOL gldInitialiseMesa_DX(
MaxTextureSize >>= 1;
}
lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
lpCtx->glCtx->Const.MaxDrawBuffers = 1;
IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE);
IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);

View File

@@ -1625,6 +1625,7 @@ BOOL gldInitialiseMesa_MesaSW(
// Added this to force max texture diminsion to 256. KeithH
ctx->Const.MaxTextureLevels = 8;
ctx->Const.MaxDrawBuffers = 1;
_mesa_enable_sw_extensions(ctx);
_mesa_enable_imaging_extensions(ctx);

View File

@@ -903,15 +903,14 @@ _mesa_PopAttrib(void)
* function, but legal for the later.
*/
GLboolean multipleBuffers = GL_FALSE;
if (ctx->Extensions.ARB_draw_buffers) {
GLuint i;
for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
if (color->DrawBuffer[i] != GL_NONE) {
multipleBuffers = GL_TRUE;
break;
}
}
}
/* Call the API_level functions, not _mesa_drawbuffers()
* since we need to do error checking on the pop'd
* GL_DRAW_BUFFER.

View File

@@ -289,10 +289,6 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (!ctx->Extensions.ARB_draw_buffers) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB");
return;
}
if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)");
return;

View File

@@ -45,7 +45,7 @@ static const struct {
int flag_offset;
} default_extensions[] = {
{ OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) },
{ OFF, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
{ ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
{ OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
{ OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
@@ -184,7 +184,7 @@ void
_mesa_enable_sw_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_depth_texture = GL_TRUE;
ctx->Extensions.ARB_draw_buffers = GL_TRUE;
/*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
#if FEATURE_ARB_fragment_program
ctx->Extensions.ARB_fragment_program = GL_TRUE;
ctx->Extensions.ARB_fragment_program_shadow = GL_TRUE;
@@ -401,7 +401,7 @@ _mesa_enable_1_5_extensions(GLcontext *ctx)
void
_mesa_enable_2_0_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_draw_buffers = GL_TRUE;
/*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
#if FEATURE_ARB_fragment_shader
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
#endif

View File

@@ -1732,15 +1732,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition);
break;
case GL_MAX_DRAW_BUFFERS_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers);
break;
case GL_DRAW_BUFFER0_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetBooleanv");
params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_DRAW_BUFFER1_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetBooleanv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -1752,7 +1749,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
}
break;
case GL_DRAW_BUFFER2_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetBooleanv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -1764,7 +1760,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
}
break;
case GL_DRAW_BUFFER3_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetBooleanv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -3563,15 +3558,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition);
break;
case GL_MAX_DRAW_BUFFERS_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetFloatv");
params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers);
break;
case GL_DRAW_BUFFER0_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetFloatv");
params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_DRAW_BUFFER1_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetFloatv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -3583,7 +3575,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
}
break;
case GL_DRAW_BUFFER2_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetFloatv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -3595,7 +3586,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
}
break;
case GL_DRAW_BUFFER3_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetFloatv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -5394,15 +5384,12 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = ctx->VertexProgram.CurrentPosition;
break;
case GL_MAX_DRAW_BUFFERS_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetIntegerv");
params[0] = ctx->Const.MaxDrawBuffers;
break;
case GL_DRAW_BUFFER0_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetIntegerv");
params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_DRAW_BUFFER1_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetIntegerv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -5414,7 +5401,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
case GL_DRAW_BUFFER2_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetIntegerv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
@@ -5426,7 +5412,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
case GL_DRAW_BUFFER3_ARB:
CHECK_EXT1(ARB_draw_buffers, "GetIntegerv");
{
GLenum buffer;
if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {

View File

@@ -914,9 +914,9 @@ StateVars = [
# GL_ARB_draw_buffers
( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
["ctx->Const.MaxDrawBuffers"], "", ["ARB_draw_buffers"] ),
["ctx->Const.MaxDrawBuffers"], "", None ),
( "GL_DRAW_BUFFER0_ARB", GLenum,
["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", ["ARB_draw_buffers"] ),
["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
( "GL_DRAW_BUFFER1_ARB", GLenum,
["buffer"],
"""GLenum buffer;
@@ -924,7 +924,7 @@ StateVars = [
_mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
return;
}
buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", ["ARB_draw_buffers"] ),
buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", None ),
( "GL_DRAW_BUFFER2_ARB", GLenum,
["buffer"],
"""GLenum buffer;
@@ -932,7 +932,7 @@ StateVars = [
_mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
return;
}
buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", ["ARB_draw_buffers"] ),
buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", None ),
( "GL_DRAW_BUFFER3_ARB", GLenum,
["buffer"],
"""GLenum buffer;
@@ -940,7 +940,7 @@ StateVars = [
_mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
return;
}
buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", ["ARB_draw_buffers"] ),
buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", None ),
# XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future
# GL_OES_read_format

View File

@@ -3616,8 +3616,7 @@ enable_parser_extensions(GLcontext *ctx, grammar id)
if (ctx->Extensions.NV_texture_rectangle
&& !enable_ext(ctx, id, "texture_rectangle"))
return GL_FALSE;
if (ctx->Extensions.ARB_draw_buffers
&& !enable_ext(ctx, id, "draw_buffers"))
if (!enable_ext(ctx, id, "draw_buffers"))
return GL_FALSE;
if (ctx->Extensions.MESA_texture_array
&& !enable_ext(ctx, id, "texture_array"))

View File

@@ -508,7 +508,6 @@ static GLvoid
pp_ext_init(pp_ext *self, const struct gl_extensions *extensions)
{
pp_ext_disable_all (self);
if (extensions->ARB_draw_buffers)
self->ARB_draw_buffers = GL_TRUE;
if (extensions->NV_texture_rectangle)
self->ARB_texture_rectangle = GL_TRUE;