stub render backend for tests; hoist out raddbg code/entry points from build target file, to be called into by sanity tests

This commit is contained in:
Ryan Fleury
2024-01-12 20:06:38 -08:00
parent 2078af15f9
commit b9a7b64280
11 changed files with 1405 additions and 1277 deletions
+3 -1
View File
@@ -4,7 +4,9 @@
#include "render_core.c"
#if LANG_CPP
# if R_BACKEND == R_BACKEND_D3D11
# if R_BACKEND == R_BACKEND_STUB
# include "stub/render_stub.cpp"
# elif R_BACKEND == R_BACKEND_D3D11
# include "d3d11/render_d3d11.cpp"
# else
# error Renderer backend not specified.
+4 -1
View File
@@ -7,6 +7,7 @@
////////////////////////////////
//~ rjf: Backend Constants
#define R_BACKEND_STUB 0
#define R_BACKEND_D3D11 1
////////////////////////////////
@@ -25,7 +26,9 @@
//~ rjf: Backend Includes
#if LANG_CPP
# if R_BACKEND == R_BACKEND_D3D11
# if R_BACKEND == R_BACKEND_STUB
# include "stub/render_stub.h"
# elif R_BACKEND == R_BACKEND_D3D11
# include "d3d11/render_d3d11.h"
# else
# error Renderer backend not specified.
+106
View File
@@ -0,0 +1,106 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
//- rjf: top-level layer initialization
r_hook void
r_init(CmdLine *cmdln)
{
}
//- rjf: window setup/teardown
r_hook R_Handle
r_window_equip(OS_Handle window)
{
R_Handle handle = {0};
handle.u64[0] = 1;
return handle;
}
r_hook void
r_window_unequip(OS_Handle window, R_Handle window_equip)
{
}
//- rjf: textures
r_hook R_Handle
r_tex2d_alloc(R_Tex2DKind kind, Vec2S32 size, R_Tex2DFormat format, void *data)
{
R_Handle handle = {0};
handle.u64[0] = 1;
return handle;
}
r_hook void
r_tex2d_release(R_Handle texture)
{
}
r_hook R_Tex2DKind
r_kind_from_tex2d(R_Handle texture)
{
return R_Tex2DKind_Static;
}
r_hook Vec2S32
r_size_from_tex2d(R_Handle texture)
{
return v2s32(1, 1);
}
r_hook R_Tex2DFormat
r_format_from_tex2d(R_Handle texture)
{
return R_Tex2DFormat_RGBA8;
}
r_hook void
r_fill_tex2d_region(R_Handle texture, Rng2S32 subrect, void *data)
{
}
//- rjf: buffers
r_hook R_Handle
r_buffer_alloc(R_BufferKind kind, U64 size, void *data)
{
R_Handle handle = {0};
handle.u64[0] = 1;
return handle;
}
r_hook void
r_buffer_release(R_Handle buffer)
{
}
//- rjf: frame markers
r_hook void
r_begin_frame(void)
{
}
r_hook void
r_end_frame(void)
{
}
r_hook void
r_window_begin_frame(OS_Handle window, R_Handle window_equip)
{
}
r_hook void
r_window_end_frame(OS_Handle window, R_Handle window_equip)
{
}
//- rjf: render pass submission
r_hook void
r_window_submit(OS_Handle window, R_Handle window_equip, R_PassList *passes)
{
}
+7
View File
@@ -0,0 +1,7 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef RENDER_STUB_H
#define RENDER_STUB_H
#endif // RENDER_STUB_H