diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-01-14 19:26:35 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-01-14 19:26:35 +0300 |
commit | d51dcaf1041d2bda093b1a6bc688fd4237da0e61 (patch) | |
tree | bb2f9eb3b2f6374989370da08b3e9e2e0ea6cea9 /source | |
parent | 39d5d11e022a39383103f1e46dd74dbf5a36a850 (diff) |
Fix T73116 Crash on startup caused by implicit conversion in glsl
Old drivers does not support this. Promote everything to uint.
Diffstat (limited to 'source')
3 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/outline_prepass_frag.glsl b/source/blender/draw/engines/overlay/shaders/outline_prepass_frag.glsl index 8ef89b89eb3..f6e3724eb51 100644 --- a/source/blender/draw/engines/overlay/shaders/outline_prepass_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/outline_prepass_frag.glsl @@ -1,10 +1,10 @@ -flat in int objectId; +flat in uint objectId; /* using uint because 16bit uint can contain more ids than int. */ out uint outId; void main() { - outId = uint(objectId); + outId = objectId; } diff --git a/source/blender/draw/engines/overlay/shaders/outline_prepass_geom.glsl b/source/blender/draw/engines/overlay/shaders/outline_prepass_geom.glsl index b32913dcd60..282799e1660 100644 --- a/source/blender/draw/engines/overlay/shaders/outline_prepass_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/outline_prepass_geom.glsl @@ -3,9 +3,9 @@ layout(lines_adjacency) in; layout(line_strip, max_vertices = 2) out; in vec3 vPos[]; -in int objectId_g[]; +in uint objectId_g[]; -flat out int objectId; +flat out uint objectId; void vert_from_gl_in(int v) { diff --git a/source/blender/draw/engines/overlay/shaders/outline_prepass_vert.glsl b/source/blender/draw/engines/overlay/shaders/outline_prepass_vert.glsl index 8b9854b2d3e..984e55b0c46 100644 --- a/source/blender/draw/engines/overlay/shaders/outline_prepass_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/outline_prepass_vert.glsl @@ -5,14 +5,14 @@ in vec3 pos; #ifdef USE_GEOM out vec3 vPos; -out int objectId_g; +out uint objectId_g; # define objectId objectId_g #else -flat out int objectId; +flat out uint objectId; #endif -int outline_colorid_get(void) +uint outline_colorid_get(void) { int flag = int(abs(ObjectInfo.w)); bool is_from_dupli = (flag & DRW_BASE_FROM_DUPLI) != 0; @@ -20,24 +20,24 @@ int outline_colorid_get(void) if (is_from_dupli) { if (isTransform) { - return 0; /* colorTransform */ + return 0u; /* colorTransform */ } else { - return 2; /* colorDupliSelect */ + return 2u; /* colorDupliSelect */ } } if (isTransform) { - return 0; /* colorTransform */ + return 0u; /* colorTransform */ } else if (is_active) { - return 3; /* colorActive */ + return 3u; /* colorActive */ } else { - return 1; /* colorSelect */ + return 1u; /* colorSelect */ } - return 0; + return 0u; } /* Replace top 2 bits (of the 16bit output) by outlineId. @@ -56,13 +56,13 @@ void main() gl_Position.z -= 1e-3; /* ID 0 is nothing (background) */ - objectId = resource_handle + 1; + objectId = uint(resource_handle + 1); /* Should be 2 bits only [0..3]. */ - int outline_id = outline_colorid_get(); + uint outline_id = outline_colorid_get(); /* Combine for 16bit uint target. */ - objectId = (outline_id << 14) | ((objectId << SHIFT) >> SHIFT); + objectId = (outline_id << 14u) | ((objectId << SHIFT) >> SHIFT); #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); |