diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_node_graph.c | 17 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_node_graph.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/shaders/material/gpu_shader_material_virtual_camera.glsl | 7 |
3 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 17136308cdd..553ca219617 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -20,6 +20,7 @@ #include "BLI_string.h" #include "BLI_utildefines.h" +#include "GPU_framebuffer.h" #include "GPU_texture.h" #include "GPU_vertex_format.h" @@ -115,6 +116,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType link->users++; break; case GPU_NODE_LINK_IMAGE: + case GPU_NODE_LINK_IMAGE_CAMERA: case GPU_NODE_LINK_IMAGE_TILED: case GPU_NODE_LINK_IMAGE_SKY: case GPU_NODE_LINK_COLORBAND: @@ -635,15 +637,12 @@ GPUNodeLink *GPU_image_camera(GPUMaterial *mat, Camera *camera, eGPUSamplerState { GPUNodeGraph *graph = gpu_material_node_graph(mat); GPUNodeLink *link = gpu_node_link_create(); - link->link_type = GPU_NODE_LINK_IMAGE; - link->texture = gpu_node_graph_add_texture(graph, - NULL, - NULL, - NULL, - NULL, - &camera->runtime.virtual_display_texture, - link->link_type, - sampler_state); + GPUTexture *texture = camera->runtime.virtual_camera_stage ? + NULL : + GPU_offscreen_color_texture(camera->runtime.virtual_display_texture); + link->link_type = GPU_NODE_LINK_IMAGE_CAMERA; + link->texture = gpu_node_graph_add_texture( + graph, NULL, NULL, NULL, NULL, &texture, link->link_type, sampler_state); return link; } diff --git a/source/blender/gpu/intern/gpu_node_graph.h b/source/blender/gpu/intern/gpu_node_graph.h index de0a0687b13..6417f7d0a47 100644 --- a/source/blender/gpu/intern/gpu_node_graph.h +++ b/source/blender/gpu/intern/gpu_node_graph.h @@ -50,6 +50,7 @@ typedef enum { GPU_NODE_LINK_IMAGE_TILED, GPU_NODE_LINK_IMAGE_TILED_MAPPING, GPU_NODE_LINK_IMAGE_SKY, + GPU_NODE_LINK_IMAGE_CAMERA, GPU_NODE_LINK_OUTPUT, GPU_NODE_LINK_UNIFORM, GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN, diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_virtual_camera.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_virtual_camera.glsl index 05bc6f90686..26d15292e6a 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_virtual_camera.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_virtual_camera.glsl @@ -4,8 +4,13 @@ void node_virtual_camera_empty(vec3 co, out vec4 color, out float alpha) alpha = 0.0; } -void node_virtual_camera(vec3 co, sampler2D ima, out vec4 color, out float alpha) +void node_virtual_camera(vec3 co, sampler2D ima, float mix, out vec4 color, out float alpha) { + if (mix == 1.0) { + node_virtual_camera_empty(co, color, alpha); + return; + } + color = texture(ima, co.xy); alpha = color.a; } |