Skip to content

Commit 2876063

Browse files
committed
Initial commit
0 parents  commit 2876063

File tree

1,295 files changed

+603769
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,295 files changed

+603769
-0
lines changed

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
imgui.ini
2+
/nbproject
3+
/.settings
4+
core
5+
*~
6+
*.bak
7+
*.log
8+
*.orig
9+
*.rej
10+
11+
# Object files
12+
*.o
13+
*.ko
14+
*.obj
15+
*.elf
16+
17+
# Precompiled Headers
18+
*.gch
19+
*.pch
20+
21+
# Libraries
22+
*.lib
23+
*.a
24+
*.la
25+
*.lo
26+
27+
# Shared objects (inc. Windows DLLs)
28+
*.dll
29+
*.so
30+
*.so.*
31+
*.dylib
32+
33+
# Executables
34+
*.exe
35+
*.out
36+
*.app
37+
*.i*86
38+
*.x86_64
39+
*.hex
40+
41+
# Debug files
42+
*.dSYM/
43+
44+
# Eclipse
45+
/.project
46+
/.cproject
47+
48+
# VSCode
49+
/.vscode

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "lib/imguicolortextedit"]
2+
path = lib/imguicolortextedit
3+
url = https://github.com/cheako/ImGuiColorTextEdit.git
4+
[submodule "lib/whereami"]
5+
path = lib/whereami
6+
url = https://github.com/gpakosz/whereami

0000tri/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/data_dynamic.o
2+
/data_dynamic.c
3+
/*_frag.spv
4+
/libdata.so
5+
/*_vert.spv
6+
/vulkan

0000tri/0_frag.glsl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#version 400
2+
3+
#extension GL_ARB_separate_shader_objects : enable
4+
#extension GL_ARB_shading_language_420pack : enable
5+
6+
layout (location = 0) out vec4 outFragColor;
7+
8+
void main()
9+
{
10+
outFragColor = vec4(0.0, 0.0, 0.059, 1.0);
11+
}

0000tri/0_vert.glsl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#version 400
2+
3+
#extension GL_ARB_separate_shader_objects : enable
4+
#extension GL_ARB_shading_language_420pack : enable
5+
6+
layout (location = 0) in vec3 inPos;
7+
8+
out gl_PerVertex
9+
{
10+
vec4 gl_Position;
11+
};
12+
13+
void main() {
14+
gl_Position = vec4(inPos, 1.0);
15+
}

0000tri/Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Makefile for vulkan
2+
3+
# Our single executable
4+
OBJS = vulkan
5+
6+
all: $(OBJS)
7+
8+
include ../misc-targets.mk
9+
10+
DEPENDS = libdata.so
11+
vulkan: $(MYLDLIBS) $(DEPENDS)
12+
LIBDEPENDS_DYNAMIC = 0_vert.spv 0_frag.spv
13+
data_dynamic.o: $(LIBDEPENDS_DYNAMIC) data.h
14+
LIBDEPENDS = data_bulk.o data_dynamic.o
15+
libdata.so: libdata.c $(LIBDEPENDS)
16+
$(LINK.c) -shared -fPIC $(OUTPUT_OPTION) $^
17+
18+
clean:
19+
rm -f $(OBJS) $(DEPENDS) $(LIBDEPENDS) $(LIBDEPENDS_DYNAMIC)
20+
21+
22+
# valgrind discovers bugs, google it.
23+
test: clean all
24+
valgrind ./vulkan
25+
26+
.PHONY: all clean test

0000tri/data.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef HAND_DATA_H__
2+
#define HAND_DATA_H__
3+
4+
#define GLFW_INCLUDE_VULKAN
5+
#include <GLFW/glfw3.h>
6+
7+
extern GLFWwindow *data_window;
8+
9+
#ifdef NEWER_CGLM
10+
#define GLM_DEPTH_ZERO_TO_ONE
11+
#define GLM_FORCE_LEFT_HANDED
12+
#endif
13+
#include <cglm/cglm.h>
14+
15+
extern const void *data_model_vertex;
16+
extern const size_t data_model_vertex_count;
17+
extern const VkDeviceSize data_model_vertex_size;
18+
19+
extern const VkVertexInputBindingDescription data_binding_description;
20+
extern const VkVertexInputAttributeDescription data_attribute_descriptions[];
21+
extern const uint32_t data_attribute_descriptions_count;
22+
23+
typedef struct
24+
{
25+
struct
26+
{
27+
const void *spv;
28+
const size_t *size;
29+
} vert, frag;
30+
} data_material_shader_t;
31+
extern const data_material_shader_t data_material_shaders[];
32+
33+
#endif

0000tri/data_bulk.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "data.h"
2+
3+
typedef struct
4+
{
5+
vec3 position;
6+
} vertex_t;
7+
const vertex_t model_vertex[] = {
8+
{{0.0f, -0.5f, 0.5f}},
9+
{{0.5f, 0.5f, 0.5f}},
10+
{{-0.5f, 0.5f, 0.5f}},
11+
};
12+
const void *data_model_vertex = model_vertex;
13+
const size_t data_model_vertex_count =
14+
sizeof(model_vertex) / sizeof(vertex_t);
15+
const VkDeviceSize data_model_vertex_size = sizeof(model_vertex);
16+
const VkVertexInputBindingDescription data_binding_description = {
17+
.binding = 0,
18+
.stride = sizeof(vertex_t),
19+
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX};
20+
const VkVertexInputAttributeDescription data_attribute_descriptions[] = {
21+
{.location = 0,
22+
.binding = 0,
23+
.format = VK_FORMAT_R32G32B32_SFLOAT,
24+
.offset = offsetof(vertex_t, position)},
25+
};
26+
const uint32_t data_attribute_descriptions_count =
27+
sizeof(data_attribute_descriptions) /
28+
sizeof(data_attribute_descriptions[0]);

0000tri/data_dynamic.c.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "data.h"
2+
3+
const uint8_t material_shader_0_vert_spv[] = {
4+
syscmd(`xxd -i < 0_vert.spv')dnl
5+
};
6+
const size_t material_shader_0_vert_size = sizeof(material_shader_0_vert_spv);
7+
const uint8_t material_shader_0_frag_spv[] = {
8+
syscmd(`xxd -i < 0_frag.spv')dnl
9+
};
10+
const size_t material_shader_0_frag_size = sizeof(material_shader_0_frag_spv);

0000tri/libdata.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "data.h"
2+
3+
GLFWwindow *data_window = NULL;
4+
5+
const uint8_t material_shader_0_vert_spv[1];
6+
const size_t material_shader_0_vert_size;
7+
const uint8_t material_shader_0_frag_spv[1];
8+
const size_t material_shader_0_frag_size;
9+
const data_material_shader_t data_material_shaders[] = {
10+
{{
11+
material_shader_0_vert_spv,
12+
&material_shader_0_vert_size,
13+
},
14+
{
15+
material_shader_0_frag_spv,
16+
&material_shader_0_frag_size,
17+
}},
18+
};

0 commit comments

Comments
 (0)