From 69e07bdeb42f2454f5052f86119adfb68f253098 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 7 Mar 2009 11:53:18 -0700 Subject: [PATCH] mesa: remove GL_MESA_program_debug extension This was never fully fleshed out and hasn't been used. --- docs/MESA_shader_debug.spec | 2 +- src/mesa/SConscript | 1 - src/mesa/drivers/common/driverfuncs.c | 3 - src/mesa/drivers/dri/tdfx/tdfx_context.c | 4 - src/mesa/drivers/glide/fxdd.c | 1 - src/mesa/main/dd.h | 3 - src/mesa/main/enable.c | 22 -- src/mesa/main/extensions.c | 4 - src/mesa/main/ffvertex_prog.c | 1 - src/mesa/main/get.c | 48 ----- src/mesa/main/get_gen.py | 10 - src/mesa/main/getstring.c | 30 --- src/mesa/main/mfeatures.h | 1 - src/mesa/main/mtypes.h | 15 -- src/mesa/shader/arbprogparse.c | 9 - src/mesa/shader/nvfragparse.c | 4 - src/mesa/shader/nvvertparse.c | 7 - src/mesa/shader/prog_debug.c | 255 ----------------------- src/mesa/shader/prog_debug.h | 44 ---- src/mesa/shader/prog_execute.c | 41 ---- src/mesa/shader/prog_instruction.h | 5 - src/mesa/sources.mak | 1 - src/mesa/swrast/swrast.h | 6 - 23 files changed, 1 insertion(+), 516 deletions(-) delete mode 100644 src/mesa/shader/prog_debug.c delete mode 100644 src/mesa/shader/prog_debug.h diff --git a/docs/MESA_shader_debug.spec b/docs/MESA_shader_debug.spec index 1f7d42ac914..fab92abc762 100644 --- a/docs/MESA_shader_debug.spec +++ b/docs/MESA_shader_debug.spec @@ -13,7 +13,7 @@ Contact Status - XXX - Not complete yet!!! + Obsolete. Version diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 273ce112806..2e0168e0bc7 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -189,7 +189,6 @@ if env['platform'] != 'winddk': 'shader/nvvertparse.c', 'shader/program.c', 'shader/prog_cache.c', - 'shader/prog_debug.c', 'shader/prog_execute.c', 'shader/prog_instruction.c', 'shader/prog_noise.c', diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 9bee212c6a3..44adaf86828 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -134,9 +134,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->BindProgram = NULL; driver->NewProgram = _mesa_new_program; driver->DeleteProgram = _mesa_delete_program; -#if FEATURE_MESA_program_debug - driver->GetProgramRegister = _mesa_get_program_register; -#endif /* FEATURE_MESA_program_debug */ /* simple state commands */ driver->AlphaFunc = NULL; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 20046fcb3af..68b5027561b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -67,7 +67,6 @@ #define need_GL_EXT_fog_coord #define need_GL_EXT_paletted_texture /* #define need_GL_EXT_secondary_color */ -/* #define need_GL_MESA_program_debug */ /* #define need_GL_NV_vertex_program */ #include "extension_helper.h" @@ -101,9 +100,6 @@ const struct dri_extension card_extensions[] = #ifdef need_GL_NV_vertex_program { "GL_NV_vertex_program", GL_NV_vertex_program_functions } { "GL_NV_vertex_program1_1", NULL }, -#endif -#ifdef need_GL_MESA_program_debug - { "GL_MESA_program_debug", GL_MESA_program_debug_functions }, #endif { NULL, NULL } }; diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 1bcf2512a63..2bc60399ea2 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1922,7 +1922,6 @@ fxDDInitExtensions(GLcontext * ctx) _mesa_enable_extension(ctx, "GL_ARB_vertex_program"); _mesa_enable_extension(ctx, "GL_NV_vertex_program"); _mesa_enable_extension(ctx, "GL_NV_vertex_program1_1"); - _mesa_enable_extension(ctx, "GL_MESA_program_debug"); } #if 0 /* this requires _tnl_vertex_cull_stage in the pipeline */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index a335f77479d..d994401e55f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -602,9 +602,6 @@ struct dd_function_table { /** Notify driver that a program string has been specified. */ void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, struct gl_program *prog); - /** Get value of a program register during program execution. */ - void (*GetProgramRegister)(GLcontext *ctx, enum register_file file, - GLuint index, GLfloat val[4]); /** Query if program can be loaded onto hardware */ GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index a824705bdcc..f432be183cb 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -944,18 +944,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) ctx->Depth.BoundsTest = state; break; - /* GL_MESA_program_debug */ -#if FEATURE_MESA_program_debug - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug, cap); - ctx->FragmentProgram.CallbackEnabled = state; - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug, cap); - ctx->VertexProgram.CallbackEnabled = state; - break; -#endif - #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader, cap); @@ -1398,16 +1386,6 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(EXT_depth_bounds_test); return ctx->Depth.BoundsTest; - /* GL_MESA_program_debug */ -#if FEATURE_MESA_program_debug - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug); - return ctx->FragmentProgram.CallbackEnabled; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXTENSION(MESA_program_debug); - return ctx->VertexProgram.CallbackEnabled; -#endif - #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 9c8bd13e692..fbca924ad3d 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -147,7 +147,6 @@ static const struct { { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) }, { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) }, - { OFF, "GL_MESA_program_debug", F(MESA_program_debug) }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, { OFF, "GL_MESA_texture_array", F(MESA_texture_array) }, { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, @@ -276,9 +275,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/ ctx->Extensions.MESA_pack_invert = GL_TRUE; -#if FEATURE_MESA_program_debug - ctx->Extensions.MESA_program_debug = GL_TRUE; -#endif ctx->Extensions.MESA_resize_buffers = GL_TRUE; ctx->Extensions.MESA_texture_array = GL_TRUE; ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 42c8cc97c08..72b880e28ee 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -655,7 +655,6 @@ static void emit_op3fn(struct tnl_program *p, inst = &p->program->Base.Instructions[nr]; inst->Opcode = (enum prog_opcode) op; - inst->StringPos = 0; inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 3a8d56140f5..0937fd053c5 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1715,22 +1715,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin); params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax); break; - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = ctx->FragmentProgram.CallbackEnabled; - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = ctx->VertexProgram.CallbackEnabled; - break; - case GL_FRAGMENT_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition); - break; - case GL_VERTEX_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition); - break; case GL_MAX_DRAW_BUFFERS_ARB: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers); break; @@ -3541,22 +3525,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Depth.BoundsMin; params[1] = ctx->Depth.BoundsMax; break; - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled); - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled); - break; - case GL_FRAGMENT_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition); - break; - case GL_VERTEX_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetFloatv"); - params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition); - break; case GL_MAX_DRAW_BUFFERS_ARB: params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers); break; @@ -5367,22 +5335,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Depth.BoundsMin); params[1] = IROUND(ctx->Depth.BoundsMax); break; - case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled); - break; - case GL_VERTEX_PROGRAM_CALLBACK_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled); - break; - case GL_FRAGMENT_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = ctx->FragmentProgram.CurrentPosition; - break; - case GL_VERTEX_PROGRAM_POSITION_MESA: - CHECK_EXT1(MESA_program_debug, "GetIntegerv"); - params[0] = ctx->VertexProgram.CurrentPosition; - break; case GL_MAX_DRAW_BUFFERS_ARB: params[0] = ctx->Const.MaxDrawBuffers; break; diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 729f382b4b1..fa695c48f1a 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -902,16 +902,6 @@ StateVars = [ ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"], "", ["EXT_depth_bounds_test"] ), - # GL_MESA_program_debug - ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean, - ["ctx->FragmentProgram.CallbackEnabled"], "", ["MESA_program_debug"] ), - ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean, - ["ctx->VertexProgram.CallbackEnabled"], "", ["MESA_program_debug"] ), - ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint, - ["ctx->FragmentProgram.CurrentPosition"], "", ["MESA_program_debug"] ), - ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint, - ["ctx->VertexProgram.CurrentPosition"], "", ["MESA_program_debug"] ), - # GL_ARB_draw_buffers ( "GL_MAX_DRAW_BUFFERS_ARB", GLint, ["ctx->Const.MaxDrawBuffers"], "", None ), diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index a42c44686dd..41fd786d7d5 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -242,36 +242,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_SELECTION_BUFFER_POINTER: *params = ctx->Select.Buffer; break; -#if FEATURE_MESA_program_debug - case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = *(GLvoid **) &ctx->FragmentProgram.Callback; - break; - case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = ctx->FragmentProgram.CallbackData; - break; - case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = *(GLvoid **) &ctx->VertexProgram.Callback; - break; - case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA: - if (!ctx->Extensions.MESA_program_debug) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); - return; - } - *params = ctx->VertexProgram.CallbackData; - break; -#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); return; diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 8fb32dd7e94..f5706479423 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -75,7 +75,6 @@ #define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL #define FEATURE_EXT_timer_query _HAVE_FULL_GL #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL -#define FEATURE_MESA_program_debug _HAVE_FULL_GL #define FEATURE_NV_fence _HAVE_FULL_GL #define FEATURE_NV_fragment_program _HAVE_FULL_GL #define FEATURE_NV_vertex_program _HAVE_FULL_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index baf5850b83b..17f6241e04e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1856,13 +1856,6 @@ struct gl_vertex_program_state /** Cache of fixed-function programs */ struct gl_program_cache *Cache; -#if FEATURE_MESA_program_debug - GLprogramcallbackMESA Callback; - GLvoid *CallbackData; - GLboolean CallbackEnabled; - GLuint CurrentPosition; -#endif - GLboolean _Overriden; }; @@ -1892,13 +1885,6 @@ struct gl_fragment_program_state /** Cache of fixed-function programs */ struct gl_program_cache *Cache; - -#if FEATURE_MESA_program_debug - GLprogramcallbackMESA Callback; - GLvoid *CallbackData; - GLboolean CallbackEnabled; - GLuint CurrentPosition; -#endif }; @@ -2502,7 +2488,6 @@ struct gl_extensions GLboolean IBM_multimode_draw_arrays; GLboolean MESA_pack_invert; GLboolean MESA_packed_depth_stencil; - GLboolean MESA_program_debug; GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; GLboolean MESA_texture_array; diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index ccc0318a53f..75398cda903 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2752,9 +2752,6 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, _mesa_init_instructions(fp, 1); - /* Record the position in the program string for debugging */ - fp->StringPos = Program->Position; - /* OP_ALU_INST or OP_TEX_INST */ instClass = *(*inst)++; @@ -3194,8 +3191,6 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, code = *(*inst)++; _mesa_init_instructions(vp, 1); - /* Record the position in the program string for debugging */ - vp->StringPos = Program->Position; switch (type) { /* XXX: */ @@ -3557,10 +3552,6 @@ parse_instructions(GLcontext * ctx, const GLubyte * inst, const GLuint numInst = Program->Base.NumInstructions; _mesa_init_instructions(Program->Base.Instructions + numInst, 1); Program->Base.Instructions[numInst].Opcode = OPCODE_END; - /* YYY Wrong Position in program, whatever, at least not random -> crash - Program->Position = parse_position (&inst); - */ - Program->Base.Instructions[numInst].StringPos = Program->Position; } Program->Base.NumInstructions++; diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 37418ffb6ef..b935cb562a6 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -1311,8 +1311,6 @@ Parse_InstructionSequence(struct parse_state *parseState, } else if (Parse_String(parseState, "END")) { inst->Opcode = OPCODE_END; - inst->StringPos = parseState->curLine - parseState->start; - assert(inst->StringPos >= 0); parseState->numInst++; if (Parse_Token(parseState, token)) { RETURN_ERROR1("Code after END opcode."); @@ -1339,8 +1337,6 @@ Parse_InstructionSequence(struct parse_state *parseState, inst->SaturateMode = (instMatch.suffixes & (_S)) ? SATURATE_ZERO_ONE : SATURATE_OFF; inst->CondUpdate = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE; - inst->StringPos = parseState->curLine - parseState->start; - assert(inst->StringPos >= 0); /* * parse the input and output operands diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 08538c0ee4f..268b577aec9 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -799,7 +799,6 @@ Parse_UnaryOpInstruction(struct parse_state *parseState, RETURN_ERROR1("ABS illegal for vertex program 1.0"); inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -832,7 +831,6 @@ Parse_BiOpInstruction(struct parse_state *parseState, RETURN_ERROR1("SUB illegal for vertex program 1.0"); inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -880,7 +878,6 @@ Parse_TriOpInstruction(struct parse_state *parseState, enum prog_opcode opcode) { inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -951,7 +948,6 @@ Parse_ScalarInstruction(struct parse_state *parseState, RETURN_ERROR1("RCC illegal for vertex program 1.0"); inst->Opcode = opcode; - inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) @@ -977,7 +973,6 @@ static GLboolean Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst) { inst->Opcode = OPCODE_ARL; - inst->StringPos = parseState->curLine - parseState->start; /* Make ARB_vp backends happy */ inst->DstReg.File = PROGRAM_ADDRESS; @@ -1010,7 +1005,6 @@ Parse_EndInstruction(struct parse_state *parseState, struct prog_instruction *in GLubyte token[100]; inst->Opcode = OPCODE_END; - inst->StringPos = parseState->curLine - parseState->start; /* this should fail! */ if (Parse_Token(parseState, token)) @@ -1044,7 +1038,6 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction * GLint idx; inst->Opcode = OPCODE_PRINT; - inst->StringPos = parseState->curLine - parseState->start; /* The first argument is a literal string 'just like this' */ if (!Parse_String(parseState, "'")) diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c deleted file mode 100644 index 35ce37d5ce0..00000000000 --- a/src/mesa/shader/prog_debug.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "nvfragparse.h" -#include "nvvertparse.h" -#include "program.h" -#include "prog_debug.h" -#include "prog_parameter.h" -#include "prog_instruction.h" - - - -/** - * Functions for the experimental GL_MESA_program_debug extension. - */ - - -/* XXX temporary */ -GLAPI void GLAPIENTRY -glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data) -{ - _mesa_ProgramCallbackMESA(target, callback, data); -} - - -void -_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data) -{ - GET_CURRENT_CONTEXT(ctx); - - switch (target) { - case GL_FRAGMENT_PROGRAM_ARB: - if (!ctx->Extensions.ARB_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->FragmentProgram.Callback = callback; - ctx->FragmentProgram.CallbackData = data; - break; - case GL_FRAGMENT_PROGRAM_NV: - if (!ctx->Extensions.NV_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->FragmentProgram.Callback = callback; - ctx->FragmentProgram.CallbackData = data; - break; - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - if (!ctx->Extensions.ARB_vertex_program && - !ctx->Extensions.NV_vertex_program) { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } - ctx->VertexProgram.Callback = callback; - ctx->VertexProgram.CallbackData = data; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); - return; - } -} - - -/* XXX temporary */ -GLAPI void GLAPIENTRY -glGetProgramRegisterfvMESA(GLenum target, - GLsizei len, const GLubyte *registerName, - GLfloat *v) -{ - _mesa_GetProgramRegisterfvMESA(target, len, registerName, v); -} - - -void -_mesa_GetProgramRegisterfvMESA(GLenum target, - GLsizei len, const GLubyte *registerName, - GLfloat *v) -{ - char reg[1000]; - GET_CURRENT_CONTEXT(ctx); - - /* We _should_ be inside glBegin/glEnd */ -#if 0 - if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); - return; - } -#endif - - /* make null-terminated copy of registerName */ - len = MIN2((unsigned int) len, sizeof(reg) - 1); - _mesa_memcpy(reg, registerName, len); - reg[len] = 0; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - if (!ctx->Extensions.ARB_vertex_program && - !ctx->Extensions.NV_vertex_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->VertexProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - /* GL_NV_vertex_program */ - if (reg[0] == 'R') { - /* Temp register */ - GLint i = _mesa_atoi(reg + 1); - if (i >= (GLint)ctx->Const.VertexProgram.MaxTemps) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - ctx->Driver.GetProgramRegister(ctx, PROGRAM_TEMPORARY, i, v); - } - else if (reg[0] == 'v' && reg[1] == '[') { - /* Vertex Input attribute */ - GLuint i; - for (i = 0; i < ctx->Const.VertexProgram.MaxAttribs; i++) { - const char *name = _mesa_nv_vertex_input_register_name(i); - char number[10]; - _mesa_sprintf(number, "%d", i); - if (_mesa_strncmp(reg + 2, name, 4) == 0 || - _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { - ctx->Driver.GetProgramRegister(ctx, PROGRAM_INPUT, i, v); - return; - } - } - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - else if (reg[0] == 'o' && reg[1] == '[') { - /* Vertex output attribute */ - } - /* GL_ARB_vertex_program */ - else if (_mesa_strncmp(reg, "vertex.", 7) == 0) { - - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - break; - case GL_FRAGMENT_PROGRAM_ARB: - if (!ctx->Extensions.ARB_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->FragmentProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - /* XXX to do */ - break; - case GL_FRAGMENT_PROGRAM_NV: - if (!ctx->Extensions.NV_fragment_program) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } - if (!ctx->FragmentProgram._Enabled) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetProgramRegisterfvMESA"); - return; - } - if (reg[0] == 'R') { - /* Temp register */ - GLint i = _mesa_atoi(reg + 1); - if (i >= (GLint)ctx->Const.FragmentProgram.MaxTemps) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - ctx->Driver.GetProgramRegister(ctx, PROGRAM_TEMPORARY, - i, v); - } - else if (reg[0] == 'f' && reg[1] == '[') { - /* Fragment input attribute */ - GLuint i; - for (i = 0; i < ctx->Const.FragmentProgram.MaxAttribs; i++) { - const char *name = _mesa_nv_fragment_input_register_name(i); - if (_mesa_strncmp(reg + 2, name, 4) == 0) { - ctx->Driver.GetProgramRegister(ctx, PROGRAM_INPUT, i, v); - return; - } - } - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - else if (_mesa_strcmp(reg, "o[COLR]") == 0 || - _mesa_strcmp(reg, "o[COLH]") == 0) { - /* Fragment output color */ - ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_COLOR, v); - } - else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { - /* Fragment output depth */ - ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_DEPTH, v); - } - else { - /* try user-defined identifiers */ - const GLfloat *value = _mesa_lookup_parameter_value( - ctx->FragmentProgram.Current->Base.Parameters, -1, reg); - if (value) { - COPY_4V(v, value); - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetProgramRegisterfvMESA(registerName)"); - return; - } - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetProgramRegisterfvMESA(target)"); - return; - } -} diff --git a/src/mesa/shader/prog_debug.h b/src/mesa/shader/prog_debug.h deleted file mode 100644 index fc400e19de1..00000000000 --- a/src/mesa/shader/prog_debug.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef PROG_DEBUG_H -#define PROG_DEBUG_H 1 - - -/* - * GL_MESA_program_debug - */ - -extern void -_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, - GLvoid *data); - -extern void -_mesa_GetProgramRegisterfvMESA(GLenum target, GLsizei len, - const GLubyte *registerName, GLfloat *v); - - - -#endif /* PROG_DEBUG_H */ diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index a93733c0852..a60cda674ba 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -186,30 +186,6 @@ get_dst_register_pointer(const struct prog_dst_register *dest, -#if FEATURE_MESA_program_debug -static struct gl_program_machine *CurrentMachine = NULL; - -/** - * For GL_MESA_program_debug. - * Return current value (4*GLfloat) of a program register. - * Called via ctx->Driver.GetProgramRegister(). - */ -void -_mesa_get_program_register(GLcontext *ctx, enum register_file file, - GLuint index, GLfloat val[4]) -{ - if (CurrentMachine) { - struct prog_src_register srcReg; - const GLfloat *src; - srcReg.File = file; - srcReg.Index = index; - src = get_src_register_pointer(&srcReg, CurrentMachine); - COPY_4V(val, src); - } -} -#endif /* FEATURE_MESA_program_debug */ - - /** * Fetch a 4-element float vector from the given source register. * Apply swizzling and negating as needed. @@ -633,10 +609,6 @@ _mesa_execute_program(GLcontext * ctx, printf("execute program %u --------------------\n", program->Id); } -#if FEATURE_MESA_program_debug - CurrentMachine = machine; -#endif - if (program->Target == GL_VERTEX_PROGRAM_ARB) { machine->EnvParams = ctx->VertexProgram.Parameters; } @@ -647,15 +619,6 @@ _mesa_execute_program(GLcontext * ctx, for (pc = 0; pc < numInst; pc++) { const struct prog_instruction *inst = program->Instructions + pc; -#if FEATURE_MESA_program_debug - if (ctx->FragmentProgram.CallbackEnabled && - ctx->FragmentProgram.Callback) { - ctx->FragmentProgram.CurrentPosition = inst->StringPos; - ctx->FragmentProgram.Callback(program->Target, - ctx->FragmentProgram.CallbackData); - } -#endif - if (DEBUG_PROG) { _mesa_print_instruction(inst); } @@ -1780,9 +1743,5 @@ _mesa_execute_program(GLcontext * ctx, } /* for pc */ -#if FEATURE_MESA_program_debug - CurrentMachine = NULL; -#endif - return GL_TRUE; } diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 95dd7fda7f4..4adce11f957 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -421,11 +421,6 @@ struct prog_instruction /** for driver use (try to remove someday) */ GLint Aux; - - /* XXX obsolete - remove someday */ -#if FEATURE_MESA_program_debug - GLshort StringPos; -#endif }; diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 08ba345009b..d8d48476e81 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -220,7 +220,6 @@ SHADER_SOURCES = \ shader/nvvertparse.c \ shader/program.c \ shader/prog_cache.c \ - shader/prog_debug.c \ shader/prog_execute.c \ shader/prog_instruction.c \ shader/prog_noise.c \ diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 015f8a05c3e..c319ca62f9c 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -266,12 +266,6 @@ extern void _swrast_eject_texture_images(GLcontext *ctx); -#if FEATURE_MESA_program_debug -extern void -_swrast_get_program_register(GLcontext *, enum register_file file, - GLuint index, GLfloat val[4]); -#endif /* FEATURE_MESA_program_debug */ - /** * The driver interface for the software rasterizer. -- 2.30.2