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 16:30:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-08-14 00:01:18 +0300
commit77b39bbaa0c796b936f8691c1431f467d4f39981 (patch)
tree7ca96767ca82b7138eb58577ddd811b7aaac7a9f /source/blender/gpu
parent822de6e9e1b87e2ed3571e7166281fa622c28c02 (diff)
Cleanup: Rename GPU_* functions to make more sense
* Remove GPU_link_changed which is unused. * Remove all GPU link function that are not used anymore. * GPU_uniform_buffer is now GPU_uniform. * GPU_texture_ramp is now GPU_color_band. * GPU_uniform is now GPU_constant.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_material.h9
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c96
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h1
-rw-r--r--source/blender/gpu/intern/gpu_shader.c7
4 files changed, 10 insertions, 103 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 6b0296361ec..5bbe9d6d904 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -224,16 +224,11 @@ typedef enum GPUDynamicType {
} GPUDynamicType;
GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
+GPUNodeLink *GPU_constant(float *num);
GPUNodeLink *GPU_uniform(float *num);
-GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data);
-GPUNodeLink *GPU_uniform_buffer(float *num, GPUType gputype);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data);
-GPUNodeLink *GPU_cube_map(struct Image *ima, struct ImageUser *iuser, bool is_data);
-GPUNodeLink *GPU_image_preview(struct PreviewImage *prv);
-GPUNodeLink *GPU_texture_ramp(GPUMaterial *mat, int size, float *pixels, float *layer);
-GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, GPUDynamicType dynamictype, void *data);
+GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer);
GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
-GPUNodeLink *GPU_opengl_builtin(GPUOpenGLBuiltin builtin);
void GPU_node_link_set_type(GPUNodeLink *link, GPUType type);
bool GPU_link(GPUMaterial *mat, const char *name, ...);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 289befe674e..0eee9bf6ead 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1447,19 +1447,19 @@ static GPUNodeLink *gpu_uniformbuffer_link(
case SOCK_FLOAT:
{
bNodeSocketValueFloat *socket_data = socket->default_value;
- link = GPU_uniform_buffer(&socket_data->value, GPU_FLOAT);
+ link = GPU_uniform(&socket_data->value);
break;
}
case SOCK_VECTOR:
{
bNodeSocketValueRGBA *socket_data = socket->default_value;
- link = GPU_uniform_buffer(socket_data->value, GPU_VEC3);
+ link = GPU_uniform(socket_data->value);
break;
}
case SOCK_RGBA:
{
bNodeSocketValueRGBA *socket_data = socket->default_value;
- link = GPU_uniform_buffer(socket_data->value, GPU_VEC4);
+ link = GPU_uniform(socket_data->value);
break;
}
default:
@@ -1612,7 +1612,7 @@ GPUNodeLink *GPU_attribute(const CustomDataType type, const char *name)
return link;
}
-GPUNodeLink *GPU_uniform(float *num)
+GPUNodeLink *GPU_constant(float *num)
{
GPUNodeLink *link = GPU_node_link_create();
@@ -1622,30 +1622,13 @@ GPUNodeLink *GPU_uniform(float *num)
return link;
}
-GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data)
-{
- GPUNodeLink *link = GPU_node_link_create();
-
- link->ptr1 = num;
- link->ptr2 = data;
- link->dynamic = true;
- link->dynamictype = dynamictype;
-
-
- return link;
-}
-
-/**
- * Add uniform to UBO struct of GPUMaterial.
- */
-GPUNodeLink *GPU_uniform_buffer(float *num, GPUType gputype)
+GPUNodeLink *GPU_uniform(float *num)
{
GPUNodeLink *link = GPU_node_link_create();
link->ptr1 = num;
link->ptr2 = NULL;
link->dynamic = true;
link->dynamictype = GPU_DYNAMIC_UBO;
- link->type = gputype;
return link;
}
@@ -1662,53 +1645,18 @@ GPUNodeLink *GPU_image(Image *ima, ImageUser *iuser, bool is_data)
return link;
}
-GPUNodeLink *GPU_cube_map(Image *ima, ImageUser *iuser, bool is_data)
-{
- GPUNodeLink *link = GPU_node_link_create();
-
- link->image = GPU_NODE_LINK_IMAGE_CUBE_MAP;
- link->ptr1 = ima;
- link->ptr2 = iuser;
- link->image_isdata = is_data;
-
- return link;
-}
-
-GPUNodeLink *GPU_image_preview(PreviewImage *prv)
-{
- GPUNodeLink *link = GPU_node_link_create();
-
- link->image = GPU_NODE_LINK_IMAGE_PREVIEW;
- link->ptr1 = prv;
-
- return link;
-}
-
-
-GPUNodeLink *GPU_texture_ramp(GPUMaterial *mat, int size, float *pixels, float *row)
+GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer)
{
GPUNodeLink *link = GPU_node_link_create();
link->texture = true;
- link->ptr1 = gpu_material_ramp_texture_row_set(mat, size, pixels, row);
+ link->ptr1 = gpu_material_ramp_texture_row_set(mat, size, pixels, layer);
MEM_freeN(pixels);
return link;
}
-GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, GPUDynamicType dynamictype, void *data)
-{
- GPUNodeLink *link = GPU_node_link_create();
-
- link->dynamic = true;
- link->dynamictex = tex;
- link->dynamictype = dynamictype;
- link->ptr2 = data;
-
- return link;
-}
-
GPUNodeLink *GPU_builtin(GPUBuiltin builtin)
{
GPUNodeLink *link = GPU_node_link_create();
@@ -1718,15 +1666,6 @@ GPUNodeLink *GPU_builtin(GPUBuiltin builtin)
return link;
}
-GPUNodeLink *GPU_opengl_builtin(GPUOpenGLBuiltin builtin)
-{
- GPUNodeLink *link = GPU_node_link_create();
-
- link->oglbuiltin = builtin;
-
- return link;
-}
-
bool GPU_link(GPUMaterial *mat, const char *name, ...)
{
GPUNode *node;
@@ -1826,27 +1765,6 @@ bool GPU_stack_link(GPUMaterial *material, bNode *bnode, const char *name, GPUNo
return true;
}
-int GPU_link_changed(GPUNodeLink *link)
-{
- GPUNode *node;
- GPUInput *input;
- const char *name;
-
- if (link->output) {
- node = link->output->node;
- name = node->name;
-
- if (STREQ(name, "set_value") || STREQ(name, "set_rgb")) {
- input = node->inputs.first;
- return (input->link != NULL);
- }
-
- return 1;
- }
- else
- return 0;
-}
-
GPUNodeLink *GPU_uniformbuffer_link_out(GPUMaterial *mat, bNode *node, GPUNodeStack *stack, const int index)
{
return gpu_uniformbuffer_link(mat, node, stack, index, SOCK_OUT);
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 77e6e5cf4ef..21dcaf6b591 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -198,6 +198,5 @@ void gpu_codegen_exit(void);
const char *GPU_builtin_name(GPUBuiltin builtin);
void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node);
struct GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, float *row);
-int GPU_link_changed(struct GPUNodeLink *link);
#endif
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 6560b5e7f13..b812cf61483 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -239,13 +239,8 @@ static void gpu_shader_standard_defines(
bool use_opensubdiv)
{
/* some useful defines to detect GPU type */
- if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) {
+ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY))
strcat(defines, "#define GPU_ATI\n");
- if (GLEW_VERSION_3_0) {
- /* TODO(merwin): revisit this version check; GLEW_VERSION_3_0 means GL 3.0 or newer */
- strcat(defines, "#define CLIP_WORKAROUND\n");
- }
- }
else if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY))
strcat(defines, "#define GPU_NVIDIA\n");
else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY))