aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r--mesalib/src/glsl/Android.mk2
-rw-r--r--mesalib/src/glsl/ast_array_index.cpp9
-rwxr-xr-xmesalib/src/glsl/builtin_functions.cpp48
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y3
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp3
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h2
-rwxr-xr-xmesalib/src/glsl/ir.cpp8
-rw-r--r--mesalib/src/glsl/ir.h4
-rwxr-xr-xmesalib/src/glsl/ir_constant_expression.cpp4
-rw-r--r--mesalib/src/glsl/ir_set_program_inouts.cpp4
-rw-r--r--mesalib/src/glsl/ir_validate.cpp4
-rw-r--r--mesalib/src/glsl/link_functions.cpp2
-rw-r--r--mesalib/src/glsl/link_uniform_initializers.cpp27
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp5
-rw-r--r--mesalib/src/glsl/link_varyings.cpp2
-rw-r--r--mesalib/src/glsl/linker.cpp6
-rw-r--r--mesalib/src/glsl/linker.h6
-rw-r--r--mesalib/src/glsl/opt_vectorize.cpp13
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.cpp2
-rw-r--r--mesalib/src/glsl/test_optpass.cpp2
20 files changed, 131 insertions, 25 deletions
diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk
index 8a3942652..7b1fa7e53 100644
--- a/mesalib/src/glsl/Android.mk
+++ b/mesalib/src/glsl/Android.mk
@@ -39,12 +39,12 @@ LOCAL_SRC_FILES := \
$(LIBGLSL_FILES)
LOCAL_C_INCLUDES := \
- external/astl/include \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa
LOCAL_MODULE := libmesa_glsl
+include external/stlport/libstlport.mk
include $(LOCAL_PATH)/Android.gen.mk
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp
index 50f9987c8..5ca85f6ab 100644
--- a/mesalib/src/glsl/ast_array_index.cpp
+++ b/mesalib/src/glsl/ast_array_index.cpp
@@ -213,6 +213,13 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
* as using a loop counter as the index to an array of samplers. If the
* loop in unrolled, the code should compile correctly. Instead, emit a
* warning.
+ *
+ * In GLSL 4.00 / ARB_gpu_shader5, this requirement is relaxed again to allow
+ * indexing with dynamically uniform expressions. Note that these are not
+ * required to be uniforms or expressions based on them, but merely that the
+ * values must not diverge between shader invocations run together. If the
+ * values *do* diverge, then the behavior of the operation requiring a
+ * dynamically uniform expression is undefined.
*/
if (array->type->element_type()->is_sampler()) {
if (!state->is_version(130, 100)) {
@@ -227,7 +234,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
"expressions will be forbidden in GLSL 1.30 "
"and later");
}
- } else {
+ } else if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
_mesa_glsl_error(&loc, state,
"sampler arrays indexed with non-constant "
"expressions is forbidden in GLSL 1.30 and "
diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp
index 0cf97dc43..2cc714a98 100755
--- a/mesalib/src/glsl/builtin_functions.cpp
+++ b/mesalib/src/glsl/builtin_functions.cpp
@@ -318,6 +318,14 @@ fs_oes_derivatives(const _mesa_glsl_parse_state *state)
}
static bool
+fs_derivative_control(const _mesa_glsl_parse_state *state)
+{
+ return state->stage == MESA_SHADER_FRAGMENT &&
+ (state->is_version(450, 0) ||
+ state->ARB_derivative_control_enable);
+}
+
+static bool
tex1d_lod(const _mesa_glsl_parse_state *state)
{
return !state->es_shader && lod_exists_in_stage(state);
@@ -618,6 +626,12 @@ private:
B1(dFdx);
B1(dFdy);
B1(fwidth);
+ B1(dFdxCoarse);
+ B1(dFdyCoarse);
+ B1(fwidthCoarse);
+ B1(dFdxFine);
+ B1(dFdyFine);
+ B1(fwidthFine);
B1(noise1);
B1(noise2);
B1(noise3);
@@ -2148,6 +2162,12 @@ builtin_builder::create_builtins()
F(dFdx)
F(dFdy)
F(fwidth)
+ F(dFdxCoarse)
+ F(dFdyCoarse)
+ F(fwidthCoarse)
+ F(dFdxFine)
+ F(dFdyFine)
+ F(fwidthFine)
F(noise1)
F(noise2)
F(noise3)
@@ -4010,7 +4030,11 @@ builtin_builder::_textureQueryLevels(const glsl_type *sampler_type)
}
UNOP(dFdx, ir_unop_dFdx, fs_oes_derivatives)
+UNOP(dFdxCoarse, ir_unop_dFdx_coarse, fs_derivative_control)
+UNOP(dFdxFine, ir_unop_dFdx_fine, fs_derivative_control)
UNOP(dFdy, ir_unop_dFdy, fs_oes_derivatives)
+UNOP(dFdyCoarse, ir_unop_dFdy_coarse, fs_derivative_control)
+UNOP(dFdyFine, ir_unop_dFdy_fine, fs_derivative_control)
ir_function_signature *
builtin_builder::_fwidth(const glsl_type *type)
@@ -4024,6 +4048,30 @@ builtin_builder::_fwidth(const glsl_type *type)
}
ir_function_signature *
+builtin_builder::_fwidthCoarse(const glsl_type *type)
+{
+ ir_variable *p = in_var(type, "p");
+ MAKE_SIG(type, fs_derivative_control, 1, p);
+
+ body.emit(ret(add(abs(expr(ir_unop_dFdx_coarse, p)),
+ abs(expr(ir_unop_dFdy_coarse, p)))));
+
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_fwidthFine(const glsl_type *type)
+{
+ ir_variable *p = in_var(type, "p");
+ MAKE_SIG(type, fs_derivative_control, 1, p);
+
+ body.emit(ret(add(abs(expr(ir_unop_dFdx_fine, p)),
+ abs(expr(ir_unop_dFdy_fine, p)))));
+
+ return sig;
+}
+
+ir_function_signature *
builtin_builder::_noise1(const glsl_type *type)
{
return unop(v110, ir_unop_noise, glsl_type::float_type, type);
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index a61697394..f1119eb80 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -2469,6 +2469,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions->ARB_shader_image_load_store)
add_builtin_define(parser, "GL_ARB_shader_image_load_store", 1);
+
+ if (extensions->ARB_derivative_control)
+ add_builtin_define(parser, "GL_ARB_derivative_control", 1);
}
}
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 2d94d3554..490c3c8ee 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -514,6 +514,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(ARB_arrays_of_arrays, true, false, ARB_arrays_of_arrays),
EXT(ARB_compute_shader, true, false, ARB_compute_shader),
EXT(ARB_conservative_depth, true, false, ARB_conservative_depth),
+ EXT(ARB_derivative_control, true, false, ARB_derivative_control),
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),
@@ -1472,7 +1473,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
if (!state->error && !shader->ir->is_empty()) {
struct gl_shader_compiler_options *options =
- &ctx->ShaderCompilerOptions[shader->Stage];
+ &ctx->Const.ShaderCompilerOptions[shader->Stage];
/* Do some optimization at compile time to reduce shader IR size
* and reduce later work if the same shader is linked multiple times
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index ab5c006f5..d0299a760 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -397,6 +397,8 @@ struct _mesa_glsl_parse_state {
bool ARB_compute_shader_warn;
bool ARB_conservative_depth_enable;
bool ARB_conservative_depth_warn;
+ bool ARB_derivative_control_enable;
+ bool ARB_derivative_control_warn;
bool ARB_draw_buffers_enable;
bool ARB_draw_buffers_warn;
bool ARB_draw_instanced_enable;
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index 578548b23..c7029dc4c 100755
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
@@ -248,7 +248,11 @@ ir_expression::ir_expression(int op, ir_rvalue *op0)
case ir_unop_sin_reduced:
case ir_unop_cos_reduced:
case ir_unop_dFdx:
+ case ir_unop_dFdx_coarse:
+ case ir_unop_dFdx_fine:
case ir_unop_dFdy:
+ case ir_unop_dFdy_coarse:
+ case ir_unop_dFdy_fine:
case ir_unop_bitfield_reverse:
case ir_unop_interpolate_at_centroid:
this->type = op0->type;
@@ -509,7 +513,11 @@ static const char *const operator_strs[] = {
"sin_reduced",
"cos_reduced",
"dFdx",
+ "dFdxCoarse",
+ "dFdxFine",
"dFdy",
+ "dFdyCoarse",
+ "dFdyFine",
"packSnorm2x16",
"packSnorm4x8",
"packUnorm2x16",
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index 31c354556..18623b968 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -1205,7 +1205,11 @@ enum ir_expression_operation {
*/
/*@{*/
ir_unop_dFdx,
+ ir_unop_dFdx_coarse,
+ ir_unop_dFdx_fine,
ir_unop_dFdy,
+ ir_unop_dFdy_coarse,
+ ir_unop_dFdy_fine,
/*@}*/
/**
diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp
index 13aa2b5bd..eff2bc173 100755
--- a/mesalib/src/glsl/ir_constant_expression.cpp
+++ b/mesalib/src/glsl/ir_constant_expression.cpp
@@ -844,7 +844,11 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
break;
case ir_unop_dFdx:
+ case ir_unop_dFdx_coarse:
+ case ir_unop_dFdx_fine:
case ir_unop_dFdy:
+ case ir_unop_dFdy_coarse:
+ case ir_unop_dFdy_fine:
assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
for (unsigned c = 0; c < op[0]->type->components(); c++) {
data.f[c] = 0.0;
diff --git a/mesalib/src/glsl/ir_set_program_inouts.cpp b/mesalib/src/glsl/ir_set_program_inouts.cpp
index 5163eb215..97ead750a 100644
--- a/mesalib/src/glsl/ir_set_program_inouts.cpp
+++ b/mesalib/src/glsl/ir_set_program_inouts.cpp
@@ -306,7 +306,9 @@ ir_visitor_status
ir_set_program_inouts_visitor::visit_enter(ir_expression *ir)
{
if (this->shader_stage == MESA_SHADER_FRAGMENT &&
- ir->operation == ir_unop_dFdy) {
+ (ir->operation == ir_unop_dFdy ||
+ ir->operation == ir_unop_dFdy_coarse ||
+ ir->operation == ir_unop_dFdy_fine)) {
gl_fragment_program *fprog = (gl_fragment_program *) prog;
fprog->UsesDFdy = true;
}
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index 4f85b7db8..5b2067782 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -317,7 +317,11 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_sin_reduced:
case ir_unop_cos_reduced:
case ir_unop_dFdx:
+ case ir_unop_dFdx_coarse:
+ case ir_unop_dFdx_fine:
case ir_unop_dFdy:
+ case ir_unop_dFdy_coarse:
+ case ir_unop_dFdy_fine:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
assert(ir->operands[0]->type == ir->type);
break;
diff --git a/mesalib/src/glsl/link_functions.cpp b/mesalib/src/glsl/link_functions.cpp
index f86aec689..d62c16853 100644
--- a/mesalib/src/glsl/link_functions.cpp
+++ b/mesalib/src/glsl/link_functions.cpp
@@ -154,6 +154,8 @@ public:
linked_sig->replace_parameters(&formal_parameters);
+ linked_sig->is_intrinsic = sig->is_intrinsic;
+
if (sig->is_defined) {
foreach_in_list(const ir_instruction, original, &sig->body) {
ir_instruction *copy = original->clone(linked, ht);
diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp
index c6fe6a9ad..f6a60bce9 100644
--- a/mesalib/src/glsl/link_uniform_initializers.cpp
+++ b/mesalib/src/glsl/link_uniform_initializers.cpp
@@ -60,7 +60,8 @@ void
copy_constant_to_storage(union gl_constant_value *storage,
const ir_constant *val,
const enum glsl_base_type base_type,
- const unsigned int elements)
+ const unsigned int elements,
+ unsigned int boolean_true)
{
for (unsigned int i = 0; i < elements; i++) {
switch (base_type) {
@@ -75,7 +76,7 @@ copy_constant_to_storage(union gl_constant_value *storage,
storage[i].f = val->value.f[i];
break;
case GLSL_TYPE_BOOL:
- storage[i].b = int(val->value.b[i]);
+ storage[i].b = val->value.b[i] ? boolean_true : 0;
break;
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_STRUCT:
@@ -156,7 +157,7 @@ set_block_binding(gl_shader_program *prog, const char *block_name, int binding)
void
set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
const char *name, const glsl_type *type,
- ir_constant *val)
+ ir_constant *val, unsigned int boolean_true)
{
if (type->is_record()) {
ir_constant *field_constant;
@@ -168,7 +169,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name,
type->fields.structure[i].name);
set_uniform_initializer(mem_ctx, prog, field_name,
- field_type, field_constant);
+ field_type, field_constant, boolean_true);
field_constant = (ir_constant *)field_constant->next;
}
return;
@@ -179,7 +180,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
const char *element_name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i);
set_uniform_initializer(mem_ctx, prog, element_name,
- element_type, val->array_elements[i]);
+ element_type, val->array_elements[i],
+ boolean_true);
}
return;
}
@@ -204,7 +206,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
copy_constant_to_storage(& storage->storage[idx],
val->array_elements[i],
base_type,
- elements);
+ elements,
+ boolean_true);
idx += elements;
}
@@ -212,7 +215,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
copy_constant_to_storage(storage->storage,
val,
val->type->base_type,
- val->type->components());
+ val->type->components(),
+ boolean_true);
if (storage->type->is_sampler()) {
for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
@@ -232,7 +236,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
}
void
-link_set_uniform_initializers(struct gl_shader_program *prog)
+link_set_uniform_initializers(struct gl_shader_program *prog,
+ unsigned int boolean_true)
{
void *mem_ctx = NULL;
@@ -254,8 +259,7 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
if (var->data.explicit_binding) {
const glsl_type *const type = var->type;
- if (type->is_sampler()
- || (type->is_array() && type->fields.array->is_sampler())) {
+ if (type->without_array()->is_sampler()) {
linker::set_sampler_binding(prog, var->name, var->data.binding);
} else if (var->is_in_uniform_block()) {
const glsl_type *const iface_type = var->get_interface_type();
@@ -301,7 +305,8 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
}
} else if (var->constant_value) {
linker::set_uniform_initializer(mem_ctx, prog, var->name,
- var->type, var->constant_value);
+ var->type, var->constant_value,
+ boolean_true);
}
}
}
diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp
index a127ee7f5..f1484617b 100644
--- a/mesalib/src/glsl/link_uniforms.cpp
+++ b/mesalib/src/glsl/link_uniforms.cpp
@@ -841,7 +841,8 @@ link_set_image_access_qualifiers(struct gl_shader_program *prog)
}
void
-link_assign_uniform_locations(struct gl_shader_program *prog)
+link_assign_uniform_locations(struct gl_shader_program *prog,
+ unsigned int boolean_true)
{
ralloc_free(prog->UniformStorage);
prog->UniformStorage = NULL;
@@ -1013,7 +1014,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
prog->UniformStorage = uniforms;
link_set_image_access_qualifiers(prog);
- link_set_uniform_initializers(prog);
+ link_set_uniform_initializers(prog, boolean_true);
return;
}
diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp
index 1438a4b16..54ceae1b9 100644
--- a/mesalib/src/glsl/link_varyings.cpp
+++ b/mesalib/src/glsl/link_varyings.cpp
@@ -329,7 +329,7 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx,
* class must behave specially to account for the fact that gl_ClipDistance
* is converted from a float[8] to a vec4[2].
*/
- if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance &&
+ if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance &&
strcmp(this->var_name, "gl_ClipDistance") == 0) {
this->is_clip_distance_mesa = true;
}
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 0096fb023..d5473adc3 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -2660,12 +2660,12 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (!prog->LinkStatus)
goto done;
- if (ctx->ShaderCompilerOptions[i].LowerClipDistance) {
+ if (ctx->Const.ShaderCompilerOptions[i].LowerClipDistance) {
lower_clip_distance(prog->_LinkedShaders[i]);
}
while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
- &ctx->ShaderCompilerOptions[i],
+ &ctx->Const.ShaderCompilerOptions[i],
ctx->Const.NativeIntegers))
;
}
@@ -2821,7 +2821,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
update_array_sizes(prog);
- link_assign_uniform_locations(prog);
+ link_assign_uniform_locations(prog, ctx->Const.UniformBooleanTrue);
link_assign_atomic_counter_resources(ctx, prog);
store_fragdepth_layout(prog);
diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h
index 8851da6c8..beb9bb216 100644
--- a/mesalib/src/glsl/linker.h
+++ b/mesalib/src/glsl/linker.h
@@ -34,10 +34,12 @@ extern void
link_invalidate_variable_locations(exec_list *ir);
extern void
-link_assign_uniform_locations(struct gl_shader_program *prog);
+link_assign_uniform_locations(struct gl_shader_program *prog,
+ unsigned int boolean_true);
extern void
-link_set_uniform_initializers(struct gl_shader_program *prog);
+link_set_uniform_initializers(struct gl_shader_program *prog,
+ unsigned int boolean_true);
extern int
link_cross_validate_uniform_block(void *mem_ctx,
diff --git a/mesalib/src/glsl/opt_vectorize.cpp b/mesalib/src/glsl/opt_vectorize.cpp
index 28534a86a..2f71a8358 100644
--- a/mesalib/src/glsl/opt_vectorize.cpp
+++ b/mesalib/src/glsl/opt_vectorize.cpp
@@ -86,6 +86,7 @@ public:
virtual ir_visitor_status visit_enter(ir_expression *);
virtual ir_visitor_status visit_enter(ir_if *);
virtual ir_visitor_status visit_enter(ir_loop *);
+ virtual ir_visitor_status visit_enter(ir_texture *);
virtual ir_visitor_status visit_leave(ir_assignment *);
@@ -352,6 +353,18 @@ ir_vectorize_visitor::visit_enter(ir_loop *ir)
}
/**
+ * Upon entering an ir_texture, remove the current assignment from
+ * further consideration. Vectorizing multiple texture lookups into one
+ * is wrong.
+ */
+ir_visitor_status
+ir_vectorize_visitor::visit_enter(ir_texture *)
+{
+ this->current_assignment = NULL;
+ return visit_continue_with_parent;
+}
+
+/**
* Upon leaving an ir_assignment, save a pointer to it in ::assignment[] if
* the swizzle mask(s) found were appropriate. Also save a pointer in
* ::last_assignment so that we can compare future assignments with it.
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index abdd83a44..2b76dd17b 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -164,5 +164,5 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
options.DefaultPragmas.Optimize = true;
for (int sh = 0; sh < MESA_SHADER_STAGES; ++sh)
- memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options));
+ memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options));
}
diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp
index e4878bf15..24c06f11b 100644
--- a/mesalib/src/glsl/test_optpass.cpp
+++ b/mesalib/src/glsl/test_optpass.cpp
@@ -242,7 +242,7 @@ int test_optpass(int argc, char **argv)
if (!state->error) {
GLboolean progress;
const struct gl_shader_compiler_options *options =
- &ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader_type)];
+ &ctx->Const.ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader_type)];
do {
progress = do_optimization_passes(shader->ir, &argv[optind],
argc - optind, quiet != 0, options);