Skip to content

Commit 74fad23

Browse files
authored
Merge pull request #127 from Kylogias/cnfg-vk
Add Vulkan Support
2 parents c22e8ee + 6370267 commit 74fad23

14 files changed

Lines changed: 2620 additions & 581 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ TextTool/text
77
ogltest
88
rawdraw
99
rawdraw_ogl
10+
rawdraw_vk
1011
simple
1112
examples/fontsize
1213
examples/fontsize_ogl
@@ -15,3 +16,5 @@ tools/binary_to_buffer
1516
tools/single_file_creator
1617
tools/rawdraw_http_page.h
1718
rawdraw_sf.hf
19+
20+
vk/*temp

CNFG.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ int CNFGLastScancode = 0;
2222

2323
#include "CNFGFunctions.c"
2424

25+
#ifdef CNFGOGL
26+
#include "CNFGOGL.c"
27+
#endif
28+
29+
#ifdef CNFGVK
30+
#ifndef CNFGCONTEXTONLY
31+
#include "CNFGVK.c"
32+
#endif
33+
#endif
34+
2535
#ifdef CNFG3D
2636
#include "CNFG3D.c"
2737
#endif

CNFG.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ extern "C" {
1818
CNFG_USE_DOUBLE_FUNCTIONS -> Use double-precision floating point for CNFG3D.
1919
CNFGOGL -> Use an OpenGL Backend for all rawdraw functionality.
2020
->Caveat->If using CNFG_HAS_XSHAPE, then, we do something realy wacky.
21+
CNFGVK -> Use the experimental Vulkan backend
22+
CNFGVK_VALIDATION_LAYERS -> Enable the validation layers of the batched renderer
23+
CNFGVK_IMAGE_ALLOCATION -> Specify the amount of VRAM allocated towards images in the batched renderer
2124
CNFGRASTERIZER -> Software-rasterize the rawdraw calls, and, use
2225
CNFGUpdateScreenWithBitmap to send video to webpage.
2326
CNFGCONTEXTONLY -> Don't add any drawing functions, only opening a window to
@@ -73,6 +76,15 @@ Usually tested combinations:
7376
#endif
7477
#endif
7578

79+
#ifdef CNFGVK
80+
#define CNFG_BATCH 8192
81+
82+
#include <vulkan/vulkan.h>
83+
84+
// The drivers define the CNFG_SURFACE_EXTENSION macro for their required extensions
85+
VkResult CNFGCreateVkSurface( VkInstance inst, const VkAllocationCallbacks* alloc, VkSurfaceKHR* surface );
86+
#endif
87+
7688
typedef struct {
7789
short x, y;
7890
} RDPoint;
@@ -111,6 +123,10 @@ void CNFGBlitImage( uint32_t * data, int x, int y, int w, int h );
111123
void CNFGDeleteTex( unsigned int tex );
112124
unsigned int CNFGTexImage( uint32_t *data, int w, int h );
113125
void CNFGBlitTex( unsigned int tex, int x, int y, int w, int h );
126+
#endif
127+
128+
#if defined( CNFGOGL ) || defined( CNFGVK )
129+
void CNFGSetVSync( int vson ); // Not supported on all systems
114130
void CNFGSetScissors( int * xywh );
115131
void CNFGGetScissors( int * xywh );
116132
#endif
@@ -156,7 +172,6 @@ void CNFGInternalResize( short x, short y ); //don't call this.
156172

157173
//Not available on all systems. Use The OGL portion with care.
158174
#ifdef CNFGOGL
159-
void CNFGSetVSync( int vson );
160175
void * CNFGGetExtension( const char * extname );
161176
#endif
162177

0 commit comments

Comments
 (0)