diff options
3 files changed, 25 insertions, 23 deletions
diff --git a/source/blender/draw/intern/draw_shader.c b/source/blender/draw/intern/draw_shader.c index ba348d10c83..ffbae500e65 100644 --- a/source/blender/draw/intern/draw_shader.c +++ b/source/blender/draw/intern/draw_shader.c @@ -53,19 +53,7 @@ static GPUShader *hair_refine_shader_transform_feedback_create( static GPUShader *hair_refine_shader_transform_feedback_workaround_create( ParticleRefineShader UNUSED(refinement)) { - GPUShader *sh = NULL; - - char *shader_src = BLI_string_joinN(datatoc_common_hair_lib_glsl, - datatoc_common_hair_refine_vert_glsl); - sh = DRW_shader_create(shader_src, - NULL, - datatoc_gpu_shader_3D_smooth_color_frag_glsl, - "#define blender_srgb_to_framebuffer_space(a) a\n" - "#define HAIR_PHASE_SUBDIV\n" - "#define TF_WORKAROUND\n"); - MEM_freeN(shader_src); - - return sh; + return GPU_shader_create_from_info_name("draw_hair_refine_transform_feedback_workaround"); } GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement, diff --git a/source/blender/draw/intern/shaders/common_hair_refine_vert.glsl b/source/blender/draw/intern/shaders/common_hair_refine_vert.glsl index 2eccae5bceb..a615dbd526b 100644 --- a/source/blender/draw/intern/shaders/common_hair_refine_vert.glsl +++ b/source/blender/draw/intern/shaders/common_hair_refine_vert.glsl @@ -1,13 +1,4 @@ - -/* To be compiled with common_hair_lib.glsl */ - -out vec4 finalColor; - -#ifdef TF_WORKAROUND -uniform int targetWidth; -uniform int targetHeight; -uniform int idOffset; -#endif +#pragma BLENDER_REQUIRE(common_hair_lib.glsl) void main(void) { diff --git a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh index b80537f9deb..b477520bb97 100644 --- a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh +++ b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh @@ -24,3 +24,26 @@ GPU_SHADER_CREATE_INFO(draw_hair_refine_compute) .compute_source("common_hair_refine_comp.glsl") .define("HAIR_PHASE_SUBDIV") .do_static_compilation(true); + +GPU_SHADER_INTERFACE_INFO(draw_hair_refine_transform_feedback_workaround_iface, "") + .smooth(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(draw_hair_refine_transform_feedback_workaround) + .define("srgbTarget", "false") + .define("blender_srgb_to_framebuffer_space(a)", "a") + .define("HAIR_PHASE_SUBDIV") + .define("TF_WORKAROUND") + + /* Move these to "draw_hair"? */ + .sampler(0, ImageType::UINT_BUFFER, "hairStrandBuffer") + .sampler(1, ImageType::UINT_BUFFER, "hairStrandSegBuffer") + + .push_constant(Type::INT, "targetWidth") + .push_constant(Type::INT, "targetHeight") + .push_constant(Type::INT, "idOffset") + .vertex_out(draw_hair_refine_transform_feedback_workaround_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("common_hair_refine_vert.glsl") + .fragment_source("gpu_shader_3D_smooth_color_frag.glsl") + .additional_info("draw_hair") + .do_static_compilation(true); |