Add a Unsafe SPIR-V generate call.
Currently Dawn may use the tint generator or the SPIRV-Cross generator. In the case of SPIRV-Cross, we need to generate the SPIR-V with the original names otherwise SPIRV-Cross won't be able to match up the entry point name with the names in the shader. Change-Id: Ica473030009b282fee352f2d1c1acc93f1db592c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37222 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
03f38e0cd9
commit
b91e8a9fbe
|
@ -51,6 +51,22 @@ bool Generator::Generate() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Generator::GenerateUnsafe() {
|
||||||
|
auto unsafe_namer = std::make_unique<UnsafeNamer>(module_);
|
||||||
|
builder_ = std::make_unique<Builder>(module_, unsafe_namer.get());
|
||||||
|
|
||||||
|
if (!builder_->Build()) {
|
||||||
|
set_error(builder_->error());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer_->WriteHeader(builder_->id_bound());
|
||||||
|
writer_->WriteBuilder(builder_.get());
|
||||||
|
|
||||||
|
builder_ = std::make_unique<Builder>(module_, namer_.get());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Generator::GenerateEntryPoint(ast::PipelineStage, const std::string&) {
|
bool Generator::GenerateEntryPoint(ast::PipelineStage, const std::string&) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,11 @@ class Generator : public writer::Writer {
|
||||||
/// @returns true on successful generation; false otherwise
|
/// @returns true on successful generation; false otherwise
|
||||||
bool Generate() override;
|
bool Generate() override;
|
||||||
|
|
||||||
|
/// Generates the result data
|
||||||
|
/// DO NOT USE. Temporary fix for Dawn usage of SPRIV-Cross
|
||||||
|
/// @returns true on successful generation; false otherwise
|
||||||
|
bool GenerateUnsafe();
|
||||||
|
|
||||||
/// Converts a single entry point
|
/// Converts a single entry point
|
||||||
/// @param stage the pipeline stage
|
/// @param stage the pipeline stage
|
||||||
/// @param name the entry point name
|
/// @param name the entry point name
|
||||||
|
|
Loading…
Reference in New Issue