summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/arbprogparse.c9
-rw-r--r--src/mesa/shader/nvfragparse.c4
-rw-r--r--src/mesa/shader/nvvertparse.c7
-rw-r--r--src/mesa/shader/prog_debug.c255
-rw-r--r--src/mesa/shader/prog_debug.h44
-rw-r--r--src/mesa/shader/prog_execute.c41
-rw-r--r--src/mesa/shader/prog_instruction.h5
7 files changed, 0 insertions, 365 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index ccc0318a53..75398cda90 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 37418ffb6e..b935cb562a 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 08538c0ee4..268b577aec 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 35ce37d5ce..0000000000
--- 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 fc400e19de..0000000000
--- 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 a93733c085..a60cda674b 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 95dd7fda7f..4adce11f95 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
};