Add Vulkan render

This commit is contained in:
Denis Pauk 2023-09-17 14:17:14 +03:00
parent 92a0bcf128
commit 42465a6b03
77 changed files with 19866 additions and 9 deletions

View file

@ -377,12 +377,12 @@ endif
# ---------- # ----------
# Phony targets # Phony targets
.PHONY : all client game icon server ref_gl1 ref_gl3 ref_gles3 ref_soft .PHONY : all client game icon server ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk
# ---------- # ----------
# Builds everything # Builds everything
all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk
# ---------- # ----------
@ -730,6 +730,42 @@ build/ref_soft/%.o: %.c
# ---------- # ----------
# The vk renderer lib
ifeq ($(YQ2_OSTYPE), Windows)
ref_vk:
@echo "===> Building ref_vk.dll"
$(MAKE) release/ref_vk.dll
release/ref_vk.dll : LDFLAGS += -shared
else ifeq ($(YQ2_OSTYPE), Darwin)
ref_vk:
@echo "===> Building ref_vk.dylib"
$(MAKE) release/ref_vk.dylib
release/ref_vk.dylib : LDFLAGS += -shared
else # not Windows or Darwin
ref_vk:
@echo "===> Building ref_vk.so"
$(MAKE) release/ref_vk.so
release/ref_vk.so : CFLAGS += -fPIC
release/ref_vk.so : LDFLAGS += -shared
endif # OS specific ref_vk stuff
build/ref_vk/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
# ----------
# The baseq2 game # The baseq2 game
ifeq ($(YQ2_OSTYPE), Windows) ifeq ($(YQ2_OSTYPE), Windows)
game: game:
@ -1024,6 +1060,45 @@ REFSOFT_OBJS_ += \
src/backends/unix/shared/hunk.o src/backends/unix/shared/hunk.o
endif endif
# ----------
REFVK_OBJS_ := \
src/client/refresh/vk/vk_buffer.o \
src/client/refresh/vk/vk_cmd.o \
src/client/refresh/vk/vk_common.o \
src/client/refresh/vk/vk_device.o \
src/client/refresh/vk/vk_draw.o \
src/client/refresh/vk/vk_image.o \
src/client/refresh/vk/vk_light.o \
src/client/refresh/vk/vk_mesh.o \
src/client/refresh/vk/vk_model.o \
src/client/refresh/vk/vk_pipeline.o \
src/client/refresh/vk/vk_main.o \
src/client/refresh/vk/vk_misc.o \
src/client/refresh/vk/vk_surf.o \
src/client/refresh/vk/vk_shaders.o \
src/client/refresh/vk/vk_swapchain.o \
src/client/refresh/vk/vk_validation.o \
src/client/refresh/vk/vk_warp.o \
src/client/refresh/vk/vk_util.o \
src/client/refresh/vk/volk/volk.o \
src/client/refresh/files/surf.o \
src/client/refresh/files/models.o \
src/client/refresh/files/pcx.o \
src/client/refresh/files/stb.o \
src/client/refresh/files/wal.o \
src/client/refresh/files/pvs.o \
src/common/shared/shared.o \
src/common/shared/utils.o \
src/common/md4.o
ifeq ($(YQ2_OSTYPE), Windows)
REFVK_OBJS_ += \
src/backends/windows/shared/hunk.o
else # not Windows
REFVK_OBJS_ += \
src/backends/unix/shared/hunk.o
endif
# ---------- # ----------
# Used by the server # Used by the server
@ -1086,6 +1161,7 @@ REFGL3_OBJS += $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_GLADE_))
REFGLES3_OBJS = $(patsubst %,build/ref_gles3/%,$(REFGL3_OBJS_)) REFGLES3_OBJS = $(patsubst %,build/ref_gles3/%,$(REFGL3_OBJS_))
REFGLES3_OBJS += $(patsubst %,build/ref_gles3/%,$(REFGL3_OBJS_GLADEES_)) REFGLES3_OBJS += $(patsubst %,build/ref_gles3/%,$(REFGL3_OBJS_GLADEES_))
REFSOFT_OBJS = $(patsubst %,build/ref_soft/%,$(REFSOFT_OBJS_)) REFSOFT_OBJS = $(patsubst %,build/ref_soft/%,$(REFSOFT_OBJS_))
REFVK_OBJS = $(patsubst %,build/ref_vk/%,$(REFVK_OBJS_))
SERVER_OBJS = $(patsubst %,build/server/%,$(SERVER_OBJS_)) SERVER_OBJS = $(patsubst %,build/server/%,$(SERVER_OBJS_))
GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_)) GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
@ -1098,6 +1174,7 @@ REFGL1_DEPS= $(REFGL1_OBJS:.o=.d)
REFGL3_DEPS= $(REFGL3_OBJS:.o=.d) REFGL3_DEPS= $(REFGL3_OBJS:.o=.d)
REFGLES3_DEPS= $(REFGLES3_OBJS:.o=.d) REFGLES3_DEPS= $(REFGLES3_OBJS:.o=.d)
REFSOFT_DEPS= $(REFSOFT_OBJS:.o=.d) REFSOFT_DEPS= $(REFSOFT_OBJS:.o=.d)
REFVK_DEPS= $(REFVK_OBJS:.o=.d)
SERVER_DEPS= $(SERVER_OBJS:.o=.d) SERVER_DEPS= $(SERVER_OBJS:.o=.d)
# Suck header dependencies in. # Suck header dependencies in.
@ -1106,6 +1183,7 @@ SERVER_DEPS= $(SERVER_OBJS:.o=.d)
-include $(REFGL1_DEPS) -include $(REFGL1_DEPS)
-include $(REFGL3_DEPS) -include $(REFGL3_DEPS)
-include $(REFGLES3_DEPS) -include $(REFGLES3_DEPS)
-include $(REFVK_DEPS)
-include $(SERVER_DEPS) -include $(SERVER_DEPS)
# ---------- # ----------
@ -1201,6 +1279,21 @@ release/ref_soft.so : $(REFSOFT_OBJS)
${Q}$(CC) $(LDFLAGS) $(REFSOFT_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@ ${Q}$(CC) $(LDFLAGS) $(REFSOFT_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@
endif endif
# release/ref_vk.so
ifeq ($(YQ2_OSTYPE), Windows)
release/ref_vk.dll : $(REFVK_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) $(REFVK_OBJS) $(LDLIBS) $(DLL_SDLLDFLAGS) -o $@
else ifeq ($(YQ2_OSTYPE), Darwin)
release/ref_vk.dylib : $(REFVK_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) $(REFVK_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@
else
release/ref_vk.so : $(REFVK_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) $(REFVK_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@
endif
# release/baseq2/game.so # release/baseq2/game.so
ifeq ($(YQ2_OSTYPE), Windows) ifeq ($(YQ2_OSTYPE), Windows)
release/baseq2/game.dll : $(GAME_OBJS) release/baseq2/game.dll : $(GAME_OBJS)

View file

@ -693,7 +693,9 @@ Mod_LoadMD2 (const char *mod_name, const void *buffer, int modfilelen,
// register all skins // register all skins
memcpy ((char *)pheader + pheader->ofs_skins, (char *)pinmodel + pheader->ofs_skins, memcpy ((char *)pheader + pheader->ofs_skins, (char *)pinmodel + pheader->ofs_skins,
pheader->num_skins*MAX_SKINNAME); pheader->num_skins*MAX_SKINNAME);
for (i=0 ; i<pheader->num_skins ; i++)
// Load in our skins.
for (i=0; i < pheader->num_skins; i++)
{ {
skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME,
it_skin); it_skin);
@ -980,8 +982,16 @@ Mod_LoadFlexModel(const char *mod_name, const void *buffer, int modfilelen,
src += size; src += size;
} }
if (pheader->num_skins > MAX_MD2SKINS)
{
R_Printf(PRINT_ALL, "%s has too many skins (%i > %i), "
"extra skins will be ignored\n",
mod_name, pheader->num_skins, MAX_MD2SKINS);
pheader->num_skins = MAX_MD2SKINS;
}
// Load in our skins. // Load in our skins.
for (i=0 ; i<pheader->num_skins ; i++) for (i=0; i < pheader->num_skins; i++)
{ {
skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME,
it_skin); it_skin);
@ -1004,9 +1014,9 @@ Mod_LoadDKMModel(const char *mod_name, const void *buffer, int modfilelen,
vec3_t mins, vec3_t maxs, struct image_s **skins, findimage_t find_image, vec3_t mins, vec3_t maxs, struct image_s **skins, findimage_t find_image,
modtype_t *type) modtype_t *type)
{ {
dmdl_t dmdlheader, *pheader; dmdl_t dmdlheader, *pheader = NULL;
dkm_header_t header; dkm_header_t header = {0};
void *extradata; void *extradata = NULL;
int i; int i;
if (sizeof(dkm_header_t) > modfilelen) if (sizeof(dkm_header_t) > modfilelen)
@ -1095,8 +1105,16 @@ Mod_LoadDKMModel(const char *mod_name, const void *buffer, int modfilelen,
Mod_LoadDkmTriangleList (pheader, Mod_LoadDkmTriangleList (pheader,
(dkmtriangle_t *)((byte *)buffer + header.ofs_tris)); (dkmtriangle_t *)((byte *)buffer + header.ofs_tris));
if (pheader->num_skins > MAX_MD2SKINS)
{
R_Printf(PRINT_ALL, "%s has too many skins (%i > %i), "
"extra skins will be ignored\n",
mod_name, pheader->num_skins, MAX_MD2SKINS);
pheader->num_skins = MAX_MD2SKINS;
}
// Load in our skins. // Load in our skins.
for (i=0 ; i<pheader->num_skins ; i++) for (i=0; i < pheader->num_skins; i++)
{ {
skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME,
it_skin); it_skin);

View file

@ -217,7 +217,7 @@ extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header,
const char *lumpname, int *plumpsize, const byte *mod_base); const char *lumpname, int *plumpsize, const byte *mod_base);
extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base); extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base);
int Mod_LoadFile(char *name, void **buffer); extern int Mod_LoadFile(char *name, void **buffer);
/* Surface logic */ /* Surface logic */
#define DLIGHT_CUTOFF 64 #define DLIGHT_CUTOFF 64

View file

@ -0,0 +1,366 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __VK_LOCAL_H__
#define __VK_LOCAL_H__
#include <math.h>
#include <stdio.h>
#if defined(__APPLE__)
#include <SDL.h>
#include <SDL_vulkan.h>
#else
#include <SDL2/SDL.h>
#include <SDL2/SDL_vulkan.h>
#endif
#include "../../ref_shared.h"
#include "../volk/volk.h"
#include "qvk.h"
#if defined(__APPLE__)
#include <MoltenVK/vk_mvk_moltenvk.h>
#include <dlfcn.h>
#endif
// verify if VkResult is VK_SUCCESS
#define VK_VERIFY(x) { \
VkResult res = (x); \
if(res != VK_SUCCESS) { \
R_Printf(PRINT_ALL, "%s:%d: VkResult verification failed: %s\n", \
__func__, __LINE__, QVk_GetError(res)); \
} \
}
// up / down
#define PITCH 0
// left / right
#define YAW 1
// fall over
#define ROLL 2
extern viddef_t vid;
typedef struct image_s
{
char name[MAX_QPATH]; // game path, including extension
imagetype_t type;
int width, height; // source image
int upload_width, upload_height; // after power of two and picmip
int registration_sequence; // 0 = free
struct msurface_s *texturechain; // for sort-by-texture world drawing
qvktexture_t vk_texture; // Vulkan texture handle
} image_t;
#define MAX_VKTEXTURES 1024
//===================================================================
typedef enum
{
rserr_ok,
rserr_invalid_mode,
rserr_unknown
} rserr_t;
#include "model.h"
#define BACKFACE_EPSILON 0.01
//====================================================
extern image_t vktextures[MAX_VKTEXTURES];
extern int numvktextures;
extern image_t *r_notexture;
extern image_t *r_particletexture;
extern image_t *r_squaretexture;
extern int r_visframecount;
extern int r_framecount;
extern cplane_t frustum[4];
extern int c_brush_polys, c_alias_polys;
//
// view origin
//
extern vec3_t vup;
extern vec3_t vpn;
extern vec3_t vright;
extern vec3_t r_origin;
//
// screen size info
//
extern refdef_t r_newrefdef;
extern int r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2;
extern cvar_t *r_lefthand;
extern cvar_t *r_drawworld;
extern cvar_t *r_novis;
extern cvar_t *r_lerpmodels;
extern cvar_t *r_lockpvs;
extern cvar_t *r_modulate;
extern cvar_t *r_vsync;
extern cvar_t *r_clear;
extern cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
extern cvar_t *r_gunfov;
extern cvar_t *r_farsee;
extern cvar_t *vk_overbrightbits;
extern cvar_t *r_validation;
extern cvar_t *r_cull;
extern cvar_t *vk_picmip;
extern cvar_t *r_palettedtexture;
extern cvar_t *vk_flashblend;
extern cvar_t *vk_finish;
extern cvar_t *vk_shadows;
extern cvar_t *vk_dynamic;
extern cvar_t *vk_msaa;
extern cvar_t *vk_showtris;
extern cvar_t *r_lightmap;
extern cvar_t *vk_texturemode;
extern cvar_t *vk_lmaptexturemode;
extern cvar_t *vk_aniso;
extern cvar_t *vk_sampleshading;
extern cvar_t *vk_device_idx;
extern cvar_t *vk_mip_nearfilter;
#if defined(__APPLE__)
extern cvar_t *vk_molten_fastmath;
extern cvar_t *vk_molten_metalbuffers;
#endif
extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures;
extern cvar_t *r_nolerp_list;
extern cvar_t *r_lerp_list;
extern cvar_t *r_2D_unfiltered;
extern cvar_t *r_videos_unfiltered;
extern cvar_t *vk_pixel_size;
extern cvar_t *r_fixsurfsky;
extern cvar_t *vid_fullscreen;
extern cvar_t *vid_gamma;
extern int c_visible_lightmaps;
extern int c_visible_textures;
extern float r_viewproj_matrix[16];
extern float *s_blocklights, *s_blocklights_max;
void R_LightPoint (vec3_t p, vec3_t color, entity_t *currententity);
void R_PushDlights (void);
//====================================================================
extern model_t *r_worldmodel;
extern unsigned d_8to24table[256];
extern unsigned r_rawpalette[256];
extern qvktexture_t vk_rawTexture;
extern int vk_activeBufferIdx;
extern float r_view_matrix[16];
extern float r_projection_matrix[16];
extern float r_viewproj_matrix[16];
extern vec3_t lightspot;
extern int registration_sequence;
extern int r_dlightframecount;
extern qvksampler_t vk_current_sampler;
extern qvksampler_t vk_current_lmap_sampler;
void RE_Shutdown( void );
void Vk_ScreenShot_f (void);
void Vk_Strings_f(void);
void Vk_Mem_f(void);
void R_DrawAliasModel (entity_t *currententity, model_t *currentmodel);
void R_DrawBrushModel (entity_t *currententity, model_t *currentmodel);
void R_DrawSpriteModel (entity_t *currententity, model_t *currentmodel);
void R_DrawBeam (entity_t *currententity);
void R_DrawWorld (void);
void R_RenderDlights (void);
void R_SetCacheState( msurface_t *surf );
void R_BuildLightMap (msurface_t *surf, byte *dest, int stride);
void R_DrawAlphaSurfaces (void);
void RE_InitParticleTexture (void);
void Draw_InitLocal (void);
void Vk_SubdivideSurface (msurface_t *fa, model_t *loadmodel);
void R_RotateForEntity (entity_t *e, float *mvMatrix);
void R_MarkLeaves (void);
void EmitWaterPolys (msurface_t *fa, image_t *texture,
float *modelMatrix, const float *color,
qboolean solid_surface);
void R_AddSkySurface (msurface_t *fa);
void R_ClearSkyBox (void);
void R_DrawSkyBox (void);
void R_MarkSurfaceLights(dlight_t *light, int bit, mnode_t *node,
int r_dlightframecount);
struct image_s *RE_Draw_FindPic (char *name);
void RE_Draw_GetPicSize (int *w, int *h, char *name);
void RE_Draw_PicScaled (int x, int y, char *name, float scale);
void RE_Draw_StretchPic (int x, int y, int w, int h, char *name);
void RE_Draw_CharScaled (int x, int y, int num, float scale);
void RE_Draw_TileClear (int x, int y, int w, int h, char *name);
void RE_Draw_Fill (int x, int y, int w, int h, int c);
void RE_Draw_FadeScreen (void);
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
qboolean RE_EndWorldRenderpass( void );
struct image_s *RE_RegisterSkin (char *name);
image_t *Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
int height, int realheight, size_t data_size, imagetype_t type,
int bits);
image_t *Vk_FindImage (const char *name, imagetype_t type);
void Vk_TextureMode( char *string );
void Vk_LmapTextureMode( char *string );
void Vk_ImageList_f (void);
void Vk_BuildPolygonFromSurface(msurface_t *fa, model_t *currentmodel);
void Vk_CreateSurfaceLightmap (msurface_t *surf);
void Vk_EndBuildingLightmaps (void);
void Vk_BeginBuildingLightmaps (model_t *m);
void Vk_InitImages (void);
void Vk_ShutdownImages (void);
void Vk_FreeUnusedImages (void);
qboolean Vk_ImageHasFreeSpace(void);
void RE_BeginRegistration (char *model);
struct model_s *RE_RegisterModel (char *name);
struct image_s *RE_RegisterSkin (char *name);
void RE_SetSky (const char *name, float rotate, int autorotate, const vec3_t axis);
void RE_EndRegistration (void);
void Mat_Identity(float *matrix);
void Mat_Mul(float *m1, float *m2, float *res);
void Mat_Translate(float *matrix, float x, float y, float z);
void Mat_Rotate(float *matrix, float deg, float x, float y, float z);
void Mat_Scale(float *matrix, float x, float y, float z);
void Mat_Perspective(float *matrix, float *correction_matrix, float fovy, float aspect, float zNear, float zFar);
void Mat_Ortho(float *matrix, float left, float right, float bottom, float top, float zNear, float zFar);
typedef struct
{
uint32_t vk_version;
const char *vendor_name;
const char *device_type;
const char *present_mode;
const char *supported_present_modes[256];
const char *extensions[256];
const char *layers[256];
uint32_t vertex_buffer_usage;
uint32_t vertex_buffer_max_usage;
uint32_t vertex_buffer_size;
uint32_t index_buffer_usage;
uint32_t index_buffer_max_usage;
uint32_t index_buffer_size;
uint32_t uniform_buffer_usage;
uint32_t uniform_buffer_max_usage;
uint32_t uniform_buffer_size;
uint32_t triangle_index_usage;
uint32_t triangle_index_max_usage;
uint32_t triangle_index_count;
} vkconfig_t;
#define MAX_LIGHTMAPS 128
#define DYNLIGHTMAP_OFFSET MAX_LIGHTMAPS
typedef struct
{
float inverse_intensity;
qboolean fullscreen;
int prev_mode;
unsigned char *d_16to8table;
qvktexture_t lightmap_textures[MAX_LIGHTMAPS*2];
int currenttextures[2];
int currenttmu;
float camera_separation;
qboolean stereo_enabled;
VkPipeline current_pipeline;
qvkrenderpasstype_t current_renderpass;
} vkstate_t;
extern vkconfig_t vk_config;
extern vkstate_t vk_state;
/*
====================================================================
IMPORTED FUNCTIONS
====================================================================
*/
extern refimport_t ri;
/*
====================================================================
IMPLEMENTATION SPECIFIC FUNCTIONS
====================================================================
*/
qboolean Vkimp_CreateSurface(SDL_Window *window);
// buffers reallocate
typedef struct {
float vertex[3];
float texCoord[2];
} polyvert_t;
typedef struct {
float vertex[3];
float texCoord[2];
float texCoordLmap[2];
} lmappolyvert_t;
extern polyvert_t *verts_buffer;
extern lmappolyvert_t *lmappolyverts_buffer;
void Mesh_Init (void);
void Mesh_Free (void);
int Mesh_VertsRealloc(int count);
// All renders should export such function
Q2_DLL_EXPORTED refexport_t GetRefAPI(refimport_t imp);
#endif

View file

@ -0,0 +1,191 @@
/*
* Copyright (C) 1997-2001 Id Software, Inc.
* Copyright (C) 2018-2019 Krzysztof Kondrak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* =======================================================================
*
* Header for the model stuff.
*
* =======================================================================
*/
#ifndef __VK_MODEL_H__
#define __VK_MODEL_H__
/*
d*_t structures are on-disk representations
m*_t structures are in-memory
*/
/*
==============================================================================
BRUSH MODELS
==============================================================================
*/
//
// in memory representation
//
#define VERTEXSIZE 7
#define DEFAULT_LMSHIFT 4
typedef struct vkpoly_s
{
struct vkpoly_s *next;
struct vkpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER (not needed anymore?)
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} vkpoly_t;
typedef struct msurface_s
{
int visframe; // should be drawn when node is crossed
cplane_t *plane;
int flags;
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
short texturemins[2];
short extents[2];
short lmshift;
int light_s, light_t; // gl lightmap coordinates
int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps
vkpoly_t *polys; // multiple if warped
struct msurface_s *texturechain;
struct msurface_s *lightmapchain;
mtexinfo_t *texinfo;
/* decoupled lm */
float lmvecs[2][4];
float lmvlen[2];
/* lighting info */
int dlightframe;
int dlightbits;
int lightmaptexturenum;
byte styles[MAXLIGHTMAPS];
float cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
byte *samples; // [numstyles*surfsize]
} msurface_t;
/* Whole model */
typedef struct model_s
{
char name[MAX_QPATH];
int registration_sequence;
modtype_t type;
int numframes;
int flags;
//
// volume occupied by the model graphics
//
vec3_t mins, maxs;
float radius;
//
// solid volume for clipping
//
qboolean clipbox;
vec3_t clipmins, clipmaxs;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int lightmap; // only for submodels
int numsubmodels;
struct model_s *submodels;
int numplanes;
cplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numvertexes;
mvertex_t *vertexes;
int numedges;
medge_t *edges;
int numnodes;
int firstnode;
mnode_t *nodes;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int nummarksurfaces;
msurface_t **marksurfaces;
dvis_t *vis;
byte *lightdata;
// for alias models and skins
image_t *skins[MAX_MD2SKINS];
int extradatasize;
void *extradata;
// submodules
vec3_t origin; // for sounds or lights
} model_t;
//============================================================================
void Mod_Init (void);
const byte *Mod_ClusterPVS (int cluster, const model_t *model);
void Mod_Modellist_f (void);
void *Hunk_Begin (int maxsize);
void *Hunk_Alloc (int size);
int Hunk_End (void);
void Hunk_Free (void *base);
void Mod_FreeAll (void);
void Mod_FreeModelsKnown (void);
#endif

View file

@ -0,0 +1,345 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
** QVK.H
*/
#ifndef __QVK_H__
#define __QVK_H__
#ifdef _WIN32
# include <windows.h>
#endif
#include "local.h"
#include "util.h"
#include "shaders.h"
#if defined(__APPLE__)
#undef VK_NO_PROTOTYPES
#define VK_NO_PROTOTYPES 1
#include <MoltenVK/vk_mvk_moltenvk.h>
#endif
// Vulkan device
typedef struct
{
VkPhysicalDevice physical;
VkDevice logical;
VkPhysicalDeviceMemoryProperties mem_properties;
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceFeatures features;
#if defined(__APPLE__)
MVKPhysicalDeviceMetalFeatures metalFeatures;
#endif
VkQueue gfxQueue;
VkQueue presentQueue;
VkQueue transferQueue;
int gfxFamilyIndex;
int presentFamilyIndex;
int transferFamilyIndex;
qboolean screenshotSupported;
} qvkdevice_t;
// Vulkan swapchain
typedef struct
{
VkSwapchainKHR sc;
VkFormat format;
VkPresentModeKHR presentMode;
VkExtent2D extent;
VkImage *images;
int imageCount;
} qvkswapchain_t;
// available sampler types
typedef enum
{
S_NEAREST = 0,
S_LINEAR = 1,
S_MIPMAP_NEAREST = 2,
S_MIPMAP_LINEAR = 3,
S_NEAREST_UNNORMALIZED = 4,
S_SAMPLER_CNT = 5
} qvksampler_t;
#define NUM_SAMPLERS (S_SAMPLER_CNT * 2)
// texture object
typedef struct
{
ImageResource_t resource;
VkImageView imageView;
VkSharingMode sharingMode;
VkSampleCountFlagBits sampleCount;
VkFormat format;
VkDescriptorSet descriptorSet;
uint32_t mipLevels;
qboolean clampToEdge;
} qvktexture_t;
#define QVVKTEXTURE_INIT { \
.resource = { \
.image = VK_NULL_HANDLE, \
.memory = VK_NULL_HANDLE, \
.size = 0, \
}, \
.imageView = VK_NULL_HANDLE, \
.sharingMode = VK_SHARING_MODE_MAX_ENUM, \
.sampleCount = VK_SAMPLE_COUNT_1_BIT, \
.format = VK_FORMAT_R8G8B8A8_UNORM, \
.descriptorSet = VK_NULL_HANDLE, \
.mipLevels = 1, \
}
#define QVVKTEXTURE_CLEAR(i) { \
(i).resource.image = VK_NULL_HANDLE; \
(i).resource.memory = VK_NULL_HANDLE; \
(i).resource.size = 0; \
(i).imageView = VK_NULL_HANDLE; \
(i).sharingMode = VK_SHARING_MODE_MAX_ENUM; \
(i).sampleCount = VK_SAMPLE_COUNT_1_BIT; \
(i).format = VK_FORMAT_R8G8B8A8_UNORM; \
(i).mipLevels = 1; \
}
// Vulkan renderpass
typedef struct
{
VkRenderPass rp;
VkAttachmentLoadOp colorLoadOp;
VkSampleCountFlagBits sampleCount;
} qvkrenderpass_t;
// Vulkan buffer
typedef struct
{
VkDeviceSize currentOffset;
BufferResource_t resource;
void *pMappedData;
} qvkbuffer_t;
// Vulkan staging buffer
typedef struct
{
VkDeviceSize currentOffset;
VkCommandBuffer cmdBuffer;
VkFence fence;
qboolean submitted;
BufferResource_t resource;
void *pMappedData;
} qvkstagingbuffer_t;
// Vulkan buffer options
typedef struct
{
VkBufferUsageFlags usage;
VkMemoryPropertyFlags reqMemFlags;
VkMemoryPropertyFlags prefMemFlags;
} qvkbufferopts_t;
// Vulkan pipeline
typedef struct
{
VkPipelineLayout layout;
VkPipeline pl;
VkPipelineCreateFlags flags;
VkCullModeFlags cullMode;
VkPrimitiveTopology topology;
VkPipelineColorBlendAttachmentState blendOpts;
VkBool32 depthTestEnable;
VkBool32 depthWriteEnable;
} qvkpipeline_t;
// Vulkan shader
typedef struct
{
VkPipelineShaderStageCreateInfo createInfo;
VkShaderModule module;
} qvkshader_t;
#define QVKPIPELINE_INIT { \
.layout = VK_NULL_HANDLE, \
.pl = VK_NULL_HANDLE, \
.flags = 0, \
.cullMode = VK_CULL_MODE_BACK_BIT, \
.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, \
.blendOpts = { \
.blendEnable = VK_FALSE, \
.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA, \
.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, \
.colorBlendOp = VK_BLEND_OP_ADD, \
.srcAlphaBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA, \
.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, \
.alphaBlendOp = VK_BLEND_OP_ADD, \
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT \
}, \
.depthTestEnable = VK_TRUE, \
.depthWriteEnable = VK_TRUE \
}
// renderpass type
typedef enum
{
RP_WORLD = 0, // renders game world to offscreen buffer
RP_UI = 1, // render UI elements and game console
RP_WORLD_WARP = 2, // perform postprocessing on RP_WORLD (underwater screen warp)
RP_COUNT = 3
} qvkrenderpasstype_t;
// Vulkan constants: command and dynamic buffer count
#define NUM_CMDBUFFERS 2
#define NUM_DYNBUFFERS 2
// Vulkan instance
extern VkInstance vk_instance;
// Vulkan surface
extern VkSurfaceKHR vk_surface;
// Vulkan device
extern qvkdevice_t vk_device;
// Vulkan swapchain
extern qvkswapchain_t vk_swapchain;
// Vulkan command buffer currently in use
extern VkCommandBuffer vk_activeCmdbuffer;
// Vulkan command pools
extern VkCommandPool vk_commandPool[NUM_CMDBUFFERS];
extern VkCommandPool vk_transferCommandPool;
// Vulkan descriptor pool
extern VkDescriptorPool vk_descriptorPool;
// viewport/scissor
extern VkViewport vk_viewport;
extern VkRect2D vk_scissor;
// Vulkan descriptor sets
extern VkDescriptorSetLayout vk_samplerDescSetLayout;
// *** pipelines ***
extern qvkpipeline_t vk_drawTexQuadPipeline[RP_COUNT];
extern qvkpipeline_t vk_drawColorQuadPipeline[RP_COUNT];
extern qvkpipeline_t vk_drawModelPipelineFan[RP_COUNT];
extern qvkpipeline_t vk_drawNoDepthModelPipelineFan;
extern qvkpipeline_t vk_drawLefthandModelPipelineFan;
extern qvkpipeline_t vk_drawNullModelPipeline;
extern qvkpipeline_t vk_drawParticlesPipeline;
extern qvkpipeline_t vk_drawPointParticlesPipeline;
extern qvkpipeline_t vk_drawSpritePipeline;
extern qvkpipeline_t vk_drawPolyPipeline;
extern qvkpipeline_t vk_drawPolyLmapPipeline;
extern qvkpipeline_t vk_drawPolyWarpPipeline;
extern qvkpipeline_t vk_drawPolySolidWarpPipeline;
extern qvkpipeline_t vk_drawBeamPipeline;
extern qvkpipeline_t vk_drawSkyboxPipeline;
extern qvkpipeline_t vk_drawDLightPipeline;
extern qvkpipeline_t vk_showTrisPipeline;
extern qvkpipeline_t vk_shadowsPipelineFan;
extern qvkpipeline_t vk_worldWarpPipeline;
extern qvkpipeline_t vk_postprocessPipeline;
// color buffer containing main game/world view
extern qvktexture_t vk_colorbuffer;
// color buffer with postprocessed game view
extern qvktexture_t vk_colorbufferWarp;
// indicator if the frame is currently being rendered
extern qboolean vk_frameStarted;
// Indicates if the swap chain needs to be rebuilt.
extern qboolean vk_recreateSwapchainNeeded;
// is QVk initialized?
extern qboolean vk_initialized;
// function pointers
extern PFN_vkCreateDebugUtilsMessengerEXT qvkCreateDebugUtilsMessengerEXT;
extern PFN_vkDestroyDebugUtilsMessengerEXT qvkDestroyDebugUtilsMessengerEXT;
extern PFN_vkSetDebugUtilsObjectNameEXT qvkSetDebugUtilsObjectNameEXT;
extern PFN_vkSetDebugUtilsObjectTagEXT qvkSetDebugUtilsObjectTagEXT;
extern PFN_vkCmdBeginDebugUtilsLabelEXT qvkCmdBeginDebugUtilsLabelEXT;
extern PFN_vkCmdEndDebugUtilsLabelEXT qvkCmdEndDebugUtilsLabelEXT;
extern PFN_vkCmdInsertDebugUtilsLabelEXT qvkInsertDebugUtilsLabelEXT;
extern PFN_vkCreateDebugReportCallbackEXT qvkCreateDebugReportCallbackEXT;
extern PFN_vkDestroyDebugReportCallbackEXT qvkDestroyDebugReportCallbackEXT;
#if defined(__APPLE__)
extern PFN_vkGetPhysicalDeviceMetalFeaturesMVK qvkGetPhysicalDeviceMetalFeaturesMVK;
extern PFN_vkGetMoltenVKConfigurationMVK qvkGetMoltenVKConfigurationMVK;
extern PFN_vkSetMoltenVKConfigurationMVK qvkSetMoltenVKConfigurationMVK;
#endif
// The Interface Functions (tm)
void QVk_SetWindow(SDL_Window*);
qboolean QVk_Init(void);
void QVk_PostInit(void);
void QVk_GetDrawableSize(int *width, int *height);
void QVk_WaitAndShutdownAll(void);
void QVk_Shutdown(void);
void QVk_Restart(void);
void QVk_CreateValidationLayers(void);
void QVk_DestroyValidationLayers(void);
qboolean QVk_CreateDevice(int preferredDeviceIdx);
VkResult QVk_CreateSwapchain(void);
VkFormat QVk_FindDepthFormat(void);
VkResult QVk_CreateCommandPool(VkCommandPool *commandPool, uint32_t queueFamilyIndex);
VkResult QVk_CreateImageView(const VkImage *image, VkImageAspectFlags aspectFlags, VkImageView *imageView, VkFormat format, uint32_t mipLevels);
VkResult QVk_CreateImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, qvktexture_t *texture);
void QVk_CreateDepthBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *depthBuffer);
void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *colorBuffer, int extraFlags);
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType, qboolean clampToEdge);
void QVk_ReleaseTexture(qvktexture_t *texture);
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height);
VkSampler QVk_UpdateTextureSampler(qvktexture_t *texture, qvksampler_t samplerType, qboolean clampToEdge);
void QVk_ReadPixels(uint8_t *dstBuffer, const VkOffset2D *offset, const VkExtent2D *extent);
VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer);
void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue);
VkCommandBuffer QVk_CreateCommandBuffer(const VkCommandPool *commandPool, VkCommandBufferLevel level);
const char* QVk_GetError(VkResult errorCode);
VkResult QVk_BeginFrame(const VkViewport* viewport, const VkRect2D* scissor);
VkResult QVk_EndFrame(qboolean force);
void QVk_BeginRenderpass(qvkrenderpasstype_t rpType);
qboolean QVk_RecreateSwapchain();
void QVk_FreeStagingBuffer(qvkstagingbuffer_t *buffer);
VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbufferopts_t options);
void QVk_FreeBuffer(qvkbuffer_t *buffer);
VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
VkResult QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
void QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
void QVk_CreateIndexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, VkShaderStageFlagBits shaderStage);
void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, const uint32_t descLayoutCount, const VkPipelineVertexInputStateCreateInfo *vertexInputInfo, qvkpipeline_t *pipeline, const qvkrenderpass_t *renderpass, const qvkshader_t *shaders, uint32_t shaderCount);
void QVk_DestroyPipeline(qvkpipeline_t *pipeline);
uint8_t* QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset);
uint8_t* QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet);
uint8_t* QVk_GetStagingBuffer(VkDeviceSize size, int alignment, VkCommandBuffer *cmdBuffer, VkBuffer *buffer, uint32_t *dstOffset);
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount);
VkBuffer QVk_GetTriangleStripIbo(VkDeviceSize indexCount);
void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpType);
void QVk_DrawTexRect(const float *ubo, VkDeviceSize uboSize, qvktexture_t *texture);
void QVk_BindPipeline(qvkpipeline_t *pipeline);
void QVk_SubmitStagingBuffers(void);
void Qvk_MemoryBarrier(VkCommandBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask);
qboolean QVk_CheckExtent(void);
// debug label related functions
void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objName);
void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName, size_t tagSize, const void *tagData);
void QVk_DebugLabelBegin(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b);
void QVk_DebugLabelEnd(const VkCommandBuffer *cmdBuffer);
void QVk_DebugLabelInsert(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b);
#endif

View file

@ -0,0 +1,115 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// game shaders, compiled offline
//
#ifndef __VK_SHADERS_H__
#define __VK_SHADERS_H__
#include <stdint.h>
#include <stddef.h>
// textured quad (alpha)
extern const uint32_t basic_vert_spv[];
extern const size_t basic_vert_size;
extern const uint32_t basic_frag_spv[];
extern const size_t basic_frag_size;
// colored quad (alpha)
extern const uint32_t basic_color_quad_vert_spv[];
extern const size_t basic_color_quad_vert_size;
extern const uint32_t basic_color_quad_frag_spv[];
extern const size_t basic_color_quad_frag_size;
// textured model
extern const uint32_t model_vert_spv[];
extern const size_t model_vert_size;
extern const uint32_t model_frag_spv[];
extern const size_t model_frag_size;
// null model
extern const uint32_t nullmodel_vert_spv[];
extern const size_t nullmodel_vert_size;
// particle (texture)
extern const uint32_t particle_vert_spv[];
extern const size_t particle_vert_size;
// particle (point)
extern const uint32_t point_particle_vert_spv[];
extern const size_t point_particle_vert_size;
extern const uint32_t point_particle_frag_spv[];
extern const size_t point_particle_frag_size;
// sprite model
extern const uint32_t sprite_vert_spv[];
extern const size_t sprite_vert_size;
// beam
extern const uint32_t beam_vert_spv[];
extern const size_t beam_vert_size;
// skybox
extern const uint32_t skybox_vert_spv[];
extern const size_t skybox_vert_size;
// dynamic lights
extern const uint32_t d_light_vert_spv[];
extern const size_t d_light_vert_size;
// textured, alpha blended polygon
extern const uint32_t polygon_vert_spv[];
extern const size_t polygon_vert_size;
// textured, lightmapped polygon
extern const uint32_t polygon_lmap_vert_spv[];
extern const size_t polygon_lmap_vert_size;
extern const uint32_t polygon_lmap_frag_spv[];
extern const size_t polygon_lmap_frag_size;
// warped polygon (liquids)
extern const uint32_t polygon_warp_vert_spv[];
extern const size_t polygon_warp_vert_size;
// entity shadows
extern const uint32_t shadows_vert_spv[];
extern const size_t shadows_vert_size;
// postprocess
extern const uint32_t postprocess_vert_spv[];
extern const size_t postprocess_vert_size;
extern const uint32_t postprocess_frag_spv[];
extern const size_t postprocess_frag_size;
// underwater vision warp
extern const uint32_t world_warp_vert_spv[];
extern const size_t world_warp_vert_size;
extern const uint32_t world_warp_frag_spv[];
extern const size_t world_warp_frag_size;
#endif

View file

@ -0,0 +1,73 @@
/*
Copyright (C) 2018 Christoph Schied
Copyright (C) 2020 Denis Pauk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __VK_UTIL_H__
#define __VK_UTIL_H__
#include "../volk/volk.h"
#define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))
typedef struct BufferResource_s {
VkBuffer buffer;
// shared memory used for buffer
VkDeviceMemory memory;
// image size
VkDeviceSize size;
// posision in shared memory
VkDeviceSize offset;
// is mapped?
VkBool32 is_mapped;
} BufferResource_t;
typedef struct ImageResource_s {
VkImage image;
// shared memory used for image
VkDeviceMemory memory;
// image size
VkDeviceSize size;
// posision in shared memory
VkDeviceSize offset;
} ImageResource_t;
VkResult buffer_create(BufferResource_t *buf,
VkBufferCreateInfo buf_create_info,
VkMemoryPropertyFlags mem_properties,
VkMemoryPropertyFlags mem_preferences,
VkMemoryPropertyFlags mem_skip);
VkResult buffer_destroy(BufferResource_t *buf);
void buffer_unmap(BufferResource_t *buf);
void *buffer_map(BufferResource_t *buf);
VkResult buffer_flush(BufferResource_t *buf);
VkResult buffer_invalidate(BufferResource_t *buf);
VkResult image_create(ImageResource_t *img,
VkImageCreateInfo img_create_info,
VkMemoryPropertyFlags mem_properties,
VkMemoryPropertyFlags mem_preferences,
VkMemoryPropertyFlags mem_skip);
VkResult image_destroy(ImageResource_t *img);
void vulkan_memory_init(void);
void vulkan_memory_types_show(void);
void vulkan_memory_free_unused(void);
void vulkan_memory_delete(void);
#endif /*__VK_UTIL_H__*/

View file

@ -0,0 +1,16 @@
// 8.13.3559
#pragma once
const uint32_t basic_color_quad_frag_spv[] = {
0x07230203,0x00010000,0x00080008,0x0000000d,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000b,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x00000009,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00040005,
0x0000000b,0x6f6c6f63,0x00000072,0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,
0x0000000b,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,
0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x00040020,
0x00000008,0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00040020,
0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000007,
0x0000000c,0x0000000b,0x0003003e,0x00000009,0x0000000c,0x000100fd,0x00010038
};

View file

@ -0,0 +1,48 @@
// 8.13.3559
#pragma once
const uint32_t basic_color_quad_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000001f,0x0000002d,
0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,
0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,
0x00040005,0x00000009,0x736f5076,0x00000000,0x00050005,0x0000000b,0x65566e69,0x78657472,
0x00000000,0x00060005,0x0000000e,0x67616d69,0x61725465,0x6f66736e,0x00006d72,0x00050006,
0x0000000e,0x00000000,0x7366666f,0x00007465,0x00050006,0x0000000e,0x00000001,0x6c616373,
0x00000065,0x00050006,0x0000000e,0x00000002,0x6f6c6f63,0x00000072,0x00030005,0x00000010,
0x00007469,0x00060005,0x0000001d,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,
0x0000001d,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000001f,0x00000000,
0x00040005,0x0000002d,0x6f6c6f63,0x00000072,0x00040047,0x0000000b,0x0000001e,0x00000000,
0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,0x00000001,
0x00000023,0x00000008,0x00050048,0x0000000e,0x00000002,0x00000023,0x00000010,0x00030047,
0x0000000e,0x00000002,0x00040047,0x00000010,0x00000022,0x00000000,0x00040047,0x00000010,
0x00000021,0x00000000,0x00050048,0x0000001d,0x00000000,0x0000000b,0x00000000,0x00030047,
0x0000001d,0x00000002,0x00040047,0x0000002d,0x0000001e,0x00000000,0x00020013,0x00000002,
0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,
0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040020,0x0000000a,
0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x00040017,0x0000000d,
0x00000006,0x00000004,0x0005001e,0x0000000e,0x00000007,0x00000007,0x0000000d,0x00040020,
0x0000000f,0x00000002,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000002,0x00040015,
0x00000011,0x00000020,0x00000001,0x0004002b,0x00000011,0x00000012,0x00000001,0x00040020,
0x00000013,0x00000002,0x00000007,0x0004002b,0x00000006,0x00000017,0x3f800000,0x0005002c,
0x00000007,0x00000018,0x00000017,0x00000017,0x0003001e,0x0000001d,0x0000000d,0x00040020,
0x0000001e,0x00000003,0x0000001d,0x0004003b,0x0000001e,0x0000001f,0x00000003,0x0004002b,
0x00000011,0x00000020,0x00000000,0x0004002b,0x00000006,0x00000024,0x40000000,0x0004002b,
0x00000006,0x00000027,0x00000000,0x00040020,0x0000002b,0x00000003,0x0000000d,0x0004003b,
0x0000002b,0x0000002d,0x00000003,0x0004002b,0x00000011,0x0000002e,0x00000002,0x00040020,
0x0000002f,0x00000002,0x0000000d,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003d,0x00000007,
0x0000000c,0x0000000b,0x00050041,0x00000013,0x00000014,0x00000010,0x00000012,0x0004003d,
0x00000007,0x00000015,0x00000014,0x00050085,0x00000007,0x00000016,0x0000000c,0x00000015,
0x00050041,0x00000013,0x00000019,0x00000010,0x00000012,0x0004003d,0x00000007,0x0000001a,
0x00000019,0x00050083,0x00000007,0x0000001b,0x00000018,0x0000001a,0x00050083,0x00000007,
0x0000001c,0x00000016,0x0000001b,0x0003003e,0x00000009,0x0000001c,0x0004003d,0x00000007,
0x00000021,0x00000009,0x00050041,0x00000013,0x00000022,0x00000010,0x00000020,0x0004003d,
0x00000007,0x00000023,0x00000022,0x0005008e,0x00000007,0x00000025,0x00000023,0x00000024,
0x00050081,0x00000007,0x00000026,0x00000021,0x00000025,0x00050051,0x00000006,0x00000028,
0x00000026,0x00000000,0x00050051,0x00000006,0x00000029,0x00000026,0x00000001,0x00070050,
0x0000000d,0x0000002a,0x00000028,0x00000029,0x00000027,0x00000017,0x00050041,0x0000002b,
0x0000002c,0x0000001f,0x00000020,0x0003003e,0x0000002c,0x0000002a,0x00050041,0x0000002f,
0x00000030,0x00000010,0x0000002e,0x0004003d,0x0000000d,0x00000031,0x00000030,0x0003003e,
0x0000002d,0x00000031,0x000100fd,0x00010038
};

View file

@ -0,0 +1,48 @@
// 8.13.3559
#pragma once
const uint32_t basic_frag_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000038,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x00000011,0x00000015,
0x0000001e,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000009,0x67617266,0x746e656d,0x6f6c6f43,
0x00000072,0x00050005,0x0000000d,0x78655473,0x65727574,0x00000000,0x00050005,0x00000011,
0x43786574,0x64726f6f,0x00000000,0x00040005,0x00000015,0x6f6c6f63,0x00000072,0x00050005,
0x0000001e,0x65725461,0x6c6f6873,0x00000064,0x00060005,0x00000028,0x68737550,0x736e6f43,
0x746e6174,0x00000000,0x00050006,0x00000028,0x00000000,0x6d6d6167,0x00000061,0x00030005,
0x0000002a,0x00006370,0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,0x0000000d,
0x00000022,0x00000000,0x00040047,0x0000000d,0x00000021,0x00000000,0x00040047,0x00000011,
0x0000001e,0x00000000,0x00040047,0x00000015,0x0000001e,0x00000001,0x00040047,0x0000001e,
0x0000001e,0x00000002,0x00050048,0x00000028,0x00000000,0x00000023,0x00000044,0x00030047,
0x00000028,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x00040020,0x00000008,
0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00090019,0x0000000a,
0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,
0x0000000b,0x0000000a,0x00040020,0x0000000c,0x00000000,0x0000000b,0x0004003b,0x0000000c,
0x0000000d,0x00000000,0x00040017,0x0000000f,0x00000006,0x00000002,0x00040020,0x00000010,
0x00000001,0x0000000f,0x0004003b,0x00000010,0x00000011,0x00000001,0x00040020,0x00000014,
0x00000001,0x00000007,0x0004003b,0x00000014,0x00000015,0x00000001,0x00040015,0x00000018,
0x00000020,0x00000000,0x0004002b,0x00000018,0x00000019,0x00000003,0x00040020,0x0000001a,
0x00000003,0x00000006,0x00040020,0x0000001d,0x00000001,0x00000006,0x0004003b,0x0000001d,
0x0000001e,0x00000001,0x00020014,0x00000020,0x00040017,0x00000025,0x00000006,0x00000003,
0x0003001e,0x00000028,0x00000006,0x00040020,0x00000029,0x00000009,0x00000028,0x0004003b,
0x00000029,0x0000002a,0x00000009,0x00040015,0x0000002b,0x00000020,0x00000001,0x0004002b,
0x0000002b,0x0000002c,0x00000000,0x00040020,0x0000002d,0x00000009,0x00000006,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x0000000b,
0x0000000e,0x0000000d,0x0004003d,0x0000000f,0x00000012,0x00000011,0x00050057,0x00000007,
0x00000013,0x0000000e,0x00000012,0x0004003d,0x00000007,0x00000016,0x00000015,0x00050085,
0x00000007,0x00000017,0x00000013,0x00000016,0x0003003e,0x00000009,0x00000017,0x00050041,
0x0000001a,0x0000001b,0x00000009,0x00000019,0x0004003d,0x00000006,0x0000001c,0x0000001b,
0x0004003d,0x00000006,0x0000001f,0x0000001e,0x000500b8,0x00000020,0x00000021,0x0000001c,
0x0000001f,0x000300f7,0x00000023,0x00000000,0x000400fa,0x00000021,0x00000022,0x00000023,
0x000200f8,0x00000022,0x000100fc,0x000200f8,0x00000023,0x0004003d,0x00000007,0x00000026,
0x00000009,0x0008004f,0x00000025,0x00000027,0x00000026,0x00000026,0x00000000,0x00000001,
0x00000002,0x00050041,0x0000002d,0x0000002e,0x0000002a,0x0000002c,0x0004003d,0x00000006,
0x0000002f,0x0000002e,0x00060050,0x00000025,0x00000030,0x0000002f,0x0000002f,0x0000002f,
0x0007000c,0x00000025,0x00000031,0x00000001,0x0000001a,0x00000027,0x00000030,0x00050041,
0x0000001a,0x00000032,0x00000009,0x00000019,0x0004003d,0x00000006,0x00000033,0x00000032,
0x00050051,0x00000006,0x00000034,0x00000031,0x00000000,0x00050051,0x00000006,0x00000035,
0x00000031,0x00000001,0x00050051,0x00000006,0x00000036,0x00000031,0x00000002,0x00070050,
0x00000007,0x00000037,0x00000034,0x00000035,0x00000036,0x00000033,0x0003003e,0x00000009,
0x00000037,0x000100fd,0x00010038
};

View file

@ -0,0 +1,61 @@
// 8.13.3559
#pragma once
const uint32_t basic_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x0000003e,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000001f,0x0000002e,
0x0000002f,0x00000039,0x0000003c,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00040005,0x00000009,0x736f5076,0x00000000,0x00050005,
0x0000000b,0x65566e69,0x78657472,0x00000000,0x00060005,0x0000000d,0x67616d69,0x61725465,
0x6f66736e,0x00006d72,0x00050006,0x0000000d,0x00000000,0x7366666f,0x00007465,0x00050006,
0x0000000d,0x00000001,0x6c616373,0x00000065,0x00060006,0x0000000d,0x00000002,0x664f7675,
0x74657366,0x00000000,0x00050006,0x0000000d,0x00000003,0x63537675,0x00656c61,0x00030005,
0x0000000f,0x00007469,0x00060005,0x0000001d,0x505f6c67,0x65567265,0x78657472,0x00000000,
0x00060006,0x0000001d,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000001f,
0x00000000,0x00050005,0x0000002e,0x43786574,0x64726f6f,0x00000000,0x00050005,0x0000002f,
0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000039,0x6f6c6f63,0x00000072,0x00050005,
0x0000003c,0x65725461,0x6c6f6873,0x00000064,0x00040047,0x0000000b,0x0000001e,0x00000000,
0x00050048,0x0000000d,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000d,0x00000001,
0x00000023,0x00000008,0x00050048,0x0000000d,0x00000002,0x00000023,0x00000010,0x00050048,
0x0000000d,0x00000003,0x00000023,0x00000018,0x00030047,0x0000000d,0x00000002,0x00040047,
0x0000000f,0x00000022,0x00000001,0x00040047,0x0000000f,0x00000021,0x00000000,0x00050048,
0x0000001d,0x00000000,0x0000000b,0x00000000,0x00030047,0x0000001d,0x00000002,0x00040047,
0x0000002e,0x0000001e,0x00000000,0x00040047,0x0000002f,0x0000001e,0x00000001,0x00040047,
0x00000039,0x0000001e,0x00000001,0x00040047,0x0000003c,0x0000001e,0x00000002,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,
0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040020,
0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x0006001e,
0x0000000d,0x00000007,0x00000007,0x00000007,0x00000007,0x00040020,0x0000000e,0x00000002,
0x0000000d,0x0004003b,0x0000000e,0x0000000f,0x00000002,0x00040015,0x00000010,0x00000020,
0x00000001,0x0004002b,0x00000010,0x00000011,0x00000001,0x00040020,0x00000012,0x00000002,
0x00000007,0x0004002b,0x00000006,0x00000016,0x3f800000,0x0005002c,0x00000007,0x00000017,
0x00000016,0x00000016,0x00040017,0x0000001c,0x00000006,0x00000004,0x0003001e,0x0000001d,
0x0000001c,0x00040020,0x0000001e,0x00000003,0x0000001d,0x0004003b,0x0000001e,0x0000001f,
0x00000003,0x0004002b,0x00000010,0x00000020,0x00000000,0x0004002b,0x00000006,0x00000024,
0x40000000,0x0004002b,0x00000006,0x00000027,0x00000000,0x00040020,0x0000002b,0x00000003,
0x0000001c,0x00040020,0x0000002d,0x00000003,0x00000007,0x0004003b,0x0000002d,0x0000002e,
0x00000003,0x0004003b,0x0000000a,0x0000002f,0x00000001,0x0004002b,0x00000010,0x00000031,
0x00000003,0x0004002b,0x00000010,0x00000035,0x00000002,0x0004003b,0x0000002b,0x00000039,
0x00000003,0x0007002c,0x0000001c,0x0000003a,0x00000016,0x00000016,0x00000016,0x00000016,
0x00040020,0x0000003b,0x00000003,0x00000006,0x0004003b,0x0000003b,0x0000003c,0x00000003,
0x0004002b,0x00000006,0x0000003d,0x3f2a7efa,0x00050036,0x00000002,0x00000004,0x00000000,
0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003d,
0x00000007,0x0000000c,0x0000000b,0x00050041,0x00000012,0x00000013,0x0000000f,0x00000011,
0x0004003d,0x00000007,0x00000014,0x00000013,0x00050085,0x00000007,0x00000015,0x0000000c,
0x00000014,0x00050041,0x00000012,0x00000018,0x0000000f,0x00000011,0x0004003d,0x00000007,
0x00000019,0x00000018,0x00050083,0x00000007,0x0000001a,0x00000017,0x00000019,0x00050083,
0x00000007,0x0000001b,0x00000015,0x0000001a,0x0003003e,0x00000009,0x0000001b,0x0004003d,
0x00000007,0x00000021,0x00000009,0x00050041,0x00000012,0x00000022,0x0000000f,0x00000020,
0x0004003d,0x00000007,0x00000023,0x00000022,0x0005008e,0x00000007,0x00000025,0x00000023,
0x00000024,0x00050081,0x00000007,0x00000026,0x00000021,0x00000025,0x00050051,0x00000006,
0x00000028,0x00000026,0x00000000,0x00050051,0x00000006,0x00000029,0x00000026,0x00000001,
0x00070050,0x0000001c,0x0000002a,0x00000028,0x00000029,0x00000027,0x00000016,0x00050041,
0x0000002b,0x0000002c,0x0000001f,0x00000020,0x0003003e,0x0000002c,0x0000002a,0x0004003d,
0x00000007,0x00000030,0x0000002f,0x00050041,0x00000012,0x00000032,0x0000000f,0x00000031,
0x0004003d,0x00000007,0x00000033,0x00000032,0x00050085,0x00000007,0x00000034,0x00000030,
0x00000033,0x00050041,0x00000012,0x00000036,0x0000000f,0x00000035,0x0004003d,0x00000007,
0x00000037,0x00000036,0x00050081,0x00000007,0x00000038,0x00000034,0x00000037,0x0003003e,
0x0000002e,0x00000038,0x0003003e,0x00000039,0x0000003a,0x0003003e,0x0000003c,0x0000003d,
0x000100fd,0x00010038
};

View file

@ -0,0 +1,42 @@
// 8.13.3559
#pragma once
const uint32_t beam_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000020,
0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,
0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,
0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000008,
0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000,0x00060005,
0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,0x00000000,
0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,0x00006370,0x00050005,0x00000016,
0x65566e69,0x78657472,0x00000000,0x00040005,0x00000020,0x6f6c6f63,0x00000072,0x00070005,
0x00000021,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000021,
0x00000000,0x6f6c6f63,0x00000072,0x00030005,0x00000023,0x006f6275,0x00050048,0x00000008,
0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,
0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,
0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040047,
0x00000016,0x0000001e,0x00000000,0x00040047,0x00000020,0x0000001e,0x00000000,0x00050048,
0x00000021,0x00000000,0x00000023,0x00000000,0x00030047,0x00000021,0x00000002,0x00040047,
0x00000023,0x00000022,0x00000000,0x00040047,0x00000023,0x00000021,0x00000000,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,
0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,
0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,
0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,
0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,
0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,
0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,0x00040020,0x00000015,0x00000001,
0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018,
0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,0x0004003b,0x0000001e,0x00000020,
0x00000003,0x0003001e,0x00000021,0x00000007,0x00040020,0x00000022,0x00000002,0x00000021,
0x0004003b,0x00000022,0x00000023,0x00000002,0x00040020,0x00000024,0x00000002,0x00000007,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,
0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,
0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017,
0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006,
0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a,
0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041,
0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x00050041,
0x00000024,0x00000025,0x00000023,0x0000000c,0x0004003d,0x00000007,0x00000026,0x00000025,
0x0003003e,0x00000020,0x00000026,0x000100fd,0x00010038
};

View file

@ -0,0 +1,41 @@
// 8.13.3559
#pragma once
const uint32_t d_light_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000020,
0x00000021,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,
0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,
0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000,
0x00070005,0x0000000e,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00060006,
0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,0x006f6275,
0x00050005,0x00000016,0x65566e69,0x78657472,0x00000000,0x00040005,0x00000020,0x6f6c6f63,
0x00000072,0x00040005,0x00000021,0x6f436e69,0x00726f6c,0x00050048,0x00000008,0x00000000,
0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,0x00000000,
0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,
0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040047,0x00000010,
0x00000022,0x00000000,0x00040047,0x00000010,0x00000021,0x00000000,0x00040047,0x00000016,
0x0000001e,0x00000000,0x00040047,0x00000020,0x0000001e,0x00000000,0x00040047,0x00000021,
0x0000001e,0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,
0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,
0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,
0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,
0x00040020,0x0000000f,0x00000002,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000002,
0x00040020,0x00000011,0x00000002,0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,
0x00040020,0x00000015,0x00000001,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,
0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,
0x0004003b,0x0000001e,0x00000020,0x00000003,0x0004003b,0x00000015,0x00000021,0x00000001,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,
0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,
0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017,
0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006,
0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a,
0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041,
0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x0004003d,
0x00000014,0x00000022,0x00000021,0x00050051,0x00000006,0x00000023,0x00000022,0x00000000,
0x00050051,0x00000006,0x00000024,0x00000022,0x00000001,0x00050051,0x00000006,0x00000025,
0x00000022,0x00000002,0x00070050,0x00000007,0x00000026,0x00000023,0x00000024,0x00000025,
0x00000018,0x0003003e,0x00000020,0x00000026,0x000100fd,0x00010038
};

View file

@ -0,0 +1,37 @@
// 8.13.3559
#pragma once
const uint32_t model_frag_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000028,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000008,0x00000012,0x0000001a,
0x0000001e,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000008,0x74786574,0x64657275,0x00000000,
0x00060005,0x00000012,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x00000016,
0x78655473,0x65727574,0x00000000,0x00050005,0x0000001a,0x43786574,0x64726f6f,0x00000000,
0x00040005,0x0000001e,0x6f6c6f63,0x00000072,0x00030047,0x00000008,0x0000000e,0x00040047,
0x00000008,0x0000001e,0x00000002,0x00040047,0x00000012,0x0000001e,0x00000000,0x00040047,
0x00000016,0x00000022,0x00000000,0x00040047,0x00000016,0x00000021,0x00000000,0x00040047,
0x0000001a,0x0000001e,0x00000001,0x00040047,0x0000001e,0x0000001e,0x00000000,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,0x00040015,0x00000006,0x00000020,0x00000001,
0x00040020,0x00000007,0x00000001,0x00000006,0x0004003b,0x00000007,0x00000008,0x00000001,
0x0004002b,0x00000006,0x0000000a,0x00000000,0x00020014,0x0000000b,0x00030016,0x0000000f,
0x00000020,0x00040017,0x00000010,0x0000000f,0x00000004,0x00040020,0x00000011,0x00000003,
0x00000010,0x0004003b,0x00000011,0x00000012,0x00000003,0x00090019,0x00000013,0x0000000f,
0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000014,
0x00000013,0x00040020,0x00000015,0x00000000,0x00000014,0x0004003b,0x00000015,0x00000016,
0x00000000,0x00040017,0x00000018,0x0000000f,0x00000002,0x00040020,0x00000019,0x00000001,
0x00000018,0x0004003b,0x00000019,0x0000001a,0x00000001,0x00040020,0x0000001d,0x00000001,
0x00000010,0x0004003b,0x0000001d,0x0000001e,0x00000001,0x0004002b,0x0000000f,0x00000020,
0x00000000,0x0004002b,0x0000000f,0x00000021,0x3f800000,0x00050036,0x00000002,0x00000004,
0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000006,0x00000009,0x00000008,
0x000500ab,0x0000000b,0x0000000c,0x00000009,0x0000000a,0x000300f7,0x0000000e,0x00000000,
0x000400fa,0x0000000c,0x0000000d,0x00000026,0x000200f8,0x0000000d,0x0004003d,0x00000014,
0x00000017,0x00000016,0x0004003d,0x00000018,0x0000001b,0x0000001a,0x00050057,0x00000010,
0x0000001c,0x00000017,0x0000001b,0x0004003d,0x00000010,0x0000001f,0x0000001e,0x00070050,
0x00000010,0x00000022,0x00000020,0x00000020,0x00000020,0x00000020,0x00070050,0x00000010,
0x00000023,0x00000021,0x00000021,0x00000021,0x00000021,0x0008000c,0x00000010,0x00000024,
0x00000001,0x0000002b,0x0000001f,0x00000022,0x00000023,0x00050085,0x00000010,0x00000025,
0x0000001c,0x00000024,0x0003003e,0x00000012,0x00000025,0x000200f9,0x0000000e,0x000200f8,
0x00000026,0x0004003d,0x00000010,0x00000027,0x0000001e,0x0003003e,0x00000012,0x00000027,
0x000200f9,0x0000000e,0x000200f8,0x0000000e,0x000100fd,0x00010038
};

View file

@ -0,0 +1,59 @@
// 8.13.3559
#pragma once
const uint32_t model_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000027,
0x00000029,0x0000002d,0x0000002f,0x00000032,0x00030003,0x00000002,0x000001c2,0x00090004,
0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,
0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,
0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,
0x00030005,0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,
0x00000000,0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,
0x00000010,0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,
0x00746365,0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00060006,0x00000014,
0x00000001,0x74786574,0x64657275,0x00000000,0x00030005,0x00000016,0x006f6275,0x00050005,
0x0000001d,0x65566e69,0x78657472,0x00000000,0x00040005,0x00000027,0x6f6c6f63,0x00000072,
0x00040005,0x00000029,0x6f436e69,0x00726f6c,0x00050005,0x0000002d,0x43786574,0x64726f6f,
0x00000000,0x00050005,0x0000002f,0x65546e69,0x6f6f4378,0x00006472,0x00050005,0x00000032,
0x74786574,0x64657275,0x00000000,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,
0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,
0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,
0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,
0x00050048,0x00000014,0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,
0x00000007,0x00000010,0x00050048,0x00000014,0x00000001,0x00000023,0x00000040,0x00030047,
0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,
0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000027,
0x0000001e,0x00000000,0x00040047,0x00000029,0x0000001e,0x00000001,0x00040047,0x0000002d,
0x0000001e,0x00000001,0x00040047,0x0000002f,0x0000001e,0x00000002,0x00040047,0x00000032,
0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,
0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,
0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,
0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,
0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,
0x00040020,0x00000011,0x00000009,0x0000000d,0x0004001e,0x00000014,0x0000000d,0x0000000b,
0x00040020,0x00000015,0x00000002,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,
0x00040020,0x00000017,0x00000002,0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,
0x00040020,0x0000001c,0x00000001,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,
0x0004002b,0x00000006,0x0000001f,0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,
0x0004003b,0x00000025,0x00000027,0x00000003,0x00040020,0x00000028,0x00000001,0x00000007,
0x0004003b,0x00000028,0x00000029,0x00000001,0x00040017,0x0000002b,0x00000006,0x00000002,
0x00040020,0x0000002c,0x00000003,0x0000002b,0x0004003b,0x0000002c,0x0000002d,0x00000003,
0x00040020,0x0000002e,0x00000001,0x0000002b,0x0004003b,0x0000002e,0x0000002f,0x00000001,
0x00040020,0x00000031,0x00000003,0x0000000b,0x0004003b,0x00000031,0x00000032,0x00000003,
0x0004002b,0x0000000b,0x00000033,0x00000001,0x00040020,0x00000034,0x00000002,0x0000000b,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,
0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,
0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,
0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,
0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,
0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,
0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,
0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,
0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000007,0x0000002a,
0x00000029,0x0003003e,0x00000027,0x0000002a,0x0004003d,0x0000002b,0x00000030,0x0000002f,
0x0003003e,0x0000002d,0x00000030,0x00050041,0x00000034,0x00000035,0x00000016,0x00000033,
0x0004003d,0x0000000b,0x00000036,0x00000035,0x0003003e,0x00000032,0x00000036,0x000100fd,
0x00010038
};

View file

@ -0,0 +1,49 @@
// 8.13.3559
#pragma once
const uint32_t nullmodel_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x0000002e,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000027,
0x00000028,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,
0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,
0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000,
0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,
0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010,0x00006370,0x00070005,
0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000014,
0x00000000,0x65646f6d,0x0000006c,0x00030005,0x00000016,0x006f6275,0x00050005,0x0000001d,
0x65566e69,0x78657472,0x00000000,0x00040005,0x00000027,0x6f6c6f63,0x00000072,0x00040005,
0x00000028,0x6f436e69,0x00726f6c,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,
0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,
0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,
0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,
0x00050048,0x00000014,0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,
0x00000007,0x00000010,0x00030047,0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,
0x00000000,0x00040047,0x00000016,0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,
0x00000000,0x00040047,0x00000027,0x0000001e,0x00000000,0x00040047,0x00000028,0x0000001e,
0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,
0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,
0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,
0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,
0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,
0x00000011,0x00000009,0x0000000d,0x0003001e,0x00000014,0x0000000d,0x00040020,0x00000015,
0x00000002,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,
0x00000002,0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,
0x00000001,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,
0x0000001f,0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x0004003b,0x00000025,
0x00000027,0x00000003,0x0004003b,0x0000001c,0x00000028,0x00000001,0x00050036,0x00000002,
0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,
0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x00050041,0x00000017,
0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,0x00000018,0x00050092,
0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,0x0000001e,0x0000001d,
0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,0x00000006,0x00000021,
0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,0x00000002,0x00070050,
0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,0x00050091,0x00000007,
0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,0x0000000a,0x0000000c,
0x0003003e,0x00000026,0x00000024,0x0004003d,0x0000001b,0x00000029,0x00000028,0x00050051,
0x00000006,0x0000002a,0x00000029,0x00000000,0x00050051,0x00000006,0x0000002b,0x00000029,
0x00000001,0x00050051,0x00000006,0x0000002c,0x00000029,0x00000002,0x00070050,0x00000007,
0x0000002d,0x0000002a,0x0000002b,0x0000002c,0x0000001f,0x0003003e,0x00000027,0x0000002d,
0x000100fd,0x00010038
};

View file

@ -0,0 +1,47 @@
// 8.13.3743
#pragma once
const uint32_t particle_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x0000002d,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000022,
0x00000024,0x00000026,0x00000028,0x0000002b,0x00030003,0x00000002,0x000001c2,0x00090004,
0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,
0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,
0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,
0x00030005,0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,
0x00000000,0x00060006,0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00030005,
0x00000010,0x00006370,0x00050005,0x00000016,0x65566e69,0x78657472,0x00000000,0x00050005,
0x00000022,0x43786574,0x64726f6f,0x00000000,0x00050005,0x00000024,0x65546e69,0x6f6f4378,
0x00006472,0x00040005,0x00000026,0x6f6c6f63,0x00000072,0x00040005,0x00000028,0x6f436e69,
0x00726f6c,0x00050005,0x0000002b,0x65725461,0x6c6f6873,0x00000064,0x00050048,0x00000008,
0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,
0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,
0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040047,
0x00000016,0x0000001e,0x00000000,0x00040047,0x00000022,0x0000001e,0x00000000,0x00040047,
0x00000024,0x0000001e,0x00000002,0x00040047,0x00000026,0x0000001e,0x00000001,0x00040047,
0x00000028,0x0000001e,0x00000001,0x00040047,0x0000002b,0x0000001e,0x00000002,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,
0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,
0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,
0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,
0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,
0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,
0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,0x00040020,0x00000015,0x00000001,
0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018,
0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,0x00040017,0x00000020,0x00000006,
0x00000002,0x00040020,0x00000021,0x00000003,0x00000020,0x0004003b,0x00000021,0x00000022,
0x00000003,0x00040020,0x00000023,0x00000001,0x00000020,0x0004003b,0x00000023,0x00000024,
0x00000001,0x0004003b,0x0000001e,0x00000026,0x00000003,0x00040020,0x00000027,0x00000001,
0x00000007,0x0004003b,0x00000027,0x00000028,0x00000001,0x00040020,0x0000002a,0x00000003,
0x00000006,0x0004003b,0x0000002a,0x0000002b,0x00000003,0x0004002b,0x00000006,0x0000002c,
0x3f000000,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,
0x00050041,0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,
0x00000012,0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,
0x00000017,0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,
0x00000006,0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,
0x0000001a,0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,
0x00050041,0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,
0x0004003d,0x00000020,0x00000025,0x00000024,0x0003003e,0x00000022,0x00000025,0x0004003d,
0x00000007,0x00000029,0x00000028,0x0003003e,0x00000026,0x00000029,0x0003003e,0x0000002b,
0x0000002c,0x000100fd,0x00010038
};

View file

@ -0,0 +1,28 @@
// 8.13.3559
#pragma once
const uint32_t point_particle_frag_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000020,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000c,0x0000001c,0x0000001e,
0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,
0x6e69616d,0x00000000,0x00030005,0x00000009,0x00797863,0x00060005,0x0000000c,0x505f6c67,
0x746e696f,0x726f6f43,0x00000064,0x00060005,0x0000001c,0x67617266,0x746e656d,0x6f6c6f43,
0x00000072,0x00040005,0x0000001e,0x6f6c6f63,0x00000072,0x00040047,0x0000000c,0x0000000b,
0x00000010,0x00040047,0x0000001c,0x0000001e,0x00000000,0x00040047,0x0000001e,0x0000001e,
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,
0x00000007,0x0004002b,0x00000006,0x0000000a,0x40000000,0x00040020,0x0000000b,0x00000001,
0x00000007,0x0004003b,0x0000000b,0x0000000c,0x00000001,0x0004002b,0x00000006,0x0000000f,
0x3f800000,0x00020014,0x00000015,0x00040017,0x0000001a,0x00000006,0x00000004,0x00040020,
0x0000001b,0x00000003,0x0000001a,0x0004003b,0x0000001b,0x0000001c,0x00000003,0x00040020,
0x0000001d,0x00000001,0x0000001a,0x0004003b,0x0000001d,0x0000001e,0x00000001,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003d,0x00000007,0x0000000d,0x0000000c,0x0005008e,0x00000007,
0x0000000e,0x0000000d,0x0000000a,0x00050050,0x00000007,0x00000010,0x0000000f,0x0000000f,
0x00050083,0x00000007,0x00000011,0x0000000e,0x00000010,0x0003003e,0x00000009,0x00000011,
0x0004003d,0x00000007,0x00000012,0x00000009,0x0004003d,0x00000007,0x00000013,0x00000009,
0x00050094,0x00000006,0x00000014,0x00000012,0x00000013,0x000500ba,0x00000015,0x00000016,
0x00000014,0x0000000f,0x000300f7,0x00000018,0x00000000,0x000400fa,0x00000016,0x00000017,
0x00000018,0x000200f8,0x00000017,0x000100fc,0x000200f8,0x00000018,0x0004003d,0x0000001a,
0x0000001f,0x0000001e,0x0003003e,0x0000001c,0x0000001f,0x000100fd,0x00010038
};

View file

@ -0,0 +1,82 @@
// 8.13.3559
#pragma once
const uint32_t point_particle_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000055,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000051,
0x00000053,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,
0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,
0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00070006,0x00000008,0x00000001,
0x505f6c67,0x746e696f,0x657a6953,0x00000000,0x00030005,0x0000000a,0x00000000,0x00060005,
0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,0x00000000,
0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,0x00006370,0x00050005,0x00000016,
0x65566e69,0x78657472,0x00000000,0x00050005,0x00000021,0x74736964,0x7474615f,0x00006e65,
0x00070005,0x00000022,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00060006,
0x00000022,0x00000000,0x6e696f70,0x7a695374,0x00000065,0x00060006,0x00000022,0x00000001,
0x6e696f70,0x61635374,0x0000656c,0x00070006,0x00000022,0x00000002,0x506e696d,0x746e696f,
0x657a6953,0x00000000,0x00070006,0x00000022,0x00000003,0x5078616d,0x746e696f,0x657a6953,
0x00000000,0x00050006,0x00000022,0x00000004,0x5f747461,0x00000061,0x00050006,0x00000022,
0x00000005,0x5f747461,0x00000062,0x00050006,0x00000022,0x00000006,0x5f747461,0x00000063,
0x00030005,0x00000024,0x006f6275,0x00040005,0x00000051,0x6f6c6f63,0x00000072,0x00040005,
0x00000053,0x6f436e69,0x00726f6c,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,
0x00050048,0x00000008,0x00000001,0x0000000b,0x00000001,0x00030047,0x00000008,0x00000002,
0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,
0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,
0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000,0x00050048,0x00000022,0x00000000,
0x00000023,0x00000000,0x00050048,0x00000022,0x00000001,0x00000023,0x00000004,0x00050048,
0x00000022,0x00000002,0x00000023,0x00000008,0x00050048,0x00000022,0x00000003,0x00000023,
0x0000000c,0x00050048,0x00000022,0x00000004,0x00000023,0x00000010,0x00050048,0x00000022,
0x00000005,0x00000023,0x00000014,0x00050048,0x00000022,0x00000006,0x00000023,0x00000018,
0x00030047,0x00000022,0x00000002,0x00040047,0x00000024,0x00000022,0x00000000,0x00040047,
0x00000024,0x00000021,0x00000000,0x00040047,0x00000051,0x0000001e,0x00000000,0x00040047,
0x00000053,0x0000001e,0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,
0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0004001e,
0x00000008,0x00000007,0x00000006,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,
0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,
0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,
0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,
0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x00040017,0x00000014,
0x00000006,0x00000003,0x00040020,0x00000015,0x00000001,0x00000014,0x0004003b,0x00000015,
0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040020,0x0000001e,
0x00000003,0x00000007,0x00040020,0x00000020,0x00000007,0x00000006,0x0009001e,0x00000022,
0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00040020,
0x00000023,0x00000002,0x00000022,0x0004003b,0x00000023,0x00000024,0x00000002,0x0004002b,
0x0000000b,0x00000025,0x00000001,0x00040020,0x00000026,0x00000002,0x00000006,0x0004002b,
0x0000000b,0x00000029,0x00000004,0x0004002b,0x0000000b,0x0000002c,0x00000005,0x00040015,
0x0000002f,0x00000020,0x00000000,0x0004002b,0x0000002f,0x00000030,0x00000003,0x00040020,
0x00000031,0x00000003,0x00000006,0x0004002b,0x0000000b,0x00000036,0x00000006,0x0004002b,
0x0000000b,0x00000049,0x00000002,0x0004002b,0x0000000b,0x0000004c,0x00000003,0x0004003b,
0x0000001e,0x00000051,0x00000003,0x00040020,0x00000052,0x00000001,0x00000007,0x0004003b,
0x00000052,0x00000053,0x00000001,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x00000020,0x00000021,0x00000007,0x00050041,0x00000011,
0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x0004003d,
0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017,0x00000000,
0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006,0x0000001b,
0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a,0x0000001b,
0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041,0x0000001e,
0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x00050041,0x00000026,
0x00000027,0x00000024,0x00000025,0x0004003d,0x00000006,0x00000028,0x00000027,0x00050041,
0x00000026,0x0000002a,0x00000024,0x00000029,0x0004003d,0x00000006,0x0000002b,0x0000002a,
0x00050041,0x00000026,0x0000002d,0x00000024,0x0000002c,0x0004003d,0x00000006,0x0000002e,
0x0000002d,0x00060041,0x00000031,0x00000032,0x0000000a,0x0000000c,0x00000030,0x0004003d,
0x00000006,0x00000033,0x00000032,0x00050085,0x00000006,0x00000034,0x0000002e,0x00000033,
0x00050081,0x00000006,0x00000035,0x0000002b,0x00000034,0x00050041,0x00000026,0x00000037,
0x00000024,0x00000036,0x0004003d,0x00000006,0x00000038,0x00000037,0x00060041,0x00000031,
0x00000039,0x0000000a,0x0000000c,0x00000030,0x0004003d,0x00000006,0x0000003a,0x00000039,
0x00050085,0x00000006,0x0000003b,0x00000038,0x0000003a,0x00060041,0x00000031,0x0000003c,
0x0000000a,0x0000000c,0x00000030,0x0004003d,0x00000006,0x0000003d,0x0000003c,0x00050085,
0x00000006,0x0000003e,0x0000003b,0x0000003d,0x00050081,0x00000006,0x0000003f,0x00000035,
0x0000003e,0x00050088,0x00000006,0x00000040,0x00000028,0x0000003f,0x0003003e,0x00000021,
0x00000040,0x00050041,0x00000026,0x00000041,0x00000024,0x00000025,0x0004003d,0x00000006,
0x00000042,0x00000041,0x00050041,0x00000026,0x00000043,0x00000024,0x0000000c,0x0004003d,
0x00000006,0x00000044,0x00000043,0x00050085,0x00000006,0x00000045,0x00000042,0x00000044,
0x0004003d,0x00000006,0x00000046,0x00000021,0x0006000c,0x00000006,0x00000047,0x00000001,
0x0000001f,0x00000046,0x00050085,0x00000006,0x00000048,0x00000045,0x00000047,0x00050041,
0x00000026,0x0000004a,0x00000024,0x00000049,0x0004003d,0x00000006,0x0000004b,0x0000004a,
0x00050041,0x00000026,0x0000004d,0x00000024,0x0000004c,0x0004003d,0x00000006,0x0000004e,
0x0000004d,0x0008000c,0x00000006,0x0000004f,0x00000001,0x0000002b,0x00000048,0x0000004b,
0x0000004e,0x00050041,0x00000031,0x00000050,0x0000000a,0x00000025,0x0003003e,0x00000050,
0x0000004f,0x0004003d,0x00000007,0x00000054,0x00000053,0x0003003e,0x00000051,0x00000054,
0x000100fd,0x00010038
};

View file

@ -0,0 +1,40 @@
// 8.13.3559
#pragma once
const uint32_t polygon_lmap_frag_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000011,0x00000017,0x0000001b,
0x0000001e,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00040005,0x00000009,0x6f6c6f63,0x00000072,0x00050005,
0x0000000d,0x78655473,0x65727574,0x00000000,0x00050005,0x00000011,0x43786574,0x64726f6f,
0x00000000,0x00040005,0x00000014,0x6867696c,0x00000074,0x00050005,0x00000015,0x67694c73,
0x616d7468,0x00000070,0x00060005,0x00000017,0x43786574,0x64726f6f,0x70616d4c,0x00000000,
0x00060005,0x0000001b,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00060005,0x0000001e,
0x77656976,0x6867694c,0x70616d74,0x00000073,0x00040047,0x0000000d,0x00000022,0x00000000,
0x00040047,0x0000000d,0x00000021,0x00000000,0x00040047,0x00000011,0x0000001e,0x00000000,
0x00040047,0x00000015,0x00000022,0x00000002,0x00040047,0x00000015,0x00000021,0x00000000,
0x00040047,0x00000017,0x0000001e,0x00000001,0x00040047,0x0000001b,0x0000001e,0x00000000,
0x00040047,0x0000001e,0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,
0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,
0x00040020,0x00000008,0x00000007,0x00000007,0x00090019,0x0000000a,0x00000006,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x0000000b,0x0000000a,
0x00040020,0x0000000c,0x00000000,0x0000000b,0x0004003b,0x0000000c,0x0000000d,0x00000000,
0x00040017,0x0000000f,0x00000006,0x00000002,0x00040020,0x00000010,0x00000001,0x0000000f,
0x0004003b,0x00000010,0x00000011,0x00000001,0x0004003b,0x0000000c,0x00000015,0x00000000,
0x0004003b,0x00000010,0x00000017,0x00000001,0x00040020,0x0000001a,0x00000003,0x00000007,
0x0004003b,0x0000001a,0x0000001b,0x00000003,0x0004002b,0x00000006,0x0000001c,0x3f800000,
0x00040020,0x0000001d,0x00000001,0x00000006,0x0004003b,0x0000001d,0x0000001e,0x00000001,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,
0x00000008,0x00000009,0x00000007,0x0004003b,0x00000008,0x00000014,0x00000007,0x0004003d,
0x0000000b,0x0000000e,0x0000000d,0x0004003d,0x0000000f,0x00000012,0x00000011,0x00050057,
0x00000007,0x00000013,0x0000000e,0x00000012,0x0003003e,0x00000009,0x00000013,0x0004003d,
0x0000000b,0x00000016,0x00000015,0x0004003d,0x0000000f,0x00000018,0x00000017,0x00050057,
0x00000007,0x00000019,0x00000016,0x00000018,0x0003003e,0x00000014,0x00000019,0x0004003d,
0x00000006,0x0000001f,0x0000001e,0x00050083,0x00000006,0x00000020,0x0000001c,0x0000001f,
0x0004003d,0x00000007,0x00000021,0x00000009,0x0005008e,0x00000007,0x00000022,0x00000021,
0x00000020,0x0004003d,0x00000007,0x00000023,0x00000014,0x00050085,0x00000007,0x00000024,
0x00000022,0x00000023,0x0004003d,0x00000006,0x00000025,0x0000001e,0x0004003d,0x00000007,
0x00000026,0x00000014,0x0005008e,0x00000007,0x00000027,0x00000026,0x00000025,0x00050081,
0x00000007,0x00000028,0x00000024,0x00000027,0x0003003e,0x0000001b,0x00000028,0x000100fd,
0x00010038
};

View file

@ -0,0 +1,59 @@
// 8.13.3559
#pragma once
const uint32_t polygon_lmap_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000036,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029,
0x0000002b,0x0000002d,0x0000002e,0x00000031,0x00030003,0x00000002,0x000001c2,0x00090004,
0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,
0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,
0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,
0x00030005,0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,
0x00000000,0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,
0x00000010,0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,
0x00746365,0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00070006,0x00000014,
0x00000001,0x77656976,0x6867694c,0x70616d74,0x00000073,0x00030005,0x00000016,0x006f6275,
0x00050005,0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574,
0x64726f6f,0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00060005,
0x0000002d,0x43786574,0x64726f6f,0x70616d4c,0x00000000,0x00060005,0x0000002e,0x65546e69,
0x6f6f4378,0x6d4c6472,0x00007061,0x00060005,0x00000031,0x77656976,0x6867694c,0x70616d74,
0x00000073,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,
0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,
0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,
0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,
0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,
0x00050048,0x00000014,0x00000001,0x00000023,0x00000040,0x00030047,0x00000014,0x00000002,
0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,0x00000021,0x00000000,
0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029,0x0000001e,0x00000000,
0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x0000002d,0x0000001e,0x00000001,
0x00040047,0x0000002e,0x0000001e,0x00000002,0x00040047,0x00000031,0x0000001e,0x00000002,
0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,
0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,
0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,
0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,
0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,
0x00000009,0x0000000d,0x0004001e,0x00000014,0x0000000d,0x00000006,0x00040020,0x00000015,
0x00000002,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,
0x00000002,0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,
0x00000001,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,
0x0000001f,0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x00040017,0x00000027,
0x00000006,0x00000002,0x00040020,0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028,
0x00000029,0x00000003,0x00040020,0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a,
0x0000002b,0x00000001,0x0004003b,0x00000028,0x0000002d,0x00000003,0x0004003b,0x0000002a,
0x0000002e,0x00000001,0x00040020,0x00000030,0x00000003,0x00000006,0x0004003b,0x00000030,
0x00000031,0x00000003,0x0004002b,0x0000000b,0x00000032,0x00000001,0x00040020,0x00000033,
0x00000002,0x00000006,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
0x00000005,0x00050041,0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,
0x00000013,0x00000012,0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,
0x0000000d,0x00000019,0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,
0x0004003d,0x0000001b,0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,
0x00000000,0x00050051,0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,
0x00000022,0x0000001e,0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,
0x00000022,0x0000001f,0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,
0x00000025,0x00000026,0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0004003d,
0x00000027,0x0000002c,0x0000002b,0x0003003e,0x00000029,0x0000002c,0x0004003d,0x00000027,
0x0000002f,0x0000002e,0x0003003e,0x0000002d,0x0000002f,0x00050041,0x00000033,0x00000034,
0x00000016,0x00000032,0x0004003d,0x00000006,0x00000035,0x00000034,0x0003003e,0x00000031,
0x00000035,0x000100fd,0x00010038
};

View file

@ -0,0 +1,51 @@
// 8.13.3559
#pragma once
const uint32_t polygon_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000030,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000022,
0x00000024,0x00000026,0x0000002e,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,
0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,
0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,
0x00060006,0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,
0x00006370,0x00050005,0x00000016,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000022,
0x43786574,0x64726f6f,0x00000000,0x00050005,0x00000024,0x65546e69,0x6f6f4378,0x00006472,
0x00040005,0x00000026,0x6f6c6f63,0x00000072,0x00070005,0x00000027,0x66696e55,0x426d726f,
0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000027,0x00000000,0x6f6c6f63,0x00000072,
0x00030005,0x00000029,0x006f6275,0x00050005,0x0000002e,0x65725461,0x6c6f6873,0x00000064,
0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,
0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,
0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,
0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000,0x00040047,0x00000022,0x0000001e,
0x00000000,0x00040047,0x00000024,0x0000001e,0x00000001,0x00040047,0x00000026,0x0000001e,
0x00000001,0x00050048,0x00000027,0x00000000,0x00000023,0x00000000,0x00030047,0x00000027,
0x00000002,0x00040047,0x00000029,0x00000022,0x00000001,0x00040047,0x00000029,0x00000021,
0x00000000,0x00040047,0x0000002e,0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,
0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,
0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,
0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,
0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,
0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,
0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x00040017,
0x00000014,0x00000006,0x00000003,0x00040020,0x00000015,0x00000001,0x00000014,0x0004003b,
0x00000015,0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040020,
0x0000001e,0x00000003,0x00000007,0x00040017,0x00000020,0x00000006,0x00000002,0x00040020,
0x00000021,0x00000003,0x00000020,0x0004003b,0x00000021,0x00000022,0x00000003,0x00040020,
0x00000023,0x00000001,0x00000020,0x0004003b,0x00000023,0x00000024,0x00000001,0x0004003b,
0x0000001e,0x00000026,0x00000003,0x0003001e,0x00000027,0x00000007,0x00040020,0x00000028,
0x00000002,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000002,0x00040020,0x0000002a,
0x00000002,0x00000007,0x00040020,0x0000002d,0x00000003,0x00000006,0x0004003b,0x0000002d,
0x0000002e,0x00000003,0x0004002b,0x00000006,0x0000002f,0x00000000,0x00050036,0x00000002,
0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,
0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x0004003d,0x00000014,
0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017,0x00000000,0x00050051,
0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006,0x0000001b,0x00000017,
0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a,0x0000001b,0x00000018,
0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041,0x0000001e,0x0000001f,
0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x0004003d,0x00000020,0x00000025,
0x00000024,0x0003003e,0x00000022,0x00000025,0x00050041,0x0000002a,0x0000002b,0x00000029,
0x0000000c,0x0004003d,0x00000007,0x0000002c,0x0000002b,0x0003003e,0x00000026,0x0000002c,
0x0003003e,0x0000002e,0x0000002f,0x000100fd,0x00010038
};

View file

@ -0,0 +1,80 @@
// 8.13.3559
#pragma once
const uint32_t polygon_warp_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000058,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029,
0x0000002b,0x00000051,0x00000056,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,
0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,
0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,
0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010,
0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,
0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00050006,0x00000014,0x00000001,
0x6f6c6f63,0x00000072,0x00050006,0x00000014,0x00000002,0x656d6974,0x00000000,0x00050006,
0x00000014,0x00000003,0x6f726373,0x00006c6c,0x00030005,0x00000016,0x006f6275,0x00050005,
0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574,0x64726f6f,
0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000051,
0x6f6c6f63,0x00000072,0x00050005,0x00000056,0x65725461,0x6c6f6873,0x00000064,0x00050048,
0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,
0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,
0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,
0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000,0x00000023,
0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00050048,0x00000014,
0x00000001,0x00000023,0x00000040,0x00050048,0x00000014,0x00000002,0x00000023,0x00000050,
0x00050048,0x00000014,0x00000003,0x00000023,0x00000054,0x00030047,0x00000014,0x00000002,
0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,0x00000021,0x00000000,
0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029,0x0000001e,0x00000000,
0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x00000051,0x0000001e,0x00000001,
0x00040047,0x00000056,0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,
0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,
0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,
0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,
0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,
0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,
0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x0006001e,0x00000014,
0x0000000d,0x00000007,0x00000006,0x00000006,0x00040020,0x00000015,0x00000002,0x00000014,
0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,0x0000000d,
0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,0x0000001b,
0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,0x3f800000,
0x00040020,0x00000025,0x00000003,0x00000007,0x00040017,0x00000027,0x00000006,0x00000002,
0x00040020,0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000003,
0x00040020,0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a,0x0000002b,0x00000001,
0x0004002b,0x00000006,0x0000002d,0x40000000,0x0004002b,0x0000000b,0x0000002e,0x00000002,
0x00040020,0x0000002f,0x00000002,0x00000006,0x00040015,0x00000033,0x00000020,0x00000000,
0x0004002b,0x00000033,0x00000034,0x00000001,0x00040020,0x00000035,0x00000001,0x00000006,
0x0004002b,0x00000006,0x00000038,0x4051eb85,0x0004002b,0x00000033,0x0000003f,0x00000000,
0x0004002b,0x00000006,0x00000046,0x3d4ccccd,0x0004002b,0x0000000b,0x00000049,0x00000003,
0x00040020,0x0000004c,0x00000003,0x00000006,0x0004003b,0x00000025,0x00000051,0x00000003,
0x0004002b,0x0000000b,0x00000052,0x00000001,0x00040020,0x00000053,0x00000002,0x00000007,
0x0004003b,0x0000004c,0x00000056,0x00000003,0x0004002b,0x00000006,0x00000057,0x00000000,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,
0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,
0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,
0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,
0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,
0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,
0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,
0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,
0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000027,0x0000002c,
0x0000002b,0x00050041,0x0000002f,0x00000030,0x00000016,0x0000002e,0x0004003d,0x00000006,
0x00000031,0x00000030,0x00050085,0x00000006,0x00000032,0x0000002d,0x00000031,0x00050041,
0x00000035,0x00000036,0x0000002b,0x00000034,0x0004003d,0x00000006,0x00000037,0x00000036,
0x00050085,0x00000006,0x00000039,0x00000037,0x00000038,0x00050081,0x00000006,0x0000003a,
0x00000032,0x00000039,0x0006000c,0x00000006,0x0000003b,0x00000001,0x0000000d,0x0000003a,
0x00050041,0x0000002f,0x0000003c,0x00000016,0x0000002e,0x0004003d,0x00000006,0x0000003d,
0x0000003c,0x00050085,0x00000006,0x0000003e,0x0000002d,0x0000003d,0x00050041,0x00000035,
0x00000040,0x0000002b,0x0000003f,0x0004003d,0x00000006,0x00000041,0x00000040,0x00050085,
0x00000006,0x00000042,0x00000041,0x00000038,0x00050081,0x00000006,0x00000043,0x0000003e,
0x00000042,0x0006000c,0x00000006,0x00000044,0x00000001,0x0000000d,0x00000043,0x00050050,
0x00000027,0x00000045,0x0000003b,0x00000044,0x0005008e,0x00000027,0x00000047,0x00000045,
0x00000046,0x00050081,0x00000027,0x00000048,0x0000002c,0x00000047,0x0003003e,0x00000029,
0x00000048,0x00050041,0x0000002f,0x0000004a,0x00000016,0x00000049,0x0004003d,0x00000006,
0x0000004b,0x0000004a,0x00050041,0x0000004c,0x0000004d,0x00000029,0x0000003f,0x0004003d,
0x00000006,0x0000004e,0x0000004d,0x00050081,0x00000006,0x0000004f,0x0000004e,0x0000004b,
0x00050041,0x0000004c,0x00000050,0x00000029,0x0000003f,0x0003003e,0x00000050,0x0000004f,
0x00050041,0x00000053,0x00000054,0x00000016,0x00000052,0x0004003d,0x00000007,0x00000055,
0x00000054,0x0003003e,0x00000051,0x00000055,0x0003003e,0x00000056,0x00000057,0x000100fd,
0x00010038
};

View file

@ -0,0 +1,64 @@
// 1011.0.0
#pragma once
const uint32_t postprocess_frag_spv[] = {
0x07230203,0x00010000,0x0008000a,0x00000046,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000002c,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,
0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,
0x6e69616d,0x00000000,0x00060005,0x00000009,0x6f6e6e75,0x65546d72,0x6f6f4378,0x00006472,
0x00050005,0x0000000b,0x43786574,0x64726f6f,0x00000000,0x00060005,0x0000000d,0x68737550,
0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000d,0x00000000,0x74736f70,0x636f7270,
0x00737365,0x00050006,0x0000000d,0x00000001,0x6d6d6167,0x00000061,0x00060006,0x0000000d,
0x00000002,0x57726373,0x68746469,0x00000000,0x00060006,0x0000000d,0x00000003,0x48726373,
0x68676965,0x00000074,0x00050006,0x0000000d,0x00000004,0x7366666f,0x00587465,0x00050006,
0x0000000d,0x00000005,0x7366666f,0x00597465,0x00030005,0x0000000f,0x00006370,0x00060005,
0x0000002c,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x00000030,0x78655473,
0x65727574,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000,0x00050048,0x0000000d,
0x00000000,0x00000023,0x00000044,0x00050048,0x0000000d,0x00000001,0x00000023,0x00000048,
0x00050048,0x0000000d,0x00000002,0x00000023,0x0000004c,0x00050048,0x0000000d,0x00000003,
0x00000023,0x00000050,0x00050048,0x0000000d,0x00000004,0x00000023,0x00000054,0x00050048,
0x0000000d,0x00000005,0x00000023,0x00000058,0x00030047,0x0000000d,0x00000002,0x00040047,
0x0000002c,0x0000001e,0x00000000,0x00040047,0x00000030,0x00000022,0x00000000,0x00040047,
0x00000030,0x00000021,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,
0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,
0x00000008,0x00000007,0x00000007,0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b,
0x0000000a,0x0000000b,0x00000001,0x0008001e,0x0000000d,0x00000006,0x00000006,0x00000006,
0x00000006,0x00000006,0x00000006,0x00040020,0x0000000e,0x00000009,0x0000000d,0x0004003b,
0x0000000e,0x0000000f,0x00000009,0x00040015,0x00000010,0x00000020,0x00000001,0x0004002b,
0x00000010,0x00000011,0x00000002,0x00040020,0x00000012,0x00000009,0x00000006,0x0004002b,
0x00000010,0x00000015,0x00000003,0x0004002b,0x00000010,0x0000001a,0x00000004,0x0004002b,
0x00000010,0x0000001d,0x00000005,0x0004002b,0x00000010,0x00000022,0x00000000,0x0004002b,
0x00000006,0x00000025,0x00000000,0x00020014,0x00000026,0x00040017,0x0000002a,0x00000006,
0x00000004,0x00040020,0x0000002b,0x00000003,0x0000002a,0x0004003b,0x0000002b,0x0000002c,
0x00000003,0x00090019,0x0000002d,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,
0x00000001,0x00000000,0x0003001b,0x0000002e,0x0000002d,0x00040020,0x0000002f,0x00000000,
0x0000002e,0x0004003b,0x0000002f,0x00000030,0x00000000,0x00040017,0x00000034,0x00000006,
0x00000003,0x0004002b,0x00000006,0x00000036,0x3fc00000,0x0004002b,0x00000010,0x00000038,
0x00000001,0x0004002b,0x00000006,0x0000003d,0x3f800000,0x00050036,0x00000002,0x00000004,
0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,
0x0004003d,0x00000007,0x0000000c,0x0000000b,0x00050041,0x00000012,0x00000013,0x0000000f,
0x00000011,0x0004003d,0x00000006,0x00000014,0x00000013,0x00050041,0x00000012,0x00000016,
0x0000000f,0x00000015,0x0004003d,0x00000006,0x00000017,0x00000016,0x00050050,0x00000007,
0x00000018,0x00000014,0x00000017,0x00050085,0x00000007,0x00000019,0x0000000c,0x00000018,
0x00050041,0x00000012,0x0000001b,0x0000000f,0x0000001a,0x0004003d,0x00000006,0x0000001c,
0x0000001b,0x00050041,0x00000012,0x0000001e,0x0000000f,0x0000001d,0x0004003d,0x00000006,
0x0000001f,0x0000001e,0x00050050,0x00000007,0x00000020,0x0000001c,0x0000001f,0x00050081,
0x00000007,0x00000021,0x00000019,0x00000020,0x0003003e,0x00000009,0x00000021,0x00050041,
0x00000012,0x00000023,0x0000000f,0x00000022,0x0004003d,0x00000006,0x00000024,0x00000023,
0x000500ba,0x00000026,0x00000027,0x00000024,0x00000025,0x000300f7,0x00000029,0x00000000,
0x000400fa,0x00000027,0x00000028,0x00000042,0x000200f8,0x00000028,0x0004003d,0x0000002e,
0x00000031,0x00000030,0x0004003d,0x00000007,0x00000032,0x00000009,0x00070058,0x0000002a,
0x00000033,0x00000031,0x00000032,0x00000002,0x00000025,0x0008004f,0x00000034,0x00000035,
0x00000033,0x00000033,0x00000000,0x00000001,0x00000002,0x0005008e,0x00000034,0x00000037,
0x00000035,0x00000036,0x00050041,0x00000012,0x00000039,0x0000000f,0x00000038,0x0004003d,
0x00000006,0x0000003a,0x00000039,0x00060050,0x00000034,0x0000003b,0x0000003a,0x0000003a,
0x0000003a,0x0007000c,0x00000034,0x0000003c,0x00000001,0x0000001a,0x00000037,0x0000003b,
0x00050051,0x00000006,0x0000003e,0x0000003c,0x00000000,0x00050051,0x00000006,0x0000003f,
0x0000003c,0x00000001,0x00050051,0x00000006,0x00000040,0x0000003c,0x00000002,0x00070050,
0x0000002a,0x00000041,0x0000003e,0x0000003f,0x00000040,0x0000003d,0x0003003e,0x0000002c,
0x00000041,0x000200f9,0x00000029,0x000200f8,0x00000042,0x0004003d,0x0000002e,0x00000043,
0x00000030,0x0004003d,0x00000007,0x00000044,0x00000009,0x00070058,0x0000002a,0x00000045,
0x00000043,0x00000044,0x00000002,0x00000025,0x0003003e,0x0000002c,0x00000045,0x000200f9,
0x00000029,0x000200f8,0x00000029,0x000100fd,0x00010038
};

View file

@ -0,0 +1,36 @@
// 8.13.3559
#pragma once
const uint32_t postprocess_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000c,0x0000001a,
0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,
0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,
0x00050005,0x00000009,0x43786574,0x64726f6f,0x00000000,0x00060005,0x0000000c,0x565f6c67,
0x65747265,0x646e4978,0x00007865,0x00060005,0x00000018,0x505f6c67,0x65567265,0x78657472,
0x00000000,0x00060006,0x00000018,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,
0x0000001a,0x00000000,0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,0x0000000c,
0x0000000b,0x0000002a,0x00050048,0x00000018,0x00000000,0x0000000b,0x00000000,0x00030047,
0x00000018,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,
0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00040015,0x0000000a,
0x00000020,0x00000001,0x00040020,0x0000000b,0x00000001,0x0000000a,0x0004003b,0x0000000b,
0x0000000c,0x00000001,0x0004002b,0x0000000a,0x0000000e,0x00000001,0x0004002b,0x0000000a,
0x00000010,0x00000002,0x00040017,0x00000017,0x00000006,0x00000004,0x0003001e,0x00000018,
0x00000017,0x00040020,0x00000019,0x00000003,0x00000018,0x0004003b,0x00000019,0x0000001a,
0x00000003,0x0004002b,0x0000000a,0x0000001b,0x00000000,0x0004002b,0x00000006,0x0000001d,
0x40000000,0x0004002b,0x00000006,0x0000001f,0xbf800000,0x0004002b,0x00000006,0x00000022,
0x00000000,0x0004002b,0x00000006,0x00000023,0x3f800000,0x00040020,0x00000027,0x00000003,
0x00000017,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003d,0x0000000a,0x0000000d,0x0000000c,0x000500c4,0x0000000a,0x0000000f,0x0000000d,
0x0000000e,0x000500c7,0x0000000a,0x00000011,0x0000000f,0x00000010,0x0004006f,0x00000006,
0x00000012,0x00000011,0x0004003d,0x0000000a,0x00000013,0x0000000c,0x000500c7,0x0000000a,
0x00000014,0x00000013,0x00000010,0x0004006f,0x00000006,0x00000015,0x00000014,0x00050050,
0x00000007,0x00000016,0x00000012,0x00000015,0x0003003e,0x00000009,0x00000016,0x0004003d,
0x00000007,0x0000001c,0x00000009,0x0005008e,0x00000007,0x0000001e,0x0000001c,0x0000001d,
0x00050050,0x00000007,0x00000020,0x0000001f,0x0000001f,0x00050081,0x00000007,0x00000021,
0x0000001e,0x00000020,0x00050051,0x00000006,0x00000024,0x00000021,0x00000000,0x00050051,
0x00000006,0x00000025,0x00000021,0x00000001,0x00070050,0x00000017,0x00000026,0x00000024,
0x00000025,0x00000022,0x00000023,0x00050041,0x00000027,0x00000028,0x0000001a,0x0000001b,
0x0003003e,0x00000028,0x00000026,0x000100fd,0x00010038
};

View file

@ -0,0 +1,46 @@
// 8.13.3559
#pragma once
const uint32_t shadows_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x0000002b,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000027,
0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,
0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,
0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000008,
0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000,0x00060005,
0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,0x00000000,
0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010,0x00006370,0x00070005,0x00000014,
0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000014,0x00000000,
0x65646f6d,0x0000006c,0x00030005,0x00000016,0x006f6275,0x00050005,0x0000001d,0x65566e69,
0x78657472,0x00000000,0x00040005,0x00000027,0x6f6c6f63,0x00000072,0x00050048,0x00000008,
0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,
0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,
0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048,
0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000,0x00000023,0x00000000,
0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00030047,0x00000014,0x00000002,
0x00040047,0x00000016,0x00000022,0x00000000,0x00040047,0x00000016,0x00000021,0x00000000,
0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000027,0x0000001e,0x00000000,
0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,
0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,
0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,
0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,
0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,
0x00000009,0x0000000d,0x0003001e,0x00000014,0x0000000d,0x00040020,0x00000015,0x00000002,
0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,
0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,
0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,
0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x0004003b,0x00000025,0x00000027,
0x00000003,0x0004002b,0x00000006,0x00000028,0x00000000,0x0004002b,0x00000006,0x00000029,
0x3f000000,0x0007002c,0x00000007,0x0000002a,0x00000028,0x00000028,0x00000028,0x00000029,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,
0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,
0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,
0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,
0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,
0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,
0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,
0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,
0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0003003e,0x00000027,0x0000002a,
0x000100fd,0x00010038
};

View file

@ -0,0 +1,54 @@
// 8.13.3559
#pragma once
const uint32_t skybox_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029,
0x0000002b,0x0000002d,0x00000030,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,
0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,
0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,
0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010,
0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,
0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00030005,0x00000016,0x006f6275,
0x00050005,0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574,
0x64726f6f,0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00040005,
0x0000002d,0x6f6c6f63,0x00000072,0x00050005,0x00000030,0x65725461,0x6c6f6873,0x00000064,
0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,
0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,
0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,
0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000,
0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00030047,
0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,
0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029,
0x0000001e,0x00000000,0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x0000002d,
0x0000001e,0x00000001,0x00040047,0x00000030,0x0000001e,0x00000002,0x00020013,0x00000002,
0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,
0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003,
0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,
0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,
0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,
0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,
0x0003001e,0x00000014,0x0000000d,0x00040020,0x00000015,0x00000002,0x00000014,0x0004003b,
0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,0x0000000d,0x00040017,
0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,0x0000001b,0x0004003b,
0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,0x3f800000,0x00040020,
0x00000025,0x00000003,0x00000007,0x00040017,0x00000027,0x00000006,0x00000002,0x00040020,
0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000003,0x00040020,
0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a,0x0000002b,0x00000001,0x0004003b,
0x00000025,0x0000002d,0x00000003,0x0007002c,0x00000007,0x0000002e,0x0000001f,0x0000001f,
0x0000001f,0x0000001f,0x00040020,0x0000002f,0x00000003,0x00000006,0x0004003b,0x0000002f,
0x00000030,0x00000003,0x0004002b,0x00000006,0x00000031,0x00000000,0x00050036,0x00000002,
0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,
0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x00050041,0x00000017,
0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,0x00000018,0x00050092,
0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,0x0000001e,0x0000001d,
0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,0x00000006,0x00000021,
0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,0x00000002,0x00070050,
0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,0x00050091,0x00000007,
0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,0x0000000a,0x0000000c,
0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000027,0x0000002c,0x0000002b,0x0003003e,
0x00000029,0x0000002c,0x0003003e,0x0000002d,0x0000002e,0x0003003e,0x00000030,0x00000031,
0x000100fd,0x00010038
};

View file

@ -0,0 +1,49 @@
// 8.13.3559
#pragma once
const uint32_t sprite_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x0000002f,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000022,
0x00000024,0x00000026,0x0000002d,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,
0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,
0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,
0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,
0x00060006,0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00050006,0x0000000e,
0x00000001,0x68706c61,0x00000061,0x00030005,0x00000010,0x00006370,0x00050005,0x00000016,
0x65566e69,0x78657472,0x00000000,0x00050005,0x00000022,0x43786574,0x64726f6f,0x00000000,
0x00050005,0x00000024,0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000026,0x6f6c6f63,
0x00000072,0x00050005,0x0000002d,0x65725461,0x6c6f6873,0x00000064,0x00050048,0x00000008,
0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,
0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,
0x0000000e,0x00000000,0x00000007,0x00000010,0x00050048,0x0000000e,0x00000001,0x00000023,
0x00000040,0x00030047,0x0000000e,0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000,
0x00040047,0x00000022,0x0000001e,0x00000000,0x00040047,0x00000024,0x0000001e,0x00000001,
0x00040047,0x00000026,0x0000001e,0x00000001,0x00040047,0x0000002d,0x0000001e,0x00000002,
0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,
0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,
0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,
0x0000000d,0x00000007,0x00000004,0x0004001e,0x0000000e,0x0000000d,0x00000006,0x00040020,
0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,
0x00000011,0x00000009,0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,0x00040020,
0x00000015,0x00000001,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,0x0004002b,
0x00000006,0x00000018,0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,0x00040017,
0x00000020,0x00000006,0x00000002,0x00040020,0x00000021,0x00000003,0x00000020,0x0004003b,
0x00000021,0x00000022,0x00000003,0x00040020,0x00000023,0x00000001,0x00000020,0x0004003b,
0x00000023,0x00000024,0x00000001,0x0004003b,0x0000001e,0x00000026,0x00000003,0x0004002b,
0x0000000b,0x00000027,0x00000001,0x00040020,0x00000028,0x00000009,0x00000006,0x00040020,
0x0000002c,0x00000003,0x00000006,0x0004003b,0x0000002c,0x0000002d,0x00000003,0x0004002b,
0x00000006,0x0000002e,0x3d886595,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,
0x0000000d,0x00000013,0x00000012,0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,
0x00000006,0x00000019,0x00000017,0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,
0x00000001,0x00050051,0x00000006,0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,
0x0000001c,0x00000019,0x0000001a,0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,
0x00000013,0x0000001c,0x00050041,0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,
0x0000001f,0x0000001d,0x0004003d,0x00000020,0x00000025,0x00000024,0x0003003e,0x00000022,
0x00000025,0x00050041,0x00000028,0x00000029,0x00000010,0x00000027,0x0004003d,0x00000006,
0x0000002a,0x00000029,0x00070050,0x00000007,0x0000002b,0x00000018,0x00000018,0x00000018,
0x0000002a,0x0003003e,0x00000026,0x0000002b,0x0003003e,0x0000002d,0x0000002e,0x000100fd,
0x00010038
};

View file

@ -0,0 +1,154 @@
// 1011.0.0
#pragma once
const uint32_t world_warp_frag_spv[] = {
0x07230203,0x00010000,0x0008000a,0x000000c1,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000019,0x000000b9,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,
0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,
0x6e69616d,0x00000000,0x00040005,0x00000009,0x53726373,0x00657a69,0x00060005,0x0000000a,
0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00050006,0x0000000a,0x00000000,0x656d6974,
0x00000000,0x00050006,0x0000000a,0x00000001,0x6c616373,0x00000065,0x00060006,0x0000000a,
0x00000002,0x57726373,0x68746469,0x00000000,0x00060006,0x0000000a,0x00000003,0x48726373,
0x68676965,0x00000074,0x00050006,0x0000000a,0x00000004,0x7366666f,0x00587465,0x00050006,
0x0000000a,0x00000005,0x7366666f,0x00597465,0x00060006,0x0000000a,0x00000006,0x65786970,
0x7a69536c,0x00000065,0x00050006,0x0000000a,0x00000007,0x64666572,0x00586665,0x00050006,
0x0000000a,0x00000008,0x64666572,0x00596665,0x00060006,0x0000000a,0x00000009,0x64666572,
0x69576665,0x00687464,0x00070006,0x0000000a,0x0000000a,0x64666572,0x65486665,0x74686769,
0x00000000,0x00030005,0x0000000c,0x00006370,0x00050005,0x00000016,0x67617266,0x726f6f43,
0x00000064,0x00060005,0x00000019,0x465f6c67,0x43676172,0x64726f6f,0x00000000,0x00030005,
0x00000024,0x00007675,0x00040005,0x00000029,0x6e694d78,0x00000000,0x00040005,0x0000002d,
0x78614d78,0x00000000,0x00040005,0x00000034,0x6e694d79,0x00000000,0x00040005,0x00000038,
0x78614d79,0x00000000,0x00030005,0x00000066,0x00007873,0x00030005,0x00000077,0x00007973,
0x00040005,0x00000086,0x69685378,0x00007466,0x00040005,0x00000091,0x69685379,0x00007466,
0x00050005,0x0000009a,0x74736964,0x6974726f,0x00006e6f,0x00060005,0x000000b9,0x67617266,
0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x000000bd,0x78655473,0x65727574,0x00000000,
0x00050048,0x0000000a,0x00000000,0x00000023,0x00000044,0x00050048,0x0000000a,0x00000001,
0x00000023,0x00000048,0x00050048,0x0000000a,0x00000002,0x00000023,0x0000004c,0x00050048,
0x0000000a,0x00000003,0x00000023,0x00000050,0x00050048,0x0000000a,0x00000004,0x00000023,
0x00000054,0x00050048,0x0000000a,0x00000005,0x00000023,0x00000058,0x00050048,0x0000000a,
0x00000006,0x00000023,0x0000005c,0x00050048,0x0000000a,0x00000007,0x00000023,0x00000060,
0x00050048,0x0000000a,0x00000008,0x00000023,0x00000064,0x00050048,0x0000000a,0x00000009,
0x00000023,0x00000068,0x00050048,0x0000000a,0x0000000a,0x00000023,0x0000006c,0x00030047,
0x0000000a,0x00000002,0x00040047,0x00000019,0x0000000b,0x0000000f,0x00040047,0x000000b9,
0x0000001e,0x00000000,0x00040047,0x000000bd,0x00000022,0x00000000,0x00040047,0x000000bd,
0x00000021,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,
0x00000007,0x00000007,0x000d001e,0x0000000a,0x00000006,0x00000006,0x00000006,0x00000006,
0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00040020,
0x0000000b,0x00000009,0x0000000a,0x0004003b,0x0000000b,0x0000000c,0x00000009,0x00040015,
0x0000000d,0x00000020,0x00000001,0x0004002b,0x0000000d,0x0000000e,0x00000002,0x00040020,
0x0000000f,0x00000009,0x00000006,0x0004002b,0x0000000d,0x00000012,0x00000003,0x00040017,
0x00000017,0x00000006,0x00000004,0x00040020,0x00000018,0x00000001,0x00000017,0x0004003b,
0x00000018,0x00000019,0x00000001,0x0004002b,0x0000000d,0x0000001c,0x00000004,0x0004002b,
0x0000000d,0x0000001f,0x00000005,0x00040020,0x00000028,0x00000007,0x00000006,0x0004002b,
0x0000000d,0x0000002a,0x00000007,0x0004002b,0x0000000d,0x00000030,0x00000009,0x0004002b,
0x0000000d,0x00000035,0x00000008,0x0004002b,0x0000000d,0x0000003b,0x0000000a,0x00020014,
0x0000003f,0x0004002b,0x0000000d,0x00000040,0x00000000,0x0004002b,0x00000006,0x00000043,
0x00000000,0x00040015,0x00000047,0x00000020,0x00000000,0x0004002b,0x00000047,0x00000048,
0x00000000,0x0004002b,0x00000047,0x00000057,0x00000001,0x0004002b,0x0000000d,0x00000067,
0x00000001,0x0004002b,0x00000006,0x0000006c,0x40000000,0x0004002b,0x00000006,0x0000008c,
0x40490e56,0x0004002b,0x00000006,0x0000008e,0x41200000,0x0004002b,0x00000006,0x000000a4,
0x3bda3c21,0x0004002b,0x0000000d,0x000000a9,0x00000006,0x0005002c,0x00000007,0x000000b2,
0x00000043,0x00000043,0x0004002b,0x00000006,0x000000b4,0x3f000000,0x0005002c,0x00000007,
0x000000b5,0x000000b4,0x000000b4,0x00040020,0x000000b8,0x00000003,0x00000017,0x0004003b,
0x000000b8,0x000000b9,0x00000003,0x00090019,0x000000ba,0x00000006,0x00000001,0x00000000,
0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x000000bb,0x000000ba,0x00040020,
0x000000bc,0x00000000,0x000000bb,0x0004003b,0x000000bc,0x000000bd,0x00000000,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000008,0x00000016,0x00000007,0x0004003b,0x00000008,
0x00000024,0x00000007,0x0004003b,0x00000028,0x00000029,0x00000007,0x0004003b,0x00000028,
0x0000002d,0x00000007,0x0004003b,0x00000028,0x00000034,0x00000007,0x0004003b,0x00000028,
0x00000038,0x00000007,0x0004003b,0x00000028,0x00000066,0x00000007,0x0004003b,0x00000028,
0x00000077,0x00000007,0x0004003b,0x00000028,0x00000086,0x00000007,0x0004003b,0x00000028,
0x00000091,0x00000007,0x0004003b,0x00000008,0x0000009a,0x00000007,0x00050041,0x0000000f,
0x00000010,0x0000000c,0x0000000e,0x0004003d,0x00000006,0x00000011,0x00000010,0x00050041,
0x0000000f,0x00000013,0x0000000c,0x00000012,0x0004003d,0x00000006,0x00000014,0x00000013,
0x00050050,0x00000007,0x00000015,0x00000011,0x00000014,0x0003003e,0x00000009,0x00000015,
0x0004003d,0x00000017,0x0000001a,0x00000019,0x0007004f,0x00000007,0x0000001b,0x0000001a,
0x0000001a,0x00000000,0x00000001,0x00050041,0x0000000f,0x0000001d,0x0000000c,0x0000001c,
0x0004003d,0x00000006,0x0000001e,0x0000001d,0x00050041,0x0000000f,0x00000020,0x0000000c,
0x0000001f,0x0004003d,0x00000006,0x00000021,0x00000020,0x00050050,0x00000007,0x00000022,
0x0000001e,0x00000021,0x00050083,0x00000007,0x00000023,0x0000001b,0x00000022,0x0003003e,
0x00000016,0x00000023,0x0004003d,0x00000007,0x00000025,0x00000016,0x0004003d,0x00000007,
0x00000026,0x00000009,0x00050088,0x00000007,0x00000027,0x00000025,0x00000026,0x0003003e,
0x00000024,0x00000027,0x00050041,0x0000000f,0x0000002b,0x0000000c,0x0000002a,0x0004003d,
0x00000006,0x0000002c,0x0000002b,0x0003003e,0x00000029,0x0000002c,0x00050041,0x0000000f,
0x0000002e,0x0000000c,0x0000002a,0x0004003d,0x00000006,0x0000002f,0x0000002e,0x00050041,
0x0000000f,0x00000031,0x0000000c,0x00000030,0x0004003d,0x00000006,0x00000032,0x00000031,
0x00050081,0x00000006,0x00000033,0x0000002f,0x00000032,0x0003003e,0x0000002d,0x00000033,
0x00050041,0x0000000f,0x00000036,0x0000000c,0x00000035,0x0004003d,0x00000006,0x00000037,
0x00000036,0x0003003e,0x00000034,0x00000037,0x00050041,0x0000000f,0x00000039,0x0000000c,
0x00000035,0x0004003d,0x00000006,0x0000003a,0x00000039,0x00050041,0x0000000f,0x0000003c,
0x0000000c,0x0000003b,0x0004003d,0x00000006,0x0000003d,0x0000003c,0x00050081,0x00000006,
0x0000003e,0x0000003a,0x0000003d,0x0003003e,0x00000038,0x0000003e,0x00050041,0x0000000f,
0x00000041,0x0000000c,0x00000040,0x0004003d,0x00000006,0x00000042,0x00000041,0x000500ba,
0x0000003f,0x00000044,0x00000042,0x00000043,0x000300f7,0x00000046,0x00000000,0x000400fa,
0x00000044,0x00000045,0x00000046,0x000200f8,0x00000045,0x00050041,0x00000028,0x00000049,
0x00000016,0x00000048,0x0004003d,0x00000006,0x0000004a,0x00000049,0x0004003d,0x00000006,
0x0000004b,0x00000029,0x000500ba,0x0000003f,0x0000004c,0x0000004a,0x0000004b,0x000200f9,
0x00000046,0x000200f8,0x00000046,0x000700f5,0x0000003f,0x0000004d,0x00000044,0x00000005,
0x0000004c,0x00000045,0x000300f7,0x0000004f,0x00000000,0x000400fa,0x0000004d,0x0000004e,
0x0000004f,0x000200f8,0x0000004e,0x00050041,0x00000028,0x00000050,0x00000016,0x00000048,
0x0004003d,0x00000006,0x00000051,0x00000050,0x0004003d,0x00000006,0x00000052,0x0000002d,
0x000500b8,0x0000003f,0x00000053,0x00000051,0x00000052,0x000200f9,0x0000004f,0x000200f8,
0x0000004f,0x000700f5,0x0000003f,0x00000054,0x0000004d,0x00000046,0x00000053,0x0000004e,
0x000300f7,0x00000056,0x00000000,0x000400fa,0x00000054,0x00000055,0x00000056,0x000200f8,
0x00000055,0x00050041,0x00000028,0x00000058,0x00000016,0x00000057,0x0004003d,0x00000006,
0x00000059,0x00000058,0x0004003d,0x00000006,0x0000005a,0x00000034,0x000500ba,0x0000003f,
0x0000005b,0x00000059,0x0000005a,0x000200f9,0x00000056,0x000200f8,0x00000056,0x000700f5,
0x0000003f,0x0000005c,0x00000054,0x0000004f,0x0000005b,0x00000055,0x000300f7,0x0000005e,
0x00000000,0x000400fa,0x0000005c,0x0000005d,0x0000005e,0x000200f8,0x0000005d,0x00050041,
0x00000028,0x0000005f,0x00000016,0x00000057,0x0004003d,0x00000006,0x00000060,0x0000005f,
0x0004003d,0x00000006,0x00000061,0x00000038,0x000500b8,0x0000003f,0x00000062,0x00000060,
0x00000061,0x000200f9,0x0000005e,0x000200f8,0x0000005e,0x000700f5,0x0000003f,0x00000063,
0x0000005c,0x00000056,0x00000062,0x0000005d,0x000300f7,0x00000065,0x00000000,0x000400fa,
0x00000063,0x00000064,0x00000065,0x000200f8,0x00000064,0x00050041,0x0000000f,0x00000068,
0x0000000c,0x00000067,0x0004003d,0x00000006,0x00000069,0x00000068,0x00050041,0x0000000f,
0x0000006a,0x0000000c,0x0000000e,0x0004003d,0x00000006,0x0000006b,0x0000006a,0x00050088,
0x00000006,0x0000006d,0x0000006b,0x0000006c,0x00050041,0x00000028,0x0000006e,0x00000016,
0x00000048,0x0004003d,0x00000006,0x0000006f,0x0000006e,0x00050083,0x00000006,0x00000070,
0x0000006d,0x0000006f,0x0006000c,0x00000006,0x00000071,0x00000001,0x00000004,0x00000070,
0x00050085,0x00000006,0x00000072,0x00000071,0x0000006c,0x00050041,0x0000000f,0x00000073,
0x0000000c,0x0000000e,0x0004003d,0x00000006,0x00000074,0x00000073,0x00050088,0x00000006,
0x00000075,0x00000072,0x00000074,0x00050083,0x00000006,0x00000076,0x00000069,0x00000075,
0x0003003e,0x00000066,0x00000076,0x00050041,0x0000000f,0x00000078,0x0000000c,0x00000067,
0x0004003d,0x00000006,0x00000079,0x00000078,0x00050041,0x0000000f,0x0000007a,0x0000000c,
0x00000012,0x0004003d,0x00000006,0x0000007b,0x0000007a,0x00050088,0x00000006,0x0000007c,
0x0000007b,0x0000006c,0x00050041,0x00000028,0x0000007d,0x00000016,0x00000057,0x0004003d,
0x00000006,0x0000007e,0x0000007d,0x00050083,0x00000006,0x0000007f,0x0000007c,0x0000007e,
0x0006000c,0x00000006,0x00000080,0x00000001,0x00000004,0x0000007f,0x00050085,0x00000006,
0x00000081,0x00000080,0x0000006c,0x00050041,0x0000000f,0x00000082,0x0000000c,0x00000012,
0x0004003d,0x00000006,0x00000083,0x00000082,0x00050088,0x00000006,0x00000084,0x00000081,
0x00000083,0x00050083,0x00000006,0x00000085,0x00000079,0x00000084,0x0003003e,0x00000077,
0x00000085,0x00050041,0x0000000f,0x00000087,0x0000000c,0x00000040,0x0004003d,0x00000006,
0x00000088,0x00000087,0x00050085,0x00000006,0x00000089,0x0000006c,0x00000088,0x00050041,
0x00000028,0x0000008a,0x00000024,0x00000057,0x0004003d,0x00000006,0x0000008b,0x0000008a,
0x00050085,0x00000006,0x0000008d,0x0000008b,0x0000008c,0x00050085,0x00000006,0x0000008f,
0x0000008d,0x0000008e,0x00050081,0x00000006,0x00000090,0x00000089,0x0000008f,0x0003003e,
0x00000086,0x00000090,0x00050041,0x0000000f,0x00000092,0x0000000c,0x00000040,0x0004003d,
0x00000006,0x00000093,0x00000092,0x00050085,0x00000006,0x00000094,0x0000006c,0x00000093,
0x00050041,0x00000028,0x00000095,0x00000024,0x00000048,0x0004003d,0x00000006,0x00000096,
0x00000095,0x00050085,0x00000006,0x00000097,0x00000096,0x0000008c,0x00050085,0x00000006,
0x00000098,0x00000097,0x0000008e,0x00050081,0x00000006,0x00000099,0x00000094,0x00000098,
0x0003003e,0x00000091,0x00000099,0x0004003d,0x00000006,0x0000009b,0x00000086,0x0006000c,
0x00000006,0x0000009c,0x00000001,0x0000000d,0x0000009b,0x0004003d,0x00000006,0x0000009d,
0x00000066,0x00050085,0x00000006,0x0000009e,0x0000009c,0x0000009d,0x0004003d,0x00000006,
0x0000009f,0x00000091,0x0006000c,0x00000006,0x000000a0,0x00000001,0x0000000d,0x0000009f,
0x0004003d,0x00000006,0x000000a1,0x00000077,0x00050085,0x00000006,0x000000a2,0x000000a0,
0x000000a1,0x00050050,0x00000007,0x000000a3,0x0000009e,0x000000a2,0x0005008e,0x00000007,
0x000000a5,0x000000a3,0x000000a4,0x0003003e,0x0000009a,0x000000a5,0x0004003d,0x00000007,
0x000000a6,0x0000009a,0x0004003d,0x00000007,0x000000a7,0x00000024,0x00050081,0x00000007,
0x000000a8,0x000000a7,0x000000a6,0x0003003e,0x00000024,0x000000a8,0x000200f9,0x00000065,
0x000200f8,0x00000065,0x00050041,0x0000000f,0x000000aa,0x0000000c,0x000000a9,0x0004003d,
0x00000006,0x000000ab,0x000000aa,0x0004003d,0x00000007,0x000000ac,0x00000024,0x00050050,
0x00000007,0x000000ad,0x000000ab,0x000000ab,0x00050088,0x00000007,0x000000ae,0x000000ac,
0x000000ad,0x0003003e,0x00000024,0x000000ae,0x0004003d,0x00000007,0x000000af,0x00000024,
0x0004003d,0x00000007,0x000000b0,0x00000009,0x00050085,0x00000007,0x000000b1,0x000000af,
0x000000b0,0x0004003d,0x00000007,0x000000b3,0x00000009,0x00050083,0x00000007,0x000000b6,
0x000000b3,0x000000b5,0x0008000c,0x00000007,0x000000b7,0x00000001,0x0000002b,0x000000b1,
0x000000b2,0x000000b6,0x0003003e,0x00000024,0x000000b7,0x0004003d,0x000000bb,0x000000be,
0x000000bd,0x0004003d,0x00000007,0x000000bf,0x00000024,0x00070058,0x00000017,0x000000c0,
0x000000be,0x000000bf,0x00000002,0x00000043,0x0003003e,0x000000b9,0x000000c0,0x000100fd,
0x00010038
};

View file

@ -0,0 +1,33 @@
// 8.13.3559
#pragma once
const uint32_t world_warp_vert_spv[] = {
0x07230203,0x00010000,0x00080008,0x00000024,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000017,0x0000001b,0x00030003,
0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,
0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00050005,
0x0000000c,0x69736f70,0x6e6f6974,0x00000073,0x00060005,0x00000015,0x505f6c67,0x65567265,
0x78657472,0x00000000,0x00060006,0x00000015,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,
0x00030005,0x00000017,0x00000000,0x00060005,0x0000001b,0x565f6c67,0x65747265,0x646e4978,
0x00007865,0x00050048,0x00000015,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000015,
0x00000002,0x00040047,0x0000001b,0x0000000b,0x0000002a,0x00020013,0x00000002,0x00030021,
0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,
0x00000004,0x00040015,0x00000008,0x00000020,0x00000000,0x0004002b,0x00000008,0x00000009,
0x00000003,0x0004001c,0x0000000a,0x00000007,0x00000009,0x00040020,0x0000000b,0x00000007,
0x0000000a,0x0004002b,0x00000006,0x0000000d,0xbf800000,0x0004002b,0x00000006,0x0000000e,
0x00000000,0x0004002b,0x00000006,0x0000000f,0x3f800000,0x0007002c,0x00000007,0x00000010,
0x0000000d,0x0000000d,0x0000000e,0x0000000f,0x0004002b,0x00000006,0x00000011,0x40400000,
0x0007002c,0x00000007,0x00000012,0x00000011,0x0000000d,0x0000000e,0x0000000f,0x0007002c,
0x00000007,0x00000013,0x0000000d,0x00000011,0x0000000e,0x0000000f,0x0006002c,0x0000000a,
0x00000014,0x00000010,0x00000012,0x00000013,0x0003001e,0x00000015,0x00000007,0x00040020,
0x00000016,0x00000003,0x00000015,0x0004003b,0x00000016,0x00000017,0x00000003,0x00040015,
0x00000018,0x00000020,0x00000001,0x0004002b,0x00000018,0x00000019,0x00000000,0x00040020,
0x0000001a,0x00000001,0x00000018,0x0004003b,0x0000001a,0x0000001b,0x00000001,0x0004002b,
0x00000018,0x0000001d,0x00000003,0x00040020,0x0000001f,0x00000007,0x00000007,0x00040020,
0x00000022,0x00000003,0x00000007,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x0000000b,0x0000000c,0x00000007,0x0003003e,0x0000000c,
0x00000014,0x0004003d,0x00000018,0x0000001c,0x0000001b,0x0005008b,0x00000018,0x0000001e,
0x0000001c,0x0000001d,0x00050041,0x0000001f,0x00000020,0x0000000c,0x0000001e,0x0004003d,
0x00000007,0x00000021,0x00000020,0x00050041,0x00000022,0x00000023,0x00000017,0x00000019,
0x0003003e,0x00000023,0x00000021,0x000100fd,0x00010038
};

View file

@ -0,0 +1,206 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/local.h"
// internal helper
static void
copyBuffer(const VkBuffer * src, VkBuffer * dst, VkDeviceSize size)
{
VkCommandBuffer commandBuffer = QVk_CreateCommandBuffer(&vk_transferCommandPool,
VK_COMMAND_BUFFER_LEVEL_PRIMARY);
QVk_BeginCommand(&commandBuffer);
VkBufferCopy copyRegion = {
.srcOffset = 0,
.dstOffset = 0,
.size = size
};
vkCmdCopyBuffer(commandBuffer, *src, *dst, 1, &copyRegion);
QVk_SubmitCommand(&commandBuffer, &vk_device.transferQueue);
vkFreeCommandBuffers(vk_device.logical, vk_transferCommandPool, 1,
&commandBuffer);
}
// internal helper
static void
createStagedBuffer(const void *data, VkDeviceSize size, qvkbuffer_t * dstBuffer,
qvkbufferopts_t bufferOpts)
{
qvkstagingbuffer_t *stgBuffer;
stgBuffer = (qvkstagingbuffer_t *) malloc(sizeof(qvkstagingbuffer_t));
VK_VERIFY(QVk_CreateStagingBuffer(size, stgBuffer,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
if (data)
{
void *dst;
// staging buffers in vkQuake2 are required to be host coherent,
// so no flushing/invalidation is involved
dst = buffer_map(&stgBuffer->resource);
memcpy(dst, data, (size_t) size);
buffer_unmap(&stgBuffer->resource);
}
VK_VERIFY(QVk_CreateBuffer(size, dstBuffer, bufferOpts));
copyBuffer(&stgBuffer->resource.buffer, &dstBuffer->resource.buffer, size);
QVk_FreeStagingBuffer(stgBuffer);
free(stgBuffer);
}
VkResult
QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer,
const qvkbufferopts_t options)
{
VkBufferCreateInfo bcInfo = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.size = size,
.usage = options.usage,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = NULL,
};
// separate transfer queue makes sense only if the buffer is targetted
// for being transfered to GPU, so ignore it if it's CPU-only
uint32_t queueFamilies[] = {
(uint32_t)vk_device.gfxFamilyIndex,
(uint32_t)vk_device.transferFamilyIndex
};
if (vk_device.gfxFamilyIndex != vk_device.transferFamilyIndex)
{
bcInfo.sharingMode = VK_SHARING_MODE_CONCURRENT;
bcInfo.queueFamilyIndexCount = 2;
bcInfo.pQueueFamilyIndices = queueFamilies;
}
dstBuffer->currentOffset = 0;
return buffer_create(&dstBuffer->resource, bcInfo,
options.reqMemFlags, options.prefMemFlags,
/*skip memory*/ 0);
}
void
QVk_FreeBuffer(qvkbuffer_t *buffer)
{
buffer_destroy(&buffer->resource);
buffer->currentOffset = 0;
}
void
QVk_FreeStagingBuffer(qvkstagingbuffer_t *buffer)
{
buffer_destroy(&buffer->resource);
buffer->currentOffset = 0;
}
VkResult
QVk_CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffer,
VkMemoryPropertyFlags reqMemFlags,
VkMemoryPropertyFlags prefMemFlags)
{
VkBufferCreateInfo bcInfo = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.size = ROUNDUP(size, 1024),
.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = NULL,
};
reqMemFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
dstBuffer->currentOffset = 0;
return buffer_create(&dstBuffer->resource, bcInfo, reqMemFlags,
prefMemFlags, /*skip memory*/ 0);
}
VkResult
QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer,
VkMemoryPropertyFlags reqMemFlags,
VkMemoryPropertyFlags prefMemFlags)
{
qvkbufferopts_t dstOpts = {
.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
.reqMemFlags = reqMemFlags,
.prefMemFlags = prefMemFlags,
};
dstOpts.reqMemFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
if((vk_device.properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) ||
(dstOpts.prefMemFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
{
dstOpts.prefMemFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
return QVk_CreateBuffer(size, dstBuffer, dstOpts);
}
void
QVk_CreateVertexBuffer(const void *data, VkDeviceSize size,
qvkbuffer_t *dstBuffer,
VkMemoryPropertyFlags reqMemFlags,
VkMemoryPropertyFlags prefMemFlags)
{
qvkbufferopts_t dstOpts = {
.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT |
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
.reqMemFlags = reqMemFlags,
.prefMemFlags = prefMemFlags,
};
if((vk_device.properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) ||
(dstOpts.prefMemFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
{
dstOpts.prefMemFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
createStagedBuffer(data, size, dstBuffer, dstOpts);
}
void
QVk_CreateIndexBuffer(const void *data, VkDeviceSize size,
qvkbuffer_t *dstBuffer,
VkMemoryPropertyFlags reqMemFlags,
VkMemoryPropertyFlags prefMemFlags)
{
qvkbufferopts_t dstOpts = {
.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
.reqMemFlags = reqMemFlags,
.prefMemFlags = prefMemFlags,
};
if((vk_device.properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) ||
(dstOpts.prefMemFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
{
dstOpts.prefMemFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
createStagedBuffer(data, size, dstBuffer, dstOpts);
}

View file

@ -0,0 +1,91 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/local.h"
VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer)
{
VkCommandBufferBeginInfo cmdInfo = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
.pNext = NULL,
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
.pInheritanceInfo = NULL
};
return vkBeginCommandBuffer(*commandBuffer, &cmdInfo);
}
void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue)
{
VK_VERIFY(vkEndCommandBuffer(*commandBuffer));
VkSubmitInfo submitInfo = {
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
.pNext = NULL,
.waitSemaphoreCount = 0,
.pWaitSemaphores = NULL,
.pWaitDstStageMask = NULL,
.commandBufferCount = 1,
.pCommandBuffers = commandBuffer,
.signalSemaphoreCount = 0,
.pSignalSemaphores = NULL
};
VkFenceCreateInfo fCreateInfo = {
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
.pNext = NULL,
.flags = 0
};
VkFence queueFence;
VK_VERIFY(vkCreateFence(vk_device.logical, &fCreateInfo, NULL, &queueFence));
VK_VERIFY(vkQueueSubmit(*queue, 1, &submitInfo, queueFence));
VK_VERIFY(vkWaitForFences(vk_device.logical, 1, &queueFence, VK_TRUE, UINT64_MAX));
vkDestroyFence(vk_device.logical, queueFence, NULL);
}
VkResult QVk_CreateCommandPool(VkCommandPool *commandPool, uint32_t queueFamilyIndex)
{
VkCommandPoolCreateInfo cpCreateInfo = {
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
.pNext = NULL,
// allow the command pool to be explicitly reset without reallocating it manually during recording each frame
.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
.queueFamilyIndex = queueFamilyIndex
};
return vkCreateCommandPool(vk_device.logical, &cpCreateInfo, NULL, commandPool);
}
VkCommandBuffer QVk_CreateCommandBuffer(const VkCommandPool *commandPool, VkCommandBufferLevel level)
{
VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
VkCommandBufferAllocateInfo allocInfo = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
.pNext = NULL,
.commandPool = *commandPool,
.level = level,
.commandBufferCount = 1
};
VK_VERIFY(vkAllocateCommandBuffers(vk_device.logical, &allocInfo, &commandBuffer));
return commandBuffer;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,409 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/local.h"
// internal helper
static qboolean deviceExtensionsSupported(const VkPhysicalDevice *physicalDevice, const char* extensionName)
{
uint32_t availableExtCount = 0;
qboolean vk_extension_available = false;
VK_VERIFY(vkEnumerateDeviceExtensionProperties(*physicalDevice, NULL, &availableExtCount, NULL));
if (availableExtCount > 0)
{
VkExtensionProperties *extensions = (VkExtensionProperties *)malloc(availableExtCount * sizeof(VkExtensionProperties));
VK_VERIFY(vkEnumerateDeviceExtensionProperties(*physicalDevice, NULL, &availableExtCount, extensions));
for (uint32_t i = 0; i < availableExtCount; ++i)
{
vk_extension_available |= strcmp(extensions[i].extensionName, extensionName) == 0;
}
free(extensions);
}
// lack of extension disqualifies the device
return vk_extension_available;
}
// internal helper
static void getBestPhysicalDevice(const VkPhysicalDevice *devices, int preferredIdx,
int count, VkPhysicalDeviceType deviceType)
{
VkPhysicalDeviceProperties deviceProperties;
VkPhysicalDeviceFeatures deviceFeatures;
#if defined(__APPLE__)
MVKPhysicalDeviceMetalFeatures deviceMetalFeatures;
size_t featuresSize = sizeof(MVKPhysicalDeviceMetalFeatures);
#endif
uint32_t queueFamilyCount = 0;
for (int i = 0; i < count; ++i)
{
vkGetPhysicalDeviceProperties(devices[i], &deviceProperties);
vkGetPhysicalDeviceFeatures(devices[i], &deviceFeatures);
#if defined(__APPLE__)
qvkGetPhysicalDeviceMetalFeaturesMVK(devices[i], &deviceMetalFeatures, &featuresSize);
#endif
vkGetPhysicalDeviceQueueFamilyProperties(devices[i], &queueFamilyCount, NULL);
if (queueFamilyCount == 0)
continue;
// prefer discrete GPU but if it's the only one available then don't be picky
// also - if the user specifies a preferred device, select it
qboolean bestProperties = deviceProperties.deviceType == deviceType;
if (preferredIdx == i || (bestProperties && preferredIdx < 0) || count == 1)
{
uint32_t formatCount = 0;
uint32_t presentModesCount = 0;
// check if requested device extensions are present
if (!deviceExtensionsSupported(&devices[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME))
// no required extensions? try next device
continue;
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) && defined(__APPLE__)
if (!deviceExtensionsSupported(&devices[i], VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME))
continue;
#endif
// if extensions are fine, query surface formats and present modes to see if the device can be used
VK_VERIFY(vkGetPhysicalDeviceSurfaceFormatsKHR(devices[i], vk_surface, &formatCount, NULL));
VK_VERIFY(vkGetPhysicalDeviceSurfacePresentModesKHR(devices[i], vk_surface, &presentModesCount, NULL));
if (formatCount == 0 || presentModesCount == 0)
continue;
VkQueueFamilyProperties *queueFamilies = (VkQueueFamilyProperties *)malloc(queueFamilyCount * sizeof(VkQueueFamilyProperties));
vkGetPhysicalDeviceQueueFamilyProperties(devices[i], &queueFamilyCount, queueFamilies);
// secondary check - device is OK if there's at least on queue with VK_QUEUE_GRAPHICS_BIT set
for (uint32_t j = 0; j < queueFamilyCount; ++j)
{
// check if this queue family has support for presentation
VkBool32 presentSupported;
VK_VERIFY(vkGetPhysicalDeviceSurfaceSupportKHR(devices[i], j, vk_surface, &presentSupported));
// good optimization would be to find a queue where presentIdx == gfxQueueIdx for less overhead
if (vk_device.presentFamilyIndex < 0 && queueFamilies[j].queueCount > 0 && presentSupported)
{
vk_device.presentFamilyIndex = j;
}
if (vk_device.gfxFamilyIndex < 0 && queueFamilies[j].queueCount > 0 && (queueFamilies[j].queueFlags & VK_QUEUE_GRAPHICS_BIT))
{
vk_device.gfxFamilyIndex = j;
}
if (vk_device.transferFamilyIndex < 0 && queueFamilies[j].queueCount > 0 && !(queueFamilies[j].queueFlags & VK_QUEUE_GRAPHICS_BIT) && (queueFamilies[j].queueFlags & VK_QUEUE_TRANSFER_BIT))
{
vk_device.transferFamilyIndex = j;
}
}
free(queueFamilies);
// accept only device that has support for presentation and drawing
if (vk_device.presentFamilyIndex >= 0 && vk_device.gfxFamilyIndex >= 0)
{
if (vk_device.transferFamilyIndex < 0)
{
vk_device.transferFamilyIndex = vk_device.gfxFamilyIndex;
}
vk_device.physical = devices[i];
vk_device.properties = deviceProperties;
vk_device.features = deviceFeatures;
#if defined(__APPLE__)
vk_device.metalFeatures = deviceMetalFeatures;
#endif
return;
}
}
}
}
// internal helper
static qboolean selectPhysicalDevice(int preferredDeviceIdx)
{
VkPhysicalDeviceType typePriorities[] = {
VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU,
VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU,
VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU,
VK_PHYSICAL_DEVICE_TYPE_CPU,
VK_PHYSICAL_DEVICE_TYPE_OTHER
};
uint32_t physicalDeviceCount = 0;
int i;
VK_VERIFY(vkEnumeratePhysicalDevices(vk_instance, &physicalDeviceCount, NULL));
if (physicalDeviceCount == 0)
{
R_Printf(PRINT_ALL, "No Vulkan-capable devices found!\n");
return false;
}
R_Printf(PRINT_ALL, "...found %d Vulkan-capable device(s)\n", physicalDeviceCount);
VkPhysicalDevice *physicalDevices = (VkPhysicalDevice *)malloc(physicalDeviceCount * sizeof(VkPhysicalDevice));
VK_VERIFY(vkEnumeratePhysicalDevices(vk_instance, &physicalDeviceCount, physicalDevices));
for (i=0; i < sizeof(typePriorities) / sizeof(*typePriorities); i ++)
{
getBestPhysicalDevice(physicalDevices, preferredDeviceIdx < physicalDeviceCount ? preferredDeviceIdx : -1,
physicalDeviceCount, typePriorities[i]);
if (vk_device.physical != VK_NULL_HANDLE)
break;
}
free(physicalDevices);
if (vk_device.physical == VK_NULL_HANDLE)
{
R_Printf(PRINT_ALL, "Could not find a suitable physical device!\n");
return false;
}
if (!vk_device.features.samplerAnisotropy)
{
R_Printf(PRINT_ALL, "...anisotropy filtering is unsupported.\n");
}
return true;
}
// internal helper
static VkResult createLogicalDevice()
{
// at least one queue (graphics and present combined) has to be present
uint32_t numQueues = 1;
float queuePriority = 1.f;
VkDeviceQueueCreateInfo queueCreateInfo[3];
queueCreateInfo[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queueCreateInfo[0].pNext = NULL;
queueCreateInfo[0].flags = 0;
queueCreateInfo[0].queueFamilyIndex = vk_device.gfxFamilyIndex;
queueCreateInfo[0].queueCount = 1;
queueCreateInfo[0].pQueuePriorities = &queuePriority;
queueCreateInfo[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queueCreateInfo[1].pNext = NULL;
queueCreateInfo[1].flags = 0;
queueCreateInfo[1].queueFamilyIndex = 0;
queueCreateInfo[1].queueCount = 1;
queueCreateInfo[1].pQueuePriorities = &queuePriority;
queueCreateInfo[2].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queueCreateInfo[2].pNext = NULL;
queueCreateInfo[2].flags = 0;
queueCreateInfo[2].queueFamilyIndex = 0;
queueCreateInfo[2].queueCount = 1;
queueCreateInfo[2].pQueuePriorities = &queuePriority;
VkPhysicalDeviceFeatures wantedDeviceFeatures = {
.samplerAnisotropy = vk_device.features.samplerAnisotropy,
.fillModeNonSolid = vk_device.features.fillModeNonSolid, // for wireframe rendering
.sampleRateShading = vk_device.features.sampleRateShading, // for sample shading
};
// a graphics and present queue are different - two queues have to be created
if (vk_device.gfxFamilyIndex != vk_device.presentFamilyIndex)
{
queueCreateInfo[numQueues++].queueFamilyIndex = vk_device.presentFamilyIndex;
}
// a separate transfer queue exists that's different from present and graphics queue?
if (vk_device.transferFamilyIndex != vk_device.gfxFamilyIndex && vk_device.transferFamilyIndex != vk_device.presentFamilyIndex)
{
queueCreateInfo[numQueues++].queueFamilyIndex = vk_device.transferFamilyIndex;
}
const char *deviceExtensions[] = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) && defined(__APPLE__)
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
#endif
};
VkDeviceCreateInfo deviceCreateInfo = {
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
.pEnabledFeatures = &wantedDeviceFeatures,
.ppEnabledExtensionNames = deviceExtensions,
.enabledExtensionCount = sizeof(deviceExtensions) / sizeof(deviceExtensions[0]),
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.queueCreateInfoCount = numQueues,
.pQueueCreateInfos = queueCreateInfo
};
#if VK_HEADER_VERSION > 101
const char *validationLayers[] = { "VK_LAYER_KHRONOS_validation" };
#else
const char *validationLayers[] = { "VK_LAYER_LUNARG_standard_validation" };
#endif
if (r_validation->value > 0)
{
deviceCreateInfo.enabledLayerCount = sizeof(validationLayers)/sizeof(validationLayers[0]);
deviceCreateInfo.ppEnabledLayerNames = validationLayers;
}
return vkCreateDevice(vk_device.physical, &deviceCreateInfo, NULL, &vk_device.logical);
}
// internal helper
static const char *deviceTypeString(VkPhysicalDeviceType dType)
{
#define DEVTYPESTR(r) case VK_ ##r: return "VK_"#r
switch (dType)
{
DEVTYPESTR(PHYSICAL_DEVICE_TYPE_OTHER);
DEVTYPESTR(PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU);
DEVTYPESTR(PHYSICAL_DEVICE_TYPE_DISCRETE_GPU);
DEVTYPESTR(PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU);
DEVTYPESTR(PHYSICAL_DEVICE_TYPE_CPU);
default: return "<unknown>";
}
#undef DEVTYPESTR
return "UNKNOWN DEVICE";
}
// internal helper
static const char *vendorNameString(uint32_t vendorId)
{
switch (vendorId)
{
/* PCI vendor ID */
case 0x1002: return "AMD";
case 0x1010: return "ImgTec";
case 0x106B: return "Apple";
case 0x10DE: return "NVIDIA";
case 0x13B5: return "ARM";
case 0x5143: return "Qualcomm";
case 0x8086: return "Intel";
/* Khronos vendor ID */
case 0x10001: return "VIV";
case 0x10002: return "VSI";
case 0x10003: return "KAZAN";
case 0x10004: return "CODEPLAY";
case 0x10005: return "MESA";
case 0x10006: return "POCL";
default: return "unknown";
}
}
qboolean QVk_CreateDevice(int preferredDeviceIdx)
{
if (!selectPhysicalDevice(preferredDeviceIdx))
return false;
vk_config.vendor_name = vendorNameString(vk_device.properties.vendorID);
vk_config.device_type = deviceTypeString(vk_device.properties.deviceType);
VkResult res = createLogicalDevice();
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "Could not create Vulkan logical device: %s\n", QVk_GetError(res));
return false;
}
vkGetDeviceQueue(vk_device.logical, vk_device.gfxFamilyIndex, 0, &vk_device.gfxQueue);
vkGetDeviceQueue(vk_device.logical, vk_device.presentFamilyIndex, 0, &vk_device.presentQueue);
vkGetDeviceQueue(vk_device.logical, vk_device.transferFamilyIndex, 0, &vk_device.transferQueue);
vkGetPhysicalDeviceMemoryProperties(vk_device.physical, &vk_device.mem_properties);
// init our memory management
vulkan_memory_init();
return true;
}
// debug label related functions
void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objName)
{
if (qvkSetDebugUtilsObjectNameEXT)
{
VkDebugUtilsObjectNameInfoEXT oNameInf = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.pNext = NULL,
.objectType = objType,
.objectHandle = obj,
.pObjectName = objName
};
qvkSetDebugUtilsObjectNameEXT(vk_device.logical, &oNameInf);
}
}
void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName,
size_t tagSize, const void *tagData)
{
if (qvkSetDebugUtilsObjectTagEXT)
{
VkDebugUtilsObjectTagInfoEXT oTagInf = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT,
.pNext = NULL,
.objectType = objType,
.objectHandle = obj,
.tagName = tagName,
.tagSize = tagSize,
.pTag = tagData
};
qvkSetDebugUtilsObjectTagEXT(vk_device.logical, &oTagInf);
}
}
void QVk_DebugLabelBegin(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b)
{
if (qvkCmdBeginDebugUtilsLabelEXT)
{
VkDebugUtilsLabelEXT labelInfo = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pNext = NULL,
.pLabelName = labelName,
.color = { r, g, b, 1.f }
};
qvkCmdBeginDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
}
}
void QVk_DebugLabelEnd(const VkCommandBuffer *cmdBuffer)
{
if (qvkCmdEndDebugUtilsLabelEXT)
{
qvkCmdEndDebugUtilsLabelEXT(*cmdBuffer);
}
}
void QVk_DebugLabelInsert(const VkCommandBuffer *cmdBuffer, const char *labelName, const float r, const float g, const float b)
{
if (qvkInsertDebugUtilsLabelEXT)
{
VkDebugUtilsLabelEXT labelInfo = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pNext = NULL,
.pLabelName = labelName,
.color = { r, g, b, 1.f }
};
qvkInsertDebugUtilsLabelEXT(*cmdBuffer, &labelInfo);
}
}

View file

@ -0,0 +1,374 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// vk_draw.c
#include "header/local.h"
static image_t *draw_chars;
/*
===============
Draw_InitLocal
===============
*/
void Draw_InitLocal (void)
{
draw_chars = R_FindPic ("conchars", (findimage_t)Vk_FindImage);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
__func__);
}
}
/*
================
RE_Draw_CharScaled
Draws one 8*8 graphics character with 0 being transparent.
It can be clipped to the top of the screen to allow the console to be
smoothly scrolled off.
================
*/
void RE_Draw_CharScaled (int x, int y, int num, float scale)
{
int row, col;
float frow, fcol, size;
if (!vk_frameStarted)
return;
num &= 255;
if ((num & 127) == 32)
return; // space
if (y <= -8)
return; // totally off screen
row = num >> 4;
col = num & 15;
frow = row * 0.0625;
fcol = col * 0.0625;
size = 0.0625;
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
8.f * scale / vid.width, 8.f * scale / vid.height,
fcol, frow, size, size };
QVk_DrawTexRect(imgTransform, sizeof(imgTransform), &draw_chars->vk_texture);
}
/*
=============
RE_Draw_FindPic
=============
*/
image_t *RE_Draw_FindPic (char *name)
{
return R_FindPic(name, (findimage_t)Vk_FindImage);
}
/*
=============
RE_Draw_GetPicSize
=============
*/
void RE_Draw_GetPicSize (int *w, int *h, char *name)
{
image_t *image;
image = R_FindPic(name, (findimage_t)Vk_FindImage);
if (!image)
{
*w = *h = -1;
return;
}
*w = image->width;
*h = image->height;
}
/*
=============
RE_Draw_StretchPic
=============
*/
void RE_Draw_StretchPic (int x, int y, int w, int h, char *name)
{
image_t *vk;
if (!vk_frameStarted)
return;
vk = R_FindPic(name, (findimage_t)Vk_FindImage);
if (!vk)
{
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, name);
return;
}
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
(float)w / vid.width, (float)h / vid.height,
0, 0, 1, 1 };
QVk_DrawTexRect(imgTransform, sizeof(imgTransform), &vk->vk_texture);
}
/*
=============
RE_Draw_PicScaled
=============
*/
void RE_Draw_PicScaled (int x, int y, char *name, float scale)
{
image_t *vk;
vk = R_FindPic(name, (findimage_t)Vk_FindImage);
if (!vk)
{
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, name);
return;
}
RE_Draw_StretchPic(x, y, vk->width*scale, vk->height*scale, name);
}
/*
=============
RE_Draw_TileClear
This repeats a 64*64 tile graphic to fill the screen around a sized down
refresh window.
=============
*/
void RE_Draw_TileClear (int x, int y, int w, int h, char *name)
{
image_t *image;
if (!vk_frameStarted)
return;
image = R_FindPic(name, (findimage_t)Vk_FindImage);
if (!image)
{
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, name);
return;
}
// Change viewport and scissor to draw in the top left corner as the world view.
VkViewport tileViewport = vk_viewport;
VkRect2D tileScissor = vk_scissor;
tileViewport.x = 0.f;
tileViewport.y = 0.f;
tileScissor.offset.x = 0;
tileScissor.offset.y = 0;
vkCmdSetViewport(vk_activeCmdbuffer, 0u, 1u, &tileViewport);
vkCmdSetScissor(vk_activeCmdbuffer, 0u, 1u, &tileScissor);
const float divisor = (vk_pixel_size->value < 1.0f ? 1.0f : vk_pixel_size->value);
float imgTransform[] = { (float)x / (vid.width * divisor), (float)y / (vid.height * divisor),
(float)w / (vid.width * divisor), (float)h / (vid.height * divisor),
(float)x / (64.0 * divisor), (float)y / (64.0 * divisor),
(float)w / (64.0 * divisor), (float)h / (64.0 * divisor) };
QVk_DrawTexRect(imgTransform, sizeof(imgTransform), &image->vk_texture);
// Restore viewport and scissor.
vkCmdSetViewport(vk_activeCmdbuffer, 0u, 1u, &vk_viewport);
vkCmdSetScissor(vk_activeCmdbuffer, 0u, 1u, &vk_scissor);
}
/*
=============
RE_Draw_Fill
Fills a box of pixels with a single color
=============
*/
void RE_Draw_Fill (int x, int y, int w, int h, int c)
{
union
{
unsigned c;
byte v[4];
} color;
if (!vk_frameStarted)
return;
if ((unsigned)c > 255)
ri.Sys_Error(ERR_FATAL, "%s: bad color", __func__);
color.c = d_8to24table[c];
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
(float)w / vid.width, (float)h / vid.height,
color.v[0] / 255.f, color.v[1] / 255.f, color.v[2] / 255.f, 1.f };
QVk_DrawColorRect(imgTransform, sizeof(imgTransform), RP_UI);
}
//=============================================================================
/*
================
RE_Draw_FadeScreen
================
*/
void RE_Draw_FadeScreen (void)
{
float imgTransform[] = { 0.f, 0.f, vid.width, vid.height, 0.f, 0.f, 0.f, .8f };
if (!vk_frameStarted)
return;
QVk_DrawColorRect(imgTransform, sizeof(imgTransform), RP_UI);
}
//====================================================================
/*
=============
RE_Draw_StretchRaw
=============
*/
static int vk_rawTexture_height;
static int vk_rawTexture_width;
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int bits)
{
int i, j;
unsigned *dest;
byte *source;
byte *image_scaled = NULL;
unsigned *raw_image32;
if (!vk_frameStarted)
return;
if (bits == 32)
{
raw_image32 = malloc(cols * rows * sizeof(unsigned));
if (!raw_image32)
{
return;
}
memcpy(raw_image32, data, cols * rows * sizeof(unsigned));
}
else
{
if (r_retexturing->value)
{
// triple scaling
if (cols < (vid.width / 3) || rows < (vid.height / 3))
{
image_scaled = malloc(cols * rows * 9);
scale3x(data, image_scaled, cols, rows);
cols = cols * 3;
rows = rows * 3;
}
else
// double scaling
{
image_scaled = malloc(cols * rows * 4);
scale2x(data, image_scaled, cols, rows);
cols = cols * 2;
rows = rows * 2;
}
}
else
{
image_scaled = (byte *)data;
}
raw_image32 = malloc(cols * rows * sizeof(unsigned));
source = image_scaled;
dest = raw_image32;
for (i = 0; i < rows; ++i)
{
int rowOffset = i * cols;
for (j = 0; j < cols; ++j)
{
byte palIdx = source[rowOffset + j];
dest[rowOffset + j] = r_rawpalette[palIdx];
}
}
if (r_retexturing->value)
{
int scaled_size = cols * rows;
free(image_scaled);
SmoothColorImage(raw_image32, scaled_size, (scaled_size) >> 7);
}
}
if (vk_rawTexture.resource.image != VK_NULL_HANDLE &&
(vk_rawTexture_width != cols || vk_rawTexture_height != rows))
{
QVk_ReleaseTexture(&vk_rawTexture);
QVVKTEXTURE_CLEAR(vk_rawTexture);
}
if (vk_rawTexture.resource.image != VK_NULL_HANDLE)
{
QVk_UpdateTextureData(&vk_rawTexture, (unsigned char*)raw_image32, 0, 0, cols, rows);
}
else
{
vk_rawTexture_width = cols;
vk_rawTexture_height = rows;
QVVKTEXTURE_CLEAR(vk_rawTexture);
QVk_CreateTexture(&vk_rawTexture, (unsigned char*)raw_image32, cols, rows,
(r_videos_unfiltered->value == 0) ? vk_current_sampler : S_NEAREST,
false);
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.image,
VK_OBJECT_TYPE_IMAGE, "Image: raw texture");
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.imageView,
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: raw texture");
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.descriptorSet,
VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: raw texture");
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.memory,
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: raw texture");
}
free(raw_image32);
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
(float)w / vid.width, (float)h / vid.height,
0.f, 0.f, 1.f, 1.0f };
QVk_DrawTexRect(imgTransform, sizeof(imgTransform), &vk_rawTexture);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,672 @@
/*
* Copyright (C) 1997-2001 Id Software, Inc.
* Copyright (C) 2018-2019 Krzysztof Kondrak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* =======================================================================
*
* Lightmaps and dynamic lighting
*
* =======================================================================
*/
#include "header/local.h"
int r_dlightframecount;
static void
R_RenderDlight(dlight_t *light)
{
VkDescriptorSet uboDescriptorSet;
uint8_t *vertData, *uboData;
VkDeviceSize vboOffset;
uint32_t uboOffset;
VkBuffer vbo;
int i, j;
float rad;
rad = light->intensity * 0.35;
struct {
vec3_t verts;
float color[3];
} lightVerts[18];
for (i = 0; i < 3; i++)
{
lightVerts[0].verts[i] = light->origin[i] - vpn[i] * rad;
}
lightVerts[0].color[0] = light->color[0] * 0.2;
lightVerts[0].color[1] = light->color[1] * 0.2;
lightVerts[0].color[2] = light->color[2] * 0.2;
for (i = 16; i >= 0; i--)
{
float a;
a = i / 16.0 * M_PI * 2;
for (j = 0; j < 3; j++)
{
lightVerts[i+1].verts[j] = light->origin[j] + vright[j] * cos(a)*rad
+ vup[j] * sin(a)*rad;
lightVerts[i+1].color[j] = 0.f;
}
}
QVk_BindPipeline(&vk_drawDLightPipeline);
vertData = QVk_GetVertexBuffer(sizeof(lightVerts), &vbo, &vboOffset);
uboData = QVk_GetUniformBuffer(sizeof(r_viewproj_matrix), &uboOffset, &uboDescriptorSet);
memcpy(vertData, lightVerts, sizeof(lightVerts));
memcpy(uboData, r_viewproj_matrix, sizeof(r_viewproj_matrix));
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawDLightPipeline.layout, 0, 1, &uboDescriptorSet, 1, &uboOffset);
vkCmdBindIndexBuffer(vk_activeCmdbuffer, QVk_GetTriangleFanIbo(48), 0, VK_INDEX_TYPE_UINT16);
vkCmdDrawIndexed(vk_activeCmdbuffer, 48, 1, 0, 0, 0);
}
/*
=============
R_RenderDlights
=============
*/
void
R_RenderDlights(void)
{
int i;
dlight_t *l;
if (!vk_flashblend->value)
{
return;
}
r_dlightframecount = r_framecount + 1; // because the count hasn't
// advanced yet for this frame
l = r_newrefdef.dlights;
for (i = 0; i < r_newrefdef.num_dlights; i++, l++)
{
R_RenderDlight(l);
}
}
/*
=============================================================================
DYNAMIC LIGHTS
=============================================================================
*/
void
R_MarkSurfaceLights(dlight_t *light, int bit, mnode_t *node, int r_dlightframecount)
{
msurface_t *surf;
int i;
/* mark the polygons */
surf = r_worldmodel->surfaces + node->firstsurface;
for (i=0 ; i<node->numsurfaces ; i++, surf++)
{
if (surf->dlightframe != r_dlightframecount)
{
surf->dlightbits = 0;
surf->dlightframe = r_dlightframecount;
}
surf->dlightbits |= bit;
}
}
/*
=============
R_PushDlights
=============
*/
void
R_PushDlights(void)
{
dlight_t *l;
int i;
if (vk_flashblend->value)
{
return;
}
r_dlightframecount = r_framecount + 1; // because the count hasn't
// advanced yet for this frame
l = r_newrefdef.dlights;
for (i=0 ; i<r_newrefdef.num_dlights ; i++, l++)
{
R_MarkLights(l, 1<<i, r_worldmodel->nodes, r_dlightframecount,
R_MarkSurfaceLights);
}
}
/*
=============================================================================
LIGHT SAMPLING
=============================================================================
*/
vec3_t lightspot;
static int
RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end, vec3_t pointcolor)
{
float front, back, frac;
int side;
cplane_t *plane;
vec3_t mid;
msurface_t *surf;
int s, t, ds, dt;
int i;
mtexinfo_t *tex;
byte *lightmap;
int maps;
int r;
if (node->contents != CONTENTS_NODE)
{
return -1; // didn't hit anything
}
// calculate mid point
// FIXME: optimize for axial
plane = node->plane;
front = DotProduct(start, plane->normal) - plane->dist;
back = DotProduct(end, plane->normal) - plane->dist;
side = front < 0;
if ((back < 0) == side)
{
return RecursiveLightPoint(node->children[side], start, end, pointcolor);
}
frac = front / (front-back);
mid[0] = start[0] + (end[0] - start[0]) * frac;
mid[1] = start[1] + (end[1] - start[1]) * frac;
mid[2] = start[2] + (end[2] - start[2]) * frac;
/* go down front side */
r = RecursiveLightPoint(node->children[side], start, mid, pointcolor);
if (r >= 0)
{
return r; // hit something
}
/* check for impact on this node */
VectorCopy(mid, lightspot);
surf = r_worldmodel->surfaces + node->firstsurface;
for (i = 0; i < node->numsurfaces; i++, surf++)
{
vec3_t scale;
if (surf->flags & (SURF_DRAWTURB | SURF_DRAWSKY))
{
continue; // no lightmaps
}
tex = surf->texinfo;
s = DotProduct(mid, tex->vecs[0]) + tex->vecs[0][3];
t = DotProduct(mid, tex->vecs[1]) + tex->vecs[1][3];
if (s < surf->texturemins[0] || t < surf->texturemins[1])
{
continue;
}
ds = s - surf->texturemins[0];
dt = t - surf->texturemins[1];
if (ds > surf->extents[0] || dt > surf->extents[1])
{
continue;
}
if (!surf->samples)
{
return 0;
}
ds >>= surf->lmshift;
dt >>= surf->lmshift;
lightmap = surf->samples;
VectorCopy(vec3_origin, pointcolor);
lightmap += 3 * (dt * ((surf->extents[0] >> surf->lmshift) + 1) + ds);
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++)
{
int j;
for (j = 0; j < 3; j++)
{
scale[j] = r_modulate->value * r_newrefdef.lightstyles[surf->styles[maps]].rgb[j];
}
pointcolor[0] += lightmap[0] * scale[0] * (1.0/255);
pointcolor[1] += lightmap[1] * scale[1] * (1.0/255);
pointcolor[2] += lightmap[2] * scale[2] * (1.0/255);
lightmap += 3 * ((surf->extents[0] >> surf->lmshift) + 1) *
((surf->extents[1] >> surf->lmshift) + 1);
}
return 1;
}
/* go down back side */
return RecursiveLightPoint(node->children[!side], mid, end, pointcolor);
}
void
R_LightPoint(vec3_t p, vec3_t color, entity_t *currententity)
{
vec3_t end, pointcolor, dist;
float r;
int lnum;
dlight_t *dl;
if (!r_worldmodel->lightdata || !currententity)
{
color[0] = color[1] = color[2] = 1.0;
return;
}
end[0] = p[0];
end[1] = p[1];
end[2] = p[2] - 2048;
r = RecursiveLightPoint(r_worldmodel->nodes, p, end, pointcolor);
if (r == -1)
{
VectorCopy(vec3_origin, color);
}
else
{
VectorCopy(pointcolor, color);
}
/* add dynamic lights */
dl = r_newrefdef.dlights;
for (lnum = 0; lnum < r_newrefdef.num_dlights; lnum++, dl++)
{
float add;
VectorSubtract(currententity->origin,
dl->origin, dist);
add = dl->intensity - VectorLength(dist);
add *= (1.0 / 256);
if (add > 0)
{
VectorMA(color, add, dl->color, color);
}
}
VectorScale(color, r_modulate->value, color);
}
//===================================================================
/*
===============
R_AddDynamicLights
===============
*/
static void
R_AddDynamicLights(msurface_t *surf)
{
int lnum;
int sd, td;
float fdist, frad, fminlight;
vec3_t impact, local;
int s, t;
int i;
int smax, tmax;
dlight_t *dl;
float *plightdest;
float fsacc, ftacc;
smax = (surf->extents[0] >> surf->lmshift) + 1;
tmax = (surf->extents[1] >> surf->lmshift) + 1;
for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++)
{
if ( !(surf->dlightbits & (1<<lnum) ) )
{
continue; // not lit by this light
}
dl = &r_newrefdef.dlights[lnum];
frad = dl->intensity;
fdist = DotProduct(dl->origin, surf->plane->normal) -
surf->plane->dist;
frad -= fabs(fdist);
// rad is now the highest intensity on the plane
fminlight = DLIGHT_CUTOFF; // FIXME: make configurable?
if (frad < fminlight)
{
continue;
}
fminlight = frad - fminlight;
for (i=0 ; i<3 ; i++)
{
impact[i] = dl->origin[i] -
surf->plane->normal[i]*fdist;
}
local[0] = DotProduct (impact, surf->lmvecs[0]) + surf->lmvecs[0][3] - surf->texturemins[0];
local[1] = DotProduct (impact, surf->lmvecs[1]) + surf->lmvecs[1][3] - surf->texturemins[1];
plightdest = s_blocklights;
for (t = 0, ftacc = 0; t < tmax; t++, ftacc += (1 << surf->lmshift))
{
td = local[1] - ftacc;
if (td < 0)
td = -td;
td *= surf->lmvlen[1];
for ( s=0, fsacc = 0 ; s<smax ; s++, fsacc += (1 << surf->lmshift), plightdest += 3)
{
sd = Q_ftol( local[0] - fsacc );
if ( sd < 0 )
sd = -sd;
sd *= surf->lmvlen[0];
if (sd > td)
fdist = sd + (td>>1);
else
fdist = td + (sd>>1);
if ((fdist < fminlight) && (plightdest < (s_blocklights_max - 3)))
{
float diff = frad - fdist;
plightdest[0] += diff * dl->color[0];
plightdest[1] += diff * dl->color[1];
plightdest[2] += diff * dl->color[2];
}
}
}
}
}
/*
** R_SetCacheState
*/
void R_SetCacheState( msurface_t *surf )
{
int maps;
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++)
{
surf->cached_light[maps] = r_newrefdef.lightstyles[surf->styles[maps]].white;
}
}
float *s_blocklights = NULL, *s_blocklights_max = NULL;
/*
===============
R_BuildLightMap
Combine and scale multiple lightmaps into the floating format in blocklights
===============
*/
void
R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
{
int smax, tmax;
int r, g, b, a, max;
int i, j, size;
byte *lightmap;
float scale[4];
int mapscount;
float *bl;
if (surf->texinfo->flags & (SURF_SKY|SURF_TRANS33|SURF_TRANS66|SURF_WARP))
{
ri.Sys_Error (ERR_DROP, "R_BuildLightMap called for non-lit surface");
}
smax = (surf->extents[0] >> surf->lmshift) + 1;
tmax = (surf->extents[1] >> surf->lmshift) + 1;
size = smax * tmax;
if (!s_blocklights || (s_blocklights + (size * 3) >= s_blocklights_max))
{
int new_size = ROUNDUP(size * 3, 1024);
if (new_size < 4096)
{
new_size = 4096;
}
if (s_blocklights)
{
free(s_blocklights);
}
s_blocklights = malloc(new_size * sizeof(float));
s_blocklights_max = s_blocklights + new_size;
if (!s_blocklights)
{
ri.Sys_Error (ERR_DROP, "Can't alloc s_blocklights");
}
}
/* set to full bright if no light data */
if (!surf->samples)
{
for (i = 0; i < size * 3; i++)
{
s_blocklights[i] = 255;
}
goto store;
}
// count the # of maps
for ( mapscount = 0 ; mapscount < MAXLIGHTMAPS && surf->styles[mapscount] != 255 ;
mapscount++)
{
}
lightmap = surf->samples;
// add all the lightmaps
if ( mapscount == 1 )
{
int maps;
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++)
{
bl = s_blocklights;
for (i=0 ; i<3 ; i++)
{
scale[i] = r_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
}
if ( scale[0] == 1.0F &&
scale[1] == 1.0F &&
scale[2] == 1.0F )
{
for (i=0 ; i<size ; i++, bl+=3)
{
bl[0] = lightmap[i*3+0];
bl[1] = lightmap[i*3+1];
bl[2] = lightmap[i*3+2];
}
}
else
{
for (i=0 ; i<size ; i++, bl+=3)
{
bl[0] = lightmap[i*3+0] * scale[0];
bl[1] = lightmap[i*3+1] * scale[1];
bl[2] = lightmap[i*3+2] * scale[2];
}
}
lightmap += size*3; // skip to next lightmap
}
}
else
{
int maps;
memset(s_blocklights, 0, sizeof(s_blocklights[0]) * size * 3);
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++)
{
bl = s_blocklights;
for (i=0 ; i<3 ; i++)
{
scale[i] = r_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
}
if ( scale[0] == 1.0F &&
scale[1] == 1.0F &&
scale[2] == 1.0F )
{
for (i=0 ; i<size ; i++, bl+=3 )
{
bl[0] += lightmap[i*3+0];
bl[1] += lightmap[i*3+1];
bl[2] += lightmap[i*3+2];
}
}
else
{
for (i=0 ; i<size ; i++, bl+=3)
{
bl[0] += lightmap[i*3+0] * scale[0];
bl[1] += lightmap[i*3+1] * scale[1];
bl[2] += lightmap[i*3+2] * scale[2];
}
}
lightmap += size * 3; // skip to next lightmap
}
}
// add all the dynamic lights
if (surf->dlightframe == r_framecount)
{
R_AddDynamicLights(surf);
}
store:
// put into texture format
stride -= (smax<<2);
bl = s_blocklights;
for (i = 0; i < tmax; i++, dest += stride)
{
for (j = 0; j < smax; j++)
{
r = Q_ftol(bl[0]);
g = Q_ftol(bl[1]);
b = Q_ftol(bl[2]);
/* catch negative lights */
if (r < 0)
{
r = 0;
}
if (g < 0)
{
g = 0;
}
if (b < 0)
{
b = 0;
}
/* determine the brightest of the three color components */
if (r > g)
{
max = r;
}
else
{
max = g;
}
if (b > max)
{
max = b;
}
/* alpha is ONLY used for the mono lightmap case. For this
reason we set it to the brightest of the color components
so that things don't get too dim. */
a = max;
/* rescale all the color components if the
intensity of the greatest channel exceeds
1.0 */
if (max > 255)
{
float t = 255.0F / max;
r = r * t;
g = g * t;
b = b * t;
a = a * t;
}
dest[0] = r;
dest[1] = g;
dest[2] = b;
dest[3] = a;
bl += 3;
dest += 4;
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,331 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// vk_misc.c
#include "header/local.h"
/*
==================
RE_InitParticleTexture
==================
*/
static byte dottexture[8][8] =
{
{0,0,0,0,0,0,0,0},
{0,0,1,1,0,0,0,0},
{0,1,1,1,1,0,0,0},
{0,1,1,1,1,0,0,0},
{0,0,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
};
void RE_InitParticleTexture (void)
{
int x,y,i;
byte data[8][8][4];
//
// particle texture
//
for (x=0 ; x<8 ; x++)
{
for (y=0 ; y<8 ; y++)
{
data[y][x][0] = 255;
data[y][x][1] = 255;
data[y][x][2] = 255;
data[y][x][3] = dottexture[x][y]*255;
}
}
r_particletexture = Vk_LoadPic("***particle***", (byte *)data,
8, 8, 8, 8, 8 * 8, it_sprite, 32);
//
// particle texture
//
for (x=0 ; x<8 ; x++)
{
for (y=0 ; y<8 ; y++)
{
for (i=0 ; i<4 ; i++)
{
data[y][x][i] = ((y < 4) && (x < 4)) ? 255 : 0;
}
}
}
r_squaretexture = Vk_LoadPic("***square***", (byte *)data,
8, 8, 8, 8, 8 * 8, it_sprite, 32);
//
// also use this for bad textures, but without alpha
//
for (x=0 ; x<8 ; x++)
{
for (y=0 ; y<8 ; y++)
{
data[y][x][0] = dottexture[x&3][y&3]*255;
data[y][x][1] = 0;
data[y][x][2] = 0;
data[y][x][3] = 255;
}
}
r_notexture = Vk_LoadPic("***r_notexture***", (byte *)data,
8, 8, 8, 8, 8 * 8, it_wall, 32);
}
/*
==============================================================================
SCREEN SHOTS
==============================================================================
*/
/*
==================
Vk_ScreenShot_f
==================
*/
void Vk_ScreenShot_f (void)
{
byte *buffer;
int i;
size_t buffSize = vid.width * vid.height * 4;
if (!vk_device.screenshotSupported)
{
R_Printf(PRINT_ALL, "%s: Screenshots are not supported by this GPU.\n", __func__);
return;
}
buffer = malloc(buffSize);
VkExtent2D extent = {
.width = (uint32_t)(vid.width),
.height = (uint32_t)(vid.height),
};
VkOffset2D offset = {
.x = (int32_t)((vk_swapchain.extent.width - extent.width) / 2u),
.y = (int32_t)((vk_swapchain.extent.height - extent.height) / 2u),
};
QVk_ReadPixels(buffer, &offset, &extent);
// swap rgb to bgr
if (vk_swapchain.format == VK_FORMAT_R8G8B8A8_UNORM ||
vk_swapchain.format == VK_FORMAT_R8G8B8A8_SRGB)
{
for (i = 0; i < buffSize; i += 4)
{
buffer[i + 3] = 255;
}
}
else
{
for (i = 0; i < buffSize; i += 4)
{
int temp;
temp = buffer[i];
buffer[i] = buffer[i + 2];
buffer[i + 2] = temp;
buffer[i + 3] = 255; // alpha component
}
}
ri.Vid_WriteScreenshot(vid.width, vid.height, 4, buffer);
free(buffer);
}
/*
** Vk_Strings_f
*/
void Vk_Strings_f(void)
{
int i = 0;
uint32_t numDevices = 0;
int usedDevice = 0;
VkPhysicalDevice *physicalDevices;
VkPhysicalDeviceProperties deviceProperties;
int preferredDevice = (int)vk_device_idx->value;
int msaa = (int)vk_msaa->value;
uint32_t driverMajor = VK_VERSION_MAJOR(vk_device.properties.driverVersion);
uint32_t driverMinor = VK_VERSION_MINOR(vk_device.properties.driverVersion);
uint32_t driverPatch = VK_VERSION_PATCH(vk_device.properties.driverVersion);
// NVIDIA driver version decoding scheme
if (vk_device.properties.vendorID == 0x10DE)
{
driverMajor = ((uint32_t)(vk_device.properties.driverVersion) >> 22) & 0x3ff;
driverMinor = ((uint32_t)(vk_device.properties.driverVersion) >> 14) & 0x0ff;
uint32_t secondary = ((uint32_t)(vk_device.properties.driverVersion) >> 6) & 0x0ff;
uint32_t tertiary = vk_device.properties.driverVersion & 0x03f;
driverPatch = (secondary << 8) | tertiary;
}
VK_VERIFY(vkEnumeratePhysicalDevices(vk_instance, &numDevices, NULL));
if (!numDevices)
{
return;
}
physicalDevices = malloc(sizeof(VkPhysicalDevice) * numDevices);
if (!physicalDevices)
{
return;
}
VK_VERIFY(vkEnumeratePhysicalDevices(vk_instance, &numDevices, physicalDevices));
if (preferredDevice >= numDevices)
{
preferredDevice = -1;
}
R_Printf(PRINT_ALL, "------------------------------------\n");
R_Printf(PRINT_ALL, "Vulkan API: %d.%d\n", VK_VERSION_MAJOR(vk_config.vk_version),
VK_VERSION_MINOR(vk_config.vk_version));
R_Printf(PRINT_ALL, "Header version: %d\n", VK_HEADER_VERSION);
R_Printf(PRINT_ALL, "Devices found:\n");
for (i = 0; i < numDevices; ++i)
{
qboolean isPreferred = false;
vkGetPhysicalDeviceProperties(physicalDevices[i], &deviceProperties);
isPreferred = (preferredDevice == i) || (
preferredDevice < 0 &&
deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
);
if (isPreferred) {
usedDevice = i;
}
R_Printf(PRINT_ALL, "%s#%d: %s\n",
isPreferred && numDevices > 1 ? "* " : " ",
i, deviceProperties.deviceName);
}
free(physicalDevices);
R_Printf(PRINT_ALL, "Using device #%d:\n", usedDevice);
R_Printf(PRINT_ALL, " deviceName: %s\n", vk_device.properties.deviceName);
R_Printf(PRINT_ALL, " resolution: %dx%d", vid.width, vid.height);
if (msaa > 0)
{
R_Printf(PRINT_ALL, " (MSAAx%d)\n", msaa);
}
else
{
R_Printf(PRINT_ALL, "\n");
}
#ifndef __linux__
// Intel on Windows and MacOS (Linux uses semver for Mesa drivers)
if (vk_device.properties.vendorID == 0x8086)
{
R_Printf(PRINT_ALL, " driverVersion: %d (0x%X)\n",
vk_device.properties.driverVersion,
vk_device.properties.driverVersion);
}
else
#endif
{
R_Printf(PRINT_ALL, " driverVersion: %d.%d.%d (0x%X)\n",
driverMajor, driverMinor, driverPatch,
vk_device.properties.driverVersion);
}
R_Printf(PRINT_ALL, " apiVersion: %d.%d.%d\n",
VK_VERSION_MAJOR(vk_device.properties.apiVersion),
VK_VERSION_MINOR(vk_device.properties.apiVersion),
VK_VERSION_PATCH(vk_device.properties.apiVersion));
R_Printf(PRINT_ALL, " deviceID: %d\n", vk_device.properties.deviceID);
R_Printf(PRINT_ALL, " vendorID: 0x%X (%s)\n",
vk_device.properties.vendorID, vk_config.vendor_name);
#if defined(__APPLE__)
R_Printf(PRINT_ALL, " mslVersion: %d.%d.%d\n",
VK_VERSION_MAJOR(vk_device.metalFeatures.mslVersion),
VK_VERSION_MINOR(vk_device.metalFeatures.mslVersion),
VK_VERSION_PATCH(vk_device.metalFeatures.mslVersion));
#endif
R_Printf(PRINT_ALL, " deviceType: %s\n", vk_config.device_type);
R_Printf(PRINT_ALL, " gfx/present/transfer: %d/%d/%d\n",
vk_device.gfxFamilyIndex,
vk_device.presentFamilyIndex,
vk_device.transferFamilyIndex);
R_Printf(PRINT_ALL, "Present mode: %s\n", vk_config.present_mode);
R_Printf(PRINT_ALL, "Swapchain image format: %d\n", vk_swapchain.format);
R_Printf(PRINT_ALL, "Supported present modes: ");
i = 0;
while(vk_config.supported_present_modes[i])
{
R_Printf(PRINT_ALL, "%s ", vk_config.supported_present_modes[i++]);
}
R_Printf(PRINT_ALL, "\n");
R_Printf(PRINT_ALL, "Enabled extensions: ");
i = 0;
while(vk_config.extensions[i])
{
R_Printf(PRINT_ALL, "%s ", vk_config.extensions[i++]);
}
R_Printf(PRINT_ALL, "\n");
R_Printf(PRINT_ALL, "Enabled layers: ");
i = 0;
while(vk_config.layers[i])
{
R_Printf(PRINT_ALL, "%s ", vk_config.layers[i++]);
}
R_Printf(PRINT_ALL, "\n");
}
/*
** Vk_Mem_f
*/
void Vk_Mem_f(void)
{
R_Printf(PRINT_ALL, "\nDynamic buffer stats: \n");
R_Printf(PRINT_ALL, "Vertex : %u/%ukB (%.1f%% max: %ukB)\n",
vk_config.vertex_buffer_usage / 1024,
vk_config.vertex_buffer_size / 1024,
100.f * vk_config.vertex_buffer_usage / vk_config.vertex_buffer_size,
vk_config.vertex_buffer_max_usage / 1024);
R_Printf(PRINT_ALL, "Index : %u/%uB (%.1f%% max: %uB)\n",
vk_config.index_buffer_usage,
vk_config.index_buffer_size,
100.f * vk_config.index_buffer_usage / vk_config.index_buffer_size,
vk_config.index_buffer_max_usage);
R_Printf(PRINT_ALL, "Uniform: %u/%ukB (%.1f%% max: %ukB)\n",
vk_config.uniform_buffer_usage / 1024,
vk_config.uniform_buffer_size / 1024,
100.f * vk_config.uniform_buffer_usage / vk_config.uniform_buffer_size,
vk_config.uniform_buffer_max_usage / 1024);
R_Printf(PRINT_ALL, "Triangle index: %u/%u (%.1f%% max: %u)\n",
vk_config.triangle_index_usage,
vk_config.triangle_index_count,
100.f * vk_config.triangle_index_usage / vk_config.triangle_index_count,
vk_config.triangle_index_max_usage);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,222 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/local.h"
qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, VkShaderStageFlagBits shaderStage)
{
qvkshader_t shader;
VkShaderModuleCreateInfo smCreateInfo = {
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.codeSize = shaderCodeSize,
.pCode = shaderSrc
};
VK_VERIFY(vkCreateShaderModule(vk_device.logical, &smCreateInfo, NULL, &shader.module));
VkPipelineShaderStageCreateInfo vssCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.stage = shaderStage,
.module = shader.module,
.pName = "main",
.pSpecializationInfo = NULL
};
shader.createInfo = vssCreateInfo;
return shader;
}
void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, const uint32_t descLayoutCount, const VkPipelineVertexInputStateCreateInfo *vertexInputInfo,
qvkpipeline_t *pipeline, const qvkrenderpass_t *renderpass, const qvkshader_t *shaders, uint32_t shaderCount)
{
VkPipelineShaderStageCreateInfo *ssCreateInfos = (VkPipelineShaderStageCreateInfo *)malloc(shaderCount * sizeof(VkPipelineShaderStageCreateInfo));
for (int i = 0; i < shaderCount; i++)
{
ssCreateInfos[i] = shaders[i].createInfo;
}
VkPipelineInputAssemblyStateCreateInfo iaCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.topology = pipeline->topology,
.primitiveRestartEnable = VK_FALSE
};
VkViewport viewport = {
.x = 0.f,
.y = 0.f,
.width = (float)vid.width,
.height = (float)vid.height,
.minDepth = 0.f,
.maxDepth = 1.f,
};
VkRect2D scissor = {
.offset.x = 0,
.offset.y = 0,
.extent = vk_swapchain.extent
};
VkPipelineViewportStateCreateInfo vpCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.viewportCount = 1,
.pViewports = &viewport,
.scissorCount = 1,
.pScissors = &scissor
};
VkPipelineRasterizationStateCreateInfo rCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.depthClampEnable = VK_FALSE,
.rasterizerDiscardEnable = VK_FALSE,
.polygonMode = VK_POLYGON_MODE_FILL,
.cullMode = pipeline->cullMode,
.frontFace = VK_FRONT_FACE_CLOCKWISE,
.depthBiasEnable = VK_FALSE,
.depthBiasConstantFactor = 0.f,
.depthBiasClamp = 0.f,
.depthBiasSlopeFactor = 0.f,
.lineWidth = 1.f
};
VkPipelineMultisampleStateCreateInfo msCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.rasterizationSamples = renderpass->sampleCount,
.sampleShadingEnable = (vk_sampleshading->value > 0 && vk_device.features.sampleRateShading) ? VK_TRUE : VK_FALSE,
.minSampleShading = (vk_sampleshading->value > 0 && vk_device.features.sampleRateShading) ? 1.f : 0.f,
.pSampleMask = NULL,
.alphaToCoverageEnable = VK_FALSE,
.alphaToOneEnable = VK_FALSE
};
VkPipelineDepthStencilStateCreateInfo dCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.depthTestEnable = pipeline->depthTestEnable,
.depthWriteEnable = pipeline->depthTestEnable == VK_TRUE ? pipeline->depthWriteEnable : VK_FALSE, // there should be NO depth writes if depthTestEnable is false but Intel seems to not follow the specs fully...
.depthCompareOp = VK_COMPARE_OP_LESS,
.depthBoundsTestEnable = VK_FALSE,
.stencilTestEnable = VK_FALSE,
.front = { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_NEVER, 0, 0, 0 },
.back = { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_NEVER, 0, 0, 0 },
.minDepthBounds = 0.f,
.maxDepthBounds = 1.f
};
VkPipelineColorBlendStateCreateInfo cbsCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.logicOpEnable = VK_FALSE,
.logicOp = VK_LOGIC_OP_COPY,
.attachmentCount = 1,
.pAttachments = &pipeline->blendOpts,
.blendConstants[0] = 0.f,
.blendConstants[1] = 0.f,
.blendConstants[2] = 0.f,
.blendConstants[3] = 0.f
};
VkDynamicState dynamicStates[] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
VkPipelineDynamicStateCreateInfo dsCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.dynamicStateCount = 2,
.pDynamicStates = dynamicStates
};
// push constant sizes accomodate for maximum number of uploaded elements (should probably be checked against the hardware's maximum supported value)
VkPushConstantRange pushConstantRange[] = {
{
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
.offset = 0,
.size = 17 * sizeof(float)
},
{
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
.offset = 17 * sizeof(float),
.size = 11 * sizeof(float)
}};
VkPipelineLayoutCreateInfo plCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.setLayoutCount = descLayoutCount,
.pSetLayouts = descriptorLayout,
// for simplicity assume only two push constant range is passed,
// so it's not the most flexible approach
.pushConstantRangeCount = 2,
.pPushConstantRanges = pushConstantRange
};
VK_VERIFY(vkCreatePipelineLayout(vk_device.logical, &plCreateInfo, NULL, &pipeline->layout));
// create THE pipeline
VkGraphicsPipelineCreateInfo pCreateInfo = {
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
.pNext = NULL,
.flags = pipeline->flags,
.stageCount = shaderCount,
.pStages = ssCreateInfos,
.pVertexInputState = vertexInputInfo,
.pInputAssemblyState = &iaCreateInfo,
.pTessellationState = NULL,
.pViewportState = &vpCreateInfo,
.pRasterizationState = &rCreateInfo,
.pMultisampleState = &msCreateInfo,
.pDepthStencilState = &dCreateInfo,
.pColorBlendState = &cbsCreateInfo,
.pDynamicState = &dsCreateInfo,
.layout = pipeline->layout,
.renderPass = renderpass->rp,
.subpass = 0,
.basePipelineHandle = VK_NULL_HANDLE,
.basePipelineIndex = -1
};
VK_VERIFY(vkCreateGraphicsPipelines(vk_device.logical, VK_NULL_HANDLE, 1, &pCreateInfo, NULL, &pipeline->pl));
free(ssCreateInfos);
}
void QVk_DestroyPipeline(qvkpipeline_t *pipeline)
{
if (pipeline->layout != VK_NULL_HANDLE)
vkDestroyPipelineLayout(vk_device.logical, pipeline->layout, NULL);
if (pipeline->pl != VK_NULL_HANDLE)
vkDestroyPipeline(vk_device.logical, pipeline->pl, NULL);
pipeline->layout = VK_NULL_HANDLE;
pipeline->pl = VK_NULL_HANDLE;
}

View file

@ -0,0 +1,85 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/shaders.h"
// ingame shaders stored as uint32_t arrays (autogenerated by glslangValidator)
#include "spirv/basic_vert.c"
#include "spirv/basic_frag.c"
#include "spirv/basic_color_quad_vert.c"
#include "spirv/basic_color_quad_frag.c"
#include "spirv/model_vert.c"
#include "spirv/model_frag.c"
#include "spirv/nullmodel_vert.c"
#include "spirv/particle_vert.c"
#include "spirv/point_particle_vert.c"
#include "spirv/point_particle_frag.c"
#include "spirv/sprite_vert.c"
#include "spirv/beam_vert.c"
#include "spirv/skybox_vert.c"
#include "spirv/d_light_vert.c"
#include "spirv/polygon_vert.c"
#include "spirv/polygon_lmap_vert.c"
#include "spirv/polygon_lmap_frag.c"
#include "spirv/polygon_warp_vert.c"
#include "spirv/shadows_vert.c"
#include "spirv/postprocess_vert.c"
#include "spirv/postprocess_frag.c"
#include "spirv/world_warp_vert.c"
#include "spirv/world_warp_frag.c"
const size_t basic_vert_size = sizeof(basic_vert_spv);
const size_t basic_frag_size = sizeof(basic_frag_spv);
const size_t basic_color_quad_vert_size = sizeof(basic_color_quad_vert_spv);
const size_t basic_color_quad_frag_size = sizeof(basic_color_quad_frag_spv);
const size_t model_vert_size = sizeof(model_vert_spv);
const size_t model_frag_size = sizeof(model_frag_spv);
const size_t nullmodel_vert_size = sizeof(nullmodel_vert_spv);
const size_t particle_vert_size = sizeof(particle_vert_spv);
const size_t point_particle_vert_size = sizeof(point_particle_vert_spv);
const size_t point_particle_frag_size = sizeof(point_particle_frag_spv);
const size_t sprite_vert_size = sizeof(sprite_vert_spv);
const size_t beam_vert_size = sizeof(beam_vert_spv);
const size_t skybox_vert_size = sizeof(skybox_vert_spv);
const size_t d_light_vert_size = sizeof(d_light_vert_spv);
const size_t polygon_vert_size = sizeof(polygon_vert_spv);
const size_t polygon_lmap_vert_size = sizeof(polygon_lmap_vert_spv);
const size_t polygon_lmap_frag_size = sizeof(polygon_lmap_frag_spv);
const size_t polygon_warp_vert_size = sizeof(polygon_warp_vert_spv);
const size_t shadows_vert_size = sizeof(shadows_vert_spv);
const size_t postprocess_vert_size = sizeof(postprocess_vert_spv);
const size_t postprocess_frag_size = sizeof(postprocess_frag_spv);
const size_t world_warp_vert_size = sizeof(world_warp_vert_spv);
const size_t world_warp_frag_size = sizeof(world_warp_frag_spv);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,250 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/local.h"
// internal helper
static const char *presentModeString(VkPresentModeKHR presentMode)
{
#define PMSTR(r) case VK_ ##r: return "VK_"#r
switch (presentMode)
{
PMSTR(PRESENT_MODE_IMMEDIATE_KHR);
PMSTR(PRESENT_MODE_MAILBOX_KHR);
PMSTR(PRESENT_MODE_FIFO_KHR);
PMSTR(PRESENT_MODE_FIFO_RELAXED_KHR);
default: return "<unknown>";
}
#undef PMSTR
return "UNKNOWN PRESENT MODE";
}
// internal helper
static VkSurfaceFormatKHR getSwapSurfaceFormat(const VkSurfaceFormatKHR *surfaceFormats, uint32_t formatCount)
{
VkSurfaceFormatKHR swapSurfaceFormat;
memset(&swapSurfaceFormat, 0, sizeof(swapSurfaceFormat));
if (!surfaceFormats || !formatCount)
{
return swapSurfaceFormat;
}
for (size_t i = 0; i < formatCount; ++i)
{
if (surfaceFormats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR &&
surfaceFormats[i].format == VK_FORMAT_B8G8R8A8_UNORM)
{
swapSurfaceFormat.colorSpace = surfaceFormats[i].colorSpace;
swapSurfaceFormat.format = surfaceFormats[i].format;
return swapSurfaceFormat;
}
}
// no preferred format, so get the first one from list
swapSurfaceFormat.colorSpace = surfaceFormats[0].colorSpace;
swapSurfaceFormat.format = surfaceFormats[0].format;
return swapSurfaceFormat;
}
// internal helper
// look to https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPresentModeKHR.html for more information
static VkPresentModeKHR getSwapPresentMode(const VkPresentModeKHR *presentModes, uint32_t presentModesCount, VkPresentModeKHR desiredMode)
{
// PRESENT_MODE_FIFO_KHR is guaranteed to exist due to spec requirements
VkPresentModeKHR usedPresentMode = VK_PRESENT_MODE_FIFO_KHR;
if (!presentModes)
{
return usedPresentMode;
}
// check if the desired present mode is supported
for (uint32_t i = 0; i < presentModesCount; ++i)
{
// mode supported, nothing to do here
if (presentModes[i] == desiredMode)
{
vk_config.present_mode = presentModeString(desiredMode);
R_Printf(PRINT_ALL, "...using present mode: %s\n", vk_config.present_mode);
return desiredMode;
}
}
// preferred present mode not found - choose the next best thing
for (uint32_t i = 0; i < presentModesCount; ++i)
{
// always prefer mailbox for triple buffering with whole image replace
if (presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR)
{
usedPresentMode = presentModes[i];
break;
}
// prefer immediate update with tearing
else if (presentModes[i] == VK_PRESENT_MODE_IMMEDIATE_KHR)
{
usedPresentMode = presentModes[i];
}
}
vk_config.present_mode = presentModeString(usedPresentMode);
R_Printf(PRINT_ALL, "...present mode %s not supported, using present mode: %s\n", presentModeString(desiredMode), vk_config.present_mode);
return usedPresentMode;
}
static const VkCompositeAlphaFlagBitsKHR compositeAlphaFlags[] = {
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR,
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
};
// internal helper
static VkCompositeAlphaFlagBitsKHR getSupportedCompositeAlpha(VkCompositeAlphaFlagsKHR supportedFlags)
{
for (int i = 0; i < 4; ++i)
{
if (supportedFlags & compositeAlphaFlags[i])
return compositeAlphaFlags[i];
}
return VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
}
qboolean QVk_CheckExtent(void)
{
VkSurfaceCapabilitiesKHR surfaceCaps;
VK_VERIFY(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(vk_device.physical, vk_surface, &surfaceCaps));
if (surfaceCaps.currentExtent.width == 0 || surfaceCaps.currentExtent.height == 0)
{
return false;
}
return true;
}
VkResult QVk_CreateSwapchain()
{
VkSurfaceCapabilitiesKHR surfaceCaps;
VkSurfaceFormatKHR *surfaceFormats = NULL;
VkPresentModeKHR *presentModes = NULL;
uint32_t formatCount, presentModesCount;
VK_VERIFY(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(vk_device.physical, vk_surface, &surfaceCaps));
VK_VERIFY(vkGetPhysicalDeviceSurfaceFormatsKHR(vk_device.physical, vk_surface, &formatCount, NULL));
VK_VERIFY(vkGetPhysicalDeviceSurfacePresentModesKHR(vk_device.physical, vk_surface, &presentModesCount, NULL));
if (formatCount > 0)
{
surfaceFormats = (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
VK_VERIFY(vkGetPhysicalDeviceSurfaceFormatsKHR(vk_device.physical, vk_surface, &formatCount, surfaceFormats));
}
if (presentModesCount > 0)
{
presentModes = (VkPresentModeKHR *)malloc(presentModesCount * sizeof(VkPresentModeKHR));
VK_VERIFY(vkGetPhysicalDeviceSurfacePresentModesKHR(vk_device.physical, vk_surface, &presentModesCount, presentModes));
R_Printf(PRINT_ALL, "Supported present modes: ");
for (int i = 0; i < presentModesCount; i++)
{
R_Printf(PRINT_ALL, "%s ", presentModeString(presentModes[i]));
vk_config.supported_present_modes[i] = presentModeString(presentModes[i]);
}
R_Printf(PRINT_ALL, "\n");
}
VkSurfaceFormatKHR swapSurfaceFormat = getSwapSurfaceFormat(surfaceFormats, formatCount);
VkPresentModeKHR swapPresentMode = getSwapPresentMode(presentModes, presentModesCount, r_vsync->value > 0 ? VK_PRESENT_MODE_FIFO_KHR : VK_PRESENT_MODE_MAILBOX_KHR);
free(surfaceFormats);
free(presentModes);
VkExtent2D extent = surfaceCaps.currentExtent;
if(extent.width == UINT32_MAX || extent.height == UINT32_MAX)
{
extent.width = max(surfaceCaps.minImageExtent.width, min(surfaceCaps.maxImageExtent.width, vid.width));
extent.height = max(surfaceCaps.minImageExtent.height, min(surfaceCaps.maxImageExtent.height, vid.height));
}
// request at least 2 images - this fixes fullscreen crashes on AMD when launching the game in fullscreen
uint32_t imageCount = max(2, surfaceCaps.minImageCount);
if (swapPresentMode != VK_PRESENT_MODE_FIFO_KHR)
imageCount = max(3, surfaceCaps.minImageCount);
if (surfaceCaps.maxImageCount > 0)
imageCount = min(imageCount, surfaceCaps.maxImageCount);
VkImageUsageFlags imgUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
// TRANSFER_SRC_BIT is required for taking screenshots
if (surfaceCaps.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT)
{
imgUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
vk_device.screenshotSupported = true;
}
VkSwapchainKHR oldSwapchain = vk_swapchain.sc;
VkSwapchainCreateInfoKHR scCreateInfo = {
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
.pNext = NULL,
.flags = 0,
.surface = vk_surface,
.minImageCount = imageCount,
.imageFormat = swapSurfaceFormat.format,
.imageColorSpace = swapSurfaceFormat.colorSpace,
.imageExtent = extent,
.imageArrayLayers = 1,
.imageUsage = imgUsage,
.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = NULL,
.preTransform = (surfaceCaps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) ? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : surfaceCaps.currentTransform,
.compositeAlpha = getSupportedCompositeAlpha(surfaceCaps.supportedCompositeAlpha),
.presentMode = swapPresentMode,
.clipped = VK_TRUE,
.oldSwapchain = oldSwapchain
};
uint32_t queueFamilyIndices[] = { (uint32_t)vk_device.gfxFamilyIndex, (uint32_t)vk_device.presentFamilyIndex };
if (vk_device.presentFamilyIndex != vk_device.gfxFamilyIndex)
{
scCreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
scCreateInfo.queueFamilyIndexCount = 2;
scCreateInfo.pQueueFamilyIndices = queueFamilyIndices;
}
vk_swapchain.format = swapSurfaceFormat.format;
vk_swapchain.extent = extent;
R_Printf(PRINT_ALL, "...trying swapchain extent: %dx%d\n", vk_swapchain.extent.width, vk_swapchain.extent.height);
R_Printf(PRINT_ALL, "...trying swapchain image format: %d\n", vk_swapchain.format);
VkResult res = vkCreateSwapchainKHR(vk_device.logical, &scCreateInfo, NULL, &vk_swapchain.sc);
if (res != VK_SUCCESS)
return res;
VK_VERIFY(vkGetSwapchainImagesKHR(vk_device.logical, vk_swapchain.sc, &imageCount, NULL));
vk_swapchain.images = (VkImage *)realloc(vk_swapchain.images, imageCount * sizeof(VkImage));
vk_swapchain.imageCount = imageCount;
res = vkGetSwapchainImagesKHR(vk_device.logical, vk_swapchain.sc, &imageCount, vk_swapchain.images);
if (oldSwapchain != VK_NULL_HANDLE)
vkDestroySwapchainKHR(vk_device.logical, oldSwapchain, NULL);
return res;
}

View file

@ -0,0 +1,716 @@
/*
Copyright (C) 2018 Christoph Schied
Copyright (C) 2020 Denis Pauk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "header/util.h"
#include "header/local.h"
#include <assert.h>
/*
Returns number of bits set to 1 in (v).
On specific platforms and compilers you can use instrinsics like:
Visual Studio:
return __popcnt(v);
GCC, Clang:
return static_cast<uint32_t>(__builtin_popcount(v));
*/
static inline uint32_t count_bits_set(uint32_t v)
{
#ifdef __builtin_popcount
return __builtin_popcount(v);
#else
uint32_t c = v - ((v >> 1) & 0x55555555);
c = ((c >> 2) & 0x33333333) + (c & 0x33333333);
c = ((c >> 4) + c) & 0x0F0F0F0F;
c = ((c >> 8) + c) & 0x00FF00FF;
c = ((c >> 16) + c) & 0x0000FFFF;
return c;
#endif
}
/*
* Check:
* https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceMemoryProperties.html
* for more information.
*/
static uint32_t
get_memory_type(uint32_t mem_req_type_bits,
VkMemoryPropertyFlags mem_prop,
VkMemoryPropertyFlags mem_pref,
VkMemoryPropertyFlags mem_skip)
{
uint32_t mem_type_index = VK_MAX_MEMORY_TYPES;
int max_cost = -1;
// update prefered with required
mem_pref |= mem_prop;
// skip for host visible memory
if (mem_pref & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
{
mem_skip |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
}
for(uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; i++) {
if(mem_req_type_bits & (1 << i)) {
VkMemoryPropertyFlags propertyFlags;
// cache flags
propertyFlags = vk_device.mem_properties.memoryTypes[i].propertyFlags;
// This memory type contains mem_prop and no mem_skip
if(
(propertyFlags & mem_prop) == mem_prop &&
!(propertyFlags & mem_skip)
)
{
int curr_cost;
// Calculate cost as number of bits from preferredFlags
// not present in this memory type.
curr_cost = count_bits_set(propertyFlags & mem_pref);
// Remember memory type with upper cost as has more prefered bits.
if(curr_cost > max_cost)
{
mem_type_index = i;
max_cost = curr_cost;
}
}
}
}
return mem_type_index;
}
typedef struct MemoryResource_s {
// type of memory
uint32_t memory_type;
// offset step
VkDeviceSize alignment;
// id memory used
VkBool32 used;
// suballocate
VkBool32 suballocate;
// shared memory used for image
VkDeviceMemory memory;
// image size
VkDeviceSize size;
// posision in shared memory
VkDeviceSize offset;
} MemoryResource_t;
// 1MB buffers / 512 x 512 * RGBA
#define MEMORY_THRESHOLD (512 * 512 * 4)
static VkDeviceSize memory_block_threshold;
static MemoryResource_t *used_memory;
static VkDeviceSize used_memory_size;
void
vulkan_memory_init(void)
{
memory_block_threshold = MEMORY_THRESHOLD;
used_memory_size = 1024; // Size of buffers history
used_memory = calloc(used_memory_size, sizeof(MemoryResource_t));
}
static void
memory_type_print(VkMemoryPropertyFlags mem_prop)
{
if (!mem_prop)
{
R_Printf(PRINT_ALL, " VK_MEMORY_PROPERTY_NONE");
return;
}
#define MPSTR(r, prop) \
if((prop & VK_MEMORY_PROPERTY_ ##r) != 0) \
{ R_Printf(PRINT_ALL, " %s", "VK_MEMORY_PROPERTY_"#r); }; \
MPSTR(DEVICE_LOCAL_BIT, mem_prop);
MPSTR(HOST_VISIBLE_BIT, mem_prop);
MPSTR(HOST_COHERENT_BIT, mem_prop);
MPSTR(HOST_CACHED_BIT, mem_prop);
MPSTR(LAZILY_ALLOCATED_BIT, mem_prop);
MPSTR(PROTECTED_BIT, mem_prop);
MPSTR(DEVICE_COHERENT_BIT_AMD, mem_prop);
MPSTR(DEVICE_UNCACHED_BIT_AMD, mem_prop);
#ifdef VK_MEMORY_PROPERTY_RDMA_CAPABLE_BIT_NV
MPSTR(RDMA_CAPABLE_BIT_NV, mem_prop);
#endif
#undef PMSTR
}
void
vulkan_memory_types_show(void)
{
R_Printf(PRINT_ALL, "\nMemory blocks:");
for(uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; i++)
{
if (vk_device.mem_properties.memoryTypes[i].propertyFlags)
{
R_Printf(PRINT_ALL, "\n #%d:", i);
memory_type_print(vk_device.mem_properties.memoryTypes[i].propertyFlags);
}
}
R_Printf(PRINT_ALL, "\n");
}
static VkBool32
vulkan_memory_is_used(int start_pos, int end_pos, VkDeviceMemory memory)
{
int pos;
for (pos = start_pos; pos < end_pos; pos++)
{
if (used_memory[pos].memory == memory && used_memory[pos].used)
return VK_TRUE;
}
return VK_FALSE;
}
void
vulkan_memory_free_unused(void)
{
int pos_global;
for (pos_global = 0; pos_global < used_memory_size; pos_global ++)
{
VkDeviceMemory memory = used_memory[pos_global].memory;
if (memory != VK_NULL_HANDLE && !used_memory[pos_global].used)
{
int pos_local;
// is used somewhere else after
if (vulkan_memory_is_used(pos_global, used_memory_size, memory))
continue;
// is used somewhere else before
if (vulkan_memory_is_used(0, pos_global, memory))
continue;
// free current memory block
vkFreeMemory(vk_device.logical, memory, NULL);
memset(&used_memory[pos_global], 0, sizeof(MemoryResource_t));
// cleanup same block
for (pos_local = pos_global + 1; pos_local < used_memory_size; pos_local++)
{
if (used_memory[pos_local].memory == memory)
{
memset(&used_memory[pos_local], 0, sizeof(MemoryResource_t));
}
}
}
}
}
void
vulkan_memory_delete(void)
{
int pos_global;
for (pos_global = 0; pos_global < used_memory_size; pos_global ++)
{
VkDeviceMemory memory = used_memory[pos_global].memory;
if (memory != VK_NULL_HANDLE)
{
int pos_local;
// free current memory block
vkFreeMemory(vk_device.logical, memory, NULL);
memset(&used_memory[pos_global], 0, sizeof(MemoryResource_t));
// cleanup same block
for (pos_local = pos_global + 1; pos_local < used_memory_size; pos_local++)
{
if (used_memory[pos_local].memory == memory)
{
memset(&used_memory[pos_local], 0, sizeof(MemoryResource_t));
}
}
}
}
free(used_memory);
}
static VkResult
memory_block_min(VkDeviceSize size,
uint32_t memory_type,
VkDeviceSize alignment,
VkBool32 suballocate,
int* block_pos)
{
int pos;
VkDeviceSize min_size = memory_block_threshold;
VkResult result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
// update max_size
if (min_size < size)
{
*block_pos = -1;
return result;
}
// search minimal posible size
for (pos = 0; pos < used_memory_size; pos ++)
{
if (used_memory[pos].memory_type == memory_type &&
used_memory[pos].suballocate == suballocate &&
used_memory[pos].alignment == alignment &&
used_memory[pos].memory != VK_NULL_HANDLE &&
used_memory[pos].used == VK_FALSE &&
used_memory[pos].size < min_size &&
used_memory[pos].size >= size)
{
// save minimal size
min_size = used_memory[pos].size;
*block_pos = pos;
result = VK_SUCCESS;
}
}
return result;
}
static VkResult
memory_block_empty(int *block_pos)
{
int pos;
MemoryResource_t *memory;
// search empty memory
for (pos = *block_pos; pos < used_memory_size; pos ++)
{
if (used_memory[pos].memory == VK_NULL_HANDLE)
{
*block_pos = pos;
return VK_SUCCESS;
}
}
memory = realloc(used_memory, (used_memory_size * 2) * sizeof(MemoryResource_t));
if (!memory)
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
// use previous end
*block_pos = used_memory_size;
// update old struct
memset(memory + used_memory_size, 0, used_memory_size * sizeof(MemoryResource_t));
used_memory_size *= 2;
used_memory = memory;
return VK_SUCCESS;
}
static VkResult
memory_block_allocate(VkDeviceSize size,
uint32_t memory_type,
VkDeviceSize alignment,
VkBool32 suballocate,
int *block_pos)
{
int pos = 0;
if (memory_block_empty(&pos) == VK_SUCCESS)
{
VkResult result;
VkDeviceMemory memory;
if (size < MEMORY_THRESHOLD)
size = MEMORY_THRESHOLD;
// allocate only aligned
size = ROUNDUP(size, alignment);
// Need to split only buffers with suballocate support
if (suballocate)
{
// requested bigger then usual
if (size > memory_block_threshold)
{
size *= 2;
// up threshold for next allocations
memory_block_threshold = size;
}
// allcate bigger memory for reuse
else if (size < memory_block_threshold)
{
size = memory_block_threshold;
}
}
VkMemoryAllocateInfo mem_alloc_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.allocationSize = size,
.memoryTypeIndex = memory_type
};
result = vkAllocateMemory(vk_device.logical, &mem_alloc_info, NULL, &memory);
if (result == VK_SUCCESS)
{
used_memory[pos].memory = memory;
used_memory[pos].memory_type = memory_type;
used_memory[pos].alignment = alignment;
used_memory[pos].offset = 0;
used_memory[pos].size = size;
used_memory[pos].suballocate = suballocate;
used_memory[pos].used = VK_FALSE;
*block_pos = pos;
}
else
{
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
}
return result;
}
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
static VkResult
memory_create(VkDeviceSize size,
uint32_t memory_type,
VkBool32 suballocate,
VkDeviceSize alignment,
VkDeviceMemory *memory,
VkDeviceSize *offset)
{
int pos = -1;
VkResult result;
result = memory_block_min(size, memory_type, alignment, suballocate, &pos);
if (result != VK_SUCCESS)
{
result = memory_block_allocate(size, memory_type, alignment, suballocate, &pos);
}
if (result == VK_SUCCESS)
{
// check size of block,
// new block should be at least same size as current
// and bigger than double minimal offset
// and marked as not for mmap
if (used_memory[pos].size > (size * 2) &&
(used_memory[pos].size > (used_memory[pos].alignment * 2)) &&
used_memory[pos].suballocate)
{
// search from next slot
int new_pos = pos + 1;
result = memory_block_empty(&new_pos);
if (result == VK_SUCCESS)
{
VkDeviceSize new_size = ROUNDUP(size, used_memory[pos].alignment);
// split to several blocks
memmove(&used_memory[new_pos], &used_memory[pos], sizeof(MemoryResource_t));
used_memory[new_pos].offset = used_memory[pos].offset + new_size;
used_memory[new_pos].size = used_memory[pos].size - new_size;
// save new size to block, it can be bigger than required
used_memory[pos].size = used_memory[new_pos].offset - used_memory[pos].offset;
assert(used_memory[pos].size > 0);
}
}
used_memory[pos].used = VK_TRUE;
*offset = used_memory[pos].offset;
*memory = used_memory[pos].memory;
return result;
}
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
static void
memory_destroy(VkDeviceMemory memory, VkDeviceSize offset)
{
int pos;
for (pos = 0; pos < used_memory_size; pos ++)
{
if (used_memory[pos].memory == memory && used_memory[pos].offset == offset)
{
used_memory[pos].used = VK_FALSE;
return;
}
}
// looks as no such memory registered
vkFreeMemory(vk_device.logical, memory, NULL);
}
static VkResult
memory_create_by_property(VkMemoryRequirements* mem_reqs,
VkMemoryPropertyFlags mem_properties,
VkMemoryPropertyFlags mem_preferences,
VkMemoryPropertyFlags mem_skip,
VkDeviceMemory *memory,
VkDeviceSize *offset)
{
VkMemoryPropertyFlags host_visible;
uint32_t memory_index;
if (r_validation->value > 0)
{
R_Printf(PRINT_ALL, "Asked about memory properties with:\n");
memory_type_print(mem_properties);
R_Printf(PRINT_ALL, "\nAsked about memory preferences with:\n");
memory_type_print(mem_preferences);
R_Printf(PRINT_ALL, "\nAsked about memory skip with:\n");
memory_type_print(mem_skip);
R_Printf(PRINT_ALL, "\n");
}
memory_index = get_memory_type(mem_reqs->memoryTypeBits,
mem_properties, mem_preferences, mem_skip);
if (memory_index == VK_MAX_MEMORY_TYPES)
{
R_Printf(PRINT_ALL, "%s:%d: Have not found required memory type.\n",
__func__, __LINE__);
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
else if (r_validation->value > 0)
{
R_Printf(PRINT_ALL, "%s:%d: Selected %d memory properties with:\n",
__func__, __LINE__, memory_index);
memory_type_print(
vk_device.mem_properties.memoryTypes[memory_index].propertyFlags);
R_Printf(PRINT_ALL, "\n");
}
/* get selected memory properties */
mem_properties = vk_device.mem_properties.memoryTypes[memory_index].propertyFlags &
(mem_properties | mem_preferences);
host_visible = mem_properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
return memory_create(mem_reqs->size, memory_index,
// suballocate allowed
host_visible != VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
mem_reqs->alignment, memory, offset);
}
VkResult
buffer_create(BufferResource_t *buf,
VkBufferCreateInfo buf_create_info,
VkMemoryPropertyFlags mem_properties,
VkMemoryPropertyFlags mem_preferences,
VkMemoryPropertyFlags mem_skip)
{
assert(buf_create_info.size > 0);
assert(buf);
VkResult result = VK_SUCCESS;
buf->size = buf_create_info.size;
buf->is_mapped = VK_FALSE;
result = vkCreateBuffer(vk_device.logical, &buf_create_info, NULL, &buf->buffer);
if(result != VK_SUCCESS) {
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
goto fail_buffer;
}
assert(buf->buffer != VK_NULL_HANDLE);
VkMemoryRequirements mem_reqs;
vkGetBufferMemoryRequirements(vk_device.logical, buf->buffer, &mem_reqs);
result = memory_create_by_property(&mem_reqs, mem_properties, mem_preferences,
mem_skip, &buf->memory, &buf->offset);
if(result != VK_SUCCESS) {
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
goto fail_mem_alloc;
}
assert(buf->memory != VK_NULL_HANDLE);
result = vkBindBufferMemory(vk_device.logical, buf->buffer, buf->memory, buf->offset);
if(result != VK_SUCCESS) {
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
goto fail_bind_buf_memory;
}
return VK_SUCCESS;
fail_bind_buf_memory:
memory_destroy(buf->memory, buf->offset);
fail_mem_alloc:
vkDestroyBuffer(vk_device.logical, buf->buffer, NULL);
fail_buffer:
buf->buffer = VK_NULL_HANDLE;
buf->memory = VK_NULL_HANDLE;
buf->size = 0;
return result;
}
VkResult
image_create(ImageResource_t *img,
VkImageCreateInfo img_create_info,
VkMemoryPropertyFlags mem_properties,
VkMemoryPropertyFlags mem_preferences,
VkMemoryPropertyFlags mem_skip)
{
assert(img);
VkResult result = VK_SUCCESS;
result = vkCreateImage(vk_device.logical, &img_create_info, NULL, &img->image);
if(result != VK_SUCCESS) {
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
goto fail_buffer;
}
assert(img->image != VK_NULL_HANDLE);
VkMemoryRequirements mem_reqs;
vkGetImageMemoryRequirements(vk_device.logical, img->image, &mem_reqs);
img->size = mem_reqs.size;
result = memory_create_by_property(&mem_reqs, mem_properties, mem_preferences,
mem_skip, &img->memory, &img->offset);
if(result != VK_SUCCESS) {
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
goto fail_mem_alloc;
}
assert(img->memory != VK_NULL_HANDLE);
result = vkBindImageMemory(vk_device.logical, img->image, img->memory, img->offset);
if(result != VK_SUCCESS) {
R_Printf(PRINT_ALL, "%s:%d: VkResult verification: %s\n",
__func__, __LINE__, QVk_GetError(result));
goto fail_bind_buf_memory;
}
return VK_SUCCESS;
fail_bind_buf_memory:
memory_destroy(img->memory, img->offset);
fail_mem_alloc:
vkDestroyImage(vk_device.logical, img->image, NULL);
fail_buffer:
img->image = VK_NULL_HANDLE;
img->memory = VK_NULL_HANDLE;
img->size = 0;
return result;
}
VkResult
buffer_destroy(BufferResource_t *buf)
{
assert(!buf->is_mapped);
// buffer should be destroed before bound memory
if(buf->buffer != VK_NULL_HANDLE)
{
vkDestroyBuffer(vk_device.logical, buf->buffer, NULL);
buf->buffer = VK_NULL_HANDLE;
}
// buffer desroed, we can free up memory
if(buf->memory != VK_NULL_HANDLE)
{
memory_destroy(buf->memory, buf->offset);
buf->memory = VK_NULL_HANDLE;
}
memset(buf, 0, sizeof(BufferResource_t));
return VK_SUCCESS;
}
VkResult
image_destroy(ImageResource_t *img)
{
// image should be destroed before bound memory
if(img->image != VK_NULL_HANDLE)
{
vkDestroyImage(vk_device.logical, img->image, NULL);
img->image = VK_NULL_HANDLE;
}
// image destroed, we can free up memory
if(img->memory != VK_NULL_HANDLE)
{
memory_destroy(img->memory, img->offset);
img->memory = VK_NULL_HANDLE;
}
memset(img, 0, sizeof(ImageResource_t));
return VK_SUCCESS;
}
VkResult
buffer_flush(BufferResource_t *buf)
{
VkResult result = VK_SUCCESS;
VkMappedMemoryRange ranges[1] = {{
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
.memory = buf->memory,
.offset = buf->offset,
.size = buf->size
}};
result = vkFlushMappedMemoryRanges(vk_device.logical, 1, ranges);
return result;
}
VkResult
buffer_invalidate(BufferResource_t *buf)
{
VkResult result = VK_SUCCESS;
VkMappedMemoryRange ranges[1] = {{
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
.memory = buf->memory,
.offset = buf->offset,
.size = buf->size
}};
result = vkInvalidateMappedMemoryRanges(vk_device.logical, 1, ranges);
return result;
}
void *
buffer_map(BufferResource_t *buf)
{
assert(buf->memory);
assert(!buf->is_mapped);
buf->is_mapped = VK_TRUE;
void *ret = NULL;
assert(buf->memory != VK_NULL_HANDLE);
assert(buf->size > 0);
VK_VERIFY(vkMapMemory(vk_device.logical, buf->memory,
buf->offset/*offset*/, buf->size, 0 /*flags*/, &ret));
return ret;
}
void
buffer_unmap(BufferResource_t *buf)
{
assert(buf->memory);
assert(buf->is_mapped);
buf->is_mapped = VK_FALSE;
vkUnmapMemory(vk_device.logical, buf->memory);
}

View file

@ -0,0 +1,150 @@
/*
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "header/local.h"
static VkDebugUtilsMessengerEXT validationMessenger = VK_NULL_HANDLE;
// layer message to string
static const char* msgToString(VkDebugUtilsMessageTypeFlagsEXT type)
{
int g = (type & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT) != 0 ? 1 : 0;
int p = (type & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) != 0 ? 1 : 0;
int v = (type & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) != 0 ? 1 : 0;
if (g) return "";
if (p && !v) return "(performance)";
if (p && v) return "(performance and validation)";
if (v) return "(validation)";
return "?";
}
// validation layer callback function (VK_EXT_debug_utils)
static VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT msgSeverity,
VkDebugUtilsMessageTypeFlagsEXT msgType,
const VkDebugUtilsMessengerCallbackDataEXT *callbackData,
void* userData)
{
switch (msgSeverity)
{
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
R_Printf(PRINT_ALL, "VK_INFO: %s %s\n", callbackData->pMessage, msgToString(msgType));
break;
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
R_Printf(PRINT_ALL, "VK_VERBOSE: %s %s\n", callbackData->pMessage, msgToString(msgType));
break;
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
R_Printf(PRINT_ALL, "VK_WARNING: %s %s\n", callbackData->pMessage, msgToString(msgType));
break;
default:
R_Printf(PRINT_ALL, "VK_ERROR: %s %s\n", callbackData->pMessage, msgToString(msgType));
assert(!"Vulkan error occured!");
}
return VK_FALSE;
}
static VkDebugReportCallbackEXT validationLayerCallback = VK_NULL_HANDLE;
// validation layer callback function (VK_EXT_debug_report)
static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallbackReport(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objType,
uint64_t obj, size_t location, int32_t code,
const char *layerPrefix, const char *msg,
void* userData)
{
switch (flags)
{
case VK_DEBUG_REPORT_INFORMATION_BIT_EXT:
R_Printf(PRINT_ALL, "VK_INFO: %s %s\n", layerPrefix, msg);
break;
case VK_DEBUG_REPORT_DEBUG_BIT_EXT:
R_Printf(PRINT_ALL, "VK_DEBUG: %s %s\n", layerPrefix, msg);
break;
case VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT:
R_Printf(PRINT_ALL, "VK_PERFORMANCE: %s %s\n", layerPrefix, msg);
break;
case VK_DEBUG_REPORT_WARNING_BIT_EXT:
R_Printf(PRINT_ALL, "VK_WARNING: %s %s\n", layerPrefix, msg);
break;
default:
R_Printf(PRINT_ALL, "VK_ERROR: %s %s\n", layerPrefix, msg);
break;
}
return VK_FALSE;
}
void QVk_CreateValidationLayers()
{
VkDebugUtilsMessengerCreateInfoEXT callbackInfo = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
.pNext = NULL,
.flags = 0,
.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT,
.pfnUserCallback = debugUtilsCallback,
.pUserData = NULL
};
VkDebugReportCallbackCreateInfoEXT callbackReport = {
.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT,
.pNext = NULL,
.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_DEBUG_BIT_EXT | VK_DEBUG_REPORT_INFORMATION_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
.pfnCallback = debugCallbackReport,
.pUserData = NULL
};
if (r_validation->value > 1)
{
callbackInfo.messageSeverity |= VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
}
if (qvkCreateDebugUtilsMessengerEXT)
{
VK_VERIFY(qvkCreateDebugUtilsMessengerEXT(vk_instance, &callbackInfo, NULL, &validationMessenger));
}
if (qvkCreateDebugReportCallbackEXT)
{
VK_VERIFY(qvkCreateDebugReportCallbackEXT(vk_instance, &callbackReport, NULL, &validationLayerCallback));
R_Printf(PRINT_ALL, "...Vulkan validation layers enabled\n");
}
}
void QVk_DestroyValidationLayers()
{
if( validationMessenger != VK_NULL_HANDLE && qvkDestroyDebugUtilsMessengerEXT)
{
qvkDestroyDebugUtilsMessengerEXT( vk_instance, validationMessenger, NULL );
validationMessenger = VK_NULL_HANDLE;
}
if ( validationLayerCallback != VK_NULL_HANDLE && qvkDestroyDebugReportCallbackEXT)
{
qvkDestroyDebugReportCallbackEXT( vk_instance, validationLayerCallback, NULL );
validationLayerCallback = VK_NULL_HANDLE;
}
}

View file

@ -0,0 +1,723 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
Copyright (C) 2018-2019 Krzysztof Kondrak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// vk_warp.c -- sky and water polygons
#include "header/local.h"
static float skyrotate;
static int skyautorotate;
static vec3_t skyaxis;
static image_t *sky_images[6];
static msurface_t *warpface;
#define SUBDIVIDE_SIZE 64
static void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
{
int i, j;
float *v;
mins[0] = mins[1] = mins[2] = 9999;
maxs[0] = maxs[1] = maxs[2] = -9999;
v = verts;
for (i=0 ; i<numverts ; i++)
for (j=0 ; j<3 ; j++, v++)
{
if (*v < mins[j])
mins[j] = *v;
if (*v > maxs[j])
maxs[j] = *v;
}
}
static void SubdividePolygon (int numverts, float *verts)
{
int i, j, k;
vec3_t mins, maxs;
float *v;
vec3_t front[64], back[64];
int f, b;
float dist[64];
float frac;
vkpoly_t *poly;
vec3_t total;
float total_s, total_t;
if (numverts > 60)
ri.Sys_Error (ERR_DROP, "%s: numverts = %i", __func__, numverts);
BoundPoly (numverts, verts, mins, maxs);
for (i=0 ; i<3 ; i++)
{
float m;
m = (mins[i] + maxs[i]) * 0.5;
m = SUBDIVIDE_SIZE * floor (m/SUBDIVIDE_SIZE + 0.5);
if (maxs[i] - m < 8)
continue;
if (m - mins[i] < 8)
continue;
// cut it
v = verts + i;
for (j=0 ; j<numverts ; j++, v+= 3)
dist[j] = *v - m;
// wrap cases
dist[j] = dist[0];
v-=i;
VectorCopy(verts, v);
f = b = 0;
v = verts;
for (j=0 ; j<numverts ; j++, v+= 3)
{
if (dist[j] >= 0)
{
VectorCopy(v, front[f]);
f++;
}
if (dist[j] <= 0)
{
VectorCopy(v, back[b]);
b++;
}
if (dist[j] == 0 || dist[j+1] == 0)
continue;
if ( (dist[j] > 0) != (dist[j+1] > 0) )
{
// clip point
frac = dist[j] / (dist[j] - dist[j+1]);
for (k=0 ; k<3 ; k++)
front[f][k] = back[b][k] = v[k] + frac*(v[3+k] - v[k]);
f++;
b++;
}
}
SubdividePolygon (f, front[0]);
SubdividePolygon (b, back[0]);
return;
}
// add a point in the center to help keep warp valid
poly = Hunk_Alloc (sizeof(vkpoly_t) + ((numverts-4)+2) * VERTEXSIZE*sizeof(float));
poly->next = warpface->polys;
warpface->polys = poly;
poly->numverts = numverts+2;
VectorClear (total);
total_s = 0;
total_t = 0;
for (i=0 ; i<numverts ; i++, verts+= 3)
{
float s, t;
VectorCopy(verts, poly->verts[i+1]);
s = DotProduct(verts, warpface->texinfo->vecs[0]);
t = DotProduct(verts, warpface->texinfo->vecs[1]);
total_s += s;
total_t += t;
VectorAdd (total, verts, total);
poly->verts[i+1][3] = s;
poly->verts[i+1][4] = t;
}
VectorScale(total, (1.0/numverts), poly->verts[0]);
poly->verts[0][3] = total_s/numverts;
poly->verts[0][4] = total_t/numverts;
// copy first vertex to last
memmove (poly->verts[i+1], poly->verts[1], sizeof(poly->verts[0]));
}
/*
================
Vk_SubdivideSurface
Breaks a polygon up along axial 64 unit
boundaries so that turbulent and sky warps
can be done reasonably.
================
*/
void Vk_SubdivideSurface (msurface_t *fa, model_t *loadmodel)
{
vec3_t verts[64];
int numverts;
int i;
float *vec;
warpface = fa;
//
// convert edges back to a normal polygon
//
numverts = 0;
for (i=0 ; i<fa->numedges ; i++)
{
int lindex;
lindex = loadmodel->surfedges[fa->firstedge + i];
if (lindex > 0)
vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position;
else
vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position;
VectorCopy(vec, verts[numverts]);
numverts++;
}
SubdividePolygon (numverts, verts[0]);
}
//=========================================================
/*
=============
EmitWaterPolys
Does a water warp on the pre-fragmented vkpoly_t chain
=============
*/
void
EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix,
const float *color, qboolean solid_surface)
{
vkpoly_t *p, *bp;
float *v;
int i;
struct {
float model[16];
float color[4];
float time;
float scroll;
} polyUbo;
polyUbo.color[0] = color[0];
polyUbo.color[1] = color[1];
polyUbo.color[2] = color[2];
polyUbo.color[3] = color[3];
polyUbo.time = r_newrefdef.time;
if (fa->texinfo->flags & SURF_FLOWING)
polyUbo.scroll = (-64 * ((r_newrefdef.time*0.5) - (int)(r_newrefdef.time*0.5))) / 64.f;
else
polyUbo.scroll = 0;
if (modelMatrix)
{
memcpy(polyUbo.model, modelMatrix, sizeof(float) * 16);
}
else
{
Mat_Identity(polyUbo.model);
}
if (solid_surface)
{
// Solid surface
QVk_BindPipeline(&vk_drawPolySolidWarpPipeline);
}
else
{
// Blend surface
QVk_BindPipeline(&vk_drawPolyWarpPipeline);
}
uint32_t uboOffset;
VkDescriptorSet uboDescriptorSet;
uint8_t *uboData = QVk_GetUniformBuffer(sizeof(polyUbo), &uboOffset, &uboDescriptorSet);
memcpy(uboData, &polyUbo, sizeof(polyUbo));
VkBuffer vbo;
VkDeviceSize vboOffset;
VkDescriptorSet descriptorSets[] = { texture->vk_texture.descriptorSet, uboDescriptorSet };
float gamma = 2.1F - vid_gamma->value;
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
if (solid_surface)
{
// Solid surface
vkCmdBindDescriptorSets(
vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
vk_drawPolySolidWarpPipeline.layout, 0, 2,
descriptorSets, 1, &uboOffset);
}
else
{
// Blend surface
vkCmdBindDescriptorSets(
vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
vk_drawPolyWarpPipeline.layout, 0, 2,
descriptorSets, 1, &uboOffset);
}
for (bp = fa->polys; bp; bp = bp->next)
{
p = bp;
if (Mesh_VertsRealloc(p->numverts))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE)
{
verts_buffer[i].vertex[0] = v[0];
verts_buffer[i].vertex[1] = v[1];
verts_buffer[i].vertex[2] = v[2];
verts_buffer[i].texCoord[0] = v[3] / 64.f;
verts_buffer[i].texCoord[1] = v[4] / 64.f;
}
uint8_t *vertData = QVk_GetVertexBuffer(sizeof(polyvert_t) * p->numverts, &vbo, &vboOffset);
memcpy(vertData, verts_buffer, sizeof(polyvert_t) * p->numverts);
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
vkCmdBindIndexBuffer(vk_activeCmdbuffer, QVk_GetTriangleFanIbo((p->numverts - 2) * 3), 0, VK_INDEX_TYPE_UINT16);
vkCmdDrawIndexed(vk_activeCmdbuffer, (p->numverts - 2) * 3, 1, 0, 0, 0);
}
}
//===================================================================
static vec3_t skyclip[6] = {
{1,1,0},
{1,-1,0},
{0,-1,1},
{0,1,1},
{1,0,1},
{-1,0,1}
};
// 1 = s, 2 = t, 3 = 2048
static int st_to_vec[6][3] =
{
{3,-1,2},
{-3,1,2},
{1,3,2},
{-1,-3,2},
{-2,-1,3}, // 0 degrees yaw, look straight up
{2,-1,-3} // look straight down
// {-1,2,3},
// {1,2,-3}
};
// s = [0]/[2], t = [1]/[2]
static int vec_to_st[6][3] =
{
{-2,3,1},
{2,3,-1},
{1,3,2},
{-1,3,-2},
{-2,-1,3},
{-2,1,-3}
// {-1,2,3},
// {1,2,-3}
};
static float skymins[2][6], skymaxs[2][6];
static float sky_min, sky_max;
static void DrawSkyPolygon (int nump, vec3_t vecs)
{
int i;
vec3_t v, av;
float s, t, dv;
int axis;
float *vp;
// decide which face it maps to
VectorCopy(vec3_origin, v);
for (i=0, vp=vecs ; i<nump ; i++, vp+=3)
{
VectorAdd (vp, v, v);
}
av[0] = fabs(v[0]);
av[1] = fabs(v[1]);
av[2] = fabs(v[2]);
if (av[0] > av[1] && av[0] > av[2])
{
if (v[0] < 0)
axis = 1;
else
axis = 0;
}
else if (av[1] > av[2] && av[1] > av[0])
{
if (v[1] < 0)
axis = 3;
else
axis = 2;
}
else
{
if (v[2] < 0)
axis = 5;
else
axis = 4;
}
// project new texture coords
for (i=0 ; i<nump ; i++, vecs+=3)
{
int j;
j = vec_to_st[axis][2];
if (j > 0)
dv = vecs[j - 1];
else
dv = -vecs[-j - 1];
if (dv < 0.001)
continue; // don't divide by zero
j = vec_to_st[axis][0];
if (j < 0)
s = -vecs[-j -1] / dv;
else
s = vecs[j-1] / dv;
j = vec_to_st[axis][1];
if (j < 0)
t = -vecs[-j -1] / dv;
else
t = vecs[j-1] / dv;
if (s < skymins[0][axis])
skymins[0][axis] = s;
if (t < skymins[1][axis])
skymins[1][axis] = t;
if (s > skymaxs[0][axis])
skymaxs[0][axis] = s;
if (t > skymaxs[1][axis])
skymaxs[1][axis] = t;
}
}
#define ON_EPSILON 0.1 // point on plane side epsilon
#define MAX_CLIP_VERTS 64
static void ClipSkyPolygon (int nump, vec3_t vecs, int stage)
{
float *norm;
float *v;
qboolean front, back;
float d, e;
float dists[MAX_CLIP_VERTS];
int sides[MAX_CLIP_VERTS];
vec3_t newv[2][MAX_CLIP_VERTS];
int newc[2];
int i, j;
if (nump > MAX_CLIP_VERTS-2)
ri.Sys_Error (ERR_DROP, "%s: MAX_CLIP_VERTS", __func__);
if (stage == 6)
{ // fully clipped, so draw it
DrawSkyPolygon (nump, vecs);
return;
}
front = back = false;
norm = skyclip[stage];
for (i=0, v = vecs ; i<nump ; i++, v+=3)
{
d = DotProduct(v, norm);
if (d > ON_EPSILON)
{
front = true;
sides[i] = SIDE_FRONT;
}
else if (d < -ON_EPSILON)
{
back = true;
sides[i] = SIDE_BACK;
}
else
sides[i] = SIDE_ON;
dists[i] = d;
}
if (!front || !back)
{ // not clipped
ClipSkyPolygon (nump, vecs, stage+1);
return;
}
// clip it
sides[i] = sides[0];
dists[i] = dists[0];
VectorCopy(vecs, (vecs+(i*3)) );
newc[0] = newc[1] = 0;
for (i=0, v = vecs ; i<nump ; i++, v+=3)
{
switch (sides[i])
{
case SIDE_FRONT:
VectorCopy(v, newv[0][newc[0]]);
newc[0]++;
break;
case SIDE_BACK:
VectorCopy(v, newv[1][newc[1]]);
newc[1]++;
break;
case SIDE_ON:
VectorCopy(v, newv[0][newc[0]]);
newc[0]++;
VectorCopy(v, newv[1][newc[1]]);
newc[1]++;
break;
}
if (sides[i] == SIDE_ON || sides[i+1] == SIDE_ON || sides[i+1] == sides[i])
continue;
d = dists[i] / (dists[i] - dists[i+1]);
for (j=0 ; j<3 ; j++)
{
e = v[j] + d*(v[j+3] - v[j]);
newv[0][newc[0]][j] = e;
newv[1][newc[1]][j] = e;
}
newc[0]++;
newc[1]++;
}
// continue
ClipSkyPolygon (newc[0], newv[0][0], stage+1);
ClipSkyPolygon (newc[1], newv[1][0], stage+1);
}
/*
=================
R_AddSkySurface
=================
*/
void R_AddSkySurface (msurface_t *fa)
{
int i;
vec3_t verts[MAX_CLIP_VERTS];
vkpoly_t *p;
// calculate vertex values for sky box
for (p=fa->polys ; p ; p=p->next)
{
for (i=0 ; i<p->numverts ; i++)
{
VectorSubtract(p->verts[i], r_origin, verts[i]);
}
ClipSkyPolygon (p->numverts, verts[0], 0);
}
}
/*
==============
R_ClearSkyBox
==============
*/
void R_ClearSkyBox (void)
{
int i;
for (i=0 ; i<6 ; i++)
{
skymins[0][i] = skymins[1][i] = 9999;
skymaxs[0][i] = skymaxs[1][i] = -9999;
}
}
static void MakeSkyVec (float s, float t, int axis, float *vertexData)
{
vec3_t v, b;
int j;
float dist = (r_farsee->value == 0) ? 2300.0f : 4096.0f;
b[0] = s * dist;
b[1] = t * dist;
b[2] = dist;
for (j = 0; j<3; j++)
{
int k;
k = st_to_vec[axis][j];
if (k < 0)
v[j] = -b[-k - 1];
else
v[j] = b[k - 1];
}
// avoid bilerp seam
s = (s + 1)*0.5;
t = (t + 1)*0.5;
if (s < sky_min)
s = sky_min;
else if (s > sky_max)
s = sky_max;
if (t < sky_min)
t = sky_min;
else if (t > sky_max)
t = sky_max;
t = 1.0 - t;
vertexData[0] = v[0];
vertexData[1] = v[1];
vertexData[2] = v[2];
vertexData[3] = s;
vertexData[4] = t;
}
/*
==============
R_DrawSkyBox
==============
*/
static int skytexorder[6] = {0,2,1,3,4,5};
void R_DrawSkyBox (void)
{
int i;
if (skyrotate)
{ // check for no sky at all
for (i = 0; i<6; i++)
if (skymins[0][i] < skymaxs[0][i]
&& skymins[1][i] < skymaxs[1][i])
break;
if (i == 6)
return; // nothing visible
}
float model[16];
Mat_Identity(model);
Mat_Rotate(model, (skyautorotate ? r_newrefdef.time : 1.f) * skyrotate,
skyaxis[0], skyaxis[1], skyaxis[2]);
Mat_Translate(model, r_origin[0], r_origin[1], r_origin[2]);
struct {
float data[5];
} skyVerts[4];
QVk_BindPipeline(&vk_drawSkyboxPipeline);
uint32_t uboOffset;
VkDescriptorSet uboDescriptorSet;
uint8_t *uboData = QVk_GetUniformBuffer(sizeof(model), &uboOffset, &uboDescriptorSet);
memcpy(uboData, model, sizeof(model));
for (i = 0; i<6; i++)
{
if (skyrotate)
{ // hack, forces full sky to draw when rotating
skymins[0][i] = -1;
skymins[1][i] = -1;
skymaxs[0][i] = 1;
skymaxs[1][i] = 1;
}
if (skymins[0][i] >= skymaxs[0][i]
|| skymins[1][i] >= skymaxs[1][i])
continue;
MakeSkyVec(skymins[0][i], skymins[1][i], i, skyVerts[0].data);
MakeSkyVec(skymins[0][i], skymaxs[1][i], i, skyVerts[1].data);
MakeSkyVec(skymaxs[0][i], skymaxs[1][i], i, skyVerts[2].data);
MakeSkyVec(skymaxs[0][i], skymins[1][i], i, skyVerts[3].data);
float verts[] = {
skyVerts[0].data[0], skyVerts[0].data[1], skyVerts[0].data[2], skyVerts[0].data[3], skyVerts[0].data[4],
skyVerts[1].data[0], skyVerts[1].data[1], skyVerts[1].data[2], skyVerts[1].data[3], skyVerts[1].data[4],
skyVerts[2].data[0], skyVerts[2].data[1], skyVerts[2].data[2], skyVerts[2].data[3], skyVerts[2].data[4],
skyVerts[0].data[0], skyVerts[0].data[1], skyVerts[0].data[2], skyVerts[0].data[3], skyVerts[0].data[4],
skyVerts[2].data[0], skyVerts[2].data[1], skyVerts[2].data[2], skyVerts[2].data[3], skyVerts[2].data[4],
skyVerts[3].data[0], skyVerts[3].data[1], skyVerts[3].data[2], skyVerts[3].data[3], skyVerts[3].data[4]
};
VkBuffer vbo;
VkDeviceSize vboOffset;
uint8_t *vertData = QVk_GetVertexBuffer(sizeof(verts), &vbo, &vboOffset);
memcpy(vertData, verts, sizeof(verts));
VkDescriptorSet descriptorSets[] = { sky_images[skytexorder[i]]->vk_texture.descriptorSet, uboDescriptorSet };
float gamma = 2.1F - vid_gamma->value;
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
vk_drawSkyboxPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
vkCmdDraw(vk_activeCmdbuffer, 6, 1, 0, 0);
}
}
/*
============
RE_SetSky
============
*/
// 3dstudio environment map names
static char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
void RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis)
{
char skyname[MAX_QPATH];
int i;
strncpy(skyname, name, sizeof(skyname) - 1);
skyrotate = rotate;
skyautorotate = autorotate;
VectorCopy(axis, skyaxis);
for (i = 0; i<6; i++)
{
image_t *image;
image = (image_t *)GetSkyImage(skyname, suf[i],
r_palettedtexture->value, (findimage_t)Vk_FindImage);
if (!image)
{
R_Printf(PRINT_ALL, "%s: can't load %s:%s sky\n",
__func__, skyname, suf[i]);
image = r_notexture;
}
sky_images[i] = image;
}
sky_min = 1.0 / 512;
sky_max = 511.0 / 512;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -750,6 +750,8 @@ YQ2_ATTR_NORETURN void Com_Quit(void);
/* Ugly work around for unsupported /* Ugly work around for unsupported
* format specifiers unter mingw. */ * format specifiers unter mingw. */
#define YQ2_COM_PRIu64 PRIu64
#ifdef WIN32 #ifdef WIN32
#define YQ2_COM_PRId64 "%I64d" #define YQ2_COM_PRId64 "%I64d"
#define YQ2_COM_PRIdS "%Id" #define YQ2_COM_PRIdS "%Id"

24
stuff/shaders/basic.frag Normal file
View file

@ -0,0 +1,24 @@
#version 450
layout(push_constant) uniform PushConstant
{
// vertex shader has 'mat4 vpMatrix;' at begin.
layout(offset = 68) float gamma;
} pc;
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in vec2 texCoord;
layout(location = 1) in vec4 color;
layout(location = 2) in float aTreshold;
layout(location = 0) out vec4 fragmentColor;
void main()
{
fragmentColor = texture(sTexture, texCoord) * color;
if(fragmentColor.a < aTreshold)
discard;
fragmentColor = vec4(pow(fragmentColor.rgb, vec3(pc.gamma)), fragmentColor.a);
}

30
stuff/shaders/basic.vert Normal file
View file

@ -0,0 +1,30 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// normalized offset and scale
layout(set = 1, binding = 0) uniform imageTransform
{
vec2 offset;
vec2 scale;
vec2 uvOffset;
vec2 uvScale;
} it;
layout(location = 0) in vec2 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
vec2 vPos = inVertex.xy * it.scale - (vec2(1.0) - it.scale);
gl_Position = vec4(vPos + it.offset * 2.0, 0.0, 1.0);
texCoord = inTexCoord.xy * it.uvScale + it.uvOffset;
color = vec4(1.0, 1.0, 1.0, 1.0);
aTreshold = 0.666;
}

View file

@ -0,0 +1,10 @@
#version 450
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 fragmentColor;
void main()
{
fragmentColor = color;
}

View file

@ -0,0 +1,24 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// normalized offset and scale
layout(set = 0, binding = 0) uniform imageTransform
{
vec2 offset;
vec2 scale;
vec4 color;
} it;
layout(location = 0) in vec2 inVertex;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
vec2 vPos = inVertex.xy * it.scale - (vec2(1.0) - it.scale);
gl_Position = vec4(vPos + it.offset * 2.0, 0.0, 1.0);
color = it.color;
}

25
stuff/shaders/beam.vert Normal file
View file

@ -0,0 +1,25 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
vec4 color;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
color = ubo.color;
}

View file

@ -0,0 +1,21 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec3 inColor;
layout(binding = 0) uniform UniformBufferObject
{
mat4 mvpMatrix;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = ubo.mvpMatrix * vec4(inVertex, 1.0);
color = vec4(inColor, 1.0);
}

17
stuff/shaders/model.frag Normal file
View file

@ -0,0 +1,17 @@
#version 450
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in vec4 color;
layout(location = 1) in vec2 texCoord;
layout(location = 2) in flat int textured;
layout(location = 0) out vec4 fragmentColor;
void main()
{
if(textured != 0)
fragmentColor = texture(sTexture, texCoord) * clamp(color, 0.0, 1.0);
else
fragmentColor = color;
}

32
stuff/shaders/model.vert Normal file
View file

@ -0,0 +1,32 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec4 inColor;
layout(location = 2) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
int textured;
} ubo;
layout(location = 0) out vec4 color;
layout(location = 1) out vec2 texCoord;
layout(location = 2) out int textured;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
color = inColor;
texCoord = inTexCoord;
textured = ubo.textured;
}

View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec3 inColor;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
mat4 model;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
color = vec4(inColor, 1.0);
}

View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec4 inColor;
layout(location = 2) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = inColor;
aTreshold = 0.5;
}

View file

@ -0,0 +1,14 @@
#version 450
layout(location = 0) in vec4 color;
layout(location = 0) out vec4 fragmentColor;
void main()
{
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
if(dot(cxy, cxy) > 1.0)
discard;
fragmentColor = color;
}

View file

@ -0,0 +1,37 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec4 inColor;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
float pointSize;
float pointScale;
float minPointSize;
float maxPointSize;
float att_a;
float att_b;
float att_c;
} ubo;
layout(location = 0) out vec4 color;
out gl_PerVertex {
vec4 gl_Position;
float gl_PointSize;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
float dist_atten = ubo.pointScale / (ubo.att_a + ubo.att_b * gl_Position.w + ubo.att_c * gl_Position.w * gl_Position.w);
gl_PointSize = clamp(ubo.pointScale * ubo.pointSize * sqrt(dist_atten), ubo.minPointSize, ubo.maxPointSize);
color = inColor;
}

View file

@ -0,0 +1,30 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
vec4 color;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = ubo.color;
aTreshold = 0.0;
}

View file

@ -0,0 +1,17 @@
#version 450
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(set = 2, binding = 0) uniform sampler2D sLightmap;
layout(location = 0) in vec2 texCoord;
layout(location = 1) in vec2 texCoordLmap;
layout(location = 2) in float viewLightmaps;
layout(location = 0) out vec4 fragmentColor;
void main()
{
vec4 color = texture(sTexture, texCoord);
vec4 light = texture(sLightmap, texCoordLmap);
fragmentColor = (1.0 - viewLightmaps) * color * light + viewLightmaps * light;
}

View file

@ -0,0 +1,32 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(location = 2) in vec2 inTexCoordLmap;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
float viewLightmaps;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec2 texCoordLmap;
layout(location = 2) out float viewLightmaps;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
texCoord = inTexCoord;
texCoordLmap = inTexCoordLmap;
viewLightmaps = ubo.viewLightmaps;
}

View file

@ -0,0 +1,34 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
vec4 color;
float time;
float scroll;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
texCoord = inTexCoord + vec2(sin(2.0 * ubo.time + inTexCoord.y * 3.28), sin(2.0 * ubo.time + inTexCoord.x * 3.28)) * 0.05;
texCoord.x += ubo.scroll;
color = ubo.color;
aTreshold = 0.0;
}

View file

@ -0,0 +1,33 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(push_constant) uniform PushConstant
{
layout(offset = 68) float postprocess;
layout(offset = 72) float gamma;
layout(offset = 76) float scrWidth;
layout(offset = 80) float scrHeight;
layout(offset = 84) float offsetX;
layout(offset = 88) float offsetY;
} pc;
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in vec2 texCoord;
layout(location = 0) out vec4 fragmentColor;
void main()
{
vec2 unnormTexCoord = texCoord * vec2(pc.scrWidth, pc.scrHeight) + vec2(pc.offsetX, pc.offsetY);
// apply any additional world-only postprocessing effects here (if enabled)
if (pc.postprocess > 0.0)
{
//gamma + color intensity bump
fragmentColor = vec4(pow(textureLod(sTexture, unnormTexCoord, 0.0).rgb * 1.5, vec3(pc.gamma)), 1.0);
}
else
{
fragmentColor = textureLod(sTexture, unnormTexCoord, 0.0);
}
}

View file

@ -0,0 +1,17 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// rendering a fullscreen quad (which is actually just a huge triangle)
// source: https://www.saschawillems.de/blog/2016/08/13/vulkan-tutorial-on-rendering-a-fullscreen-quad-without-buffers/
out gl_PerVertex {
vec4 gl_Position;
};
layout(location = 0) out vec2 texCoord;
void main()
{
texCoord = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
gl_Position = vec4(texCoord * 2.0f + -1.0f, 0.0f, 1.0f);
}

23
stuff/shaders/shaders.bat Normal file
View file

@ -0,0 +1,23 @@
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_vert_spv -V basic.vert -o ../src/vk/spirv/basic_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_frag_spv -V basic.frag -o ../src/vk/spirv/basic_frag.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_color_quad_vert_spv -V basic_color_quad.vert -o ../src/vk/spirv/basic_color_quad_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_color_quad_frag_spv -V basic_color_quad.frag -o ../src/vk/spirv/basic_color_quad_frag.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name model_vert_spv -V model.vert -o ../src/vk/spirv/model_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name model_frag_spv -V model.frag -o ../src/vk/spirv/model_frag.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name nullmodel_vert_spv -V nullmodel.vert -o ../src/vk/spirv/nullmodel_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name particle_vert_spv -V particle.vert -o ../src/vk/spirv/particle_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name point_particle_vert_spv -V point_particle.vert -o ../src/vk/spirv/point_particle_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name point_particle_frag_spv -V point_particle.frag -o ../src/vk/spirv/point_particle_frag.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name sprite_vert_spv -V sprite.vert -o ../src/vk/spirv/sprite_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name beam_vert_spv -V beam.vert -o ../src/vk/spirv/beam_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name skybox_vert_spv -V skybox.vert -o ../src/vk/spirv/skybox_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name d_light_vert_spv -V d_light.vert -o ../src/vk/spirv/d_light_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_vert_spv -V polygon.vert -o ../src/vk/spirv/polygon_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_lmap_vert_spv -V polygon_lmap.vert -o ../src/vk/spirv/polygon_lmap_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_lmap_frag_spv -V polygon_lmap.frag -o ../src/vk/spirv/polygon_lmap_frag.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_warp_vert_spv -V polygon_warp.vert -o ../src/vk/spirv/polygon_warp_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name shadows_vert_spv -V shadows.vert -o ../src/vk/spirv/shadows_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name postprocess_vert_spv -V postprocess.vert -o ../src/vk/spirv/postprocess_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name postprocess_frag_spv -V postprocess.frag -o ../src/vk/spirv/postprocess_frag.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name world_warp_vert_spv -V world_warp.vert -o ../src/vk/spirv/world_warp_vert.c
%VULKAN_SDK%\bin\glslangValidator.exe --variable-name world_warp_frag_spv -V world_warp.frag -o ../src/vk/spirv/world_warp_frag.c

25
stuff/shaders/shaders.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
glslangValidator --variable-name basic_vert_spv -V basic.vert -o ../../src/client/refresh/vk/spirv/basic_vert.c
glslangValidator --variable-name basic_frag_spv -V basic.frag -o ../../src/client/refresh/vk/spirv/basic_frag.c
glslangValidator --variable-name basic_color_quad_vert_spv -V basic_color_quad.vert -o ../../src/client/refresh/vk/spirv/basic_color_quad_vert.c
glslangValidator --variable-name basic_color_quad_frag_spv -V basic_color_quad.frag -o ../../src/client/refresh/vk/spirv/basic_color_quad_frag.c
glslangValidator --variable-name model_vert_spv -V model.vert -o ../../src/client/refresh/vk/spirv/model_vert.c
glslangValidator --variable-name model_frag_spv -V model.frag -o ../../src/client/refresh/vk/spirv/model_frag.c
glslangValidator --variable-name nullmodel_vert_spv -V nullmodel.vert -o ../../src/client/refresh/vk/spirv/nullmodel_vert.c
glslangValidator --variable-name particle_vert_spv -V particle.vert -o ../../src/client/refresh/vk/spirv/particle_vert.c
glslangValidator --variable-name point_particle_vert_spv -V point_particle.vert -o ../../src/client/refresh/vk/spirv/point_particle_vert.c
glslangValidator --variable-name point_particle_frag_spv -V point_particle.frag -o ../../src/client/refresh/vk/spirv/point_particle_frag.c
glslangValidator --variable-name sprite_vert_spv -V sprite.vert -o ../../src/client/refresh/vk/spirv/sprite_vert.c
glslangValidator --variable-name beam_vert_spv -V beam.vert -o ../../src/client/refresh/vk/spirv/beam_vert.c
glslangValidator --variable-name skybox_vert_spv -V skybox.vert -o ../../src/client/refresh/vk/spirv/skybox_vert.c
glslangValidator --variable-name d_light_vert_spv -V d_light.vert -o ../../src/client/refresh/vk/spirv/d_light_vert.c
glslangValidator --variable-name polygon_vert_spv -V polygon.vert -o ../../src/client/refresh/vk/spirv/polygon_vert.c
glslangValidator --variable-name polygon_lmap_vert_spv -V polygon_lmap.vert -o ../../src/client/refresh/vk/spirv/polygon_lmap_vert.c
glslangValidator --variable-name polygon_lmap_frag_spv -V polygon_lmap.frag -o ../../src/client/refresh/vk/spirv/polygon_lmap_frag.c
glslangValidator --variable-name polygon_warp_vert_spv -V polygon_warp.vert -o ../../src/client/refresh/vk/spirv/polygon_warp_vert.c
glslangValidator --variable-name shadows_vert_spv -V shadows.vert -o ../../src/client/refresh/vk/spirv/shadows_vert.c
glslangValidator --variable-name postprocess_vert_spv -V postprocess.vert -o ../../src/client/refresh/vk/spirv/postprocess_vert.c
glslangValidator --variable-name postprocess_frag_spv -V postprocess.frag -o ../../src/client/refresh/vk/spirv/postprocess_frag.c
glslangValidator --variable-name world_warp_vert_spv -V world_warp.vert -o ../../src/client/refresh/vk/spirv/world_warp_vert.c
glslangValidator --variable-name world_warp_frag_spv -V world_warp.frag -o ../../src/client/refresh/vk/spirv/world_warp_frag.c

View file

@ -0,0 +1,24 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 0) out vec4 color;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(binding = 0) uniform UniformBufferObject
{
mat4 model;
} ubo;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
color = vec4(0.0, 0.0, 0.0, 0.5);
}

30
stuff/shaders/skybox.vert Normal file
View file

@ -0,0 +1,30 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 vpMatrix;
} pc;
layout(set = 1, binding = 0) uniform UniformBufferObject
{
mat4 model;
} ubo;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = vec4(1.0, 1.0, 1.0, 1.0);
aTreshold = 0.0;
}

26
stuff/shaders/sprite.vert Normal file
View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 inVertex;
layout(location = 1) in vec2 inTexCoord;
layout(push_constant) uniform PushConstant
{
mat4 mvpMatrix;
float alpha;
} pc;
layout(location = 0) out vec2 texCoord;
layout(location = 1) out vec4 color;
layout(location = 2) out float aTreshold;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0);
texCoord = inTexCoord;
color = vec4(1.0, 1.0, 1.0, pc.alpha);
aTreshold = 0.0666;
}

View file

@ -0,0 +1,55 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
// Underwater screen warp effect similar to what software renderer provides.
// Pixel size to simulate lower screen resolutions is used to restore world to full screen size.
layout(push_constant) uniform PushConstant
{
layout(offset = 68) float time;
layout(offset = 72) float scale;
layout(offset = 76) float scrWidth;
layout(offset = 80) float scrHeight;
layout(offset = 84) float offsetX;
layout(offset = 88) float offsetY;
layout(offset = 92) float pixelSize;
layout(offset = 96) float refdefX;
layout(offset = 100) float refdefY;
layout(offset = 104) float refdefWidth;
layout(offset = 108) float refdefHeight;
} pc;
layout(set = 0, binding = 0) uniform sampler2D sTexture;
layout(location = 0) out vec4 fragmentColor;
#define PI 3.1415
void main()
{
vec2 scrSize = vec2(pc.scrWidth, pc.scrHeight);
vec2 fragCoord = (gl_FragCoord.xy - vec2(pc.offsetX, pc.offsetY));
vec2 uv = fragCoord / scrSize;
float xMin = pc.refdefX;
float xMax = pc.refdefX + pc.refdefWidth;
float yMin = pc.refdefY;
float yMax = pc.refdefY + pc.refdefHeight;
if (pc.time > 0 && fragCoord.x > xMin && fragCoord.x < xMax && fragCoord.y > yMin && fragCoord.y < yMax)
{
float sx = pc.scale - abs(pc.scrWidth / 2.0 - fragCoord.x) * 2.0 / pc.scrWidth;
float sy = pc.scale - abs(pc.scrHeight / 2.0 - fragCoord.y) * 2.0 / pc.scrHeight;
float xShift = 2.0 * pc.time + uv.y * PI * 10;
float yShift = 2.0 * pc.time + uv.x * PI * 10;
vec2 distortion = vec2(sin(xShift) * sx, sin(yShift) * sy) * 0.00666;
uv += distortion;
}
uv /= pc.pixelSize;
uv = clamp(uv * scrSize, vec2(0.0, 0.0), scrSize - vec2(0.5, 0.5));
fragmentColor = textureLod(sTexture, uv, 0.0);
}

View file

@ -0,0 +1,17 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
out gl_PerVertex {
vec4 gl_Position;
};
void main()
{
vec4 positions[3] = {
vec4(-1.0f, -1.0f, 0.0f, 1.0f),
vec4(3.0f, -1.0f, 0.0f, 1.0f),
vec4(-1.0f, 3.0f, 0.0f, 1.0f)
};
gl_Position = positions[gl_VertexIndex % 3];
}