6#include "flutter/testing/testing.h"
7#include "gtest/gtest.h"
28 GTEST_SKIP() <<
"Not supported with SkSL";
30 ASSERT_TRUE(CanCompileAndReflect(
"sample.vert"));
38 GTEST_SKIP() <<
"Not supported with SkSL";
40 ASSERT_TRUE(CanCompileAndReflect(
46 GTEST_SKIP() <<
"Not supported with SkSL";
48 ASSERT_TRUE(CanCompileAndReflect(
"multiple_stages.hlsl",
51 ASSERT_TRUE(CanCompileAndReflect(
"multiple_stages.hlsl",
58 GTEST_SKIP_(
"Only enabled on Metal backends till ES 3.2 support is added.");
60 ASSERT_TRUE(CanCompileAndReflect(
"sample.comp"));
66 GTEST_SKIP() <<
"Not supported with SkSL";
75 GTEST_SKIP() <<
"Not supported with SkSL";
78 ASSERT_FALSE(CanCompileAndReflect(
"struct_def_bug.vert"));
89 auto get_binding = [&](
const char* fixture) -> uint32_t {
90 auto json_fd = GetReflectionJson(fixture);
92 return shader_json[
"buffers"][0][
"binding"].get<uint32_t>();
95 auto vert_uniform_binding = get_binding(
"sample.vert");
96 auto frag_uniform_binding = get_binding(
"sample.frag");
98 ASSERT_GT(frag_uniform_binding, vert_uniform_binding);
103 GTEST_SKIP() <<
"Not supported with SkSL";
105 ASSERT_TRUE(CanCompileAndReflect(
"sample_with_binding.vert",
109 struct binding_and_set {
114 auto get_binding = [&](
const char* fixture) -> binding_and_set {
115 auto json_fd = GetReflectionJson(fixture);
117 uint32_t binding = shader_json[
"buffers"][0][
"binding"].get<uint32_t>();
118 uint32_t
set = shader_json[
"buffers"][0][
"set"].get<uint32_t>();
119 return {binding,
set};
122 auto vert_uniform_binding = get_binding(
"sample_with_binding.vert");
123 auto frag_uniform_binding = get_binding(
"sample.frag");
125 ASSERT_EQ(frag_uniform_binding.set, 0u);
126 ASSERT_EQ(vert_uniform_binding.set, 3u);
127 ASSERT_EQ(vert_uniform_binding.binding, 17u);
132 GTEST_SKIP() <<
"Only supported on SkSL";
137 auto shader = GetShaderFile(
"texture_lookup.frag", GetParam());
138 std::string_view shader_mapping(
139 reinterpret_cast<const char*
>(shader->GetMapping()), shader->GetSize());
141 constexpr std::string_view expected =
142 "textureA.eval(textureA_size * ( vec2(1.0) + flutter_FragCoord.xy));";
144 EXPECT_NE(shader_mapping.find(expected), std::string::npos);
149 GTEST_SKIP() <<
"Only supported on SkSL";
151 ASSERT_TRUE(CanCompileAndReflect(
"struct_internal.frag",
155#define INSTANTIATE_TARGET_PLATFORM_TEST_SUITE_P(suite_name) \
156 INSTANTIATE_TEST_SUITE_P( \
157 suite_name, CompilerTest, \
158 ::testing::Values(TargetPlatform::kOpenGLES, \
159 TargetPlatform::kOpenGLDesktop, \
160 TargetPlatform::kMetalDesktop, \
161 TargetPlatform::kMetalIOS, TargetPlatform::kSkSL), \
162 [](const ::testing::TestParamInfo<CompilerTest::ParamType>& info) { \
163 return TargetPlatformToString(info.param); \
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
TEST(CompilerTest, ShaderKindMatchingIsSuccessful)
INSTANTIATE_TARGET_PLATFORM_TEST_SUITE_P(CompilerSuite)
TEST_P(CompilerTest, CanCompile)
SourceType SourceTypeFromFileName(const std::string &file_name)
bool TargetPlatformIsMetal(TargetPlatform platform)
bool TargetPlatformIsVulkan(TargetPlatform platform)
def parse(repo_root, recipes_cfg_path)