changed asset packer, changed vulkan config, misc fixes
This commit is contained in:
parent
7ae8c5bdf9
commit
0c73af4374
27
src/assets.h
27
src/assets.h
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
// ::Assets::Types::Header::
|
// ::Assets::Types::Header::
|
||||||
|
|
||||||
typedef enum AssetType_e
|
typedef enum AssetType_e : u32
|
||||||
{
|
{
|
||||||
SHADER_ASSET,
|
SHADER_ASSET,
|
||||||
TEXTURE_ASSET,
|
TEXTURE_ASSET,
|
||||||
@ -17,7 +17,7 @@ typedef enum AssetType_e
|
|||||||
ASSET_TYPE_MAX,
|
ASSET_TYPE_MAX,
|
||||||
} AssetType;
|
} AssetType;
|
||||||
|
|
||||||
typedef enum ShaderAsset_e
|
typedef enum ShaderAsset_e : u32
|
||||||
{
|
{
|
||||||
QUAD_FRAG_SPIRV_SHADER,
|
QUAD_FRAG_SPIRV_SHADER,
|
||||||
QUAD_VERT_SPIRV_SHADER,
|
QUAD_VERT_SPIRV_SHADER,
|
||||||
@ -27,7 +27,7 @@ typedef enum ShaderAsset_e
|
|||||||
SHADER_ASSET_MAX,
|
SHADER_ASSET_MAX,
|
||||||
} ShaderAsset;
|
} ShaderAsset;
|
||||||
|
|
||||||
typedef enum TextureAsset_e
|
typedef enum TextureAsset_e : u32
|
||||||
{
|
{
|
||||||
PATTERMON_OBESE,
|
PATTERMON_OBESE,
|
||||||
PATTERMON_PURPLOID,
|
PATTERMON_PURPLOID,
|
||||||
@ -36,27 +36,27 @@ typedef enum TextureAsset_e
|
|||||||
TEXTURE_ASSET_MAX
|
TEXTURE_ASSET_MAX
|
||||||
} TextureAsset;
|
} TextureAsset;
|
||||||
|
|
||||||
typedef enum TextureAssetTag_e
|
typedef enum TextureAssetTag_e : u32
|
||||||
{
|
{
|
||||||
TEXTURE_ASSET_TAG_MAX,
|
TEXTURE_ASSET_TAG_MAX,
|
||||||
} TextureAssetTag;
|
} TextureAssetTag;
|
||||||
|
|
||||||
typedef enum SoundAsset_e
|
typedef enum SoundAsset_e : u32
|
||||||
{
|
{
|
||||||
SOUND_ASSET_MAX,
|
SOUND_ASSET_MAX,
|
||||||
} SoundAsset;
|
} SoundAsset;
|
||||||
|
|
||||||
typedef enum SoundAssetTag_e
|
typedef enum SoundAssetTag_e : u32
|
||||||
{
|
{
|
||||||
SOUND_ASSET_TAG_MAX,
|
SOUND_ASSET_TAG_MAX,
|
||||||
} SoundAssetTag;
|
} SoundAssetTag;
|
||||||
|
|
||||||
typedef enum ModelAsset_e
|
typedef enum ModelAsset_e : u32
|
||||||
{
|
{
|
||||||
MODEL_ASSET_MAX,
|
MODEL_ASSET_MAX,
|
||||||
} ModelAsset;
|
} ModelAsset;
|
||||||
|
|
||||||
typedef enum ModelAssetTag_e
|
typedef enum ModelAssetTag_e : u32
|
||||||
{
|
{
|
||||||
MODEL_ASSET_TAG_MAX,
|
MODEL_ASSET_TAG_MAX,
|
||||||
} ModelAssetTag;
|
} ModelAssetTag;
|
||||||
@ -68,6 +68,12 @@ typedef struct TextureAssetMeta
|
|||||||
u32 ch;
|
u32 ch;
|
||||||
} TextureAssetMeta;
|
} TextureAssetMeta;
|
||||||
|
|
||||||
|
typedef struct ModelAssetMeta
|
||||||
|
{
|
||||||
|
u32 vert_count;
|
||||||
|
u32 idx_count;
|
||||||
|
} ModelAssetMeta;
|
||||||
|
|
||||||
typedef struct Asset
|
typedef struct Asset
|
||||||
{
|
{
|
||||||
u8 *bytes;
|
u8 *bytes;
|
||||||
@ -88,6 +94,11 @@ typedef struct AssetFile
|
|||||||
{
|
{
|
||||||
u64 data_offset;
|
u64 data_offset;
|
||||||
u64 len;
|
u64 len;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
TextureAssetMeta texture_meta;
|
||||||
|
ModelAssetMeta model_meta;
|
||||||
|
};
|
||||||
} AssetFile;
|
} AssetFile;
|
||||||
|
|
||||||
typedef struct FileHeader
|
typedef struct FileHeader
|
||||||
|
|||||||
6
src/ds.c
6
src/ds.c
@ -508,6 +508,12 @@ static HashNode *HashTablePushU64Rawptr(HashTable *table, u64 key, rawptr value)
|
|||||||
return HashTablePush(table, hash, (KeyValuePair){ .key_u64 = key, .value_rawptr = value });
|
return HashTablePush(table, hash, (KeyValuePair){ .key_u64 = key, .value_rawptr = value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HashNode *HashTablePushU64U64Split(HashTable *table, u64 key, u32 upper, u32 lower)
|
||||||
|
{
|
||||||
|
u64 hash = HashFromString(String8Struct(&key));
|
||||||
|
return HashTablePush(table, hash, (KeyValuePair){ .key_u64 = key, .value_u64_upper = upper, .value_u64_lower = lower });
|
||||||
|
}
|
||||||
|
|
||||||
static HashNode *HashTablePushRawptrU64(HashTable *table, rawptr key, u64 value)
|
static HashNode *HashTablePushRawptrU64(HashTable *table, rawptr key, u64 value)
|
||||||
{
|
{
|
||||||
u64 hash = HashFromString(String8Struct(&key));
|
u64 hash = HashFromString(String8Struct(&key));
|
||||||
|
|||||||
18
src/ds.h
18
src/ds.h
@ -77,15 +77,20 @@ typedef struct KeyValuePair
|
|||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
u64 key_u64;
|
u64 key_u64;
|
||||||
rawptr key_rawptr;
|
rawptr key_rawptr;
|
||||||
};
|
};
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
String8 value_string;
|
String8 value_string;
|
||||||
rawptr value_rawptr;
|
rawptr value_rawptr;
|
||||||
u32 value_u32;
|
u32 value_u32;
|
||||||
u64 value_u64;
|
u64 value_u64;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
u32 value_u64_upper;
|
||||||
|
u32 value_u64_lower;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} KeyValuePair;
|
} KeyValuePair;
|
||||||
|
|
||||||
@ -121,5 +126,6 @@ static HashNode *HashTablePushU64U32(HashTable *table, u64 key, u32 value);
|
|||||||
static HashNode *HashTablePushU64U64(HashTable *table, u64 key, u64 value);
|
static HashNode *HashTablePushU64U64(HashTable *table, u64 key, u64 value);
|
||||||
static HashNode *HashTablePushU64String8(HashTable *table, u64 key, String8 value);
|
static HashNode *HashTablePushU64String8(HashTable *table, u64 key, String8 value);
|
||||||
static HashNode *HashTablePushU64Rawptr(HashTable *table, u64 key, rawptr value);
|
static HashNode *HashTablePushU64Rawptr(HashTable *table, u64 key, rawptr value);
|
||||||
|
static HashNode *HashTablePushU64U64Split(HashTable *table, u64 key, u32 upper, u32 lower);
|
||||||
static void HashTableDeleteU64(HashTable *table, u64 key);
|
static void HashTableDeleteU64(HashTable *table, u64 key);
|
||||||
|
|
||||||
|
|||||||
54
src/packer.c
54
src/packer.c
@ -246,13 +246,23 @@ void PackFiles(Arena *arena, FileHeader *header)
|
|||||||
u8 *file_data = MakeArray(arena, u8, file_size);
|
u8 *file_data = MakeArray(arena, u8, file_size);
|
||||||
ReadData(file_data, 0, file_size, asset_file);
|
ReadData(file_data, 0, file_size, asset_file);
|
||||||
|
|
||||||
u64 prev_offset = data_offset;
|
int w, h, ch;
|
||||||
data_offset += WriteData(file_data, data_offset, file_size, file);
|
u8 *image_bytes = stbi_load_from_memory(file_data, file_size, &w, &h, &ch, 4);
|
||||||
|
|
||||||
Assert((data_offset - prev_offset) == file_size, "File write size invalid");
|
u64 loaded_length = u64(w * h * ch);
|
||||||
|
|
||||||
|
u64 prev_offset = data_offset;
|
||||||
|
data_offset += WriteData(image_bytes, data_offset, loaded_length, file);
|
||||||
|
|
||||||
|
Assert((data_offset - prev_offset) == loaded_length, "File write size invalid");
|
||||||
|
|
||||||
texture_assets[i].data_offset = prev_offset;
|
texture_assets[i].data_offset = prev_offset;
|
||||||
texture_assets[i].len = file_size;
|
texture_assets[i].len = loaded_length;
|
||||||
|
texture_assets[i].texture_meta.w = u32(w);
|
||||||
|
texture_assets[i].texture_meta.h = u32(h);
|
||||||
|
texture_assets[i].texture_meta.ch = u32(ch);
|
||||||
|
|
||||||
|
stbi_image_free(image_bytes);
|
||||||
|
|
||||||
CloseFile(asset_file);
|
CloseFile(asset_file);
|
||||||
}
|
}
|
||||||
@ -269,24 +279,44 @@ void PackFiles(Arena *arena, FileHeader *header)
|
|||||||
|
|
||||||
// ::Packer::Tests::Functions::Start::
|
// ::Packer::Tests::Functions::Start::
|
||||||
|
|
||||||
static inline void TestAssetIsCorrect(Arena *arena, c8 *file_name, AssetFile *file_info, FILE *file)
|
static inline void TestAssetIsCorrect(Arena *arena, c8 *file_name, AssetFile *file_info, AssetType type, FILE *file)
|
||||||
{
|
{
|
||||||
FILE *asset_file = OpenFile(file_name, "r");
|
FILE *asset_file = OpenFile(file_name, "r");
|
||||||
u64 size = FileLength(asset_file);
|
u64 size = FileLength(asset_file);
|
||||||
|
|
||||||
|
|
||||||
u8 *file_data = MakeArray(arena, u8, size);
|
u8 *file_data = MakeArray(arena, u8, size);
|
||||||
u64 write_count = ReadData(file_data, 0, size, asset_file);
|
u64 write_count = ReadData(file_data, 0, size, asset_file);
|
||||||
Assert(write_count == size, "Incorrect asset size retrieved");
|
Assert(write_count == size, "Incorrect asset size retrieved");
|
||||||
|
|
||||||
Assert(file_info->len == size, "file length incorrect");
|
|
||||||
|
|
||||||
u8 *packed_asset = MakeArray(arena, u8, file_info->len);
|
u8 *packed_asset = MakeArray(arena, u8, file_info->len);
|
||||||
|
|
||||||
ReadData(packed_asset, file_info->data_offset, file_info->len, file);
|
ReadData(packed_asset, file_info->data_offset, file_info->len, file);
|
||||||
|
|
||||||
for (u64 i = 0; i < size; i++)
|
u8 *image_bytes;
|
||||||
|
u64 image_length;
|
||||||
|
if (type == TEXTURE_ASSET)
|
||||||
{
|
{
|
||||||
Assert(file_data[i] == packed_asset[i], "Asset file data is invalid");
|
int w, h, ch;
|
||||||
|
image_bytes = stbi_load_from_memory(file_data, size, &w, &h, &ch, 4);
|
||||||
|
image_length = u64(w * h * ch);
|
||||||
|
|
||||||
|
Assert(file_info->len == image_length, "file length incorrect");
|
||||||
|
|
||||||
|
for (u64 i = 0; i < image_length; i++)
|
||||||
|
{
|
||||||
|
Assert(image_bytes[i] == packed_asset[i], "Asset file data is invalid");
|
||||||
|
}
|
||||||
|
|
||||||
|
stbi_image_free(image_bytes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert(file_info->len == size, "file length incorrect");
|
||||||
|
|
||||||
|
for (u64 i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
Assert(file_data[i] == packed_asset[i], "Asset file data is invalid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseFile(asset_file);
|
CloseFile(asset_file);
|
||||||
@ -337,7 +367,7 @@ void TestAssetPack(Arena *arena)
|
|||||||
|
|
||||||
for (u32 i = 0; i < SHADER_ASSET_MAX; i++)
|
for (u32 i = 0; i < SHADER_ASSET_MAX; i++)
|
||||||
{
|
{
|
||||||
TestAssetIsCorrect(arena, g_Shader_File_Names[i], &files[SHADER_ASSET][i], file);
|
TestAssetIsCorrect(arena, g_Shader_File_Names[i], &files[SHADER_ASSET][i], SHADER_ASSET, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
pDirNavigate(return_dir);
|
pDirNavigate(return_dir);
|
||||||
@ -345,7 +375,7 @@ void TestAssetPack(Arena *arena)
|
|||||||
|
|
||||||
for (u32 i = 0; i < TEXTURE_ASSET_MAX; i++)
|
for (u32 i = 0; i < TEXTURE_ASSET_MAX; i++)
|
||||||
{
|
{
|
||||||
TestAssetIsCorrect(arena, g_Texture_File_Names[i], &files[TEXTURE_ASSET][i], file);
|
TestAssetIsCorrect(arena, g_Texture_File_Names[i], &files[TEXTURE_ASSET][i], TEXTURE_ASSET, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ void MoveToShaderDir(c8 **return_dir);
|
|||||||
// ::Packer::Tests::Functions::Header::
|
// ::Packer::Tests::Functions::Header::
|
||||||
|
|
||||||
void TestAssetPack(Arena *arena);
|
void TestAssetPack(Arena *arena);
|
||||||
static inline void TestAssetIsCorrect(Arena *arena, c8 *file_name, AssetFile *file_info, FILE *file);
|
static inline void TestAssetIsCorrect(Arena *arena, c8 *file_name, AssetFile *file_info, AssetType type, FILE *file);
|
||||||
|
|
||||||
// ::Packer::Main::Functions::Header::
|
// ::Packer::Main::Functions::Header::
|
||||||
|
|
||||||
|
|||||||
@ -132,12 +132,12 @@ static inline u64 pCPUTimerRead();
|
|||||||
|
|
||||||
// ::Platform::Atomics::Header::
|
// ::Platform::Atomics::Header::
|
||||||
|
|
||||||
#define DefSigAtomicFetchIncr(T) static inline T p##T##AtomicFetchIncr(T *ptr)
|
#define DefSigAtomicFetchIncr(T) static inline T p##T##AtomicFetchIncr(T volatile *ptr)
|
||||||
#define DefSigAtomicFetchSub(T) static inline T p##T##AtomicFetchSub(T *ptr, T count)
|
#define DefSigAtomicFetchSub(T) static inline T p##T##AtomicFetchSub(T volatile *ptr, T count)
|
||||||
#define DefSigAtomicIncr(T) static inline void p##T##AtomicIncr(T *ptr)
|
#define DefSigAtomicIncr(T) static inline void p##T##AtomicIncr(T volatile *ptr)
|
||||||
#define DefSigAtomicStore(T) static inline void p##T##AtomicStore(T *ptr, T value)
|
#define DefSigAtomicStore(T) static inline void p##T##AtomicStore(T volatile *ptr, T value)
|
||||||
#define DefSigAtomicLoad(T) static inline T p##T##AtomicLoad(T *ptr)
|
#define DefSigAtomicLoad(T) static inline T p##T##AtomicLoad(T volatile *ptr)
|
||||||
#define DefSigAtomicCompareExchange(T) static inline b32 p##T##AtomicCompareExchange(T *ptr, T *expected, T desired)
|
#define DefSigAtomicCompareExchange(T) static inline b32 p##T##AtomicCompareExchange(T volatile *ptr, T *expected, T desired)
|
||||||
|
|
||||||
DefScalarSig(AtomicFetchIncr);
|
DefScalarSig(AtomicFetchIncr);
|
||||||
DefScalarSig(AtomicFetchSub);
|
DefScalarSig(AtomicFetchSub);
|
||||||
|
|||||||
@ -90,37 +90,37 @@ b32 pSyscallErrCheck(void *ptr);
|
|||||||
// ::Platform::Linux::Atomics::Header::
|
// ::Platform::Linux::Atomics::Header::
|
||||||
|
|
||||||
#define DefAtomicFetchIncr(T) \
|
#define DefAtomicFetchIncr(T) \
|
||||||
static inline T p##T##AtomicFetchIncr(T *ptr) \
|
static inline T p##T##AtomicFetchIncr(T volatile *ptr) \
|
||||||
{ \
|
{ \
|
||||||
return __atomic_fetch_add(ptr, (T)1, __ATOMIC_ACQUIRE); \
|
return __atomic_fetch_add(ptr, (T)1, __ATOMIC_ACQUIRE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DefAtomicIncr(T) \
|
#define DefAtomicIncr(T) \
|
||||||
static inline void p##T##AtomicIncr(T *ptr) \
|
static inline void p##T##AtomicIncr(T volatile *ptr) \
|
||||||
{ \
|
{ \
|
||||||
__atomic_fetch_add(ptr, (T)1, __ATOMIC_RELEASE); \
|
__atomic_fetch_add(ptr, (T)1, __ATOMIC_RELEASE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DefAtomicStore(T) \
|
#define DefAtomicStore(T) \
|
||||||
static inline void p##T##AtomicStore(T *ptr, T value) \
|
static inline void p##T##AtomicStore(T volatile *ptr, T value) \
|
||||||
{ \
|
{ \
|
||||||
__atomic_store_n(ptr, value, __ATOMIC_RELEASE); \
|
__atomic_store_n(ptr, value, __ATOMIC_RELEASE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DefAtomicLoad(T) \
|
#define DefAtomicLoad(T) \
|
||||||
static inline T p##T##AtomicLoad(T *ptr) \
|
static inline T p##T##AtomicLoad(T volatile *ptr) \
|
||||||
{ \
|
{ \
|
||||||
return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); \
|
return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DefAtomicFetchSub(T) \
|
#define DefAtomicFetchSub(T) \
|
||||||
static inline T p##T##AtomicFetchSub(T *ptr, T count) \
|
static inline T p##T##AtomicFetchSub(T volatile *ptr, T count) \
|
||||||
{ \
|
{ \
|
||||||
return __atomic_fetch_sub(ptr, count, __ATOMIC_ACQUIRE); \
|
return __atomic_fetch_sub(ptr, count, __ATOMIC_ACQUIRE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DefAtomicCompareExchange(T) \
|
#define DefAtomicCompareExchange(T) \
|
||||||
static inline b32 p##T##AtomicCompareExchange(T *ptr, T *expected, T desired) \
|
static inline b32 p##T##AtomicCompareExchange(T volatile *ptr, T *expected, T desired) \
|
||||||
{ \
|
{ \
|
||||||
return __atomic_compare_exchange_n(ptr, expected, desired, true, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); \
|
return __atomic_compare_exchange_n(ptr, expected, desired, true, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); \
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// ::Renderer::Declarations::Header::
|
// ::Renderer::Declarations::Header::
|
||||||
|
|
||||||
typedef u32 rDescHandle;
|
typedef struct rDescHandle rDescHandle;
|
||||||
|
|
||||||
// @requirement rRenderBufferType type
|
// @requirement rRenderBufferType type
|
||||||
// @requirement u32 size
|
// @requirement u32 size
|
||||||
@ -107,7 +107,7 @@ static rBuffer rBufferCreate(rRenderBufferType type, u64 size);
|
|||||||
static b32 rBufferMap();
|
static b32 rBufferMap();
|
||||||
static void rBufferFree(rRenderBuffer *buffers, u32 buffer_count);
|
static void rBufferFree(rRenderBuffer *buffers, u32 buffer_count);
|
||||||
static b32 rBufferUpload(rRenderBuffer **buffer, rawptr *ptr, u32 count, u32 thr_ix);
|
static b32 rBufferUpload(rRenderBuffer **buffer, rawptr *ptr, u32 count, u32 thr_ix);
|
||||||
static void rBufferCreateAndUpload(rRenderBuffer *buffer, rawptr ptr);
|
static void rBufferCreateAndUpload(ModelAsset asset_id);
|
||||||
static rDescHandle rTextureCreateAndUpload(TextureAsset asset_id);
|
static rDescHandle rTextureCreateAndUpload(TextureAsset asset_id);
|
||||||
static void rBufferBindVertex(rRenderBuffer *buffer);
|
static void rBufferBindVertex(rRenderBuffer *buffer);
|
||||||
static void rBufferBindIndex(rRenderBuffer *buffer);
|
static void rBufferBindIndex(rRenderBuffer *buffer);
|
||||||
|
|||||||
@ -494,54 +494,51 @@ static void vImageUpload(rTextureBuffer *buffer, u8 *data, u32 thread_idx)
|
|||||||
|
|
||||||
// ::Vulkan::Descriptors::Functions::Start::
|
// ::Vulkan::Descriptors::Functions::Start::
|
||||||
|
|
||||||
static void vDescHandlePush(vDescType type, rDescHandle handle)
|
static void vDescIndexPush(vDescType type, u32 index)
|
||||||
{
|
{
|
||||||
vDescBindings *bindings = v_Renderer.desc_bindings + type;
|
vDescBindings *bindings = v_Renderer.desc_bindings + type;
|
||||||
|
|
||||||
Assert(bindings->free_count < DESC_MAX_BINDINGS-1, "vDescHandlePush failure: free_count equal to DESC_MAX_BINDINGS-1");
|
Assert(bindings->free_count < DESC_MAX_BINDINGS-1, "vDescIndexPush failure: free_count equal to DESC_MAX_BINDINGS-1");
|
||||||
|
|
||||||
bindings->free[bindings->free_count] = handle;
|
bindings->free[bindings->free_count] = index;
|
||||||
bindings->free_count += 1;
|
bindings->free_count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rDescHandle vDescHandlePop(vDescType type)
|
static u32 vDescIndexPop(vDescType type)
|
||||||
{
|
{
|
||||||
vDescBindings *bindings = v_Renderer.desc_bindings + type;
|
vDescBindings *bindings = v_Renderer.desc_bindings + type;
|
||||||
|
|
||||||
Assert(bindings->free_count > 0, "vDescHandlePop failure: free_count is 0");
|
Assert(bindings->free_count > 0, "vDescIndexPop failure: free_count is 0");
|
||||||
|
|
||||||
bindings->free_count -= 1;
|
bindings->free_count -= 1;
|
||||||
return bindings->free[bindings->free_count];
|
return bindings->free[bindings->free_count];
|
||||||
}
|
}
|
||||||
|
|
||||||
static vAssetInfo *vDescHandleSearch(vDescType type, u64 asset_id)
|
static rDescHandle vDescHandleSearch(vDescType type, u32 asset_id)
|
||||||
{
|
{
|
||||||
vAssetInfo *asset_info = NULL;
|
rDescHandle asset_info = {
|
||||||
|
.asset_id = UINT32_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
HashTable *table = &v_Renderer.desc_bindings[type].lookup_table;
|
HashTable *table = &v_Renderer.desc_bindings[type].lookup_table;
|
||||||
|
|
||||||
KeyValuePair *kv_pair = HashTableSearchU64(table, asset_id);
|
KeyValuePair *kv_pair = HashTableSearchU64(table, asset_id);
|
||||||
if (kv_pair != NULL)
|
if (kv_pair != NULL)
|
||||||
{
|
{
|
||||||
asset_info = (vAssetInfo *)kv_pair->value_rawptr;
|
asset_info.asset_id = kv_pair->value_u64_upper;
|
||||||
|
asset_info.desc_index = kv_pair->value_u64_lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
return asset_info;
|
return asset_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DescriptorTableInsert(vDescType type, u64 asset_id, rDescHandle handle)
|
static void DescriptorTableInsert(vDescType type, rDescHandle handle)
|
||||||
{
|
{
|
||||||
vAssetInfo *asset_info = FLMemAlloc(sizeof(vAssetInfo));
|
|
||||||
|
|
||||||
asset_info->handle = handle;
|
|
||||||
asset_info->type = type;
|
|
||||||
asset_info->asset_id = asset_id;
|
|
||||||
|
|
||||||
HashTable *table = &v_Renderer.desc_bindings[type].lookup_table;
|
HashTable *table = &v_Renderer.desc_bindings[type].lookup_table;
|
||||||
HashTablePushU64Rawptr(table, asset_id, asset_info);
|
HashTablePushU64U64Split(table, handle.asset_id, handle.asset_id, handle.desc_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vDescHandleDelete(vDescType type, u64 asset_id)
|
static void vDescHandleDelete(vDescType type, u32 asset_id)
|
||||||
{
|
{
|
||||||
HashTable *table = &v_Renderer.desc_bindings[type].lookup_table;
|
HashTable *table = &v_Renderer.desc_bindings[type].lookup_table;
|
||||||
HashTableDeleteU64(table, asset_id);
|
HashTableDeleteU64(table, asset_id);
|
||||||
@ -665,7 +662,7 @@ static void vEnableDebug()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vInitArenas()
|
static void vArenasInit()
|
||||||
{
|
{
|
||||||
v_Renderer.mem.perm_arena = ArenaCreateDebug(MB(16), __LINE__);
|
v_Renderer.mem.perm_arena = ArenaCreateDebug(MB(16), __LINE__);
|
||||||
|
|
||||||
@ -1417,21 +1414,68 @@ static b32 vDescriptorsInit()
|
|||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
success = false;
|
success = false;
|
||||||
|
|
||||||
for (u32 i = 0; i < vDT_MAX; i++)
|
if (success)
|
||||||
{
|
{
|
||||||
bindings[i].free = ArenaAlloc(v_Renderer.mem.perm_arena, sizeof(u32) * DESC_MAX_BINDINGS);
|
for (u32 i = 0; i < vDT_MAX; i++)
|
||||||
|
|
||||||
HashTableInit(&bindings[i].lookup_table, 6);
|
|
||||||
|
|
||||||
u32 free_count = 0;
|
|
||||||
for (i32 j = DESC_MAX_BINDINGS-1; j >= 0; j--)
|
|
||||||
{
|
{
|
||||||
bindings[i].free[j] = free_count++;
|
bindings[i].free = ArenaAlloc(v_Renderer.mem.perm_arena, sizeof(u32) * DESC_MAX_BINDINGS);
|
||||||
|
|
||||||
|
HashTableInit(&bindings[i].lookup_table, 6);
|
||||||
|
|
||||||
|
u32 free_count = 0;
|
||||||
|
for (i32 j = DESC_MAX_BINDINGS-1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
bindings[i].free[j] = free_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings[i].free_count = free_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
bindings[i].free_count = free_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
VkPhysicalDeviceProperties properties;
|
||||||
|
vkGetPhysicalDeviceProperties(v_Renderer.handles.phys_device, &properties);
|
||||||
|
|
||||||
|
VkSamplerCreateInfo sampler_create_info = {
|
||||||
|
.sType = STYPE(SAMPLER_CREATE_INFO),
|
||||||
|
.magFilter = VK_FILTER_NEAREST,
|
||||||
|
.minFilter = VK_FILTER_NEAREST,
|
||||||
|
.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||||
|
.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||||
|
.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||||
|
.anisotropyEnable = VK_TRUE,
|
||||||
|
.maxAnisotropy = properties.limits.maxSamplerAnisotropy,
|
||||||
|
.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK,
|
||||||
|
.compareOp = VK_COMPARE_OP_ALWAYS,
|
||||||
|
.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR,
|
||||||
|
};
|
||||||
|
|
||||||
|
result = vkCreateSampler(v_Renderer.handles.device, &sampler_create_info, NULL, &v_Renderer.handles.nearest_sampler);
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
{
|
||||||
|
Printfln("vDescriptorsInit failure: vkCreateSampler failed: %s", vVkResultStr(result));
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
VkDescriptorImageInfo sampler_info = {
|
||||||
|
.sampler = v_Renderer.handles.nearest_sampler,
|
||||||
|
};
|
||||||
|
|
||||||
|
VkWriteDescriptorSet desc_write = {
|
||||||
|
.sType = STYPE(WRITE_DESCRIPTOR_SET),
|
||||||
|
.dstSet = v_Renderer.handles.desc_sets[vDT_SHARED],
|
||||||
|
.dstBinding = 3,
|
||||||
|
.descriptorCount = 1,
|
||||||
|
.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER,
|
||||||
|
.pImageInfo = &sampler_info,
|
||||||
|
};
|
||||||
|
|
||||||
|
vkUpdateDescriptorSets(v_Renderer.handles.device, 1, &desc_write, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -1553,7 +1597,7 @@ static b32 vShaderModuleInit(u8 *bytes, u32 len, VkShaderModule *module)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32 vInitBuffers()
|
static b32 vBuffersInit()
|
||||||
{
|
{
|
||||||
vRBuffers *buf = &v_Renderer.buffers;
|
vRBuffers *buf = &v_Renderer.buffers;
|
||||||
Arena *arena = v_Renderer.mem.perm_arena;
|
Arena *arena = v_Renderer.mem.perm_arena;
|
||||||
|
|||||||
@ -175,124 +175,16 @@ typedef enum DescType_e
|
|||||||
vDT_MAX,
|
vDT_MAX,
|
||||||
} vDescType;
|
} vDescType;
|
||||||
|
|
||||||
/*
|
typedef struct rDescHandle
|
||||||
typedef struct vMeshBuffer
|
|
||||||
{
|
{
|
||||||
//TODO: FIX
|
u32 asset_id;
|
||||||
//rRenderBuffer index_buf, vertex_buf;
|
u32 desc_index;
|
||||||
u32 index_count;
|
} rDescHandle;
|
||||||
} vMeshBuffer;
|
|
||||||
|
|
||||||
typedef struct vPipelineStructures
|
|
||||||
{
|
|
||||||
VkPipelineLayout pipeline_layout;
|
|
||||||
VkDescriptorPool pool;
|
|
||||||
VkDescriptorSetLayout layouts[vDT_MAX];
|
|
||||||
VkDescriptorSet sets[vDT_MAX];
|
|
||||||
vDescBindings *bindings;
|
|
||||||
u16 bindings_count;
|
|
||||||
VkPipeline pipelines[R_PIPELINE_MAX];
|
|
||||||
} vPipelineStructures;
|
|
||||||
|
|
||||||
typedef struct vFrameStructures
|
|
||||||
{
|
|
||||||
VkCommandPool *pools;
|
|
||||||
VkCommandBuffer *buffers;
|
|
||||||
VkSemaphore *swapchain_sems;
|
|
||||||
VkSemaphore *render_sems;
|
|
||||||
VkFence *render_fences;
|
|
||||||
rRenderBuffer **buffer_destroy_queues;
|
|
||||||
u32 *buffer_counts;
|
|
||||||
} vFrameStructures;
|
|
||||||
|
|
||||||
typedef struct vImmediateStructures
|
|
||||||
{
|
|
||||||
VkCommandPool *pools;
|
|
||||||
VkCommandBuffer *cmds;
|
|
||||||
VkFence *fences;
|
|
||||||
} vImmediateStructures;
|
|
||||||
|
|
||||||
typedef struct vSwapchainStructures
|
|
||||||
{
|
|
||||||
VkFormat format;
|
|
||||||
VkColorSpaceKHR color_space;
|
|
||||||
VkPresentModeKHR present_mode;
|
|
||||||
VkExtent3D extent;
|
|
||||||
VkImage *imgs;
|
|
||||||
VkImageView *views;
|
|
||||||
u32 img_count;
|
|
||||||
vImage draw_img;
|
|
||||||
vImage depth_img;
|
|
||||||
} vSwapchainStructures;
|
|
||||||
|
|
||||||
typedef struct vFrameState
|
|
||||||
{
|
|
||||||
u32 img_ix;
|
|
||||||
u64 frame_cnt;
|
|
||||||
u64 prev_frame;
|
|
||||||
b8 begin_rendering;
|
|
||||||
rPipelineHandle last_pipeline;
|
|
||||||
rRenderBuffer *prev_buffers;
|
|
||||||
u32 prev_buffer_count;
|
|
||||||
} vFrameState;
|
|
||||||
|
|
||||||
typedef struct vVulkan
|
|
||||||
{
|
|
||||||
pLibrary lib;
|
|
||||||
VkInstance inst;
|
|
||||||
VkSurfaceKHR surface;
|
|
||||||
VkDevice device;
|
|
||||||
VkSwapchainKHR swapchain;
|
|
||||||
VkPhysicalDevice phys_device;
|
|
||||||
vDeviceQueues queues;
|
|
||||||
VmaAllocator alloc;
|
|
||||||
vFrameStructures frame;
|
|
||||||
vImmediateStructures imm;
|
|
||||||
vSwapchainStructures sc;
|
|
||||||
vPipelineStructures pipe;
|
|
||||||
#ifdef BUILD_DEBUG
|
|
||||||
VkDebugUtilsMessengerEXT debug;
|
|
||||||
#endif
|
|
||||||
} vVulkan;
|
|
||||||
|
|
||||||
typedef struct vPendingUpdates
|
|
||||||
{
|
|
||||||
u16 render_width;
|
|
||||||
u16 render_height;
|
|
||||||
b8 resized;
|
|
||||||
} vPendingUpdates;
|
|
||||||
|
|
||||||
typedef struct vVulkanConfig
|
|
||||||
{
|
|
||||||
u8 avail_threads;
|
|
||||||
u8 volatile sleeping_threads;
|
|
||||||
#ifdef __linux__
|
|
||||||
pthread_t *threads;
|
|
||||||
#elif _WIN32
|
|
||||||
#error not yet implemented
|
|
||||||
#endif
|
|
||||||
} vVulkanConfig;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct vRenderer
|
|
||||||
{
|
|
||||||
vVulkan vk;
|
|
||||||
vVulkanConfig vk_conf;
|
|
||||||
vFrameState frame_state;
|
|
||||||
vPendingUpdates pending;
|
|
||||||
Arena *perm_arena;
|
|
||||||
Arena *frame_arena[FRAME_OVERLAP];
|
|
||||||
rUploadQueue upload_queues[vDT_MAX];
|
|
||||||
} vRenderer;
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// NEW
|
|
||||||
|
|
||||||
typedef struct vAssetInfo
|
typedef struct vAssetInfo
|
||||||
{
|
{
|
||||||
rDescHandle handle;
|
rDescHandle handle;
|
||||||
vDescType type;
|
vDescType type;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
u64 asset_id;
|
u64 asset_id;
|
||||||
@ -424,6 +316,7 @@ typedef struct vRHandles
|
|||||||
VkDescriptorSet desc_sets[vDT_MAX];
|
VkDescriptorSet desc_sets[vDT_MAX];
|
||||||
VkQueue gfx_queue;
|
VkQueue gfx_queue;
|
||||||
VkQueue tfer_queue;
|
VkQueue tfer_queue;
|
||||||
|
VkSampler nearest_sampler;
|
||||||
#ifdef BUILD_DEBUG
|
#ifdef BUILD_DEBUG
|
||||||
VkDebugUtilsMessengerEXT debug;
|
VkDebugUtilsMessengerEXT debug;
|
||||||
#endif
|
#endif
|
||||||
@ -552,7 +445,7 @@ const char *vVkResultStr(VkResult result);
|
|||||||
|
|
||||||
static b32 vInitInstance();
|
static b32 vInitInstance();
|
||||||
static void vEnableDebug();
|
static void vEnableDebug();
|
||||||
static void vInitArenas();
|
static void vArenasInit();
|
||||||
static b32 vLibraryLoad();
|
static b32 vLibraryLoad();
|
||||||
static b32 vInstanceFunctionsInit();
|
static b32 vInstanceFunctionsInit();
|
||||||
static b32 vGlobalFunctionsInit();
|
static b32 vGlobalFunctionsInit();
|
||||||
@ -574,7 +467,7 @@ static b32 vPipelinesInit();
|
|||||||
static b32 vShaderModuleInit(u8 *bytes, u32 len, VkShaderModule *module);
|
static b32 vShaderModuleInit(u8 *bytes, u32 len, VkShaderModule *module);
|
||||||
static void vUploadQueuesInit();
|
static void vUploadQueuesInit();
|
||||||
static void vLoaderStartThreads();
|
static void vLoaderStartThreads();
|
||||||
static b32 vInitBuffers();
|
static b32 vBuffersInit();
|
||||||
|
|
||||||
// ::Vulkan::Util::Functions::Header::
|
// ::Vulkan::Util::Functions::Header::
|
||||||
|
|
||||||
@ -593,16 +486,16 @@ static inline void vImageCopyToImage(VkCommandBuffer cmd, VkImage src, VkImage d
|
|||||||
|
|
||||||
// ::Vulkan::Async::Functions::Header::
|
// ::Vulkan::Async::Functions::Header::
|
||||||
|
|
||||||
|
void vLoaderWake();
|
||||||
|
static u32 vLoaderProcessBuffers(u32 thread_index);
|
||||||
|
static u32 vLoaderProcessSamplers(u32 thread_index);
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
void *vLoaderStart(void *thread_data);
|
void *vLoaderStart(void *thread_data);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
# error not yet implemented
|
# error not yet implemented
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void vLoaderWake();
|
|
||||||
static u32 vLoaderProcessBuffers(u32 thread_index);
|
|
||||||
static u32 vLoaderProcessSamplers(u32 thread_index);
|
|
||||||
|
|
||||||
// ::Vulkan::ImmediateSubmit::Functions::Header::
|
// ::Vulkan::ImmediateSubmit::Functions::Header::
|
||||||
|
|
||||||
static b32 vImmSubmitBegin(VkDevice device, VkFence fence, VkCommandBuffer cmd);
|
static b32 vImmSubmitBegin(VkDevice device, VkFence fence, VkCommandBuffer cmd);
|
||||||
@ -623,10 +516,10 @@ static void vImageUpload(rTextureBuffer *buffer, u8 *data, u32 thread_idx);
|
|||||||
|
|
||||||
// ::Vulkan::Descriptors::Functions::Header::
|
// ::Vulkan::Descriptors::Functions::Header::
|
||||||
|
|
||||||
static void vDescHandlePush(vDescType type, rDescHandle handle);
|
static void vDescIndexPush(vDescType type, u32 index);
|
||||||
static rDescHandle vDescHandlePop(vDescType type);
|
static u32 vDescIndexPop(vDescType type);
|
||||||
static vAssetInfo *vDescHandleSearch(vDescType type, u64 asset_id);
|
static rDescHandle vDescHandleSearch(vDescType type, u32 asset_id);
|
||||||
static void vDescHandleDelete(vDescType type, u64 asset_id);
|
static void vDescHandleDelete(vDescType type, u32 asset_id);
|
||||||
|
|
||||||
// ::Vulkan::Buffers::Functions::Header::
|
// ::Vulkan::Buffers::Functions::Header::
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
b32 rInit()
|
b32 rInit()
|
||||||
{
|
{
|
||||||
rThreadCountSet(pCPUCountGet());
|
rThreadCountSet(pCPUCountGet());
|
||||||
vInitArenas();
|
vArenasInit();
|
||||||
vCustomizePipelines();
|
vCustomizePipelines();
|
||||||
|
|
||||||
Assert(vInitInstance(), "Unable to initialize instance");
|
Assert(vInitInstance(), "Unable to initialize instance");
|
||||||
@ -24,7 +24,7 @@ b32 rInit()
|
|||||||
Assert(vImmediateStructuresInit(), "Unable to create immediate structures");
|
Assert(vImmediateStructuresInit(), "Unable to create immediate structures");
|
||||||
Assert(vDescriptorsInit(), "Unable to initialize descriptors.");
|
Assert(vDescriptorsInit(), "Unable to initialize descriptors.");
|
||||||
Assert(vPipelinesInit(), "Unable to initialize pipelines.");
|
Assert(vPipelinesInit(), "Unable to initialize pipelines.");
|
||||||
Assert(vInitBuffers(), "Unable to initialize buffers.");
|
Assert(vBuffersInit(), "Unable to initialize buffers.");
|
||||||
|
|
||||||
vUploadQueuesInit();
|
vUploadQueuesInit();
|
||||||
vLoaderStartThreads();
|
vLoaderStartThreads();
|
||||||
@ -265,28 +265,32 @@ static b32 rBufferUpload(rRenderBuffer **buffers, rawptr *ptrs, u32 count, u32 t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rBufferCreateAndUpload(rRenderBuffer *buffer, rawptr ptr)
|
static void rBufferCreateAndUpload(ModelAsset asset_id)
|
||||||
{
|
{
|
||||||
|
/* TODO: figure out how buffers should be loaded to get index count, etc
|
||||||
// TODO: replace
|
|
||||||
/*
|
|
||||||
TicketMutLock(&renderer.upload_queues[vDT_MATERIAL].ticket_mut);
|
TicketMutLock(&renderer.upload_queues[vDT_MATERIAL].ticket_mut);
|
||||||
|
|
||||||
|
rDescHandle handle = vDescHandleSearch(MODEL_ASSET, asset_id);
|
||||||
|
if (handle.asset_id != UINT32_MAX)
|
||||||
|
{
|
||||||
|
vBufferAlloc *buffer = FLMemAlloc(sizeof(vBufferAlloc));
|
||||||
|
buffer->
|
||||||
|
}
|
||||||
|
|
||||||
u32 job_idx = JobQueueAdd(&renderer.upload_queues[vDT_MATERIAL].job_queue, 1);
|
u32 job_idx = JobQueueAdd(&renderer.upload_queues[vDT_MATERIAL].job_queue, 1);
|
||||||
renderer.upload_queues[vDT_MATERIAL].queued_buffers[job_idx] = buffer;
|
renderer.upload_queues[vDT_MATERIAL].queued_buffers[job_idx] = buffer;
|
||||||
renderer.upload_queues[vDT_MATERIAL].data[job_idx] = ptr;
|
renderer.upload_queues[vDT_MATERIAL].data[job_idx] = ptr;
|
||||||
|
|
||||||
TicketMutUnlock(&renderer.upload_queues[vDT_MATERIAL].ticket_mut);
|
TicketMutUnlock(&renderer.upload_queues[vDT_MATERIAL].ticket_mut);
|
||||||
*/
|
|
||||||
|
|
||||||
vLoaderWake();
|
vLoaderWake();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static rDescHandle rTextureCreateAndUpload(TextureAsset asset_id)
|
static rDescHandle rTextureCreateAndUpload(TextureAsset asset_id)
|
||||||
{
|
{
|
||||||
rDescHandle handle = 0;
|
|
||||||
|
|
||||||
// TODO: replace it
|
// TODO: replace it, store asset information (vertex count, res, etc) in asset header files and pull them for use in draw commands, etc.
|
||||||
/*
|
/*
|
||||||
vAssetInfo *info = vDescHandleSearch(vDT_SAMPLED_IMAGE, asset_id);
|
vAssetInfo *info = vDescHandleSearch(vDT_SAMPLED_IMAGE, asset_id);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
@ -305,7 +309,7 @@ static rDescHandle rTextureCreateAndUpload(TextureAsset asset_id)
|
|||||||
renderer.upload_queues[vDT_SAMPLED_IMAGE].queued_textures[job_idx] = buffer;
|
renderer.upload_queues[vDT_SAMPLED_IMAGE].queued_textures[job_idx] = buffer;
|
||||||
renderer.upload_queues[vDT_SAMPLED_IMAGE].data[job_idx] = asset.bytes;
|
renderer.upload_queues[vDT_SAMPLED_IMAGE].data[job_idx] = asset.bytes;
|
||||||
|
|
||||||
handle = vDescHandlePop(vDT_SAMPLED_IMAGE);
|
handle = vDescIndexPop(vDT_SAMPLED_IMAGE);
|
||||||
|
|
||||||
TicketMutUnlock(&renderer.upload_queues[vDT_SAMPLED_IMAGE].ticket_mut);
|
TicketMutUnlock(&renderer.upload_queues[vDT_SAMPLED_IMAGE].ticket_mut);
|
||||||
|
|
||||||
@ -317,6 +321,8 @@ static rDescHandle rTextureCreateAndUpload(TextureAsset asset_id)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
rDescHandle handle = {UINT32_MAX};
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -229,6 +229,7 @@ static VkDescriptorBindingFlags shared_desc_binding_flags[] = {
|
|||||||
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
||||||
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
||||||
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
||||||
|
VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
static VkDescriptorSetLayoutBindingFlagsCreateInfo shared_layout_binding_flags_info = {
|
static VkDescriptorSetLayoutBindingFlagsCreateInfo shared_layout_binding_flags_info = {
|
||||||
@ -241,6 +242,7 @@ static VkDescriptorSetLayoutBinding shared_layout_bindings[] = {
|
|||||||
{ .binding = 0, .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
{ .binding = 0, .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
||||||
{ .binding = 1, .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
{ .binding = 1, .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
||||||
{ .binding = 2, .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
{ .binding = 2, .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
||||||
|
{ .binding = 3, .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER, .descriptorCount = 1, .stageFlags = VK_SHADER_STAGE_ALL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static VkDescriptorSetLayoutCreateInfo shared_layout_create_info = {
|
static VkDescriptorSetLayoutCreateInfo shared_layout_create_info = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user