diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl index cb34515a960..382323b9609 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl @@ -219,10 +219,10 @@ uniform float strokeIndexOffset = 0.0; * Note that we are rendering quad instances and not using any index buffer (except for fills). */ /* x is material index, y is stroke_id, z is point_id, w is aspect & rotation & hardness packed. */ -in ivec4 ma; -in ivec4 ma1; -in ivec4 ma2; -in ivec4 ma3; +in vec4 ma; +in vec4 ma1; +in vec4 ma2; +in vec4 ma3; /* Position contains thickness in 4th component. */ in vec4 pos; /* Prev adj vert */ in vec4 pos1; /* Current edge */ @@ -236,17 +236,17 @@ in vec4 col2; in vec4 fcol1; /* WARNING: Max attrib count is actually 14 because OSX OpenGL implementation * considers gl_VertexID and gl_InstanceID as vertex attribute. (see T74536) */ -# define stroke_id1 ma1.y -# define point_id1 ma1.z +# define stroke_id1 int(ma1.y) +# define point_id1 int(ma1.z) # define thickness1 pos1.w # define thickness2 pos2.w # define strength1 uv1.w # define strength2 uv2.w /* Packed! need to be decoded. */ -# define hardness1 ma1.w -# define hardness2 ma2.w -# define uvrot1 ma1.w -# define aspect1 ma1.w +# define hardness1 int(ma1.w) +# define hardness2 int(ma2.w) +# define uvrot1 int(ma1.w) +# define aspect1 int(ma1.w) vec2 decode_aspect(int packed_data) { @@ -362,7 +362,7 @@ void color_output(vec4 stroke_col, vec4 vert_col, float vert_strength, float mix void stroke_vertex() { - int m = ma1.x; + int m = int(ma1.x); bool is_dot = false; bool is_squares = false; @@ -374,13 +374,13 @@ void stroke_vertex() # endif /* Special Case. Stroke with single vert are rendered as dots. Do not discard them. */ - if (!is_dot && ma.x == -1 && ma2.x == -1) { + if (!is_dot && ma.x == -1.0 && ma2.x == -1.0) { is_dot = true; is_squares = false; } /* Enpoints, we discard the vertices. */ - if (ma1.x == -1 || (!is_dot && ma2.x == -1)) { + if (ma1.x == -1.0 || (!is_dot && ma2.x == -1.0)) { discard_vert(); return; } @@ -538,7 +538,7 @@ void fill_vertex() finalPos = wpos; # ifdef GP_MATERIAL_BUFFER_LEN - int m = ma1.x; + int m = int(ma1.x); vec4 fill_col = MATERIAL(m).fill_color; float mix_tex = MATERIAL(m).fill_texture_mix; diff --git a/source/blender/draw/engines/overlay/shaders/edit_gpencil_vert.glsl b/source/blender/draw/engines/overlay/shaders/edit_gpencil_vert.glsl index 3a52e0c73b7..cb03ad44615 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_gpencil_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_gpencil_vert.glsl @@ -9,7 +9,7 @@ uniform vec4 gpEditColor; uniform sampler1D weightTex; in vec3 pos; -in int ma; +in float ma; in uint vflag; in float weight; @@ -93,7 +93,7 @@ void main() #endif /* Discard unwanted padding vertices. */ - if (ma == -1 || (is_multiframe && !doMultiframe)) { + if (ma == -1.0 || (is_multiframe && !doMultiframe)) { discard_vert(); } diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index 349eb6b00ae..e40697f8c8a 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -167,7 +167,7 @@ void DRW_gpencil_batch_cache_free(bGPdata *gpd) /* MUST match the format below. */ typedef struct gpStrokeVert { - int32_t mat, stroke_id, point_id, packed_asp_hard_rot; + float mat, stroke_id, point_id, packed_asp_hard_rot; /** Position and thickness packed in the same attribute. */ float pos[3], thickness; /** UV and strength packed in the same attribute. */ @@ -178,7 +178,7 @@ static GPUVertFormat *gpencil_stroke_format(void) { static GPUVertFormat format = {0}; if (format.attr_len == 0) { - GPU_vertformat_attr_add(&format, "ma", GPU_COMP_I32, 4, GPU_FETCH_INT); + GPU_vertformat_attr_add(&format, "ma", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); GPU_vertformat_attr_add(&format, "uv", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); /* IMPORTANT: This means having only 4 attributes to fit into GPU module limit of 16 attrib. */