-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: more advancements with vulkan (doesn't work rn tho)
- Loading branch information
1 parent
380caae
commit d2d05c9
Showing
23 changed files
with
609 additions
and
65 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
|
||
BasedOnStyle: LLVM | ||
UseTab: Never | ||
IndentWidth: 4 | ||
TabWidth: 4 | ||
BreakBeforeBraces: Allman | ||
AllowShortIfStatementsOnASingleLine: false | ||
IndentCaseLabels: false | ||
ColumnLimit: 0 | ||
AccessModifierOffset: -4 | ||
FixNamespaceComments: true | ||
SpaceBeforeInheritanceColon: true | ||
BreakInheritanceList: AfterColon | ||
IndentPPDirectives: AfterHash | ||
ForEachMacros: ["__dummy_foreach"] | ||
IncludeBlocks: Merge | ||
IncludeCategories: | ||
- Regex: '<([A-Za-z0-9.\/-_])+>' | ||
Priority: 0 | ||
SortPriority: 0 | ||
- Regex: '"([A-Za-z0-9.\/-_])+"' | ||
Priority: 10 | ||
SortPriority: 10 | ||
... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ | |
|
||
#define WINDOW_WIDTH (1920) | ||
#define WINDOW_HEIGHT (1080) | ||
|
||
#define USE_GLFW | ||
#define USE_VULKAN |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
#pragma once | ||
#pragma once | ||
|
||
// Regular bold text | ||
#define BBLK "\e[1;30m" | ||
#define BRED "\e[1;31m" | ||
#define BGRN "\e[1;32m" | ||
#define BYEL "\e[1;33m" | ||
#define BBLU "\e[1;34m" | ||
#define BMAG "\e[1;35m" | ||
#define BCYN "\e[1;36m" | ||
#define BWHT "\e[1;37m" | ||
|
||
#define CRESET "\e[0m" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
#pragma once | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <window/window.h> | ||
|
||
typedef struct | ||
{ | ||
int id; | ||
} Render; | ||
|
||
int render_engine_init(void); | ||
int render_engine_init(Window *window); | ||
|
||
int render_engine_deinit(void); | ||
|
||
int render_init(Render* self); | ||
int render_init(Render *self); | ||
|
||
int render_deinit(Render* self); | ||
int render_deinit(Render *self); | ||
|
||
int render_surface_init(Render *self, uintptr_t handle); | ||
|
||
int render_surface_deinit(Render *self, uintptr_t handle); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#pragma once | ||
|
||
#include <ds/vec.h> | ||
#include <render/vulkan/vulkan.h> | ||
#include <stdbool.h> | ||
|
||
typedef struct | ||
{ | ||
uint32_t index; | ||
uint32_t family_idx; | ||
uint32_t present_family; | ||
bool _present; | ||
bool _has_present_family; | ||
} QueueFamilyIndices; | ||
|
||
void vulkan_pick_physical_device(VulkanCtx *self); | ||
|
||
QueueFamilyIndices vulkan_pick_queue_family(VulkanCtx *self); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#define VK_USE_PLATFORM_XLIB_KHR | ||
#define GLFW_INCLUDE_VULKAN | ||
#include <GLFW/glfw3.h> | ||
#define GLFW_EXPOSE_NATIVE_X11 | ||
#include <GLFW/glfw3native.h> | ||
#include <render/vulkan/vulkan.h> | ||
#include <stdint.h> | ||
|
||
VkXlibSurfaceCreateInfoKHR glfw_vulkan_handle(GLFWwindow *window) | ||
{ | ||
VkXlibSurfaceCreateInfoKHR sinfo = { | ||
.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR, | ||
.dpy = glfwGetX11Display(), | ||
.window = glfwGetX11Window(window), | ||
.pNext = NULL, | ||
}; | ||
return sinfo; | ||
} | ||
int vulkan_render_surface_init(VulkanCtx *self, uintptr_t handle) | ||
{ | ||
VkXlibSurfaceCreateInfoKHR sinfo = glfw_vulkan_handle((GLFWwindow *)handle); | ||
vulkan_assert_success$(vkCreateXlibSurfaceKHR(self->instance, &sinfo, NULL, &self->surface)); | ||
|
||
// vulkan_assert_success$(glfwCreateWindowSurface(self->instance, (GLFWwindow *)handle, NULL, &self->surface)); | ||
return 0; | ||
} | ||
int vulkan_render_surface_deinit(VulkanCtx *self) | ||
{ | ||
|
||
vkDestroySurfaceKHR(self->instance, self->surface, NULL); | ||
return 0; | ||
} | ||
|
||
void vulkan_render_surface_target_size(VulkanCtx *self, uintptr_t handle, int *width, int *height) | ||
{ | ||
(void)self; | ||
glfwGetFramebufferSize((GLFWwindow *)handle, width, height); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#pragma once | ||
#include <vulkan/vulkan.h> | ||
#include <stdbool.h> | ||
#include <vulkan/vulkan.h> | ||
|
||
bool vulkan_load_validation_layer(VkInstanceCreateInfo *create); | ||
|
||
bool vulkan_load_validation_layer(VkInstanceCreateInfo* create); | ||
void vulkan_load_validation_layer_device(VkDeviceCreateInfo *info); |
Oops, something went wrong.