Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More renderer debug logs #1331

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/engine/renderer/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6777,7 +6777,8 @@ void R_BuildCubeMaps()
}

// build the cubemap
cubeProbe->cubemap = R_AllocImage( Str::Format( "_autoCube%d", i ).c_str(), false );
std::string name = Str::Format( "_autoCube%d", i );
cubeProbe->cubemap = R_AllocImage( name.c_str(), false );

if ( !cubeProbe->cubemap )
{
Expand All @@ -6795,7 +6796,7 @@ void R_BuildCubeMaps()

imageParams_t imageParams = {};

R_UploadImage( ( const byte ** ) tr.cubeTemp, 6, 1, cubeProbe->cubemap, imageParams );
R_UploadImage( name.c_str(), ( const byte ** ) tr.cubeTemp, 6, 1, cubeProbe->cubemap, imageParams );
}

r_gpuOcclusionCulling.Set( gpuOcclusionCulling );
Expand Down
14 changes: 10 additions & 4 deletions src/engine/renderer/tr_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ level 1 has only numLayers/2 layers. There are still numLayers pointers in
the dataArray for every mip level, the unneeded elements at the end aren't used.
===============
*/
void R_UploadImage( const byte **dataArray, int numLayers, int numMips, image_t *image, const imageParams_t &imageParams )
void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int numMips, image_t *image, const imageParams_t &imageParams )
{
const byte *data;
byte *scaledBuffer = nullptr;
Expand Down Expand Up @@ -1022,6 +1022,8 @@ void R_UploadImage( const byte **dataArray, int numLayers, int numMips, image_t
}
}

Log::Debug( "Uploading image %s (%d×%d, %d layers, %0#x type, %0#x format)", name, scaledWidth, scaledHeight, numLayers, image->type, internalFormat );

// 3D textures are uploaded in slices via glTexSubImage3D,
// so the storage has to be allocated before the loop
if( image->type == GL_TEXTURE_3D ) {
Expand Down Expand Up @@ -1348,6 +1350,8 @@ R_AllocImage
*/
image_t *R_AllocImage( const char *name, bool linkIntoHashTable )
{
Log::Debug( "Allocating image %s", name );

image_t *image;
unsigned hash;

Expand Down Expand Up @@ -1405,6 +1409,8 @@ R_CreateImage
*/
image_t *R_CreateImage( const char *name, const byte **pic, int width, int height, int numMips, const imageParams_t &imageParams )
{
Log::Debug( "Creating image %s (%d×%d, %d mips)", name, width, height, numMips );

image_t *image;

image = R_AllocImage( name, true );
Expand All @@ -1424,7 +1430,7 @@ image_t *R_CreateImage( const char *name, const byte **pic, int width, int heigh
image->filterType = imageParams.filterType;
image->wrapType = imageParams.wrapType;

R_UploadImage( pic, 1, numMips, image, imageParams );
R_UploadImage( name, pic, 1, numMips, image, imageParams );

if( r_exportTextures->integer ) {
R_ExportTexture( image );
Expand Down Expand Up @@ -1505,7 +1511,7 @@ image_t *R_CreateCubeImage( const char *name, const byte *pic[ 6 ], int width, i
image->filterType = imageParams.filterType;
image->wrapType = imageParams.wrapType;

R_UploadImage( pic, 6, 1, image, imageParams );
R_UploadImage( name, pic, 6, 1, image, imageParams );

if( r_exportTextures->integer ) {
R_ExportTexture( image );
Expand Down Expand Up @@ -1552,7 +1558,7 @@ image_t *R_Create3DImage( const char *name, const byte *pic, int width, int heig
image->filterType = imageParams.filterType;
image->wrapType = imageParams.wrapType;

R_UploadImage( pics, numLayers, 1, image, imageParams );
R_UploadImage( name, pics, numLayers, 1, image, imageParams );

if( pics ) {
ri.Hunk_FreeTempMemory( pics );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -3205,7 +3205,7 @@ inline bool checkGLErrors()
qhandle_t RE_GenerateTexture( const byte *pic, int width, int height );

image_t *R_AllocImage( const char *name, bool linkIntoHashTable );
void R_UploadImage( const byte **dataArray, int numLayers, int numMips, image_t *image, const imageParams_t &imageParams );
void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int numMips, image_t *image, const imageParams_t &imageParams );

void RE_GetTextureSize( int textureID, int *width, int *height );

Expand Down
15 changes: 11 additions & 4 deletions src/engine/sys/sdl_glimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,14 @@ static bool LoadExt( int flags, bool hasExt, const char* name, bool test = true
{
if ( test )
{
logger.WithoutSuppression().Notice( "...using GL_%s", name );
if ( flags & ExtFlag_REQUIRED )
{
logger.WithoutSuppression().Notice( "...using required core extension GL_%s.", name );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is wrong, taking this branch doesn't mean it must be core

}
else
{
logger.WithoutSuppression().Notice( "...using optional core extension GL_%s.", name );
}

if ( glConfig2.glEnabledExtensionsString.length() != 0 )
{
Expand All @@ -1914,18 +1921,18 @@ static bool LoadExt( int flags, bool hasExt, const char* name, bool test = true
// Required extension can't be made optional
ASSERT( !( flags & ExtFlag_REQUIRED ) );

logger.WithoutSuppression().Notice( "...ignoring GL_%s", name );
logger.WithoutSuppression().Notice( "...ignoring optional core extension GL_%s.", name );
}
}
else
{
if ( flags & ExtFlag_REQUIRED )
{
Sys::Error( "Required extension GL_%s is missing.", name );
Sys::Error( "Missing required extension GL_%s.", name );
}
else
{
logger.WithoutSuppression().Notice( "...GL_%s not found.", name );
logger.WithoutSuppression().Notice( "...optional extension GL_%s not found", name );

if ( glConfig2.glMissingExtensionsString.length() != 0 )
{
Expand Down