From bdd44564c9c1e22396fc8e30b6b6d831add02b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 7 Nov 2018 22:16:03 +0100 Subject: GPU: Cleanups: Remove GPUMatType, Vectorize / MADD some operations --- .../nodes/shader/nodes/node_shader_bsdf_principled.c | 3 +-- .../blender/nodes/shader/nodes/node_shader_tex_coord.c | 17 ++++------------- 2 files changed, 5 insertions(+), 15 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c index 16d35c7003a..c628fd7a7f5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c @@ -103,8 +103,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE sss_scale = in[2].link; } else { - float one[3] = {1.0f, 1.0f, 1.0f}; - GPU_link(mat, "set_rgb", GPU_constant((float *)one), &sss_scale); + GPU_link(mat, "set_rgb_one", &sss_scale); } bool use_diffuse = socket_not_one(4) && socket_not_one(15); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index 002fdc6d3ae..58fea60f9f5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -46,22 +46,13 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, bNodeExecDat { GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ""); - GPUMatType type = GPU_Material_get_type(mat); GPU_link(mat, "generated_from_orco", orco, &orco); - if (type == GPU_MATERIAL_TYPE_WORLD) { - return GPU_stack_link(mat, node, "node_tex_coord_background", in, out, - GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), - GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), - GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface); - } - else { - return GPU_stack_link(mat, node, "node_tex_coord", in, out, - GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), - GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), - GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface); - } + return GPU_stack_link(mat, node, "node_tex_coord", in, out, + GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), + GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), + GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface); } /* node type definition */ -- cgit v1.2.3