1
0
Fork 0
forked from fte/fteqw

fix eukara's icons (he typoed), so they're actually used properly. use them for d3d renderers too.

ignore mip levels that don't match what gl/vk require.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5137 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-08-10 19:40:47 +00:00
parent 145666ac22
commit 2759632327
12 changed files with 84 additions and 32 deletions

View file

@ -942,6 +942,14 @@ void Con_PrintFlags(const char *txt, unsigned int setflags, unsigned int clearfl
{ {
setflags |= con_main.parseflags; setflags |= con_main.parseflags;
setflags &= ~clearflags; setflags &= ~clearflags;
// also echo to debugging console
Sys_Printf ("%s", txt); // also echo to debugging console
// log all messages to file
Con_Log (txt);
if (con_initialized)
Con_PrintCon(&con_main, txt, setflags); Con_PrintCon(&con_main, txt, setflags);
} }

View file

@ -2498,7 +2498,7 @@ static qboolean Image_ReadDDSFile(texid_t tex, unsigned int flags, char *fname,
} }
else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('2'<<24))) //dx3 with premultiplied alpha else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('2'<<24))) //dx3 with premultiplied alpha
{ {
// if (!(tex->flags & IF_PREMULTIPLYALPHA)) if (!(tex->flags & IF_PREMULTIPLYALPHA))
return false; return false;
encoding = PTI_S3RGBA3; encoding = PTI_S3RGBA3;
pad = 8; pad = 8;

View file

@ -833,6 +833,8 @@ console_t *Con_TextEditor(const char *fname, const char *line, qboolean newfile)
if (line) if (line)
Con_Editor_GoToLine(con, atoi(line)); Con_Editor_GoToLine(con, atoi(line));
else
Con_Editor_GoToLine(con, 1);
Con_Footerf(con, false, " ^2%i lines", con->linecount); Con_Footerf(con, false, " ^2%i lines", con->linecount);

View file

@ -85,24 +85,24 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
#ifdef CONFIG_FILE_NAME #ifdef CONFIG_FILE_NAME
IDI_ICON1 ICON BRANDING_ICON IDI_ICON1 ICON BRANDING_ICON
#elif defined(BRANDING_ICON) #elif defined(BRANDING_ICON)
IDI_ICON1 ICON BRANDING_ICON IDI_ICON1 ICON BRANDING_ICON
#if defined( _MSC_VER ) && ( _MSC_VER >= 1500 ) #if defined( _MSC_VER ) && ( _MSC_VER >= 1500 )
ID1_ICON2 ICON "fte_eukara.ico" IDI_ICON2 ICON "fte_eukara.ico"
#else
IDI_ICON2 ICON "fte_eukaranopng.ico"
#endif
IDI_ICON3 ICON "bymorphed.ico"
IDI_ICON4 ICON "q2.ico"
#else #else
ID1_ICON2 ICON "fte_eukaranopng.ico" #if defined( _MSC_VER ) && ( _MSC_VER >= 1500 )
#endif IDI_ICON1 ICON "fte_eukara.ico"
IDI_ICON3 ICON "bymorphed.ico" #else
IDI_ICON4 ICON "q2.ico" IDI_ICON1 ICON "fte_eukaranopng.ico"
#else #endif
#if defined( _MSC_VER ) && ( _MSC_VER >= 1500 ) IDI_ICON2 ICON "bymorphed.ico"
ID1_ICON1 ICON "fte_eukara.ico" IDI_ICON3 ICON "q2.ico"
#else
ID1_ICON1 ICON "fte_eukaranopng.ico"
#endif
IDI_ICON2 ICON "bymorphed.ico"
IDI_ICON3 ICON "q2.ico"
#endif #endif
#ifdef CONFIG_MANIFEST_TEXT #ifdef CONFIG_MANIFEST_TEXT

View file

@ -2480,8 +2480,6 @@ static void D3D9BE_GenBatchVBOs(vbo_t **vbochain, batch_t *firstbatch, batch_t *
index_t *vboedata; index_t *vboedata;
vbovdata_t *vbovdata; vbovdata_t *vbovdata;
vbo = Z_Malloc(sizeof(*vbo));
maxvboverts = 0; maxvboverts = 0;
maxvboelements = 0; maxvboelements = 0;
for(batch = firstbatch; batch != stopbatch; batch = batch->next) for(batch = firstbatch; batch != stopbatch; batch = batch->next)
@ -2496,6 +2494,10 @@ static void D3D9BE_GenBatchVBOs(vbo_t **vbochain, batch_t *firstbatch, batch_t *
if (maxvboverts > MAX_INDICIES) if (maxvboverts > MAX_INDICIES)
Sys_Error("Building a vbo with too many verticies\n"); Sys_Error("Building a vbo with too many verticies\n");
if (!maxvboelements)
return;
vbo = Z_Malloc(sizeof(*vbo));
IDirect3DDevice9_CreateIndexBuffer(pD3DDev9, sizeof(index_t) * maxvboelements, 0, D3DFMT_QINDEX, D3DPOOL_MANAGED, &ebuff, NULL); IDirect3DDevice9_CreateIndexBuffer(pD3DDev9, sizeof(index_t) * maxvboelements, 0, D3DFMT_QINDEX, D3DPOOL_MANAGED, &ebuff, NULL);
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, sizeof(*vbovdata) * maxvboverts, D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &vbuff, NULL); IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, sizeof(*vbovdata) * maxvboverts, D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &vbuff, NULL);

View file

@ -4,6 +4,7 @@
#include "renderque.h" #include "renderque.h"
#include "glquake.h" #include "glquake.h"
#include "resource.h"
#ifdef D3D9QUAKE #ifdef D3D9QUAKE
#include "winquake.h" #include "winquake.h"
@ -710,6 +711,7 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
DWORD wstyle; DWORD wstyle;
RECT rect; RECT rect;
MSG msg; MSG msg;
HICON hIcon = LoadIcon (global_hInstance, MAKEINTRESOURCE (IDI_ICON1));
//DDGAMMARAMP gammaramp; //DDGAMMARAMP gammaramp;
//int i; //int i;
@ -721,7 +723,7 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
0, 0,
0, 0,
NULL, NULL,
NULL, hIcon,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@ -1072,12 +1074,17 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
} }
#endif #endif
*/ */
D3D9_Set2D();
if (Media_ShowFilm()) if (Media_ShowFilm())
{ {
M_Draw(0); M_Draw(0);
// V_UpdatePalette (false); // V_UpdatePalette (false);
Media_RecordFrame(); Media_RecordFrame();
// R2D_BrightenScreen(); // R2D_BrightenScreen();
if (R2D_Flush)
R2D_Flush();
IDirect3DDevice9_EndScene(pD3DDev9); IDirect3DDevice9_EndScene(pD3DDev9);
D3D9_VID_SwapBuffers(); D3D9_VID_SwapBuffers();
return true; return true;
@ -1091,8 +1098,6 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
noworld = false; noworld = false;
nohud = false; nohud = false;
D3D9_Set2D();
#ifdef VM_CG #ifdef VM_CG
if (CG_Refresh()) if (CG_Refresh())
nohud = true; nohud = true;

View file

@ -5,6 +5,7 @@
#include "glquake.h" #include "glquake.h"
#include "shader.h" #include "shader.h"
#include "renderque.h" #include "renderque.h"
#include "resource.h"
#define COBJMACROS #define COBJMACROS
#include <d3d11.h> #include <d3d11.h>
@ -937,6 +938,7 @@ static qboolean D3D11_VID_Init(rendererstate_t *info, unsigned char *palette)
DWORD wstyle; DWORD wstyle;
RECT rect; RECT rect;
MSG msg; MSG msg;
HICON hIcon = LoadIcon (global_hInstance, MAKEINTRESOURCE (IDI_ICON1));
//DDGAMMARAMP gammaramp; //DDGAMMARAMP gammaramp;
//int i; //int i;
@ -948,7 +950,7 @@ static qboolean D3D11_VID_Init(rendererstate_t *info, unsigned char *palette)
0, 0,
0, 0,
NULL, NULL,
NULL, hIcon,
NULL, NULL,
NULL, NULL,
NULL, NULL,

View file

@ -2,6 +2,7 @@
#include "gl_draw.h" #include "gl_draw.h"
#include "shader.h" #include "shader.h"
#include "renderque.h" #include "renderque.h"
#include "resource.h"
#include "glquake.h" #include "glquake.h"
@ -750,6 +751,7 @@ static qboolean D3D8_VID_Init(rendererstate_t *info, unsigned char *palette)
DWORD wstyle; DWORD wstyle;
RECT rect; RECT rect;
MSG msg; MSG msg;
HICON hIcon = LoadIcon (global_hInstance, MAKEINTRESOURCE (IDI_ICON1));
//DDGAMMARAMP gammaramp; //DDGAMMARAMP gammaramp;
//int i; //int i;
@ -761,7 +763,7 @@ static qboolean D3D8_VID_Init(rendererstate_t *info, unsigned char *palette)
0, 0,
0, 0,
NULL, NULL,
NULL, hIcon,
NULL, NULL,
NULL, NULL,
NULL, NULL,

View file

@ -350,6 +350,20 @@ qboolean GL_LoadTextureMips(texid_t tex, struct pendingtextureinfo *mips)
qglTexParameteri(targ, GL_TEXTURE_WRAP_R, GL_REPEAT); qglTexParameteri(targ, GL_TEXTURE_WRAP_R, GL_REPEAT);
} }
if (targ == GL_TEXTURE_2D && mips->mipcount > 1)
{ //npot mipmapped textures are awkward.
//opengl floors.
for (i = 1; i < mips->mipcount; i++)
{
if (mips->mip[i].width != (mips->mip[i-1].width>>1) ||
mips->mip[i].height != (mips->mip[i-1].height>>1))
{ //okay, this mip looks like it was sized wrongly. this can easily happen with dds files made for direct3d.
mips->mipcount = i;
break;
}
}
}
//make sure the texture is complete even if the mips are not. //make sure the texture is complete even if the mips are not.
//note that some drivers will just ignore levels that are not valid. //note that some drivers will just ignore levels that are not valid.
//this means that we can't make this setting dynamic, so we might as well let the drivers know BEFORE we do the uploads, to be kind to those that are buggy.. //this means that we can't make this setting dynamic, so we might as well let the drivers know BEFORE we do the uploads, to be kind to those that are buggy..

View file

@ -856,7 +856,7 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, const char *fontfil
} }
error = FT_Err_Cannot_Open_Resource; error = FT_Err_Cannot_Open_Resource;
if (FS_FLocateFile(fontfilename, FSLF_IFFOUND, &loc)) if (FS_FLocateFile(fontfilename, FSLF_IFFOUND, &loc) || FS_FLocateFile(va("%s.ttf", fontfilename), FSLF_IFFOUND, &loc))
{ {
if (*loc.rawname && !loc.offset) if (*loc.rawname && !loc.offset)
{ {

View file

@ -4088,7 +4088,7 @@ static void BE_UploadLightmaps(qboolean force)
if (!lightmap[i]) if (!lightmap[i])
continue; continue;
if (force) if (force && !lightmap[i]->external)
{ {
lightmap[i]->rectchange.l = 0; lightmap[i]->rectchange.l = 0;
lightmap[i]->rectchange.t = 0; lightmap[i]->rectchange.t = 0;

View file

@ -1145,6 +1145,20 @@ qboolean VK_LoadTextureMips (texid_t tex, struct pendingtextureinfo *mips)
layers = (mips->type == PTI_CUBEMAP)?6:1; layers = (mips->type == PTI_CUBEMAP)?6:1;
if (layers == 1 && mips->mipcount > 1)
{ //npot mipmapped textures are awkward.
//vulkan floors.
for (i = 1; i < mips->mipcount; i++)
{
if (mips->mip[i].width != (mips->mip[i-1].width>>1) ||
mips->mip[i].height != (mips->mip[i-1].height>>1))
{ //okay, this mip looks like it was sized wrongly. this can easily happen with dds files.
mips->mipcount = i;
break;
}
}
}
switch(mips->encoding) switch(mips->encoding)
{ {
case PTI_RGB565: case PTI_RGB565:
@ -1314,12 +1328,15 @@ qboolean VK_LoadTextureMips (texid_t tex, struct pendingtextureinfo *mips)
uint32_t blockwidth = (mips->mip[i].width+blocksize-1) / blocksize; uint32_t blockwidth = (mips->mip[i].width+blocksize-1) / blocksize;
uint32_t blockheight = (mips->mip[i].height+blocksize-1) / blocksize; uint32_t blockheight = (mips->mip[i].height+blocksize-1) / blocksize;
if (mips->mip[i].data)
memcpy((char*)mapdata + bci.size, (char*)mips->mip[i].data, blockwidth*blockbytes*blockheight); memcpy((char*)mapdata + bci.size, (char*)mips->mip[i].data, blockwidth*blockbytes*blockheight);
else
memset((char*)mapdata + bci.size, 0, blockwidth*blockbytes*blockheight);
//queue up a buffer->image copy for this mip //queue up a buffer->image copy for this mip
region.bufferOffset = bci.size; region.bufferOffset = bci.size;
region.bufferRowLength = 0;//blockwidth*blockbytes; region.bufferRowLength = blockwidth*blocksize;//*blockbytes;
region.bufferImageHeight = 0;//blockheight; region.bufferImageHeight = blockheight*blocksize;
region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.imageSubresource.mipLevel = i%(mips->mipcount/layers); region.imageSubresource.mipLevel = i%(mips->mipcount/layers);
region.imageSubresource.baseArrayLayer = i/(mips->mipcount/layers); region.imageSubresource.baseArrayLayer = i/(mips->mipcount/layers);
@ -1327,8 +1344,8 @@ qboolean VK_LoadTextureMips (texid_t tex, struct pendingtextureinfo *mips)
region.imageOffset.x = 0; region.imageOffset.x = 0;
region.imageOffset.y = 0; region.imageOffset.y = 0;
region.imageOffset.z = 0; region.imageOffset.z = 0;
region.imageExtent.width = mips->mip[i].width; region.imageExtent.width = mips->mip[i].width;//blockwidth*blocksize;
region.imageExtent.height = mips->mip[i].height; region.imageExtent.height = mips->mip[i].height;//blockheight*blocksize;
region.imageExtent.depth = 1; region.imageExtent.depth = 1;
vkCmdCopyBufferToImage(vkloadcmd, fence->stagingbuffer, target.image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region); vkCmdCopyBufferToImage(vkloadcmd, fence->stagingbuffer, target.image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);