Drawing a textured quad
Added new assets Loaded all texture assets into game state Loaded the basic pipeline Setup a hard-coded quad to test drawing Created a very jank vertex struct Added ReadEntireFile for filesystem Added getting file size from file handle Added a descriptor pool to each in flight frame Changed Vk_BufferCreate to handle multiple uses Added shader building to the windows.bat build script
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
#if OS_WINDOWS
|
||||
#include "impl/windows/core.c"
|
||||
#endif
|
||||
|
||||
|
||||
Str8 FS_ReadEntireFile(M_Arena *arena, Str8 path) {
|
||||
Str8 result = { 0 };
|
||||
|
||||
OS_Handle file = FS_FileOpen(path, FS_ACCESS_READ);
|
||||
if (file.v[0]) {
|
||||
result.count = FS_FileSize(file);
|
||||
result.data = M_ArenaPush(arena, U8, .count = result.count);
|
||||
|
||||
FS_FileRead(file, result.data, result.count, 0);
|
||||
FS_FileClose(file);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ function void FS_FileClose(OS_Handle file);
|
||||
function void FS_FileRead(OS_Handle file, void *ptr, U64 size, U64 offset);
|
||||
function void FS_FileWrite(OS_Handle file, void *ptr, U64 size, U64 offset);
|
||||
|
||||
function U64 FS_FileSize(OS_Handle file);
|
||||
|
||||
typedef U32 FS_EntryType;
|
||||
enum {
|
||||
FS_ENTRY_TYPE_FILE = 0,
|
||||
@@ -42,4 +44,6 @@ struct FS_List {
|
||||
|
||||
function FS_List FS_PathList(M_Arena *arena, Str8 path);
|
||||
|
||||
function Str8 FS_ReadEntireFile(M_Arena *arena, Str8 path);
|
||||
|
||||
#endif // LD_OS_FILESYSTEM_H_
|
||||
|
||||
@@ -83,6 +83,19 @@ void FS_FileWrite(OS_Handle file, void *ptr, U64 size, U64 offset) {
|
||||
}
|
||||
}
|
||||
|
||||
U64 FS_FileSize(OS_Handle file) {
|
||||
U64 result = 0;
|
||||
HANDLE hFile = cast(HANDLE) file.v[0];
|
||||
if (hFile) {
|
||||
DWORD dwLow, dwHigh;
|
||||
dwLow = GetFileSize(hFile, &dwHigh);
|
||||
|
||||
result = ((U64) dwHigh << 32) | ((U64) dwLow);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
FS_List FS_PathList(M_Arena *arena, Str8 path) {
|
||||
FS_List result = { 0 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user