1
Fork 0

Add dummy Vulkan backend

This commit is contained in:
Joshua Goins 2022-10-03 22:49:19 -04:00
parent d965f83daa
commit cc526e1d89
4 changed files with 125 additions and 1 deletions

View file

@ -490,7 +490,8 @@ PLATFORM_CFLAGS += -DNO_SEGMENTED_MEMORY -DUSE_SYSTEM_MALLOC
# Compiler and linker flags for graphics backend # Compiler and linker flags for graphics backend
ifeq ($(ENABLE_OPENGL),1) ifeq ($(ENABLE_OPENGL),1)
GFX_CFLAGS := -DENABLE_OPENGL # TODO: right now the opengl and vulkan backends are linked, will seperate later...
GFX_CFLAGS := -DENABLE_OPENGL -DENABLE_VULKAN
GFX_LDFLAGS := GFX_LDFLAGS :=
ifeq ($(TARGET_WINDOWS),1) ifeq ($(TARGET_WINDOWS),1)
GFX_CFLAGS += $(shell sdl2-config --cflags) -DGLEW_STATIC GFX_CFLAGS += $(shell sdl2-config --cflags) -DGLEW_STATIC

110
src/pc/gfx/gfx_vulkan.cpp Normal file
View file

@ -0,0 +1,110 @@
#ifdef ENABLE_VULKAN
#include <time.h>
#include <errno.h>
#include "gfx_rendering_api.h"
static bool gfx_vulkan_renderer_z_is_from_0_to_1(void) {
return false;
}
static void gfx_vulkan_renderer_unload_shader(struct ShaderProgram *old_prg) {
}
static void gfx_vulkan_renderer_load_shader(struct ShaderProgram *new_prg) {
}
static struct ShaderProgram *gfx_vulkan_renderer_create_and_load_new_shader(uint32_t shader_id) {
return NULL;
}
static struct ShaderProgram *gfx_vulkan_renderer_lookup_shader(uint32_t shader_id) {
return NULL;
}
static void gfx_vulkan_renderer_shader_get_info(struct ShaderProgram *prg, uint8_t *num_inputs, bool used_textures[2]) {
*num_inputs = 0;
used_textures[0] = false;
used_textures[1] = false;
}
static uint32_t gfx_vulkan_renderer_new_texture(void) {
return 0;
}
static void gfx_vulkan_renderer_select_texture(int tile, uint32_t texture_id) {
}
static void gfx_vulkan_renderer_upload_texture(const uint8_t *rgba32_buf, int width, int height) {
}
static void gfx_vulkan_renderer_set_sampler_parameters(int tile, bool linear_filter, uint32_t cms, uint32_t cmt) {
}
static void gfx_vulkan_renderer_set_depth_test(bool depth_test) {
}
static void gfx_vulkan_renderer_set_depth_mask(bool z_upd) {
}
static void gfx_vulkan_renderer_set_zmode_decal(bool zmode_decal) {
}
static void gfx_vulkan_renderer_set_viewport(int x, int y, int width, int height) {
}
static void gfx_vulkan_renderer_set_scissor(int x, int y, int width, int height) {
}
static void gfx_vulkan_renderer_set_use_alpha(bool use_alpha) {
}
static void gfx_vulkan_renderer_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris) {
}
static void gfx_vulkan_renderer_init(void) {
}
static void gfx_vulkan_renderer_on_resize(void) {
}
static void gfx_vulkan_renderer_start_frame(void) {
}
static void gfx_vulkan_renderer_end_frame(void) {
}
static void gfx_vulkan_renderer_finish_render(void) {
}
static const char* gfx_vulkan_get_name() {
return "Vulkan";
}
struct GfxRenderingAPI gfx_vulkan_api = {
gfx_vulkan_renderer_z_is_from_0_to_1,
gfx_vulkan_renderer_unload_shader,
gfx_vulkan_renderer_load_shader,
gfx_vulkan_renderer_create_and_load_new_shader,
gfx_vulkan_renderer_lookup_shader,
gfx_vulkan_renderer_shader_get_info,
gfx_vulkan_renderer_new_texture,
gfx_vulkan_renderer_select_texture,
gfx_vulkan_renderer_upload_texture,
gfx_vulkan_renderer_set_sampler_parameters,
gfx_vulkan_renderer_set_depth_test,
gfx_vulkan_renderer_set_depth_mask,
gfx_vulkan_renderer_set_zmode_decal,
gfx_vulkan_renderer_set_viewport,
gfx_vulkan_renderer_set_scissor,
gfx_vulkan_renderer_set_use_alpha,
gfx_vulkan_renderer_draw_triangles,
gfx_vulkan_renderer_init,
gfx_vulkan_renderer_on_resize,
gfx_vulkan_renderer_start_frame,
gfx_vulkan_renderer_end_frame,
gfx_vulkan_renderer_finish_render,
gfx_vulkan_get_name,
};
#endif

12
src/pc/gfx/gfx_vulkan.h Normal file
View file

@ -0,0 +1,12 @@
#ifdef ENABLE_VULKAN
#ifndef GFX_VULKAN_H
#define GFX_VULKAN_H
#include "gfx_rendering_api.h"
extern struct GfxRenderingAPI gfx_vulkan_api;
#endif
#endif

View file

@ -18,6 +18,7 @@
#include "gfx/gfx_glx.h" #include "gfx/gfx_glx.h"
#include "gfx/gfx_sdl.h" #include "gfx/gfx_sdl.h"
#include "gfx/gfx_dummy.h" #include "gfx/gfx_dummy.h"
#include "gfx/gfx_vulkan.h"
#include "audio/audio_api.h" #include "audio/audio_api.h"
#include "audio/audio_wasapi.h" #include "audio/audio_wasapi.h"