Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cheako committed Mar 3, 2019
0 parents commit 16b7940
Show file tree
Hide file tree
Showing 1,294 changed files with 587,126 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
imgui.ini
/nbproject
/.settings
core
*~
*.bak
*.log
*.orig
*.rej

# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/

# Eclipse
/.project
/.cproject

# VSCode
/.vscode
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "lib/imguicolortextedit"]
path = lib/imguicolortextedit
url = https://github.com/cheako/ImGuiColorTextEdit.git
[submodule "lib/whereami"]
path = lib/whereami
url = https://github.com/gpakosz/whereami
6 changes: 6 additions & 0 deletions 0000tri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/data_dynamic.o
/data_dynamic.c
/*_frag.spv
/libdata.so
/*_vert.spv
/vulkan
11 changes: 11 additions & 0 deletions 0000tri/0_frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 400

#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable

layout (location = 0) out vec4 outFragColor;

void main()
{
outFragColor = vec4(0.0, 0.0, 0.059, 1.0);
}
15 changes: 15 additions & 0 deletions 0000tri/0_vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 400

#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable

layout (location = 0) in vec3 inPos;

out gl_PerVertex
{
vec4 gl_Position;
};

void main() {
gl_Position = vec4(inPos, 1.0);
}
26 changes: 26 additions & 0 deletions 0000tri/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Makefile for vulkan

# Our single executable
OBJS = vulkan

all: $(OBJS)

include ../misc-targets.mk

DEPENDS = libdata.so
vulkan: $(MYLDLIBS) $(DEPENDS)
LIBDEPENDS_DYNAMIC = 0_vert.spv 0_frag.spv
data_dynamic.o: $(LIBDEPENDS_DYNAMIC) data.h
LIBDEPENDS = data_bulk.o data_dynamic.o
libdata.so: libdata.c $(LIBDEPENDS)
$(LINK.c) -shared -fPIC $(OUTPUT_OPTION) $^

clean:
rm -f $(OBJS) $(DEPENDS) $(LIBDEPENDS) $(LIBDEPENDS_DYNAMIC)


# valgrind discovers bugs, google it.
test: clean all
valgrind ./vulkan

.PHONY: all clean test
33 changes: 33 additions & 0 deletions 0000tri/data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef HAND_DATA_H__
#define HAND_DATA_H__

#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>

extern GLFWwindow *data_window;

#ifdef NEWER_CGLM
#define GLM_DEPTH_ZERO_TO_ONE
#define GLM_FORCE_LEFT_HANDED
#endif
#include <cglm/cglm.h>

extern const void *data_model_vertex;
extern const size_t data_model_vertex_count;
extern const VkDeviceSize data_model_vertex_size;

extern const VkVertexInputBindingDescription data_binding_description;
extern const VkVertexInputAttributeDescription data_attribute_descriptions[];
extern const uint32_t data_attribute_descriptions_count;

typedef struct
{
struct
{
const void *spv;
const size_t *size;
} vert, frag;
} data_material_shader_t;
extern const data_material_shader_t data_material_shaders[];

#endif
28 changes: 28 additions & 0 deletions 0000tri/data_bulk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "data.h"

typedef struct
{
vec3 position;
} vertex_t;
const vertex_t model_vertex[] = {
{{0.0f, -0.5f, 0.5f}},
{{0.5f, 0.5f, 0.5f}},
{{-0.5f, 0.5f, 0.5f}},
};
const void *data_model_vertex = model_vertex;
const size_t data_model_vertex_count =
sizeof(model_vertex) / sizeof(vertex_t);
const VkDeviceSize data_model_vertex_size = sizeof(model_vertex);
const VkVertexInputBindingDescription data_binding_description = {
.binding = 0,
.stride = sizeof(vertex_t),
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX};
const VkVertexInputAttributeDescription data_attribute_descriptions[] = {
{.location = 0,
.binding = 0,
.format = VK_FORMAT_R32G32B32_SFLOAT,
.offset = offsetof(vertex_t, position)},
};
const uint32_t data_attribute_descriptions_count =
sizeof(data_attribute_descriptions) /
sizeof(data_attribute_descriptions[0]);
10 changes: 10 additions & 0 deletions 0000tri/data_dynamic.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "data.h"

const uint8_t material_shader_0_vert_spv[] = {
syscmd(`xxd -i < 0_vert.spv')dnl
};
const size_t material_shader_0_vert_size = sizeof(material_shader_0_vert_spv);
const uint8_t material_shader_0_frag_spv[] = {
syscmd(`xxd -i < 0_frag.spv')dnl
};
const size_t material_shader_0_frag_size = sizeof(material_shader_0_frag_spv);
18 changes: 18 additions & 0 deletions 0000tri/libdata.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "data.h"

GLFWwindow *data_window = NULL;

const uint8_t material_shader_0_vert_spv[1];
const size_t material_shader_0_vert_size;
const uint8_t material_shader_0_frag_spv[1];
const size_t material_shader_0_frag_size;
const data_material_shader_t data_material_shaders[] = {
{{
material_shader_0_vert_spv,
&material_shader_0_vert_size,
},
{
material_shader_0_frag_spv,
&material_shader_0_frag_size,
}},
};
Loading

0 comments on commit 16b7940

Please sign in to comment.