Metal: Generate storage buffer lengths with Tint
Tint now matches the behavior of spirv-cross for shaders to use the arrayLength builtin, and so needs a uniform buffer containing storage buffer lengths to be passed to shaders that use this builtin. Fixed: tint:256 Change-Id: Ib51cc4a3c6f7c2cdea867a23ed868d9d3740d734 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/55181 Auto-Submit: James Price <jrprice@google.com> Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
f2d1d55e99
commit
3a1a0397d3
|
@ -61,9 +61,6 @@ namespace dawn_native { namespace metal {
|
|||
const VertexState* vertexState,
|
||||
std::string* remappedEntryPointName,
|
||||
bool* needsStorageBufferLength) {
|
||||
// TODO(crbug.com/tint/256): Set this accordingly if arrayLength(..) is used.
|
||||
*needsStorageBufferLength = false;
|
||||
|
||||
ScopedTintICEHandler scopedICEHandler(GetDevice());
|
||||
|
||||
std::ostringstream errorStream;
|
||||
|
@ -133,6 +130,8 @@ namespace dawn_native { namespace metal {
|
|||
std::move(accessControls),
|
||||
/* mayCollide */ true);
|
||||
|
||||
transformInputs.Add<tint::transform::Msl::Config>(kBufferLengthBufferSlot);
|
||||
|
||||
tint::Program program;
|
||||
tint::transform::DataMap transformOutputs;
|
||||
DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, GetTintProgram(), transformInputs,
|
||||
|
@ -148,6 +147,12 @@ namespace dawn_native { namespace metal {
|
|||
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
||||
}
|
||||
|
||||
if (auto* data = transformOutputs.Get<tint::transform::Msl::Result>()) {
|
||||
*needsStorageBufferLength = data->needs_storage_buffer_sizes;
|
||||
} else {
|
||||
return DAWN_VALIDATION_ERROR("Transform output missing MSL data.");
|
||||
}
|
||||
|
||||
tint::writer::msl::Generator generator(&program);
|
||||
if (!generator.Generate()) {
|
||||
errorStream << "Generator: " << generator.error() << std::endl;
|
||||
|
|
Loading…
Reference in New Issue