diff --git a/engine/client/ref_common.h b/engine/client/ref_common.h index 687ae566..d16cd1fd 100644 --- a/engine/client/ref_common.h +++ b/engine/client/ref_common.h @@ -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 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 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 ); diff --git a/ref/vk/TODO.md b/ref/vk/TODO.md index 6dce8010..c3ababff 100644 --- a/ref/vk/TODO.md +++ b/ref/vk/TODO.md @@ -4,14 +4,19 @@ - [ ] devmem assert, not all textures are destroyed in wagonchik - [ ] new material names+fixme => move to material hash table - [x] preallocated default textures -- [ ] check mips - [x] check urmom stats after a few different changelevels - [x] COUNT(IS_DELETED) - [x] clusters size histogram +- [ ] silence logs + - [x] "accessing empty texture" + - [x] "found existing texture" + - [ ] .. +- [ ] check mips - [ ] massage texture code - [ ] single return/goto cleanup - [ ] pass args via structs? - [ ] collapse texture uploading into a single function +- [ ] why are there references to \*unused # 2023-10-26 E319 - [x] fix pbr materials disappearing diff --git a/ref/vk/r_textures.c b/ref/vk/r_textures.c index 2a94d714..e10009dd 100644 --- a/ref/vk/r_textures.c +++ b/ref/vk/r_textures.c @@ -1049,16 +1049,16 @@ struct vk_texture_s *R_TextureGetByIndex( uint index ) { ASSERT(index >= 0); ASSERT(index < MAX_TEXTURES); - //return g_vktextures.textures + index; - - vk_texture_t *const tex = g_textures.all + index; - if (!URMOM_IS_OCCUPIED(tex->hdr_)) - WARN("Accessing empty texture %d", index); - return tex; + return g_textures.all + index; } int R_TexturesGetParm( int parm, int 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){ case PARM_TEX_WIDTH: @@ -1088,6 +1088,7 @@ int R_TexturesGetParm( int parm, int arg ) { void R_TextureAcquire( unsigned int texnum ) { vk_texture_t *const tex = R_TextureGetByIndex(texnum); + ASSERT(URMOM_IS_OCCUPIED(tex->hdr_)); ++tex->refcount; DEBUG("Acquiring existing texture %s(%d) refcount=%d", TEX_NAME(tex), texnum, tex->refcount); diff --git a/ref/vk/vk_textures.c b/ref/vk/vk_textures.c index b5219737..1ca17ca1 100644 --- a/ref/vk/vk_textures.c +++ b/ref/vk/vk_textures.c @@ -512,7 +512,9 @@ qboolean R_VkTexturesSkyboxUpload( const char *name, rgbdata_t *const sides[6], VkDescriptorSet R_VkTextureGetDescriptorUnorm( uint index ) { ASSERT( index < MAX_TEXTURES ); // 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 ) {