Send view and project matrices in push constant

This commit is contained in:
Camden Dixie O'Brien committed 2025-10-03 23:42:54 +01:00
1 parent f3aa7435ec
commit ea82627695
4 files changed
+67 -59

No files matched your search

+7 -9
View File
@@ -10,10 +10,9 @@
#define MAX_FRAMES_IN_FLIGHT 4
typedef struct {
mat4_t model;
mat4_t view;
mat4_t proj;
} mvp_t;
} vp_t;
typedef struct {
VkInstance inst;
@@ -49,15 +48,15 @@ typedef struct {
} gpu_ctx_t;
typedef struct {
mvp_t *mvp_ptr;
mat4_t *transform_ptr;
mat4_t *bone_ptr;
VkBuffer vertex_buf;
VkDeviceMemory vertex_mem;
VkBuffer index_buf;
VkDeviceMemory index_mem;
VkDescriptorSet desc_sets[MAX_FRAMES_IN_FLIGHT];
VkBuffer mvp_buf;
VkDeviceMemory mvp_mem;
VkBuffer transform_buf;
VkDeviceMemory transform_mem;
VkBuffer bone_buf;
VkDeviceMemory bone_mem;
size_t index_count;
@@ -71,11 +70,10 @@ void gpu_model_load(
const gpu_ctx_t *ctx, const model_t *model, gpu_model_t *out);
void gpu_model_cleanup(const gpu_ctx_t *ctx, const gpu_model_t *model);
void gpu_render_begin(gpu_ctx_t *ctx);
void gpu_render_begin(gpu_ctx_t *ctx, vp_t vp);
void gpu_render_model(
const gpu_ctx_t *ctx, const gpu_model_t *model, const mvp_t *mvp,
const mat4_t *bone_matrices);
const gpu_ctx_t *ctx, const gpu_model_t *model,
const mat4_t *bone_matrices, mat4_t transform);
void gpu_render_submit(gpu_ctx_t *ctx);
#endif