formatting

This commit is contained in:
jacob 2025-06-23 15:23:45 -05:00
parent 7a4554ba99
commit ccf47c03f6
4 changed files with 21 additions and 8 deletions

View File

@ -6,8 +6,8 @@
#define DECL(t, n) t n : n #define DECL(t, n) t n : n
#define NURI(i) NonUniformResourceIndex(i) #define NURI(i) NonUniformResourceIndex(i)
#if !SH_CPU #ifdef INTELLISENSE
# define INLINE /* For intellisense */ # define INLINE
#endif #endif
/* Linear color from normalized sRGB */ /* Linear color from normalized sRGB */

View File

@ -18,6 +18,7 @@
cbuffer cb : register(b0) { struct sh_material_constants g_constants; }; cbuffer cb : register(b0) { struct sh_material_constants g_constants; };
StructuredBuffer<struct sh_material_instance> g_instances : register(t0); StructuredBuffer<struct sh_material_instance> g_instances : register(t0);
Texture2D g_nuri_textures[] : register(t1); Texture2D g_nuri_textures[] : register(t1);
SamplerState g_sampler : register(s0); SamplerState g_sampler : register(s0);
/* ========================== * /* ========================== *

View File

@ -2195,9 +2195,17 @@ INTERNAL struct dx12_resource *update_swapchain(struct sys_window *window, struc
return G.swapchain_resources[G.swapchain_frame_index]; return G.swapchain_resources[G.swapchain_frame_index];
} }
/* FIXME: Remove this */ /* FIXME: Remove this */
#include "draw.h" #include "draw.h"
INTERNAL void present_blit(struct dx12_resource *dst, struct dx12_resource *src, struct xform src_xf) INTERNAL void present_blit(struct dx12_resource *dst, struct dx12_resource *src, struct xform src_xf)
{ {
/* FIXME: Remove this */ /* FIXME: Remove this */
@ -2227,6 +2235,12 @@ INTERNAL void present_blit(struct dx12_resource *dst, struct dx12_resource *src,
gp_dispatch(params); gp_dispatch(params);
} }
void gp_present(struct sys_window *window, struct v2i32 backbuffer_resolution, struct gp_handle texture, struct xform texture_xf, i32 vsync) void gp_present(struct sys_window *window, struct v2i32 backbuffer_resolution, struct gp_handle texture, struct xform texture_xf, i32 vsync)
{ {
query_memory_info(); query_memory_info();

View File

@ -4,10 +4,9 @@
#include "atomic.h" #include "atomic.h"
#include "intrinsics.h" #include "intrinsics.h"
#define THREAD_LOCAL_STORE_RESERVE (MEGABYTE(64)) /* Arbitrary limits. Increase if needed. */
/* Arbitrary. Increase if needed. */
#define MAX_THREAD_LOCAL_VARS 256 #define MAX_THREAD_LOCAL_VARS 256
#define THREAD_LOCAL_STORE_RESERVE (MEGABYTE(64))
GLOBAL struct { GLOBAL struct {
struct atomic_i32 metas_lock_flag; struct atomic_i32 metas_lock_flag;
@ -17,8 +16,8 @@ GLOBAL struct {
INTERNAL void metas_lock(void) INTERNAL void metas_lock(void)
{ {
/* Spinlock */
while (atomic_i32_eval_compare_exchange(&G.metas_lock_flag, 0, 1) == 0) { while (atomic_i32_eval_compare_exchange(&G.metas_lock_flag, 0, 1) == 0) {
/* Spinlock */
ix_pause(); ix_pause();
} }
} }
@ -54,7 +53,6 @@ void thread_local_store_release(struct thread_local_store *t)
} }
} }
metas_unlock(); metas_unlock();
arena_release(t->arena); arena_release(t->arena);
} }
@ -68,7 +66,7 @@ void *_thread_local_var_eval(struct thread_local_var_meta *meta)
__profscope(_thread_local_var_eval__REGISTER); __profscope(_thread_local_var_eval__REGISTER);
metas_lock(); metas_lock();
{ {
id_plus_one = atomic_u64_eval(&meta->id_plus_one); /* Re-check now that locked */ id_plus_one = atomic_u64_eval(&meta->id_plus_one); /* Reevaluate now that we've locked */
if (id_plus_one == 0) { if (id_plus_one == 0) {
id = G.metas_count++; id = G.metas_count++;
if (id >= MAX_THREAD_LOCAL_VARS) { if (id >= MAX_THREAD_LOCAL_VARS) {