aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/SConscript3
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/de.po4
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/es.po5
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po4
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po4
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/options.h10
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po5
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h5
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c1
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.c31
-rw-r--r--mesalib/src/mesa/main/api_exec.c47
-rw-r--r--mesalib/src/mesa/main/api_validate.c2
-rw-r--r--mesalib/src/mesa/main/arbprogram.c112
-rw-r--r--mesalib/src/mesa/main/arrayobj.c2
-rw-r--r--mesalib/src/mesa/main/arrayobj.h12
-rw-r--r--mesalib/src/mesa/main/attrib.c18
-rw-r--r--mesalib/src/mesa/main/blend.c10
-rw-r--r--mesalib/src/mesa/main/bufferobj.c22
-rw-r--r--mesalib/src/mesa/main/buffers.c2
-rw-r--r--mesalib/src/mesa/main/clear.c2
-rw-r--r--mesalib/src/mesa/main/config.h9
-rw-r--r--mesalib/src/mesa/main/context.c19
-rw-r--r--mesalib/src/mesa/main/dd.h2
-rw-r--r--mesalib/src/mesa/main/debug.h15
-rw-r--r--mesalib/src/mesa/main/depth.h9
-rw-r--r--mesalib/src/mesa/main/dlist.c356
-rw-r--r--mesalib/src/mesa/main/drawpix.c2
-rw-r--r--mesalib/src/mesa/main/enable.c181
-rw-r--r--mesalib/src/mesa/main/eval.c66
-rw-r--r--mesalib/src/mesa/main/extensions.c7
-rw-r--r--mesalib/src/mesa/main/extensions.h19
-rw-r--r--mesalib/src/mesa/main/feedback.c4
-rw-r--r--mesalib/src/mesa/main/ffvertex_prog.c1
-rw-r--r--mesalib/src/mesa/main/fog.h9
-rw-r--r--mesalib/src/mesa/main/get.c29
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py60
-rw-r--r--mesalib/src/mesa/main/getstring.c4
-rw-r--r--mesalib/src/mesa/main/glformats.c2
-rw-r--r--mesalib/src/mesa/main/hint.h9
-rw-r--r--mesalib/src/mesa/main/light.h11
-rw-r--r--mesalib/src/mesa/main/matrix.c20
-rw-r--r--mesalib/src/mesa/main/mfeatures.h3
-rw-r--r--mesalib/src/mesa/main/mtypes.h22
-rw-r--r--mesalib/src/mesa/main/nvprogram.c917
-rw-r--r--mesalib/src/mesa/main/nvprogram.h119
-rw-r--r--mesalib/src/mesa/main/points.c4
-rw-r--r--mesalib/src/mesa/main/polygon.c3
-rw-r--r--mesalib/src/mesa/main/shaderapi.c1
-rw-r--r--mesalib/src/mesa/main/stencil.c2
-rw-r--r--mesalib/src/mesa/main/texcompress.c2
-rw-r--r--mesalib/src/mesa/main/texcompress.h11
-rw-r--r--mesalib/src/mesa/main/teximage.c2
-rw-r--r--mesalib/src/mesa/main/texobj.c3
-rw-r--r--mesalib/src/mesa/main/texstate.c7
-rw-r--r--mesalib/src/mesa/main/varray.c32
-rw-r--r--mesalib/src/mesa/main/varray.h15
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c2
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--mesalib/src/mesa/program/nvfragparse.c1591
-rw-r--r--mesalib/src/mesa/program/nvfragparse.h47
-rw-r--r--mesalib/src/mesa/program/nvvertparse.c1456
-rw-r--r--mesalib/src/mesa/program/nvvertparse.h49
-rw-r--r--mesalib/src/mesa/program/prog_execute.c66
-rw-r--r--mesalib/src/mesa/program/prog_instruction.c7
-rw-r--r--mesalib/src/mesa/program/prog_instruction.h29
-rw-r--r--mesalib/src/mesa/program/prog_optimize.c3
-rw-r--r--mesalib/src/mesa/program/prog_parameter.c100
-rw-r--r--mesalib/src/mesa/program/prog_parameter.h36
-rw-r--r--mesalib/src/mesa/program/prog_parameter_layout.c2
-rw-r--r--mesalib/src/mesa/program/prog_print.c84
-rw-r--r--mesalib/src/mesa/program/prog_print.h1
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c91
-rw-r--r--mesalib/src/mesa/program/prog_statevars.h3
-rw-r--r--mesalib/src/mesa/program/program.c12
-rw-r--r--mesalib/src/mesa/program/program_parse.y7
-rw-r--r--mesalib/src/mesa/program/programopt.c7
-rw-r--r--mesalib/src/mesa/sources.mak3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c12
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c19
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_program.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c124
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.h5
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp5
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c22
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c2
-rw-r--r--mesalib/src/mesa/swrast/s_context.c4
-rw-r--r--mesalib/src/mesa/swrast/s_fragprog.c5
-rw-r--r--mesalib/src/mesa/tnl/t_context.h2
-rw-r--r--mesalib/src/mesa/tnl/t_vb_program.c41
-rw-r--r--mesalib/src/mesa/tnl/tnl.h3
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.h2
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h1
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c10
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c26
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c5
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_eval.c17
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c5
99 files changed, 241 insertions, 5955 deletions
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index b7f908a9a..12bb70aec 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -90,7 +90,6 @@ main_sources = [
'main/mipmap.c',
'main/mm.c',
'main/multisample.c',
- 'main/nvprogram.c',
'main/pack.c',
'main/pbo.c',
'main/pixel.c',
@@ -294,8 +293,6 @@ program_sources = [
'program/arbprogparse.c',
'program/hash_table.c',
'program/ir_to_mesa.cpp',
- 'program/nvfragparse.c',
- 'program/nvvertparse.c',
'program/program.c',
'program/program_parse_extra.c',
'program/prog_cache.c',
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po
index 933a05c04..724237929 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po
@@ -268,10 +268,6 @@ msgstr "Funktionalität, die nicht hardwarebeschleunigt ist"
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Erweiterung GL_ARB_vertex_program aktivieren"
-#: t_options.h:268
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Erweiterung GL_NV_vertex_program aktivieren"
-
#: t_options.h:273
msgid "Enable flushing batchbuffer after each draw call"
msgstr "Aktiviere sofortige Leerung des Stapelpuffers nach jedem Zeichenaufruf"
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po
index 82ad177cb..8bccd8631 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po
@@ -212,8 +212,3 @@ msgstr "Características no aceleradas por hardware"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Activar la extensión GL_ARB_vertex_program"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Activar extensión GL_NV_vertex_program"
-
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po
index 19f3b4a4e..7a10969b8 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po
@@ -219,7 +219,3 @@ msgstr "Fonctionnalités ne bénéficiant pas d'une accélération matérielle"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Activer l'extension GL_ARB_vertex_program"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Activer l'extension GL_NV_vertex_program"
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po
index 1e4cf167b..64516f606 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po
@@ -224,7 +224,3 @@ msgstr "Eigenschappen die niet hardwareversneld zijn"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Zet uitbreiding GL_ARB_vertex_program aan"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Zet uitbreiding GL_NV_vertex_program aan"
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h
index a20e3d12d..112a046d2 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h
@@ -597,16 +597,6 @@ DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
DRI_CONF_DESC(sv,"Aktivera tillägget GL_ARB_vertex_program") \
DRI_CONF_OPT_END
-#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
- DRI_CONF_DESC(en,"Enable extension GL_NV_vertex_program") \
- DRI_CONF_DESC(de,"Erweiterung GL_NV_vertex_program aktivieren") \
- DRI_CONF_DESC(es,"Activar extensión GL_NV_vertex_program") \
- DRI_CONF_DESC(nl,"Zet uitbreiding GL_NV_vertex_program aan") \
- DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \
- DRI_CONF_DESC(sv,"Aktivera tillägget GL_NV_vertex_program") \
-DRI_CONF_OPT_END
-
#define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \
DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \
DRI_CONF_DESC(en,"Enable flushing batchbuffer after each draw call") \
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po
index ba32b2ff1..d1cb56bba 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po
@@ -219,8 +219,3 @@ msgstr "Funktioner som inte är hårdvaruaccelererade"
#: t_options.h:228
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Aktivera tillägget GL_ARB_vertex_program"
-
-#: t_options.h:233
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Aktivera tillägget GL_NV_vertex_program"
-
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 2427aa77f..e2d4aaee3 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -263,11 +263,6 @@ DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
DRI_CONF_DESC(en,gettext("Enable extension GL_ARB_vertex_program")) \
DRI_CONF_OPT_END
-#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
- DRI_CONF_DESC(en,gettext("Enable extension GL_NV_vertex_program")) \
-DRI_CONF_OPT_END
-
#define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \
DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \
DRI_CONF_DESC(en,gettext("Enable flushing batchbuffer after each draw call")) \
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 5bdbe709b..545e898f1 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -668,7 +668,6 @@ static const char *es2_extensions[] = {
"GL_EXT_framebuffer_blit",
"GL_IBM_multimode_draw_arrays",
"GL_MESA_window_pos",
- "GL_NV_vertex_program",
/* Required by GLES2 */
"GL_ARB_fragment_program",
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index d530001bc..20b8ff4d1 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -1528,31 +1528,24 @@ static void _ae_update_state( struct gl_context *ctx )
for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) { /* skip zero! */
struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
if (attribArray->Enabled) {
+ GLint intOrNorm;
at->array = attribArray;
/* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
* function pointer here (for float arrays) since the pointer may
* change from one execution of _ae_ArrayElement() to
* the next. Doing so caused UT to break.
*/
- if (ctx->VertexProgram._Enabled
- && ctx->VertexProgram.Current->IsNVProgram) {
- at->func = AttribFuncsNV[at->array->Normalized]
- [at->array->Size-1]
- [TYPE_IDX(at->array->Type)];
- }
- else {
- GLint intOrNorm;
- if (at->array->Integer)
- intOrNorm = 2;
- else if (at->array->Normalized)
- intOrNorm = 1;
- else
- intOrNorm = 0;
-
- at->func = AttribFuncsARB[intOrNorm]
- [at->array->Size-1]
- [TYPE_IDX(at->array->Type)];
- }
+ if (at->array->Integer)
+ intOrNorm = 2;
+ else if (at->array->Normalized)
+ intOrNorm = 1;
+ else
+ intOrNorm = 0;
+
+ at->func = AttribFuncsARB[intOrNorm]
+ [at->array->Size-1]
+ [TYPE_IDX(at->array->Type)];
+
at->index = i;
check_vbo(actx, at->array->BufferObj);
at++;
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index f42da9438..a5e5f26d2 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -87,7 +87,6 @@
#include "mtypes.h"
#include "varray.h"
#include "viewport.h"
-#include "nvprogram.h"
#include "shaderapi.h"
#include "uniforms.h"
#include "syncobj.h"
@@ -476,31 +475,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
if (ctx->API == API_OPENGL) {
SET_BindProgramNV(exec, _mesa_BindProgram);
SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
- SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
SET_GenProgramsNV(exec, _mesa_GenPrograms);
- SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
- SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
- SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
- SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
- SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
- SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
- SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
- SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
- SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
- SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
SET_IsProgramNV(exec, _mesa_IsProgramARB);
- SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
- SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
- SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
- SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
- SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
- SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
- SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
- SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
- SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
/* glVertexAttrib*NV functions handled in api_loopback.c */
}
- SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
/* 273. GL_APPLE_vertex_array_object */
if (ctx->API == API_OPENGL) {
@@ -511,22 +489,6 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
- /* 282. GL_NV_fragment_program */
- if (ctx->API == API_OPENGL) {
- SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
- SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
- SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
- SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
- SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
- SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
- SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
- SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
- }
-
/* 262. GL_NV_point_sprite */
#if _HAVE_FULL_GL
if (_mesa_is_desktop_gl(ctx)) {
@@ -660,7 +622,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
- /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
+ SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervARB);
if (ctx->API == API_OPENGL) {
SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
@@ -767,10 +729,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
}
- if (ctx->API != API_OPENGLES2) {
- SET_MapBufferRange(exec, _mesa_MapBufferRange);
- SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
- }
+ /* GL_ARB_map_buffer_range / GL_EXT_map_buffer_range */
+ SET_MapBufferRange(exec, _mesa_MapBufferRange);
+ SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
/* GL_ARB_copy_buffer */
if (ctx->API != API_OPENGLES2) {
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index db9d14a4c..6f0250800 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -148,7 +148,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
break;
default:
- ASSERT_NO_FEATURE();
+ assert(!"Invalid API value in check_valid_to_render()");
}
return GL_TRUE;
diff --git a/mesalib/src/mesa/main/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c
index ae91fd5a3..9be86c2fe 100644
--- a/mesalib/src/mesa/main/arbprogram.c
+++ b/mesalib/src/mesa/main/arbprogram.c
@@ -37,33 +37,9 @@
#include "main/mtypes.h"
#include "main/arbprogram.h"
#include "program/arbprogparse.h"
-#include "program/nvfragparse.h"
-#include "program/nvvertparse.h"
#include "program/program.h"
-
-/**
- * Mixing ARB and NV vertex/fragment programs can be tricky.
- * Note: GL_VERTEX_PROGRAM_ARB == GL_VERTEX_PROGRAM_NV
- * but, GL_FRAGMENT_PROGRAM_ARB != GL_FRAGMENT_PROGRAM_NV
- * The two different fragment program targets are supposed to be compatible
- * to some extent (see GL_ARB_fragment_program spec).
- * This function does the compatibility check.
- */
-static GLboolean
-compatible_program_targets(GLenum t1, GLenum t2)
-{
- if (t1 == t2)
- return GL_TRUE;
- if (t1 == GL_FRAGMENT_PROGRAM_ARB && t2 == GL_FRAGMENT_PROGRAM_NV)
- return GL_TRUE;
- if (t1 == GL_FRAGMENT_PROGRAM_NV && t2 == GL_FRAGMENT_PROGRAM_ARB)
- return GL_TRUE;
- return GL_FALSE;
-}
-
-
/**
* Bind a program (make it current)
* \note Called from the GL API dispatcher by both glBindProgramNV
@@ -77,19 +53,15 @@ _mesa_BindProgram(GLenum target, GLuint id)
ASSERT_OUTSIDE_BEGIN_END(ctx);
/* Error-check target and get curProg */
- if ((target == GL_VERTEX_PROGRAM_ARB) && /* == GL_VERTEX_PROGRAM_NV */
- (ctx->Extensions.NV_vertex_program ||
- ctx->Extensions.ARB_vertex_program)) {
+ if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
curProg = &ctx->VertexProgram.Current->Base;
}
- else if ((target == GL_FRAGMENT_PROGRAM_NV
- && ctx->Extensions.NV_fragment_program) ||
- (target == GL_FRAGMENT_PROGRAM_ARB
- && ctx->Extensions.ARB_fragment_program)) {
+ else if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
curProg = &ctx->FragmentProgram.Current->Base;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramARB(target)");
return;
}
@@ -101,7 +73,7 @@ _mesa_BindProgram(GLenum target, GLuint id)
if (id == 0) {
/* Bind a default program */
newProg = NULL;
- if (target == GL_VERTEX_PROGRAM_ARB) /* == GL_VERTEX_PROGRAM_NV */
+ if (target == GL_VERTEX_PROGRAM_ARB)
newProg = &ctx->Shared->DefaultVertexProgram->Base;
else
newProg = &ctx->Shared->DefaultFragmentProgram->Base;
@@ -113,14 +85,14 @@ _mesa_BindProgram(GLenum target, GLuint id)
/* allocate a new program now */
newProg = ctx->Driver.NewProgram(ctx, target, id);
if (!newProg) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
return;
}
_mesa_HashInsert(ctx->Shared->Programs, id, newProg);
}
- else if (!compatible_program_targets(newProg->Target, target)) {
+ else if (newProg->Target != target) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindProgramNV/ARB(target mismatch)");
+ "glBindProgramARB(target mismatch)");
return;
}
}
@@ -136,12 +108,11 @@ _mesa_BindProgram(GLenum target, GLuint id)
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
/* bind newProg */
- if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */
+ if (target == GL_VERTEX_PROGRAM_ARB) {
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
gl_vertex_program(newProg));
}
- else if (target == GL_FRAGMENT_PROGRAM_NV ||
- target == GL_FRAGMENT_PROGRAM_ARB) {
+ else if (target == GL_FRAGMENT_PROGRAM_ARB) {
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
gl_fragment_program(newProg));
}
@@ -181,15 +152,13 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids)
else if (prog) {
/* Unbind program if necessary */
switch (prog->Target) {
- case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
- case GL_VERTEX_STATE_PROGRAM_NV:
+ case GL_VERTEX_PROGRAM_ARB:
if (ctx->VertexProgram.Current &&
ctx->VertexProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
break;
- case GL_FRAGMENT_PROGRAM_NV:
case GL_FRAGMENT_PROGRAM_ARB:
if (ctx->FragmentProgram.Current &&
ctx->FragmentProgram.Current->Base.Id == ids[i]) {
@@ -286,11 +255,6 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
prog = &(ctx->FragmentProgram.Current->Base);
maxParams = ctx->Const.FragmentProgram.MaxLocalParams;
}
- else if (target == GL_FRAGMENT_PROGRAM_NV
- && ctx->Extensions.NV_fragment_program) {
- prog = &(ctx->FragmentProgram.Current->Base);
- maxParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
- }
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(target)", func);
@@ -321,8 +285,7 @@ get_env_param_pointer(struct gl_context *ctx, const char *func,
return GL_TRUE;
}
else if (target == GL_VERTEX_PROGRAM_ARB &&
- (ctx->Extensions.ARB_vertex_program ||
- ctx->Extensions.NV_vertex_program)) {
+ ctx->Extensions.ARB_vertex_program) {
if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
return GL_FALSE;
@@ -356,28 +319,12 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
return;
}
- /* The first couple cases are complicated. The same enum value is used for
- * ARB and NV vertex programs. If the target is a vertex program, parse it
- * using the ARB grammar if the string starts with "!!ARB" or if
- * NV_vertex_program is not supported.
- */
- if (target == GL_VERTEX_PROGRAM_ARB
- && ctx->Extensions.ARB_vertex_program
- && ((strncmp(string, "!!ARB", 5) == 0)
- || !ctx->Extensions.NV_vertex_program)) {
+ if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
struct gl_vertex_program *prog = ctx->VertexProgram.Current;
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
base = & prog->Base;
}
- else if ((target == GL_VERTEX_PROGRAM_ARB
- || target == GL_VERTEX_STATE_PROGRAM_NV)
- && ctx->Extensions.NV_vertex_program) {
- struct gl_vertex_program *prog = ctx->VertexProgram.Current;
- _mesa_parse_nv_vertex_program(ctx, target, string, len, prog);
-
- base = & prog->Base;
- }
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
@@ -385,13 +332,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
base = & prog->Base;
}
- else if (target == GL_FRAGMENT_PROGRAM_NV
- && ctx->Extensions.NV_fragment_program) {
- struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
- _mesa_parse_nv_fragment_program(ctx, target, string, len, prog);
-
- base = & prog->Base;
- }
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
return;
@@ -410,8 +350,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterdNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
@@ -425,8 +363,6 @@ _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterdvNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
@@ -441,8 +377,6 @@ _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterfNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
@@ -466,8 +400,6 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterfvNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
@@ -557,9 +489,6 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
}
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
void GLAPIENTRY
_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
@@ -578,9 +507,6 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
}
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
void GLAPIENTRY
_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
const GLfloat *params)
@@ -629,9 +555,6 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
}
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
void GLAPIENTRY
_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y,
@@ -642,9 +565,6 @@ _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
}
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
void GLAPIENTRY
_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
const GLdouble *params)
@@ -655,9 +575,6 @@ _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
}
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
void GLAPIENTRY
_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
GLfloat *params)
@@ -673,9 +590,6 @@ _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
}
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
void GLAPIENTRY
_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
GLdouble *params)
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 9255559d5..5959260c2 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -314,8 +314,6 @@ _mesa_update_array_object_max_element(struct gl_context *ctx,
if (!ctx->VertexProgram._Current ||
ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
enabled = _mesa_array_object_get_enabled_ff(arrayObj);
- } else if (ctx->VertexProgram._Current->IsNVProgram) {
- enabled = _mesa_array_object_get_enabled_nv(arrayObj);
} else {
enabled = _mesa_array_object_get_enabled_arb(arrayObj);
}
diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h
index 4f89064bb..dfefec2a7 100644
--- a/mesalib/src/mesa/main/arrayobj.h
+++ b/mesalib/src/mesa/main/arrayobj.h
@@ -87,18 +87,6 @@ _mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj)
return arrayObj->_Enabled & VERT_BIT_FF_ALL;
}
-/** Returns the bitmask of all enabled arrays in nv shader mode.
- *
- * In nv shader mode, the nv generic arrays take precedence over
- * the legacy arrays.
- */
-static inline GLbitfield64
-_mesa_array_object_get_enabled_nv(const struct gl_array_object *arrayObj)
-{
- GLbitfield64 enabled = arrayObj->_Enabled;
- return enabled & ~(VERT_BIT_FF_NVALIAS & (enabled >> VERT_ATTRIB_GENERIC0));
-}
-
/** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
*
* In arb/glsl shader mode all the fixed function and the arb/glsl generic
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index b92c4652e..48df7f16b 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -94,7 +94,6 @@ struct gl_enable_attrib
GLboolean Map1TextureCoord4;
GLboolean Map1Vertex3;
GLboolean Map1Vertex4;
- GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */
GLboolean Map2Color4;
GLboolean Map2Index;
GLboolean Map2Normal;
@@ -104,7 +103,6 @@ struct gl_enable_attrib
GLboolean Map2TextureCoord4;
GLboolean Map2Vertex3;
GLboolean Map2Vertex4;
- GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */
GLboolean Normalize;
GLboolean PixelTexture;
@@ -127,7 +125,7 @@ struct gl_enable_attrib
GLbitfield Texture[MAX_TEXTURE_UNITS];
GLbitfield TexGen[MAX_TEXTURE_UNITS];
- /* GL_ARB_vertex_program / GL_NV_vertex_program */
+ /* GL_ARB_vertex_program */
GLboolean VertexProgram;
GLboolean VertexProgramPointSize;
GLboolean VertexProgramTwoSide;
@@ -285,7 +283,6 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4;
attr->Map1Vertex3 = ctx->Eval.Map1Vertex3;
attr->Map1Vertex4 = ctx->Eval.Map1Vertex4;
- memcpy(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib));
attr->Map2Color4 = ctx->Eval.Map2Color4;
attr->Map2Index = ctx->Eval.Map2Index;
attr->Map2Normal = ctx->Eval.Map2Normal;
@@ -295,7 +292,6 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4;
attr->Map2Vertex3 = ctx->Eval.Map2Vertex3;
attr->Map2Vertex4 = ctx->Eval.Map2Vertex4;
- memcpy(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib));
attr->Normalize = ctx->Transform.Normalize;
attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped;
attr->PointSmooth = ctx->Point.SmoothFlag;
@@ -317,7 +313,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
}
- /* GL_NV_vertex_program */
+ /* GL_ARB_vertex_program */
attr->VertexProgram = ctx->VertexProgram.Enabled;
attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled;
attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled;
@@ -545,10 +541,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
GL_MAP1_VERTEX_3);
TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4,
GL_MAP1_VERTEX_4);
- for (i = 0; i < 16; i++) {
- TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i],
- GL_MAP1_VERTEX_ATTRIB0_4_NV + i);
- }
TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4);
TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX);
@@ -565,10 +557,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
GL_MAP2_VERTEX_3);
TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4,
GL_MAP2_VERTEX_4);
- for (i = 0; i < 16; i++) {
- TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i],
- GL_MAP2_VERTEX_ATTRIB0_4_NV + i);
- }
TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL);
TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE);
@@ -609,7 +597,7 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
enable->SampleCoverage,
GL_SAMPLE_COVERAGE_ARB);
- /* GL_ARB_vertex_program, GL_NV_vertex_program */
+ /* GL_ARB_vertex_program */
TEST_AND_UPDATE(ctx->VertexProgram.Enabled,
enable->VertexProgram,
GL_VERTEX_PROGRAM_ARB);
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index 5d553118c..5cd3ce244 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -256,9 +256,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
}
-#if _HAVE_FULL_GL
-
-
/**
* Set blend source/dest factors for one color buffer/target.
*/
@@ -520,10 +517,6 @@ _mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
}
-
-#endif /* _HAVE_FULL_GL */
-
-
/**
* Set the blending color.
*
@@ -666,7 +659,7 @@ _mesa_LogicOp( GLenum opcode )
ctx->Driver.LogicOpcode( ctx, opcode );
}
-#if _HAVE_FULL_GL
+
void GLAPIENTRY
_mesa_IndexMask( GLuint mask )
{
@@ -679,7 +672,6 @@ _mesa_IndexMask( GLuint mask )
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.IndexMask = mask;
}
-#endif
/**
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index efb8df894..d6b886e8d 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -1312,20 +1312,17 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
*params = _mesa_bufferobj_mapped(bufObj);
return;
case GL_BUFFER_ACCESS_FLAGS:
- if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
- && !_mesa_is_gles3(ctx))
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = bufObj->AccessFlags;
return;
case GL_BUFFER_MAP_OFFSET:
- if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
- && !_mesa_is_gles3(ctx))
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = (GLint) bufObj->Offset;
return;
case GL_BUFFER_MAP_LENGTH:
- if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
- && !_mesa_is_gles3(ctx))
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = (GLint) bufObj->Length;
return;
@@ -1524,6 +1521,19 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
return NULL;
}
+ /* Page 38 of the PDF of the OpenGL ES 3.0 spec says:
+ *
+ * "An INVALID_OPERATION error is generated for any of the following
+ * conditions:
+ *
+ * * <length> is zero."
+ */
+ if (_mesa_is_gles(ctx) && length == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(length = 0)");
+ return NULL;
+ }
+
if (access & ~(GL_MAP_READ_BIT |
GL_MAP_WRITE_BIT |
GL_MAP_INVALIDATE_RANGE_BIT |
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 216b6ee87..cc268b67c 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -353,7 +353,6 @@ updated_drawbuffers(struct gl_context *ctx)
{
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
-#if FEATURE_GL
if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
struct gl_framebuffer *fb = ctx->DrawBuffer;
@@ -362,7 +361,6 @@ updated_drawbuffers(struct gl_context *ctx)
fb->_Status = 0;
}
}
-#endif
}
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index f07d5333b..83ffdf66b 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -41,7 +41,6 @@
-#if _HAVE_FULL_GL
void GLAPIENTRY
_mesa_ClearIndex( GLfloat c )
{
@@ -54,7 +53,6 @@ _mesa_ClearIndex( GLfloat c )
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClearIndex = (GLuint) c;
}
-#endif
/**
diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h
index ead1d323c..1b72b5449 100644
--- a/mesalib/src/mesa/main/config.h
+++ b/mesalib/src/mesa/main/config.h
@@ -204,15 +204,6 @@
#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0
/*@}*/
-/** For GL_NV_vertex_program */
-/*@{*/
-#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
-#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
-#define MAX_NV_VERTEX_PROGRAM_PARAMS 96
-#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
-#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
-/*@}*/
-
/** For GL_NV_fragment_program */
/*@{*/
#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 29f28bd18..b00c64233 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -129,9 +129,7 @@
#include "vtxfmt.h"
#include "program/program.h"
#include "program/prog_print.h"
-#if _HAVE_FULL_GL
#include "math/m_matrix.h"
-#endif
#include "main/dispatch.h" /* for _gloffset_COUNT */
#ifdef USE_SPARC_ASM
@@ -490,7 +488,7 @@ init_program_limits(struct gl_context *ctx, GLenum type,
switch (type) {
case GL_VERTEX_PROGRAM_ARB:
prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS;
- prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
+ prog->MaxAttribs = MAX_VERTEX_GENERIC_ATTRIBS;
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
break;
@@ -501,8 +499,8 @@ init_program_limits(struct gl_context *ctx, GLenum type,
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
break;
case MESA_GEOMETRY_PROGRAM:
- prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS;
- prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
+ prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS;
+ prog->MaxAttribs = MAX_VERTEX_GENERIC_ATTRIBS;
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
prog->MaxUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
break;
@@ -687,11 +685,6 @@ check_context_limits(struct gl_context *ctx)
assert(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
assert(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
- assert(MAX_NV_FRAGMENT_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS);
- assert(MAX_NV_VERTEX_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS);
- assert(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX);
- assert(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX);
-
/* Texture unit checks */
assert(ctx->Const.MaxTextureImageUnits > 0);
assert(ctx->Const.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS);
@@ -1165,7 +1158,6 @@ _mesa_destroy_context( struct gl_context *ctx )
}
-#if _HAVE_FULL_GL
/**
* Copy attribute groups from one context to another.
*
@@ -1286,7 +1278,6 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
dst->NewState = _NEW_ALL;
dst->NewDriverState = ~0;
}
-#endif
/**
@@ -1463,8 +1454,6 @@ _mesa_make_current( struct gl_context *newCtx,
#if 1
/* We want to get rid of these lines: */
-
-#if _HAVE_FULL_GL
if (!drawBuffer->Initialized) {
initialize_framebuffer_size(newCtx, drawBuffer);
}
@@ -1473,8 +1462,6 @@ _mesa_make_current( struct gl_context *newCtx,
}
_mesa_resizebuffers(newCtx);
-#endif
-
#else
/* We want the drawBuffer and readBuffer to be initialized by
* the driver.
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 0000a397a..70c53240e 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -903,7 +903,7 @@ typedef struct {
void (GLAPIENTRYP Begin)( GLenum );
void (GLAPIENTRYP End)( void );
void (GLAPIENTRYP PrimitiveRestartNV)( void );
- /* GL_NV_vertex_program */
+ /* Originally for GL_NV_vertex_program, now used only dlist.c and friends */
void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
diff --git a/mesalib/src/mesa/main/debug.h b/mesalib/src/mesa/main/debug.h
index bc64a83bb..6bc536591 100644
--- a/mesalib/src/mesa/main/debug.h
+++ b/mesalib/src/mesa/main/debug.h
@@ -42,27 +42,12 @@
struct gl_context;
struct gl_texture_image;
-#if _HAVE_FULL_GL
-
extern void _mesa_print_tri_caps( const char *name, GLuint flags );
extern void _mesa_print_enable_flags( const char *msg, GLuint flags );
extern void _mesa_print_state( const char *msg, GLuint state );
extern void _mesa_print_info( void );
extern void _mesa_init_debug( struct gl_context *ctx );
-#else
-
-/** No-op */
-#define _mesa_print_state( m, s ) ((void)0)
-
-/** No-op */
-#define _mesa_print_info() ((void)0)
-
-/** No-op */
-#define _mesa_init_debug( c ) ((void)0)
-
-#endif
-
extern void
_mesa_write_renderbuffer_image(const struct gl_renderbuffer *rb);
diff --git a/mesalib/src/mesa/main/depth.h b/mesalib/src/mesa/main/depth.h
index 2f428629f..fe6b33f36 100644
--- a/mesalib/src/mesa/main/depth.h
+++ b/mesalib/src/mesa/main/depth.h
@@ -38,8 +38,6 @@
struct gl_context;
-#if _HAVE_FULL_GL
-
extern void GLAPIENTRY
_mesa_ClearDepth( GLclampd depth );
@@ -58,11 +56,4 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax );
extern void
_mesa_init_depth( struct gl_context * ctx );
-#else
-
-/** No-op */
-#define _mesa_init_depth( c ) ((void)0)
-
-#endif
-
#endif
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 99519120a..28cd52a40 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -63,7 +63,6 @@
#include "mtypes.h"
#include "varray.h"
#include "arbprogram.h"
-#include "nvprogram.h"
#include "transformfeedback.h"
#include "math/m_matrix.h"
@@ -319,15 +318,9 @@ typedef enum
OPCODE_SAMPLE_COVERAGE,
/* GL_ARB_window_pos */
OPCODE_WINDOW_POS_ARB,
- /* GL_NV_vertex_program */
- OPCODE_BIND_PROGRAM_NV,
- OPCODE_EXECUTE_PROGRAM_NV,
- OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
- OPCODE_LOAD_PROGRAM_NV,
- OPCODE_TRACK_MATRIX_NV,
/* GL_NV_fragment_program */
+ OPCODE_BIND_PROGRAM_NV,
OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
- OPCODE_PROGRAM_NAMED_PARAMETER_NV,
/* GL_EXT_stencil_two_side */
OPCODE_ACTIVE_STENCIL_FACE_EXT,
/* GL_EXT_depth_bounds_test */
@@ -728,18 +721,6 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
free(n[11].data);
n += InstSize[n[0].opcode];
break;
- case OPCODE_LOAD_PROGRAM_NV:
- free(n[4].data); /* program string */
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
- free(n[2].data); /* array of program ids */
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
- free(n[3].data); /* parameter name */
- n += InstSize[n[0].opcode];
- break;
case OPCODE_PROGRAM_STRING_ARB:
free(n[4].data); /* program string */
n += InstSize[n[0].opcode];
@@ -4840,7 +4821,7 @@ save_SampleCoverageARB(GLclampf value, GLboolean invert)
/*
- * GL_NV_vertex_program
+ * GL_NV_fragment_program
*/
static void GLAPIENTRY
save_BindProgramNV(GLenum target, GLuint id)
@@ -4943,125 +4924,6 @@ save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
static void GLAPIENTRY
-save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = id;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramParameters4dvNV(GLenum target, GLuint index,
- GLsizei num, const GLdouble *params)
-{
- GLint i;
- for (i = 0; i < num; i++) {
- save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i);
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramParameters4fvNV(GLenum target, GLuint index,
- GLsizei num, const GLfloat *params)
-{
- GLint i;
- for (i = 0; i < num; i++) {
- save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i);
- }
-}
-
-
-static void GLAPIENTRY
-save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
- const GLubyte * program)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
- if (n) {
- GLubyte *programCopy = malloc(len);
- if (!programCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- memcpy(programCopy, program, len);
- n[1].e = target;
- n[2].ui = id;
- n[3].i = len;
- n[4].data = programCopy;
- }
- if (ctx->ExecuteFlag) {
- CALL_LoadProgramNV(ctx->Exec, (target, id, len, program));
- }
-}
-
-
-static void GLAPIENTRY
-save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
- if (n) {
- GLuint *idCopy = malloc(num * sizeof(GLuint));
- if (!idCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
- return;
- }
- memcpy(idCopy, ids, num * sizeof(GLuint));
- n[1].i = num;
- n[2].data = idCopy;
- }
- if (ctx->ExecuteFlag) {
- CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids));
- }
-}
-
-
-static void GLAPIENTRY
-save_TrackMatrixNV(GLenum target, GLuint address,
- GLenum matrix, GLenum transform)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 4);
- if (n) {
- n[1].e = target;
- n[2].ui = address;
- n[3].e = matrix;
- n[4].e = transform;
- }
- if (ctx->ExecuteFlag) {
- CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform));
- }
-}
-
-
-/*
- * GL_NV_fragment_program
- */
-static void GLAPIENTRY
save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
@@ -5181,63 +5043,6 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
}
}
-static void GLAPIENTRY
-save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
- if (n) {
- GLubyte *nameCopy = malloc(len);
- if (!nameCopy) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
- return;
- }
- memcpy(nameCopy, name, len);
- n[1].ui = id;
- n[2].i = len;
- n[3].data = nameCopy;
- n[4].f = x;
- n[5].f = y;
- n[6].f = z;
- n[7].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name,
- const float v[])
-{
- save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
-}
-
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y,
- (GLfloat) z, (GLfloat) w);
-}
-
-
-static void GLAPIENTRY
-save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name,
- const double v[])
-{
- save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0],
- (GLfloat) v[1], (GLfloat) v[2],
- (GLfloat) v[3]);
-}
-
/* GL_EXT_stencil_two_side */
static void GLAPIENTRY
@@ -6135,85 +5940,6 @@ index_error(void)
}
-/* First level for NV_vertex_program:
- *
- * Check for errors at compile time?.
- */
-static void GLAPIENTRY
-save_VertexAttrib1fNV(GLuint index, GLfloat x)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr1fNV(index, x);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr1fNV(index, v[0]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr2fNV(index, x, y);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr2fNV(index, v[0], v[1]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr3fNV(index, x, y, z);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr3fNV(index, v[0], v[1], v[2]);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
- GLfloat z, GLfloat w)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr4fNV(index, x, y, z, w);
- else
- index_error();
-}
-
-static void GLAPIENTRY
-save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
-{
- if (index < MAX_NV_VERTEX_PROGRAM_INPUTS)
- save_Attr4fNV(index, v[0], v[1], v[2], v[3]);
- else
- index_error();
-}
-
-
-
static void GLAPIENTRY
save_VertexAttrib1fARB(GLuint index, GLfloat x)
@@ -8373,41 +8099,14 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f));
break;
- case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
+ case OPCODE_BIND_PROGRAM_NV: /* GL_ARB_vertex_program */
CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui));
break;
- case OPCODE_EXECUTE_PROGRAM_NV:
- {
- GLfloat v[4];
- v[0] = n[3].f;
- v[1] = n[4].f;
- v[2] = n[5].f;
- v[3] = n[6].f;
- CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
- }
- break;
- case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
- CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
- (GLuint *) n[2].data));
- break;
- case OPCODE_LOAD_PROGRAM_NV:
- CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
- (const GLubyte *) n[4].data));
- break;
- case OPCODE_TRACK_MATRIX_NV:
- CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
- break;
case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
CALL_ProgramLocalParameter4fARB(ctx->Exec,
(n[1].e, n[2].ui, n[3].f, n[4].f,
n[5].f, n[6].f));
break;
- case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
- CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
- (const GLubyte *) n[3].
- data, n[4].f, n[5].f,
- n[6].f, n[7].f));
- break;
case OPCODE_ACTIVE_STENCIL_FACE_EXT:
CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
break;
@@ -10238,29 +9937,8 @@ _mesa_create_save_table(const struct gl_context *ctx)
*/
SET_BindProgramNV(table, save_BindProgramNV);
SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
- SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
SET_GenProgramsNV(table, _mesa_GenPrograms);
- SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
- SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
- SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
- SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
- SET_GetProgramivNV(table, _mesa_GetProgramivNV);
- SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
- SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
- SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
- SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
- SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
- SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
SET_IsProgramNV(table, _mesa_IsProgramARB);
- SET_LoadProgramNV(table, save_LoadProgramNV);
- SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
- SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
- SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
- SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
- SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
- SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
- SET_TrackMatrixNV(table, save_TrackMatrixNV);
- SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
/* 244. GL_ATI_envmap_bumpmap */
SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
@@ -10270,24 +9948,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
- /* 282. GL_NV_fragment_program */
- SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
- SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
- SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
- SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
- SET_GetProgramNamedParameterfvNV(table,
- _mesa_GetProgramNamedParameterfvNV);
- SET_GetProgramNamedParameterdvNV(table,
- _mesa_GetProgramNamedParameterdvNV);
- SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
- SET_GetProgramLocalParameterdvARB(table,
- _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(table,
- _mesa_GetProgramLocalParameterfvARB);
-
/* 262. GL_NV_point_sprite */
SET_PointParameteriNV(table, save_PointParameteriNV);
SET_PointParameterivNV(table, save_PointParameterivNV);
@@ -10368,7 +10028,7 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_GetVertexAttribdvARB(table, _mesa_GetVertexAttribdvARB);
SET_GetVertexAttribfvARB(table, _mesa_GetVertexAttribfvARB);
SET_GetVertexAttribivARB(table, _mesa_GetVertexAttribivARB);
- SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
+ SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervARB);
SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
@@ -10924,14 +10584,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
vfmt->Vertex3fv = save_Vertex3fv;
vfmt->Vertex4f = save_Vertex4f;
vfmt->Vertex4fv = save_Vertex4fv;
- vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
- vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
- vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
- vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
- vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
- vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
- vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
- vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index b5ab2cbeb..8836e0a0e 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -344,7 +344,6 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
}
}
-#if _HAVE_FULL_GL
else if (ctx->RenderMode == GL_FEEDBACK) {
FLUSH_CURRENT(ctx, 0);
_mesa_feedback_token( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN );
@@ -357,7 +356,6 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
ASSERT(ctx->RenderMode == GL_SELECT);
/* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */
}
-#endif
/* update raster position */
ctx->Current.RasterPos[0] += xmove;
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index a607bdc10..e60a05a9e 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -97,31 +97,6 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
flag = VERT_BIT_POINT_SIZE;
break;
- case GL_VERTEX_ATTRIB_ARRAY0_NV:
- case GL_VERTEX_ATTRIB_ARRAY1_NV:
- case GL_VERTEX_ATTRIB_ARRAY2_NV:
- case GL_VERTEX_ATTRIB_ARRAY3_NV:
- case GL_VERTEX_ATTRIB_ARRAY4_NV:
- case GL_VERTEX_ATTRIB_ARRAY5_NV:
- case GL_VERTEX_ATTRIB_ARRAY6_NV:
- case GL_VERTEX_ATTRIB_ARRAY7_NV:
- case GL_VERTEX_ATTRIB_ARRAY8_NV:
- case GL_VERTEX_ATTRIB_ARRAY9_NV:
- case GL_VERTEX_ATTRIB_ARRAY10_NV:
- case GL_VERTEX_ATTRIB_ARRAY11_NV:
- case GL_VERTEX_ATTRIB_ARRAY12_NV:
- case GL_VERTEX_ATTRIB_ARRAY13_NV:
- case GL_VERTEX_ATTRIB_ARRAY14_NV:
- case GL_VERTEX_ATTRIB_ARRAY15_NV:
- CHECK_EXTENSION(NV_vertex_program, cap);
- {
- GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(arrayObj->VertexAttrib));
- var = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled;
- flag = VERT_BIT_GENERIC(n);
- }
- break;
-
/* GL_NV_primitive_restart */
case GL_PRIMITIVE_RESTART_NV:
if (!ctx->Extensions.NV_primitive_restart) {
@@ -734,7 +709,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
-#if FEATURE_ES1
case GL_TEXTURE_GEN_STR_OES:
/* disable S, T, and R at the same time */
{
@@ -755,7 +729,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
}
break;
-#endif
/* client-side state */
case GL_VERTEX_ARRAY:
@@ -851,7 +824,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_VERTEX_PROGRAM_ARB:
if (ctx->API != API_OPENGL)
goto invalid_enum_error;
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
+ CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
@@ -863,7 +836,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
*/
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
+ CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.PointSizeEnabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
@@ -872,74 +845,13 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
if (ctx->API != API_OPENGL)
goto invalid_enum_error;
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
+ CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.TwoSideEnabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->VertexProgram.TwoSideEnabled = state;
break;
- case GL_MAP1_VERTEX_ATTRIB0_4_NV:
- case GL_MAP1_VERTEX_ATTRIB1_4_NV:
- case GL_MAP1_VERTEX_ATTRIB2_4_NV:
- case GL_MAP1_VERTEX_ATTRIB3_4_NV:
- case GL_MAP1_VERTEX_ATTRIB4_4_NV:
- case GL_MAP1_VERTEX_ATTRIB5_4_NV:
- case GL_MAP1_VERTEX_ATTRIB6_4_NV:
- case GL_MAP1_VERTEX_ATTRIB7_4_NV:
- case GL_MAP1_VERTEX_ATTRIB8_4_NV:
- case GL_MAP1_VERTEX_ATTRIB9_4_NV:
- case GL_MAP1_VERTEX_ATTRIB10_4_NV:
- case GL_MAP1_VERTEX_ATTRIB11_4_NV:
- case GL_MAP1_VERTEX_ATTRIB12_4_NV:
- case GL_MAP1_VERTEX_ATTRIB13_4_NV:
- case GL_MAP1_VERTEX_ATTRIB14_4_NV:
- case GL_MAP1_VERTEX_ATTRIB15_4_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_vertex_program, cap);
- {
- const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map1Attrib[map] = state;
- }
- break;
- case GL_MAP2_VERTEX_ATTRIB0_4_NV:
- case GL_MAP2_VERTEX_ATTRIB1_4_NV:
- case GL_MAP2_VERTEX_ATTRIB2_4_NV:
- case GL_MAP2_VERTEX_ATTRIB3_4_NV:
- case GL_MAP2_VERTEX_ATTRIB4_4_NV:
- case GL_MAP2_VERTEX_ATTRIB5_4_NV:
- case GL_MAP2_VERTEX_ATTRIB6_4_NV:
- case GL_MAP2_VERTEX_ATTRIB7_4_NV:
- case GL_MAP2_VERTEX_ATTRIB8_4_NV:
- case GL_MAP2_VERTEX_ATTRIB9_4_NV:
- case GL_MAP2_VERTEX_ATTRIB10_4_NV:
- case GL_MAP2_VERTEX_ATTRIB11_4_NV:
- case GL_MAP2_VERTEX_ATTRIB12_4_NV:
- case GL_MAP2_VERTEX_ATTRIB13_4_NV:
- case GL_MAP2_VERTEX_ATTRIB14_4_NV:
- case GL_MAP2_VERTEX_ATTRIB15_4_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_vertex_program, cap);
- {
- const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
- FLUSH_VERTICES(ctx, _NEW_EVAL);
- ctx->Eval.Map2Attrib[map] = state;
- }
- break;
-
- case GL_FRAGMENT_PROGRAM_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_fragment_program, cap);
- if (ctx->FragmentProgram.Enabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->FragmentProgram.Enabled = state;
- break;
-
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
if (ctx->API != API_OPENGL)
@@ -1450,7 +1362,6 @@ _mesa_IsEnabled( GLenum cap )
}
}
return GL_FALSE;
-#if FEATURE_ES1
case GL_TEXTURE_GEN_STR_OES:
{
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
@@ -1463,7 +1374,6 @@ _mesa_IsEnabled( GLenum cap )
? GL_TRUE : GL_FALSE;
}
}
-#endif
/* client-side state */
case GL_VERTEX_ARRAY:
@@ -1501,12 +1411,10 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
CHECK_EXTENSION(EXT_secondary_color);
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
-#if FEATURE_ES
case GL_POINT_SIZE_ARRAY_OES:
if (ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0);
-#endif
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
@@ -1555,7 +1463,7 @@ _mesa_IsEnabled( GLenum cap )
case GL_VERTEX_PROGRAM_ARB:
if (ctx->API != API_OPENGL)
goto invalid_enum_error;
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
+ CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.Enabled;
case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
/* This was added with ARB_vertex_program, but it is also used with
@@ -1563,91 +1471,14 @@ _mesa_IsEnabled( GLenum cap )
*/
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
+ CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.PointSizeEnabled;
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
if (ctx->API != API_OPENGL)
goto invalid_enum_error;
- CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
+ CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.TwoSideEnabled;
- case GL_VERTEX_ATTRIB_ARRAY0_NV:
- case GL_VERTEX_ATTRIB_ARRAY1_NV:
- case GL_VERTEX_ATTRIB_ARRAY2_NV:
- case GL_VERTEX_ATTRIB_ARRAY3_NV:
- case GL_VERTEX_ATTRIB_ARRAY4_NV:
- case GL_VERTEX_ATTRIB_ARRAY5_NV:
- case GL_VERTEX_ATTRIB_ARRAY6_NV:
- case GL_VERTEX_ATTRIB_ARRAY7_NV:
- case GL_VERTEX_ATTRIB_ARRAY8_NV:
- case GL_VERTEX_ATTRIB_ARRAY9_NV:
- case GL_VERTEX_ATTRIB_ARRAY10_NV:
- case GL_VERTEX_ATTRIB_ARRAY11_NV:
- case GL_VERTEX_ATTRIB_ARRAY12_NV:
- case GL_VERTEX_ATTRIB_ARRAY13_NV:
- case GL_VERTEX_ATTRIB_ARRAY14_NV:
- case GL_VERTEX_ATTRIB_ARRAY15_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_vertex_program);
- {
- GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(ctx->Array.ArrayObj->VertexAttrib));
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled != 0);
- }
- case GL_MAP1_VERTEX_ATTRIB0_4_NV:
- case GL_MAP1_VERTEX_ATTRIB1_4_NV:
- case GL_MAP1_VERTEX_ATTRIB2_4_NV:
- case GL_MAP1_VERTEX_ATTRIB3_4_NV:
- case GL_MAP1_VERTEX_ATTRIB4_4_NV:
- case GL_MAP1_VERTEX_ATTRIB5_4_NV:
- case GL_MAP1_VERTEX_ATTRIB6_4_NV:
- case GL_MAP1_VERTEX_ATTRIB7_4_NV:
- case GL_MAP1_VERTEX_ATTRIB8_4_NV:
- case GL_MAP1_VERTEX_ATTRIB9_4_NV:
- case GL_MAP1_VERTEX_ATTRIB10_4_NV:
- case GL_MAP1_VERTEX_ATTRIB11_4_NV:
- case GL_MAP1_VERTEX_ATTRIB12_4_NV:
- case GL_MAP1_VERTEX_ATTRIB13_4_NV:
- case GL_MAP1_VERTEX_ATTRIB14_4_NV:
- case GL_MAP1_VERTEX_ATTRIB15_4_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_vertex_program);
- {
- const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
- return ctx->Eval.Map1Attrib[map];
- }
- case GL_MAP2_VERTEX_ATTRIB0_4_NV:
- case GL_MAP2_VERTEX_ATTRIB1_4_NV:
- case GL_MAP2_VERTEX_ATTRIB2_4_NV:
- case GL_MAP2_VERTEX_ATTRIB3_4_NV:
- case GL_MAP2_VERTEX_ATTRIB4_4_NV:
- case GL_MAP2_VERTEX_ATTRIB5_4_NV:
- case GL_MAP2_VERTEX_ATTRIB6_4_NV:
- case GL_MAP2_VERTEX_ATTRIB7_4_NV:
- case GL_MAP2_VERTEX_ATTRIB8_4_NV:
- case GL_MAP2_VERTEX_ATTRIB9_4_NV:
- case GL_MAP2_VERTEX_ATTRIB10_4_NV:
- case GL_MAP2_VERTEX_ATTRIB11_4_NV:
- case GL_MAP2_VERTEX_ATTRIB12_4_NV:
- case GL_MAP2_VERTEX_ATTRIB13_4_NV:
- case GL_MAP2_VERTEX_ATTRIB14_4_NV:
- case GL_MAP2_VERTEX_ATTRIB15_4_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_vertex_program);
- {
- const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
- return ctx->Eval.Map2Attrib[map];
- }
-
- case GL_FRAGMENT_PROGRAM_NV:
- if (ctx->API != API_OPENGL)
- goto invalid_enum_error;
- CHECK_EXTENSION(NV_fragment_program);
- return ctx->FragmentProgram.Enabled;
-
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
if (ctx->API != API_OPENGL)
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index b0458a1e8..d6e45d6e8 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -77,19 +77,6 @@ GLuint _mesa_evaluator_components( GLenum target )
default: break;
}
- /* XXX need to check for the vertex program extension
- if (!ctx->Extensions.NV_vertex_program)
- return 0;
- */
-
- if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV &&
- target <= GL_MAP1_VERTEX_ATTRIB15_4_NV)
- return 4;
-
- if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV &&
- target <= GL_MAP2_VERTEX_ATTRIB15_4_NV)
- return 4;
-
return 0;
}
@@ -119,25 +106,6 @@ get_1d_map( struct gl_context *ctx, GLenum target )
return &ctx->EvalMap.Map1Texture3;
case GL_MAP1_TEXTURE_COORD_4:
return &ctx->EvalMap.Map1Texture4;
- case GL_MAP1_VERTEX_ATTRIB0_4_NV:
- case GL_MAP1_VERTEX_ATTRIB1_4_NV:
- case GL_MAP1_VERTEX_ATTRIB2_4_NV:
- case GL_MAP1_VERTEX_ATTRIB3_4_NV:
- case GL_MAP1_VERTEX_ATTRIB4_4_NV:
- case GL_MAP1_VERTEX_ATTRIB5_4_NV:
- case GL_MAP1_VERTEX_ATTRIB6_4_NV:
- case GL_MAP1_VERTEX_ATTRIB7_4_NV:
- case GL_MAP1_VERTEX_ATTRIB8_4_NV:
- case GL_MAP1_VERTEX_ATTRIB9_4_NV:
- case GL_MAP1_VERTEX_ATTRIB10_4_NV:
- case GL_MAP1_VERTEX_ATTRIB11_4_NV:
- case GL_MAP1_VERTEX_ATTRIB12_4_NV:
- case GL_MAP1_VERTEX_ATTRIB13_4_NV:
- case GL_MAP1_VERTEX_ATTRIB14_4_NV:
- case GL_MAP1_VERTEX_ATTRIB15_4_NV:
- if (!ctx->Extensions.NV_vertex_program)
- return NULL;
- return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV];
default:
return NULL;
}
@@ -169,25 +137,6 @@ get_2d_map( struct gl_context *ctx, GLenum target )
return &ctx->EvalMap.Map2Texture3;
case GL_MAP2_TEXTURE_COORD_4:
return &ctx->EvalMap.Map2Texture4;
- case GL_MAP2_VERTEX_ATTRIB0_4_NV:
- case GL_MAP2_VERTEX_ATTRIB1_4_NV:
- case GL_MAP2_VERTEX_ATTRIB2_4_NV:
- case GL_MAP2_VERTEX_ATTRIB3_4_NV:
- case GL_MAP2_VERTEX_ATTRIB4_4_NV:
- case GL_MAP2_VERTEX_ATTRIB5_4_NV:
- case GL_MAP2_VERTEX_ATTRIB6_4_NV:
- case GL_MAP2_VERTEX_ATTRIB7_4_NV:
- case GL_MAP2_VERTEX_ATTRIB8_4_NV:
- case GL_MAP2_VERTEX_ATTRIB9_4_NV:
- case GL_MAP2_VERTEX_ATTRIB10_4_NV:
- case GL_MAP2_VERTEX_ATTRIB11_4_NV:
- case GL_MAP2_VERTEX_ATTRIB12_4_NV:
- case GL_MAP2_VERTEX_ATTRIB13_4_NV:
- case GL_MAP2_VERTEX_ATTRIB14_4_NV:
- case GL_MAP2_VERTEX_ATTRIB15_4_NV:
- if (!ctx->Extensions.NV_vertex_program)
- return NULL;
- return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV];
default:
return NULL;
}
@@ -966,8 +915,6 @@ init_2d_map( struct gl_2d_map *map, int n, const float *initial )
void _mesa_init_eval( struct gl_context *ctx )
{
- int i;
-
/* Evaluators group */
ctx->Eval.Map1Color4 = GL_FALSE;
ctx->Eval.Map1Index = GL_FALSE;
@@ -978,7 +925,6 @@ void _mesa_init_eval( struct gl_context *ctx )
ctx->Eval.Map1TextureCoord4 = GL_FALSE;
ctx->Eval.Map1Vertex3 = GL_FALSE;
ctx->Eval.Map1Vertex4 = GL_FALSE;
- memset(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
ctx->Eval.Map2Color4 = GL_FALSE;
ctx->Eval.Map2Index = GL_FALSE;
ctx->Eval.Map2Normal = GL_FALSE;
@@ -988,7 +934,6 @@ void _mesa_init_eval( struct gl_context *ctx )
ctx->Eval.Map2TextureCoord4 = GL_FALSE;
ctx->Eval.Map2Vertex3 = GL_FALSE;
ctx->Eval.Map2Vertex4 = GL_FALSE;
- memset(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
ctx->Eval.AutoNormal = GL_FALSE;
ctx->Eval.MapGrid1un = 1;
ctx->Eval.MapGrid1u1 = 0.0;
@@ -1007,7 +952,6 @@ void _mesa_init_eval( struct gl_context *ctx )
static GLfloat index[1] = { 1.0 };
static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 };
- static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 };
init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex );
init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex );
@@ -1018,8 +962,6 @@ void _mesa_init_eval( struct gl_context *ctx )
init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord );
init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord );
init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord );
- for (i = 0; i < 16; i++)
- init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib );
init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex );
init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex );
@@ -1030,16 +972,12 @@ void _mesa_init_eval( struct gl_context *ctx )
init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord );
init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord );
init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord );
- for (i = 0; i < 16; i++)
- init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib );
}
}
void _mesa_free_eval_data( struct gl_context *ctx )
{
- int i;
-
/* Free evaluator data */
free(ctx->EvalMap.Map1Vertex3.Points);
free(ctx->EvalMap.Map1Vertex4.Points);
@@ -1050,8 +988,6 @@ void _mesa_free_eval_data( struct gl_context *ctx )
free(ctx->EvalMap.Map1Texture2.Points);
free(ctx->EvalMap.Map1Texture3.Points);
free(ctx->EvalMap.Map1Texture4.Points);
- for (i = 0; i < Elements(ctx->EvalMap.Map1Attrib); i++)
- free(ctx->EvalMap.Map1Attrib[i].Points);
free(ctx->EvalMap.Map2Vertex3.Points);
free(ctx->EvalMap.Map2Vertex4.Points);
@@ -1062,6 +998,4 @@ void _mesa_free_eval_data( struct gl_context *ctx )
free(ctx->EvalMap.Map2Texture2.Points);
free(ctx->EvalMap.Map2Texture3.Points);
free(ctx->EvalMap.Map2Texture4.Points);
- for (i = 0; i < Elements(ctx->EvalMap.Map2Attrib); i++)
- free((ctx->EvalMap.Map2Attrib[i].Points));
}
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 4971ebc93..edee5967d 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -176,6 +176,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 },
{ "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 },
{ "GL_EXT_gpu_shader4", o(EXT_gpu_shader4), GL, 2006 },
+ { "GL_EXT_map_buffer_range", o(ARB_map_buffer_range), ES1 | ES2, 2012 },
{ "GL_EXT_multi_draw_arrays", o(dummy_true), GLL | ES1 | ES2, 1999 },
{ "GL_EXT_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2005 },
{ "GL_EXT_packed_float", o(EXT_packed_float), GL, 2004 },
@@ -301,7 +302,6 @@ static const struct extension extension_table[] = {
{ "GL_NV_draw_buffers", o(dummy_true), ES2, 2011 },
{ "GL_NV_fbo_color_attachments", o(EXT_framebuffer_object), ES2, 2010 },
{ "GL_NV_fog_distance", o(NV_fog_distance), GLL, 2001 },
- { "GL_NV_fragment_program", o(NV_fragment_program), GLL, 2001 },
{ "GL_NV_fragment_program_option", o(NV_fragment_program_option), GLL, 2005 },
{ "GL_NV_light_max_exponent", o(NV_light_max_exponent), GLL, 1999 },
{ "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2000 },
@@ -312,8 +312,6 @@ static const struct extension extension_table[] = {
{ "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 },
{ "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GLL, 1999 },
{ "GL_NV_texture_rectangle", o(NV_texture_rectangle), GLL, 2000 },
- { "GL_NV_vertex_program1_1", o(NV_vertex_program1_1), GLL, 2001 },
- { "GL_NV_vertex_program", o(NV_vertex_program), GLL, 2000 },
{ "GL_S3_s3tc", o(S3_s3tc), GL, 1999 },
{ "GL_SGIS_generate_mipmap", o(dummy_true), GLL, 1997 },
{ "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 1997 },
@@ -475,9 +473,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
/*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
- ctx->Extensions.NV_vertex_program = GL_TRUE;
- ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
- ctx->Extensions.NV_fragment_program = GL_TRUE;
ctx->Extensions.NV_fragment_program_option = GL_TRUE;
ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
_mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
diff --git a/mesalib/src/mesa/main/extensions.h b/mesalib/src/mesa/main/extensions.h
index 712c6e94d..8acbd4b68 100644
--- a/mesalib/src/mesa/main/extensions.h
+++ b/mesalib/src/mesa/main/extensions.h
@@ -41,8 +41,6 @@
struct gl_context;
-#if _HAVE_FULL_GL
-
extern void _mesa_enable_sw_extensions(struct gl_context *ctx);
extern void _mesa_enable_1_3_extensions(struct gl_context *ctx);
@@ -71,21 +69,4 @@ _mesa_get_extension_count(struct gl_context *ctx);
extern const GLubyte *
_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
-
-#else
-
-/** No-op */
-#define _mesa_extensions_dtr( ctx ) ((void)0)
-
-/** No-op */
-#define _mesa_extensions_ctr( ctx ) ((void)0)
-
-/** No-op */
-#define _mesa_extensions_get_string( ctx ) "GL_EXT_texture_object"
-
-/** No-op */
-#define _mesa_enable_extension( c, n ) ((void)0)
-
-#endif
-
#endif
diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c
index 8a63acdf1..f45b823b1 100644
--- a/mesalib/src/mesa/main/feedback.c
+++ b/mesalib/src/mesa/main/feedback.c
@@ -449,7 +449,6 @@ _mesa_RenderMode( GLenum mode )
ctx->Select.Hits = 0;
ctx->Select.NameStackDepth = 0;
break;
-#if _HAVE_FULL_GL
case GL_FEEDBACK:
if (ctx->Feedback.Count > ctx->Feedback.BufferSize) {
/* overflow */
@@ -460,7 +459,6 @@ _mesa_RenderMode( GLenum mode )
}
ctx->Feedback.Count = 0;
break;
-#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
return 0;
@@ -475,14 +473,12 @@ _mesa_RenderMode( GLenum mode )
_mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
}
break;
-#if _HAVE_FULL_GL
case GL_FEEDBACK:
if (ctx->Feedback.BufferSize==0) {
/* haven't called glFeedbackBuffer yet */
_mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
}
break;
-#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
return 0;
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index 0a98c4acf..efdca015e 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -544,7 +544,6 @@ static void emit_dst( struct prog_dst_register *dst,
dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
dst->CondMask = COND_TR; /* always pass cond test */
dst->CondSwizzle = SWIZZLE_NOOP;
- dst->CondSrc = 0;
/* Check that bitfield sizes aren't exceeded */
ASSERT(dst->Index == reg.idx);
}
diff --git a/mesalib/src/mesa/main/fog.h b/mesalib/src/mesa/main/fog.h
index 9191a4a54..20a75e96b 100644
--- a/mesalib/src/mesa/main/fog.h
+++ b/mesalib/src/mesa/main/fog.h
@@ -43,8 +43,6 @@
struct gl_context;
-#if _HAVE_FULL_GL
-
extern void GLAPIENTRY
_mesa_Fogf(GLenum pname, GLfloat param);
@@ -59,11 +57,4 @@ _mesa_Fogiv(GLenum pname, const GLint *params );
extern void _mesa_init_fog( struct gl_context * ctx );
-#else
-
-/** No-op */
-#define _mesa_init_fog( c ) ((void)0)
-
-#endif
-
#endif
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 7570fab96..e38d594e2 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -305,8 +305,6 @@ EXTRA_EXT(NV_fog_distance);
EXTRA_EXT(EXT_texture_filter_anisotropic);
EXTRA_EXT(IBM_rasterpos_clip);
EXTRA_EXT(NV_point_sprite);
-EXTRA_EXT(NV_vertex_program);
-EXTRA_EXT(NV_fragment_program);
EXTRA_EXT(NV_texture_rectangle);
EXTRA_EXT(EXT_stencil_two_side);
EXTRA_EXT(NV_light_max_exponent);
@@ -330,8 +328,6 @@ EXTRA_EXT(ARB_transform_feedback3);
EXTRA_EXT(EXT_pixel_buffer_object);
EXTRA_EXT(ARB_vertex_program);
EXTRA_EXT2(NV_point_sprite, ARB_point_sprite);
-EXTRA_EXT2(ARB_fragment_program, NV_fragment_program);
-EXTRA_EXT2(ARB_vertex_program, NV_vertex_program);
EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program);
EXTRA_EXT(ARB_geometry_shader4);
EXTRA_EXT(ARB_color_buffer_float);
@@ -344,23 +340,6 @@ EXTRA_EXT(ARB_uniform_buffer_object);
EXTRA_EXT(ARB_timer_query);
static const int
-extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
- EXT(ARB_vertex_program),
- EXT(ARB_fragment_program),
- EXT(NV_vertex_program),
- EXTRA_END
-};
-
-static const int
-extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
- EXT(NV_vertex_program),
- EXT(ARB_vertex_program),
- EXT(ARB_fragment_program),
- EXT(NV_vertex_program),
- EXTRA_END
-};
-
-static const int
extra_NV_primitive_restart[] = {
EXT(NV_primitive_restart),
EXTRA_END
@@ -727,14 +706,6 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_int = ctx->CopyWriteBuffer->Name;
break;
- case GL_FRAGMENT_PROGRAM_BINDING_NV:
- v->value_int =
- ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0;
- break;
- case GL_VERTEX_PROGRAM_BINDING_NV:
- v->value_int =
- ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0;
- break;
case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
v->value_int = ctx->Pack.BufferObj->Name;
break;
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index 7dde0f9e8..7a25cb10c 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -259,7 +259,7 @@ descriptor=[
{ "apis": ["GL", "GL_CORE", "GLES2"], "params": [
# == GL_MAX_TEXTURE_COORDS_NV
- [ "MAX_TEXTURE_COORDS_ARB", "CONTEXT_INT(Const.MaxTextureCoordUnits), extra_ARB_fragment_program_NV_fragment_program" ],
+ [ "MAX_TEXTURE_COORDS_ARB", "CONTEXT_INT(Const.MaxTextureCoordUnits), extra_ARB_fragment_program" ],
[ "PACK_IMAGE_HEIGHT", "CONTEXT_INT(Pack.ImageHeight), NO_EXTRA" ],
[ "PACK_ROW_LENGTH", "CONTEXT_INT(Pack.RowLength), NO_EXTRA" ],
[ "PACK_SKIP_PIXELS", "CONTEXT_INT(Pack.SkipPixels), NO_EXTRA" ],
@@ -289,7 +289,7 @@ descriptor=[
# GL_ARB_fragment_program
# == GL_MAX_TEXTURE_IMAGE_UNITS_NV
- [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxTextureImageUnits), extra_ARB_fragment_program_NV_fragment_program" ],
+ [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxTextureImageUnits), extra_ARB_fragment_program" ],
[ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxVertexTextureImageUnits), extra_ARB_vertex_shader" ],
[ "MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxCombinedTextureImageUnits), extra_ARB_vertex_shader" ],
@@ -513,46 +513,6 @@ descriptor=[
[ "POINT_SPRITE_R_MODE_NV", "CONTEXT_ENUM(Point.SpriteRMode), extra_NV_point_sprite" ],
[ "POINT_SPRITE_COORD_ORIGIN", "CONTEXT_ENUM(Point.SpriteOrigin), extra_NV_point_sprite_ARB_point_sprite" ],
-# GL_NV_vertex_program
- [ "VERTEX_PROGRAM_BINDING_NV", "LOC_CUSTOM, TYPE_INT, 0, extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY0_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(0)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY1_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(1)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY2_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(2)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY3_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(3)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY4_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(4)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY5_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(5)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY6_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(6)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY7_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(7)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY8_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(8)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY9_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(9)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY10_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(10)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY11_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(11)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY12_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(12)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY13_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(13)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY14_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(14)].Enabled), extra_NV_vertex_program" ],
- [ "VERTEX_ATTRIB_ARRAY15_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(15)].Enabled), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB0_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[0]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB1_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[1]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB2_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[2]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB3_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[3]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB4_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[4]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB5_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[5]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB6_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[6]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB7_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[7]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB8_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[8]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB9_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[9]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB10_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[10]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB11_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[11]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB12_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[12]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB13_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[13]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB14_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[14]), extra_NV_vertex_program" ],
- [ "MAP1_VERTEX_ATTRIB15_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[15]), extra_NV_vertex_program" ],
-
-# GL_NV_fragment_program
- [ "FRAGMENT_PROGRAM_NV", "CONTEXT_BOOL(FragmentProgram.Enabled), extra_NV_fragment_program" ],
- [ "FRAGMENT_PROGRAM_BINDING_NV", "LOC_CUSTOM, TYPE_INT, 0, extra_NV_fragment_program" ],
- [ "MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", "CONST(MAX_NV_FRAGMENT_PROGRAM_PARAMS), extra_NV_fragment_program" ],
-
# GL_NV_texture_rectangle
[ "TEXTURE_RECTANGLE_NV", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_NV_texture_rectangle" ],
[ "TEXTURE_BINDING_RECTANGLE_NV", "LOC_CUSTOM, TYPE_INT, TEXTURE_RECT_INDEX, extra_NV_texture_rectangle" ],
@@ -582,23 +542,23 @@ descriptor=[
# GL_ARB_vertex_program
# == GL_VERTEX_PROGRAM_NV
- [ "VERTEX_PROGRAM_ARB", "CONTEXT_BOOL(VertexProgram.Enabled), extra_ARB_vertex_program_NV_vertex_program" ],
+ [ "VERTEX_PROGRAM_ARB", "CONTEXT_BOOL(VertexProgram.Enabled), extra_ARB_vertex_program" ],
# == GL_VERTEX_PROGRAM_POINT_SIZE_NV
- [ "VERTEX_PROGRAM_POINT_SIZE_ARB", "CONTEXT_BOOL(VertexProgram.PointSizeEnabled), extra_ARB_vertex_program_NV_vertex_program" ],
+ [ "VERTEX_PROGRAM_POINT_SIZE_ARB", "CONTEXT_BOOL(VertexProgram.PointSizeEnabled), extra_ARB_vertex_program" ],
# == GL_VERTEX_PROGRAM_TWO_SIDE_NV
- [ "VERTEX_PROGRAM_TWO_SIDE_ARB", "CONTEXT_BOOL(VertexProgram.TwoSideEnabled), extra_ARB_vertex_program_NV_vertex_program" ],
+ [ "VERTEX_PROGRAM_TWO_SIDE_ARB", "CONTEXT_BOOL(VertexProgram.TwoSideEnabled), extra_ARB_vertex_program" ],
# == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV
- [ "MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", "CONTEXT_INT(Const.MaxProgramMatrixStackDepth), extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ],
+ [ "MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", "CONTEXT_INT(Const.MaxProgramMatrixStackDepth), extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_MAX_TRACK_MATRICES_NV
- [ "MAX_PROGRAM_MATRICES_ARB", "CONTEXT_INT(Const.MaxProgramMatrices), extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ],
+ [ "MAX_PROGRAM_MATRICES_ARB", "CONTEXT_INT(Const.MaxProgramMatrices), extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_CURRENT_MATRIX_STACK_DEPTH_NV
- [ "CURRENT_MATRIX_STACK_DEPTH_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ],
+ [ "CURRENT_MATRIX_STACK_DEPTH_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_CURRENT_MATRIX_NV
- [ "CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ],
+ [ "CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_CURRENT_MATRIX_NV
[ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_PROGRAM_ERROR_POSITION_NV
- [ "PROGRAM_ERROR_POSITION_ARB", "CONTEXT_INT(Program.ErrorPos), extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ],
+ [ "PROGRAM_ERROR_POSITION_ARB", "CONTEXT_INT(Program.ErrorPos), extra_ARB_vertex_program_ARB_fragment_program" ],
# GL_ARB_fragment_program
[ "FRAGMENT_PROGRAM_ARB", "CONTEXT_BOOL(FragmentProgram.Enabled), extra_ARB_fragment_program" ],
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index 54e518d2b..a04db0dc7 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -137,9 +137,7 @@ _mesa_GetString( GLenum name )
return shading_language_version(ctx);
case GL_PROGRAM_ERROR_STRING_NV:
if (ctx->API == API_OPENGL &&
- (ctx->Extensions.NV_fragment_program ||
- ctx->Extensions.ARB_fragment_program ||
- ctx->Extensions.NV_vertex_program ||
+ (ctx->Extensions.ARB_fragment_program ||
ctx->Extensions.ARB_vertex_program)) {
return (const GLubyte *) ctx->Program.ErrorString;
}
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index ccdf56b4f..ba79f193b 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -829,7 +829,6 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
case GL_ETC1_RGB8_OES:
return _mesa_is_gles(ctx)
&& ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
-#if FEATURE_ES
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE4_R5_G6_B5_OES:
@@ -841,7 +840,6 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
case GL_PALETTE8_RGBA4_OES:
case GL_PALETTE8_RGB5_A1_OES:
return ctx->API == API_OPENGLES;
-#endif
default:
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/hint.h b/mesalib/src/mesa/main/hint.h
index 6c6206874..ca9659d58 100644
--- a/mesalib/src/mesa/main/hint.h
+++ b/mesalib/src/mesa/main/hint.h
@@ -41,19 +41,10 @@
struct gl_context;
-#if _HAVE_FULL_GL
-
extern void GLAPIENTRY
_mesa_Hint( GLenum target, GLenum mode );
extern void
_mesa_init_hint( struct gl_context * ctx );
-#else
-
-/** No-op */
-#define _mesa_init_hint( c ) ((void) 0)
-
-#endif
-
#endif
diff --git a/mesalib/src/mesa/main/light.h b/mesalib/src/mesa/main/light.h
index c751d6d6b..2e6a5003e 100644
--- a/mesalib/src/mesa/main/light.h
+++ b/mesalib/src/mesa/main/light.h
@@ -42,7 +42,6 @@ extern void GLAPIENTRY
_mesa_ProvokingVertexEXT(GLenum mode);
-#if _HAVE_FULL_GL
extern void GLAPIENTRY
_mesa_ColorMaterial( GLenum face, GLenum mode );
@@ -108,14 +107,4 @@ extern void _mesa_free_lighting_data( struct gl_context *ctx );
extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag );
-#else
-#define _mesa_update_color_material( c, r ) ((void)0)
-#define _mesa_material_bitmask( c, f, p, l, s ) 0
-#define _mesa_init_lighting( c ) ((void)0)
-#define _mesa_free_lighting_data( c ) ((void)0)
-#define _mesa_update_lighting( c ) ((void)0)
-#define _mesa_update_tnl_spaces( c, n ) ((void)0)
-#define GET_SHINE_TAB_ENTRY( table, dp, result ) ((result)=0)
-#endif
-
#endif
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index 76f5ea7cd..28c4e2b49 100644
--- a/mesalib/src/mesa/main/matrix.c
+++ b/mesalib/src/mesa/main/matrix.c
@@ -179,22 +179,6 @@ _mesa_MatrixMode( GLenum mode )
ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack));
ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
break;
- case GL_MATRIX0_NV:
- case GL_MATRIX1_NV:
- case GL_MATRIX2_NV:
- case GL_MATRIX3_NV:
- case GL_MATRIX4_NV:
- case GL_MATRIX5_NV:
- case GL_MATRIX6_NV:
- case GL_MATRIX7_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_vertex_program) {
- ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
- return;
- }
- break;
case GL_MATRIX0_ARB:
case GL_MATRIX1_ARB:
case GL_MATRIX2_ARB:
@@ -460,7 +444,6 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
}
-#if _HAVE_FULL_GL
void GLAPIENTRY
_mesa_LoadMatrixd( const GLdouble *m )
{
@@ -503,10 +486,8 @@ _mesa_Translated( GLdouble x, GLdouble y, GLdouble z )
{
_mesa_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
}
-#endif
-#if _HAVE_FULL_GL
void GLAPIENTRY
_mesa_LoadTransposeMatrixfARB( const GLfloat *m )
{
@@ -545,7 +526,6 @@ _mesa_MultTransposeMatrixdARB( const GLdouble *m )
_math_transposefd(tm, m);
_mesa_MultMatrixf(tm);
}
-#endif
diff --git a/mesalib/src/mesa/main/mfeatures.h b/mesalib/src/mesa/main/mfeatures.h
index 3162a0bbf..829c0563b 100644
--- a/mesalib/src/mesa/main/mfeatures.h
+++ b/mesalib/src/mesa/main/mfeatures.h
@@ -35,9 +35,6 @@
#define _HAVE_FULL_GL 1
#endif
-/* assert that a feature is disabled and should never be used */
-#define ASSERT_NO_FEATURE() ASSERT(0)
-
#ifndef FEATURE_ES1
#define FEATURE_ES1 0
#endif
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index b154b9527..c3378cd99 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -195,8 +195,6 @@ typedef enum
#define VERT_BIT_TEX(i) VERT_BIT(VERT_ATTRIB_TEX(i))
#define VERT_BIT_TEX_ALL \
BITFIELD64_RANGE(VERT_ATTRIB_TEX(0), VERT_ATTRIB_TEX_MAX)
-#define VERT_BIT_FF_NVALIAS \
- BITFIELD64_RANGE(VERT_ATTRIB_POS, VERT_ATTRIB_TEX(VERT_ATTRIB_TEX_MAX))
#define VERT_BIT_GENERIC_NV(i) VERT_BIT(VERT_ATTRIB_GENERIC_NV(i))
#define VERT_BIT_GENERIC_NV_ALL \
@@ -858,7 +856,6 @@ struct gl_eval_attrib
GLboolean Map1TextureCoord4;
GLboolean Map1Vertex3;
GLboolean Map1Vertex4;
- GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */
GLboolean Map2Color4;
GLboolean Map2Index;
GLboolean Map2Normal;
@@ -868,7 +865,6 @@ struct gl_eval_attrib
GLboolean Map2TextureCoord4;
GLboolean Map2Vertex3;
GLboolean Map2Vertex4;
- GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */
GLboolean AutoNormal;
/*@}*/
@@ -1719,7 +1715,6 @@ struct gl_evaluators
struct gl_1d_map Map1Texture2;
struct gl_1d_map Map1Texture3;
struct gl_1d_map Map1Texture4;
- struct gl_1d_map Map1Attrib[16]; /**< GL_NV_vertex_program */
/*@}*/
/**
@@ -1735,7 +1730,6 @@ struct gl_evaluators
struct gl_2d_map Map2Texture2;
struct gl_2d_map Map2Texture3;
struct gl_2d_map Map2Texture4;
- struct gl_2d_map Map2Attrib[16]; /**< GL_NV_vertex_program */
/*@}*/
};
@@ -1847,7 +1841,7 @@ struct gl_transform_feedback_state
* NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
* All values should fit in a 4-bit field.
*
- * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR, PROGRAM_NAMED_PARAM,
+ * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR,
* PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be considered to
* be "uniform" variables since they can only be set outside glBegin/End.
* They're also all stored in the same Parameters array.
@@ -1857,11 +1851,9 @@ typedef enum
PROGRAM_TEMPORARY, /**< machine->Temporary[] */
PROGRAM_INPUT, /**< machine->Inputs[] */
PROGRAM_OUTPUT, /**< machine->Outputs[] */
- PROGRAM_VARYING, /**< machine->Inputs[]/Outputs[] */
PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */
PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */
PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */
- PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */
PROGRAM_CONSTANT, /**< gl_program->Parameters[] */
PROGRAM_UNIFORM, /**< gl_program->Parameters[] */
PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */
@@ -1928,9 +1920,8 @@ struct gl_program
GLuint Id;
GLubyte *String; /**< Null-terminated program text */
GLint RefCount;
- GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_FRAGMENT_PROGRAM_NV */
+ GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB */
GLenum Format; /**< String encoding format */
- GLboolean Resident;
struct prog_instruction *Instructions;
@@ -1986,7 +1977,6 @@ struct gl_program
struct gl_vertex_program
{
struct gl_program Base; /**< base class */
- GLboolean IsNVProgram; /**< is this a GL_NV_vertex_program program? */
GLboolean IsPositionInvariant;
GLboolean UsesClipDistance;
};
@@ -2060,10 +2050,6 @@ struct gl_vertex_program_state
GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
- /* For GL_NV_vertex_program only: */
- GLenum TrackMatrix[MAX_PROGRAM_ENV_PARAMS / 4];
- GLenum TrackMatrixTransform[MAX_PROGRAM_ENV_PARAMS / 4];
-
/** Should fixed-function T&L be implemented with a vertex prog? */
GLboolean _MaintainTnlProgram;
@@ -2456,7 +2442,6 @@ struct gl_shader_compiler_options
{
/** Driver-selectable options: */
GLboolean EmitCondCodes; /**< Use condition codes? */
- GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */
GLboolean EmitNoLoops;
GLboolean EmitNoFunctions;
GLboolean EmitNoCont; /**< Emit CONT opcode? */
@@ -3068,7 +3053,6 @@ struct gl_extensions
GLboolean NV_blend_square;
GLboolean NV_conditional_render;
GLboolean NV_fog_distance;
- GLboolean NV_fragment_program;
GLboolean NV_fragment_program_option;
GLboolean NV_light_max_exponent;
GLboolean NV_point_sprite;
@@ -3078,8 +3062,6 @@ struct gl_extensions
GLboolean NV_texgen_reflection;
GLboolean NV_texture_env_combine4;
GLboolean NV_texture_rectangle;
- GLboolean NV_vertex_program;
- GLboolean NV_vertex_program1_1;
GLboolean SGIS_texture_lod;
GLboolean TDFX_texture_compression_FXT1;
GLboolean S3_s3tc;
diff --git a/mesalib/src/mesa/main/nvprogram.c b/mesalib/src/mesa/main/nvprogram.c
deleted file mode 100644
index fc5749afc..000000000
--- a/mesalib/src/mesa/main/nvprogram.c
+++ /dev/null
@@ -1,917 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 1999-2006 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.
- */
-
-/**
- * \file nvprogram.c
- * NVIDIA vertex/fragment program state management functions.
- * \author Brian Paul
- */
-
-/*
- * Regarding GL_NV_fragment/vertex_program, GL_NV_vertex_program1_1, etc:
- *
- * Portions of this software may use or implement intellectual
- * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
- * any and all warranties with respect to such intellectual property,
- * including any use thereof or modifications thereto.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/hash.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "main/nvprogram.h"
-#include "program/arbprogparse.h"
-#include "program/nvfragparse.h"
-#include "program/nvvertparse.h"
-#include "program/program.h"
-#include "program/prog_instruction.h"
-#include "program/prog_parameter.h"
-
-
-
-/**
- * Execute a vertex state program.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
-{
- struct gl_vertex_program *vprog;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target != GL_VERTEX_STATE_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glExecuteProgramNV");
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
- vprog = gl_vertex_program(_mesa_lookup_program(ctx, id));
-
- if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV");
- return;
- }
-
- _mesa_problem(ctx, "glExecuteProgramNV() not supported");
-}
-
-
-/**
- * Determine if a set of programs is resident in hardware.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-GLboolean GLAPIENTRY
-_mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
- GLboolean *residences)
-{
- GLint i, j;
- GLboolean allResident = GL_TRUE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(n)");
- return GL_FALSE;
- }
-
- for (i = 0; i < n; i++) {
- const struct gl_program *prog;
- if (ids[i] == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
- return GL_FALSE;
- }
- prog = _mesa_lookup_program(ctx, ids[i]);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
- return GL_FALSE;
- }
- if (prog->Resident) {
- if (!allResident)
- residences[i] = GL_TRUE;
- }
- else {
- if (allResident) {
- allResident = GL_FALSE;
- for (j = 0; j < i; j++)
- residences[j] = GL_TRUE;
- }
- residences[i] = GL_FALSE;
- }
- }
-
- return allResident;
-}
-
-
-/**
- * Request that a set of programs be resident in hardware.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids)
-{
- GLint i;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(n)");
- return;
- }
-
- /* just error checking for now */
- for (i = 0; i < n; i++) {
- struct gl_program *prog;
-
- if (ids[i] == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)");
- return;
- }
-
- prog = _mesa_lookup_program(ctx, ids[i]);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)");
- return;
- }
-
- /* XXX this is really a hardware thing we should hook out */
- prog->Resident = GL_TRUE;
- }
-}
-
-
-/**
- * Get a program parameter register.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramParameterfvNV(GLenum target, GLuint index,
- GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV) {
- if (pname == GL_PROGRAM_PARAMETER_NV) {
- if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) {
- COPY_4V(params, ctx->VertexProgram.Parameters[index]);
- }
- else {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetProgramParameterfvNV(index)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV(pname)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV(target)");
- return;
- }
-}
-
-
-/**
- * Get a program parameter register.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramParameterdvNV(GLenum target, GLuint index,
- GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV) {
- if (pname == GL_PROGRAM_PARAMETER_NV) {
- if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) {
- COPY_4V(params, ctx->VertexProgram.Parameters[index]);
- }
- else {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetProgramParameterdvNV(index)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterdvNV(pname)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterdvNV(target)");
- return;
- }
-}
-
-
-/**
- * Get a program attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params)
-{
- struct gl_program *prog;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV");
- return;
- }
-
- switch (pname) {
- case GL_PROGRAM_TARGET_NV:
- *params = prog->Target;
- return;
- case GL_PROGRAM_LENGTH_NV:
- *params = prog->String ?(GLint) strlen((char *) prog->String) : 0;
- return;
- case GL_PROGRAM_RESIDENT_NV:
- *params = prog->Resident;
- return;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivNV(pname)");
- return;
- }
-}
-
-
-/**
- * Get the program source code.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
-{
- struct gl_program *prog;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname != GL_PROGRAM_STRING_NV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringNV(pname)");
- return;
- }
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramStringNV");
- return;
- }
-
- if (prog->String) {
- memcpy(program, prog->String, strlen((char *) prog->String));
- }
- else {
- program[0] = 0;
- }
-}
-
-
-/**
- * Get matrix tracking information.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetTrackMatrixivNV(GLenum target, GLuint address,
- GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV
- && ctx->Extensions.NV_vertex_program) {
- GLuint i;
-
- if ((address & 0x3) || address >= MAX_NV_VERTEX_PROGRAM_PARAMS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetTrackMatrixivNV(address)");
- return;
- }
-
- i = address / 4;
-
- switch (pname) {
- case GL_TRACK_MATRIX_NV:
- params[0] = (GLint) ctx->VertexProgram.TrackMatrix[i];
- return;
- case GL_TRACK_MATRIX_TRANSFORM_NV:
- params[0] = (GLint) ctx->VertexProgram.TrackMatrixTransform[i];
- return;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV");
- return;
- }
-}
-
-
-/**
- * Get a vertex (or vertex array) attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params)
-{
- const struct gl_client_array *array;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)");
- return;
- }
-
- array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
-
- switch (pname) {
- case GL_ATTRIB_ARRAY_SIZE_NV:
- params[0] = array->Size;
- break;
- case GL_ATTRIB_ARRAY_STRIDE_NV:
- params[0] = array->Stride;
- break;
- case GL_ATTRIB_ARRAY_TYPE_NV:
- params[0] = array->Type;
- break;
- case GL_CURRENT_ATTRIB_NV:
- if (index == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetVertexAttribdvNV(index == 0)");
- return;
- }
- FLUSH_CURRENT(ctx, 0);
- COPY_4V(params, ctx->Current.Attrib[index]);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
- return;
- }
-}
-
-/**
- * Get a vertex (or vertex array) attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params)
-{
- const struct gl_client_array *array;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)");
- return;
- }
-
- array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
-
- switch (pname) {
- case GL_ATTRIB_ARRAY_SIZE_NV:
- params[0] = (GLfloat) array->Size;
- break;
- case GL_ATTRIB_ARRAY_STRIDE_NV:
- params[0] = (GLfloat) array->Stride;
- break;
- case GL_ATTRIB_ARRAY_TYPE_NV:
- params[0] = (GLfloat) array->Type;
- break;
- case GL_CURRENT_ATTRIB_NV:
- if (index == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetVertexAttribfvNV(index == 0)");
- return;
- }
- FLUSH_CURRENT(ctx, 0);
- COPY_4V(params, ctx->Current.Attrib[index]);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
- return;
- }
-}
-
-/**
- * Get a vertex (or vertex array) attribute.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params)
-{
- const struct gl_client_array *array;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)");
- return;
- }
-
- array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
-
- switch (pname) {
- case GL_ATTRIB_ARRAY_SIZE_NV:
- params[0] = array->Size;
- break;
- case GL_ATTRIB_ARRAY_STRIDE_NV:
- params[0] = array->Stride;
- break;
- case GL_ATTRIB_ARRAY_TYPE_NV:
- params[0] = array->Type;
- break;
- case GL_CURRENT_ATTRIB_NV:
- if (index == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetVertexAttribivNV(index == 0)");
- return;
- }
- FLUSH_CURRENT(ctx, 0);
- params[0] = (GLint) ctx->Current.Attrib[index][0];
- params[1] = (GLint) ctx->Current.Attrib[index][1];
- params[2] = (GLint) ctx->Current.Attrib[index][2];
- params[3] = (GLint) ctx->Current.Attrib[index][3];
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
- params[0] = array->BufferObj->Name;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
- return;
- }
-}
-
-
-/**
- * Get a vertex array attribute pointer.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerNV(index)");
- return;
- }
-
- if (pname != GL_ATTRIB_ARRAY_POINTER_NV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerNV(pname)");
- return;
- }
-
- *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr;
-}
-
-void
-_mesa_emit_nv_temp_initialization(struct gl_context *ctx,
- struct gl_program *program)
-{
- struct prog_instruction *inst;
- GLuint i;
- struct gl_shader_compiler_options* options =
- &ctx->ShaderCompilerOptions[_mesa_program_target_to_index(program->Target)];
-
- if (!options->EmitNVTempInitialization)
- return;
-
- /* We'll swizzle up a zero temporary so we can use it for the
- * ARL.
- */
- if (program->NumTemporaries == 0)
- program->NumTemporaries = 1;
-
- _mesa_insert_instructions(program, 0, program->NumTemporaries + 1);
-
- for (i = 0; i < program->NumTemporaries; i++) {
- struct prog_instruction *inst = &program->Instructions[i];
-
- inst->Opcode = OPCODE_SWZ;
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = i;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = 0;
- inst->SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO,
- SWIZZLE_ZERO,
- SWIZZLE_ZERO,
- SWIZZLE_ZERO);
- }
-
- inst = &program->Instructions[i];
- inst->Opcode = OPCODE_ARL;
- inst->DstReg.File = PROGRAM_ADDRESS;
- inst->DstReg.Index = 0;
- inst->DstReg.WriteMask = WRITEMASK_XYZW;
- inst->SrcReg[0].File = PROGRAM_TEMPORARY;
- inst->SrcReg[0].Index = 0;
- inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
-
- if (program->NumAddressRegs == 0)
- program->NumAddressRegs = 1;
-}
-
-void
-_mesa_setup_nv_temporary_count(struct gl_program *program)
-{
- GLuint i;
-
- program->NumTemporaries = 0;
- for (i = 0; i < program->NumInstructions; i++) {
- struct prog_instruction *inst = &program->Instructions[i];
-
- if (inst->DstReg.File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2(program->NumTemporaries,
- inst->DstReg.Index + 1);
- }
- if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
- inst->SrcReg[0].Index + 1);
- }
- if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
- inst->SrcReg[1].Index + 1);
- }
- if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) {
- program->NumTemporaries = MAX2((GLint)program->NumTemporaries,
- inst->SrcReg[2].Index + 1);
- }
- }
-}
-
-/**
- * Load/parse/compile a program.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
- const GLubyte *program)
-{
- struct gl_program *prog;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.NV_vertex_program
- && !ctx->Extensions.NV_fragment_program) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV()");
- return;
- }
-
- if (id == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)");
- return;
- }
-
- if (len < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(len)");
- return;
- }
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
- prog = _mesa_lookup_program(ctx, id);
-
- if (prog && prog->Target != 0 && prog->Target != target) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)");
- return;
- }
-
- if ((target == GL_VERTEX_PROGRAM_NV ||
- target == GL_VERTEX_STATE_PROGRAM_NV)
- && ctx->Extensions.NV_vertex_program) {
- struct gl_vertex_program *vprog = gl_vertex_program(prog);
- if (!vprog || prog == &_mesa_DummyProgram) {
- vprog = gl_vertex_program(ctx->Driver.NewProgram(ctx, target, id));
- if (!vprog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- _mesa_HashInsert(ctx->Shared->Programs, id, vprog);
- }
-
- if (ctx->Extensions.ARB_vertex_program
- && (strncmp((char *) program, "!!ARB", 5) == 0)) {
- _mesa_parse_arb_vertex_program(ctx, target, program, len, vprog);
- } else {
- _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog);
- }
- }
- else if (target == GL_FRAGMENT_PROGRAM_NV
- && ctx->Extensions.NV_fragment_program) {
- struct gl_fragment_program *fprog = gl_fragment_program(prog);
- if (!fprog || prog == &_mesa_DummyProgram) {
- fprog = gl_fragment_program(ctx->Driver.NewProgram(ctx, target, id));
- if (!fprog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- _mesa_HashInsert(ctx->Shared->Programs, id, fprog);
- }
- _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog);
- }
- else if (target == GL_FRAGMENT_PROGRAM_ARB
- && ctx->Extensions.ARB_fragment_program) {
- struct gl_fragment_program *fprog = gl_fragment_program(prog);
- if (!fprog || prog == &_mesa_DummyProgram) {
- fprog = gl_fragment_program(ctx->Driver.NewProgram(ctx, target, id));
- if (!fprog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- _mesa_HashInsert(ctx->Shared->Programs, id, fprog);
- }
- _mesa_parse_arb_fragment_program(ctx, target, program, len, fprog);
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)");
- }
-}
-
-
-
-/**
- * Set a sequence of program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_ProgramParameters4dvNV(GLenum target, GLuint index,
- GLsizei num, const GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
- GLint i;
- if (index + num > MAX_NV_VERTEX_PROGRAM_PARAMS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4dvNV");
- return;
- }
- for (i = 0; i < num; i++) {
- ctx->VertexProgram.Parameters[index + i][0] = (GLfloat) params[0];
- ctx->VertexProgram.Parameters[index + i][1] = (GLfloat) params[1];
- ctx->VertexProgram.Parameters[index + i][2] = (GLfloat) params[2];
- ctx->VertexProgram.Parameters[index + i][3] = (GLfloat) params[3];
- params += 4;
- };
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4dvNV");
- return;
- }
-}
-
-
-/**
- * Set a sequence of program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_ProgramParameters4fvNV(GLenum target, GLuint index,
- GLsizei num, const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
- GLint i;
- if (index + num > MAX_NV_VERTEX_PROGRAM_PARAMS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4fvNV");
- return;
- }
- for (i = 0; i < num; i++) {
- COPY_4V(ctx->VertexProgram.Parameters[index + i], params);
- params += 4;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4fvNV");
- return;
- }
-}
-
-
-
-/**
- * Setup tracking of matrices into program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_TrackMatrixNV(GLenum target, GLuint address,
- GLenum matrix, GLenum transform)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
- if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
- if (address & 0x3) {
- /* addr must be multiple of four */
- _mesa_error(ctx, GL_INVALID_VALUE, "glTrackMatrixNV(address)");
- return;
- }
-
- switch (matrix) {
- case GL_NONE:
- case GL_MODELVIEW:
- case GL_PROJECTION:
- case GL_TEXTURE:
- case GL_COLOR:
- case GL_MODELVIEW_PROJECTION_NV:
- case GL_MATRIX0_NV:
- case GL_MATRIX1_NV:
- case GL_MATRIX2_NV:
- case GL_MATRIX3_NV:
- case GL_MATRIX4_NV:
- case GL_MATRIX5_NV:
- case GL_MATRIX6_NV:
- case GL_MATRIX7_NV:
- /* OK, fallthrough */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(matrix)");
- return;
- }
-
- switch (transform) {
- case GL_IDENTITY_NV:
- case GL_INVERSE_NV:
- case GL_TRANSPOSE_NV:
- case GL_INVERSE_TRANSPOSE_NV:
- /* OK, fallthrough */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(transform)");
- return;
- }
-
- ctx->VertexProgram.TrackMatrix[address / 4] = matrix;
- ctx->VertexProgram.TrackMatrixTransform[address / 4] = transform;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(target)");
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- struct gl_program *prog;
- struct gl_fragment_program *fragProg;
- gl_constant_value *v;
-
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramNamedParameterNV");
- return;
- }
-
- if (len <= 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramNamedParameterNV(len)");
- return;
- }
-
- fragProg = gl_fragment_program(prog);
- v = _mesa_lookup_parameter_value(fragProg->Base.Parameters, len,
- (char *) name);
- if (v) {
- v[0].f = x;
- v[1].f = y;
- v[2].f = z;
- v[3].f = w;
- return;
- }
-
- _mesa_error(ctx, GL_INVALID_VALUE, "glProgramNamedParameterNV(name)");
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
- const float v[])
-{
- _mesa_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- _mesa_ProgramNamedParameter4fNV(id, len, name, (GLfloat)x, (GLfloat)y,
- (GLfloat)z, (GLfloat)w);
-}
-
-
-void GLAPIENTRY
-_mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
- const double v[])
-{
- _mesa_ProgramNamedParameter4fNV(id, len, name,
- (GLfloat)v[0], (GLfloat)v[1],
- (GLfloat)v[2], (GLfloat)v[3]);
-}
-
-
-void GLAPIENTRY
-_mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat *params)
-{
- struct gl_program *prog;
- struct gl_fragment_program *fragProg;
- const gl_constant_value *v;
-
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- prog = _mesa_lookup_program(ctx, id);
- if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramNamedParameterNV");
- return;
- }
-
- if (len <= 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramNamedParameterNV");
- return;
- }
-
- fragProg = gl_fragment_program(prog);
- v = _mesa_lookup_parameter_value(fragProg->Base.Parameters,
- len, (char *) name);
- if (v) {
- params[0] = v[0].f;
- params[1] = v[1].f;
- params[2] = v[2].f;
- params[3] = v[3].f;
- return;
- }
-
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramNamedParameterNV");
-}
-
-
-void GLAPIENTRY
-_mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble *params)
-{
- GLfloat floatParams[4];
- _mesa_GetProgramNamedParameterfvNV(id, len, name, floatParams);
- COPY_4V(params, floatParams);
-}
diff --git a/mesalib/src/mesa/main/nvprogram.h b/mesalib/src/mesa/main/nvprogram.h
deleted file mode 100644
index fc579a9fe..000000000
--- a/mesalib/src/mesa/main/nvprogram.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 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.
- *
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef NVPROGRAM_H
-#define NVPROGRAM_H
-
-#include "glheader.h"
-
-struct gl_context;
-struct gl_program;
-
-extern void GLAPIENTRY
-_mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params);
-
-extern GLboolean GLAPIENTRY
-_mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences);
-
-extern void GLAPIENTRY
-_mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids);
-
-extern void GLAPIENTRY
-_mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program);
-
-extern void GLAPIENTRY
-_mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer);
-
-extern void GLAPIENTRY
-_mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program);
-
-extern void GLAPIENTRY
-_mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLsizei num,
- const GLdouble *params);
-
-extern void GLAPIENTRY
-_mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLsizei num,
- const GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
-
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
- const float v[]);
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-
-extern void GLAPIENTRY
-_mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
- const double v[]);
-
-extern void GLAPIENTRY
-_mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name,
- GLdouble *params);
-
-extern void
-_mesa_setup_nv_temporary_count(struct gl_program *program);
-
-extern void
-_mesa_emit_nv_temp_initialization(struct gl_context *ctx,
- struct gl_program *program);
-
-#endif
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index 538f3cf44..7d6e5a5e1 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -62,9 +62,6 @@ _mesa_PointSize( GLfloat size )
}
-#if _HAVE_FULL_GL
-
-
void GLAPIENTRY
_mesa_PointParameteri( GLenum pname, GLint param )
{
@@ -221,7 +218,6 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
if (ctx->Driver.PointParameterfv)
(*ctx->Driver.PointParameterfv)(ctx, pname, params);
}
-#endif
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index d7d52daa8..eb53f8a4a 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -184,8 +184,6 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
ctx->Driver.PolygonMode(ctx, face, mode);
}
-#if _HAVE_FULL_GL
-
/**
* This routine updates the ctx->Polygon.Stipple state.
@@ -298,7 +296,6 @@ _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
_mesa_PolygonOffset(factor, bias * ctx->DrawBuffer->_DepthMaxF );
}
-#endif
/**********************************************************************/
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 6ee41f2b6..d40a35376 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -105,6 +105,7 @@ _mesa_init_shader_state(struct gl_context *ctx)
memset(&options, 0, sizeof(options));
options.MaxUnrollIterations = 32;
+ options.MaxIfDepth = UINT_MAX;
/* Default pragma settings */
options.DefaultPragmas.Optimize = GL_TRUE;
diff --git a/mesalib/src/mesa/main/stencil.c b/mesalib/src/mesa/main/stencil.c
index f47b57b8d..8d2948b8e 100644
--- a/mesalib/src/mesa/main/stencil.c
+++ b/mesalib/src/mesa/main/stencil.c
@@ -382,7 +382,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-#if _HAVE_FULL_GL
/* GL_EXT_stencil_two_side */
void GLAPIENTRY
_mesa_ActiveStencilFaceEXT(GLenum face)
@@ -406,7 +405,6 @@ _mesa_ActiveStencilFaceEXT(GLenum face)
_mesa_error(ctx, GL_INVALID_ENUM, "glActiveStencilFaceEXT(face)");
}
}
-#endif
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index bb61e6eda..957cc6df6 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -275,7 +275,6 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
}
}
-#if FEATURE_ES1
if (ctx->API == API_OPENGLES) {
if (formats) {
formats[n++] = GL_PALETTE4_RGB8_OES;
@@ -293,7 +292,6 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
n += 10;
}
}
-#endif
return n;
}
diff --git a/mesalib/src/mesa/main/texcompress.h b/mesalib/src/mesa/main/texcompress.h
index 34f4fae7a..359b9168a 100644
--- a/mesalib/src/mesa/main/texcompress.h
+++ b/mesalib/src/mesa/main/texcompress.h
@@ -31,8 +31,6 @@
struct gl_context;
-#if _HAVE_FULL_GL
-
extern GLenum
_mesa_gl_compressed_format_base_format(GLenum format);
@@ -55,13 +53,4 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
const GLubyte *src, GLint srcRowStride,
GLfloat *dest);
-#else /* _HAVE_FULL_GL */
-
-/* no-op macros */
-#define _mesa_get_compressed_formats( c, f ) 0
-#define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0
-#define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0)
-
-#endif /* _HAVE_FULL_GL */
-
#endif /* TEXCOMPRESS_H */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 6c8bb85b8..b88931743 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1966,7 +1966,6 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
}
switch (internalFormat) {
-#if FEATURE_ES
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE4_R5_G6_B5_OES:
@@ -2005,7 +2004,6 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
*/
level = -level;
break;
-#endif
default:
/* check level */
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 513f3bb05..224d8a825 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -769,6 +769,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
target = GL_TEXTURE_BUFFER;
break;
case TEXTURE_EXTERNAL_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_EXTERNAL_OES;
+ break;
default:
/* no-op */
return NULL;
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 1fd09e985..0e5ba44ed 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -600,6 +600,13 @@ update_texture_state( struct gl_context *ctx )
texTarget = (gl_texture_index) (ffs(enabledTargets) - 1);
texObj = _mesa_get_fallback_texture(ctx, texTarget);
+
+ assert(texObj);
+ if (!texObj) {
+ /* invalid fallback texture: don't enable the texture unit */
+ continue;
+ }
+
_mesa_reference_texobj(&texUnit->_Current, texObj);
texUnit->_ReallyEnabled = 1 << texTarget;
}
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 9a2dec61b..522f5a704 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -432,38 +432,6 @@ _mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr)
/**
- * Set a vertex attribute array.
- * Note that these arrays DO alias the conventional GL vertex arrays
- * (position, normal, color, fog, texcoord, etc).
- * The generic attribute slots at #16 and above are not touched.
- */
-void GLAPIENTRY
-_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
-{
- const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT |
- FLOAT_BIT | DOUBLE_BIT);
- GLboolean normalized = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
- return;
- }
-
- if (type == GL_UNSIGNED_BYTE && size != 4) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)");
- return;
- }
-
- update_array(ctx, "glVertexAttribPointerNV", VERT_ATTRIB_GENERIC(index),
- legalTypes, 1, BGRA_OR_4,
- size, type, stride, normalized, GL_FALSE, ptr);
-}
-
-
-/**
* Set a generic vertex attribute array.
* Note that these arrays DO NOT alias the conventional GL vertex arrays
* (position, normal, color, fog, texcoord, etc).
diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h
index d48361256..b54e2f7df 100644
--- a/mesalib/src/mesa/main/varray.h
+++ b/mesalib/src/mesa/main/varray.h
@@ -65,8 +65,6 @@ _mesa_update_array_max_element(struct gl_client_array *array)
}
-#if _HAVE_FULL_GL
-
extern void GLAPIENTRY
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr);
@@ -142,11 +140,6 @@ _mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr);
extern void GLAPIENTRY
-_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
- GLsizei stride, const GLvoid *pointer);
-
-
-extern void GLAPIENTRY
_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
GLboolean normalized, GLsizei stride,
const GLvoid *pointer);
@@ -271,12 +264,4 @@ _mesa_init_varray( struct gl_context * ctx );
extern void
_mesa_free_varray_data(struct gl_context *ctx);
-#else
-
-/** No-op */
-#define _mesa_init_varray( c ) ((void)0)
-#define _mesa_free_varray_data( c ) ((void)0)
-
-#endif
-
#endif
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index aa6cf286a..462cc8849 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -135,7 +135,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
vfmt->DrawTransformFeedbackStreamInstanced);
}
- /* GL_NV_vertex_program */
+ /* Originally for GL_NV_vertex_program, this is also used by dlist.c */
if (ctx->API == API_OPENGL) {
SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 4991a551c..d5b9683db 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -2407,7 +2407,7 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name)
int index = _mesa_lookup_parameter_index(params, -1, name);
if (index < 0) {
index = _mesa_add_parameter(params, file, name, size, type->gl_type,
- NULL, NULL, 0x0);
+ NULL, NULL);
/* Sampler uniform values are stored in prog->SamplerUnits,
* and the entry in that array is selected by this index we
diff --git a/mesalib/src/mesa/program/nvfragparse.c b/mesalib/src/mesa/program/nvfragparse.c
deleted file mode 100644
index f251d7e6c..000000000
--- a/mesalib/src/mesa/program/nvfragparse.c
+++ /dev/null
@@ -1,1591 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2005 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.
- */
-
-/**
- * \file nvfragparse.c
- * NVIDIA fragment program parser.
- * \author Brian Paul
- */
-
-/*
- * Regarding GL_NV_fragment_program:
- *
- * Portions of this software may use or implement intellectual
- * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
- * any and all warranties with respect to such intellectual property,
- * including any use thereof or modifications thereto.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "program.h"
-#include "prog_parameter.h"
-#include "prog_print.h"
-#include "prog_instruction.h"
-#include "nvfragparse.h"
-
-
-#define INPUT_1V 1
-#define INPUT_2V 2
-#define INPUT_3V 3
-#define INPUT_1S 4
-#define INPUT_2S 5
-#define INPUT_CC 6
-#define INPUT_1V_T 7 /* one source vector, plus textureId */
-#define INPUT_3V_T 8 /* one source vector, plus textureId */
-#define INPUT_NONE 9
-#define INPUT_1V_S 10 /* a string and a vector register */
-#define OUTPUT_V 20
-#define OUTPUT_S 21
-#define OUTPUT_NONE 22
-
-/* IRIX defines some of these */
-#undef _R
-#undef _H
-#undef _X
-#undef _C
-#undef _S
-
-/* Optional suffixes */
-#define _R FLOAT32 /* float */
-#define _H FLOAT16 /* half-float */
-#define _X FIXED12 /* fixed */
-#define _C 0x08 /* set cond codes */
-#define _S 0x10 /* saturate, clamp result to [0,1] */
-
-struct instruction_pattern {
- const char *name;
- enum prog_opcode opcode;
- GLuint inputs;
- GLuint outputs;
- GLuint suffixes;
-};
-
-static const struct instruction_pattern Instructions[] = {
- { "ADD", OPCODE_ADD, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "COS", OPCODE_COS, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "DDX", OPCODE_DDX, INPUT_1V, OUTPUT_V, _R | _H | _C | _S },
- { "DDY", OPCODE_DDY, INPUT_1V, OUTPUT_V, _R | _H | _C | _S },
- { "DP3", OPCODE_DP3, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S },
- { "DP4", OPCODE_DP4, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S },
- { "DST", OPCODE_DP4, INPUT_2V, OUTPUT_V, _R | _H | _C | _S },
- { "EX2", OPCODE_DP4, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "FLR", OPCODE_FLR, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "FRC", OPCODE_FRC, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "KIL", OPCODE_KIL_NV, INPUT_CC, OUTPUT_NONE, 0 },
- { "LG2", OPCODE_LG2, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "LIT", OPCODE_LIT, INPUT_1V, OUTPUT_V, _R | _H | _C | _S },
- { "LRP", OPCODE_LRP, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MAD", OPCODE_MAD, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MAX", OPCODE_MAX, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MIN", OPCODE_MIN, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MOV", OPCODE_MOV, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "MUL", OPCODE_MUL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "PK2H", OPCODE_PK2H, INPUT_1V, OUTPUT_S, 0 },
- { "PK2US", OPCODE_PK2US, INPUT_1V, OUTPUT_S, 0 },
- { "PK4B", OPCODE_PK4B, INPUT_1V, OUTPUT_S, 0 },
- { "PK4UB", OPCODE_PK4UB, INPUT_1V, OUTPUT_S, 0 },
- { "POW", OPCODE_POW, INPUT_2S, OUTPUT_S, _R | _H | _C | _S },
- { "RCP", OPCODE_RCP, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "RFL", OPCODE_RFL, INPUT_2V, OUTPUT_V, _R | _H | _C | _S },
- { "RSQ", OPCODE_RSQ, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "SEQ", OPCODE_SEQ, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SFL", OPCODE_SFL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SGE", OPCODE_SGE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SGT", OPCODE_SGT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SIN", OPCODE_SIN, INPUT_1S, OUTPUT_S, _R | _H | _C | _S },
- { "SLE", OPCODE_SLE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SLT", OPCODE_SLT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SNE", OPCODE_SNE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "STR", OPCODE_STR, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "SUB", OPCODE_SUB, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S },
- { "TEX", OPCODE_TEX, INPUT_1V_T, OUTPUT_V, _C | _S },
- { "TXD", OPCODE_TXD, INPUT_3V_T, OUTPUT_V, _C | _S },
- { "TXP", OPCODE_TXP_NV, INPUT_1V_T, OUTPUT_V, _C | _S },
- { "UP2H", OPCODE_UP2H, INPUT_1S, OUTPUT_V, _C | _S },
- { "UP2US", OPCODE_UP2US, INPUT_1S, OUTPUT_V, _C | _S },
- { "UP4B", OPCODE_UP4B, INPUT_1S, OUTPUT_V, _C | _S },
- { "UP4UB", OPCODE_UP4UB, INPUT_1S, OUTPUT_V, _C | _S },
- { "X2D", OPCODE_X2D, INPUT_3V, OUTPUT_V, _R | _H | _C | _S },
- { "PRINT", OPCODE_PRINT, INPUT_1V_S, OUTPUT_NONE, 0 },
- { NULL, (enum prog_opcode) -1, 0, 0, 0 }
-};
-
-
-/*
- * Information needed or computed during parsing.
- * Remember, we can't modify the target program object until we've
- * _successfully_ parsed the program text.
- */
-struct parse_state {
- struct gl_context *ctx;
- const GLubyte *start; /* start of program string */
- const GLubyte *pos; /* current position */
- const GLubyte *curLine;
- struct gl_fragment_program *program; /* current program */
-
- struct gl_program_parameter_list *parameters;
-
- GLuint numInst; /* number of instructions parsed */
- GLuint inputsRead; /* bitmask of input registers used */
- GLuint outputsWritten; /* bitmask of 1 << FRAG_OUTPUT_* bits */
- GLuint texturesUsed[MAX_TEXTURE_IMAGE_UNITS];
-};
-
-
-
-/*
- * Called whenever we find an error during parsing.
- */
-static void
-record_error(struct parse_state *parseState, const char *msg, int lineNo)
-{
-#ifdef DEBUG
- GLint line, column;
- const GLubyte *lineStr;
- lineStr = _mesa_find_line_column(parseState->start,
- parseState->pos, &line, &column);
- _mesa_debug(parseState->ctx,
- "nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
- lineNo, line, column, (char *) lineStr, msg);
- free((void *) lineStr);
-#else
- (void) lineNo;
-#endif
-
- /* Check that no error was already recorded. Only record the first one. */
- if (parseState->ctx->Program.ErrorString[0] == 0) {
- _mesa_set_program_error(parseState->ctx,
- parseState->pos - parseState->start,
- msg);
- }
-}
-
-
-#define RETURN_ERROR \
-do { \
- record_error(parseState, "Unexpected end of input.", __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR1(msg) \
-do { \
- record_error(parseState, msg, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR2(msg1, msg2) \
-do { \
- char err[1000]; \
- sprintf(err, "%s %s", msg1, msg2); \
- record_error(parseState, err, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-
-
-
-/*
- * Search a list of instruction structures for a match.
- */
-static struct instruction_pattern
-MatchInstruction(const GLubyte *token)
-{
- const struct instruction_pattern *inst;
- struct instruction_pattern result;
-
- result.name = NULL;
- result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
- result.inputs = 0;
- result.outputs = 0;
- result.suffixes = 0;
-
- for (inst = Instructions; inst->name; inst++) {
- if (strncmp((const char *) token, inst->name, 3) == 0) {
- /* matched! */
- int i = 3;
- result = *inst;
- result.suffixes = 0;
- /* look at suffix */
- if (token[i] == 'R') {
- result.suffixes |= _R;
- i++;
- }
- else if (token[i] == 'H') {
- result.suffixes |= _H;
- i++;
- }
- else if (token[i] == 'X') {
- result.suffixes |= _X;
- i++;
- }
- if (token[i] == 'C') {
- result.suffixes |= _C;
- i++;
- }
- if (token[i] == '_' && token[i+1] == 'S' &&
- token[i+2] == 'A' && token[i+3] == 'T') {
- result.suffixes |= _S;
- }
- return result;
- }
- }
-
- return result;
-}
-
-
-
-
-/**********************************************************************/
-
-
-static GLboolean IsLetter(GLubyte b)
-{
- return (b >= 'a' && b <= 'z') ||
- (b >= 'A' && b <= 'Z') ||
- (b == '_') ||
- (b == '$');
-}
-
-
-static GLboolean IsDigit(GLubyte b)
-{
- return b >= '0' && b <= '9';
-}
-
-
-static GLboolean IsWhitespace(GLubyte b)
-{
- return b == ' ' || b == '\t' || b == '\n' || b == '\r';
-}
-
-
-/**
- * Starting at 'str' find the next token. A token can be an integer,
- * an identifier or punctuation symbol.
- * \return <= 0 we found an error, else, return number of characters parsed.
- */
-static GLint
-GetToken(struct parse_state *parseState, GLubyte *token)
-{
- const GLubyte *str = parseState->pos;
- GLint i = 0, j = 0;
-
- token[0] = 0;
-
- /* skip whitespace and comments */
- while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) {
- if (str[i] == '#') {
- /* skip comment */
- while (str[i] && (str[i] != '\n' && str[i] != '\r')) {
- i++;
- }
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- }
- else {
- /* skip whitespace */
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- i++;
- }
- }
-
- if (str[i] == 0)
- return -i;
-
- /* try matching an integer */
- while (str[i] && IsDigit(str[i])) {
- token[j++] = str[i++];
- }
- if (j > 0 || !str[i]) {
- token[j] = 0;
- return i;
- }
-
- /* try matching an identifier */
- if (IsLetter(str[i])) {
- while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) {
- token[j++] = str[i++];
- }
- token[j] = 0;
- return i;
- }
-
- /* punctuation character */
- if (str[i]) {
- token[0] = str[i++];
- token[1] = 0;
- return i;
- }
-
- /* end of input */
- token[0] = 0;
- return i;
-}
-
-
-/**
- * Get next token from input stream and increment stream pointer past token.
- */
-static GLboolean
-Parse_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- parseState->pos += i;
- return GL_TRUE;
-}
-
-
-/**
- * Get next token from input stream but don't increment stream pointer.
- */
-static GLboolean
-Peek_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i, len;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- len = (GLint) strlen((const char *) token);
- parseState->pos += (i - len);
- return GL_TRUE;
-}
-
-
-/**********************************************************************/
-
-static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = {
- "WPOS", "COL0", "COL1", "FOGC",
- "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
-};
-
-
-
-/**********************************************************************/
-
-/**
- * Try to match 'pattern' as the next token after any whitespace/comments.
- */
-static GLboolean
-Parse_String(struct parse_state *parseState, const char *pattern)
-{
- const GLubyte *m;
- GLint i;
-
- /* skip whitespace and comments */
- while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') {
- if (*parseState->pos == '#') {
- while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) {
- parseState->pos += 1;
- }
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- }
- else {
- /* skip whitespace */
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- parseState->pos += 1;
- }
- }
-
- /* Try to match the pattern */
- m = parseState->pos;
- for (i = 0; pattern[i]; i++) {
- if (*m != (GLubyte) pattern[i])
- return GL_FALSE;
- m += 1;
- }
- parseState->pos = m;
-
- return GL_TRUE; /* success */
-}
-
-
-static GLboolean
-Parse_Identifier(struct parse_state *parseState, GLubyte *ident)
-{
- if (!Parse_Token(parseState, ident))
- RETURN_ERROR;
- if (IsLetter(ident[0]))
- return GL_TRUE;
- else
- RETURN_ERROR1("Expected an identfier");
-}
-
-
-/**
- * Parse a floating point constant, or a defined symbol name.
- * [+/-]N[.N[eN]]
- * Output: number[0 .. 3] will get the value.
- */
-static GLboolean
-Parse_ScalarConstant(struct parse_state *parseState, GLfloat *number)
-{
- char *end = NULL;
-
- *number = (GLfloat) _mesa_strtof((const char *) parseState->pos, &end);
-
- if (end && end > (char *) parseState->pos) {
- /* got a number */
- parseState->pos = (GLubyte *) end;
- number[1] = *number;
- number[2] = *number;
- number[3] = *number;
- return GL_TRUE;
- }
- else {
- /* should be an identifier */
- GLubyte ident[100];
- const GLfloat *constant;
- if (!Parse_Identifier(parseState, ident))
- RETURN_ERROR1("Expected an identifier");
- constant = (GLfloat *)_mesa_lookup_parameter_value(parseState->parameters,
- -1,
- (const char *) ident);
- /* XXX Check that it's a constant and not a parameter */
- if (!constant) {
- RETURN_ERROR1("Undefined symbol");
- }
- else {
- COPY_4V(number, constant);
- return GL_TRUE;
- }
- }
-}
-
-
-
-/**
- * Parse a vector constant, one of:
- * { float }
- * { float, float }
- * { float, float, float }
- * { float, float, float, float }
- */
-static GLboolean
-Parse_VectorConstant(struct parse_state *parseState, GLfloat *vec)
-{
- /* "{" was already consumed */
-
- ASSIGN_4V(vec, 0.0, 0.0, 0.0, 1.0);
-
- if (!Parse_ScalarConstant(parseState, vec+0)) /* X */
- return GL_FALSE;
-
- if (Parse_String(parseState, "}")) {
- return GL_TRUE;
- }
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected comma in vector constant");
-
- if (!Parse_ScalarConstant(parseState, vec+1)) /* Y */
- return GL_FALSE;
-
- if (Parse_String(parseState, "}")) {
- return GL_TRUE;
- }
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected comma in vector constant");
-
- if (!Parse_ScalarConstant(parseState, vec+2)) /* Z */
- return GL_FALSE;
-
- if (Parse_String(parseState, "}")) {
- return GL_TRUE;
- }
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected comma in vector constant");
-
- if (!Parse_ScalarConstant(parseState, vec+3)) /* W */
- return GL_FALSE;
-
- if (!Parse_String(parseState, "}"))
- RETURN_ERROR1("Expected closing brace in vector constant");
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse <number>, <varname> or {a, b, c, d}.
- * Return number of values in the vector or scalar, or zero if parse error.
- */
-static GLuint
-Parse_VectorOrScalarConstant(struct parse_state *parseState, GLfloat *vec)
-{
- if (Parse_String(parseState, "{")) {
- return Parse_VectorConstant(parseState, vec);
- }
- else {
- GLboolean b = Parse_ScalarConstant(parseState, vec);
- if (b) {
- vec[1] = vec[2] = vec[3] = vec[0];
- }
- return b;
- }
-}
-
-
-/**
- * Parse a texture image source:
- * [TEX0 | TEX1 | .. | TEX15] , [1D | 2D | 3D | CUBE | RECT]
- */
-static GLboolean
-Parse_TextureImageId(struct parse_state *parseState,
- GLubyte *texUnit, GLubyte *texTarget)
-{
- GLubyte imageSrc[100];
- GLint unit;
-
- if (!Parse_Token(parseState, imageSrc))
- RETURN_ERROR;
-
- if (imageSrc[0] != 'T' ||
- imageSrc[1] != 'E' ||
- imageSrc[2] != 'X') {
- RETURN_ERROR1("Expected TEX# source");
- }
- unit = atoi((const char *) imageSrc + 3);
- if ((unit < 0 || unit >= MAX_TEXTURE_IMAGE_UNITS) ||
- (unit == 0 && (imageSrc[3] != '0' || imageSrc[4] != 0))) {
- RETURN_ERROR1("Invalied TEX# source index");
- }
- *texUnit = unit;
-
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
-
- if (Parse_String(parseState, "1D")) {
- *texTarget = TEXTURE_1D_INDEX;
- }
- else if (Parse_String(parseState, "2D")) {
- *texTarget = TEXTURE_2D_INDEX;
- }
- else if (Parse_String(parseState, "3D")) {
- *texTarget = TEXTURE_3D_INDEX;
- }
- else if (Parse_String(parseState, "CUBE")) {
- *texTarget = TEXTURE_CUBE_INDEX;
- }
- else if (Parse_String(parseState, "RECT")) {
- *texTarget = TEXTURE_RECT_INDEX;
- }
- else {
- RETURN_ERROR1("Invalid texture target token");
- }
-
- /* update record of referenced texture units */
- parseState->texturesUsed[*texUnit] |= (1 << *texTarget);
- if (_mesa_bitcount(parseState->texturesUsed[*texUnit]) > 1) {
- RETURN_ERROR1("Only one texture target can be used per texture unit.");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a scalar suffix like .x, .y, .z or .w or parse a swizzle suffix
- * like .wxyz, .xxyy, etc and return the swizzle indexes.
- */
-static GLboolean
-Parse_SwizzleSuffix(const GLubyte *token, GLuint swizzle[4])
-{
- if (token[1] == 0) {
- /* single letter swizzle (scalar) */
- if (token[0] == 'x')
- ASSIGN_4V(swizzle, 0, 0, 0, 0);
- else if (token[0] == 'y')
- ASSIGN_4V(swizzle, 1, 1, 1, 1);
- else if (token[0] == 'z')
- ASSIGN_4V(swizzle, 2, 2, 2, 2);
- else if (token[0] == 'w')
- ASSIGN_4V(swizzle, 3, 3, 3, 3);
- else
- return GL_FALSE;
- }
- else {
- /* 4-component swizzle (vector) */
- GLint k;
- for (k = 0; k < 4 && token[k]; k++) {
- if (token[k] == 'x')
- swizzle[k] = 0;
- else if (token[k] == 'y')
- swizzle[k] = 1;
- else if (token[k] == 'z')
- swizzle[k] = 2;
- else if (token[k] == 'w')
- swizzle[k] = 3;
- else
- return GL_FALSE;
- }
- if (k != 4)
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_CondCodeMask(struct parse_state *parseState,
- struct prog_dst_register *dstReg)
-{
- if (Parse_String(parseState, "EQ"))
- dstReg->CondMask = COND_EQ;
- else if (Parse_String(parseState, "GE"))
- dstReg->CondMask = COND_GE;
- else if (Parse_String(parseState, "GT"))
- dstReg->CondMask = COND_GT;
- else if (Parse_String(parseState, "LE"))
- dstReg->CondMask = COND_LE;
- else if (Parse_String(parseState, "LT"))
- dstReg->CondMask = COND_LT;
- else if (Parse_String(parseState, "NE"))
- dstReg->CondMask = COND_NE;
- else if (Parse_String(parseState, "TR"))
- dstReg->CondMask = COND_TR;
- else if (Parse_String(parseState, "FL"))
- dstReg->CondMask = COND_FL;
- else
- RETURN_ERROR1("Invalid condition code mask");
-
- /* look for optional .xyzw swizzle */
- if (Parse_String(parseState, ".")) {
- GLubyte token[100];
- GLuint swz[4];
-
- if (!Parse_Token(parseState, token)) /* get xyzw suffix */
- RETURN_ERROR;
-
- if (!Parse_SwizzleSuffix(token, swz))
- RETURN_ERROR1("Invalid swizzle suffix");
-
- dstReg->CondSwizzle = MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a temporary register: Rnn or Hnn
- */
-static GLboolean
-Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
-
- /* Should be 'R##' or 'H##' */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] != 'R' && token[0] != 'H')
- RETURN_ERROR1("Expected R## or H##");
-
- if (IsDigit(token[1])) {
- GLint reg = atoi((const char *) (token + 1));
- if (token[0] == 'H')
- reg += 32;
- if (reg >= MAX_NV_FRAGMENT_PROGRAM_TEMPS)
- RETURN_ERROR1("Invalid temporary register name");
- *tempRegNum = reg;
- }
- else {
- RETURN_ERROR1("Invalid temporary register name");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a write-only dummy register: RC or HC.
- */
-static GLboolean
-Parse_DummyReg(struct parse_state *parseState, GLint *regNum)
-{
- if (Parse_String(parseState, "RC")) {
- *regNum = 0;
- }
- else if (Parse_String(parseState, "HC")) {
- *regNum = 1;
- }
- else {
- RETURN_ERROR1("Invalid write-only register name");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse a program local parameter register "p[##]"
- */
-static GLboolean
-Parse_ProgramParamReg(struct parse_state *parseState, GLint *regNum)
-{
- GLubyte token[100];
-
- if (!Parse_String(parseState, "p["))
- RETURN_ERROR1("Expected p[");
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- /* a numbered program parameter register */
- GLint reg = atoi((const char *) token);
- if (reg >= MAX_NV_FRAGMENT_PROGRAM_PARAMS)
- RETURN_ERROR1("Invalid constant program number");
- *regNum = reg;
- }
- else {
- RETURN_ERROR;
- }
-
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse f[name] - fragment input register
- */
-static GLboolean
-Parse_FragReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
- GLint j;
-
- /* Match 'f[' */
- if (!Parse_String(parseState, "f["))
- RETURN_ERROR1("Expected f[");
-
- /* get <name> and look for match */
- if (!Parse_Token(parseState, token)) {
- RETURN_ERROR;
- }
- for (j = 0; InputRegisters[j]; j++) {
- if (strcmp((const char *) token, InputRegisters[j]) == 0) {
- *tempRegNum = j;
- parseState->inputsRead |= (1 << j);
- break;
- }
- }
- if (!InputRegisters[j]) {
- /* unknown input register label */
- RETURN_ERROR2("Invalid register name", token);
- }
-
- /* Match '[' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
-{
- GLubyte token[100];
-
- /* Match "o[" */
- if (!Parse_String(parseState, "o["))
- RETURN_ERROR1("Expected o[");
-
- /* Get output reg name */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- /* try to match an output register name */
- if (strcmp((char *) token, "COLR") == 0 ||
- strcmp((char *) token, "COLH") == 0) {
- /* note that we don't distinguish between COLR and COLH */
- *outputRegNum = FRAG_RESULT_COLOR;
- parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
- }
- else if (strcmp((char *) token, "DEPR") == 0) {
- *outputRegNum = FRAG_RESULT_DEPTH;
- parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
- }
- else {
- RETURN_ERROR1("Invalid output register name");
- }
-
- /* Match ']' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_MaskedDstReg(struct parse_state *parseState,
- struct prog_dst_register *dstReg)
-{
- GLubyte token[100];
- GLint idx;
-
- /* Dst reg can be R<n>, H<n>, o[n], RC or HC */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (strcmp((const char *) token, "RC") == 0 ||
- strcmp((const char *) token, "HC") == 0) {
- /* a write-only register */
- dstReg->File = PROGRAM_WRITE_ONLY;
- if (!Parse_DummyReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (token[0] == 'R' || token[0] == 'H') {
- /* a temporary register */
- dstReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (token[0] == 'o') {
- /* an output register */
- dstReg->File = PROGRAM_OUTPUT;
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else {
- RETURN_ERROR1("Invalid destination register name");
- }
-
- /* Parse optional write mask */
- if (Parse_String(parseState, ".")) {
- /* got a mask */
- GLint k = 0;
-
- if (!Parse_Token(parseState, token)) /* get xyzw writemask */
- RETURN_ERROR;
-
- dstReg->WriteMask = 0;
-
- if (token[k] == 'x') {
- dstReg->WriteMask |= WRITEMASK_X;
- k++;
- }
- if (token[k] == 'y') {
- dstReg->WriteMask |= WRITEMASK_Y;
- k++;
- }
- if (token[k] == 'z') {
- dstReg->WriteMask |= WRITEMASK_Z;
- k++;
- }
- if (token[k] == 'w') {
- dstReg->WriteMask |= WRITEMASK_W;
- k++;
- }
- if (k == 0) {
- RETURN_ERROR1("Invalid writemask character");
- }
-
- }
- else {
- dstReg->WriteMask = WRITEMASK_XYZW;
- }
-
- /* optional condition code mask */
- if (Parse_String(parseState, "(")) {
- /* ("EQ" | "GE" | "GT" | "LE" | "LT" | "NE" | "TR" | "FL".x|y|z|w) */
- /* ("EQ" | "GE" | "GT" | "LE" | "LT" | "NE" | "TR" | "FL".[xyzw]) */
- if (!Parse_CondCodeMask(parseState, dstReg))
- RETURN_ERROR;
-
- if (!Parse_String(parseState, ")")) /* consume ")" */
- RETURN_ERROR1("Expected )");
-
- return GL_TRUE;
- }
- else {
- /* no cond code mask */
- dstReg->CondMask = COND_TR;
- dstReg->CondSwizzle = SWIZZLE_NOOP;
- return GL_TRUE;
- }
-}
-
-
-/**
- * Parse a vector source (register, constant, etc):
- * <vectorSrc> ::= <absVectorSrc>
- * | <baseVectorSrc>
- * <absVectorSrc> ::= <negate> "|" <baseVectorSrc> "|"
- */
-static GLboolean
-Parse_VectorSrc(struct parse_state *parseState,
- struct prog_src_register *srcReg)
-{
- GLfloat sign = 1.0F;
- GLubyte token[100];
- GLint idx;
- GLuint negateBase, negateAbs;
-
- /*
- * First, take care of +/- and absolute value stuff.
- */
- if (Parse_String(parseState, "-"))
- sign = -1.0F;
- else if (Parse_String(parseState, "+"))
- sign = +1.0F;
-
- if (Parse_String(parseState, "|")) {
- srcReg->Abs = GL_TRUE;
- negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
-
- if (Parse_String(parseState, "-"))
- negateBase = NEGATE_XYZW;
- else if (Parse_String(parseState, "+"))
- negateBase = NEGATE_NONE;
- else
- negateBase = NEGATE_NONE;
- }
- else {
- srcReg->Abs = GL_FALSE;
- negateAbs = NEGATE_NONE;
- negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
- }
-
- srcReg->Negate = srcReg->Abs ? negateAbs : negateBase;
-
- /* This should be the real src vector/register name */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- /* Src reg can be Rn, Hn, f[n], p[n], a named parameter, a scalar
- * literal or vector literal.
- */
- if (token[0] == 'R' || token[0] == 'H') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'f') {
- /* XXX this might be an identifier! */
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_FragReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'p') {
- /* XXX this might be an identifier! */
- srcReg->File = PROGRAM_LOCAL_PARAM;
- if (!Parse_ProgramParamReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (IsLetter(token[0])){
- GLubyte ident[100];
- GLint paramIndex;
- if (!Parse_Identifier(parseState, ident))
- RETURN_ERROR;
- paramIndex = _mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) ident);
- if (paramIndex < 0) {
- RETURN_ERROR2("Undefined constant or parameter: ", ident);
- }
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (IsDigit(token[0]) || token[0] == '-' || token[0] == '+' || token[0] == '.'){
- /* literal scalar constant */
- GLfloat values[4];
- GLuint paramIndex;
- if (!Parse_ScalarConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- (gl_constant_value *) values,
- 4, NULL);
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (token[0] == '{'){
- /* literal vector constant */
- GLfloat values[4];
- GLuint paramIndex;
- (void) Parse_String(parseState, "{");
- if (!Parse_VectorConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- (gl_constant_value *) values,
- 4, NULL);
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else {
- RETURN_ERROR2("Invalid source register name", token);
- }
-
- /* init swizzle fields */
- srcReg->Swizzle = SWIZZLE_NOOP;
-
- /* Look for optional swizzle suffix */
- if (Parse_String(parseState, ".")) {
- GLuint swz[4];
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (!Parse_SwizzleSuffix(token, swz))
- RETURN_ERROR1("Invalid swizzle suffix");
-
- srcReg->Swizzle = MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
- }
-
- /* Finish absolute value */
- if (srcReg->Abs && !Parse_String(parseState, "|")) {
- RETURN_ERROR1("Expected |");
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ScalarSrcReg(struct parse_state *parseState,
- struct prog_src_register *srcReg)
-{
- GLubyte token[100];
- GLfloat sign = 1.0F;
- GLboolean needSuffix = GL_TRUE;
- GLint idx;
- GLuint negateBase, negateAbs;
-
- /*
- * First, take care of +/- and absolute value stuff.
- */
- if (Parse_String(parseState, "-"))
- sign = -1.0F;
- else if (Parse_String(parseState, "+"))
- sign = +1.0F;
-
- if (Parse_String(parseState, "|")) {
- srcReg->Abs = GL_TRUE;
- negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
-
- if (Parse_String(parseState, "-"))
- negateBase = NEGATE_XYZW;
- else if (Parse_String(parseState, "+"))
- negateBase = NEGATE_NONE;
- else
- negateBase = NEGATE_NONE;
- }
- else {
- srcReg->Abs = GL_FALSE;
- negateAbs = NEGATE_NONE;
- negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
- }
-
- srcReg->Negate = srcReg->Abs ? negateAbs : negateBase;
-
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- /* Src reg can be R<n>, H<n> or a named fragment attrib */
- if (token[0] == 'R' || token[0] == 'H') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'f') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_FragReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == '{') {
- /* vector literal */
- GLfloat values[4];
- GLuint paramIndex;
- (void) Parse_String(parseState, "{");
- if (!Parse_VectorConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- (gl_constant_value *) values,
- 4, NULL);
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (IsLetter(token[0])){
- /* named param/constant */
- GLubyte ident[100];
- GLint paramIndex;
- if (!Parse_Identifier(parseState, ident))
- RETURN_ERROR;
- paramIndex = _mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) ident);
- if (paramIndex < 0) {
- RETURN_ERROR2("Undefined constant or parameter: ", ident);
- }
- srcReg->File = PROGRAM_NAMED_PARAM;
- srcReg->Index = paramIndex;
- }
- else if (IsDigit(token[0])) {
- /* scalar literal */
- GLfloat values[4];
- GLuint paramIndex;
- if (!Parse_ScalarConstant(parseState, values))
- RETURN_ERROR;
- paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
- (gl_constant_value *) values,
- 4, NULL);
- srcReg->Index = paramIndex;
- srcReg->File = PROGRAM_NAMED_PARAM;
- needSuffix = GL_FALSE;
- }
- else {
- RETURN_ERROR2("Invalid scalar source argument", token);
- }
-
- srcReg->Swizzle = 0;
- if (needSuffix) {
- /* parse .[xyzw] suffix */
- if (!Parse_String(parseState, "."))
- RETURN_ERROR1("Expected .");
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == 'x' && token[1] == 0) {
- srcReg->Swizzle = 0;
- }
- else if (token[0] == 'y' && token[1] == 0) {
- srcReg->Swizzle = 1;
- }
- else if (token[0] == 'z' && token[1] == 0) {
- srcReg->Swizzle = 2;
- }
- else if (token[0] == 'w' && token[1] == 0) {
- srcReg->Swizzle = 3;
- }
- else {
- RETURN_ERROR1("Invalid scalar source suffix");
- }
- }
-
- /* Finish absolute value */
- if (srcReg->Abs && !Parse_String(parseState, "|")) {
- RETURN_ERROR1("Expected |");
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_PrintInstruction(struct parse_state *parseState,
- struct prog_instruction *inst)
-{
- const GLubyte *str;
- GLubyte *msg;
- GLuint len;
- GLint idx;
-
- /* The first argument is a literal string 'just like this' */
- if (!Parse_String(parseState, "'"))
- RETURN_ERROR1("Expected '");
-
- str = parseState->pos;
- for (len = 0; str[len] != '\''; len++) /* find closing quote */
- ;
- parseState->pos += len + 1;
- msg = malloc(len + 1);
-
- memcpy(msg, str, len);
- msg[len] = 0;
- inst->Data = msg;
-
- if (Parse_String(parseState, ",")) {
- /* got an optional register to print */
- GLubyte token[100];
- GetToken(parseState, token);
- if (token[0] == 'o') {
- /* dst reg */
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- inst->SrcReg[0].Index = idx;
- inst->SrcReg[0].File = PROGRAM_OUTPUT;
- }
- else {
- /* src reg */
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- }
- }
- else {
- inst->SrcReg[0].File = PROGRAM_UNDEFINED;
- }
-
- inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
- inst->SrcReg[0].Abs = GL_FALSE;
- inst->SrcReg[0].Negate = NEGATE_NONE;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_InstructionSequence(struct parse_state *parseState,
- struct prog_instruction program[])
-{
- while (1) {
- struct prog_instruction *inst = program + parseState->numInst;
- struct instruction_pattern instMatch;
- GLubyte token[100];
-
- /* Initialize the instruction */
- _mesa_init_instructions(inst, 1);
-
- /* special instructions */
- if (Parse_String(parseState, "DEFINE")) {
- GLubyte id[100];
- GLfloat value[7]; /* yes, 7 to be safe */
- if (!Parse_Identifier(parseState, id))
- RETURN_ERROR;
- /* XXX make sure id is not a reserved identifer, like R9 */
- if (!Parse_String(parseState, "="))
- RETURN_ERROR1("Expected =");
- if (!Parse_VectorOrScalarConstant(parseState, value))
- RETURN_ERROR;
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR1("Expected ;");
- if (_mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) id) >= 0) {
- RETURN_ERROR2(id, "already defined");
- }
- _mesa_add_named_parameter(parseState->parameters,
- (const char *) id,
- (gl_constant_value *) value);
- }
- else if (Parse_String(parseState, "DECLARE")) {
- GLubyte id[100];
- GLfloat value[7] = {0, 0, 0, 0, 0, 0, 0}; /* yes, to be safe */
- if (!Parse_Identifier(parseState, id))
- RETURN_ERROR;
- /* XXX make sure id is not a reserved identifer, like R9 */
- if (Parse_String(parseState, "=")) {
- if (!Parse_VectorOrScalarConstant(parseState, value))
- RETURN_ERROR;
- }
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR1("Expected ;");
- if (_mesa_lookup_parameter_index(parseState->parameters,
- -1, (const char *) id) >= 0) {
- RETURN_ERROR2(id, "already declared");
- }
- _mesa_add_named_parameter(parseState->parameters,
- (const char *) id,
- (gl_constant_value *) value);
- }
- else if (Parse_String(parseState, "END")) {
- inst->Opcode = OPCODE_END;
- parseState->numInst++;
- if (Parse_Token(parseState, token)) {
- RETURN_ERROR1("Code after END opcode.");
- }
- break;
- }
- else {
- /* general/arithmetic instruction */
-
- /* get token */
- if (!Parse_Token(parseState, token)) {
- RETURN_ERROR1("Missing END instruction.");
- }
-
- /* try to find matching instuction */
- instMatch = MatchInstruction(token);
- if (instMatch.opcode >= MAX_OPCODE) {
- /* bad instruction name */
- RETURN_ERROR2("Unexpected token: ", token);
- }
-
- inst->Opcode = instMatch.opcode;
- inst->Precision = instMatch.suffixes & (_R | _H | _X);
- inst->SaturateMode = (instMatch.suffixes & (_S))
- ? SATURATE_ZERO_ONE : SATURATE_OFF;
- inst->CondUpdate = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE;
-
- /*
- * parse the input and output operands
- */
- if (instMatch.outputs == OUTPUT_S || instMatch.outputs == OUTPUT_V) {
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- }
- else if (instMatch.outputs == OUTPUT_NONE) {
- if (instMatch.opcode == OPCODE_KIL_NV) {
- /* This is a little weird, the cond code info is in
- * the dest register.
- */
- if (!Parse_CondCodeMask(parseState, &inst->DstReg))
- RETURN_ERROR;
- }
- else {
- ASSERT(instMatch.opcode == OPCODE_PRINT);
- }
- }
-
- if (instMatch.inputs == INPUT_1V) {
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_2V) {
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_3V) {
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[2]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_1S) {
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_2S) {
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- }
- else if (instMatch.inputs == INPUT_CC) {
- /* XXX to-do */
- }
- else if (instMatch.inputs == INPUT_1V_T) {
- GLubyte unit, idx;
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_TextureImageId(parseState, &unit, &idx))
- RETURN_ERROR;
- inst->TexSrcUnit = unit;
- inst->TexSrcTarget = idx;
- }
- else if (instMatch.inputs == INPUT_3V_T) {
- GLubyte unit, idx;
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_VectorSrc(parseState, &inst->SrcReg[2]))
- RETURN_ERROR;
- if (!Parse_String(parseState, ","))
- RETURN_ERROR1("Expected ,");
- if (!Parse_TextureImageId(parseState, &unit, &idx))
- RETURN_ERROR;
- inst->TexSrcUnit = unit;
- inst->TexSrcTarget = idx;
- }
- else if (instMatch.inputs == INPUT_1V_S) {
- if (!Parse_PrintInstruction(parseState, inst))
- RETURN_ERROR;
- }
-
- /* end of statement semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR1("Expected ;");
-
- parseState->numInst++;
-
- if (parseState->numInst >= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS)
- RETURN_ERROR1("Program too long");
- }
- }
- return GL_TRUE;
-}
-
-
-
-/**
- * Parse/compile the 'str' returning the compiled 'program'.
- * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos
- * indicates the position of the error in 'str'.
- */
-void
-_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
- const GLubyte *str, GLsizei len,
- struct gl_fragment_program *program)
-{
- struct parse_state parseState;
- struct prog_instruction instBuffer[MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS];
- struct prog_instruction *newInst;
- GLenum target;
- GLubyte *programString;
-
- /* Make a null-terminated copy of the program string */
- programString = malloc(len + 1);
- if (!programString) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- memcpy(programString, str, len);
- programString[len] = 0;
-
- /* Get ready to parse */
- memset(&parseState, 0, sizeof(struct parse_state));
- parseState.ctx = ctx;
- parseState.start = programString;
- parseState.program = program;
- parseState.numInst = 0;
- parseState.curLine = programString;
- parseState.parameters = _mesa_new_parameter_list();
-
- /* Reset error state */
- _mesa_set_program_error(ctx, -1, NULL);
-
- /* check the program header */
- if (strncmp((const char *) programString, "!!FP1.0", 7) == 0) {
- target = GL_FRAGMENT_PROGRAM_NV;
- parseState.pos = programString + 7;
- }
- else if (strncmp((const char *) programString, "!!FCP1.0", 8) == 0) {
- /* fragment / register combiner program - not supported */
- _mesa_set_program_error(ctx, 0, "Invalid fragment program header");
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)");
- return;
- }
- else {
- /* invalid header */
- _mesa_set_program_error(ctx, 0, "Invalid fragment program header");
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)");
- return;
- }
-
- /* make sure target and header match */
- if (target != dstTarget) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(target mismatch 0x%x != 0x%x)",
- target, dstTarget);
- return;
- }
-
- if (Parse_InstructionSequence(&parseState, instBuffer)) {
- GLuint u;
- /* successful parse! */
-
- if (parseState.outputsWritten == 0) {
- /* must write at least one output! */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "Invalid fragment program - no outputs written.");
- return;
- }
-
- /* copy the compiled instructions */
- assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS);
- newInst = _mesa_alloc_instructions(parseState.numInst);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return; /* out of memory */
- }
- _mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
-
- /* install the program */
- program->Base.Target = target;
- free(program->Base.String);
- program->Base.String = programString;
- program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- free(program->Base.Instructions);
- program->Base.Instructions = newInst;
- program->Base.NumInstructions = parseState.numInst;
- program->Base.InputsRead = parseState.inputsRead;
- program->Base.OutputsWritten = parseState.outputsWritten;
- for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++)
- program->Base.TexturesUsed[u] = parseState.texturesUsed[u];
-
- /* save program parameters */
- program->Base.Parameters = parseState.parameters;
-
- /* allocate registers for declared program parameters */
-#if 00
- _mesa_assign_program_registers(&(program->SymbolTable));
-#endif
-
-#ifdef DEBUG_foo
- printf("--- glLoadProgramNV(%d) result ---\n", program->Base.Id);
- _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0);
- printf("----------------------------------\n");
-#endif
- }
- else {
- /* Error! */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV");
- /* NOTE: _mesa_set_program_error would have been called already */
- }
-}
-
-
-const char *
-_mesa_nv_fragment_input_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_INPUTS);
- return InputRegisters[i];
-}
-
diff --git a/mesalib/src/mesa/program/nvfragparse.h b/mesalib/src/mesa/program/nvfragparse.h
deleted file mode 100644
index 088e7527d..000000000
--- a/mesalib/src/mesa/program/nvfragparse.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2002 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.
- *
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef NVFRAGPARSE_H
-#define NVFRAGPARSE_H
-
-#include "main/glheader.h"
-
-struct gl_context;
-struct gl_fragment_program;
-
-extern void
-_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target,
- const GLubyte *str, GLsizei len,
- struct gl_fragment_program *program);
-
-
-extern const char *
-_mesa_nv_fragment_input_register_name(GLuint i);
-
-#endif
diff --git a/mesalib/src/mesa/program/nvvertparse.c b/mesalib/src/mesa/program/nvvertparse.c
deleted file mode 100644
index 6272c2f7f..000000000
--- a/mesalib/src/mesa/program/nvvertparse.c
+++ /dev/null
@@ -1,1456 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 1999-2006 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.
- */
-
-/**
- * \file nvvertparse.c
- * NVIDIA vertex program parser.
- * \author Brian Paul
- */
-
-/*
- * Regarding GL_NV_vertex_program, GL_NV_vertex_program1_1:
- *
- * Portions of this software may use or implement intellectual
- * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
- * any and all warranties with respect to such intellectual property,
- * including any use thereof or modifications thereto.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/nvprogram.h"
-#include "nvvertparse.h"
-#include "prog_instruction.h"
-#include "prog_parameter.h"
-#include "prog_print.h"
-#include "program.h"
-
-
-/**
- * Current parsing state. This structure is passed among the parsing
- * functions and keeps track of the current parser position and various
- * program attributes.
- */
-struct parse_state {
- struct gl_context *ctx;
- const GLubyte *start;
- const GLubyte *pos;
- const GLubyte *curLine;
- GLboolean isStateProgram;
- GLboolean isPositionInvariant;
- GLboolean isVersion1_1;
- GLbitfield inputsRead;
- GLbitfield outputsWritten;
- GLboolean anyProgRegsWritten;
- GLboolean indirectRegisterFiles;
- GLuint numInst; /* number of instructions parsed */
-};
-
-
-/*
- * Called whenever we find an error during parsing.
- */
-static void
-record_error(struct parse_state *parseState, const char *msg, int lineNo)
-{
-#ifdef DEBUG
- GLint line, column;
- const GLubyte *lineStr;
- lineStr = _mesa_find_line_column(parseState->start,
- parseState->pos, &line, &column);
- _mesa_debug(parseState->ctx,
- "nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
- lineNo, line, column, (char *) lineStr, msg);
- free((void *) lineStr);
-#else
- (void) lineNo;
-#endif
-
- /* Check that no error was already recorded. Only record the first one. */
- if (parseState->ctx->Program.ErrorString[0] == 0) {
- _mesa_set_program_error(parseState->ctx,
- parseState->pos - parseState->start,
- msg);
- }
-}
-
-
-#define RETURN_ERROR \
-do { \
- record_error(parseState, "Unexpected end of input.", __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR1(msg) \
-do { \
- record_error(parseState, msg, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-#define RETURN_ERROR2(msg1, msg2) \
-do { \
- char err[1000]; \
- sprintf(err, "%s %s", msg1, msg2); \
- record_error(parseState, err, __LINE__); \
- return GL_FALSE; \
-} while(0)
-
-
-
-
-
-static GLboolean IsLetter(GLubyte b)
-{
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z');
-}
-
-
-static GLboolean IsDigit(GLubyte b)
-{
- return b >= '0' && b <= '9';
-}
-
-
-static GLboolean IsWhitespace(GLubyte b)
-{
- return b == ' ' || b == '\t' || b == '\n' || b == '\r';
-}
-
-
-/**
- * Starting at 'str' find the next token. A token can be an integer,
- * an identifier or punctuation symbol.
- * \return <= 0 we found an error, else, return number of characters parsed.
- */
-static GLint
-GetToken(struct parse_state *parseState, GLubyte *token)
-{
- const GLubyte *str = parseState->pos;
- GLint i = 0, j = 0;
-
- token[0] = 0;
-
- /* skip whitespace and comments */
- while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) {
- if (str[i] == '#') {
- /* skip comment */
- while (str[i] && (str[i] != '\n' && str[i] != '\r')) {
- i++;
- }
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- }
- else {
- /* skip whitespace */
- if (str[i] == '\n' || str[i] == '\r')
- parseState->curLine = str + i + 1;
- i++;
- }
- }
-
- if (str[i] == 0)
- return -i;
-
- /* try matching an integer */
- while (str[i] && IsDigit(str[i])) {
- token[j++] = str[i++];
- }
- if (j > 0 || !str[i]) {
- token[j] = 0;
- return i;
- }
-
- /* try matching an identifier */
- if (IsLetter(str[i])) {
- while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) {
- token[j++] = str[i++];
- }
- token[j] = 0;
- return i;
- }
-
- /* punctuation character */
- if (str[i]) {
- token[0] = str[i++];
- token[1] = 0;
- return i;
- }
-
- /* end of input */
- token[0] = 0;
- return i;
-}
-
-
-/**
- * Get next token from input stream and increment stream pointer past token.
- */
-static GLboolean
-Parse_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- parseState->pos += i;
- return GL_TRUE;
-}
-
-
-/**
- * Get next token from input stream but don't increment stream pointer.
- */
-static GLboolean
-Peek_Token(struct parse_state *parseState, GLubyte *token)
-{
- GLint i, len;
- i = GetToken(parseState, token);
- if (i <= 0) {
- parseState->pos += (-i);
- return GL_FALSE;
- }
- len = (GLint) strlen((const char *) token);
- parseState->pos += (i - len);
- return GL_TRUE;
-}
-
-
-/**
- * Try to match 'pattern' as the next token after any whitespace/comments.
- * Advance the current parsing position only if we match the pattern.
- * \return GL_TRUE if pattern is matched, GL_FALSE otherwise.
- */
-static GLboolean
-Parse_String(struct parse_state *parseState, const char *pattern)
-{
- const GLubyte *m;
- GLint i;
-
- /* skip whitespace and comments */
- while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') {
- if (*parseState->pos == '#') {
- while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) {
- parseState->pos += 1;
- }
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- }
- else {
- /* skip whitespace */
- if (*parseState->pos == '\n' || *parseState->pos == '\r')
- parseState->curLine = parseState->pos + 1;
- parseState->pos += 1;
- }
- }
-
- /* Try to match the pattern */
- m = parseState->pos;
- for (i = 0; pattern[i]; i++) {
- if (*m != (GLubyte) pattern[i])
- return GL_FALSE;
- m += 1;
- }
- parseState->pos = m;
-
- return GL_TRUE; /* success */
-}
-
-
-/**********************************************************************/
-
-static const char *InputRegisters[MAX_NV_VERTEX_PROGRAM_INPUTS + 1] = {
- "OPOS", "WGHT", "NRML", "COL0", "COL1", "FOGC", "6", "7",
- "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
-};
-
-static const char *OutputRegisters[MAX_NV_VERTEX_PROGRAM_OUTPUTS + 1] = {
- "HPOS", "COL0", "COL1", "FOGC",
- "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7",
- "PSIZ", "BFC0", "BFC1", NULL
-};
-
-
-
-/**
- * Parse a temporary register: Rnn
- */
-static GLboolean
-Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
-
- /* Should be 'R##' */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] != 'R')
- RETURN_ERROR1("Expected R##");
-
- if (IsDigit(token[1])) {
- GLint reg = atoi((char *) (token + 1));
- if (reg >= MAX_NV_VERTEX_PROGRAM_TEMPS)
- RETURN_ERROR1("Bad temporary register name");
- *tempRegNum = reg;
- }
- else {
- RETURN_ERROR1("Bad temporary register name");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse address register "A0.x"
- */
-static GLboolean
-Parse_AddrReg(struct parse_state *parseState)
-{
- /* match 'A0' */
- if (!Parse_String(parseState, "A0"))
- RETURN_ERROR;
-
- /* match '.' */
- if (!Parse_String(parseState, "."))
- RETURN_ERROR;
-
- /* match 'x' */
- if (!Parse_String(parseState, "x"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse absolute program parameter register "c[##]"
- */
-static GLboolean
-Parse_AbsParamReg(struct parse_state *parseState, GLint *regNum)
-{
- GLubyte token[100];
-
- if (!Parse_String(parseState, "c"))
- RETURN_ERROR;
-
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- /* a numbered program parameter register */
- GLint reg = atoi((char *) token);
- if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS)
- RETURN_ERROR1("Bad program parameter number");
- *regNum = reg;
- }
- else {
- RETURN_ERROR;
- }
-
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ParamReg(struct parse_state *parseState, struct prog_src_register *srcReg)
-{
- GLubyte token[100];
-
- if (!Parse_String(parseState, "c"))
- RETURN_ERROR;
-
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- /* a numbered program parameter register */
- GLint reg;
- (void) Parse_Token(parseState, token);
- reg = atoi((char *) token);
- if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS)
- RETURN_ERROR1("Bad program parameter number");
- srcReg->File = PROGRAM_ENV_PARAM;
- srcReg->Index = reg;
- }
- else if (strcmp((const char *) token, "A0") == 0) {
- /* address register "A0.x" */
- if (!Parse_AddrReg(parseState))
- RETURN_ERROR;
-
- srcReg->RelAddr = GL_TRUE;
- srcReg->File = PROGRAM_ENV_PARAM;
- parseState->indirectRegisterFiles |= (1 << srcReg->File);
- /* Look for +/-N offset */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == '-' || token[0] == '+') {
- const GLubyte sign = token[0];
- (void) Parse_Token(parseState, token); /* consume +/- */
-
- /* an integer should be next */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (IsDigit(token[0])) {
- const GLint k = atoi((char *) token);
- if (sign == '-') {
- if (k > 64)
- RETURN_ERROR1("Bad address offset");
- srcReg->Index = -k;
- }
- else {
- if (k > 63)
- RETURN_ERROR1("Bad address offset");
- srcReg->Index = k;
- }
- }
- else {
- RETURN_ERROR;
- }
- }
- else {
- /* probably got a ']', catch it below */
- }
- }
- else {
- RETURN_ERROR;
- }
-
- /* Match closing ']' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-/**
- * Parse v[#] or v[<name>]
- */
-static GLboolean
-Parse_AttribReg(struct parse_state *parseState, GLint *tempRegNum)
-{
- GLubyte token[100];
- GLint j;
-
- /* Match 'v' */
- if (!Parse_String(parseState, "v"))
- RETURN_ERROR;
-
- /* Match '[' */
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- /* match number or named register */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (parseState->isStateProgram && token[0] != '0')
- RETURN_ERROR1("Only v[0] accessible in vertex state programs");
-
- if (IsDigit(token[0])) {
- GLint reg = atoi((char *) token);
- if (reg >= MAX_NV_VERTEX_PROGRAM_INPUTS)
- RETURN_ERROR1("Bad vertex attribute register name");
- *tempRegNum = reg;
- }
- else {
- for (j = 0; InputRegisters[j]; j++) {
- if (strcmp((const char *) token, InputRegisters[j]) == 0) {
- *tempRegNum = j;
- break;
- }
- }
- if (!InputRegisters[j]) {
- /* unknown input register label */
- RETURN_ERROR2("Bad register name", token);
- }
- }
-
- /* Match '[' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
-{
- GLubyte token[100];
- GLint start, j;
-
- /* Match 'o' */
- if (!Parse_String(parseState, "o"))
- RETURN_ERROR;
-
- /* Match '[' */
- if (!Parse_String(parseState, "["))
- RETURN_ERROR;
-
- /* Get output reg name */
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (parseState->isPositionInvariant)
- start = 1; /* skip HPOS register name */
- else
- start = 0;
-
- /* try to match an output register name */
- for (j = start; OutputRegisters[j]; j++) {
- if (strcmp((const char *) token, OutputRegisters[j]) == 0) {
- *outputRegNum = j;
- break;
- }
- }
- if (!OutputRegisters[j])
- RETURN_ERROR1("Unrecognized output register name");
-
- /* Match ']' */
- if (!Parse_String(parseState, "]"))
- RETURN_ERROR1("Expected ]");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_MaskedDstReg(struct parse_state *parseState, struct prog_dst_register *dstReg)
-{
- GLubyte token[100];
- GLint idx;
-
- /* Dst reg can be R<n> or o[n] */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == 'R') {
- /* a temporary register */
- dstReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (!parseState->isStateProgram && token[0] == 'o') {
- /* an output register */
- dstReg->File = PROGRAM_OUTPUT;
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else if (parseState->isStateProgram && token[0] == 'c' &&
- parseState->isStateProgram) {
- /* absolute program parameter register */
- /* Only valid for vertex state programs */
- dstReg->File = PROGRAM_ENV_PARAM;
- if (!Parse_AbsParamReg(parseState, &idx))
- RETURN_ERROR;
- dstReg->Index = idx;
- }
- else {
- RETURN_ERROR1("Bad destination register name");
- }
-
- /* Parse optional write mask */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == '.') {
- /* got a mask */
- GLint k = 0;
-
- if (!Parse_String(parseState, "."))
- RETURN_ERROR;
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- dstReg->WriteMask = 0;
-
- if (token[k] == 'x') {
- dstReg->WriteMask |= WRITEMASK_X;
- k++;
- }
- if (token[k] == 'y') {
- dstReg->WriteMask |= WRITEMASK_Y;
- k++;
- }
- if (token[k] == 'z') {
- dstReg->WriteMask |= WRITEMASK_Z;
- k++;
- }
- if (token[k] == 'w') {
- dstReg->WriteMask |= WRITEMASK_W;
- k++;
- }
- if (k == 0) {
- RETURN_ERROR1("Bad writemask character");
- }
- return GL_TRUE;
- }
- else {
- dstReg->WriteMask = WRITEMASK_XYZW;
- return GL_TRUE;
- }
-}
-
-
-static GLboolean
-Parse_SwizzleSrcReg(struct parse_state *parseState, struct prog_src_register *srcReg)
-{
- GLubyte token[100];
- GLint idx;
-
- srcReg->RelAddr = GL_FALSE;
-
- /* check for '-' */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] == '-') {
- (void) Parse_String(parseState, "-");
- srcReg->Negate = NEGATE_XYZW;
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- }
- else {
- srcReg->Negate = NEGATE_NONE;
- }
-
- /* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */
- if (token[0] == 'R') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'c') {
- if (!Parse_ParamReg(parseState, srcReg))
- RETURN_ERROR;
- }
- else if (token[0] == 'v') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_AttribReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else {
- RETURN_ERROR2("Bad source register name", token);
- }
-
- /* init swizzle fields */
- srcReg->Swizzle = SWIZZLE_NOOP;
-
- /* Look for optional swizzle suffix */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] == '.') {
- (void) Parse_String(parseState, "."); /* consume . */
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[1] == 0) {
- /* single letter swizzle */
- if (token[0] == 'x')
- srcReg->Swizzle = SWIZZLE_XXXX;
- else if (token[0] == 'y')
- srcReg->Swizzle = SWIZZLE_YYYY;
- else if (token[0] == 'z')
- srcReg->Swizzle = SWIZZLE_ZZZZ;
- else if (token[0] == 'w')
- srcReg->Swizzle = SWIZZLE_WWWW;
- else
- RETURN_ERROR1("Expected x, y, z, or w");
- }
- else {
- /* 2, 3 or 4-component swizzle */
- GLint k;
-
- srcReg->Swizzle = 0;
-
- for (k = 0; token[k] && k < 5; k++) {
- if (token[k] == 'x')
- srcReg->Swizzle |= 0 << (k*3);
- else if (token[k] == 'y')
- srcReg->Swizzle |= 1 << (k*3);
- else if (token[k] == 'z')
- srcReg->Swizzle |= 2 << (k*3);
- else if (token[k] == 'w')
- srcReg->Swizzle |= 3 << (k*3);
- else
- RETURN_ERROR;
- }
- if (k >= 5)
- RETURN_ERROR;
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ScalarSrcReg(struct parse_state *parseState, struct prog_src_register *srcReg)
-{
- GLubyte token[100];
- GLint idx;
-
- srcReg->RelAddr = GL_FALSE;
-
- /* check for '-' */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- if (token[0] == '-') {
- srcReg->Negate = NEGATE_XYZW;
- (void) Parse_String(parseState, "-"); /* consume '-' */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
- }
- else {
- srcReg->Negate = NEGATE_NONE;
- }
-
- /* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */
- if (token[0] == 'R') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'c') {
- if (!Parse_ParamReg(parseState, srcReg))
- RETURN_ERROR;
- }
- else if (token[0] == 'v') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_AttribReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else {
- RETURN_ERROR2("Bad source register name", token);
- }
-
- /* Look for .[xyzw] suffix */
- if (!Parse_String(parseState, "."))
- RETURN_ERROR;
-
- if (!Parse_Token(parseState, token))
- RETURN_ERROR;
-
- if (token[0] == 'x' && token[1] == 0) {
- srcReg->Swizzle = 0;
- }
- else if (token[0] == 'y' && token[1] == 0) {
- srcReg->Swizzle = 1;
- }
- else if (token[0] == 'z' && token[1] == 0) {
- srcReg->Swizzle = 2;
- }
- else if (token[0] == 'w' && token[1] == 0) {
- srcReg->Swizzle = 3;
- }
- else {
- RETURN_ERROR1("Bad scalar source suffix");
- }
-
- return GL_TRUE;
-}
-
-
-static GLint
-Parse_UnaryOpInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- if (opcode == OPCODE_ABS && !parseState->isVersion1_1)
- RETURN_ERROR1("ABS illegal for vertex program 1.0");
-
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_BiOpInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- if (opcode == OPCODE_DPH && !parseState->isVersion1_1)
- RETURN_ERROR1("DPH illegal for vertex program 1.0");
- if (opcode == OPCODE_SUB && !parseState->isVersion1_1)
- RETURN_ERROR1("SUB illegal for vertex program 1.0");
-
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* first src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* second src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- /* make sure we don't reference more than one program parameter register */
- if (inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index)
- RETURN_ERROR1("Can't reference two program parameter registers");
-
- /* make sure we don't reference more than one vertex attribute register */
- if (inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[1].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index)
- RETURN_ERROR1("Can't reference two vertex attribute registers");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_TriOpInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* first src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* second src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1]))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* third src arg */
- if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[2]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- /* make sure we don't reference more than one program parameter register */
- if ((inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index) ||
- (inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[2].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[0].Index != inst->SrcReg[2].Index) ||
- (inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[2].File == PROGRAM_ENV_PARAM &&
- inst->SrcReg[1].Index != inst->SrcReg[2].Index))
- RETURN_ERROR1("Can only reference one program register");
-
- /* make sure we don't reference more than one vertex attribute register */
- if ((inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[1].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index != inst->SrcReg[1].Index) ||
- (inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[2].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index != inst->SrcReg[2].Index) ||
- (inst->SrcReg[1].File == PROGRAM_INPUT &&
- inst->SrcReg[2].File == PROGRAM_INPUT &&
- inst->SrcReg[1].Index != inst->SrcReg[2].Index))
- RETURN_ERROR1("Can only reference one input register");
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_ScalarInstruction(struct parse_state *parseState,
- struct prog_instruction *inst,
- enum prog_opcode opcode)
-{
- if (opcode == OPCODE_RCC && !parseState->isVersion1_1)
- RETURN_ERROR1("RCC illegal for vertex program 1.0");
-
- inst->Opcode = opcode;
-
- /* dest reg */
- if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* first src arg */
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst)
-{
- inst->Opcode = OPCODE_ARL;
-
- /* Make ARB_vp backends happy */
- inst->DstReg.File = PROGRAM_ADDRESS;
- inst->DstReg.WriteMask = WRITEMASK_X;
- inst->DstReg.Index = 0;
-
- /* dest A0 reg */
- if (!Parse_AddrReg(parseState))
- RETURN_ERROR;
-
- /* comma */
- if (!Parse_String(parseState, ","))
- RETURN_ERROR;
-
- /* parse src reg */
- if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
- RETURN_ERROR;
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_EndInstruction(struct parse_state *parseState, struct prog_instruction *inst)
-{
- GLubyte token[100];
-
- inst->Opcode = OPCODE_END;
-
- /* this should fail! */
- if (Parse_Token(parseState, token))
- RETURN_ERROR2("Unexpected token after END:", token);
- else
- return GL_TRUE;
-}
-
-
-/**
- * The PRINT instruction is Mesa-specific and is meant as a debugging aid for
- * the vertex program developer.
- * The NV_vertex_program extension grammar is modified as follows:
- *
- * <instruction> ::= <ARL-instruction>
- * | ...
- * | <PRINT-instruction>
- *
- * <PRINT-instruction> ::= "PRINT" <string literal>
- * | "PRINT" <string literal> "," <srcReg>
- * | "PRINT" <string literal> "," <dstReg>
- */
-static GLboolean
-Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *inst)
-{
- const GLubyte *str;
- GLubyte *msg;
- GLuint len;
- GLubyte token[100];
- struct prog_src_register *srcReg = &inst->SrcReg[0];
- GLint idx;
-
- inst->Opcode = OPCODE_PRINT;
-
- /* The first argument is a literal string 'just like this' */
- if (!Parse_String(parseState, "'"))
- RETURN_ERROR;
-
- str = parseState->pos;
- for (len = 0; str[len] != '\''; len++) /* find closing quote */
- ;
- parseState->pos += len + 1;
- msg = malloc(len + 1);
-
- memcpy(msg, str, len);
- msg[len] = 0;
- inst->Data = msg;
-
- /* comma */
- if (Parse_String(parseState, ",")) {
-
- /* The second argument is a register name */
- if (!Peek_Token(parseState, token))
- RETURN_ERROR;
-
- srcReg->RelAddr = GL_FALSE;
- srcReg->Negate = NEGATE_NONE;
- srcReg->Swizzle = SWIZZLE_NOOP;
-
- /* Register can be R<n>, c[n], c[n +/- offset], a named vertex attrib,
- * or an o[n] output register.
- */
- if (token[0] == 'R') {
- srcReg->File = PROGRAM_TEMPORARY;
- if (!Parse_TempReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'c') {
- srcReg->File = PROGRAM_ENV_PARAM;
- if (!Parse_ParamReg(parseState, srcReg))
- RETURN_ERROR;
- }
- else if (token[0] == 'v') {
- srcReg->File = PROGRAM_INPUT;
- if (!Parse_AttribReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else if (token[0] == 'o') {
- srcReg->File = PROGRAM_OUTPUT;
- if (!Parse_OutputReg(parseState, &idx))
- RETURN_ERROR;
- srcReg->Index = idx;
- }
- else {
- RETURN_ERROR2("Bad source register name", token);
- }
- }
- else {
- srcReg->File = PROGRAM_UNDEFINED;
- }
-
- /* semicolon */
- if (!Parse_String(parseState, ";"))
- RETURN_ERROR;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-Parse_OptionSequence(struct parse_state *parseState,
- struct prog_instruction program[])
-{
- (void) program;
- while (1) {
- if (!Parse_String(parseState, "OPTION"))
- return GL_TRUE; /* ok, not an OPTION statement */
- if (Parse_String(parseState, "NV_position_invariant")) {
- parseState->isPositionInvariant = GL_TRUE;
- }
- else {
- RETURN_ERROR1("unexpected OPTION statement");
- }
- if (!Parse_String(parseState, ";"))
- return GL_FALSE;
- }
-}
-
-
-static GLboolean
-Parse_InstructionSequence(struct parse_state *parseState,
- struct prog_instruction program[])
-{
- while (1) {
- struct prog_instruction *inst = program + parseState->numInst;
-
- /* Initialize the instruction */
- _mesa_init_instructions(inst, 1);
-
- if (Parse_String(parseState, "MOV")) {
- if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_MOV))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "LIT")) {
- if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_LIT))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "ABS")) {
- if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_ABS))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MUL")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MUL))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "ADD")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_ADD))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DP3")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DP3))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DP4")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DP4))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DST")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DST))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MIN")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MIN))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MAX")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_MAX))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "SLT")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SLT))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "SGE")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SGE))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "DPH")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_DPH))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "SUB")) {
- if (!Parse_BiOpInstruction(parseState, inst, OPCODE_SUB))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "MAD")) {
- if (!Parse_TriOpInstruction(parseState, inst, OPCODE_MAD))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "RCP")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RCP))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "RSQ")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RSQ))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "EXP")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_EXP))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "LOG")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_LOG))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "RCC")) {
- if (!Parse_ScalarInstruction(parseState, inst, OPCODE_RCC))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "ARL")) {
- if (!Parse_AddressInstruction(parseState, inst))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "PRINT")) {
- if (!Parse_PrintInstruction(parseState, inst))
- RETURN_ERROR;
- }
- else if (Parse_String(parseState, "END")) {
- if (!Parse_EndInstruction(parseState, inst))
- RETURN_ERROR;
- else {
- parseState->numInst++;
- return GL_TRUE; /* all done */
- }
- }
- else {
- /* bad instruction name */
- RETURN_ERROR1("Unexpected token");
- }
-
- /* examine input/output registers */
- if (inst->DstReg.File == PROGRAM_OUTPUT)
- parseState->outputsWritten |= (1 << inst->DstReg.Index);
- else if (inst->DstReg.File == PROGRAM_ENV_PARAM)
- parseState->anyProgRegsWritten = GL_TRUE;
-
- if (inst->SrcReg[0].File == PROGRAM_INPUT)
- parseState->inputsRead |= (1 << inst->SrcReg[0].Index);
- if (inst->SrcReg[1].File == PROGRAM_INPUT)
- parseState->inputsRead |= (1 << inst->SrcReg[1].Index);
- if (inst->SrcReg[2].File == PROGRAM_INPUT)
- parseState->inputsRead |= (1 << inst->SrcReg[2].Index);
-
- parseState->numInst++;
-
- if (parseState->numInst >= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS)
- RETURN_ERROR1("Program too long");
- }
-
- RETURN_ERROR;
-}
-
-
-static GLboolean
-Parse_Program(struct parse_state *parseState,
- struct prog_instruction instBuffer[])
-{
- if (parseState->isVersion1_1) {
- if (!Parse_OptionSequence(parseState, instBuffer)) {
- return GL_FALSE;
- }
- }
- return Parse_InstructionSequence(parseState, instBuffer);
-}
-
-
-/**
- * Parse/compile the 'str' returning the compiled 'program'.
- * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos
- * indicates the position of the error in 'str'.
- */
-void
-_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget,
- const GLubyte *str, GLsizei len,
- struct gl_vertex_program *program)
-{
- struct parse_state parseState;
- struct prog_instruction instBuffer[MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS];
- struct prog_instruction *newInst;
- GLenum target;
- GLubyte *programString;
-
- /* Make a null-terminated copy of the program string */
- programString = malloc(len + 1);
- if (!programString) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- return;
- }
- memcpy(programString, str, len);
- programString[len] = 0;
-
- /* Get ready to parse */
- parseState.ctx = ctx;
- parseState.start = programString;
- parseState.isPositionInvariant = GL_FALSE;
- parseState.isVersion1_1 = GL_FALSE;
- parseState.numInst = 0;
- parseState.inputsRead = 0;
- parseState.outputsWritten = 0;
- parseState.anyProgRegsWritten = GL_FALSE;
- parseState.indirectRegisterFiles = 0x0;
-
- /* Reset error state */
- _mesa_set_program_error(ctx, -1, NULL);
-
- /* check the program header */
- if (strncmp((const char *) programString, "!!VP1.0", 7) == 0) {
- target = GL_VERTEX_PROGRAM_NV;
- parseState.pos = programString + 7;
- parseState.isStateProgram = GL_FALSE;
- }
- else if (strncmp((const char *) programString, "!!VP1.1", 7) == 0) {
- target = GL_VERTEX_PROGRAM_NV;
- parseState.pos = programString + 7;
- parseState.isStateProgram = GL_FALSE;
- parseState.isVersion1_1 = GL_TRUE;
- }
- else if (strncmp((const char *) programString, "!!VSP1.0", 8) == 0) {
- target = GL_VERTEX_STATE_PROGRAM_NV;
- parseState.pos = programString + 8;
- parseState.isStateProgram = GL_TRUE;
- }
- else {
- /* invalid header */
- ctx->Program.ErrorPos = 0;
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)");
- return;
- }
-
- /* make sure target and header match */
- if (target != dstTarget) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(target mismatch)");
- return;
- }
-
-
- if (Parse_Program(&parseState, instBuffer)) {
- gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0};
- int i;
-
- /* successful parse! */
-
- if (parseState.isStateProgram) {
- if (!parseState.anyProgRegsWritten) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(c[#] not written)");
- return;
- }
- }
- else {
- if (!parseState.isPositionInvariant &&
- !(parseState.outputsWritten & (1 << VERT_RESULT_HPOS))) {
- /* bit 1 = HPOS register */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLoadProgramNV(HPOS not written)");
- return;
- }
- }
-
- /* copy the compiled instructions */
- assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS);
- newInst = _mesa_alloc_instructions(parseState.numInst);
- if (!newInst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
- free(programString);
- return; /* out of memory */
- }
- _mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
-
- /* install the program */
- program->Base.Target = target;
- free(program->Base.String);
- program->Base.String = programString;
- program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
- free(program->Base.Instructions);
- program->Base.Instructions = newInst;
- program->Base.InputsRead = parseState.inputsRead;
- if (parseState.isPositionInvariant)
- program->Base.InputsRead |= VERT_BIT_POS;
- program->Base.NumInstructions = parseState.numInst;
- program->Base.OutputsWritten = parseState.outputsWritten;
- program->IsPositionInvariant = parseState.isPositionInvariant;
- program->IsNVProgram = GL_TRUE;
-
-#ifdef DEBUG_foo
- printf("--- glLoadProgramNV result ---\n");
- _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0);
- printf("------------------------------\n");
-#endif
-
- if (program->Base.Parameters)
- _mesa_free_parameter_list(program->Base.Parameters);
-
- program->Base.Parameters = _mesa_new_parameter_list ();
- program->Base.NumParameters = 0;
-
- program->Base.IndirectRegisterFiles = parseState.indirectRegisterFiles;
-
- state_tokens[0] = STATE_VERTEX_PROGRAM;
- state_tokens[1] = STATE_ENV;
- /* Add refs to all of the potential params, in order. If we want to not
- * upload everything, _mesa_layout_parameters is the answer.
- */
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) {
- GLint index;
- state_tokens[2] = i;
- index = _mesa_add_state_reference(program->Base.Parameters,
- state_tokens);
- assert(index == i);
- (void)index;
- }
- program->Base.NumParameters = program->Base.Parameters->NumParameters;
-
- _mesa_setup_nv_temporary_count(&program->Base);
- _mesa_emit_nv_temp_initialization(ctx, &program->Base);
- }
- else {
- /* Error! */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV");
- /* NOTE: _mesa_set_program_error would have been called already */
- /* GL_NV_vertex_program isn't supposed to set the error string
- * so we reset it here.
- */
- _mesa_set_program_error(ctx, ctx->Program.ErrorPos, NULL);
- }
-}
-
-
-const char *
-_mesa_nv_vertex_input_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_VERTEX_PROGRAM_INPUTS);
- return InputRegisters[i];
-}
-
-
-const char *
-_mesa_nv_vertex_output_register_name(GLuint i)
-{
- ASSERT(i < MAX_NV_VERTEX_PROGRAM_OUTPUTS);
- return OutputRegisters[i];
-}
-
diff --git a/mesalib/src/mesa/program/nvvertparse.h b/mesalib/src/mesa/program/nvvertparse.h
deleted file mode 100644
index 7318e1494..000000000
--- a/mesalib/src/mesa/program/nvvertparse.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 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.
- *
- * Authors:
- * Brian Paul
- */
-
-
-#ifndef NVVERTPARSE_H
-#define NVVERTPARSE_H
-
-#include "main/glheader.h"
-
-struct gl_context;
-struct gl_vertex_program;
-
-extern void
-_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target,
- const GLubyte *str, GLsizei len,
- struct gl_vertex_program *program);
-
-
-extern const char *
-_mesa_nv_vertex_input_register_name(GLuint i);
-
-extern const char *
-_mesa_nv_vertex_output_register_name(GLuint i);
-
-#endif
diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c
index dd1706e14..9ee2f2014 100644
--- a/mesalib/src/mesa/program/prog_execute.c
+++ b/mesalib/src/mesa/program/prog_execute.c
@@ -79,23 +79,6 @@
static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
-
-/**
- * Return TRUE for +0 and other positive values, FALSE otherwise.
- * Used for RCC opcode.
- */
-static inline GLboolean
-positive(float x)
-{
- fi_type fi;
- fi.f = x;
- if (fi.i & 0x80000000)
- return GL_FALSE;
- return GL_TRUE;
-}
-
-
-
/**
* Return a pointer to the 4-element float vector specified by the given
* source register.
@@ -153,8 +136,6 @@ get_src_register_pointer(const struct prog_src_register *source,
case PROGRAM_CONSTANT:
/* Fallthrough */
case PROGRAM_UNIFORM:
- /* Fallthrough */
- case PROGRAM_NAMED_PARAM:
if (reg >= (GLint) prog->Parameters->NumParameters)
return ZeroVec;
return (GLfloat *) prog->Parameters->ParameterValues[reg];
@@ -202,9 +183,6 @@ get_dst_register_pointer(const struct prog_dst_register *dest,
return dummyReg;
return machine->Outputs[reg];
- case PROGRAM_WRITE_ONLY:
- return dummyReg;
-
default:
_mesa_problem(NULL,
"Invalid dest register file %d in get_dst_register_pointer()",
@@ -728,13 +706,6 @@ _mesa_execute_program(struct gl_context * ctx,
break;
case OPCODE_ENDSUB: /* end subroutine */
break;
- case OPCODE_BRA: /* branch (conditional) */
- if (eval_condition(machine, inst)) {
- /* take branch */
- /* Subtract 1 here since we'll do pc++ below */
- pc = inst->BranchTarget - 1;
- }
- break;
case OPCODE_BRK: /* break out of loop (conditional) */
ASSERT(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
@@ -1367,43 +1338,6 @@ _mesa_execute_program(struct gl_context * ctx,
store_vector4(inst, machine, result);
}
break;
- case OPCODE_RCC: /* clamped riciprocal */
- {
- const float largest = 1.884467e+19, smallest = 5.42101e-20;
- GLfloat a[4], r, result[4];
- fetch_vector1(&inst->SrcReg[0], machine, a);
- if (DEBUG_PROG) {
- if (a[0] == 0)
- printf("RCC(0)\n");
- else if (IS_INF_OR_NAN(a[0]))
- printf("RCC(inf)\n");
- }
- if (a[0] == 1.0F) {
- r = 1.0F;
- }
- else {
- r = 1.0F / a[0];
- }
- if (positive(r)) {
- if (r > largest) {
- r = largest;
- }
- else if (r < smallest) {
- r = smallest;
- }
- }
- else {
- if (r < -largest) {
- r = -largest;
- }
- else if (r > -smallest) {
- r = -smallest;
- }
- }
- result[0] = result[1] = result[2] = result[3] = r;
- store_vector4(inst, machine, result);
- }
- break;
case OPCODE_RCP:
{
diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c
index d69d7b2d4..0bd45b09b 100644
--- a/mesalib/src/mesa/program/prog_instruction.c
+++ b/mesalib/src/mesa/program/prog_instruction.c
@@ -154,13 +154,9 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
{ OPCODE_ABS, "ABS", 1, 1 },
{ OPCODE_ADD, "ADD", 2, 1 },
{ OPCODE_AND, "AND", 2, 1 },
- { OPCODE_ARA, "ARA", 1, 1 },
{ OPCODE_ARL, "ARL", 1, 1 },
- { OPCODE_ARL_NV, "ARL_NV", 1, 1 },
- { OPCODE_ARR, "ARL", 1, 1 },
{ OPCODE_BGNLOOP,"BGNLOOP", 0, 0 },
{ OPCODE_BGNSUB, "BGNSUB", 0, 0 },
- { OPCODE_BRA, "BRA", 0, 0 },
{ OPCODE_BRK, "BRK", 0, 0 },
{ OPCODE_CAL, "CAL", 0, 0 },
{ OPCODE_CMP, "CMP", 3, 1 },
@@ -210,10 +206,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
{ OPCODE_PK4B, "PK4B", 1, 1 },
{ OPCODE_PK4UB, "PK4UB", 1, 1 },
{ OPCODE_POW, "POW", 2, 1 },
- { OPCODE_POPA, "POPA", 0, 0 },
{ OPCODE_PRINT, "PRINT", 1, 0 },
- { OPCODE_PUSHA, "PUSHA", 0, 0 },
- { OPCODE_RCC, "RCC", 1, 1 },
{ OPCODE_RCP, "RCP", 1, 1 },
{ OPCODE_RET, "RET", 0, 0 },
{ OPCODE_RFL, "RFL", 1, 1 },
diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h
index 656556dd4..8bb0c6541 100644
--- a/mesalib/src/mesa/program/prog_instruction.h
+++ b/mesalib/src/mesa/program/prog_instruction.h
@@ -148,13 +148,9 @@ typedef enum prog_opcode {
OPCODE_ABS, /* X X 1.1 X */
OPCODE_ADD, /* X X X X X */
OPCODE_AND, /* */
- OPCODE_ARA, /* 2 */
OPCODE_ARL, /* X X X */
- OPCODE_ARL_NV, /* 2 */
- OPCODE_ARR, /* 2 */
OPCODE_BGNLOOP, /* opt */
OPCODE_BGNSUB, /* opt */
- OPCODE_BRA, /* 2 */
OPCODE_BRK, /* 2 opt */
OPCODE_CAL, /* 2 2 opt */
OPCODE_CMP, /* X X */
@@ -204,10 +200,7 @@ typedef enum prog_opcode {
OPCODE_PK4B, /* X */
OPCODE_PK4UB, /* X */
OPCODE_POW, /* X X X X */
- OPCODE_POPA, /* 3 */
OPCODE_PRINT, /* X X */
- OPCODE_PUSHA, /* 3 */
- OPCODE_RCC, /* 1.1 */
OPCODE_RCP, /* X X X X X */
OPCODE_RET, /* 2 2 opt */
OPCODE_RFL, /* X */
@@ -304,8 +297,7 @@ struct prog_dst_register
* \name Conditional destination update control.
*
* \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
+ * NV_fragment_program_option, NV_vertex_program2, NV_vertex_program2_option.
*/
/*@{*/
/**
@@ -320,15 +312,6 @@ struct prog_dst_register
* Condition code swizzle value.
*/
GLuint CondSwizzle:12;
-
- /**
- * Selects the condition code register to use for conditional destination
- * update masking. In NV_fragmnet_program or NV_vertex_program2 mode, only
- * condition code register 0 is available. In NV_vertex_program3 mode,
- * condition code registers 0 and 1 are available.
- */
- GLuint CondSrc:1;
- /*@}*/
};
@@ -346,8 +329,7 @@ struct prog_instruction
* register.
*
* \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
+ * NV_fragment_program_option, NV_vertex_program2, NV_vertex_program2_option.
*/
GLuint CondUpdate:1;
@@ -360,8 +342,7 @@ struct prog_instruction
* code registers 0 and 1 are available.
*
* \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
- * NV_vertex_program2_option.
+ * NV_fragment_program_option, NV_vertex_program2, NV_vertex_program2_option.
*/
GLuint CondDst:1;
@@ -372,7 +353,7 @@ struct prog_instruction
* Value is one of the SATURATE_* tokens.
*
* \since
- * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3.
+ * NV_fragment_program_option, NV_vertex_program3.
*/
GLuint SaturateMode:2;
@@ -380,7 +361,7 @@ struct prog_instruction
* Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12.
*
* \since
- * NV_fragment_program, NV_fragment_program_option.
+ * NV_fragment_program_option.
*/
GLuint Precision:3;
diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c
index e89e8d6a4..c1013a5a2 100644
--- a/mesalib/src/mesa/program/prog_optimize.c
+++ b/mesalib/src/mesa/program/prog_optimize.c
@@ -392,7 +392,6 @@ find_next_use(const struct gl_program *prog,
switch (inst->Opcode) {
case OPCODE_BGNLOOP:
case OPCODE_BGNSUB:
- case OPCODE_BRA:
case OPCODE_CAL:
case OPCODE_CONT:
case OPCODE_IF:
@@ -439,7 +438,6 @@ _mesa_is_flow_control_opcode(enum prog_opcode opcode)
switch (opcode) {
case OPCODE_BGNLOOP:
case OPCODE_BGNSUB:
- case OPCODE_BRA:
case OPCODE_CAL:
case OPCODE_CONT:
case OPCODE_IF:
@@ -791,7 +789,6 @@ _mesa_remove_extra_moves(struct gl_program *prog)
if (prevInst->DstReg.File == PROGRAM_TEMPORARY &&
prevInst->DstReg.Index == id &&
prevInst->DstReg.RelAddr == 0 &&
- prevInst->DstReg.CondSrc == 0 &&
prevInst->DstReg.CondMask == COND_TR) {
const GLuint dst_mask = prevInst->DstReg.WriteMask;
diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c
index b9f4d9d57..8713d57b5 100644
--- a/mesalib/src/mesa/program/prog_parameter.c
+++ b/mesalib/src/mesa/program/prog_parameter.c
@@ -109,8 +109,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
gl_register_file type, const char *name,
GLuint size, GLenum datatype,
const gl_constant_value *values,
- const gl_state_index state[STATE_LENGTH],
- GLbitfield flags)
+ const gl_state_index state[STATE_LENGTH])
{
const GLuint oldNum = paramList->NumParameters;
const GLuint sz4 = (size + 3) / 4; /* no. of new param slots needed */
@@ -155,7 +154,6 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
p->Type = type;
p->Size = size;
p->DataType = datatype;
- p->Flags = flags;
if (values) {
COPY_4V(paramList->ParameterValues[oldNum + i], values);
values += 4;
@@ -180,20 +178,6 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
/**
- * Add a new named program parameter (Ex: NV_fragment_program DEFINE statement)
- * \return index of the new entry in the parameter list
- */
-GLint
-_mesa_add_named_parameter(struct gl_program_parameter_list *paramList,
- const char *name, const gl_constant_value values[4])
-{
- return _mesa_add_parameter(paramList, PROGRAM_NAMED_PARAM, name,
- 4, GL_NONE, values, NULL, 0x0);
-
-}
-
-
-/**
* Add a new named constant to the parameter list.
* This will be used when the program contains something like this:
* PARAM myVals = { 0, 1, 2, 3 };
@@ -223,7 +207,7 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
}
/* not found, add new parameter */
return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
- size, GL_NONE, values, NULL, 0x0);
+ size, GL_NONE, values, NULL);
}
@@ -275,7 +259,7 @@ _mesa_add_typed_unnamed_constant(struct gl_program_parameter_list *paramList,
/* add a new parameter to store this constant */
pos = _mesa_add_parameter(paramList, PROGRAM_CONSTANT, NULL,
- size, datatype, values, NULL, 0x0);
+ size, datatype, values, NULL);
if (pos >= 0 && swizzleOut) {
if (size == 1)
*swizzleOut = SWIZZLE_XXXX;
@@ -307,58 +291,6 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
swizzleOut);
}
-/**
- * Add parameter representing a varying variable.
- */
-GLint
-_mesa_add_varying(struct gl_program_parameter_list *paramList,
- const char *name, GLuint size, GLenum datatype,
- GLbitfield flags)
-{
- GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
- if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_VARYING) {
- /* already in list */
- return i;
- }
- else {
- /*assert(size == 4);*/
- i = _mesa_add_parameter(paramList, PROGRAM_VARYING, name,
- size, datatype, NULL, NULL, flags);
- return i;
- }
-}
-
-
-/**
- * Add parameter representing a vertex program attribute.
- * \param size size of attribute (in floats), may be -1 if unknown
- * \param attrib the attribute index, or -1 if unknown
- */
-GLint
-_mesa_add_attribute(struct gl_program_parameter_list *paramList,
- const char *name, GLint size, GLenum datatype, GLint attrib)
-{
- GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
- if (i >= 0) {
- /* replace */
- if (attrib < 0)
- attrib = i;
- paramList->Parameters[i].StateIndexes[0] = attrib;
- }
- else {
- /* add */
- gl_state_index state[STATE_LENGTH];
- state[0] = (gl_state_index) attrib;
- if (size < 0)
- size = 4;
- i = _mesa_add_parameter(paramList, PROGRAM_INPUT, name,
- size, datatype, NULL, state, 0x0);
- }
- return i;
-}
-
-
-
#if 0 /* not used yet */
/**
* Returns the number of 4-component registers needed to store a piece
@@ -410,7 +342,7 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
name = _mesa_program_state_string(stateTokens);
index = _mesa_add_parameter(paramList, PROGRAM_STATE_VAR, name,
size, GL_NONE,
- NULL, (gl_state_index *) stateTokens, 0x0);
+ NULL, (gl_state_index *) stateTokens);
paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
/* free name string here since we duplicated it in add_parameter() */
@@ -583,10 +515,9 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list)
struct gl_program_parameter *pCopy;
GLuint size = MIN2(p->Size, 4);
GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType,
- list->ParameterValues[i], NULL, 0x0);
+ list->ParameterValues[i], NULL);
ASSERT(j >= 0);
pCopy = clone->Parameters + j;
- pCopy->Flags = p->Flags;
/* copy state indexes */
if (p->Type == PROGRAM_STATE_VAR) {
GLint k;
@@ -624,8 +555,7 @@ _mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA,
_mesa_add_parameter(list, param->Type, param->Name, param->Size,
param->DataType,
listB->ParameterValues[i],
- param->StateIndexes,
- param->Flags);
+ param->StateIndexes);
}
}
}
@@ -637,21 +567,3 @@ _mesa_combine_parameter_lists(const struct gl_program_parameter_list *listA,
}
return list;
}
-
-
-/**
- * Count the number of parameters in the last that match the given type.
- */
-GLuint
-_mesa_num_parameters_of_type(const struct gl_program_parameter_list *list,
- gl_register_file type)
-{
- GLuint i, count = 0;
- if (list) {
- for (i = 0; i < list->NumParameters; i++) {
- if (list->Parameters[i].Type == type)
- count++;
- }
- }
- return count;
-}
diff --git a/mesalib/src/mesa/program/prog_parameter.h b/mesalib/src/mesa/program/prog_parameter.h
index 3c6dc8cf9..7b6b4b80e 100644
--- a/mesalib/src/mesa/program/prog_parameter.h
+++ b/mesalib/src/mesa/program/prog_parameter.h
@@ -41,18 +41,6 @@ extern "C" {
/**
- * Program parameter flags
- */
-/*@{*/
-#define PROG_PARAM_BIT_CENTROID 0x1 /**< for varying vars (GLSL 1.20) */
-#define PROG_PARAM_BIT_INVARIANT 0x2 /**< for varying vars (GLSL 1.20) */
-#define PROG_PARAM_BIT_FLAT 0x4 /**< for varying vars (GLSL 1.30) */
-#define PROG_PARAM_BIT_LINEAR 0x8 /**< for varying vars (GLSL 1.30) */
-#define PROG_PARAM_BIT_CYL_WRAP 0x10 /**< XXX gallium debug */
-/*@}*/
-
-
-/**
* Actual data for constant values of parameters.
*/
typedef union gl_constant_value
@@ -71,7 +59,7 @@ typedef union gl_constant_value
struct gl_program_parameter
{
const char *Name; /**< Null-terminated string */
- gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
+ gl_register_file Type; /**< PROGRAM_CONSTANT or STATE_VAR */
GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */
/**
* Number of components (1..4), or more.
@@ -81,7 +69,6 @@ struct gl_program_parameter
*/
GLuint Size;
GLboolean Initialized; /**< debug: Has the ParameterValue[] been set? */
- GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */
/**
* A sequence of STATE_* tokens and integers to identify GL state.
*/
@@ -130,12 +117,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
gl_register_file type, const char *name,
GLuint size, GLenum datatype,
const gl_constant_value *values,
- const gl_state_index state[STATE_LENGTH],
- GLbitfield flags);
-
-extern GLint
-_mesa_add_named_parameter(struct gl_program_parameter_list *paramList,
- const char *name, const gl_constant_value values[4]);
+ const gl_state_index state[STATE_LENGTH]);
extern GLint
_mesa_add_named_constant(struct gl_program_parameter_list *paramList,
@@ -153,15 +135,6 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
GLuint *swizzleOut);
extern GLint
-_mesa_add_varying(struct gl_program_parameter_list *paramList,
- const char *name, GLuint size, GLenum datatype,
- GLbitfield flags);
-
-extern GLint
-_mesa_add_attribute(struct gl_program_parameter_list *paramList,
- const char *name, GLint size, GLenum datatype, GLint attrib);
-
-extern GLint
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
const gl_state_index stateTokens[STATE_LENGTH]);
@@ -178,11 +151,6 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
const gl_constant_value v[], GLuint vSize,
GLint *posOut, GLuint *swizzleOut);
-extern GLuint
-_mesa_num_parameters_of_type(const struct gl_program_parameter_list *list,
- gl_register_file type);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/mesalib/src/mesa/program/prog_parameter_layout.c b/mesalib/src/mesa/program/prog_parameter_layout.c
index e4f2db3b3..e83469059 100644
--- a/mesalib/src/mesa/program/prog_parameter_layout.c
+++ b/mesalib/src/mesa/program/prog_parameter_layout.c
@@ -173,7 +173,7 @@ _mesa_layout_parameters(struct asm_parser_state *state)
continue;
}
- if ((inst->SrcReg[i].Base.File <= PROGRAM_VARYING )
+ if ((inst->SrcReg[i].Base.File <= PROGRAM_OUTPUT)
|| (inst->SrcReg[i].Base.File >= PROGRAM_WRITE_ONLY)) {
continue;
}
diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c
index bc5dc5803..a83cce4e3 100644
--- a/mesalib/src/mesa/program/prog_print.c
+++ b/mesalib/src/mesa/program/prog_print.c
@@ -60,16 +60,10 @@ _mesa_register_file_name(gl_register_file f)
return "INPUT";
case PROGRAM_OUTPUT:
return "OUTPUT";
- case PROGRAM_NAMED_PARAM:
- return "NAMED";
case PROGRAM_CONSTANT:
return "CONST";
case PROGRAM_UNIFORM:
return "UNIFORM";
- case PROGRAM_VARYING:
- return "VARYING";
- case PROGRAM_WRITE_ONLY:
- return "WRITE_ONLY";
case PROGRAM_ADDRESS:
return "ADDR";
case PROGRAM_SAMPLER:
@@ -350,9 +344,6 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
case PROGRAM_LOCAL_PARAM:
sprintf(str, "program.local[%s%d]", addr, index);
break;
- case PROGRAM_VARYING: /* extension */
- sprintf(str, "varying[%s%d]", addr, index);
- break;
case PROGRAM_CONSTANT: /* extension */
sprintf(str, "constant[%s%d]", addr, index);
break;
@@ -379,40 +370,6 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
}
break;
- case PROG_PRINT_NV:
- switch (f) {
- case PROGRAM_INPUT:
- if (prog->Target == GL_VERTEX_PROGRAM_ARB)
- sprintf(str, "v[%d]", index);
- else
- sprintf(str, "f[%d]", index);
- break;
- case PROGRAM_OUTPUT:
- sprintf(str, "o[%d]", index);
- break;
- case PROGRAM_TEMPORARY:
- sprintf(str, "R%d", index);
- break;
- case PROGRAM_ENV_PARAM:
- sprintf(str, "c[%d]", index);
- break;
- case PROGRAM_VARYING: /* extension */
- sprintf(str, "varying[%s%d]", addr, index);
- break;
- case PROGRAM_UNIFORM: /* extension */
- sprintf(str, "uniform[%s%d]", addr, index);
- break;
- case PROGRAM_CONSTANT: /* extension */
- sprintf(str, "constant[%s%d]", addr, index);
- break;
- case PROGRAM_STATE_VAR: /* extension */
- sprintf(str, "state[%s%d]", addr, index);
- break;
- default:
- _mesa_problem(NULL, "bad file in reg_string()");
- }
- break;
-
default:
_mesa_problem(NULL, "bad mode in reg_string()");
}
@@ -748,13 +705,6 @@ _mesa_fprint_instruction_opt(FILE *f,
fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
fprint_comment(f, inst);
break;
- case OPCODE_BRA:
- fprintf(f, "BRA %d (%s%s)",
- inst->BranchTarget,
- _mesa_condcode_string(inst->DstReg.CondMask),
- _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE));
- fprint_comment(f, inst);
- break;
case OPCODE_IF:
if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
/* Use ordinary register */
@@ -795,15 +745,9 @@ _mesa_fprint_instruction_opt(FILE *f,
break;
case OPCODE_BGNSUB:
- if (mode == PROG_PRINT_NV) {
- fprintf(f, "%s:\n", inst->Comment); /* comment is label */
- return indent;
- }
- else {
- fprintf(f, "BGNSUB");
- fprint_comment(f, inst);
- return indent + 3;
- }
+ fprintf(f, "BGNSUB");
+ fprint_comment(f, inst);
+ return indent + 3;
case OPCODE_ENDSUB:
if (mode == PROG_PRINT_DEBUG) {
fprintf(f, "ENDSUB");
@@ -811,13 +755,8 @@ _mesa_fprint_instruction_opt(FILE *f,
}
break;
case OPCODE_CAL:
- if (mode == PROG_PRINT_NV) {
- fprintf(f, "CAL %s; # (goto %d)\n", inst->Comment, inst->BranchTarget);
- }
- else {
- fprintf(f, "CAL %u", inst->BranchTarget);
- fprint_comment(f, inst);
- }
+ fprintf(f, "CAL %u", inst->BranchTarget);
+ fprint_comment(f, inst);
break;
case OPCODE_RET:
fprintf(f, "RET (%s%s)",
@@ -900,17 +839,12 @@ _mesa_fprint_program_opt(FILE *f,
case GL_VERTEX_PROGRAM_ARB:
if (mode == PROG_PRINT_ARB)
fprintf(f, "!!ARBvp1.0\n");
- else if (mode == PROG_PRINT_NV)
- fprintf(f, "!!VP1.0\n");
else
fprintf(f, "# Vertex Program/Shader %u\n", prog->Id);
break;
case GL_FRAGMENT_PROGRAM_ARB:
- case GL_FRAGMENT_PROGRAM_NV:
if (mode == PROG_PRINT_ARB)
fprintf(f, "!!ARBfp1.0\n");
- else if (mode == PROG_PRINT_NV)
- fprintf(f, "!!FP1.0\n");
else
fprintf(f, "# Fragment Program/Shader %u\n", prog->Id);
break;
@@ -1036,14 +970,6 @@ _mesa_fprint_parameter_list(FILE *f,
i, param->Size,
_mesa_register_file_name(list->Parameters[i].Type),
param->Name, v[0], v[1], v[2], v[3]);
- if (param->Flags & PROG_PARAM_BIT_CENTROID)
- fprintf(f, " Centroid");
- if (param->Flags & PROG_PARAM_BIT_INVARIANT)
- fprintf(f, " Invariant");
- if (param->Flags & PROG_PARAM_BIT_FLAT)
- fprintf(f, " Flat");
- if (param->Flags & PROG_PARAM_BIT_LINEAR)
- fprintf(f, " Linear");
fprintf(f, "\n");
}
}
diff --git a/mesalib/src/mesa/program/prog_print.h b/mesalib/src/mesa/program/prog_print.h
index b95ec2be5..3e400eb46 100644
--- a/mesalib/src/mesa/program/prog_print.h
+++ b/mesalib/src/mesa/program/prog_print.h
@@ -42,7 +42,6 @@ struct prog_instruction;
*/
typedef enum {
PROG_PRINT_ARB,
- PROG_PRINT_NV,
PROG_PRINT_DEBUG
} gl_prog_print_mode;
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index f9c6677b1..5a350798c 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -1074,94 +1074,3 @@ _mesa_load_state_parameters(struct gl_context *ctx,
}
}
}
-
-
-/**
- * Copy the 16 elements of a matrix into four consecutive program
- * registers starting at 'pos'.
- */
-static void
-load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
-{
- GLuint i;
- for (i = 0; i < 4; i++) {
- registers[pos + i][0] = mat[0 + i];
- registers[pos + i][1] = mat[4 + i];
- registers[pos + i][2] = mat[8 + i];
- registers[pos + i][3] = mat[12 + i];
- }
-}
-
-
-/**
- * As above, but transpose the matrix.
- */
-static void
-load_transpose_matrix(GLfloat registers[][4], GLuint pos,
- const GLfloat mat[16])
-{
- memcpy(registers[pos], mat, 16 * sizeof(GLfloat));
-}
-
-
-/**
- * Load current vertex program's parameter registers with tracked
- * matrices (if NV program). This only needs to be done per
- * glBegin/glEnd, not per-vertex.
- */
-void
-_mesa_load_tracked_matrices(struct gl_context *ctx)
-{
- GLuint i;
-
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
- /* point 'mat' at source matrix */
- GLmatrix *mat;
- if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) {
- mat = ctx->ModelviewMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) {
- mat = ctx->ProjectionMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) {
- GLuint unit = MIN2(ctx->Texture.CurrentUnit,
- Elements(ctx->TextureMatrixStack) - 1);
- mat = ctx->TextureMatrixStack[unit].Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) {
- /* XXX verify the combined matrix is up to date */
- mat = &ctx->_ModelProjectMatrix;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV &&
- ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) {
- GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV;
- ASSERT(n < Elements(ctx->ProgramMatrixStack));
- mat = ctx->ProgramMatrixStack[n].Top;
- }
- else {
- /* no matrix is tracked, but we leave the register values as-is */
- assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE);
- continue;
- }
-
- /* load the matrix values into sequential registers */
- if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) {
- load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
- }
- else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) {
- _math_matrix_analyse(mat); /* update the inverse */
- ASSERT(!_math_matrix_is_dirty(mat));
- load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
- }
- else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) {
- load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
- }
- else {
- assert(ctx->VertexProgram.TrackMatrixTransform[i]
- == GL_INVERSE_TRANSPOSE_NV);
- _math_matrix_analyse(mat); /* update the inverse */
- ASSERT(!_math_matrix_is_dirty(mat));
- load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
- }
- }
-}
diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h
index efd0e030c..af2c89792 100644
--- a/mesalib/src/mesa/program/prog_statevars.h
+++ b/mesalib/src/mesa/program/prog_statevars.h
@@ -146,9 +146,6 @@ extern char *
_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
-extern void
-_mesa_load_tracked_matrices(struct gl_context *ctx);
-
#ifdef __cplusplus
}
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index 30f83772f..993803dd5 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -52,8 +52,6 @@ struct gl_program _mesa_DummyProgram;
void
_mesa_init_program(struct gl_context *ctx)
{
- GLuint i;
-
/*
* If this assertion fails, we need to increase the field
* size for register indexes (see INST_INDEX_BITS).
@@ -90,10 +88,6 @@ _mesa_init_program(struct gl_context *ctx)
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
ctx->Shared->DefaultVertexProgram);
assert(ctx->VertexProgram.Current);
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
- ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
- ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
- }
ctx->VertexProgram.Cache = _mesa_new_program_cache();
ctx->FragmentProgram.Enabled = GL_FALSE;
@@ -244,7 +238,6 @@ _mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
memset(prog, 0, sizeof(*prog));
prog->Id = id;
prog->Target = target;
- prog->Resident = GL_TRUE;
prog->RefCount = 1;
prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
@@ -317,7 +310,6 @@ _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
struct gl_program *prog;
switch (target) {
case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
- case GL_VERTEX_STATE_PROGRAM_NV:
prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),
target, id );
break;
@@ -511,7 +503,6 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
const struct gl_vertex_program *vp = gl_vertex_program_const(prog);
struct gl_vertex_program *vpc = gl_vertex_program(clone);
vpc->IsPositionInvariant = vp->IsPositionInvariant;
- vpc->IsNVProgram = vp->IsNVProgram;
}
break;
case GL_FRAGMENT_PROGRAM_ARB:
@@ -925,9 +916,6 @@ _mesa_valid_register_index(const struct gl_context *ctx,
case PROGRAM_LOCAL_PARAM:
return index >= 0 && index < c->MaxLocalParams;
- case PROGRAM_NAMED_PARAM:
- return index >= 0 && index < c->MaxParameters;
-
case PROGRAM_UNIFORM:
case PROGRAM_STATE_VAR:
/* aka constant buffer */
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index 54b17314a..025b54706 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -468,7 +468,6 @@ KIL_instruction: KIL swizzleSrcReg
$$ = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
$$->Base.DstReg.CondMask = $2.CondMask;
$$->Base.DstReg.CondSwizzle = $2.CondSwizzle;
- $$->Base.DstReg.CondSrc = $2.CondSrc;
state->fragment.UsesKill = 1;
}
;
@@ -637,7 +636,6 @@ maskedDstReg: dstReg optionalMask optionalCcMask
$$.WriteMask = $2.mask;
$$.CondMask = $3.CondMask;
$$.CondSwizzle = $3.CondSwizzle;
- $$.CondSrc = $3.CondSrc;
if ($$.File == PROGRAM_OUTPUT) {
/* Technically speaking, this should check that it is in
@@ -1030,7 +1028,6 @@ optionalCcMask: '(' ccTest ')'
{
$$.CondMask = COND_TR;
$$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
}
;
@@ -1067,7 +1064,6 @@ ccMaskRule: IDENTIFIER
$$.CondMask = cond;
$$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
}
;
@@ -1090,7 +1086,6 @@ ccMaskRule2: USED_IDENTIFIER
$$.CondMask = cond;
$$.CondSwizzle = SWIZZLE_NOOP;
- $$.CondSrc = 0;
}
;
@@ -2478,7 +2473,7 @@ int add_state_reference(struct gl_program_parameter_list *param_list,
name = _mesa_program_state_string(tokens);
index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
- size, GL_NONE, NULL, tokens, 0x0);
+ size, GL_NONE, NULL, tokens);
param_list->StateFlags |= _mesa_program_state_flags(tokens);
/* free name string here since we duplicated it in add_parameter() */
diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c
index 389ea218b..2a3702198 100644
--- a/mesalib/src/mesa/program/programopt.c
+++ b/mesalib/src/mesa/program/programopt.c
@@ -499,9 +499,7 @@ _mesa_count_texture_instructions(struct gl_program *prog)
/**
* Scan/rewrite program to remove reads of custom (output) registers.
- * The passed type has to be either PROGRAM_OUTPUT or PROGRAM_VARYING
- * (for vertex shaders).
- * In GLSL shaders, varying vars can be read and written.
+ * The passed type has to be PROGRAM_OUTPUT.
* On some hardware, trying to read an output register causes trouble.
* So, rewrite the program to use a temporary register in this case.
*/
@@ -517,8 +515,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
_mesa_find_used_registers(prog, PROGRAM_TEMPORARY,
usedTemps, MAX_PROGRAM_TEMPS);
- assert(type == PROGRAM_VARYING || type == PROGRAM_OUTPUT);
- assert(prog->Target == GL_VERTEX_PROGRAM_ARB || type != PROGRAM_VARYING);
+ assert(type == PROGRAM_OUTPUT);
for (i = 0; i < VERT_RESULT_MAX; i++)
outputMap[i] = -1;
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index dabddf2fe..b14ec13ed 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -60,7 +60,6 @@ MAIN_FILES = \
$(SRCDIR)main/mipmap.c \
$(SRCDIR)main/mm.c \
$(SRCDIR)main/multisample.c \
- $(SRCDIR)main/nvprogram.c \
$(SRCDIR)main/pack.c \
$(SRCDIR)main/pbo.c \
$(SRCDIR)main/pixel.c \
@@ -250,8 +249,6 @@ STATETRACKER_FILES = \
PROGRAM_FILES = \
$(SRCDIR)program/arbprogparse.c \
$(SRCDIR)program/hash_table.c \
- $(SRCDIR)program/nvfragparse.c \
- $(SRCDIR)program/nvvertparse.c \
$(SRCDIR)program/program.c \
$(SRCDIR)program/program_parse_extra.c \
$(SRCDIR)program/prog_cache.c \
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index adcc7b505..3eba5b13c 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -34,6 +34,7 @@
#include "main/macros.h"
#include "main/mtypes.h"
+#include "main/glformats.h"
#include "main/samplerobj.h"
#include "main/texobj.h"
@@ -172,12 +173,17 @@ convert_sampler(struct st_context *st,
msamp->BorderColor.ui[2] ||
msamp->BorderColor.ui[3]) {
struct gl_texture_image *teximg;
+ GLboolean is_integer = GL_FALSE;
teximg = texobj->Image[0][texobj->BaseLevel];
- st_translate_color(msamp->BorderColor.f,
- teximg ? teximg->_BaseFormat : GL_RGBA,
- sampler->border_color.f);
+ if (teximg) {
+ is_integer = _mesa_is_enum_format_integer(teximg->InternalFormat);
+ }
+
+ st_translate_color(&msamp->BorderColor,
+ &sampler->border_color,
+ teximg ? teximg->_BaseFormat : GL_RGBA, is_integer);
}
sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index e731b6b5e..90eb0af4f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -37,6 +37,7 @@
#include "main/accum.h"
#include "main/formats.h"
#include "main/macros.h"
+#include "main/glformats.h"
#include "program/prog_instruction.h"
#include "st_context.h"
#include "st_atom.h"
@@ -301,9 +302,13 @@ clear_with_quad(struct gl_context *ctx,
cso_set_geometry_shader_handle(st->cso_context, NULL);
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- st_translate_color(ctx->Color.ClearColor.f,
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- clearColor.f);
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
+ GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
+
+ st_translate_color(&ctx->Color.ClearColor,
+ &clearColor,
+ ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
+ is_integer);
}
/* draw quad matching scissor rect */
@@ -540,9 +545,13 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- st_translate_color(ctx->Color.ClearColor.f,
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
+ GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
+
+ st_translate_color(&ctx->Color.ClearColor,
+ &clearColor,
ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- clearColor.f);
+ is_integer);
}
st->pipe->clear(st->pipe, clear_buffers, &clearColor,
diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c
index 617e7ce64..e7732bdbd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_program.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_program.c
@@ -99,8 +99,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
return _mesa_init_vertex_program(ctx, &prog->Base, target, id);
}
- case GL_FRAGMENT_PROGRAM_ARB:
- case GL_FRAGMENT_PROGRAM_NV: {
+ case GL_FRAGMENT_PROGRAM_ARB: {
struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
return _mesa_init_fragment_program(ctx, &prog->Base, target, id);
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index d6cb915e9..08a41c3e2 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -524,11 +524,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.NV_texgen_reflection = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
-#if 0
- /* possibly could support the following two */
- ctx->Extensions.NV_vertex_program = GL_TRUE;
- ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
-#endif
ctx->Extensions.OES_EGL_image = GL_TRUE;
if (ctx->API != API_OPENGL)
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index a9ff2cd0d..af81f732d 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1686,44 +1686,92 @@ st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2)
* Similarly for texture border colors.
*/
void
-st_translate_color(const GLfloat colorIn[4], GLenum baseFormat,
- GLfloat colorOut[4])
+st_translate_color(union gl_color_union *colorIn,
+ union pipe_color_union *colorOut,
+ GLenum baseFormat, GLboolean is_integer)
{
- switch (baseFormat) {
- case GL_RED:
- colorOut[0] = colorIn[0];
- colorOut[1] = 0.0F;
- colorOut[2] = 0.0F;
- colorOut[3] = 1.0F;
- break;
- case GL_RG:
- colorOut[0] = colorIn[0];
- colorOut[1] = colorIn[1];
- colorOut[2] = 0.0F;
- colorOut[3] = 1.0F;
- break;
- case GL_RGB:
- colorOut[0] = colorIn[0];
- colorOut[1] = colorIn[1];
- colorOut[2] = colorIn[2];
- colorOut[3] = 1.0F;
- break;
- case GL_ALPHA:
- colorOut[0] = colorOut[1] = colorOut[2] = 0.0;
- colorOut[3] = colorIn[3];
- break;
- case GL_LUMINANCE:
- colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0];
- colorOut[3] = 1.0;
- break;
- case GL_LUMINANCE_ALPHA:
- colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0];
- colorOut[3] = colorIn[3];
- break;
- case GL_INTENSITY:
- colorOut[0] = colorOut[1] = colorOut[2] = colorOut[3] = colorIn[0];
- break;
- default:
- COPY_4V(colorOut, colorIn);
+ if (is_integer) {
+ int *in = colorIn->i;
+ int *out = colorOut->i;
+
+ switch (baseFormat) {
+ case GL_RED:
+ out[0] = in[0];
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ break;
+ case GL_RG:
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = 0;
+ out[3] = 1;
+ break;
+ case GL_RGB:
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = 1;
+ break;
+ case GL_ALPHA:
+ out[0] = out[1] = out[2] = 0;
+ out[3] = in[3];
+ break;
+ case GL_LUMINANCE:
+ out[0] = out[1] = out[2] = in[0];
+ out[3] = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ out[0] = out[1] = out[2] = in[0];
+ out[3] = in[3];
+ break;
+ case GL_INTENSITY:
+ out[0] = out[1] = out[2] = out[3] = in[0];
+ break;
+ default:
+ COPY_4V(out, in);
+ }
+ }
+ else {
+ float *in = colorIn->f;
+ float *out = colorOut->f;
+
+ switch (baseFormat) {
+ case GL_RED:
+ out[0] = in[0];
+ out[1] = 0.0F;
+ out[2] = 0.0F;
+ out[3] = 1.0F;
+ break;
+ case GL_RG:
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = 0.0F;
+ out[3] = 1.0F;
+ break;
+ case GL_RGB:
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = 1.0F;
+ break;
+ case GL_ALPHA:
+ out[0] = out[1] = out[2] = 0.0F;
+ out[3] = in[3];
+ break;
+ case GL_LUMINANCE:
+ out[0] = out[1] = out[2] = in[0];
+ out[3] = 1.0F;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ out[0] = out[1] = out[2] = in[0];
+ out[3] = in[3];
+ break;
+ case GL_INTENSITY:
+ out[0] = out[1] = out[2] = out[3] = in[0];
+ break;
+ default:
+ COPY_4V(out, in);
+ }
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h
index 2eef2c0d4..39397b17a 100644
--- a/mesalib/src/mesa/state_tracker/st_format.h
+++ b/mesalib/src/mesa/state_tracker/st_format.h
@@ -75,7 +75,8 @@ st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2);
extern void
-st_translate_color(const GLfloat colorIn[4], GLenum baseFormat,
- GLfloat colorOut[4]);
+st_translate_color(union gl_color_union *colorIn,
+ union pipe_color_union *colorOut,
+ GLenum baseFormat, GLboolean is_integer);
#endif /* ST_FORMAT_H */
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 852dceaf6..705f2b055 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -74,7 +74,6 @@ extern "C" {
#define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \
(1 << PROGRAM_ENV_PARAM) | \
(1 << PROGRAM_STATE_VAR) | \
- (1 << PROGRAM_NAMED_PARAM) | \
(1 << PROGRAM_CONSTANT) | \
(1 << PROGRAM_UNIFORM))
@@ -536,7 +535,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op,
case PROGRAM_LOCAL_PARAM:
case PROGRAM_ENV_PARAM:
case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
case PROGRAM_CONSTANT:
case PROGRAM_UNIFORM:
this->indirect_addr_consts = true;
@@ -558,7 +556,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op,
case PROGRAM_LOCAL_PARAM:
case PROGRAM_ENV_PARAM:
case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
case PROGRAM_CONSTANT:
case PROGRAM_UNIFORM:
this->indirect_addr_consts = true;
@@ -4041,7 +4038,6 @@ src_register(struct st_translate *t,
t->temps[index] = ureg_DECL_local_temporary(t->ureg);
return ureg_src(t->temps[index]);
- case PROGRAM_NAMED_PARAM:
case PROGRAM_ENV_PARAM:
case PROGRAM_LOCAL_PARAM:
case PROGRAM_UNIFORM:
@@ -4692,7 +4688,6 @@ st_translate_program(
case PROGRAM_ENV_PARAM:
case PROGRAM_LOCAL_PARAM:
case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
case PROGRAM_UNIFORM:
t->constants[i] = ureg_DECL_constant(ureg, i);
break;
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index c614bdec5..a023058d0 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -49,7 +49,6 @@
#define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \
(1 << PROGRAM_ENV_PARAM) | \
(1 << PROGRAM_STATE_VAR) | \
- (1 << PROGRAM_NAMED_PARAM) | \
(1 << PROGRAM_CONSTANT) | \
(1 << PROGRAM_UNIFORM))
@@ -221,7 +220,6 @@ src_register( struct st_translate *t,
t->temps[index] = ureg_DECL_temporary( t->ureg );
return ureg_src(t->temps[index]);
- case PROGRAM_NAMED_PARAM:
case PROGRAM_ENV_PARAM:
case PROGRAM_LOCAL_PARAM:
case PROGRAM_UNIFORM:
@@ -543,8 +541,6 @@ translate_opcode( unsigned op )
return TGSI_OPCODE_BGNLOOP;
case OPCODE_BGNSUB:
return TGSI_OPCODE_BGNSUB;
- case OPCODE_BRA:
- return TGSI_OPCODE_BRA;
case OPCODE_BRK:
return TGSI_OPCODE_BRK;
case OPCODE_CAL:
@@ -1056,19 +1052,10 @@ st_translate_mesa_program(
*/
if (procType == TGSI_PROCESSOR_FRAGMENT) {
for (i = 0; i < numInputs; i++) {
- if (program->InputFlags[0] & PROG_PARAM_BIT_CYL_WRAP) {
- t->inputs[i] = ureg_DECL_fs_input_cyl(ureg,
- inputSemanticName[i],
- inputSemanticIndex[i],
- interpMode[i],
- TGSI_CYLINDRICAL_WRAP_X);
- }
- else {
- t->inputs[i] = ureg_DECL_fs_input(ureg,
- inputSemanticName[i],
- inputSemanticIndex[i],
- interpMode[i]);
- }
+ t->inputs[i] = ureg_DECL_fs_input(ureg,
+ inputSemanticName[i],
+ inputSemanticIndex[i],
+ interpMode[i]);
}
if (program->InputsRead & FRAG_BIT_WPOS) {
@@ -1211,7 +1198,6 @@ st_translate_mesa_program(
case PROGRAM_ENV_PARAM:
case PROGRAM_LOCAL_PARAM:
case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
case PROGRAM_UNIFORM:
t->constants[i] = ureg_DECL_constant( ureg, i );
break;
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index ac066a766..a9111b523 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -309,7 +309,6 @@ st_translate_vertex_program(struct st_context *st,
if (!stvp->glsl_to_tgsi)
{
_mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT);
- _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_VARYING);
}
ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
@@ -828,7 +827,6 @@ st_translate_geometry_program(struct st_context *st,
return NULL;
_mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT);
- _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_VARYING);
ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY );
if (ureg == NULL) {
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index 31a12dade..ef7ca2e15 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -251,9 +251,7 @@ _swrast_update_fog_state( struct gl_context *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
- assert((fp == NULL) ||
- (fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) ||
- (fp->Base.Target == GL_FRAGMENT_PROGRAM_NV));
+ assert(fp == NULL || fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB);
/* determine if fog is needed, and if so, which fog mode */
swrast->_FogEnabled = (!_swrast_use_fragment_program(ctx) &&
diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c
index 812189f09..9b60893db 100644
--- a/mesalib/src/mesa/swrast/s_fragprog.c
+++ b/mesalib/src/mesa/swrast/s_fragprog.c
@@ -164,11 +164,6 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
{
GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col];
- if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
- /* Clear temporary registers (undefined for ARB_f_p) */
- memset(machine->Temporaries, 0, MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
- }
-
/* ARB_fragment_coord_conventions */
if (program->OriginUpperLeft)
wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
diff --git a/mesalib/src/mesa/tnl/t_context.h b/mesalib/src/mesa/tnl/t_context.h
index 8f18ddeb1..62dde4f4e 100644
--- a/mesalib/src/mesa/tnl/t_context.h
+++ b/mesalib/src/mesa/tnl/t_context.h
@@ -221,7 +221,7 @@ struct vertex_buffer
GLuint PrimitiveCount;
/* Inputs to the vertex program stage */
- GLvector4f *AttribPtr[_TNL_ATTRIB_MAX]; /* GL_NV_vertex_program */
+ GLvector4f *AttribPtr[_TNL_ATTRIB_MAX];
};
diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c
index f2e76115e..8ff300cd7 100644
--- a/mesalib/src/mesa/tnl/t_vb_program.c
+++ b/mesalib/src/mesa/tnl/t_vb_program.c
@@ -231,21 +231,6 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
memcpy(machine->VertAttribs, ctx->Current.Attrib,
MAX_VERTEX_GENERIC_ATTRIBS * 4 * sizeof(GLfloat));
- if (ctx->VertexProgram._Current->IsNVProgram) {
- GLuint i;
- /* Output/result regs are initialized to [0,0,0,1] */
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_OUTPUTS; i++) {
- ASSIGN_4V(machine->Outputs[i], 0.0F, 0.0F, 0.0F, 1.0F);
- }
- /* Temp regs are initialized to [0,0,0,0] */
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_TEMPS; i++) {
- ASSIGN_4V(machine->Temporaries[i], 0.0F, 0.0F, 0.0F, 0.0F);
- }
- for (i = 0; i < MAX_VERTEX_PROGRAM_ADDRESS_REGS; i++) {
- ASSIGN_4V(machine->AddressReg[i], 0, 0, 0, 0);
- }
- }
-
machine->NumDeriv = 0;
/* init condition codes */
@@ -321,13 +306,8 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
if (!program)
return GL_TRUE;
- if (program->IsNVProgram) {
- _mesa_load_tracked_matrices(ctx);
- }
- else {
- /* ARB program or vertex shader */
- _mesa_load_state_parameters(ctx, program->Base.Parameters);
- }
+ /* ARB program or vertex shader */
+ _mesa_load_state_parameters(ctx, program->Base.Parameters);
/* make list of outputs to save some time below */
numOutputs = 0;
@@ -425,23 +405,6 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
unmap_textures(ctx, program);
- /* Fixup fog and point size results if needed */
- if (program->IsNVProgram) {
- if (ctx->Fog.Enabled &&
- (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_FOGC)) == 0) {
- for (i = 0; i < VB->Count; i++) {
- store->results[VERT_RESULT_FOGC].data[i][0] = 1.0;
- }
- }
-
- if (ctx->VertexProgram.PointSizeEnabled &&
- (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_PSIZ)) == 0) {
- for (i = 0; i < VB->Count; i++) {
- store->results[VERT_RESULT_PSIZ].data[i][0] = ctx->Point.Size;
- }
- }
- }
-
if (program->IsPositionInvariant) {
/* We need the exact same transform as in the fixed function path here
* to guarantee invariance, depending on compiler optimization flags
diff --git a/mesalib/src/mesa/tnl/tnl.h b/mesalib/src/mesa/tnl/tnl.h
index f6b70e323..958322887 100644
--- a/mesalib/src/mesa/tnl/tnl.h
+++ b/mesalib/src/mesa/tnl/tnl.h
@@ -95,9 +95,6 @@ _tnl_vbo_draw_prims( struct gl_context *ctx,
struct gl_transform_feedback_object *tfb_vertcount );
extern void
-_mesa_load_tracked_matrices(struct gl_context *ctx);
-
-extern void
_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
extern void
diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h
index e3e37e7f2..c896f1196 100644
--- a/mesalib/src/mesa/vbo/vbo_context.h
+++ b/mesalib/src/mesa/vbo/vbo_context.h
@@ -106,8 +106,6 @@ get_program_mode( struct gl_context *ctx )
return VP_NONE;
else if (ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram)
return VP_NONE;
- else if (ctx->VertexProgram._Current->IsNVProgram)
- return VP_NV;
else
return VP_ARB;
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c
index 0763f0d4d..81a4d25ff 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.c
+++ b/mesalib/src/mesa/vbo/vbo_exec.c
@@ -89,7 +89,7 @@ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
exec->array.recalculate_inputs = GL_TRUE;
}
- if (new_state & (_NEW_PROGRAM|_NEW_EVAL))
+ if (new_state & _NEW_EVAL)
exec->eval.recalculate_maps = 1;
_ae_invalidate_state(ctx, new_state);
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index 635e743ae..ef57a8199 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -55,7 +55,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/** Current vertex program mode */
enum vp_mode {
VP_NONE, /**< fixed function */
- VP_NV, /**< NV vertex program */
VP_ARB /**< ARB vertex program or GLSL vertex shader */
};
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 6bcb61cc8..2ddb71588 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -667,8 +667,7 @@ vbo_exec_EvalMesh1(GLenum mode, GLint i1, GLint i2)
/* No effect if vertex maps disabled.
*/
if (!ctx->Eval.Map1Vertex4 &&
- !ctx->Eval.Map1Vertex3 &&
- !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
+ !ctx->Eval.Map1Vertex3)
return;
du = ctx->Eval.MapGrid1du;
@@ -704,8 +703,7 @@ vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
/* No effect if vertex maps disabled.
*/
if (!ctx->Eval.Map2Vertex4 &&
- !ctx->Eval.Map2Vertex3 &&
- !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
+ !ctx->Eval.Map2Vertex3)
return;
du = ctx->Eval.MapGrid2du;
@@ -960,6 +958,10 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
vfmt->VertexAttrib4fvARB = vbo_VertexAttrib4fvARB;
}
+ /* Note that VertexAttrib4fNV is used from dlist.c and api_arrayelt.c so
+ * they can have a single entrypoint for updating any of the legacy
+ * attribs.
+ */
vfmt->VertexAttrib1fNV = vbo_VertexAttrib1fNV;
vfmt->VertexAttrib1fvNV = vbo_VertexAttrib1fvNV;
vfmt->VertexAttrib2fNV = vbo_VertexAttrib2fNV;
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index f0ef2058e..d857ac3e5 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -440,32 +440,6 @@ recalculate_input_bindings(struct gl_context *ctx)
}
break;
- case VP_NV:
- /* NV_vertex_program - attribute arrays alias and override
- * conventional, legacy arrays. No materials, and the generic
- * slots are vacant.
- */
- for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
- if (i < VERT_ATTRIB_GENERIC_MAX
- && vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
- inputs[i] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)];
- else if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
- inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
- else {
- inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i];
- const_inputs |= VERT_BIT_FF(i);
- }
- }
-
- /* Could use just about anything, just to fill in the empty
- * slots:
- */
- for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
- inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
- const_inputs |= VERT_BIT_GENERIC(i);
- }
- break;
-
case VP_ARB:
/* GL_ARB_vertex_program or GLSL vertex shader - Only the generic[0]
* attribute array aliases and overrides the legacy position array.
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index 15ecfc031..817af4dd5 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -180,12 +180,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
}
map = vbo->map_vp_none;
break;
- case VP_NV:
case VP_ARB:
- /* The aliasing of attributes for NV vertex programs has already
- * occurred. NV vertex programs cannot access material values,
- * nor attributes greater than VERT_ATTRIB_TEX7.
- */
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_eval.c b/mesalib/src/mesa/vbo/vbo_exec_eval.c
index 1e8c3c45b..e6c728476 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_eval.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_eval.c
@@ -117,23 +117,6 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec )
else if (ctx->Eval.Map2Vertex3)
set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );
- /* _NEW_PROGRAM */
- if (ctx->VertexProgram._Enabled) {
- /* These are the 16 evaluators which GL_NV_vertex_program defines.
- * They alias and override the conventional vertex attributs.
- */
- for (attr = 0; attr < 16; attr++) {
- /* _NEW_EVAL */
- assert(attr < Elements(ctx->Eval.Map1Attrib));
- if (ctx->Eval.Map1Attrib[attr])
- set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] );
-
- assert(attr < Elements(ctx->Eval.Map2Attrib));
- if (ctx->Eval.Map2Attrib[attr])
- set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] );
- }
- }
-
exec->eval.recalculate_maps = 0;
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index 8ffc96aec..09b8b8ab2 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -152,12 +152,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
}
map = vbo->map_vp_none;
break;
- case VP_NV:
case VP_ARB:
- /* The aliasing of attributes for NV vertex programs has already
- * occurred. NV vertex programs cannot access material values,
- * nor attributes greater than VERT_ATTRIB_TEX7.
- */
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}