diff options
Diffstat (limited to 'source/blender/nodes/shader')
4 files changed, 23 insertions, 15 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.c b/source/blender/nodes/shader/nodes/node_shader_blackbody.c index 76291df41bc..e57f5e0d6cf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.c +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.c @@ -40,12 +40,15 @@ static bNodeSocketTemplate sh_node_blackbody_out[] = { static int node_shader_gpu_blackbody(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - const int size = 256; + const int size = CM_TABLE + 1; float *data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture"); blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f); - return GPU_stack_link(mat, node, "node_blackbody", in, out, GPU_texture(size, data)); + float layer; + GPUNodeLink *ramp_texture = GPU_texture_ramp(mat, size, data, &layer); + + return GPU_stack_link(mat, node, "node_blackbody", in, out, ramp_texture, GPU_uniform(&layer)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c index d5932ff233a..21bdc3cd0d8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.c +++ b/source/blender/nodes/shader/nodes/node_shader_curves.c @@ -62,11 +62,13 @@ static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - float *array; + float *array, layer; int size; curvemapping_table_RGBA(node->storage, &array, &size); - return GPU_stack_link(mat, node, "curves_vec", in, out, GPU_texture(size, array)); + GPUNodeLink *tex = GPU_texture_ramp(mat, size, array, &layer); + + return GPU_stack_link(mat, node, "curves_vec", in, out, tex, GPU_uniform(&layer)); } void register_node_type_sh_curve_vec(void) @@ -119,12 +121,14 @@ static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - float *array; + float *array, layer; int size; curvemapping_initialize(node->storage); curvemapping_table_RGBA(node->storage, &array, &size); - return GPU_stack_link(mat, node, "curves_rgb", in, out, GPU_texture(size, array)); + GPUNodeLink *tex = GPU_texture_ramp(mat, size, array, &layer); + + return GPU_stack_link(mat, node, "curves_rgb", in, out, tex, GPU_uniform(&layer)); } void register_node_type_sh_curve_rgb(void) diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index b6581cb18cb..00940b5acaf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -65,11 +65,12 @@ static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node) static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - float *array; + float *array, layer; int size; BKE_colorband_evaluate_table_rgba(node->storage, &array, &size); - return GPU_stack_link(mat, node, "valtorgb", in, out, GPU_texture(size, array)); + GPUNodeLink *tex = GPU_texture_ramp(mat, size, array, &layer); + return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_uniform(&layer)); } void register_node_type_sh_valtorgb(void) diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c index a88a7ebb21a..c946c42f9af 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c @@ -132,19 +132,19 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat, bNode *node, bNod } /* Create blackbody spectrum. */ - GPUNodeLink *spectrummap; + const int size = CM_TABLE + 1; + float *data, layer; if (use_blackbody) { - const int size = 256; - float *data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture"); + data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture"); blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f); - spectrummap = GPU_texture(size, data); } else { - float *data = MEM_callocN(sizeof(float) * 4, "blackbody black"); - spectrummap = GPU_texture(1, data); + data = MEM_callocN(sizeof(float) * size * 4, "blackbody black"); } + GPUNodeLink *spectrummap = GPU_texture_ramp(mat, size, data, &layer); - return GPU_stack_link(mat, node, "node_volume_principled", in, out, density, color, temperature, spectrummap); + return GPU_stack_link(mat, node, "node_volume_principled", in, out, density, color, temperature, spectrummap, + GPU_uniform(&layer)); } /* node type definition */ |