Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] align SSBOs to 16 bytes to fix iOS shader validation issue. #39654

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions impeller/entity/contents/gradient_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ namespace impeller {

class Context;

/// Lower iOS version require alignment to be a multiple of 16, so the alignof
/// operator will not give correct results for most structs.
constexpr size_t kSSBOAlignOf = 16u;

/**
* @brief Create a host visible texture that contains the gradient defined
* by the provided gradient data.
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/contents/linear_gradient_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool LinearGradientContents::RenderSSBO(const ContentContext& renderer,

gradient_info.colors_length = colors.size();
auto color_buffer = host_buffer.Emplace(
colors.data(), colors.size() * sizeof(StopData), alignof(StopData));
colors.data(), colors.size() * sizeof(StopData), kSSBOAlignOf);

VS::FrameInfo frame_info;
frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/contents/radial_gradient_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool RadialGradientContents::RenderSSBO(const ContentContext& renderer,

gradient_info.colors_length = colors.size();
auto color_buffer = host_buffer.Emplace(
colors.data(), colors.size() * sizeof(StopData), alignof(StopData));
colors.data(), colors.size() * sizeof(StopData), kSSBOAlignOf);

VS::FrameInfo frame_info;
frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/contents/sweep_gradient_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool SweepGradientContents::RenderSSBO(const ContentContext& renderer,

gradient_info.colors_length = colors.size();
auto color_buffer = host_buffer.Emplace(
colors.data(), colors.size() * sizeof(StopData), alignof(StopData));
colors.data(), colors.size() * sizeof(StopData), kSSBOAlignOf);

VS::FrameInfo frame_info;
frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *
Expand Down