Remove `sig` deprecation.
This CL removes support for the `sig` member in `frexp`. It is now an error if `sig` is used, the deprecation is removed. `fract` should be used instead. Bug: tint:1766 Change-Id: I991544b675caf31f22c8c9472a60c77811ff4efd Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117920 Kokoro: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
97ad405216
commit
f374b819d9
|
@ -1,5 +1,11 @@
|
|||
# Tint changes during Origin Trial
|
||||
|
||||
## Changes for M112
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* * The `sig` member of the return type of `frexp()` has been renamed to `fract`. [tint:1766](crbug.com/tint/1766)
|
||||
|
||||
## Changes for M111
|
||||
|
||||
### New features
|
||||
|
|
|
@ -1046,29 +1046,6 @@ TEST_F(ResolverBuiltinFloatTest, FrexpVector_f16) {
|
|||
EXPECT_EQ(ty->SizeNoPadding(), 28u);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1757): Remove once deprecation period for `frexp().sig` is over
|
||||
TEST_F(ResolverBuiltinFloatTest, FrexpVector_sig) {
|
||||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* call = Call("frexp", vec3<f16>());
|
||||
auto* expr = MemberAccessor(call, "sig");
|
||||
WrapInFunction(expr);
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
||||
ASSERT_NE(TypeOf(call), nullptr);
|
||||
auto* ty = TypeOf(call)->As<sem::Struct>();
|
||||
ASSERT_NE(ty, nullptr);
|
||||
ASSERT_EQ(ty->Members().Length(), 2u);
|
||||
|
||||
auto* sig = ty->Members()[0];
|
||||
EXPECT_TYPE(sig->Type(), TypeOf(expr));
|
||||
|
||||
auto* access = Sem().Get<sem::StructMemberAccess>(expr);
|
||||
ASSERT_NE(access, nullptr);
|
||||
EXPECT_EQ(access->Member(), sig);
|
||||
}
|
||||
|
||||
TEST_F(ResolverBuiltinFloatTest, Frexp_Error_FirstParamInt) {
|
||||
GlobalVar("v", ty.i32(), type::AddressSpace::kWorkgroup);
|
||||
auto* call = Call("frexp", 1_i, AddressOf("v"));
|
||||
|
|
|
@ -2779,16 +2779,6 @@ sem::Expression* Resolver::MemberAccessor(const ast::MemberAccessorExpression* e
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1757): Remove
|
||||
if (utils::HasPrefix(builder_->Symbols().NameFor(str->Name()), "__frexp_result")) {
|
||||
if (builder_->Symbols().NameFor(symbol) == "sig") {
|
||||
AddWarning(
|
||||
"use of deprecated language feature: 'sig' has been renamed to 'fract'",
|
||||
expr->member->source);
|
||||
member = str->Members()[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (member == nullptr) {
|
||||
AddError("struct member " + builder_->Symbols().NameFor(symbol) + " not found",
|
||||
expr->source);
|
||||
|
|
|
@ -160,7 +160,7 @@ TEST_F(RenamerTest, PreserveBuiltinTypes) {
|
|||
fn entry() {
|
||||
var a = modf(1.0).whole;
|
||||
var b = modf(1.0).fract;
|
||||
var c = frexp(1.0).sig;
|
||||
var c = frexp(1.0).fract;
|
||||
var d = frexp(1.0).exp;
|
||||
}
|
||||
)";
|
||||
|
@ -170,7 +170,7 @@ fn entry() {
|
|||
fn tint_symbol() {
|
||||
var tint_symbol_1 = modf(1.0).whole;
|
||||
var tint_symbol_2 = modf(1.0).fract;
|
||||
var tint_symbol_3 = frexp(1.0).sig;
|
||||
var tint_symbol_3 = frexp(1.0).fract;
|
||||
var tint_symbol_4 = frexp(1.0).exp;
|
||||
}
|
||||
)";
|
||||
|
|
|
@ -920,27 +920,6 @@ void main() {
|
|||
)");
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1757): Remove once deprecation period for `frexp().sig` is over
|
||||
TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Sig_Deprecation) {
|
||||
WrapInFunction(MemberAccessor(Call("frexp", 1_f), "sig"));
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||
|
||||
void test_function() {
|
||||
float tint_symbol = 0.5f;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
test_function();
|
||||
return;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f32) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("degrees", val);
|
||||
|
|
|
@ -802,27 +802,6 @@ void test_function() {
|
|||
)");
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1757): Remove once deprecation period for `frexp().sig` is over
|
||||
TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Sig_Deprecation) {
|
||||
WrapInFunction(Var("v", Call("frexp", 1_f)), //
|
||||
MemberAccessor("v", "sig"));
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(struct frexp_result_f32 {
|
||||
float fract;
|
||||
int exp;
|
||||
};
|
||||
[numthreads(1, 1, 1)]
|
||||
void test_function() {
|
||||
frexp_result_f32 v = {0.5f, 1};
|
||||
const float tint_symbol = v.fract;
|
||||
return;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f32) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("degrees", val);
|
||||
|
|
|
@ -837,24 +837,6 @@ kernel void test_function() {
|
|||
)");
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1757): Remove once deprecation period for `frexp().sig` is over
|
||||
TEST_F(MslGeneratorImplTest, Frexp_Sig_Deprecation) {
|
||||
WrapInFunction(MemberAccessor(Call("frexp", 1_f), "sig"));
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"(#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void test_function() {
|
||||
float const tint_symbol = 0.5f;
|
||||
return;
|
||||
}
|
||||
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, Degrees_Scalar_f32) {
|
||||
auto* val = Var("val", ty.f32());
|
||||
auto* call = Call("degrees", val);
|
||||
|
|
|
@ -2045,60 +2045,6 @@ OpFunctionEnd
|
|||
Validate(b);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/1757): Remove once deprecation period for `frexp().sig` is over
|
||||
TEST_F(BuiltinBuilderTest, Frexp_Sig_Deprecation) {
|
||||
Func("a_func", utils::Empty, ty.void_(),
|
||||
utils::Vector{
|
||||
Decl(Var("vec", vec2<f32>(1_f, 2_f))),
|
||||
Decl(Let("s", MemberAccessor(Call("frexp", "vec"), "sig"))),
|
||||
},
|
||||
utils::Vector{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
ASSERT_TRUE(b.Build()) << b.error();
|
||||
auto got = DumpBuilder(b);
|
||||
auto* expect = R"(OpCapability Shader
|
||||
%17 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %3 "a_func"
|
||||
OpExecutionMode %3 OriginUpperLeft
|
||||
OpName %3 "a_func"
|
||||
OpName %10 "vec"
|
||||
OpName %14 "__frexp_result_vec2_f32"
|
||||
OpMemberName %14 0 "fract"
|
||||
OpMemberName %14 1 "exp"
|
||||
OpMemberDecorate %14 0 Offset 0
|
||||
OpMemberDecorate %14 1 Offset 8
|
||||
%2 = OpTypeVoid
|
||||
%1 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%5 = OpTypeVector %6 2
|
||||
%7 = OpConstant %6 1
|
||||
%8 = OpConstant %6 2
|
||||
%9 = OpConstantComposite %5 %7 %8
|
||||
%11 = OpTypePointer Function %5
|
||||
%12 = OpConstantNull %5
|
||||
%16 = OpTypeInt 32 1
|
||||
%15 = OpTypeVector %16 2
|
||||
%14 = OpTypeStruct %5 %15
|
||||
%3 = OpFunction %2 None %1
|
||||
%4 = OpLabel
|
||||
%10 = OpVariable %11 Function %12
|
||||
OpStore %10 %9
|
||||
%18 = OpLoad %5 %10
|
||||
%13 = OpExtInst %14 %17 FrexpStruct %18
|
||||
%19 = OpCompositeExtract %5 %13 0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
EXPECT_EQ(expect, got);
|
||||
|
||||
Validate(b);
|
||||
}
|
||||
|
||||
TEST_F(BuiltinBuilderTest, Call_QuantizeToF16_Scalar) {
|
||||
GlobalVar("v", Expr(2_f), type::AddressSpace::kPrivate);
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
// TODO(crbug.com/tint/1757): Remove this test once the deprecation period for `frexp().sig` is over
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
let res = frexp(1.23);
|
||||
let exp : i32 = res.exp;
|
||||
let sig : f32 = res.sig;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
bug/tint/1757.wgsl:6:25 warning: use of deprecated language feature: 'sig' has been renamed to 'fract'
|
||||
let sig : f32 = res.sig;
|
||||
^^^
|
||||
|
||||
struct frexp_result_f32 {
|
||||
float fract;
|
||||
int exp;
|
||||
};
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const frexp_result_f32 res = {0.61500001f, 1};
|
||||
const int exp = res.exp;
|
||||
const float sig = res.fract;
|
||||
return;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
bug/tint/1757.wgsl:6:25 warning: use of deprecated language feature: 'sig' has been renamed to 'fract'
|
||||
let sig : f32 = res.sig;
|
||||
^^^
|
||||
|
||||
struct frexp_result_f32 {
|
||||
float fract;
|
||||
int exp;
|
||||
};
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const frexp_result_f32 res = {0.61500001f, 1};
|
||||
const int exp = res.exp;
|
||||
const float sig = res.fract;
|
||||
return;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
bug/tint/1757.wgsl:6:25 warning: use of deprecated language feature: 'sig' has been renamed to 'fract'
|
||||
let sig : f32 = res.sig;
|
||||
^^^
|
||||
|
||||
#version 310 es
|
||||
|
||||
struct frexp_result_f32 {
|
||||
float fract;
|
||||
int exp;
|
||||
};
|
||||
|
||||
|
||||
void tint_symbol() {
|
||||
frexp_result_f32 res = frexp_result_f32(0.61500001f, 1);
|
||||
int tint_symbol_1 = res.exp;
|
||||
float sig = res.fract;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
bug/tint/1757.wgsl:6:25 warning: use of deprecated language feature: 'sig' has been renamed to 'fract'
|
||||
let sig : f32 = res.sig;
|
||||
^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct frexp_result_f32 {
|
||||
float fract;
|
||||
int exp;
|
||||
};
|
||||
kernel void tint_symbol() {
|
||||
frexp_result_f32 const res = frexp_result_f32{.fract=0.61500001f, .exp=1};
|
||||
int const exp = res.exp;
|
||||
float const sig = res.fract;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
bug/tint/1757.wgsl:6:25 warning: use of deprecated language feature: 'sig' has been renamed to 'fract'
|
||||
let sig : f32 = res.sig;
|
||||
^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 13
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
OpName %__frexp_result_f32 "__frexp_result_f32"
|
||||
OpMemberName %__frexp_result_f32 0 "fract"
|
||||
OpMemberName %__frexp_result_f32 1 "exp"
|
||||
OpMemberDecorate %__frexp_result_f32 0 Offset 0
|
||||
OpMemberDecorate %__frexp_result_f32 1 Offset 4
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%int = OpTypeInt 32 1
|
||||
%__frexp_result_f32 = OpTypeStruct %float %int
|
||||
%float_0_61500001 = OpConstant %float 0.61500001
|
||||
%int_1 = OpConstant %int 1
|
||||
%10 = OpConstantComposite %__frexp_result_f32 %float_0_61500001 %int_1
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%11 = OpCompositeExtract %int %10 1
|
||||
%12 = OpCompositeExtract %float %10 0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -1,10 +0,0 @@
|
|||
bug/tint/1757.wgsl:6:25 warning: use of deprecated language feature: 'sig' has been renamed to 'fract'
|
||||
let sig : f32 = res.sig;
|
||||
^^^
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
let res = frexp(1.23);
|
||||
let exp : i32 = res.exp;
|
||||
let sig : f32 = res.sig;
|
||||
}
|
Loading…
Reference in New Issue