mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +00:00
render: sync count of images with protocol max image count
This commit is contained in:
parent
6973181a21
commit
59e118ed26
16 changed files with 44 additions and 53 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
image_t gltextures[MAX_GLTEXTURES];
|
||||
image_t gltextures[MAX_TEXTURES];
|
||||
int numgltextures;
|
||||
static int image_max = 0;
|
||||
int base_textureid; /* gltextures[i] = base_textureid+i */
|
||||
|
@ -367,7 +367,8 @@ R_ImageList_f(void)
|
|||
"Total texel count (not counting mipmaps): %i\n",
|
||||
texels);
|
||||
freeup = R_ImageHasFreeSpace();
|
||||
R_Printf(PRINT_ALL, "Used %d of %d images%s.\n", used, image_max, freeup ? ", has free space" : "");
|
||||
R_Printf(PRINT_ALL, "Used %d of %d / %d images%s.\n",
|
||||
used, image_max, MAX_TEXTURES, freeup ? ", has free space" : "");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -892,9 +893,9 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
|||
|
||||
if (i == numgltextures)
|
||||
{
|
||||
if (numgltextures == MAX_GLTEXTURES)
|
||||
if (numgltextures == MAX_TEXTURES)
|
||||
{
|
||||
Com_Error(ERR_DROP, "%s: load %s is failed MAX_GLTEXTURES",
|
||||
Com_Error(ERR_DROP, "%s: load %s is failed MAX_TEXTURES",
|
||||
__func__, name);
|
||||
}
|
||||
|
||||
|
@ -1170,7 +1171,7 @@ R_ImageHasFreeSpace(void)
|
|||
}
|
||||
|
||||
// should same size of free slots as currently used
|
||||
return (numgltextures + used) < MAX_GLTEXTURES;
|
||||
return (numgltextures + used) < MAX_TEXTURES;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -60,12 +60,10 @@
|
|||
#define TEXNUM_LIGHTMAPS 1024
|
||||
#define TEXNUM_SCRAPS 1152
|
||||
#define TEXNUM_IMAGES 1153
|
||||
#define MAX_GLTEXTURES 1024
|
||||
#define MAX_SCRAPS 1
|
||||
#define BLOCK_WIDTH 256
|
||||
#define BLOCK_HEIGHT 256
|
||||
#define REF_VERSION "Yamagi Quake II OpenGL Refresher"
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
#define MAX_LIGHTMAPS 256
|
||||
#define GL_LIGHTMAP_FORMAT GL_RGBA
|
||||
|
||||
|
@ -121,7 +119,7 @@ typedef struct
|
|||
float r, g, b;
|
||||
} glvert_t;
|
||||
|
||||
extern image_t gltextures[MAX_GLTEXTURES];
|
||||
extern image_t gltextures[MAX_TEXTURES];
|
||||
extern int numgltextures;
|
||||
|
||||
extern image_t *r_notexture;
|
||||
|
|
|
@ -45,7 +45,7 @@ glmode_t modes[] = {
|
|||
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
||||
int gl_filter_max = GL_LINEAR;
|
||||
|
||||
gl3image_t gl3textures[MAX_GL3TEXTURES];
|
||||
gl3image_t gl3textures[MAX_TEXTURES];
|
||||
int numgl3textures = 0;
|
||||
static int image_max = 0;
|
||||
|
||||
|
@ -412,9 +412,9 @@ GL3_LoadPic(char *name, byte *pic, int width, int realwidth,
|
|||
|
||||
if (i == numgl3textures)
|
||||
{
|
||||
if (numgl3textures == MAX_GL3TEXTURES)
|
||||
if (numgl3textures == MAX_TEXTURES)
|
||||
{
|
||||
Com_Error(ERR_DROP, "MAX_GLTEXTURES");
|
||||
Com_Error(ERR_DROP, "MAX_TEXTURES");
|
||||
}
|
||||
|
||||
numgl3textures++;
|
||||
|
@ -738,7 +738,7 @@ GL3_ImageHasFreeSpace(void)
|
|||
}
|
||||
|
||||
// should same size of free slots as currently used
|
||||
return (numgl3textures + used) < MAX_GL3TEXTURES;
|
||||
return (numgl3textures + used) < MAX_TEXTURES;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -848,5 +848,6 @@ GL3_ImageList_f(void)
|
|||
|
||||
R_Printf(PRINT_ALL, "Total texel count (not counting mipmaps): %i\n", texels);
|
||||
freeup = GL3_ImageHasFreeSpace();
|
||||
R_Printf(PRINT_ALL, "Used %d of %d images%s.\n", used, image_max, freeup ? ", has free space" : "");
|
||||
R_Printf(PRINT_ALL, "Used %d of %d / %d images%s.\n",
|
||||
used, image_max, MAX_TEXTURES, freeup ? ", has free space" : "");
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
|
||||
gl3model_t mod_known[MAX_MOD_KNOWN];
|
||||
static gl3model_t mod_known[MAX_MOD_KNOWN];
|
||||
static int mod_numknown;
|
||||
static int mod_max = 0;
|
||||
|
||||
|
|
|
@ -37,9 +37,8 @@ static msurface_t *gl3_alpha_surfaces;
|
|||
|
||||
gl3lightmapstate_t gl3_lms;
|
||||
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
|
||||
extern gl3image_t gl3textures[MAX_GL3TEXTURES];
|
||||
extern gl3image_t gl3textures[MAX_TEXTURES];
|
||||
extern int numgl3textures;
|
||||
|
||||
void GL3_SurfInit(void)
|
||||
|
|
|
@ -309,8 +309,6 @@ typedef struct image_s
|
|||
|
||||
} gl3image_t;
|
||||
|
||||
enum {MAX_GL3TEXTURES = 1024};
|
||||
|
||||
// include this down here so it can use gl3image_t
|
||||
#include "model.h"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ glmode_t modes[] = {
|
|||
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
||||
int gl_filter_max = GL_LINEAR;
|
||||
|
||||
gl4image_t gl4textures[MAX_GL4TEXTURES];
|
||||
gl4image_t gl4textures[MAX_TEXTURES];
|
||||
int numgl4textures = 0;
|
||||
static int image_max = 0;
|
||||
|
||||
|
@ -413,9 +413,9 @@ GL4_LoadPic(char *name, byte *pic, int width, int realwidth,
|
|||
|
||||
if (i == numgl4textures)
|
||||
{
|
||||
if (numgl4textures == MAX_GL4TEXTURES)
|
||||
if (numgl4textures == MAX_TEXTURES)
|
||||
{
|
||||
Com_Error(ERR_DROP, "MAX_GLTEXTURES");
|
||||
Com_Error(ERR_DROP, "MAX_TEXTURES");
|
||||
}
|
||||
|
||||
numgl4textures++;
|
||||
|
@ -739,7 +739,7 @@ GL4_ImageHasFreeSpace(void)
|
|||
}
|
||||
|
||||
// should same size of free slots as currently used
|
||||
return (numgl4textures + used) < MAX_GL4TEXTURES;
|
||||
return (numgl4textures + used) < MAX_TEXTURES;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -849,5 +849,6 @@ GL4_ImageList_f(void)
|
|||
|
||||
R_Printf(PRINT_ALL, "Total texel count (not counting mipmaps): %i\n", texels);
|
||||
freeup = GL4_ImageHasFreeSpace();
|
||||
R_Printf(PRINT_ALL, "Used %d of %d images%s.\n", used, image_max, freeup ? ", has free space" : "");
|
||||
R_Printf(PRINT_ALL, "Used %d of %d / %d images%s.\n",
|
||||
used, image_max, MAX_TEXTURES, freeup ? ", has free space" : "");
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "header/local.h"
|
||||
|
||||
YQ2_ALIGNAS_TYPE(int) static byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
gl4model_t mod_known[MAX_MOD_KNOWN];
|
||||
static gl4model_t mod_known[MAX_MOD_KNOWN];
|
||||
static int mod_numknown;
|
||||
static int mod_max = 0;
|
||||
int registration_sequence;
|
||||
|
|
|
@ -37,9 +37,7 @@ static msurface_t *gl4_alpha_surfaces;
|
|||
|
||||
gl4lightmapstate_t gl4_lms;
|
||||
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
|
||||
extern gl4image_t gl4textures[MAX_GL4TEXTURES];
|
||||
extern gl4image_t gl4textures[MAX_TEXTURES];
|
||||
extern int numgl4textures;
|
||||
|
||||
void GL4_SurfInit(void)
|
||||
|
|
|
@ -301,8 +301,6 @@ typedef struct image_s
|
|||
|
||||
} gl4image_t;
|
||||
|
||||
enum {MAX_GL4TEXTURES = 1024};
|
||||
|
||||
// include this down here so it can use gl4image_t
|
||||
#include "model.h"
|
||||
|
||||
|
|
|
@ -86,7 +86,10 @@ typedef enum
|
|||
#define MAX_LBM_HEIGHT 480
|
||||
#define DEFAULT_NOLERP_LIST "pics/conchars.* pics/ch1.* pics/ch2. pics/ch3.*"
|
||||
#define DEFAULT_LMSHIFT 4
|
||||
#define MAX_MOD_KNOWN 512
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
|
||||
#define MAX_MOD_KNOWN (MAX_MODELS * 2)
|
||||
#define MAX_TEXTURES (MAX_IMAGES * 4)
|
||||
|
||||
extern void R_Printf(int level, const char* msg, ...) PRINTF_ATTR(2, 3);
|
||||
|
||||
|
@ -300,9 +303,9 @@ typedef struct bspxlgsamp_s
|
|||
|
||||
typedef struct bspxlgleaf_s
|
||||
{
|
||||
int mins[3];
|
||||
int size[3];
|
||||
bspxlgsamp_t *rgbvalues;
|
||||
int mins[3];
|
||||
int size[3];
|
||||
bspxlgsamp_t *rgbvalues;
|
||||
} bspxlgleaf_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -160,8 +160,6 @@ extern oldrefdef_t r_refdef;
|
|||
#define XCENTERING (1.0 / 2.0)
|
||||
#define YCENTERING (1.0 / 2.0)
|
||||
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
|
||||
#define NEAR_CLIP 0.01
|
||||
|
||||
#define ALIAS_Z_CLIP_PLANE 4
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
#define MAX_RIMAGES 1024
|
||||
static image_t *r_whitetexture_mip = NULL;
|
||||
static image_t r_images[MAX_RIMAGES];
|
||||
static image_t r_images[MAX_TEXTURES];
|
||||
static int numr_images;
|
||||
static int image_max = 0;
|
||||
|
||||
|
@ -82,7 +81,8 @@ R_ImageList_f (void)
|
|||
}
|
||||
R_Printf(PRINT_ALL, "Total texel count: %i\n", texels);
|
||||
freeup = R_ImageHasFreeSpace();
|
||||
R_Printf(PRINT_ALL, "Used %d of %d images%s.\n", used, image_max, freeup ? ", has free space" : "");
|
||||
R_Printf(PRINT_ALL, "Used %d of %d / %d images%s.\n",
|
||||
used, image_max, MAX_TEXTURES, freeup ? ", has free space" : "");
|
||||
}
|
||||
|
||||
//=======================================================
|
||||
|
@ -111,7 +111,7 @@ R_FindFreeImage(char *name)
|
|||
|
||||
if (i == numr_images)
|
||||
{
|
||||
if (numr_images == MAX_RIMAGES)
|
||||
if (numr_images == MAX_TEXTURES)
|
||||
Com_Error(ERR_DROP, "%s: Max images", __func__);
|
||||
numr_images++;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ R_ImageHasFreeSpace(void)
|
|||
}
|
||||
|
||||
// should same size of free slots as currently used
|
||||
return (numr_images + used) < MAX_RIMAGES;
|
||||
return (numr_images + used) < MAX_TEXTURES;
|
||||
}
|
||||
|
||||
static struct texture_buffer {
|
||||
|
|
|
@ -71,18 +71,13 @@ typedef struct image_s
|
|||
qvktexture_t vk_texture; /* Vulkan texture handle */
|
||||
} image_t;
|
||||
|
||||
#define MAX_VKTEXTURES 1024
|
||||
|
||||
//===================================================================
|
||||
|
||||
#include "model.h"
|
||||
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
|
||||
|
||||
//====================================================
|
||||
|
||||
extern image_t vktextures[MAX_VKTEXTURES];
|
||||
extern image_t vktextures[MAX_TEXTURES];
|
||||
extern int numvktextures;
|
||||
|
||||
extern image_t *r_notexture;
|
||||
|
|
|
@ -947,7 +947,7 @@ static void CreateDescriptorPool()
|
|||
// sampler
|
||||
{
|
||||
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
.descriptorCount = MAX_VKTEXTURES + 1
|
||||
.descriptorCount = MAX_TEXTURES + 1
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -955,7 +955,7 @@ static void CreateDescriptorPool()
|
|||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
|
||||
.maxSets = MAX_VKTEXTURES + 32,
|
||||
.maxSets = MAX_TEXTURES + 32,
|
||||
.poolSizeCount = sizeof(poolSizes) / sizeof(poolSizes[0]),
|
||||
.pPoolSizes = poolSizes,
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
image_t vktextures[MAX_VKTEXTURES];
|
||||
image_t vktextures[MAX_TEXTURES];
|
||||
int numvktextures = 0;
|
||||
static int img_loaded = 0;
|
||||
static int image_max = 0;
|
||||
|
@ -631,7 +631,8 @@ void Vk_ImageList_f (void)
|
|||
}
|
||||
R_Printf(PRINT_ALL, "Total texel count (not counting mipmaps): %i in %d images\n", texels, img_loaded);
|
||||
freeup = Vk_ImageHasFreeSpace();
|
||||
R_Printf(PRINT_ALL, "Used %d of %d images%s.\n", used, image_max, freeup ? ", has free space" : "");
|
||||
R_Printf(PRINT_ALL, "Used %d of %d / %d images%s.\n",
|
||||
used, image_max, MAX_TEXTURES, freeup ? ", has free space" : "");
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -1081,8 +1082,8 @@ Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
|||
|
||||
if (i == numvktextures)
|
||||
{
|
||||
if (numvktextures == MAX_VKTEXTURES)
|
||||
Com_Error(ERR_DROP, "%s: MAX_VKTEXTURES", __func__);
|
||||
if (numvktextures == MAX_TEXTURES)
|
||||
Com_Error(ERR_DROP, "%s: MAX_TEXTURES", __func__);
|
||||
numvktextures++;
|
||||
}
|
||||
image = &vktextures[i];
|
||||
|
@ -1281,7 +1282,7 @@ Vk_ImageHasFreeSpace(void)
|
|||
}
|
||||
|
||||
/* should same size of free slots as currently used */
|
||||
return (img_loaded + used) < MAX_VKTEXTURES;
|
||||
return (img_loaded + used) < MAX_TEXTURES;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue