Vulkan: Optimize shader source macro replacement
@@ LAYOUT-xx @@ and @@ QUALIFIER-xx @@ macros are generated by the
compiler when emitting Vulkan GLSL. These macros are replaced at link
time in the Vulkan backend.
Previously, this replacement was done through calls to
angle::ReplaceSubstring, reiterating over the whole source on every
replacement. This CL does a prepass on the input source and chunks it
up in blocks. Search is optimized as only blocks of a certain type are
string-compared (skipping large chunks of shader text). Replace is
optimized as the whole shader is not shifted left or right on every
replacement.
Additionally, this CL modifies the layout macro to the following format:
@@ LAYOUT-xx(extra, args) @@
This is used in a follow up CL to have the compiler provide additional
layout qualifiers.
Bug: angleproject:3220
Change-Id: I6367e781c3304d5f2e0a406e4fb4e6feb4c45f1d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1592070
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by:
Jamie Madill <jmadill@chromium.org>
Reviewed-by:
Yuly Novikov <ynovikov@chromium.org>
Showing
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment