return state->is_version(140, 0);
}
+static bool
+v140_or_es3(const _mesa_glsl_parse_state *state)
+{
+ return state->is_version(140, 300);
+}
+
static bool
v400_fs_only(const _mesa_glsl_parse_state *state)
{
state->OES_texture_storage_multisample_2d_array_enable;
}
+static bool
+texture_samples_identical(const _mesa_glsl_parse_state *state)
+{
+ return texture_multisample(state) &&
+ state->EXT_shader_samples_identical_enable;
+}
+
+static bool
+texture_samples_identical_array(const _mesa_glsl_parse_state *state)
+{
+ return texture_multisample_array(state) &&
+ state->EXT_shader_samples_identical_enable;
+}
+
static bool
fs_texture_cube_map_array(const _mesa_glsl_parse_state *state)
{
return state->has_atomic_counters();
}
+static bool
+shader_clock(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shader_clock_enable;
+}
+
static bool
shader_storage_buffer_object(const _mesa_glsl_parse_state *state)
{
return state->has_double();
}
+static bool
+compute_shader(const _mesa_glsl_parse_state *state)
+{
+ return state->stage == MESA_SHADER_COMPUTE;
+}
+
+static bool
+buffer_atomics_supported(const _mesa_glsl_parse_state *state)
+{
+ return compute_shader(state) || shader_storage_buffer_object(state);
+}
+
static bool
barrier_supported(const _mesa_glsl_parse_state *state)
{
- return state->stage == MESA_SHADER_COMPUTE ||
+ return compute_shader(state) ||
state->stage == MESA_SHADER_TESS_CTRL;
}
ir_variable *in_var(const glsl_type *type, const char *name);
ir_variable *out_var(const glsl_type *type, const char *name);
ir_constant *imm(float f, unsigned vector_elements=1);
+ ir_constant *imm(bool b, unsigned vector_elements=1);
ir_constant *imm(int i, unsigned vector_elements=1);
ir_constant *imm(unsigned u, unsigned vector_elements=1);
ir_constant *imm(double d, unsigned vector_elements=1);
ir_expression_operation opcode,
const glsl_type *return_type,
const glsl_type *param_type);
- ir_function_signature *binop(ir_expression_operation opcode,
- builtin_available_predicate avail,
+ ir_function_signature *binop(builtin_available_predicate avail,
+ ir_expression_operation opcode,
const glsl_type *return_type,
const glsl_type *param0_type,
const glsl_type *param1_type);
BA2(textureQueryLod);
B1(textureQueryLevels);
+ BA2(textureSamplesIdentical);
B1(dFdx);
B1(dFdy);
B1(fwidth);
ir_function_signature *_atomic_counter_op(const char *intrinsic,
builtin_available_predicate avail);
- ir_function_signature *_atomic_ssbo_intrinsic2(builtin_available_predicate avail,
- const glsl_type *type);
- ir_function_signature *_atomic_ssbo_op2(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type);
- ir_function_signature *_atomic_ssbo_intrinsic3(builtin_available_predicate avail,
- const glsl_type *type);
- ir_function_signature *_atomic_ssbo_op3(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type);
+ ir_function_signature *_atomic_intrinsic2(builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_atomic_op2(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_atomic_intrinsic3(builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_atomic_op3(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type);
B1(min3)
B1(max3)
ir_function_signature *_memory_barrier_intrinsic(
builtin_available_predicate avail);
- ir_function_signature *_memory_barrier(
- builtin_available_predicate avail);
+ ir_function_signature *_memory_barrier(const char *intrinsic_name,
+ builtin_available_predicate avail);
+
+ ir_function_signature *_shader_clock_intrinsic(builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_shader_clock(builtin_available_predicate avail,
+ const glsl_type *type);
#undef B0
#undef B1
_atomic_counter_intrinsic(shader_atomic_counters),
NULL);
- add_function("__intrinsic_ssbo_atomic_add",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_min",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_max",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_and",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_or",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_xor",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_exchange",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_comp_swap",
- _atomic_ssbo_intrinsic3(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic3(shader_storage_buffer_object,
- glsl_type::int_type),
+ add_function("__intrinsic_atomic_add",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_min",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_max",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_and",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_or",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_xor",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_exchange",
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(buffer_atomics_supported,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_comp_swap",
+ _atomic_intrinsic3(buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_intrinsic3(buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_image_functions(false);
add_function("__intrinsic_memory_barrier",
_memory_barrier_intrinsic(shader_image_load_store),
NULL);
+ add_function("__intrinsic_group_memory_barrier",
+ _memory_barrier_intrinsic(compute_shader),
+ NULL);
+ add_function("__intrinsic_memory_barrier_atomic_counter",
+ _memory_barrier_intrinsic(compute_shader),
+ NULL);
+ add_function("__intrinsic_memory_barrier_buffer",
+ _memory_barrier_intrinsic(compute_shader),
+ NULL);
+ add_function("__intrinsic_memory_barrier_image",
+ _memory_barrier_intrinsic(compute_shader),
+ NULL);
+ add_function("__intrinsic_memory_barrier_shared",
+ _memory_barrier_intrinsic(compute_shader),
+ NULL);
+
+ add_function("__intrinsic_shader_clock",
+ _shader_clock_intrinsic(shader_clock,
+ glsl_type::uvec2_type),
+ NULL);
}
/**
_smoothstep(fp64, glsl_type::dvec3_type, glsl_type::dvec3_type),
_smoothstep(fp64, glsl_type::dvec4_type, glsl_type::dvec4_type),
NULL);
-
+
FD130(isnan)
FD130(isinf)
FD(distance)
FD(dot)
- add_function("cross", _cross(always_available, glsl_type::vec3_type),
+ add_function("cross", _cross(always_available, glsl_type::vec3_type),
_cross(fp64, glsl_type::dvec3_type), NULL);
FD(normalize)
NULL);
add_function("inverse",
- _inverse_mat2(v120, glsl_type::mat2_type),
- _inverse_mat3(v120, glsl_type::mat3_type),
- _inverse_mat4(v120, glsl_type::mat4_type),
+ _inverse_mat2(v140_or_es3, glsl_type::mat2_type),
+ _inverse_mat3(v140_or_es3, glsl_type::mat3_type),
+ _inverse_mat4(v140_or_es3, glsl_type::mat4_type),
_inverse_mat2(fp64, glsl_type::dmat2_type),
_inverse_mat3(fp64, glsl_type::dmat3_type),
_inverse_mat4(fp64, glsl_type::dmat4_type),
NULL);
+ add_function("textureSamplesIdenticalEXT",
+ _textureSamplesIdentical(texture_samples_identical, glsl_type::sampler2DMS_type, glsl_type::ivec2_type),
+ _textureSamplesIdentical(texture_samples_identical, glsl_type::isampler2DMS_type, glsl_type::ivec2_type),
+ _textureSamplesIdentical(texture_samples_identical, glsl_type::usampler2DMS_type, glsl_type::ivec2_type),
+
+ _textureSamplesIdentical(texture_samples_identical_array, glsl_type::sampler2DMSArray_type, glsl_type::ivec3_type),
+ _textureSamplesIdentical(texture_samples_identical_array, glsl_type::isampler2DMSArray_type, glsl_type::ivec3_type),
+ _textureSamplesIdentical(texture_samples_identical_array, glsl_type::usampler2DMSArray_type, glsl_type::ivec3_type),
+ NULL);
+
add_function("texture1D",
_texture(ir_tex, v110, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
_texture(ir_txb, v110_fs_only, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
NULL);
add_function("atomicAdd",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_add",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_add",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_add",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_add",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicMin",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_min",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_min",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_min",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_min",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicMax",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_max",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_max",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_max",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_max",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicAnd",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_and",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_and",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_and",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_and",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicOr",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_or",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_or",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_or",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_or",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicXor",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_xor",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_xor",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_xor",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_xor",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicExchange",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_exchange",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_exchange",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_exchange",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_exchange",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("atomicCompSwap",
- _atomic_ssbo_op3("__intrinsic_ssbo_atomic_comp_swap",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op3("__intrinsic_ssbo_atomic_comp_swap",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op3("__intrinsic_atomic_comp_swap",
+ buffer_atomics_supported,
+ glsl_type::uint_type),
+ _atomic_op3("__intrinsic_atomic_comp_swap",
+ buffer_atomics_supported,
+ glsl_type::int_type),
NULL);
add_function("min3",
add_image_functions(true);
add_function("memoryBarrier",
- _memory_barrier(shader_image_load_store),
+ _memory_barrier("__intrinsic_memory_barrier",
+ shader_image_load_store),
+ NULL);
+ add_function("groupMemoryBarrier",
+ _memory_barrier("__intrinsic_group_memory_barrier",
+ compute_shader),
+ NULL);
+ add_function("memoryBarrierAtomicCounter",
+ _memory_barrier("__intrinsic_memory_barrier_atomic_counter",
+ compute_shader),
+ NULL);
+ add_function("memoryBarrierBuffer",
+ _memory_barrier("__intrinsic_memory_barrier_buffer",
+ compute_shader),
+ NULL);
+ add_function("memoryBarrierImage",
+ _memory_barrier("__intrinsic_memory_barrier_image",
+ compute_shader),
+ NULL);
+ add_function("memoryBarrierShared",
+ _memory_barrier("__intrinsic_memory_barrier_shared",
+ compute_shader),
+ NULL);
+
+ add_function("clock2x32ARB",
+ _shader_clock(shader_clock,
+ glsl_type::uvec2_type),
NULL);
#undef F
return new(mem_ctx) ir_variable(type, name, ir_var_function_out);
}
+ir_constant *
+builtin_builder::imm(bool b, unsigned vector_elements)
+{
+ return new(mem_ctx) ir_constant(b, vector_elements);
+}
+
ir_constant *
builtin_builder::imm(float f, unsigned vector_elements)
{
}
ir_function_signature *
-builtin_builder::binop(ir_expression_operation opcode,
- builtin_available_predicate avail,
+builtin_builder::binop(builtin_available_predicate avail,
+ ir_expression_operation opcode,
const glsl_type *return_type,
const glsl_type *param0_type,
const glsl_type *param1_type)
ir_function_signature *
builtin_builder::_pow(const glsl_type *type)
{
- return binop(ir_binop_pow, always_available, type, type, type);
+ return binop(always_available, ir_binop_pow, type, type, type);
}
UNOP(exp, ir_unop_exp, always_available)
ir_function_signature *
builtin_builder::_mod(const glsl_type *x_type, const glsl_type *y_type)
{
- return binop(ir_binop_mod, always_available, x_type, x_type, y_type);
+ return binop(always_available, ir_binop_mod, x_type, x_type, y_type);
}
ir_function_signature *
builtin_builder::_min(builtin_available_predicate avail,
const glsl_type *x_type, const glsl_type *y_type)
{
- return binop(ir_binop_min, avail, x_type, x_type, y_type);
+ return binop(avail, ir_binop_min, x_type, x_type, y_type);
}
ir_function_signature *
builtin_builder::_max(builtin_available_predicate avail,
const glsl_type *x_type, const glsl_type *y_type)
{
- return binop(ir_binop_max, avail, x_type, x_type, y_type);
+ return binop(avail, ir_binop_max, x_type, x_type, y_type);
}
ir_function_signature *
ir_constant_data infinities;
for (int i = 0; i < type->vector_elements; i++) {
- infinities.f[i] = INFINITY;
+ switch (type->base_type) {
+ case GLSL_TYPE_FLOAT:
+ infinities.f[i] = INFINITY;
+ break;
+ case GLSL_TYPE_DOUBLE:
+ infinities.d[i] = INFINITY;
+ break;
+ default:
+ unreachable("unknown type");
+ }
}
body.emit(ret(equal(abs(x), imm(type, infinities))));
builtin_builder::_dot(builtin_available_predicate avail, const glsl_type *type)
{
if (type->vector_elements == 1)
- return binop(ir_binop_mul, avail, type, type, type);
+ return binop(avail, ir_binop_mul, type, type, type);
- return binop(ir_binop_dot, avail,
+ return binop(avail, ir_binop_dot,
type->get_base_type(), type, type);
}
builtin_builder::_lessThan(builtin_available_predicate avail,
const glsl_type *type)
{
- return binop(ir_binop_less, avail,
+ return binop(avail, ir_binop_less,
glsl_type::bvec(type->vector_elements), type, type);
}
builtin_builder::_lessThanEqual(builtin_available_predicate avail,
const glsl_type *type)
{
- return binop(ir_binop_lequal, avail,
+ return binop(avail, ir_binop_lequal,
glsl_type::bvec(type->vector_elements), type, type);
}
builtin_builder::_greaterThan(builtin_available_predicate avail,
const glsl_type *type)
{
- return binop(ir_binop_greater, avail,
+ return binop(avail, ir_binop_greater,
glsl_type::bvec(type->vector_elements), type, type);
}
builtin_builder::_greaterThanEqual(builtin_available_predicate avail,
const glsl_type *type)
{
- return binop(ir_binop_gequal, avail,
+ return binop(avail, ir_binop_gequal,
glsl_type::bvec(type->vector_elements), type, type);
}
builtin_builder::_equal(builtin_available_predicate avail,
const glsl_type *type)
{
- return binop(ir_binop_equal, avail,
+ return binop(avail, ir_binop_equal,
glsl_type::bvec(type->vector_elements), type, type);
}
builtin_builder::_notEqual(builtin_available_predicate avail,
const glsl_type *type)
{
- return binop(ir_binop_nequal, avail,
+ return binop(avail, ir_binop_nequal,
glsl_type::bvec(type->vector_elements), type, type);
}
ir_function_signature *
builtin_builder::_any(const glsl_type *type)
{
- return unop(always_available, ir_unop_any, glsl_type::bool_type, type);
+ ir_variable *v = in_var(type, "v");
+ MAKE_SIG(glsl_type::bool_type, always_available, 1, v);
+
+ const unsigned vec_elem = v->type->vector_elements;
+ body.emit(ret(expr(ir_binop_any_nequal, v, imm(false, vec_elem))));
+
+ return sig;
}
ir_function_signature *
ir_variable *v = in_var(type, "v");
MAKE_SIG(glsl_type::bool_type, always_available, 1, v);
- switch (type->vector_elements) {
- case 2:
- body.emit(ret(logic_and(swizzle_x(v), swizzle_y(v))));
- break;
- case 3:
- body.emit(ret(logic_and(logic_and(swizzle_x(v), swizzle_y(v)),
- swizzle_z(v))));
- break;
- case 4:
- body.emit(ret(logic_and(logic_and(logic_and(swizzle_x(v), swizzle_y(v)),
- swizzle_z(v)),
- swizzle_w(v))));
- break;
- }
+ const unsigned vec_elem = v->type->vector_elements;
+ body.emit(ret(expr(ir_binop_all_equal, v, imm(true, vec_elem))));
return sig;
}
return sig;
}
+ir_function_signature *
+builtin_builder::_textureSamplesIdentical(builtin_available_predicate avail,
+ const glsl_type *sampler_type,
+ const glsl_type *coord_type)
+{
+ ir_variable *s = in_var(sampler_type, "sampler");
+ ir_variable *P = in_var(coord_type, "P");
+ const glsl_type *return_type = glsl_type::bool_type;
+ MAKE_SIG(return_type, avail, 2, s, P);
+
+ ir_texture *tex = new(mem_ctx) ir_texture(ir_samples_identical);
+ tex->coordinate = var_ref(P);
+ tex->set_sampler(var_ref(s), return_type);
+
+ body.emit(ret(tex));
+
+ return sig;
+}
+
UNOP(dFdx, ir_unop_dFdx, fs_oes_derivatives)
UNOP(dFdxCoarse, ir_unop_dFdx_coarse, fs_derivative_control)
UNOP(dFdxFine, ir_unop_dFdx_fine, fs_derivative_control)
ir_function_signature *
builtin_builder::_ldexp(const glsl_type *x_type, const glsl_type *exp_type)
{
- return binop(ir_binop_ldexp, x_type->base_type == GLSL_TYPE_DOUBLE ? fp64 : gpu_shader5_or_es31, x_type, x_type, exp_type);
+ return binop(x_type->base_type == GLSL_TYPE_DOUBLE ? fp64 : gpu_shader5_or_es31,
+ ir_binop_ldexp, x_type, x_type, exp_type);
}
ir_function_signature *
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_intrinsic2(builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_intrinsic2(builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic");
ir_variable *data = in_var(type, "data");
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_intrinsic3(builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_intrinsic3(builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic");
ir_variable *data1 = in_var(type, "data1");
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_op2(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_op2(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic_var");
ir_variable *data = in_var(type, "atomic_data");
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_op3(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_op3(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic_var");
ir_variable *data1 = in_var(type, "atomic_data1");
ir_function_signature *
builtin_builder::_image_samples_prototype(const glsl_type *image_type,
- unsigned num_arguments,
- unsigned flags)
+ unsigned /* num_arguments */,
+ unsigned /* flags */)
{
ir_variable *image = in_var(image_type, "image");
ir_function_signature *sig =
}
ir_function_signature *
-builtin_builder::_memory_barrier(builtin_available_predicate avail)
+builtin_builder::_memory_barrier(const char *intrinsic_name,
+ builtin_available_predicate avail)
{
MAKE_SIG(glsl_type::void_type, avail, 0);
- body.emit(call(shader->symbols->get_function("__intrinsic_memory_barrier"),
+ body.emit(call(shader->symbols->get_function(intrinsic_name),
NULL, sig->parameters));
return sig;
}
+ir_function_signature *
+builtin_builder::_shader_clock_intrinsic(builtin_available_predicate avail,
+ const glsl_type *type)
+{
+ MAKE_INTRINSIC(type, avail, 0);
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_shader_clock(builtin_available_predicate avail,
+ const glsl_type *type)
+{
+ MAKE_SIG(type, avail, 0);
+
+ ir_variable *retval = body.make_temp(type, "clock_retval");
+
+ body.emit(call(shader->symbols->get_function("__intrinsic_shader_clock"),
+ retval, sig->parameters));
+ body.emit(ret(retval));
+ return sig;
+}
+
/** @} */
/******************************************************************************/