vk: silence extra logs, add diagnostic checks

This commit is contained in:
Ivan Avdeev 2023-10-27 10:41:39 -04:00
parent eab46bfe20
commit 96864cf0bd
4 changed files with 17 additions and 9 deletions

View File

@ -41,7 +41,7 @@ void R_GetTextureParms( int *w, int *h, int texnum );
#define REF_GET_PARM( parm, arg ) ref.dllFuncs.RefGetParm( (parm), (arg) ) #define REF_GET_PARM( parm, arg ) ref.dllFuncs.RefGetParm( (parm), (arg) )
#define GL_LoadTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), false ) #define GL_LoadTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), false )
#define GL_UpdateTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), true ) #define GL_UpdateTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), true )
#define R_GetBuiltinTexture( name ) ref.dllFuncs.GL_LoadTexture( (name), 0, 0, 0 ) #define R_GetBuiltinTexture( name ) ref.dllFuncs.GL_FindTexture( (name) )
void GL_RenderFrame( const struct ref_viewpass_s *rvp ); void GL_RenderFrame( const struct ref_viewpass_s *rvp );

View File

@ -4,14 +4,19 @@
- [ ] devmem assert, not all textures are destroyed in wagonchik - [ ] devmem assert, not all textures are destroyed in wagonchik
- [ ] new material names+fixme => move to material hash table - [ ] new material names+fixme => move to material hash table
- [x] preallocated default textures - [x] preallocated default textures
- [ ] check mips
- [x] check urmom stats after a few different changelevels - [x] check urmom stats after a few different changelevels
- [x] COUNT(IS_DELETED) - [x] COUNT(IS_DELETED)
- [x] clusters size histogram - [x] clusters size histogram
- [ ] silence logs
- [x] "accessing empty texture"
- [x] "found existing texture"
- [ ] ..
- [ ] check mips
- [ ] massage texture code - [ ] massage texture code
- [ ] single return/goto cleanup - [ ] single return/goto cleanup
- [ ] pass args via structs? - [ ] pass args via structs?
- [ ] collapse texture uploading into a single function - [ ] collapse texture uploading into a single function
- [ ] why are there references to \*unused
# 2023-10-26 E319 # 2023-10-26 E319
- [x] fix pbr materials disappearing - [x] fix pbr materials disappearing

View File

@ -1049,16 +1049,16 @@ struct vk_texture_s *R_TextureGetByIndex( uint index )
{ {
ASSERT(index >= 0); ASSERT(index >= 0);
ASSERT(index < MAX_TEXTURES); ASSERT(index < MAX_TEXTURES);
//return g_vktextures.textures + index; return g_textures.all + index;
vk_texture_t *const tex = g_textures.all + index;
if (!URMOM_IS_OCCUPIED(tex->hdr_))
WARN("Accessing empty texture %d", index);
return tex;
} }
int R_TexturesGetParm( int parm, int arg ) { int R_TexturesGetParm( int parm, int arg ) {
const vk_texture_t *const tex = R_TextureGetByIndex( arg ); const vk_texture_t *const tex = R_TextureGetByIndex( arg );
if (!URMOM_IS_OCCUPIED(tex->hdr_))
WARN("%s: accessing empty texture %d", __FUNCTION__, arg);
if (!tex->ref_interface_visible)
return 0;
switch(parm){ switch(parm){
case PARM_TEX_WIDTH: case PARM_TEX_WIDTH:
@ -1088,6 +1088,7 @@ int R_TexturesGetParm( int parm, int arg ) {
void R_TextureAcquire( unsigned int texnum ) { void R_TextureAcquire( unsigned int texnum ) {
vk_texture_t *const tex = R_TextureGetByIndex(texnum); vk_texture_t *const tex = R_TextureGetByIndex(texnum);
ASSERT(URMOM_IS_OCCUPIED(tex->hdr_));
++tex->refcount; ++tex->refcount;
DEBUG("Acquiring existing texture %s(%d) refcount=%d", TEX_NAME(tex), texnum, tex->refcount); DEBUG("Acquiring existing texture %s(%d) refcount=%d", TEX_NAME(tex), texnum, tex->refcount);

View File

@ -512,7 +512,9 @@ qboolean R_VkTexturesSkyboxUpload( const char *name, rgbdata_t *const sides[6],
VkDescriptorSet R_VkTextureGetDescriptorUnorm( uint index ) { VkDescriptorSet R_VkTextureGetDescriptorUnorm( uint index ) {
ASSERT( index < MAX_TEXTURES ); ASSERT( index < MAX_TEXTURES );
// TODO make an array of unorm descriptors // TODO make an array of unorm descriptors
return R_TextureGetByIndex(index)->vk.descriptor_unorm; const vk_texture_t *const tex = R_TextureGetByIndex(index);
ASSERT(tex->vk.descriptor_unorm != VK_NULL_HANDLE);
return tex->vk.descriptor_unorm;
} }
const VkDescriptorImageInfo* R_VkTexturesGetAllDescriptorsArray( void ) { const VkDescriptorImageInfo* R_VkTexturesGetAllDescriptorsArray( void ) {