aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/SConscript17
-rw-r--r--mesalib/src/mesa/main/mtypes.h14
-rw-r--r--mesalib/src/mesa/main/shaderobj.h4
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp10
-rw-r--r--mesalib/src/mesa/program/program.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c24
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp10
8 files changed, 32 insertions, 54 deletions
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index 0f1543802..d328fc13c 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -417,23 +417,6 @@ if (env['gcc'] or env['clang']) and \
env.Append(CPPPATH = [matypes[0].dir])
-# The enums.c file is generated from the GL/ES API.xml file
-env.CodeGenerate(
- target = 'main/enums.c',
- script = GLAPI + 'gen/gl_enums.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
- )
-
-# The api_exec.c file is generated from the GL/ES API.xml file
-env.CodeGenerate(
- target = 'main/api_exec.c',
- script = GLAPI + 'gen/gl_genexec.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
- )
-
-
def write_git_sha1_h_file(filename):
"""Mesa looks for a git_sha1.h file at compile time in order to display
the current git hash id in the GL_VERSION string. This function tries
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 1f62e2c9c..2f7cce7ba 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2173,13 +2173,16 @@ struct gl_shader
/**
* Shader stages. Note that these will become 5 with tessellation.
- * These MUST have the same values as gallium's PIPE_SHADER_*
+ *
+ * The order must match how shaders are ordered in the pipeline.
+ * The GLSL linker assumes that if i<j, then the j-th shader is
+ * executed later than the i-th shader.
*/
typedef enum
{
MESA_SHADER_VERTEX = 0,
- MESA_SHADER_FRAGMENT = 1,
- MESA_SHADER_GEOMETRY = 2,
+ MESA_SHADER_GEOMETRY = 1,
+ MESA_SHADER_FRAGMENT = 2,
MESA_SHADER_TYPES = 3
} gl_shader_type;
@@ -2922,12 +2925,11 @@ struct gl_constants
GLboolean StripTextureBorder;
/**
- * For drivers which can do a better job at eliminating unused varyings
- * and uniforms than the GLSL compiler.
+ * For drivers which can do a better job at eliminating unused uniforms
+ * than the GLSL compiler.
*
* XXX Remove these as soon as a better solution is available.
*/
- GLboolean GLSLSkipStrictMaxVaryingLimitCheck;
GLboolean GLSLSkipStrictMaxUniformLimitCheck;
/**
diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h
index 5ce85cfde..de1c9fcaf 100644
--- a/mesalib/src/mesa/main/shaderobj.h
+++ b/mesalib/src/mesa/main/shaderobj.h
@@ -123,8 +123,8 @@ _mesa_shader_index_to_type(GLuint i)
{
static const GLenum enums[MESA_SHADER_TYPES] = {
GL_VERTEX_SHADER,
- GL_FRAGMENT_SHADER,
- GL_GEOMETRY_SHADER ,
+ GL_GEOMETRY_SHADER,
+ GL_FRAGMENT_SHADER
};
if (i >= MESA_SHADER_TYPES)
return 0;
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 35a9b8437..4af1c8241 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3073,12 +3073,6 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
- static const GLenum targets[] = {
- GL_VERTEX_PROGRAM_ARB,
- GL_FRAGMENT_PROGRAM_ARB,
- GL_GEOMETRY_PROGRAM_NV
- };
-
if (i == MESA_SHADER_VERTEX) {
((struct gl_vertex_program *)linked_prog)->UsesClipDistance
= prog->Vert.UsesClipDistance;
@@ -3086,7 +3080,9 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
linked_prog);
- if (!ctx->Driver.ProgramStringNotify(ctx, targets[i], linked_prog)) {
+ if (!ctx->Driver.ProgramStringNotify(ctx,
+ _mesa_program_index_to_target(i),
+ linked_prog)) {
return GL_FALSE;
}
}
diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h
index ecda59b58..f28983894 100644
--- a/mesalib/src/mesa/program/program.h
+++ b/mesalib/src/mesa/program/program.h
@@ -205,8 +205,8 @@ _mesa_program_index_to_target(GLuint i)
{
static const GLenum enums[MESA_SHADER_TYPES] = {
GL_VERTEX_PROGRAM_ARB,
- GL_FRAGMENT_PROGRAM_ARB,
GL_GEOMETRY_PROGRAM_NV,
+ GL_FRAGMENT_PROGRAM_ARB
};
if(i >= MESA_SHADER_TYPES)
return 0;
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 7d18c2521..80393cff7 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -221,11 +221,6 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
struct gl_context *shareCtx = share ? share->ctx : NULL;
struct dd_function_table funcs;
- /* Sanity checks */
- STATIC_ASSERT(MESA_SHADER_VERTEX == PIPE_SHADER_VERTEX);
- STATIC_ASSERT(MESA_SHADER_FRAGMENT == PIPE_SHADER_FRAGMENT);
- STATIC_ASSERT(MESA_SHADER_GEOMETRY == PIPE_SHADER_GEOMETRY);
-
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(&funcs);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 83e8e2e96..32348ef73 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -68,7 +68,7 @@ void st_init_limits(struct st_context *st)
{
struct pipe_screen *screen = st->pipe->screen;
struct gl_constants *c = &st->ctx->Const;
- gl_shader_type sh;
+ unsigned sh;
boolean can_ubo = TRUE;
c->MaxTextureLevels
@@ -149,23 +149,25 @@ void st_init_limits(struct st_context *st)
can_ubo = FALSE;
}
- for (sh = 0; sh < MESA_SHADER_TYPES; ++sh) {
- struct gl_shader_compiler_options *options =
- &st->ctx->ShaderCompilerOptions[sh];
+ for (sh = 0; sh < PIPE_SHADER_TYPES; ++sh) {
+ struct gl_shader_compiler_options *options;
struct gl_program_constants *pc;
switch (sh) {
case PIPE_SHADER_FRAGMENT:
pc = &c->FragmentProgram;
+ options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
break;
case PIPE_SHADER_VERTEX:
pc = &c->VertexProgram;
+ options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX];
break;
case PIPE_SHADER_GEOMETRY:
pc = &c->GeometryProgram;
+ options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_GEOMETRY];
break;
default:
- assert(0);
+ /* compute shader, etc. */
continue;
}
@@ -274,9 +276,6 @@ void st_init_limits(struct st_context *st)
c->GLSLSkipStrictMaxUniformLimitCheck =
screen->get_param(screen, PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS);
- c->GLSLSkipStrictMaxVaryingLimitCheck =
- screen->get_param(screen, PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS);
-
if (can_ubo) {
st->ctx->Extensions.ARB_uniform_buffer_object = GL_TRUE;
c->UniformBufferOffsetAlignment =
@@ -552,7 +551,14 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
ctx->Extensions.EXT_point_parameters = GL_TRUE;
ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
- ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
+
+ /* IMPORTANT:
+ * Don't enable EXT_separate_shader_objects. It disallows a certain
+ * optimization in the GLSL compiler and therefore is considered
+ * harmful.
+ */
+ ctx->Extensions.EXT_separate_shader_objects = GL_FALSE;
+
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
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 32bc2b37b..64e0a8a46 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5271,15 +5271,11 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
- static const GLenum targets[] = {
- GL_VERTEX_PROGRAM_ARB,
- GL_FRAGMENT_PROGRAM_ARB,
- GL_GEOMETRY_PROGRAM_NV
- };
-
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
linked_prog);
- if (!ctx->Driver.ProgramStringNotify(ctx, targets[i], linked_prog)) {
+ if (!ctx->Driver.ProgramStringNotify(ctx,
+ _mesa_program_index_to_target(i),
+ linked_prog)) {
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
NULL);
_mesa_reference_program(ctx, &linked_prog, NULL);