Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -311,7 +311,7 @@ extern "C" void gdraw_psp2_wait(U64 fence_val)
// // (once or several times) here
// SceGxmNotification notify = gdraw_psp2_End();
// // --- again, may issue rendering calls here (but not draw Iggys)
// sceGxmEndScene(imm_ctx, nullptr, &notify);
// sceGxmEndScene(imm_ctx, NULL, &notify);
//
// That is, exactly one gdraw_psp2_Begin/_End pair for that scene, and
// all IggyPlayerDraws must be inside that pair. That's it.
@@ -360,7 +360,7 @@ static void gdraw_gpu_memcpy(GDrawHandleCache *c, void *dst, void *src, U32 num_
0, 0, SCE_GXM_TRANSFER_COLORKEY_NONE,
SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, srcp + offs, 0, 0, row_size,
SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, dstp + offs, 0, 0, row_size,
nullptr, 0, nullptr);
NULL, 0, NULL);
offs += num_rows * row_size;
}
@@ -375,7 +375,7 @@ static void gdraw_gpu_memcpy(GDrawHandleCache *c, void *dst, void *src, U32 num_
0, 0, SCE_GXM_TRANSFER_COLORKEY_NONE,
SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, srcp + offs, 0, 0, row_size,
SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, dstp + offs, 0, 0, row_size,
nullptr, 0, nullptr);
NULL, 0, NULL);
}
if (c->is_vertex)
@@ -436,7 +436,7 @@ static void api_free_resource(GDrawHandle *r)
if (!r->cache->is_vertex) {
for (S32 i=0; i < MAX_SAMPLERS; i++)
if (gdraw->active_tex[i] == (GDrawTexture *) r)
gdraw->active_tex[i] = nullptr;
gdraw->active_tex[i] = NULL;
}
}
@@ -462,7 +462,7 @@ static void track_dynamic_alloc_attempt(U32 size, U32 align)
static void track_dynamic_alloc_failed()
{
if (gdraw->dynamic_stats.allocs_attempted == gdraw->dynamic_stats.allocs_succeeded + 1) { // warn the first time we run out of mem
IggyGDrawSendWarning(nullptr, "GDraw out of dynamic memory");
IggyGDrawSendWarning(NULL, "GDraw out of dynamic memory");
}
}
@@ -506,7 +506,7 @@ GDrawTexture * RADLINK gdraw_psp2_WrappedTextureCreate(SceGxmTexture *tex)
{
GDrawStats stats = {};
GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats);
gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned);
gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned);
gdraw_psp2_WrappedTextureChange((GDrawTexture *) p, tex);
return (GDrawTexture *) p;
}
@@ -561,11 +561,11 @@ static U32 tex_linear_stride(U32 width)
static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats)
{
S32 bytes_pixel = 4;
GDrawHandle *t = nullptr;
GDrawHandle *t = NULL;
SceGxmTextureFormat format = SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ABGR;
if (width > MAX_TEXTURE2D_DIM || height > MAX_TEXTURE2D_DIM) {
IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM);
IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM);
return false;
}
@@ -611,7 +611,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) {
rrbool ok;
assert(p->temp_buffer != nullptr);
assert(p->temp_buffer != NULL);
ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, mipmaps,
bytes_pixel, p->temp_buffer, p->temp_buffer_bytes);
if (!ok)
@@ -626,7 +626,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
p->i2 = height;
} else {
// non-mipmapped textures, we just upload straight to their destination
p->p1 = nullptr;
p->p1 = NULL;
p->texture_data = (U8 *)t->raw_ptr;
p->num_rows = height;
p->stride_in_bytes = base_stride * bytes_pixel;
@@ -723,8 +723,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr
static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats)
{
GDrawHandle *t = (GDrawHandle *) tt;
assert(t != nullptr);
if (t->owner == unique_id || unique_id == nullptr) {
assert(t != NULL);
if (t->owner == unique_id || unique_id == NULL) {
gdraw_res_kill(t, stats);
}
}
@@ -744,7 +744,7 @@ static void RADLINK gdraw_DescribeTexture(GDrawTexture *tex, GDraw_Texture_Descr
static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba)
{
if (sceGxmTextureGetData(&gdraw->aa_tex) != nullptr)
if (sceGxmTextureGetData(&gdraw->aa_tex) != NULL)
return;
assert(width <= MAX_AATEX_WIDTH);
@@ -801,7 +801,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni
static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats)
{
GDrawHandle *h = (GDrawHandle *) vb;
assert(h != nullptr); // @GDRAW_ASSERT
assert(h != NULL); // @GDRAW_ASSERT
if (h->owner == unique_id)
gdraw_res_kill(h, stats);
}
@@ -931,8 +931,8 @@ static void set_common_renderstate()
// clear our state caching
memset(gdraw->active_tex, 0, sizeof(gdraw->active_tex));
gdraw->scissor_state = 0;
gdraw->cur_fp = nullptr;
gdraw->cur_vp = nullptr;
gdraw->cur_fp = NULL;
gdraw->cur_vp = NULL;
// all the state we won't touch again until we're done rendering
sceGxmSetCullMode(gxm, SCE_GXM_CULL_NONE);
@@ -1032,7 +1032,7 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32
// must include anything necessary for texture creation/update
static void RADLINK gdraw_RenderingBegin(void)
{
assert(gdraw->gxm != nullptr); // call after gdraw_psp2_Begin
assert(gdraw->gxm != NULL); // call after gdraw_psp2_Begin
set_common_renderstate();
}
@@ -1061,7 +1061,7 @@ static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, S32 pa
// clear our depth/stencil buffers (and also color if requested)
clear_whole_surf(true, true, gdraw->next_tile_clear, stats);
gdraw->next_tile_clear = nullptr;
gdraw->next_tile_clear = NULL;
}
static void RADLINK gdraw_RenderTileEnd(GDrawStats *stats)
@@ -1079,7 +1079,7 @@ void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, c
{
U32 xmin, ymin, xmax, ymax;
assert(gdraw->gxm == nullptr); // may not nest Begin calls
assert(gdraw->gxm == NULL); // may not nest Begin calls
// need to wait for the buffer to become idle before we can use it!
gdraw_psp2_WaitForDynamicBufferIdle(dynamic_buf);
@@ -1106,7 +1106,7 @@ void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, c
// - We need the stencil buffer to support Flash masking operations.
// - We need the mask bit to perform pixel-accurate scissor testing.
// There's only one format that satisfies both requirements.
IggyGDrawSendWarning(nullptr, "Iggy rendering will not work correctly unless a depth/stencil buffer in DF32M_S8 format is provided.");
IggyGDrawSendWarning(NULL, "Iggy rendering will not work correctly unless a depth/stencil buffer in DF32M_S8 format is provided.");
}
// For immediate contexts, we need to flush pending vertex transfers before
@@ -1125,15 +1125,15 @@ SceGxmNotification gdraw_psp2_End()
GDrawStats gdraw_stats = {};
SceGxmNotification notify;
assert(gdraw->gxm != nullptr); // please keep Begin / End pairs properly matched
assert(gdraw->gxm != NULL); // please keep Begin / End pairs properly matched
notify = scene_end_notification();
gdraw->dyn_buf->sync = gdraw->scene_end_fence.value;
gdraw->dyn_buf->stats = gdraw->dynamic_stats;
gdraw_arena_init(&gdraw->dynamic, nullptr, 0);
gdraw->gxm = nullptr;
gdraw->dyn_buf = nullptr;
gdraw_arena_init(&gdraw->dynamic, NULL, 0);
gdraw->gxm = NULL;
gdraw->dyn_buf = NULL;
// NOTE: the stats from these go nowhere. That's a bit unfortunate, but the
// GDrawStats model is that things can be accounted to something in the
@@ -1173,13 +1173,13 @@ static void RADLINK gdraw_GetInfo(GDrawInfo *d)
static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format format, U32 flags, void *owner, GDrawStats *stats)
{
IggyGDrawSendWarning(nullptr, "GDraw no rendertarget support on PSP2");
IggyGDrawSendWarning(NULL, "GDraw no rendertarget support on PSP2");
return false;
}
static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats)
{
return nullptr;
return NULL;
}
////////////////////////////////////////////////////////////////////////
@@ -1190,13 +1190,13 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats)
static void RADLINK gdraw_ClearStencilBits(U32 bits)
{
GDrawStats stats = {};
clear_whole_surf(false, true, nullptr, &stats);
clear_whole_surf(false, true, NULL, &stats);
}
static void RADLINK gdraw_ClearID(void)
{
GDrawStats stats = {};
clear_whole_surf(true, false, nullptr, &stats);
clear_whole_surf(true, false, NULL, &stats);
}
////////////////////////////////////////////////////////////////////////
@@ -1451,7 +1451,7 @@ static GDrawHandle *check_resource(void *ptr)
#define check_resource(ptr) ((GDrawHandle *)(ptr))
#endif
static RADINLINE void fence_resources(void *r1, void *r2=nullptr, void *r3=nullptr)
static RADINLINE void fence_resources(void *r1, void *r2=NULL, void *r3=NULL)
{
GDrawFence fence = get_next_fence();
if (r1) check_resource(r1)->fence = fence;
@@ -1592,7 +1592,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
// actual filter effects and special blends aren't supported on PSP2.
if (r->blend_mode == GDRAW_BLEND_filter || r->blend_mode == GDRAW_BLEND_special) {
IggyGDrawSendWarning(nullptr, "GDraw no filter or special blend support on PSP2");
IggyGDrawSendWarning(NULL, "GDraw no filter or special blend support on PSP2");
// just don't do anything.
} else {
// just a plain quad.
@@ -1614,7 +1614,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
static bool gxm_check(SceGxmErrorCode err)
{
if (err != SCE_OK)
IggyGDrawSendWarning(nullptr, "GXM error");
IggyGDrawSendWarning(NULL, "GXM error");
return err == SCE_OK;
}
@@ -1643,9 +1643,9 @@ static bool register_and_create_vertex_prog(SceGxmVertexProgram **out_prog, SceG
SceGxmVertexStream stream;
if (!register_shader(patcher, shader))
return nullptr;
return NULL;
*out_prog = nullptr;
*out_prog = NULL;
if (attr_bytes) {
attr.streamIndex = 0;
@@ -1659,7 +1659,7 @@ static bool register_and_create_vertex_prog(SceGxmVertexProgram **out_prog, SceG
return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, &attr, 1, &stream, 1, out_prog));
} else
return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, nullptr, 0, nullptr, 0, out_prog));
return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, NULL, 0, NULL, 0, out_prog));
}
static void destroy_vertex_prog(SceGxmShaderPatcher *patcher, SceGxmVertexProgram *prog)
@@ -1670,8 +1670,8 @@ static void destroy_vertex_prog(SceGxmShaderPatcher *patcher, SceGxmVertexProgra
static bool create_fragment_prog(SceGxmFragmentProgram **out_prog, SceGxmShaderPatcher *patcher, ShaderCode *shader, const SceGxmBlendInfo *blend, SceGxmOutputRegisterFormat out_fmt)
{
*out_prog = nullptr;
return gxm_check(sceGxmShaderPatcherCreateFragmentProgram(patcher, shader->id, out_fmt, SCE_GXM_MULTISAMPLE_NONE, blend, nullptr, out_prog));
*out_prog = NULL;
return gxm_check(sceGxmShaderPatcherCreateFragmentProgram(patcher, shader->id, out_fmt, SCE_GXM_MULTISAMPLE_NONE, blend, NULL, out_prog));
}
static void destroy_fragment_prog(SceGxmShaderPatcher *patcher, SceGxmFragmentProgram *prog)
@@ -1731,10 +1731,10 @@ static bool create_all_programs(SceGxmOutputRegisterFormat reg_format)
}
if (!register_shader(patcher, pshader_manual_clear_arr) ||
!create_fragment_prog(&gdraw->clear_fp, patcher, pshader_manual_clear_arr, nullptr, reg_format))
!create_fragment_prog(&gdraw->clear_fp, patcher, pshader_manual_clear_arr, NULL, reg_format))
return false;
gdraw->mask_update_fp = nullptr;
gdraw->mask_update_fp = NULL;
return gxm_check(sceGxmShaderPatcherCreateMaskUpdateFragmentProgram(patcher, &gdraw->mask_update_fp));
}
@@ -1786,7 +1786,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali
one_pool_bytes = align_down(one_pool_bytes / 2, align);
if (one_pool_bytes < (S32)align)
return nullptr;
return NULL;
cache = (GDrawHandleCache *) IggyGDrawMalloc(cache_size + header_size);
if (cache) {
@@ -1805,7 +1805,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali
cache->alloc = gfxalloc_create(gdraw_limits[type].ptr, one_pool_bytes, align, num_handles);
if (!cache->alloc) {
IggyGDrawFree(cache);
return nullptr;
return NULL;
}
if (use_twopool) {
@@ -1813,7 +1813,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali
if (!cache->alloc_other) {
IggyGDrawFree(cache->alloc);
IggyGDrawFree(cache);
return nullptr;
return NULL;
}
// two dummy copies to make sure we have gpu read/write access
@@ -1898,12 +1898,12 @@ int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles,
case GDRAW_PSP2_RESOURCE_texture:
free_handle_cache(gdraw->texturecache);
gdraw->texturecache = make_handle_cache(GDRAW_PSP2_RESOURCE_texture, GDRAW_PSP2_TEXTURE_ALIGNMENT, true);
return gdraw->texturecache != nullptr;
return gdraw->texturecache != NULL;
case GDRAW_PSP2_RESOURCE_vertexbuffer:
free_handle_cache(gdraw->vbufcache);
gdraw->vbufcache = make_handle_cache(GDRAW_PSP2_RESOURCE_vertexbuffer, GDRAW_PSP2_VERTEXBUFFER_ALIGNMENT, true);
return gdraw->vbufcache != nullptr;
return gdraw->vbufcache != NULL;
default:
return 0;
@@ -1912,8 +1912,8 @@ int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles,
void gdraw_psp2_ResetAllResourceMemory()
{
gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_texture, 0, nullptr, 0);
gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_vertexbuffer, 0, nullptr, 0);
gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_texture, 0, NULL, 0);
gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_vertexbuffer, 0, NULL, 0);
}
GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, void *context_mem, volatile U32 *notification, SceGxmOutputRegisterFormat reg_format)
@@ -1935,7 +1935,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo
};
gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw));
if (!gdraw) return nullptr;
if (!gdraw) return NULL;
memset(gdraw, 0, sizeof(*gdraw));
@@ -1961,7 +1961,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo
if (!gdraw->quad_ib || !gdraw->mask_ib || !create_all_programs(reg_format)) {
gdraw_psp2_DestroyContext();
return nullptr;
return NULL;
}
// init quad index buffer
@@ -1977,7 +1977,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo
gdraw->mask_draw_gpu = gdraw_arena_alloc(&gdraw->context_arena, sceGxmGetPrecomputedDrawSize(gdraw->mask_vp), SCE_GXM_PRECOMPUTED_ALIGNMENT);
if (!gdraw->mask_draw_gpu) {
gdraw_psp2_DestroyContext();
return nullptr;
return NULL;
}
memcpy(gdraw->mask_ib, mask_ib_data, sizeof(mask_ib_data));
@@ -2048,7 +2048,7 @@ void gdraw_psp2_DestroyContext(void)
free_handle_cache(gdraw->vbufcache);
destroy_all_programs();
IggyGDrawFree(gdraw);
gdraw = nullptr;
gdraw = NULL;
}
}
@@ -2070,7 +2070,7 @@ void RADLINK gdraw_psp2_EndCustomDraw(IggyCustomDrawCallbackRegion *region)
GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S32 len, IggyFileTexturePSP2 *tex)
{
SceGxmErrorCode (*init_func)(SceGxmTexture *texture, const void *data, SceGxmTextureFormat texFormat, uint32_t width, uint32_t height, uint32_t mipCount) = nullptr;
SceGxmErrorCode (*init_func)(SceGxmTexture *texture, const void *data, SceGxmTextureFormat texFormat, uint32_t width, uint32_t height, uint32_t mipCount) = NULL;
switch (tex->texture.type) {
case SCE_GXM_TEXTURE_SWIZZLED: init_func = sceGxmTextureInitSwizzled; break;
@@ -2080,15 +2080,15 @@ GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S3
}
if (!init_func) {
IggyGDrawSendWarning(nullptr, "Unsupported texture type in MakeTextureFromResource");
return nullptr;
IggyGDrawSendWarning(NULL, "Unsupported texture type in MakeTextureFromResource");
return NULL;
}
SceGxmTexture gxm;
SceGxmErrorCode err = init_func(&gxm, file_in_memory + tex->file_offset, (SceGxmTextureFormat)tex->texture.format, tex->texture.width, tex->texture.height, tex->texture.mip_count);
if (err != SCE_OK) {
IggyGDrawSendWarning(nullptr, "Texture init failed in MakeTextureFromResource (bad data?)");
return nullptr;
IggyGDrawSendWarning(NULL, "Texture init failed in MakeTextureFromResource (bad data?)");
return NULL;
}
return gdraw_psp2_WrappedTextureCreate(&gxm);

View File

@@ -68,7 +68,7 @@ IDOC extern int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 n
mapped to the GPU and *writeable*. If it isn't, the GPU will crash during
either this function or CreateContext!
Pass in nullptr for "ptr" and zero "num_bytes" to free the memory allocated to
Pass in NULL for "ptr" and zero "num_bytes" to free the memory allocated to
a specific pool.
GDraw can run into cases where resource memory gets fragmented; we defragment
@@ -121,7 +121,7 @@ IDOC extern GDrawFunctions * gdraw_psp2_CreateContext(SceGxmShaderPatcher *shade
be valid for as long as a GDraw context is alive.
If initialization fails for some reason (the main reason would be an out of memory condition),
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */
IDOC extern void gdraw_psp2_DestroyContext(void);
/* Destroys the current GDraw context, if any.

View File

@@ -532,24 +532,24 @@ static unsigned char pshader_basic_17[436] = {
};
static ShaderCode pshader_basic_arr[18] = {
{ pshader_basic_0, { nullptr } },
{ pshader_basic_1, { nullptr } },
{ pshader_basic_2, { nullptr } },
{ pshader_basic_3, { nullptr } },
{ pshader_basic_4, { nullptr } },
{ pshader_basic_5, { nullptr } },
{ pshader_basic_6, { nullptr } },
{ pshader_basic_7, { nullptr } },
{ pshader_basic_8, { nullptr } },
{ pshader_basic_9, { nullptr } },
{ pshader_basic_10, { nullptr } },
{ pshader_basic_11, { nullptr } },
{ pshader_basic_12, { nullptr } },
{ pshader_basic_13, { nullptr } },
{ pshader_basic_14, { nullptr } },
{ pshader_basic_15, { nullptr } },
{ pshader_basic_16, { nullptr } },
{ pshader_basic_17, { nullptr } },
{ pshader_basic_0, { NULL } },
{ pshader_basic_1, { NULL } },
{ pshader_basic_2, { NULL } },
{ pshader_basic_3, { NULL } },
{ pshader_basic_4, { NULL } },
{ pshader_basic_5, { NULL } },
{ pshader_basic_6, { NULL } },
{ pshader_basic_7, { NULL } },
{ pshader_basic_8, { NULL } },
{ pshader_basic_9, { NULL } },
{ pshader_basic_10, { NULL } },
{ pshader_basic_11, { NULL } },
{ pshader_basic_12, { NULL } },
{ pshader_basic_13, { NULL } },
{ pshader_basic_14, { NULL } },
{ pshader_basic_15, { NULL } },
{ pshader_basic_16, { NULL } },
{ pshader_basic_17, { NULL } },
};
static unsigned char pshader_manual_clear_0[220] = {
@@ -570,7 +570,7 @@ static unsigned char pshader_manual_clear_0[220] = {
};
static ShaderCode pshader_manual_clear_arr[1] = {
{ pshader_manual_clear_0, { nullptr } },
{ pshader_manual_clear_0, { NULL } },
};
static unsigned char vshader_vspsp2_0[360] = {
@@ -664,9 +664,9 @@ static unsigned char vshader_vspsp2_2[336] = {
};
static ShaderCode vshader_vspsp2_arr[3] = {
{ vshader_vspsp2_0, { nullptr } },
{ vshader_vspsp2_1, { nullptr } },
{ vshader_vspsp2_2, { nullptr } },
{ vshader_vspsp2_0, { NULL } },
{ vshader_vspsp2_1, { NULL } },
{ vshader_vspsp2_2, { NULL } },
};
static unsigned char vshader_vspsp2_mask_0[304] = {
@@ -692,6 +692,6 @@ static unsigned char vshader_vspsp2_mask_0[304] = {
};
static ShaderCode vshader_vspsp2_mask_arr[1] = {
{ vshader_vspsp2_mask_0, { nullptr } },
{ vshader_vspsp2_mask_0, { NULL } },
};

View File

@@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c)
s = s->next;
}
s = c->active;
while (s != nullptr) {
while (s != NULL) {
assert(s->raw_ptr != t->raw_ptr);
s = s->next;
}
@@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState
{
check_lists(t->cache);
assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here!
assert(t->state != static_cast<U32>(new_state)); // code should never call "transition" if it's not transitioning!
assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning!
// unlink from prev state
t->prev->next = t->next;
t->next->prev = t->prev;
@@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats
static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner)
{
return gdraw_HandleCacheLockStats(t, owner, nullptr);
return gdraw_HandleCacheLockStats(t, owner, NULL);
}
static void gdraw_HandleCacheUnlock(GDrawHandle *t)
@@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
c->is_thrashing = false;
c->did_defragment = false;
for (i=0; i < GDRAW_HANDLE_STATE__count; i++) {
c->state[i].owner = nullptr;
c->state[i].cache = nullptr; // should never follow cache link from sentinels!
c->state[i].owner = NULL;
c->state[i].cache = NULL; // should never follow cache link from sentinels!
c->state[i].next = c->state[i].prev = &c->state[i];
#ifdef GDRAW_MANAGE_MEM
c->state[i].raw_ptr = nullptr;
c->state[i].raw_ptr = NULL;
#endif
c->state[i].fence.value = 0;
c->state[i].bytes = 0;
@@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
c->handle[i].bytes = 0;
c->handle[i].state = GDRAW_HANDLE_STATE_free;
#ifdef GDRAW_MANAGE_MEM
c->handle[i].raw_ptr = nullptr;
c->handle[i].raw_ptr = NULL;
#endif
}
c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0];
@@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
c->prev_frame_start.value = 0;
c->prev_frame_end.value = 0;
#ifdef GDRAW_MANAGE_MEM
c->alloc = nullptr;
c->alloc = NULL;
#endif
#ifdef GDRAW_MANAGE_MEM_TWOPOOL
c->alloc_other = nullptr;
c->alloc_other = NULL;
#endif
check_lists(c);
}
@@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c)
{
GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free];
GDrawHandle *t = nullptr;
GDrawHandle *t = NULL;
if (free_list->next != free_list) {
t = free_list->next;
gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc);
t->bytes = 0;
t->owner = 0;
#ifdef GDRAW_MANAGE_MEM
t->raw_ptr = nullptr;
t->raw_ptr = NULL;
#endif
#ifdef GDRAW_CORRUPTION_CHECK
t->has_check_value = false;
@@ -562,7 +562,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c)
// at the front of the LRU list are the oldest ones, since in-use resources
// will get appended on every transition from "locked" to "live".
GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live];
return (sentinel->next != sentinel) ? sentinel->next : nullptr;
return (sentinel->next != sentinel) ? sentinel->next : NULL;
}
static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now)
@@ -777,7 +777,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe
if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats))
return r->tex[0];
c->BlurPass(r, taps, data, draw_bounds, tc, static_cast<F32>(c->h) / c->frametex_height, clamp, gstats);
c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats);
return g->TextureDrawBufferEnd(gstats);
}
@@ -829,7 +829,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo *
assert(clamp[0] <= clamp[2]);
assert(clamp[1] <= clamp[3]);
c->BlurPass(r, taps, data, &z, tc, static_cast<F32>(c->h) / c->frametex_height, clamp, gstats);
c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats);
return g->TextureDrawBufferEnd(gstats);
}
@@ -841,7 +841,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR
GDrawTexture *t;
F32 data[MAX_TAPS][4];
S32 off_axis = 1-axis;
S32 w = static_cast<S32>(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5
S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5
F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1
F32 inverse_weight = 1.0f / blur_width;
@@ -948,7 +948,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR
// max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample
// 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width,
// which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1)
S32 w_mip = static_cast<S32>(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)));
S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS));
S32 downsample = w_mip;
F32 sample_spacing = texel;
if (downsample < 2) downsample = 2;
@@ -1094,7 +1094,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment)
if (addr_aligned != addr_orig) {
S32 diff = (S32) (addr_aligned - addr_orig);
if (*num_bytes < diff) {
*start = nullptr;
*start = NULL;
*num_bytes = 0;
return;
} else {
@@ -1131,7 +1131,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align)
UINTa remaining = arena->end - arena->current;
UINTa total_size = (ptr - arena->current) + size;
if (remaining < total_size) // doesn't fit
return nullptr;
return NULL;
arena->current = ptr + size;
return ptr;
@@ -1156,7 +1156,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align)
// (i.e. block->next->prev == block->prev->next == block)
// - All allocated blocks are also kept in a hash table, indexed by their
// pointer (to allow free to locate the corresponding block_info quickly).
// There's a single-linked, nullptr-terminated list of elements in each hash
// There's a single-linked, NULL-terminated list of elements in each hash
// bucket.
// - The physical block list is ordered. It always contains all currently
// active blocks and spans the whole managed memory range. There are no
@@ -1165,7 +1165,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align)
// they are coalesced immediately.
// - The maximum number of blocks that could ever be necessary is allocated
// on initialization. All block_infos not currently in use are kept in a
// single-linked, nullptr-terminated list of unused blocks. Every block is either
// single-linked, NULL-terminated list of unused blocks. Every block is either
// in the physical block list or the unused list, and the total number of
// blocks is constant.
// These invariants always hold before and after an allocation/free.
@@ -1383,7 +1383,7 @@ static void gfxalloc_check2(gfx_allocator *alloc)
static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc)
{
GFXALLOC_ASSERT(alloc->unused_list != nullptr);
GFXALLOC_ASSERT(alloc->unused_list != NULL);
GFXALLOC_ASSERT(alloc->unused_list->is_unused);
GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);)
@@ -1456,7 +1456,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma
U32 i, max_blocks, size;
if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2
return nullptr;
return NULL;
// for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case:
// [free][used][free] .... [free][used][free]
@@ -1464,7 +1464,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma
size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info);
a = (gfx_allocator *) IggyGDrawMalloc(size);
if (!a)
return nullptr;
return NULL;
memset(a, 0, size);
@@ -1505,16 +1505,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma
a->blocks[i].is_unused = 1;
gfxalloc_check(a);
debug_complete_check(a, nullptr, 0,0);
debug_complete_check(a, NULL, 0,0);
return a;
}
static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes)
{
gfx_block_info *cur, *best = nullptr;
gfx_block_info *cur, *best = NULL;
U32 i, best_wasted = ~0u;
U32 size = size_in_bytes;
debug_complete_check(alloc, nullptr, 0,0);
debug_complete_check(alloc, NULL, 0,0);
gfxalloc_check(alloc);
GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);)
GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);)
@@ -1564,7 +1564,7 @@ gfxalloc_check(alloc);
debug_check_overlap(alloc->cache, best->ptr, best->size);
return best->ptr;
} else
return nullptr; // not enough space!
return NULL; // not enough space!
}
static void gfxalloc_free(gfx_allocator *alloc, void *ptr)
@@ -1734,7 +1734,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta
// (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle)
for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys)
if (!b->is_free)
b->prev = nullptr;
b->prev = NULL;
// go through all handles and store a pointer to the handle in the corresponding memory block
for (i=0; i < c->max_handles; i++)
@@ -1747,7 +1747,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta
break;
}
GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere!
GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere!
}
// clear alloc hash table (we rebuild it during defrag)
@@ -1909,7 +1909,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c)
static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats)
{
GDrawHandleCache *c = t->cache;
void *ptr = nullptr;
void *ptr = NULL;
assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned);
// anything we migrate should be in the "other" (old) pool
@@ -2299,7 +2299,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32
static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring)
{
ring->cur = nullptr;
ring->cur = NULL;
ring->seg_size = 0;
}
@@ -2309,7 +2309,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32
gdraw_bufring_seg *seg;
if (size > ring->seg_size)
return nullptr; // nope, won't fit
return NULL; // nope, won't fit
assert(align <= ring->align);
@@ -2414,7 +2414,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats)
// was it referenced since end of previous frame (=in this frame)?
// if some, we're thrashing; report it to the user, but only once per frame.
if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) {
IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory");
IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory");
c->is_thrashing = true;
}
@@ -2434,8 +2434,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t
{
if (t)
gdraw_HandleCacheAllocateFail(t);
IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type);
return nullptr;
IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type);
return NULL;
}
#ifndef GDRAW_MANAGE_MEM
@@ -2444,7 +2444,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
{
GDrawHandle *t;
if (size > c->total_bytes)
gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)");
gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)");
else {
// given how much data we're going to allocate, throw out
// data until there's "room" (this basically lets us use
@@ -2452,7 +2452,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
// packing it and being exact)
while (c->bytes_free < size) {
if (!gdraw_res_free_lru(c, stats)) {
gdraw_res_alloc_outofmem(c, nullptr, "memory");
gdraw_res_alloc_outofmem(c, NULL, "memory");
break;
}
}
@@ -2467,8 +2467,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
// we'd trade off cost of regenerating)
if (gdraw_res_free_lru(c, stats)) {
t = gdraw_HandleCacheAllocateBegin(c);
if (t == nullptr) {
gdraw_res_alloc_outofmem(c, nullptr, "handles");
if (t == NULL) {
gdraw_res_alloc_outofmem(c, NULL, "handles");
}
}
}
@@ -2512,7 +2512,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats)
{
GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current.
r->owner = nullptr;
r->owner = NULL;
gdraw_HandleCacheInsertDead(r);
gdraw_res_reap(r->cache, stats);
}
@@ -2520,11 +2520,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats)
static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats)
{
GDrawHandle *t;
void *ptr = nullptr;
void *ptr = NULL;
gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH();
if (size > c->total_bytes)
return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)");
return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)");
// now try to allocate a handle
t = gdraw_HandleCacheAllocateBegin(c);
@@ -2536,7 +2536,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
gdraw_res_free_lru(c, stats);
t = gdraw_HandleCacheAllocateBegin(c);
if (!t)
return gdraw_res_alloc_outofmem(c, nullptr, "handles");
return gdraw_res_alloc_outofmem(c, NULL, "handles");
}
// try to allocate first

View File

@@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive
IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats);
/* Draws a collection of indexed triangles, ignoring special filters or blend modes.
If buf is nullptr, then the pointers in 'prim' are machine pointers, and
If buf is NULL, then the pointers in 'prim' are machine pointers, and
you need to make a copy of the data (note currently all triangles
implementing strokes (wide lines) go this path).
If buf is non-nullptr, then use the appropriate vertex buffer, and the
If buf is non-NULL, then use the appropriate vertex buffer, and the
pointers in prim are actually offsets from the beginning of the
vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr;
vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL;
(note there are separate spaces for vertices and indices; e.g. the
first mesh in a given vertex buffer will normally have a 0 offset
for the vertices and a 0 offset for the indices)
@@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro
/* Ends specification of a new texture.
$:info The same handle initially passed to $gdraw_make_texture_begin
$:return Handle for the newly created texture, or nullptr if an error occured
$:return Handle for the newly created texture, or NULL if an error occured
*/
IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats);

View File

@@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo
$:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE
$:storage_size_in_bytes The size of the block pointer to by <tt>storage</tt>
Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer
can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP
Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer
can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP
which you can pass to $IggyUseExplorer. */
IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p);