Updated glsl-optimizer.

This commit is contained in:
Branimir Karadžić 2014-03-29 16:26:01 -07:00
parent bf52dc9d02
commit 6afa55381a
255 changed files with 9616 additions and 5116 deletions
3rdparty/glsl-optimizer
Changelog.md
contrib/glslopt
src
tests/fragment

View file

@ -1,6 +1,20 @@
GLSL optimizer Change Log
=========================
2014 03
-------
Fixes:
* Fixed missing precision qualifier in some ES shaders (mostly due to expansion of ternary ?: check).
2014 02
-------
Fixes:
* Fixed vectorize pass introduced last month going wrong with dot products.
2014 01
-------
@ -15,6 +29,7 @@ Fixes:
* Fixed array assignments sometimes appearing in pre-GLSL1.20 versions, especially with
complex loops that couldn't be unrolled.
* Fixed output of textureOffset and texelFetch.
* Fixed error messages on MRT outputs on GL & GLES3 (now supports 4 MRTs).
2013 12
-------

View file

@ -17,7 +17,7 @@ static int printhelp(const char* msg)
static bool init()
{
gContext = glslopt_initialize(false);
gContext = glslopt_initialize(kGlslTargetOpenGL);
if( !gContext )
return false;
return true;

View file

@ -460,12 +460,29 @@ struct ast_type_qualifier {
unsigned prim_type:1;
unsigned max_vertices:1;
/** \} */
/**
* local_size_{x,y,z} flags for compute shaders. Bit 0 represents
* local_size_x, and so on.
*/
unsigned local_size:3;
/** \name Layout and memory qualifiers for ARB_shader_image_load_store. */
/** \{ */
unsigned early_fragment_tests:1;
unsigned explicit_image_format:1;
unsigned coherent:1;
unsigned _volatile:1;
unsigned restrict_flag:1;
unsigned read_only:1; /**< "readonly" qualifier. */
unsigned write_only:1; /**< "writeonly" qualifier. */
/** \} */
}
/** \brief Set of flags, accessed by name. */
q;
/** \brief Set of flags, accessed as a bitmask. */
unsigned i;
uint64_t i;
} flags;
/** Precision of the type (highp/medium/lowp). */
@ -509,6 +526,32 @@ struct ast_type_qualifier {
*/
int offset;
/**
* Local size specified via GL_ARB_compute_shader's "local_size_{x,y,z}"
* layout qualifier. Element i of this array is only valid if
* flags.q.local_size & (1 << i) is set.
*/
int local_size[3];
/**
* Image format specified with an ARB_shader_image_load_store
* layout qualifier.
*
* \note
* This field is only valid if \c explicit_image_format is set.
*/
GLenum image_format;
/**
* Base type of the data read from or written to this image. Only
* the following enumerants are allowed: GLSL_TYPE_UINT,
* GLSL_TYPE_INT, GLSL_TYPE_FLOAT.
*
* \note
* This field is only valid if \c explicit_image_format is set.
*/
glsl_base_type image_base_type;
/**
* Return true if and only if an interpolation qualifier is present.
*/
@ -889,14 +932,13 @@ public:
ast_node *body;
private:
/**
* Generate IR from the condition of a loop
*
* This is factored out of ::hir because some loops have the condition
* test at the top (for and while), and others have it at the end (do-while).
*/
void condition_to_hir(class ir_loop *, struct _mesa_glsl_parse_state *);
void condition_to_hir(exec_list *, struct _mesa_glsl_parse_state *);
};
@ -991,6 +1033,27 @@ private:
const GLenum prim_type;
};
/**
* AST node representing a decalaration of the input layout for compute
* shaders.
*/
class ast_cs_input_layout : public ast_node
{
public:
ast_cs_input_layout(const struct YYLTYPE &locp, const unsigned *local_size)
{
memcpy(this->local_size, local_size, sizeof(this->local_size));
set_location(locp);
}
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
private:
unsigned local_size[3];
};
/*@}*/
extern void

View file

@ -93,7 +93,6 @@ prototype_string(const glsl_type *return_type, const char *name,
return str;
}
static glsl_precision precision_for_call (const ir_function_signature* sig, glsl_precision max_prec, glsl_precision first_prec)
{
if (sig->precision != glsl_precision_undefined)
@ -146,6 +145,57 @@ static glsl_precision precision_for_call (const ir_function_signature* sig, exec
return precision_for_call (sig, prec_params_max, prec_params_first);
}
static bool
verify_image_parameter(YYLTYPE *loc, _mesa_glsl_parse_state *state,
const ir_variable *formal, const ir_variable *actual)
{
/**
* From the ARB_shader_image_load_store specification:
*
* "The values of image variables qualified with coherent,
* volatile, restrict, readonly, or writeonly may not be passed
* to functions whose formal parameters lack such
* qualifiers. [...] It is legal to have additional qualifiers
* on a formal parameter, but not to have fewer."
*/
if (actual->data.image.coherent && !formal->data.image.coherent) {
_mesa_glsl_error(loc, state,
"function call parameter `%s' drops "
"`coherent' qualifier", formal->name);
return false;
}
if (actual->data.image._volatile && !formal->data.image._volatile) {
_mesa_glsl_error(loc, state,
"function call parameter `%s' drops "
"`volatile' qualifier", formal->name);
return false;
}
if (actual->data.image.restrict_flag && !formal->data.image.restrict_flag) {
_mesa_glsl_error(loc, state,
"function call parameter `%s' drops "
"`restrict' qualifier", formal->name);
return false;
}
if (actual->data.image.read_only && !formal->data.image.read_only) {
_mesa_glsl_error(loc, state,
"function call parameter `%s' drops "
"`readonly' qualifier", formal->name);
return false;
}
if (actual->data.image.write_only && !formal->data.image.write_only) {
_mesa_glsl_error(loc, state,
"function call parameter `%s' drops "
"`writeonly' qualifier", formal->name);
return false;
}
return true;
}
/**
* Verify that 'out' and 'inout' actual parameters are lvalues. Also, verify
@ -234,6 +284,13 @@ verify_parameter_modes(_mesa_glsl_parse_state *state,
}
}
if (formal->type->is_image() &&
actual->variable_referenced()) {
if (!verify_image_parameter(&loc, state, formal,
actual->variable_referenced()))
return false;
}
actual_ir_node = actual_ir_node->next;
actual_ast_node = actual_ast_node->next;
}

View file

@ -77,6 +77,7 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
state->toplevel_ir = instructions;
state->gs_input_prim_type_specified = false;
state->cs_input_local_size_specified = false;
/* Section 4.2 of the GLSL 1.20 specification states:
* "The built-in functions are scoped in a scope outside the global scope
@ -994,6 +995,7 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
case GLSL_TYPE_ERROR:
case GLSL_TYPE_VOID:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_INTERFACE:
case GLSL_TYPE_ATOMIC_UINT:
/* I assume a comparison of a struct containing a sampler just
@ -2186,6 +2188,12 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
fail = true;
break;
case MESA_SHADER_COMPUTE:
_mesa_glsl_error(loc, state,
"compute shader variables cannot be given "
"explicit locations");
return;
};
if (fail) {
@ -2234,6 +2242,54 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
return;
}
static void
apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
ir_variable *var,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
const glsl_type *base_type =
(var->type->is_array() ? var->type->element_type() : var->type);
if (base_type->is_image()) {
if (var->data.mode != ir_var_uniform &&
var->data.mode != ir_var_function_in) {
_mesa_glsl_error(loc, state, "image variables may only be declared as "
"function parameters or uniform-qualified "
"global variables");
}
var->data.image.read_only |= qual->flags.q.read_only;
var->data.image.write_only |= qual->flags.q.write_only;
var->data.image.coherent |= qual->flags.q.coherent;
var->data.image._volatile |= qual->flags.q._volatile;
var->data.image.restrict_flag |= qual->flags.q.restrict_flag;
var->data.read_only = true;
if (qual->flags.q.explicit_image_format) {
if (var->data.mode == ir_var_function_in) {
_mesa_glsl_error(loc, state, "format qualifiers cannot be "
"used on image function parameters");
}
if (qual->image_base_type != base_type->sampler_type) {
_mesa_glsl_error(loc, state, "format qualifier doesn't match the "
"base data type of the image");
}
var->data.image.format = qual->image_format;
} else {
if (var->data.mode == ir_var_uniform && !qual->flags.q.write_only) {
_mesa_glsl_error(loc, state, "uniforms not qualified with "
"`writeonly' must have a format layout "
"qualifier");
}
var->data.image.format = GL_NONE;
}
}
}
static void
apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
ir_variable *var,
@ -2306,6 +2362,13 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
var->data.mode = ir_var_uniform;
if (!is_parameter && is_varying_var(var, state->stage)) {
/* User-defined ins/outs are not permitted in compute shaders. */
if (state->stage == MESA_SHADER_COMPUTE) {
_mesa_glsl_error(loc, state,
"user-defined input and output variables are not "
"permitted in compute shaders");
}
/* This variable is being used to link data between shader stages (in
* pre-glsl-1.30 parlance, it's a "varying"). Check that it has a type
* that is allowed for such purposes.
@ -2368,6 +2431,9 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
if (var->data.mode == ir_var_shader_in)
var->data.invariant = true;
break;
case MESA_SHADER_COMPUTE:
/* Invariance isn't meaningful in compute shaders. */
break;
}
}
@ -2514,6 +2580,9 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
if (qual->flags.q.row_major || qual->flags.q.column_major) {
validate_matrix_layout_for_type(state, loc, var->type, var);
}
if (var->type->contains_image())
apply_image_qualifier_to_variable(qual, var, state, loc);
}
/**
@ -2673,9 +2742,15 @@ process_initializer(ir_variable *var, ast_declaration *decl,
"cannot initialize uniforms");
}
if (var->type->is_sampler()) {
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Opaque variables [...] are initialized only through the
* OpenGL API; they cannot be declared with an initializer in a
* shader."
*/
if (var->type->contains_opaque()) {
_mesa_glsl_error(& initializer_loc, state,
"cannot initialize samplers");
"cannot initialize opaque variable");
}
if ((var->data.mode == ir_var_shader_in) && (state->current_function == NULL)) {
@ -3449,15 +3524,15 @@ ast_declarator_list::hir(exec_list *instructions,
", integer and sampler types");
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "[Sampler types] can only be declared as function
* parameters or uniform variables (see Section 4.3.5
* "Uniform")".
* "[Opaque types] can only be declared as function
* parameters or uniform-qualified variables."
*/
if (var_type->contains_sampler() &&
if (var_type->contains_opaque() &&
!this->type->qualifier.flags.q.uniform) {
_mesa_glsl_error(&loc, state, "samplers must be declared uniform");
_mesa_glsl_error(&loc, state,
"opaque variables must be declared uniform");
}
/* Process the initializer and add its instructions to a temporary
@ -3658,15 +3733,16 @@ ast_parameter_declarator::hir(exec_list *instructions,
true);
apply_precision_to_variable(this->type->qualifier, var, state);
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Samplers cannot be treated as l-values; hence cannot be used
* as out or inout function parameters, nor can they be assigned
* into."
* "Opaque variables cannot be treated as l-values; hence cannot
* be used as out or inout function parameters, nor can they be
* assigned into."
*/
if ((var->data.mode == ir_var_function_inout || var->data.mode == ir_var_function_out)
&& type->contains_sampler()) {
_mesa_glsl_error(&loc, state, "out and inout parameters cannot contain samplers");
&& type->contains_opaque()) {
_mesa_glsl_error(&loc, state, "out and inout parameters cannot "
"contain opaque variables");
type = glsl_type::error_type;
}
@ -3821,15 +3897,15 @@ ast_function::hir(exec_list *instructions,
"sized", name);
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "[Sampler types] can only be declared as function parameters
* or uniform variables (see Section 4.3.5 "Uniform")".
* "[Opaque types] can only be declared as function parameters
* or uniform-qualified variables."
*/
if (return_type->contains_sampler()) {
if (return_type->contains_opaque()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state,
"function `%s' return type can't contain a sampler",
"function `%s' return type can't contain an opaque type",
name);
}
@ -4083,17 +4159,22 @@ ast_jump_statement::hir(exec_list *instructions,
_mesa_glsl_error(& loc, state,
"break may only appear in a loop or a switch");
} else {
/* For a loop, inline the for loop expression again,
* since we don't know where near the end of
* the loop body the normal copy of it
* is going to be placed.
/* For a loop, inline the for loop expression again, since we don't
* know where near the end of the loop body the normal copy of it is
* going to be placed. Same goes for the condition for a do-while
* loop.
*/
if (state->loop_nesting_ast != NULL &&
mode == ast_continue &&
state->loop_nesting_ast->rest_expression) {
state->loop_nesting_ast->rest_expression->hir(instructions,
state);
}
mode == ast_continue) {
if (state->loop_nesting_ast->rest_expression) {
state->loop_nesting_ast->rest_expression->hir(instructions,
state);
}
if (state->loop_nesting_ast->mode ==
ast_iteration_statement::ast_do_while) {
state->loop_nesting_ast->condition_to_hir(instructions, state);
}
}
if (state->switch_state.is_switch_innermost &&
mode == ast_break) {
@ -4423,14 +4504,14 @@ ast_case_label::hir(exec_list *instructions,
}
void
ast_iteration_statement::condition_to_hir(ir_loop *stmt,
ast_iteration_statement::condition_to_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
if (condition != NULL) {
ir_rvalue *const cond =
condition->hir(& stmt->body_instructions, state);
condition->hir(instructions, state);
if ((cond == NULL)
|| !cond->type->is_boolean() || !cond->type->is_scalar()) {
@ -4451,7 +4532,7 @@ ast_iteration_statement::condition_to_hir(ir_loop *stmt,
new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
if_stmt->then_instructions.push_tail(break_stmt);
stmt->body_instructions.push_tail(if_stmt);
instructions->push_tail(if_stmt);
}
}
}
@ -4486,7 +4567,7 @@ ast_iteration_statement::hir(exec_list *instructions,
state->switch_state.is_switch_innermost = false;
if (mode != ast_do_while)
condition_to_hir(stmt, state);
condition_to_hir(&stmt->body_instructions, state);
if (body != NULL)
body->hir(& stmt->body_instructions, state);
@ -4495,7 +4576,7 @@ ast_iteration_statement::hir(exec_list *instructions,
rest_expression->hir(& stmt->body_instructions, state);
if (mode == ast_do_while)
condition_to_hir(stmt, state);
condition_to_hir(&stmt->body_instructions, state);
if (mode != ast_do_while)
state->symbols->pop_scope();
@ -4647,6 +4728,7 @@ ast_type_specifier::hir(exec_list *instructions,
ir_var_temporary, (glsl_precision)this->default_precision);
state->symbols->add_variable(junk);
state->had_float_precision = true;
}
/* FINISHME: Translate precision statements into IR. */
@ -4742,12 +4824,9 @@ ast_process_structure_or_interface_block(exec_list *instructions,
if (!allow_reserved_names)
validate_identifier(decl->identifier, loc, state);
/* From the GL_ARB_uniform_buffer_object spec:
/* From section 4.3.9 of the GLSL 4.40 spec:
*
* "Sampler types are not allowed inside of uniform
* blocks. All other types, arrays, and structures
* allowed for uniforms are allowed within a uniform
* block."
* "[In interface blocks] opaque types are not allowed."
*
* It should be impossible for decl_type to be NULL here. Cases that
* might naturally lead to decl_type being NULL, especially for the
@ -4757,10 +4836,11 @@ ast_process_structure_or_interface_block(exec_list *instructions,
const struct glsl_type *field_type =
decl_type != NULL ? decl_type : glsl_type::error_type;
if (is_interface && field_type->contains_sampler()) {
if (is_interface && field_type->contains_opaque()) {
YYLTYPE loc = decl_list->get_location();
_mesa_glsl_error(&loc, state,
"uniform in non-default uniform block contains sampler");
"uniform in non-default uniform block contains "
"opaque variable");
}
if (field_type->contains_atomic()) {
@ -4774,6 +4854,16 @@ ast_process_structure_or_interface_block(exec_list *instructions,
"uniform block");
}
if (field_type->contains_image()) {
/* FINISHME: Same problem as with atomic counters.
* FINISHME: Request clarification from Khronos and add
* FINISHME: spec quotation here.
*/
YYLTYPE loc = decl_list->get_location();
_mesa_glsl_error(&loc, state,
"image in structure or uniform block");
}
const struct ast_type_qualifier *const qual =
& decl_list->type->qualifier;
if (qual->flags.q.std140 ||
@ -5376,6 +5466,84 @@ ast_gs_input_layout::hir(exec_list *instructions,
}
ir_rvalue *
ast_cs_input_layout::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
YYLTYPE loc = this->get_location();
/* If any compute input layout declaration preceded this one, make sure it
* was consistent with this one.
*/
if (state->cs_input_local_size_specified) {
for (int i = 0; i < 3; i++) {
if (state->cs_input_local_size[i] != this->local_size[i]) {
_mesa_glsl_error(&loc, state,
"compute shader input layout does not match"
" previous declaration");
return NULL;
}
}
}
/* From the ARB_compute_shader specification:
*
* If the local size of the shader in any dimension is greater
* than the maximum size supported by the implementation for that
* dimension, a compile-time error results.
*
* It is not clear from the spec how the error should be reported if
* the total size of the work group exceeds
* MAX_COMPUTE_WORK_GROUP_INVOCATIONS, but it seems reasonable to
* report it at compile time as well.
*/
GLuint64 total_invocations = 1;
for (int i = 0; i < 3; i++) {
if (this->local_size[i] > state->ctx->Const.MaxComputeWorkGroupSize[i]) {
_mesa_glsl_error(&loc, state,
"local_size_%c exceeds MAX_COMPUTE_WORK_GROUP_SIZE"
" (%d)", 'x' + i,
state->ctx->Const.MaxComputeWorkGroupSize[i]);
break;
}
total_invocations *= this->local_size[i];
if (total_invocations >
state->ctx->Const.MaxComputeWorkGroupInvocations) {
_mesa_glsl_error(&loc, state,
"product of local_sizes exceeds "
"MAX_COMPUTE_WORK_GROUP_INVOCATIONS (%d)",
state->ctx->Const.MaxComputeWorkGroupInvocations);
break;
}
}
state->cs_input_local_size_specified = true;
for (int i = 0; i < 3; i++)
state->cs_input_local_size[i] = this->local_size[i];
/* We may now declare the built-in constant gl_WorkGroupSize (see
* builtin_variable_generator::generate_constants() for why we didn't
* declare it earlier).
*/
ir_variable *var = new(state->symbols)
ir_variable(glsl_type::ivec3_type, "gl_WorkGroupSize", ir_var_auto, glsl_precision_undefined);
var->data.how_declared = ir_var_declared_implicitly;
var->data.read_only = true;
instructions->push_tail(var);
state->symbols->add_variable(var);
ir_constant_data data;
memset(&data, 0, sizeof(data));
for (int i = 0; i < 3; i++)
data.i[i] = this->local_size[i];
var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data);
var->constant_initializer =
new(var) ir_constant(glsl_type::ivec3_type, &data);
var->data.has_initializer = true;
return NULL;
}
static void
detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
exec_list *instructions)

View file

@ -118,6 +118,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
ubo_layout_mask.flags.q.shared = 1;
ast_type_qualifier ubo_binding_mask;
ubo_binding_mask.flags.i = 0;
ubo_binding_mask.flags.q.explicit_binding = 1;
ubo_binding_mask.flags.q.explicit_offset = 1;
@ -158,6 +159,20 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
if ((q.flags.i & ubo_layout_mask.flags.i) != 0)
this->flags.i &= ~ubo_layout_mask.flags.i;
for (int i = 0; i < 3; i++) {
if (q.flags.q.local_size & (1 << i)) {
if ((this->flags.q.local_size & (1 << i)) &&
this->local_size[i] != q.local_size[i]) {
_mesa_glsl_error(loc, state,
"compute shader set conflicting values for "
"local_size_%c (%d and %d)", 'x' + i,
this->local_size[i], q.local_size[i]);
return false;
}
this->local_size[i] = q.local_size[i];
}
}
this->flags.i |= q.flags.i;
if (q.flags.q.explicit_location)
@ -175,6 +190,11 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
if (q.precision != ast_precision_none)
this->precision = q.precision;
if (q.flags.q.explicit_image_format) {
this->image_format = q.image_format;
this->image_base_type = q.image_base_type;
}
return true;
}

View file

@ -366,6 +366,13 @@ shader_trinary_minmax(const _mesa_glsl_parse_state *state)
return state->AMD_shader_trinary_minmax_enable;
}
static bool
shader_image_load_store(const _mesa_glsl_parse_state *state)
{
return (state->is_version(420, 0) ||
state->ARB_shader_image_load_store_enable);
}
/** @} */
/******************************************************************************/
@ -439,6 +446,33 @@ private:
/** Create a new function and add the given signatures. */
void add_function(const char *name, ...);
enum image_function_flags {
IMAGE_FUNCTION_EMIT_STUB = (1 << 0),
IMAGE_FUNCTION_RETURNS_VOID = (1 << 1),
IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE = (1 << 2),
IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE = (1 << 3),
IMAGE_FUNCTION_READ_ONLY = (1 << 4),
IMAGE_FUNCTION_WRITE_ONLY = (1 << 5)
};
/**
* Create a new image built-in function for all known image types.
* \p flags is a bitfield of \c image_function_flags flags.
*/
void add_image_function(const char *name,
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags);
/**
* Create new functions for all known image built-ins and types.
* If \p glsl is \c true, use the GLSL built-in names and emit code
* to call into the actual compiler intrinsic. If \p glsl is
* false, emit a function prototype with no body for each image
* intrinsic name.
*/
void add_image_functions(bool glsl);
ir_function_signature *new_sig(const glsl_type *return_type,
builtin_available_predicate avail,
int num_params, ...);
@ -606,6 +640,20 @@ private:
B1(max3)
B1(mid3)
ir_function_signature *_image_prototype(const glsl_type *image_type,
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags);
ir_function_signature *_image(const glsl_type *image_type,
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags);
ir_function_signature *_memory_barrier_intrinsic(
builtin_available_predicate avail);
ir_function_signature *_memory_barrier(
builtin_available_predicate avail);
#undef B0
#undef B1
#undef B2
@ -720,6 +768,12 @@ builtin_builder::create_intrinsics()
add_function("__intrinsic_atomic_predecrement",
_atomic_intrinsic(shader_atomic_counters),
NULL);
add_image_functions(false);
add_function("__intrinsic_memory_barrier",
_memory_barrier_intrinsic(shader_image_load_store),
NULL);
}
/**
@ -2221,6 +2275,12 @@ builtin_builder::create_builtins()
_mid3(glsl_type::uvec4_type),
NULL);
add_image_functions(true);
add_function("memoryBarrier",
_memory_barrier(shader_image_load_store),
NULL);
#undef F
#undef FI
#undef FIU
@ -2254,6 +2314,104 @@ builtin_builder::add_function(const char *name, ...)
shader->symbols->add_function(f);
}
void
builtin_builder::add_image_function(const char *name,
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags)
{
static const glsl_type *const types[] = {
glsl_type::image1D_type,
glsl_type::image2D_type,
glsl_type::image3D_type,
glsl_type::image2DRect_type,
glsl_type::imageCube_type,
glsl_type::imageBuffer_type,
glsl_type::image1DArray_type,
glsl_type::image2DArray_type,
glsl_type::imageCubeArray_type,
glsl_type::image2DMS_type,
glsl_type::image2DMSArray_type,
glsl_type::iimage1D_type,
glsl_type::iimage2D_type,
glsl_type::iimage3D_type,
glsl_type::iimage2DRect_type,
glsl_type::iimageCube_type,
glsl_type::iimageBuffer_type,
glsl_type::iimage1DArray_type,
glsl_type::iimage2DArray_type,
glsl_type::iimageCubeArray_type,
glsl_type::iimage2DMS_type,
glsl_type::iimage2DMSArray_type,
glsl_type::uimage1D_type,
glsl_type::uimage2D_type,
glsl_type::uimage3D_type,
glsl_type::uimage2DRect_type,
glsl_type::uimageCube_type,
glsl_type::uimageBuffer_type,
glsl_type::uimage1DArray_type,
glsl_type::uimage2DArray_type,
glsl_type::uimageCubeArray_type,
glsl_type::uimage2DMS_type,
glsl_type::uimage2DMSArray_type
};
ir_function *f = new(mem_ctx) ir_function(name);
for (unsigned i = 0; i < Elements(types); ++i) {
if (types[i]->sampler_type != GLSL_TYPE_FLOAT ||
(flags & IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE))
f->add_signature(_image(types[i], intrinsic_name,
num_arguments, flags));
}
shader->symbols->add_function(f);
}
void
builtin_builder::add_image_functions(bool glsl)
{
const unsigned flags = (glsl ? IMAGE_FUNCTION_EMIT_STUB : 0);
add_image_function(glsl ? "imageLoad" : "__intrinsic_image_load",
"__intrinsic_image_load", 0,
(flags | IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE |
IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE |
IMAGE_FUNCTION_READ_ONLY));
add_image_function(glsl ? "imageStore" : "__intrinsic_image_store",
"__intrinsic_image_store", 1,
(flags | IMAGE_FUNCTION_RETURNS_VOID |
IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE |
IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE |
IMAGE_FUNCTION_WRITE_ONLY));
add_image_function(glsl ? "imageAtomicAdd" : "__intrinsic_image_atomic_add",
"__intrinsic_image_atomic_add", 1, flags);
add_image_function(glsl ? "imageAtomicMin" : "__intrinsic_image_atomic_min",
"__intrinsic_image_atomic_min", 1, flags);
add_image_function(glsl ? "imageAtomicMax" : "__intrinsic_image_atomic_max",
"__intrinsic_image_atomic_max", 1, flags);
add_image_function(glsl ? "imageAtomicAnd" : "__intrinsic_image_atomic_and",
"__intrinsic_image_atomic_and", 1, flags);
add_image_function(glsl ? "imageAtomicOr" : "__intrinsic_image_atomic_or",
"__intrinsic_image_atomic_or", 1, flags);
add_image_function(glsl ? "imageAtomicXor" : "__intrinsic_image_atomic_xor",
"__intrinsic_image_atomic_xor", 1, flags);
add_image_function((glsl ? "imageAtomicExchange" :
"__intrinsic_image_atomic_exchange"),
"__intrinsic_image_atomic_exchange", 1, flags);
add_image_function((glsl ? "imageAtomicCompSwap" :
"__intrinsic_image_atomic_comp_swap"),
"__intrinsic_image_atomic_comp_swap", 2, flags);
}
ir_variable *
builtin_builder::in_var(const glsl_type *type, const char *name)
{
@ -3603,7 +3761,7 @@ builtin_builder::_texture(ir_texture_opcode opcode,
ir_texture *tex = new(mem_ctx) ir_texture(opcode);
tex->set_sampler(var_ref(s), return_type);
const int coord_size = sampler_type->sampler_coordinate_components();
const int coord_size = sampler_type->coordinate_components();
// removed for glsl optimizer
//if (coord_size == coord_type->vector_elements) {
@ -4151,12 +4309,112 @@ builtin_builder::_mid3(const glsl_type *type)
return sig;
}
ir_function_signature *
builtin_builder::_image_prototype(const glsl_type *image_type,
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags)
{
const glsl_type *data_type = glsl_type::get_instance(
image_type->sampler_type,
(flags & IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE ? 4 : 1),
1);
const glsl_type *ret_type = (flags & IMAGE_FUNCTION_RETURNS_VOID ?
glsl_type::void_type : data_type);
/* Addressing arguments that are always present. */
ir_variable *image = in_var(image_type, "image");
ir_variable *coord = in_var(
glsl_type::ivec(image_type->coordinate_components()), "coord");
ir_function_signature *sig = new_sig(
ret_type, shader_image_load_store, 2, image, coord);
/* Sample index for multisample images. */
if (image_type->sampler_dimensionality == GLSL_SAMPLER_DIM_MS)
sig->parameters.push_tail(in_var(glsl_type::int_type, "sample"));
/* Data arguments. */
for (unsigned i = 0; i < num_arguments; ++i)
sig->parameters.push_tail(in_var(data_type,
ralloc_asprintf(NULL, "arg%d", i)));
/* Set the maximal set of qualifiers allowed for this image
* built-in. Function calls with arguments having fewer
* qualifiers than present in the prototype are allowed by the
* spec, but not with more, i.e. this will make the compiler
* accept everything that needs to be accepted, and reject cases
* like loads from write-only or stores to read-only images.
*/
image->data.image.read_only = flags & IMAGE_FUNCTION_READ_ONLY;
image->data.image.write_only = flags & IMAGE_FUNCTION_WRITE_ONLY;
image->data.image.coherent = true;
image->data.image._volatile = true;
image->data.image.restrict_flag = true;
return sig;
}
ir_function_signature *
builtin_builder::_image(const glsl_type *image_type,
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags)
{
ir_function_signature *sig = _image_prototype(image_type, intrinsic_name,
num_arguments, flags);
if (flags & IMAGE_FUNCTION_EMIT_STUB) {
ir_factory body(&sig->body, mem_ctx);
ir_function *f = shader->symbols->get_function(intrinsic_name);
if (flags & IMAGE_FUNCTION_RETURNS_VOID) {
body.emit(call(f, NULL, sig->parameters));
} else {
ir_variable *ret_val =
body.make_temp(sig->return_type, "_ret_val");
body.emit(call(f, ret_val, sig->parameters));
body.emit(ret(ret_val));
}
sig->is_defined = true;
} else {
sig->is_intrinsic = true;
}
return sig;
}
ir_function_signature *
builtin_builder::_memory_barrier_intrinsic(builtin_available_predicate avail)
{
MAKE_INTRINSIC(glsl_type::void_type, avail, 0);
return sig;
}
ir_function_signature *
builtin_builder::_memory_barrier(builtin_available_predicate avail)
{
MAKE_SIG(glsl_type::void_type, avail, 0);
body.emit(call(shader->symbols->get_function("__intrinsic_memory_barrier"),
NULL, sig->parameters));
return sig;
}
/** @} */
/******************************************************************************/
//@TODO: implement
#define _glthread_DECLARE_STATIC_MUTEX(name)
#define _glthread_LOCK_MUTEX(name)
#define _glthread_UNLOCK_MUTEX(name)
/* The singleton instance of builtin_builder. */
static builtin_builder builtins;
_glthread_DECLARE_STATIC_MUTEX(builtins_lock);
/**
* External API (exposing the built-in module to the rest of the compiler):
@ -4165,20 +4423,28 @@ static builtin_builder builtins;
void
_mesa_glsl_initialize_builtin_functions()
{
_glthread_LOCK_MUTEX(builtins_lock);
builtins.initialize();
_glthread_UNLOCK_MUTEX(builtins_lock);
}
void
_mesa_glsl_release_builtin_functions()
{
_glthread_LOCK_MUTEX(builtins_lock);
builtins.release();
_glthread_UNLOCK_MUTEX(builtins_lock);
}
ir_function_signature *
_mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
const char *name, exec_list *actual_parameters)
{
return builtins.find(state, name, actual_parameters);
ir_function_signature * s;
_glthread_LOCK_MUTEX(builtins_lock);
s = builtins.find(state, name, actual_parameters);
_glthread_UNLOCK_MUTEX(builtins_lock);
return s;
}
gl_shader *

View file

@ -64,51 +64,85 @@ DECL_TYPE(mat3x4, GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3)
DECL_TYPE(mat4x2, GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4)
DECL_TYPE(mat4x3, GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4)
DECL_TYPE(sampler1D, GL_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2D, GL_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler3D, GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCube, GL_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler1DArray, GL_SAMPLER_1D_ARRAY, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DArray, GL_SAMPLER_2D_ARRAY, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCubeArray, GL_SAMPLER_CUBE_MAP_ARRAY, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DRect, GL_SAMPLER_2D_RECT, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerBuffer, GL_SAMPLER_BUFFER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DMS, GL_SAMPLER_2D_MULTISAMPLE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DMSArray, GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler1D, GL_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2D, GL_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler3D, GL_SAMPLER_3D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCube, GL_SAMPLER_CUBE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler1DArray, GL_SAMPLER_1D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DArray, GL_SAMPLER_2D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCubeArray, GL_SAMPLER_CUBE_MAP_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DRect, GL_SAMPLER_2D_RECT, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerBuffer, GL_SAMPLER_BUFFER, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DMS, GL_SAMPLER_2D_MULTISAMPLE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DMSArray, GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(isampler1D, GL_INT_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler2D, GL_INT_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler3D, GL_INT_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isamplerCube, GL_INT_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler1DArray, GL_INT_SAMPLER_1D_ARRAY, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isampler2DArray, GL_INT_SAMPLER_2D_ARRAY, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isamplerCubeArray, GL_INT_SAMPLER_CUBE_MAP_ARRAY, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isampler2DRect, GL_INT_SAMPLER_2D_RECT, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isamplerBuffer, GL_INT_SAMPLER_BUFFER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler2DMS, GL_INT_SAMPLER_2D_MULTISAMPLE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler2DMSArray, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isampler1D, GL_INT_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler2D, GL_INT_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler3D, GL_INT_SAMPLER_3D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isamplerCube, GL_INT_SAMPLER_CUBE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler1DArray, GL_INT_SAMPLER_1D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isampler2DArray, GL_INT_SAMPLER_2D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isamplerCubeArray, GL_INT_SAMPLER_CUBE_MAP_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(isampler2DRect, GL_INT_SAMPLER_2D_RECT, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isamplerBuffer, GL_INT_SAMPLER_BUFFER, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler2DMS, GL_INT_SAMPLER_2D_MULTISAMPLE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isampler2DMSArray, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_INT)
DECL_TYPE(usampler1D, GL_UNSIGNED_INT_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler2D, GL_UNSIGNED_INT_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler3D, GL_UNSIGNED_INT_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usamplerCube, GL_UNSIGNED_INT_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler1DArray, GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DArray, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usamplerCubeArray, GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DRect, GL_UNSIGNED_INT_SAMPLER_2D_RECT, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usamplerBuffer, GL_UNSIGNED_INT_SAMPLER_BUFFER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DMS, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DMSArray, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usampler1D, GL_UNSIGNED_INT_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler2D, GL_UNSIGNED_INT_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler3D, GL_UNSIGNED_INT_SAMPLER_3D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usamplerCube, GL_UNSIGNED_INT_SAMPLER_CUBE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler1DArray, GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DArray, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usamplerCubeArray, GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DRect, GL_UNSIGNED_INT_SAMPLER_2D_RECT, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usamplerBuffer, GL_UNSIGNED_INT_SAMPLER_BUFFER, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DMS, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usampler2DMSArray, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(sampler1DShadow, GL_SAMPLER_1D_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DShadow, GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCubeShadow, GL_SAMPLER_CUBE_SHADOW, GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler1DArrayShadow, GL_SAMPLER_1D_ARRAY_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DArrayShadow, GL_SAMPLER_2D_ARRAY_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCubeArrayShadow, GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW, GLSL_SAMPLER_DIM_CUBE, 1, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DRectShadow, GL_SAMPLER_2D_RECT_SHADOW, GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler1DShadow, GL_SAMPLER_1D_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DShadow, GL_SAMPLER_2D_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCubeShadow, GL_SAMPLER_CUBE_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler1DArrayShadow, GL_SAMPLER_1D_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DArrayShadow, GL_SAMPLER_2D_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerCubeArrayShadow, GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 1, 1, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2DRectShadow, GL_SAMPLER_2D_RECT_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerExternalOES, GL_SAMPLER_EXTERNAL_OES, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(samplerExternalOES, GL_SAMPLER_EXTERNAL_OES, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(image1D, GL_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(image2D, GL_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(image3D, GL_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(image2DRect, GL_IMAGE_2D_RECT, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(imageCube, GL_IMAGE_CUBE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(imageBuffer, GL_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(image1DArray, GL_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT);
DECL_TYPE(image2DArray, GL_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT);
DECL_TYPE(imageCubeArray, GL_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT);
DECL_TYPE(image2DMS, GL_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_FLOAT);
DECL_TYPE(image2DMSArray, GL_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_FLOAT);
DECL_TYPE(iimage1D, GL_INT_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimage2D, GL_INT_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimage3D, GL_INT_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimage2DRect, GL_INT_IMAGE_2D_RECT, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimageCube, GL_INT_IMAGE_CUBE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimageBuffer, GL_INT_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimage1DArray, GL_INT_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT);
DECL_TYPE(iimage2DArray, GL_INT_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT);
DECL_TYPE(iimageCubeArray, GL_INT_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT);
DECL_TYPE(iimage2DMS, GL_INT_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_INT);
DECL_TYPE(iimage2DMSArray, GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_INT);
DECL_TYPE(uimage1D, GL_UNSIGNED_INT_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimage2D, GL_UNSIGNED_INT_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimage3D, GL_UNSIGNED_INT_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimage2DRect, GL_UNSIGNED_INT_IMAGE_2D_RECT, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimageCube, GL_UNSIGNED_INT_IMAGE_CUBE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimageBuffer, GL_UNSIGNED_INT_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimage1DArray, GL_UNSIGNED_INT_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT);
DECL_TYPE(uimage2DArray, GL_UNSIGNED_INT_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT);
DECL_TYPE(uimageCubeArray, GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT);
DECL_TYPE(uimage2DMS, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT);
DECL_TYPE(uimage2DMSArray, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT);
DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)

View file

@ -204,6 +204,40 @@ const static struct builtin_type_versions {
T(struct_gl_DepthRangeParameters, 110, 100)
T(image1D, 420, 999)
T(image2D, 420, 999)
T(image3D, 420, 999)
T(image2DRect, 420, 999)
T(imageCube, 420, 999)
T(imageBuffer, 420, 999)
T(image1DArray, 420, 999)
T(image2DArray, 420, 999)
T(imageCubeArray, 420, 999)
T(image2DMS, 420, 999)
T(image2DMSArray, 420, 999)
T(iimage1D, 420, 999)
T(iimage2D, 420, 999)
T(iimage3D, 420, 999)
T(iimage2DRect, 420, 999)
T(iimageCube, 420, 999)
T(iimageBuffer, 420, 999)
T(iimage1DArray, 420, 999)
T(iimage2DArray, 420, 999)
T(iimageCubeArray, 420, 999)
T(iimage2DMS, 420, 999)
T(iimage2DMSArray, 420, 999)
T(uimage1D, 420, 999)
T(uimage2D, 420, 999)
T(uimage3D, 420, 999)
T(uimage2DRect, 420, 999)
T(uimageCube, 420, 999)
T(uimageBuffer, 420, 999)
T(uimage1DArray, 420, 999)
T(uimage2DArray, 420, 999)
T(uimageCubeArray, 420, 999)
T(uimage2DMS, 420, 999)
T(uimage2DMSArray, 420, 999)
T(atomic_uint, 420, 999)
};
@ -291,6 +325,42 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::sampler3D_type);
}
if (state->ARB_shader_image_load_store_enable) {
add_type(symbols, glsl_type::image1D_type);
add_type(symbols, glsl_type::image2D_type);
add_type(symbols, glsl_type::image3D_type);
add_type(symbols, glsl_type::image2DRect_type);
add_type(symbols, glsl_type::imageCube_type);
add_type(symbols, glsl_type::imageBuffer_type);
add_type(symbols, glsl_type::image1DArray_type);
add_type(symbols, glsl_type::image2DArray_type);
add_type(symbols, glsl_type::imageCubeArray_type);
add_type(symbols, glsl_type::image2DMS_type);
add_type(symbols, glsl_type::image2DMSArray_type);
add_type(symbols, glsl_type::iimage1D_type);
add_type(symbols, glsl_type::iimage2D_type);
add_type(symbols, glsl_type::iimage3D_type);
add_type(symbols, glsl_type::iimage2DRect_type);
add_type(symbols, glsl_type::iimageCube_type);
add_type(symbols, glsl_type::iimageBuffer_type);
add_type(symbols, glsl_type::iimage1DArray_type);
add_type(symbols, glsl_type::iimage2DArray_type);
add_type(symbols, glsl_type::iimageCubeArray_type);
add_type(symbols, glsl_type::iimage2DMS_type);
add_type(symbols, glsl_type::iimage2DMSArray_type);
add_type(symbols, glsl_type::uimage1D_type);
add_type(symbols, glsl_type::uimage2D_type);
add_type(symbols, glsl_type::uimage3D_type);
add_type(symbols, glsl_type::uimage2DRect_type);
add_type(symbols, glsl_type::uimageCube_type);
add_type(symbols, glsl_type::uimageBuffer_type);
add_type(symbols, glsl_type::uimage1DArray_type);
add_type(symbols, glsl_type::uimage2DArray_type);
add_type(symbols, glsl_type::uimageCubeArray_type);
add_type(symbols, glsl_type::uimage2DMS_type);
add_type(symbols, glsl_type::uimage2DMSArray_type);
}
if (state->ARB_shader_atomic_counters_enable) {
add_type(symbols, glsl_type::atomic_uint_type);
}

View file

@ -370,6 +370,7 @@ public:
void generate_vs_special_vars();
void generate_gs_special_vars();
void generate_fs_special_vars();
void generate_cs_special_vars();
void generate_varyings();
private:
@ -403,6 +404,7 @@ private:
enum ir_variable_mode mode, int slot, glsl_precision prec);
ir_variable *add_uniform(const glsl_type *type, const char *name, glsl_precision prec);
ir_variable *add_const(const char *name, int value);
ir_variable *add_const_ivec3(const char *name, int x, int y, int z);
void add_varying(int slot, const glsl_type *type, const char *name,
const char *name_as_gs_input, glsl_precision prec);
@ -546,6 +548,25 @@ builtin_variable_generator::add_const(const char *name, int value)
}
ir_variable *
builtin_variable_generator::add_const_ivec3(const char *name, int x, int y,
int z)
{
ir_variable *const var = add_variable(name, glsl_type::ivec3_type,
ir_var_auto, -1, glsl_precision_undefined);
ir_constant_data data;
memset(&data, 0, sizeof(data));
data.i[0] = x;
data.i[1] = y;
data.i[2] = z;
var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data);
var->constant_initializer =
new(var) ir_constant(glsl_type::ivec3_type, &data);
var->data.has_initializer = true;
return var;
}
void
builtin_variable_generator::generate_constants()
{
@ -676,6 +697,57 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxTessControlAtomicCounters", 0);
add_const("gl_MaxTessEvaluationAtomicCounters", 0);
}
if (state->is_version(430, 0) || state->ARB_compute_shader_enable) {
add_const_ivec3("gl_MaxComputeWorkGroupCount",
state->Const.MaxComputeWorkGroupCount[0],
state->Const.MaxComputeWorkGroupCount[1],
state->Const.MaxComputeWorkGroupCount[2]);
add_const_ivec3("gl_MaxComputeWorkGroupSize",
state->Const.MaxComputeWorkGroupSize[0],
state->Const.MaxComputeWorkGroupSize[1],
state->Const.MaxComputeWorkGroupSize[2]);
/* From the GLSL 4.40 spec, section 7.1 (Built-In Language Variables):
*
* The built-in constant gl_WorkGroupSize is a compute-shader
* constant containing the local work-group size of the shader. The
* size of the work group in the X, Y, and Z dimensions is stored in
* the x, y, and z components. The constants values in
* gl_WorkGroupSize will match those specified in the required
* local_size_x, local_size_y, and local_size_z layout qualifiers
* for the current shader. This is a constant so that it can be
* used to size arrays of memory that can be shared within the local
* work group. It is a compile-time error to use gl_WorkGroupSize
* in a shader that does not declare a fixed local group size, or
* before that shader has declared a fixed local group size, using
* local_size_x, local_size_y, and local_size_z.
*
* To prevent the shader from trying to refer to gl_WorkGroupSize before
* the layout declaration, we don't define it here. Intead we define it
* in ast_cs_input_layout::hir().
*/
}
if (state->is_version(420, 0) ||
state->ARB_shader_image_load_store_enable) {
add_const("gl_MaxImageUnits",
state->Const.MaxImageUnits);
add_const("gl_MaxCombinedImageUnitsAndFragmentOutputs",
state->Const.MaxCombinedImageUnitsAndFragmentOutputs);
add_const("gl_MaxImageSamples",
state->Const.MaxImageSamples);
add_const("gl_MaxVertexImageUniforms",
state->Const.MaxVertexImageUniforms);
add_const("gl_MaxTessControlImageUniforms", 0);
add_const("gl_MaxTessEvaluationImageUniforms", 0);
add_const("gl_MaxGeometryImageUniforms",
state->Const.MaxGeometryImageUniforms);
add_const("gl_MaxFragmentImageUniforms",
state->Const.MaxFragmentImageUniforms);
add_const("gl_MaxCombinedImageUniforms",
state->Const.MaxCombinedImageUniforms);
}
}
@ -892,6 +964,16 @@ builtin_variable_generator::generate_fs_special_vars()
}
/**
* Generate variables which only exist in compute shaders.
*/
void
builtin_variable_generator::generate_cs_special_vars()
{
/* TODO: finish this. */
}
/**
* Add a single "varying" variable. The variable's type and direction (input
* or output) are adjusted as appropriate for the type of shader being
@ -914,6 +996,9 @@ builtin_variable_generator::add_varying(int slot, const glsl_type *type,
case MESA_SHADER_FRAGMENT:
add_input(slot, type, name, prec);
break;
case MESA_SHADER_COMPUTE:
/* Compute shaders don't have varyings. */
break;
}
}
@ -1001,5 +1086,8 @@ _mesa_glsl_initialize_variables(exec_list *instructions,
case MESA_SHADER_FRAGMENT:
gen.generate_fs_special_vars();
break;
case MESA_SHADER_COMPUTE:
gen.generate_cs_special_vars();
break;
}
}

View file

@ -1040,41 +1040,39 @@ case 1:
YY_RULE_SETUP
#line 158 "src/glsl/glcpp/glcpp-lex.l"
{
if (parser->commented_newlines)
BEGIN NEWLINE_CATCHUP;
}
YY_BREAK
/* Multi-line comments */
case 2:
YY_RULE_SETUP
#line 164 "src/glsl/glcpp/glcpp-lex.l"
#line 162 "src/glsl/glcpp/glcpp-lex.l"
{ yy_push_state(COMMENT, yyscanner); }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 165 "src/glsl/glcpp/glcpp-lex.l"
#line 163 "src/glsl/glcpp/glcpp-lex.l"
YY_BREAK
case 4:
/* rule 4 can match eol */
YY_RULE_SETUP
#line 166 "src/glsl/glcpp/glcpp-lex.l"
#line 164 "src/glsl/glcpp/glcpp-lex.l"
{ yylineno++; yycolumn = 0; parser->commented_newlines++; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 167 "src/glsl/glcpp/glcpp-lex.l"
#line 165 "src/glsl/glcpp/glcpp-lex.l"
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
#line 168 "src/glsl/glcpp/glcpp-lex.l"
#line 166 "src/glsl/glcpp/glcpp-lex.l"
{ yylineno++; yycolumn = 0; parser->commented_newlines++; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 169 "src/glsl/glcpp/glcpp-lex.l"
#line 167 "src/glsl/glcpp/glcpp-lex.l"
{
yy_pop_state(yyscanner);
if (yyextra->space_tokens)
@ -1083,7 +1081,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 175 "src/glsl/glcpp/glcpp-lex.l"
#line 173 "src/glsl/glcpp/glcpp-lex.l"
{
yylval->str = ralloc_strdup (yyextra, yytext);
yyextra->space_tokens = 0;
@ -1094,7 +1092,7 @@ YY_RULE_SETUP
* Simply pass them through to the main compiler's lexer/parser. */
case 9:
YY_RULE_SETUP
#line 183 "src/glsl/glcpp/glcpp-lex.l"
#line 181 "src/glsl/glcpp/glcpp-lex.l"
{
if (parser->commented_newlines)
BEGIN NEWLINE_CATCHUP;
@ -1106,7 +1104,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
#line 192 "src/glsl/glcpp/glcpp-lex.l"
#line 190 "src/glsl/glcpp/glcpp-lex.l"
{
return HASH_LINE;
}
@ -1114,7 +1112,7 @@ YY_RULE_SETUP
case 11:
YY_RULE_SETUP
#line 197 "src/glsl/glcpp/glcpp-lex.l"
#line 195 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
@ -1123,7 +1121,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
#line 203 "src/glsl/glcpp/glcpp-lex.l"
#line 201 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
@ -1136,7 +1134,7 @@ case 13:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 209 "src/glsl/glcpp/glcpp-lex.l"
#line 207 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
@ -1149,7 +1147,7 @@ case 14:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 215 "src/glsl/glcpp/glcpp-lex.l"
#line 213 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
@ -1158,7 +1156,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
#line 221 "src/glsl/glcpp/glcpp-lex.l"
#line 219 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_ELSE;
@ -1166,7 +1164,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
#line 226 "src/glsl/glcpp/glcpp-lex.l"
#line 224 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_ENDIF;
@ -1175,7 +1173,7 @@ YY_RULE_SETUP
case 17:
YY_RULE_SETUP
#line 232 "src/glsl/glcpp/glcpp-lex.l"
#line 230 "src/glsl/glcpp/glcpp-lex.l"
{
if (parser->commented_newlines)
BEGIN NEWLINE_CATCHUP;
@ -1183,7 +1181,7 @@ YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
#line 237 "src/glsl/glcpp/glcpp-lex.l"
#line 235 "src/glsl/glcpp/glcpp-lex.l"
{
char *p;
for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
@ -1193,7 +1191,7 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
#line 244 "src/glsl/glcpp/glcpp-lex.l"
#line 242 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
yy_push_state(DEFINE, yyscanner);
@ -1205,7 +1203,7 @@ case 20:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 250 "src/glsl/glcpp/glcpp-lex.l"
#line 248 "src/glsl/glcpp/glcpp-lex.l"
{
yy_pop_state(yyscanner);
yylval->str = ralloc_strdup (yyextra, yytext);
@ -1214,7 +1212,7 @@ YY_RULE_SETUP
YY_BREAK
case 21:
YY_RULE_SETUP
#line 256 "src/glsl/glcpp/glcpp-lex.l"
#line 254 "src/glsl/glcpp/glcpp-lex.l"
{
yy_pop_state(yyscanner);
yylval->str = ralloc_strdup (yyextra, yytext);
@ -1223,7 +1221,7 @@ YY_RULE_SETUP
YY_BREAK
case 22:
YY_RULE_SETUP
#line 262 "src/glsl/glcpp/glcpp-lex.l"
#line 260 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_UNDEF;
@ -1231,7 +1229,7 @@ YY_RULE_SETUP
YY_BREAK
case 23:
YY_RULE_SETUP
#line 267 "src/glsl/glcpp/glcpp-lex.l"
#line 265 "src/glsl/glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH;
@ -1239,7 +1237,7 @@ YY_RULE_SETUP
YY_BREAK
case 24:
YY_RULE_SETUP
#line 272 "src/glsl/glcpp/glcpp-lex.l"
#line 270 "src/glsl/glcpp/glcpp-lex.l"
{
yylval->str = ralloc_strdup (yyextra, yytext);
return INTEGER_STRING;
@ -1247,7 +1245,7 @@ YY_RULE_SETUP
YY_BREAK
case 25:
YY_RULE_SETUP
#line 277 "src/glsl/glcpp/glcpp-lex.l"
#line 275 "src/glsl/glcpp/glcpp-lex.l"
{
yylval->str = ralloc_strdup (yyextra, yytext);
return INTEGER_STRING;
@ -1255,7 +1253,7 @@ YY_RULE_SETUP
YY_BREAK
case 26:
YY_RULE_SETUP
#line 282 "src/glsl/glcpp/glcpp-lex.l"
#line 280 "src/glsl/glcpp/glcpp-lex.l"
{
yylval->str = ralloc_strdup (yyextra, yytext);
return INTEGER_STRING;
@ -1263,63 +1261,63 @@ YY_RULE_SETUP
YY_BREAK
case 27:
YY_RULE_SETUP
#line 287 "src/glsl/glcpp/glcpp-lex.l"
#line 285 "src/glsl/glcpp/glcpp-lex.l"
{
return LEFT_SHIFT;
}
YY_BREAK
case 28:
YY_RULE_SETUP
#line 291 "src/glsl/glcpp/glcpp-lex.l"
#line 289 "src/glsl/glcpp/glcpp-lex.l"
{
return RIGHT_SHIFT;
}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 295 "src/glsl/glcpp/glcpp-lex.l"
#line 293 "src/glsl/glcpp/glcpp-lex.l"
{
return LESS_OR_EQUAL;
}
YY_BREAK
case 30:
YY_RULE_SETUP
#line 299 "src/glsl/glcpp/glcpp-lex.l"
#line 297 "src/glsl/glcpp/glcpp-lex.l"
{
return GREATER_OR_EQUAL;
}
YY_BREAK
case 31:
YY_RULE_SETUP
#line 303 "src/glsl/glcpp/glcpp-lex.l"
#line 301 "src/glsl/glcpp/glcpp-lex.l"
{
return EQUAL;
}
YY_BREAK
case 32:
YY_RULE_SETUP
#line 307 "src/glsl/glcpp/glcpp-lex.l"
#line 305 "src/glsl/glcpp/glcpp-lex.l"
{
return NOT_EQUAL;
}
YY_BREAK
case 33:
YY_RULE_SETUP
#line 311 "src/glsl/glcpp/glcpp-lex.l"
#line 309 "src/glsl/glcpp/glcpp-lex.l"
{
return AND;
}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 315 "src/glsl/glcpp/glcpp-lex.l"
#line 313 "src/glsl/glcpp/glcpp-lex.l"
{
return OR;
}
YY_BREAK
case 35:
YY_RULE_SETUP
#line 319 "src/glsl/glcpp/glcpp-lex.l"
#line 317 "src/glsl/glcpp/glcpp-lex.l"
{
if (parser->is_gles)
glcpp_error(yylloc, yyextra, "Token pasting (##) is illegal in GLES");
@ -1328,14 +1326,14 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
#line 325 "src/glsl/glcpp/glcpp-lex.l"
#line 323 "src/glsl/glcpp/glcpp-lex.l"
{
return DEFINED;
}
YY_BREAK
case 37:
YY_RULE_SETUP
#line 329 "src/glsl/glcpp/glcpp-lex.l"
#line 327 "src/glsl/glcpp/glcpp-lex.l"
{
yylval->str = ralloc_strdup (yyextra, yytext);
return IDENTIFIER;
@ -1343,14 +1341,14 @@ YY_RULE_SETUP
YY_BREAK
case 38:
YY_RULE_SETUP
#line 334 "src/glsl/glcpp/glcpp-lex.l"
#line 332 "src/glsl/glcpp/glcpp-lex.l"
{
return yytext[0];
}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 338 "src/glsl/glcpp/glcpp-lex.l"
#line 336 "src/glsl/glcpp/glcpp-lex.l"
{
yylval->str = ralloc_strdup (yyextra, yytext);
return OTHER;
@ -1358,7 +1356,7 @@ YY_RULE_SETUP
YY_BREAK
case 40:
YY_RULE_SETUP
#line 343 "src/glsl/glcpp/glcpp-lex.l"
#line 341 "src/glsl/glcpp/glcpp-lex.l"
{
if (yyextra->space_tokens) {
return SPACE;
@ -1368,7 +1366,7 @@ YY_RULE_SETUP
case 41:
/* rule 41 can match eol */
YY_RULE_SETUP
#line 349 "src/glsl/glcpp/glcpp-lex.l"
#line 347 "src/glsl/glcpp/glcpp-lex.l"
{
if (parser->commented_newlines) {
BEGIN NEWLINE_CATCHUP;
@ -1381,7 +1379,7 @@ YY_RULE_SETUP
YY_BREAK
/* Handle missing newline at EOF. */
case YY_STATE_EOF(INITIAL):
#line 360 "src/glsl/glcpp/glcpp-lex.l"
#line 358 "src/glsl/glcpp/glcpp-lex.l"
{
BEGIN DONE; /* Don't keep matching this rule forever. */
yyextra->lexing_if = 0;
@ -1394,7 +1392,7 @@ case YY_STATE_EOF(INITIAL):
warnings. */
case 42:
YY_RULE_SETUP
#line 370 "src/glsl/glcpp/glcpp-lex.l"
#line 368 "src/glsl/glcpp/glcpp-lex.l"
{
unput('.');
yy_top_state(yyextra);
@ -1402,10 +1400,10 @@ YY_RULE_SETUP
YY_BREAK
case 43:
YY_RULE_SETUP
#line 375 "src/glsl/glcpp/glcpp-lex.l"
#line 373 "src/glsl/glcpp/glcpp-lex.l"
ECHO;
YY_BREAK
#line 1409 "src/glsl/glcpp/glcpp-lex.c"
#line 1407 "src/glsl/glcpp/glcpp-lex.c"
case YY_STATE_EOF(DONE):
case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(UNREACHABLE):
@ -2629,7 +2627,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
#line 375 "src/glsl/glcpp/glcpp-lex.l"
#line 373 "src/glsl/glcpp/glcpp-lex.l"

View file

@ -156,8 +156,6 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
/* Single-line comments */
"//"[^\n]* {
if (parser->commented_newlines)
BEGIN NEWLINE_CATCHUP;
}
/* Multi-line comments */

View file

@ -683,15 +683,15 @@ static const yytype_uint16 yyrline[] =
0, 188, 188, 190, 194, 197, 197, 208, 213, 214,
218, 221, 224, 232, 245, 248, 251, 257, 257, 260,
260, 270, 270, 292, 302, 302, 309, 309, 316, 341,
361, 361, 374, 374, 377, 380, 383, 389, 398, 403,
404, 409, 412, 415, 418, 421, 424, 427, 430, 433,
436, 439, 442, 445, 448, 451, 454, 462, 470, 473,
476, 479, 482, 485, 491, 496, 504, 505, 509, 515,
516, 519, 521, 528, 532, 536, 541, 545, 552, 557,
564, 568, 572, 576, 580, 587, 588, 589, 590, 591,
592, 593, 594, 595, 596, 597, 598, 599, 600, 601,
602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
612, 613, 614, 615, 616, 617
361, 361, 374, 374, 377, 383, 389, 395, 404, 409,
410, 415, 418, 421, 424, 427, 430, 433, 436, 439,
442, 445, 448, 451, 454, 457, 460, 468, 476, 479,
482, 485, 488, 491, 497, 502, 510, 511, 515, 521,
522, 525, 527, 534, 538, 542, 547, 551, 558, 563,
570, 574, 578, 582, 586, 593, 594, 595, 596, 597,
598, 599, 600, 601, 602, 603, 604, 605, 606, 607,
608, 609, 610, 611, 612, 613, 614, 615, 616, 617,
618, 619, 620, 621, 622, 623
};
#endif
@ -2251,21 +2251,27 @@ yyreduce:
/* Line 1787 of yacc.c */
#line 377 "src/glsl/glcpp/glcpp-parse.y"
{
if (parser->version_resolved) {
glcpp_error(& (yylsp[(1) - (3)]), parser, "#version must appear on the first line");
}
_glcpp_parser_handle_version_declaration(parser, (yyvsp[(2) - (3)].ival), NULL, true);
}
break;
case 35:
/* Line 1787 of yacc.c */
#line 380 "src/glsl/glcpp/glcpp-parse.y"
#line 383 "src/glsl/glcpp/glcpp-parse.y"
{
if (parser->version_resolved) {
glcpp_error(& (yylsp[(1) - (4)]), parser, "#version must appear on the first line");
}
_glcpp_parser_handle_version_declaration(parser, (yyvsp[(2) - (4)].ival), (yyvsp[(3) - (4)].str), true);
}
break;
case 36:
/* Line 1787 of yacc.c */
#line 383 "src/glsl/glcpp/glcpp-parse.y"
#line 389 "src/glsl/glcpp/glcpp-parse.y"
{
glcpp_parser_resolve_implicit_version(parser);
}
@ -2273,7 +2279,7 @@ yyreduce:
case 37:
/* Line 1787 of yacc.c */
#line 389 "src/glsl/glcpp/glcpp-parse.y"
#line 395 "src/glsl/glcpp/glcpp-parse.y"
{
if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) {
(yyval.ival) = (int)strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16);
@ -2287,7 +2293,7 @@ yyreduce:
case 38:
/* Line 1787 of yacc.c */
#line 398 "src/glsl/glcpp/glcpp-parse.y"
#line 404 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (1)].ival);
}
@ -2295,7 +2301,7 @@ yyreduce:
case 40:
/* Line 1787 of yacc.c */
#line 404 "src/glsl/glcpp/glcpp-parse.y"
#line 410 "src/glsl/glcpp/glcpp-parse.y"
{
if (parser->is_gles)
glcpp_error(& (yylsp[(1) - (1)]), parser, "undefined macro %s in expression (illegal in GLES)", (yyvsp[(1) - (1)].str));
@ -2305,7 +2311,7 @@ yyreduce:
case 41:
/* Line 1787 of yacc.c */
#line 409 "src/glsl/glcpp/glcpp-parse.y"
#line 415 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival);
}
@ -2313,7 +2319,7 @@ yyreduce:
case 42:
/* Line 1787 of yacc.c */
#line 412 "src/glsl/glcpp/glcpp-parse.y"
#line 418 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival);
}
@ -2321,7 +2327,7 @@ yyreduce:
case 43:
/* Line 1787 of yacc.c */
#line 415 "src/glsl/glcpp/glcpp-parse.y"
#line 421 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival);
}
@ -2329,7 +2335,7 @@ yyreduce:
case 44:
/* Line 1787 of yacc.c */
#line 418 "src/glsl/glcpp/glcpp-parse.y"
#line 424 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival);
}
@ -2337,7 +2343,7 @@ yyreduce:
case 45:
/* Line 1787 of yacc.c */
#line 421 "src/glsl/glcpp/glcpp-parse.y"
#line 427 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival);
}
@ -2345,7 +2351,7 @@ yyreduce:
case 46:
/* Line 1787 of yacc.c */
#line 424 "src/glsl/glcpp/glcpp-parse.y"
#line 430 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival);
}
@ -2353,7 +2359,7 @@ yyreduce:
case 47:
/* Line 1787 of yacc.c */
#line 427 "src/glsl/glcpp/glcpp-parse.y"
#line 433 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival);
}
@ -2361,7 +2367,7 @@ yyreduce:
case 48:
/* Line 1787 of yacc.c */
#line 430 "src/glsl/glcpp/glcpp-parse.y"
#line 436 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival);
}
@ -2369,7 +2375,7 @@ yyreduce:
case 49:
/* Line 1787 of yacc.c */
#line 433 "src/glsl/glcpp/glcpp-parse.y"
#line 439 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival);
}
@ -2377,7 +2383,7 @@ yyreduce:
case 50:
/* Line 1787 of yacc.c */
#line 436 "src/glsl/glcpp/glcpp-parse.y"
#line 442 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival);
}
@ -2385,7 +2391,7 @@ yyreduce:
case 51:
/* Line 1787 of yacc.c */
#line 439 "src/glsl/glcpp/glcpp-parse.y"
#line 445 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival);
}
@ -2393,7 +2399,7 @@ yyreduce:
case 52:
/* Line 1787 of yacc.c */
#line 442 "src/glsl/glcpp/glcpp-parse.y"
#line 448 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival);
}
@ -2401,7 +2407,7 @@ yyreduce:
case 53:
/* Line 1787 of yacc.c */
#line 445 "src/glsl/glcpp/glcpp-parse.y"
#line 451 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival);
}
@ -2409,7 +2415,7 @@ yyreduce:
case 54:
/* Line 1787 of yacc.c */
#line 448 "src/glsl/glcpp/glcpp-parse.y"
#line 454 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival);
}
@ -2417,7 +2423,7 @@ yyreduce:
case 55:
/* Line 1787 of yacc.c */
#line 451 "src/glsl/glcpp/glcpp-parse.y"
#line 457 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival);
}
@ -2425,7 +2431,7 @@ yyreduce:
case 56:
/* Line 1787 of yacc.c */
#line 454 "src/glsl/glcpp/glcpp-parse.y"
#line 460 "src/glsl/glcpp/glcpp-parse.y"
{
if ((yyvsp[(3) - (3)].ival) == 0) {
yyerror (& (yylsp[(1) - (3)]), parser,
@ -2438,7 +2444,7 @@ yyreduce:
case 57:
/* Line 1787 of yacc.c */
#line 462 "src/glsl/glcpp/glcpp-parse.y"
#line 468 "src/glsl/glcpp/glcpp-parse.y"
{
if ((yyvsp[(3) - (3)].ival) == 0) {
yyerror (& (yylsp[(1) - (3)]), parser,
@ -2451,7 +2457,7 @@ yyreduce:
case 58:
/* Line 1787 of yacc.c */
#line 470 "src/glsl/glcpp/glcpp-parse.y"
#line 476 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival);
}
@ -2459,7 +2465,7 @@ yyreduce:
case 59:
/* Line 1787 of yacc.c */
#line 473 "src/glsl/glcpp/glcpp-parse.y"
#line 479 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = ! (yyvsp[(2) - (2)].ival);
}
@ -2467,7 +2473,7 @@ yyreduce:
case 60:
/* Line 1787 of yacc.c */
#line 476 "src/glsl/glcpp/glcpp-parse.y"
#line 482 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = ~ (yyvsp[(2) - (2)].ival);
}
@ -2475,7 +2481,7 @@ yyreduce:
case 61:
/* Line 1787 of yacc.c */
#line 479 "src/glsl/glcpp/glcpp-parse.y"
#line 485 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = - (yyvsp[(2) - (2)].ival);
}
@ -2483,7 +2489,7 @@ yyreduce:
case 62:
/* Line 1787 of yacc.c */
#line 482 "src/glsl/glcpp/glcpp-parse.y"
#line 488 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = + (yyvsp[(2) - (2)].ival);
}
@ -2491,7 +2497,7 @@ yyreduce:
case 63:
/* Line 1787 of yacc.c */
#line 485 "src/glsl/glcpp/glcpp-parse.y"
#line 491 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(2) - (3)].ival);
}
@ -2499,7 +2505,7 @@ yyreduce:
case 64:
/* Line 1787 of yacc.c */
#line 491 "src/glsl/glcpp/glcpp-parse.y"
#line 497 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.string_list) = _string_list_create (parser);
_string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str));
@ -2509,7 +2515,7 @@ yyreduce:
case 65:
/* Line 1787 of yacc.c */
#line 496 "src/glsl/glcpp/glcpp-parse.y"
#line 502 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.string_list) = (yyvsp[(1) - (3)].string_list);
_string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str));
@ -2519,13 +2525,13 @@ yyreduce:
case 66:
/* Line 1787 of yacc.c */
#line 504 "src/glsl/glcpp/glcpp-parse.y"
#line 510 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; }
break;
case 68:
/* Line 1787 of yacc.c */
#line 509 "src/glsl/glcpp/glcpp-parse.y"
#line 515 "src/glsl/glcpp/glcpp-parse.y"
{
yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #");
}
@ -2533,13 +2539,13 @@ yyreduce:
case 69:
/* Line 1787 of yacc.c */
#line 515 "src/glsl/glcpp/glcpp-parse.y"
#line 521 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; }
break;
case 72:
/* Line 1787 of yacc.c */
#line 521 "src/glsl/glcpp/glcpp-parse.y"
#line 527 "src/glsl/glcpp/glcpp-parse.y"
{
glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive");
}
@ -2547,7 +2553,7 @@ yyreduce:
case 73:
/* Line 1787 of yacc.c */
#line 528 "src/glsl/glcpp/glcpp-parse.y"
#line 534 "src/glsl/glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0;
(yyval.token) = _token_create_ival (parser, INTEGER, v);
@ -2556,7 +2562,7 @@ yyreduce:
case 74:
/* Line 1787 of yacc.c */
#line 532 "src/glsl/glcpp/glcpp-parse.y"
#line 538 "src/glsl/glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0;
(yyval.token) = _token_create_ival (parser, INTEGER, v);
@ -2565,7 +2571,7 @@ yyreduce:
case 76:
/* Line 1787 of yacc.c */
#line 541 "src/glsl/glcpp/glcpp-parse.y"
#line 547 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token_list) = _token_list_create (parser);
_token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token));
@ -2574,7 +2580,7 @@ yyreduce:
case 77:
/* Line 1787 of yacc.c */
#line 545 "src/glsl/glcpp/glcpp-parse.y"
#line 551 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@ -2583,7 +2589,7 @@ yyreduce:
case 78:
/* Line 1787 of yacc.c */
#line 552 "src/glsl/glcpp/glcpp-parse.y"
#line 558 "src/glsl/glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
(yyval.token_list) = _token_list_create (parser);
@ -2593,7 +2599,7 @@ yyreduce:
case 79:
/* Line 1787 of yacc.c */
#line 557 "src/glsl/glcpp/glcpp-parse.y"
#line 563 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@ -2602,7 +2608,7 @@ yyreduce:
case 80:
/* Line 1787 of yacc.c */
#line 564 "src/glsl/glcpp/glcpp-parse.y"
#line 570 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
@ -2611,7 +2617,7 @@ yyreduce:
case 81:
/* Line 1787 of yacc.c */
#line 568 "src/glsl/glcpp/glcpp-parse.y"
#line 574 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
@ -2620,7 +2626,7 @@ yyreduce:
case 82:
/* Line 1787 of yacc.c */
#line 572 "src/glsl/glcpp/glcpp-parse.y"
#line 578 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival));
(yyval.token)->location = yylloc;
@ -2629,7 +2635,7 @@ yyreduce:
case 83:
/* Line 1787 of yacc.c */
#line 576 "src/glsl/glcpp/glcpp-parse.y"
#line 582 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
@ -2638,7 +2644,7 @@ yyreduce:
case 84:
/* Line 1787 of yacc.c */
#line 580 "src/glsl/glcpp/glcpp-parse.y"
#line 586 "src/glsl/glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, SPACE, SPACE);
(yyval.token)->location = yylloc;
@ -2647,193 +2653,193 @@ yyreduce:
case 85:
/* Line 1787 of yacc.c */
#line 587 "src/glsl/glcpp/glcpp-parse.y"
#line 593 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '['; }
break;
case 86:
/* Line 1787 of yacc.c */
#line 588 "src/glsl/glcpp/glcpp-parse.y"
#line 594 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = ']'; }
break;
case 87:
/* Line 1787 of yacc.c */
#line 589 "src/glsl/glcpp/glcpp-parse.y"
#line 595 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '('; }
break;
case 88:
/* Line 1787 of yacc.c */
#line 590 "src/glsl/glcpp/glcpp-parse.y"
#line 596 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = ')'; }
break;
case 89:
/* Line 1787 of yacc.c */
#line 591 "src/glsl/glcpp/glcpp-parse.y"
#line 597 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '{'; }
break;
case 90:
/* Line 1787 of yacc.c */
#line 592 "src/glsl/glcpp/glcpp-parse.y"
#line 598 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '}'; }
break;
case 91:
/* Line 1787 of yacc.c */
#line 593 "src/glsl/glcpp/glcpp-parse.y"
#line 599 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '.'; }
break;
case 92:
/* Line 1787 of yacc.c */
#line 594 "src/glsl/glcpp/glcpp-parse.y"
#line 600 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '&'; }
break;
case 93:
/* Line 1787 of yacc.c */
#line 595 "src/glsl/glcpp/glcpp-parse.y"
#line 601 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '*'; }
break;
case 94:
/* Line 1787 of yacc.c */
#line 596 "src/glsl/glcpp/glcpp-parse.y"
#line 602 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '+'; }
break;
case 95:
/* Line 1787 of yacc.c */
#line 597 "src/glsl/glcpp/glcpp-parse.y"
#line 603 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '-'; }
break;
case 96:
/* Line 1787 of yacc.c */
#line 598 "src/glsl/glcpp/glcpp-parse.y"
#line 604 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '~'; }
break;
case 97:
/* Line 1787 of yacc.c */
#line 599 "src/glsl/glcpp/glcpp-parse.y"
#line 605 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '!'; }
break;
case 98:
/* Line 1787 of yacc.c */
#line 600 "src/glsl/glcpp/glcpp-parse.y"
#line 606 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '/'; }
break;
case 99:
/* Line 1787 of yacc.c */
#line 601 "src/glsl/glcpp/glcpp-parse.y"
#line 607 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '%'; }
break;
case 100:
/* Line 1787 of yacc.c */
#line 602 "src/glsl/glcpp/glcpp-parse.y"
#line 608 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = LEFT_SHIFT; }
break;
case 101:
/* Line 1787 of yacc.c */
#line 603 "src/glsl/glcpp/glcpp-parse.y"
#line 609 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = RIGHT_SHIFT; }
break;
case 102:
/* Line 1787 of yacc.c */
#line 604 "src/glsl/glcpp/glcpp-parse.y"
#line 610 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '<'; }
break;
case 103:
/* Line 1787 of yacc.c */
#line 605 "src/glsl/glcpp/glcpp-parse.y"
#line 611 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '>'; }
break;
case 104:
/* Line 1787 of yacc.c */
#line 606 "src/glsl/glcpp/glcpp-parse.y"
#line 612 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = LESS_OR_EQUAL; }
break;
case 105:
/* Line 1787 of yacc.c */
#line 607 "src/glsl/glcpp/glcpp-parse.y"
#line 613 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = GREATER_OR_EQUAL; }
break;
case 106:
/* Line 1787 of yacc.c */
#line 608 "src/glsl/glcpp/glcpp-parse.y"
#line 614 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = EQUAL; }
break;
case 107:
/* Line 1787 of yacc.c */
#line 609 "src/glsl/glcpp/glcpp-parse.y"
#line 615 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = NOT_EQUAL; }
break;
case 108:
/* Line 1787 of yacc.c */
#line 610 "src/glsl/glcpp/glcpp-parse.y"
#line 616 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '^'; }
break;
case 109:
/* Line 1787 of yacc.c */
#line 611 "src/glsl/glcpp/glcpp-parse.y"
#line 617 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '|'; }
break;
case 110:
/* Line 1787 of yacc.c */
#line 612 "src/glsl/glcpp/glcpp-parse.y"
#line 618 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = AND; }
break;
case 111:
/* Line 1787 of yacc.c */
#line 613 "src/glsl/glcpp/glcpp-parse.y"
#line 619 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = OR; }
break;
case 112:
/* Line 1787 of yacc.c */
#line 614 "src/glsl/glcpp/glcpp-parse.y"
#line 620 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = ';'; }
break;
case 113:
/* Line 1787 of yacc.c */
#line 615 "src/glsl/glcpp/glcpp-parse.y"
#line 621 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = ','; }
break;
case 114:
/* Line 1787 of yacc.c */
#line 616 "src/glsl/glcpp/glcpp-parse.y"
#line 622 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = '='; }
break;
case 115:
/* Line 1787 of yacc.c */
#line 617 "src/glsl/glcpp/glcpp-parse.y"
#line 623 "src/glsl/glcpp/glcpp-parse.y"
{ (yyval.ival) = PASTE; }
break;
/* Line 1787 of yacc.c */
#line 2837 "src/glsl/glcpp/glcpp-parse.c"
#line 2843 "src/glsl/glcpp/glcpp-parse.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -3072,7 +3078,7 @@ yyreturn:
/* Line 2050 of yacc.c */
#line 620 "src/glsl/glcpp/glcpp-parse.y"
#line 626 "src/glsl/glcpp/glcpp-parse.y"
string_list_t *
@ -4573,6 +4579,12 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions->ARB_viewport_array)
add_builtin_define(parser, "GL_ARB_viewport_array", 1);
if (extensions->ARB_compute_shader)
add_builtin_define(parser, "GL_ARB_compute_shader", 1);
if (extensions->ARB_shader_image_load_store)
add_builtin_define(parser, "GL_ARB_shader_image_load_store", 1);
}
}

View file

@ -375,9 +375,15 @@ control_line:
_glcpp_parser_skip_stack_pop (parser, & @1);
} NEWLINE
| HASH_VERSION integer_constant NEWLINE {
if (parser->version_resolved) {
glcpp_error(& @1, parser, "#version must appear on the first line");
}
_glcpp_parser_handle_version_declaration(parser, $2, NULL, true);
}
| HASH_VERSION integer_constant IDENTIFIER NEWLINE {
if (parser->version_resolved) {
glcpp_error(& @1, parser, "#version must appear on the first line");
}
_glcpp_parser_handle_version_declaration(parser, $2, $3, true);
}
| HASH NEWLINE {
@ -2117,6 +2123,12 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions->ARB_viewport_array)
add_builtin_define(parser, "GL_ARB_viewport_array", 1);
if (extensions->ARB_compute_shader)
add_builtin_define(parser, "GL_ARB_compute_shader", 1);
if (extensions->ARB_shader_image_load_store)
add_builtin_define(parser, "GL_ARB_shader_image_load_store", 1);
}
}

File diff suppressed because it is too large Load diff

View file

@ -343,6 +343,51 @@ samplerExternalOES {
return IDENTIFIER;
}
/* keywords available with ARB_shader_image_load_store */
image1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE1D);
image2D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2D);
image3D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE3D);
image2DRect KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DRECT);
imageCube KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGECUBE);
imageBuffer KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGEBUFFER);
image1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE1DARRAY);
image2DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DARRAY);
imageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGECUBEARRAY);
image2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DMS);
image2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DMSARRAY);
iimage1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE1D);
iimage2D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2D);
iimage3D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE3D);
iimage2DRect KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DRECT);
iimageCube KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGECUBE);
iimageBuffer KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGEBUFFER);
iimage1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE1DARRAY);
iimage2DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DARRAY);
iimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGECUBEARRAY);
iimage2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DMS);
iimage2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DMSARRAY);
uimage1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE1D);
uimage2D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2D);
uimage3D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE3D);
uimage2DRect KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DRECT);
uimageCube KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGECUBE);
uimageBuffer KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGEBUFFER);
uimage1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE1DARRAY);
uimage2DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DARRAY);
uimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGECUBEARRAY);
uimage2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DMS);
uimage2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DMSARRAY);
image1DShadow KEYWORD(130, 300, 0, 0, IMAGE1DSHADOW);
image2DShadow KEYWORD(130, 300, 0, 0, IMAGE2DSHADOW);
image1DArrayShadow KEYWORD(130, 300, 0, 0, IMAGE1DARRAYSHADOW);
image2DArrayShadow KEYWORD(130, 300, 0, 0, IMAGE2DARRAYSHADOW);
coherent KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, COHERENT);
volatile KEYWORD_WITH_ALT(110, 100, 420, 0, yyextra->ARB_shader_image_load_store_enable, VOLATILE);
restrict KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, RESTRICT);
readonly KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, READONLY);
writeonly KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, WRITEONLY);
atomic_uint KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_atomic_counters_enable, ATOMIC_UINT);
struct return STRUCT;
@ -355,7 +400,8 @@ layout {
|| yyextra->ARB_explicit_attrib_location_enable
|| yyextra->ARB_uniform_buffer_object_enable
|| yyextra->ARB_fragment_coord_conventions_enable
|| yyextra->ARB_shading_language_420pack_enable) {
|| yyextra->ARB_shading_language_420pack_enable
|| yyextra->ARB_compute_shader_enable) {
return LAYOUT_TOK;
} else {
yylval->identifier = strdup(yytext);
@ -441,7 +487,6 @@ switch KEYWORD(110, 100, 130, 300, SWITCH);
default KEYWORD(110, 100, 130, 300, DEFAULT);
inline KEYWORD(110, 100, 0, 0, INLINE_TOK);
noinline KEYWORD(110, 100, 0, 0, NOINLINE);
volatile KEYWORD(110, 100, 0, 0, VOLATILE);
public KEYWORD(110, 100, 0, 0, PUBLIC_TOK);
static KEYWORD(110, 100, 0, 0, STATIC);
extern KEYWORD(110, 100, 0, 0, EXTERN);
@ -486,31 +531,6 @@ active KEYWORD(130, 300, 0, 0, ACTIVE);
superp KEYWORD(130, 100, 0, 0, SUPERP);
samplerBuffer KEYWORD(130, 300, 140, 0, SAMPLERBUFFER);
filter KEYWORD(130, 300, 0, 0, FILTER);
image1D KEYWORD(130, 300, 0, 0, IMAGE1D);
image2D KEYWORD(130, 300, 0, 0, IMAGE2D);
image3D KEYWORD(130, 300, 0, 0, IMAGE3D);
imageCube KEYWORD(130, 300, 0, 0, IMAGECUBE);
iimage1D KEYWORD(130, 300, 0, 0, IIMAGE1D);
iimage2D KEYWORD(130, 300, 0, 0, IIMAGE2D);
iimage3D KEYWORD(130, 300, 0, 0, IIMAGE3D);
iimageCube KEYWORD(130, 300, 0, 0, IIMAGECUBE);
uimage1D KEYWORD(130, 300, 0, 0, UIMAGE1D);
uimage2D KEYWORD(130, 300, 0, 0, UIMAGE2D);
uimage3D KEYWORD(130, 300, 0, 0, UIMAGE3D);
uimageCube KEYWORD(130, 300, 0, 0, UIMAGECUBE);
image1DArray KEYWORD(130, 300, 0, 0, IMAGE1DARRAY);
image2DArray KEYWORD(130, 300, 0, 0, IMAGE2DARRAY);
iimage1DArray KEYWORD(130, 300, 0, 0, IIMAGE1DARRAY);
iimage2DArray KEYWORD(130, 300, 0, 0, IIMAGE2DARRAY);
uimage1DArray KEYWORD(130, 300, 0, 0, UIMAGE1DARRAY);
uimage2DArray KEYWORD(130, 300, 0, 0, UIMAGE2DARRAY);
image1DShadow KEYWORD(130, 300, 0, 0, IMAGE1DSHADOW);
image2DShadow KEYWORD(130, 300, 0, 0, IMAGE2DSHADOW);
image1DArrayShadow KEYWORD(130, 300, 0, 0, IMAGE1DARRAYSHADOW);
image2DArrayShadow KEYWORD(130, 300, 0, 0, IMAGE2DARRAYSHADOW);
imageBuffer KEYWORD(130, 300, 0, 0, IMAGEBUFFER);
iimageBuffer KEYWORD(130, 300, 0, 0, IIMAGEBUFFER);
uimageBuffer KEYWORD(130, 300, 0, 0, UIMAGEBUFFER);
row_major KEYWORD_WITH_ALT(130, 0, 140, 0, yyextra->ARB_uniform_buffer_object_enable && !yyextra->es_shader, ROW_MAJOR);
/* Additional reserved words in GLSL 1.40 */
@ -520,10 +540,6 @@ isamplerBuffer KEYWORD(140, 300, 140, 0, ISAMPLERBUFFER);
usamplerBuffer KEYWORD(140, 300, 140, 0, USAMPLERBUFFER);
/* Additional reserved words in GLSL ES 3.00 */
coherent KEYWORD(0, 300, 0, 0, COHERENT);
restrict KEYWORD(0, 300, 0, 0, RESTRICT);
readonly KEYWORD(0, 300, 0, 0, READONLY);
writeonly KEYWORD(0, 300, 0, 0, WRITEONLY);
resource KEYWORD(0, 300, 0, 0, RESOURCE);
patch KEYWORD(0, 300, 0, 0, PATCH);
sample KEYWORD_WITH_ALT(400, 300, 400, 0, yyextra->ARB_gpu_shader5_enable, SAMPLE);

View file

@ -75,12 +75,14 @@ struct glslopt_ctx {
glslopt_ctx (glslopt_target target) {
mem_ctx = ralloc_context (NULL);
initialize_mesa_context (&mesa_ctx, target);
max_unroll_iterations = 8;
}
~glslopt_ctx() {
ralloc_free (mem_ctx);
}
struct gl_context mesa_ctx;
void* mem_ctx;
unsigned int max_unroll_iterations;
};
glslopt_ctx* glslopt_initialize (glslopt_target target)
@ -94,6 +96,11 @@ void glslopt_cleanup (glslopt_ctx* ctx)
_mesa_destroy_shader_compiler();
}
void glslopt_set_max_unroll_iterations (glslopt_ctx* ctx, unsigned iterations)
{
ctx->max_unroll_iterations = iterations;
}
struct glslopt_shader_input
{
const char* name;
@ -284,7 +291,7 @@ static bool propagate_precision(exec_list* list)
}
static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_state* state, void* mem_ctx)
static void do_optimization_passes(exec_list* ir, bool linked, unsigned max_unroll_iterations, _mesa_glsl_parse_state* state, void* mem_ctx)
{
bool progress;
do {
@ -336,7 +343,7 @@ static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_
loop_state *ls = analyze_loop_variables(ir);
if (ls->loop_found) {
progress2 = set_loop_controls(ir, ls); progress |= progress2; if (progress2) debug_print_ir ("After set loop", ir, state, mem_ctx);
progress2 = unroll_loops(ir, ls, 8); progress |= progress2; if (progress2) debug_print_ir ("After unroll", ir, state, mem_ctx);
progress2 = unroll_loops(ir, ls, max_unroll_iterations); progress |= progress2; if (progress2) debug_print_ir ("After unroll", ir, state, mem_ctx);
}
delete ls;
}
@ -443,7 +450,7 @@ glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, co
if (!state->error && !ir->is_empty())
{
const bool linked = !(options & kGlslOptionNotFullShader);
do_optimization_passes(ir, linked, state, shader);
do_optimization_passes(ir, linked, ctx->max_unroll_iterations, state, shader);
validate_ir_tree(ir);
}

View file

@ -45,6 +45,8 @@ enum glslopt_target {
glslopt_ctx* glslopt_initialize (glslopt_target target);
void glslopt_cleanup (glslopt_ctx* ctx);
void glslopt_set_max_unroll_iterations (glslopt_ctx* ctx, unsigned iterations);
glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, const char* shaderSource, unsigned options);
bool glslopt_get_status (glslopt_shader* shader);
const char* glslopt_get_output (glslopt_shader* shader);

File diff suppressed because it is too large Load diff

View file

@ -134,136 +134,148 @@ extern int _mesa_glsl_debug;
ISAMPLER2DMSARRAY = 343,
USAMPLER2DMSARRAY = 344,
SAMPLEREXTERNALOES = 345,
ATOMIC_UINT = 346,
STRUCT = 347,
VOID_TOK = 348,
WHILE = 349,
IDENTIFIER = 350,
TYPE_IDENTIFIER = 351,
NEW_IDENTIFIER = 352,
FLOATCONSTANT = 353,
INTCONSTANT = 354,
UINTCONSTANT = 355,
BOOLCONSTANT = 356,
FIELD_SELECTION = 357,
LEFT_OP = 358,
RIGHT_OP = 359,
INC_OP = 360,
DEC_OP = 361,
LE_OP = 362,
GE_OP = 363,
EQ_OP = 364,
NE_OP = 365,
AND_OP = 366,
OR_OP = 367,
XOR_OP = 368,
MUL_ASSIGN = 369,
DIV_ASSIGN = 370,
ADD_ASSIGN = 371,
MOD_ASSIGN = 372,
LEFT_ASSIGN = 373,
RIGHT_ASSIGN = 374,
AND_ASSIGN = 375,
XOR_ASSIGN = 376,
OR_ASSIGN = 377,
SUB_ASSIGN = 378,
INVARIANT = 379,
LOWP = 380,
MEDIUMP = 381,
HIGHP = 382,
SUPERP = 383,
PRECISION = 384,
VERSION_TOK = 385,
EXTENSION = 386,
LINE = 387,
COLON = 388,
EOL = 389,
INTERFACE = 390,
OUTPUT = 391,
PRAGMA_DEBUG_ON = 392,
PRAGMA_DEBUG_OFF = 393,
PRAGMA_OPTIMIZE_ON = 394,
PRAGMA_OPTIMIZE_OFF = 395,
PRAGMA_INVARIANT_ALL = 396,
LAYOUT_TOK = 397,
ASM = 398,
CLASS = 399,
UNION = 400,
ENUM = 401,
TYPEDEF = 402,
TEMPLATE = 403,
THIS = 404,
PACKED_TOK = 405,
GOTO = 406,
INLINE_TOK = 407,
NOINLINE = 408,
VOLATILE = 409,
PUBLIC_TOK = 410,
STATIC = 411,
EXTERN = 412,
EXTERNAL = 413,
LONG_TOK = 414,
SHORT_TOK = 415,
DOUBLE_TOK = 416,
HALF = 417,
FIXED_TOK = 418,
UNSIGNED = 419,
INPUT_TOK = 420,
OUPTUT = 421,
HVEC2 = 422,
HVEC3 = 423,
HVEC4 = 424,
DVEC2 = 425,
DVEC3 = 426,
DVEC4 = 427,
FVEC2 = 428,
FVEC3 = 429,
FVEC4 = 430,
SAMPLER3DRECT = 431,
SIZEOF = 432,
CAST = 433,
NAMESPACE = 434,
USING = 435,
COHERENT = 436,
RESTRICT = 437,
READONLY = 438,
WRITEONLY = 439,
RESOURCE = 440,
PATCH = 441,
SAMPLE = 442,
SUBROUTINE = 443,
ERROR_TOK = 444,
COMMON = 445,
PARTITION = 446,
ACTIVE = 447,
FILTER = 448,
IMAGE1D = 449,
IMAGE2D = 450,
IMAGE3D = 451,
IMAGECUBE = 452,
IMAGE1DARRAY = 453,
IMAGE2DARRAY = 454,
IIMAGE1D = 455,
IIMAGE2D = 456,
IIMAGE3D = 457,
IIMAGECUBE = 458,
IIMAGE1DARRAY = 459,
IIMAGE2DARRAY = 460,
UIMAGE1D = 461,
UIMAGE2D = 462,
UIMAGE3D = 463,
UIMAGECUBE = 464,
UIMAGE1DARRAY = 465,
UIMAGE2DARRAY = 466,
IMAGE1DSHADOW = 467,
IMAGE2DSHADOW = 468,
IMAGEBUFFER = 469,
IIMAGEBUFFER = 470,
UIMAGEBUFFER = 471,
IMAGE1DARRAYSHADOW = 472,
IMAGE2DARRAYSHADOW = 473,
ROW_MAJOR = 474,
THEN = 475
IMAGE1D = 346,
IMAGE2D = 347,
IMAGE3D = 348,
IMAGE2DRECT = 349,
IMAGECUBE = 350,
IMAGEBUFFER = 351,
IMAGE1DARRAY = 352,
IMAGE2DARRAY = 353,
IMAGECUBEARRAY = 354,
IMAGE2DMS = 355,
IMAGE2DMSARRAY = 356,
IIMAGE1D = 357,
IIMAGE2D = 358,
IIMAGE3D = 359,
IIMAGE2DRECT = 360,
IIMAGECUBE = 361,
IIMAGEBUFFER = 362,
IIMAGE1DARRAY = 363,
IIMAGE2DARRAY = 364,
IIMAGECUBEARRAY = 365,
IIMAGE2DMS = 366,
IIMAGE2DMSARRAY = 367,
UIMAGE1D = 368,
UIMAGE2D = 369,
UIMAGE3D = 370,
UIMAGE2DRECT = 371,
UIMAGECUBE = 372,
UIMAGEBUFFER = 373,
UIMAGE1DARRAY = 374,
UIMAGE2DARRAY = 375,
UIMAGECUBEARRAY = 376,
UIMAGE2DMS = 377,
UIMAGE2DMSARRAY = 378,
IMAGE1DSHADOW = 379,
IMAGE2DSHADOW = 380,
IMAGE1DARRAYSHADOW = 381,
IMAGE2DARRAYSHADOW = 382,
COHERENT = 383,
VOLATILE = 384,
RESTRICT = 385,
READONLY = 386,
WRITEONLY = 387,
ATOMIC_UINT = 388,
STRUCT = 389,
VOID_TOK = 390,
WHILE = 391,
IDENTIFIER = 392,
TYPE_IDENTIFIER = 393,
NEW_IDENTIFIER = 394,
FLOATCONSTANT = 395,
INTCONSTANT = 396,
UINTCONSTANT = 397,
BOOLCONSTANT = 398,
FIELD_SELECTION = 399,
LEFT_OP = 400,
RIGHT_OP = 401,
INC_OP = 402,
DEC_OP = 403,
LE_OP = 404,
GE_OP = 405,
EQ_OP = 406,
NE_OP = 407,
AND_OP = 408,
OR_OP = 409,
XOR_OP = 410,
MUL_ASSIGN = 411,
DIV_ASSIGN = 412,
ADD_ASSIGN = 413,
MOD_ASSIGN = 414,
LEFT_ASSIGN = 415,
RIGHT_ASSIGN = 416,
AND_ASSIGN = 417,
XOR_ASSIGN = 418,
OR_ASSIGN = 419,
SUB_ASSIGN = 420,
INVARIANT = 421,
LOWP = 422,
MEDIUMP = 423,
HIGHP = 424,
SUPERP = 425,
PRECISION = 426,
VERSION_TOK = 427,
EXTENSION = 428,
LINE = 429,
COLON = 430,
EOL = 431,
INTERFACE = 432,
OUTPUT = 433,
PRAGMA_DEBUG_ON = 434,
PRAGMA_DEBUG_OFF = 435,
PRAGMA_OPTIMIZE_ON = 436,
PRAGMA_OPTIMIZE_OFF = 437,
PRAGMA_INVARIANT_ALL = 438,
LAYOUT_TOK = 439,
ASM = 440,
CLASS = 441,
UNION = 442,
ENUM = 443,
TYPEDEF = 444,
TEMPLATE = 445,
THIS = 446,
PACKED_TOK = 447,
GOTO = 448,
INLINE_TOK = 449,
NOINLINE = 450,
PUBLIC_TOK = 451,
STATIC = 452,
EXTERN = 453,
EXTERNAL = 454,
LONG_TOK = 455,
SHORT_TOK = 456,
DOUBLE_TOK = 457,
HALF = 458,
FIXED_TOK = 459,
UNSIGNED = 460,
INPUT_TOK = 461,
OUPTUT = 462,
HVEC2 = 463,
HVEC3 = 464,
HVEC4 = 465,
DVEC2 = 466,
DVEC3 = 467,
DVEC4 = 468,
FVEC2 = 469,
FVEC3 = 470,
FVEC4 = 471,
SAMPLER3DRECT = 472,
SIZEOF = 473,
CAST = 474,
NAMESPACE = 475,
USING = 476,
RESOURCE = 477,
PATCH = 478,
SAMPLE = 479,
SUBROUTINE = 480,
ERROR_TOK = 481,
COMMON = 482,
PARTITION = 483,
ACTIVE = 484,
FILTER = 485,
ROW_MAJOR = 486,
THEN = 487
};
#endif
@ -311,7 +323,7 @@ typedef union YYSTYPE
/* Line 2053 of yacc.c */
#line 315 "src/glsl/glsl_parser.h"
#line 327 "src/glsl/glsl_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

View file

@ -150,6 +150,14 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
%token SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
%token SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
%token SAMPLEREXTERNALOES
%token IMAGE1D IMAGE2D IMAGE3D IMAGE2DRECT IMAGECUBE IMAGEBUFFER
%token IMAGE1DARRAY IMAGE2DARRAY IMAGECUBEARRAY IMAGE2DMS IMAGE2DMSARRAY
%token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGE2DRECT IIMAGECUBE IIMAGEBUFFER
%token IIMAGE1DARRAY IIMAGE2DARRAY IIMAGECUBEARRAY IIMAGE2DMS IIMAGE2DMSARRAY
%token UIMAGE1D UIMAGE2D UIMAGE3D UIMAGE2DRECT UIMAGECUBE UIMAGEBUFFER
%token UIMAGE1DARRAY UIMAGE2DARRAY UIMAGECUBEARRAY UIMAGE2DMS UIMAGE2DMSARRAY
%token IMAGE1DSHADOW IMAGE2DSHADOW IMAGE1DARRAYSHADOW IMAGE2DARRAYSHADOW
%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY
%token ATOMIC_UINT
%token STRUCT VOID_TOK WHILE
%token <identifier> IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER
@ -175,23 +183,17 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
/* Reserved words that are not actually used in the grammar.
*/
%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED_TOK GOTO
%token INLINE_TOK NOINLINE VOLATILE PUBLIC_TOK STATIC EXTERN EXTERNAL
%token INLINE_TOK NOINLINE PUBLIC_TOK STATIC EXTERN EXTERNAL
%token LONG_TOK SHORT_TOK DOUBLE_TOK HALF FIXED_TOK UNSIGNED INPUT_TOK OUPTUT
%token HVEC2 HVEC3 HVEC4 DVEC2 DVEC3 DVEC4 FVEC2 FVEC3 FVEC4
%token SAMPLER3DRECT
%token SIZEOF CAST NAMESPACE USING
%token COHERENT RESTRICT READONLY WRITEONLY RESOURCE PATCH SAMPLE
%token RESOURCE PATCH SAMPLE
%token SUBROUTINE
%token ERROR_TOK
%token COMMON PARTITION ACTIVE FILTER
%token IMAGE1D IMAGE2D IMAGE3D IMAGECUBE IMAGE1DARRAY IMAGE2DARRAY
%token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGECUBE IIMAGE1DARRAY IIMAGE2DARRAY
%token UIMAGE1D UIMAGE2D UIMAGE3D UIMAGECUBE UIMAGE1DARRAY UIMAGE2DARRAY
%token IMAGE1DSHADOW IMAGE2DSHADOW IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER
%token IMAGE1DARRAYSHADOW IMAGE2DARRAYSHADOW
%token ROW_MAJOR
%token COMMON PARTITION ACTIVE FILTER ROW_MAJOR
%type <identifier> variable_identifier
%type <node> statement
@ -1240,6 +1242,72 @@ layout_qualifier_id:
}
}
/* Layout qualifiers for ARB_shader_image_load_store. */
if (state->ARB_shader_image_load_store_enable ||
state->is_version(420, 0)) {
if (!$$.flags.i) {
static const struct {
const char *name;
GLenum format;
glsl_base_type base_type;
} map[] = {
{ "rgba32f", GL_RGBA32F, GLSL_TYPE_FLOAT },
{ "rgba16f", GL_RGBA16F, GLSL_TYPE_FLOAT },
{ "rg32f", GL_RG32F, GLSL_TYPE_FLOAT },
{ "rg16f", GL_RG16F, GLSL_TYPE_FLOAT },
{ "r11f_g11f_b10f", GL_R11F_G11F_B10F, GLSL_TYPE_FLOAT },
{ "r32f", GL_R32F, GLSL_TYPE_FLOAT },
{ "r16f", GL_R16F, GLSL_TYPE_FLOAT },
{ "rgba32ui", GL_RGBA32UI, GLSL_TYPE_UINT },
{ "rgba16ui", GL_RGBA16UI, GLSL_TYPE_UINT },
{ "rgb10_a2ui", GL_RGB10_A2UI, GLSL_TYPE_UINT },
{ "rgba8ui", GL_RGBA8UI, GLSL_TYPE_UINT },
{ "rg32ui", GL_RG32UI, GLSL_TYPE_UINT },
{ "rg16ui", GL_RG16UI, GLSL_TYPE_UINT },
{ "rg8ui", GL_RG8UI, GLSL_TYPE_UINT },
{ "r32ui", GL_R32UI, GLSL_TYPE_UINT },
{ "r16ui", GL_R16UI, GLSL_TYPE_UINT },
{ "r8ui", GL_R8UI, GLSL_TYPE_UINT },
{ "rgba32i", GL_RGBA32I, GLSL_TYPE_INT },
{ "rgba16i", GL_RGBA16I, GLSL_TYPE_INT },
{ "rgba8i", GL_RGBA8I, GLSL_TYPE_INT },
{ "rg32i", GL_RG32I, GLSL_TYPE_INT },
{ "rg16i", GL_RG16I, GLSL_TYPE_INT },
{ "rg8i", GL_RG8I, GLSL_TYPE_INT },
{ "r32i", GL_R32I, GLSL_TYPE_INT },
{ "r16i", GL_R16I, GLSL_TYPE_INT },
{ "r8i", GL_R8I, GLSL_TYPE_INT },
{ "rgba16", GL_RGBA16, GLSL_TYPE_FLOAT },
{ "rgb10_a2", GL_RGB10_A2, GLSL_TYPE_FLOAT },
{ "rgba8", GL_RGBA8, GLSL_TYPE_FLOAT },
{ "rg16", GL_RG16, GLSL_TYPE_FLOAT },
{ "rg8", GL_RG8, GLSL_TYPE_FLOAT },
{ "r16", GL_R16, GLSL_TYPE_FLOAT },
{ "r8", GL_R8, GLSL_TYPE_FLOAT },
{ "rgba16_snorm", GL_RGBA16_SNORM, GLSL_TYPE_FLOAT },
{ "rgba8_snorm", GL_RGBA8_SNORM, GLSL_TYPE_FLOAT },
{ "rg16_snorm", GL_RG16_SNORM, GLSL_TYPE_FLOAT },
{ "rg8_snorm", GL_RG8_SNORM, GLSL_TYPE_FLOAT },
{ "r16_snorm", GL_R16_SNORM, GLSL_TYPE_FLOAT },
{ "r8_snorm", GL_R8_SNORM, GLSL_TYPE_FLOAT }
};
for (unsigned i = 0; i < Elements(map); i++) {
if (match_layout_qualifier($1, map[i].name, state) == 0) {
$$.flags.q.explicit_image_format = 1;
$$.image_format = map[i].format;
$$.image_base_type = map[i].base_type;
break;
}
}
}
if (!$$.flags.i &&
match_layout_qualifier($1, "early_fragment_tests", state) == 0) {
$$.flags.q.early_fragment_tests = 1;
}
}
if (!$$.flags.i) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'", $1);
@ -1303,6 +1371,34 @@ layout_qualifier_id:
}
}
static const char *local_size_qualifiers[3] = {
"local_size_x",
"local_size_y",
"local_size_z",
};
for (int i = 0; i < 3; i++) {
if (match_layout_qualifier(local_size_qualifiers[i], $1,
state) == 0) {
if ($3 <= 0) {
_mesa_glsl_error(& @3, state,
"invalid %s of %d specified",
local_size_qualifiers[i], $3);
YYERROR;
} else if (!state->is_version(430, 0) &&
!state->ARB_compute_shader_enable) {
_mesa_glsl_error(& @3, state,
"%s qualifier requires GLSL 4.30 or "
"ARB_compute_shader",
local_size_qualifiers[i]);
YYERROR;
} else {
$$.flags.q.local_size |= (1 << i);
$$.local_size[i] = $3;
}
break;
}
}
/* If the identifier didn't match any known layout identifiers,
* emit an error.
*/
@ -1485,7 +1581,7 @@ type_qualifier:
"just before storage qualifiers");
}
$$ = $1;
$$.flags.i |= $2.flags.i;
$$.merge_qualifier(&@1, state, $2);
}
| storage_qualifier type_qualifier
{
@ -1571,6 +1667,32 @@ storage_qualifier:
$$.precision = ast_precision_none;
$$.flags.q.uniform = 1;
}
| COHERENT
{
memset(& $$, 0, sizeof($$));
$$.flags.q.coherent = 1;
}
| VOLATILE
{
memset(& $$, 0, sizeof($$));
$$.flags.q._volatile = 1;
}
| RESTRICT
{
STATIC_ASSERT(sizeof($$.flags.q) <= sizeof($$.flags.i));
memset(& $$, 0, sizeof($$));
$$.flags.q.restrict_flag = 1;
}
| READONLY
{
memset(& $$, 0, sizeof($$));
$$.flags.q.read_only = 1;
}
| WRITEONLY
{
memset(& $$, 0, sizeof($$));
$$.flags.q.write_only = 1;
}
;
array_specifier:
@ -1710,6 +1832,39 @@ basic_type_specifier_nonarray:
| SAMPLER2DMSARRAY { $$ = "sampler2DMSArray"; }
| ISAMPLER2DMSARRAY { $$ = "isampler2DMSArray"; }
| USAMPLER2DMSARRAY { $$ = "usampler2DMSArray"; }
| IMAGE1D { $$ = "image1D"; }
| IMAGE2D { $$ = "image2D"; }
| IMAGE3D { $$ = "image3D"; }
| IMAGE2DRECT { $$ = "image2DRect"; }
| IMAGECUBE { $$ = "imageCube"; }
| IMAGEBUFFER { $$ = "imageBuffer"; }
| IMAGE1DARRAY { $$ = "image1DArray"; }
| IMAGE2DARRAY { $$ = "image2DArray"; }
| IMAGECUBEARRAY { $$ = "imageCubeArray"; }
| IMAGE2DMS { $$ = "image2DMS"; }
| IMAGE2DMSARRAY { $$ = "image2DMSArray"; }
| IIMAGE1D { $$ = "iimage1D"; }
| IIMAGE2D { $$ = "iimage2D"; }
| IIMAGE3D { $$ = "iimage3D"; }
| IIMAGE2DRECT { $$ = "iimage2DRect"; }
| IIMAGECUBE { $$ = "iimageCube"; }
| IIMAGEBUFFER { $$ = "iimageBuffer"; }
| IIMAGE1DARRAY { $$ = "iimage1DArray"; }
| IIMAGE2DARRAY { $$ = "iimage2DArray"; }
| IIMAGECUBEARRAY { $$ = "iimageCubeArray"; }
| IIMAGE2DMS { $$ = "iimage2DMS"; }
| IIMAGE2DMSARRAY { $$ = "iimage2DMSArray"; }
| UIMAGE1D { $$ = "uimage1D"; }
| UIMAGE2D { $$ = "uimage2D"; }
| UIMAGE3D { $$ = "uimage3D"; }
| UIMAGE2DRECT { $$ = "uimage2DRect"; }
| UIMAGECUBE { $$ = "uimageCube"; }
| UIMAGEBUFFER { $$ = "uimageBuffer"; }
| UIMAGE1DARRAY { $$ = "uimage1DArray"; }
| UIMAGE2DARRAY { $$ = "uimage2DArray"; }
| UIMAGECUBEARRAY { $$ = "uimageCubeArray"; }
| UIMAGE2DMS { $$ = "uimage2DMS"; }
| UIMAGE2DMSARRAY { $$ = "uimage2DMSArray"; }
| ATOMIC_UINT { $$ = "atomic_uint"; }
;
@ -2226,7 +2381,7 @@ basic_interface_block:
"an instance name are not allowed");
}
unsigned interface_type_mask;
uint64_t interface_type_mask;
struct ast_type_qualifier temp_type_qualifier;
/* Get a bitmask containing only the in/out/uniform flags, allowing us
@ -2242,7 +2397,7 @@ basic_interface_block:
* production rule guarantees that only one bit will be set (and
* it will be in/out/uniform).
*/
unsigned block_interface_qualifier = $1.flags.i;
uint64_t block_interface_qualifier = $1.flags.i;
block->layout.flags.i |= block_interface_qualifier;
@ -2363,29 +2518,60 @@ layout_defaults:
{
void *ctx = state;
$$ = NULL;
if (state->stage != MESA_SHADER_GEOMETRY) {
switch (state->stage) {
case MESA_SHADER_GEOMETRY: {
if (!$1.flags.q.prim_type) {
_mesa_glsl_error(& @1, state,
"input layout qualifiers must specify a primitive"
" type");
} else {
/* Make sure this is a valid input primitive type. */
switch ($1.prim_type) {
case GL_POINTS:
case GL_LINES:
case GL_LINES_ADJACENCY:
case GL_TRIANGLES:
case GL_TRIANGLES_ADJACENCY:
$$ = new(ctx) ast_gs_input_layout(@1, $1.prim_type);
break;
default:
_mesa_glsl_error(&@1, state,
"invalid geometry shader input primitive type");
break;
}
}
}
break;
case MESA_SHADER_FRAGMENT:
if ($1.flags.q.early_fragment_tests) {
state->early_fragment_tests = true;
} else {
_mesa_glsl_error(& @1, state, "invalid input layout qualifier");
}
break;
case MESA_SHADER_COMPUTE: {
if ($1.flags.q.local_size == 0) {
_mesa_glsl_error(& @1, state,
"input layout qualifiers must specify a local "
"size");
} else {
/* Infer a local_size of 1 for every unspecified dimension */
unsigned local_size[3];
for (int i = 0; i < 3; i++) {
if ($1.flags.q.local_size & (1 << i))
local_size[i] = $1.local_size[i];
else
local_size[i] = 1;
}
$$ = new(ctx) ast_cs_input_layout(@1, local_size);
}
}
break;
default:
_mesa_glsl_error(& @1, state,
"input layout qualifiers only valid in "
"geometry shaders");
} else if (!$1.flags.q.prim_type) {
_mesa_glsl_error(& @1, state,
"input layout qualifiers must specify a primitive"
" type");
} else {
/* Make sure this is a valid input primitive type. */
switch ($1.prim_type) {
case GL_POINTS:
case GL_LINES:
case GL_LINES_ADJACENCY:
case GL_TRIANGLES:
case GL_TRIANGLES_ADJACENCY:
$$ = new(ctx) ast_gs_input_layout(@1, $1.prim_type);
break;
default:
_mesa_glsl_error(&@1, state,
"invalid geometry shader input primitive type");
break;
}
"geometry, fragment and compute shaders");
break;
}
}

View file

@ -56,7 +56,8 @@ static unsigned known_desktop_glsl_versions[] =
_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
gl_shader_stage stage,
void *mem_ctx)
: ctx(_ctx), switch_state()
: ctx(_ctx), cs_input_local_size_specified(false), cs_input_local_size(),
switch_state()
{
assert(stage < MESA_SHADER_STAGES);
this->stage = stage;
@ -82,6 +83,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
ctx->Const.ForceGLSLVersion : 110;
this->es_shader = false;
this->had_version_string = false;
this->had_float_precision = false;
this->ARB_texture_rectangle_enable = true;
/* OpenGL ES 2.0 has different defaults from desktop GL. */
@ -124,6 +126,20 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
/* Compute shader constants */
for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupCount); i++)
this->Const.MaxComputeWorkGroupCount[i] = ctx->Const.MaxComputeWorkGroupCount[i];
for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupSize); i++)
this->Const.MaxComputeWorkGroupSize[i] = ctx->Const.MaxComputeWorkGroupSize[i];
this->Const.MaxImageUnits = ctx->Const.MaxImageUnits;
this->Const.MaxCombinedImageUnitsAndFragmentOutputs = ctx->Const.MaxCombinedImageUnitsAndFragmentOutputs;
this->Const.MaxImageSamples = ctx->Const.MaxImageSamples;
this->Const.MaxVertexImageUniforms = ctx->Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms;
this->Const.MaxGeometryImageUniforms = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms;
this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms;
this->current_function = NULL;
this->toplevel_ir = NULL;
this->found_return = false;
@ -191,6 +207,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->gs_input_prim_type = GL_POINTS;
this->gs_input_size = 0;
this->out_qualifier = new(this) ast_type_qualifier();
this->early_fragment_tests = false;
memset(this->atomic_counter_offsets, 0,
sizeof(this->atomic_counter_offsets));
}
@ -524,6 +541,8 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(ARB_sample_shading, true, false, ARB_sample_shading),
EXT(AMD_shader_trinary_minmax, true, false, dummy_true),
EXT(ARB_viewport_array, true, false, ARB_viewport_array),
EXT(ARB_compute_shader, true, false, ARB_compute_shader),
EXT(ARB_shader_image_load_store, true, false, ARB_shader_image_load_store),
};
#undef EXT
@ -1337,23 +1356,45 @@ set_shader_inout_layout(struct gl_shader *shader,
/* Should have been prevented by the parser. */
assert(!state->gs_input_prim_type_specified);
assert(!state->out_qualifier->flags.i);
return;
}
shader->Geom.VerticesOut = 0;
if (state->out_qualifier->flags.q.max_vertices)
shader->Geom.VerticesOut = state->out_qualifier->max_vertices;
if (state->gs_input_prim_type_specified) {
shader->Geom.InputType = state->gs_input_prim_type;
} else {
shader->Geom.InputType = PRIM_UNKNOWN;
if (shader->Stage != MESA_SHADER_COMPUTE) {
/* Should have been prevented by the parser. */
assert(!state->cs_input_local_size_specified);
}
if (state->out_qualifier->flags.q.prim_type) {
shader->Geom.OutputType = state->out_qualifier->prim_type;
} else {
shader->Geom.OutputType = PRIM_UNKNOWN;
switch (shader->Stage) {
case MESA_SHADER_GEOMETRY:
shader->Geom.VerticesOut = 0;
if (state->out_qualifier->flags.q.max_vertices)
shader->Geom.VerticesOut = state->out_qualifier->max_vertices;
if (state->gs_input_prim_type_specified) {
shader->Geom.InputType = state->gs_input_prim_type;
} else {
shader->Geom.InputType = PRIM_UNKNOWN;
}
if (state->out_qualifier->flags.q.prim_type) {
shader->Geom.OutputType = state->out_qualifier->prim_type;
} else {
shader->Geom.OutputType = PRIM_UNKNOWN;
}
break;
case MESA_SHADER_COMPUTE:
if (state->cs_input_local_size_specified) {
for (int i = 0; i < 3; i++)
shader->Comp.LocalSize[i] = state->cs_input_local_size[i];
} else {
for (int i = 0; i < 3; i++)
shader->Comp.LocalSize[i] = 0;
}
break;
default:
/* Nothing to do. */
break;
}
}

View file

@ -166,6 +166,7 @@ struct _mesa_glsl_parse_state {
bool es_shader;
unsigned language_version;
bool had_version_string;
bool had_float_precision;
gl_shader_stage stage;
/**
@ -197,6 +198,21 @@ struct _mesa_glsl_parse_state {
*/
GLenum gs_input_prim_type;
/**
* True if a compute shader input local size was specified using a layout
* directive.
*
* Note: this value is computed at ast_to_hir time rather than at parse
* time.
*/
bool cs_input_local_size_specified;
/**
* If cs_input_local_size_specified is true, the local size that was
* specified. Otherwise ignored.
*/
unsigned cs_input_local_size[3];
/** Output layout qualifiers from GLSL 1.50. (geometry shader controls)*/
struct ast_type_qualifier *out_qualifier;
@ -251,6 +267,19 @@ struct _mesa_glsl_parse_state {
unsigned MaxFragmentAtomicCounters;
unsigned MaxCombinedAtomicCounters;
unsigned MaxAtomicBufferBindings;
/* ARB_compute_shader */
unsigned MaxComputeWorkGroupCount[3];
unsigned MaxComputeWorkGroupSize[3];
/* ARB_shader_image_load_store */
unsigned MaxImageUnits;
unsigned MaxCombinedImageUnitsAndFragmentOutputs;
unsigned MaxImageSamples;
unsigned MaxVertexImageUniforms;
unsigned MaxGeometryImageUniforms;
unsigned MaxFragmentImageUniforms;
unsigned MaxCombinedImageUniforms;
} Const;
/**
@ -363,6 +392,10 @@ struct _mesa_glsl_parse_state {
bool AMD_shader_trinary_minmax_warn;
bool ARB_viewport_array_enable;
bool ARB_viewport_array_warn;
bool ARB_compute_shader_enable;
bool ARB_compute_shader_warn;
bool ARB_shader_image_load_store_enable;
bool ARB_shader_image_load_store_warn;
/*@}*/
/** Extensions supported by the OpenGL implementation. */
@ -379,6 +412,8 @@ struct _mesa_glsl_parse_state {
*/
unsigned gs_input_size;
bool early_fragment_tests;
/** Atomic counter offsets by binding */
unsigned atomic_counter_offsets[MAX_COMBINED_ATOMIC_BUFFERS];
};

View file

@ -65,20 +65,26 @@ glsl_type::glsl_type(GLenum gl_type,
memset(& fields, 0, sizeof(fields));
}
glsl_type::glsl_type(GLenum gl_type,
glsl_type::glsl_type(GLenum gl_type, glsl_base_type base_type,
enum glsl_sampler_dim dim, bool shadow, bool array,
unsigned type, const char *name) :
gl_type(gl_type),
base_type(GLSL_TYPE_SAMPLER),
base_type(base_type),
sampler_dimensionality(dim), sampler_shadow(shadow),
sampler_array(array), sampler_type(type), interface_packing(0),
vector_elements(0), matrix_columns(0),
length(0)
{
init_ralloc_type_ctx();
assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
memset(& fields, 0, sizeof(fields));
if (base_type == GLSL_TYPE_SAMPLER) {
/* Samplers take no storage whatsoever. */
matrix_columns = vector_elements = 0;
} else {
matrix_columns = vector_elements = 1;
}
}
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
@ -177,6 +183,7 @@ bool
glsl_type::contains_opaque() const {
switch (base_type) {
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
return true;
case GLSL_TYPE_ARRAY:
@ -222,6 +229,21 @@ glsl_type::sampler_index() const
}
}
bool
glsl_type::contains_image() const
{
if (this->is_array()) {
return this->fields.array->contains_image();
} else if (this->is_record()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_image())
return true;
}
return false;
} else {
return this->is_image();
}
}
const glsl_type *glsl_type::get_base_type() const
{
@ -662,6 +684,9 @@ glsl_type::component_slots() const
case GLSL_TYPE_ARRAY:
return this->length * this->fields.array->component_slots();
case GLSL_TYPE_IMAGE:
return 1;
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
@ -952,6 +977,7 @@ glsl_type::count_attribute_slots() const
return this->length * this->fields.array->count_attribute_slots();
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
@ -964,10 +990,8 @@ glsl_type::count_attribute_slots() const
}
int
glsl_type::sampler_coordinate_components() const
glsl_type::coordinate_components() const
{
assert(is_sampler());
int size;
switch (sampler_dimensionality) {

View file

@ -53,6 +53,7 @@ enum glsl_base_type {
GLSL_TYPE_FLOAT,
GLSL_TYPE_BOOL,
GLSL_TYPE_SAMPLER,
GLSL_TYPE_IMAGE,
GLSL_TYPE_ATOMIC_UINT,
GLSL_TYPE_STRUCT,
GLSL_TYPE_INTERFACE,
@ -96,8 +97,9 @@ struct glsl_type {
unsigned sampler_dimensionality:3; /**< \see glsl_sampler_dim */
unsigned sampler_shadow:1;
unsigned sampler_array:1;
unsigned sampler_type:2; /**< Type of data returned using this sampler.
* only \c GLSL_TYPE_FLOAT, \c GLSL_TYPE_INT,
unsigned sampler_type:2; /**< Type of data returned using this
* sampler or image. Only \c
* GLSL_TYPE_FLOAT, \c GLSL_TYPE_INT,
* and \c GLSL_TYPE_UINT are valid.
*/
unsigned interface_packing:2;
@ -408,6 +410,20 @@ struct glsl_type {
*/
gl_texture_index sampler_index() const;
/**
* Query whether or not type is an image, or for struct and array
* types, contains an image.
*/
bool contains_image() const;
/**
* Query whether or not a type is an image
*/
bool is_image() const
{
return base_type == GLSL_TYPE_IMAGE;
}
/**
* Query whether or not a type is an array
*/
@ -541,7 +557,8 @@ struct glsl_type {
}
/**
* Return the number of coordinate components needed for this sampler type.
* Return the number of coordinate components needed for this
* sampler or image type.
*
* This is based purely on the sampler's dimensionality. For example, this
* returns 1 for sampler1D, and 3 for sampler2DArray.
@ -550,7 +567,7 @@ struct glsl_type {
* a texturing built-in function, since those pack additional values (such
* as the shadow comparitor or projector) into the coordinate type.
*/
int sampler_coordinate_components() const;
int coordinate_components() const;
/**
* Compare a record type against another record type.
@ -574,8 +591,8 @@ private:
glsl_base_type base_type, unsigned vector_elements,
unsigned matrix_columns, const char *name);
/** Constructor for sampler types */
glsl_type(GLenum gl_type,
/** Constructor for sampler or image types */
glsl_type(GLenum gl_type, glsl_base_type base_type,
enum glsl_sampler_dim dim, bool shadow, bool array,
unsigned type, const char *name);

View file

@ -1351,13 +1351,13 @@ ir_dereference::is_lvalue() const
if ((var == NULL) || var->data.read_only)
return false;
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Samplers cannot be treated as l-values; hence cannot be used
* as out or inout function parameters, nor can they be
* assigned into."
* "Opaque variables cannot be treated as l-values; hence cannot
* be used as out or inout function parameters, nor can they be
* assigned into."
*/
if (this->type->contains_sampler())
if (this->type->contains_opaque())
return false;
return true;
@ -1595,6 +1595,11 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
this->data.max_array_access = 0;
this->data.atomic.buffer_index = 0;
this->data.atomic.offset = 0;
this->data.image.read_only = false;
this->data.image.write_only = false;
this->data.image.coherent = false;
this->data.image._volatile = false;
this->data.image.restrict_flag = false;
if (type != NULL) {
if (type->base_type == GLSL_TYPE_SAMPLER)
@ -1700,7 +1705,12 @@ ir_function_signature::qualifiers_match(exec_list *params)
!modes_match(a->data.mode, b->data.mode) ||
a->data.interpolation != b->data.interpolation ||
a->data.centroid != b->data.centroid ||
a->data.sample != b->data.sample) {
a->data.sample != b->data.sample ||
a->data.image.read_only != b->data.image.read_only ||
a->data.image.write_only != b->data.image.write_only ||
a->data.image.coherent != b->data.image.coherent ||
a->data.image._volatile != b->data.image._volatile ||
a->data.image.restrict_flag != b->data.image.restrict_flag) {
/* parameter a's qualifiers don't match */
return a->name;

View file

@ -479,7 +479,7 @@ public:
void reinit_interface_type(const struct glsl_type *type)
{
if (this->max_ifc_array_access != NULL) {
#ifndef _NDEBUG
#ifndef NDEBUG
/* Redeclaring gl_PerVertex is only allowed if none of the built-ins
* it defines have been accessed yet; so it's safe to throw away the
* old max_ifc_array_access pointer, since all of its values are
@ -700,6 +700,20 @@ public:
unsigned offset;
} atomic;
/**
* ARB_shader_image_load_store qualifiers.
*/
struct {
bool read_only; /**< "readonly" qualifier. */
bool write_only; /**< "writeonly" qualifier. */
bool coherent;
bool _volatile;
bool restrict_flag;
/** Image internal format if specified explicitly, otherwise GL_NONE. */
GLenum format;
} image;
/**
* Highest element accessed with a constant expression array index
*

View file

@ -375,6 +375,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const
}
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:

View file

@ -336,6 +336,17 @@ void ir_print_glsl_visitor::print_precision (ir_instruction* ir, const glsl_type
}
glsl_precision prec = precision_from_ir(ir);
// In fragment shader, default float precision is undefined.
// We must thus always print it, when there was no default precision
// and for whatever reason our type ended up having undefined precision.
if (prec == glsl_precision_undefined &&
type && type->is_float() &&
// this->state->stage == MESA_SHADER_FRAGMENT &&
!this->state->had_float_precision)
{
prec = glsl_precision_medium;
}
// skip precision for samplers that end up being lowp (default anyway) or undefined;
// except always emit it for shadowmap samplers (some drivers don't implement
// default EXT_shadow_samplers precision)

View file

@ -78,6 +78,26 @@ struct gl_uniform_driver_storage {
void *data;
};
struct gl_opaque_uniform_index {
/**
* Base opaque uniform index
*
* If \c gl_uniform_storage::base_type is an opaque type, this
* represents its uniform index. If \c
* gl_uniform_storage::array_elements is not zero, the array will
* use opaque uniform indices \c index through \c index + \c
* gl_uniform_storage::array_elements - 1, inclusive.
*
* Note that the index may be different in each shader stage.
*/
uint8_t index;
/**
* Whether this opaque uniform is used in this shader stage.
*/
bool active;
};
struct gl_uniform_storage {
char *name;
/** Type of this uniform data stored.
@ -99,24 +119,9 @@ struct gl_uniform_storage {
*/
bool initialized;
struct {
/**
* Base sampler index
*
* If \c ::base_type is \c GLSL_TYPE_SAMPLER, this represents the index
* of this sampler. If \c ::array_elements is not zero, the array will
* use sampler indices \c ::sampler through \c ::sampler +
* \c ::array_elements - 1, inclusive.
*
* Note that the index may be different in each shader stage.
*/
uint8_t index;
struct gl_opaque_uniform_index sampler[MESA_SHADER_STAGES];
/**
* Whether this sampler is used in this shader stage.
*/
bool active;
} sampler[MESA_SHADER_STAGES];
struct gl_opaque_uniform_index image[MESA_SHADER_STAGES];
/**
* Storage used by the driver for the uniform

View file

@ -69,6 +69,7 @@ copy_constant_to_storage(union gl_constant_value *storage,
break;
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_INTERFACE:
case GLSL_TYPE_VOID:

View file

@ -240,7 +240,8 @@ class count_uniform_size : public program_resource_visitor {
public:
count_uniform_size(struct string_to_uint_map *map)
: num_active_uniforms(0), num_values(0), num_shader_samplers(0),
num_shader_uniform_components(0), is_ubo_var(false), map(map)
num_shader_images(0), num_shader_uniform_components(0),
is_ubo_var(false), map(map)
{
/* empty */
}
@ -248,6 +249,7 @@ public:
void start_shader()
{
this->num_shader_samplers = 0;
this->num_shader_images = 0;
this->num_shader_uniform_components = 0;
}
@ -276,6 +278,11 @@ public:
*/
unsigned num_shader_samplers;
/**
* Number of images used
*/
unsigned num_shader_images;
/**
* Number of uniforms used in the current shader
*/
@ -303,6 +310,15 @@ private:
if (type->contains_sampler()) {
this->num_shader_samplers +=
type->is_array() ? type->array_size() : 1;
} else if (type->contains_image()) {
this->num_shader_images += values;
/* As drivers are likely to represent image uniforms as
* scalar indices, count them against the limit of uniform
* components in the default block. The spec allows image
* uniforms to use up no more than one scalar slot.
*/
this->num_shader_uniform_components += values;
} else {
/* Accumulate the total number of uniform slots used by this shader.
* Note that samplers do not count against this limit because they
@ -364,6 +380,7 @@ public:
this->shader_samplers_used = 0;
this->shader_shadow_samplers = 0;
this->next_sampler = 0;
this->next_image = 0;
memset(this->targets, 0, sizeof(this->targets));
}
@ -460,6 +477,24 @@ private:
}
}
void handle_images(const glsl_type *base_type,
struct gl_uniform_storage *uniform)
{
if (base_type->is_image()) {
uniform->image[shader_type].index = this->next_image;
uniform->image[shader_type].active = true;
/* Increment the image index by 1 for non-arrays and by the
* number of array elements for arrays.
*/
this->next_image += MAX2(1, uniform->array_elements);
} else {
uniform->image[shader_type].index = ~0;
uniform->image[shader_type].active = false;
}
}
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
{
@ -495,8 +530,9 @@ private:
base_type = type;
}
/* This assigns sampler uniforms to sampler units. */
/* This assigns uniform indices to sampler and image uniforms. */
handle_samplers(base_type, &this->uniforms[id]);
handle_images(base_type, &this->uniforms[id]);
/* If there is already storage associated with this uniform, it means
* that it was set while processing an earlier shader stage. For
@ -554,6 +590,7 @@ private:
struct gl_uniform_storage *uniforms;
unsigned next_sampler;
unsigned next_image;
public:
union gl_constant_value *values;
@ -720,6 +757,40 @@ link_assign_uniform_block_offsets(struct gl_shader *shader)
}
}
/**
* Scan the program for image uniforms and store image unit access
* information into the gl_shader data structure.
*/
static void
link_set_image_access_qualifiers(struct gl_shader_program *prog)
{
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
gl_shader *sh = prog->_LinkedShaders[i];
if (sh == NULL)
continue;
foreach_list(node, sh->ir) {
ir_variable *var = ((ir_instruction *) node)->as_variable();
if (var && var->data.mode == ir_var_uniform &&
var->type->contains_image()) {
unsigned id;
bool found = prog->UniformHash->get(id, var->name);
assert(found);
const gl_uniform_storage *storage = &prog->UniformStorage[id];
const unsigned index = storage->image[i].index;
const GLenum access = (var->data.image.read_only ? GL_READ_ONLY :
var->data.image.write_only ? GL_WRITE_ONLY :
GL_READ_WRITE);
for (unsigned j = 0; j < MAX2(1, storage->array_elements); ++j)
sh->ImageAccess[index + j] = access;
}
}
}
}
void
link_assign_uniform_locations(struct gl_shader_program *prog)
{
@ -757,6 +828,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
* types cannot have initializers."
*/
memset(sh->SamplerUnits, 0, sizeof(sh->SamplerUnits));
memset(sh->ImageUnits, 0, sizeof(sh->ImageUnits));
link_update_uniform_buffer_variables(sh);
@ -782,6 +854,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
}
sh->num_samplers = uniform_size.num_shader_samplers;
sh->NumImages = uniform_size.num_shader_images;
sh->num_uniform_components = uniform_size.num_shader_uniform_components;
sh->num_combined_uniform_components = sh->num_uniform_components;
@ -862,6 +935,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
prog->NumUserUniformStorage = num_user_uniforms;
prog->UniformStorage = uniforms;
link_set_image_access_qualifiers(prog);
link_set_uniform_initializers(prog);
return;

View file

@ -1291,6 +1291,69 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
prog->Geom.VerticesOut = linked_shader->Geom.VerticesOut;
}
/**
* Perform cross-validation of compute shader local_size_{x,y,z} layout
* qualifiers for the attached compute shaders, and propagate them to the
* linked CS and linked shader program.
*/
static void
link_cs_input_layout_qualifiers(struct gl_shader_program *prog,
struct gl_shader *linked_shader,
struct gl_shader **shader_list,
unsigned num_shaders)
{
for (int i = 0; i < 3; i++)
linked_shader->Comp.LocalSize[i] = 0;
/* This function is called for all shader stages, but it only has an effect
* for compute shaders.
*/
if (linked_shader->Stage != MESA_SHADER_COMPUTE)
return;
/* From the ARB_compute_shader spec, in the section describing local size
* declarations:
*
* If multiple compute shaders attached to a single program object
* declare local work-group size, the declarations must be identical;
* otherwise a link-time error results. Furthermore, if a program
* object contains any compute shaders, at least one must contain an
* input layout qualifier specifying the local work sizes of the
* program, or a link-time error will occur.
*/
for (unsigned sh = 0; sh < num_shaders; sh++) {
struct gl_shader *shader = shader_list[sh];
if (shader->Comp.LocalSize[0] != 0) {
if (linked_shader->Comp.LocalSize[0] != 0) {
for (int i = 0; i < 3; i++) {
if (linked_shader->Comp.LocalSize[i] !=
shader->Comp.LocalSize[i]) {
linker_error(prog, "compute shader defined with conflicting "
"local sizes\n");
return;
}
}
}
for (int i = 0; i < 3; i++)
linked_shader->Comp.LocalSize[i] = shader->Comp.LocalSize[i];
}
}
/* Just do the intrastage -> interstage propagation right now,
* since we already know we're in the right type of shader program
* for doing it.
*/
if (linked_shader->Comp.LocalSize[0] == 0) {
linker_error(prog, "compute shader didn't declare local size\n");
return;
}
for (int i = 0; i < 3; i++)
prog->Comp.LocalSize[i] = linked_shader->Comp.LocalSize[i];
}
/**
* Combine a group of shaders for a single stage to generate a linked shader
*
@ -1395,6 +1458,7 @@ link_intrastage_shaders(void *mem_ctx,
ralloc_steal(linked, linked->UniformBlocks);
link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders);
link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders);
populate_symbol_table(linked);
@ -1971,6 +2035,46 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
}
}
/**
* Validate shader image resources.
*/
static void
check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog)
{
unsigned total_image_units = 0;
unsigned fragment_outputs = 0;
if (!ctx->Extensions.ARB_shader_image_load_store)
return;
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
struct gl_shader *sh = prog->_LinkedShaders[i];
if (sh) {
if (sh->NumImages > ctx->Const.Program[i].MaxImageUniforms)
linker_error(prog, "Too many %s shader image uniforms",
_mesa_shader_stage_to_string(i));
total_image_units += sh->NumImages;
if (i == MESA_SHADER_FRAGMENT) {
foreach_list(node, sh->ir) {
ir_variable *var = ((ir_instruction *)node)->as_variable();
if (var && var->data.mode == ir_var_shader_out)
fragment_outputs += var->type->count_attribute_slots();
}
}
}
}
if (total_image_units > ctx->Const.MaxCombinedImageUniforms)
linker_error(prog, "Too many combined image uniforms");
if (total_image_units + fragment_outputs >
ctx->Const.MaxCombinedImageUnitsAndFragmentOutputs)
linker_error(prog, "Too many combined image uniforms and fragment outputs");
}
void
link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
{
@ -2049,6 +2153,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
}
/* Compute shaders have additional restrictions. */
if (num_shaders[MESA_SHADER_COMPUTE] > 0 &&
num_shaders[MESA_SHADER_COMPUTE] != prog->NumShaders) {
linker_error(prog, "Compute shaders may not be linked with any other "
"type of shader\n");
}
for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
if (prog->_LinkedShaders[i] != NULL)
ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);
@ -2102,7 +2213,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
unsigned prev;
for (prev = 0; prev < MESA_SHADER_STAGES; prev++) {
for (prev = 0; prev <= MESA_SHADER_FRAGMENT; prev++) {
if (prog->_LinkedShaders[prev] != NULL)
break;
}
@ -2110,7 +2221,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
/* Validate the inputs of each stage with the output of the preceding
* stage.
*/
for (unsigned i = prev + 1; i < MESA_SHADER_STAGES; i++) {
for (unsigned i = prev + 1; i <= MESA_SHADER_FRAGMENT; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
@ -2205,7 +2316,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
}
unsigned first;
for (first = 0; first < MESA_SHADER_STAGES; first++) {
for (first = 0; first <= MESA_SHADER_FRAGMENT; first++) {
if (prog->_LinkedShaders[first] != NULL)
break;
}
@ -2237,7 +2348,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
* eliminated if they are (transitively) not used in a later stage.
*/
int last, next;
for (last = MESA_SHADER_STAGES-1; last >= 0; last--) {
for (last = MESA_SHADER_FRAGMENT; last >= 0; last--) {
if (prog->_LinkedShaders[last] != NULL)
break;
}
@ -2327,6 +2438,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
store_fragdepth_layout(prog);
check_resources(ctx, prog);
check_image_resources(ctx, prog);
link_check_atomic_counter_resources(ctx, prog);
if (!prog->LinkStatus)

View file

@ -80,6 +80,8 @@ loop_state::loop_state()
hash_table_pointer_compare);
this->ht_inductors = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
this->ht_non_inductors = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
this->mem_ctx = ralloc_context(NULL);
this->loop_found = false;
}
@ -89,6 +91,7 @@ loop_state::~loop_state()
{
hash_table_dtor(this->ht);
hash_table_dtor(this->ht_inductors);
hash_table_dtor(this->ht_non_inductors);
ralloc_free(this->mem_ctx);
}
@ -120,6 +123,10 @@ loop_state::get_for_inductor(const ir_variable *ir)
void
loop_state::insert_inductor(ir_variable* var, loop_variable_state* state, ir_loop* loop)
{
// Check if this variable is already marked as "sure can't be a private inductor variable"
if (hash_table_find(this->ht_non_inductors, var))
return;
// Check if this variable is used after the loop anywhere. If it is, it can't be a
// variable that's private to the loop.
ir_variable_refcount_visitor refs;
@ -130,7 +137,12 @@ loop_state::insert_inductor(ir_variable* var, loop_variable_state* state, ir_loo
ir_instruction *ir = (ir_instruction *) node;
ir->accept (&refs);
if (refs.find_variable_entry(var))
{
// add to list of "non inductors", so that next loop does not try
// to add it as inductor again
hash_table_insert(this->ht_non_inductors, state, var);
return;
}
}
state->private_induction_variable_count++;

View file

@ -281,6 +281,8 @@ private:
* Hash table from ir_variables to loop state, for induction variables.
*/
hash_table *ht_inductors;
hash_table *ht_non_inductors;
void *mem_ctx;

View file

@ -253,7 +253,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
*/
loop_unroll_count count(&ir->body_instructions);
if (count.fail || count.nodes * iterations > (int)max_iterations * 15)
if (count.fail || count.nodes * iterations > (int)max_iterations * 25)
return visit_continue;
/* Note: the limiting terminator contributes 1 to ls->num_loop_jumps.

View file

@ -50,6 +50,17 @@ initialize_context(struct gl_context *ctx, gl_api api)
*/
ctx->Const.GLSLVersion = glsl_version;
ctx->Extensions.ARB_ES3_compatibility = true;
ctx->Const.MaxComputeWorkGroupCount[0] = 65535;
ctx->Const.MaxComputeWorkGroupCount[1] = 65535;
ctx->Const.MaxComputeWorkGroupCount[2] = 65535;
ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
ctx->Const.MaxComputeWorkGroupSize[2] = 64;
ctx->Const.MaxComputeWorkGroupInvocations = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxOutputComponents = 0; /* not used */
switch (ctx->Const.GLSLVersion) {
case 100:
@ -221,7 +232,7 @@ load_text_file(void *ctx, const char *file_name)
if (bytes < size - total_read) {
free(text);
text = NULL;
break;
goto error;
}
if (bytes == 0) {
@ -232,6 +243,7 @@ load_text_file(void *ctx, const char *file_name)
} while (total_read < size);
text[total_read] = '\0';
error:;
}
fclose(fp);
@ -360,6 +372,8 @@ main(int argc, char **argv)
shader->Type = GL_GEOMETRY_SHADER;
else if (strncmp(".frag", ext, 5) == 0)
shader->Type = GL_FRAGMENT_SHADER;
else if (strncmp(".comp", ext, 5) == 0)
shader->Type = GL_COMPUTE_SHADER;
else
usage_fail(argv[0]);
shader->Stage = _mesa_shader_enum_to_shader_stage(shader->Type);

View file

@ -224,6 +224,11 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
this->mem_ctx = ralloc_parent(ir);
switch (ir->operation) {
case ir_unop_bit_not:
if (op_expr[0] && op_expr[0]->operation == ir_unop_bit_not)
return op_expr[0]->operands[0];
break;
case ir_unop_abs:
if (op_expr[0] == NULL)
break;
@ -254,6 +259,42 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
case ir_unop_exp:
if (op_expr[0] == NULL)
break;
if (op_expr[0]->operation == ir_unop_log) {
return op_expr[0]->operands[0];
}
break;
case ir_unop_log:
if (op_expr[0] == NULL)
break;
if (op_expr[0]->operation == ir_unop_exp) {
return op_expr[0]->operands[0];
}
break;
case ir_unop_exp2:
if (op_expr[0] == NULL)
break;
if (op_expr[0]->operation == ir_unop_log2) {
return op_expr[0]->operands[0];
}
break;
case ir_unop_log2:
if (op_expr[0] == NULL)
break;
if (op_expr[0]->operation == ir_unop_exp2) {
return op_expr[0]->operands[0];
}
break;
case ir_unop_logic_not: {
enum ir_expression_operation new_op = ir_unop_logic_not;
@ -499,6 +540,10 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
if (is_vec_one(op_const[0]))
return op_const[0];
/* x^1 == x */
if (is_vec_one(op_const[1]))
return ir->operands[0];
/* pow(2,x) == exp2(x) */
if (is_vec_two(op_const[0]))
return expr(ir_unop_exp2, ir->operands[1]);
@ -522,15 +567,37 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
break;
case ir_triop_fma:
/* Operands are op0 * op1 + op2. */
if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) {
return ir->operands[2];
} else if (is_vec_zero(op_const[2])) {
return mul(ir->operands[0], ir->operands[1]);
} else if (is_vec_one(op_const[0])) {
return add(ir->operands[1], ir->operands[2]);
} else if (is_vec_one(op_const[1])) {
return add(ir->operands[0], ir->operands[2]);
}
break;
case ir_triop_lrp:
/* Operands are (x, y, a). */
if (is_vec_zero(op_const[2])) {
return ir->operands[0];
} else if (is_vec_one(op_const[2])) {
return ir->operands[1];
} else if (ir->operands[0]->equals(ir->operands[1])) {
return ir->operands[0];
}
break;
case ir_triop_csel:
if (is_vec_one(op_const[0]))
return ir->operands[1];
if (is_vec_zero(op_const[0]))
return ir->operands[2];
break;
default:
break;
}

View file

@ -82,11 +82,14 @@ public:
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_swizzle *);
virtual ir_visitor_status visit_enter(ir_dereference_array *);
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_leave(ir_assignment *);
void try_vectorize();
ir_assignment *assignment[4];
@ -106,9 +109,10 @@ public:
* the nodes of the tree (expression float log2 (swiz z (var_ref v0))),
* rewriting it into (expression vec3 log2 (swiz xyz (var_ref v0))).
*
* The function modifies only ir_expressions and ir_swizzles. For expressions
* it sets a new type and swizzles any scalar dereferences into appropriately
* sized vector arguments. For example, if combining
* The function operates on ir_expressions (and its operands) and ir_swizzles.
* For expressions it sets a new type and swizzles any non-expression and non-
* swizzle scalar operands into appropriately sized vector arguments. For
* example, if combining
*
* (assign (x) (var_ref r1) (expression float + (swiz x (var_ref v0) (var_ref v1))))
* (assign (y) (var_ref r1) (expression float + (swiz y (var_ref v0) (var_ref v1))))
@ -146,16 +150,12 @@ rewrite_swizzle(ir_instruction *ir, void *data)
mask->num_components, 1);
for (unsigned i = 0; i < 4; i++) {
if (expr->operands[i]) {
ir_dereference *deref = expr->operands[i]->as_dereference();
if (deref && deref->type->is_scalar()) {
expr->operands[i] = new(ir) ir_swizzle(deref, 0, 0, 0, 0,
ir_rvalue *rval = expr->operands[i]->as_rvalue();
if (rval && rval->type->is_scalar() &&
!rval->as_expression() && !rval->as_swizzle()) {
expr->operands[i] = new(ir) ir_swizzle(rval, 0, 0, 0, 0,
mask->num_components);
}
ir_constant *cns = expr->operands[i]->as_constant();
if (cns && cns->type->is_scalar()) {
expr->operands[i] = new(ir) ir_swizzle(cns, 0, 0, 0, 0,
mask->num_components);
}
}
}
break;
@ -292,6 +292,33 @@ ir_vectorize_visitor::visit_enter(ir_swizzle *ir)
return visit_continue;
}
/* Upon entering an ir_binop_dot, remove the current assignment from
* further consideration. Dot product is "horizontal" instruction
* that we can't vectorize.
*/
ir_visitor_status
ir_vectorize_visitor::visit_enter(ir_expression *ir)
{
if (ir->operation == ir_binop_dot) {
this->current_assignment = NULL;
return visit_continue_with_parent;
}
return visit_continue;
}
/* Upon entering an ir_array_dereference, remove the current assignment from
* further consideration. Since the index of an array dereference must scalar,
* we are not able to vectorize it.
*
* FINISHME: If all of scalar indices are identical we could vectorize.
*/
ir_visitor_status
ir_vectorize_visitor::visit_enter(ir_dereference_array *ir)
{
this->current_assignment = NULL;
return visit_continue_with_parent;
}
/* Since there is no statement to visit between the "then" and "else"
* instructions try to vectorize before, in between, and after them to avoid
* combining statements from different basic blocks.

View file

@ -91,6 +91,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
ctx->Extensions.dummy_false = false;
ctx->Extensions.dummy_true = true;
ctx->Extensions.ARB_compute_shader = true;
ctx->Extensions.ARB_conservative_depth = true;
ctx->Extensions.ARB_draw_instanced = true;
ctx->Extensions.ARB_ES2_compatibility = true;
@ -140,6 +141,17 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 32;
ctx->Const.MaxDrawBuffers = 1;
ctx->Const.MaxComputeWorkGroupCount[0] = 65535;
ctx->Const.MaxComputeWorkGroupCount[1] = 65535;
ctx->Const.MaxComputeWorkGroupCount[2] = 65535;
ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
ctx->Const.MaxComputeWorkGroupSize[2] = 64;
ctx->Const.MaxComputeWorkGroupInvocations = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxOutputComponents = 0; /* not used */
/* Set up default shader compiler options. */
struct gl_shader_compiler_options options;

View file

@ -58,6 +58,8 @@ _mesa_shader_enum_to_shader_stage(GLenum v)
return MESA_SHADER_FRAGMENT;
case GL_GEOMETRY_SHADER:
return MESA_SHADER_GEOMETRY;
case GL_COMPUTE_SHADER:
return MESA_SHADER_COMPUTE;
default:
assert(!"bad value in _mesa_shader_enum_to_shader_stage()");
return MESA_SHADER_VERTEX;

View file

@ -272,6 +272,15 @@
#define MAX_DEBUG_GROUP_STACK_DEPTH 64
/*@}*/
/** For GL_ARB_gpu_shader5 */
/*@{*/
#define MAX_GEOMETRY_SHADER_INVOCATIONS 32
#define MIN_FRAGMENT_INTERPOLATION_OFFSET -0.5
#define MAX_FRAGMENT_INTERPOLATION_OFFSET 0.5
#define FRAGMENT_INTERPOLATION_OFFSET_BITS 4
#define MAX_VERTEX_STREAMS 4
/*@}*/
/*
* Color channel component order
*

View file

@ -41,15 +41,15 @@ struct gl_shader;
struct dd_function_table {
/**
* \name GLSL-related functions (ARB extensions and OpenGL 2.x)
*/
/*@{*/
struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type);
struct gl_shader *(*NewShader)(struct gl_context *ctx,
GLuint name, GLenum type);
void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
/*@}*/
};
#endif /* DD_INCLUDED */

View file

@ -42,6 +42,7 @@
#define GL_VERTEX_SHADER 0x8B31
#define GL_GEOMETRY_SHADER 0x8DD9
#define GL_GEOMETRY_SHADER_ARB 0x8DD9
#define GL_COMPUTE_SHADER 0x91B9
#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
@ -115,6 +116,43 @@
#define GL_INTERLEAVED_ATTRIBS 0x8C8C
#define GL_SEPARATE_ATTRIBS 0x8C8D
#define GL_IMAGE_1D 0x904C
#define GL_IMAGE_2D 0x904D
#define GL_IMAGE_3D 0x904E
#define GL_IMAGE_2D_RECT 0x904F
#define GL_IMAGE_CUBE 0x9050
#define GL_IMAGE_BUFFER 0x9051
#define GL_IMAGE_1D_ARRAY 0x9052
#define GL_IMAGE_2D_ARRAY 0x9053
#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
#define GL_IMAGE_2D_MULTISAMPLE 0x9055
#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
#define GL_INT_IMAGE_1D 0x9057
#define GL_INT_IMAGE_2D 0x9058
#define GL_INT_IMAGE_3D 0x9059
#define GL_INT_IMAGE_2D_RECT 0x905A
#define GL_INT_IMAGE_CUBE 0x905B
#define GL_INT_IMAGE_BUFFER 0x905C
#define GL_INT_IMAGE_1D_ARRAY 0x905D
#define GL_INT_IMAGE_2D_ARRAY 0x905E
#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
#define GL_READ_ONLY 0x88B8
#define GL_WRITE_ONLY 0x88B9
#define GL_READ_WRITE 0x88BA
#ifdef __cplusplus
extern "C" {

View file

@ -30,6 +30,8 @@
#ifndef __gl_minimal_h_
#define __gl_minimal_h_
#include "stdint.h"
/**********************************************************************
* Begin system-specific stuff. Do not do any of this when building
@ -100,6 +102,9 @@ typedef double GLdouble; /* double precision float */
typedef double GLclampd; /* double precision float in [0,1] */
typedef char GLchar;
typedef char GLcharARB;
typedef int64_t GLint64;
typedef uint64_t GLuint64;
@ -416,6 +421,57 @@ typedef char GLcharARB;
#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
/* Texture formats */
#define GL_RGBA32F 0x8814
#define GL_RGB32F 0x8815
#define GL_RGBA16F 0x881A
#define GL_RGB16F 0x881B
#define GL_R8 0x8229
#define GL_R16 0x822A
#define GL_RG8 0x822B
#define GL_RG16 0x822C
#define GL_R16F 0x822D
#define GL_R32F 0x822E
#define GL_RG16F 0x822F
#define GL_RG32F 0x8230
#define GL_R8I 0x8231
#define GL_R8UI 0x8232
#define GL_R16I 0x8233
#define GL_R16UI 0x8234
#define GL_R32I 0x8235
#define GL_R32UI 0x8236
#define GL_RG8I 0x8237
#define GL_RG8UI 0x8238
#define GL_RG16I 0x8239
#define GL_RG16UI 0x823A
#define GL_RG32I 0x823B
#define GL_RG32UI 0x823C
#define GL_RGBA32UI 0x8D70
#define GL_RGB32UI 0x8D71
#define GL_RGBA16UI 0x8D76
#define GL_RGB16UI 0x8D77
#define GL_RGBA8UI 0x8D7C
#define GL_RGB8UI 0x8D7D
#define GL_RGBA32I 0x8D82
#define GL_RGB32I 0x8D83
#define GL_RGBA16I 0x8D88
#define GL_RGB16I 0x8D89
#define GL_RGBA8I 0x8D8E
#define GL_RGB8I 0x8D8F
#define GL_RGBA8 0x8058
#define GL_RGB10_A2 0x8059
#define GL_R11F_G11F_B10F 0x8C3A
#define GL_R8_SNORM 0x8F94
#define GL_RG8_SNORM 0x8F95
#define GL_RGB8_SNORM 0x8F96
#define GL_RGBA8_SNORM 0x8F97
#define GL_R16_SNORM 0x8F98
#define GL_RG16_SNORM 0x8F99
#define GL_RGB16_SNORM 0x8F9A
#define GL_RGBA16_SNORM 0x8F9B
#define GL_RGB10_A2UI 0x906F
#define GL_RGBA16 0x805B
#endif /* __gl_h_ */

View file

@ -213,9 +213,10 @@ typedef enum
MESA_SHADER_VERTEX = 0,
MESA_SHADER_GEOMETRY = 1,
MESA_SHADER_FRAGMENT = 2,
MESA_SHADER_COMPUTE = 3,
} gl_shader_stage;
#define MESA_SHADER_STAGES (MESA_SHADER_FRAGMENT + 1)
#define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1)
@ -601,6 +602,17 @@ struct gl_shader
* ImageAccess arrays above.
*/
GLuint NumImages;
/**
* Compute shader state from ARB_compute_shader layout qualifiers.
*/
struct {
/**
* Size specified using local_size_{x,y,z}, or all 0's to indicate that
* it's not set in this shader.
*/
unsigned LocalSize[3];
} Comp;
};
@ -785,6 +797,18 @@ struct gl_shader_program
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
} Vert;
/**
* Compute shader state - copied into gl_compute_program by
* _mesa_copy_linked_program_data().
*/
struct {
/**
* If this shader contains a compute stage, size specified using
* local_size_{x,y,z}. Otherwise undefined.
*/
unsigned LocalSize[3];
} Comp;
/* post-link info: */
unsigned NumUserUniformStorage;
@ -1178,6 +1202,15 @@ struct gl_constants
GLuint MaxCombinedImageUnitsAndFragmentOutputs;
GLuint MaxImageSamples;
GLuint MaxCombinedImageUniforms;
/** GL_ARB_compute_shader */
GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */
GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */
GLuint MaxComputeWorkGroupInvocations;
/** GL_ARB_gpu_shader5 */
GLfloat MinFragmentInterpolationOffset;
GLfloat MaxFragmentInterpolationOffset;
};
@ -1197,6 +1230,7 @@ struct gl_extensions
GLboolean ARB_base_instance;
GLboolean ARB_blend_func_extended;
GLboolean ARB_color_buffer_float;
GLboolean ARB_compute_shader;
GLboolean ARB_conservative_depth;
GLboolean ARB_depth_buffer_float;
GLboolean ARB_depth_clamp;

View file

@ -3,34 +3,34 @@ mediump vec4 xlat_main ()
int i_1;
mediump vec4 c_2;
highp vec2 poisson_3[8];
vec2 tmpvar_4;
mediump vec2 tmpvar_4;
tmpvar_4 = vec2(0.0, 0.0);
poisson_3[0] = tmpvar_4;
vec2 tmpvar_5;
mediump vec2 tmpvar_5;
tmpvar_5 = vec2(0.527837, -0.085868);
poisson_3[1] = tmpvar_5;
vec2 tmpvar_6;
mediump vec2 tmpvar_6;
tmpvar_6 = vec2(-0.040088, 0.536087);
poisson_3[2] = tmpvar_6;
vec2 tmpvar_7;
mediump vec2 tmpvar_7;
tmpvar_7 = vec2(-0.670445, -0.179949);
poisson_3[3] = tmpvar_7;
vec2 tmpvar_8;
mediump vec2 tmpvar_8;
tmpvar_8 = vec2(-0.419418, -0.616039);
poisson_3[4] = tmpvar_8;
vec2 tmpvar_9;
mediump vec2 tmpvar_9;
tmpvar_9 = vec2(0.440453, -0.639399);
poisson_3[5] = tmpvar_9;
vec2 tmpvar_10;
mediump vec2 tmpvar_10;
tmpvar_10 = vec2(-0.757088, 0.349334);
poisson_3[6] = tmpvar_10;
vec2 tmpvar_11;
mediump vec2 tmpvar_11;
tmpvar_11 = vec2(0.574619, 0.685879);
poisson_3[7] = tmpvar_11;
int tmpvar_12;
tmpvar_12 = 0;
i_1 = tmpvar_12;
vec4 tmpvar_13;
mediump vec4 tmpvar_13;
tmpvar_13 = vec4(0.0, 0.0, 0.0, 0.0);
c_2 = tmpvar_13;
while (true) {

View file

@ -3,34 +3,34 @@ mediump vec4 xlat_main ()
int i_1;
mediump vec4 c_2;
highp vec2 poisson_3[8];
vec2 tmpvar_4;
mediump vec2 tmpvar_4;
tmpvar_4 = vec2(0.0, 0.0);
poisson_3[0] = tmpvar_4;
vec2 tmpvar_5;
mediump vec2 tmpvar_5;
tmpvar_5 = vec2(0.527837, -0.085868);
poisson_3[1] = tmpvar_5;
vec2 tmpvar_6;
mediump vec2 tmpvar_6;
tmpvar_6 = vec2(-0.040088, 0.536087);
poisson_3[2] = tmpvar_6;
vec2 tmpvar_7;
mediump vec2 tmpvar_7;
tmpvar_7 = vec2(-0.670445, -0.179949);
poisson_3[3] = tmpvar_7;
vec2 tmpvar_8;
mediump vec2 tmpvar_8;
tmpvar_8 = vec2(-0.419418, -0.616039);
poisson_3[4] = tmpvar_8;
vec2 tmpvar_9;
mediump vec2 tmpvar_9;
tmpvar_9 = vec2(0.440453, -0.639399);
poisson_3[5] = tmpvar_9;
vec2 tmpvar_10;
mediump vec2 tmpvar_10;
tmpvar_10 = vec2(-0.757088, 0.349334);
poisson_3[6] = tmpvar_10;
vec2 tmpvar_11;
mediump vec2 tmpvar_11;
tmpvar_11 = vec2(0.574619, 0.685879);
poisson_3[7] = tmpvar_11;
int tmpvar_12;
tmpvar_12 = 0;
i_1 = tmpvar_12;
vec4 tmpvar_13;
mediump vec4 tmpvar_13;
tmpvar_13 = vec4(0.0, 0.0, 0.0, 0.0);
c_2 = tmpvar_13;
while (true) {

View file

@ -0,0 +1,21 @@
// https://github.com/aras-p/glsl-optimizer/issues/49
uniform int loopNum;
void main() {
int myIdx;
vec4 r = vec4(0.0);
myIdx = 1;
for ( ; myIdx < loopNum; ++myIdx) {
r.x += 1.0;
r.y += 2.0;
r.z += 3.0;
}
myIdx = 2;
for ( ; myIdx < loopNum; ++myIdx) {
r.x += 1.0;
r.y += 2.0;
r.z += 3.0;
}
gl_FragColor = r;
}

View file

@ -0,0 +1,53 @@
uniform int loopNum;
void main ()
{
vec4 r_1;
int myIdx_2;
vec4 tmpvar_3;
tmpvar_3 = vec4(0.0, 0.0, 0.0, 0.0);
r_1 = tmpvar_3;
int tmpvar_4;
tmpvar_4 = 1;
myIdx_2 = tmpvar_4;
while (true) {
if (!((myIdx_2 < loopNum))) {
break;
};
float tmpvar_5;
tmpvar_5 = (r_1.x + 1.0);
r_1.x = tmpvar_5;
float tmpvar_6;
tmpvar_6 = (r_1.y + 2.0);
r_1.y = vec2(tmpvar_6).y;
float tmpvar_7;
tmpvar_7 = (r_1.z + 3.0);
r_1.z = vec3(tmpvar_7).z;
int tmpvar_8;
tmpvar_8 = (myIdx_2 + 1);
myIdx_2 = tmpvar_8;
};
int tmpvar_9;
tmpvar_9 = 2;
myIdx_2 = tmpvar_9;
while (true) {
if (!((myIdx_2 < loopNum))) {
break;
};
float tmpvar_10;
tmpvar_10 = (r_1.x + 1.0);
r_1.x = tmpvar_10;
float tmpvar_11;
tmpvar_11 = (r_1.y + 2.0);
r_1.y = vec2(tmpvar_11).y;
float tmpvar_12;
tmpvar_12 = (r_1.z + 3.0);
r_1.z = vec3(tmpvar_12).z;
int tmpvar_13;
tmpvar_13 = (myIdx_2 + 1);
myIdx_2 = tmpvar_13;
};
vec4 tmpvar_14;
tmpvar_14 = r_1;
gl_FragColor = tmpvar_14;
}

View file

@ -0,0 +1,23 @@
uniform int loopNum;
void main ()
{
vec4 r_1;
int myIdx_2;
r_1 = vec4(0.0, 0.0, 0.0, 0.0);
myIdx_2 = 1;
for (; myIdx_2 < loopNum; myIdx_2++) {
r_1.x = (r_1.x + 1.0);
r_1.y = (r_1.y + 2.0);
r_1.z = (r_1.z + 3.0);
};
myIdx_2 = 2;
for (; myIdx_2 < loopNum; myIdx_2++) {
r_1.x = (r_1.x + 1.0);
r_1.y = (r_1.y + 2.0);
r_1.z = (r_1.z + 3.0);
};
gl_FragColor = r_1;
}
// inputs: 0, stats: 13 alu 0 tex 4 flow

View file

@ -1,210 +1,210 @@
#extension GL_OES_standard_derivatives : enable
varying highp vec4 xlv_TEXCOORD0;
float xll_dFdx (
in float f_1
mediump float xll_dFdx (
in mediump float f_1
)
{
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = dFdx (f_1);
return tmpvar_2;
}
vec2 xll_dFdx (
in vec2 v_3
mediump vec2 xll_dFdx (
in mediump vec2 v_3
)
{
vec2 tmpvar_4;
mediump vec2 tmpvar_4;
tmpvar_4 = dFdx (v_3);
return tmpvar_4;
}
vec3 xll_dFdx (
in vec3 v_5
mediump vec3 xll_dFdx (
in mediump vec3 v_5
)
{
vec3 tmpvar_6;
mediump vec3 tmpvar_6;
tmpvar_6 = dFdx (v_5);
return tmpvar_6;
}
vec4 xll_dFdx (
in vec4 v_7
mediump vec4 xll_dFdx (
in mediump vec4 v_7
)
{
vec4 tmpvar_8;
mediump vec4 tmpvar_8;
tmpvar_8 = dFdx (v_7);
return tmpvar_8;
}
mat2 xll_dFdx (
in mat2 m_9
mediump mat2 xll_dFdx (
in mediump mat2 m_9
)
{
vec2 tmpvar_10;
mediump vec2 tmpvar_10;
tmpvar_10 = dFdx (m_9[0]);
vec2 tmpvar_11;
mediump vec2 tmpvar_11;
tmpvar_11 = dFdx (m_9[1]);
mat2 tmpvar_12;
vec2 tmpvar_13;
mediump mat2 tmpvar_12;
mediump vec2 tmpvar_13;
tmpvar_13 = tmpvar_10;
tmpvar_12[0] = tmpvar_13;
vec2 tmpvar_14;
mediump vec2 tmpvar_14;
tmpvar_14 = tmpvar_11;
tmpvar_12[1] = tmpvar_14;
return tmpvar_12;
}
mat3 xll_dFdx (
in mat3 m_15
mediump mat3 xll_dFdx (
in mediump mat3 m_15
)
{
vec3 tmpvar_16;
mediump vec3 tmpvar_16;
tmpvar_16 = dFdx (m_15[0]);
vec3 tmpvar_17;
mediump vec3 tmpvar_17;
tmpvar_17 = dFdx (m_15[1]);
vec3 tmpvar_18;
mediump vec3 tmpvar_18;
tmpvar_18 = dFdx (m_15[2]);
mat3 tmpvar_19;
vec3 tmpvar_20;
mediump mat3 tmpvar_19;
mediump vec3 tmpvar_20;
tmpvar_20 = tmpvar_16;
tmpvar_19[0] = tmpvar_20;
vec3 tmpvar_21;
mediump vec3 tmpvar_21;
tmpvar_21 = tmpvar_17;
tmpvar_19[1] = tmpvar_21;
vec3 tmpvar_22;
mediump vec3 tmpvar_22;
tmpvar_22 = tmpvar_18;
tmpvar_19[2] = tmpvar_22;
return tmpvar_19;
}
mat4 xll_dFdx (
in mat4 m_23
mediump mat4 xll_dFdx (
in mediump mat4 m_23
)
{
vec4 tmpvar_24;
mediump vec4 tmpvar_24;
tmpvar_24 = dFdx (m_23[0]);
vec4 tmpvar_25;
mediump vec4 tmpvar_25;
tmpvar_25 = dFdx (m_23[1]);
vec4 tmpvar_26;
mediump vec4 tmpvar_26;
tmpvar_26 = dFdx (m_23[2]);
vec4 tmpvar_27;
mediump vec4 tmpvar_27;
tmpvar_27 = dFdx (m_23[3]);
mat4 tmpvar_28;
vec4 tmpvar_29;
mediump mat4 tmpvar_28;
mediump vec4 tmpvar_29;
tmpvar_29 = tmpvar_24;
tmpvar_28[0] = tmpvar_29;
vec4 tmpvar_30;
mediump vec4 tmpvar_30;
tmpvar_30 = tmpvar_25;
tmpvar_28[1] = tmpvar_30;
vec4 tmpvar_31;
mediump vec4 tmpvar_31;
tmpvar_31 = tmpvar_26;
tmpvar_28[2] = tmpvar_31;
vec4 tmpvar_32;
mediump vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_28[3] = tmpvar_32;
return tmpvar_28;
}
float xll_fwidth (
in float f_33
mediump float xll_fwidth (
in mediump float f_33
)
{
float tmpvar_34;
mediump float tmpvar_34;
tmpvar_34 = fwidth (f_33);
return tmpvar_34;
}
vec2 xll_fwidth (
in vec2 v_35
mediump vec2 xll_fwidth (
in mediump vec2 v_35
)
{
vec2 tmpvar_36;
mediump vec2 tmpvar_36;
tmpvar_36 = fwidth (v_35);
return tmpvar_36;
}
vec3 xll_fwidth (
in vec3 v_37
mediump vec3 xll_fwidth (
in mediump vec3 v_37
)
{
vec3 tmpvar_38;
mediump vec3 tmpvar_38;
tmpvar_38 = fwidth (v_37);
return tmpvar_38;
}
vec4 xll_fwidth (
in vec4 v_39
mediump vec4 xll_fwidth (
in mediump vec4 v_39
)
{
vec4 tmpvar_40;
mediump vec4 tmpvar_40;
tmpvar_40 = fwidth (v_39);
return tmpvar_40;
}
mat2 xll_fwidth (
in mat2 m_41
mediump mat2 xll_fwidth (
in mediump mat2 m_41
)
{
vec2 tmpvar_42;
mediump vec2 tmpvar_42;
tmpvar_42 = fwidth (m_41[0]);
vec2 tmpvar_43;
mediump vec2 tmpvar_43;
tmpvar_43 = fwidth (m_41[1]);
mat2 tmpvar_44;
vec2 tmpvar_45;
mediump mat2 tmpvar_44;
mediump vec2 tmpvar_45;
tmpvar_45 = tmpvar_42;
tmpvar_44[0] = tmpvar_45;
vec2 tmpvar_46;
mediump vec2 tmpvar_46;
tmpvar_46 = tmpvar_43;
tmpvar_44[1] = tmpvar_46;
return tmpvar_44;
}
mat3 xll_fwidth (
in mat3 m_47
mediump mat3 xll_fwidth (
in mediump mat3 m_47
)
{
vec3 tmpvar_48;
mediump vec3 tmpvar_48;
tmpvar_48 = fwidth (m_47[0]);
vec3 tmpvar_49;
mediump vec3 tmpvar_49;
tmpvar_49 = fwidth (m_47[1]);
vec3 tmpvar_50;
mediump vec3 tmpvar_50;
tmpvar_50 = fwidth (m_47[2]);
mat3 tmpvar_51;
vec3 tmpvar_52;
mediump mat3 tmpvar_51;
mediump vec3 tmpvar_52;
tmpvar_52 = tmpvar_48;
tmpvar_51[0] = tmpvar_52;
vec3 tmpvar_53;
mediump vec3 tmpvar_53;
tmpvar_53 = tmpvar_49;
tmpvar_51[1] = tmpvar_53;
vec3 tmpvar_54;
mediump vec3 tmpvar_54;
tmpvar_54 = tmpvar_50;
tmpvar_51[2] = tmpvar_54;
return tmpvar_51;
}
mat4 xll_fwidth (
in mat4 m_55
mediump mat4 xll_fwidth (
in mediump mat4 m_55
)
{
vec4 tmpvar_56;
mediump vec4 tmpvar_56;
tmpvar_56 = fwidth (m_55[0]);
vec4 tmpvar_57;
mediump vec4 tmpvar_57;
tmpvar_57 = fwidth (m_55[1]);
vec4 tmpvar_58;
mediump vec4 tmpvar_58;
tmpvar_58 = fwidth (m_55[2]);
vec4 tmpvar_59;
mediump vec4 tmpvar_59;
tmpvar_59 = fwidth (m_55[3]);
mat4 tmpvar_60;
vec4 tmpvar_61;
mediump mat4 tmpvar_60;
mediump vec4 tmpvar_61;
tmpvar_61 = tmpvar_56;
tmpvar_60[0] = tmpvar_61;
vec4 tmpvar_62;
mediump vec4 tmpvar_62;
tmpvar_62 = tmpvar_57;
tmpvar_60[1] = tmpvar_62;
vec4 tmpvar_63;
mediump vec4 tmpvar_63;
tmpvar_63 = tmpvar_58;
tmpvar_60[2] = tmpvar_63;
vec4 tmpvar_64;
mediump vec4 tmpvar_64;
tmpvar_64 = tmpvar_59;
tmpvar_60[3] = tmpvar_64;
return tmpvar_60;
@ -215,22 +215,22 @@ mediump vec4 xlat_main (
)
{
lowp vec4 res_66;
float tmpvar_67;
mediump float tmpvar_67;
tmpvar_67 = xll_dFdx (uv_65.x);
float tmpvar_68;
mediump float tmpvar_68;
tmpvar_68 = tmpvar_67;
res_66.x = tmpvar_68;
float tmpvar_69;
mediump float tmpvar_69;
tmpvar_69 = xll_dFdx (uv_65.y);
float tmpvar_70;
mediump float tmpvar_70;
tmpvar_70 = tmpvar_69;
res_66.y = vec2(tmpvar_70).y;
float tmpvar_71;
mediump float tmpvar_71;
tmpvar_71 = xll_fwidth (uv_65.z);
float tmpvar_72;
mediump float tmpvar_72;
tmpvar_72 = tmpvar_71;
res_66.z = vec3(tmpvar_72).z;
float tmpvar_73;
mediump float tmpvar_73;
tmpvar_73 = 1.0;
res_66.w = vec4(tmpvar_73).w;
return res_66;

View file

@ -4,10 +4,10 @@ void xlat_main (
out mediump float oz_2
)
{
vec4 tmpvar_3;
mediump vec4 tmpvar_3;
tmpvar_3 = vec4(0.5, 0.5, 0.5, 0.5);
ocol_1 = tmpvar_3;
float tmpvar_4;
mediump float tmpvar_4;
tmpvar_4 = 0.9;
oz_2 = tmpvar_4;
}

View file

@ -23,7 +23,7 @@ void main ()
{
v2f xlt_i_5;
mediump vec4 xl_retval_6;
vec4 tmpvar_7;
mediump vec4 tmpvar_7;
tmpvar_7 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_5.pos = tmpvar_7;
highp vec2 tmpvar_8;

View file

@ -1,22 +1,22 @@
varying highp vec4 xlv_TEXCOORD0;
float xll_mod (
in float x_1,
in float y_2
mediump float xll_mod (
in mediump float x_1,
in mediump float y_2
)
{
float f_3;
float d_4;
float tmpvar_5;
mediump float f_3;
mediump float d_4;
mediump float tmpvar_5;
tmpvar_5 = (x_1 / y_2);
d_4 = tmpvar_5;
float tmpvar_6;
mediump float tmpvar_6;
tmpvar_6 = abs (d_4);
float tmpvar_7;
mediump float tmpvar_7;
tmpvar_7 = fract (tmpvar_6);
float tmpvar_8;
mediump float tmpvar_8;
tmpvar_8 = (tmpvar_7 * y_2);
f_3 = tmpvar_8;
float tmpvar_9;
mediump float tmpvar_9;
if ((d_4 >= 0.0)) {
tmpvar_9 = f_3;
} else {
@ -25,125 +25,125 @@ float xll_mod (
return tmpvar_9;
}
vec2 xll_mod (
in vec2 x_10,
in vec2 y_11
mediump vec2 xll_mod (
in mediump vec2 x_10,
in mediump vec2 y_11
)
{
vec2 f_12;
vec2 d_13;
vec2 tmpvar_14;
mediump vec2 f_12;
mediump vec2 d_13;
mediump vec2 tmpvar_14;
tmpvar_14 = (x_10 / y_11);
d_13 = tmpvar_14;
vec2 tmpvar_15;
mediump vec2 tmpvar_15;
tmpvar_15 = abs (d_13);
vec2 tmpvar_16;
mediump vec2 tmpvar_16;
tmpvar_16 = fract (tmpvar_15);
vec2 tmpvar_17;
mediump vec2 tmpvar_17;
tmpvar_17 = (tmpvar_16 * y_11);
f_12 = tmpvar_17;
float tmpvar_18;
mediump float tmpvar_18;
if ((d_13.x >= 0.0)) {
tmpvar_18 = f_12.x;
} else {
tmpvar_18 = -(f_12.x);
};
float tmpvar_19;
mediump float tmpvar_19;
if ((d_13.y >= 0.0)) {
tmpvar_19 = f_12.y;
} else {
tmpvar_19 = -(f_12.y);
};
vec2 tmpvar_20;
mediump vec2 tmpvar_20;
tmpvar_20.x = tmpvar_18;
tmpvar_20.y = tmpvar_19;
return tmpvar_20;
}
vec3 xll_mod (
in vec3 x_21,
in vec3 y_22
mediump vec3 xll_mod (
in mediump vec3 x_21,
in mediump vec3 y_22
)
{
vec3 f_23;
vec3 d_24;
vec3 tmpvar_25;
mediump vec3 f_23;
mediump vec3 d_24;
mediump vec3 tmpvar_25;
tmpvar_25 = (x_21 / y_22);
d_24 = tmpvar_25;
vec3 tmpvar_26;
mediump vec3 tmpvar_26;
tmpvar_26 = abs (d_24);
vec3 tmpvar_27;
mediump vec3 tmpvar_27;
tmpvar_27 = fract (tmpvar_26);
vec3 tmpvar_28;
mediump vec3 tmpvar_28;
tmpvar_28 = (tmpvar_27 * y_22);
f_23 = tmpvar_28;
float tmpvar_29;
mediump float tmpvar_29;
if ((d_24.x >= 0.0)) {
tmpvar_29 = f_23.x;
} else {
tmpvar_29 = -(f_23.x);
};
float tmpvar_30;
mediump float tmpvar_30;
if ((d_24.y >= 0.0)) {
tmpvar_30 = f_23.y;
} else {
tmpvar_30 = -(f_23.y);
};
float tmpvar_31;
mediump float tmpvar_31;
if ((d_24.z >= 0.0)) {
tmpvar_31 = f_23.z;
} else {
tmpvar_31 = -(f_23.z);
};
vec3 tmpvar_32;
mediump vec3 tmpvar_32;
tmpvar_32.x = tmpvar_29;
tmpvar_32.y = tmpvar_30;
tmpvar_32.z = tmpvar_31;
return tmpvar_32;
}
vec4 xll_mod (
in vec4 x_33,
in vec4 y_34
mediump vec4 xll_mod (
in mediump vec4 x_33,
in mediump vec4 y_34
)
{
vec4 f_35;
vec4 d_36;
vec4 tmpvar_37;
mediump vec4 f_35;
mediump vec4 d_36;
mediump vec4 tmpvar_37;
tmpvar_37 = (x_33 / y_34);
d_36 = tmpvar_37;
vec4 tmpvar_38;
mediump vec4 tmpvar_38;
tmpvar_38 = abs (d_36);
vec4 tmpvar_39;
mediump vec4 tmpvar_39;
tmpvar_39 = fract (tmpvar_38);
vec4 tmpvar_40;
mediump vec4 tmpvar_40;
tmpvar_40 = (tmpvar_39 * y_34);
f_35 = tmpvar_40;
float tmpvar_41;
mediump float tmpvar_41;
if ((d_36.x >= 0.0)) {
tmpvar_41 = f_35.x;
} else {
tmpvar_41 = -(f_35.x);
};
float tmpvar_42;
mediump float tmpvar_42;
if ((d_36.y >= 0.0)) {
tmpvar_42 = f_35.y;
} else {
tmpvar_42 = -(f_35.y);
};
float tmpvar_43;
mediump float tmpvar_43;
if ((d_36.z >= 0.0)) {
tmpvar_43 = f_35.z;
} else {
tmpvar_43 = -(f_35.z);
};
float tmpvar_44;
mediump float tmpvar_44;
if ((d_36.w >= 0.0)) {
tmpvar_44 = f_35.w;
} else {
tmpvar_44 = -(f_35.w);
};
vec4 tmpvar_45;
mediump vec4 tmpvar_45;
tmpvar_45.x = tmpvar_41;
tmpvar_45.y = tmpvar_42;
tmpvar_45.z = tmpvar_43;
@ -151,8 +151,8 @@ vec4 xll_mod (
return tmpvar_45;
}
float xll_modf (
in float x_46,
mediump float xll_modf (
in mediump float x_46,
out int ip_47
)
{
@ -162,23 +162,23 @@ float xll_modf (
return (x_46 - float(ip_47));
}
float xll_modf (
in float x_49,
out float ip_50
mediump float xll_modf (
in mediump float x_49,
out mediump float ip_50
)
{
int i_51;
int tmpvar_52;
tmpvar_52 = int(x_49);
i_51 = tmpvar_52;
float tmpvar_53;
mediump float tmpvar_53;
tmpvar_53 = float(i_51);
ip_50 = tmpvar_53;
return (x_49 - ip_50);
}
vec2 xll_modf (
in vec2 x_54,
mediump vec2 xll_modf (
in mediump vec2 x_54,
out ivec2 ip_55
)
{
@ -187,14 +187,14 @@ vec2 xll_modf (
ivec2 tmpvar_57;
tmpvar_57 = tmpvar_56;
ip_55 = tmpvar_57;
vec2 tmpvar_58;
mediump vec2 tmpvar_58;
tmpvar_58 = vec2(ip_55).xy;
return (x_54 - tmpvar_58);
}
vec2 xll_modf (
in vec2 x_59,
out vec2 ip_60
mediump vec2 xll_modf (
in mediump vec2 x_59,
out mediump vec2 ip_60
)
{
ivec2 i_61;
@ -203,16 +203,16 @@ vec2 xll_modf (
ivec2 tmpvar_63;
tmpvar_63 = tmpvar_62;
i_61 = tmpvar_63;
vec2 tmpvar_64;
mediump vec2 tmpvar_64;
tmpvar_64 = vec2(i_61).xy;
vec2 tmpvar_65;
mediump vec2 tmpvar_65;
tmpvar_65 = tmpvar_64;
ip_60 = tmpvar_65;
return (x_59 - ip_60);
}
vec3 xll_modf (
in vec3 x_66,
mediump vec3 xll_modf (
in mediump vec3 x_66,
out ivec3 ip_67
)
{
@ -221,14 +221,14 @@ vec3 xll_modf (
ivec3 tmpvar_69;
tmpvar_69 = tmpvar_68;
ip_67 = tmpvar_69;
vec3 tmpvar_70;
mediump vec3 tmpvar_70;
tmpvar_70 = vec3(ip_67).xyz;
return (x_66 - tmpvar_70);
}
vec3 xll_modf (
in vec3 x_71,
out vec3 ip_72
mediump vec3 xll_modf (
in mediump vec3 x_71,
out mediump vec3 ip_72
)
{
ivec3 i_73;
@ -237,16 +237,16 @@ vec3 xll_modf (
ivec3 tmpvar_75;
tmpvar_75 = tmpvar_74;
i_73 = tmpvar_75;
vec3 tmpvar_76;
mediump vec3 tmpvar_76;
tmpvar_76 = vec3(i_73).xyz;
vec3 tmpvar_77;
mediump vec3 tmpvar_77;
tmpvar_77 = tmpvar_76;
ip_72 = tmpvar_77;
return (x_71 - ip_72);
}
vec4 xll_modf (
in vec4 x_78,
mediump vec4 xll_modf (
in mediump vec4 x_78,
out ivec4 ip_79
)
{
@ -255,14 +255,14 @@ vec4 xll_modf (
ivec4 tmpvar_81;
tmpvar_81 = tmpvar_80;
ip_79 = tmpvar_81;
vec4 tmpvar_82;
mediump vec4 tmpvar_82;
tmpvar_82 = vec4(ip_79).xyzw;
return (x_78 - tmpvar_82);
}
vec4 xll_modf (
in vec4 x_83,
out vec4 ip_84
mediump vec4 xll_modf (
in mediump vec4 x_83,
out mediump vec4 ip_84
)
{
ivec4 i_85;
@ -271,9 +271,9 @@ vec4 xll_modf (
ivec4 tmpvar_87;
tmpvar_87 = tmpvar_86;
i_85 = tmpvar_87;
vec4 tmpvar_88;
mediump vec4 tmpvar_88;
tmpvar_88 = vec4(i_85).xyzw;
vec4 tmpvar_89;
mediump vec4 tmpvar_89;
tmpvar_89 = tmpvar_88;
ip_84 = tmpvar_89;
return (x_83 - ip_84);
@ -285,45 +285,45 @@ mediump vec4 xlat_main (
{
mediump vec4 d_91;
mediump vec4 c_92;
vec4 tmpvar_93;
mediump vec4 tmpvar_93;
tmpvar_93 = vec4(0.0, 0.0, 0.0, 0.0);
c_92 = tmpvar_93;
float tmpvar_94;
mediump float tmpvar_94;
tmpvar_94 = xll_mod (uv_90.x, 2.0);
mediump float tmpvar_95;
tmpvar_95 = (c_92.x + tmpvar_94);
c_92.x = tmpvar_95;
vec2 tmpvar_96;
mediump vec2 tmpvar_96;
tmpvar_96 = xll_mod (uv_90.xy, vec2(2.0, 2.0));
mediump vec2 tmpvar_97;
tmpvar_97 = (c_92.xy + tmpvar_96);
c_92.xy = tmpvar_97.xy.xy;
vec3 tmpvar_98;
mediump vec3 tmpvar_98;
tmpvar_98 = xll_mod (uv_90.xyz, vec3(2.0, 2.0, 2.0));
mediump vec3 tmpvar_99;
tmpvar_99 = (c_92.xyz + tmpvar_98);
c_92.xyz = tmpvar_99.xyz.xyz;
vec4 tmpvar_100;
mediump vec4 tmpvar_100;
tmpvar_100 = xll_mod (uv_90.xyzw, vec4(2.0, 2.0, 2.0, 2.0));
mediump vec4 tmpvar_101;
tmpvar_101 = (c_92.xyzw + tmpvar_100);
c_92 = tmpvar_101.xyzw.xyzw;
float tmpvar_102;
mediump float tmpvar_102;
tmpvar_102 = xll_modf (uv_90.x, d_91.x);
mediump float tmpvar_103;
tmpvar_103 = (c_92.x + tmpvar_102);
c_92.x = tmpvar_103;
vec2 tmpvar_104;
mediump vec2 tmpvar_104;
tmpvar_104 = xll_modf (uv_90.xy, d_91.xy);
mediump vec2 tmpvar_105;
tmpvar_105 = (c_92.xy + tmpvar_104);
c_92.xy = tmpvar_105.xy.xy;
vec3 tmpvar_106;
mediump vec3 tmpvar_106;
tmpvar_106 = xll_modf (uv_90.xyz, d_91.xyz);
mediump vec3 tmpvar_107;
tmpvar_107 = (c_92.xyz + tmpvar_106);
c_92.xyz = tmpvar_107.xyz.xyz;
vec4 tmpvar_108;
mediump vec4 tmpvar_108;
tmpvar_108 = xll_modf (uv_90.xyzw, d_91.xyzw);
mediump vec4 tmpvar_109;
tmpvar_109 = (c_92.xyzw + tmpvar_108);

View file

@ -21,7 +21,7 @@ lowp vec4 xlat_main (
lowp vec4 tmpvar_7;
tmpvar_7 = tmpvar_6;
col_3 = tmpvar_7;
vec3 tmpvar_8;
mediump vec3 tmpvar_8;
tmpvar_8 = vec3(0.0, 0.0, 0.0);
light_2 = tmpvar_8;
while (true) {

View file

@ -21,7 +21,7 @@ lowp vec4 xlat_main (
if ((col_4.w < 0.5)) {
discard;
};
vec3 tmpvar_7;
mediump vec3 tmpvar_7;
tmpvar_7 = vec3(0.0, 0.0, 0.0);
light_3 = tmpvar_7;
int tmpvar_8;

View file

@ -24,7 +24,7 @@ lowp vec4 xlat_main (
if ((col_3.w < 0.5)) {
discard;
};
vec3 tmpvar_8;
mediump vec3 tmpvar_8;
tmpvar_8 = vec3(0.0, 0.0, 0.0);
light_2 = tmpvar_8;
while (true) {

View file

@ -5,7 +5,7 @@ void main ()
int tmpvar_3;
tmpvar_3 = 0;
i_2 = tmpvar_3;
float tmpvar_4;
mediump float tmpvar_4;
tmpvar_4 = 0.0;
f_1 = tmpvar_4;
while (true) {

View file

@ -19,7 +19,7 @@ lowp vec4 xlat_main (
lowp vec4 tmpvar_7;
tmpvar_7 = tmpvar_6;
col_5 = tmpvar_7;
vec3 tmpvar_8;
mediump vec3 tmpvar_8;
tmpvar_8 = vec3(0.0, 0.0, 0.0);
light_4 = tmpvar_8;
int tmpvar_9;

View file

@ -0,0 +1,7 @@
void main()
{
gl_FragData[0] = vec4(0.0);
gl_FragData[1] = vec4(0.1);
gl_FragData[2] = vec4(0.2);
gl_FragData[3] = vec4(0.3);
}

View file

@ -0,0 +1,9 @@
#version 300 es
out lowp vec4 _fragData[4];
void main()
{
_fragData[0] = vec4(0.0);
_fragData[1] = vec4(0.1);
_fragData[2] = vec4(0.2);
_fragData[3] = vec4(0.3);
}

View file

@ -0,0 +1,16 @@
void main ()
{
vec4 tmpvar_1;
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
gl_FragData[0] = tmpvar_1;
vec4 tmpvar_2;
tmpvar_2 = vec4(0.1, 0.1, 0.1, 0.1);
gl_FragData[1] = tmpvar_2;
vec4 tmpvar_3;
tmpvar_3 = vec4(0.2, 0.2, 0.2, 0.2);
gl_FragData[2] = tmpvar_3;
vec4 tmpvar_4;
tmpvar_4 = vec4(0.3, 0.3, 0.3, 0.3);
gl_FragData[3] = tmpvar_4;
}

View file

@ -0,0 +1,18 @@
#version 300 es
out lowp vec4 _fragData[4];
void main ()
{
mediump vec4 tmpvar_1;
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
_fragData[0] = tmpvar_1;
mediump vec4 tmpvar_2;
tmpvar_2 = vec4(0.1, 0.1, 0.1, 0.1);
_fragData[1] = tmpvar_2;
mediump vec4 tmpvar_3;
tmpvar_3 = vec4(0.2, 0.2, 0.2, 0.2);
_fragData[2] = tmpvar_3;
mediump vec4 tmpvar_4;
tmpvar_4 = vec4(0.3, 0.3, 0.3, 0.3);
_fragData[3] = tmpvar_4;
}

View file

@ -0,0 +1,10 @@
void main ()
{
gl_FragData[0] = vec4(0.0, 0.0, 0.0, 0.0);
gl_FragData[1] = vec4(0.1, 0.1, 0.1, 0.1);
gl_FragData[2] = vec4(0.2, 0.2, 0.2, 0.2);
gl_FragData[3] = vec4(0.3, 0.3, 0.3, 0.3);
}
// inputs: 0, stats: 4 alu 0 tex 0 flow

View file

@ -0,0 +1,12 @@
#version 300 es
out lowp vec4 _fragData[4];
void main ()
{
_fragData[0] = vec4(0.0, 0.0, 0.0, 0.0);
_fragData[1] = vec4(0.1, 0.1, 0.1, 0.1);
_fragData[2] = vec4(0.2, 0.2, 0.2, 0.2);
_fragData[3] = vec4(0.3, 0.3, 0.3, 0.3);
}
// inputs: 0, stats: 4 alu 0 tex 0 flow

View file

@ -1,9 +1,9 @@
varying lowp float xx;
int func (
inout float x_1
inout mediump float x_1
)
{
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = (x_1 * 2.0);
x_1 = tmpvar_2;
return 0;
@ -25,7 +25,7 @@ void main ()
if ((x_5 < 0.0)) {
discard;
};
float tmpvar_9;
mediump float tmpvar_9;
tmpvar_9 = 0.0;
c_3 = tmpvar_9;
while (true) {

View file

@ -19,7 +19,7 @@ void main ()
if ((x_3 < 2)) {
discard;
};
float tmpvar_7;
mediump float tmpvar_7;
tmpvar_7 = 0.0;
c_1 = tmpvar_7;
while (true) {

View file

@ -9,7 +9,7 @@ void main ()
if ((xx < 0.0)) {
discard;
};
float tmpvar_4;
mediump float tmpvar_4;
tmpvar_4 = 0.0;
c_1 = tmpvar_4;
while (true) {

View file

@ -0,0 +1,22 @@
uniform float _Fresnel;
uniform float _SpecIntensity;
float saturate (float f) { return max(0.0, min(1.0,f)); }
float splineFresnel (in vec3 N, in vec3 E, in float specIntensity, in float fresnel)
{
float factor = (1.0 - saturate(dot(N,E)));
float factor3 = ((factor * factor) * factor);
vec3 p = vec3(1.0, factor, factor3);
vec2 t = vec2(1.0 - fresnel, fresnel);
p.x = dot(p.xy, t);
p.y = dot(p.yz, t);
factor = (0.05 + (0.95 * dot(p.xy, t)));
factor *= specIntensity;
return factor;
}
varying vec3 inN;
varying vec3 inE;
void main()
{
float f = splineFresnel (inN, inE, _SpecIntensity, _Fresnel);
gl_FragColor = vec4(f);
}

View file

@ -0,0 +1,85 @@
uniform float _Fresnel;
uniform float _SpecIntensity;
varying vec3 inN;
varying vec3 inE;
float saturate (
in float f_1
)
{
float tmpvar_2;
tmpvar_2 = min (1.0, f_1);
float tmpvar_3;
tmpvar_3 = max (0.0, tmpvar_2);
return tmpvar_3;
}
float splineFresnel (
in vec3 N_4,
in vec3 E_5,
in float specIntensity_6,
in float fresnel_7
)
{
vec2 t_8;
vec3 p_9;
float factor3_10;
float factor_11;
float tmpvar_12;
tmpvar_12 = dot (N_4, E_5);
float tmpvar_13;
tmpvar_13 = saturate (tmpvar_12);
float tmpvar_14;
tmpvar_14 = (1.0 - tmpvar_13);
factor_11 = tmpvar_14;
float tmpvar_15;
tmpvar_15 = ((factor_11 * factor_11) * factor_11);
factor3_10 = tmpvar_15;
vec3 tmpvar_16;
tmpvar_16.x = 1.0;
tmpvar_16.y = factor_11;
tmpvar_16.z = factor3_10;
vec3 tmpvar_17;
tmpvar_17 = tmpvar_16;
p_9 = tmpvar_17;
vec2 tmpvar_18;
tmpvar_18.x = (1.0 - fresnel_7);
tmpvar_18.y = fresnel_7;
vec2 tmpvar_19;
tmpvar_19 = tmpvar_18;
t_8 = tmpvar_19;
float tmpvar_20;
tmpvar_20 = dot (p_9.xy, t_8);
float tmpvar_21;
tmpvar_21 = tmpvar_20;
p_9.x = tmpvar_21;
float tmpvar_22;
tmpvar_22 = dot (p_9.yz, t_8);
float tmpvar_23;
tmpvar_23 = tmpvar_22;
p_9.y = vec2(tmpvar_23).y;
float tmpvar_24;
tmpvar_24 = dot (p_9.xy, t_8);
float tmpvar_25;
tmpvar_25 = (0.05 + (0.95 * tmpvar_24));
factor_11 = tmpvar_25;
float tmpvar_26;
tmpvar_26 = (factor_11 * specIntensity_6);
factor_11 = tmpvar_26;
return factor_11;
}
void main ()
{
float f_27;
float tmpvar_28;
tmpvar_28 = splineFresnel (inN, inE, _SpecIntensity, _Fresnel);
float tmpvar_29;
tmpvar_29 = tmpvar_28;
f_27 = tmpvar_29;
vec4 tmpvar_30;
tmpvar_30 = vec4(f_27);
vec4 tmpvar_31;
tmpvar_31 = tmpvar_30;
gl_FragColor = tmpvar_31;
}

View file

@ -0,0 +1,28 @@
uniform float _Fresnel;
uniform float _SpecIntensity;
varying vec3 inN;
varying vec3 inE;
void main ()
{
vec3 p_1;
float tmpvar_2;
tmpvar_2 = (1.0 - max (0.0, min (1.0,
dot (inN, inE)
)));
vec3 tmpvar_3;
tmpvar_3.x = 1.0;
tmpvar_3.y = tmpvar_2;
tmpvar_3.z = ((tmpvar_2 * tmpvar_2) * tmpvar_2);
p_1.z = tmpvar_3.z;
vec2 tmpvar_4;
tmpvar_4.x = (1.0 - _Fresnel);
tmpvar_4.y = _Fresnel;
p_1.x = dot (tmpvar_3.xy, tmpvar_4);
p_1.y = dot (tmpvar_3.yz, tmpvar_4);
gl_FragColor = vec4(((0.05 + (0.95 *
dot (p_1.xy, tmpvar_4)
)) * _SpecIntensity));
}
// inputs: 2, stats: 14 alu 0 tex 0 flow

View file

@ -19,5 +19,7 @@ uniform mediump int im;
void main() {
lowp float f = fh1 + fh2 + fm + s1.f;
highp int i = il1 + il2 + im + s1.i;
gl_FragColor = vec4(f, i, 0.0, 0.0);
float z = 0.0;
z += gl_FragCoord.x > 0.5 ? 0.9 : 0.1;
gl_FragColor = vec4(f, i, z, 0.0);
}

View file

@ -13,20 +13,34 @@ uniform int il2;
uniform int im;
void main ()
{
int i_1;
lowp float f_2;
highp float tmpvar_3;
tmpvar_3 = (((fh1 + fh2) + fm) + s1.f);
f_2 = tmpvar_3;
int tmpvar_4;
tmpvar_4 = (((il1 + il2) + im) + s1.i);
i_1 = tmpvar_4;
highp vec4 tmpvar_5;
tmpvar_5.zw = vec2(0.0, 0.0);
tmpvar_5.x = f_2;
tmpvar_5.y = float(i_1);
highp vec4 tmpvar_6;
tmpvar_6 = tmpvar_5;
gl_FragColor = tmpvar_6;
float z_1;
int i_2;
lowp float f_3;
highp float tmpvar_4;
tmpvar_4 = (((fh1 + fh2) + fm) + s1.f);
f_3 = tmpvar_4;
int tmpvar_5;
tmpvar_5 = (((il1 + il2) + im) + s1.i);
i_2 = tmpvar_5;
float tmpvar_6;
tmpvar_6 = 0.0;
z_1 = tmpvar_6;
float tmpvar_7;
if ((gl_FragCoord.x > 0.5)) {
tmpvar_7 = 0.9;
} else {
tmpvar_7 = 0.1;
};
float tmpvar_8;
tmpvar_8 = (z_1 + tmpvar_7);
z_1 = tmpvar_8;
highp vec4 tmpvar_9;
tmpvar_9.w = 0.0;
tmpvar_9.x = f_3;
tmpvar_9.y = float(i_2);
tmpvar_9.z = z_1;
highp vec4 tmpvar_10;
tmpvar_10 = tmpvar_9;
gl_FragColor = tmpvar_10;
}

View file

@ -21,12 +21,19 @@ void main ()
int tmpvar_4;
tmpvar_4 = (((il1 + il2) + im) + s1.i);
i_1 = tmpvar_4;
highp vec4 tmpvar_5;
tmpvar_5.zw = vec2(0.0, 0.0);
tmpvar_5.x = f_2;
tmpvar_5.y = float(i_1);
gl_FragColor = tmpvar_5;
float tmpvar_5;
if ((gl_FragCoord.x > 0.5)) {
tmpvar_5 = 0.9;
} else {
tmpvar_5 = 0.1;
};
highp vec4 tmpvar_6;
tmpvar_6.w = 0.0;
tmpvar_6.x = f_2;
tmpvar_6.y = float(i_1);
tmpvar_6.z = tmpvar_5;
gl_FragColor = tmpvar_6;
}
// inputs: 0, stats: 8 alu 0 tex 0 flow
// inputs: 1, stats: 11 alu 0 tex 1 flow

View file

@ -3,20 +3,20 @@ uniform sampler2D _BurntTex;
uniform mediump float _EmberFadeEnd;
uniform mediump float _EmberFadeStart;
varying mediump vec2 xlv_TEXCOORD0;
float xll_saturate (
in float x_1
mediump float xll_saturate (
in mediump float x_1
)
{
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = clamp (x_1, 0.0, 1.0);
return tmpvar_2;
}
vec3 xll_saturate (
in vec3 x_3
mediump vec3 xll_saturate (
in mediump vec3 x_3
)
{
vec3 tmpvar_4;
mediump vec3 tmpvar_4;
tmpvar_4 = clamp (x_3, 0.0, 1.0);
return tmpvar_4;
}
@ -38,9 +38,9 @@ lowp vec4 frag (
lowp vec3 tmpvar_12;
tmpvar_12 = tmpvar_11.xyz;
burn_7 = tmpvar_12;
float tmpvar_13;
mediump float tmpvar_13;
tmpvar_13 = xll_saturate (((_EmberFadeStart - 0.05) / (_EmberFadeStart - _EmberFadeEnd)));
float tmpvar_14;
mediump float tmpvar_14;
tmpvar_14 = tmpvar_13;
t_6 = tmpvar_14;
lowp vec3 tmpvar_15;

View file

@ -3,20 +3,20 @@ uniform sampler2D _BurntTex;
uniform mediump float _EmberFadeEnd;
uniform mediump float _EmberFadeStart;
varying mediump vec2 xlv_TEXCOORD0;
float xll_saturate (
in float x_1
mediump float xll_saturate (
in mediump float x_1
)
{
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = clamp (x_1, 0.0, 1.0);
return tmpvar_2;
}
vec3 xll_saturate (
in vec3 x_3
mediump vec3 xll_saturate (
in mediump vec3 x_3
)
{
vec3 tmpvar_4;
mediump vec3 tmpvar_4;
tmpvar_4 = clamp (x_3, 0.0, 1.0);
return tmpvar_4;
}
@ -38,11 +38,11 @@ lowp vec4 frag (
lowp vec3 tmpvar_12;
tmpvar_12 = tmpvar_11.xyz;
burn_7 = tmpvar_12;
float tmpvar_13;
mediump float tmpvar_13;
tmpvar_13 = xll_saturate (((_EmberFadeStart - 0.05) / (_EmberFadeStart - _EmberFadeEnd)));
vec3 tmpvar_14;
mediump vec3 tmpvar_14;
tmpvar_14 = vec3(tmpvar_13);
vec3 tmpvar_15;
mediump vec3 tmpvar_15;
tmpvar_15 = tmpvar_14;
t_6 = tmpvar_15;
lowp vec3 tmpvar_16;

View file

@ -59,7 +59,7 @@ lowp vec4 frag_surf (
(_LightColor0.xyz * diff_5)
+ IN_1.vlight)) + (_LightColor0.xyz * spec_3));
c_2.xyz = tmpvar_21.xyz.xyz;
float tmpvar_22;
mediump float tmpvar_22;
tmpvar_22 = 0.0;
c_2.w = vec4(tmpvar_22).w;
return c_2;
@ -69,7 +69,7 @@ void main ()
{
v2f_surf xlt_IN_23;
lowp vec4 xl_retval_24;
vec4 tmpvar_25;
mediump vec4 tmpvar_25;
tmpvar_25 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_23.pos = tmpvar_25;
lowp vec2 tmpvar_26;

View file

@ -1,7 +1,7 @@
mediump vec4 xlat_main ()
{
highp float foo_1;
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = 1.0;
foo_1 = tmpvar_2;
highp float tmpvar_3;

View file

@ -4,10 +4,10 @@ mediump vec4 xlat_main (
)
{
mediump vec4 c_2;
vec4 tmpvar_3;
mediump vec4 tmpvar_3;
tmpvar_3 = vec4(0.0, 0.0, 0.0, 0.0);
c_2 = tmpvar_3;
float tmpvar_4;
mediump float tmpvar_4;
if ((uv_1.x > 0.5)) {
tmpvar_4 = 0.9;
} else {
@ -16,7 +16,7 @@ mediump vec4 xlat_main (
mediump vec4 tmpvar_5;
tmpvar_5 = (c_2 + tmpvar_4);
c_2 = tmpvar_5;
vec4 tmpvar_6;
mediump vec4 tmpvar_6;
if ((uv_1.x > 0.5)) {
tmpvar_6 = vec4(0.9, 0.9, 0.9, 0.9);
} else {
@ -25,7 +25,7 @@ mediump vec4 xlat_main (
mediump vec4 tmpvar_7;
tmpvar_7 = (c_2 + tmpvar_6);
c_2 = tmpvar_7;
vec3 tmpvar_8;
mediump vec3 tmpvar_8;
if ((uv_1.x > 0.5)) {
tmpvar_8 = vec3(0.9, 0.9, 0.9);
} else {
@ -34,7 +34,7 @@ mediump vec4 xlat_main (
mediump vec3 tmpvar_9;
tmpvar_9 = (c_2.xyz + tmpvar_8);
c_2.xyz = tmpvar_9.xyz.xyz;
vec2 tmpvar_10;
mediump vec2 tmpvar_10;
if ((uv_1.x > 0.5)) {
tmpvar_10 = vec2(0.9, 0.9);
} else {
@ -45,7 +45,7 @@ mediump vec4 xlat_main (
c_2.xy = tmpvar_11.xy.xy;
highp float tmpvar_12;
tmpvar_12 = fract (uv_1.x);
float tmpvar_13;
mediump float tmpvar_13;
if (bool(tmpvar_12)) {
tmpvar_13 = 0.9;
} else {

View file

@ -3,14 +3,14 @@ void main ()
{
mediump vec4 c_1;
c_1 = vec4(0.0, 0.0, 0.0, 0.0);
float tmpvar_2;
mediump float tmpvar_2;
if ((xlv_TEXCOORD0.x > 0.5)) {
tmpvar_2 = 0.9;
} else {
tmpvar_2 = 0.1;
};
c_1 = vec4(tmpvar_2);
vec4 tmpvar_3;
mediump vec4 tmpvar_3;
if ((xlv_TEXCOORD0.x > 0.5)) {
tmpvar_3 = vec4(0.9, 0.9, 0.9, 0.9);
} else {
@ -19,14 +19,14 @@ void main ()
mediump vec4 tmpvar_4;
tmpvar_4 = (vec4(tmpvar_2) + tmpvar_3);
c_1 = tmpvar_4;
vec3 tmpvar_5;
mediump vec3 tmpvar_5;
if ((xlv_TEXCOORD0.x > 0.5)) {
tmpvar_5 = vec3(0.9, 0.9, 0.9);
} else {
tmpvar_5 = vec3(0.1, 0.1, 0.1);
};
c_1.xyz = (tmpvar_4.xyz + tmpvar_5);
vec2 tmpvar_6;
mediump vec2 tmpvar_6;
if ((xlv_TEXCOORD0.x > 0.5)) {
tmpvar_6 = vec2(0.9, 0.9);
} else {
@ -35,7 +35,7 @@ void main ()
c_1.xy = (c_1.xy + tmpvar_6);
highp float tmpvar_7;
tmpvar_7 = fract(xlv_TEXCOORD0.x);
float tmpvar_8;
mediump float tmpvar_8;
if (bool(tmpvar_7)) {
tmpvar_8 = 0.9;
} else {

View file

@ -1,90 +1,90 @@
varying highp vec4 xlv_TEXCOORD0;
vec2 xll_vecTSel (
mediump vec2 xll_vecTSel (
in bvec2 a_1,
in vec2 b_2,
in vec2 c_3
in mediump vec2 b_2,
in mediump vec2 c_3
)
{
float tmpvar_4;
mediump float tmpvar_4;
if (a_1.x) {
tmpvar_4 = b_2.x;
} else {
tmpvar_4 = c_3.x;
};
float tmpvar_5;
mediump float tmpvar_5;
if (a_1.y) {
tmpvar_5 = b_2.y;
} else {
tmpvar_5 = c_3.y;
};
vec2 tmpvar_6;
mediump vec2 tmpvar_6;
tmpvar_6.x = tmpvar_4;
tmpvar_6.y = tmpvar_5;
return tmpvar_6;
}
vec3 xll_vecTSel (
mediump vec3 xll_vecTSel (
in bvec3 a_7,
in vec3 b_8,
in vec3 c_9
in mediump vec3 b_8,
in mediump vec3 c_9
)
{
float tmpvar_10;
mediump float tmpvar_10;
if (a_7.x) {
tmpvar_10 = b_8.x;
} else {
tmpvar_10 = c_9.x;
};
float tmpvar_11;
mediump float tmpvar_11;
if (a_7.y) {
tmpvar_11 = b_8.y;
} else {
tmpvar_11 = c_9.y;
};
float tmpvar_12;
mediump float tmpvar_12;
if (a_7.z) {
tmpvar_12 = b_8.z;
} else {
tmpvar_12 = c_9.z;
};
vec3 tmpvar_13;
mediump vec3 tmpvar_13;
tmpvar_13.x = tmpvar_10;
tmpvar_13.y = tmpvar_11;
tmpvar_13.z = tmpvar_12;
return tmpvar_13;
}
vec4 xll_vecTSel (
mediump vec4 xll_vecTSel (
in bvec4 a_14,
in vec4 b_15,
in vec4 c_16
in mediump vec4 b_15,
in mediump vec4 c_16
)
{
float tmpvar_17;
mediump float tmpvar_17;
if (a_14.x) {
tmpvar_17 = b_15.x;
} else {
tmpvar_17 = c_16.x;
};
float tmpvar_18;
mediump float tmpvar_18;
if (a_14.y) {
tmpvar_18 = b_15.y;
} else {
tmpvar_18 = c_16.y;
};
float tmpvar_19;
mediump float tmpvar_19;
if (a_14.z) {
tmpvar_19 = b_15.z;
} else {
tmpvar_19 = c_16.z;
};
float tmpvar_20;
mediump float tmpvar_20;
if (a_14.w) {
tmpvar_20 = b_15.w;
} else {
tmpvar_20 = c_16.w;
};
vec4 tmpvar_21;
mediump vec4 tmpvar_21;
tmpvar_21.x = tmpvar_17;
tmpvar_21.y = tmpvar_18;
tmpvar_21.z = tmpvar_19;
@ -97,33 +97,33 @@ mediump vec4 xlat_main (
)
{
highp vec4 a_23;
vec4 tmpvar_24;
mediump vec4 tmpvar_24;
tmpvar_24 = vec4(0.0, 0.0, 0.0, 0.0);
a_23 = tmpvar_24;
bvec4 tmpvar_25;
tmpvar_25 = greaterThan (uv_22, vec4(0.5, 0.5, 0.5, 0.5));
vec4 tmpvar_26;
mediump vec4 tmpvar_26;
tmpvar_26 = xll_vecTSel (tmpvar_25, vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0));
highp vec4 tmpvar_27;
tmpvar_27 = (a_23 + tmpvar_26);
a_23 = tmpvar_27;
bvec4 tmpvar_28;
tmpvar_28 = greaterThan (uv_22, vec4(0.5, 0.5, 0.5, 0.5));
vec4 tmpvar_29;
mediump vec4 tmpvar_29;
tmpvar_29 = xll_vecTSel (tmpvar_28, vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0));
highp vec4 tmpvar_30;
tmpvar_30 = (a_23 + tmpvar_29);
a_23 = tmpvar_30;
bvec4 tmpvar_31;
tmpvar_31 = greaterThan (uv_22, vec4(0.5, 0.5, 0.5, 0.5));
vec4 tmpvar_32;
mediump vec4 tmpvar_32;
tmpvar_32 = xll_vecTSel (tmpvar_31, vec4(1.0, 1.0, 1.0, 1.0), vec4(2.0, 2.0, 2.0, 2.0));
highp vec4 tmpvar_33;
tmpvar_33 = (a_23 + tmpvar_32);
a_23 = tmpvar_33;
bvec4 tmpvar_34;
tmpvar_34 = greaterThan (uv_22, vec4(0.5, 0.5, 0.5, 0.5));
vec4 tmpvar_35;
mediump vec4 tmpvar_35;
tmpvar_35 = xll_vecTSel (tmpvar_34, vec4(1.0, 1.0, 1.0, 1.0), vec4(2.0, 2.0, 2.0, 2.0));
highp vec4 tmpvar_36;
tmpvar_36 = (a_23 + tmpvar_35);
@ -132,7 +132,7 @@ mediump vec4 xlat_main (
tmpvar_37 = fract (uv_22);
bvec4 tmpvar_38;
tmpvar_38 = bvec4(tmpvar_37).xyzw;
vec4 tmpvar_39;
mediump vec4 tmpvar_39;
tmpvar_39 = xll_vecTSel (tmpvar_38, vec4(1.0, 1.0, 1.0, 1.0), vec4(2.0, 2.0, 2.0, 2.0));
highp vec4 tmpvar_40;
tmpvar_40 = (a_23 + tmpvar_39);

View file

@ -4,62 +4,62 @@ void main ()
mediump vec4 tmpvar_1;
bvec4 tmpvar_2;
tmpvar_2 = greaterThan (xlv_TEXCOORD0, vec4(0.5, 0.5, 0.5, 0.5));
float tmpvar_3;
mediump float tmpvar_3;
if (tmpvar_2.x) {
tmpvar_3 = 1.0;
} else {
tmpvar_3 = 5.0;
};
float tmpvar_4;
mediump float tmpvar_4;
if (tmpvar_2.y) {
tmpvar_4 = 2.0;
} else {
tmpvar_4 = 6.0;
};
float tmpvar_5;
mediump float tmpvar_5;
if (tmpvar_2.z) {
tmpvar_5 = 3.0;
} else {
tmpvar_5 = 7.0;
};
float tmpvar_6;
mediump float tmpvar_6;
if (tmpvar_2.w) {
tmpvar_6 = 4.0;
} else {
tmpvar_6 = 8.0;
};
vec4 tmpvar_7;
mediump vec4 tmpvar_7;
tmpvar_7.x = tmpvar_3;
tmpvar_7.y = tmpvar_4;
tmpvar_7.z = tmpvar_5;
tmpvar_7.w = tmpvar_6;
bvec4 tmpvar_8;
tmpvar_8 = greaterThan (xlv_TEXCOORD0, vec4(0.5, 0.5, 0.5, 0.5));
float tmpvar_9;
mediump float tmpvar_9;
if (tmpvar_8.x) {
tmpvar_9 = 1.0;
} else {
tmpvar_9 = 5.0;
};
float tmpvar_10;
mediump float tmpvar_10;
if (tmpvar_8.y) {
tmpvar_10 = 2.0;
} else {
tmpvar_10 = 6.0;
};
float tmpvar_11;
mediump float tmpvar_11;
if (tmpvar_8.z) {
tmpvar_11 = 3.0;
} else {
tmpvar_11 = 7.0;
};
float tmpvar_12;
mediump float tmpvar_12;
if (tmpvar_8.w) {
tmpvar_12 = 4.0;
} else {
tmpvar_12 = 8.0;
};
vec4 tmpvar_13;
mediump vec4 tmpvar_13;
tmpvar_13.x = tmpvar_9;
tmpvar_13.y = tmpvar_10;
tmpvar_13.z = tmpvar_11;
@ -68,31 +68,31 @@ void main ()
tmpvar_14 = (tmpvar_7 + tmpvar_13);
bvec4 tmpvar_15;
tmpvar_15 = greaterThan (xlv_TEXCOORD0, vec4(0.5, 0.5, 0.5, 0.5));
float tmpvar_16;
mediump float tmpvar_16;
if (tmpvar_15.x) {
tmpvar_16 = 1.0;
} else {
tmpvar_16 = 2.0;
};
float tmpvar_17;
mediump float tmpvar_17;
if (tmpvar_15.y) {
tmpvar_17 = 1.0;
} else {
tmpvar_17 = 2.0;
};
float tmpvar_18;
mediump float tmpvar_18;
if (tmpvar_15.z) {
tmpvar_18 = 1.0;
} else {
tmpvar_18 = 2.0;
};
float tmpvar_19;
mediump float tmpvar_19;
if (tmpvar_15.w) {
tmpvar_19 = 1.0;
} else {
tmpvar_19 = 2.0;
};
vec4 tmpvar_20;
mediump vec4 tmpvar_20;
tmpvar_20.x = tmpvar_16;
tmpvar_20.y = tmpvar_17;
tmpvar_20.z = tmpvar_18;
@ -101,31 +101,31 @@ void main ()
tmpvar_21 = (tmpvar_14 + tmpvar_20);
bvec4 tmpvar_22;
tmpvar_22 = greaterThan (xlv_TEXCOORD0, vec4(0.5, 0.5, 0.5, 0.5));
float tmpvar_23;
mediump float tmpvar_23;
if (tmpvar_22.x) {
tmpvar_23 = 1.0;
} else {
tmpvar_23 = 2.0;
};
float tmpvar_24;
mediump float tmpvar_24;
if (tmpvar_22.y) {
tmpvar_24 = 1.0;
} else {
tmpvar_24 = 2.0;
};
float tmpvar_25;
mediump float tmpvar_25;
if (tmpvar_22.z) {
tmpvar_25 = 1.0;
} else {
tmpvar_25 = 2.0;
};
float tmpvar_26;
mediump float tmpvar_26;
if (tmpvar_22.w) {
tmpvar_26 = 1.0;
} else {
tmpvar_26 = 2.0;
};
vec4 tmpvar_27;
mediump vec4 tmpvar_27;
tmpvar_27.x = tmpvar_23;
tmpvar_27.y = tmpvar_24;
tmpvar_27.z = tmpvar_25;
@ -134,31 +134,31 @@ void main ()
tmpvar_28 = (tmpvar_21 + tmpvar_27);
bvec4 tmpvar_29;
tmpvar_29 = bvec4(fract(xlv_TEXCOORD0));
float tmpvar_30;
mediump float tmpvar_30;
if (tmpvar_29.x) {
tmpvar_30 = 1.0;
} else {
tmpvar_30 = 2.0;
};
float tmpvar_31;
mediump float tmpvar_31;
if (tmpvar_29.y) {
tmpvar_31 = 1.0;
} else {
tmpvar_31 = 2.0;
};
float tmpvar_32;
mediump float tmpvar_32;
if (tmpvar_29.z) {
tmpvar_32 = 1.0;
} else {
tmpvar_32 = 2.0;
};
float tmpvar_33;
mediump float tmpvar_33;
if (tmpvar_29.w) {
tmpvar_33 = 1.0;
} else {
tmpvar_33 = 2.0;
};
vec4 tmpvar_34;
mediump vec4 tmpvar_34;
tmpvar_34.x = tmpvar_30;
tmpvar_34.y = tmpvar_31;
tmpvar_34.z = tmpvar_32;

View file

@ -2,18 +2,18 @@
#extension GL_OES_standard_derivatives : enable
uniform sampler2D tex;
uniform samplerCube cub;
varying vec3 uv;
varying mediump vec3 uv;
void main ()
{
vec2 tmpvar_1;
mediump vec2 tmpvar_1;
tmpvar_1 = dFdx (uv.xy);
vec2 tmpvar_2;
mediump vec2 tmpvar_2;
tmpvar_2 = dFdy (uv.xy);
lowp vec4 tmpvar_3;
tmpvar_3 = texture2DGradEXT (tex, uv.xy, tmpvar_1, tmpvar_2);
vec3 tmpvar_4;
mediump vec3 tmpvar_4;
tmpvar_4 = dFdx (uv);
vec3 tmpvar_5;
mediump vec3 tmpvar_5;
tmpvar_5 = dFdy (uv);
lowp vec4 tmpvar_6;
tmpvar_6 = textureCubeGradEXT (cub, uv, tmpvar_4, tmpvar_5);

View file

@ -2,7 +2,7 @@
#extension GL_OES_standard_derivatives : enable
uniform sampler2D tex;
uniform samplerCube cub;
varying vec3 uv;
varying mediump vec3 uv;
void main ()
{
lowp vec4 tmpvar_1;

View file

@ -1,9 +1,9 @@
#extension GL_EXT_shader_texture_lod : enable
uniform sampler2D tex;
varying highp vec4 xlv_TEXCOORD0;
vec4 xll_tex2Dlod (
mediump vec4 xll_tex2Dlod (
in sampler2D s_1,
in vec4 coord_2
in mediump vec4 coord_2
)
{
lowp vec4 tmpvar_3;
@ -18,7 +18,7 @@ mediump vec4 xlat_main (
highp vec4 tmpvar_5;
tmpvar_5.zw = vec2(0.0, 0.0);
tmpvar_5.xy = uv_4.xy.xy;
vec4 tmpvar_6;
mediump vec4 tmpvar_6;
tmpvar_6 = xll_tex2Dlod (tex, tmpvar_5);
return tmpvar_6;
}

View file

@ -1,9 +1,9 @@
#extension GL_EXT_shadow_samplers : enable
uniform lowp sampler2DShadow shadowmap;
varying highp vec4 xlv_TEXCOORD0;
float xll_shadow2D (
mediump float xll_shadow2D (
in lowp sampler2DShadow s_1,
in vec3 coord_2
in mediump vec3 coord_2
)
{
lowp float tmpvar_3;
@ -11,9 +11,9 @@ float xll_shadow2D (
return tmpvar_3;
}
float xll_shadow2Dproj (
mediump float xll_shadow2Dproj (
in lowp sampler2DShadow s_4,
in vec4 coord_5
in mediump vec4 coord_5
)
{
lowp float tmpvar_6;
@ -27,14 +27,14 @@ lowp vec4 xlat_main (
{
lowp float s2_8;
lowp float s1_9;
float tmpvar_10;
mediump float tmpvar_10;
tmpvar_10 = xll_shadow2D (shadowmap, uv_7.xyz);
float tmpvar_11;
mediump float tmpvar_11;
tmpvar_11 = tmpvar_10;
s1_9 = tmpvar_11;
float tmpvar_12;
mediump float tmpvar_12;
tmpvar_12 = xll_shadow2Dproj (shadowmap, uv_7);
float tmpvar_13;
mediump float tmpvar_13;
tmpvar_13 = tmpvar_12;
s2_8 = tmpvar_13;
lowp vec4 tmpvar_14;

View file

@ -6,7 +6,7 @@ mediump vec4 xlat_main (
)
{
mediump vec4 c_3;
vec4 tmpvar_4;
mediump vec4 tmpvar_4;
tmpvar_4 = vec4(0.0, 0.0, 0.0, 0.0);
c_3 = tmpvar_4;
return c_3;

View file

@ -103,10 +103,10 @@ vec2 EncodeFloatRG (
highp vec2 enc_33;
highp float kEncodeBit_34;
highp vec2 kEncodeMul_35;
vec2 tmpvar_36;
mediump vec2 tmpvar_36;
tmpvar_36 = vec2(1.0, 255.0);
kEncodeMul_35 = tmpvar_36;
float tmpvar_37;
mediump float tmpvar_37;
tmpvar_37 = 0.00392157;
kEncodeBit_34 = tmpvar_37;
highp vec2 tmpvar_38;
@ -155,7 +155,7 @@ mediump vec4 xlat_main (
mediump float tmpvar_55;
tmpvar_55 = shadow_44;
res_43.x = tmpvar_55;
float tmpvar_56;
mediump float tmpvar_56;
tmpvar_56 = 1.0;
res_43.y = vec2(tmpvar_56).y;
highp vec2 tmpvar_57;
@ -170,7 +170,7 @@ void main ()
{
v2f xlt_i_59;
mediump vec4 xl_retval_60;
vec4 tmpvar_61;
mediump vec4 tmpvar_61;
tmpvar_61 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_59.pos = tmpvar_61;
highp vec2 tmpvar_62;

View file

@ -8,9 +8,9 @@ uniform sampler2D _MainTex;
uniform highp vec4 _MainTex_TexelSize;
varying highp vec2 xlv_TEXCOORD0;
varying highp vec4 xlv_TEXCOORD1;
vec4 xll_tex2Dlod (
mediump vec4 xll_tex2Dlod (
in sampler2D s_1,
in vec4 coord_2
in mediump vec4 coord_2
)
{
lowp vec4 tmpvar_3;
@ -77,7 +77,7 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_51;
tmpvar_51.zw = vec2(0.0, 0.0);
tmpvar_51.xy = fxaaConsolePosPos_6.xy.xy;
vec4 tmpvar_52;
mediump vec4 tmpvar_52;
tmpvar_52 = xll_tex2Dlod (tex_7, tmpvar_51);
highp float tmpvar_53;
tmpvar_53 = FxaaLuma (tmpvar_52);
@ -87,7 +87,7 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_55;
tmpvar_55.zw = vec2(0.0, 0.0);
tmpvar_55.xy = fxaaConsolePosPos_6.xw.xy;
vec4 tmpvar_56;
mediump vec4 tmpvar_56;
tmpvar_56 = xll_tex2Dlod (tex_7, tmpvar_55);
highp float tmpvar_57;
tmpvar_57 = FxaaLuma (tmpvar_56);
@ -97,7 +97,7 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_59;
tmpvar_59.zw = vec2(0.0, 0.0);
tmpvar_59.xy = fxaaConsolePosPos_6.zy.xy;
vec4 tmpvar_60;
mediump vec4 tmpvar_60;
tmpvar_60 = xll_tex2Dlod (tex_7, tmpvar_59);
highp float tmpvar_61;
tmpvar_61 = FxaaLuma (tmpvar_60);
@ -107,7 +107,7 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_63;
tmpvar_63.zw = vec2(0.0, 0.0);
tmpvar_63.xy = fxaaConsolePosPos_6.zw.xy;
vec4 tmpvar_64;
mediump vec4 tmpvar_64;
tmpvar_64 = xll_tex2Dlod (tex_7, tmpvar_63);
highp float tmpvar_65;
tmpvar_65 = FxaaLuma (tmpvar_64);
@ -117,9 +117,9 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_67;
tmpvar_67.zw = vec2(0.0, 0.0);
tmpvar_67.xy = pos_5.xy.xy;
vec4 tmpvar_68;
mediump vec4 tmpvar_68;
tmpvar_68 = xll_tex2Dlod (tex_7, tmpvar_67);
vec4 tmpvar_69;
mediump vec4 tmpvar_69;
tmpvar_69 = tmpvar_68;
rgbyM_46 = tmpvar_69;
lowp float tmpvar_70;
@ -202,17 +202,17 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_98;
tmpvar_98.zw = vec2(0.0, 0.0);
tmpvar_98.xy = (pos_5.xy - (dir1_30 * fxaaConsoleRcpFrameOpt_11.zw)).xy;
vec4 tmpvar_99;
mediump vec4 tmpvar_99;
tmpvar_99 = xll_tex2Dlod (tex_7, tmpvar_98);
vec4 tmpvar_100;
mediump vec4 tmpvar_100;
tmpvar_100 = tmpvar_99;
rgbyN1_29 = tmpvar_100;
highp vec4 tmpvar_101;
tmpvar_101.zw = vec2(0.0, 0.0);
tmpvar_101.xy = (pos_5.xy + (dir1_30 * fxaaConsoleRcpFrameOpt_11.zw)).xy;
vec4 tmpvar_102;
mediump vec4 tmpvar_102;
tmpvar_102 = xll_tex2Dlod (tex_7, tmpvar_101);
vec4 tmpvar_103;
mediump vec4 tmpvar_103;
tmpvar_103 = tmpvar_102;
rgbyP1_28 = tmpvar_103;
highp float tmpvar_104;
@ -232,17 +232,17 @@ lowp vec4 FxaaPixelShader (
highp vec4 tmpvar_110;
tmpvar_110.zw = vec2(0.0, 0.0);
tmpvar_110.xy = (pos_5.xy - (dir2_26 * fxaaConsoleRcpFrameOpt2_12.zw)).xy;
vec4 tmpvar_111;
mediump vec4 tmpvar_111;
tmpvar_111 = xll_tex2Dlod (tex_7, tmpvar_110);
vec4 tmpvar_112;
mediump vec4 tmpvar_112;
tmpvar_112 = tmpvar_111;
rgbyN2_25 = tmpvar_112;
highp vec4 tmpvar_113;
tmpvar_113.zw = vec2(0.0, 0.0);
tmpvar_113.xy = (pos_5.xy + (dir2_26 * fxaaConsoleRcpFrameOpt2_12.zw)).xy;
vec4 tmpvar_114;
mediump vec4 tmpvar_114;
tmpvar_114 = xll_tex2Dlod (tex_7, tmpvar_113);
vec4 tmpvar_115;
mediump vec4 tmpvar_115;
tmpvar_115 = tmpvar_114;
rgbyP2_24 = tmpvar_115;
lowp vec4 tmpvar_116;
@ -267,7 +267,7 @@ lowp vec4 xlat_main (
)
{
highp float fxaaN_121;
float tmpvar_122;
mediump float tmpvar_122;
tmpvar_122 = 0.5;
fxaaN_121 = tmpvar_122;
highp vec4 tmpvar_123;
@ -284,7 +284,7 @@ void main ()
{
v2f xlt_i_125;
lowp vec4 xl_retval_126;
vec4 tmpvar_127;
mediump vec4 tmpvar_127;
tmpvar_127 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_125.pos = tmpvar_127;
highp vec2 tmpvar_128;

View file

@ -9,9 +9,9 @@ uniform highp vec4 _MainTex_TexelSize;
varying highp vec4 xlv_SV_POSITION;
varying highp vec2 xlv_TEXCOORD0;
varying highp vec4 xlv_TEXCOORD1;
vec4 xll_tex2Dlod (
mediump vec4 xll_tex2Dlod (
in sampler2D s_1,
in vec4 coord_2
in mediump vec4 coord_2
)
{
lowp vec4 tmpvar_3;
@ -19,106 +19,106 @@ vec4 xll_tex2Dlod (
return tmpvar_3;
}
float xll_saturate (
in float x_4
mediump float xll_saturate (
in mediump float x_4
)
{
float tmpvar_5;
mediump float tmpvar_5;
tmpvar_5 = clamp (x_4, 0.0, 1.0);
return tmpvar_5;
}
vec2 xll_saturate (
in vec2 x_6
mediump vec2 xll_saturate (
in mediump vec2 x_6
)
{
vec2 tmpvar_7;
mediump vec2 tmpvar_7;
tmpvar_7 = clamp (x_6, 0.0, 1.0);
return tmpvar_7;
}
vec3 xll_saturate (
in vec3 x_8
mediump vec3 xll_saturate (
in mediump vec3 x_8
)
{
vec3 tmpvar_9;
mediump vec3 tmpvar_9;
tmpvar_9 = clamp (x_8, 0.0, 1.0);
return tmpvar_9;
}
vec4 xll_saturate (
in vec4 x_10
mediump vec4 xll_saturate (
in mediump vec4 x_10
)
{
vec4 tmpvar_11;
mediump vec4 tmpvar_11;
tmpvar_11 = clamp (x_10, 0.0, 1.0);
return tmpvar_11;
}
mat2 xll_saturate (
in mat2 m_12
mediump mat2 xll_saturate (
in mediump mat2 m_12
)
{
vec2 tmpvar_13;
mediump vec2 tmpvar_13;
tmpvar_13 = clamp (m_12[0], 0.0, 1.0);
vec2 tmpvar_14;
mediump vec2 tmpvar_14;
tmpvar_14 = clamp (m_12[1], 0.0, 1.0);
mat2 tmpvar_15;
vec2 tmpvar_16;
mediump mat2 tmpvar_15;
mediump vec2 tmpvar_16;
tmpvar_16 = tmpvar_13;
tmpvar_15[0] = tmpvar_16;
vec2 tmpvar_17;
mediump vec2 tmpvar_17;
tmpvar_17 = tmpvar_14;
tmpvar_15[1] = tmpvar_17;
return tmpvar_15;
}
mat3 xll_saturate (
in mat3 m_18
mediump mat3 xll_saturate (
in mediump mat3 m_18
)
{
vec3 tmpvar_19;
mediump vec3 tmpvar_19;
tmpvar_19 = clamp (m_18[0], 0.0, 1.0);
vec3 tmpvar_20;
mediump vec3 tmpvar_20;
tmpvar_20 = clamp (m_18[1], 0.0, 1.0);
vec3 tmpvar_21;
mediump vec3 tmpvar_21;
tmpvar_21 = clamp (m_18[2], 0.0, 1.0);
mat3 tmpvar_22;
vec3 tmpvar_23;
mediump mat3 tmpvar_22;
mediump vec3 tmpvar_23;
tmpvar_23 = tmpvar_19;
tmpvar_22[0] = tmpvar_23;
vec3 tmpvar_24;
mediump vec3 tmpvar_24;
tmpvar_24 = tmpvar_20;
tmpvar_22[1] = tmpvar_24;
vec3 tmpvar_25;
mediump vec3 tmpvar_25;
tmpvar_25 = tmpvar_21;
tmpvar_22[2] = tmpvar_25;
return tmpvar_22;
}
mat4 xll_saturate (
in mat4 m_26
mediump mat4 xll_saturate (
in mediump mat4 m_26
)
{
vec4 tmpvar_27;
mediump vec4 tmpvar_27;
tmpvar_27 = clamp (m_26[0], 0.0, 1.0);
vec4 tmpvar_28;
mediump vec4 tmpvar_28;
tmpvar_28 = clamp (m_26[1], 0.0, 1.0);
vec4 tmpvar_29;
mediump vec4 tmpvar_29;
tmpvar_29 = clamp (m_26[2], 0.0, 1.0);
vec4 tmpvar_30;
mediump vec4 tmpvar_30;
tmpvar_30 = clamp (m_26[3], 0.0, 1.0);
mat4 tmpvar_31;
vec4 tmpvar_32;
mediump mat4 tmpvar_31;
mediump vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_31[0] = tmpvar_32;
vec4 tmpvar_33;
mediump vec4 tmpvar_33;
tmpvar_33 = tmpvar_28;
tmpvar_31[1] = tmpvar_33;
vec4 tmpvar_34;
mediump vec4 tmpvar_34;
tmpvar_34 = tmpvar_29;
tmpvar_31[2] = tmpvar_34;
vec4 tmpvar_35;
mediump vec4 tmpvar_35;
tmpvar_35 = tmpvar_30;
tmpvar_31[3] = tmpvar_35;
return tmpvar_31;
@ -240,15 +240,15 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_136;
tmpvar_136.zw = vec2(0.0, 0.0);
tmpvar_136.xy = posM_133.xy;
vec4 tmpvar_137;
mediump vec4 tmpvar_137;
tmpvar_137 = xll_tex2Dlod (tex_39, tmpvar_136);
vec4 tmpvar_138;
mediump vec4 tmpvar_138;
tmpvar_138 = tmpvar_137;
rgbyM_132 = tmpvar_138;
highp vec4 tmpvar_139;
tmpvar_139.zw = vec2(0.0, 0.0);
tmpvar_139.xy = (posM_133 + (vec2(0.0, 1.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_140;
mediump vec4 tmpvar_140;
tmpvar_140 = xll_tex2Dlod (tex_39, tmpvar_139);
highp float tmpvar_141;
tmpvar_141 = FxaaLuma (tmpvar_140);
@ -258,7 +258,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_143;
tmpvar_143.zw = vec2(0.0, 0.0);
tmpvar_143.xy = (posM_133 + (vec2(1.0, 0.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_144;
mediump vec4 tmpvar_144;
tmpvar_144 = xll_tex2Dlod (tex_39, tmpvar_143);
highp float tmpvar_145;
tmpvar_145 = FxaaLuma (tmpvar_144);
@ -268,7 +268,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_147;
tmpvar_147.zw = vec2(0.0, 0.0);
tmpvar_147.xy = (posM_133 + (vec2(0.0, -1.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_148;
mediump vec4 tmpvar_148;
tmpvar_148 = xll_tex2Dlod (tex_39, tmpvar_147);
highp float tmpvar_149;
tmpvar_149 = FxaaLuma (tmpvar_148);
@ -278,7 +278,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_151;
tmpvar_151.zw = vec2(0.0, 0.0);
tmpvar_151.xy = (posM_133 + (vec2(-1.0, 0.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_152;
mediump vec4 tmpvar_152;
tmpvar_152 = xll_tex2Dlod (tex_39, tmpvar_151);
highp float tmpvar_153;
tmpvar_153 = FxaaLuma (tmpvar_152);
@ -345,7 +345,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_176;
tmpvar_176.zw = vec2(0.0, 0.0);
tmpvar_176.xy = (posM_133 + (vec2(-1.0, -1.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_177;
mediump vec4 tmpvar_177;
tmpvar_177 = xll_tex2Dlod (tex_39, tmpvar_176);
highp float tmpvar_178;
tmpvar_178 = FxaaLuma (tmpvar_177);
@ -355,7 +355,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_180;
tmpvar_180.zw = vec2(0.0, 0.0);
tmpvar_180.xy = (posM_133 + (vec2(1.0, 1.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_181;
mediump vec4 tmpvar_181;
tmpvar_181 = xll_tex2Dlod (tex_39, tmpvar_180);
highp float tmpvar_182;
tmpvar_182 = FxaaLuma (tmpvar_181);
@ -365,7 +365,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_184;
tmpvar_184.zw = vec2(0.0, 0.0);
tmpvar_184.xy = (posM_133 + (vec2(1.0, -1.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_185;
mediump vec4 tmpvar_185;
tmpvar_185 = xll_tex2Dlod (tex_39, tmpvar_184);
highp float tmpvar_186;
tmpvar_186 = FxaaLuma (tmpvar_185);
@ -375,7 +375,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_188;
tmpvar_188.zw = vec2(0.0, 0.0);
tmpvar_188.xy = (posM_133 + (vec2(-1.0, 1.0) * fxaaQualityRcpFrame_42.xy)).xy;
vec4 tmpvar_189;
mediump vec4 tmpvar_189;
tmpvar_189 = xll_tex2Dlod (tex_39, tmpvar_188);
highp float tmpvar_190;
tmpvar_190 = FxaaLuma (tmpvar_189);
@ -513,9 +513,9 @@ vec4 FxaaPixelShader (
};
highp float tmpvar_236;
tmpvar_236 = abs (subpixB_89);
float tmpvar_237;
mediump float tmpvar_237;
tmpvar_237 = xll_saturate ((tmpvar_236 * subpixRcpRange_109));
float tmpvar_238;
mediump float tmpvar_238;
tmpvar_238 = tmpvar_237;
subpixC_82 = tmpvar_238;
highp float tmpvar_239;
@ -570,7 +570,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_252;
tmpvar_252.zw = vec2(0.0, 0.0);
tmpvar_252.xy = posN_79.xy;
vec4 tmpvar_253;
mediump vec4 tmpvar_253;
tmpvar_253 = xll_tex2Dlod (tex_39, tmpvar_252);
highp float tmpvar_254;
tmpvar_254 = FxaaLuma (tmpvar_253);
@ -583,7 +583,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_257;
tmpvar_257.zw = vec2(0.0, 0.0);
tmpvar_257.xy = posP_78.xy;
vec4 tmpvar_258;
mediump vec4 tmpvar_258;
tmpvar_258 = xll_tex2Dlod (tex_39, tmpvar_257);
highp float tmpvar_259;
tmpvar_259 = FxaaLuma (tmpvar_258);
@ -651,7 +651,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_277;
tmpvar_277.zw = vec2(0.0, 0.0);
tmpvar_277.xy = posN_79.xy.xy;
vec4 tmpvar_278;
mediump vec4 tmpvar_278;
tmpvar_278 = xll_tex2Dlod (tex_39, tmpvar_277);
highp float tmpvar_279;
tmpvar_279 = FxaaLuma (tmpvar_278);
@ -663,7 +663,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_281;
tmpvar_281.zw = vec2(0.0, 0.0);
tmpvar_281.xy = posP_78.xy.xy;
vec4 tmpvar_282;
mediump vec4 tmpvar_282;
tmpvar_282 = xll_tex2Dlod (tex_39, tmpvar_281);
highp float tmpvar_283;
tmpvar_283 = FxaaLuma (tmpvar_282);
@ -719,7 +719,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_296;
tmpvar_296.zw = vec2(0.0, 0.0);
tmpvar_296.xy = posN_79.xy.xy;
vec4 tmpvar_297;
mediump vec4 tmpvar_297;
tmpvar_297 = xll_tex2Dlod (tex_39, tmpvar_296);
highp float tmpvar_298;
tmpvar_298 = FxaaLuma (tmpvar_297);
@ -731,7 +731,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_300;
tmpvar_300.zw = vec2(0.0, 0.0);
tmpvar_300.xy = posP_78.xy.xy;
vec4 tmpvar_301;
mediump vec4 tmpvar_301;
tmpvar_301 = xll_tex2Dlod (tex_39, tmpvar_300);
highp float tmpvar_302;
tmpvar_302 = FxaaLuma (tmpvar_301);
@ -787,7 +787,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_315;
tmpvar_315.zw = vec2(0.0, 0.0);
tmpvar_315.xy = posN_79.xy.xy;
vec4 tmpvar_316;
mediump vec4 tmpvar_316;
tmpvar_316 = xll_tex2Dlod (tex_39, tmpvar_315);
highp float tmpvar_317;
tmpvar_317 = FxaaLuma (tmpvar_316);
@ -799,7 +799,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_319;
tmpvar_319.zw = vec2(0.0, 0.0);
tmpvar_319.xy = posP_78.xy.xy;
vec4 tmpvar_320;
mediump vec4 tmpvar_320;
tmpvar_320 = xll_tex2Dlod (tex_39, tmpvar_319);
highp float tmpvar_321;
tmpvar_321 = FxaaLuma (tmpvar_320);
@ -855,7 +855,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_334;
tmpvar_334.zw = vec2(0.0, 0.0);
tmpvar_334.xy = posN_79.xy.xy;
vec4 tmpvar_335;
mediump vec4 tmpvar_335;
tmpvar_335 = xll_tex2Dlod (tex_39, tmpvar_334);
highp float tmpvar_336;
tmpvar_336 = FxaaLuma (tmpvar_335);
@ -867,7 +867,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_338;
tmpvar_338.zw = vec2(0.0, 0.0);
tmpvar_338.xy = posP_78.xy.xy;
vec4 tmpvar_339;
mediump vec4 tmpvar_339;
tmpvar_339 = xll_tex2Dlod (tex_39, tmpvar_338);
highp float tmpvar_340;
tmpvar_340 = FxaaLuma (tmpvar_339);
@ -923,7 +923,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_353;
tmpvar_353.zw = vec2(0.0, 0.0);
tmpvar_353.xy = posN_79.xy.xy;
vec4 tmpvar_354;
mediump vec4 tmpvar_354;
tmpvar_354 = xll_tex2Dlod (tex_39, tmpvar_353);
highp float tmpvar_355;
tmpvar_355 = FxaaLuma (tmpvar_354);
@ -935,7 +935,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_357;
tmpvar_357.zw = vec2(0.0, 0.0);
tmpvar_357.xy = posP_78.xy.xy;
vec4 tmpvar_358;
mediump vec4 tmpvar_358;
tmpvar_358 = xll_tex2Dlod (tex_39, tmpvar_357);
highp float tmpvar_359;
tmpvar_359 = FxaaLuma (tmpvar_358);
@ -991,7 +991,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_372;
tmpvar_372.zw = vec2(0.0, 0.0);
tmpvar_372.xy = posN_79.xy.xy;
vec4 tmpvar_373;
mediump vec4 tmpvar_373;
tmpvar_373 = xll_tex2Dlod (tex_39, tmpvar_372);
highp float tmpvar_374;
tmpvar_374 = FxaaLuma (tmpvar_373);
@ -1003,7 +1003,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_376;
tmpvar_376.zw = vec2(0.0, 0.0);
tmpvar_376.xy = posP_78.xy.xy;
vec4 tmpvar_377;
mediump vec4 tmpvar_377;
tmpvar_377 = xll_tex2Dlod (tex_39, tmpvar_376);
highp float tmpvar_378;
tmpvar_378 = FxaaLuma (tmpvar_377);
@ -1059,7 +1059,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_391;
tmpvar_391.zw = vec2(0.0, 0.0);
tmpvar_391.xy = posN_79.xy.xy;
vec4 tmpvar_392;
mediump vec4 tmpvar_392;
tmpvar_392 = xll_tex2Dlod (tex_39, tmpvar_391);
highp float tmpvar_393;
tmpvar_393 = FxaaLuma (tmpvar_392);
@ -1071,7 +1071,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_395;
tmpvar_395.zw = vec2(0.0, 0.0);
tmpvar_395.xy = posP_78.xy.xy;
vec4 tmpvar_396;
mediump vec4 tmpvar_396;
tmpvar_396 = xll_tex2Dlod (tex_39, tmpvar_395);
highp float tmpvar_397;
tmpvar_397 = FxaaLuma (tmpvar_396);
@ -1127,7 +1127,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_410;
tmpvar_410.zw = vec2(0.0, 0.0);
tmpvar_410.xy = posN_79.xy.xy;
vec4 tmpvar_411;
mediump vec4 tmpvar_411;
tmpvar_411 = xll_tex2Dlod (tex_39, tmpvar_410);
highp float tmpvar_412;
tmpvar_412 = FxaaLuma (tmpvar_411);
@ -1139,7 +1139,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_414;
tmpvar_414.zw = vec2(0.0, 0.0);
tmpvar_414.xy = posP_78.xy.xy;
vec4 tmpvar_415;
mediump vec4 tmpvar_415;
tmpvar_415 = xll_tex2Dlod (tex_39, tmpvar_414);
highp float tmpvar_416;
tmpvar_416 = FxaaLuma (tmpvar_415);
@ -1195,7 +1195,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_429;
tmpvar_429.zw = vec2(0.0, 0.0);
tmpvar_429.xy = posN_79.xy.xy;
vec4 tmpvar_430;
mediump vec4 tmpvar_430;
tmpvar_430 = xll_tex2Dlod (tex_39, tmpvar_429);
highp float tmpvar_431;
tmpvar_431 = FxaaLuma (tmpvar_430);
@ -1207,7 +1207,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_433;
tmpvar_433.zw = vec2(0.0, 0.0);
tmpvar_433.xy = posP_78.xy.xy;
vec4 tmpvar_434;
mediump vec4 tmpvar_434;
tmpvar_434 = xll_tex2Dlod (tex_39, tmpvar_433);
highp float tmpvar_435;
tmpvar_435 = FxaaLuma (tmpvar_434);
@ -1263,7 +1263,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_448;
tmpvar_448.zw = vec2(0.0, 0.0);
tmpvar_448.xy = posN_79.xy.xy;
vec4 tmpvar_449;
mediump vec4 tmpvar_449;
tmpvar_449 = xll_tex2Dlod (tex_39, tmpvar_448);
highp float tmpvar_450;
tmpvar_450 = FxaaLuma (tmpvar_449);
@ -1275,7 +1275,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_452;
tmpvar_452.zw = vec2(0.0, 0.0);
tmpvar_452.xy = posP_78.xy.xy;
vec4 tmpvar_453;
mediump vec4 tmpvar_453;
tmpvar_453 = xll_tex2Dlod (tex_39, tmpvar_452);
highp float tmpvar_454;
tmpvar_454 = FxaaLuma (tmpvar_453);
@ -1417,7 +1417,7 @@ vec4 FxaaPixelShader (
highp vec4 tmpvar_489;
tmpvar_489.zw = vec2(0.0, 0.0);
tmpvar_489.xy = posM_133.xy;
vec4 tmpvar_490;
mediump vec4 tmpvar_490;
tmpvar_490 = xll_tex2Dlod (tex_39, tmpvar_489);
highp vec4 tmpvar_491;
tmpvar_491.xyz = tmpvar_490.xyz.xyz;
@ -1430,7 +1430,7 @@ vec4 xlat_main (
)
{
highp float fxaaN_493;
float tmpvar_494;
mediump float tmpvar_494;
tmpvar_494 = 0.5;
fxaaN_493 = tmpvar_494;
highp vec4 tmpvar_495;

View file

@ -19,7 +19,7 @@ void main ()
{
v2f xlt_i_3;
lowp vec4 xl_retval_4;
vec4 tmpvar_5;
mediump vec4 tmpvar_5;
tmpvar_5 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_3.vertex = tmpvar_5;
lowp vec4 tmpvar_6;

View file

@ -20,197 +20,197 @@ uniform highp vec4 _ZBufferParams;
uniform highp vec4 unity_LightmapFade;
varying highp vec4 xlv_TEXCOORD0;
varying highp vec3 xlv_TEXCOORD1;
float xll_saturate (
in float x_1
mediump float xll_saturate (
in mediump float x_1
)
{
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = clamp (x_1, 0.0, 1.0);
return tmpvar_2;
}
vec2 xll_saturate (
in vec2 x_3
mediump vec2 xll_saturate (
in mediump vec2 x_3
)
{
vec2 tmpvar_4;
mediump vec2 tmpvar_4;
tmpvar_4 = clamp (x_3, 0.0, 1.0);
return tmpvar_4;
}
vec3 xll_saturate (
in vec3 x_5
mediump vec3 xll_saturate (
in mediump vec3 x_5
)
{
vec3 tmpvar_6;
mediump vec3 tmpvar_6;
tmpvar_6 = clamp (x_5, 0.0, 1.0);
return tmpvar_6;
}
vec4 xll_saturate (
in vec4 x_7
mediump vec4 xll_saturate (
in mediump vec4 x_7
)
{
vec4 tmpvar_8;
mediump vec4 tmpvar_8;
tmpvar_8 = clamp (x_7, 0.0, 1.0);
return tmpvar_8;
}
mat2 xll_saturate (
in mat2 m_9
mediump mat2 xll_saturate (
in mediump mat2 m_9
)
{
vec2 tmpvar_10;
mediump vec2 tmpvar_10;
tmpvar_10 = clamp (m_9[0], 0.0, 1.0);
vec2 tmpvar_11;
mediump vec2 tmpvar_11;
tmpvar_11 = clamp (m_9[1], 0.0, 1.0);
mat2 tmpvar_12;
vec2 tmpvar_13;
mediump mat2 tmpvar_12;
mediump vec2 tmpvar_13;
tmpvar_13 = tmpvar_10;
tmpvar_12[0] = tmpvar_13;
vec2 tmpvar_14;
mediump vec2 tmpvar_14;
tmpvar_14 = tmpvar_11;
tmpvar_12[1] = tmpvar_14;
return tmpvar_12;
}
mat3 xll_saturate (
in mat3 m_15
mediump mat3 xll_saturate (
in mediump mat3 m_15
)
{
vec3 tmpvar_16;
mediump vec3 tmpvar_16;
tmpvar_16 = clamp (m_15[0], 0.0, 1.0);
vec3 tmpvar_17;
mediump vec3 tmpvar_17;
tmpvar_17 = clamp (m_15[1], 0.0, 1.0);
vec3 tmpvar_18;
mediump vec3 tmpvar_18;
tmpvar_18 = clamp (m_15[2], 0.0, 1.0);
mat3 tmpvar_19;
vec3 tmpvar_20;
mediump mat3 tmpvar_19;
mediump vec3 tmpvar_20;
tmpvar_20 = tmpvar_16;
tmpvar_19[0] = tmpvar_20;
vec3 tmpvar_21;
mediump vec3 tmpvar_21;
tmpvar_21 = tmpvar_17;
tmpvar_19[1] = tmpvar_21;
vec3 tmpvar_22;
mediump vec3 tmpvar_22;
tmpvar_22 = tmpvar_18;
tmpvar_19[2] = tmpvar_22;
return tmpvar_19;
}
mat4 xll_saturate (
in mat4 m_23
mediump mat4 xll_saturate (
in mediump mat4 m_23
)
{
vec4 tmpvar_24;
mediump vec4 tmpvar_24;
tmpvar_24 = clamp (m_23[0], 0.0, 1.0);
vec4 tmpvar_25;
mediump vec4 tmpvar_25;
tmpvar_25 = clamp (m_23[1], 0.0, 1.0);
vec4 tmpvar_26;
mediump vec4 tmpvar_26;
tmpvar_26 = clamp (m_23[2], 0.0, 1.0);
vec4 tmpvar_27;
mediump vec4 tmpvar_27;
tmpvar_27 = clamp (m_23[3], 0.0, 1.0);
mat4 tmpvar_28;
vec4 tmpvar_29;
mediump mat4 tmpvar_28;
mediump vec4 tmpvar_29;
tmpvar_29 = tmpvar_24;
tmpvar_28[0] = tmpvar_29;
vec4 tmpvar_30;
mediump vec4 tmpvar_30;
tmpvar_30 = tmpvar_25;
tmpvar_28[1] = tmpvar_30;
vec4 tmpvar_31;
mediump vec4 tmpvar_31;
tmpvar_31 = tmpvar_26;
tmpvar_28[2] = tmpvar_31;
vec4 tmpvar_32;
mediump vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_28[3] = tmpvar_32;
return tmpvar_28;
}
vec2 xll_vecTSel (
mediump vec2 xll_vecTSel (
in bvec2 a_33,
in vec2 b_34,
in vec2 c_35
in mediump vec2 b_34,
in mediump vec2 c_35
)
{
float tmpvar_36;
mediump float tmpvar_36;
if (a_33.x) {
tmpvar_36 = b_34.x;
} else {
tmpvar_36 = c_35.x;
};
float tmpvar_37;
mediump float tmpvar_37;
if (a_33.y) {
tmpvar_37 = b_34.y;
} else {
tmpvar_37 = c_35.y;
};
vec2 tmpvar_38;
mediump vec2 tmpvar_38;
tmpvar_38.x = tmpvar_36;
tmpvar_38.y = tmpvar_37;
return tmpvar_38;
}
vec3 xll_vecTSel (
mediump vec3 xll_vecTSel (
in bvec3 a_39,
in vec3 b_40,
in vec3 c_41
in mediump vec3 b_40,
in mediump vec3 c_41
)
{
float tmpvar_42;
mediump float tmpvar_42;
if (a_39.x) {
tmpvar_42 = b_40.x;
} else {
tmpvar_42 = c_41.x;
};
float tmpvar_43;
mediump float tmpvar_43;
if (a_39.y) {
tmpvar_43 = b_40.y;
} else {
tmpvar_43 = c_41.y;
};
float tmpvar_44;
mediump float tmpvar_44;
if (a_39.z) {
tmpvar_44 = b_40.z;
} else {
tmpvar_44 = c_41.z;
};
vec3 tmpvar_45;
mediump vec3 tmpvar_45;
tmpvar_45.x = tmpvar_42;
tmpvar_45.y = tmpvar_43;
tmpvar_45.z = tmpvar_44;
return tmpvar_45;
}
vec4 xll_vecTSel (
mediump vec4 xll_vecTSel (
in bvec4 a_46,
in vec4 b_47,
in vec4 c_48
in mediump vec4 b_47,
in mediump vec4 c_48
)
{
float tmpvar_49;
mediump float tmpvar_49;
if (a_46.x) {
tmpvar_49 = b_47.x;
} else {
tmpvar_49 = c_48.x;
};
float tmpvar_50;
mediump float tmpvar_50;
if (a_46.y) {
tmpvar_50 = b_47.y;
} else {
tmpvar_50 = c_48.y;
};
float tmpvar_51;
mediump float tmpvar_51;
if (a_46.z) {
tmpvar_51 = b_47.z;
} else {
tmpvar_51 = c_48.z;
};
float tmpvar_52;
mediump float tmpvar_52;
if (a_46.w) {
tmpvar_52 = b_47.w;
} else {
tmpvar_52 = c_48.w;
};
vec4 tmpvar_53;
mediump vec4 tmpvar_53;
tmpvar_53.x = tmpvar_49;
tmpvar_53.y = tmpvar_50;
tmpvar_53.z = tmpvar_51;
@ -239,7 +239,7 @@ float DecodeFloatRGBA (
)
{
highp vec4 kDecodeDot_58;
vec4 tmpvar_59;
mediump vec4 tmpvar_59;
tmpvar_59 = vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09);
kDecodeDot_58 = tmpvar_59;
highp float tmpvar_60;
@ -270,7 +270,7 @@ mediump float unitySampleShadow (
mediump vec4 shadows_68;
highp vec4 shadowVals_69;
highp float z_70;
float tmpvar_71;
mediump float tmpvar_71;
tmpvar_71 = 0.0078125;
z_70 = tmpvar_71;
highp vec3 tmpvar_72;
@ -317,9 +317,9 @@ mediump float unitySampleShadow (
tmpvar_86 = lessThan (shadowVals_69, tmpvar_85);
highp vec4 tmpvar_87;
tmpvar_87 = _LightShadowData.xxxx.xyzw;
vec4 tmpvar_88;
mediump vec4 tmpvar_88;
tmpvar_88 = xll_vecTSel (tmpvar_86, tmpvar_87, vec4(1.0, 1.0, 1.0, 1.0));
vec4 tmpvar_89;
mediump vec4 tmpvar_89;
tmpvar_89 = tmpvar_88;
shadows_68 = tmpvar_89;
mediump float tmpvar_90;
@ -338,9 +338,9 @@ mediump float ComputeShadow (
highp float tmpvar_96;
tmpvar_96 = ((z_92 * _LightShadowData.z) + _LightShadowData.w);
fade_95 = tmpvar_96;
float tmpvar_97;
mediump float tmpvar_97;
tmpvar_97 = xll_saturate (fade_95);
float tmpvar_98;
mediump float tmpvar_98;
tmpvar_98 = tmpvar_97;
fade_95 = tmpvar_98;
highp float tmpvar_99;
@ -472,7 +472,7 @@ mediump vec4 xlat_main (
mediump float tmpvar_156;
tmpvar_156 = tmpvar_155;
spec_106 = tmpvar_156;
float tmpvar_157;
mediump float tmpvar_157;
tmpvar_157 = xll_saturate (atten_109);
highp float tmpvar_158;
tmpvar_158 = (spec_106 * tmpvar_157);
@ -488,7 +488,7 @@ mediump vec4 xlat_main (
highp float tmpvar_162;
tmpvar_162 = ((vpos_114.z * unity_LightmapFade.z) + unity_LightmapFade.w);
fade_104 = tmpvar_162;
float tmpvar_163;
mediump float tmpvar_163;
tmpvar_163 = xll_saturate ((1.0 - fade_104));
mediump vec4 tmpvar_164;
tmpvar_164 = (res_105 * tmpvar_163);
@ -502,7 +502,7 @@ void main ()
{
v2f xlt_i_166;
mediump vec4 xl_retval_167;
vec4 tmpvar_168;
mediump vec4 tmpvar_168;
tmpvar_168 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_166.pos = tmpvar_168;
highp vec4 tmpvar_169;

View file

@ -36,7 +36,7 @@ varying highp vec3 xlv_TEXCOORD1;
varying highp vec3 xlv_TEXCOORD2;
varying highp vec2 xlv_TEXCOORD3;
void xll_clip (
in float x_1
in mediump float x_1
)
{
if ((x_1 < 0.0)) {
@ -44,106 +44,106 @@ void xll_clip (
};
}
float xll_saturate (
in float x_2
mediump float xll_saturate (
in mediump float x_2
)
{
float tmpvar_3;
mediump float tmpvar_3;
tmpvar_3 = clamp (x_2, 0.0, 1.0);
return tmpvar_3;
}
vec2 xll_saturate (
in vec2 x_4
mediump vec2 xll_saturate (
in mediump vec2 x_4
)
{
vec2 tmpvar_5;
mediump vec2 tmpvar_5;
tmpvar_5 = clamp (x_4, 0.0, 1.0);
return tmpvar_5;
}
vec3 xll_saturate (
in vec3 x_6
mediump vec3 xll_saturate (
in mediump vec3 x_6
)
{
vec3 tmpvar_7;
mediump vec3 tmpvar_7;
tmpvar_7 = clamp (x_6, 0.0, 1.0);
return tmpvar_7;
}
vec4 xll_saturate (
in vec4 x_8
mediump vec4 xll_saturate (
in mediump vec4 x_8
)
{
vec4 tmpvar_9;
mediump vec4 tmpvar_9;
tmpvar_9 = clamp (x_8, 0.0, 1.0);
return tmpvar_9;
}
mat2 xll_saturate (
in mat2 m_10
mediump mat2 xll_saturate (
in mediump mat2 m_10
)
{
vec2 tmpvar_11;
mediump vec2 tmpvar_11;
tmpvar_11 = clamp (m_10[0], 0.0, 1.0);
vec2 tmpvar_12;
mediump vec2 tmpvar_12;
tmpvar_12 = clamp (m_10[1], 0.0, 1.0);
mat2 tmpvar_13;
vec2 tmpvar_14;
mediump mat2 tmpvar_13;
mediump vec2 tmpvar_14;
tmpvar_14 = tmpvar_11;
tmpvar_13[0] = tmpvar_14;
vec2 tmpvar_15;
mediump vec2 tmpvar_15;
tmpvar_15 = tmpvar_12;
tmpvar_13[1] = tmpvar_15;
return tmpvar_13;
}
mat3 xll_saturate (
in mat3 m_16
mediump mat3 xll_saturate (
in mediump mat3 m_16
)
{
vec3 tmpvar_17;
mediump vec3 tmpvar_17;
tmpvar_17 = clamp (m_16[0], 0.0, 1.0);
vec3 tmpvar_18;
mediump vec3 tmpvar_18;
tmpvar_18 = clamp (m_16[1], 0.0, 1.0);
vec3 tmpvar_19;
mediump vec3 tmpvar_19;
tmpvar_19 = clamp (m_16[2], 0.0, 1.0);
mat3 tmpvar_20;
vec3 tmpvar_21;
mediump mat3 tmpvar_20;
mediump vec3 tmpvar_21;
tmpvar_21 = tmpvar_17;
tmpvar_20[0] = tmpvar_21;
vec3 tmpvar_22;
mediump vec3 tmpvar_22;
tmpvar_22 = tmpvar_18;
tmpvar_20[1] = tmpvar_22;
vec3 tmpvar_23;
mediump vec3 tmpvar_23;
tmpvar_23 = tmpvar_19;
tmpvar_20[2] = tmpvar_23;
return tmpvar_20;
}
mat4 xll_saturate (
in mat4 m_24
mediump mat4 xll_saturate (
in mediump mat4 m_24
)
{
vec4 tmpvar_25;
mediump vec4 tmpvar_25;
tmpvar_25 = clamp (m_24[0], 0.0, 1.0);
vec4 tmpvar_26;
mediump vec4 tmpvar_26;
tmpvar_26 = clamp (m_24[1], 0.0, 1.0);
vec4 tmpvar_27;
mediump vec4 tmpvar_27;
tmpvar_27 = clamp (m_24[2], 0.0, 1.0);
vec4 tmpvar_28;
mediump vec4 tmpvar_28;
tmpvar_28 = clamp (m_24[3], 0.0, 1.0);
mat4 tmpvar_29;
vec4 tmpvar_30;
mediump mat4 tmpvar_29;
mediump vec4 tmpvar_30;
tmpvar_30 = tmpvar_25;
tmpvar_29[0] = tmpvar_30;
vec4 tmpvar_31;
mediump vec4 tmpvar_31;
tmpvar_31 = tmpvar_26;
tmpvar_29[1] = tmpvar_31;
vec4 tmpvar_32;
mediump vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_29[2] = tmpvar_32;
vec4 tmpvar_33;
mediump vec4 tmpvar_33;
tmpvar_33 = tmpvar_28;
tmpvar_29[3] = tmpvar_33;
return tmpvar_29;
@ -253,12 +253,12 @@ mediump vec4 LightingTreeLeaf (
spec_66 = tmpvar_78;
mediump float tmpvar_79;
tmpvar_79 = dot (viewDir_61, -(lightDir_60));
float tmpvar_80;
mediump float tmpvar_80;
tmpvar_80 = xll_saturate (tmpvar_79);
float tmpvar_81;
mediump float tmpvar_81;
tmpvar_81 = tmpvar_80;
backContrib_65 = tmpvar_81;
float tmpvar_82;
mediump float tmpvar_82;
tmpvar_82 = xll_saturate (-(nl_68));
mediump float tmpvar_83;
tmpvar_83 = mix (tmpvar_82, backContrib_65, _TranslucencyViewDependency);
@ -301,16 +301,16 @@ mediump vec4 xlat_main (
highp vec4 tmpvar_98;
tmpvar_98 = IN_92.lop_color;
surfIN_96.color = tmpvar_98;
vec3 tmpvar_99;
mediump vec3 tmpvar_99;
tmpvar_99 = vec3(0.0, 0.0, 0.0);
o_95.Albedo = tmpvar_99;
vec3 tmpvar_100;
mediump vec3 tmpvar_100;
tmpvar_100 = vec3(0.0, 0.0, 0.0);
o_95.Emission = tmpvar_100;
float tmpvar_101;
mediump float tmpvar_101;
tmpvar_101 = 0.0;
o_95.Specular = tmpvar_101;
float tmpvar_102;
mediump float tmpvar_102;
tmpvar_102 = 0.0;
o_95.Alpha = tmpvar_102;
surf (surfIN_96, o_95);
@ -339,7 +339,7 @@ void main ()
{
v2f_surf xlt_IN_110;
mediump vec4 xl_retval_111;
vec4 tmpvar_112;
mediump vec4 tmpvar_112;
tmpvar_112 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_110.pos = tmpvar_112;
highp vec2 tmpvar_113;

View file

@ -21,7 +21,7 @@ varying highp vec3 xlv_TEXCOORD2;
varying highp vec3 xlv_TEXCOORD3;
varying highp vec3 xlv_TEXCOORD4;
void xll_clip (
in float x_1
in mediump float x_1
)
{
if ((x_1 < 0.0)) {
@ -117,7 +117,7 @@ lowp vec4 xlat_main (
mediump vec3 tmpvar_38;
tmpvar_38 = (light_11 * 2.0);
c_3.xyz = tmpvar_38.xyz.xyz;
float tmpvar_39;
mediump float tmpvar_39;
tmpvar_39 = 1.0;
c_3.w = vec4(tmpvar_39).w;
return c_3;

View file

@ -98,7 +98,7 @@ lowp vec4 LightingMobileBlinnPhong (
(s_14.Albedo * diff_21)
+ spec_19) * _LightColor0.xyz) * (atten_17 * 2.0));
c_18.xyz = tmpvar_30.xyz.xyz;
float tmpvar_31;
mediump float tmpvar_31;
tmpvar_31 = 0.0;
c_18.w = vec4(tmpvar_31).w;
return c_18;
@ -115,26 +115,26 @@ lowp vec4 frag_surf (
mediump vec2 tmpvar_37;
tmpvar_37 = IN_32.pack0.xy;
surfIN_36.uv_MainTex = tmpvar_37;
vec3 tmpvar_38;
mediump vec3 tmpvar_38;
tmpvar_38 = vec3(0.0, 0.0, 0.0);
o_35.Albedo = tmpvar_38;
vec3 tmpvar_39;
mediump vec3 tmpvar_39;
tmpvar_39 = vec3(0.0, 0.0, 0.0);
o_35.Emission = tmpvar_39;
float tmpvar_40;
mediump float tmpvar_40;
tmpvar_40 = 0.0;
o_35.Specular = tmpvar_40;
float tmpvar_41;
mediump float tmpvar_41;
tmpvar_41 = 0.0;
o_35.Alpha = tmpvar_41;
float tmpvar_42;
mediump float tmpvar_42;
tmpvar_42 = 0.0;
o_35.Gloss = tmpvar_42;
surf (surfIN_36, o_35);
float tmpvar_43;
mediump float tmpvar_43;
tmpvar_43 = 1.0;
atten_34 = tmpvar_43;
vec4 tmpvar_44;
mediump vec4 tmpvar_44;
tmpvar_44 = vec4(0.0, 0.0, 0.0, 0.0);
c_33 = tmpvar_44;
lowp vec4 tmpvar_45;
@ -152,7 +152,7 @@ void main ()
{
v2f_surf xlt_IN_48;
lowp vec4 xl_retval_49;
vec4 tmpvar_50;
mediump vec4 tmpvar_50;
tmpvar_50 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_48.pos = tmpvar_50;
mediump vec2 tmpvar_51;

View file

@ -13,11 +13,11 @@ uniform sampler2D _RandomTexture;
uniform highp vec4 _Params;
in highp vec2 xlv_TEXCOORD0;
in highp vec2 xlv_TEXCOORD1;
float xll_saturate_f (
in float x_1
mediump float xll_saturate_f (
in mediump float x_1
)
{
float tmpvar_2;
mediump float tmpvar_2;
tmpvar_2 = clamp (x_1, 0.0, 1.0);
return tmpvar_2;
}
@ -27,7 +27,7 @@ float DecodeFloatRG (
)
{
highp vec2 kDecodeDot_4;
vec2 tmpvar_5;
mediump vec2 tmpvar_5;
tmpvar_5 = vec2(1.0, 0.00392157);
kDecodeDot_4 = tmpvar_5;
highp float tmpvar_6;
@ -43,7 +43,7 @@ vec3 DecodeViewNormalStereo (
highp float g_9;
highp vec3 nn_10;
highp float kScale_11;
float tmpvar_12;
mediump float tmpvar_12;
tmpvar_12 = 1.7777;
kScale_11 = tmpvar_12;
highp vec3 tmpvar_13;
@ -119,7 +119,7 @@ mediump float frag_ao (
highp float tmpvar_42;
tmpvar_42 = (_Params.x / depth_33);
scale_32 = tmpvar_42;
float tmpvar_43;
mediump float tmpvar_43;
tmpvar_43 = 0.0;
occ_31 = tmpvar_43;
int tmpvar_44;
@ -144,13 +144,13 @@ mediump float frag_ao (
randomDir_52 = tmpvar_54;
highp float tmpvar_55;
tmpvar_55 = dot (viewNorm_34, randomDir_52);
float tmpvar_56;
mediump float tmpvar_56;
if ((tmpvar_55 < 0.0)) {
tmpvar_56 = 1.0;
} else {
tmpvar_56 = -(1.0);
};
float tmpvar_57;
mediump float tmpvar_57;
tmpvar_57 = tmpvar_56;
flip_51 = tmpvar_57;
mediump vec3 tmpvar_58;
@ -174,9 +174,9 @@ mediump float frag_ao (
highp float tmpvar_64;
tmpvar_64 = (sampleD_47 * _ProjectionParams.z);
sampleD_47 = tmpvar_64;
float tmpvar_65;
mediump float tmpvar_65;
tmpvar_65 = xll_saturate_f ((sD_49 - sampleD_47));
float tmpvar_66;
mediump float tmpvar_66;
tmpvar_66 = tmpvar_65;
zd_45 = tmpvar_66;
if ((zd_45 > _Params.y)) {
@ -215,7 +215,7 @@ void main ()
{
v2f_ao xlt_i_76;
mediump vec4 xl_retval_77;
vec4 tmpvar_78;
mediump vec4 tmpvar_78;
tmpvar_78 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_76.pos = tmpvar_78;
highp vec2 tmpvar_79;

View file

@ -48,7 +48,7 @@ void main ()
randomDir_17 = tmpvar_18;
highp float tmpvar_20;
tmpvar_20 = dot (viewNorm_7, randomDir_17);
float tmpvar_21;
mediump float tmpvar_21;
if ((tmpvar_20 < 0.0)) {
tmpvar_21 = 1.0;
} else {

View file

@ -0,0 +1,131 @@
float xll_saturate_f( float x) {
return clamp( x, 0.0, 1.0);
}
vec2 xll_saturate_vf2( vec2 x) {
return clamp( x, 0.0, 1.0);
}
vec3 xll_saturate_vf3( vec3 x) {
return clamp( x, 0.0, 1.0);
}
vec4 xll_saturate_vf4( vec4 x) {
return clamp( x, 0.0, 1.0);
}
mat2 xll_saturate_mf2x2(mat2 m) {
return mat2( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0));
}
mat3 xll_saturate_mf3x3(mat3 m) {
return mat3( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0), clamp(m[2], 0.0, 1.0));
}
mat4 xll_saturate_mf4x4(mat4 m) {
return mat4( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0), clamp(m[2], 0.0, 1.0), clamp(m[3], 0.0, 1.0));
}
#line 4
struct v2f_ao {
highp vec4 pos;
highp vec2 uv;
highp vec2 uvr;
};
#line 10
uniform sampler2D _CameraDepthNormalsTexture;
uniform sampler2D _RandomTexture;
uniform highp vec4 _Params;
uniform highp vec4 _ProjectionParams;
#line 15
#line 36
#line 83
#line 25
highp float DecodeFloatRG( in highp vec2 enc ) {
#line 27
highp vec2 kDecodeDot = vec2( 1.0, 0.00392157);
return dot( enc, kDecodeDot);
}
#line 15
highp vec3 DecodeViewNormalStereo( in highp vec4 enc4 ) {
highp float kScale = 1.7777;
highp vec3 nn = ((enc4.xyz * vec3( (2.0 * kScale), (2.0 * kScale), 0.0)) + vec3( (-kScale), (-kScale), 1.0));
#line 19
highp float g = (2.0 / dot( nn.xyz, nn.xyz));
highp vec3 n;
n.xy = (g * nn.xy);
n.z = (g - 1.0);
#line 23
return n;
}
#line 30
void DecodeDepthNormal( in highp vec4 enc, out highp float depth, out highp vec3 normal ) {
#line 32
depth = DecodeFloatRG( enc.zw);
normal = DecodeViewNormalStereo( enc);
}
#line 36
mediump float frag_ao( in v2f_ao i, in highp int sampleCount, in highp vec3 samples[8] ) {
mediump vec3 randN = ((texture2D( _RandomTexture, i.uvr).xyz * 2.0) - 1.0);
#line 42
highp vec4 depthnormal = texture2D( _CameraDepthNormalsTexture, i.uv);
highp vec3 viewNorm;
highp float depth;
DecodeDepthNormal( depthnormal, depth, viewNorm);
#line 46
depth *= _ProjectionParams.z;
highp float scale = (_Params.x / depth);
#line 50
highp float occ = 0.0;
highp int s = 0;
for ( ; (s < sampleCount); (++s)) {
#line 54
mediump vec3 randomDir = reflect( samples[s], randN);
mediump float flip = (( (dot( viewNorm, randomDir) < 0.0) ) ? ( 1.0 ) : ( -1.0 ));
#line 58
randomDir *= (-flip);
randomDir += (viewNorm * 0.3);
#line 62
highp vec2 offset = (randomDir.xy * scale);
highp float sD = (depth - (randomDir.z * _Params.x));
#line 66
highp vec4 sampleND = texture2D( _CameraDepthNormalsTexture, (i.uv + offset));
highp float sampleD;
highp vec3 sampleN;
DecodeDepthNormal( sampleND, sampleD, sampleN);
#line 70
sampleD *= _ProjectionParams.z;
highp float zd = xll_saturate_f((sD - sampleD));
if ((zd > _Params.y)){
#line 74
occ += pow( (1.0 - zd), _Params.z);
}
}
#line 79
occ /= float(sampleCount);
return (1.0 - occ);
}
#line 83
mediump vec4 xlat_main( in v2f_ao i ) {
highp vec3 RAND_SAMPLES[8];
RAND_SAMPLES[0] = vec3( 0.0130572, 0.587232, -0.119337);
RAND_SAMPLES[1] = vec3( 0.323078, 0.0220727, -0.418873);
RAND_SAMPLES[2] = vec3( -0.310725, -0.191367, 0.0561369);
RAND_SAMPLES[3] = vec3( -0.479646, 0.0939877, -0.580265);
RAND_SAMPLES[4] = vec3( 0.139999, -0.33577, 0.559679);
RAND_SAMPLES[5] = vec3( -0.248458, 0.255532, 0.348944);
RAND_SAMPLES[6] = vec3( 0.18719, -0.702764, -0.231748);
RAND_SAMPLES[7] = vec3( 0.884915, 0.284208, 0.368524);
#line 95
return vec4( frag_ao( i, 8, RAND_SAMPLES));
}
varying highp vec2 xlv_TEXCOORD0;
varying highp vec2 xlv_TEXCOORD1;
void main() {
mediump vec4 xl_retval;
v2f_ao xlt_i;
xlt_i.pos = vec4(0.0);
xlt_i.uv = vec2(xlv_TEXCOORD0);
xlt_i.uvr = vec2(xlv_TEXCOORD1);
xl_retval = xlat_main( xlt_i);
gl_FragData[0] = vec4(xl_retval);
}
// uniforms:
// _CameraDepthNormalsTexture:<none> type 25 arrsize 0
// _Params:<none> type 12 arrsize 0
// _ProjectionParams:<none> type 12 arrsize 0
// _RandomTexture:<none> type 25 arrsize 0

View file

@ -0,0 +1,355 @@
struct v2f_ao {
highp vec4 pos;
highp vec2 uv;
highp vec2 uvr;
};
uniform sampler2D _CameraDepthNormalsTexture;
uniform sampler2D _RandomTexture;
uniform highp vec4 _Params;
uniform highp vec4 _ProjectionParams;
varying highp vec2 xlv_TEXCOORD0;
varying highp vec2 xlv_TEXCOORD1;
mediump float xll_saturate_f (
in mediump float x_1
)
{
mediump float tmpvar_2;
tmpvar_2 = clamp (x_1, 0.0, 1.0);
return tmpvar_2;
}
mediump vec2 xll_saturate_vf2 (
in mediump vec2 x_3
)
{
mediump vec2 tmpvar_4;
tmpvar_4 = clamp (x_3, 0.0, 1.0);
return tmpvar_4;
}
mediump vec3 xll_saturate_vf3 (
in mediump vec3 x_5
)
{
mediump vec3 tmpvar_6;
tmpvar_6 = clamp (x_5, 0.0, 1.0);
return tmpvar_6;
}
mediump vec4 xll_saturate_vf4 (
in mediump vec4 x_7
)
{
mediump vec4 tmpvar_8;
tmpvar_8 = clamp (x_7, 0.0, 1.0);
return tmpvar_8;
}
mediump mat2 xll_saturate_mf2x2 (
in mediump mat2 m_9
)
{
mediump vec2 tmpvar_10;
tmpvar_10 = clamp (m_9[0], 0.0, 1.0);
mediump vec2 tmpvar_11;
tmpvar_11 = clamp (m_9[1], 0.0, 1.0);
mediump mat2 tmpvar_12;
mediump vec2 tmpvar_13;
tmpvar_13 = tmpvar_10;
tmpvar_12[0] = tmpvar_13;
mediump vec2 tmpvar_14;
tmpvar_14 = tmpvar_11;
tmpvar_12[1] = tmpvar_14;
return tmpvar_12;
}
mediump mat3 xll_saturate_mf3x3 (
in mediump mat3 m_15
)
{
mediump vec3 tmpvar_16;
tmpvar_16 = clamp (m_15[0], 0.0, 1.0);
mediump vec3 tmpvar_17;
tmpvar_17 = clamp (m_15[1], 0.0, 1.0);
mediump vec3 tmpvar_18;
tmpvar_18 = clamp (m_15[2], 0.0, 1.0);
mediump mat3 tmpvar_19;
mediump vec3 tmpvar_20;
tmpvar_20 = tmpvar_16;
tmpvar_19[0] = tmpvar_20;
mediump vec3 tmpvar_21;
tmpvar_21 = tmpvar_17;
tmpvar_19[1] = tmpvar_21;
mediump vec3 tmpvar_22;
tmpvar_22 = tmpvar_18;
tmpvar_19[2] = tmpvar_22;
return tmpvar_19;
}
mediump mat4 xll_saturate_mf4x4 (
in mediump mat4 m_23
)
{
mediump vec4 tmpvar_24;
tmpvar_24 = clamp (m_23[0], 0.0, 1.0);
mediump vec4 tmpvar_25;
tmpvar_25 = clamp (m_23[1], 0.0, 1.0);
mediump vec4 tmpvar_26;
tmpvar_26 = clamp (m_23[2], 0.0, 1.0);
mediump vec4 tmpvar_27;
tmpvar_27 = clamp (m_23[3], 0.0, 1.0);
mediump mat4 tmpvar_28;
mediump vec4 tmpvar_29;
tmpvar_29 = tmpvar_24;
tmpvar_28[0] = tmpvar_29;
mediump vec4 tmpvar_30;
tmpvar_30 = tmpvar_25;
tmpvar_28[1] = tmpvar_30;
mediump vec4 tmpvar_31;
tmpvar_31 = tmpvar_26;
tmpvar_28[2] = tmpvar_31;
mediump vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_28[3] = tmpvar_32;
return tmpvar_28;
}
float DecodeFloatRG (
in highp vec2 enc_33
)
{
highp vec2 kDecodeDot_34;
mediump vec2 tmpvar_35;
tmpvar_35 = vec2(1.0, 0.00392157);
kDecodeDot_34 = tmpvar_35;
highp float tmpvar_36;
tmpvar_36 = dot (enc_33, kDecodeDot_34);
return tmpvar_36;
}
vec3 DecodeViewNormalStereo (
in highp vec4 enc4_37
)
{
highp vec3 n_38;
highp float g_39;
highp vec3 nn_40;
highp float kScale_41;
mediump float tmpvar_42;
tmpvar_42 = 1.7777;
kScale_41 = tmpvar_42;
highp vec3 tmpvar_43;
tmpvar_43.z = 0.0;
tmpvar_43.x = (2.0 * kScale_41);
tmpvar_43.y = (2.0 * kScale_41);
highp vec3 tmpvar_44;
tmpvar_44.z = 1.0;
tmpvar_44.x = -(kScale_41);
tmpvar_44.y = -(kScale_41);
highp vec3 tmpvar_45;
tmpvar_45 = ((enc4_37.xyz * tmpvar_43) + tmpvar_44);
nn_40 = tmpvar_45;
highp float tmpvar_46;
tmpvar_46 = dot (nn_40.xyz, nn_40.xyz);
highp float tmpvar_47;
tmpvar_47 = (2.0 / tmpvar_46);
g_39 = tmpvar_47;
highp vec2 tmpvar_48;
tmpvar_48 = (g_39 * nn_40.xy);
n_38.xy = tmpvar_48.xy.xy;
highp float tmpvar_49;
tmpvar_49 = (g_39 - 1.0);
n_38.z = vec3(tmpvar_49).z;
return n_38;
}
void DecodeDepthNormal (
in highp vec4 enc_50,
out highp float depth_51,
out highp vec3 normal_52
)
{
highp float tmpvar_53;
tmpvar_53 = DecodeFloatRG (enc_50.zw);
highp float tmpvar_54;
tmpvar_54 = tmpvar_53;
depth_51 = tmpvar_54;
highp vec3 tmpvar_55;
tmpvar_55 = DecodeViewNormalStereo (enc_50);
highp vec3 tmpvar_56;
tmpvar_56 = tmpvar_55;
normal_52 = tmpvar_56;
}
mediump float frag_ao (
in v2f_ao i_57,
in int sampleCount_58,
in highp vec3 samples_59[8]
)
{
int s_60;
highp float occ_61;
highp float scale_62;
highp float depth_63;
highp vec3 viewNorm_64;
highp vec4 depthnormal_65;
mediump vec3 randN_66;
lowp vec4 tmpvar_67;
tmpvar_67 = texture2D (_RandomTexture, i_57.uvr);
lowp vec3 tmpvar_68;
tmpvar_68 = ((tmpvar_67.xyz * 2.0) - 1.0);
randN_66 = tmpvar_68;
lowp vec4 tmpvar_69;
tmpvar_69 = texture2D (_CameraDepthNormalsTexture, i_57.uv);
lowp vec4 tmpvar_70;
tmpvar_70 = tmpvar_69;
depthnormal_65 = tmpvar_70;
DecodeDepthNormal (depthnormal_65, depth_63, viewNorm_64);
highp float tmpvar_71;
tmpvar_71 = (depth_63 * _ProjectionParams.z);
depth_63 = tmpvar_71;
highp float tmpvar_72;
tmpvar_72 = (_Params.x / depth_63);
scale_62 = tmpvar_72;
mediump float tmpvar_73;
tmpvar_73 = 0.0;
occ_61 = tmpvar_73;
int tmpvar_74;
tmpvar_74 = 0;
s_60 = tmpvar_74;
while (true) {
highp float zd_75;
highp vec3 sampleN_76;
highp float sampleD_77;
highp vec4 sampleND_78;
highp float sD_79;
highp vec2 offset_80;
mediump float flip_81;
mediump vec3 randomDir_82;
if (!((s_60 < sampleCount_58))) {
break;
};
highp vec3 tmpvar_83;
tmpvar_83 = reflect (samples_59[s_60], randN_66);
highp vec3 tmpvar_84;
tmpvar_84 = tmpvar_83;
randomDir_82 = tmpvar_84;
highp float tmpvar_85;
tmpvar_85 = dot (viewNorm_64, randomDir_82);
mediump float tmpvar_86;
if ((tmpvar_85 < 0.0)) {
tmpvar_86 = 1.0;
} else {
tmpvar_86 = -(1.0);
};
mediump float tmpvar_87;
tmpvar_87 = tmpvar_86;
flip_81 = tmpvar_87;
mediump vec3 tmpvar_88;
tmpvar_88 = (randomDir_82 * -(flip_81));
randomDir_82 = tmpvar_88;
highp vec3 tmpvar_89;
tmpvar_89 = (randomDir_82 + (viewNorm_64 * 0.3));
randomDir_82 = tmpvar_89;
highp vec2 tmpvar_90;
tmpvar_90 = (randomDir_82.xy * scale_62);
offset_80 = tmpvar_90;
highp float tmpvar_91;
tmpvar_91 = (depth_63 - (randomDir_82.z * _Params.x));
sD_79 = tmpvar_91;
lowp vec4 tmpvar_92;
tmpvar_92 = texture2D (_CameraDepthNormalsTexture, (i_57.uv + offset_80));
lowp vec4 tmpvar_93;
tmpvar_93 = tmpvar_92;
sampleND_78 = tmpvar_93;
DecodeDepthNormal (sampleND_78, sampleD_77, sampleN_76);
highp float tmpvar_94;
tmpvar_94 = (sampleD_77 * _ProjectionParams.z);
sampleD_77 = tmpvar_94;
mediump float tmpvar_95;
tmpvar_95 = xll_saturate_f ((sD_79 - sampleD_77));
mediump float tmpvar_96;
tmpvar_96 = tmpvar_95;
zd_75 = tmpvar_96;
if ((zd_75 > _Params.y)) {
highp float tmpvar_97;
tmpvar_97 = pow ((1.0 - zd_75), _Params.z);
highp float tmpvar_98;
tmpvar_98 = (occ_61 + tmpvar_97);
occ_61 = tmpvar_98;
};
int tmpvar_99;
tmpvar_99 = (s_60 + 1);
s_60 = tmpvar_99;
};
highp float tmpvar_100;
tmpvar_100 = (occ_61 / float(sampleCount_58));
occ_61 = tmpvar_100;
return (1.0 - occ_61);
}
mediump vec4 xlat_main (
in v2f_ao i_101
)
{
highp vec3 RAND_SAMPLES_102[8];
mediump vec3 tmpvar_103;
tmpvar_103 = vec3(0.0130572, 0.587232, -0.119337);
RAND_SAMPLES_102[0] = tmpvar_103;
mediump vec3 tmpvar_104;
tmpvar_104 = vec3(0.323078, 0.0220727, -0.418873);
RAND_SAMPLES_102[1] = tmpvar_104;
mediump vec3 tmpvar_105;
tmpvar_105 = vec3(-0.310725, -0.191367, 0.0561369);
RAND_SAMPLES_102[2] = tmpvar_105;
mediump vec3 tmpvar_106;
tmpvar_106 = vec3(-0.479646, 0.0939877, -0.580265);
RAND_SAMPLES_102[3] = tmpvar_106;
mediump vec3 tmpvar_107;
tmpvar_107 = vec3(0.139999, -0.33577, 0.559679);
RAND_SAMPLES_102[4] = tmpvar_107;
mediump vec3 tmpvar_108;
tmpvar_108 = vec3(-0.248458, 0.255532, 0.348944);
RAND_SAMPLES_102[5] = tmpvar_108;
mediump vec3 tmpvar_109;
tmpvar_109 = vec3(0.18719, -0.702764, -0.231748);
RAND_SAMPLES_102[6] = tmpvar_109;
mediump vec3 tmpvar_110;
tmpvar_110 = vec3(0.884915, 0.284208, 0.368524);
RAND_SAMPLES_102[7] = tmpvar_110;
mediump float tmpvar_111;
tmpvar_111 = frag_ao (i_101, 8, RAND_SAMPLES_102);
mediump vec4 tmpvar_112;
tmpvar_112 = vec4(tmpvar_111);
return tmpvar_112;
}
void main ()
{
v2f_ao xlt_i_113;
mediump vec4 xl_retval_114;
mediump vec4 tmpvar_115;
tmpvar_115 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_113.pos = tmpvar_115;
highp vec2 tmpvar_116;
tmpvar_116 = xlv_TEXCOORD0.xy;
highp vec2 tmpvar_117;
tmpvar_117 = tmpvar_116;
xlt_i_113.uv = tmpvar_117;
highp vec2 tmpvar_118;
tmpvar_118 = xlv_TEXCOORD1.xy;
highp vec2 tmpvar_119;
tmpvar_119 = tmpvar_118;
xlt_i_113.uvr = tmpvar_119;
mediump vec4 tmpvar_120;
tmpvar_120 = xlat_main (xlt_i_113);
mediump vec4 tmpvar_121;
tmpvar_121 = tmpvar_120;
xl_retval_114 = tmpvar_121;
mediump vec4 tmpvar_122;
tmpvar_122 = xl_retval_114.xyzw;
mediump vec4 tmpvar_123;
tmpvar_123 = tmpvar_122;
gl_FragData[0] = tmpvar_123;
}

Some files were not shown because too many files have changed in this diff Show more