Add EmitVertexPointSizeTransform

EmitVertexPointSizeTransform is a Transformer that adds a PointSize builtin global output variable to the module which is assigned 1.0 as the new first statement for all vertex stage entry points.

If the module does not contain a vertex pipeline stage entry point then then this transformer is a no-op.

Bug: tint:321
Change-Id: I0e01236339d9fa1ceab3622af0931a1199c33b99
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34561
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-12-03 14:54:09 +00:00
committed by Commit Bot service account
parent 685cb02ea8
commit 76d12f0f5a
12 changed files with 344 additions and 1 deletions

View File

@@ -74,6 +74,7 @@ const char kUsage[] = R"(Usage: tint [options] <input-file>
--transform <name list> -- Runs transformers, name list is comma separated
Available transforms:
bound_array_accessors
emit_vertex_point_size
--parse-only -- Stop after parsing the input
--dump-ast -- Dump the generated AST to stdout
--dawn-validation -- SPIRV outputs are validated with the same flags
@@ -516,6 +517,10 @@ int main(int argc, const char** argv) {
transform_manager.append(
std::make_unique<tint::transform::BoundArrayAccessorsTransform>(
&mod));
} else if (name == "emit_vertex_point_size") {
transform_manager.append(
std::make_unique<tint::transform::EmitVertexPointSizeTransform>(
&mod));
} else {
std::cerr << "Unknown transform name: " << name << std::endl;
return 1;