#if FEATURE_GL
case API_OPENGL:
+ case API_OPENGL_CORE:
{
const struct gl_shader_program *vsProg =
ctx->Shader.CurrentVertexProgram;
* when an app is linked to libGLES*, there are not enough dynamic
* entries.
*/
- if (ctx->API == API_OPENGL)
+ if (_mesa_is_desktop_gl(ctx))
_mesa_init_remap_table();
}
#endif
/* Shading language version */
- if (ctx->API == API_OPENGL) {
+ if (_mesa_is_desktop_gl(ctx)) {
ctx->Const.GLSLVersion = 120;
_mesa_override_glsl_version(ctx);
}
switch (ctx->API) {
#if FEATURE_GL
case API_OPENGL:
+ case API_OPENGL_CORE:
ctx->Exec = _mesa_create_exec_table();
break;
#endif
switch (ctx->API) {
case API_OPENGL:
+ case API_OPENGL_CORE:
#if FEATURE_dlist
ctx->Save = _mesa_create_save_table();
if (!ctx->Save) {
enum {
DISABLE = 0,
- GL = 1 << API_OPENGL,
+ GLL = 1 << API_OPENGL, /* GL Legacy / Compatibility */
+ GLC = 1 << API_OPENGL_CORE, /* GL Core */
+ GL = (1 << API_OPENGL) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2,
};
{
switch (target) {
case GL_DRAW_FRAMEBUFFER:
- return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL
+ return ctx->Extensions.EXT_framebuffer_blit && _mesa_is_desktop_gl(ctx)
? ctx->DrawBuffer : NULL;
case GL_READ_FRAMEBUFFER:
- return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL
+ return ctx->Extensions.EXT_framebuffer_blit && _mesa_is_desktop_gl(ctx)
? ctx->ReadBuffer : NULL;
case GL_FRAMEBUFFER_EXT:
return ctx->DrawBuffer;
}
return &fb->Attachment[BUFFER_COLOR0 + i];
case GL_DEPTH_STENCIL_ATTACHMENT:
- if (ctx->API != API_OPENGL)
+ if (!_mesa_is_desktop_gl(ctx))
return NULL;
/* fall-through */
case GL_DEPTH_ATTACHMENT_EXT:
}
#if FEATURE_GL
- if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
+ if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) {
/* Check that all DrawBuffers are present */
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
if (fb->ColorDrawBuffer[j] != GL_NONE) {
ASSERT_OUTSIDE_BEGIN_END(ctx);
/* The error differs in GL and GLES. */
- err = ctx->API == API_OPENGL ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
+ err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
buffer = get_framebuffer_target(ctx, target);
if (!buffer) {
* OES_framebuffer_object spec refers to the EXT_framebuffer_object
* spec.
*/
- if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object) {
+ if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetFramebufferAttachmentParameteriv(bound FBO = 0)");
return;
}
else {
assert(att->Type == GL_NONE);
- if (ctx->API == API_OPENGL) {
+ if (_mesa_is_desktop_gl(ctx)) {
*params = 0;
} else {
_mesa_error(ctx, GL_INVALID_ENUM,
#define API_OPENGL_BIT (1 << API_OPENGL)
#define API_OPENGLES_BIT (1 << API_OPENGLES)
#define API_OPENGLES2_BIT (1 << API_OPENGLES2)
+#define API_OPENGL_CORE_BIT (1 << API_OPENGL_CORE)
/* This is the big table describing all the enums we accept in
* glGet*v(). The table is partitioned into six parts: enums
static const struct value_desc values[] = {
/* Enums shared between OpenGL, GLES1 and GLES2 */
{ 0, 0, TYPE_API_MASK,
- API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT, NO_EXTRA},
+ API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT |
+ API_OPENGL_CORE_BIT,
+ NO_EXTRA},
{ GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
{ GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
{ GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
#if FEATURE_GL || FEATURE_ES1
/* Enums in OpenGL and GLES1 */
- { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT, NO_EXTRA },
+ { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
{ GL_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights), NO_EXTRA },
{ GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA },
{ GL_LIGHT1, CONTEXT_BOOL(Light.Light[1].Enabled), NO_EXTRA },
#if FEATURE_GL
/* Remaining enums are only in OpenGL */
- { 0, 0, TYPE_API_MASK, API_OPENGL_BIT, NO_EXTRA },
+ { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
{ GL_ACCUM_RED_BITS, BUFFER_INT(Visual.accumRedBits), NO_EXTRA },
{ GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA },
{ GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits), NO_EXTRA },
}
break;
case EXTRA_API_GL:
- if (ctx->API == API_OPENGL) {
+ if (_mesa_is_desktop_gl(ctx)) {
total++;
enabled++;
}
{
switch (ctx->API) {
case API_OPENGL:
+ case API_OPENGL_CORE:
if (!ctx->Extensions.ARB_shader_objects) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
return (const GLubyte *) 0;
}
/* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
*/
- if (ctx->API != API_OPENGL) {
+ if (_mesa_is_gles(ctx)) {
switch (internalFormat) {
case GL_BGRA:
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
/* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
*/
- if (ctx->API != API_OPENGL) {
+ if (_mesa_is_gles(ctx)) {
switch (internalFormat) {
case GL_BGRA:
return GL_RGBA;
case GL_DOUBLE:
return DOUBLE_BIT;
case GL_FIXED:
- return ctx->API == API_OPENGL ? FIXED_GL_BIT : FIXED_ES_BIT;
+ return _mesa_is_desktop_gl(ctx) ? FIXED_GL_BIT : FIXED_ES_BIT;
case GL_UNSIGNED_INT_2_10_10_10_REV:
return UNSIGNED_INT_2_10_10_10_REV_BIT;
case GL_INT_2_10_10_10_REV:
switch (ctx->API) {
case API_OPENGL:
+ case API_OPENGL_CORE:
compute_version(ctx);
break;
case API_OPENGLES:
void
_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{
- if (ctx->API == API_OPENGL)
+ if (_mesa_is_desktop_gl(ctx))
install_vtxfmt( ctx->Exec, vfmt );
}
void
_mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{
- if (ctx->API == API_OPENGL)
+ if (_mesa_is_desktop_gl(ctx))
install_vtxfmt( ctx->Save, vfmt );
}