Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2022-06-24 14:03:29 +0300
committerJeroen Bakker <jeroen@blender.org>2022-06-24 14:03:29 +0300
commit7927ac2fbe52329f479d13de2714d52536fff7a8 (patch)
tree3dfcf457e3e0ae0f0876de5845ad02b73bcb9160 /source
parent79973494eca596bc633ca0d2da30d5e19ccd1733 (diff)
Fix T99129: Eevee Hair Info Length not working (old particle hair).
When using the old particle hair with the hair info length it wasn't working with AMD GPUs. The reason was that the drw_curves uniform buffer wasn't initialized what made the shader select the incorrect length.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/draw_hair.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_hair.cc b/source/blender/draw/intern/draw_hair.cc
index 0a3c16e0d71..dc791314333 100644
--- a/source/blender/draw/intern/draw_hair.cc
+++ b/source/blender/draw/intern/draw_hair.cc
@@ -27,8 +27,11 @@
#include "GPU_texture.h"
#include "GPU_vertex_buffer.h"
+#include "DRW_gpu_wrapper.hh"
+
#include "draw_hair_private.h"
#include "draw_shader.h"
+#include "draw_shader_shared.h"
#ifndef __APPLE__
# define USE_TRANSFORM_FEEDBACK
@@ -65,6 +68,7 @@ static int g_tf_target_height;
static GPUVertBuf *g_dummy_vbo = nullptr;
static GPUTexture *g_dummy_texture = nullptr;
static DRWPass *g_tf_pass; /* XXX can be a problem with multiple DRWManager in the future */
+static blender::draw::UniformBuffer<CurvesInfos> *g_dummy_curves_info = nullptr;
static GPUShader *hair_refine_shader_get(ParticleRefineShader refinement)
{
@@ -93,6 +97,13 @@ void DRW_hair_init(void)
GPU_vertbuf_use(g_dummy_vbo);
g_dummy_texture = GPU_texture_create_from_vertbuf("hair_dummy_attr", g_dummy_vbo);
+
+ g_dummy_curves_info = MEM_new<blender::draw::UniformBuffer<CurvesInfos>>(
+ "g_dummy_curves_info");
+ memset(g_dummy_curves_info->is_point_attribute,
+ 0,
+ sizeof(g_dummy_curves_info->is_point_attribute));
+ g_dummy_curves_info->push_update();
}
}
@@ -276,6 +287,8 @@ DRWShadingGroup *DRW_shgroup_hair_create_sub(Object *object,
if (hair_cache->length_tex) {
DRW_shgroup_uniform_texture(shgrp, "l", hair_cache->length_tex);
}
+
+ DRW_shgroup_uniform_block(shgrp, "drw_curves", *g_dummy_curves_info);
DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1);
DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res);
DRW_shgroup_uniform_float_copy(shgrp, "hairRadShape", hair_rad_shape);
@@ -374,4 +387,5 @@ void DRW_hair_free(void)
{
GPU_VERTBUF_DISCARD_SAFE(g_dummy_vbo);
DRW_TEXTURE_FREE_SAFE(g_dummy_texture);
+ MEM_delete(g_dummy_curves_info);
}