[Bf-blender-cvs] [d6c1b15527b] temp-texture-painting-gpu: Use 16F
Jeroen Bakker
noreply at git.blender.org
Tue Oct 4 15:42:40 CEST 2022
Commit: d6c1b15527b6f938787b50f8cfadc9d9f82a4ab1
Author: Jeroen Bakker
Date: Tue Oct 4 15:42:33 2022 +0200
Branches: temp-texture-painting-gpu
https://developer.blender.org/rBd6c1b15527b6f938787b50f8cfadc9d9f82a4ab1
Use 16F
===================================================================
M source/blender/editors/sculpt_paint/sculpt_paint_image.cc
M source/blender/gpu/shaders/sculpt_paint/infos/sculpt_paint_image_info.hh
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
index 9ad88f95fcf..99353b934fd 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
@@ -632,7 +632,7 @@ struct GPUSculptPaintData {
GPU_texture_free(tile_texture);
tile_texture = nullptr;
}
- tile_texture = GPU_texture_create_2d(__func__, UNPACK2(resolution), 1, GPU_RGBA32F, nullptr);
+ tile_texture = GPU_texture_create_2d(__func__, UNPACK2(resolution), 1, GPU_RGBA16F, nullptr);
}
}
};
@@ -668,6 +668,8 @@ static BrushVariationFlags determine_shader_variation_flags(const Brush &brush)
return result;
}
+// TODO: Currently only working on a copy of the actual data. In most use cases this isn't needed
+// and can we paint directly on the target gpu target.
static void gpu_painting_paint_step(TexturePaintingUserData &data,
GPUSculptPaintData &batches,
TileNumber tile_number,
@@ -691,7 +693,7 @@ static void gpu_painting_paint_step(TexturePaintingUserData &data,
/* Only clear the texture when it is used for the first time. */
if (texture_needs_clearing) {
// Copy from image buffer?
- GPU_texture_clear(batches.tile_texture, GPU_DATA_FLOAT, float4(0.0f, 0.0f, 0.0f, 0.0f));
+ GPU_texture_clear(batches.tile_texture, GPU_DATA_FLOAT, float4(0.0f, 0.0f, 0.0f, 1.0f));
texture_needs_clearing = false;
}
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
index 97eed0237f4..e42666ac578 100644
--- 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
@@ -9,7 +9,7 @@
GPU_SHADER_CREATE_INFO(sculpt_paint_image_compute)
.local_group_size(1, 1, 1)
- .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_img")
+ .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_img")
.storage_buf(0, Qualifier::READ, "PackedPixelRow", "pixel_row_buf[]")
.storage_buf(1, Qualifier::READ, "TrianglePaintInput", "paint_input[]")
.storage_buf(2, Qualifier::READ, "vec3", "vert_coord_buf[]")
@@ -22,7 +22,7 @@ GPU_SHADER_CREATE_INFO(sculpt_paint_image_compute)
GPU_SHADER_CREATE_INFO(sculpt_paint_image_merge_compute)
.local_group_size(1, 1, 1)
- .image(0, GPU_RGBA32F, Qualifier::READ, ImageType::FLOAT_2D, "in_paint_img")
+ .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_paint_img")
.image(1, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_img")
.compute_source("sculpt_paint_image_merge_comp.glsl")
.typedef_source("GPU_sculpt_shader_shared.h")
More information about the Bf-blender-cvs
mailing list