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
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-04-24 19:18:17 +0300
committermano-wii <germano.costa@ig.com.br>2019-04-24 19:19:02 +0300
commitfa4201f82da5cd605af88195d1d98a256c678782 (patch)
tree1ece4b1bb4bc2dbccb5339e0af13cdab2d32f120 /source/blender/draw/intern/draw_cache_impl_particles.c
parentca41548626f5f49a769dc018ab54d7ed06c05489 (diff)
Fix T62701: Hair edit mode crashes on some old AMD Radeon drivers.
The crash is related to the format, but the real reason is unknown.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_particles.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index e998b17a44f..87ec2f19481 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -99,7 +99,7 @@ typedef struct HairAttributeID {
typedef struct EditStrandData {
float pos[3];
- uchar color;
+ float color;
} EditStrandData;
static GPUVertFormat *edit_points_vert_format_get(uint *r_pos_id, uint *r_color_id)
@@ -110,7 +110,7 @@ static GPUVertFormat *edit_points_vert_format_get(uint *r_pos_id, uint *r_color_
/* Keep in sync with EditStrandData */
pos_id = GPU_vertformat_attr_add(&edit_point_format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
color_id = GPU_vertformat_attr_add(
- &edit_point_format, "color", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ &edit_point_format, "color", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
}
*r_pos_id = pos_id;
*r_color_id = color_id;
@@ -693,12 +693,12 @@ static int particle_batch_cache_fill_segments_edit(
float strand_t = (float)(j) / path->segments;
if (particle) {
float weight = particle_key_weight(particle, i, strand_t);
- /* NaN or unclamped become 0xFF */
- seg_data->color = (uchar)((weight <= 1.0f) ? 0xFE * weight : 0xFF);
+ /* NaN or unclamped become 1.0f */
+ seg_data->color = (weight < 1.0f) ? weight : 1.0f;
}
else {
float selected = particle_key_select_ratio(edit, i, strand_t);
- seg_data->color = (uchar)(0xFF * selected);
+ seg_data->color = selected;
}
GPU_indexbuf_add_generic_vert(elb, curr_point);
curr_point++;
@@ -1565,7 +1565,7 @@ static void particle_batch_cache_ensure_edit_inner_pos(PTCacheEdit *edit,
const PTCacheEditPoint *point = &edit->points[point_index];
for (int key_index = 0; key_index < point->totkey - 1; key_index++) {
PTCacheEditKey *key = &point->keys[key_index];
- uchar color = (key->flag & PEK_SELECT) ? 0xFF : 0x00;
+ float color = (key->flag & PEK_SELECT) ? 1.0f : 0.0f;
GPU_vertbuf_attr_set(cache->edit_inner_pos, pos_id, global_key_index, key->world_co);
GPU_vertbuf_attr_set(cache->edit_inner_pos, color_id, global_key_index, &color);
global_key_index++;
@@ -1611,7 +1611,8 @@ static void particle_batch_cache_ensure_edit_tip_pos(PTCacheEdit *edit, Particle
for (int point_index = 0; point_index < edit->totpoint; point_index++) {
const PTCacheEditPoint *point = &edit->points[point_index];
PTCacheEditKey *key = &point->keys[point->totkey - 1];
- uchar color = (key->flag & PEK_SELECT) ? 0xFF : 0x00;
+ float color = (key->flag & PEK_SELECT) ? 0.0f : 1.0f;
+
GPU_vertbuf_attr_set(cache->edit_tip_pos, pos_id, point_index, key->world_co);
GPU_vertbuf_attr_set(cache->edit_tip_pos, color_id, point_index, &color);
}