Start wiring up impellerc

This commit is contained in:
Chinmay Garde
2021-05-09 18:24:11 -07:00
committed by Dan Field
parent adb97f773a
commit 981e697f1f
5 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
executable("compiler") {
output_name = "impellerc"
sources = [ "impellerc_main.cc" ]
deps = [
"//flutter/fml",
"//flutter/runtime:libdart",
"//third_party/shaderc_flutter",
]
}

View File

@@ -0,0 +1,23 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/fml/command_line.h"
#include "flutter/fml/macros.h"
#include "third_party/shaderc/libshaderc/include/shaderc/shaderc.hpp"
namespace impeller {
namespace compiler {
bool Main(const fml::CommandLine& command_line) {
return false;
}
} // namespace compiler
} // namespace impeller
int main(int argc, char const* argv[]) {
return impeller::compiler::Main(fml::CommandLineFromArgcArgv(argc, argv))
? EXIT_SUCCESS
: EXIT_FAILURE;
}

View File

@@ -0,0 +1,7 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
template("impeller_shaders") {
assert(defined(invoker.shaders), "Impeller shaders must be specified.")
}

View File

@@ -0,0 +1,12 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(binding = 1) uniform sampler2D textureSampler;
layout(location = 0) in vec2 inTextureCoord;
layout(location = 0) out vec4 outColor;
void main() {
outColor = texture(textureSampler, inTextureCoord);
}

View File

@@ -0,0 +1,18 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(binding = 0) uniform UniformBufferObject {
mat4 model;
mat4 view;
mat4 projection;
} ubo;
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec2 inTextureCoord;
layout(location = 0) out vec2 outTextureCoord;
void main() {
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPosition, 1.0);
outTextureCoord = inTextureCoord;
}