diff options
Diffstat (limited to 'source/blender/draw')
20 files changed, 67 insertions, 48 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_armature.cc b/source/blender/draw/engines/overlay/overlay_armature.cc index 1e10fc7cd20..494fd3739d7 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.cc +++ b/source/blender/draw/engines/overlay/overlay_armature.cc @@ -140,11 +140,11 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) pd->armature_bone_select_act_grp = grp = DRW_shgroup_create(sh, psl->armature_bone_select_ps); float4 color = {0.0f, 0.0f, 0.0f, alpha}; - DRW_shgroup_uniform_vec4_copy(grp, "color", color); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", color); pd->armature_bone_select_grp = grp = DRW_shgroup_create(sh, psl->armature_bone_select_ps); color = {0.0f, 0.0f, 0.0f, powf(alpha, 4)}; - DRW_shgroup_uniform_vec4_copy(grp, "color", color); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", color); } for (int i = 0; i < 2; i++) { diff --git a/source/blender/draw/engines/overlay/overlay_background.cc b/source/blender/draw/engines/overlay/overlay_background.cc index e8bae74c70a..2442efc033e 100644 --- a/source/blender/draw/engines/overlay/overlay_background.cc +++ b/source/blender/draw/engines/overlay/overlay_background.cc @@ -89,7 +89,7 @@ void OVERLAY_background_cache_init(OVERLAY_Data *vedata) GPUShader *sh = OVERLAY_shader_clipbound(); DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->clipping_frustum_ps); - DRW_shgroup_uniform_vec4_copy(grp, "color", G_draw.block.color_clipping_border); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", G_draw.block.color_clipping_border); DRW_shgroup_uniform_vec3(grp, "boundbox", &bb->vec[0][0], 8); struct GPUBatch *cube = DRW_cache_cube_get(); diff --git a/source/blender/draw/engines/overlay/overlay_edit_text.cc b/source/blender/draw/engines/overlay/overlay_edit_text.cc index f541619ccdd..ebadaa530e4 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_text.cc +++ b/source/blender/draw/engines/overlay/overlay_edit_text.cc @@ -37,7 +37,7 @@ void OVERLAY_edit_text_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_uniform_color(); pd->edit_text_wire_grp[i] = grp = DRW_shgroup_create(sh, psl->edit_text_wire_ps[i]); - DRW_shgroup_uniform_vec4_copy(grp, "color", G_draw.block.color_wire); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", G_draw.block.color_wire); } { /* Cursor (text caret). */ @@ -45,14 +45,14 @@ void OVERLAY_edit_text_cache_init(OVERLAY_Data *vedata) DRW_PASS_CREATE(psl->edit_text_cursor_ps, state | pd->clipping_state); sh = OVERLAY_shader_uniform_color(); pd->edit_text_cursor_grp = grp = DRW_shgroup_create(sh, psl->edit_text_cursor_ps); - DRW_shgroup_uniform_vec4(grp, "color", pd->edit_text.cursor_color, 1); + DRW_shgroup_uniform_vec4(grp, "ucolor", pd->edit_text.cursor_color, 1); /* Selection boxes. */ state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; DRW_PASS_CREATE(psl->edit_text_selection_ps, state | pd->clipping_state); sh = OVERLAY_shader_uniform_color(); pd->edit_text_selection_grp = grp = DRW_shgroup_create(sh, psl->edit_text_selection_ps); - DRW_shgroup_uniform_vec4(grp, "color", pd->edit_text.selection_color, 1); + DRW_shgroup_uniform_vec4(grp, "ucolor", pd->edit_text.selection_color, 1); /* Highlight text within selection boxes. */ state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_DEPTH_GREATER_EQUAL | diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.cc b/source/blender/draw/engines/overlay/overlay_edit_uv.cc index c173201b271..25fa25c611d 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.cc +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.cc @@ -116,10 +116,10 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata) const bool show_modified_uvs = sima->flag & SI_DRAWSHADOW; const bool is_tiled_image = image && (image->source == IMA_SRC_TILED); const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ? - /* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge - * on the mesh may cause single UV vertices to be selected. */ - false : - (ts->uv_selectmode == UV_SELECT_EDGE); + /* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge + * on the mesh may cause single UV vertices to be selected. */ + false : + (ts->uv_selectmode == UV_SELECT_EDGE); const bool do_faces = ((sima->flag & SI_NO_DRAWFACES) == 0); const bool do_face_dots = (ts->uv_flag & UV_SYNC_SELECTION) ? (ts->selectmode & SCE_SELECT_FACE) != 0 : @@ -301,7 +301,7 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) srgb_to_linearrgb_v4(selected_color, selected_color); DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->edit_uv_tiled_image_borders_ps); - DRW_shgroup_uniform_vec4_copy(grp, "color", theme_color); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", theme_color); const float3 offset = {0.0f, 0.0f, 0.0f}; DRW_shgroup_uniform_vec3_copy(grp, "offset", offset); diff --git a/source/blender/draw/engines/overlay/overlay_extra.cc b/source/blender/draw/engines/overlay/overlay_extra.cc index 3e9855720b3..f0665f7e90f 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.cc +++ b/source/blender/draw/engines/overlay/overlay_extra.cc @@ -195,23 +195,23 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata) DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); grp_sub = DRW_shgroup_create_sub(grp); - DRW_shgroup_uniform_vec4_copy(grp_sub, "color", G_draw.block.color_active); + DRW_shgroup_uniform_vec4_copy(grp_sub, "ucolor", G_draw.block.color_active); cb->center_active = BUF_POINT(grp_sub, format); grp_sub = DRW_shgroup_create_sub(grp); - DRW_shgroup_uniform_vec4_copy(grp_sub, "color", G_draw.block.color_select); + DRW_shgroup_uniform_vec4_copy(grp_sub, "ucolor", G_draw.block.color_select); cb->center_selected = BUF_POINT(grp_sub, format); grp_sub = DRW_shgroup_create_sub(grp); - DRW_shgroup_uniform_vec4_copy(grp_sub, "color", G_draw.block.color_deselect); + DRW_shgroup_uniform_vec4_copy(grp_sub, "ucolor", G_draw.block.color_deselect); cb->center_deselected = BUF_POINT(grp_sub, format); grp_sub = DRW_shgroup_create_sub(grp); - DRW_shgroup_uniform_vec4_copy(grp_sub, "color", G_draw.block.color_library_select); + DRW_shgroup_uniform_vec4_copy(grp_sub, "ucolor", G_draw.block.color_library_select); cb->center_selected_lib = BUF_POINT(grp_sub, format); grp_sub = DRW_shgroup_create_sub(grp); - DRW_shgroup_uniform_vec4_copy(grp_sub, "color", G_draw.block.color_library); + DRW_shgroup_uniform_vec4_copy(grp_sub, "ucolor", G_draw.block.color_library); cb->center_deselected_lib = BUF_POINT(grp_sub, format); } } diff --git a/source/blender/draw/engines/overlay/overlay_fade.cc b/source/blender/draw/engines/overlay/overlay_fade.cc index 138226c3e2e..ee5540d91eb 100644 --- a/source/blender/draw/engines/overlay/overlay_fade.cc +++ b/source/blender/draw/engines/overlay/overlay_fade.cc @@ -36,7 +36,7 @@ void OVERLAY_fade_cache_init(OVERLAY_Data *vedata) if (draw_ctx->v3d->shading.background_type == V3D_SHADING_BACKGROUND_THEME) { srgb_to_linearrgb_v4(color, color); } - DRW_shgroup_uniform_vec4_copy(pd->fade_grp[i], "color", color); + DRW_shgroup_uniform_vec4_copy(pd->fade_grp[i], "ucolor", color); } if (!pd->use_in_front) { diff --git a/source/blender/draw/engines/overlay/overlay_grid.cc b/source/blender/draw/engines/overlay/overlay_grid.cc index 89fc6ec2eb7..d1958205a10 100644 --- a/source/blender/draw/engines/overlay/overlay_grid.cc +++ b/source/blender/draw/engines/overlay/overlay_grid.cc @@ -290,7 +290,7 @@ void OVERLAY_grid_cache_init(OVERLAY_Data *ved) /* add wire border */ GPUShader *sh = OVERLAY_shader_grid_image(); DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->grid_ps); - DRW_shgroup_uniform_vec4_copy(grp, "color", theme_color); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", theme_color); unit_m4(mat); for (int x = 0; x < grid->size[0]; x++) { mat[3][0] = x; diff --git a/source/blender/draw/engines/overlay/overlay_image.cc b/source/blender/draw/engines/overlay/overlay_image.cc index dff30eed620..47587319098 100644 --- a/source/blender/draw/engines/overlay/overlay_image.cc +++ b/source/blender/draw/engines/overlay/overlay_image.cc @@ -349,7 +349,7 @@ void OVERLAY_image_camera_cache_populate(OVERLAY_Data *vedata, Object *ob) DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", true); DRW_shgroup_uniform_bool_copy(grp, "isCameraBackground", true); DRW_shgroup_uniform_bool_copy(grp, "depthSet", true); - DRW_shgroup_uniform_vec4_copy(grp, "color", color_premult_alpha); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", color_premult_alpha); DRW_shgroup_call_obmat(grp, DRW_cache_quad_get(), mat); } } @@ -435,7 +435,7 @@ void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob) DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", use_alpha_blend); DRW_shgroup_uniform_bool_copy(grp, "isCameraBackground", false); DRW_shgroup_uniform_bool_copy(grp, "depthSet", depth_mode != OB_EMPTY_IMAGE_DEPTH_DEFAULT); - DRW_shgroup_uniform_vec4_copy(grp, "color", ob->color); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", ob->color); DRW_shgroup_call_obmat(grp, DRW_cache_quad_get(), mat); } } diff --git a/source/blender/draw/engines/overlay/overlay_mode_transfer.cc b/source/blender/draw/engines/overlay/overlay_mode_transfer.cc index d4bc5655da3..b312a12a07b 100644 --- a/source/blender/draw/engines/overlay/overlay_mode_transfer.cc +++ b/source/blender/draw/engines/overlay/overlay_mode_transfer.cc @@ -100,7 +100,7 @@ void OVERLAY_mode_transfer_cache_populate(OVERLAY_Data *vedata, Object *ob) UI_GetThemeColor3fv(TH_VERTEX_SELECT, color); color[3] = mode_transfer_alpha_for_animation_time_get(animation_time); srgb_to_linearrgb_v4(color, color); - DRW_shgroup_uniform_vec4_copy(mode_transfer_grp[i], "color", color); + DRW_shgroup_uniform_vec4_copy(mode_transfer_grp[i], "ucolor", color); } if (!pd->use_in_front) { diff --git a/source/blender/draw/engines/overlay/overlay_paint.cc b/source/blender/draw/engines/overlay/overlay_paint.cc index d2573d1db0b..b8f087a1460 100644 --- a/source/blender/draw/engines/overlay/overlay_paint.cc +++ b/source/blender/draw/engines/overlay/overlay_paint.cc @@ -168,7 +168,7 @@ void OVERLAY_paint_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_paint_face(); pd->paint_face_grp = grp = DRW_shgroup_create(sh, psl->paint_overlay_ps); const float4 color = {1.0f, 1.0f, 1.0f, 0.2f}; - DRW_shgroup_uniform_vec4_copy(grp, "color", color); + DRW_shgroup_uniform_vec4_copy(grp, "ucolor", color); DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); sh = OVERLAY_shader_paint_wire(); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh index 88a012c35c9..8bc15400248 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh @@ -15,7 +15,7 @@ GPU_SHADER_CREATE_INFO(overlay_background) GPU_SHADER_CREATE_INFO(overlay_clipbound) .do_static_compilation(true) - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .push_constant(Type::VEC3, "boundbox", 8) .vertex_source("overlay_clipbound_vert.glsl") .fragment_out(0, Type::VEC4, "fragColor") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index 92a35a049a4..e2cc0a54153 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -278,7 +278,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts) GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") .fragment_source("overlay_uniform_color_frag.glsl") @@ -294,7 +294,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stencil_image) .sampler(0, ImageType::FLOAT_2D, "imgTexture") .push_constant(Type::BOOL, "imgPremultiplied") .push_constant(Type::BOOL, "imgAlphaBlend") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .fragment_out(0, Type::VEC4, "fragColor") .fragment_source("overlay_image_frag.glsl") .additional_info("draw_mesh"); @@ -581,7 +581,7 @@ GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped) GPU_SHADER_CREATE_INFO(overlay_uniform_color) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_depth_only_vert.glsl") .fragment_source("overlay_uniform_color_frag.glsl") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh index 4ebc83c27b0..65084361f14 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh @@ -145,7 +145,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_point) /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ .define("blender_srgb_to_framebuffer_space(a)", "a") .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .vertex_out(overlay_extra_point_iface) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_extra_point_vert.glsl") @@ -161,7 +161,7 @@ GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface, "").smooth(Type::VEC4 GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .vertex_out(overlay_extra_loose_point_iface) .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput") @@ -257,7 +257,7 @@ GPU_SHADER_CREATE_INFO(overlay_image) .push_constant(Type::BOOL, "isCameraBackground") .push_constant(Type::BOOL, "imgPremultiplied") .push_constant(Type::BOOL, "imgAlphaBlend") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .vertex_in(0, Type::VEC3, "pos") .vertex_out(overlay_image_iface) .sampler(0, ImageType::FLOAT_2D, "imgTexture") @@ -304,7 +304,7 @@ GPU_SHADER_INTERFACE_INFO(overlay_particle_iface, "").flat(Type::VEC4, "finalCol GPU_SHADER_CREATE_INFO(overlay_particle) .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::VEC4, "color") /* Draw-size packed in alpha. */ + .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ .vertex_in(0, Type::VEC3, "part_pos") .vertex_in(1, Type::VEC4, "part_rot") .vertex_in(2, Type::FLOAT, "part_val") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh index a8f1281d53a..70175b7072f 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh @@ -32,7 +32,7 @@ GPU_SHADER_CREATE_INFO(overlay_grid_background) GPU_SHADER_CREATE_INFO(overlay_grid_image) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") .fragment_source("overlay_uniform_color_frag.glsl") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh index 3083d5a463b..08b421de3e6 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh @@ -12,7 +12,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_face) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ - .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "ucolor") .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_paint_face_vert.glsl") .fragment_source("overlay_uniform_color_frag.glsl") diff --git a/source/blender/draw/engines/overlay/shaders/overlay_extra_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_extra_point_vert.glsl index de999c241c0..179c3cb6d73 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_extra_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_extra_point_vert.glsl @@ -16,7 +16,7 @@ void main() radii[3] = radius - outline_width - 1.0; radii /= sizeObjectCenter; - fillColor = color; + fillColor = ucolor; outlineColor = colorOutline; view_clipping_distances(world_pos); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl index c48e7cce550..48038d0ca17 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_particle_vert.glsl @@ -16,7 +16,7 @@ vec3 rotate(vec3 vec, vec4 quat) void main() { /* Drawsize packed in alpha. */ - float draw_size = color.a; + float draw_size = ucolor.a; vec3 world_pos = part_pos; @@ -43,7 +43,7 @@ void main() finalColor = vec4(clamp(pos * 10000.0, 0.0, 1.0), 1.0); } else if (part_val < 0.0) { - finalColor = vec4(color.rgb, 1.0); + finalColor = vec4(ucolor.rgb, 1.0); } else { finalColor = vec4(texture(weightTex, part_val).rgb, 1.0); diff --git a/source/blender/draw/engines/overlay/shaders/overlay_uniform_color_frag.glsl b/source/blender/draw/engines/overlay/shaders/overlay_uniform_color_frag.glsl index e1a4a3602e3..2794481489c 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_uniform_color_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_uniform_color_frag.glsl @@ -1,4 +1,4 @@ void main() { - fragColor = color; + fragColor = ucolor; } diff --git a/source/blender/draw/engines/workbench/shaders/workbench_transparent_accum_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_transparent_accum_frag.glsl index 213279b1913..32191835668 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_transparent_accum_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_transparent_accum_frag.glsl @@ -6,7 +6,7 @@ #pragma BLENDER_REQUIRE(workbench_world_light_lib.glsl) /* Special function only to be used with calculate_transparent_weight(). */ -float linear_zdepth(float depth, vec4 viewvecs[2], mat4 proj_mat) +float linear_zdepth(float depth, mat4 proj_mat) { if (proj_mat[3][3] == 0.0) { float d = 2.0 * depth - 1.0; @@ -14,7 +14,7 @@ float linear_zdepth(float depth, vec4 viewvecs[2], mat4 proj_mat) } else { /* Return depth from near plane. */ - return depth * viewvecs[1].z; + return depth * drw_view.viewvecs[1].z; } } @@ -24,7 +24,7 @@ float linear_zdepth(float depth, vec4 viewvecs[2], mat4 proj_mat) */ float calculate_transparent_weight(void) { - float z = linear_zdepth(gl_FragCoord.z, drw_view.viewvecs, drw_view.winmat); + float z = linear_zdepth(gl_FragCoord.z, drw_view.winmat); #if 0 /* Eq 10 : Good for surfaces with varying opacity (like particles) */ float a = min(1.0, alpha * 10.0) + 0.01; diff --git a/source/blender/draw/intern/shaders/common_smaa_lib.glsl b/source/blender/draw/intern/shaders/common_smaa_lib.glsl index dbc4c998b34..0c040c9acfe 100644 --- a/source/blender/draw/intern/shaders/common_smaa_lib.glsl +++ b/source/blender/draw/intern/shaders/common_smaa_lib.glsl @@ -588,15 +588,18 @@ SamplerState PointSampler # else # define mad(a, b, c) (a * b + c) # endif -# define float2 vec2 -# define float3 vec3 -# define float4 vec4 -# define int2 ivec2 -# define int3 ivec3 -# define int4 ivec4 -# define bool2 bvec2 -# define bool3 bvec3 -# define bool4 bvec4 +/* NOTE(Metal): Types already natively declared in MSL. */ +# ifndef GPU_METAL +# define float2 vec2 +# define float3 vec3 +# define float4 vec4 +# define int2 ivec2 +# define int3 ivec3 +# define int4 ivec4 +# define bool2 bvec2 +# define bool3 bvec3 +# define bool4 bvec4 +# endif #endif /* clang-format off */ @@ -658,7 +661,14 @@ void SMAAMovc(bool4 cond, inout float4 variable, float4 value) /** * Edge Detection Vertex Shader */ +# ifdef GPU_METAL +/* NOTE: Metal API requires explicit address space qualifiers for pointer types. + * Arrays in functions are passed as pointers, and thus require explicit address + * space. */ +void SMAAEdgeDetectionVS(float2 texcoord, thread float4 *offset) +# else void SMAAEdgeDetectionVS(float2 texcoord, out float4 offset[3]) +# endif { offset[0] = mad(SMAA_RT_METRICS.xyxy, float4(-1.0, 0.0, 0.0, -1.0), texcoord.xyxy); offset[1] = mad(SMAA_RT_METRICS.xyxy, float4(1.0, 0.0, 0.0, 1.0), texcoord.xyxy); @@ -668,7 +678,16 @@ void SMAAEdgeDetectionVS(float2 texcoord, out float4 offset[3]) /** * Blend Weight Calculation Vertex Shader */ +# ifdef GPU_METAL +/* NOTE: Metal API requires explicit address space qualifiers for pointer types. + * Arrays in functions are passed as pointers, and thus require explicit address + * space. */ +void SMAABlendingWeightCalculationVS(float2 texcoord, + thread float2 &pixcoord, + thread float4 *offset) +# else void SMAABlendingWeightCalculationVS(float2 texcoord, out float2 pixcoord, out float4 offset[3]) +# endif { pixcoord = texcoord * SMAA_RT_METRICS.zw; |