Compare commits

...

7 Commits

Author SHA1 Message Date
Jordan Justen
85e97b18e0 mesa: don't enable legacy GL functions when using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
f2c8a8f550 intel: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
631566bd77 meta: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
7027b53956 glsl: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
b0396f5d7b mesa: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
cbc6974330 mesa: add api check macros
These macros make it easier to check for multiple API types.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
f7a395f970 mesa: add API_OPENGL_CORE api
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:58 -07:00
17 changed files with 270 additions and 192 deletions

View File

@@ -90,19 +90,17 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
*/ */
this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2) this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2)
|| ctx->Extensions.ARB_ES2_compatibility; || ctx->Extensions.ARB_ES2_compatibility;
this->Const.GLSL_110 = (ctx->API == API_OPENGL); bool is_desktop_gl = IS_CTX_DESKTOP_GL(ctx);
this->Const.GLSL_120 = (ctx->API == API_OPENGL) this->Const.GLSL_110 = is_desktop_gl;
&& (ctx->Const.GLSLVersion >= 120); this->Const.GLSL_120 = is_desktop_gl && (ctx->Const.GLSLVersion >= 120);
this->Const.GLSL_130 = (ctx->API == API_OPENGL) this->Const.GLSL_130 = is_desktop_gl && (ctx->Const.GLSLVersion >= 130);
&& (ctx->Const.GLSLVersion >= 130); this->Const.GLSL_140 = is_desktop_gl && (ctx->Const.GLSLVersion >= 140);
this->Const.GLSL_140 = (ctx->API == API_OPENGL)
&& (ctx->Const.GLSLVersion >= 140);
const unsigned lowest_version = const unsigned lowest_version =
(ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility (ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility
? 100 : 110; ? 100 : 110;
const unsigned highest_version = const unsigned highest_version =
(ctx->API == API_OPENGL) ? ctx->Const.GLSLVersion : 100; is_desktop_gl ? ctx->Const.GLSLVersion : 100;
char *supported = ralloc_strdup(this, ""); char *supported = ralloc_strdup(this, "");
for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) { for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) {

View File

@@ -1848,7 +1848,7 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->ColorLocation = _mesa_GetUniformLocationARB(clear->ShaderProg, clear->ColorLocation = _mesa_GetUniformLocationARB(clear->ShaderProg,
"color"); "color");
if (ctx->API == API_OPENGL && ctx->Const.GLSLVersion >= 130) { if (IS_CTX_DESKTOP_GL(ctx) && ctx->Const.GLSLVersion >= 130) {
vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source); vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source);
fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source); fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source);

View File

@@ -44,7 +44,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_draw_elements_base_vertex = true; ctx->Extensions.ARB_draw_elements_base_vertex = true;
ctx->Extensions.ARB_explicit_attrib_location = true; ctx->Extensions.ARB_explicit_attrib_location = true;
if (ctx->API == API_OPENGL) if (IS_CTX_DESKTOP_GL(ctx))
ctx->Extensions.ARB_framebuffer_object = true; ctx->Extensions.ARB_framebuffer_object = true;
ctx->Extensions.ARB_half_float_pixel = true; ctx->Extensions.ARB_half_float_pixel = true;
ctx->Extensions.ARB_map_buffer_range = true; ctx->Extensions.ARB_map_buffer_range = true;

View File

@@ -120,7 +120,7 @@
* \param exec dispatch table. * \param exec dispatch table.
*/ */
struct _glapi_table * struct _glapi_table *
_mesa_create_exec_table(void) _mesa_create_exec_table(struct gl_context *ctx)
{ {
struct _glapi_table *exec; struct _glapi_table *exec;
@@ -133,7 +133,10 @@ _mesa_create_exec_table(void)
#endif #endif
/* load the dispatch slots we understand */ /* load the dispatch slots we understand */
if (ctx->API != API_OPENGL_CORE) {
SET_AlphaFunc(exec, _mesa_AlphaFunc); SET_AlphaFunc(exec, _mesa_AlphaFunc);
}
SET_BlendFunc(exec, _mesa_BlendFunc); SET_BlendFunc(exec, _mesa_BlendFunc);
SET_Clear(exec, _mesa_Clear); SET_Clear(exec, _mesa_Clear);
SET_ClearColor(exec, _mesa_ClearColor); SET_ClearColor(exec, _mesa_ClearColor);
@@ -149,42 +152,62 @@ _mesa_create_exec_table(void)
SET_Finish(exec, _mesa_Finish); SET_Finish(exec, _mesa_Finish);
SET_Flush(exec, _mesa_Flush); SET_Flush(exec, _mesa_Flush);
SET_FrontFace(exec, _mesa_FrontFace); SET_FrontFace(exec, _mesa_FrontFace);
if (ctx->API != API_OPENGL_CORE) {
SET_Frustum(exec, _mesa_Frustum); SET_Frustum(exec, _mesa_Frustum);
}
SET_GetError(exec, _mesa_GetError); SET_GetError(exec, _mesa_GetError);
SET_GetFloatv(exec, _mesa_GetFloatv); SET_GetFloatv(exec, _mesa_GetFloatv);
SET_GetString(exec, _mesa_GetString); SET_GetString(exec, _mesa_GetString);
if (ctx->API != API_OPENGL_CORE) {
SET_LineStipple(exec, _mesa_LineStipple); SET_LineStipple(exec, _mesa_LineStipple);
}
SET_LineWidth(exec, _mesa_LineWidth); SET_LineWidth(exec, _mesa_LineWidth);
if (ctx->API != API_OPENGL_CORE) {
SET_LoadIdentity(exec, _mesa_LoadIdentity); SET_LoadIdentity(exec, _mesa_LoadIdentity);
SET_LoadMatrixf(exec, _mesa_LoadMatrixf); SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
}
SET_LogicOp(exec, _mesa_LogicOp); SET_LogicOp(exec, _mesa_LogicOp);
if (ctx->API != API_OPENGL_CORE) {
SET_MatrixMode(exec, _mesa_MatrixMode); SET_MatrixMode(exec, _mesa_MatrixMode);
SET_MultMatrixf(exec, _mesa_MultMatrixf); SET_MultMatrixf(exec, _mesa_MultMatrixf);
SET_Ortho(exec, _mesa_Ortho); SET_Ortho(exec, _mesa_Ortho);
}
SET_PixelStorei(exec, _mesa_PixelStorei); SET_PixelStorei(exec, _mesa_PixelStorei);
if (ctx->API != API_OPENGL_CORE) {
SET_PopMatrix(exec, _mesa_PopMatrix); SET_PopMatrix(exec, _mesa_PopMatrix);
SET_PushMatrix(exec, _mesa_PushMatrix); SET_PushMatrix(exec, _mesa_PushMatrix);
SET_Rotatef(exec, _mesa_Rotatef); SET_Rotatef(exec, _mesa_Rotatef);
SET_Scalef(exec, _mesa_Scalef); SET_Scalef(exec, _mesa_Scalef);
}
SET_Scissor(exec, _mesa_Scissor); SET_Scissor(exec, _mesa_Scissor);
if (ctx->API != API_OPENGL_CORE) {
SET_ShadeModel(exec, _mesa_ShadeModel); SET_ShadeModel(exec, _mesa_ShadeModel);
}
SET_StencilFunc(exec, _mesa_StencilFunc); SET_StencilFunc(exec, _mesa_StencilFunc);
SET_StencilMask(exec, _mesa_StencilMask); SET_StencilMask(exec, _mesa_StencilMask);
SET_StencilOp(exec, _mesa_StencilOp); SET_StencilOp(exec, _mesa_StencilOp);
if (ctx->API != API_OPENGL_CORE) {
SET_TexEnvfv(exec, _mesa_TexEnvfv); SET_TexEnvfv(exec, _mesa_TexEnvfv);
SET_TexEnvi(exec, _mesa_TexEnvi); SET_TexEnvi(exec, _mesa_TexEnvi);
}
SET_TexImage2D(exec, _mesa_TexImage2D); SET_TexImage2D(exec, _mesa_TexImage2D);
SET_TexParameteri(exec, _mesa_TexParameteri); SET_TexParameteri(exec, _mesa_TexParameteri);
if (ctx->API != API_OPENGL_CORE) {
SET_Translatef(exec, _mesa_Translatef); SET_Translatef(exec, _mesa_Translatef);
}
SET_Viewport(exec, _mesa_Viewport); SET_Viewport(exec, _mesa_Viewport);
if (ctx->API != API_OPENGL_CORE) {
_mesa_init_accum_dispatch(exec); _mesa_init_accum_dispatch(exec);
_mesa_init_dlist_dispatch(exec); _mesa_init_dlist_dispatch(exec);
}
SET_ClearDepth(exec, _mesa_ClearDepth); SET_ClearDepth(exec, _mesa_ClearDepth);
if (ctx->API != API_OPENGL_CORE) {
SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClearIndex(exec, _mesa_ClearIndex);
SET_ClipPlane(exec, _mesa_ClipPlane); SET_ClipPlane(exec, _mesa_ClipPlane);
SET_ColorMaterial(exec, _mesa_ColorMaterial); SET_ColorMaterial(exec, _mesa_ColorMaterial);
}
SET_DepthFunc(exec, _mesa_DepthFunc); SET_DepthFunc(exec, _mesa_DepthFunc);
SET_DepthMask(exec, _mesa_DepthMask); SET_DepthMask(exec, _mesa_DepthMask);
SET_DepthRange(exec, _mesa_DepthRange); SET_DepthRange(exec, _mesa_DepthRange);
@@ -192,15 +215,18 @@ _mesa_create_exec_table(void)
_mesa_init_drawpix_dispatch(exec); _mesa_init_drawpix_dispatch(exec);
_mesa_init_feedback_dispatch(exec); _mesa_init_feedback_dispatch(exec);
if (ctx->API != API_OPENGL_CORE) {
SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
SET_Fogf(exec, _mesa_Fogf); SET_Fogf(exec, _mesa_Fogf);
SET_Fogfv(exec, _mesa_Fogfv); SET_Fogfv(exec, _mesa_Fogfv);
SET_Fogi(exec, _mesa_Fogi); SET_Fogi(exec, _mesa_Fogi);
SET_Fogiv(exec, _mesa_Fogiv); SET_Fogiv(exec, _mesa_Fogiv);
SET_GetClipPlane(exec, _mesa_GetClipPlane); SET_GetClipPlane(exec, _mesa_GetClipPlane);
}
SET_GetBooleanv(exec, _mesa_GetBooleanv); SET_GetBooleanv(exec, _mesa_GetBooleanv);
SET_GetDoublev(exec, _mesa_GetDoublev); SET_GetDoublev(exec, _mesa_GetDoublev);
SET_GetIntegerv(exec, _mesa_GetIntegerv); SET_GetIntegerv(exec, _mesa_GetIntegerv);
if (ctx->API != API_OPENGL_CORE) {
SET_GetLightfv(exec, _mesa_GetLightfv); SET_GetLightfv(exec, _mesa_GetLightfv);
SET_GetLightiv(exec, _mesa_GetLightiv); SET_GetLightiv(exec, _mesa_GetLightiv);
SET_GetMaterialfv(exec, _mesa_GetMaterialfv); SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
@@ -208,14 +234,18 @@ _mesa_create_exec_table(void)
SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
SET_GetTexEnviv(exec, _mesa_GetTexEnviv); SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
}
SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv); SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
SET_GetTexImage(exec, _mesa_GetTexImage); SET_GetTexImage(exec, _mesa_GetTexImage);
SET_Hint(exec, _mesa_Hint); SET_Hint(exec, _mesa_Hint);
if (ctx->API != API_OPENGL_CORE) {
SET_IndexMask(exec, _mesa_IndexMask); SET_IndexMask(exec, _mesa_IndexMask);
}
SET_IsEnabled(exec, _mesa_IsEnabled); SET_IsEnabled(exec, _mesa_IsEnabled);
if (ctx->API != API_OPENGL_CORE) {
SET_LightModelf(exec, _mesa_LightModelf); SET_LightModelf(exec, _mesa_LightModelf);
SET_LightModelfv(exec, _mesa_LightModelfv); SET_LightModelfv(exec, _mesa_LightModelfv);
SET_LightModeli(exec, _mesa_LightModeli); SET_LightModeli(exec, _mesa_LightModeli);
@@ -225,10 +255,13 @@ _mesa_create_exec_table(void)
SET_Lighti(exec, _mesa_Lighti); SET_Lighti(exec, _mesa_Lighti);
SET_Lightiv(exec, _mesa_Lightiv); SET_Lightiv(exec, _mesa_Lightiv);
SET_LoadMatrixd(exec, _mesa_LoadMatrixd); SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
}
_mesa_init_eval_dispatch(exec); _mesa_init_eval_dispatch(exec);
if (ctx->API != API_OPENGL_CORE) {
SET_MultMatrixd(exec, _mesa_MultMatrixd); SET_MultMatrixd(exec, _mesa_MultMatrixd);
}
_mesa_init_pixel_dispatch(exec); _mesa_init_pixel_dispatch(exec);
@@ -236,17 +269,21 @@ _mesa_create_exec_table(void)
SET_PointSize(exec, _mesa_PointSize); SET_PointSize(exec, _mesa_PointSize);
SET_PolygonMode(exec, _mesa_PolygonMode); SET_PolygonMode(exec, _mesa_PolygonMode);
SET_PolygonOffset(exec, _mesa_PolygonOffset); SET_PolygonOffset(exec, _mesa_PolygonOffset);
if (ctx->API != API_OPENGL_CORE) {
SET_PolygonStipple(exec, _mesa_PolygonStipple); SET_PolygonStipple(exec, _mesa_PolygonStipple);
}
_mesa_init_attrib_dispatch(exec); _mesa_init_attrib_dispatch(exec);
_mesa_init_rastpos_dispatch(exec); _mesa_init_rastpos_dispatch(exec);
SET_ReadPixels(exec, _mesa_ReadPixels); SET_ReadPixels(exec, _mesa_ReadPixels);
if (ctx->API != API_OPENGL_CORE) {
SET_Rotated(exec, _mesa_Rotated); SET_Rotated(exec, _mesa_Rotated);
SET_Scaled(exec, _mesa_Scaled); SET_Scaled(exec, _mesa_Scaled);
SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
SET_TexEnvf(exec, _mesa_TexEnvf); SET_TexEnvf(exec, _mesa_TexEnvf);
SET_TexEnviv(exec, _mesa_TexEnviv); SET_TexEnviv(exec, _mesa_TexEnviv);
}
_mesa_init_texgen_dispatch(exec); _mesa_init_texgen_dispatch(exec);
@@ -254,32 +291,42 @@ _mesa_create_exec_table(void)
SET_TexParameterf(exec, _mesa_TexParameterf); SET_TexParameterf(exec, _mesa_TexParameterf);
SET_TexParameterfv(exec, _mesa_TexParameterfv); SET_TexParameterfv(exec, _mesa_TexParameterfv);
SET_TexParameteriv(exec, _mesa_TexParameteriv); SET_TexParameteriv(exec, _mesa_TexParameteriv);
if (ctx->API != API_OPENGL_CORE) {
SET_Translated(exec, _mesa_Translated); SET_Translated(exec, _mesa_Translated);
}
/* 1.1 */ /* 1.1 */
SET_BindTexture(exec, _mesa_BindTexture); SET_BindTexture(exec, _mesa_BindTexture);
SET_DeleteTextures(exec, _mesa_DeleteTextures); SET_DeleteTextures(exec, _mesa_DeleteTextures);
SET_GenTextures(exec, _mesa_GenTextures); SET_GenTextures(exec, _mesa_GenTextures);
#if _HAVE_FULL_GL #if _HAVE_FULL_GL
if (ctx->API != API_OPENGL_CORE) {
SET_AreTexturesResident(exec, _mesa_AreTexturesResident); SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
SET_ColorPointer(exec, _mesa_ColorPointer); SET_ColorPointer(exec, _mesa_ColorPointer);
}
SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D); SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D); SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D); SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D); SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
if (ctx->API != API_OPENGL_CORE) {
SET_DisableClientState(exec, _mesa_DisableClientState); SET_DisableClientState(exec, _mesa_DisableClientState);
SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer); SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
SET_EnableClientState(exec, _mesa_EnableClientState); SET_EnableClientState(exec, _mesa_EnableClientState);
SET_GetPointerv(exec, _mesa_GetPointerv); SET_GetPointerv(exec, _mesa_GetPointerv);
SET_IndexPointer(exec, _mesa_IndexPointer); SET_IndexPointer(exec, _mesa_IndexPointer);
SET_InterleavedArrays(exec, _mesa_InterleavedArrays); SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
}
SET_IsTexture(exec, _mesa_IsTexture); SET_IsTexture(exec, _mesa_IsTexture);
if (ctx->API != API_OPENGL_CORE) {
SET_NormalPointer(exec, _mesa_NormalPointer); SET_NormalPointer(exec, _mesa_NormalPointer);
SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
SET_TexCoordPointer(exec, _mesa_TexCoordPointer); SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
}
SET_TexSubImage1D(exec, _mesa_TexSubImage1D); SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
SET_TexSubImage2D(exec, _mesa_TexSubImage2D); SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
if (ctx->API != API_OPENGL_CORE) {
SET_VertexPointer(exec, _mesa_VertexPointer); SET_VertexPointer(exec, _mesa_VertexPointer);
}
#endif #endif
/* 1.2 */ /* 1.2 */
@@ -327,31 +374,37 @@ _mesa_create_exec_table(void)
/* 11. GL_EXT_histogram */ /* 11. GL_EXT_histogram */
#if 0 #if 0
if (ctx->API != API_OPENGL_CORE) {
SET_GetHistogramEXT(exec, _mesa_GetHistogram); SET_GetHistogramEXT(exec, _mesa_GetHistogram);
SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
SET_GetMinmaxEXT(exec, _mesa_GetMinmax); SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
}
#endif #endif
/* 14. SGI_color_table */ /* 14. SGI_color_table */
#if 0 #if 0
if (ctx->API != API_OPENGL_CORE) {
SET_ColorTableSGI(exec, _mesa_ColorTable); SET_ColorTableSGI(exec, _mesa_ColorTable);
SET_ColorSubTableSGI(exec, _mesa_ColorSubTable); SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
SET_GetColorTableSGI(exec, _mesa_GetColorTable); SET_GetColorTableSGI(exec, _mesa_GetColorTable);
SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv); SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv); SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
}
#endif #endif
/* 30. GL_EXT_vertex_array */ /* 30. GL_EXT_vertex_array */
#if _HAVE_FULL_GL #if _HAVE_FULL_GL
if (ctx->API != API_OPENGL_CORE) {
SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT); SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT); SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT); SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
}
#endif #endif
/* 37. GL_EXT_blend_minmax */ /* 37. GL_EXT_blend_minmax */
@@ -483,10 +536,12 @@ _mesa_create_exec_table(void)
/* ARB 3. GL_ARB_transpose_matrix */ /* ARB 3. GL_ARB_transpose_matrix */
#if _HAVE_FULL_GL #if _HAVE_FULL_GL
if (ctx->API != API_OPENGL_CORE) {
SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB); SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
}
#endif #endif
/* ARB 5. GL_ARB_multisample */ /* ARB 5. GL_ARB_multisample */

View File

@@ -28,12 +28,13 @@
struct _glapi_table; struct _glapi_table;
struct gl_context;
extern struct _glapi_table * extern struct _glapi_table *
_mesa_alloc_dispatch_table(int size); _mesa_alloc_dispatch_table(int size);
extern struct _glapi_table * extern struct _glapi_table *
_mesa_create_exec_table(void); _mesa_create_exec_table(struct gl_context *ctx);
extern struct _glapi_table * extern struct _glapi_table *
_mesa_create_exec_table_es1(void); _mesa_create_exec_table_es1(void);

View File

@@ -128,6 +128,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
#if FEATURE_GL #if FEATURE_GL
case API_OPENGL: case API_OPENGL:
case API_OPENGL_CORE:
{ {
const struct gl_shader_program *vsProg = const struct gl_shader_program *vsProg =
ctx->Shader.CurrentVertexProgram; ctx->Shader.CurrentVertexProgram;

View File

@@ -431,7 +431,7 @@ one_time_init( struct gl_context *ctx )
* when an app is linked to libGLES*, there are not enough dynamic * when an app is linked to libGLES*, there are not enough dynamic
* entries. * entries.
*/ */
if (ctx->API == API_OPENGL) if (IS_CTX_DESKTOP_GL(ctx))
_mesa_init_remap_table(); _mesa_init_remap_table();
} }
@@ -626,7 +626,7 @@ _mesa_init_constants(struct gl_context *ctx)
#endif #endif
/* Shading language version */ /* Shading language version */
if (ctx->API == API_OPENGL) { if (IS_CTX_DESKTOP_GL(ctx)) {
ctx->Const.GLSLVersion = 120; ctx->Const.GLSLVersion = 120;
_mesa_override_glsl_version(ctx); _mesa_override_glsl_version(ctx);
} }
@@ -962,7 +962,8 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) { switch (ctx->API) {
#if FEATURE_GL #if FEATURE_GL
case API_OPENGL: case API_OPENGL:
ctx->Exec = _mesa_create_exec_table(); case API_OPENGL_CORE:
ctx->Exec = _mesa_create_exec_table(ctx);
break; break;
#endif #endif
#if FEATURE_ES1 #if FEATURE_ES1
@@ -1007,6 +1008,7 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) { switch (ctx->API) {
case API_OPENGL: case API_OPENGL:
case API_OPENGL_CORE:
#if FEATURE_dlist #if FEATURE_dlist
ctx->Save = _mesa_create_save_table(); ctx->Save = _mesa_create_save_table();
if (!ctx->Save) { if (!ctx->Save) {

View File

@@ -41,7 +41,9 @@
enum { enum {
DISABLE = 0, DISABLE = 0,
GL = 1 << API_OPENGL, GLL = 1 << API_OPENGL,
GLC = 1 << API_OPENGL_CORE,
GL = (1 << API_OPENGL) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES, ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2, ES2 = 1 << API_OPENGLES2,
}; };

View File

@@ -164,10 +164,10 @@ get_framebuffer_target(struct gl_context *ctx, GLenum target)
{ {
switch (target) { switch (target) {
case GL_DRAW_FRAMEBUFFER: case GL_DRAW_FRAMEBUFFER:
return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL return ctx->Extensions.EXT_framebuffer_blit && IS_CTX_DESKTOP_GL(ctx)
? ctx->DrawBuffer : NULL; ? ctx->DrawBuffer : NULL;
case GL_READ_FRAMEBUFFER: case GL_READ_FRAMEBUFFER:
return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL return ctx->Extensions.EXT_framebuffer_blit && IS_CTX_DESKTOP_GL(ctx)
? ctx->ReadBuffer : NULL; ? ctx->ReadBuffer : NULL;
case GL_FRAMEBUFFER_EXT: case GL_FRAMEBUFFER_EXT:
return ctx->DrawBuffer; return ctx->DrawBuffer;
@@ -221,7 +221,7 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
} }
return &fb->Attachment[BUFFER_COLOR0 + i]; return &fb->Attachment[BUFFER_COLOR0 + i];
case GL_DEPTH_STENCIL_ATTACHMENT: case GL_DEPTH_STENCIL_ATTACHMENT:
if (ctx->API != API_OPENGL) if (!IS_CTX_DESKTOP_GL(ctx))
return NULL; return NULL;
/* fall-through */ /* fall-through */
case GL_DEPTH_ATTACHMENT_EXT: case GL_DEPTH_ATTACHMENT_EXT:
@@ -817,7 +817,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
} }
#if FEATURE_GL #if FEATURE_GL
if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) { if (IS_CTX_DESKTOP_GL(ctx) && !ctx->Extensions.ARB_ES2_compatibility) {
/* Check that all DrawBuffers are present */ /* Check that all DrawBuffers are present */
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) { for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
if (fb->ColorDrawBuffer[j] != GL_NONE) { if (fb->ColorDrawBuffer[j] != GL_NONE) {
@@ -2289,7 +2289,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
ASSERT_OUTSIDE_BEGIN_END(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx);
/* The error differs in GL and GLES. */ /* The error differs in GL and GLES. */
err = ctx->API == API_OPENGL ? GL_INVALID_OPERATION : GL_INVALID_ENUM; err = IS_CTX_DESKTOP_GL(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
buffer = get_framebuffer_target(ctx, target); buffer = get_framebuffer_target(ctx, target);
if (!buffer) { if (!buffer) {
@@ -2309,7 +2309,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
* OES_framebuffer_object spec refers to the EXT_framebuffer_object * OES_framebuffer_object spec refers to the EXT_framebuffer_object
* spec. * spec.
*/ */
if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object) { if (!IS_CTX_DESKTOP_GL(ctx) || !ctx->Extensions.ARB_framebuffer_object) {
_mesa_error(ctx, GL_INVALID_OPERATION, _mesa_error(ctx, GL_INVALID_OPERATION,
"glGetFramebufferAttachmentParameteriv(bound FBO = 0)"); "glGetFramebufferAttachmentParameteriv(bound FBO = 0)");
return; return;
@@ -2357,7 +2357,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
} }
else { else {
assert(att->Type == GL_NONE); assert(att->Type == GL_NONE);
if (ctx->API == API_OPENGL) { if (IS_CTX_DESKTOP_GL(ctx)) {
*params = 0; *params = 0;
} else { } else {
_mesa_error(ctx, GL_INVALID_ENUM, _mesa_error(ctx, GL_INVALID_ENUM,

View File

@@ -391,6 +391,7 @@ extra_NV_read_buffer_api_gl[] = {
#define API_OPENGL_BIT (1 << API_OPENGL) #define API_OPENGL_BIT (1 << API_OPENGL)
#define API_OPENGLES_BIT (1 << API_OPENGLES) #define API_OPENGLES_BIT (1 << API_OPENGLES)
#define API_OPENGLES2_BIT (1 << API_OPENGLES2) #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 /* This is the big table describing all the enums we accept in
* glGet*v(). The table is partitioned into six parts: enums * 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[] = { static const struct value_desc values[] = {
/* Enums shared between OpenGL, GLES1 and GLES2 */ /* Enums shared between OpenGL, GLES1 and GLES2 */
{ 0, 0, TYPE_API_MASK, { 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_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
{ GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA }, { GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
{ GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), 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 #if FEATURE_GL || FEATURE_ES1
/* Enums in OpenGL and GLES1 */ /* 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_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights), NO_EXTRA },
{ GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA }, { GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA },
{ GL_LIGHT1, CONTEXT_BOOL(Light.Light[1].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 #if FEATURE_GL
/* Remaining enums are only in OpenGL */ /* 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_RED_BITS, BUFFER_INT(Visual.accumRedBits), NO_EXTRA },
{ GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA }, { GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA },
{ GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits), 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; break;
case EXTRA_API_GL: case EXTRA_API_GL:
if (ctx->API == API_OPENGL) { if (IS_CTX_DESKTOP_GL(ctx)) {
total++; total++;
enabled++; enabled++;
} }

View File

@@ -41,6 +41,7 @@ shading_language_version(struct gl_context *ctx)
{ {
switch (ctx->API) { switch (ctx->API) {
case API_OPENGL: case API_OPENGL:
case API_OPENGL_CORE:
if (!ctx->Extensions.ARB_shader_objects) { if (!ctx->Extensions.ARB_shader_objects) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetString"); _mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
return (const GLubyte *) 0; return (const GLubyte *) 0;

View File

@@ -3336,9 +3336,14 @@ typedef enum
{ {
API_OPENGL, API_OPENGL,
API_OPENGLES, API_OPENGLES,
API_OPENGLES2 API_OPENGLES2,
API_OPENGL_CORE,
} gl_api; } gl_api;
#define IS_CTX_IN2(ctx, api1, api2) ((ctx->API == api1) || (ctx->API == api2))
#define IS_CTX_DESKTOP_GL(ctx) IS_CTX_IN2(ctx, API_OPENGL, API_OPENGL_CORE)
#define IS_CTX_GLES(ctx) IS_CTX_IN2(ctx, API_OPENGLES, API_OPENGLES2)
/** /**
* Driver-specific state flags. * Driver-specific state flags.
* *

View File

@@ -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). /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
*/ */
if (ctx->API != API_OPENGL) { if (IS_CTX_GLES(ctx)) {
switch (internalFormat) { switch (internalFormat) {
case GL_BGRA: case GL_BGRA:
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);

View File

@@ -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). /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
*/ */
if (ctx->API != API_OPENGL) { if (IS_CTX_GLES(ctx)) {
switch (internalFormat) { switch (internalFormat) {
case GL_BGRA: case GL_BGRA:
return GL_RGBA; return GL_RGBA;

View File

@@ -92,7 +92,7 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
case GL_DOUBLE: case GL_DOUBLE:
return DOUBLE_BIT; return DOUBLE_BIT;
case GL_FIXED: case GL_FIXED:
return ctx->API == API_OPENGL ? FIXED_GL_BIT : FIXED_ES_BIT; return (IS_CTX_DESKTOP_GL(ctx)) ? FIXED_GL_BIT : FIXED_ES_BIT;
case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_2_10_10_10_REV:
return UNSIGNED_INT_2_10_10_10_REV_BIT; return UNSIGNED_INT_2_10_10_10_REV_BIT;
case GL_INT_2_10_10_10_REV: case GL_INT_2_10_10_10_REV:

View File

@@ -315,6 +315,7 @@ _mesa_compute_version(struct gl_context *ctx)
switch (ctx->API) { switch (ctx->API) {
case API_OPENGL: case API_OPENGL:
case API_OPENGL_CORE:
compute_version(ctx); compute_version(ctx);
break; break;
case API_OPENGLES: case API_OPENGLES:

View File

@@ -45,18 +45,22 @@
* API dispatch table. * API dispatch table.
*/ */
static void static void
install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
const GLvertexformat *vfmt)
{ {
_mesa_install_arrayelt_vtxfmt(tab, vfmt); _mesa_install_arrayelt_vtxfmt(tab, vfmt);
if (ctx->API != API_OPENGL_CORE) {
SET_Color3f(tab, vfmt->Color3f); SET_Color3f(tab, vfmt->Color3f);
SET_Color3fv(tab, vfmt->Color3fv); SET_Color3fv(tab, vfmt->Color3fv);
SET_Color4f(tab, vfmt->Color4f); SET_Color4f(tab, vfmt->Color4f);
SET_Color4fv(tab, vfmt->Color4fv); SET_Color4fv(tab, vfmt->Color4fv);
SET_EdgeFlag(tab, vfmt->EdgeFlag); SET_EdgeFlag(tab, vfmt->EdgeFlag);
}
_mesa_install_eval_vtxfmt(tab, vfmt); _mesa_install_eval_vtxfmt(tab, vfmt);
if (ctx->API != API_OPENGL_CORE) {
SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT); SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT); SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
SET_Indexf(tab, vfmt->Indexf); SET_Indexf(tab, vfmt->Indexf);
@@ -88,14 +92,17 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_Vertex3fv(tab, vfmt->Vertex3fv); SET_Vertex3fv(tab, vfmt->Vertex3fv);
SET_Vertex4f(tab, vfmt->Vertex4f); SET_Vertex4f(tab, vfmt->Vertex4f);
SET_Vertex4fv(tab, vfmt->Vertex4fv); SET_Vertex4fv(tab, vfmt->Vertex4fv);
}
_mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */ _mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
if (ctx->API != API_OPENGL_CORE) {
SET_Begin(tab, vfmt->Begin); SET_Begin(tab, vfmt->Begin);
SET_End(tab, vfmt->End); SET_End(tab, vfmt->End);
SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV); SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
SET_Rectf(tab, vfmt->Rectf); SET_Rectf(tab, vfmt->Rectf);
}
SET_DrawArrays(tab, vfmt->DrawArrays); SET_DrawArrays(tab, vfmt->DrawArrays);
SET_DrawElements(tab, vfmt->DrawElements); SET_DrawElements(tab, vfmt->DrawElements);
@@ -154,6 +161,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv); SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv);
SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv); SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
if (ctx->API != API_OPENGL_CORE) {
/* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */ /* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
SET_VertexP2ui(tab, vfmt->VertexP2ui); SET_VertexP2ui(tab, vfmt->VertexP2ui);
SET_VertexP2uiv(tab, vfmt->VertexP2uiv); SET_VertexP2uiv(tab, vfmt->VertexP2uiv);
@@ -190,6 +198,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_SecondaryColorP3ui(tab, vfmt->SecondaryColorP3ui); SET_SecondaryColorP3ui(tab, vfmt->SecondaryColorP3ui);
SET_SecondaryColorP3uiv(tab, vfmt->SecondaryColorP3uiv); SET_SecondaryColorP3uiv(tab, vfmt->SecondaryColorP3uiv);
}
SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui); SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui);
SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui); SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui);
@@ -209,8 +218,8 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
void void
_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{ {
if (ctx->API == API_OPENGL) if (IS_CTX_DESKTOP_GL(ctx))
install_vtxfmt( ctx->Exec, vfmt ); install_vtxfmt( ctx, ctx->Exec, vfmt );
} }
@@ -221,8 +230,8 @@ _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
void void
_mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) _mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{ {
if (ctx->API == API_OPENGL) if (IS_CTX_DESKTOP_GL(ctx))
install_vtxfmt( ctx->Save, vfmt ); install_vtxfmt( ctx, ctx->Save, vfmt );
} }