aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-08-01 13:22:08 +0200
committermarha <marha@users.sourceforge.net>2013-08-01 13:22:08 +0200
commit0659c77949b38440a2a9ba67e1ee9cacef1f3a7f (patch)
tree891077ab7001a45e0e37ff2e554db0c56671acdc /mesalib/src
parent4c8cee9b5a37db30af50aafcbf54b36b9fd9e03a (diff)
downloadvcxsrv-0659c77949b38440a2a9ba67e1ee9cacef1f3a7f.tar.gz
vcxsrv-0659c77949b38440a2a9ba67e1ee9cacef1f3a7f.tar.bz2
vcxsrv-0659c77949b38440a2a9ba67e1ee9cacef1f3a7f.zip
libX11 mesa xserver xkeyboard-config git update 1 aug 2013
xserver commit b6e5c4669e0db391966deb397e8c975ec7f0124d xkeyboard-config commit abaf14335dc6504e59d91e77babc8e034df5beb7 libX11 commit 44f84223f5e2dd46883fcbd352af2798bfa9aeb6 mesa commit 3eef7fec677f40eef1674e44e7ebd836bc7f8612
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_s3tc.c12
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h71
-rw-r--r--mesalib/src/glsl/glsl_lexer.ll2
-rw-r--r--mesalib/src/glsl/glsl_parser.yy10
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp92
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h4
-rw-r--r--mesalib/src/glsl/ir_function_detect_recursion.cpp1
-rw-r--r--mesalib/src/glsl/link_interface_blocks.cpp25
-rw-r--r--mesalib/src/glsl/link_uniform_blocks.cpp2
-rw-r--r--mesalib/src/glsl/link_varyings.cpp12
-rw-r--r--mesalib/src/glsl/link_varyings.h2
-rw-r--r--mesalib/src/glsl/linker.cpp122
-rw-r--r--mesalib/src/glsl/linker.h12
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirc44
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c4
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h19
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/fbobject.c8
-rw-r--r--mesalib/src/mesa/main/mipmap.c17
-rw-r--r--mesalib/src/mesa/main/mtypes.h7
-rw-r--r--mesalib/src/mesa/main/shaderapi.c19
-rw-r--r--mesalib/src/mesa/main/teximage.c10
-rw-r--r--mesalib/src/mesa/main/texobj.c11
-rw-r--r--mesalib/src/mesa/main/texobj.h3
-rw-r--r--mesalib/src/mesa/main/texparam.c2
-rw-r--r--mesalib/src/mesa/main/texstate.c6
-rw-r--r--mesalib/src/mesa/main/texstorage.c4
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp1
-rw-r--r--mesalib/src/mesa/program/program_lexer.l2
-rw-r--r--mesalib/src/mesa/program/program_parse.y20
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c24
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
35 files changed, 348 insertions, 245 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c
index fd628157b..11b46020b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -111,7 +111,6 @@ util_format_s3tc_init(void)
util_dl_proc fetch_2d_texel_rgba_dxt3;
util_dl_proc fetch_2d_texel_rgba_dxt5;
util_dl_proc tx_compress_dxtn;
- char *force_s3tc_enable;
if (!first_time)
return;
@@ -122,15 +121,8 @@ util_format_s3tc_init(void)
library = util_dl_open(DXTN_LIBNAME);
if (!library) {
- if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
- !strcmp(force_s3tc_enable, "true")) {
- debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
- "force_s3tc_enable=true environment variable\n");
- util_format_s3tc_enabled = TRUE;
- } else {
- debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
- "compression/decompression unavailable\n");
- }
+ debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
+ "compression/decompression unavailable\n");
return;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index 6e65ee6c9..7a82f05c3 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -227,6 +227,12 @@ pipe_surface_equal(struct pipe_surface *s1, struct pipe_surface *s2)
* Convenience wrappers for screen buffer functions.
*/
+
+/**
+ * Create a new resource.
+ * \param bind bitmask of PIPE_BIND_x flags
+ * \param usage bitmask of PIPE_USAGE_x flags
+ */
static INLINE struct pipe_resource *
pipe_buffer_create( struct pipe_screen *screen,
unsigned bind,
@@ -247,12 +253,20 @@ pipe_buffer_create( struct pipe_screen *screen,
return screen->resource_create(screen, &buffer);
}
+
+/**
+ * Map a range of a resource.
+ * \param offset start of region, in bytes
+ * \param length size of region, in bytes
+ * \param access bitmask of PIPE_TRANSFER_x flags
+ * \param transfer returns a transfer object
+ */
static INLINE void *
pipe_buffer_map_range(struct pipe_context *pipe,
struct pipe_resource *buffer,
unsigned offset,
unsigned length,
- unsigned usage,
+ unsigned access,
struct pipe_transfer **transfer)
{
struct pipe_box box;
@@ -264,7 +278,7 @@ pipe_buffer_map_range(struct pipe_context *pipe,
u_box_1d(offset, length, &box);
- map = pipe->transfer_map(pipe, buffer, 0, usage, &box, transfer);
+ map = pipe->transfer_map(pipe, buffer, 0, access, &box, transfer);
if (map == NULL) {
return NULL;
}
@@ -273,13 +287,18 @@ pipe_buffer_map_range(struct pipe_context *pipe,
}
+/**
+ * Map whole resource.
+ * \param access bitmask of PIPE_TRANSFER_x flags
+ * \param transfer returns a transfer object
+ */
static INLINE void *
pipe_buffer_map(struct pipe_context *pipe,
struct pipe_resource *buffer,
- unsigned usage,
+ unsigned access,
struct pipe_transfer **transfer)
{
- return pipe_buffer_map_range(pipe, buffer, 0, buffer->width0, usage, transfer);
+ return pipe_buffer_map_range(pipe, buffer, 0, buffer->width0, access, transfer);
}
@@ -322,12 +341,12 @@ pipe_buffer_write(struct pipe_context *pipe,
const void *data)
{
struct pipe_box box;
- unsigned usage = PIPE_TRANSFER_WRITE;
+ unsigned access = PIPE_TRANSFER_WRITE;
if (offset == 0 && size == buf->width0) {
- usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ access |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
} else {
- usage |= PIPE_TRANSFER_DISCARD_RANGE;
+ access |= PIPE_TRANSFER_DISCARD_RANGE;
}
u_box_1d(offset, size, &box);
@@ -335,7 +354,7 @@ pipe_buffer_write(struct pipe_context *pipe,
pipe->transfer_inline_write( pipe,
buf,
0,
- usage,
+ access,
&box,
data,
size,
@@ -368,12 +387,18 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
0, 0);
}
+
+/**
+ * Create a new resource and immediately put data into it
+ * \param bind bitmask of PIPE_BIND_x flags
+ * \param usage bitmask of PIPE_USAGE_x flags
+ */
static INLINE struct pipe_resource *
pipe_buffer_create_with_data(struct pipe_context *pipe,
unsigned bind,
unsigned usage,
unsigned size,
- void *ptr)
+ const void *ptr)
{
struct pipe_resource *res = pipe_buffer_create(pipe->screen,
bind, usage, size);
@@ -403,11 +428,16 @@ pipe_buffer_read(struct pipe_context *pipe,
pipe_buffer_unmap(pipe, src_transfer);
}
+
+/**
+ * Map a resource for reading/writing.
+ * \param access bitmask of PIPE_TRANSFER_x flags
+ */
static INLINE void *
pipe_transfer_map(struct pipe_context *context,
struct pipe_resource *resource,
unsigned level, unsigned layer,
- enum pipe_transfer_usage usage,
+ unsigned access,
unsigned x, unsigned y,
unsigned w, unsigned h,
struct pipe_transfer **transfer)
@@ -417,15 +447,20 @@ pipe_transfer_map(struct pipe_context *context,
return context->transfer_map(context,
resource,
level,
- usage,
+ access,
&box, transfer);
}
+
+/**
+ * Map a 3D (texture) resource for reading/writing.
+ * \param access bitmask of PIPE_TRANSFER_x flags
+ */
static INLINE void *
pipe_transfer_map_3d(struct pipe_context *context,
struct pipe_resource *resource,
unsigned level,
- enum pipe_transfer_usage usage,
+ unsigned access,
unsigned x, unsigned y, unsigned z,
unsigned w, unsigned h, unsigned d,
struct pipe_transfer **transfer)
@@ -435,7 +470,7 @@ pipe_transfer_map_3d(struct pipe_context *context,
return context->transfer_map(context,
resource,
level,
- usage,
+ access,
&box, transfer);
}
@@ -463,9 +498,13 @@ pipe_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
}
-static INLINE boolean util_get_offset(
- const struct pipe_rasterizer_state *templ,
- unsigned fill_mode)
+/**
+ * Get the polygon offset enable/disable flag for the given polygon fill mode.
+ * \param fill_mode one of PIPE_POLYGON_MODE_POINT/LINE/FILL
+ */
+static INLINE boolean
+util_get_offset(const struct pipe_rasterizer_state *templ,
+ unsigned fill_mode)
{
switch(fill_mode) {
case PIPE_POLYGON_MODE_POINT:
diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll
index 93752307d..e24df8096 100644
--- a/mesalib/src/glsl/glsl_lexer.ll
+++ b/mesalib/src/glsl/glsl_lexer.ll
@@ -149,7 +149,7 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
%option bison-bridge bison-locations reentrant noyywrap
%option nounput noyy_top_state
%option never-interactive
-%option prefix="_mesa_glsl_"
+%option prefix="_mesa_glsl_lexer_"
%option extra-type="struct _mesa_glsl_parse_state *"
%x PP PRAGMA
diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy
index bf312366b..fcc5620cd 100644
--- a/mesalib/src/glsl/glsl_parser.yy
+++ b/mesalib/src/glsl/glsl_parser.yy
@@ -31,14 +31,18 @@
#include "glsl_types.h"
#include "main/context.h"
-#define YYLEX_PARAM state->scanner
-
#undef yyerror
static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
{
_mesa_glsl_error(loc, st, "%s", msg);
}
+
+static int
+_mesa_glsl_lex(YYSTYPE *val, YYLTYPE *loc, _mesa_glsl_parse_state *state)
+{
+ return _mesa_glsl_lexer_lex(val, loc, state->scanner);
+}
%}
%expect 0
@@ -55,7 +59,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
@$.source = 0;
}
-%lex-param {void *scanner}
+%lex-param {struct _mesa_glsl_parse_state *state}
%parse-param {struct _mesa_glsl_parse_state *state}
%union {
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index e36ba584a..a5bc20c23 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -74,7 +74,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->num_builtins_to_link = 0;
/* Set default language version and extensions */
- this->language_version = 110;
+ this->language_version = ctx->Const.ForceGLSLVersion ?
+ ctx->Const.ForceGLSLVersion : 110;
this->es_shader = false;
this->ARB_texture_rectangle_enable = true;
@@ -430,15 +431,6 @@ struct _mesa_glsl_extension {
*/
const char *name;
- /** True if this extension is available to vertex shaders */
- bool avail_in_VS;
-
- /** True if this extension is available to geometry shaders */
- bool avail_in_GS;
-
- /** True if this extension is available to fragment shaders */
- bool avail_in_FS;
-
/** True if this extension is available to desktop GL shaders */
bool avail_in_GL;
@@ -485,9 +477,9 @@ struct _mesa_glsl_extension {
void set_flags(_mesa_glsl_parse_state *state, ext_behavior behavior) const;
};
-#define EXT(NAME, VS, GS, FS, GL, ES, SUPPORTED_FLAG) \
- { "GL_" #NAME, VS, GS, FS, GL, ES, &gl_extensions::SUPPORTED_FLAG, \
- &_mesa_glsl_parse_state::NAME##_enable, \
+#define EXT(NAME, GL, ES, SUPPORTED_FLAG) \
+ { "GL_" #NAME, GL, ES, &gl_extensions::SUPPORTED_FLAG, \
+ &_mesa_glsl_parse_state::NAME##_enable, \
&_mesa_glsl_parse_state::NAME##_warn }
/**
@@ -495,31 +487,31 @@ struct _mesa_glsl_extension {
* and the conditions under which they are supported.
*/
static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
- /* target availability API availability */
- /* name VS GS FS GL ES supported flag */
- EXT(ARB_conservative_depth, false, false, true, true, false, ARB_conservative_depth),
- EXT(ARB_draw_buffers, false, false, true, true, false, dummy_true),
- EXT(ARB_draw_instanced, true, false, false, true, false, ARB_draw_instanced),
- EXT(ARB_explicit_attrib_location, true, false, true, true, false, ARB_explicit_attrib_location),
- EXT(ARB_fragment_coord_conventions, true, false, true, true, false, ARB_fragment_coord_conventions),
- EXT(ARB_texture_rectangle, true, false, true, true, false, dummy_true),
- EXT(EXT_texture_array, true, false, true, true, false, EXT_texture_array),
- EXT(ARB_shader_texture_lod, true, false, true, true, false, ARB_shader_texture_lod),
- EXT(ARB_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export),
- EXT(AMD_conservative_depth, false, false, true, true, false, ARB_conservative_depth),
- EXT(AMD_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export),
- EXT(OES_texture_3D, true, false, true, false, true, EXT_texture3D),
- EXT(OES_EGL_image_external, true, false, true, false, true, OES_EGL_image_external),
- EXT(ARB_shader_bit_encoding, true, true, true, true, false, ARB_shader_bit_encoding),
- EXT(ARB_uniform_buffer_object, true, false, true, true, false, ARB_uniform_buffer_object),
- EXT(OES_standard_derivatives, false, false, true, false, true, OES_standard_derivatives),
- EXT(ARB_texture_cube_map_array, true, false, true, true, false, ARB_texture_cube_map_array),
- EXT(ARB_shading_language_packing, true, false, true, true, false, ARB_shading_language_packing),
- EXT(ARB_shading_language_420pack, true, true, true, true, false, ARB_shading_language_420pack),
- EXT(ARB_texture_multisample, true, false, true, true, false, ARB_texture_multisample),
- EXT(ARB_texture_query_lod, false, false, true, true, false, ARB_texture_query_lod),
- EXT(ARB_gpu_shader5, true, true, true, true, false, ARB_gpu_shader5),
- EXT(AMD_vertex_shader_layer, true, false, false, true, false, AMD_vertex_shader_layer),
+ /* API availability */
+ /* name GL ES supported flag */
+ EXT(ARB_conservative_depth, true, false, ARB_conservative_depth),
+ EXT(ARB_draw_buffers, true, false, dummy_true),
+ EXT(ARB_draw_instanced, true, false, ARB_draw_instanced),
+ EXT(ARB_explicit_attrib_location, true, false, ARB_explicit_attrib_location),
+ EXT(ARB_fragment_coord_conventions, true, false, ARB_fragment_coord_conventions),
+ EXT(ARB_texture_rectangle, true, false, dummy_true),
+ EXT(EXT_texture_array, true, false, EXT_texture_array),
+ EXT(ARB_shader_texture_lod, true, false, ARB_shader_texture_lod),
+ EXT(ARB_shader_stencil_export, true, false, ARB_shader_stencil_export),
+ EXT(AMD_conservative_depth, true, false, ARB_conservative_depth),
+ EXT(AMD_shader_stencil_export, true, false, ARB_shader_stencil_export),
+ EXT(OES_texture_3D, false, true, EXT_texture3D),
+ EXT(OES_EGL_image_external, false, true, OES_EGL_image_external),
+ EXT(ARB_shader_bit_encoding, true, false, ARB_shader_bit_encoding),
+ EXT(ARB_uniform_buffer_object, true, false, ARB_uniform_buffer_object),
+ EXT(OES_standard_derivatives, false, true, OES_standard_derivatives),
+ EXT(ARB_texture_cube_map_array, true, false, ARB_texture_cube_map_array),
+ EXT(ARB_shading_language_packing, true, false, ARB_shading_language_packing),
+ EXT(ARB_shading_language_420pack, true, false, ARB_shading_language_420pack),
+ EXT(ARB_texture_multisample, true, false, ARB_texture_multisample),
+ EXT(ARB_texture_query_lod, true, false, ARB_texture_query_lod),
+ EXT(ARB_gpu_shader5, true, false, ARB_gpu_shader5),
+ EXT(AMD_vertex_shader_layer, true, false, AMD_vertex_shader_layer),
};
#undef EXT
@@ -532,30 +524,6 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
bool _mesa_glsl_extension::compatible_with_state(const _mesa_glsl_parse_state *
state) const
{
- /* Check that this extension matches the type of shader we are
- * compiling to.
- */
- switch (state->target) {
- case vertex_shader:
- if (!this->avail_in_VS) {
- return false;
- }
- break;
- case geometry_shader:
- if (!this->avail_in_GS) {
- return false;
- }
- break;
- case fragment_shader:
- if (!this->avail_in_FS) {
- return false;
- }
- break;
- default:
- assert (!"Unrecognized shader target");
- return false;
- }
-
/* Check that this extension matches whether we are compiling
* for desktop GL or GLES.
*/
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 7f478df80..1e386dd31 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -337,8 +337,8 @@ extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,
extern void _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state);
union YYSTYPE;
-extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
- void *scanner);
+extern int _mesa_glsl_lexer_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
+ void *scanner);
extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *);
diff --git a/mesalib/src/glsl/ir_function_detect_recursion.cpp b/mesalib/src/glsl/ir_function_detect_recursion.cpp
index 5df3ac518..280c4734a 100644
--- a/mesalib/src/glsl/ir_function_detect_recursion.cpp
+++ b/mesalib/src/glsl/ir_function_detect_recursion.cpp
@@ -319,7 +319,6 @@ emit_errors_linked(const void *key, void *data, void *closure)
linker_error(prog, "function `%s' has static recursion.\n", proto);
ralloc_free(proto);
- prog->LinkStatus = false;
}
diff --git a/mesalib/src/glsl/link_interface_blocks.cpp b/mesalib/src/glsl/link_interface_blocks.cpp
index b91860d03..928a88ee2 100644
--- a/mesalib/src/glsl/link_interface_blocks.cpp
+++ b/mesalib/src/glsl/link_interface_blocks.cpp
@@ -31,8 +31,9 @@
#include "linker.h"
#include "main/macros.h"
-bool
-validate_intrastage_interface_blocks(const gl_shader **shader_list,
+void
+validate_intrastage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader **shader_list,
unsigned num_shaders)
{
glsl_symbol_table interfaces;
@@ -62,16 +63,17 @@ validate_intrastage_interface_blocks(const gl_shader **shader_list,
interfaces.add_interface(iface_type->name, iface_type,
(enum ir_variable_mode) var->mode);
} else if (old_iface_type != iface_type) {
- return false;
+ linker_error(prog, "definitions of interface block `%s' do not"
+ " match\n", iface_type->name);
+ return;
}
}
}
-
- return true;
}
-bool
-validate_interstage_interface_blocks(const gl_shader *producer,
+void
+validate_interstage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader *producer,
const gl_shader *consumer)
{
glsl_symbol_table interfaces;
@@ -102,9 +104,10 @@ validate_interstage_interface_blocks(const gl_shader *producer,
if (expected_type == NULL)
continue;
- if (var->interface_type != expected_type)
- return false;
+ if (var->interface_type != expected_type) {
+ linker_error(prog, "definitions of interface block `%s' do not "
+ "match\n", var->interface_type->name);
+ return;
+ }
}
-
- return true;
}
diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp
index c72d1d8f1..1083653c7 100644
--- a/mesalib/src/glsl/link_uniform_blocks.cpp
+++ b/mesalib/src/glsl/link_uniform_blocks.cpp
@@ -137,7 +137,7 @@ struct block {
bool has_instance_name;
};
-int
+unsigned
link_uniform_blocks(void *mem_ctx,
struct gl_shader_program *prog,
struct gl_shader **shader_list,
diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp
index 51cbdaa0e..2c7e4514e 100644
--- a/mesalib/src/glsl/link_varyings.cpp
+++ b/mesalib/src/glsl/link_varyings.cpp
@@ -43,7 +43,7 @@
/**
* Validate that outputs from one stage match inputs of another
*/
-bool
+void
cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
gl_shader *producer, gl_shader *consumer)
{
@@ -106,7 +106,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
producer_stage, output->name,
output->type->name,
consumer_stage, input->type->name);
- return false;
+ return;
}
}
@@ -121,7 +121,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
(output->centroid) ? "has" : "lacks",
consumer_stage,
(input->centroid) ? "has" : "lacks");
- return false;
+ return;
}
if (input->invariant != output->invariant) {
@@ -133,7 +133,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
(output->invariant) ? "has" : "lacks",
consumer_stage,
(input->invariant) ? "has" : "lacks");
- return false;
+ return;
}
if (input->interpolation != output->interpolation) {
@@ -147,12 +147,10 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
output->interpolation_string(),
consumer_stage,
input->interpolation_string());
- return false;
+ return;
}
}
}
-
- return true;
}
diff --git a/mesalib/src/glsl/link_varyings.h b/mesalib/src/glsl/link_varyings.h
index 7f7be353b..cfc6e474f 100644
--- a/mesalib/src/glsl/link_varyings.h
+++ b/mesalib/src/glsl/link_varyings.h
@@ -214,7 +214,7 @@ private:
};
-bool
+void
cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
gl_shader *producer, gl_shader *consumer);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index ac010cfbb..942f90615 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -340,12 +340,12 @@ count_attribute_slots(const glsl_type *t)
*
* \param shader Vertex shader executable to be verified
*/
-bool
+void
validate_vertex_shader_executable(struct gl_shader_program *prog,
struct gl_shader *shader)
{
if (shader == NULL)
- return true;
+ return;
/* From the GLSL 1.10 spec, page 48:
*
@@ -378,7 +378,7 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
find.run(shader->ir);
if (!find.variable_found()) {
linker_error(prog, "vertex shader does not write to `gl_Position'\n");
- return false;
+ return;
}
}
@@ -402,7 +402,7 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
if (clip_vertex.variable_found() && clip_distance.variable_found()) {
linker_error(prog, "vertex shader writes to both `gl_ClipVertex' "
"and `gl_ClipDistance'\n");
- return false;
+ return;
}
prog->Vert.UsesClipDistance = clip_distance.variable_found();
ir_variable *clip_distance_var =
@@ -410,8 +410,6 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
if (clip_distance_var)
prog->Vert.ClipDistanceArraySize = clip_distance_var->type->length;
}
-
- return true;
}
@@ -420,12 +418,12 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
*
* \param shader Fragment shader executable to be verified
*/
-bool
+void
validate_fragment_shader_executable(struct gl_shader_program *prog,
struct gl_shader *shader)
{
if (shader == NULL)
- return true;
+ return;
find_assignment_visitor frag_color("gl_FragColor");
find_assignment_visitor frag_data("gl_FragData");
@@ -436,10 +434,7 @@ validate_fragment_shader_executable(struct gl_shader_program *prog,
if (frag_color.variable_found() && frag_data.variable_found()) {
linker_error(prog, "fragment shader writes to both "
"`gl_FragColor' and `gl_FragData'\n");
- return false;
}
-
- return true;
}
@@ -469,7 +464,7 @@ mode_string(const ir_variable *var)
/**
* Perform validation of global variables used across multiple shaders
*/
-bool
+void
cross_validate_globals(struct gl_shader_program *prog,
struct gl_shader **shader_list,
unsigned num_shaders,
@@ -524,7 +519,7 @@ cross_validate_globals(struct gl_shader_program *prog,
mode_string(var),
var->name, var->type->name,
existing->type->name);
- return false;
+ return;
}
}
@@ -534,7 +529,7 @@ cross_validate_globals(struct gl_shader_program *prog,
linker_error(prog, "explicit locations for %s "
"`%s' have differing values\n",
mode_string(var), var->name);
- return false;
+ return;
}
existing->location = var->location;
@@ -553,7 +548,7 @@ cross_validate_globals(struct gl_shader_program *prog,
linker_error(prog, "explicit bindings for %s "
"`%s' have differing values\n",
mode_string(var), var->name);
- return false;
+ return;
}
existing->binding = var->binding;
@@ -614,7 +609,7 @@ cross_validate_globals(struct gl_shader_program *prog,
linker_error(prog, "initializers for %s "
"`%s' have differing values\n",
mode_string(var), var->name);
- return false;
+ return;
}
} else {
/* If the first-seen instance of a particular uniform did not
@@ -643,7 +638,7 @@ cross_validate_globals(struct gl_shader_program *prog,
"shared global variable `%s' has multiple "
"non-constant initializers.\n",
var->name);
- return false;
+ return;
}
/* Some instance had an initializer, so keep track of that. In
@@ -658,31 +653,29 @@ cross_validate_globals(struct gl_shader_program *prog,
linker_error(prog, "declarations for %s `%s' have "
"mismatching invariant qualifiers\n",
mode_string(var), var->name);
- return false;
+ return;
}
if (existing->centroid != var->centroid) {
linker_error(prog, "declarations for %s `%s' have "
"mismatching centroid qualifiers\n",
mode_string(var), var->name);
- return false;
+ return;
}
} else
variables.add_variable(var);
}
}
-
- return true;
}
/**
* Perform validation of uniforms used across multiple shader stages
*/
-bool
+void
cross_validate_uniforms(struct gl_shader_program *prog)
{
- return cross_validate_globals(prog, prog->_LinkedShaders,
- MESA_SHADER_TYPES, true);
+ cross_validate_globals(prog, prog->_LinkedShaders,
+ MESA_SHADER_TYPES, true);
}
/**
@@ -955,21 +948,21 @@ link_intrastage_shaders(void *mem_ctx,
/* Check that global variables defined in multiple shaders are consistent.
*/
- if (!cross_validate_globals(prog, shader_list, num_shaders, false))
+ cross_validate_globals(prog, shader_list, num_shaders, false);
+ if (!prog->LinkStatus)
return NULL;
/* Check that interface blocks defined in multiple shaders are consistent.
*/
- if (!validate_intrastage_interface_blocks((const gl_shader **)shader_list,
- num_shaders))
+ validate_intrastage_interface_blocks(prog, (const gl_shader **)shader_list,
+ num_shaders);
+ if (!prog->LinkStatus)
return NULL;
- /* Check that uniform blocks between shaders for a stage agree. */
- const int num_uniform_blocks =
+ /* Link up uniform blocks defined within this stage. */
+ const unsigned num_uniform_blocks =
link_uniform_blocks(mem_ctx, prog, shader_list, num_shaders,
&uniform_blocks);
- if (num_uniform_blocks < 0)
- return NULL;
/* Check that there is only a single definition of each function signature
* across all shaders.
@@ -1529,7 +1522,7 @@ store_fragdepth_layout(struct gl_shader_program *prog)
/**
* Validate the resources used by a program versus the implementation limits
*/
-static bool
+static void
check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
{
static const char *const shader_names[MESA_SHADER_TYPES] = {
@@ -1626,8 +1619,6 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
}
}
}
-
- return prog->LinkStatus;
}
void
@@ -1638,7 +1629,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
void *mem_ctx = ralloc_context(NULL); // temporary linker context
- prog->LinkStatus = false;
+ prog->LinkStatus = true; /* All error paths will set this to false */
prog->Validated = false;
prog->_Used = false;
@@ -1724,10 +1715,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
link_intrastage_shaders(mem_ctx, ctx, prog, vert_shader_list,
num_vert_shaders);
- if (sh == NULL)
+ if (!prog->LinkStatus)
goto done;
- if (!validate_vertex_shader_executable(prog, sh))
+ validate_vertex_shader_executable(prog, sh);
+ if (!prog->LinkStatus)
goto done;
_mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_VERTEX],
@@ -1739,10 +1731,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
link_intrastage_shaders(mem_ctx, ctx, prog, frag_shader_list,
num_frag_shaders);
- if (sh == NULL)
+ if (!prog->LinkStatus)
goto done;
- if (!validate_fragment_shader_executable(prog, sh))
+ validate_fragment_shader_executable(prog, sh);
+ if (!prog->LinkStatus)
goto done;
_mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
@@ -1753,36 +1746,36 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
* performed, then locations are assigned for uniforms, attributes, and
* varyings.
*/
- if (cross_validate_uniforms(prog)) {
- unsigned prev;
+ cross_validate_uniforms(prog);
+ if (!prog->LinkStatus)
+ goto done;
- for (prev = 0; prev < MESA_SHADER_TYPES; prev++) {
- if (prog->_LinkedShaders[prev] != NULL)
- break;
- }
+ unsigned prev;
- /* Validate the inputs of each stage with the output of the preceding
- * stage.
- */
- for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) {
- if (prog->_LinkedShaders[i] == NULL)
- continue;
+ for (prev = 0; prev < MESA_SHADER_TYPES; prev++) {
+ if (prog->_LinkedShaders[prev] != NULL)
+ break;
+ }
- if (!validate_interstage_interface_blocks(prog->_LinkedShaders[prev],
- prog->_LinkedShaders[i])) {
- linker_error(prog, "interface block mismatch between shader stages\n");
- goto done;
- }
+ /* Validate the inputs of each stage with the output of the preceding
+ * stage.
+ */
+ for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
- if (!cross_validate_outputs_to_inputs(prog,
- prog->_LinkedShaders[prev],
- prog->_LinkedShaders[i]))
- goto done;
+ validate_interstage_interface_blocks(prog, prog->_LinkedShaders[prev],
+ prog->_LinkedShaders[i]);
+ if (!prog->LinkStatus)
+ goto done;
- prev = i;
- }
+ cross_validate_outputs_to_inputs(prog,
+ prog->_LinkedShaders[prev],
+ prog->_LinkedShaders[i]);
+ if (!prog->LinkStatus)
+ goto done;
- prog->LinkStatus = true;
+ prev = i;
}
@@ -1971,7 +1964,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
link_assign_uniform_locations(prog);
store_fragdepth_layout(prog);
- if (!check_resources(ctx, prog))
+ check_resources(ctx, prog);
+ if (!prog->LinkStatus)
goto done;
/* OpenGL ES requires that a vertex shader and a fragment shader both be
diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h
index 2fe2410c2..0ce747d6c 100644
--- a/mesalib/src/glsl/linker.h
+++ b/mesalib/src/glsl/linker.h
@@ -53,19 +53,21 @@ extern bool
link_uniform_blocks_are_compatible(const gl_uniform_block *a,
const gl_uniform_block *b);
-extern int
+extern unsigned
link_uniform_blocks(void *mem_ctx,
struct gl_shader_program *prog,
struct gl_shader **shader_list,
unsigned num_shaders,
struct gl_uniform_block **blocks_ret);
-bool
-validate_intrastage_interface_blocks(const gl_shader **shader_list,
+void
+validate_intrastage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader **shader_list,
unsigned num_shaders);
-bool
-validate_interstage_interface_blocks(const gl_shader *producer,
+void
+validate_interstage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader *producer,
const gl_shader *consumer);
/**
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc
index 556d1b599..ebc04cd9b 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirc
+++ b/mesalib/src/mesa/drivers/dri/common/drirc
@@ -1,33 +1,75 @@
+<!--
+
+============================================
+Application bugs worked around in this file:
+============================================
+
+* Various Unigine products don't use the #version and #extension GLSL
+ directives, meaning they only get GLSL 1.10 and no extensions for their
+ shaders.
+ Enabling all extensions for Unigine fixes most issues, but the GLSL version
+ is still 1.10.
+
+* Unigine Heaven 3.0 with ARB_texture_multisample uses a "ivec4 * vec4"
+ expression, which fails to compile with GLSL 1.10.
+ Adding "#version 130" fixes this.
+
+* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses the uint keyword, which
+ fails to compile with GLSL 1.10.
+ Adding "#version 130" fixes this.
+
+* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses a "uint & int"
+ expression, which fails (and should fail) to compile with any GLSL version.
+ Disabling ARB_shader_bit_encoding fixes this.
+
+TODO: document the other workarounds.
+
+-->
+
<driconf>
- <device screen="0" driver="i965">
+ <!-- Please always enable app-specific workarounds for all drivers and
+ screens. -->
+ <device>
<application name="Unigine Sanctuary" executable="Sanctuary">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Unigine Tropics" executable="Tropics">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Unigine Heaven (32-bit)" executable="heaven_x86">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
+ <option name="force_glsl_version" value="130" />
+ <option name="disable_shader_bit_encoding" value="true" />
</application>
+
<application name="Unigine Heaven (64-bit)" executable="heaven_x64">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
+ <option name="force_glsl_version" value="130" />
+ <option name="disable_shader_bit_encoding" value="true" />
</application>
+
<application name="Unigine OilRush (32-bit)" executable="OilRush_x86">
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Unigine OilRush (64-bit)" executable="OilRush_x64">
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Savage 2" executable="savage2.bin">
<option name="disable_glsl_line_continuations" value="true" />
</application>
+
<application name="Topogun (32-bit)" executable="topogun32">
<option name="always_have_depth_buffer" value="true" />
</application>
+
<application name="Topogun (64-bit)" executable="topogun64">
<option name="always_have_depth_buffer" value="true" />
</application>
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index 72483a42a..5c97c20fc 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -812,7 +812,9 @@ static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
driOptionCache *cache = data->cache;
GLuint opt = findOption (cache, name);
if (cache->info[opt].name == NULL)
- XML_WARNING ("undefined option: %s.", name);
+ /* don't use XML_WARNING, drirc defines options for all drivers,
+ * but not all drivers support them */
+ return;
else if (getenv (cache->info[opt].name))
/* don't use XML_WARNING, we want the user to see this! */
fprintf (stderr, "ATTENTION: option value of option %s ignored.\n",
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 ca4772003..3bf804a17 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -95,6 +95,16 @@ DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \
DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \
DRI_CONF_OPT_END
+#define DRI_CONF_DISABLE_SHADER_BIT_ENCODING(def) \
+DRI_CONF_OPT_BEGIN_B(disable_shader_bit_encoding, def) \
+ DRI_CONF_DESC(en,gettext("Disable GL_ARB_shader_bit_encoding")) \
+DRI_CONF_OPT_END
+
+#define DRI_CONF_FORCE_GLSL_VERSION(def) \
+DRI_CONF_OPT_BEGIN_V(force_glsl_version, int, def, "0:999") \
+ DRI_CONF_DESC(en,gettext("Force a default GLSL version for shaders that lack an explicit #version line")) \
+DRI_CONF_OPT_END
+
/**
@@ -266,15 +276,6 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(en,gettext("Number of texture units used")) \
DRI_CONF_OPT_END
-#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \
-DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,gettext("Support larger textures not guaranteed to fit into graphics memory")) \
- DRI_CONF_ENUM(0,gettext("No")) \
- DRI_CONF_ENUM(1,gettext("At least 1 texture must fit under worst-case assumptions")) \
- DRI_CONF_ENUM(2,gettext("Announce hardware limits")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
DRI_CONF_DESC(en,gettext("Texture filtering quality vs. speed, AKA “brilinear” texture filtering")) \
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 4e46cf095..1a040ee3b 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -275,6 +275,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_stencil4", o(dummy_false), DISABLE, 2005 },
{ "GL_OES_stencil8", o(dummy_true), ES1 | ES2, 2005 },
{ "GL_OES_stencil_wrap", o(dummy_true), ES1, 2002 },
+ { "GL_OES_surfaceless_context", o(dummy_true), ES1 | ES2, 2012 },
{ "GL_OES_texture_3D", o(EXT_texture3D), ES2, 2005 },
{ "GL_OES_texture_cube_map", o(ARB_texture_cube_map), ES1, 2007 },
{ "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1, 2005 },
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index a29f1ab13..bf7e85c88 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -2141,8 +2141,12 @@ _mesa_CheckFramebufferStatus(GLenum target)
}
if (_mesa_is_winsys_fbo(buffer)) {
- /* The window system / default framebuffer is always complete */
- return GL_FRAMEBUFFER_COMPLETE_EXT;
+ /* EGL_KHR_surfaceless_context allows the winsys FBO to be incomplete. */
+ if (buffer != &IncompleteFramebuffer) {
+ return GL_FRAMEBUFFER_COMPLETE_EXT;
+ } else {
+ return GL_FRAMEBUFFER_UNDEFINED;
+ }
}
/* No need to flush here */
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 583963232..180f89116 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -2024,7 +2024,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
GLubyte *temp_src = NULL, *temp_dst = NULL;
GLenum temp_datatype;
GLenum temp_base_format;
- GLubyte **temp_src_slices, **temp_dst_slices;
+ GLubyte **temp_src_slices = NULL, **temp_dst_slices = NULL;
/* only two types of compressed textures at this time */
assert(texObj->Target == GL_TEXTURE_2D ||
@@ -2063,11 +2063,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
temp_dst_slices = malloc(srcImage->Depth * sizeof(GLubyte *));
if (!temp_src || !temp_src_slices || !temp_dst_slices) {
- free(temp_src);
- free(temp_src_slices);
- free(temp_dst_slices);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- return;
+ goto end;
}
/* decompress base image to the temporary src buffer */
@@ -2119,7 +2116,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
temp_dst = malloc(temp_dst_img_stride * dstDepth);
if (!temp_dst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- break;
+ goto end;
}
}
@@ -2127,8 +2124,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
dstImage = _mesa_get_tex_image(ctx, texObj, target, level + 1);
if (!dstImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- free(temp_dst);
- return;
+ goto end;
}
/* for 2D arrays, setup array[depth] of slice pointers */
@@ -2153,8 +2149,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
dstWidth, dstHeight, dstDepth,
border, srcImage->InternalFormat,
srcImage->TexFormat)) {
- free(temp_dst);
- return;
+ /* all done */
+ goto end;
}
/* The image space was allocated above so use glTexSubImage now */
@@ -2173,6 +2169,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
}
} /* loop over mipmap levels */
+end:
free(temp_src);
free(temp_dst);
free(temp_src_slices);
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index aba7d845b..5bb680745 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2402,6 +2402,7 @@ struct gl_shader_program
#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */
#define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */
#define GLSL_REPORT_ERRORS 0x100 /**< Print compilation errors */
+#define GLSL_DUMP_ON_ERROR 0x200 /**< Dump shaders to stderr on compile error */
/**
@@ -2873,6 +2874,12 @@ struct gl_constants
GLboolean ForceGLSLExtensionsWarn;
/**
+ * If non-zero, forces GLSL shaders without the #version directive to behave
+ * as if they began with "#version ForceGLSLVersion".
+ */
+ GLuint ForceGLSLVersion;
+
+ /**
* Does the driver support real 32-bit integers? (Otherwise, integers are
* simulated via floats.)
*/
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 4cc0357b1..c349b0cb5 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -71,7 +71,9 @@ get_shader_flags(void)
const char *env = _mesa_getenv("MESA_GLSL");
if (env) {
- if (strstr(env, "dump"))
+ if (strstr(env, "dump_on_error"))
+ flags |= GLSL_DUMP_ON_ERROR;
+ else if (strstr(env, "dump"))
flags |= GLSL_DUMP;
if (strstr(env, "log"))
flags |= GLSL_LOG;
@@ -783,10 +785,17 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
}
- if (sh->CompileStatus == GL_FALSE &&
- (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) {
- _mesa_debug(ctx, "Error compiling shader %u:\n%s\n",
- sh->Name, sh->InfoLog);
+ if (!sh->CompileStatus) {
+ if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) {
+ fprintf(stderr, "GLSL source for %s shader %d:\n",
+ _mesa_glsl_shader_target_name(sh->Type), sh->Name);
+ fprintf(stderr, "%s\n", sh->Source);
+ }
+
+ if (ctx->Shader.Flags & GLSL_REPORT_ERRORS) {
+ _mesa_debug(ctx, "Error compiling shader %u:\n%s\n",
+ sh->Name, sh->InfoLog);
+ }
}
}
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 111849655..b719fc856 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1097,24 +1097,34 @@ _mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height,
switch (target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
+ case GL_PROXY_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_1D_ARRAY:
size = width;
break;
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
ASSERT(width == height);
size = width;
break;
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_ARRAY:
+ case GL_PROXY_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_2D_ARRAY:
size = MAX2(width, height);
break;
case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
size = MAX3(width, height, depth);
break;
case GL_TEXTURE_RECTANGLE:
case GL_TEXTURE_EXTERNAL_OES:
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ case GL_PROXY_TEXTURE_RECTANGLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return 1;
default:
assert(0);
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 2168bffb1..334dee77b 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -83,7 +83,7 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
struct gl_texture_object *obj;
(void) ctx;
obj = MALLOC_STRUCT(gl_texture_object);
- _mesa_initialize_texture_object(obj, name, target);
+ _mesa_initialize_texture_object(ctx, obj, name, target);
return obj;
}
@@ -95,7 +95,8 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
* \param target the texture target
*/
void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+ struct gl_texture_object *obj,
GLuint name, GLenum target )
{
ASSERT(target == 0 ||
@@ -146,7 +147,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Sampler.MaxAnisotropy = 1.0;
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
- obj->DepthMode = GL_LUMINANCE;
+ obj->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Swizzle[0] = GL_RED;
obj->Swizzle[1] = GL_GREEN;
@@ -154,8 +155,8 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Swizzle[3] = GL_ALPHA;
obj->_Swizzle = SWIZZLE_NOOP;
obj->Sampler.sRGBDecode = GL_DECODE_EXT;
- obj->BufferObjectFormat = GL_LUMINANCE8;
- obj->_BufferObjectFormat = MESA_FORMAT_L8;
+ obj->BufferObjectFormat = GL_R8;
+ obj->_BufferObjectFormat = MESA_FORMAT_R8;
}
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index a99f45bfa..0df088ce4 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -50,7 +50,8 @@ extern struct gl_texture_object *
_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
extern void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+ struct gl_texture_object *obj,
GLuint name, GLenum target );
extern void
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 141cbe3ab..32109951c 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -1048,6 +1048,8 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target)
return ctx->API == API_OPENGL_CORE && ctx->Version >= 31;
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return ctx->Extensions.ARB_texture_multisample;
default:
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 741985c46..afff01359 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -594,8 +594,8 @@ update_texture_state( struct gl_context *ctx )
/* Look for the highest priority texture target that's enabled (or used
* by the vert/frag shaders) and "complete". That's the one we'll use
- * for texturing. If we're using vert/frag program we're guaranteed
- * that bitcount(enabledBits) <= 1.
+ * for texturing.
+ *
* Note that the TEXTURE_x_INDEX values are in high to low priority.
*/
for (texIndex = 0; texIndex < NUM_TEXTURE_TARGETS; texIndex++) {
@@ -624,8 +624,6 @@ update_texture_state( struct gl_context *ctx )
struct gl_texture_object *texObj;
gl_texture_index texTarget;
- assert(_mesa_bitcount(enabledTargets) == 1);
-
texTarget = (gl_texture_index) (ffs(enabledTargets) - 1);
texObj = _mesa_get_fallback_texture(ctx, texTarget);
diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c
index 0a53726fe..7bd8652b5 100644
--- a/mesalib/src/mesa/main/texstorage.c
+++ b/mesalib/src/mesa/main/texstorage.c
@@ -335,14 +335,14 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
/* non-default texture object check */
texObj = _mesa_get_current_tex_object(ctx, target);
- if (!texObj || (texObj->Name == 0)) {
+ if (!_mesa_is_proxy_texture(target) && (!texObj || (texObj->Name == 0))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexStorage%uD(texture object 0)", dims);
return GL_TRUE;
}
/* Check if texObj->Immutable is set */
- if (texObj->Immutable) {
+ if (!_mesa_is_proxy_texture(target) && texObj->Immutable) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)",
dims);
return GL_TRUE;
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 4af1c8241..f0fc1b9b1 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3108,7 +3108,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
for (i = 0; i < prog->NumShaders; i++) {
if (!prog->Shaders[i]->CompileStatus) {
linker_error(prog, "linking with uncompiled shader");
- prog->LinkStatus = GL_FALSE;
}
}
diff --git a/mesalib/src/mesa/program/program_lexer.l b/mesalib/src/mesa/program/program_lexer.l
index 0947bb046..d5dbcf347 100644
--- a/mesalib/src/mesa/program/program_lexer.l
+++ b/mesalib/src/mesa/program/program_lexer.l
@@ -165,7 +165,7 @@ szf [HR]?
cc C?
sat (_SAT)?
-%option prefix="_mesa_program_"
+%option prefix="_mesa_program_lexer_"
%option bison-bridge bison-locations reentrant noyywrap
%%
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index e2da63347..a76db4e86 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -98,7 +98,7 @@ static struct asm_instruction *asm_instruction_copy_ctor(
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
- if (YYID(N)) { \
+ if (N) { \
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
(Current).position = YYRHSLOC(Rhs, 1).position; \
@@ -112,16 +112,14 @@ static struct asm_instruction *asm_instruction_copy_ctor(
(Current).position = YYRHSLOC(Rhs, 0).position \
+ (Current).first_column; \
} \
- } while(YYID(0))
-
-#define YYLEX_PARAM state->scanner
+ } while(0)
%}
%pure-parser
%locations
+%lex-param { struct asm_parser_state *state }
%parse-param { struct asm_parser_state *state }
%error-verbose
-%lex-param { void *scanner }
%union {
struct asm_instruction *inst;
@@ -269,8 +267,16 @@ static struct asm_instruction *asm_instruction_copy_ctor(
%type <negate> optionalSign
%{
-extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
- void *yyscanner);
+extern int
+_mesa_program_lexer_lex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
+ void *yyscanner);
+
+static int
+yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
+ struct asm_parser_state *state)
+{
+ return _mesa_program_lexer_lex(yylval_param, yylloc_param, state->scanner);
+}
%}
%%
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 826722be8..77aaccd04 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -37,6 +37,7 @@
#include "main/context.h"
#include "main/fbobject.h"
#include "main/framebuffer.h"
+#include "main/glformats.h"
#include "main/macros.h"
#include "main/renderbuffer.h"
@@ -132,6 +133,13 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
pipe_surface_reference( &strb->surface, NULL );
pipe_resource_reference( &strb->texture, NULL );
+ /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear
+ * formats.
+ */
+ if (!ctx->Extensions.EXT_framebuffer_sRGB) {
+ internalFormat = _mesa_get_linear_internalformat(internalFormat);
+ }
+
/* Handle multisample renderbuffers first.
*
* From ARB_framebuffer_object:
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index c167744f4..faa9ee3f6 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -141,7 +141,7 @@ st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object);
DBG("%s\n", __FUNCTION__);
- _mesa_initialize_texture_object(&obj->base, name, target);
+ _mesa_initialize_texture_object(ctx, &obj->base, name, target);
return &obj->base;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index d01942967..0b7001bae 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -289,14 +289,6 @@ void st_init_limits(struct st_context *st)
}
-static GLboolean st_get_s3tc_override(void)
-{
- const char *override = _mesa_getenv("force_s3tc_enable");
- if (override && !strcmp(override, "true"))
- return GL_TRUE;
- return GL_FALSE;
-}
-
/**
* Given a member \c x of struct gl_extensions, return offset of
* \c x in bytes.
@@ -606,16 +598,24 @@ void st_init_extensions(struct st_context *st)
_mesa_override_glsl_version(st->ctx);
+ if (st->options.force_glsl_version > 0 &&
+ st->options.force_glsl_version <= ctx->Const.GLSLVersion) {
+ ctx->Const.ForceGLSLVersion = st->options.force_glsl_version;
+ }
+
if (ctx->Const.GLSLVersion >= 130) {
ctx->Const.NativeIntegers = GL_TRUE;
ctx->Const.MaxClipPlanes = 8;
/* Extensions that either depend on GLSL 1.30 or are a subset thereof. */
ctx->Extensions.ARB_conservative_depth = GL_TRUE;
- ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE;
ctx->Extensions.ARB_shading_language_packing = GL_TRUE;
ctx->Extensions.OES_depth_texture_cube_map = GL_TRUE;
ctx->Extensions.ARB_shading_language_420pack = GL_TRUE;
+
+ if (!st->options.disable_shader_bit_encoding) {
+ ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE;
+ }
} else {
/* Optional integer support for GLSL 1.2. */
if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
@@ -628,7 +628,7 @@ void st_init_extensions(struct st_context *st)
/* Below are the cases which cannot be moved into tables easily. */
- if (!ctx->Mesa_DXTn && !st_get_s3tc_override()) {
+ if (!ctx->Mesa_DXTn && !st->options.force_s3tc_enable) {
ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE;
ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE;
}
@@ -710,9 +710,11 @@ void st_init_extensions(struct st_context *st)
}
else if (ctx->Const.MaxSamples >= 2) {
ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
}
- if (ctx->Const.MaxDualSourceDrawBuffers > 0)
+ if (ctx->Const.MaxDualSourceDrawBuffers > 0 &&
+ !st->options.disable_blend_func_extended)
ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
st->has_time_elapsed =
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 16d977fc9..64bfd1faa 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1782,6 +1782,13 @@ st_QuerySamplesForFormat(struct gl_context *ctx, GLenum target,
else
bind = PIPE_BIND_RENDER_TARGET;
+ /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear
+ * formats.
+ */
+ if (!ctx->Extensions.EXT_framebuffer_sRGB) {
+ internalFormat = _mesa_get_linear_internalformat(internalFormat);
+ }
+
/* Set sample counts in descending order. */
for (i = 16; i > 1; i--) {
format = st_choose_format(st, internalFormat, GL_NONE, GL_NONE,
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 69c1b412b..3dfd5e5b3 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1832,10 +1832,17 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]);
break;
case ir_unop_bitcast_f2i:
+ result_src = op[0];
+ result_src.type = GLSL_TYPE_INT;
+ break;
case ir_unop_bitcast_f2u:
+ result_src = op[0];
+ result_src.type = GLSL_TYPE_UINT;
+ break;
case ir_unop_bitcast_i2f:
case ir_unop_bitcast_u2f:
result_src = op[0];
+ result_src.type = GLSL_TYPE_FLOAT;
break;
case ir_unop_f2b:
emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0));