aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/Android.libmesa_dricore.mk2
-rw-r--r--mesalib/src/mesa/Android.libmesa_st_mesa.mk2
-rw-r--r--mesalib/src/mesa/SConscript7
-rw-r--r--mesalib/src/mesa/drivers/SConscript5
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Android.mk2
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am10
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.sources8
-rw-r--r--mesalib/src/mesa/drivers/dri/common/SConscript83
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.c22
-rw-r--r--mesalib/src/mesa/main/arbprogram.c6
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h30
-rw-r--r--mesalib/src/mesa/main/performance_monitor.c16
-rw-r--r--mesalib/src/mesa/main/texstorage.c7
-rw-r--r--mesalib/src/mesa/main/varray.h6
-rw-r--r--mesalib/src/mesa/program/Android.mk2
-rw-r--r--mesalib/src/mesa/program/prog_execute.c10
-rw-r--r--mesalib/src/mesa/program/prog_print.c10
-rw-r--r--mesalib/src/mesa/program/program.c18
-rw-r--r--mesalib/src/mesa/program/program_parse.y7
-rw-r--r--mesalib/src/mesa/program/program_parser.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp12
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c8
23 files changed, 183 insertions, 94 deletions
diff --git a/mesalib/src/mesa/Android.libmesa_dricore.mk b/mesalib/src/mesa/Android.libmesa_dricore.mk
index 3679b50ba..0db5825de 100644
--- a/mesalib/src/mesa/Android.libmesa_dricore.mk
+++ b/mesalib/src/mesa/Android.libmesa_dricore.mk
@@ -38,8 +38,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_dricore
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-MESA_ENABLED_APIS := ES1 ES2 GL
-
LOCAL_SRC_FILES := \
$(MESA_FILES)
diff --git a/mesalib/src/mesa/Android.libmesa_st_mesa.mk b/mesalib/src/mesa/Android.libmesa_st_mesa.mk
index e7203c41d..e6374a6d8 100644
--- a/mesalib/src/mesa/Android.libmesa_st_mesa.mk
+++ b/mesalib/src/mesa/Android.libmesa_st_mesa.mk
@@ -37,8 +37,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_st_mesa
-MESA_ENABLED_APIS := ES1 ES2
-
LOCAL_SRC_FILES := \
$(MESA_GALLIUM_FILES)
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index 42134983c..a2bb9f131 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -18,9 +18,6 @@ env.Append(CPPPATH = [
Dir('.'), # src/mesa build path
])
-enabled_apis = []
-enabled_apis += ['GL']
-
if env['platform'] == 'windows':
env.Append(CPPDEFINES = [
'_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
@@ -340,10 +337,6 @@ mesa_sources = (
GLAPI = '#src/mapi/glapi/'
-if env['gles']:
-
- enabled_apis += ['ES1', 'ES2']
-
get_hash_header = env.CodeGenerate(
target = 'main/get_hash.h',
script = 'main/get_hash_generator.py',
diff --git a/mesalib/src/mesa/drivers/SConscript b/mesalib/src/mesa/drivers/SConscript
index 86aa868e5..9888e3306 100644
--- a/mesalib/src/mesa/drivers/SConscript
+++ b/mesalib/src/mesa/drivers/SConscript
@@ -6,7 +6,10 @@ if env['x11']:
SConscript('x11/SConscript')
if env['dri']:
- SConscript('dri/common/xmlpool/SConscript')
+ SConscript([
+ 'dri/common/xmlpool/SConscript',
+ 'dri/common/SConscript',
+ ])
if env['platform'] == 'windows':
SConscript('windows/gdi/SConscript')
diff --git a/mesalib/src/mesa/drivers/dri/common/Android.mk b/mesalib/src/mesa/drivers/dri/common/Android.mk
index b3dac29dd..0489a32de 100644
--- a/mesalib/src/mesa/drivers/dri/common/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/common/Android.mk
@@ -40,7 +40,7 @@ LOCAL_C_INCLUDES := \
$(intermediates) \
$(MESA_DRI_C_INCLUDES)
-LOCAL_SRC_FILES := $(mesa_dri_common_SOURCES)
+LOCAL_SRC_FILES := $(DRI_COMMON_FILES)
LOCAL_GENERATED_SOURCES := \
$(intermediates)/xmlpool/options.h
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am
index 7f87ed6f5..e500bdb30 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -21,6 +21,8 @@
SUBDIRS = xmlpool
+include Makefile.sources
+
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/ \
@@ -35,13 +37,9 @@ noinst_LTLIBRARIES = \
libmegadriver_stub.la \
libdri_test_stubs.la
-libdricommon_la_SOURCES = \
- utils.c \
- dri_util.c \
- xmlconfig.c
+libdricommon_la_SOURCES = $(DRI_COMMON_FILES)
-libdri_test_stubs_la_SOURCES = \
- dri_test.c
+libdri_test_stubs_la_SOURCES = $(test_stubs_FILES)
libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
libmegadriver_stub_la_SOURCES = megadriver_stub.c
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.sources b/mesalib/src/mesa/drivers/dri/common/Makefile.sources
index 040b71725..8469b4950 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.sources
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.sources
@@ -1,11 +1,8 @@
-mesa_dri_common_gallium_SOURCES := \
+DRI_COMMON_FILES := \
utils.c \
dri_util.c \
xmlconfig.c
-mesa_dri_common_SOURCES := \
- $(mesa_dri_common_gallium_SOURCES)
-
# Paths are relative to MESA_TOP.
mesa_dri_common_INCLUDES := \
include \
@@ -14,3 +11,6 @@ mesa_dri_common_INCLUDES := \
src/mapi \
src/mesa \
src/mesa/drivers/dri/common
+
+test_stubs_FILES := \
+ dri_test.c
diff --git a/mesalib/src/mesa/drivers/dri/common/SConscript b/mesalib/src/mesa/drivers/dri/common/SConscript
new file mode 100644
index 000000000..8b15532e3
--- /dev/null
+++ b/mesalib/src/mesa/drivers/dri/common/SConscript
@@ -0,0 +1,83 @@
+###################################
+# SConcscript file for dri targets
+
+Import('*')
+
+drienv = env.Clone()
+
+drienv.Replace(CPPPATH = [
+ '#src/mesa/drivers/dri/common',
+ xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h
+ '#include',
+ '#include/GL/internal',
+ '#src/mapi',
+ '#src/gallium/include',
+ '#src/gallium/auxiliary',
+ '#src/gallium/drivers',
+ '#src/gallium/winsys',
+ '#src/mesa',
+ '#src/mesa/main',
+ '#src/mesa/glapi',
+ '#src/mesa/math',
+ '#src/mesa/transform',
+ '#src/mesa/shader',
+ '#src/mesa/swrast',
+ '#src/mesa/swrast_setup',
+ '#src/egl/main',
+ '#src/egl/drivers/dri',
+])
+
+driswenv = drienv.Clone()
+driswenv.Append(CPPDEFINES = [
+ '__NOT_HAVE_DRM_H',
+])
+
+drienv.PkgUseModules('DRM')
+
+dri_common_utils = drienv.SharedObject(
+ target = 'utils.o',
+ source = '#src/mesa/drivers/dri/common/utils.c'
+)
+
+dri_common_xmlconfig = drienv.SharedObject(
+ target = 'xmlconfig.o',
+ source = '#src/mesa/drivers/dri/common/xmlconfig.c'
+)
+
+dri_common_dri_util = drienv.SharedObject(
+ target = 'dri_util.o',
+ source = '#src/mesa/drivers/dri/common/dri_util.c'
+)
+
+dri_common_drisw_util = driswenv.SharedObject(
+ target = 'drisw_util.o',
+ source = '#src/mesa/drivers/dri/common/dri_util.c'
+)
+
+
+COMMON_DRI_SW_OBJECTS = [
+ dri_common_utils,
+ dri_common_xmlconfig,
+ dri_common_drisw_util,
+]
+
+COMMON_DRI_DRM_OBJECTS = [
+ dri_common_utils,
+ dri_common_xmlconfig,
+ dri_common_dri_util,
+]
+
+drienv.AppendUnique(LIBS = [
+ 'expat',
+])
+
+driswenv.AppendUnique(LIBS = [
+ 'expat',
+])
+
+Export([
+ 'drienv',
+ 'driswenv',
+ 'COMMON_DRI_SW_OBJECTS',
+ 'COMMON_DRI_DRM_OBJECTS',
+])
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index 6822465e8..c9d4d038f 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -1469,6 +1469,18 @@ check_vbo(AEcontext *actx, struct gl_buffer_object *vbo)
}
+static inline void
+update_derived_client_arrays(struct gl_context *ctx)
+{
+ struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
+
+ if (arrayObj->NewArrays) {
+ _mesa_update_array_object_client_arrays(ctx, arrayObj);
+ arrayObj->NewArrays = 0;
+ }
+}
+
+
/**
* Make a list of per-vertex functions to call for each glArrayElement call.
* These functions access the array data (i.e. glVertex, glColor, glNormal,
@@ -1486,12 +1498,6 @@ _ae_update_state(struct gl_context *ctx)
actx->nr_vbos = 0;
- if (arrayObj->NewArrays) {
- /* update the derived client arrays */
- _mesa_update_array_object_client_arrays(ctx, arrayObj);
- arrayObj->NewArrays = 0;
- }
-
/* conventional vertex arrays */
if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
@@ -1618,6 +1624,8 @@ _ae_map_vbos(struct gl_context *ctx)
if (actx->mapped_vbos)
return;
+ update_derived_client_arrays(ctx);
+
if (actx->NewState)
_ae_update_state(ctx);
@@ -1669,6 +1677,8 @@ _ae_ArrayElement(GLint elt)
const struct _glapi_table * const disp = GET_DISPATCH();
GLboolean do_map;
+ update_derived_client_arrays(ctx);
+
/* If PrimitiveRestart is enabled and the index is the RestartIndex
* then we call PrimitiveRestartNV and return.
*/
diff --git a/mesalib/src/mesa/main/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c
index 51a299370..8bd3f0bd0 100644
--- a/mesalib/src/mesa/main/arbprogram.c
+++ b/mesalib/src/mesa/main/arbprogram.c
@@ -265,6 +265,12 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
return GL_FALSE;
}
+ if (!prog->LocalParams) {
+ prog->LocalParams = calloc(maxParams, sizeof(float[4]));
+ if (!prog->LocalParams)
+ return GL_FALSE;
+ }
+
*param = prog->LocalParams[index];
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 75a3cbab1..e0aee7a35 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -494,7 +494,7 @@ init_program_limits(struct gl_context *ctx, GLenum type,
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;
+ prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
prog->MaxInputComponents = 16 * 4; /* old limit not to break tnl and swrast */
prog->MaxOutputComponents = 16 * 4; /* old limit not to break tnl and swrast */
break;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 41ffdb765..8801d6f61 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1846,9 +1846,19 @@ struct gl_transform_feedback_state
*/
struct gl_perf_monitor_object
{
+ GLuint Name;
+
+ /** True if the monitor is currently active (Begin called but not End). */
GLboolean Active;
/**
+ * True if the monitor has ended.
+ *
+ * This is distinct from !Active because it may never have began.
+ */
+ GLboolean Ended;
+
+ /**
* A list of groups with currently active counters.
*
* ActiveGroups[g] == n if there are n counters active from group 'g'.
@@ -1930,10 +1940,9 @@ struct gl_perf_monitor_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_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.
+ * NOTE: 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.
*/
typedef enum
{
@@ -1941,8 +1950,6 @@ typedef enum
PROGRAM_ARRAY, /**< Arrays & Matrixes */
PROGRAM_INPUT, /**< machine->Inputs[] */
PROGRAM_OUTPUT, /**< machine->Outputs[] */
- PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */
- PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */
PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */
PROGRAM_CONSTANT, /**< gl_program->Parameters[] */
PROGRAM_UNIFORM, /**< gl_program->Parameters[] */
@@ -2038,8 +2045,15 @@ struct gl_program
/** Named parameters, constants, etc. from program text */
struct gl_program_parameter_list *Parameters;
- /** Numbered local parameters */
- GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4];
+
+ /**
+ * Local parameters used by the program.
+ *
+ * It's dynamically allocated because it is rarely used (just
+ * assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries once it's
+ * allocated.
+ */
+ GLfloat (*LocalParams)[4];
/** Map from sampler unit to texture unit (set by glUniform1i()) */
GLubyte SamplerUnits[MAX_SAMPLERS];
diff --git a/mesalib/src/mesa/main/performance_monitor.c b/mesalib/src/mesa/main/performance_monitor.c
index 17cae5183..6491b4200 100644
--- a/mesalib/src/mesa/main/performance_monitor.c
+++ b/mesalib/src/mesa/main/performance_monitor.c
@@ -62,6 +62,10 @@ new_performance_monitor(struct gl_context *ctx, GLuint index)
if (m == NULL)
return NULL;
+ m->Name = index;
+
+ m->Active = false;
+
m->ActiveGroups =
rzalloc_array(NULL, unsigned, ctx->PerfMonitor.NumGroups);
@@ -355,8 +359,10 @@ _mesa_DeletePerfMonitorsAMD(GLsizei n, GLuint *monitors)
if (m) {
/* Give the driver a chance to stop the monitor if it's active. */
- if (m->Active)
+ if (m->Active) {
ctx->Driver.ResetPerfMonitor(ctx, m);
+ m->Ended = false;
+ }
_mesa_HashRemove(ctx->PerfMonitor.Monitors, monitors[i]);
ralloc_free(m->ActiveGroups);
@@ -474,6 +480,7 @@ _mesa_BeginPerfMonitorAMD(GLuint monitor)
*/
if (ctx->Driver.BeginPerfMonitor(ctx, m)) {
m->Active = true;
+ m->Ended = false;
} else {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginPerfMonitor(driver unable to begin monitoring)");
@@ -503,6 +510,7 @@ _mesa_EndPerfMonitorAMD(GLuint monitor)
ctx->Driver.EndPerfMonitor(ctx, m);
m->Active = false;
+ m->Ended = true;
}
/**
@@ -560,8 +568,12 @@ _mesa_GetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname,
return;
}
+ /* If the monitor has never ended, there is no result. */
+ bool result_available = m->Ended &&
+ ctx->Driver.IsPerfMonitorResultAvailable(ctx, m);
+
/* AMD appears to return 0 for all queries unless a result is available. */
- if (!ctx->Driver.IsPerfMonitorResultAvailable(ctx, m)) {
+ if (!result_available) {
*data = 0;
if (bytesWritten != NULL)
*bytesWritten = sizeof(GLuint);
diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c
index 7bd8652b5..84b8f8224 100644
--- a/mesalib/src/mesa/main/texstorage.c
+++ b/mesalib/src/mesa/main/texstorage.c
@@ -365,6 +365,13 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat,
GET_CURRENT_CONTEXT(ctx);
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexStorage%uD %s %d %s %d %d %d\n",
+ dims,
+ _mesa_lookup_enum_by_nr(target), levels,
+ _mesa_lookup_enum_by_nr(internalformat),
+ width, height, depth);
+
if (tex_storage_error_check(ctx, dims, target, levels,
internalformat, width, height, depth)) {
return; /* error was recorded */
diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h
index 3b9f39a61..bc820ed23 100644
--- a/mesalib/src/mesa/main/varray.h
+++ b/mesalib/src/mesa/main/varray.h
@@ -110,12 +110,6 @@ extern void GLAPIENTRY
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr);
-extern void GLAPIENTRY
-_mesa_UnlockArraysEXT( void );
-
-extern void GLAPIENTRY
-_mesa_LockArraysEXT(GLint first, GLsizei count);
-
extern void GLAPIENTRY
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
diff --git a/mesalib/src/mesa/program/Android.mk b/mesalib/src/mesa/program/Android.mk
index 29a1b6a63..e85afe672 100644
--- a/mesalib/src/mesa/program/Android.mk
+++ b/mesalib/src/mesa/program/Android.mk
@@ -47,8 +47,6 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
intermediates := $(call local-intermediates-dir)
-MESA_ENABLED_APIS := ES1 ES2
-
# TODO(chadv): In Makefile.sources, move these vars to a different list so we can
# remove this kludge.
generated_sources_basenames := \
diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c
index 560332a6e..115525eba 100644
--- a/mesalib/src/mesa/program/prog_execute.c
+++ b/mesalib/src/mesa/program/prog_execute.c
@@ -118,16 +118,6 @@ get_src_register_pointer(const struct prog_src_register *source,
return ZeroVec;
return machine->Outputs[reg];
- case PROGRAM_LOCAL_PARAM:
- if (reg >= MAX_PROGRAM_LOCAL_PARAMS)
- return ZeroVec;
- return machine->CurProgram->LocalParams[reg];
-
- case PROGRAM_ENV_PARAM:
- if (reg >= MAX_PROGRAM_ENV_PARAMS)
- return ZeroVec;
- return machine->EnvParams[reg];
-
case PROGRAM_STATE_VAR:
/* Fallthrough */
case PROGRAM_CONSTANT:
diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c
index fa9063f5b..fa120cc5e 100644
--- a/mesalib/src/mesa/program/prog_print.c
+++ b/mesalib/src/mesa/program/prog_print.c
@@ -50,10 +50,6 @@ _mesa_register_file_name(gl_register_file f)
switch (f) {
case PROGRAM_TEMPORARY:
return "TEMP";
- case PROGRAM_LOCAL_PARAM:
- return "LOCAL";
- case PROGRAM_ENV_PARAM:
- return "ENV";
case PROGRAM_STATE_VAR:
return "STATE";
case PROGRAM_INPUT:
@@ -382,12 +378,6 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
case PROGRAM_TEMPORARY:
sprintf(str, "temp%d", index);
break;
- case PROGRAM_ENV_PARAM:
- sprintf(str, "program.env[%s%d]", addr, index);
- break;
- case PROGRAM_LOCAL_PARAM:
- sprintf(str, "program.local[%s%d]", addr, index);
- break;
case PROGRAM_CONSTANT: /* extension */
sprintf(str, "constant[%s%d]", addr, index);
break;
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index a102ec17a..01f8c6f11 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -349,6 +349,7 @@ _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
return;
free(prog->String);
+ free(prog->LocalParams);
if (prog->Instructions) {
_mesa_free_instructions(prog->Instructions, prog->NumInstructions);
@@ -477,7 +478,16 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
if (prog->Parameters)
clone->Parameters = _mesa_clone_parameter_list(prog->Parameters);
- memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
+ if (prog->LocalParams) {
+ clone->LocalParams = malloc(MAX_PROGRAM_LOCAL_PARAMS *
+ sizeof(float[4]));
+ if (!clone->LocalParams) {
+ _mesa_reference_program(ctx, &clone, NULL);
+ return NULL;
+ }
+ memcpy(clone->LocalParams, prog->LocalParams,
+ MAX_PROGRAM_LOCAL_PARAMS * sizeof(float[4]));
+ }
clone->IndirectRegisterFiles = prog->IndirectRegisterFiles;
clone->NumInstructions = prog->NumInstructions;
clone->NumTemporaries = prog->NumTemporaries;
@@ -909,12 +919,6 @@ _mesa_valid_register_index(const struct gl_context *ctx,
case PROGRAM_TEMPORARY:
return index >= 0 && index < (GLint) c->MaxTemps;
- case PROGRAM_ENV_PARAM:
- return index >= 0 && index < (GLint) c->MaxEnvParams;
-
- case PROGRAM_LOCAL_PARAM:
- return index >= 0 && index < (GLint) c->MaxLocalParams;
-
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 a76db4e86..03c0a3dba 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
+#include "main/macros.h"
#include "main/mtypes.h"
#include "main/imports.h"
#include "program/program.h"
@@ -2559,6 +2560,12 @@ initialize_symbol_from_param(struct gl_program *prog,
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_STATE_VAR;
+ /* Dynamically allocate LocalParams, since it's a large array to have
+ * statically in every gl_program otherwise.
+ */
+ if (state_tokens[1] == STATE_LOCAL && !prog->LocalParams)
+ prog->LocalParams = calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+
/* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
* we need to unroll it and call add_state_reference() for each row
*/
diff --git a/mesalib/src/mesa/program/program_parser.h b/mesalib/src/mesa/program/program_parser.h
index ca36bb6dc..04c64f446 100644
--- a/mesalib/src/mesa/program/program_parser.h
+++ b/mesalib/src/mesa/program/program_parser.h
@@ -44,7 +44,7 @@ struct asm_symbol {
unsigned output_binding; /**< Output / result register number. */
/**
- * One of PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, or PROGRAM_ENV_PARAM.
+ * One of PROGRAM_STATE_VAR or PROGRAM_CONSTANT.
*/
unsigned param_binding_type;
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 0eaf7467b..6319079d5 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -70,9 +70,7 @@ extern "C" {
}
#define PROGRAM_IMMEDIATE PROGRAM_FILE_MAX
-#define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \
- (1 << PROGRAM_ENV_PARAM) | \
- (1 << PROGRAM_STATE_VAR) | \
+#define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) | \
(1 << PROGRAM_CONSTANT) | \
(1 << PROGRAM_UNIFORM))
@@ -565,8 +563,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op,
/* Update indirect addressing status used by TGSI */
if (dst.reladdr) {
switch(dst.file) {
- case PROGRAM_LOCAL_PARAM:
- case PROGRAM_ENV_PARAM:
case PROGRAM_STATE_VAR:
case PROGRAM_CONSTANT:
case PROGRAM_UNIFORM:
@@ -583,8 +579,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op,
for (i=0; i<3; i++) {
if(inst->src[i].reladdr) {
switch(inst->src[i].file) {
- case PROGRAM_LOCAL_PARAM:
- case PROGRAM_ENV_PARAM:
case PROGRAM_STATE_VAR:
case PROGRAM_CONSTANT:
case PROGRAM_UNIFORM:
@@ -4311,8 +4305,6 @@ src_register(struct st_translate *t,
case PROGRAM_ARRAY:
return ureg_src(dst_register(t, file, index));
- case PROGRAM_ENV_PARAM:
- case PROGRAM_LOCAL_PARAM:
case PROGRAM_UNIFORM:
assert(index >= 0);
return t->constants[index];
@@ -4962,8 +4954,6 @@ st_translate_program(
for (i = 0; i < proginfo->Parameters->NumParameters; i++) {
switch (proginfo->Parameters->Parameters[i].Type) {
- case PROGRAM_ENV_PARAM:
- case PROGRAM_LOCAL_PARAM:
case PROGRAM_STATE_VAR:
case PROGRAM_UNIFORM:
t->constants[i] = ureg_DECL_constant(ureg, i);
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 1bbeced34..921b0f9b8 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -46,9 +46,7 @@
#include "util/u_memory.h"
-#define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \
- (1 << PROGRAM_ENV_PARAM) | \
- (1 << PROGRAM_STATE_VAR) | \
+#define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) | \
(1 << PROGRAM_CONSTANT) | \
(1 << PROGRAM_UNIFORM))
@@ -214,8 +212,6 @@ src_register( struct st_translate *t,
t->temps[index] = ureg_DECL_temporary( t->ureg );
return ureg_src(t->temps[index]);
- case PROGRAM_ENV_PARAM:
- case PROGRAM_LOCAL_PARAM:
case PROGRAM_UNIFORM:
assert(index >= 0);
return t->constants[index];
@@ -1195,8 +1191,6 @@ st_translate_mesa_program(
for (i = 0; i < program->Parameters->NumParameters; i++) {
switch (program->Parameters->Parameters[i].Type) {
- case PROGRAM_ENV_PARAM:
- case PROGRAM_LOCAL_PARAM:
case PROGRAM_STATE_VAR:
case PROGRAM_UNIFORM:
t->constants[i] = ureg_DECL_constant( ureg, i );