compiler/types: Add a texture type

This is separate from images and samplers.  It's a texture (not a
storage image) without a sampler.  We also add C-visible helpers to
convert between sampler and image types.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13389>
This commit is contained in:
Jason Ekstrand
2021-10-15 13:56:57 -05:00
committed by Marge Bot
parent 7558c9cb07
commit 3ace6b968b
14 changed files with 267 additions and 6 deletions

View File

@@ -1182,6 +1182,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_TEXTURE:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_INTERFACE:
case GLSL_TYPE_ATOMIC_UINT:
@@ -4222,6 +4223,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
case GLSL_TYPE_INT64:
break;
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
if (state->has_bindless())
break;
@@ -5432,6 +5434,7 @@ ast_declarator_list::hir(exec_list *instructions,
error = !state->is_version(410, 0) && !state->ARB_vertex_attrib_64bit_enable;
break;
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
error = !state->has_bindless();
break;
@@ -7228,6 +7231,7 @@ is_valid_default_precision_type(const struct glsl_type *const type)
/* "int" and "float" are valid, but vectors and matrices are not. */
return type->vector_elements == 1 && type->matrix_columns == 1;
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
return true;

View File

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

View File

@@ -354,6 +354,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const
case GLSL_TYPE_UINT8:
case GLSL_TYPE_INT8:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
return new(mem_ctx) ir_constant(this->type, &this->value);

View File

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

View File

@@ -84,6 +84,7 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
data.i[i] = values[idx];
break;
@@ -129,6 +130,7 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
ASSERT_EQ(data.i[i], val->value.i[i]);
break;
@@ -262,6 +264,7 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size,
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_TEXTURE:
case GLSL_TYPE_IMAGE:
EXPECT_EQ(val->value.i[i], storage[i].i);
break;