compiler/types: Move GLSL specific builtin structs into glsl/

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25006>
This commit is contained in:
Caio Oliveira
2023-09-06 17:28:32 -07:00
committed by Marge Bot
parent 75bcebbb9e
commit f865905fac
4 changed files with 39 additions and 44 deletions
-8
View File
@@ -260,11 +260,3 @@ DECL_TYPE(utextureSubpassInputMS, 0, GLSL_TYPE_T
DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)
STRUCT_TYPE(gl_DepthRangeParameters)
STRUCT_TYPE(gl_PointParameters)
STRUCT_TYPE(gl_MaterialParameters)
STRUCT_TYPE(gl_LightSourceParameters)
STRUCT_TYPE(gl_LightModelParameters)
STRUCT_TYPE(gl_LightModelProducts)
STRUCT_TYPE(gl_LightProducts)
STRUCT_TYPE(gl_FogParameters)
+31 -19
View File
@@ -40,18 +40,9 @@
#include "main/consts_exts.h"
/**
* Declarations of type flyweights (glsl_type::_foo_type) and
* convenience pointers (glsl_type::foo_type).
* Declarations of struct builtins types.
* @{
*/
#define DECL_TYPE(NAME, ...)
#define STRUCT_TYPE(NAME) \
const glsl_type glsl_type::_struct_##NAME##_type = \
glsl_type(NAME##_fields, ARRAY_SIZE(NAME##_fields), #NAME); \
const glsl_type *const glsl_type::struct_##NAME##_type = \
&glsl_type::_struct_##NAME##_type;
static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = {
glsl_struct_field(glsl_type::float_type, GLSL_PRECISION_HIGH, "near"),
glsl_struct_field(glsl_type::float_type, GLSL_PRECISION_HIGH, "far"),
@@ -113,7 +104,22 @@ static const struct glsl_struct_field gl_FogParameters_fields[] = {
glsl_struct_field(glsl_type::float_type, "scale"),
};
#include "compiler/builtin_type_macros.h"
#define STRUCT_TYPE(NAME) \
const glsl_type _struct_##NAME##_type = \
glsl_type(NAME##_fields, ARRAY_SIZE(NAME##_fields), #NAME); \
const glsl_type *const struct_##NAME##_type = \
&_struct_##NAME##_type;
STRUCT_TYPE(gl_DepthRangeParameters)
STRUCT_TYPE(gl_PointParameters)
STRUCT_TYPE(gl_MaterialParameters)
STRUCT_TYPE(gl_LightSourceParameters)
STRUCT_TYPE(gl_LightModelParameters)
STRUCT_TYPE(gl_LightModelProducts)
STRUCT_TYPE(gl_LightProducts)
STRUCT_TYPE(gl_FogParameters)
#undef STRUCT_TYPE
/** @} */
/**
@@ -126,6 +132,9 @@ static const struct glsl_struct_field gl_FogParameters_fields[] = {
#define T(TYPE, MIN_GL, MIN_ES) \
{ glsl_type::TYPE##_type, MIN_GL, MIN_ES },
#define S(TYPE, MIN_GL, MIN_ES) \
{ TYPE##_type, MIN_GL, MIN_ES },
static const struct builtin_type_versions {
const glsl_type *const type;
int min_gl;
@@ -216,7 +225,7 @@ static const struct builtin_type_versions {
T(samplerCubeArrayShadow, 400, 320)
T(sampler2DRectShadow, 140, 999)
T(struct_gl_DepthRangeParameters, 110, 100)
S(struct_gl_DepthRangeParameters, 110, 100)
T(image1D, 420, 999)
T(image2D, 420, 310)
@@ -255,14 +264,17 @@ static const struct builtin_type_versions {
T(atomic_uint, 420, 310)
};
#undef T
#undef S
static const glsl_type *const deprecated_types[] = {
glsl_type::struct_gl_PointParameters_type,
glsl_type::struct_gl_MaterialParameters_type,
glsl_type::struct_gl_LightSourceParameters_type,
glsl_type::struct_gl_LightModelParameters_type,
glsl_type::struct_gl_LightModelProducts_type,
glsl_type::struct_gl_LightProducts_type,
glsl_type::struct_gl_FogParameters_type,
struct_gl_PointParameters_type,
struct_gl_MaterialParameters_type,
struct_gl_LightSourceParameters_type,
struct_gl_LightModelParameters_type,
struct_gl_LightModelProducts_type,
struct_gl_LightProducts_type,
struct_gl_FogParameters_type,
};
static inline void
+1 -3
View File
@@ -2925,10 +2925,8 @@ glsl_type::coordinate_components() const
#define DECL_TYPE(NAME, ...) \
const glsl_type glsl_type::_##NAME##_type = glsl_type(__VA_ARGS__, #NAME); \
const glsl_type *const glsl_type::NAME##_type = &glsl_type::_##NAME##_type;
#define STRUCT_TYPE(NAME)
#include "compiler/builtin_type_macros.h"
#undef DECL_TYPE
/** @} */
union packed_type {
+7 -14
View File
@@ -369,13 +369,10 @@ public:
* \name Pointers to various public type singletons
*/
/*@{*/
#undef DECL_TYPE
#define DECL_TYPE(NAME, ...) \
static const glsl_type *const NAME##_type;
#undef STRUCT_TYPE
#define STRUCT_TYPE(NAME) \
static const glsl_type *const struct_##NAME##_type;
#include "compiler/builtin_type_macros.h"
#undef DECL_TYPE
/*@}*/
/**
@@ -1227,6 +1224,11 @@ public:
~glsl_type();
/** Constructor for record types */
glsl_type(const glsl_struct_field *fields, unsigned num_fields,
const char *name, bool packed = false,
unsigned explicit_alignment = 0);
private:
static simple_mtx_t hash_mutex;
@@ -1248,11 +1250,6 @@ private:
enum glsl_sampler_dim dim, bool shadow, bool array,
glsl_base_type type, const char *name);
/** Constructor for record types */
glsl_type(const glsl_struct_field *fields, unsigned num_fields,
const char *name, bool packed = false,
unsigned explicit_alignment = 0);
/** Constructor for interface types */
glsl_type(const glsl_struct_field *fields, unsigned num_fields,
enum glsl_interface_packing packing,
@@ -1289,11 +1286,9 @@ private:
* \name Built-in type flyweights
*/
/*@{*/
#undef DECL_TYPE
#define DECL_TYPE(NAME, ...) static const glsl_type _##NAME##_type;
#undef STRUCT_TYPE
#define STRUCT_TYPE(NAME) static const glsl_type _struct_##NAME##_type;
#include "compiler/builtin_type_macros.h"
#undef DECL_TYPE
/*@}*/
/**
@@ -1314,8 +1309,6 @@ private:
unsigned int explicit_alignment);
};
#undef DECL_TYPE
#undef STRUCT_TYPE
#endif /* __cplusplus */
struct glsl_struct_field {