190
191
* is acceptable but the actual depth type will be GLushort or GLuint as
192
193
* \param stencilBits requested minimum bits per stencil buffer value
193
* \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number of bits per color component in accum buffer.
194
* \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number
195
* of bits per color component in accum buffer.
194
196
* \param indexBits number of bits per pixel if \p rgbFlag is GL_FALSE
195
197
* \param redBits number of bits per color component in frame buffer for RGB(A)
196
198
* mode. We always use 8 in core Mesa though.
199
201
* \param alphaBits same as above.
200
202
* \param numSamples not really used.
202
* \return pointer to new struct gl_config or NULL if requested parameters can't be
204
* \return pointer to new struct gl_config or NULL if requested parameters
205
207
* \note Need to add params for level and numAuxBuffers (at least)
481
487
prog->MaxTemps = MAX_PROGRAM_TEMPS;
482
488
prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS;
483
489
prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
484
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
490
prog->MaxAddressOffset = MAX_PROGRAM_LOCAL_PARAMS;
487
493
case GL_VERTEX_PROGRAM_ARB:
488
494
prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS;
489
495
prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
490
496
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
497
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
492
499
case GL_FRAGMENT_PROGRAM_ARB:
493
500
prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
494
501
prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS;
495
502
prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
503
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
497
505
case MESA_GEOMETRY_PROGRAM:
498
506
prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS;
499
507
prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
500
508
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
502
prog->MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS;
503
prog->MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS;
504
prog->MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS;
505
prog->MaxGeometryUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
506
prog->MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
507
prog->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
509
prog->MaxUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
510
512
assert(0 && "Bad program type in init_program_limits()");
529
531
prog->MediumFloat.RangeMax = 127;
530
532
prog->MediumFloat.Precision = 23;
531
533
prog->LowFloat = prog->HighFloat = prog->MediumFloat;
532
/* assume ints are stored as floats for now */
533
prog->LowInt = prog->MediumInt = prog->HighInt = prog->MediumFloat;
535
/* Assume ints are stored as floats for now, since this is the least-common
536
* denominator. The OpenGL ES spec implies (page 132) that the precision
537
* of integer types should be 0. Practically speaking, IEEE
538
* single-precision floating point values can only store integers in the
539
* range [-0x01000000, 0x01000000] without loss of precision.
541
prog->MediumInt.RangeMin = 24;
542
prog->MediumInt.RangeMax = 24;
543
prog->MediumInt.Precision = 0;
544
prog->LowInt = prog->HighInt = prog->MediumInt;
557
568
ctx->Const.MaxTextureImageUnits);
558
569
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
559
570
ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
571
ctx->Const.MaxTextureBufferSize = 65536;
560
572
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
561
573
ctx->Const.SubPixelBits = SUB_PIXEL_BITS;
562
574
ctx->Const.MinPointSize = MIN_POINT_SIZE;
604
616
ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
605
617
ctx->Const.MaxVarying = MAX_VARYING;
619
#if FEATURE_ARB_geometry_shader4
620
ctx->Const.MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS;
621
ctx->Const.MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS;
622
ctx->Const.MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS;
623
ctx->Const.MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
624
ctx->Const.MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
608
627
/* Shading language version */
609
628
if (ctx->API == API_OPENGL) {
872
895
* \param driverContext pointer to driver-specific context data
875
_mesa_initialize_context_for_api(struct gl_context *ctx,
877
const struct gl_config *visual,
878
struct gl_context *share_list,
879
const struct dd_function_table *driverFunctions,
898
_mesa_initialize_context(struct gl_context *ctx,
900
const struct gl_config *visual,
901
struct gl_context *share_list,
902
const struct dd_function_table *driverFunctions,
882
905
struct gl_shared_state *shared;
965
988
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
991
/* Mesa core handles all the formats that mesa core knows about.
992
* Drivers will want to override this list with just the formats
993
* they can handle, and confirm that appropriate fallbacks exist in
994
* _mesa_choose_tex_format().
996
memset(&ctx->TextureFormatSupported, GL_TRUE,
997
sizeof(ctx->TextureFormatSupported));
968
999
switch (ctx->API) {
969
1000
case API_OPENGL:
970
1001
#if FEATURE_dlist
1010
* Initialize an OpenGL context.
1013
_mesa_initialize_context(struct gl_context *ctx,
1014
const struct gl_config *visual,
1015
struct gl_context *share_list,
1016
const struct dd_function_table *driverFunctions,
1017
void *driverContext)
1019
return _mesa_initialize_context_for_api(ctx,
1029
1041
* Allocate and initialize a struct gl_context structure.
1030
1042
* Note that the driver needs to pass in its dd_function_table here since
1031
1043
* we need to at least call driverFunctions->NewTextureObject to initialize
1041
1053
* \return pointer to a new __struct gl_contextRec or NULL if error.
1043
1055
struct gl_context *
1044
_mesa_create_context_for_api(gl_api api,
1045
const struct gl_config *visual,
1046
struct gl_context *share_list,
1047
const struct dd_function_table *driverFunctions,
1048
void *driverContext)
1056
_mesa_create_context(gl_api api,
1057
const struct gl_config *visual,
1058
struct gl_context *share_list,
1059
const struct dd_function_table *driverFunctions,
1060
void *driverContext)
1050
1062
struct gl_context *ctx;
1059
if (_mesa_initialize_context_for_api(ctx, api, visual, share_list,
1060
driverFunctions, driverContext)) {
1071
if (_mesa_initialize_context(ctx, api, visual, share_list,
1072
driverFunctions, driverContext)) {
1071
* Create an OpenGL context.
1074
_mesa_create_context(const struct gl_config *visual,
1075
struct gl_context *share_list,
1076
const struct dd_function_table *driverFunctions,
1077
void *driverContext)
1079
return _mesa_create_context_for_api(API_OPENGL, visual,
1087
1083
* Free the data associated with the given context.
1089
1085
* But doesn't free the struct gl_context struct itself.
1198
_mesa_copy_context( const struct gl_context *src, struct gl_context *dst, GLuint mask )
1194
_mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
1200
1197
if (mask & GL_ACCUM_BUFFER_BIT) {
1201
1198
/* OK to memcpy */
1448
1446
_glapi_set_dispatch(newCtx->CurrentDispatch);
1450
1448
if (drawBuffer && readBuffer) {
1451
/* TODO: check if newCtx and buffer's visual match??? */
1453
1449
ASSERT(drawBuffer->Name == 0);
1454
1450
ASSERT(readBuffer->Name == 0);
1455
1451
_mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer);
1460
1456
* or not bound to a user-created FBO.
1462
1458
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
1463
/* KW: merge conflict here, revisit.
1465
/* fix up the fb fields - these will end up wrong otherwise
1466
* if the DRIdrawable changes, and everything relies on them.
1467
* This is a bit messy (same as needed in _mesa_BindFramebufferEXT)
1470
GLenum buffers[MAX_DRAW_BUFFERS];
1472
1459
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
1474
for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) {
1475
buffers[i] = newCtx->Color.DrawBuffer[i];
1478
_mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers,
1460
/* Update the FBO's list of drawbuffers/renderbuffers.
1461
* For winsys FBOs this comes from the GL state (which may have
1462
* changed since the last time this FBO was bound).
1464
_mesa_update_draw_buffers(newCtx);
1481
1466
if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
1482
1467
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);