2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// vid.h -- video driver defs
# define VID_CBITS 6
# define VID_GRADES (1 << VID_CBITS)
// a pixel can be one, two, or four bytes
typedef qbyte pixel_t ;
2016-07-12 00:40:13 +00:00
typedef enum
{
QR_NONE , //server-style operation (no rendering).
QR_HEADLESS , //no window/rendering at all (system tray only)
QR_OPENGL , //gl+gles+etc.
QR_DIRECT3D9 , //
QR_DIRECT3D11 , //
QR_SOFTWARE , //not worth using
QR_VULKAN , //
QR_DIRECT3D12 , //no implementation
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
QR_METAL , //no implementation
2018-04-19 17:30:39 +00:00
QR_DIRECT3D8 //liimted. available for win95 where d3d8.1+ does not. also only renderer supported on the original xbox, if that's ever relevant.
2016-07-12 00:40:13 +00:00
} r_qrenderer_t ;
2004-08-23 00:15:46 +00:00
typedef struct {
//you are not allowed to make anything not work if it's not based on these vars...
int width ;
int height ;
2015-01-21 18:18:37 +00:00
int fullscreen ; //0 = windowed. 1 = fullscreen (mode changes). 2 = borderless+maximized
2012-09-30 05:52:03 +00:00
qboolean stereo ;
2018-04-27 16:40:50 +00:00
int srgb ; //<0 = gamma-only. 0 = no srgb at all, >0 full srgb, including textures and stuff
2018-03-04 14:41:16 +00:00
int bpp ; //16, 24(aka 32), 30, and 48 are meaningful
2020-06-12 23:29:58 +00:00
int depthbits ;
2004-08-23 00:15:46 +00:00
int rate ;
2010-11-06 23:05:29 +00:00
int wait ; //-1 = default, 0 = off, 1 = on, 2 = every other
2006-03-15 20:48:48 +00:00
int multisample ; //for opengl antialiasing (which requires context stuff)
2011-06-17 01:54:54 +00:00
int triplebuffer ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
char subrenderer [ MAX_QPATH ] ; //external driver
char devicename [ MAX_QPATH ] ; //device name (usually monitor)
2010-02-06 01:25:04 +00:00
struct rendererinfo_s * renderer ;
2020-05-14 15:50:26 +00:00
struct plugvrfuncs_s * vr ; //the vr driver we're trying to use.
2004-08-23 00:15:46 +00:00
} rendererstate_t ;
2014-10-05 20:04:11 +00:00
# ifndef SERVERONLY
2010-10-02 02:25:39 +00:00
extern rendererstate_t currentrendererstate ;
2014-10-05 20:04:11 +00:00
# endif
2004-08-23 00:15:46 +00:00
typedef struct vrect_s
{
2013-08-21 07:14:39 +00:00
float x , y , width , height ;
2004-08-23 00:15:46 +00:00
} vrect_t ;
2013-11-21 23:02:28 +00:00
typedef struct
{
int x ;
int y ;
int width ;
int height ;
int maxheight ; //vid.pixelheight or so
} pxrect_t ;
2004-08-23 00:15:46 +00:00
2018-03-04 14:41:16 +00:00
//srgb colourspace displays smoother visual gradients, but its more of an illusion than anything else.
2021-04-14 05:21:04 +00:00
//we can be in a few different modes:
//linear - rendering is done using some float framebuffer or so. lighting is more correct. textures are converted from srgb colourspace when reading.
//non-linear - the lame option where lighting is wrong, but used anyway for compat. final colours will be whatever the screen uses (probably srgb, so artwork looks fine)
//srgb - like linear, except our framebuffer does extra transforms to hide that its storage is actually non-linear.
2018-03-04 14:41:16 +00:00
# define VID_SRGBAWARE (1u<<0) //we need to convert input srgb values to actual linear values (requires vid_reload to change...)
# define VID_SRGB_FB_LINEAR (1u<<1) //framebuffer is linear (either the presentation engine is linear, or the blend unit is faking it)
# define VID_SRGB_FB_FAKED (1u<<2) //renderer is faking it with a linear texture
# define VID_SRGB_CAPABLE (1u<<3) //we can toggle VID_SRGB_FB_LINEARISED on or off.
# define VID_FP16 (1u<<4) //use 16bit currentrender etc to avoid banding
# define VID_SRGB_FB (VID_SRGB_FB_LINEAR|VID_SRGB_FB_FAKED)
2004-08-23 00:15:46 +00:00
typedef struct
{
2016-02-10 23:23:43 +00:00
qboolean activeapp ;
2013-07-13 12:14:32 +00:00
qboolean isminimized ; //can omit rendering as it won't be seen anyway.
2004-08-23 00:15:46 +00:00
int fullbright ; // index of first fullbright color
2016-07-28 15:57:22 +00:00
int gammarampsize ; //typically 256. but can be up to 1024 (yay 10-bit hardware that's crippled to only actually use 8)
2009-11-04 21:16:50 +00:00
2016-07-26 11:47:59 +00:00
unsigned fbvwidth ; /*virtual 2d width of the current framebuffer image*/
2014-02-07 08:38:40 +00:00
unsigned fbvheight ; /*virtual 2d height*/
2016-07-26 11:47:59 +00:00
unsigned fbpwidth ; /*physical 2d width of the current framebuffer image*/
unsigned fbpheight ; /*physical 2d height*/
2015-08-11 09:14:33 +00:00
struct image_s * framebuffer ; /*the framebuffer fbo (set by democapture)*/
2014-02-07 08:38:40 +00:00
unsigned width ; /*virtual 2d screen width*/
unsigned height ; /*virtual 2d screen height*/
2004-08-23 00:15:46 +00:00
int numpages ;
2018-03-04 14:41:16 +00:00
unsigned int flags ; //VID_* flags
2007-05-25 22:16:29 +00:00
2011-02-25 04:22:14 +00:00
unsigned rotpixelwidth ; /*width after rotation in pixels*/
unsigned rotpixelheight ; /*pixel after rotation in pixels*/
unsigned pixelwidth ; /*true height in pixels*/
unsigned pixelheight ; /*true width in pixels*/
2016-02-10 23:23:43 +00:00
float dpi_x ;
float dpi_y ;
2018-11-27 16:48:19 +00:00
conchar_t * ime_preview ; //pending IME preview text that has been entered but isn't committed yet. set by video code.
size_t ime_previewlen ;
size_t ime_caret ;
float ime_position [ 2 ] ; //where to display any ime popups (virtual coords)
qboolean ime_allow ; //enable the ime (ie: at the console or messagemode)
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
qboolean forcecursor ;
float forcecursorpos [ 2 ] ; //in physical pixels
2020-05-14 15:50:26 +00:00
struct plugvrfuncs_s * vr ; //how do deal with VR contexts.
2004-08-23 00:15:46 +00:00
} viddef_t ;
extern viddef_t vid ; // global video state
extern unsigned int d_8to24rgbtable [ 256 ] ;
2018-03-04 14:41:16 +00:00
extern unsigned int d_8to24srgbtable [ 256 ] ;
2014-10-11 19:39:45 +00:00
extern unsigned int d_8to24bgrtable [ 256 ] ;
2018-03-04 14:41:16 +00:00
extern unsigned int d_quaketo24srgbtable [ 256 ] ;