From 9ee3221d05becdf36a1257920fcbe83f70168400 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 16 Feb 2023 11:45:34 -0800 Subject: [PATCH] [Impeller] align SSBOs to 16 bytes to fix iOS shader validation issue. (#39654) * [Impeller] align SSBOs to 16 bytes to fix iOS shader validation issue. * use DefaultUniformAlignment --- impeller/entity/contents/linear_gradient_contents.cc | 5 +++-- impeller/entity/contents/radial_gradient_contents.cc | 5 +++-- impeller/entity/contents/sweep_gradient_contents.cc | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/impeller/entity/contents/linear_gradient_contents.cc b/impeller/entity/contents/linear_gradient_contents.cc index 9ac82f82ffb8e..02d583e4686ca 100644 --- a/impeller/entity/contents/linear_gradient_contents.cc +++ b/impeller/entity/contents/linear_gradient_contents.cc @@ -134,8 +134,9 @@ bool LinearGradientContents::RenderSSBO(const ContentContext& renderer, auto colors = CreateGradientColors(colors_, stops_); gradient_info.colors_length = colors.size(); - auto color_buffer = host_buffer.Emplace( - colors.data(), colors.size() * sizeof(StopData), alignof(StopData)); + auto color_buffer = + host_buffer.Emplace(colors.data(), colors.size() * sizeof(StopData), + DefaultUniformAlignment()); VS::FrameInfo frame_info; frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) * diff --git a/impeller/entity/contents/radial_gradient_contents.cc b/impeller/entity/contents/radial_gradient_contents.cc index 5a5d7b0c5999f..3b475c29d3c10 100644 --- a/impeller/entity/contents/radial_gradient_contents.cc +++ b/impeller/entity/contents/radial_gradient_contents.cc @@ -70,8 +70,9 @@ bool RadialGradientContents::RenderSSBO(const ContentContext& renderer, auto colors = CreateGradientColors(colors_, stops_); gradient_info.colors_length = colors.size(); - auto color_buffer = host_buffer.Emplace( - colors.data(), colors.size() * sizeof(StopData), alignof(StopData)); + auto color_buffer = + host_buffer.Emplace(colors.data(), colors.size() * sizeof(StopData), + DefaultUniformAlignment()); VS::FrameInfo frame_info; frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) * diff --git a/impeller/entity/contents/sweep_gradient_contents.cc b/impeller/entity/contents/sweep_gradient_contents.cc index 5c21614851885..897913c7c157c 100644 --- a/impeller/entity/contents/sweep_gradient_contents.cc +++ b/impeller/entity/contents/sweep_gradient_contents.cc @@ -76,8 +76,9 @@ bool SweepGradientContents::RenderSSBO(const ContentContext& renderer, auto colors = CreateGradientColors(colors_, stops_); gradient_info.colors_length = colors.size(); - auto color_buffer = host_buffer.Emplace( - colors.data(), colors.size() * sizeof(StopData), alignof(StopData)); + auto color_buffer = + host_buffer.Emplace(colors.data(), colors.size() * sizeof(StopData), + DefaultUniformAlignment()); VS::FrameInfo frame_info; frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *