vector_elements(vector_elements), matrix_columns(matrix_columns),
length(0)
{
+ /* Values of these types must fit in the two bits of
+ * glsl_type::sampled_type.
+ */
+ STATIC_ASSERT((unsigned(GLSL_TYPE_UINT) & 3) == unsigned(GLSL_TYPE_UINT));
+ STATIC_ASSERT((unsigned(GLSL_TYPE_INT) & 3) == unsigned(GLSL_TYPE_INT));
+ STATIC_ASSERT((unsigned(GLSL_TYPE_FLOAT) & 3) == unsigned(GLSL_TYPE_FLOAT));
+
mtx_lock(&glsl_type::mutex);
init_ralloc_type_ctx();
return error_type;
else
return samplerExternalOES_type;
+ case GLSL_SAMPLER_DIM_SUBPASS:
+ return error_type;
}
case GLSL_TYPE_INT:
if (shadow)
return (array ? isampler2DMSArray_type : isampler2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
+ case GLSL_SAMPLER_DIM_SUBPASS:
+ return error_type;
}
case GLSL_TYPE_UINT:
if (shadow)
return (array ? usampler2DMSArray_type : usampler2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
+ case GLSL_SAMPLER_DIM_SUBPASS:
+ return error_type;
}
default:
return error_type;
glsl_type::get_image_instance(enum glsl_sampler_dim dim,
bool array, glsl_base_type type)
{
+ if (dim == GLSL_SAMPLER_DIM_SUBPASS)
+ return subpassInput_type;
switch (type) {
case GLSL_TYPE_FLOAT:
switch (dim) {
case GLSL_SAMPLER_DIM_MS:
return (array ? image2DMSArray_type : image2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
+ case GLSL_SAMPLER_DIM_SUBPASS:
return error_type;
}
case GLSL_TYPE_INT:
case GLSL_SAMPLER_DIM_MS:
return (array ? iimage2DMSArray_type : iimage2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
+ case GLSL_SAMPLER_DIM_SUBPASS:
return error_type;
}
case GLSL_TYPE_UINT:
case GLSL_SAMPLER_DIM_MS:
return (array ? uimage2DMSArray_type : uimage2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
+ case GLSL_SAMPLER_DIM_SUBPASS:
return error_type;
}
default:
const glsl_type *const key2 = (glsl_type *) b;
if (key1->length != key2->length)
- return 1;
+ return false;
return memcmp(key1->fields.parameters, key2->fields.parameters,
(key1->length + 1) * sizeof(*key1->fields.parameters)) == 0;
function_key_hash(const void *a)
{
const glsl_type *const key = (glsl_type *) a;
- char hash_key[128];
- unsigned size = 0;
-
- size = snprintf(hash_key, sizeof(hash_key), "%08x", key->length);
-
- for (unsigned i = 0; i < key->length; i++) {
- if (size >= sizeof(hash_key))
- break;
-
- size += snprintf(& hash_key[size], sizeof(hash_key) - size,
- "%p", (void *) key->fields.structure[i].type);
- }
-
- return _mesa_hash_string(hash_key);
+ return _mesa_hash_data(key->fields.parameters,
+ (key->length + 1) * sizeof(*key->fields.parameters));
}
const glsl_type *
if (this == desired)
return true;
- /* ESSL does not allow implicit conversions. If there is no state, we're
- * doing intra-stage function linking where these checks have already been
- * done.
+ /* GLSL 1.10 and ESSL do not allow implicit conversions. If there is no
+ * state, we're doing intra-stage function linking where these checks have
+ * already been done.
*/
- if (state && state->es_shader)
+ if (state && (state->es_shader || !state->is_version(120, 0)))
return false;
/* There is no conversion among matrix types. */
if (desired->is_float() && this->is_integer())
return true;
- /* With GLSL 4.0 / ARB_gpu_shader5, int can be converted to uint.
- * Note that state may be NULL here, when resolving function calls in the
- * linker. By this time, all the state-dependent checks have already
- * happened though, so allow anything that's allowed in any shader version. */
- if ((!state || state->is_version(400, 0) || state->ARB_gpu_shader5_enable) &&
+ /* With GLSL 4.0, ARB_gpu_shader5, or MESA_shader_integer_functions, int
+ * can be converted to uint. Note that state may be NULL here, when
+ * resolving function calls in the linker. By this time, all the
+ * state-dependent checks have already happened though, so allow anything
+ * that's allowed in any shader version.
+ */
+ if ((!state || state->is_version(400, 0) || state->ARB_gpu_shader5_enable ||
+ state->MESA_shader_integer_functions_enable) &&
desired->base_type == GLSL_TYPE_UINT && this->base_type == GLSL_TYPE_INT)
return true;
unsigned
glsl_type::std140_base_alignment(bool row_major) const
{
- unsigned N = is_double() ? 8 : 4;
+ unsigned N = is_64bit() ? 8 : 4;
/* (1) If the member is a scalar consuming <N> basic machine units, the
* base alignment is <N>.
unsigned
glsl_type::std140_size(bool row_major) const
{
- unsigned N = is_double() ? 8 : 4;
+ unsigned N = is_64bit() ? 8 : 4;
/* (1) If the member is a scalar consuming <N> basic machine units, the
* base alignment is <N>.
glsl_type::std430_base_alignment(bool row_major) const
{
- unsigned N = is_double() ? 8 : 4;
+ unsigned N = is_64bit() ? 8 : 4;
/* (1) If the member is a scalar consuming <N> basic machine units, the
* base alignment is <N>.
unsigned
glsl_type::std430_array_stride(bool row_major) const
{
- unsigned N = is_double() ? 8 : 4;
+ unsigned N = is_64bit() ? 8 : 4;
/* Notice that the array stride of a vec3 is not 3 * N but 4 * N.
* See OpenGL 4.30 spec, section 7.6.2.2 "Standard Uniform Block Layout"
unsigned
glsl_type::std430_size(bool row_major) const
{
- unsigned N = is_double() ? 8 : 4;
+ unsigned N = is_64bit() ? 8 : 4;
/* OpenGL 4.30 spec, section 7.6.2.2 "Standard Uniform Block Layout":
*
case GLSL_SAMPLER_DIM_RECT:
case GLSL_SAMPLER_DIM_MS:
case GLSL_SAMPLER_DIM_EXTERNAL:
+ case GLSL_SAMPLER_DIM_SUBPASS:
size = 2;
break;
case GLSL_SAMPLER_DIM_3D: