diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-09-27 16:34:10 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-09-27 16:35:53 +0300 |
commit | 26dc50ac3414a54b13150b8d31ab08bcd71a72a3 (patch) | |
tree | 2f22e64a1c2e1daaeea65cc003d4b727017da3df /source/blender/gpu/shaders | |
parent | 1cbfe0463879fb3dde7e10f151b5ef24008bd211 (diff) |
SculptPaint: Use GPU shaders.
This is WIP/PoC patch to check how we could increase code reusability between
CPU and GPU versions.
Differential Revision: https://developer.blender.org/D16083
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/sculpt_paint/infos/sculpt_paint_image_info.hh | 17 | ||||
-rw-r--r-- | source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl | 12 |
2 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/sculpt_paint/infos/sculpt_paint_image_info.hh b/source/blender/gpu/shaders/sculpt_paint/infos/sculpt_paint_image_info.hh new file mode 100644 index 00000000000..bc1f3b4ebf0 --- /dev/null +++ b/source/blender/gpu/shaders/sculpt_paint/infos/sculpt_paint_image_info.hh @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2022 Blender Foundation. All rights reserved. */ + +/** \file + * \ingroup gpu + */ + +#include "gpu_shader_create_info.hh" + +GPU_SHADER_CREATE_INFO(sculpt_paint_image_compute) + .local_group_size(1, 1, 1) + .storage_buf(0, Qualifier::READ, "PackedPixelRow", "pixel_row_buf[]") + .storage_buf(1, Qualifier::READ, "TrianglePaintInput", "paint_input[]") + .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_img") + .compute_source("sculpt_paint_image_comp.glsl") + .typedef_source("GPU_sculpt_shader_shared.h") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl b/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl new file mode 100644 index 00000000000..9954967c87e --- /dev/null +++ b/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl @@ -0,0 +1,12 @@ +void main() +{ + PackedPixelRow row = pixel_row_buf[gl_GlobalInvocationID.x]; + ivec2 image_coord = PIXEL_ROW_START_IMAGE_COORD(row); + + uint row_len = PIXEL_ROW_LEN(row); + + for (int i = 0; i < row_len; i++) { + + imageStore(out_img, image_coord + ivec2(i, 0), float4(1.0, 0.0, 1.0, 1.0)); + } +}
\ No newline at end of file |