Skip to content

Commit

Permalink
feat: add some sample zones for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Pollind <[email protected]>
  • Loading branch information
pollend committed Dec 21, 2024
1 parent 537ea36 commit e856958
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
max-parallel: 1
matrix:
config:
- { name: "Linux-x86_64-Release", type: "release", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1" }
- { name: "Linux-x86_64-Debug", type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1" }
- { name: "Linux-x86_64-Release", type: "release", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1 -DTRACY_ENABLE=0" }
- { name: "Linux-x86_64-Debug", type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1 -DTRACY_ENABLE=0" }
name: ${{ matrix.config.name }}
runs-on: ubuntu-22.04
container:
Expand Down Expand Up @@ -82,8 +82,8 @@ jobs:
max-parallel: 1
matrix:
config:
- { agent: "macos-12", name: "OSX-x86_64-Release", xcode-version: '13.4.1', type: "release", cmake_args: "-DBUILD_STEAMLIB=1" , build_folder: "Release" }
- { agent: "macos-12", name: "OSX-x86_64-Debug", xcode-version: '13.4.1', type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON", build_folder: "Debug" }
- { agent: "macos-12", name: "OSX-x86_64-Release", xcode-version: '13.4.1', type: "release", cmake_args: "-DBUILD_STEAMLIB=1 -DTRACY_ENABLE=0" , build_folder: "Release" }
- { agent: "macos-12", name: "OSX-x86_64-Debug", xcode-version: '13.4.1', type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON -DTRACY_ENABLE=0", build_folder: "Debug" }
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.agent }}
steps:
Expand Down Expand Up @@ -149,8 +149,8 @@ jobs:
max-parallel: 1
matrix:
config:
- { agent: "windows-latest", name: "win-x86_64-Release", vs_version: 'Visual Studio 17 2022', type: "release", cmake_args: "-DBUILD_STEAMLIB=1", build_folder: "Release" }
- { agent: "windows-latest", name: "win-x86_64-Debug", vs_version: 'Visual Studio 17 2022', type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON", build_folder: "Debug" }
- { agent: "windows-latest", name: "win-x86_64-Release", vs_version: 'Visual Studio 17 2022', type: "release", cmake_args: "-DBUILD_STEAMLIB=1 -DTRACY_ENABLE=0", build_folder: "Release" }
- { agent: "windows-latest", name: "win-x86_64-Debug", vs_version: 'Visual Studio 17 2022', type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON -DTRACY_ENABLE=0", build_folder: "Debug" }

name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.agent }}
Expand Down
14 changes: 11 additions & 3 deletions source/ref_nri/r_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "stb_ds.h"
#include "r_capture.h"
#include "tracy/TracyC.h"


static ref_frontend_t rrf;

Expand Down Expand Up @@ -200,6 +202,7 @@ rserr_t RF_Init( const char *applicationName, const char *screenshotPrefix, int

rserr_t RF_SetMode( int x, int y, int width, int height, int displayFrequency, bool fullScreen, bool stereo )
{
TracyCZone(ctx, 1);
rsh.nri.helperI.WaitForIdle( rsh.cmdQueue );

if( fullScreen ) {
Expand Down Expand Up @@ -327,6 +330,7 @@ rserr_t RF_SetMode( int x, int y, int width, int height, int displayFrequency, b

RB_Init();

TracyCZoneEnd(ctx);
return rserr_ok;
}

Expand Down Expand Up @@ -404,6 +408,7 @@ void RF_Shutdown( bool verbose )

static void RF_CheckCvars( void )
{
TracyCZone(ctx, 1);
// disallow bogus r_maxfps values, reset to default value instead
if( r_maxfps->modified ) {
if( r_maxfps->integer <= 0 ) {
Expand Down Expand Up @@ -459,10 +464,12 @@ static void RF_CheckCvars( void )
}
r_outlines_scale->modified = false;
}
TracyCZoneEnd(ctx);
}

void RF_BeginFrame( float cameraSeparation, bool forceClear, bool forceVsync )
{
TracyCZone(ctx, 1);
RF_CheckCvars();

// run cinematic passes on shaders
Expand Down Expand Up @@ -539,12 +546,10 @@ void RF_BeginFrame( float cameraSeparation, bool forceClear, bool forceVsync )

rrf.cameraSeparation = cameraSeparation;


memset( &rf.stats, 0, sizeof( rf.stats ) );

// update fps meter
// copy in changes from R_BeginFrame
// rrf.frame->BeginFrame( rrf.frame, cameraSeparation, forceClear, forceVsync );
const unsigned int time = ri.Sys_Milliseconds();
rf.fps.count++;
rf.fps.time = time;
Expand All @@ -557,7 +562,7 @@ void RF_BeginFrame( float cameraSeparation, bool forceClear, bool forceVsync )
rf.width2D = -1;
rf.height2D = -1;
R_Set2DMode(frame, true );

TracyCZoneEnd(ctx);
}

static inline void __R_PolyBlendPostPass(struct frame_cmd_buffer_s* frame) {
Expand Down Expand Up @@ -595,6 +600,7 @@ static inline void __R_ApplyBrightnessBlend(struct frame_cmd_buffer_s* frame) {

void RF_EndFrame( void )
{
TracyCZone(ctx, 1);
const uint32_t bufferedFrameIndex = rsh.swapchainCount % NUMBER_FRAMES_FLIGHT;
struct frame_cmd_buffer_s *frame = &rsh.frameCmds[bufferedFrameIndex];

Expand Down Expand Up @@ -727,6 +733,8 @@ void RF_EndFrame( void )

rsh.swapchainCount++;
rsh.frameCount++;

TracyCZoneEnd(ctx);
}

void RF_BeginRegistration( void )
Expand Down
23 changes: 21 additions & 2 deletions source/ref_nri/r_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "r_ktx_loader.h"
#include <assert.h>

#include <qstr.h>

#include "tracy/TracyC.h"

#define MAX_GLIMAGES 8192
#define IMAGES_HASH_SIZE 64
#define IMAGE_SAMPLER_HASH_SIZE 1024
Expand Down Expand Up @@ -700,6 +701,7 @@ static bool R_IsKTXFormatValid( int format, int type )
//TODO: move ktx loader to a seperate file
static bool __R_LoadKTX( image_t *image, const char *pathname )
{
TracyCZone(ctx, 1);
const uint_fast16_t numFaces = ( ( image->flags & IT_CUBEMAP ) ? 6 : 1 );
if( image->flags & ( IT_FLIPX|IT_FLIPY|IT_FLIPDIAGONAL ) )
return false;
Expand Down Expand Up @@ -867,10 +869,12 @@ static bool __R_LoadKTX( image_t *image, const char *pathname )
R_KTXFreeContext(&ktxContext);
R_FreeFile( buffer );
R_DeferDataSync();
TracyCZoneEnd(ctx);
return true;
error: // must not be reached after actually starting uploading the texture
R_KTXFreeContext(&ktxContext);
R_FreeFile( buffer );
TracyCZoneEnd(ctx);
return false;
}

Expand Down Expand Up @@ -1022,7 +1026,7 @@ static uint16_t __R_calculateMipMapLevel(int flags, int width, int height, uint3

struct image_s *R_LoadImage( const char *name, uint8_t **pic, int width, int height, int flags, int minmipsize, int tags, int samples )
{

TracyCZone(ctx, 1);
struct image_s *image = __R_AllocImage( qCToStrRef(name) );

image->width = width;
Expand Down Expand Up @@ -1105,6 +1109,7 @@ struct image_s *R_LoadImage( const char *name, uint8_t **pic, int width, int hei
}
}
arrfree( tmpBuffer );
TracyCZoneEnd(ctx);
return image;
}

Expand Down Expand Up @@ -1132,6 +1137,7 @@ image_t *R_CreateImage( const char *name, int width, int height, int layers, int

static void __FreeImage( struct frame_cmd_buffer_s *cmd, struct image_s *image )
{
TracyCZone(ctx, 1);
{
__FreeGPUImageData(cmd, image);
// R_ReleaseNriTexture(image);
Expand Down Expand Up @@ -1160,11 +1166,13 @@ static void __FreeImage( struct frame_cmd_buffer_s *cmd, struct image_s *image )
image->prev = NULL;
ri.Mutex_Unlock( r_imagesLock );
}
TracyCZoneEnd(ctx);

}

void R_ReplaceImage( image_t *image, uint8_t **pic, int width, int height, int flags, int minmipsize, int samples )
{
TracyCZone(ctx, 1);
assert( image );
assert( image->texture );
const NriTextureDesc* textureDesc = rsh.nri.coreI.GetTextureDesc(image->texture);
Expand Down Expand Up @@ -1207,13 +1215,15 @@ void R_ReplaceImage( image_t *image, uint8_t **pic, int width, int height, int f
image->minmipsize = minmipsize;

R_ReplaceSubImage(image, 0, 0, 0, pic, width, height);
TracyCZoneEnd(ctx);
}

/*
* R_ReplaceSubImage
*/
void R_ReplaceSubImage( image_t *image, int layer, int x, int y, uint8_t **pic, int width, int height )
{
TracyCZone(ctx, 1);
assert( image );
assert( image->texture );

Expand Down Expand Up @@ -1254,13 +1264,15 @@ void R_ReplaceSubImage( image_t *image, int layer, int x, int y, uint8_t **pic,
R_DeferDataSync();

image->registrationSequence = rsh.registrationSequence;
TracyCZoneEnd(ctx);
}

/*
* R_ReplaceImageLayer
*/
void R_ReplaceImageLayer( image_t *image, int layer, uint8_t **pic )
{
TracyCZone(ctx, 1);
assert( image );
assert( image->texture );

Expand Down Expand Up @@ -1301,6 +1313,7 @@ void R_ReplaceImageLayer( image_t *image, int layer, uint8_t **pic )
R_DeferDataSync();

image->registrationSequence = rsh.registrationSequence;
TracyCZoneEnd(ctx);
}

/*
Expand All @@ -1311,6 +1324,7 @@ void R_ReplaceImageLayer( image_t *image, int layer, uint8_t **pic )
*/
image_t *R_FindImage( const char *name, const char *suffix, int flags, int minmipsize, int tags )
{
TracyCZone(ctx, 1);
assert( name );
assert( name[0] );
struct UploadImgBuffer {
Expand Down Expand Up @@ -1577,6 +1591,7 @@ image_t *R_FindImage( const char *name, const char *suffix, int flags, int minmi
T_FreeTextureBuf(&uploads[i].buffer);
}
qStrFree(&resolvedPath);
TracyCZoneEnd(ctx);
return image;
}

Expand Down Expand Up @@ -1909,6 +1924,7 @@ void R_TouchImage( image_t *image, int tags )
*/
void R_FreeUnusedImagesByTags( int tags )
{
TracyCZone(ctx, 1);
int i;
image_t *image;
int keeptags = ~tags;
Expand All @@ -1931,6 +1947,7 @@ void R_FreeUnusedImagesByTags( int tags )

__FreeImage( R_ActiveFrameCmd(),image );
}
TracyCZoneEnd(ctx);
}

/*
Expand All @@ -1946,6 +1963,7 @@ void R_FreeUnusedImages( void )
*/
void R_ShutdownImages( void )
{
TracyCZone(ctx, 1);
int i;
image_t *image;

Expand Down Expand Up @@ -1977,6 +1995,7 @@ void R_ShutdownImages( void )
r_imagesPool = NULL;
r_screenShotBuffer = NULL;
r_screenShotBufferSize = 0;
TracyCZoneEnd(ctx);

}

9 changes: 7 additions & 2 deletions source/ref_nri/r_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "r_local.h"
#include "iqm.h"

#include "tracy/TracyC.h"

void Mod_LoadAliasMD3Model( model_t *mod, model_t *parent, void *buffer, bspFormatDesc_t *unused );
void Mod_LoadSkeletalModel( model_t *mod, model_t *parent, void *buffer, bspFormatDesc_t *unused );
void Mod_LoadQ3BrushModel( model_t *mod, model_t *parent, void *buffer, bspFormatDesc_t *format );
Expand Down Expand Up @@ -1288,6 +1290,7 @@ static void R_FinishMapConfig( const model_t *mod )
*/
void R_RegisterWorldModel( const char *model, const dvis_t *pvsData )
{
TracyCZone( ctx, 1 );
r_prevworldmodel = rsh.worldModel;
rsh.worldModel = NULL;
rsh.worldBrushModel = NULL;
Expand All @@ -1301,15 +1304,17 @@ void R_RegisterWorldModel( const char *model, const dvis_t *pvsData )
mod_isworldmodel = false;

if( !rsh.worldModel ) {
TracyCZoneEnd( ctx );
return;
}

// FIXME: this is ugly...
mapConfig = mod_mapConfigs[rsh.worldModel - mod_known];

R_TouchModel( rsh.worldModel );
rsh.worldBrushModel = ( mbrushmodel_t * )rsh.worldModel->extradata;
rsh.worldBrushModel->pvs = ( dvis_t * )pvsData;
rsh.worldBrushModel = (mbrushmodel_t *)rsh.worldModel->extradata;
rsh.worldBrushModel->pvs = (dvis_t *)pvsData;
TracyCZoneEnd( ctx );
}

/*
Expand Down
Loading

0 comments on commit e856958

Please sign in to comment.