Add fuzzing target to BUILD.gn
TEST=Built fuzzer in local checkout of Chromium with tint integrated. BUG=dawn:14 Change-Id: I84aacd41f893070c3af40f5e640361e177689f9e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20343 Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
parent
597f52add2
commit
d34b210e73
206
BUILD.gn
206
BUILD.gn
|
@ -22,7 +22,6 @@ import("tint_overrides_with_defaults.gni")
|
|||
|
||||
config("tint_common_config") {
|
||||
defines = []
|
||||
|
||||
if (tint_build_spv_reader) {
|
||||
defines += [ "TINT_BUILD_SPV_READER=1" ]
|
||||
} else {
|
||||
|
@ -46,6 +45,144 @@ config("tint_common_config") {
|
|||
} else {
|
||||
defines += [ "TINT_BUILD_WGSL_WRITER=0" ]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"${target_gen_dir}",
|
||||
"${tint_root_dir}/",
|
||||
"${tint_spirv_headers_dir}/include",
|
||||
"${tint_spirv_tools_dir}/",
|
||||
"${tint_spirv_tools_dir}/include",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generated - Generated source files
|
||||
###############################################################################
|
||||
# These are copies of rules from SPIRV-Tools with the names tweaked to be Tint
|
||||
# specific. They are needed here because referencing generated files in sibling
|
||||
# packages is difficult/impossible in Chromium. Parts of Tint's SPIRV handling
|
||||
# code depend on internal parts of SPIRV-Tools. This causes issues because when
|
||||
# Tint references the internal headers, since it causes a dependency on these
|
||||
# generated files, but they are not visible in the context building Tint. Thus
|
||||
# Tint generates its own copy of the generated files. Since they come from the
|
||||
# same source of truth, they should not vary.
|
||||
|
||||
template("tint_core_tables") {
|
||||
assert(defined(invoker.version), "Need version in $target_name generation.")
|
||||
|
||||
action("tint_core_tables_" + target_name) {
|
||||
script = "${tint_spirv_tools_dir}/utils/generate_grammar_tables.py"
|
||||
|
||||
version = invoker.version
|
||||
|
||||
core_json_file = "${tint_spirv_headers_dir}/include/spirv/$version/spirv.core.grammar.json"
|
||||
core_insts_file = "${target_gen_dir}/core.insts-$version.inc"
|
||||
operand_kinds_file = "${target_gen_dir}/operand.kinds-$version.inc"
|
||||
debuginfo_insts_file =
|
||||
"${tint_spirv_tools_dir}/source/extinst.debuginfo.grammar.json"
|
||||
cldebuginfo100_insts_file = "${tint_spirv_tools_dir}/source/extinst.opencl.debuginfo.100.grammar.json"
|
||||
|
||||
sources = [
|
||||
cldebuginfo100_insts_file,
|
||||
core_json_file,
|
||||
debuginfo_insts_file,
|
||||
]
|
||||
outputs = [
|
||||
core_insts_file,
|
||||
operand_kinds_file,
|
||||
]
|
||||
args = [
|
||||
"--spirv-core-grammar",
|
||||
rebase_path(core_json_file, root_build_dir),
|
||||
"--core-insts-output",
|
||||
rebase_path(core_insts_file, root_build_dir),
|
||||
"--extinst-debuginfo-grammar",
|
||||
rebase_path(debuginfo_insts_file, root_build_dir),
|
||||
"--extinst-cldebuginfo100-grammar",
|
||||
rebase_path(cldebuginfo100_insts_file, root_build_dir),
|
||||
"--operand-kinds-output",
|
||||
rebase_path(operand_kinds_file, root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("tint_core_enums") {
|
||||
assert(defined(invoker.version), "Need version in $target_name generation.")
|
||||
|
||||
action("tint_core_enums_" + target_name) {
|
||||
script = "${tint_spirv_tools_dir}/utils/generate_grammar_tables.py"
|
||||
|
||||
version = invoker.version
|
||||
|
||||
core_json_file = "${tint_spirv_headers_dir}/include/spirv/$version/spirv.core.grammar.json"
|
||||
debuginfo_insts_file =
|
||||
"${tint_spirv_tools_dir}/source/extinst.debuginfo.grammar.json"
|
||||
cldebuginfo100_insts_file = "${tint_spirv_tools_dir}/source/extinst.opencl.debuginfo.100.grammar.json"
|
||||
|
||||
extension_enum_file = "${target_gen_dir}/extension_enum.inc"
|
||||
extension_map_file = "${target_gen_dir}/enum_string_mapping.inc"
|
||||
|
||||
args = [
|
||||
"--spirv-core-grammar",
|
||||
rebase_path(core_json_file, root_build_dir),
|
||||
"--extinst-debuginfo-grammar",
|
||||
rebase_path(debuginfo_insts_file, root_build_dir),
|
||||
"--extinst-cldebuginfo100-grammar",
|
||||
rebase_path(cldebuginfo100_insts_file, root_build_dir),
|
||||
"--extension-enum-output",
|
||||
rebase_path(extension_enum_file, root_build_dir),
|
||||
"--enum-string-mapping-output",
|
||||
rebase_path(extension_map_file, root_build_dir),
|
||||
]
|
||||
inputs = [
|
||||
core_json_file,
|
||||
debuginfo_insts_file,
|
||||
cldebuginfo100_insts_file,
|
||||
]
|
||||
outputs = [
|
||||
extension_enum_file,
|
||||
extension_map_file,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("tint_language_header") {
|
||||
assert(defined(invoker.name), "Need name in $target_name generation.")
|
||||
|
||||
action("tint_language_header_" + target_name) {
|
||||
script = "${tint_spirv_tools_dir}/utils/generate_language_headers.py"
|
||||
|
||||
name = invoker.name
|
||||
extinst_output_path = "${target_gen_dir}/${name}.h"
|
||||
|
||||
args = [
|
||||
"--extinst-grammar",
|
||||
rebase_path(invoker.grammar_file, root_build_dir),
|
||||
"--extinst-output-path",
|
||||
rebase_path(extinst_output_path, root_build_dir),
|
||||
]
|
||||
inputs = [ invoker.grammar_file ]
|
||||
outputs = [ "${extinst_output_path}" ]
|
||||
}
|
||||
}
|
||||
|
||||
tint_core_tables("unified1") {
|
||||
version = "unified1"
|
||||
}
|
||||
|
||||
tint_core_enums("unified1") {
|
||||
version = "unified1"
|
||||
}
|
||||
|
||||
tint_language_header("debuginfo") {
|
||||
name = "DebugInfo"
|
||||
grammar_file = "${tint_spirv_tools_dir}/source/extinst.debuginfo.grammar.json"
|
||||
}
|
||||
|
||||
tint_language_header("cldebuginfo100") {
|
||||
name = "OpenCLDebugInfo100"
|
||||
grammar_file =
|
||||
"${tint_spirv_tools_dir}/source/extinst.opencl.debuginfo.100.grammar.json"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -223,6 +360,13 @@ source_set("libtint_core_src") {
|
|||
"src/writer/writer.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_core_enums_unified1",
|
||||
":tint_core_tables_unified1",
|
||||
":tint_language_header_cldebuginfo100",
|
||||
":tint_language_header_debuginfo",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
|
@ -231,14 +375,6 @@ source_set("libtint_core_src") {
|
|||
}
|
||||
}
|
||||
|
||||
config("libtint_spv_config") {
|
||||
include_dirs = [
|
||||
"${tint_spirv_tools_dir}/",
|
||||
"${tint_spirv_tools_dir}/include",
|
||||
"${target_gen_dir}/${tint_spirv_tools_gen}",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("libtint_spv_reader_src") {
|
||||
sources = [
|
||||
"src/reader/spirv/enum_converter.cc",
|
||||
|
@ -255,15 +391,15 @@ source_set("libtint_spv_reader_src") {
|
|||
]
|
||||
|
||||
deps = [
|
||||
"${tint_spirv_headers_dir}/:spv_headers",
|
||||
":tint_core_enums_unified1",
|
||||
":tint_core_tables_unified1",
|
||||
":tint_language_header_cldebuginfo100",
|
||||
":tint_language_header_debuginfo",
|
||||
"${tint_spirv_tools_dir}/:spvtools_opt",
|
||||
"${tint_spirv_tools_dir}/:spvtools_val",
|
||||
]
|
||||
|
||||
configs += [
|
||||
":tint_common_config",
|
||||
":libtint_spv_config",
|
||||
]
|
||||
configs += [ ":tint_common_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
|
@ -287,12 +423,7 @@ source_set("libtint_spv_writer_src") {
|
|||
"src/writer/spirv/operand.h",
|
||||
]
|
||||
|
||||
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
||||
|
||||
configs += [
|
||||
":tint_common_config",
|
||||
":libtint_spv_config",
|
||||
]
|
||||
configs += [ ":tint_common_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
|
@ -535,10 +666,7 @@ source_set("tint_unittests_spv_reader_src") {
|
|||
"src/reader/spirv/spirv_tools_helpers_test.h",
|
||||
]
|
||||
|
||||
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
||||
|
||||
configs += [
|
||||
":libtint_spv_config",
|
||||
":tint_common_config",
|
||||
":tint_unittests_config",
|
||||
]
|
||||
|
@ -574,10 +702,8 @@ source_set("tint_unittests_spv_writer_src") {
|
|||
"src/writer/spirv/spv_dump.cc",
|
||||
"src/writer/spirv/spv_dump.h",
|
||||
]
|
||||
deps = [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
||||
|
||||
configs += [
|
||||
":libtint_spv_config",
|
||||
":tint_common_config",
|
||||
":tint_unittests_config",
|
||||
]
|
||||
|
@ -769,6 +895,28 @@ test("tint_unittests") {
|
|||
testonly = true
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Fuzzers - Libfuzzer based fuzzing targets for Chromium
|
||||
###############################################################################
|
||||
# To run the fuzzers outside of Chromium, use the CMake based builds.
|
||||
|
||||
if (build_with_chromium) {
|
||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||
|
||||
source_set("tint_wgsl_reader_fuzzer_src") {
|
||||
sources = [ "fuzzers/tint_wgsl_reader_fuzzer.cc" ]
|
||||
configs += [ ":tint_common_config" ]
|
||||
}
|
||||
|
||||
fuzzer_test("tint_wgsl_reader_fuzzer") {
|
||||
sources = []
|
||||
deps = [
|
||||
":libtint",
|
||||
":tint_wgsl_reader_fuzzer_src",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Samples - Executables exposing command line functionality
|
||||
###############################################################################
|
||||
|
@ -776,7 +924,7 @@ test("tint_unittests") {
|
|||
config("tint_exe_config") {
|
||||
include_dirs = []
|
||||
if (tint_build_spv_reader || tint_build_spv_writer) {
|
||||
include_dirs = [ "${tint_spirv_tools_dir}/include/" ]
|
||||
include_dirs += [ "${tint_spirv_tools_dir}/include/" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,8 +936,10 @@ executable("tint_exe") {
|
|||
deps += [ "${tint_spirv_headers_dir}/:spv_headers" ]
|
||||
}
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
configs += [ ":tint_exe_config" ]
|
||||
configs += [
|
||||
":tint_common_config",
|
||||
":tint_exe_config",
|
||||
]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
namespace tint {
|
||||
namespace ast {
|
||||
|
||||
Import::Import() = default;
|
||||
|
||||
Import::Import(const std::string& path, const std::string& name)
|
||||
: Node(), path_(path), name_(name) {}
|
||||
|
||||
|
@ -27,6 +29,8 @@ Import::Import(const Source& source,
|
|||
const std::string& name)
|
||||
: Node(source), path_(path), name_(name) {}
|
||||
|
||||
Import::Import(Import&&) = default;
|
||||
|
||||
Import::~Import() = default;
|
||||
|
||||
bool Import::IsValid() const {
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ast {
|
|||
class Import : public Node {
|
||||
public:
|
||||
/// Create a new empty import statement
|
||||
Import() = default;
|
||||
Import();
|
||||
/// Create a new import statement
|
||||
/// @param path The import path e.g. GLSL.std.450
|
||||
/// @param name The import reference name e.g. std
|
||||
|
@ -43,7 +43,7 @@ class Import : public Node {
|
|||
const std::string& path,
|
||||
const std::string& name);
|
||||
/// Move constructor
|
||||
Import(Import&&) = default;
|
||||
Import(Import&&);
|
||||
|
||||
~Import() override;
|
||||
|
||||
|
|
|
@ -697,7 +697,7 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue(
|
|||
}
|
||||
|
||||
if (inst.opcode() == SpvOpBitcast) {
|
||||
auto target_ty = parser_impl_.ConvertType(inst.type_id());
|
||||
auto* target_ty = parser_impl_.ConvertType(inst.type_id());
|
||||
return {target_ty,
|
||||
std::make_unique<ast::AsExpression>(target_ty, operand(0).expr)};
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -154,7 +154,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -183,7 +183,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -212,7 +212,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -243,7 +243,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -274,7 +274,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -307,7 +307,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -340,7 +340,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -375,7 +375,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -402,7 +402,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -680,7 +680,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
|
@ -715,7 +715,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
|
@ -824,7 +824,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
|
@ -859,7 +859,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
|
|
|
@ -384,7 +384,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -411,7 +411,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -440,7 +440,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -469,7 +469,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -496,7 +496,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -527,7 +527,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -560,7 +560,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -592,7 +592,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
|
|
@ -71,7 +71,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
@ -97,7 +97,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
|
|
@ -202,7 +202,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) {
|
|||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
|
|
@ -172,6 +172,17 @@ bool AssumesResultSignednessMatchesBinaryFirstOperand(SpvOp opcode) {
|
|||
|
||||
} // namespace
|
||||
|
||||
TypedExpression::TypedExpression() : type(nullptr), expr(nullptr) {}
|
||||
|
||||
TypedExpression::TypedExpression(ast::type::Type* t,
|
||||
std::unique_ptr<ast::Expression> e)
|
||||
: type(t), expr(std::move(e)) {}
|
||||
|
||||
TypedExpression::TypedExpression(TypedExpression&& other)
|
||||
: type(other.type), expr(std::move(other.expr)) {}
|
||||
|
||||
TypedExpression::~TypedExpression() {}
|
||||
|
||||
ParserImpl::ParserImpl(Context* ctx, const std::vector<uint32_t>& spv_binary)
|
||||
: Reader(ctx),
|
||||
spv_binary_(spv_binary),
|
||||
|
@ -509,9 +520,9 @@ bool ParserImpl::EmitEntryPoints() {
|
|||
ast::type::Type* ParserImpl::ConvertType(
|
||||
const spvtools::opt::analysis::Integer* int_ty) {
|
||||
if (int_ty->width() == 32) {
|
||||
auto signed_ty =
|
||||
auto* signed_ty =
|
||||
ctx_.type_mgr().Get(std::make_unique<ast::type::I32Type>());
|
||||
auto unsigned_ty =
|
||||
auto* unsigned_ty =
|
||||
ctx_.type_mgr().Get(std::make_unique<ast::type::U32Type>());
|
||||
signed_type_for_[unsigned_ty] = signed_ty;
|
||||
unsigned_type_for_[signed_ty] = unsigned_ty;
|
||||
|
|
|
@ -55,16 +55,16 @@ using DecorationList = std::vector<Decoration>;
|
|||
// An AST expression with its type.
|
||||
struct TypedExpression {
|
||||
/// Dummy constructor
|
||||
TypedExpression() : type(nullptr), expr(nullptr) {}
|
||||
TypedExpression();
|
||||
/// Constructor
|
||||
/// @param t the type
|
||||
/// @param e the expression
|
||||
TypedExpression(ast::type::Type* t, std::unique_ptr<ast::Expression> e)
|
||||
: type(t), expr(std::move(e)) {}
|
||||
TypedExpression(ast::type::Type* t, std::unique_ptr<ast::Expression> e);
|
||||
/// Move constructor
|
||||
/// @param other the other typed expression
|
||||
TypedExpression(TypedExpression&& other)
|
||||
: type(other.type), expr(std::move(other.expr)) {}
|
||||
TypedExpression(TypedExpression&& other);
|
||||
/// Destructor
|
||||
~TypedExpression();
|
||||
/// The type
|
||||
ast::type::Type* type;
|
||||
/// The expression
|
||||
|
|
|
@ -1685,7 +1685,7 @@ TEST_P(ImportData_SingleParamTest, Vector) {
|
|||
td()->GetImportData({0, 0}, "GLSL.std.450", param.name, params, &id);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->is_float_vector());
|
||||
EXPECT_EQ(type->AsVector()->size(), 3);
|
||||
EXPECT_EQ(type->AsVector()->size(), 3u);
|
||||
EXPECT_EQ(id, param.value);
|
||||
}
|
||||
|
||||
|
@ -1924,7 +1924,7 @@ TEST_P(ImportData_TwoParamTest, Vector) {
|
|||
td()->GetImportData({0, 0}, "GLSL.std.450", param.name, params, &id);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->is_float_vector());
|
||||
EXPECT_EQ(type->AsVector()->size(), 3);
|
||||
EXPECT_EQ(type->AsVector()->size(), 3u);
|
||||
EXPECT_EQ(id, param.value);
|
||||
}
|
||||
|
||||
|
@ -2332,7 +2332,7 @@ TEST_P(ImportData_ThreeParamTest, Vector) {
|
|||
td()->GetImportData({0, 0}, "GLSL.std.450", param.name, params, &id);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->is_float_vector());
|
||||
EXPECT_EQ(type->AsVector()->size(), 3);
|
||||
EXPECT_EQ(type->AsVector()->size(), 3u);
|
||||
EXPECT_EQ(id, param.value);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ import("//build_overrides/tint.gni")
|
|||
# This file contains Tint-related build flags.
|
||||
|
||||
declare_args() {
|
||||
# Path to tint checkout
|
||||
if (!defined(tint_root_dir)) {
|
||||
tint_root_dir = "//"
|
||||
}
|
||||
|
||||
# Path to spirv-tools checkout
|
||||
if (!defined(tint_spirv_tools_dir)) {
|
||||
tint_spirv_tools_dir = "//third_party/spirv-tools"
|
||||
|
@ -37,10 +42,6 @@ declare_args() {
|
|||
tint_spirv_headers_dir = "//third_party/spirv-headers"
|
||||
}
|
||||
|
||||
# Generate documentation
|
||||
# TODO(rharrison): Implement documentation support
|
||||
tint_build_doc = false
|
||||
|
||||
# Build the SPIR-V input reader
|
||||
if (!defined(tint_build_spv_reader)) {
|
||||
tint_build_spv_reader = false
|
||||
|
@ -61,10 +62,6 @@ declare_args() {
|
|||
tint_build_wgsl_writer = false
|
||||
}
|
||||
|
||||
# Generate fuzzers
|
||||
# TODO(rharrison): Implement fuzzer support
|
||||
tint_build_fuzzers = false
|
||||
|
||||
# Enable memory sanitizer
|
||||
# TODO(rharrison): Implement sanitizer support
|
||||
tint_enable_msan = false
|
||||
|
|
Loading…
Reference in New Issue