Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-08-13 19:44:27 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-08-14 00:01:18 +0300
commitefd44f8480b692e169155f5f35077a76969f6844 (patch)
tree48c80f74815935714ea0a2926755035367071a94 /source/blender/gpu/intern/gpu_codegen.h
parent77b39bbaa0c796b936f8691c1431f467d4f39981 (diff)
Cleanup: GPU codegen: remove most of legacy code
A lot of code in codegen was used by previous GLSL system. Now most of it is not used due to all the things being written from scratch in 2.8 and we can clean most of it. As a side not this make the system a bit less flexible (no support for cubemaps, preview image, etc...) but can be extended again.
Diffstat (limited to 'source/blender/gpu/intern/gpu_codegen.h')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h125
1 files changed, 65 insertions, 60 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 21dcaf6b591..7a86bed55de 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -52,21 +52,25 @@ struct PreviewImage;
*/
typedef enum GPUDataSource {
- GPU_SOURCE_VEC_UNIFORM,
+ GPU_SOURCE_OUTPUT,
+ GPU_SOURCE_CONSTANT,
+ GPU_SOURCE_UNIFORM,
+ GPU_SOURCE_ATTRIB,
GPU_SOURCE_BUILTIN,
- GPU_SOURCE_OPENGL_BUILTIN,
- GPU_SOURCE_TEX_PIXEL,
+ GPU_SOURCE_STRUCT,
GPU_SOURCE_TEX,
- GPU_SOURCE_ATTRIB,
- GPU_SOURCE_STRUCT
} GPUDataSource;
typedef enum {
- GPU_NODE_LINK_IMAGE_NONE = 0,
- GPU_NODE_LINK_IMAGE_BLENDER = 1,
- GPU_NODE_LINK_IMAGE_PREVIEW = 2,
- GPU_NODE_LINK_IMAGE_CUBE_MAP = 3
-} GPUNodeLinkImage;
+ GPU_NODE_LINK_NONE = 0,
+ GPU_NODE_LINK_ATTRIB,
+ GPU_NODE_LINK_BUILTIN,
+ GPU_NODE_LINK_COLORBAND,
+ GPU_NODE_LINK_CONSTANT,
+ GPU_NODE_LINK_IMAGE_BLENDER,
+ GPU_NODE_LINK_OUTPUT,
+ GPU_NODE_LINK_UNIFORM,
+} GPUNodeLinkType;
struct GPUNode {
struct GPUNode *next, *prev;
@@ -83,31 +87,30 @@ struct GPUNode {
struct GPUNodeLink {
GPUNodeStack *socket;
- CustomDataType attribtype;
- const char *attribname;
-
- GPUNodeLinkImage image;
- bool image_isdata;
-
- bool texture;
- int texturesize;
-
- void *ptr1, *ptr2;
-
- bool dynamic;
- GPUDynamicType dynamictype;
-
- GPUType type;
-
- /* Refcount */
- int users;
-
- struct GPUTexture *dynamictex;
-
- GPUBuiltin builtin;
- GPUOpenGLBuiltin oglbuiltin;
-
- struct GPUOutput *output;
+ GPUNodeLinkType link_type;
+ int users; /* Refcount */
+
+ union {
+ /* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */
+ float *data;
+ /* GPU_NODE_LINK_BUILTIN */
+ GPUBuiltin builtin;
+ /* GPU_NODE_LINK_COLORBAND */
+ struct GPUTexture **coba;
+ /* GPU_NODE_LINK_OUTPUT */
+ struct GPUOutput *output;
+ /* GPU_NODE_LINK_ATTRIB */
+ struct {
+ const char *attribname;
+ CustomDataType attribtype;
+ };
+ /* GPU_NODE_LINK_IMAGE_BLENDER */
+ struct {
+ struct Image *ima;
+ struct ImageUser *iuser;
+ bool image_isdata;
+ };
+ };
};
typedef struct GPUOutput {
@@ -123,37 +126,39 @@ typedef struct GPUInput {
struct GPUInput *next, *prev;
GPUNode *node;
-
GPUType type; /* datatype */
+ GPUNodeLink *link;
+ int id; /* unique id as created by code generator */
+
GPUDataSource source; /* data source */
- int id; /* unique id as created by code generator */
- int texid; /* number for multitexture, starting from zero */
- int attribid; /* id for vertex attributes */
- bool bindtex; /* input is responsible for binding the texture? */
- bool definetex; /* input is responsible for defining the pixel? */
- int textarget; /* GL texture target, e.g. GL_TEXTURE_2D */
- GPUType textype; /* datatype */
-
- struct Image *ima; /* image */
- struct ImageUser *iuser; /* image user */
- struct PreviewImage *prv; /* preview images & icons */
- bool image_isdata; /* image does not contain color data */
- float *dynamicvec; /* vector data in case it is dynamic */
- GPUDynamicType dynamictype; /* origin of the dynamic uniform */
- void *dynamicdata; /* data source of the dynamic uniform */
- struct GPUTexture *tex; /* input texture, only set at runtime */
int shaderloc; /* id from opengl */
char shadername[32]; /* name in shader */
- float vec[16]; /* vector data */
- GPUNodeLink *link;
- bool dynamictex; /* dynamic? */
- CustomDataType attribtype; /* attribute type */
- char attribname[MAX_CUSTOMDATA_LAYER_NAME]; /* attribute name */
- int attribfirst; /* this is the first one that is bound */
- GPUBuiltin builtin; /* builtin uniform */
- GPUOpenGLBuiltin oglbuiltin; /* opengl built in varying */
+ /* Content based on GPUDataSource */
+ union {
+ /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
+ float vec[16]; /* vector data */
+ /* GPU_SOURCE_BUILTIN */
+ GPUBuiltin builtin; /* builtin uniform */
+ /* GPU_SOURCE_TEX */
+ struct {
+ struct GPUTexture **coba; /* input texture, only set at runtime */
+ struct Image *ima; /* image */
+ struct ImageUser *iuser; /* image user */
+ bool image_isdata; /* image does not contain color data */
+ bool bindtex; /* input is responsible for binding the texture? */
+ int texid; /* number for multitexture, starting from zero */
+ GPUType textype; /* texture type (2D, 1D Array ...) */
+ };
+ /* GPU_SOURCE_ATTRIB */
+ struct {
+ char attribname[MAX_CUSTOMDATA_LAYER_NAME]; /* attribute name */
+ int attribid; /* id for vertex attributes */
+ bool attribfirst; /* this is the first one that is bound */
+ CustomDataType attribtype; /* attribute type */
+ };
+ };
} GPUInput;
struct GPUPass {