{
return tex3d(state) && lod_exists_in_stage(state);
}
+
+static bool
+shader_atomic_counters(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shader_atomic_counters_enable;
+}
+
/** @} */
/******************************************************************************/
B1(uaddCarry)
B1(usubBorrow)
B1(mulExtended)
+
+ ir_function_signature *_atomic_intrinsic(builtin_available_predicate avail);
+ ir_function_signature *_atomic_op(const char *intrinsic,
+ builtin_available_predicate avail);
+
#undef B0
#undef B1
#undef B2
void
builtin_builder::create_intrinsics()
{
+ add_function("__intrinsic_atomic_read",
+ _atomic_intrinsic(shader_atomic_counters),
+ NULL);
+ add_function("__intrinsic_atomic_increment",
+ _atomic_intrinsic(shader_atomic_counters),
+ NULL);
+ add_function("__intrinsic_atomic_predecrement",
+ _atomic_intrinsic(shader_atomic_counters),
+ NULL);
}
/**
_mulExtended(glsl_type::uvec3_type),
_mulExtended(glsl_type::uvec4_type),
NULL);
+
+ add_function("atomicCounter",
+ _atomic_op("__intrinsic_atomic_read",
+ shader_atomic_counters),
+ NULL);
+ add_function("atomicCounterIncrement",
+ _atomic_op("__intrinsic_atomic_increment",
+ shader_atomic_counters),
+ NULL);
+ add_function("atomicCounterDecrement",
+ _atomic_op("__intrinsic_atomic_predecrement",
+ shader_atomic_counters),
+ NULL);
+
#undef F
#undef FI
#undef FIU
return sig;
}
+
+ir_function_signature *
+builtin_builder::_atomic_intrinsic(builtin_available_predicate avail)
+{
+ ir_variable *counter = in_var(glsl_type::atomic_uint_type, "counter");
+ MAKE_INTRINSIC(glsl_type::uint_type, avail, 1, counter);
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_atomic_op(const char *intrinsic,
+ builtin_available_predicate avail)
+{
+ ir_variable *counter = in_var(glsl_type::atomic_uint_type, "atomic_counter");
+ MAKE_SIG(glsl_type::uint_type, avail, 1, counter);
+
+ ir_variable *retval = body.make_temp(glsl_type::uint_type, "atomic_retval");
+ body.emit(call(shader->symbols->get_function(intrinsic), retval,
+ sig->parameters));
+ body.emit(ret(retval));
+ return sig;
+}
+
/** @} */
/******************************************************************************/
*/
add_const("gl_MaxTextureCoords", state->Const.MaxTextureCoords);
}
+
+ if (state->ARB_shader_atomic_counters_enable) {
+ add_const("gl_MaxVertexAtomicCounters",
+ state->Const.MaxVertexAtomicCounters);
+ add_const("gl_MaxGeometryAtomicCounters",
+ state->Const.MaxGeometryAtomicCounters);
+ add_const("gl_MaxFragmentAtomicCounters",
+ state->Const.MaxFragmentAtomicCounters);
+ add_const("gl_MaxCombinedAtomicCounters",
+ state->Const.MaxCombinedAtomicCounters);
+ add_const("gl_MaxAtomicCounterBindings",
+ state->Const.MaxAtomicBufferBindings);
+ add_const("gl_MaxTessControlAtomicCounters", 0);
+ add_const("gl_MaxTessEvaluationAtomicCounters", 0);
+ }
}
this->Const.MaxGeometryTotalOutputComponents = ctx->Const.MaxGeometryTotalOutputComponents;
this->Const.MaxGeometryUniformComponents = ctx->Const.GeometryProgram.MaxUniformComponents;
+ this->Const.MaxVertexAtomicCounters = ctx->Const.VertexProgram.MaxAtomicCounters;
+ this->Const.MaxGeometryAtomicCounters = ctx->Const.GeometryProgram.MaxAtomicCounters;
+ this->Const.MaxFragmentAtomicCounters = ctx->Const.FragmentProgram.MaxAtomicCounters;
+ this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
+ this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
+
this->current_function = NULL;
this->toplevel_ir = NULL;
this->found_return = false;