glsl/types: Rename sampler_type to sampled_type
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 9 Feb 2016 21:56:23 +0000 (13:56 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sun, 14 Feb 2016 01:22:36 +0000 (17:22 -0800)
It's a bit more descriptive since it is the base type that you get when you
sample from it.  Also, the next commit adds a bare "sampler" type and we
need glsl_type::sampler_type available for a public static member.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/builtin_functions.cpp
src/compiler/glsl/ir.cpp
src/compiler/glsl/tests/sampler_types_test.cpp
src/compiler/glsl_types.cpp
src/compiler/glsl_types.h
src/mesa/drivers/dri/i965/brw_fs_nir.cpp

index dbeb5c0ad408341782ee6b3b1bfadc102d5749c6..3996b01c9f92fe584054c76fbb432919584e1bf2 100644 (file)
@@ -2267,7 +2267,7 @@ get_type_name_for_precision_qualifier(const glsl_type *type)
          type->sampler_array + 2 * type->sampler_shadow;
       const unsigned offset = type->base_type == GLSL_TYPE_SAMPLER ? 0 : 4;
       assert(type_idx < 4);
-      switch (type->sampler_type) {
+      switch (type->sampled_type) {
       case GLSL_TYPE_FLOAT:
          switch (type->sampler_dimensionality) {
          case GLSL_SAMPLER_DIM_1D: {
@@ -2953,7 +2953,7 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
                              "used on image function parameters");
          }
 
-         if (qual->image_base_type != base_type->sampler_type) {
+         if (qual->image_base_type != base_type->sampled_type) {
             _mesa_glsl_error(loc, state, "format qualifier doesn't match the "
                              "base data type of the image");
          }
index 5512a33f114e6f9f2efa49d603577a2b44745cae..f488434e4c9298e1b70cb8d4580c3b5025f1aece 100644 (file)
@@ -2921,7 +2921,7 @@ builtin_builder::add_image_function(const char *name,
    ir_function *f = new(mem_ctx) ir_function(name);
 
    for (unsigned i = 0; i < ARRAY_SIZE(types); ++i) {
-      if ((types[i]->sampler_type != GLSL_TYPE_FLOAT ||
+      if ((types[i]->sampled_type != GLSL_TYPE_FLOAT ||
            (flags & IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE)) &&
           (types[i]->sampler_dimensionality == GLSL_SAMPLER_DIM_MS ||
            !(flags & IMAGE_FUNCTION_MS_ONLY)))
@@ -5238,7 +5238,7 @@ builtin_builder::_image_prototype(const glsl_type *image_type,
                                   unsigned flags)
 {
    const glsl_type *data_type = glsl_type::get_instance(
-      image_type->sampler_type,
+      image_type->sampled_type,
       (flags & IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE ? 4 : 1),
       1);
    const glsl_type *ret_type = (flags & IMAGE_FUNCTION_RETURNS_VOID ?
index 5debca3241114b00976c3680ffa58dac12fafdd2..c7a2496b6c8804fd61d04271b177ccdf48c4dcba 100644 (file)
@@ -1442,7 +1442,7 @@ ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
       assert(sampler->type->base_type == GLSL_TYPE_SAMPLER);
       assert(sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_MS);
    } else {
-      assert(sampler->type->sampler_type == (int) type->base_type);
+      assert(sampler->type->sampled_type == (int) type->base_type);
       if (sampler->type->sampler_shadow)
         assert(type->vector_elements == 4 || type->vector_elements == 1);
       else
index 04dd65e6e8d2f3c568ec6834784d1a45d7138541..ef03158bba94e71be0644eb602e79c9b570fb1fe 100644 (file)
@@ -43,7 +43,7 @@ TEST(sampler_types, TYPE)                                   \
    const glsl_type *type = glsl_type::TYPE##_type;          \
    EXPECT_EQ(GLSL_TYPE_SAMPLER, type->base_type);           \
    EXPECT_EQ(DIM, type->sampler_dimensionality);            \
-   EXPECT_EQ(DATA_TYPE, type->sampler_type);                \
+   EXPECT_EQ(DATA_TYPE, type->sampled_type);                \
    ARR;                                                     \
    SHAD;                                                    \
    EXPECT_EQ(COMPS, type->coordinate_components());         \
index 1458ad366cdc0c8dc3add6cf03a4b679f3fdae5d..f412f897be40035de7d958bc8b646844bf00aff7 100644 (file)
@@ -50,7 +50,7 @@ glsl_type::glsl_type(GLenum gl_type,
    gl_type(gl_type),
    base_type(base_type),
    sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
-   sampler_type(0), interface_packing(0),
+   sampled_type(0), interface_packing(0),
    vector_elements(vector_elements), matrix_columns(matrix_columns),
    length(0)
 {
@@ -74,7 +74,7 @@ glsl_type::glsl_type(GLenum gl_type, glsl_base_type base_type,
    gl_type(gl_type),
    base_type(base_type),
    sampler_dimensionality(dim), sampler_shadow(shadow),
-   sampler_array(array), sampler_type(type), interface_packing(0),
+   sampler_array(array), sampled_type(type), interface_packing(0),
    length(0)
 {
    mtx_lock(&glsl_type::mutex);
@@ -100,7 +100,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
    gl_type(0),
    base_type(GLSL_TYPE_STRUCT),
    sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
-   sampler_type(0), interface_packing(0),
+   sampled_type(0), interface_packing(0),
    vector_elements(0), matrix_columns(0),
    length(num_fields)
 {
@@ -140,7 +140,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
    gl_type(0),
    base_type(GLSL_TYPE_INTERFACE),
    sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
-   sampler_type(0), interface_packing((unsigned) packing),
+   sampled_type(0), interface_packing((unsigned) packing),
    vector_elements(0), matrix_columns(0),
    length(num_fields)
 {
@@ -178,7 +178,7 @@ glsl_type::glsl_type(const char *subroutine_name) :
    gl_type(0),
    base_type(GLSL_TYPE_SUBROUTINE),
    sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
-   sampler_type(0), interface_packing(0),
+   sampled_type(0), interface_packing(0),
    vector_elements(1), matrix_columns(1),
    length(0)
 {
@@ -394,7 +394,7 @@ _mesa_glsl_release_types(void)
 glsl_type::glsl_type(const glsl_type *array, unsigned length) :
    base_type(GLSL_TYPE_ARRAY),
    sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
-   sampler_type(0), interface_packing(0),
+   sampled_type(0), interface_packing(0),
    vector_elements(0), matrix_columns(0),
    length(length), name(NULL)
 {
index 00133d9cb258b16a557aae0f1bd6609579b06d8a..1d9cfd4c869d271001dc9c7e8707854a19dd4b37 100644 (file)
@@ -121,7 +121,7 @@ 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
+   unsigned sampled_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.
index 1fc21e474a7cd5ac1299056fcfe37809ffe3b213..1d5d316ace9f3a714a337ae238e8f25e9a404adb 100644 (file)
@@ -1235,7 +1235,7 @@ fs_visitor::emit_percomp(const fs_builder &bld, const fs_inst &inst,
 static brw_reg_type
 get_image_base_type(const glsl_type *type)
 {
-   switch ((glsl_base_type)type->sampler_type) {
+   switch ((glsl_base_type)type->sampled_type) {
    case GLSL_TYPE_UINT:
       return BRW_REGISTER_TYPE_UD;
    case GLSL_TYPE_INT: