aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-10-25 19:53:22 +0200
committermarha <marha@users.sourceforge.net>2014-10-25 19:53:22 +0200
commitd6d5581d5fba846c8476ad4d593da662306765d7 (patch)
tree7a864e15d2c5007b7c3298487a59f11f15c55c75 /mesalib/src
parenta14858a22f164b5accc4bd192a5d3de21d88e3d1 (diff)
downloadvcxsrv-d6d5581d5fba846c8476ad4d593da662306765d7.tar.gz
vcxsrv-d6d5581d5fba846c8476ad4d593da662306765d7.tar.bz2
vcxsrv-d6d5581d5fba846c8476ad4d593da662306765d7.zip
libXft mesa xserver pixman xkeyboard-config git update 25 Oct 2014
xserver commit 16a32c53f6e9ad1f3284d4596edfa33e9efb740e xkeyboard-config commit 0d4c3d9d891536aa1ec4f1fff5e3df51cfd2718d pixman commit 594e6a6c93e92fcfb495e987aec5617f6c37f467 libXft commit e8a83226bc10afb587f6f34daac44d2ef809c85e mesa commit 13862812dc910a4ef57cb72cb9fe777ce3c14515
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c77
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h2
-rw-r--r--mesalib/src/glsl/ast_array_index.cpp6
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp107
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h4
-rw-r--r--mesalib/src/glsl/ir_uniform.h11
-rw-r--r--mesalib/src/glsl/linker.cpp18
-rw-r--r--mesalib/src/glsl/lower_offset_array.cpp10
-rw-r--r--mesalib/src/glsl/main.cpp2
-rw-r--r--mesalib/src/glsl/opt_array_splitting.cpp2
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.cpp27
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.h3
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_clip_control.xml25
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile.am1
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_API.xml4
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_gentable.py4
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c9
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h3
-rw-r--r--mesalib/src/mesa/main/attrib.c1
-rw-r--r--mesalib/src/mesa/main/bufferobj.c4
-rw-r--r--mesalib/src/mesa/main/context.c12
-rw-r--r--mesalib/src/mesa/main/dd.h3
-rw-r--r--mesalib/src/mesa/main/dlist.c26
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp14
-rw-r--r--mesalib/src/mesa/main/get.c1
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py2
-rw-r--r--mesalib/src/mesa/main/mtypes.h7
-rw-r--r--mesalib/src/mesa/main/polygon.c2
-rw-r--r--mesalib/src/mesa/main/shaderapi.c2
-rw-r--r--mesalib/src/mesa/main/shaderapi.h9
-rw-r--r--mesalib/src/mesa/main/shaderimage.c2
-rw-r--r--mesalib/src/mesa/main/shaderobj.c28
-rw-r--r--mesalib/src/mesa/main/shaderobj.h6
-rw-r--r--mesalib/src/mesa/main/state.c25
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp74
-rw-r--r--mesalib/src/mesa/main/uniforms.c22
-rw-r--r--mesalib/src/mesa/main/uniforms.h2
-rw-r--r--mesalib/src/mesa/main/version.c2
-rw-r--r--mesalib/src/mesa/main/viewport.c122
-rw-r--r--mesalib/src/mesa/main/viewport.h6
-rw-r--r--mesalib/src/mesa/math/m_matrix.c17
-rw-r--r--mesalib/src/mesa/math/m_matrix.h4
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_viewport.c23
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_program.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_debug.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_debug.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp47
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h5
-rw-r--r--mesalib/src/util/macros.h14
-rw-r--r--mesalib/src/util/register_allocate.c2
54 files changed, 531 insertions, 309 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index f3fe949c2..e59fa0481 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -134,6 +134,7 @@ struct blitter_context_priv
boolean has_stream_out;
boolean has_stencil_export;
boolean has_texture_multisample;
+ boolean cached_all_shaders;
/* The Draw module overrides these functions.
* Always create the blitter before Draw. */
@@ -356,10 +357,11 @@ static void bind_fs_empty(struct blitter_context_priv *ctx)
struct pipe_context *pipe = ctx->base.pipe;
if (!ctx->fs_empty) {
+ assert(!ctx->cached_all_shaders);
ctx->fs_empty = util_make_empty_fragment_shader(pipe);
}
- pipe->bind_fs_state(pipe, ctx->fs_empty);
+ ctx->bind_fs_state(pipe, ctx->fs_empty);
}
static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx)
@@ -367,12 +369,13 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx)
struct pipe_context *pipe = ctx->base.pipe;
if (!ctx->fs_write_one_cbuf) {
+ assert(!ctx->cached_all_shaders);
ctx->fs_write_one_cbuf =
util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
TGSI_INTERPOLATE_CONSTANT, FALSE);
}
- pipe->bind_fs_state(pipe, ctx->fs_write_one_cbuf);
+ ctx->bind_fs_state(pipe, ctx->fs_write_one_cbuf);
}
static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx)
@@ -380,12 +383,13 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx)
struct pipe_context *pipe = ctx->base.pipe;
if (!ctx->fs_write_all_cbufs) {
+ assert(!ctx->cached_all_shaders);
ctx->fs_write_all_cbufs =
util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
TGSI_INTERPOLATE_CONSTANT, TRUE);
}
- pipe->bind_fs_state(pipe, ctx->fs_write_all_cbufs);
+ ctx->bind_fs_state(pipe, ctx->fs_write_all_cbufs);
}
void util_blitter_destroy(struct blitter_context *blitter)
@@ -850,6 +854,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
shader = &ctx->fs_resolve[target][index][filter];
if (!*shader) {
+ assert(!ctx->cached_all_shaders);
if (filter == PIPE_TEX_FILTER_LINEAR) {
*shader = util_make_fs_msaa_resolve_bilinear(pipe, tgsi_tex,
src_nr_samples,
@@ -870,6 +875,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
+ assert(!ctx->cached_all_shaders);
*shader = util_make_fs_blit_msaa_color(pipe, tgsi_tex);
}
}
@@ -880,6 +886,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
+ assert(!ctx->cached_all_shaders);
*shader = util_make_fragment_tex_shader(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
@@ -902,11 +909,10 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target,
- nr_samples);
-
- *shader =
- util_make_fs_blit_msaa_depth(pipe, tgsi_tex);
+ unsigned tgsi_tex;
+ assert(!ctx->cached_all_shaders);
+ tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples);
+ *shader = util_make_fs_blit_msaa_depth(pipe, tgsi_tex);
}
return *shader;
@@ -915,8 +921,9 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
-
+ unsigned tgsi_tex;
+ assert(!ctx->cached_all_shaders);
+ tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
*shader =
util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
@@ -940,11 +947,10 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target,
- nr_samples);
-
- *shader =
- util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex);
+ unsigned tgsi_tex;
+ assert(!ctx->cached_all_shaders);
+ tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples);
+ *shader = util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex);
}
return *shader;
@@ -953,8 +959,9 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
-
+ unsigned tgsi_tex;
+ assert(!ctx->cached_all_shaders);
+ tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
*shader =
util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
@@ -978,11 +985,10 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target,
- nr_samples);
-
- *shader =
- util_make_fs_blit_msaa_stencil(pipe, tgsi_tex);
+ unsigned tgsi_tex;
+ assert(!ctx->cached_all_shaders);
+ tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples);
+ *shader = util_make_fs_blit_msaa_stencil(pipe, tgsi_tex);
}
return *shader;
@@ -991,8 +997,9 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
/* Create the fragment shader on-demand. */
if (!*shader) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
-
+ unsigned tgsi_tex;
+ assert(!ctx->cached_all_shaders);
+ tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
*shader =
util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
@@ -1002,10 +1009,18 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
}
}
+
+/**
+ * Generate and save all fragment shaders that we will ever need for
+ * blitting. Drivers which use the 'draw' fallbacks will typically use
+ * this to make sure we generate/use shaders that don't go through the
+ * draw module's wrapper functions.
+ */
void util_blitter_cache_all_shaders(struct blitter_context *blitter)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
- struct pipe_screen *screen = blitter->pipe->screen;
+ struct pipe_context *pipe = blitter->pipe;
+ struct pipe_screen *screen = pipe->screen;
unsigned samples, j, f, target, max_samples;
boolean has_arraytex, has_cubearraytex;
@@ -1065,6 +1080,18 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter)
}
}
}
+
+ ctx->fs_empty = util_make_empty_fragment_shader(pipe);
+
+ ctx->fs_write_one_cbuf =
+ util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
+ TGSI_INTERPOLATE_CONSTANT, FALSE);
+
+ ctx->fs_write_all_cbufs =
+ util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
+ TGSI_INTERPOLATE_CONSTANT, TRUE);
+
+ ctx->cached_all_shaders = TRUE;
}
static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx,
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index f95c11166..0113fb1a0 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -799,7 +799,7 @@ util_bswap64(uint64_t n)
#if defined(HAVE___BUILTIN_BSWAP64)
return __builtin_bswap64(n);
#else
- return ((uint64_t)util_bswap32(n) << 32) |
+ return ((uint64_t)util_bswap32((uint32_t)n) << 32) |
util_bswap32((n >> 32));
#endif
}
diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp
index 49a8574f2..ff0c7576d 100644
--- a/mesalib/src/glsl/ast_array_index.cpp
+++ b/mesalib/src/glsl/ast_array_index.cpp
@@ -49,12 +49,12 @@ ast_array_specifier::print(void) const
* loc and state to report the error.
*/
static void
-update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
+update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc,
struct _mesa_glsl_parse_state *state)
{
if (ir_dereference_variable *deref_var = ir->as_dereference_variable()) {
ir_variable *var = deref_var->var;
- if (idx > var->data.max_array_access) {
+ if (idx > (int)var->data.max_array_access) {
var->data.max_array_access = idx;
/* Check whether this access will, as a side effect, implicitly cause
@@ -94,7 +94,7 @@ update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
assert(max_ifc_array_access != NULL);
- if (idx > max_ifc_array_access[field_index]) {
+ if (idx > (int)max_ifc_array_access[field_index]) {
max_ifc_array_access[field_index] = idx;
/* Check whether this access will, as a side effect, implicitly
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 068af295a..fe1e1291e 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -3767,7 +3767,7 @@ ast_declarator_list::hir(exec_list *instructions,
earlier->data.how_declared == ir_var_declared_in_block) {
_mesa_glsl_error(&loc, state,
"`%s' has already been redeclared using "
- "gl_PerVertex", var->name);
+ "gl_PerVertex", earlier->name);
}
earlier->data.how_declared = ir_var_declared_normally;
}
@@ -4373,7 +4373,7 @@ ast_jump_statement::hir(exec_list *instructions,
* loop.
*/
if (state->loop_nesting_ast != NULL &&
- mode == ast_continue) {
+ mode == ast_continue && !state->switch_state.is_switch_innermost) {
if (state->loop_nesting_ast->rest_expression) {
state->loop_nesting_ast->rest_expression->hir(instructions,
state);
@@ -4385,19 +4385,27 @@ ast_jump_statement::hir(exec_list *instructions,
}
if (state->switch_state.is_switch_innermost &&
+ mode == ast_continue) {
+ /* Set 'continue_inside' to true. */
+ ir_rvalue *const true_val = new (ctx) ir_constant(true);
+ ir_dereference_variable *deref_continue_inside_var =
+ new(ctx) ir_dereference_variable(state->switch_state.continue_inside);
+ instructions->push_tail(new(ctx) ir_assignment(deref_continue_inside_var,
+ true_val));
+
+ /* Break out from the switch, continue for the loop will
+ * be called right after switch. */
+ ir_loop_jump *const jump =
+ new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+ instructions->push_tail(jump);
+
+ } else if (state->switch_state.is_switch_innermost &&
mode == ast_break) {
- /* Force break out of switch by setting is_break switch state.
- */
- ir_variable *const is_break_var = state->switch_state.is_break_var;
- ir_dereference_variable *const deref_is_break_var =
- new(ctx) ir_dereference_variable(is_break_var);
- ir_constant *const true_val = new(ctx) ir_constant(true);
- ir_assignment *const set_break_var =
- new(ctx) ir_assignment(deref_is_break_var, true_val);
-
- instructions->push_tail(set_break_var);
- }
- else {
+ /* Force break out of switch by inserting a break. */
+ ir_loop_jump *const jump =
+ new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+ instructions->push_tail(jump);
+ } else {
ir_loop_jump *const jump =
new(ctx) ir_loop_jump((mode == ast_break)
? ir_loop_jump::jump_break
@@ -4509,19 +4517,19 @@ ast_switch_statement::hir(exec_list *instructions,
instructions->push_tail(new(ctx) ir_assignment(deref_is_fallthru_var,
is_fallthru_val));
- /* Initalize is_break state to false.
+ /* Initialize continue_inside state to false.
*/
- ir_rvalue *const is_break_val = new (ctx) ir_constant(false);
- state->switch_state.is_break_var =
+ state->switch_state.continue_inside =
new(ctx) ir_variable(glsl_type::bool_type,
- "switch_is_break_tmp",
+ "continue_inside_tmp",
ir_var_temporary);
- instructions->push_tail(state->switch_state.is_break_var);
+ instructions->push_tail(state->switch_state.continue_inside);
- ir_dereference_variable *deref_is_break_var =
- new(ctx) ir_dereference_variable(state->switch_state.is_break_var);
- instructions->push_tail(new(ctx) ir_assignment(deref_is_break_var,
- is_break_val));
+ ir_rvalue *const false_val = new (ctx) ir_constant(false);
+ ir_dereference_variable *deref_continue_inside_var =
+ new(ctx) ir_dereference_variable(state->switch_state.continue_inside);
+ instructions->push_tail(new(ctx) ir_assignment(deref_continue_inside_var,
+ false_val));
state->switch_state.run_default =
new(ctx) ir_variable(glsl_type::bool_type,
@@ -4529,13 +4537,42 @@ ast_switch_statement::hir(exec_list *instructions,
ir_var_temporary);
instructions->push_tail(state->switch_state.run_default);
+ /* Loop around the switch is used for flow control. */
+ ir_loop * loop = new(ctx) ir_loop();
+ instructions->push_tail(loop);
+
/* Cache test expression.
*/
- test_to_hir(instructions, state);
+ test_to_hir(&loop->body_instructions, state);
/* Emit code for body of switch stmt.
*/
- body->hir(instructions, state);
+ body->hir(&loop->body_instructions, state);
+
+ /* Insert a break at the end to exit loop. */
+ ir_loop_jump *jump = new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+ loop->body_instructions.push_tail(jump);
+
+ /* If we are inside loop, check if continue got called inside switch. */
+ if (state->loop_nesting_ast != NULL) {
+ ir_dereference_variable *deref_continue_inside =
+ new(ctx) ir_dereference_variable(state->switch_state.continue_inside);
+ ir_if *irif = new(ctx) ir_if(deref_continue_inside);
+ ir_loop_jump *jump = new(ctx) ir_loop_jump(ir_loop_jump::jump_continue);
+
+ if (state->loop_nesting_ast != NULL) {
+ if (state->loop_nesting_ast->rest_expression) {
+ state->loop_nesting_ast->rest_expression->hir(&irif->then_instructions,
+ state);
+ }
+ if (state->loop_nesting_ast->mode ==
+ ast_iteration_statement::ast_do_while) {
+ state->loop_nesting_ast->condition_to_hir(&irif->then_instructions, state);
+ }
+ }
+ irif->then_instructions.push_tail(jump);
+ instructions->push_tail(irif);
+ }
hash_table_dtor(state->switch_state.labels_ht);
@@ -4659,18 +4696,6 @@ ast_case_statement::hir(exec_list *instructions,
{
labels->hir(instructions, state);
- /* Conditionally set fallthru state based on break state. */
- ir_constant *const false_val = new(state) ir_constant(false);
- ir_dereference_variable *const deref_is_fallthru_var =
- new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
- ir_dereference_variable *const deref_is_break_var =
- new(state) ir_dereference_variable(state->switch_state.is_break_var);
- ir_assignment *const reset_fallthru_on_break =
- new(state) ir_assignment(deref_is_fallthru_var,
- false_val,
- deref_is_break_var);
- instructions->push_tail(reset_fallthru_on_break);
-
/* Guard case statements depending on fallthru state. */
ir_dereference_variable *const deref_fallthru_guard =
new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
@@ -5681,17 +5706,21 @@ ast_interface_block::hir(exec_list *instructions,
var->data.stream = this->layout.stream;
+ /* Examine var name here since var may get deleted in the next call */
+ bool var_is_gl_id = is_gl_identifier(var->name);
+
if (redeclaring_per_vertex) {
ir_variable *earlier =
get_variable_being_redeclared(var, loc, state,
true /* allow_all_redeclarations */);
- if (!is_gl_identifier(var->name) || earlier == NULL) {
+ if (!var_is_gl_id || earlier == NULL) {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex can only "
"include built-in variables");
} else if (earlier->data.how_declared == ir_var_declared_normally) {
_mesa_glsl_error(&loc, state,
- "`%s' has already been redeclared", var->name);
+ "`%s' has already been redeclared",
+ earlier->name);
} else {
earlier->data.how_declared = ir_var_declared_in_block;
earlier->reinit_interface_type(block_type);
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index c8b94781c..c14d74c98 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -40,9 +40,11 @@ struct glsl_switch_state {
/** Temporary variables needed for switch statement. */
ir_variable *test_var;
ir_variable *is_fallthru_var;
- ir_variable *is_break_var;
class ast_switch_statement *switch_nesting_ast;
+ /** Used to detect if 'continue' was called inside a switch. */
+ ir_variable *continue_inside;
+
/** Used to set condition if 'default' label should be chosen. */
ir_variable *run_default;
diff --git a/mesalib/src/glsl/ir_uniform.h b/mesalib/src/glsl/ir_uniform.h
index 2f7352825..b9ecf7cdd 100644
--- a/mesalib/src/glsl/ir_uniform.h
+++ b/mesalib/src/glsl/ir_uniform.h
@@ -45,17 +45,6 @@ extern "C" {
enum PACKED gl_uniform_driver_format {
uniform_native = 0, /**< Store data in the native format. */
uniform_int_float, /**< Store integer data as floats. */
- uniform_bool_float, /**< Store boolean data as floats. */
-
- /**
- * Store boolean data as integer using 1 for \c true.
- */
- uniform_bool_int_0_1,
-
- /**
- * Store boolean data as integer using ~0 for \c true.
- */
- uniform_bool_int_0_not0
};
struct gl_uniform_driver_storage {
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 47a722d9d..2d31801d3 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -1679,7 +1679,7 @@ link_intrastage_shaders(void *mem_ctx,
populate_symbol_table(linked);
- /* The a pointer to the main function in the final linked shader (i.e., the
+ /* The pointer to the main function in the final linked shader (i.e., the
* copy of the original shader that contained the main function).
*/
ir_function_signature *const main_sig =
@@ -1882,7 +1882,7 @@ find_available_slots(unsigned used_mask, unsigned needed_count)
/**
- * Assign locations for either VS inputs for FS outputs
+ * Assign locations for either VS inputs or FS outputs
*
* \param prog Shader program whose variables need locations assigned
* \param target_index Selector for the program target to receive location
@@ -2484,20 +2484,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
prog->Validated = false;
prog->_Used = false;
- ralloc_free(prog->InfoLog);
- prog->InfoLog = ralloc_strdup(NULL, "");
-
- ralloc_free(prog->UniformBlocks);
- prog->UniformBlocks = NULL;
- prog->NumUniformBlocks = 0;
- for (int i = 0; i < MESA_SHADER_STAGES; i++) {
- ralloc_free(prog->UniformBlockStageIndex[i]);
- prog->UniformBlockStageIndex[i] = NULL;
- }
-
- ralloc_free(prog->AtomicBuffers);
- prog->AtomicBuffers = NULL;
- prog->NumAtomicBuffers = 0;
prog->ARB_fragment_coord_conventions_enable = false;
/* Separate the shaders into groups based on their type.
diff --git a/mesalib/src/glsl/lower_offset_array.cpp b/mesalib/src/glsl/lower_offset_array.cpp
index 5b48526db..c30f80143 100644
--- a/mesalib/src/glsl/lower_offset_array.cpp
+++ b/mesalib/src/glsl/lower_offset_array.cpp
@@ -22,7 +22,7 @@
*/
/**
- * \file brw_lower_offset_array.cpp
+ * \file lower_offset_array.cpp
*
* IR lower pass to decompose ir_texture ir_tg4 with an array of offsets
* into four ir_tg4s with a single ivec2 offset, select the .w component of each,
@@ -39,9 +39,9 @@
using namespace ir_builder;
-class brw_lower_offset_array_visitor : public ir_rvalue_visitor {
+class lower_offset_array_visitor : public ir_rvalue_visitor {
public:
- brw_lower_offset_array_visitor()
+ lower_offset_array_visitor()
{
progress = false;
}
@@ -52,7 +52,7 @@ public:
};
void
-brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
+lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
{
if (*rv == NULL || (*rv)->ir_type != ir_type_texture)
return;
@@ -83,7 +83,7 @@ brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
bool
lower_offset_arrays(exec_list *instructions)
{
- brw_lower_offset_array_visitor v;
+ lower_offset_array_visitor v;
visit_list_elements(&v, instructions);
diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp
index feed10082..9b36a1fed 100644
--- a/mesalib/src/glsl/main.cpp
+++ b/mesalib/src/glsl/main.cpp
@@ -403,6 +403,8 @@ main(int argc, char **argv)
}
if ((status == EXIT_SUCCESS) && do_link) {
+ _mesa_clear_shader_program_data(whole_program);
+
link_shaders(ctx, whole_program);
status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/mesalib/src/glsl/opt_array_splitting.cpp b/mesalib/src/glsl/opt_array_splitting.cpp
index ebb076b22..9e73f3c44 100644
--- a/mesalib/src/glsl/opt_array_splitting.cpp
+++ b/mesalib/src/glsl/opt_array_splitting.cpp
@@ -295,7 +295,7 @@ ir_array_splitting_visitor::split_deref(ir_dereference **deref)
ir_constant *constant = deref_array->array_index->as_constant();
assert(constant);
- if (constant->value.i[0] < (int)entry->size) {
+ if (constant->value.i[0] >= 0 && constant->value.i[0] < (int)entry->size) {
*deref = new(entry->mem_ctx)
ir_dereference_variable(entry->components[constant->value.i[0]]);
} else {
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index 2b76dd17b..67b0d0c82 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -83,6 +83,33 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
return shader;
}
+void
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
+{
+ unsigned i;
+
+ shProg->NumUserUniformStorage = 0;
+ shProg->UniformStorage = NULL;
+ shProg->NumUniformRemapTable = 0;
+ shProg->UniformRemapTable = NULL;
+ shProg->UniformHash = NULL;
+
+ ralloc_free(shProg->InfoLog);
+ shProg->InfoLog = ralloc_strdup(shProg, "");
+
+ ralloc_free(shProg->UniformBlocks);
+ shProg->UniformBlocks = NULL;
+ shProg->NumUniformBlocks = 0;
+ for (i = 0; i < MESA_SHADER_STAGES; i++) {
+ ralloc_free(shProg->UniformBlockStageIndex[i]);
+ shProg->UniformBlockStageIndex[i] = NULL;
+ }
+
+ ralloc_free(shProg->AtomicBuffers);
+ shProg->AtomicBuffers = NULL;
+ shProg->NumAtomicBuffers = 0;
+}
+
void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
{
memset(ctx, 0, sizeof(*ctx));
diff --git a/mesalib/src/glsl/standalone_scaffolding.h b/mesalib/src/glsl/standalone_scaffolding.h
index df783afdb..895dd2782 100644
--- a/mesalib/src/glsl/standalone_scaffolding.h
+++ b/mesalib/src/glsl/standalone_scaffolding.h
@@ -45,6 +45,9 @@ extern "C" struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
extern "C" void
+_mesa_clear_shader_program_data(struct gl_shader_program *);
+
+extern "C" void
_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
const char *msg, int len);
diff --git a/mesalib/src/mapi/glapi/gen/ARB_clip_control.xml b/mesalib/src/mapi/glapi/gen/ARB_clip_control.xml
new file mode 100644
index 000000000..ab1a3883e
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/ARB_clip_control.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_clip_control" number="160">
+
+ <enum name="LOWER_LEFT" value = "0x8CA1"/>
+ <enum name="UPPER_LEFT" value = "0x8CA2"/>
+
+ <enum name="NEGATIVE_ONE_TO_ONE" value = "0x935E"/>
+ <enum name="ZERO_TO_ONE" value = "0x935F"/>
+
+ <enum name="CLIP_ORIGIN" value = "0x935C"/>
+ <enum name="CLIP_DEPTH_MODE" value = "0x935D"/>
+
+ <function name="ClipControl" offset="assign">
+ <param name="origin" type="GLenum"/>
+ <param name="depth" type="GLenum"/>
+ <!-- <glx rop="1340"/> -->
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index 2fbc59806..72e5095ee 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -113,6 +113,7 @@ API_XML = \
ARB_blend_func_extended.xml \
ARB_clear_buffer_object.xml \
ARB_clear_texture.xml \
+ ARB_clip_control.xml \
ARB_color_buffer_float.xml \
ARB_compressed_texture_pixel_storage.xml \
ARB_compute_shader.xml \
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index 73f2f7508..534e6a0b4 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -8364,7 +8364,9 @@
<xi:include href="ARB_multi_bind.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
-<!-- ARB extensions 148 - 160 -->
+<!-- ARB extensions 148 - 159 -->
+
+<xi:include href="ARB_clip_control.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<category name="GL_ARB_conditional_render_inverted" number="161">
<enum name="QUERY_WAIT_INVERTED" value="0x8E17"/>
diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py
index deffcee4d..06a5ebf04 100644
--- a/mesalib/src/mapi/glapi/gen/gl_gentable.py
+++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py
@@ -100,7 +100,7 @@ static void
__glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
GLuint entries = _glapi_get_dispatch_table_size();
void **dispatch = (void **) disp;
- int i;
+ unsigned i;
/* ISO C is annoying sometimes */
union {_glapi_proc p; void *v;} p;
@@ -147,7 +147,7 @@ class PrintCode(gl_XML.gl_print_base):
def __init__(self):
gl_XML.gl_print_base.__init__(self)
- self.name = "gl_gen_table.py (from Mesa)"
+ self.name = "gl_gentable.py (from Mesa)"
self.license = license.bsd_license_template % ( \
"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
(C) Copyright IBM Corporation 2004, 2005
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 7a8e627ba..87532c1df 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -680,6 +680,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_Ortho(0.0, ctx->DrawBuffer->Width,
0.0, ctx->DrawBuffer->Height,
-1.0, 1.0);
+
+ if (ctx->Extensions.ARB_clip_control) {
+ save->ClipOrigin = ctx->Transform.ClipOrigin;
+ save->ClipDepthMode = ctx->Transform.ClipDepthMode;
+ _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
+ }
}
if (state & MESA_META_CLIP) {
@@ -1081,6 +1087,9 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_LoadMatrixf(save->ProjectionMatrix);
_mesa_MatrixMode(save->MatrixMode);
+
+ if (ctx->Extensions.ARB_clip_control)
+ _mesa_ClipControl(save->ClipOrigin, save->ClipDepthMode);
}
if (state & MESA_META_CLIP) {
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index 2c9517b14..6ecf3c005 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -136,6 +136,9 @@ struct save_state
GLfloat ModelviewMatrix[16];
GLfloat ProjectionMatrix[16];
GLfloat TextureMatrix[16];
+ /** GL_ARB_clip_control */
+ GLenum ClipOrigin; /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+ GLenum ClipDepthMode; /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
/** MESA_META_CLIP */
GLbitfield ClipPlanesEnabled;
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index d90e6627f..5345339f6 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1345,6 +1345,7 @@ _mesa_PopAttrib(void)
if (xform->DepthClamp != ctx->Transform.DepthClamp)
_mesa_set_enable(ctx, GL_DEPTH_CLAMP,
ctx->Transform.DepthClamp);
+ _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode);
}
break;
case GL_TEXTURE_BIT:
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 0ee88560f..2bae1bc72 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -2710,7 +2710,7 @@ bind_buffer_range_uniform_buffer(struct gl_context *ctx,
if (offset & (ctx->Const.UniformBufferOffsetAlignment - 1)) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glBindBufferRange(offset misalgned %d/%d)", (int) offset,
+ "glBindBufferRange(offset misaligned %d/%d)", (int) offset,
ctx->Const.UniformBufferOffsetAlignment);
return;
}
@@ -2797,7 +2797,7 @@ bind_atomic_buffer(struct gl_context *ctx,
if (offset & (ATOMIC_COUNTER_SIZE - 1)) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "%s(offset misalgned %d/%d)", name, (int) offset,
+ "%s(offset misaligned %d/%d)", name, (int) offset,
ATOMIC_COUNTER_SIZE);
return;
}
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 5a8f7184a..25b9bfc4c 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -133,6 +133,7 @@
#include "program/prog_print.h"
#include "math/m_matrix.h"
#include "main/dispatch.h" /* for _gloffset_COUNT */
+#include "uniforms.h"
#ifdef USE_SPARC_ASM
#include "sparc/sparc.h"
@@ -1949,6 +1950,17 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
}
}
+ /* If a program is active and SSO not in use, check if validation of
+ * samplers succeeded for the active program. */
+ if (ctx->_Shader->ActiveProgram && ctx->_Shader != ctx->Pipeline.Current) {
+ char errMsg[100];
+ if (!_mesa_sampler_uniforms_are_valid(ctx->_Shader->ActiveProgram,
+ errMsg, 100)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", errMsg);
+ return GL_FALSE;
+ }
+ }
+
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
"%s(incomplete framebuffer)", where);
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index c07e83ad9..2f40915d9 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -758,8 +758,7 @@ struct dd_function_table {
struct gl_shader *(*NewShader)(struct gl_context *ctx,
GLuint name, GLenum type);
void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
- struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx,
- GLuint name);
+ struct gl_shader_program *(*NewShaderProgram)(GLuint name);
void (*DeleteShaderProgram)(struct gl_context *ctx,
struct gl_shader_program *shProg);
void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 5c7160d05..4b7b0604b 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -398,6 +398,9 @@ typedef enum
OPCODE_PROGRAM_UNIFORM_MATRIX34F,
OPCODE_PROGRAM_UNIFORM_MATRIX43F,
+ /* GL_ARB_clip_control */
+ OPCODE_CLIP_CONTROL,
+
/* GL_ARB_color_buffer_float */
OPCODE_CLAMP_COLOR,
@@ -7208,6 +7211,22 @@ save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
}
static void GLAPIENTRY
+save_ClipControl(GLenum origin, GLenum depth)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
+ if (n) {
+ n[1].e = origin;
+ n[2].e = depth;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_ClipControl(ctx->Exec, (origin, depth));
+ }
+}
+
+static void GLAPIENTRY
save_ClampColorARB(GLenum target, GLenum clamp)
{
GET_CURRENT_CONTEXT(ctx);
@@ -8617,6 +8636,10 @@ execute_list(struct gl_context *ctx, GLuint list)
get_pointer(&n[5])));
break;
+ case OPCODE_CLIP_CONTROL:
+ CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
+ break;
+
case OPCODE_CLAMP_COLOR:
CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
break;
@@ -9551,6 +9574,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_TexParameterIiv(table, save_TexParameterIiv);
SET_TexParameterIuiv(table, save_TexParameterIuiv);
+ /* GL_ARB_clip_control */
+ SET_ClipControl(table, save_ClipControl);
+
/* GL_ARB_color_buffer_float */
SET_ClampColor(table, save_ClampColorARB);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index f0e2f89e4..15d66a744 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -91,6 +91,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_buffer_storage", o(ARB_buffer_storage), GL, 2013 },
{ "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 },
{ "GL_ARB_clear_texture", o(ARB_clear_texture), GL, 2013 },
+ { "GL_ARB_clip_control", o(ARB_clip_control), GL, 2014 },
{ "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 },
{ "GL_ARB_compressed_texture_pixel_storage", o(dummy_true), GL, 2011 },
{ "GL_ARB_compute_shader", o(ARB_compute_shader), GL, 2012 },
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 9bb706cc5..5591d57df 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -665,7 +665,7 @@ static GLboolean args_match( const struct state_key *key, GLuint unit )
}
static ir_rvalue *
-smear(texenv_fragment_program *p, ir_rvalue *val)
+smear(ir_rvalue *val)
{
if (!val->type->is_scalar())
return val;
@@ -722,7 +722,7 @@ emit_combine(texenv_fragment_program *p,
tmp1 = mul(src[1], new(p->mem_ctx) ir_constant(2.0f));
tmp1 = add(tmp1, new(p->mem_ctx) ir_constant(-1.0f));
- return dot(swizzle_xyz(smear(p, tmp0)), swizzle_xyz(smear(p, tmp1)));
+ return dot(swizzle_xyz(smear(tmp0)), swizzle_xyz(smear(tmp1)));
}
case MODE_MODULATE_ADD_ATI:
return add(mul(src[0], src[2]), src[1]);
@@ -804,7 +804,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsRGB,
key->unit[unit].ModeRGB,
key->unit[unit].OptRGB);
- val = smear(p, val);
+ val = smear(val);
if (rgb_saturate)
val = saturate(val);
@@ -816,7 +816,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsRGB,
key->unit[unit].ModeRGB,
key->unit[unit].OptRGB);
- val = smear(p, val);
+ val = smear(val);
if (rgb_saturate)
val = saturate(val);
p->emit(assign(temp_var, val));
@@ -829,7 +829,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsRGB,
key->unit[unit].ModeRGB,
key->unit[unit].OptRGB);
- val = swizzle_xyz(smear(p, val));
+ val = swizzle_xyz(smear(val));
if (rgb_saturate)
val = saturate(val);
p->emit(assign(temp_var, val, WRITEMASK_XYZ));
@@ -838,7 +838,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsA,
key->unit[unit].ModeA,
key->unit[unit].OptA);
- val = swizzle_w(smear(p, val));
+ val = swizzle_w(smear(val));
if (alpha_saturate)
val = saturate(val);
p->emit(assign(temp_var, val, WRITEMASK_W));
@@ -1212,7 +1212,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
p.top_instructions = p.shader->ir;
p.instructions = p.shader->ir;
p.state = key;
- p.shader_program = ctx->Driver.NewShaderProgram(ctx, 0);
+ p.shader_program = ctx->Driver.NewShaderProgram(0);
/* Tell the linker to ignore the fact that we're building a
* separate shader, in case we're in a GLES2 context that would
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 0e2d8f687..6091efc7f 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -391,6 +391,7 @@ EXTRA_EXT(ARB_gpu_shader5);
EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
EXTRA_EXT(INTEL_performance_query);
EXTRA_EXT(ARB_explicit_uniform_location);
+EXTRA_EXT(ARB_clip_control);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index da3568469..aa9f282d8 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -414,6 +414,8 @@ descriptor=[
[ "AUX_BUFFERS", "BUFFER_INT(Visual.numAuxBuffers), NO_EXTRA" ],
[ "BLUE_BIAS", "CONTEXT_FLOAT(Pixel.BlueBias), NO_EXTRA" ],
[ "BLUE_SCALE", "CONTEXT_FLOAT(Pixel.BlueScale), NO_EXTRA" ],
+ [ "CLIP_DEPTH_MODE", "CONTEXT_ENUM(Transform.ClipDepthMode), extra_ARB_clip_control" ],
+ [ "CLIP_ORIGIN", "CONTEXT_ENUM(Transform.ClipOrigin), extra_ARB_clip_control" ],
[ "CLIENT_ATTRIB_STACK_DEPTH", "CONTEXT_INT(ClientAttribStackDepth), NO_EXTRA" ],
[ "COLOR_MATERIAL_FACE", "CONTEXT_ENUM(Light.ColorMaterialFace), NO_EXTRA" ],
[ "COLOR_MATERIAL_PARAMETER", "CONTEXT_ENUM(Light.ColorMaterialMode), NO_EXTRA" ],
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 9f44edac6..e1f1f1dde 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1430,6 +1430,9 @@ struct gl_transform_attrib
GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */
GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */
GLboolean DepthClamp; /**< GL_ARB_depth_clamp */
+ /** GL_ARB_clip_control */
+ GLenum ClipOrigin; /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+ GLenum ClipDepthMode; /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
};
@@ -2775,7 +2778,7 @@ struct gl_shader_program
* Transform feedback varyings last specified by
* glTransformFeedbackVaryings().
*
- * For the current set of transform feeedback varyings used for transform
+ * For the current set of transform feedback varyings used for transform
* feedback output, see LinkedTransformFeedback.
*/
struct {
@@ -2884,6 +2887,7 @@ struct gl_shader_program
GLboolean LinkStatus; /**< GL_LINK_STATUS */
GLboolean Validated;
GLboolean _Used; /**< Ever used for drawing? */
+ GLboolean SamplersValidated; /**< Samplers validated against texture units? */
GLchar *InfoLog;
unsigned Version; /**< GLSL version used for linking */
@@ -3697,6 +3701,7 @@ struct gl_extensions
GLboolean ARB_blend_func_extended;
GLboolean ARB_buffer_storage;
GLboolean ARB_clear_texture;
+ GLboolean ARB_clip_control;
GLboolean ARB_color_buffer_float;
GLboolean ARB_compute_shader;
GLboolean ARB_conditional_render_inverted;
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index 611cef653..76d601977 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -104,8 +104,6 @@ _mesa_FrontFace( GLenum mode )
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.FrontFace = mode;
- ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
-
if (ctx->Driver.FrontFace)
ctx->Driver.FrontFace( ctx, mode );
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 3e6f61067..2be9092c1 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -316,7 +316,7 @@ create_shader_program(struct gl_context *ctx)
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
- shProg = ctx->Driver.NewShaderProgram(ctx, name);
+ shProg = ctx->Driver.NewShaderProgram(name);
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h
index 17b05b313..047d2562d 100644
--- a/mesalib/src/mesa/main/shaderapi.h
+++ b/mesalib/src/mesa/main/shaderapi.h
@@ -205,15 +205,6 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
struct gl_shader_program *shProg,
struct gl_pipeline_object *shTarget);
-extern void GLAPIENTRY
-_mesa_UseShaderProgramEXT(GLenum type, GLuint program);
-
-extern void GLAPIENTRY
-_mesa_ActiveProgramEXT(GLuint program);
-
-extern GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string);
-
extern void
_mesa_copy_linked_program_data(gl_shader_stage type,
const struct gl_shader_program *src,
diff --git a/mesalib/src/mesa/main/shaderimage.c b/mesalib/src/mesa/main/shaderimage.c
index 9e62f4294..dcbcca623 100644
--- a/mesalib/src/mesa/main/shaderimage.c
+++ b/mesalib/src/mesa/main/shaderimage.c
@@ -384,7 +384,7 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
void
_mesa_validate_image_units(struct gl_context *ctx)
{
- int i;
+ unsigned i;
for (i = 0; i < ctx->Const.MaxImageUnits; ++i) {
struct gl_image_unit *u = &ctx->ImageUnits[i];
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 693e9a259..81bd7829d 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -235,8 +235,8 @@ _mesa_reference_shader_program(struct gl_context *ctx,
}
}
-void
-_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog)
+static void
+init_shader_program(struct gl_shader_program *prog)
{
prog->Type = GL_SHADER_PROGRAM_MESA;
prog->RefCount = 1;
@@ -261,13 +261,13 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
* Called via ctx->Driver.NewShaderProgram()
*/
static struct gl_shader_program *
-_mesa_new_shader_program(struct gl_context *ctx, GLuint name)
+_mesa_new_shader_program(GLuint name)
{
struct gl_shader_program *shProg;
shProg = rzalloc(NULL, struct gl_shader_program);
if (shProg) {
shProg->Name = name;
- _mesa_init_shader_program(ctx, shProg);
+ init_shader_program(shProg);
}
return shProg;
}
@@ -277,11 +277,11 @@ _mesa_new_shader_program(struct gl_context *ctx, GLuint name)
* Clear (free) the shader program state that gets produced by linking.
*/
void
-_mesa_clear_shader_program_data(struct gl_context *ctx,
- struct gl_shader_program *shProg)
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
{
+ unsigned i;
+
if (shProg->UniformStorage) {
- unsigned i;
for (i = 0; i < shProg->NumUserUniformStorage; ++i)
_mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
ralloc_free(shProg->UniformStorage);
@@ -303,6 +303,18 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
assert(shProg->InfoLog != NULL);
ralloc_free(shProg->InfoLog);
shProg->InfoLog = ralloc_strdup(shProg, "");
+
+ ralloc_free(shProg->UniformBlocks);
+ shProg->UniformBlocks = NULL;
+ shProg->NumUniformBlocks = 0;
+ for (i = 0; i < MESA_SHADER_STAGES; i++) {
+ ralloc_free(shProg->UniformBlockStageIndex[i]);
+ shProg->UniformBlockStageIndex[i] = NULL;
+ }
+
+ ralloc_free(shProg->AtomicBuffers);
+ shProg->AtomicBuffers = NULL;
+ shProg->NumAtomicBuffers = 0;
}
@@ -319,7 +331,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
- _mesa_clear_shader_program_data(ctx, shProg);
+ _mesa_clear_shader_program_data(shProg);
if (shProg->AttributeBindings) {
string_to_uint_map_dtor(shProg->AttributeBindings);
diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h
index d72919c1f..05ddfeb50 100644
--- a/mesalib/src/mesa/main/shaderobj.h
+++ b/mesalib/src/mesa/main/shaderobj.h
@@ -71,9 +71,6 @@ _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader);
extern struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
-extern void
-_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog);
-
extern struct gl_shader_program *
_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name);
@@ -82,8 +79,7 @@ _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
const char *caller);
extern void
-_mesa_clear_shader_program_data(struct gl_context *ctx,
- struct gl_shader_program *shProg);
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg);
extern void
_mesa_free_shader_program_data(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index 80287c470..45bce78fd 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -51,6 +51,7 @@
#include "texobj.h"
#include "texstate.h"
#include "varray.h"
+#include "viewport.h"
#include "blend.h"
@@ -281,16 +282,29 @@ update_viewport_matrix(struct gl_context *ctx)
* NOTE: RasterPos uses this.
*/
for (i = 0; i < ctx->Const.MaxViewports; i++) {
+ double scale[3], translate[3];
+
+ _mesa_get_viewport_xform(ctx, i, scale, translate);
_math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
- ctx->ViewportArray[i].X, ctx->ViewportArray[i].Y,
- ctx->ViewportArray[i].Width, ctx->ViewportArray[i].Height,
- ctx->ViewportArray[i].Near, ctx->ViewportArray[i].Far,
- depthMax);
+ scale, translate, depthMax);
}
}
/**
+ * Update the ctx->Polygon._FrontBit flag.
+ */
+static void
+update_frontbit(struct gl_context *ctx)
+{
+ if (ctx->Transform.ClipOrigin == GL_LOWER_LEFT)
+ ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CW);
+ else
+ ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CCW);
+}
+
+
+/**
* Update derived multisample state.
*/
static void
@@ -372,6 +386,9 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
_mesa_update_texture( ctx, new_state );
+ if (new_state & _NEW_POLYGON)
+ update_frontbit( ctx );
+
if (new_state & _NEW_BUFFERS)
_mesa_update_framebuffer(ctx);
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 1592c9bfd..fcb14c4e2 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -533,8 +533,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
dst += array_index * store->element_stride;
switch (store->format) {
- case uniform_native:
- case uniform_bool_int_0_1: {
+ case uniform_native: {
unsigned j;
unsigned v;
@@ -550,8 +549,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
break;
}
- case uniform_int_float:
- case uniform_bool_float: {
+ case uniform_int_float: {
const int *isrc = (const int *) src;
unsigned j;
unsigned v;
@@ -572,27 +570,6 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
break;
}
- case uniform_bool_int_0_not0: {
- const int *isrc = (const int *) src;
- unsigned j;
- unsigned v;
- unsigned c;
-
- for (j = 0; j < count; j++) {
- for (v = 0; v < vectors; v++) {
- for (c = 0; c < components; c++) {
- ((int *) dst)[c] = *isrc == 0 ? 0 : ~0;
- isrc++;
- }
-
- dst += store->vector_stride;
- }
-
- dst += extra_stride;
- }
- break;
- }
-
default:
assert(!"Should not get here.");
break;
@@ -996,8 +973,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
* array offset in *offset, or GL_INVALID_INDEX (-1).
*/
extern "C" unsigned
-_mesa_get_uniform_location(struct gl_context *ctx,
- struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_shader_program *shProg,
const GLchar *name,
unsigned *out_offset)
{
@@ -1064,42 +1040,16 @@ extern "C" bool
_mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
char *errMsg, size_t errMsgLength)
{
- const glsl_type *unit_types[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
- memset(unit_types, 0, sizeof(unit_types));
-
- for (unsigned i = 0; i < shProg->NumUserUniformStorage; i++) {
- const struct gl_uniform_storage *const storage =
- &shProg->UniformStorage[i];
- const glsl_type *const t = (storage->type->is_array())
- ? storage->type->fields.array : storage->type;
-
- if (!t->is_sampler())
- continue;
-
- const unsigned count = MAX2(1, storage->type->array_size());
- for (unsigned j = 0; j < count; j++) {
- const unsigned unit = storage->storage[j].i;
-
- /* The types of the samplers associated with a particular texture
- * unit must be an exact match. Page 74 (page 89 of the PDF) of the
- * OpenGL 3.3 core spec says:
- *
- * "It is not allowed to have variables of different sampler
- * types pointing to the same texture image unit within a program
- * object."
- */
- if (unit_types[unit] == NULL) {
- unit_types[unit] = t;
- } else if (unit_types[unit] != t) {
- _mesa_snprintf(errMsg, errMsgLength,
- "Texture unit %d is accessed both as %s and %s",
- unit, unit_types[unit]->name, t->name);
- return false;
- }
- }
+ /* Shader does not have samplers. */
+ if (shProg->NumUserUniformStorage == 0)
+ return true;
+
+ if (!shProg->SamplersValidated) {
+ _mesa_snprintf(errMsg, errMsgLength,
+ "active samplers with a different type "
+ "refer to the same texture image unit");
+ return false;
}
-
return true;
}
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 0d0cbf57e..c30710772 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -75,12 +75,26 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
memcpy(prog->SamplerUnits, shader->SamplerUnits, sizeof(prog->SamplerUnits));
memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
+ shProg->SamplersValidated = GL_TRUE;
+
for (s = 0; s < MAX_SAMPLERS; s++) {
if (prog->SamplersUsed & (1 << s)) {
GLuint unit = shader->SamplerUnits[s];
GLuint tgt = shader->SamplerTargets[s];
assert(unit < Elements(prog->TexturesUsed));
assert(tgt < NUM_TEXTURE_TARGETS);
+
+ /* The types of the samplers associated with a particular texture
+ * unit must be an exact match. Page 74 (page 89 of the PDF) of the
+ * OpenGL 3.3 core spec says:
+ *
+ * "It is not allowed to have variables of different sampler
+ * types pointing to the same texture image unit within a program
+ * object."
+ */
+ if (prog->TexturesUsed[unit] & ~(1 << tgt))
+ shProg->SamplersValidated = GL_FALSE;
+
prog->TexturesUsed[unit] |= (1 << tgt);
}
}
@@ -917,7 +931,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
return -1;
}
- index = _mesa_get_uniform_location(ctx, shProg, name, &offset);
+ index = _mesa_get_uniform_location(shProg, name, &offset);
if (index == GL_INVALID_INDEX)
return -1;
@@ -990,7 +1004,7 @@ _mesa_GetUniformIndices(GLuint program,
for (i = 0; i < uniformCount; i++) {
unsigned offset;
- uniformIndices[i] = _mesa_get_uniform_location(ctx, shProg,
+ uniformIndices[i] = _mesa_get_uniform_location(shProg,
uniformNames[i], &offset);
}
}
@@ -1096,7 +1110,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
const int idx =
- _mesa_get_uniform_location(ctx, shProg,
+ _mesa_get_uniform_location(shProg,
block->Uniforms[i].IndexName,
&offset);
if (idx != -1)
@@ -1113,7 +1127,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
const int idx =
- _mesa_get_uniform_location(ctx, shProg,
+ _mesa_get_uniform_location(shProg,
block->Uniforms[i].IndexName,
&offset);
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index e7a370e84..6575a52f4 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -259,7 +259,7 @@ _mesa_parse_program_resource_name(const GLchar *name,
const GLchar **out_base_name_end);
unsigned
-_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_shader_program *shProg,
const GLchar *name, unsigned *offset);
void
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 71f70119b..4951891cb 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -381,7 +381,6 @@ compute_version_es2(const struct gl_extensions *extensions)
extensions->ARB_shader_texture_lod &&
extensions->ARB_texture_float &&
extensions->ARB_texture_rg &&
- extensions->ARB_texture_compression_rgtc &&
extensions->EXT_draw_buffers2 &&
/* extensions->ARB_framebuffer_object && */
extensions->EXT_framebuffer_sRGB &&
@@ -389,7 +388,6 @@ compute_version_es2(const struct gl_extensions *extensions)
extensions->EXT_texture_array &&
extensions->EXT_texture_shared_exponent &&
extensions->EXT_transform_feedback &&
- extensions->NV_conditional_render &&
extensions->ARB_draw_instanced &&
extensions->ARB_uniform_buffer_object &&
extensions->EXT_texture_snorm &&
diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c
index 222ae307b..d6a9e290a 100644
--- a/mesalib/src/mesa/main/viewport.c
+++ b/mesalib/src/mesa/main/viewport.c
@@ -30,6 +30,7 @@
#include "context.h"
+#include "enums.h"
#include "macros.h"
#include "mtypes.h"
#include "viewport.h"
@@ -39,6 +40,8 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
GLfloat x, GLfloat y,
GLfloat width, GLfloat height)
{
+ double scale[3], translate[3];
+
/* clamp width and height to the implementation dependent range */
width = MIN2(width, (GLfloat) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLfloat) ctx->Const.MaxViewportHeight);
@@ -75,14 +78,9 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
* the WindowMap matrix being up to date in the driver's Viewport
* and DepthRange functions.
*/
+ _mesa_get_viewport_xform(ctx, idx, scale, translate);
_math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
- ctx->ViewportArray[idx].X,
- ctx->ViewportArray[idx].Y,
- ctx->ViewportArray[idx].Width,
- ctx->ViewportArray[idx].Height,
- ctx->ViewportArray[idx].Near,
- ctx->ViewportArray[idx].Far,
- ctx->DrawBuffer->_DepthMaxF);
+ scale, translate, ctx->DrawBuffer->_DepthMaxF);
#endif
}
@@ -248,6 +246,8 @@ static void
set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
GLclampd nearval, GLclampd farval)
{
+ double scale[3], translate[3];
+
if (ctx->ViewportArray[idx].Near == nearval &&
ctx->ViewportArray[idx].Far == farval)
return;
@@ -261,14 +261,9 @@ set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
* the WindowMap matrix being up to date in the driver's Viewport
* and DepthRange functions.
*/
+ _mesa_get_viewport_xform(ctx, idx, scale, translate);
_math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
- ctx->ViewportArray[idx].X,
- ctx->ViewportArray[idx].Y,
- ctx->ViewportArray[idx].Width,
- ctx->ViewportArray[idx].Height,
- ctx->ViewportArray[idx].Near,
- ctx->ViewportArray[idx].Far,
- ctx->DrawBuffer->_DepthMaxF);
+ scale, translate, ctx->DrawBuffer->_DepthMaxF);
#endif
}
@@ -396,10 +391,15 @@ void _mesa_init_viewport(struct gl_context *ctx)
GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
unsigned i;
+ ctx->Transform.ClipOrigin = GL_LOWER_LEFT;
+ ctx->Transform.ClipDepthMode = GL_NEGATIVE_ONE_TO_ONE;
+
/* Note: ctx->Const.MaxViewports may not have been set by the driver yet,
* so just initialize all of them.
*/
for (i = 0; i < MAX_VIEWPORTS; i++) {
+ double scale[3], translate[3];
+
/* Viewport group */
ctx->ViewportArray[i].X = 0;
ctx->ViewportArray[i].Y = 0;
@@ -409,8 +409,9 @@ void _mesa_init_viewport(struct gl_context *ctx)
ctx->ViewportArray[i].Far = 1.0;
_math_matrix_ctr(&ctx->ViewportArray[i]._WindowMap);
- _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap, 0, 0, 0, 0,
- 0.0F, 1.0F, depthMax);
+ _mesa_get_viewport_xform(ctx, i, scale, translate);
+ _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
+ scale, translate, depthMax);
}
}
@@ -427,3 +428,92 @@ void _mesa_free_viewport_data(struct gl_context *ctx)
_math_matrix_dtr(&ctx->ViewportArray[i]._WindowMap);
}
+extern void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glClipControl(%s, %s)\n",
+ _mesa_lookup_enum_by_nr(origin),
+ _mesa_lookup_enum_by_nr(depth));
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.ARB_clip_control) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glClipControl");
+ return;
+ }
+
+ if (origin != GL_LOWER_LEFT && origin != GL_UPPER_LEFT) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+ return;
+ }
+
+ if (depth != GL_NEGATIVE_ONE_TO_ONE && depth != GL_ZERO_TO_ONE) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+ return;
+ }
+
+ if (ctx->Transform.ClipOrigin == origin &&
+ ctx->Transform.ClipDepthMode == depth)
+ return;
+
+ FLUSH_VERTICES(ctx, 0);
+
+ if (ctx->Transform.ClipOrigin != origin) {
+ ctx->Transform.ClipOrigin = origin;
+
+ /* Affects the winding order of the front face. */
+ ctx->NewState |= _NEW_POLYGON;
+ /* Affects the y component of the viewport transform. */
+ ctx->NewState |= _NEW_VIEWPORT;
+
+ if (ctx->Driver.FrontFace)
+ ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
+ }
+
+ if (ctx->Transform.ClipDepthMode != depth) {
+ ctx->Transform.ClipDepthMode = depth;
+
+ /* Affects the z part of the viewpoint transform. */
+ ctx->NewState |= _NEW_VIEWPORT;
+
+ if (ctx->Driver.DepthRange)
+ ctx->Driver.DepthRange(ctx);
+ }
+}
+
+/**
+ * Computes the scaling and the translation part of the
+ * viewport transform matrix of the \param i-th viewport
+ * and writes that into \param scale and \param translate.
+ */
+void
+_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
+ double scale[3], double translate[3])
+{
+ double x = ctx->ViewportArray[i].X;
+ double y = ctx->ViewportArray[i].Y;
+ double half_width = 0.5*ctx->ViewportArray[i].Width;
+ double half_height = 0.5*ctx->ViewportArray[i].Height;
+ double n = ctx->ViewportArray[i].Near;
+ double f = ctx->ViewportArray[i].Far;
+
+ scale[0] = half_width;
+ translate[0] = half_width + x;
+ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
+ scale[1] = -half_height;
+ translate[1] = half_height - y;
+ } else {
+ scale[1] = half_height;
+ translate[1] = half_height + y;
+ }
+ if (ctx->Transform.ClipDepthMode == GL_NEGATIVE_ONE_TO_ONE) {
+ scale[2] = 0.5*(f - n);
+ translate[2] = 0.5*(n + f);
+ } else {
+ scale[2] = f - n;
+ translate[2] = n;
+ }
+}
diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h
index f2311c02b..426e194bd 100644
--- a/mesalib/src/mesa/main/viewport.h
+++ b/mesalib/src/mesa/main/viewport.h
@@ -71,5 +71,11 @@ _mesa_init_viewport(struct gl_context *ctx);
extern void
_mesa_free_viewport_data(struct gl_context *ctx);
+extern void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth);
+
+extern void
+_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
+ double scale[3], double translate[3]);
#endif
diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c
index e512e456f..9c9310d93 100644
--- a/mesalib/src/mesa/math/m_matrix.c
+++ b/mesalib/src/mesa/math/m_matrix.c
@@ -1110,16 +1110,15 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
* Transforms Normalized Device Coords to window/Z values.
*/
void
-_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y,
- GLfloat width, GLfloat height,
- GLdouble zNear, GLdouble zFar, GLdouble depthMax)
+_math_matrix_viewport(GLmatrix *m, const double scale[3],
+ const double translate[3], double depthMax)
{
- m->m[MAT_SX] = width / 2.0F;
- m->m[MAT_TX] = m->m[MAT_SX] + x;
- m->m[MAT_SY] = height / 2.0F;
- m->m[MAT_TY] = m->m[MAT_SY] + y;
- m->m[MAT_SZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0));
- m->m[MAT_TZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0 + zNear));
+ m->m[MAT_SX] = scale[0];
+ m->m[MAT_TX] = translate[0];
+ m->m[MAT_SY] = scale[1];
+ m->m[MAT_TY] = translate[1];
+ m->m[MAT_SZ] = depthMax*scale[2];
+ m->m[MAT_TZ] = depthMax*translate[2];
m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION;
m->type = MATRIX_3D_NO_ROT;
}
diff --git a/mesalib/src/mesa/math/m_matrix.h b/mesalib/src/mesa/math/m_matrix.h
index dddce7019..778d716dc 100644
--- a/mesalib/src/mesa/math/m_matrix.h
+++ b/mesalib/src/mesa/math/m_matrix.h
@@ -122,8 +122,8 @@ _math_matrix_frustum( GLmatrix *mat,
GLfloat nearval, GLfloat farval );
extern void
-_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, GLfloat width, GLfloat height,
- GLdouble zNear, GLdouble zFar, GLdouble depthMax);
+_math_matrix_viewport( GLmatrix *m, const double scale[3],
+ const double translate[3], double depthMax );
extern void
_math_matrix_set_identity( GLmatrix *dest );
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index b3e04d7b6..5cd905822 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3020,7 +3020,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
unsigned int i;
- _mesa_clear_shader_program_data(ctx, prog);
+ _mesa_clear_shader_program_data(prog);
prog->LinkStatus = GL_TRUE;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index a2285383e..50209788b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -33,6 +33,7 @@
#include "main/macros.h"
#include "st_context.h"
#include "st_atom.h"
+#include "st_debug.h"
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
@@ -71,6 +72,11 @@ static void update_raster_state( struct st_context *st )
{
raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW);
+ /* _NEW_VIEWPORT */
+ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
+ raster->front_ccw ^= 1;
+ }
+
/*
* Gallium's surfaces are Y=0=TOP orientation. OpenGL is the
* opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs
@@ -119,8 +125,14 @@ static void update_raster_state( struct st_context *st )
/* _NEW_POLYGON
*/
{
- raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
- raster->fill_back = translate_fill( ctx->Polygon.BackMode );
+ if (ST_DEBUG & DEBUG_WIREFRAME) {
+ raster->fill_front = PIPE_POLYGON_MODE_LINE;
+ raster->fill_back = PIPE_POLYGON_MODE_LINE;
+ }
+ else {
+ raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
+ raster->fill_back = translate_fill( ctx->Polygon.BackMode );
+ }
/* Simplify when culling is active:
*/
@@ -234,6 +246,12 @@ static void update_raster_state( struct st_context *st )
raster->half_pixel_center = 1;
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
raster->bottom_edge_rule = 1;
+ /* _NEW_VIEWPORT */
+ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT)
+ raster->bottom_edge_rule ^= 1;
+
+ /* _NEW_VIEWPORT */
+ raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
/* ST_NEW_RASTERIZER */
raster->rasterizer_discard = ctx->RasterDiscard;
@@ -265,7 +283,8 @@ const struct st_tracked_state st_update_rasterizer = {
_NEW_PROGRAM |
_NEW_SCISSOR |
_NEW_FRAG_CLAMP |
- _NEW_TRANSFORM), /* mesa state dependencies*/
+ _NEW_TRANSFORM |
+ _NEW_VIEWPORT), /* mesa state dependencies*/
(ST_NEW_VERTEX_PROGRAM |
ST_NEW_RASTERIZER), /* state tracker dependencies */
},
diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
index 7584f9b3d..5b992084b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
@@ -27,6 +27,7 @@
#include "main/context.h"
+#include "main/viewport.h"
#include "st_context.h"
#include "st_atom.h"
#include "pipe/p_context.h"
@@ -63,21 +64,17 @@ update_viewport( struct st_context *st )
*/
for (i = 0; i < ctx->Const.MaxViewports; i++)
{
- GLfloat x = ctx->ViewportArray[i].X;
- GLfloat y = ctx->ViewportArray[i].Y;
- GLfloat z = ctx->ViewportArray[i].Near;
- GLfloat half_width = ctx->ViewportArray[i].Width * 0.5f;
- GLfloat half_height = ctx->ViewportArray[i].Height * 0.5f;
- GLfloat half_depth = (GLfloat)(ctx->ViewportArray[i].Far - ctx->ViewportArray[i].Near) * 0.5f;
-
- st->state.viewport[i].scale[0] = half_width;
- st->state.viewport[i].scale[1] = half_height * yScale;
- st->state.viewport[i].scale[2] = half_depth;
+ double scale[3], translate[3];
+ _mesa_get_viewport_xform(ctx, i, scale, translate);
+
+ st->state.viewport[i].scale[0] = scale[0];
+ st->state.viewport[i].scale[1] = scale[1] * yScale;
+ st->state.viewport[i].scale[2] = scale[2];
st->state.viewport[i].scale[3] = 1.0;
- st->state.viewport[i].translate[0] = half_width + x;
- st->state.viewport[i].translate[1] = (half_height + y) * yScale + yBias;
- st->state.viewport[i].translate[2] = half_depth + z;
+ st->state.viewport[i].translate[0] = translate[0];
+ st->state.viewport[i].translate[1] = translate[1] * yScale + yBias;
+ st->state.viewport[i].translate[2] = translate[2];
st->state.viewport[i].translate[3] = 0.0;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c
index 82e1fd14a..faff9c4bd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_program.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_program.c
@@ -242,7 +242,5 @@ st_init_program_functions(struct dd_function_table *functions)
functions->IsProgramNative = st_is_program_native;
functions->ProgramStringNotify = st_program_string_notify;
- functions->NewShader = st_new_shader;
- functions->NewShaderProgram = st_new_shader_program;
functions->LinkShader = st_link_shader;
}
diff --git a/mesalib/src/mesa/state_tracker/st_debug.c b/mesalib/src/mesa/state_tracker/st_debug.c
index 8c15e18d3..de3e3a9cd 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.c
+++ b/mesalib/src/mesa/state_tracker/st_debug.c
@@ -55,6 +55,7 @@ static const struct debug_named_value st_debug_flags[] = {
{ "query", DEBUG_QUERY, NULL },
{ "draw", DEBUG_DRAW, NULL },
{ "buffer", DEBUG_BUFFER, NULL },
+ { "wf", DEBUG_WIREFRAME, NULL },
DEBUG_NAMED_VALUE_END
};
diff --git a/mesalib/src/mesa/state_tracker/st_debug.h b/mesalib/src/mesa/state_tracker/st_debug.h
index c1c482524..49b916fb3 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.h
+++ b/mesalib/src/mesa/state_tracker/st_debug.h
@@ -46,6 +46,7 @@ st_print_current(void);
#define DEBUG_SCREEN 0x80
#define DEBUG_DRAW 0x100
#define DEBUG_BUFFER 0x200
+#define DEBUG_WIREFRAME 0x400
#ifdef DEBUG
extern int ST_DEBUG;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 5dd827800..aff3ddebe 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -192,6 +192,10 @@ void st_init_limits(struct pipe_screen *screen,
pc->MaxParameters = pc->MaxNativeParameters =
screen->get_shader_param(screen, sh,
PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) / sizeof(float[4]);
+ pc->MaxInputComponents =
+ screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS) * 4;
+ pc->MaxOutputComponents =
+ screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_OUTPUTS) * 4;
pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS);
@@ -261,10 +265,6 @@ void st_init_limits(struct pipe_screen *screen,
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_MAX_INPUTS);
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
- c->Program[MESA_SHADER_FRAGMENT].MaxInputComponents = c->MaxVarying * 4;
- c->Program[MESA_SHADER_VERTEX].MaxOutputComponents = c->MaxVarying * 4;
- c->Program[MESA_SHADER_GEOMETRY].MaxInputComponents = c->MaxVarying * 4;
- c->Program[MESA_SHADER_GEOMETRY].MaxOutputComponents = c->MaxVarying * 4;
c->MaxGeometryOutputVertices = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES);
c->MaxGeometryTotalOutputComponents = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS);
@@ -463,6 +463,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_derivative_control), PIPE_CAP_TGSI_FS_FINE_DERIVATIVE },
{ o(ARB_conditional_render_inverted), PIPE_CAP_CONDITIONAL_RENDER_INVERTED },
{ o(ARB_texture_view), PIPE_CAP_SAMPLER_VIEW_TARGET },
+ { o(ARB_clip_control), PIPE_CAP_CLIP_HALFZ },
};
/* Required: render target and sampler support */
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 a0da9f635..a4e2c8da5 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4781,15 +4781,19 @@ emit_wpos(struct st_context *st,
* saturating the value to [0,1] does the job.
*/
static void
-emit_face_var(struct st_translate *t)
+emit_face_var(struct gl_context *ctx, struct st_translate *t)
{
struct ureg_program *ureg = t->ureg;
struct ureg_dst face_temp = ureg_DECL_temporary(ureg);
struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]];
- /* MOV_SAT face_temp, input[face] */
- face_temp = ureg_saturate(face_temp);
- ureg_MOV(ureg, face_temp, face_input);
+ if (ctx->Const.NativeIntegers) {
+ ureg_FSGE(ureg, face_temp, face_input, ureg_imm1f(ureg, 0));
+ }
+ else {
+ /* MOV_SAT face_temp, input[face] */
+ ureg_MOV(ureg, ureg_saturate(face_temp), face_input);
+ }
/* Use face_temp as face input from here on: */
t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp);
@@ -4909,7 +4913,7 @@ st_translate_program(
}
if (proginfo->InputsRead & VARYING_BIT_FACE)
- emit_face_var(t);
+ emit_face_var(ctx, t);
/*
* Declare output attributes.
@@ -5210,6 +5214,7 @@ get_mesa_program(struct gl_context *ctx,
v->have_sqrt = pscreen->get_shader_param(pscreen, ptarget,
PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED);
+ _mesa_copy_linked_program_data(shader->Stage, shader_program, prog);
_mesa_generate_parameters_list_for_uniforms(shader_program, shader,
prog->Parameters);
@@ -5315,10 +5320,6 @@ get_mesa_program(struct gl_context *ctx,
case GL_GEOMETRY_SHADER:
stgp = (struct st_geometry_program *)prog;
stgp->glsl_to_tgsi = v;
- stgp->Base.InputType = shader_program->Geom.InputType;
- stgp->Base.OutputType = shader_program->Geom.OutputType;
- stgp->Base.VerticesOut = shader_program->Geom.VerticesOut;
- stgp->Base.Invocations = shader_program->Geom.Invocations;
break;
default:
assert(!"should not be reached");
@@ -5330,34 +5331,6 @@ get_mesa_program(struct gl_context *ctx,
extern "C" {
-struct gl_shader *
-st_new_shader(struct gl_context *ctx, GLuint name, GLuint type)
-{
- struct gl_shader *shader;
- assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER ||
- type == GL_GEOMETRY_SHADER_ARB);
- shader = rzalloc(NULL, struct gl_shader);
- if (shader) {
- shader->Type = type;
- shader->Stage = _mesa_shader_enum_to_shader_stage(type);
- shader->Name = name;
- _mesa_init_shader(ctx, shader);
- }
- return shader;
-}
-
-struct gl_shader_program *
-st_new_shader_program(struct gl_context *ctx, GLuint name)
-{
- struct gl_shader_program *shProg;
- shProg = rzalloc(NULL, struct gl_shader_program);
- if (shProg) {
- shProg->Name = name;
- _mesa_init_shader_program(ctx, shProg);
- }
- return shProg;
-}
-
/**
* Link a shader.
* Called via ctx->Driver.LinkShader()
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
index 18f666f5b..5ed640747 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -61,11 +61,6 @@ void get_bitmap_visitor(struct st_fragment_program *fp,
struct glsl_to_tgsi_visitor *original,
int samplerIndex);
-struct gl_shader *st_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
-
-struct gl_shader_program *
-st_new_shader_program(struct gl_context *ctx, GLuint name);
-
GLboolean st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
void
diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h
index 40ebf02da..ff37a7d63 100644
--- a/mesalib/src/util/macros.h
+++ b/mesalib/src/util/macros.h
@@ -75,6 +75,20 @@ do { \
#define unreachable(str)
#endif
+/**
+ * Assume macro. Useful for expressing our assumptions to the compiler,
+ * typically for purposes of silencing warnings.
+ */
+#ifdef HAVE___BUILTIN_UNREACHABLE
+#define assume(expr) ((expr) ? ((void) 0) \
+ : (assert(!"assumption failed"), \
+ __builtin_unreachable()))
+#elif _MSC_VER >= 1200
+#define assume(expr) __assume(expr)
+#else
+#define assume(expr) assert(expr)
+#endif
+
#ifdef HAVE_FUNC_ATTRIBUTE_FLATTEN
#define FLATTEN __attribute__((__flatten__))
#else
diff --git a/mesalib/src/util/register_allocate.c b/mesalib/src/util/register_allocate.c
index afab9ddd3..6cf7ce721 100644
--- a/mesalib/src/util/register_allocate.c
+++ b/mesalib/src/util/register_allocate.c
@@ -335,7 +335,7 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values)
for (i = 0; i < regs->regs[rc].num_conflicts; i++) {
unsigned int rb = regs->regs[rc].conflict_list[i];
- if (BITSET_TEST(regs->classes[b]->regs, rb))
+ if (reg_belongs_to_class(rb, regs->classes[b]))
conflicts++;
}
max_conflicts = MAX2(max_conflicts, conflicts);