summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2012-07-19 11:27:16 -0700
committerJordan Justen <[email protected]>2012-07-30 16:18:57 -0700
commit09714c09a40501d82823e42f7461d7b8d7bf11c0 (patch)
tree144610e22885309e431706173799f044d86255c7
parent3d284dcba6f692ce268c9a2178a30e7a308b2cfc (diff)
mesa: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/main/api_validate.c1
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/extensions.c4
-rw-r--r--src/mesa/main/fbobject.c14
-rw-r--r--src/mesa/main/get.c11
-rw-r--r--src/mesa/main/getstring.c1
-rw-r--r--src/mesa/main/texformat.c2
-rw-r--r--src/mesa/main/teximage.c2
-rw-r--r--src/mesa/main/varray.c2
-rw-r--r--src/mesa/main/version.c1
-rw-r--r--src/mesa/main/vtxfmt.c4
11 files changed, 29 insertions, 19 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index ece0a2b4ad7..eaf614bdc5f 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -128,6 +128,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
#if FEATURE_GL
case API_OPENGL:
+ case API_OPENGL_CORE:
{
const struct gl_shader_program *vsProg =
ctx->Shader.CurrentVertexProgram;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 243053eeb29..b1f16ec065b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -431,7 +431,7 @@ one_time_init( struct gl_context *ctx )
* 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();
}
@@ -626,7 +626,7 @@ _mesa_init_constants(struct gl_context *ctx)
#endif
/* Shading language version */
- if (ctx->API == API_OPENGL) {
+ if (_mesa_is_desktop_gl(ctx)) {
ctx->Const.GLSLVersion = 120;
_mesa_override_glsl_version(ctx);
}
@@ -962,6 +962,7 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) {
#if FEATURE_GL
case API_OPENGL:
+ case API_OPENGL_CORE:
ctx->Exec = _mesa_create_exec_table();
break;
#endif
@@ -1007,6 +1008,7 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) {
case API_OPENGL:
+ case API_OPENGL_CORE:
#if FEATURE_dlist
ctx->Save = _mesa_create_save_table();
if (!ctx->Save) {
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 0675ce75da6..a7b481ca771 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -41,7 +41,9 @@
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,
};
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ece1251fa40..eb03b09183c 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -164,10 +164,10 @@ get_framebuffer_target(struct gl_context *ctx, GLenum target)
{
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;
@@ -221,7 +221,7 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
}
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:
@@ -817,7 +817,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
}
#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) {
@@ -2289,7 +2289,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
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) {
@@ -2309,7 +2309,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
* 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;
@@ -2357,7 +2357,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
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,
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 15de321e400..b9c98fb22d3 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -391,6 +391,7 @@ extra_NV_read_buffer_api_gl[] = {
#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
@@ -405,7 +406,9 @@ extra_NV_read_buffer_api_gl[] = {
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 },
@@ -534,7 +537,7 @@ static const struct value_desc values[] = {
#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 },
@@ -796,7 +799,7 @@ static const struct value_desc values[] = {
#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 },
@@ -1887,7 +1890,7 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
}
break;
case EXTRA_API_GL:
- if (ctx->API == API_OPENGL) {
+ if (_mesa_is_desktop_gl(ctx)) {
total++;
enabled++;
}
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 2f445aaf97d..c6f400af597 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -41,6 +41,7 @@ shading_language_version(struct gl_context *ctx)
{
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;
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 91897176ef4..d360f0e2262 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -895,7 +895,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
}
/* 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);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 91df133312b..d2746c6f33d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -130,7 +130,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
/* 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;
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index efa63b07c13..7ec7cfee6f4 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -92,7 +92,7 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
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:
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index efaaf58de88..91ef2dff4dd 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -315,6 +315,7 @@ _mesa_compute_version(struct gl_context *ctx)
switch (ctx->API) {
case API_OPENGL:
+ case API_OPENGL_CORE:
compute_version(ctx);
break;
case API_OPENGLES:
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index bf7a54c0ad6..bc925b0db7b 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -209,7 +209,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
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 );
}
@@ -221,7 +221,7 @@ _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *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 );
}