On 07/27/2012 12:43 AM, Jordan Justen wrote:
Signed-off-by: Jordan Justen<jordan.l.jus...@intel.com>
---
src/mesa/main/api_exec.c | 227 ++++++++++++++++++++++++++++------------------
src/mesa/main/api_exec.h | 3 +-
src/mesa/main/context.c | 2 +-
src/mesa/main/vtxfmt.c | 167 ++++++++++++++++++----------------
4 files changed, 232 insertions(+), 167 deletions(-)
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 19e7f98..81be46d 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -120,7 +120,7 @@
* \param exec dispatch table.
*/
struct _glapi_table *
-_mesa_create_exec_table(void)
+_mesa_create_exec_table(struct gl_context *ctx)
{
struct _glapi_table *exec;
@@ -133,7 +133,10 @@ _mesa_create_exec_table(void)
#endif
/* load the dispatch slots we understand */
- SET_AlphaFunc(exec, _mesa_AlphaFunc);
+ if (ctx->API != API_OPENGL_CORE) {
+ SET_AlphaFunc(exec, _mesa_AlphaFunc);
+ }
+
SET_BlendFunc(exec, _mesa_BlendFunc);
SET_Clear(exec, _mesa_Clear);
SET_ClearColor(exec, _mesa_ClearColor);
@@ -149,42 +152,62 @@ _mesa_create_exec_table(void)
SET_Finish(exec, _mesa_Finish);
SET_Flush(exec, _mesa_Flush);
SET_FrontFace(exec, _mesa_FrontFace);
- SET_Frustum(exec, _mesa_Frustum);
+ if (ctx->API != API_OPENGL_CORE) {
+ SET_Frustum(exec, _mesa_Frustum);
+ }
So, if you're not plugging functions into these dispatch pointers, the
default is the "no op" function in the dispatcher module which print a
warning message about calling an invalid function.
But the GL 3.2 spec says "Functions which have been removed will
generate an INVALID_OPERATION error if called in the core profile or
in a forward-compatible context."
So I think we actually need to plug in a "invalid operation" stub
function instead. Something like this:
void GLAPIENTRY
_mesa_invalid_function(void)
{
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_INVALID_OPERATION,
"Calling legacy function from core profile");
}
[...]
if (ctx->API == API_OPENGL_CORE) {
SET_Frustum(exec, _mesa_invalid_function);
}
else {
SET_Frustum(exec, _mesa_Frustum);
}
But it might be simplest to have a function that simply plugs the
_mesa_invalid_function into all the relevant dispatch slots when a
core profile context is created. It would be called both for the
"exec" the "dlist" dispatch tables. Then we could leave the
api_exec.c code mostly as-is.
-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev