Working towards d3d+gl dual support again.

Fixed slow-rockets bug with high framerates.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3608 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-10-02 02:25:39 +00:00
parent 184954dd6f
commit 789197f58f
22 changed files with 1495 additions and 159 deletions

View file

@ -1841,7 +1841,7 @@ void CL_LinkPacketEntities (void)
if (state->lightpflags & PFLAGS_FULLDYNAMIC)
{
vec3_t colour;
if (!colour[0] && !colour[1] && !colour[2])
if (!state->light[0] && !state->light[1] && !state->light[2])
{
colour[0] = colour[1] = colour[2] = 1;
}

View file

@ -1869,7 +1869,7 @@ texid_t GL_LoadTextureDDS(unsigned char *buffer, int filesize)
if (!qglCompressedTexImage2DARB)
return r_nulltex;
texnum = GL_AllocNewTexture();
texnum = GL_AllocNewTexture(fmtheader.dwWidth, fmtheader.dwHeight);
GL_Bind(texnum);
datasize = fmtheader.dwPitchOrLinearSize;

View file

@ -150,7 +150,12 @@ void Draw_FunStringWidth(int x, int y, const void *str, int width);
// qbyte *Mod_LeafPVS (struct mleaf_s *leaf, struct model_s *model, qbyte *buffer);
#endif
typedef union {
unsigned int num;
#ifdef D3DQUAKE
void *ptr;
#endif
} texid_t;
typedef struct rendererinfo_s {
char *description;
@ -177,6 +182,15 @@ typedef struct rendererinfo_s {
void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic
void (*Draw_ImageColours) (float r, float g, float b, float a);
texid_t (*IMG_LoadTexture) (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags);
texid_t (*IMG_LoadTexture8Pal24) (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
texid_t (*IMG_LoadTexture8Pal32) (char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags);
texid_t (*IMG_LoadCompressed) (char *name);
texid_t (*IMG_FindTexture) (char *identifier);
texid_t (*IMG_AllocNewTexture) (int w, int h);
void (*IMG_Upload) (texid_t tex, char *name, enum uploadfmt fmt, void *data, void *palette, int width, int height, unsigned int flags);
void (*IMG_DestroyTexture) (texid_t tex);
void (*R_Init) (void);
void (*R_DeInit) (void);
void (*R_RenderView) (void); // must set r_refdef first
@ -216,3 +230,14 @@ typedef struct rendererinfo_s {
char *alignment;
} rendererinfo_t;
#define rf currentrendererstate.renderer
#define R_LoadTexture rf->IMG_LoadTexture
#define R_LoadTexture8Pal24 rf->IMG_LoadTexture8Pal24
#define R_LoadTexture8Pal32 rf->IMG_LoadTexture8Pal32
#define R_LoadCompressed rf->IMG_LoadCompressed
#define R_FindTexture rf->IMG_FindTexture
#define R_AllocNewTexture rf->IMG_AllocNewTexture
#define R_Upload rf->IMG_Upload
#define R_DestroyTexture rf->IMG_DestroyTexture

View file

@ -80,6 +80,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma warning( error : 4020)
#pragma warning(error:4013)
//msvc... shut the fuck up.
#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif

View file

@ -32,12 +32,6 @@ extern int r_framecount;
struct msurface_s;
struct batch_s;
typedef union {
unsigned int num;
#ifdef D3DQUAKE
void *ptr;
#endif
} texid_t;
static const texid_t r_nulltex = {0};
#define TEXVALID(t) ((t).num!=0)
@ -274,46 +268,15 @@ enum uploadfmt
TF_8PAL32
};
#if defined(GLQUAKE) && defined(D3DQUAKE)
#define R_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture8Pal32(skinname, width, height, data, palette, usemips, alpha):GL_LoadTexture8Pal32(skinname, width, height, data, palette, usemips, alpha))
#define R_LoadTexture8Pal24(skinname,width,height,data,palette,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture8Pal24(skinname, width, height, data, palette, usemips, alpha):GL_LoadTexture8Pal24(skinname, width, height, data, palette, usemips, alpha))
#define R_FindTexture(name) ((qrenderer == QR_DIRECT3D)?D3D_FindTexture(name):GL_FindTexture(name))
#define R_LoadCompressed(name) ((qrenderer == QR_DIRECT3D)?D3D_LoadCompressed(name):GL_LoadCompressed(name))
#elif defined(D3DQUAKE)
#define R_LoadTexture8Pal32 D3D_LoadTexture8Pal32
#define R_LoadTexture8Pal24 D3D_LoadTexture8Pal24
#define R_FindTexture D3D_FindTexture
#define R_LoadCompressed D3D_LoadCompressed
#define R_AllocNewTexture D3D_AllocNewTexture
#define R_Upload D3D_UploadFmt
#define R_LoadTexture D3D_LoadTextureFmt
#define R_DestroyTexture(tno) 0
#elif defined(GLQUAKE)
#define R_LoadTexture8Pal32 GL_LoadTexture8Pal32
#define R_LoadTexture8Pal24 GL_LoadTexture8Pal24
#define R_FindTexture GL_FindTexture
#define R_LoadCompressed GL_LoadCompressed
#define R_AllocNewTexture(w,h) GL_AllocNewTexture()
#define R_Upload GL_UploadFmt
#define R_LoadTexture GL_LoadTextureFmt
#define R_DestroyTexture GL_DestroyTexture
#endif
#define R_LoadTexture8(id,w,h,d,f,t) R_LoadTexture(id,w,h,t?TF_TRANS8:TF_SOLID8,d,f)
#define R_LoadTexture32(id,w,h,d,f) R_LoadTexture(id,w,h,TF_RGBA32,d,f)
#define R_LoadTextureFB(id,w,h,d,f) R_LoadTexture(id,w,h,TF_TRANS8_FULLBRIGHT,d,f)
#define R_LoadTexture32(id,w,h,d,f) R_LoadTexture(id,w,h,TF_RGBA32,d,f)
#define R_LoadTextureFB(id,w,h,d,f) R_LoadTexture(id,w,h,TF_TRANS8_FULLBRIGHT,d,f)
#define R_LoadTexture8BumpPal(id,w,h,d,f) R_LoadTexture(id,w,h,TF_HEIGHT8PAL,d,f)
#define R_LoadTexture8Bump(id,w,h,d,f) R_LoadTexture(id,w,h,TF_HEIGHT8,d,f)
#define R_LoadTexture8Bump(id,w,h,d,f) R_LoadTexture(id,w,h,TF_HEIGHT8,d,f)
/*it seems a little excessive to have to include glquake (and windows headers), just to load some textures/shaders for the backend*/
#ifdef GLQUAKE
texid_t GL_AllocNewTexture(void);
texid_t GL_AllocNewTexture(int w, int h);
void GL_UploadFmt(texid_t tex, char *name, enum uploadfmt fmt, void *data, void *palette, int width, int height, unsigned int flags);
texid_t GL_LoadTextureFmt (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags);
void GL_DestroyTexture(texid_t tex);

View file

@ -730,8 +730,6 @@ int (*Mod_SkinForName) (struct model_s *model, char *name);
int (*Mod_FrameForName) (struct model_s *model, char *name);
float (*Mod_GetFrameDuration) (struct model_s *model, int framenum);
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
void (*VID_DeInit) (void);
void (*VID_SetPalette) (unsigned char *palette);
@ -777,6 +775,15 @@ rendererinfo_t dedicatedrendererinfo = {
NULL, //Draw_Image
NULL, //Draw_ImageColours
NULL, //R_LoadTexture
NULL, //R_LoadTexture8Pal24
NULL, //R_LoadTexture8Pal32
NULL, //R_LoadCompressed
NULL, //R_FindTexture
NULL, //R_AllocNewTexture
NULL, //R_Upload
NULL, //R_DestroyTexture
NULL, //R_Init;
NULL, //R_DeInit;
NULL, //R_RenderView;

View file

@ -197,7 +197,9 @@ static BOOL (CALLBACK DSEnumCallback)(GUID FAR *guid, LPCSTR str1, LPCSTR str2,
*/
/* new formatTag:*/
#ifndef WAVE_FORMAT_EXTENSIBLE
# define WAVE_FORMAT_EXTENSIBLE (0xfffe)
#endif
/* Speaker Positions:*/
# define SPEAKER_FRONT_LEFT 0x1

View file

@ -38,6 +38,7 @@ typedef struct {
char glrenderer[MAX_QPATH];
struct rendererinfo_s *renderer;
} rendererstate_t;
extern rendererstate_t currentrendererstate;
typedef struct vrect_s
{

View file

@ -90,6 +90,9 @@ typedef struct
unsigned int shaderbits;
unsigned int lastpasscount;
mesh_t **meshlist;
unsigned int nummeshes;
D3DCOLOR passcolour;
IDirect3DVertexBuffer9 *dynxyz_buff;
@ -641,11 +644,13 @@ static void alphagenbyte(const shaderpass_t *pass, int cnt, const byte_vec4_t *s
}
}
static unsigned int BE_GenerateColourMods(unsigned int vertcount, const shaderpass_t *pass, const mesh_t *meshlist)
static unsigned int BE_GenerateColourMods(unsigned int vertcount, const shaderpass_t *pass)
{
/*
unsigned int ret = 0;
unsigned char *map;
const mesh_t *m;
unsigned int mno;
qboolean usearray;
if (pass->flags & SHADER_PASS_NOCOLORARRAY)
@ -659,8 +664,12 @@ static unsigned int BE_GenerateColourMods(unsigned int vertcount, const shaderpa
ret |= D3D_VDEC_COL4B;
allocvertexbuffer(shaderstate.dyncol_buff, &shaderstate.dyncol_offs, (void**)&map, vertcount*sizeof(D3DCOLOR));
for (m = meshlist, vertcount = 0; m; vertcount += m->numvertexes, m = m->next)
for (vertcount = 0, mno = 0; mno < shaderstate.nummeshes; mno++)
{
m = shaderstate.meshlist[mno];
memcpy((char*)map+vertcount*sizeof(D3DCOLOR), m->colors4b_array, m->numvertexes*sizeof(D3DCOLOR));
vertcount += m->numvertexes;
}
IDirect3DVertexBuffer9_Unlock(shaderstate.dyncol_buff);
IDirect3DDevice9_SetStreamSource(pD3DDev9, 1, shaderstate.dyncol_buff, shaderstate.dyncol_offs - vertcount*sizeof(D3DCOLOR), sizeof(D3DCOLOR));
}
@ -699,6 +708,7 @@ static unsigned int BE_GenerateColourMods(unsigned int vertcount, const shaderpa
IDirect3DDevice9_SetStreamSource(pD3DDev9, 1, NULL, 0, 0);
}
return ret;
*/
}
/*********************************************************************************************************/
/*========================================== texture coord generation =====================================*/
@ -856,6 +866,7 @@ static void tcmod(const tcmod_t *tcmod, int cnt, const float *src, float *dst, c
static void GenerateTCMods(const shaderpass_t *pass, float *dest, const mesh_t *meshlist)
{
/*
unsigned int fvertex = 0;
for (; meshlist; meshlist = meshlist->next)
{
@ -877,6 +888,7 @@ static void GenerateTCMods(const shaderpass_t *pass, float *dest, const mesh_t *
}
dest += meshlist->numvertexes*2;
}
*/
}
//end texture coords
@ -912,7 +924,7 @@ static void BE_DrawMeshChain_SetupPass(shaderpass_t *pass, unsigned int vertcoun
vdec = 0;
/*we only use one colour, generated from the first pass*/
vdec |= BE_GenerateColourMods(vertcount, pass, meshchain);
vdec |= BE_GenerateColourMods(vertcount, pass);
for (; passno < lastpass; passno++)
{
@ -945,8 +957,9 @@ static void BE_DrawMeshChain_SetupPass(shaderpass_t *pass, unsigned int vertcoun
D3DBE_ApplyShaderBits(pass->shaderbits);
}
static void BE_DrawMeshChain_Internal(mesh_t *meshchain)
static void BE_DrawMeshChain_Internal(void)
{
#ifdef FIXME
unsigned int vertcount, idxcount, idxfirst;
mesh_t *m;
void *map;
@ -987,15 +1000,17 @@ static void BE_DrawMeshChain_Internal(mesh_t *meshchain)
BE_DrawMeshChain_SetupPass(pass+passno, vertcount, meshchain);
IDirect3DDevice9_DrawIndexedPrimitive(pD3DDev9, D3DPT_TRIANGLELIST, 0, 0, vertcount, idxfirst, idxcount/3);
}
#endif
}
/*
void BE_DrawMeshChain(shader_t *shader, mesh_t *meshchain, vbo_t *vbo, texnums_t *texnums)
{
shaderstate.curshader = shader;
shaderstate.curtexnums = texnums;
BE_DrawMeshChain_Internal(meshchain);
}
shaderstate.meshlist = meshchain;
shaderstate.nummeshes = 1;
BE_DrawMeshChain_Internal();
}*/
void BE_SelectMode(backendmode_t mode, unsigned int flags)
{
@ -1174,6 +1189,7 @@ void BE_UploadAllLightmaps(void)
static void DrawSurfaceChain(msurface_t *s, shader_t *shader, vbo_t *vbo)
{ //doesn't merge surfaces, but tells gl to do each vertex arrayed surface individually, which means no vertex copying.
#ifdef FIXME
int i;
mesh_t *ml, *m;
@ -1270,6 +1286,7 @@ static void DrawSurfaceChain(msurface_t *s, shader_t *shader, vbo_t *vbo)
BE_DrawMeshChain_Internal(lightmap[i]->meshchain);
lightmap[i]->meshchain = NULL;
}
#endif
}
static void BE_BaseTextureChain(msurface_t *first)

View file

@ -292,13 +292,13 @@ static LRESULT WINAPI D3D9_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
{
if ((short) HIWORD(wParam) > 0)
{
Key_Event(K_MWHEELUP, 0, true);
Key_Event(K_MWHEELUP, 0, false);
Key_Event(0, K_MWHEELUP, 0, true);
Key_Event(0, K_MWHEELUP, 0, false);
}
else
{
Key_Event(K_MWHEELDOWN, 0, true);
Key_Event(K_MWHEELDOWN, 0, false);
Key_Event(0, K_MWHEELDOWN, 0, true);
Key_Event(0, K_MWHEELDOWN, 0, false);
}
}
break;
@ -595,8 +595,8 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
vid.pixelheight = height;
vid.recalc_refdef = true;
vid.width = vid.conwidth = width;
vid.height = vid.conheight = height;
vid.width = width;
vid.height = height;
// pDD->lpVtbl->QueryInterface ((void*)pDD, &IID_IDirectDrawGammaControl, (void**)&pGammaControl);
/* if (pGammaControl)
@ -656,20 +656,12 @@ resetD3D9();
/*a new model has been loaded*/
static void (D3D9_R_NewMap) (void)
{
int i;
r_worldentity.model = cl.worldmodel;
R_AnimateLight();
Surf_BuildLightmaps();
/*wipe any lingering particles*/
P_ClearParticles();
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
{
if (!cl.worldmodel->textures[i])
continue;
cl.worldmodel->textures[i]->texturechain = NULL;
}
}
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
@ -848,27 +840,26 @@ static void (D3D9_SCR_UpdateScreen) (void)
#pragma message("Fixme: remove the code from here...")
{
unsigned int ow = vid.width, oh = vid.height;
extern cvar_t vid_conwidth, vid_conheight, vid_conautoscale;
if (vid_conautoscale.value)
{
vid.conwidth = vid.pixelwidth*vid_conautoscale.value;
vid.conheight = vid.pixelheight*vid_conautoscale.value;
vid.width = vid.pixelwidth*vid_conautoscale.value;
vid.height = vid.pixelheight*vid_conautoscale.value;
}
else
{
vid.conwidth = vid_conwidth.value;
vid.conheight = vid_conheight.value;
vid.width = vid_conwidth.value;
vid.height = vid_conheight.value;
}
if (!vid.conwidth)
vid.conwidth = vid.pixelwidth;
if (!vid.conheight)
vid.conheight = vid.pixelheight;
if (!vid.width)
vid.width = vid.pixelwidth;
if (!vid.height)
vid.height = vid.pixelheight;
if (vid.width != vid.conwidth || vid.height != vid.conheight)
if (vid.width != ow || vid.height != oh)
vid.recalc_refdef = true;
vid.width = vid.conwidth;
vid.height = vid.conheight;
}
@ -1094,18 +1085,18 @@ static void D3D9_SetupViewPort(void)
screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height;
GL_InfinatePerspective(fov_x, fov_y, gl_mindist.value);
Matrix4_ModelViewMatrixFromAxis(r_view_matrix, vpn, vright, vup, r_refdef.vieworg);
Matrix4_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)r_projection_matrix);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)r_view_matrix);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)r_refdef.m_projection);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view);
}
static void (D3D9_R_RenderView) (void)
{
D3D9_SetupViewPort();
d3d9error(IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1, 0));
R_SetFrustum (r_projection_matrix, r_view_matrix);
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
Surf_DrawWorld();
P_DrawParticles ();
@ -1175,10 +1166,6 @@ rendererinfo_t d3drendererinfo =
D3D9_R_AddStain,
D3D9_R_LessenStains,
NULL,
NULL,
NULL,
RMod_Init,
RMod_ClearAll,
RMod_ForName,
@ -1197,12 +1184,6 @@ rendererinfo_t d3drendererinfo =
D3D9_VID_Init,
D3D9_VID_DeInit,
D3D9_VID_LockBuffer,
D3D9_VID_UnlockBuffer,
D3D9_D_BeginDirectRect,
D3D9_D_EndDirectRect,
D3D9_VID_ForceLockState,
D3D9_VID_ForceUnlockedAndReturnState,
D3D9_VID_SetPalette,
D3D9_VID_ShiftPalette,
D3D9_VID_GetRGBInfo,

View file

@ -45,11 +45,11 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|x64.Build.0 = D3DDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|Win32.ActiveCfg = Debug Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|Win32.Build.0 = Debug Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.ActiveCfg = GLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.Build.0 = GLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.ActiveCfg = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.Build.0 = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|Win32.ActiveCfg = MDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.ActiveCfg = MDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.Build.0 = MDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.ActiveCfg = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.Build.0 = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.ActiveCfg = GLDebug|x64
@ -60,8 +60,8 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.Build.0 = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|Win32.ActiveCfg = MDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|Win32.Build.0 = MDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|x64.ActiveCfg = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|x64.Build.0 = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|x64.ActiveCfg = MDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|x64.Build.0 = MDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|Win32.ActiveCfg = MinGLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|Win32.Build.0 = MinGLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|x64.ActiveCfg = MinGLDebug|x64
@ -84,39 +84,40 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|x64.Build.0 = GLRelease|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|x64.ActiveCfg = Debug|Win32

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,11 @@
#include "glquake.h"
#include "shader.h"
#ifdef _WIN32
#include <malloc.h>
#else
#include <alloca.h>
#endif
#define LIGHTPASS_GLSL_SHARED "\
varying vec2 tcbase;\n\
@ -453,6 +458,10 @@ void GL_SelectVBO(int vbo)
}
void GL_SelectEBO(int vbo)
{
extern cvar_t temp1;
if (temp1.ival && shaderstate.meshcount != 1)
vbo = 0;
#ifndef FORCESTATE
if (shaderstate.currentebo != vbo)
#endif
@ -698,7 +707,7 @@ static texid_t T_Gen_CurrentRender(void)
}
// copy the scene to texture
if (!TEXVALID(shaderstate.temptexture))
shaderstate.temptexture = GL_AllocNewTexture();
shaderstate.temptexture = GL_AllocNewTexture(vwidth, vheight);
GL_Bind(shaderstate.temptexture);
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, vwidth, vheight, 0);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@ -1887,6 +1896,48 @@ static void BE_SubmitMeshChain(void)
int m;
mesh_t *mesh;
if (!shaderstate.currentebo)
{
if (shaderstate.meshcount == 1)
{
mesh = shaderstate.meshes[0];
qglDrawRangeElements(GL_TRIANGLES, mesh->vbofirstvert, mesh->vbofirstvert+mesh->numvertexes, mesh->numindexes, GL_INDEX_TYPE, shaderstate.sourcevbo->indicies + mesh->vbofirstelement);
return;
}
else
{
index_t *ilst;
mesh = shaderstate.meshes[0];
startv = mesh->vbofirstvert;
endv = startv + mesh->numvertexes;
endi = mesh->numindexes;
for (m = 1; m < shaderstate.meshcount; m++)
{
mesh = shaderstate.meshes[m];
endi += mesh->numindexes;
if (startv > mesh->vbofirstvert)
startv = mesh->vbofirstvert;
if (endv < mesh->vbofirstvert+mesh->numvertexes)
endv = mesh->vbofirstvert+mesh->numvertexes;
}
ilst = alloca(endi*sizeof(index_t));
endi = 0;
for (m = 0; m < shaderstate.meshcount; m++)
{
mesh = shaderstate.meshes[m];
for (starti = 0; starti < mesh->numindexes; )
ilst[endi++] = mesh->vbofirstvert + mesh->indexes[starti++];
}
qglDrawRangeElements(GL_TRIANGLES, startv, endv, endi, GL_INDEX_TYPE, ilst);
}
return;
}
/*
if (qglLockArraysEXT)
{
@ -2925,7 +2976,6 @@ static void BE_UpdateLightmaps(void)
continue;
if (lightmap[lm]->modified)
{
extern cvar_t temp1;
glRect_t *theRect;
lightmap[lm]->modified = false;
theRect = &lightmap[lm]->rectchange;

View file

@ -192,7 +192,7 @@ void R_Bloom_InitTextures(void)
data = Z_Malloc(size);
memset(data, 255, size);
if (!TEXVALID(bs.tx_screen))
bs.tx_screen = GL_AllocNewTexture();
bs.tx_screen = GL_AllocNewTexture(bs.scr_w, bs.scr_h);
GL_Bind(bs.tx_screen);
qglTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, bs.scr_w, bs.scr_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View file

@ -381,7 +381,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
GL_EndRendering ();
GL_DoSwap();
cs_texture = GL_AllocNewTexture();
cs_texture = GL_AllocNewTexture(16, 16);
crosshair_shader = R_RegisterShader("crosshairshader",
"{\n"
@ -397,7 +397,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
GL_SetupSceneProcessingTextures();
// save a texture slot for translated picture
translate_texture = GL_AllocNewTexture();
translate_texture = GL_AllocNewTexture(0, 0);
//
// get the other pics we need
@ -2406,7 +2406,7 @@ TRACE(("dbg: GL_LoadTexture: new %s\n", identifier));
gltextures = glt;
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 8;
@ -2446,7 +2446,7 @@ texid_t GL_LoadTextureFB (char *identifier, int width, int height, qbyte *data,
gltextures = glt;
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 8;
@ -2479,7 +2479,7 @@ texid_t GL_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *da
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 24;
@ -2511,7 +2511,7 @@ texid_t GL_LoadTexture8Pal32 (char *identifier, int width, int height, qbyte *da
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 32;
@ -2545,7 +2545,7 @@ texid_t GL_LoadTexture32 (char *identifier, int width, int height, void *data, u
gltextures = glt;
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 32;
@ -2579,7 +2579,7 @@ texid_t GL_LoadTexture32_BGRA (char *identifier, int width, int height, unsigned
gltextures = glt;
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 32;
@ -2626,7 +2626,7 @@ texid_t GL_LoadCompressed(char *name)
gltextures = glt;
strcpy (glt->identifier, name);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(0, 0);
glt->bpp = 32;
glt->flags = 0;
@ -2661,7 +2661,7 @@ texid_t GL_LoadTexture8Grey (char *identifier, int width, int height, unsigned c
gltextures = glt;
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 8;
@ -2700,7 +2700,7 @@ texid_t GL_LoadTexture8Bump (char *identifier, int width, int height, unsigned c
gltextures = glt;
strcpy (glt->identifier, identifier);
glt->texnum = GL_AllocNewTexture();
glt->texnum = GL_AllocNewTexture(width, height);
glt->width = width;
glt->height = height;
glt->bpp = 8;

View file

@ -358,13 +358,13 @@ void GL_SetupSceneProcessingTextures (void)
scenepp_fisheye_texture = r_nulltex;
sceneblur_texture = GL_AllocNewTexture();
sceneblur_texture = GL_AllocNewTexture(0, 0);
if (!gl_config.arb_shader_objects)
return;
scenepp_texture_warp = GL_AllocNewTexture();
scenepp_texture_edge = GL_AllocNewTexture();
scenepp_texture_warp = GL_AllocNewTexture(0, 0);
scenepp_texture_edge = GL_AllocNewTexture(0, 0);
// init warp texture - this specifies offset in
for (y=0; y<PP_WARP_TEX_SIZE; y++)
@ -1638,7 +1638,7 @@ qboolean R_RenderScene_Fish(void)
if (!TEXVALID(scenepp_fisheye_texture))
{
scenepp_fisheye_texture = GL_AllocNewTexture();
scenepp_fisheye_texture = GL_AllocNewTexture(cmapsize, cmapsize);
qglDisable(GL_TEXTURE_2D);
qglEnable(GL_TEXTURE_CUBE_MAP_ARB);

View file

@ -245,7 +245,7 @@ void GLR_ReInit (void)
extern int gl_bumpmappingpossible;
netgraphtexture = GL_AllocNewTexture();
netgraphtexture = GL_AllocNewTexture(0, 0);
#if 0
if (gl_bumpmappingpossible)

View file

@ -1782,6 +1782,7 @@ void Shader_Shutdown (void)
void Shader_SetBlendmode (shaderpass_t *pass)
{
#ifdef GLQUAKE /*FIXME: move to backnd*/
if (pass->texgen == T_GEN_DELUXMAP)
{
pass->blendmode = GL_DOT3_RGB_ARB;
@ -1820,6 +1821,7 @@ void Shader_SetBlendmode (shaderpass_t *pass)
pass->blendmode = GL_DECAL;
else
pass->blendmode = GL_MODULATE;
#endif
}
void Shader_Readpass (shader_t *shader, char **ptr)

View file

@ -1395,7 +1395,7 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis)
if (!TEXVALID(l->stexture))
{
l->stexture = GL_AllocNewTexture();
l->stexture = GL_AllocNewTexture(smsize, smsize);
checkerror();

View file

@ -304,7 +304,7 @@ qboolean GL_CheckExtension(char *extname)
return !!strstr(gl_extensions, extname);
}
texid_t GL_AllocNewTexture(void)
texid_t GL_AllocNewTexture(int w, int h)
{
texid_t r;
qglGenTextures(1, &r.num);
@ -984,6 +984,15 @@ rendererinfo_t openglrendererinfo = {
R2D_Image,
R2D_ImageColours,
GL_LoadTextureFmt,
GL_LoadTexture8Pal24,
GL_LoadTexture8Pal32,
GL_LoadCompressed,
GL_FindTexture,
GL_AllocNewTexture,
GL_UploadFmt,
GL_DestroyTexture,
GLR_Init,
GLR_DeInit,
GLR_RenderView,

View file

@ -3361,6 +3361,8 @@ void SV_Frame (void)
svs.stats.idle += start - end;
end = start;
svs.framenum++;
if (svs.framenum > 0x10000)
svs.framenum = 0;
// keep the random time dependent
rand ();

View file

@ -1836,7 +1836,7 @@ void SV_RunEntity (edict_t *ent)
}
else
{
if (ent->v->lastruntime == svs.framenum)
if ((unsigned int)ent->v->lastruntime == svs.framenum)
return;
ent->v->lastruntime = svs.framenum;
}