aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r--mesalib/src/glsl/builtin_functions.cpp96
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y3
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp1
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h2
-rw-r--r--mesalib/src/glsl/ir.cpp4
-rw-r--r--mesalib/src/glsl/ir.h7
-rw-r--r--mesalib/src/glsl/ir_clone.cpp5
-rw-r--r--mesalib/src/glsl/ir_constant_expression.cpp6
-rw-r--r--mesalib/src/glsl/ir_hv_accept.cpp7
-rw-r--r--mesalib/src/glsl/ir_print_visitor.cpp11
-rw-r--r--mesalib/src/glsl/ir_reader.cpp18
-rw-r--r--mesalib/src/glsl/ir_rvalue_visitor.cpp5
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp4
-rw-r--r--mesalib/src/glsl/opt_tree_grafting.cpp6
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.cpp1
15 files changed, 160 insertions, 16 deletions
diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp
index df735ef31..b6451089c 100644
--- a/mesalib/src/glsl/builtin_functions.cpp
+++ b/mesalib/src/glsl/builtin_functions.cpp
@@ -256,6 +256,13 @@ texture_cube_map_array(const _mesa_glsl_parse_state *state)
}
static bool
+texture_query_levels(const _mesa_glsl_parse_state *state)
+{
+ return state->is_version(430, 0) ||
+ state->ARB_texture_query_levels_enable;
+}
+
+static bool
texture_query_lod(const _mesa_glsl_parse_state *state)
{
return state->target == fragment_shader &&
@@ -266,7 +273,8 @@ static bool
texture_gather(const _mesa_glsl_parse_state *state)
{
return state->is_version(400, 0) ||
- state->ARB_texture_gather_enable;
+ state->ARB_texture_gather_enable ||
+ state->ARB_gpu_shader5_enable;
}
/* Desktop GL or OES_standard_derivatives + fragment shader only */
@@ -486,6 +494,7 @@ private:
/** Flags to _texture() */
#define TEX_PROJECT 1
#define TEX_OFFSET 2
+#define TEX_COMPONENT 4
ir_function_signature *_texture(ir_texture_opcode opcode,
builtin_available_predicate avail,
@@ -504,6 +513,7 @@ private:
B0(EndPrimitive)
B2(textureQueryLod);
+ B1(textureQueryLevels);
B1(dFdx);
B1(dFdy);
B1(fwidth);
@@ -1603,6 +1613,39 @@ builtin_builder::create_builtins()
_textureQueryLod(glsl_type::samplerCubeArrayShadow_type, glsl_type::vec3_type),
NULL);
+ add_function("textureQueryLevels",
+ _textureQueryLevels(glsl_type::sampler1D_type),
+ _textureQueryLevels(glsl_type::sampler2D_type),
+ _textureQueryLevels(glsl_type::sampler3D_type),
+ _textureQueryLevels(glsl_type::samplerCube_type),
+ _textureQueryLevels(glsl_type::sampler1DArray_type),
+ _textureQueryLevels(glsl_type::sampler2DArray_type),
+ _textureQueryLevels(glsl_type::samplerCubeArray_type),
+ _textureQueryLevels(glsl_type::sampler1DShadow_type),
+ _textureQueryLevels(glsl_type::sampler2DShadow_type),
+ _textureQueryLevels(glsl_type::samplerCubeShadow_type),
+ _textureQueryLevels(glsl_type::sampler1DArrayShadow_type),
+ _textureQueryLevels(glsl_type::sampler2DArrayShadow_type),
+ _textureQueryLevels(glsl_type::samplerCubeArrayShadow_type),
+
+ _textureQueryLevels(glsl_type::isampler1D_type),
+ _textureQueryLevels(glsl_type::isampler2D_type),
+ _textureQueryLevels(glsl_type::isampler3D_type),
+ _textureQueryLevels(glsl_type::isamplerCube_type),
+ _textureQueryLevels(glsl_type::isampler1DArray_type),
+ _textureQueryLevels(glsl_type::isampler2DArray_type),
+ _textureQueryLevels(glsl_type::isamplerCubeArray_type),
+
+ _textureQueryLevels(glsl_type::usampler1D_type),
+ _textureQueryLevels(glsl_type::usampler2D_type),
+ _textureQueryLevels(glsl_type::usampler3D_type),
+ _textureQueryLevels(glsl_type::usamplerCube_type),
+ _textureQueryLevels(glsl_type::usampler1DArray_type),
+ _textureQueryLevels(glsl_type::usampler2DArray_type),
+ _textureQueryLevels(glsl_type::usamplerCubeArray_type),
+
+ NULL);
+
add_function("texture1D",
_texture(ir_tex, v110, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
_texture(ir_txb, v110_fs_only, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
@@ -1828,6 +1871,10 @@ builtin_builder::create_builtins()
_texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type),
_texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type),
+ _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2DRect_type, glsl_type::vec2_type),
+ _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isampler2DRect_type, glsl_type::vec2_type),
+ _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usampler2DRect_type, glsl_type::vec2_type),
+
_texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type),
_texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type),
_texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type),
@@ -1839,6 +1886,26 @@ builtin_builder::create_builtins()
_texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type),
_texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type),
_texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type),
+
+ _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec2_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_COMPONENT),
+
+ _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2DRect_type, glsl_type::vec2_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isampler2DRect_type, glsl_type::vec2_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usampler2DRect_type, glsl_type::vec2_type, TEX_COMPONENT),
+
+ _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_COMPONENT),
+
+ _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::samplerCube_type, glsl_type::vec3_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_COMPONENT),
+
+ _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
NULL);
add_function("textureGatherOffset",
@@ -3281,6 +3348,18 @@ builtin_builder::_texture(ir_texture_opcode opcode,
tex->offset = var_ref(offset);
}
+ if (opcode == ir_tg4) {
+ if (flags & TEX_COMPONENT) {
+ ir_variable *component =
+ new(mem_ctx) ir_variable(glsl_type::int_type, "comp", ir_var_const_in);
+ sig->parameters.push_tail(component);
+ tex->lod_info.component = var_ref(component);
+ }
+ else {
+ tex->lod_info.component = imm(0);
+ }
+ }
+
/* The "bias" parameter comes /after/ the "offset" parameter, which is
* inconsistent with both textureLodOffset and textureGradOffset.
*/
@@ -3393,6 +3472,21 @@ builtin_builder::_textureQueryLod(const glsl_type *sampler_type,
return sig;
}
+ir_function_signature *
+builtin_builder::_textureQueryLevels(const glsl_type *sampler_type)
+{
+ ir_variable *s = in_var(sampler_type, "sampler");
+ const glsl_type *return_type = glsl_type::int_type;
+ MAKE_SIG(return_type, texture_query_levels, 1, s);
+
+ ir_texture *tex = new(mem_ctx) ir_texture(ir_query_levels);
+ tex->set_sampler(var_ref(s), return_type);
+
+ body.emit(ret(tex));
+
+ return sig;
+}
+
UNOP(dFdx, ir_unop_dFdx, fs_oes_derivatives)
UNOP(dFdy, ir_unop_dFdy, fs_oes_derivatives)
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index c7ad3e958..02100ab0c 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -1234,6 +1234,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
if (extensions->ARB_texture_multisample)
add_builtin_define(parser, "GL_ARB_texture_multisample", 1);
+ if (extensions->ARB_texture_query_levels)
+ add_builtin_define(parser, "GL_ARB_texture_query_levels", 1);
+
if (extensions->ARB_texture_query_lod)
add_builtin_define(parser, "GL_ARB_texture_query_lod", 1);
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 7368a7156..ad85db9e3 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -518,6 +518,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(ARB_shading_language_packing, true, false, ARB_shading_language_packing),
EXT(ARB_shading_language_420pack, true, false, ARB_shading_language_420pack),
EXT(ARB_texture_multisample, true, false, ARB_texture_multisample),
+ EXT(ARB_texture_query_levels, true, false, ARB_texture_query_levels),
EXT(ARB_texture_query_lod, true, false, ARB_texture_query_lod),
EXT(ARB_gpu_shader5, true, false, ARB_gpu_shader5),
EXT(AMD_vertex_shader_layer, true, false, AMD_vertex_shader_layer),
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 9c3e88721..dba1a35e5 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -304,6 +304,8 @@ struct _mesa_glsl_parse_state {
bool ARB_shading_language_packing_warn;
bool ARB_texture_multisample_enable;
bool ARB_texture_multisample_warn;
+ bool ARB_texture_query_levels_enable;
+ bool ARB_texture_query_levels_warn;
bool ARB_texture_query_lod_enable;
bool ARB_texture_query_lod_warn;
bool ARB_gpu_shader5_enable;
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index 81c6380ca..ae67d6bdd 100644
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
@@ -1374,7 +1374,7 @@ ir_dereference::is_lvalue() const
}
-static const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txf_ms", "txs", "lod", "tg4" };
+static const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txf_ms", "txs", "lod", "tg4", "query_levels" };
const char *ir_texture::opcode_string()
{
@@ -1403,7 +1403,7 @@ ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
this->sampler = sampler;
this->type = type;
- if (this->op == ir_txs) {
+ if (this->op == ir_txs || this->op == ir_query_levels) {
assert(type->base_type == GLSL_TYPE_INT);
} else if (this->op == ir_lod) {
assert(type->vector_elements == 2);
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index 885837a7a..1a4a3a2e3 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -1560,7 +1560,8 @@ enum ir_texture_opcode {
ir_txf_ms, /**< Multisample texture fetch */
ir_txs, /**< Texture size */
ir_lod, /**< Texture lod query */
- ir_tg4 /**< Texture gather */
+ ir_tg4, /**< Texture gather */
+ ir_query_levels /**< Texture levels query */
};
@@ -1585,7 +1586,8 @@ enum ir_texture_opcode {
* <type> <sampler> <coordinate> <sample_index>)
* (txs <type> <sampler> <lod>)
* (lod <type> <sampler> <coordinate>)
- * (tg4 <type> <sampler> <coordinate> 0)
+ * (tg4 <type> <sampler> <coordinate> <offset> <component>)
+ * (query_levels <type> <sampler>)
*/
class ir_texture : public ir_rvalue {
public:
@@ -1653,6 +1655,7 @@ public:
ir_rvalue *lod; /**< Floating point LOD */
ir_rvalue *bias; /**< Floating point LOD bias */
ir_rvalue *sample_index; /**< MSAA sample index */
+ ir_rvalue *component; /**< Gather component selector */
struct {
ir_rvalue *dPdx; /**< Partial derivative of coordinate wrt X */
ir_rvalue *dPdy; /**< Partial derivative of coordinate wrt Y */
diff --git a/mesalib/src/glsl/ir_clone.cpp b/mesalib/src/glsl/ir_clone.cpp
index fe531a8e3..dde22e018 100644
--- a/mesalib/src/glsl/ir_clone.cpp
+++ b/mesalib/src/glsl/ir_clone.cpp
@@ -248,7 +248,7 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const
switch (this->op) {
case ir_tex:
case ir_lod:
- case ir_tg4:
+ case ir_query_levels:
break;
case ir_txb:
new_tex->lod_info.bias = this->lod_info.bias->clone(mem_ctx, ht);
@@ -265,6 +265,9 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const
new_tex->lod_info.grad.dPdx = this->lod_info.grad.dPdx->clone(mem_ctx, ht);
new_tex->lod_info.grad.dPdy = this->lod_info.grad.dPdy->clone(mem_ctx, ht);
break;
+ case ir_tg4:
+ new_tex->lod_info.component = this->lod_info.component->clone(mem_ctx, ht);
+ break;
}
return new_tex;
diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp
index 12641e5df..0efd1d5b3 100644
--- a/mesalib/src/glsl/ir_constant_expression.cpp
+++ b/mesalib/src/glsl/ir_constant_expression.cpp
@@ -45,6 +45,12 @@ static int isnormal(double x)
{
return _fpclass(x) == _FPCLASS_NN || _fpclass(x) == _FPCLASS_PN;
}
+#elif defined(__SUNPRO_CC)
+#include <ieeefp.h>
+static int isnormal(double x)
+{
+ return fpclass(x) == FP_NORMAL;
+}
#endif
#if defined(_MSC_VER)
diff --git a/mesalib/src/glsl/ir_hv_accept.cpp b/mesalib/src/glsl/ir_hv_accept.cpp
index 3877e721c..941b25e97 100644
--- a/mesalib/src/glsl/ir_hv_accept.cpp
+++ b/mesalib/src/glsl/ir_hv_accept.cpp
@@ -214,7 +214,7 @@ ir_texture::accept(ir_hierarchical_visitor *v)
switch (this->op) {
case ir_tex:
case ir_lod:
- case ir_tg4:
+ case ir_query_levels:
break;
case ir_txb:
s = this->lod_info.bias->accept(v);
@@ -242,6 +242,11 @@ ir_texture::accept(ir_hierarchical_visitor *v)
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
break;
+ case ir_tg4:
+ s = this->lod_info.component->accept(v);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+ break;
}
return (s == visit_stop) ? s : v->visit_leave(this);
diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp
index 2c06b95f6..f85e573c4 100644
--- a/mesalib/src/glsl/ir_print_visitor.cpp
+++ b/mesalib/src/glsl/ir_print_visitor.cpp
@@ -252,7 +252,7 @@ void ir_print_visitor::visit(ir_texture *ir)
ir->sampler->accept(this);
printf(" ");
- if (ir->op != ir_txs) {
+ if (ir->op != ir_txs && ir->op != ir_query_levels) {
ir->coordinate->accept(this);
printf(" ");
@@ -266,7 +266,9 @@ void ir_print_visitor::visit(ir_texture *ir)
printf(" ");
}
- if (ir->op != ir_txf && ir->op != ir_txf_ms && ir->op != ir_txs && ir->op != ir_tg4) {
+ if (ir->op != ir_txf && ir->op != ir_txf_ms &&
+ ir->op != ir_txs && ir->op != ir_tg4 &&
+ ir->op != ir_query_levels) {
if (ir->projector)
ir->projector->accept(this);
else
@@ -285,7 +287,7 @@ void ir_print_visitor::visit(ir_texture *ir)
{
case ir_tex:
case ir_lod:
- case ir_tg4:
+ case ir_query_levels:
break;
case ir_txb:
ir->lod_info.bias->accept(this);
@@ -305,6 +307,9 @@ void ir_print_visitor::visit(ir_texture *ir)
ir->lod_info.grad.dPdy->accept(this);
printf(")");
break;
+ case ir_tg4:
+ ir->lod_info.component->accept(this);
+ break;
};
printf(")");
}
diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp
index 8038b8f5d..00e2db9a3 100644
--- a/mesalib/src/glsl/ir_reader.cpp
+++ b/mesalib/src/glsl/ir_reader.cpp
@@ -934,6 +934,7 @@ ir_reader::read_texture(s_expression *expr)
s_list *s_shadow = NULL;
s_expression *s_lod = NULL;
s_expression *s_sample_index = NULL;
+ s_expression *s_component = NULL;
ir_texture_opcode op = ir_tex; /* silence warning */
@@ -948,7 +949,9 @@ ir_reader::read_texture(s_expression *expr)
s_pattern txs_pattern[] =
{ "txs", s_type, s_sampler, s_lod };
s_pattern tg4_pattern[] =
- { "tg4", s_type, s_sampler, s_coord, s_offset };
+ { "tg4", s_type, s_sampler, s_coord, s_offset, s_component };
+ s_pattern query_levels_pattern[] =
+ { "query_levels", s_type, s_sampler };
s_pattern other_pattern[] =
{ tag, s_type, s_sampler, s_coord, s_offset, s_proj, s_shadow, s_lod };
@@ -964,6 +967,8 @@ ir_reader::read_texture(s_expression *expr)
op = ir_txs;
} else if (MATCH(expr, tg4_pattern)) {
op = ir_tg4;
+ } else if (MATCH(expr, query_levels_pattern)) {
+ op = ir_query_levels;
} else if (MATCH(expr, other_pattern)) {
op = ir_texture::get_opcode(tag->value());
if (op == -1)
@@ -1014,7 +1019,9 @@ ir_reader::read_texture(s_expression *expr)
}
}
- if (op != ir_txf && op != ir_txf_ms && op != ir_txs && op != ir_lod && op != ir_tg4) {
+ if (op != ir_txf && op != ir_txf_ms &&
+ op != ir_txs && op != ir_lod && op != ir_tg4 &&
+ op != ir_query_levels) {
s_int *proj_as_int = SX_AS_INT(s_proj);
if (proj_as_int && proj_as_int->value() == 1) {
tex->projector = NULL;
@@ -1083,6 +1090,13 @@ ir_reader::read_texture(s_expression *expr)
}
break;
}
+ case ir_tg4:
+ tex->lod_info.component = read_rvalue(s_component);
+ if (tex->lod_info.component == NULL) {
+ ir_read_error(NULL, "when reading component in (tg4 ...)");
+ return NULL;
+ }
+ break;
default:
// tex and lod don't have any extra parameters.
break;
diff --git a/mesalib/src/glsl/ir_rvalue_visitor.cpp b/mesalib/src/glsl/ir_rvalue_visitor.cpp
index 4c3d81320..9d8ccd94a 100644
--- a/mesalib/src/glsl/ir_rvalue_visitor.cpp
+++ b/mesalib/src/glsl/ir_rvalue_visitor.cpp
@@ -57,7 +57,7 @@ ir_rvalue_base_visitor::rvalue_visit(ir_texture *ir)
switch (ir->op) {
case ir_tex:
case ir_lod:
- case ir_tg4:
+ case ir_query_levels:
break;
case ir_txb:
handle_rvalue(&ir->lod_info.bias);
@@ -74,6 +74,9 @@ ir_rvalue_base_visitor::rvalue_visit(ir_texture *ir)
handle_rvalue(&ir->lod_info.grad.dPdx);
handle_rvalue(&ir->lod_info.grad.dPdy);
break;
+ case ir_tg4:
+ handle_rvalue(&ir->lod_info.component);
+ break;
}
return visit_continue;
diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp
index 03cbcd1ce..1cdd5a922 100644
--- a/mesalib/src/glsl/link_uniforms.cpp
+++ b/mesalib/src/glsl/link_uniforms.cpp
@@ -140,8 +140,8 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
/* Append the subscript to the current variable name */
ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", i);
- recursion(t->fields.array, name, new_length,
- t->fields.structure[i].row_major, record_type);
+ recursion(t->fields.array, name, new_length, row_major,
+ record_type);
/* Only the first leaf-field of the record gets called with the
* record type pointer.
diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp
index 03b920d8a..46c06e6c4 100644
--- a/mesalib/src/glsl/opt_tree_grafting.cpp
+++ b/mesalib/src/glsl/opt_tree_grafting.cpp
@@ -275,7 +275,7 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir)
switch (ir->op) {
case ir_tex:
case ir_lod:
- case ir_tg4:
+ case ir_query_levels:
break;
case ir_txb:
if (do_graft(&ir->lod_info.bias))
@@ -296,6 +296,10 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir)
do_graft(&ir->lod_info.grad.dPdy))
return visit_stop;
break;
+ case ir_tg4:
+ if (do_graft(&ir->lod_info.component))
+ return visit_stop;
+ break;
}
return visit_continue;
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index b03734c06..3b64f2cfc 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -103,6 +103,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
ctx->Extensions.OES_standard_derivatives = true;
ctx->Extensions.ARB_texture_cube_map_array = true;
ctx->Extensions.ARB_texture_multisample = true;
+ ctx->Extensions.ARB_texture_query_levels = true;
ctx->Extensions.ARB_texture_query_lod = true;
ctx->Extensions.ARB_gpu_shader5 = true;
ctx->Extensions.ARB_texture_gather = true;