mesa: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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,
|
||||
};
|
||||
|
@@ -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,
|
||||
|
@@ -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++;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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:
|
||||
|
@@ -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:
|
||||
|
@@ -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 );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user