mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Rename builtin(frag_coord) to builtin(position)
Use the variable storage class to determine the correct builtin to use in the SPIR-V generator. Added a deprecation warning for frag_coord. Bug: tint:714 Change-Id: I5ad4956f9345e2f39f4af16e84668dec345ac82e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47742 Auto-Submit: James Price <jrprice@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
d13982ff2e
commit
88d7edcf7a
@@ -34,7 +34,7 @@ namespace transform {
|
||||
/// };
|
||||
///
|
||||
/// [[stage(fragment)]]
|
||||
/// fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
/// fn frag_main([[builtin(position)]] coord : vec4<f32>,
|
||||
/// locations : Locations) -> [[location(0)]] f32 {
|
||||
/// var col : f32 = (coord.x * locations.loc1);
|
||||
/// return col;
|
||||
@@ -49,7 +49,7 @@ namespace transform {
|
||||
/// };
|
||||
///
|
||||
/// struct frag_main_in {
|
||||
/// [[builtin(frag_coord)]] coord : vec4<f32>;
|
||||
/// [[builtin(position)]] coord : vec4<f32>;
|
||||
/// [[location(1)]] loc1 : f32;
|
||||
/// [[location(2)]] loc2 : vec4<u32>
|
||||
/// };
|
||||
|
||||
@@ -25,7 +25,7 @@ using CanonicalizeEntryPointIOTest = TransformTest;
|
||||
TEST_F(CanonicalizeEntryPointIOTest, Parameters) {
|
||||
auto* src = R"(
|
||||
[[stage(fragment)]]
|
||||
fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
fn frag_main([[builtin(position)]] coord : vec4<f32>,
|
||||
[[location(1)]] loc1 : f32,
|
||||
[[location(2)]] loc2 : vec4<u32>) {
|
||||
var col : f32 = (coord.x * loc1);
|
||||
@@ -34,7 +34,7 @@ fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
[[builtin(frag_coord)]]
|
||||
[[builtin(position)]]
|
||||
coord : vec4<f32>;
|
||||
[[location(1)]]
|
||||
loc1 : f32;
|
||||
@@ -89,7 +89,7 @@ fn frag_main(tint_symbol : tint_symbol_1) {
|
||||
TEST_F(CanonicalizeEntryPointIOTest, Parameters_EmptyBody) {
|
||||
auto* src = R"(
|
||||
[[stage(fragment)]]
|
||||
fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
fn frag_main([[builtin(position)]] coord : vec4<f32>,
|
||||
[[location(1)]] loc1 : f32,
|
||||
[[location(2)]] loc2 : vec4<u32>) {
|
||||
}
|
||||
@@ -97,7 +97,7 @@ fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
|
||||
auto* expect = R"(
|
||||
struct tint_symbol_1 {
|
||||
[[builtin(frag_coord)]]
|
||||
[[builtin(position)]]
|
||||
coord : vec4<f32>;
|
||||
[[location(1)]]
|
||||
loc1 : f32;
|
||||
@@ -118,7 +118,7 @@ fn frag_main(tint_symbol : tint_symbol_1) {
|
||||
TEST_F(CanonicalizeEntryPointIOTest, StructParameters) {
|
||||
auto* src = R"(
|
||||
struct FragBuiltins {
|
||||
[[builtin(frag_coord)]] coord : vec4<f32>;
|
||||
[[builtin(position)]] coord : vec4<f32>;
|
||||
};
|
||||
struct FragLocations {
|
||||
[[location(1)]] loc1 : f32;
|
||||
@@ -144,7 +144,7 @@ struct FragLocations {
|
||||
};
|
||||
|
||||
struct tint_symbol_1 {
|
||||
[[builtin(frag_coord)]]
|
||||
[[builtin(position)]]
|
||||
coord : vec4<f32>;
|
||||
[[location(1)]]
|
||||
loc1 : f32;
|
||||
@@ -451,7 +451,7 @@ TEST_F(CanonicalizeEntryPointIOTest, Struct_LayoutDecorations) {
|
||||
[[block]]
|
||||
struct FragmentInput {
|
||||
[[size(16), location(1)]] value : f32;
|
||||
[[builtin(frag_coord)]] [[align(32)]] coord : vec4<f32>;
|
||||
[[builtin(position)]] [[align(32)]] coord : vec4<f32>;
|
||||
};
|
||||
|
||||
struct FragmentOutput {
|
||||
@@ -481,7 +481,7 @@ struct FragmentOutput {
|
||||
struct tint_symbol_1 {
|
||||
[[location(1)]]
|
||||
value : f32;
|
||||
[[builtin(frag_coord)]]
|
||||
[[builtin(position)]]
|
||||
coord : vec4<f32>;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ void Spirv::HandleEntryPointIOTypes(CloneContext& ctx) const {
|
||||
//
|
||||
// [[stage(fragment)]]
|
||||
// fn frag_main(
|
||||
// [[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
// [[builtin(position)]] coord : vec4<f32>,
|
||||
// samples : FragmentInput
|
||||
// ) -> FragmentOutput {
|
||||
// var output : FragmentOutput = FragmentOutput(1.0,
|
||||
@@ -88,7 +88,7 @@ void Spirv::HandleEntryPointIOTypes(CloneContext& ctx) const {
|
||||
// mask_out : u32;
|
||||
// };
|
||||
//
|
||||
// [[builtin(frag_coord)]] var<in> coord : vec4<f32>,
|
||||
// [[builtin(position)]] var<in> coord : vec4<f32>,
|
||||
// [[builtin(sample_index)]] var<in> sample_index : u32,
|
||||
// [[builtin(sample_mask_in)]] var<in> sample_mask_in : u32,
|
||||
// [[builtin(frag_depth)]] var<out> depth: f32;
|
||||
|
||||
@@ -25,7 +25,7 @@ using SpirvTest = TransformTest;
|
||||
TEST_F(SpirvTest, HandleEntryPointIOTypes_Parameters) {
|
||||
auto* src = R"(
|
||||
[[stage(fragment)]]
|
||||
fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
|
||||
fn frag_main([[builtin(position)]] coord : vec4<f32>,
|
||||
[[location(1)]] loc1 : f32) {
|
||||
var col : f32 = (coord.x * loc1);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ fn compute_main([[builtin(local_invocation_id)]] local_id : vec3<u32>,
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
[[builtin(frag_coord)]] var<in> tint_symbol : vec4<f32>;
|
||||
[[builtin(position)]] var<in> tint_symbol : vec4<f32>;
|
||||
|
||||
[[location(1)]] var<in> tint_symbol_1 : f32;
|
||||
|
||||
@@ -192,7 +192,7 @@ fn frag_main() {
|
||||
TEST_F(SpirvTest, HandleEntryPointIOTypes_StructParameters) {
|
||||
auto* src = R"(
|
||||
struct FragmentInput {
|
||||
[[builtin(frag_coord)]] coord : vec4<f32>;
|
||||
[[builtin(position)]] coord : vec4<f32>;
|
||||
[[location(1)]] value : f32;
|
||||
};
|
||||
|
||||
@@ -208,7 +208,7 @@ struct FragmentInput {
|
||||
value : f32;
|
||||
};
|
||||
|
||||
[[builtin(frag_coord)]] var<in> tint_symbol : vec4<f32>;
|
||||
[[builtin(position)]] var<in> tint_symbol : vec4<f32>;
|
||||
|
||||
[[location(1)]] var<in> tint_symbol_1 : f32;
|
||||
|
||||
@@ -392,7 +392,7 @@ TEST_F(SpirvTest, HandleEntryPointIOTypes_StructLayoutDecorations) {
|
||||
[[block]]
|
||||
struct FragmentInput {
|
||||
[[size(16), location(1)]] value : f32;
|
||||
[[builtin(frag_coord)]] [[align(32)]] coord : vec4<f32>;
|
||||
[[builtin(position)]] [[align(32)]] coord : vec4<f32>;
|
||||
};
|
||||
|
||||
struct FragmentOutput {
|
||||
@@ -421,7 +421,7 @@ struct FragmentOutput {
|
||||
|
||||
[[location(1)]] var<in> tint_symbol : f32;
|
||||
|
||||
[[builtin(frag_coord)]] var<in> tint_symbol_1 : vec4<f32>;
|
||||
[[builtin(position)]] var<in> tint_symbol_1 : vec4<f32>;
|
||||
|
||||
[[location(1)]] var<out> tint_symbol_4 : f32;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user