diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-02-27 15:55:29 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-02-27 18:14:21 +0300 |
commit | e88a715364981af39353073c6d96b9056fafca6b (patch) | |
tree | 5deb475604760b1e5a59fc3ef4409f38d8ecfd11 /source/blender/gpu/GPU_material.h | |
parent | 1ec11363bd93cf6bd43e5da33322b3f88a9be210 (diff) |
Cleanup: more refactoring of GPU material attributes and textures
This further separates requested attributes and textures from the actual
node graph, that can be retained after the graph has been compiled and
freed. It makes it easier to add volume grids as a native concept, which
sits somewhere between an attribute and a texture.
It also adds explicit link types for UDIM tile mapping, rather than
relying on fairly hidden logic.
Diffstat (limited to 'source/blender/gpu/GPU_material.h')
-rw-r--r-- | source/blender/gpu/GPU_material.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 800843dd851..37fe30bc96b 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -64,6 +64,7 @@ typedef enum eGPUType { GPU_VEC4 = 4, GPU_MAT3 = 9, GPU_MAT4 = 16, + GPU_MAX_CONSTANT_DATA = GPU_MAT4, /* Values not in GPU_DATATYPE_STR */ GPU_TEX1D_ARRAY = 1001, @@ -137,10 +138,12 @@ typedef enum eGPUMaterialStatus { GPU_MAT_SUCCESS, } eGPUMaterialStatus; -GPUNodeLink *GPU_attribute(CustomDataType type, const char *name); -GPUNodeLink *GPU_constant(float *num); -GPUNodeLink *GPU_uniform(float *num); -GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser); +GPUNodeLink *GPU_constant(const float *num); +GPUNodeLink *GPU_uniform(const float *num); +GPUNodeLink *GPU_attribute(GPUMaterial *mat, CustomDataType type, const char *name); +GPUNodeLink *GPU_image(GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser); +GPUNodeLink *GPU_image_tiled(GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser); +GPUNodeLink *GPU_image_tiled_mapping(GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser); GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer); GPUNodeLink *GPU_builtin(eGPUBuiltin builtin); @@ -212,17 +215,19 @@ typedef struct GPUMaterialAttribute { struct GPUMaterialAttribute *next, *prev; int type; /* CustomDataType */ char name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ + eGPUType gputype; int id; + int users; } GPUMaterialAttribute; typedef struct GPUMaterialTexture { struct GPUMaterialTexture *next, *prev; - eGPUType type; struct Image *ima; struct ImageUser *iuser; struct GPUTexture **colorband; - char shadername[32]; /* Name of sampler in GLSL. */ - int id; + char sampler_name[32]; /* Name of sampler in GLSL. */ + char tiled_mapping_name[32]; /* Name of tile mapping sampler in GLSL. */ + int users; } GPUMaterialTexture; ListBase GPU_material_attributes(GPUMaterial *material); |