View main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// triangle/main.cpp | |
... | |
void createGraphicsPipeline() { | |
auto vertShaderCode = readFile("triangle/shaders/shader.vert.spv"); | |
auto fragShaderCode = readFile("triangle/shaders/shader.frag.spv"); | |
... | |
} |
View BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# triangle/BUILD | |
load("@rules_cc//cc:defs.bzl", "cc_binary") | |
cc_binary( | |
name = "triangle", | |
srcs = glob(["*.cpp"]), | |
data = [ | |
"//triangle/shaders:vert_shader", | |
"//triangle/shaders:frag_shader", | |
], |
View BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# triangle/shaders/BUILD | |
load("@rules_vulkan//glsl:defs.bzl", "glsl_shader") | |
package(default_visibility = ["//triangle:__pkg__"]) | |
glsl_shader( | |
name = "vert_shader", | |
shader = "shader.vert", | |
) |
View shader.vert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// triangle/shaders/shader.vert | |
#version 450 | |
layout(location = 0) out vec3 fragColor; | |
vec2 positions[3] = vec2[]( | |
vec2(0.0, -0.5), | |
vec2(0.5, 0.5), | |
vec2(-0.5, 0.5) | |
); |
View shader.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// triangle/shaders/shader.frag | |
#version 450 | |
layout(location = 0) in vec3 fragColor; | |
layout(location = 0) out vec4 outColor; | |
void main() { | |
outColor = vec4(fragColor, 1.0); | |
} |
View main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// env_setup/main.cpp | |
#define GLFW_INCLUDE_VULKAN | |
#include <GLFW/glfw3.h> | |
#define GLM_FORCE_RADIANS | |
#define GLM_FORCE_DEPTH_ZERO_TO_ONE | |
#include <glm/vec4.hpp> | |
#include <glm/mat4x4.hpp> | |
#include <iostream> |
View WORKSPACE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WORKSPACE | |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | |
git_repository( | |
name = "rules_vulkan", | |
remote = "https://github.com/jadarve/rules_vulkan.git", | |
tag = "v0.0.6" | |
) | |
load("@rules_vulkan//vulkan:repositories.bzl", "vulkan_repositories") |
View BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# third_party/glfw/BUILD | |
package(default_visibility = ["//visibility:public"]) | |
alias( | |
name = "glfw", | |
actual = "@glfw", | |
) |
View WORKSPACE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WORKSPACE | |
... | |
GLFW_VERSION = "3.3.5" | |
http_archive( | |
name = "glfw", | |
build_file = "@//third_party/glfw:glfw.BUILD", | |
sha256 = "a89bb6074bc12bc12fcd322dcf848af81b679ccdc695f70b29ca8a9aa066684b", | |
strip_prefix = "glfw-{}".format(GLFW_VERSION), | |
urls = ["https://github.com/glfw/glfw/archive/{}.zip".format(GLFW_VERSION)], |
View BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# third_party/glfw/glfw.BUILD | |
... | |
cc_library( | |
name = "glfw", | |
hdrs = [ | |
"include/GLFW/glfw3.h", | |
"include/GLFW/glfw3native.h", | |
], | |
linkopts = select({ | |
"@bazel_tools//src/conditions:windows": WIN32_LINKOPTS, |
NewerOlder