Fix outdated hlsl11 shaders.

Enable d3d11 renderer by default (in builds that already have a d3d9 renderer anyway).
Fix d3d11 + multisample.
fix some sdl issues.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4988 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-09-14 15:20:09 +00:00
parent da316ce374
commit 12dd83c20f
18 changed files with 120 additions and 62 deletions

View file

@ -58,6 +58,13 @@ ifneq (,$(BRANDING))
-include game_$(BRANDING).mak -include game_$(BRANDING).mak
endif endif
ifeq ($(BITS),64)
CC:=$(CC) -m64
endif
ifeq ($(BITS),32)
CC:=$(CC) -m32
endif
#correct the gcc build when cross compiling #correct the gcc build when cross compiling
ifneq (,$(findstring win32,$(FTE_TARGET))) ifneq (,$(findstring win32,$(FTE_TARGET)))
ifeq ($(shell $(CC) -v 2>&1 | grep mingw),) ifeq ($(shell $(CC) -v 2>&1 | grep mingw),)
@ -412,7 +419,7 @@ PROFILE_CFLAGS=-pg
DX7SDK=-I./libs/dxsdk7/include/ DX7SDK=-I./libs/dxsdk7/include/
GLCFLAGS?=-DGLQUAKE GLCFLAGS?=-DGLQUAKE
D3DCFLAGS?=-DD3D9QUAKE D3DCFLAGS?=-DD3D9QUAKE -DD3D11QUAKE
NPFTECFLAGS=-DNPFTE NPFTECFLAGS=-DNPFTE
SPEEXCFLAGS=-DSPEEX_STATIC -I$(BASE_DIR)/libs/speex/include -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" SPEEXCFLAGS=-DSPEEX_STATIC -I$(BASE_DIR)/libs/speex/include -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT=""
@ -722,8 +729,10 @@ GLCL_EXE_NAME=../fteqwcl_gl$(FTE_FULLTARGET)
#SDLCONFIG:=libs/sdl2_mingw/$(CC_MACHINE)/bin/sdl2-config --prefix=libs/sdl2_mingw/$(CC_MACHINE) #SDLCONFIG:=libs/sdl2_mingw/$(CC_MACHINE)/bin/sdl2-config --prefix=libs/sdl2_mingw/$(CC_MACHINE)
ifdef windir ifdef windir
GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs` GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
else else
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) `$(SDLCONFIG) --static-libs` GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) `$(SDLCONFIG) --static-libs`
M_LDFLAGS=$(MLDFLAGS) `$(SDLCONFIG) --static-libs` $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS)
endif endif
GL_CFLAGS=-DFTE_SDL $(GLCFLAGS) `$(SDLCONFIG) --cflags` GL_CFLAGS=-DFTE_SDL $(GLCFLAGS) `$(SDLCONFIG) --cflags`
GLB_DIR=gl_$(FTE_FULLTARGET) GLB_DIR=gl_$(FTE_FULLTARGET)
@ -743,13 +752,6 @@ MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd
M_CFLAGS=$(GLCFLAGS) `$(SDLCONFIG) --cflags` M_CFLAGS=$(GLCFLAGS) `$(SDLCONFIG) --cflags`
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS)
ifdef windir
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
else
#pthread is needed because of SDL.
M_LDFLAGS=$(MLDFLAGS) `$(SDLCONFIG) --static-libs` $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS)
endif
ifeq (,$(findstring NO_ZLIB,$(CFLAGS))) ifeq (,$(findstring NO_ZLIB,$(CFLAGS)))
SV_LDFLAGS+=-lz SV_LDFLAGS+=-lz
GL_LDFLAGS+=-lz GL_LDFLAGS+=-lz
@ -845,8 +847,12 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
GLCL_EXE_NAME=../fteqwcl_sdl$(BITS)$(EXEPOSTFIX) GLCL_EXE_NAME=../fteqwcl_sdl$(BITS)$(EXEPOSTFIX)
ifdef windir ifdef windir
GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs` GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
SV_LDFLAGS=$(MINGW_LIBS_DIR)/libz.a -lm -lmingw32 -lws2_32 -lwinmm `$(SDLCONFIG) --static-libs`
else else
GL_LDFLAGS=$(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `$(SDLCONFIG) --static-libs` GL_LDFLAGS=$(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `$(SDLCONFIG) --libs`
M_LDFLAGS=$(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) -lws2_32 -lmingw32 -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `$(SDL_CONFIG) --libs` $(IMAGELDFLAGS)
SV_LDFLAGS=$(MINGW_LIBS_DIR)/libz.a -lm -lmingw32 -lws2_32 -lwinmm `$(SDLCONFIG) --libs`
endif endif
GL_CFLAGS=-DFTE_SDL -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) -I$(LIBS_DIR) $(GLCFLAGS) -DLIBVORBISFILE_STATIC $(DX7SDK) $(SPEEXCFLAGS) GL_CFLAGS=-DFTE_SDL -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) -I$(LIBS_DIR) $(GLCFLAGS) -DLIBVORBISFILE_STATIC $(DX7SDK) $(SPEEXCFLAGS)
@ -860,7 +866,6 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) $(BOTLIB_OBJS) $(LTO_END) resources.o $(LTO_START) SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) $(BOTLIB_OBJS) $(LTO_END) resources.o $(LTO_START)
SV_EXE_NAME=../fteqw_sdl_sv$(BITS)$(EXEPOSTFIX) SV_EXE_NAME=../fteqw_sdl_sv$(BITS)$(EXEPOSTFIX)
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -DFTE_SDL SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -DFTE_SDL
SV_LDFLAGS=$(MINGW_LIBS_DIR)/libz.a -lm -lmingw32 -lws2_32 -lwinmm `$(SDLCONFIG) --static-libs`
MINGL_DIR=mingl_sdlwin$(BITS) MINGL_DIR=mingl_sdlwin$(BITS)
MINGL_EXE_NAME=../fteqw_sdl_mingl$(BITS)$(EXEPOSTFIX) MINGL_EXE_NAME=../fteqw_sdl_mingl$(BITS)$(EXEPOSTFIX)
@ -876,12 +881,6 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS)
ifdef windir
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 `$(SDLCONFIG) --static-libs`
else
#pthread is needed because of SDL.
M_LDFLAGS=$(IMAGELDFLAGS) $(OGGVORBISLDFLAGS) -lws2_32 -lmingw32 -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `$(SDL_CONFIG) --libs` $(IMAGELDFLAGS)
endif
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(SPEEX_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START) D3DCL_OBJS=$(D3DQUAKE_OBJS) $(SPEEX_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3d_sdl_qw$(BITS)$(EXEPOSTFIX) D3D_EXE_NAME=../fted3d_sdl_qw$(BITS)$(EXEPOSTFIX)

View file

@ -5345,7 +5345,7 @@ void Host_FinishLoading(void)
"\n" "\n"
"See the GNU General Public License for more details.\n"); "See the GNU General Public License for more details.\n");
#if defined(_WIN32) && defined(WEBCLIENT) #if defined(_WIN32) && !defined(FTE_SDL) && defined(WEBCLIENT)
if (Sys_RunInstaller()) if (Sys_RunInstaller())
Sys_Quit(); Sys_Quit();
#endif #endif

View file

@ -1762,7 +1762,7 @@ void S_Startup (void)
} }
if (!sndcardinfo && !nodefault) if (!sndcardinfo && !nodefault)
{ {
#ifdef _WIN32 #if defined(_WIN32) && !defined(FTE_SDL)
INS_SetupControllerAudioDevices(); INS_SetupControllerAudioDevices();
#endif #endif
if (!sndcardinfo) if (!sndcardinfo)

View file

@ -177,7 +177,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef AVAIL_JPEGLIB #undef AVAIL_JPEGLIB
#undef AVAIL_XZDEC #undef AVAIL_XZDEC
#if defined(_WIN32) && !defined(MULTITHREAD) //always thread on win32 non-minimal builds #if defined(_WIN32) && !defined(FTE_SDL) !defined(MULTITHREAD) //always thread on win32 non-minimal builds
#define MULTITHREAD #define MULTITHREAD
#endif #endif
#elif defined(MINIMAL) #elif defined(MINIMAL)
@ -280,7 +280,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VOICECHAT #define VOICECHAT
#if defined(_WIN32) && !defined(MULTITHREAD) //always thread on win32 non-minimal builds #if defined(_WIN32) && !defined(FTE_SDL) && !defined(MULTITHREAD) //always thread on win32 non-minimal builds
#define MULTITHREAD #define MULTITHREAD
#endif #endif
#endif #endif

View file

@ -3322,7 +3322,7 @@ void FS_ReloadPackFiles_f(void)
FS_BeginManifestUpdates(); FS_BeginManifestUpdates();
} }
#if defined(_WIN32) && !defined(WINRT) #if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT)
#include "winquake.h" #include "winquake.h"
#ifdef MINGW #ifdef MINGW
#define byte BYTE //some versions of mingw headers are broken slightly. this lets it compile. #define byte BYTE //some versions of mingw headers are broken slightly. this lets it compile.
@ -5071,7 +5071,7 @@ void COM_InitFilesystem (void)
usehome = false; usehome = false;
#if defined(_WIN32) && !defined(WINRT) #if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT)
{ //win32 sucks. { //win32 sucks.
HRESULT (WINAPI *dSHGetFolderPathW) (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, wchar_t *pszPath) = NULL; HRESULT (WINAPI *dSHGetFolderPathW) (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, wchar_t *pszPath) = NULL;
dllfunction_t funcs[] = dllfunction_t funcs[] =

View file

@ -632,4 +632,4 @@ searchpathfuncs_t *QDECL VFSW32_OpenPath(vfsfile_t *mustbenull, const char *desc
return &np->pub; return &np->pub;
} }
#endif #endif

View file

@ -12,7 +12,7 @@
#ifdef PLUGINS #ifdef PLUGINS
cvar_t plug_sbar = SCVAR("plug_sbar", "1"); cvar_t plug_sbar = CVARD("plug_sbar", "3", "Controls whether plugins are allowed to draw the hud, rather than the engine (when allowed by csqc). This is typically used to permit the ezhud plugin without needing to bother unloading it.\n=0: never use hud plugins.\n&1: Use hud plugins in deathmatch.\n&2: Use hud plugins in singleplayer/coop.\n=3: Always use hud plugins (when loaded).");
cvar_t plug_loaddefault = SCVAR("plug_loaddefault", "1"); cvar_t plug_loaddefault = SCVAR("plug_loaddefault", "1");
qintptr_t Plug_Bullet_Init(qintptr_t *args); qintptr_t Plug_Bullet_Init(qintptr_t *args);
@ -1641,6 +1641,7 @@ void Plug_SBar(playerview_t *pv)
plugin_t *oc=currentplug; plugin_t *oc=currentplug;
int ret; int ret;
int cleared = false; int cleared = false;
int hudmode;
if (!Sbar_ShouldDraw()) if (!Sbar_ShouldDraw())
{ {
@ -1649,7 +1650,11 @@ void Plug_SBar(playerview_t *pv)
} }
ret = 0; ret = 0;
if (!plug_sbar.ival) if (cl.deathmatch)
hudmode = 1;
else
hudmode = 2;
if (!(plug_sbar.ival & hudmode))
currentplug = NULL; currentplug = NULL;
else else
{ {

View file

@ -71,6 +71,7 @@ ID3D11RenderTargetView *fb_backbuffer;
ID3D11DepthStencilView *fb_backdepthstencil; ID3D11DepthStencilView *fb_backdepthstencil;
void *d3d11mod; void *d3d11mod;
static unsigned int d3d11multisample_count, d3d11multisample_quality;
qboolean vid_initializing; qboolean vid_initializing;
@ -635,8 +636,8 @@ static qboolean resetd3dbackbuffer(int width, int height)
t2ddesc.MipLevels = 1; t2ddesc.MipLevels = 1;
t2ddesc.ArraySize = 1; t2ddesc.ArraySize = 1;
t2ddesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; t2ddesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
t2ddesc.SampleDesc.Count = 1; t2ddesc.SampleDesc.Count = d3d11multisample_count;
t2ddesc.SampleDesc.Quality = 0; t2ddesc.SampleDesc.Quality = d3d11multisample_quality;
t2ddesc.Usage = D3D11_USAGE_DEFAULT; t2ddesc.Usage = D3D11_USAGE_DEFAULT;
t2ddesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; t2ddesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
t2ddesc.CPUAccessFlags = 0; t2ddesc.CPUAccessFlags = 0;
@ -701,7 +702,8 @@ static qboolean D3D11_VID_Init(rendererstate_t *info, unsigned char *palette)
scd.Height = info->height; scd.Height = info->height;
scd.Format = info->srgb?DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:DXGI_FORMAT_B8G8R8A8_UNORM; scd.Format = info->srgb?DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:DXGI_FORMAT_B8G8R8A8_UNORM;
scd.Stereo = info->stereo; scd.Stereo = info->stereo;
scd.SampleDesc.Count = 1+info->multisample; scd.SampleDesc.Count = d3d11multisample_count = max(1,info->multisample);
scd.SampleDesc.Quality = d3d11multisample_quality = (d3d11multisample_count>1)?D3D11_STANDARD_MULTISAMPLE_PATTERN:0;
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.BufferCount = 2+info->triplebuffer; //rt only supports fullscreen, so the frontbuffer needs to be created by us. scd.BufferCount = 2+info->triplebuffer; //rt only supports fullscreen, so the frontbuffer needs to be created by us.
scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
@ -779,7 +781,8 @@ static qboolean initD3D11Device(HWND hWnd, rendererstate_t *info, PFN_D3D11_CREA
scd.BufferDesc.Format = info->srgb?DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:DXGI_FORMAT_R8G8B8A8_UNORM; //32bit colour scd.BufferDesc.Format = info->srgb?DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:DXGI_FORMAT_R8G8B8A8_UNORM; //32bit colour
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.OutputWindow = hWnd; scd.OutputWindow = hWnd;
scd.SampleDesc.Count = 1+info->multisample; //as we're starting up windowed (and switching to fullscreen after), the frontbuffer is handled by windows. scd.SampleDesc.Count = d3d11multisample_count = max(1, info->multisample); //as we're starting up windowed (and switching to fullscreen after), the frontbuffer is handled by windows.
scd.SampleDesc.Quality = d3d11multisample_quality = (d3d11multisample_count>1)?D3D11_STANDARD_MULTISAMPLE_PATTERN:0;
scd.Windowed = TRUE; scd.Windowed = TRUE;
scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;// | DXGI_SWAP_CHAIN_FLAG_NONPREROTATED; scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;// | DXGI_SWAP_CHAIN_FLAG_NONPREROTATED;

View file

@ -724,7 +724,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"struct a2v\n" "struct a2v\n"
"{\n" "{\n"
"float4 pos: POSITION;\n" "float4 pos: POSITION;\n"
"float4 tc: TEXCOORD0;\n" "float2 tc: TEXCOORD0;\n"
"float3 normal: NORMAL;\n" "float3 normal: NORMAL;\n"
"};\n" "};\n"
"struct v2f\n" "struct v2f\n"
@ -1039,7 +1039,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"struct a2v\n" "struct a2v\n"
"{\n" "{\n"
"float4 pos: POSITION;\n" "float4 pos: POSITION;\n"
"float4 tc: TEXCOORD0;\n" "float2 tc: TEXCOORD0;\n"
"float4 vcol: COLOR0;\n" "float4 vcol: COLOR0;\n"
"};\n" "};\n"
"struct v2f\n" "struct v2f\n"
@ -1261,7 +1261,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"struct a2v\n" "struct a2v\n"
"{\n" "{\n"
"float4 pos: POSITION;\n" "float4 pos: POSITION;\n"
"float4 tc: TEXCOORD0;\n" "float2 tc: TEXCOORD0;\n"
"float2 lmtc: TEXCOORD1;\n"
"};\n" "};\n"
"struct v2f\n" "struct v2f\n"
"{\n" "{\n"
@ -1279,8 +1280,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"outp.pos = mul(m_model, inp.pos);\n" "outp.pos = mul(m_model, inp.pos);\n"
"outp.pos = mul(m_view, outp.pos);\n" "outp.pos = mul(m_view, outp.pos);\n"
"outp.pos = mul(m_projection, outp.pos);\n" "outp.pos = mul(m_projection, outp.pos);\n"
"outp.tc = inp.tc.xy;\n" "outp.tc = inp.tc;\n"
"outp.lmtc = inp.tc.zw;\n" "outp.lmtc = inp.lmtc;\n"
"return outp;\n" "return outp;\n"
"}\n" "}\n"
"#endif\n" "#endif\n"
@ -1289,17 +1290,17 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"Texture2D t_lightmap : register(t2);\n" "Texture2D t_lightmap : register(t2);\n"
"SamplerState s_lightmap : register(s2);\n" "SamplerState s_lightmap : register(s2);\n"
"Texture2D t_diffuse : register(s0);\n" "Texture2D t_diffuse : register(t0);\n"
"SamplerState s_diffuse : register(s0);\n" "SamplerState s_diffuse : register(s0);\n"
"Texture2D t_fullbright : register(s1);\n" "Texture2D t_fullbright : register(t1);\n"
"SamplerState s_fullbright : register(s1);\n" "SamplerState s_fullbright : register(s1);\n"
"float4 main (v2f inp) : SV_TARGET\n" "float4 main (v2f inp) : SV_TARGET\n"
"{\n" "{\n"
"float4 result;\n" "float4 result;\n"
"result = t_diffuse.Sample(s_diffuse, inp.tc);\n" "result = t_diffuse.Sample(s_diffuse, inp.tc);\n"
"result.rgb *= t_lightmap.Sample(s_lightmap, inp.lmtc).bgr * e_lmscale[0].rgb;\n" "result.rgb *= t_lightmap.Sample(s_lightmap, inp.lmtc).rgb * e_lmscale[0].rgb;\n"
"float4 fb = t_fullbright.Sample(s_fullbright, inp.tc);\n" "float4 fb = t_fullbright.Sample(s_fullbright, inp.tc);\n"
"result.rgb += fb.rgb * fb.a;//lerp(result.rgb, fb.rgb, fb.a);\n" "result.rgb += fb.rgb * fb.a;//lerp(result.rgb, fb.rgb, fb.a);\n"
"return result;\n" "return result;\n"
@ -1496,7 +1497,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"struct a2v\n" "struct a2v\n"
"{\n" "{\n"
"float4 pos: POSITION;\n" "float4 pos: POSITION;\n"
"float4 tc: TEXCOORD0;\n" "float2 tc: TEXCOORD0;\n"
"float2 lmtc: TEXCOORD1;\n"
"float3 norm: NORMAL;\n" "float3 norm: NORMAL;\n"
"};\n" "};\n"
"struct v2f\n" "struct v2f\n"
@ -1516,8 +1518,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"outp.pos = mul(m_model, inp.pos);\n" "outp.pos = mul(m_model, inp.pos);\n"
"outp.pos = mul(m_view, outp.pos);\n" "outp.pos = mul(m_view, outp.pos);\n"
"outp.pos = mul(m_projection, outp.pos);\n" "outp.pos = mul(m_projection, outp.pos);\n"
"outp.tc = inp.tc.xy;\n" "outp.tc = inp.tc;\n"
"outp.lmtc = inp.tc.zw;\n" "outp.lmtc = inp.lmtc;\n"
"outp.col = ((inp.norm.z<0.73)?float4(0.5, 0.5, 0.5, 1):float4(0.25, 0.25, 0.5, 1));\n" "outp.col = ((inp.norm.z<0.73)?float4(0.5, 0.5, 0.5, 1):float4(0.25, 0.25, 0.5, 1));\n"
"return outp;\n" "return outp;\n"
"}\n" "}\n"
@ -2358,7 +2360,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"struct a2v\n" "struct a2v\n"
"{\n" "{\n"
"float4 pos: POSITION;\n" "float4 pos: POSITION;\n"
"float4 tc: TEXCOORD0;\n" "float2 tc: TEXCOORD0;\n"
"float3 n: NORMAL;\n" "float3 n: NORMAL;\n"
"float3 s: TANGENT;\n" "float3 s: TANGENT;\n"
"float3 t: BINORMAL;\n" "float3 t: BINORMAL;\n"
@ -2840,7 +2842,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"struct a2v\n" "struct a2v\n"
"{\n" "{\n"
"float4 pos: POSITION;\n" "float4 pos: POSITION;\n"
"float4 tc: TEXCOORD0;\n" "float2 tc: TEXCOORD0;\n"
"float2 lmtc: TEXCOORD0;\n"
"float4 vcol: COLOR0;\n" "float4 vcol: COLOR0;\n"
"};\n" "};\n"
"struct v2f\n" "struct v2f\n"
@ -2862,8 +2865,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"outp.pos = mul(m_model, inp.pos);\n" "outp.pos = mul(m_model, inp.pos);\n"
"outp.pos = mul(m_view, outp.pos);\n" "outp.pos = mul(m_view, outp.pos);\n"
"outp.pos = mul(m_projection, outp.pos);\n" "outp.pos = mul(m_projection, outp.pos);\n"
"outp.tc = inp.tc.xy;\n" "outp.tc = inp.tc;\n"
"outp.lmtc = inp.tc.zw;\n" "outp.lmtc = inp.lmtc;\n"
"outp.vcol = inp.vcol;\n" "outp.vcol = inp.vcol;\n"
"return outp;\n" "return outp;\n"
"}\n" "}\n"
@ -2963,3 +2966,49 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#endif\n" "#endif\n"
}, },
#endif #endif
#ifdef D3D11QUAKE
{QR_DIRECT3D11, 11, "fixedemu",
"struct a2v\n"
"{\n"
"float4 pos: POSITION;\n"
"float2 tc: TEXCOORD0;\n"
"float4 vcol: COLOR0;\n"
"};\n"
"struct v2f\n"
"{\n"
"float4 pos: SV_POSITION;\n"
"float2 tc: TEXCOORD0;\n"
"float4 vcol: COLOR0;\n"
"};\n"
"#include <ftedefs.h>\n"
"#ifdef VERTEX_SHADER\n"
"v2f main (a2v inp)\n"
"{\n"
"v2f outp;\n"
"outp.pos = mul(m_model, inp.pos);\n"
"outp.pos = mul(m_view, outp.pos);\n"
"outp.pos = mul(m_projection, outp.pos);\n"
"outp.tc = inp.tc;\n"
"outp.vcol = inp.vcol;\n"
"return outp;\n"
"}\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"Texture2D t_t0 : register(t0);\n"
"SamplerState s_t0 : register(s0);\n"
"float4 main (v2f inp) : SV_TARGET\n"
"{\n"
"float4 tc = t_t0.Sample(s_t0, inp.tc).rgba;\n"
"tc.rgba *= inp.vcol.bgra;\n"
"#ifdef ALPHATEST\n"
"if (!(tc.a ALPHATEST))\n"
"discard;\n"
"#endif\n"
"return tc;\n"
"}\n"
"#endif\n"
},
#endif

View file

@ -435,7 +435,7 @@ reeval:
//Whilst the next block would technically be correct, we don't use it as it breaks too many quake mods. //Whilst the next block would technically be correct, we don't use it as it breaks too many quake mods.
#ifdef NOLEGACY #ifdef NOLEGACY
errorif (ed->isfree) errorif (ed->ereftype == ER_FREE)
{ {
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "assignment to free entity in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name))) if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "assignment to free entity in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement; return pr_xstatement;
@ -465,7 +465,7 @@ reeval:
NUM_FOR_EDICT(ed); // make sure it's in range NUM_FOR_EDICT(ed); // make sure it's in range
#endif #endif
#ifdef NOLEGACY #ifdef NOLEGACY
if (ed->isfree) if (ed->ereftype == ER_FREE)
{ {
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references free entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name))) if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references free entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement; return pr_xstatement;
@ -494,7 +494,7 @@ reeval:
NUM_FOR_EDICT(ed); // make sure it's in range NUM_FOR_EDICT(ed); // make sure it's in range
#endif #endif
#ifdef NOLEGACY #ifdef NOLEGACY
if (ed->isfree) if (ed->ereftype == ER_FREE)
{ {
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references free entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name))) if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references free entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement; return pr_xstatement;

View file

@ -119,7 +119,7 @@ typedef struct prinst_s
#define pr_depth prinst.pr_depth #define pr_depth prinst.pr_depth
int spushed; int spushed;
#define LOCALSTACK_SIZE 4096 #define LOCALSTACK_SIZE 16384
int localstack[LOCALSTACK_SIZE]; int localstack[LOCALSTACK_SIZE];
int localstack_used; int localstack_used;

View file

@ -426,7 +426,7 @@ static void QDECL Q1QVMPF_EntRemove(pubprogfuncs_t *pf, edict_t *e)
e->freetime = sv.time; e->freetime = sv.time;
} }
static edict_t *QDECL Q1QVMPF_EntAlloc(pubprogfuncs_t *pf) static edict_t *QDECL Q1QVMPF_EntAlloc(pubprogfuncs_t *pf, pbool object, size_t extrasize)
{ {
int i; int i;
edict_t *e; edict_t *e;
@ -594,7 +594,7 @@ static qintptr_t QVM_GetEntityToken (void *offset, quintptr_t mask, const qintpt
static qintptr_t QVM_Spawn_Ent (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_Spawn_Ent (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
return Q1QVMPF_EntAlloc(svprogfuncs)->entnum; return Q1QVMPF_EntAlloc(svprogfuncs, false, 0)->entnum;
} }
static qintptr_t QVM_Remove_Ent (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_Remove_Ent (void *offset, quintptr_t mask, const qintptr_t *arg)

View file

@ -1,7 +1,7 @@
struct a2v struct a2v
{ {
float4 pos: POSITION; float4 pos: POSITION;
float4 tc: TEXCOORD0; float2 tc: TEXCOORD0;
float3 normal: NORMAL; float3 normal: NORMAL;
}; };
struct v2f struct v2f

View file

@ -1,7 +1,7 @@
struct a2v struct a2v
{ {
float4 pos: POSITION; float4 pos: POSITION;
float4 tc: TEXCOORD0; float2 tc: TEXCOORD0;
float4 vcol: COLOR0; float4 vcol: COLOR0;
}; };
struct v2f struct v2f

View file

@ -1,7 +1,8 @@
struct a2v struct a2v
{ {
float4 pos: POSITION; float4 pos: POSITION;
float4 tc: TEXCOORD0; float2 tc: TEXCOORD0;
float2 lmtc: TEXCOORD1;
float3 norm: NORMAL; float3 norm: NORMAL;
}; };
struct v2f struct v2f
@ -21,8 +22,8 @@ struct v2f
outp.pos = mul(m_model, inp.pos); outp.pos = mul(m_model, inp.pos);
outp.pos = mul(m_view, outp.pos); outp.pos = mul(m_view, outp.pos);
outp.pos = mul(m_projection, outp.pos); outp.pos = mul(m_projection, outp.pos);
outp.tc = inp.tc.xy; outp.tc = inp.tc;
outp.lmtc = inp.tc.zw; outp.lmtc = inp.lmtc;
outp.col = ((inp.norm.z<0.73)?float4(0.5, 0.5, 0.5, 1):float4(0.25, 0.25, 0.5, 1)); outp.col = ((inp.norm.z<0.73)?float4(0.5, 0.5, 0.5, 1):float4(0.25, 0.25, 0.5, 1));
return outp; return outp;
} }

View file

@ -36,7 +36,7 @@
struct a2v struct a2v
{ {
float4 pos: POSITION; float4 pos: POSITION;
float4 tc: TEXCOORD0; float2 tc: TEXCOORD0;
float3 n: NORMAL; float3 n: NORMAL;
float3 s: TANGENT; float3 s: TANGENT;
float3 t: BINORMAL; float3 t: BINORMAL;

View file

@ -1,7 +1,8 @@
struct a2v struct a2v
{ {
float4 pos: POSITION; float4 pos: POSITION;
float4 tc: TEXCOORD0; float2 tc: TEXCOORD0;
float2 lmtc: TEXCOORD0;
float4 vcol: COLOR0; float4 vcol: COLOR0;
}; };
struct v2f struct v2f
@ -23,8 +24,8 @@ struct v2f
outp.pos = mul(m_model, inp.pos); outp.pos = mul(m_model, inp.pos);
outp.pos = mul(m_view, outp.pos); outp.pos = mul(m_view, outp.pos);
outp.pos = mul(m_projection, outp.pos); outp.pos = mul(m_projection, outp.pos);
outp.tc = inp.tc.xy; outp.tc = inp.tc;
outp.lmtc = inp.tc.zw; outp.lmtc = inp.lmtc;
outp.vcol = inp.vcol; outp.vcol = inp.vcol;
return outp; return outp;
} }

View file

@ -1,7 +1,7 @@
struct a2v struct a2v
{ {
float4 pos: POSITION; float4 pos: POSITION;
float4 tc: TEXCOORD0; float2 tc: TEXCOORD0;
}; };
struct v2f struct v2f
{ {
@ -19,8 +19,8 @@ struct v2f
outp.pos = mul(m_model, inp.pos); outp.pos = mul(m_model, inp.pos);
outp.pos = mul(m_view, outp.pos); outp.pos = mul(m_view, outp.pos);
outp.pos = mul(m_projection, outp.pos); outp.pos = mul(m_projection, outp.pos);
outp.tc = inp.tc.xy; outp.tc = inp.tc;
outp.lmtc = inp.tc.zw; outp.lmtc = inp.lmtc;
return outp; return outp;
} }
#endif #endif