2013-07-29 17:36:44 +00:00
/*
Copyright spike . GNU GPL V2 . etc .
Much of this file and the parser derives originally from qfusion by vic .
Quake1 rendering works by :
Draw everything in depth order and stall lots from switching textures .
draw transparent water surfaces last .
Quake3 rendering works by :
generate a batch for every model + shader in the world .
sort batches by shader sort key , entity , shader .
draw surfaces .
Doom3 rendering works by :
generate a batch for every model + shader in the world .
sort batches by shader sort key , entity , shader .
depth is drawn ( yay alpha masked surfaces )
for each light + batch
draw each bump / diffuse / specular stage . combine to one pass if that ordering is not maintained . switch diffuse / specular if needed
ambient stages from each batch are added over the top .
FTE rtlight rendering works by :
generate a batch for every model + shader in the world .
sort batches by shader sort key , entity , shader .
draw surfaces . if rtworld_lightmaps is 0 and there ' s no additive stuff , draw as black , otherwise just scale lightmap passes .
lights are then added over the top based upon the diffusemap , bumpmap and specularmap , and without any pass - specific info ( no tcmods ) .
*/
2010-03-14 14:35:56 +00:00
# ifndef SHADER_H
# define SHADER_H
2019-03-12 05:04:27 +00:00
struct shaderparsestate_s ;
typedef void ( shader_gen_t ) ( struct shaderparsestate_s * ps , const char * name , const void * args ) ;
2009-11-04 21:16:50 +00:00
2012-11-27 03:23:19 +00:00
# define SHADER_TMU_MAX 16
2015-05-03 19:57:46 +00:00
# define SHADER_PASS_MAX 16
2004-08-23 00:15:46 +00:00
# define SHADER_MAX_TC_MODS 8
# define SHADER_DEFORM_MAX 8
2013-06-23 02:17:02 +00:00
# define SHADER_MAX_ANIMFRAMES 16
2004-10-19 16:10:14 +00:00
typedef enum {
SHADER_BSP ,
SHADER_BSP_VERTEX ,
SHADER_BSP_FLARE ,
SHADER_MD3 ,
SHADER_2D
} shadertype_t ;
2014-03-30 08:55:06 +00:00
/*
2004-10-19 16:10:14 +00:00
typedef enum {
MF_NONE = 1 < < 0 ,
MF_NORMALS = 1 < < 1 ,
MF_TRNORMALS = 1 < < 2 ,
MF_COLORS = 1 < < 3 ,
MF_STCOORDS = 1 < < 4 ,
MF_LMCOORDS = 1 < < 5 ,
MF_NOCULL = 1 < < 6 ,
MF_NONBATCHED = 1 < < 7
} meshfeatures_t ;
2014-03-30 08:55:06 +00:00
*/
2004-08-23 00:15:46 +00:00
//colour manipulation
typedef struct
{
enum {
SHADER_FUNC_SIN ,
SHADER_FUNC_TRIANGLE ,
SHADER_FUNC_SQUARE ,
SHADER_FUNC_SAWTOOTH ,
SHADER_FUNC_INVERSESAWTOOTH ,
2004-10-19 16:10:14 +00:00
SHADER_FUNC_NOISE ,
SHADER_FUNC_CONSTANT
2004-08-23 00:15:46 +00:00
} type ; // SHADER_FUNC enum
float args [ 4 ] ; // offset, amplitude, phase_offset, rate
} shaderfunc_t ;
//tecture coordinate manipulation
typedef struct
{
enum {
SHADER_TCMOD_NONE , //bug
SHADER_TCMOD_SCALE , //some sorta tabled deformation
SHADER_TCMOD_SCROLL , //boring moving texcoords with time
SHADER_TCMOD_STRETCH , //constant factor
2004-10-19 16:10:14 +00:00
SHADER_TCMOD_ROTATE ,
SHADER_TCMOD_TRANSFORM ,
2017-08-14 16:38:44 +00:00
SHADER_TCMOD_TURB ,
SHADER_TCMOD_PAGE //use a texture atlas. horizontal frames, vertical frames, time divisor
2004-08-23 00:15:46 +00:00
} type ;
float args [ 6 ] ;
} tcmod_t ;
//vertex positioning manipulation.
typedef struct
{
enum {
DEFORMV_NONE , //bug
DEFORMV_MOVE ,
DEFORMV_WAVE ,
DEFORMV_NORMAL ,
DEFORMV_BULGE ,
DEFORMV_AUTOSPRITE ,
DEFORMV_AUTOSPRITE2 ,
2018-01-22 19:18:04 +00:00
DEFORMV_PROJECTION_SHADOW ,
DEFORMV_TEXT
2004-08-23 00:15:46 +00:00
} type ;
float args [ 4 ] ;
shaderfunc_t func ;
} deformv_t ;
2009-11-04 21:16:50 +00:00
enum
{
/*source and dest factors match each other for easier parsing
but they ' re not meant to ever be set on the shader itself
NONE is also invalid , and is used to signify disabled , it should never be set on only one
*/
SBITS_SRCBLEND_NONE = 0x00000000 ,
SBITS_SRCBLEND_ZERO = 0x00000001 ,
SBITS_SRCBLEND_ONE = 0x00000002 ,
SBITS_SRCBLEND_DST_COLOR = 0x00000003 ,
SBITS_SRCBLEND_ONE_MINUS_DST_COLOR = 0x00000004 ,
SBITS_SRCBLEND_SRC_ALPHA = 0x00000005 ,
SBITS_SRCBLEND_ONE_MINUS_SRC_ALPHA = 0x00000006 ,
SBITS_SRCBLEND_DST_ALPHA = 0x00000007 ,
SBITS_SRCBLEND_ONE_MINUS_DST_ALPHA = 0x00000008 ,
SBITS_SRCBLEND_SRC_COLOR_INVALID = 0x00000009 ,
SBITS_SRCBLEND_ONE_MINUS_SRC_COLOR_INVALID = 0x0000000a ,
SBITS_SRCBLEND_ALPHA_SATURATE = 0x0000000b ,
# define SBITS_SRCBLEND_BITS 0x0000000f
/*must match src factors, just shifted 4*/
SBITS_DSTBLEND_NONE = 0x00000000 ,
SBITS_DSTBLEND_ZERO = 0x00000010 ,
SBITS_DSTBLEND_ONE = 0x00000020 ,
SBITS_DSTBLEND_DST_COLOR_INVALID = 0x00000030 ,
SBITS_DSTBLEND_ONE_MINUS_DST_COLOR_INVALID = 0x00000040 ,
SBITS_DSTBLEND_SRC_ALPHA = 0x00000050 ,
SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA = 0x00000060 ,
SBITS_DSTBLEND_DST_ALPHA = 0x00000070 ,
SBITS_DSTBLEND_ONE_MINUS_DST_ALPHA = 0x00000080 ,
SBITS_DSTBLEND_SRC_COLOR = 0x00000090 ,
SBITS_DSTBLEND_ONE_MINUS_SRC_COLOR = 0x000000a0 ,
SBITS_DSTBLEND_ALPHA_SATURATE_INVALID = 0x000000b0 ,
# define SBITS_DSTBLEND_BITS 0x000000f0
# define SBITS_BLEND_BITS (SBITS_SRCBLEND_BITS|SBITS_DSTBLEND_BITS)
2012-09-30 05:52:03 +00:00
SBITS_MASK_RED = 0x00000100 ,
SBITS_MASK_GREEN = 0x00000200 ,
SBITS_MASK_BLUE = 0x00000400 ,
SBITS_MASK_ALPHA = 0x00000800 ,
# define SBITS_MASK_BITS 0x00000f00
2009-11-04 21:16:50 +00:00
SBITS_ATEST_NONE = 0x00000000 ,
2012-09-30 05:52:03 +00:00
SBITS_ATEST_GT0 = 0x00001000 ,
SBITS_ATEST_LT128 = 0x00002000 ,
SBITS_ATEST_GE128 = 0x00003000 ,
# define SBITS_ATEST_BITS 0x0000f000
2015-08-28 03:13:45 +00:00
# define SBITS_ATEST_SHIFT 12
2012-09-30 05:52:03 +00:00
SBITS_MISC_DEPTHWRITE = 0x00010000 ,
2018-04-27 16:40:50 +00:00
SBITS_MISC_NODEPTHTEST = 0x00020000 , //strictly speaking, this is NOT the same as 'depthfunc always', which is unfortunate.
SBITS_DEPTHFUNC_CLOSEREQUAL = 0x00000000 ,
SBITS_DEPTHFUNC_EQUAL = 0x00040000 ,
SBITS_DEPTHFUNC_CLOSER = 0x00080000 ,
SBITS_DEPTHFUNC_FURTHER = 0x000c0000 ,
# define SBITS_DEPTHFUNC_BITS 0x000c0000
2012-04-09 19:12:12 +00:00
2017-02-11 16:14:06 +00:00
SBITS_TESSELLATION = 0x00100000 ,
2014-03-30 08:55:06 +00:00
SBITS_AFFINE = 0x00200000 ,
2023-01-19 04:44:24 +00:00
SBITS_MISC_FULLRATE = 0x00400000 , //don't use half-rate shading (for text/ui)
2016-07-12 00:40:13 +00:00
//provided for the backend to hack about with
SBITS_LINES = 0x80000000
2009-11-04 21:16:50 +00:00
} ;
2004-08-23 00:15:46 +00:00
2004-10-19 16:10:14 +00:00
typedef struct shaderpass_s {
int numMergedPasses ;
2004-08-23 00:15:46 +00:00
2016-11-20 20:52:41 +00:00
struct programshared_s * prog ;
2017-02-21 20:22:07 +00:00
# ifdef HAVE_MEDIA_DECODER
2006-03-06 01:41:09 +00:00
struct cin_s * cin ;
2009-11-04 21:16:50 +00:00
# endif
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
unsigned int shaderbits ;
2004-08-23 00:15:46 +00:00
2011-03-02 03:43:38 +00:00
enum {
PBM_MODULATE ,
PBM_OVERBRIGHT ,
PBM_DECAL ,
PBM_ADD ,
PBM_DOTPRODUCT ,
2011-04-30 17:21:10 +00:00
PBM_REPLACE ,
2012-05-10 01:00:41 +00:00
PBM_REPLACELIGHT ,
PBM_MODULATE_PREV_COLOUR
2011-03-02 03:43:38 +00:00
} blendmode ;
2009-07-05 18:45:53 +00:00
2004-08-23 00:15:46 +00:00
enum {
RGB_GEN_WAVE ,
RGB_GEN_ENTITY ,
RGB_GEN_ONE_MINUS_ENTITY ,
2011-10-27 16:16:29 +00:00
RGB_GEN_VERTEX_LIGHTING ,
RGB_GEN_VERTEX_EXACT ,
2004-08-23 00:15:46 +00:00
RGB_GEN_ONE_MINUS_VERTEX ,
RGB_GEN_IDENTITY_LIGHTING ,
2013-08-27 13:18:09 +00:00
RGB_GEN_IDENTITY_OVERBRIGHT ,
2004-08-23 00:15:46 +00:00
RGB_GEN_IDENTITY ,
2004-10-19 16:10:14 +00:00
RGB_GEN_CONST ,
RGB_GEN_UNKNOWN ,
2005-02-06 02:47:36 +00:00
RGB_GEN_LIGHTING_DIFFUSE ,
2017-12-09 21:22:46 +00:00
RGB_GEN_ENTITY_LIGHTING_DIFFUSE ,
2005-02-06 02:47:36 +00:00
RGB_GEN_TOPCOLOR ,
RGB_GEN_BOTTOMCOLOR
2004-08-23 00:15:46 +00:00
} rgbgen ;
2009-11-04 21:16:50 +00:00
shaderfunc_t rgbgen_func ;
2004-08-23 00:15:46 +00:00
enum {
2019-07-02 04:12:20 +00:00
ALPHA_GEN_UNDEFINED ,
2004-08-23 00:15:46 +00:00
ALPHA_GEN_ENTITY ,
ALPHA_GEN_WAVE ,
ALPHA_GEN_PORTAL ,
ALPHA_GEN_SPECULAR ,
2004-10-19 16:10:14 +00:00
ALPHA_GEN_IDENTITY ,
ALPHA_GEN_VERTEX ,
ALPHA_GEN_CONST
2004-08-23 00:15:46 +00:00
} alphagen ;
2009-11-04 21:16:50 +00:00
shaderfunc_t alphagen_func ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
enum {
TC_GEN_BASE , //basic specified texture coords
TC_GEN_LIGHTMAP , //use loaded lightmap coords
TC_GEN_ENVIRONMENT ,
TC_GEN_DOTPRODUCT ,
TC_GEN_VECTOR ,
2011-02-25 04:22:14 +00:00
//these are really for use only in glsl stuff or perhaps cubemaps, as they generate 3d coords.
2009-11-04 21:16:50 +00:00
TC_GEN_NORMAL ,
TC_GEN_SVECTOR ,
TC_GEN_TVECTOR ,
2011-02-25 04:22:14 +00:00
TC_GEN_SKYBOX ,
TC_GEN_WOBBLESKY ,
TC_GEN_REFLECT ,
2014-10-25 02:16:35 +00:00
TC_GEN_UNSPECIFIED
2009-11-04 21:16:50 +00:00
} tcgen ;
2016-07-12 00:40:13 +00:00
vec3_t tcgenvec [ 2 ] ; //bloat :(
2004-08-23 00:15:46 +00:00
int numtcmods ;
2004-10-19 16:10:14 +00:00
tcmod_t tcmods [ SHADER_MAX_TC_MODS ] ;
2004-08-23 00:15:46 +00:00
int anim_numframes ;
2009-11-04 21:16:50 +00:00
texid_t anim_frames [ SHADER_MAX_ANIMFRAMES ] ;
2004-10-19 16:10:14 +00:00
float anim_fps ;
2009-11-04 21:16:50 +00:00
// unsigned int texturetype;
2004-08-23 00:15:46 +00:00
enum {
2009-11-04 21:16:50 +00:00
T_GEN_SINGLEMAP , //single texture specified in the shader
T_GEN_ANIMMAP , //animating sequence of textures specified in the shader
T_GEN_LIGHTMAP , //world light samples
T_GEN_DELUXMAP , //world light directions
T_GEN_SHADOWMAP , //light's depth values.
2011-12-27 08:35:19 +00:00
T_GEN_LIGHTCUBEMAP , //light's projected cubemap
2009-11-04 21:16:50 +00:00
T_GEN_DIFFUSE , //texture's default diffuse texture
T_GEN_NORMALMAP , //texture's default normalmap
T_GEN_SPECULAR , //texture's default specular texture
T_GEN_UPPEROVERLAY , //texture's default personal colour
T_GEN_LOWEROVERLAY , //texture's default team colour
T_GEN_FULLBRIGHT , //texture's default fullbright overlay
2015-02-07 22:34:22 +00:00
T_GEN_PALETTED , //texture's original paletted data (8bit)
2015-05-03 19:57:46 +00:00
T_GEN_REFLECTCUBE , //dpreflectcube
T_GEN_REFLECTMASK , //dpreflectcube mask
2019-02-01 08:29:14 +00:00
T_GEN_DISPLACEMENT , //displacement texture (probably half-float or something so higher precision than normalmap.a)
2019-09-04 07:59:40 +00:00
T_GEN_OCCLUSION , //occlusion mask (instead of baking it into the texture itself, required for correct pbr)
2009-11-04 21:16:50 +00:00
T_GEN_CURRENTRENDER , //copy the current screen to a texture, and draw that
2011-09-03 03:49:43 +00:00
T_GEN_SOURCECOLOUR , //used for render-to-texture targets
T_GEN_SOURCEDEPTH , //used for render-to-texture targets
2012-05-09 15:30:53 +00:00
T_GEN_REFLECTION , //reflection image (mirror-as-fbo)
T_GEN_REFRACTION , //refraction image (portal-as-fbo)
2013-03-12 23:13:39 +00:00
T_GEN_REFRACTIONDEPTH , //refraction image (portal-as-fbo)
2012-05-14 01:41:08 +00:00
T_GEN_RIPPLEMAP , //ripplemap image (water surface distortions-as-fbo)
2012-05-09 15:30:53 +00:00
2011-10-27 16:16:29 +00:00
T_GEN_SOURCECUBE , //used for render-to-texture targets
2019-04-01 10:16:36 +00:00
# ifdef HAVE_MEDIA_DECODER
2009-11-04 21:16:50 +00:00
T_GEN_VIDEOMAP , //use the media playback as an image source, updating each frame for which it is visible
2019-04-01 10:16:36 +00:00
# endif
2017-10-31 22:52:58 +00:00
# define GBUFFER_COUNT 8
# define T_GEN_GBUFFERCASE T_GEN_GBUFFER0:case T_GEN_GBUFFER1:case T_GEN_GBUFFER2:case T_GEN_GBUFFER3:case T_GEN_GBUFFER4:case T_GEN_GBUFFER5:case T_GEN_GBUFFER6:case T_GEN_GBUFFER7
T_GEN_GBUFFER0 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER1 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER2 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER3 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER4 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER5 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER6 , //one of the gbuffer images (deferred lighting).
T_GEN_GBUFFER7 , //one of the gbuffer images (deferred lighting).
2009-11-04 21:16:50 +00:00
} texgen ;
2013-07-29 17:36:44 +00:00
enum {
ST_DIFFUSEMAP ,
ST_AMBIENT ,
ST_BUMPMAP ,
ST_SPECULARMAP
} stagetype ;
2009-11-04 21:16:50 +00:00
enum {
2014-10-05 20:04:11 +00:00
SHADER_PASS_CLAMP = 1 < < 0 , //needed for d3d's sampler states, MUST MATCH IMAGE FLAGS
SHADER_PASS_NOMIPMAP = 1 < < 1 , //needed for d3d's sampler states, MUST MATCH IMAGE FLAGS
SHADER_PASS_NEAREST = 1 < < 2 , //needed for d3d's sampler states, MUST MATCH IMAGE FLAGS
SHADER_PASS_LINEAR = 1 < < 3 , //needed for d3d's sampler states, MUST MATCH IMAGE FLAGS
SHADER_PASS_UIPIC = 1 < < 4 , // MUST MATCH IMAGE FLAGS
2017-07-12 08:15:27 +00:00
SHADER_PASS_DEPTHCMP = 1 < < 5 , //needed for d3d11's sampler states
SHADER_PASS_SRGB = 1 < < 6 , //d3d9 does srgb via samplers. everyone else does it via texture formats
# define SHADER_PASS_IMAGE_FLAGS_D3D8 (SHADER_PASS_CLAMP|SHADER_PASS_NOMIPMAP|SHADER_PASS_NEAREST|SHADER_PASS_LINEAR|SHADER_PASS_UIPIC)
# define SHADER_PASS_IMAGE_FLAGS_D3D9 (SHADER_PASS_CLAMP|SHADER_PASS_NOMIPMAP|SHADER_PASS_NEAREST|SHADER_PASS_LINEAR|SHADER_PASS_UIPIC|SHADER_PASS_SRGB)
# define SHADER_PASS_IMAGE_FLAGS_D3D11 (SHADER_PASS_CLAMP|SHADER_PASS_NOMIPMAP|SHADER_PASS_NEAREST|SHADER_PASS_LINEAR|SHADER_PASS_UIPIC|SHADER_PASS_DEPTHCMP) //NEEDS to be tightly-packed. indexing will bug out otherwise.
2014-10-05 20:04:11 +00:00
2017-07-12 08:15:27 +00:00
SHADER_PASS_NOCOLORARRAY = 1 < < 7 ,
2009-11-04 21:16:50 +00:00
//FIXME: remove these
2017-07-12 08:15:27 +00:00
SHADER_PASS_VIDEOMAP = 1 < < 8 ,
SHADER_PASS_DETAIL = 1 < < 9 ,
SHADER_PASS_LIGHTMAP = 1 < < 10 ,
SHADER_PASS_DELUXMAP = 1 < < 11 ,
SHADER_PASS_ANIMMAP = 1 < < 12
2004-08-23 00:15:46 +00:00
} flags ;
2013-11-21 23:02:28 +00:00
2016-07-12 00:40:13 +00:00
# if defined(D3D11QUAKE) || defined(VKQUAKE)
2013-11-21 23:02:28 +00:00
void * becache ; //cache for blendstate objects.
# endif
2004-08-23 00:15:46 +00:00
} shaderpass_t ;
2005-04-16 16:21:27 +00:00
typedef struct
{
2009-11-04 21:16:50 +00:00
texid_t farbox_textures [ 6 ] ;
texid_t nearbox_textures [ 6 ] ;
2005-04-16 16:21:27 +00:00
} skydome_t ;
2010-08-28 17:14:38 +00:00
enum {
2017-02-19 00:15:42 +00:00
# define PERMUTATION_GENERIC 0
# define PERMUTATION_BUMPMAP (1u<<PERMUTATION_BIT_BUMPMAP)
PERMUTATION_BIT_BUMPMAP , //FIXME: make argument somehow
# define PERMUTATION_FULLBRIGHT (1u<<PERMUTATION_BIT_FULLBRIGHT)
PERMUTATION_BIT_FULLBRIGHT , //FIXME: make argument somehow
# define PERMUTATION_UPPERLOWER (1u<<PERMUTATION_BIT_UPPERLOWER)
PERMUTATION_BIT_UPPERLOWER , //FIXME: make argument somehow
# define PERMUTATION_REFLECTCUBEMASK (1u<<PERMUTATION_BIT_REFLECTCUBEMASK)
PERMUTATION_BIT_REFLECTCUBEMASK , //FIXME: make argument somehow
# ifdef SKELETALMODELS
# define PERMUTATION_SKELETAL (1u<<PERMUTATION_BIT_SKELETAL)
PERMUTATION_BIT_SKELETAL ,
# else
# define PERMUTATION_SKELETAL 0u
# endif
# define PERMUTATION_FOG (1u<<PERMUTATION_BIT_FOG)
PERMUTATION_BIT_FOG , //FIXME: remove (recompile shaders if its enabled).
# ifdef NONSKELETALMODELS
# define PERMUTATION_FRAMEBLEND (1u<<PERMUTATION_BIT_FRAMEBLEND)
PERMUTATION_BIT_FRAMEBLEND ,
# else
# define PERMUTATION_FRAMEBLEND 0u
# endif
# if MAXRLIGHTMAPS > 1
# define PERMUTATION_LIGHTSTYLES (1u<<PERMUTATION_BIT_LIGHTSTYLES)
PERMUTATION_BIT_LIGHTSTYLES , //FIXME: make argument
# else
# define PERMUTATION_LIGHTSTYLES 0u
# endif
PERMUTATION_BIT_MAX
2010-08-28 17:14:38 +00:00
} ;
2017-02-19 00:15:42 +00:00
# define PERMUTATIONS (1u<<PERMUTATION_BIT_MAX)
2010-08-28 17:14:38 +00:00
2018-03-04 14:41:16 +00:00
extern cvar_t r_fog_permutation ;
2012-04-24 07:59:11 +00:00
enum shaderattribs_e
{
2015-07-09 18:02:49 +00:00
//GLES2 has a limit of 8.
//GL2 has a limit of 16.
//vendors may provide more.
2014-05-30 03:57:30 +00:00
VATTR_VERTEX1 = 0 , //NOTE: read the comment about VATTR_LEG_VERTEX
VATTR_VERTEX2 = 1 ,
VATTR_COLOUR = 2 ,
VATTR_TEXCOORD = 3 ,
VATTR_LMCOORD = 4 ,
VATTR_NORMALS = 5 ,
VATTR_SNORMALS = 6 ,
VATTR_TNORMALS = 7 ,
VATTR_BONENUMS = 8 , /*skeletal only*/
VATTR_BONEWEIGHTS = 9 , /*skeletal only*/
2013-10-08 14:28:11 +00:00
# if MAXRLIGHTMAPS > 1
2014-05-30 03:57:30 +00:00
VATTR_LMCOORD2 = 10 ,
VATTR_LMCOORD3 = 11 ,
VATTR_LMCOORD4 = 12 ,
VATTR_COLOUR2 = 13 ,
VATTR_COLOUR3 = 14 ,
VATTR_COLOUR4 = 15 ,
2013-10-08 14:28:11 +00:00
# endif
2013-08-27 13:18:09 +00:00
2012-04-24 07:59:11 +00:00
2013-04-06 03:36:00 +00:00
VATTR_LEG_VERTEX , //note: traditionally this is actually index 0.
//however, implementations are allowed to directly alias, or remap,
//so we're never quite sure if 0 is enabled or not when using legacy functions.
//as a result, we use legacy verticies always and never custom attribute 0 if we have any fixed function support.
//we then depend upon gl_Vertex always being supported by the glsl compiler.
//this is likely needed anyway to ensure that ftransform works properly and in all cases for stencil shadows.
2012-04-24 07:59:11 +00:00
VATTR_LEG_COLOUR ,
VATTR_LEG_ELEMENTS ,
VATTR_LEG_TMU0 ,
2013-04-06 03:36:00 +00:00
VATTR_LEG_FIRST = VATTR_LEG_VERTEX
2012-04-24 07:59:11 +00:00
} ;
2006-03-11 03:12:10 +00:00
typedef struct {
enum shaderprogparmtype_e {
2011-01-23 03:44:49 +00:00
SP_BAD , //never set (hopefully)
2008-12-23 02:55:20 +00:00
2011-01-23 03:44:49 +00:00
/*entity properties*/
2012-04-24 07:59:11 +00:00
SP_E_VBLEND ,
2013-08-27 13:18:09 +00:00
SP_E_LMSCALE , //lightmap scales
SP_E_VLSCALE , //vertex lighting style scales
2011-09-03 03:49:43 +00:00
SP_E_ORIGIN ,
SP_E_COLOURS ,
SP_E_COLOURSIDENT ,
SP_E_GLOWMOD ,
SP_E_TOPCOLOURS ,
SP_E_BOTTOMCOLOURS ,
SP_E_TIME ,
2011-01-23 03:44:49 +00:00
SP_E_L_DIR , /*these light values are non-dynamic light as in classic quake*/
SP_E_L_MUL ,
SP_E_L_AMBIENT ,
2011-09-03 03:49:43 +00:00
SP_E_EYEPOS , /*viewer's eyepos, in model space*/
SP_V_EYEPOS , /*viewer's eyepos, in world space*/
2011-12-23 03:12:29 +00:00
SP_W_FOG ,
2017-12-03 08:27:27 +00:00
SP_W_USER , //user-specified blob of data.
2011-09-03 03:49:43 +00:00
2018-12-28 00:04:36 +00:00
SP_M_ENTBONES_PACKED ,
SP_M_ENTBONES_MAT3X4 ,
2020-06-12 23:29:58 +00:00
SP_M_ENTBONES_MAT4 ,
2011-09-03 03:49:43 +00:00
SP_M_VIEW ,
SP_M_MODEL ,
SP_M_MODELVIEW ,
SP_M_PROJECTION ,
SP_M_MODELVIEWPROJECTION ,
SP_M_INVVIEWPROJECTION ,
SP_M_INVMODELVIEWPROJECTION ,
2020-06-12 23:29:58 +00:00
SP_M_INVMODELVIEW ,
2006-03-11 03:12:10 +00:00
2010-07-25 15:12:12 +00:00
SP_RENDERTEXTURESCALE , /*multiplier for currentrender->texcoord*/
2015-07-14 14:47:00 +00:00
SP_SOURCESIZE , /*size of $sourcecolour*/
2010-07-25 15:12:12 +00:00
2015-08-28 03:13:45 +00:00
SP_S_COLOUR ,
2011-01-23 03:44:49 +00:00
SP_LIGHTRADIUS , /*these light values are realtime lighting*/
2009-07-18 20:46:42 +00:00
SP_LIGHTCOLOUR ,
2012-01-01 11:22:24 +00:00
SP_LIGHTCOLOURSCALE ,
2009-07-18 20:46:42 +00:00
SP_LIGHTPOSITION ,
2018-07-22 11:49:37 +00:00
SP_LIGHTDIRECTION ,
2011-12-05 15:23:40 +00:00
SP_LIGHTSCREEN ,
2012-08-04 01:35:52 +00:00
SP_LIGHTCUBEMATRIX ,
2013-10-08 14:28:11 +00:00
SP_LIGHTSHADOWMAPPROJ ,
SP_LIGHTSHADOWMAPSCALE ,
2009-07-18 20:46:42 +00:00
2006-03-11 03:12:10 +00:00
//things that are set immediatly
SP_FIRSTIMMEDIATE , //never set
2020-06-12 23:29:58 +00:00
SP_TEXTURE ,
SP_CONST1I ,
SP_CONST2I ,
SP_CONST3I ,
SP_CONST4I ,
SP_CONST1F ,
SP_CONST2F ,
SP_CONST3F ,
SP_CONST4F ,
2006-03-11 03:12:10 +00:00
SP_CVARI ,
SP_CVARF ,
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
SP_CVAR3F ,
2020-06-12 23:29:58 +00:00
SP_CVAR4F ,
2006-03-11 03:12:10 +00:00
} type ;
2010-08-28 17:14:38 +00:00
union
{
2020-06-12 23:29:58 +00:00
int ival [ 4 ] ;
float fval [ 4 ] ;
2010-08-28 17:14:38 +00:00
void * pval ;
} ;
2015-08-07 17:49:49 +00:00
unsigned int handle ;
2006-03-11 03:12:10 +00:00
} shaderprogparm_t ;
2018-11-27 16:48:19 +00:00
struct programpermu_s
{
2018-11-28 05:41:39 +00:00
# if defined(GLQUAKE) || defined(D3DQUAKE)
2018-11-27 16:48:19 +00:00
union programhandle_u
{
# ifdef GLQUAKE
struct
{
2024-05-03 17:00:15 +00:00
unsigned int handle ;
2018-11-27 16:48:19 +00:00
qboolean usetesselation ;
} glsl ;
# endif
# ifdef D3DQUAKE
struct
{
void * vert ;
void * frag ;
# ifdef D3D9QUAKE
void * ctabf ;
void * ctabv ;
# endif
# ifdef D3D11QUAKE
int topology ; //D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST
void * hull ;
void * domain ;
void * geom ;
void * layouts [ 2 ] ;
# endif
} hlsl ;
# endif
} h ;
2019-03-12 05:04:27 +00:00
# endif
# ifdef GLQUAKE
int factorsuniform ;
2018-11-28 05:41:39 +00:00
# endif
2018-11-27 16:48:19 +00:00
unsigned int permutation ;
unsigned int attrmask ;
unsigned int texmask ; //'standard' textures that are in use
unsigned int numparms ;
shaderprogparm_t * parm ;
} ;
2011-02-25 04:22:14 +00:00
typedef struct programshared_s
{
2018-11-27 16:48:19 +00:00
char * name ;
2011-02-25 04:22:14 +00:00
int refs ;
2020-06-12 23:29:58 +00:00
unsigned calcgens : 1 ; //calculate legacy rgb/alpha/tc gens
unsigned explicitsyms : 1 ; //avoid defining symbol names that'll conflict with other glsl (any fte-specific names must have an fte_ prefix)
unsigned tess : 1 ; //has a tessellation control+evaluation shader
unsigned geom : 1 ; //has a geometry shader
2024-04-13 21:13:06 +00:00
unsigned rayquery : 1 ; //needs a top-level acceleration structure.
2020-06-12 23:29:58 +00:00
unsigned warned : 1 ; //one of the permutations of this shader has already been warned about. don't warn about all of them because that's potentially spammy.
2015-03-03 00:14:43 +00:00
unsigned short numsamplers ; //shader system can strip any passes above this
unsigned int defaulttextures ; //diffuse etc
2016-07-12 00:40:13 +00:00
unsigned int supportedpermutations ;
unsigned char * cvardata ;
unsigned int cvardatasize ;
2019-09-04 08:32:22 +00:00
int shaderver ; //glsl version
char * preshade ; //general prefixed #defines
char * shadertext ; //the glsl text
unsigned char failed [ ( PERMUTATIONS + 7 ) / 8 ] ; //so we don't try recompiling endlessly
struct programpermu_s * permu [ PERMUTATIONS ] ; //set once compiled.
2018-11-27 16:48:19 +00:00
# ifdef VKQUAKE
2018-07-22 11:49:37 +00:00
qVkShaderModule vert ; //for slightly faster regeneration
qVkShaderModule frag ;
qVkPipelineLayout layout ; //all permutations share the same layout. I'm too lazy not to.
qVkDescriptorSetLayout desclayout ;
2016-07-12 00:40:13 +00:00
struct pipeline_s * pipelines ;
# endif
2011-02-25 04:22:14 +00:00
} program_t ;
2009-11-04 21:16:50 +00:00
typedef struct {
float factor ;
float unit ;
} polyoffset_t ;
2013-10-29 17:38:22 +00:00
enum
{
LSHADER_STANDARD = 0u , //stencil or shadowless
2018-01-22 19:18:04 +00:00
LSHADER_CUBE = 1u < < 0 , //has a cubemap filter (FIXME: use custom 2d filter on spot lights)
LSHADER_SMAP = 1u < < 1 , //filter based upon a shadowmap instead of stencil/unlit
2013-10-29 17:38:22 +00:00
LSHADER_SPOT = 1u < < 2 , //filter based upon a single spotlight shadowmap
2024-04-13 21:13:06 +00:00
LSHADER_RAYQUERY = 1u < < 3 , //hardware raytrace.
2018-01-22 19:18:04 +00:00
# ifdef LFLAG_ORTHO
2024-04-13 21:13:06 +00:00
LSHADER_ORTHO = 1u < < 4 , //uses a parallel projection(ortho) matrix, with the light source being an entire plane instead of a singular point. which is weird. read: infinitely far away sunlight
LSHADER_MODES = 1u < < 5 ,
2018-01-22 19:18:04 +00:00
# else
LSHADER_ORTHO = 0 , //so bitmasks return false
2024-04-13 21:13:06 +00:00
LSHADER_MODES = 1u < < 4 ,
2018-01-22 19:18:04 +00:00
# endif
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
LSHADER_FAKESHADOWS = 1u < < 10 , //special 'light' type that isn't a light but still needs a shadowmap. ignores world+bsp shadows.
2013-10-29 17:38:22 +00:00
} ;
enum
{
//low numbers are used for various rtlight mode combinations
bemoverride_crepuscular = LSHADER_MODES , //either black (non-sky) or a special crepuscular_sky shader
bemoverride_depthonly , //depth masked. replace if you want alpha test.
bemoverride_depthdark , //itself or a pure-black shader. replace for alpha test.
2016-11-20 20:52:41 +00:00
bemoverride_gbuffer , //prelighting
2013-10-29 17:38:22 +00:00
bemoverride_fog , //post-render volumetric fog
bemoverride_max
} ;
2017-04-18 11:12:17 +00:00
//FIXME: split into separate materials and shaders
2009-11-04 21:16:50 +00:00
struct shader_s
{
2012-07-05 19:42:36 +00:00
char name [ MAX_QPATH ] ;
2021-06-22 14:40:53 +00:00
struct model_s * model ;
2013-08-21 07:14:39 +00:00
enum {
SUF_NONE = 0 ,
SUF_LIGHTMAP = 1 < < 0 , //$lightmap passes are valid. otherwise collapsed to an rgbgen
2017-04-18 11:12:17 +00:00
SUF_2D = 1 < < 1 , //any loaded textures will obey 2d picmips rather than 3d picmips
SUR_FORCEFALLBACK = 1 < < 2 //shader fallback is forced, will not load from disk
2013-08-21 07:14:39 +00:00
} usageflags ; //
2013-10-29 17:38:22 +00:00
int uses ; //released when the uses drops to 0
2014-10-05 20:04:11 +00:00
int width ; //when used as an image, this is the logical 'width' of the image. FIXME.
2009-11-04 21:16:50 +00:00
int height ;
int numpasses ;
2015-05-03 19:57:46 +00:00
unsigned int numdefaulttextures ; //0 is effectively 1.
float defaulttextures_fps ;
texnums_t * defaulttextures ; //must always have at least one entry. multiple will only appear if the diffuse texture was animmapped.
2004-08-23 00:15:46 +00:00
struct shader_s * next ;
2013-10-29 17:38:22 +00:00
int id ;
2004-08-23 00:15:46 +00:00
2017-04-18 11:12:17 +00:00
rshader_t * bemoverrides [ bemoverride_max ] ;
material_t * remapto ; //render using this material instead. for q3 nonsense.
2014-02-13 23:54:57 +00:00
float remaptime ;
2013-10-29 17:38:22 +00:00
2004-08-23 00:15:46 +00:00
byte_vec4_t fog_color ;
2004-10-19 16:10:14 +00:00
float fog_dist ;
2010-07-11 02:22:39 +00:00
float portaldist ;
2018-07-05 16:21:44 +00:00
float portalfboscale ; //if we're using texturemaps for portal recursion, this is the scale of the texture relative to the screen.
2004-08-23 00:15:46 +00:00
int numdeforms ;
deformv_t deforms [ SHADER_DEFORM_MAX ] ;
2009-11-04 21:16:50 +00:00
polyoffset_t polyoffset ;
2013-10-08 14:28:11 +00:00
# define SHADER_CULL_FLIP (SHADER_CULL_FRONT|SHADER_CULL_BACK)
2004-08-23 00:15:46 +00:00
enum {
2004-10-19 16:10:14 +00:00
SHADER_SKY = 1 < < 0 ,
SHADER_NOMIPMAPS = 1 < < 1 ,
SHADER_NOPICMIP = 1 < < 2 ,
SHADER_CULL_FRONT = 1 < < 3 ,
SHADER_CULL_BACK = 1 < < 4 ,
2016-07-12 00:40:13 +00:00
SHADER_NOMARKS = 1 < < 5 ,
SHADER_POLYGONOFFSET = 1 < < 6 ,
2004-10-19 16:10:14 +00:00
SHADER_FLARE = 1 < < 7 ,
2015-09-01 04:45:15 +00:00
SHADER_NEEDSARRAYS = 1 < < 8 , //shader uses deforms or rgbmod tcmods or something that will not work well with sparse vbos
2004-10-19 16:10:14 +00:00
SHADER_ENTITY_MERGABLE = 1 < < 9 ,
SHADER_VIDEOMAP = 1 < < 10 ,
2012-11-27 03:23:19 +00:00
SHADER_DEPTHWRITE = 1 < < 11 , //some pass already wrote depth. not used by the renderer.
2004-11-13 17:31:04 +00:00
SHADER_AGEN_PORTAL = 1 < < 12 ,
2005-05-26 12:55:34 +00:00
SHADER_BLEND = 1 < < 13 , //blend or alphatest (not 100% opaque).
2009-11-04 21:16:50 +00:00
SHADER_NODRAW = 1 < < 14 , //parsed only to pee off developers when they forget it on no-pass shaders.
SHADER_NODLIGHT = 1 < < 15 , //from surfaceflags
2010-07-18 12:52:24 +00:00
SHADER_HASLIGHTMAP = 1 < < 16 ,
2011-01-23 03:44:49 +00:00
SHADER_HASTOPBOTTOM = 1 < < 17 ,
2019-10-07 04:51:17 +00:00
SHADER_HASREFLECTCUBE = 1 < < 18 , //shader has a T_GEN_REFLECTCUBE pass (otherwise we can skip surf envmaps for better batching)
2012-05-11 01:57:00 +00:00
SHADER_HASREFLECT = 1 < < 19 , //says that we need to generate a reflection image first
SHADER_HASREFRACT = 1 < < 20 , //says that we need to generate a refraction image first
2013-03-12 23:13:39 +00:00
SHADER_HASREFRACTDEPTH = 1 < < 21 , //refraction generation needs to generate a depth texture too.
SHADER_HASNORMALMAP = 1 < < 22 , //says that we need to load a normalmap texture
SHADER_HASRIPPLEMAP = 1 < < 23 , //water surface disturbances for water splashes
2014-06-22 23:44:30 +00:00
SHADER_HASGLOSS = 1 < < 24 , //needs a _spec texture, if possible.
2013-11-21 23:02:28 +00:00
SHADER_NOSHADOWS = 1 < < 25 , //don't cast shadows
2014-06-22 23:44:30 +00:00
SHADER_HASFULLBRIGHT = 1 < < 26 , //needs a fullbright texture, if possible.
2015-02-02 08:01:53 +00:00
SHADER_HASDIFFUSE = 1 < < 27 , //has a T_GEN_DIFFUSE pass
2015-02-07 22:34:22 +00:00
SHADER_HASPALETTED = 1 < < 28 , //has a T_GEN_PALETTED pass
2016-07-12 00:40:13 +00:00
SHADER_HASCURRENTRENDER = 1 < < 29 , //has a $currentrender pass
2017-08-29 02:29:06 +00:00
SHADER_HASPORTAL = 1 < < 30 , //reflection image is actually a portal rather than a simple reflection (must be paired with SHADER_HASREFRACT)
2019-02-01 08:29:14 +00:00
SHADER_HASDISPLACEMENT = ( int ) ( 1u < < 31 )
2004-08-23 00:15:46 +00:00
} flags ;
2011-02-25 04:22:14 +00:00
program_t * prog ;
2006-03-11 03:12:10 +00:00
2004-10-19 16:10:14 +00:00
shaderpass_t passes [ SHADER_PASS_MAX ] ;
shadersort_t sort ;
2005-04-16 16:21:27 +00:00
skydome_t * skydome ;
2009-11-04 21:16:50 +00:00
shader_gen_t * generator ;
2011-12-05 15:23:40 +00:00
char * genargs ;
2005-04-16 16:21:27 +00:00
2015-03-03 00:14:43 +00:00
struct shader_clutter_s
{
struct shader_clutter_s * next ;
float scalemin ;
float scalemax ;
float anglemin ;
float anglemax ;
float spacing ;
float zofs ;
char modelname [ 1 ] ;
} * clutter ;
2010-07-11 02:22:39 +00:00
bucket_t bucket ;
2018-01-22 19:18:04 +00:00
2019-03-12 05:04:27 +00:00
# define MATERIAL_FACTOR_BASE 0
# define MATERIAL_FACTOR_SPEC 1
# define MATERIAL_FACTOR_EMIT 2
# define MATERIAL_FACTOR_COUNT 3
vec4_t factors [ MATERIAL_FACTOR_COUNT ] ;
2018-01-22 19:18:04 +00:00
//arranged as a series of vec4s
/* struct
{
float offsetmappingscale ; //default 1
float offsetmappingbias ; //default 0
float specularexpscale ; //default 1*gl_specular_power
float specularvalscale ; //default 1*gl_specular
} fragpushdata ;
*/
2009-11-04 21:16:50 +00:00
} ;
2004-08-23 00:15:46 +00:00
2021-11-03 20:31:41 +00:00
struct shaderparsestate_s ;
struct sbuiltin_s
{
int qrtype ;
int apiver ;
char name [ MAX_QPATH ] ;
char * body ;
} ;
typedef struct
{
const char * loadername ;
qboolean ( * ReadMaterial ) ( struct shaderparsestate_s * ps , const char * filename , void ( * LoadMaterialString ) ( struct shaderparsestate_s * ps , const char * script ) ) ;
struct sbuiltin_s * builtinshaders ;
# define plugmaterialloaderfuncs_name "MaterialLoader"
} plugmaterialloaderfuncs_t ;
qboolean Material_RegisterLoader ( void * module , plugmaterialloaderfuncs_t * loader ) ;
2013-10-29 17:38:22 +00:00
extern unsigned int r_numshaders ;
extern unsigned int r_maxshaders ;
extern shader_t * * r_shaders ;
2009-11-04 21:16:50 +00:00
extern int be_maxpasses ;
2006-02-11 14:51:36 +00:00
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
char * Shader_GetShaderBody ( shader_t * s , char * fname , size_t fnamesize ) ;
2010-07-11 02:22:39 +00:00
void R_UnloadShader ( shader_t * shader ) ;
2014-10-05 20:04:11 +00:00
int R_GetShaderSizes ( shader_t * shader , int * width , int * height , qboolean blocktillloaded ) ;
2017-01-24 20:15:14 +00:00
shader_t * R_RegisterPic ( const char * name , const char * subdirs ) ;
2014-04-24 01:53:01 +00:00
shader_t * QDECL R_RegisterShader ( const char * name , unsigned int usageflags , const char * shaderscript ) ;
2021-06-22 14:40:53 +00:00
shader_t * R_RegisterShader_Lightmap ( model_t * mod , const char * name ) ;
shader_t * R_RegisterShader_Vertex ( model_t * mod , const char * name ) ;
shader_t * R_RegisterShader_Flare ( model_t * mod , const char * name ) ;
shader_t * QDECL R_RegisterSkin ( model_t * mod , const char * shadername ) ;
shader_t * R_RegisterCustom ( model_t * mod , const char * name , unsigned int usageflags , shader_gen_t * defaultgen , const void * args ) ;
2015-03-03 00:14:43 +00:00
//once loaded, most shaders should have one of the following two calls used upon it
2018-09-29 17:31:58 +00:00
void QDECL R_BuildDefaultTexnums ( texnums_t * tn , shader_t * shader , unsigned int imageflags ) ;
2020-03-07 09:00:40 +00:00
void QDECL R_BuildLegacyTexnums ( shader_t * shader , const char * fallbackname , const char * subpath , unsigned int loadflags , unsigned int imageflags , uploadfmt_t basefmt , size_t width , size_t height , qbyte * mipdata , qbyte * palette ) ;
2014-02-13 23:54:57 +00:00
void R_RemapShader ( const char * sourcename , const char * destname , float timeoffset ) ;
2005-03-20 02:57:11 +00:00
2021-07-19 22:47:29 +00:00
void Shader_TouchTexnums ( texnums_t * t ) ;
void Shader_TouchTextures ( void ) ;
2010-07-11 02:22:39 +00:00
cin_t * R_ShaderGetCinematic ( shader_t * s ) ;
2014-03-30 08:55:06 +00:00
cin_t * R_ShaderFindCinematic ( const char * name ) ;
2015-08-24 03:54:39 +00:00
shader_t * R_ShaderFind ( const char * name ) ; //does NOT increase the shader refcount.
2008-11-09 22:29:28 +00:00
2019-03-12 05:04:27 +00:00
void Shader_DefaultSkin ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultSkinShell ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_Default2D ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultBSPLM ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultBSPQ1 ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultBSPQ2 ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultWaterShader ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultSkybox ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultCinematic ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_DefaultScript ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
void Shader_PolygonShader ( struct shaderparsestate_s * ps , const char * shortname , const void * args ) ;
2004-10-26 23:06:29 +00:00
2014-02-14 09:59:32 +00:00
void Shader_ResetRemaps ( void ) ; //called on map changes to reset remapped shaders.
void Shader_DoReload ( void ) ; //called when the shader system dies.
2004-10-26 23:06:29 +00:00
void Shader_Shutdown ( void ) ;
qboolean Shader_Init ( void ) ;
2011-12-05 15:23:40 +00:00
void Shader_NeedReload ( qboolean rescanfs ) ;
2011-09-03 03:49:43 +00:00
void Shader_WriteOutGenerics_f ( void ) ;
2014-02-13 23:54:57 +00:00
void Shader_RemapShader_f ( void ) ;
2014-10-25 02:16:35 +00:00
void Shader_ShowShader_f ( void ) ;
2024-04-25 05:57:34 +00:00
void Shader_ShaderList_f ( void ) ;
2006-01-28 02:35:40 +00:00
2015-08-28 03:13:45 +00:00
program_t * Shader_FindGeneric ( char * name , int qrtype ) ;
2018-11-27 16:48:19 +00:00
struct programpermu_s * Shader_LoadPermutation ( program_t * prog , unsigned int p ) ;
2016-07-12 00:40:13 +00:00
void Shader_ReleaseGeneric ( program_t * prog ) ;
2015-08-28 03:13:45 +00:00
2018-07-24 13:59:42 +00:00
image_t * Mod_CubemapForOrigin ( model_t * wmodel , vec3_t org ) ;
2014-10-05 20:04:11 +00:00
mfog_t * Mod_FogForOrigin ( model_t * wmodel , vec3_t org ) ;
2009-11-04 21:16:50 +00:00
2019-02-19 06:49:03 +00:00
# define BEF_FORCEDEPTHWRITE (1u<<0)
# define BEF_FORCEDEPTHTEST (1u<<1)
# define BEF_FORCEADDITIVE (1u<<2) //blend dest = GL_ONE
# define BEF_FORCETRANSPARENT (1u<<3) //texenv replace -> modulate
# define BEF_FORCENODEPTH (1u<<4) //disables any and all depth.
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2019-02-19 06:49:03 +00:00
# define BEF_PUSHDEPTH (1u<<5) //additional polygon offset
2017-10-13 17:50:28 +00:00
# endif
//FIXME: the above should really be legacy-only
2019-02-19 06:49:03 +00:00
# define BEF_NODLIGHT (1u<<6) //don't use a dlight pass
# define BEF_NOSHADOWS (1u<<7) //don't appear in shadows
# define BEF_FORCECOLOURMOD (1u<<8) //q3 shaders default to 'rgbgen identity', and ignore ent colours. this forces ent colours to be considered
# define BEF_LINES (1u<<9) //draw line pairs instead of triangles.
# define BEF_FORCETWOSIDED (1u<<10) //more evilness.s
//#define BEFF_POLYHASNORMALS (1u<<31) //false flag - for cl_scenetries and not actually used by the backend.
2009-11-04 21:16:50 +00:00
2014-02-07 09:36:04 +00:00
typedef struct
{
int fbo ;
int rb_size [ 2 ] ;
int rb_depth ;
int rb_stencil ;
int rb_depthstencil ;
texid_t colour ;
unsigned int enables ;
} fbostate_t ;
# define FBO_RB_DEPTH 2
# define FBO_RB_STENCIL 4
# define FBO_RESET 8 //resize all renderbuffers / free any that are not active. implied if the sizes differ
# define FBO_TEX_DEPTH 32 //internal
# define FBO_TEX_STENCIL 64 //internal
2015-02-02 08:01:53 +00:00
# ifndef __cplusplus //C++ sucks
2014-03-30 08:55:06 +00:00
typedef struct
{
char * progpath ; //path to use for glsl/hlsl
char * blobpath ; //path to use for binary glsl/hlsl blobs.
char * shadernamefmt ; //optional postfix for shader names for this renderer FIXME: should probably have multiple, for gles to fallback to desktop gl etc.
qboolean progs_supported ; //can use programs (all but gles1)
qboolean progs_required ; //no fixed function if this is true (d3d11, gles, gl3core)
unsigned int minver ; //lowest glsl version usable
unsigned int maxver ; //highest glsl version usable
2017-01-29 13:10:53 +00:00
unsigned int max_gpu_bones ; //max number of bones supported by uniforms.
2014-03-30 08:55:06 +00:00
2019-09-04 08:32:22 +00:00
int hw_bc , hw_etc , hw_astc ; //these are set only if the hardware actually supports the format, and not if we think the drivers are software-decoding them (unlike texfmt).
2014-10-11 19:39:45 +00:00
qboolean texfmt [ PTI_MAX ] ; //which texture formats are supported (renderable not implied)
2017-12-28 16:24:50 +00:00
unsigned int texture2d_maxsize ; //max size of a 2d texture
2018-12-29 07:43:02 +00:00
unsigned int texture3d_maxsize ; //max size of a 3d texture
unsigned int texture2darray_maxlayers ; //max layers of a 2darray texture
2017-12-28 16:24:50 +00:00
unsigned int texturecube_maxsize ;
2014-10-11 19:39:45 +00:00
qboolean texture_non_power_of_two ; //full support for npot
qboolean texture_non_power_of_two_pic ; //npot only works with clamp-to-edge mipless images.
2018-05-06 16:09:07 +00:00
qboolean texture_allow_block_padding ; //mip 0 of compressed formats can be any size, with implicit padding.
2014-10-11 19:39:45 +00:00
qboolean npot_rounddown ; //memory limited systems can say that they want to use less ram.
2014-03-30 08:55:06 +00:00
qboolean tex_env_combine ;
qboolean nv_tex_env_combine4 ;
qboolean env_add ;
2019-02-19 06:49:03 +00:00
qboolean can_mipcap ; //gl1.2+
qboolean can_mipbias ; //gl1.4+
2019-09-04 08:32:22 +00:00
qboolean can_genmips ; //gl3.0+
2017-08-29 02:29:06 +00:00
qboolean havecubemaps ; //since gl1.3, so pretty much everyone will have this... should probably only be set if we also have seamless or clamp-to-edge.
2022-03-08 05:31:34 +00:00
unsigned int stencilbits ;
2014-03-30 08:55:06 +00:00
2016-07-12 00:40:13 +00:00
void ( * pDeleteProg ) ( program_t * prog ) ;
2018-11-27 16:48:19 +00:00
qboolean ( * pLoadBlob ) ( program_t * prog , unsigned int permu , vfsfile_t * blobfile ) ;
qboolean ( * pCreateProgram ) ( program_t * prog , struct programpermu_s * permu , int ver , const char * * precompilerconstants , const char * vert , const char * tcs , const char * tes , const char * geom , const char * frag , qboolean noerrors , vfsfile_t * blobfile ) ;
qboolean ( * pValidateProgram ) ( program_t * prog , struct programpermu_s * permu , qboolean noerrors , vfsfile_t * blobfile ) ;
2020-06-12 23:29:58 +00:00
void ( * pProgAutoFields ) ( program_t * prog , struct programpermu_s * permu , char * * cvarnames , int * cvartypes ) ;
2022-07-28 02:17:52 +00:00
qboolean showbatches ; //print batches... cleared at end of video frame.
2014-03-30 08:55:06 +00:00
} sh_config_t ;
extern sh_config_t sh_config ;
2015-02-02 08:01:53 +00:00
# endif
2020-11-04 10:19:30 +00:00
enum
{
S_SHADOWMAP = 0 ,
S_PROJECTIONMAP = 1 ,
S_DIFFUSE = 2 ,
S_NORMALMAP = 3 ,
S_SPECULAR = 4 ,
S_UPPERMAP = 5 ,
S_LOWERMAP = 6 ,
S_FULLBRIGHT = 7 ,
S_PALETTED = 8 ,
S_REFLECTCUBE = 9 ,
S_REFLECTMASK = 10 ,
S_DISPLACEMENT = 11 ,
S_OCCLUSION = 12 ,
S_LIGHTMAP0 = 13 ,
S_DELUXEMAP0 = 14 ,
# if MAXRLIGHTMAPS > 1
S_LIGHTMAP1 = 15 ,
S_LIGHTMAP2 = 16 ,
S_LIGHTMAP3 = 17 ,
S_DELUXEMAP1 = 18 ,
S_DELUXEMAP2 = 19 ,
S_DELUXEMAP3 = 20 ,
# endif
} ;
2017-02-19 00:15:42 +00:00
extern const struct sh_defaultsamplers_s
{
const char * name ;
unsigned int defaulttexbits ;
} sh_defaultsamplers [ ] ;
2014-03-30 08:55:06 +00:00
2014-08-25 07:35:41 +00:00
# ifdef GLSLONLY
2014-08-27 08:41:31 +00:00
# define gl_config_nofixedfunc true
2014-08-25 07:35:41 +00:00
# else
2014-08-27 08:41:31 +00:00
# define gl_config_nofixedfunc gl_config.nofixedfunc
# endif
# ifdef GLESONLY
# define gl_config_gles true
# else
# define gl_config_gles gl_config.gles
2014-08-25 07:35:41 +00:00
# endif
2016-07-12 00:40:13 +00:00
# ifdef VKQUAKE
qboolean VK_LoadBlob ( program_t * prog , void * blobdata , const char * name ) ;
2019-09-04 08:32:22 +00:00
void VK_RegisterVulkanCvars ( void ) ;
2016-07-12 00:40:13 +00:00
# endif
2011-01-04 02:56:16 +00:00
# ifdef GLQUAKE
void GLBE_Init ( void ) ;
2012-07-05 19:42:36 +00:00
void GLBE_Shutdown ( void ) ;
2011-04-20 23:34:13 +00:00
void GLBE_SelectMode ( backendmode_t mode ) ;
void GLBE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
2015-05-03 19:57:46 +00:00
void GLBE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , unsigned int beflags ) ;
2011-01-04 02:56:16 +00:00
void GLBE_SubmitBatch ( batch_t * batch ) ;
batch_t * GLBE_GetTempBatch ( void ) ;
void GLBE_GenBrushModelVBO ( model_t * mod ) ;
2017-11-30 17:59:11 +00:00
void GLBE_ClearVBO ( vbo_t * vbo , qboolean dataonly ) ;
2020-04-19 01:23:32 +00:00
void GLBE_UpdateLightmaps ( void ) ;
2016-11-20 20:52:41 +00:00
void GLBE_DrawWorld ( batch_t * * worldbatches ) ;
2011-01-04 02:56:16 +00:00
qboolean GLBE_LightCullModel ( vec3_t org , model_t * model ) ;
void GLBE_SelectEntity ( entity_t * ent ) ;
2014-10-05 20:04:11 +00:00
qboolean GLBE_SelectDLight ( dlight_t * dl , vec3_t colour , vec3_t axis [ 3 ] , unsigned int lmode ) ;
2013-06-23 02:17:02 +00:00
void GLBE_Scissor ( srect_t * rect ) ;
2015-10-11 11:34:58 +00:00
void GLBE_SubmitMeshes ( batch_t * * worldbatches , int start , int stop ) ;
2014-02-07 08:38:40 +00:00
//void GLBE_RenderToTexture(texid_t sourcecol, texid_t sourcedepth, texid_t destcol, texid_t destdepth, qboolean usedepth);
void GLBE_RenderToTextureUpdate2d ( qboolean destchanged ) ;
2015-03-03 00:14:43 +00:00
void GLBE_VBO_Begin ( vbobctx_t * ctx , size_t maxsize ) ;
void GLBE_VBO_Data ( vbobctx_t * ctx , void * data , size_t size , vboarray_t * varray ) ;
2016-07-12 00:40:13 +00:00
void GLBE_VBO_Finish ( vbobctx_t * ctx , void * edata , size_t esize , vboarray_t * earray , void * * vbomem , void * * ebomem ) ;
void GLBE_VBO_Destroy ( vboarray_t * vearray , void * mem ) ;
2014-02-07 08:38:40 +00:00
void GLBE_FBO_Sources ( texid_t sourcecolour , texid_t sourcedepth ) ;
int GLBE_FBO_Push ( fbostate_t * state ) ;
void GLBE_FBO_Pop ( int oldfbo ) ;
void GLBE_FBO_Destroy ( fbostate_t * state ) ;
2015-07-06 14:47:46 +00:00
int GLBE_FBO_Update ( fbostate_t * state , unsigned int enables , texid_t * destcol , int colourbuffers , texid_t destdepth , int width , int height , int layer ) ;
2018-01-22 19:18:04 +00:00
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 GLBE_BeginShadowMap ( int id , int w , int h , uploadfmt_t encoding , int * restorefbo ) ;
2018-01-22 19:18:04 +00:00
void GLBE_EndShadowMap ( int restorefbo ) ;
void GLBE_SetupForShadowMap ( dlight_t * dl , int texwidth , int texheight , float shadowscale ) ;
2018-07-05 16:21:44 +00:00
qboolean GLVID_ApplyGammaRamps ( unsigned int size , unsigned short * ramps ) ; //called when gamma ramps need to be reapplied
qboolean GLVID_Init ( rendererstate_t * info , unsigned char * palette ) ; //the platform-specific function to init gl state
void GLVID_SwapBuffers ( void ) ;
char * GLVID_GetRGBInfo ( int * bytestride , int * truewidth , int * trueheight , enum uploadfmt * fmt ) ;
void GLVID_SetCaption ( const char * caption ) ;
2011-01-04 02:56:16 +00:00
# endif
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
# ifdef D3D8QUAKE
void D3D8BE_Init ( void ) ;
void D3D8BE_Shutdown ( void ) ;
void D3D8BE_SelectMode ( backendmode_t mode ) ;
void D3D8BE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
void D3D8BE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , unsigned int beflags ) ;
void D3D8BE_SubmitBatch ( batch_t * batch ) ;
batch_t * D3D8BE_GetTempBatch ( void ) ;
void D3D8BE_GenBrushModelVBO ( model_t * mod ) ;
2017-11-30 17:59:11 +00:00
void D3D8BE_ClearVBO ( vbo_t * vbo , qboolean dataonly ) ;
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
void D3D8BE_UploadAllLightmaps ( void ) ;
void D3D8BE_DrawWorld ( batch_t * * worldbatches ) ;
qboolean D3D8BE_LightCullModel ( vec3_t org , model_t * model ) ;
void D3D8BE_SelectEntity ( entity_t * ent ) ;
qboolean D3D8BE_SelectDLight ( dlight_t * dl , vec3_t colour , vec3_t axis [ 3 ] , unsigned int lmode ) ;
void D3D8BE_VBO_Begin ( vbobctx_t * ctx , size_t maxsize ) ;
void D3D8BE_VBO_Data ( vbobctx_t * ctx , void * data , size_t size , vboarray_t * varray ) ;
void D3D8BE_VBO_Finish ( vbobctx_t * ctx , void * edata , size_t esize , vboarray_t * earray , void * * vbomem , void * * ebomem ) ;
void D3D8BE_VBO_Destroy ( vboarray_t * vearray , void * mem ) ;
void D3D8BE_Scissor ( srect_t * rect ) ;
void D3D8Shader_Init ( void ) ;
void D3D8BE_Reset ( qboolean before ) ;
void D3D8BE_Set2D ( void ) ;
# endif
2012-09-30 05:52:03 +00:00
# ifdef D3D9QUAKE
void D3D9BE_Init ( void ) ;
void D3D9BE_Shutdown ( void ) ;
void D3D9BE_SelectMode ( backendmode_t mode ) ;
void D3D9BE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
2015-05-03 19:57:46 +00:00
void D3D9BE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , unsigned int beflags ) ;
2012-09-30 05:52:03 +00:00
void D3D9BE_SubmitBatch ( batch_t * batch ) ;
batch_t * D3D9BE_GetTempBatch ( void ) ;
void D3D9BE_GenBrushModelVBO ( model_t * mod ) ;
2017-11-30 17:59:11 +00:00
void D3D9BE_ClearVBO ( vbo_t * vbo , qboolean dataonly ) ;
2012-09-30 05:52:03 +00:00
void D3D9BE_UploadAllLightmaps ( void ) ;
2016-11-20 20:52:41 +00:00
void D3D9BE_DrawWorld ( batch_t * * worldbatches ) ;
2012-09-30 05:52:03 +00:00
qboolean D3D9BE_LightCullModel ( vec3_t org , model_t * model ) ;
void D3D9BE_SelectEntity ( entity_t * ent ) ;
2014-10-05 20:04:11 +00:00
qboolean D3D9BE_SelectDLight ( dlight_t * dl , vec3_t colour , vec3_t axis [ 3 ] , unsigned int lmode ) ;
2015-03-03 07:55:49 +00:00
void D3D9BE_VBO_Begin ( vbobctx_t * ctx , size_t maxsize ) ;
void D3D9BE_VBO_Data ( vbobctx_t * ctx , void * data , size_t size , vboarray_t * varray ) ;
2016-07-12 00:40:13 +00:00
void D3D9BE_VBO_Finish ( vbobctx_t * ctx , void * edata , size_t esize , vboarray_t * earray , void * * vbomem , void * * ebomem ) ;
void D3D9BE_VBO_Destroy ( vboarray_t * vearray , void * mem ) ;
2013-06-23 02:17:02 +00:00
void D3D9BE_Scissor ( srect_t * rect ) ;
2012-09-30 05:52:03 +00:00
void D3D9Shader_Init ( void ) ;
void D3D9BE_Reset ( qboolean before ) ;
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
void D3D9BE_Set2D ( void ) ;
2017-12-28 16:24:50 +00:00
void D3D9BE_SetViewport ( int x , int y , int w , int h ) ;
2012-09-30 05:52:03 +00:00
# endif
# ifdef D3D11QUAKE
2012-07-05 19:42:36 +00:00
void D3D11BE_Init ( void ) ;
2012-09-30 05:52:03 +00:00
void D3D11BE_Shutdown ( void ) ;
2012-07-05 19:42:36 +00:00
void D3D11BE_SelectMode ( backendmode_t mode ) ;
void D3D11BE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
2015-05-03 19:57:46 +00:00
void D3D11BE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , unsigned int beflags ) ;
2012-07-05 19:42:36 +00:00
void D3D11BE_SubmitBatch ( batch_t * batch ) ;
batch_t * D3D11BE_GetTempBatch ( void ) ;
void D3D11BE_GenBrushModelVBO ( model_t * mod ) ;
2017-11-30 17:59:11 +00:00
void D3D11BE_ClearVBO ( vbo_t * vbo , qboolean dataonly ) ;
2012-07-05 19:42:36 +00:00
void D3D11BE_UploadAllLightmaps ( void ) ;
2016-11-20 20:52:41 +00:00
void D3D11BE_DrawWorld ( batch_t * * worldbatches ) ;
2012-07-05 19:42:36 +00:00
qboolean D3D11BE_LightCullModel ( vec3_t org , model_t * model ) ;
void D3D11BE_SelectEntity ( entity_t * ent ) ;
2014-10-05 20:04:11 +00:00
qboolean D3D11BE_SelectDLight ( dlight_t * dl , vec3_t colour , vec3_t axis [ 3 ] , unsigned int lmode ) ;
2012-07-05 19:42:36 +00:00
2013-11-21 23:02:28 +00:00
qboolean D3D11Shader_Init ( unsigned int featurelevel ) ;
2012-07-05 19:42:36 +00:00
void D3D11BE_Reset ( qboolean before ) ;
2017-12-28 16:24:50 +00:00
void D3D11BE_Set2D ( void ) ;
2012-09-30 05:52:03 +00:00
void D3D11_UploadLightmap ( lightmapinfo_t * lm ) ;
2015-10-11 11:34:58 +00:00
void D3D11BE_VBO_Begin ( vbobctx_t * ctx , size_t maxsize ) ;
void D3D11BE_VBO_Data ( vbobctx_t * ctx , void * data , size_t size , vboarray_t * varray ) ;
2016-07-12 00:40:13 +00:00
void D3D11BE_VBO_Finish ( vbobctx_t * ctx , void * edata , size_t esize , vboarray_t * earray , void * * vbomem , void * * ebomem ) ;
void D3D11BE_VBO_Destroy ( vboarray_t * vearray , void * mem ) ;
2013-06-23 02:17:02 +00:00
void D3D11BE_Scissor ( srect_t * rect ) ;
2015-09-06 03:30:28 +00:00
2018-01-22 19:18:04 +00:00
qboolean D3D11_BeginShadowMap ( int id , int w , int h ) ;
void D3D11_EndShadowMap ( void ) ;
void D3D11BE_SetupForShadowMap ( dlight_t * dl , int texwidth , int texheight , float shadowscale ) ;
2015-09-06 03:30:28 +00:00
enum
{ //these are the buffer indexes
D3D11_BUFF_POS ,
D3D11_BUFF_COL ,
D3D11_BUFF_TC ,
D3D11_BUFF_LMTC ,
D3D11_BUFF_NORM ,
D3D11_BUFF_SKEL ,
D3D11_BUFF_POS2 ,
D3D11_BUFF_MAX
} ;
2011-01-04 02:56:16 +00:00
# endif
2009-11-04 21:16:50 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
//Builds a hardware shader from the software representation
void BE_GenerateProgram ( shader_t * shader ) ;
2009-11-04 21:16:50 +00:00
2013-10-08 14:28:11 +00:00
void Sh_RegisterCvars ( void ) ;
2009-11-04 21:16:50 +00:00
# ifdef RTLIGHTS
2018-11-19 06:37:25 +00:00
void R_EditLights_DrawLights ( void ) ; //3d light previews
void R_EditLights_DrawInfo ( void ) ; //2d light info display.
void R_EditLights_RegisterCommands ( void ) ;
2012-09-30 05:52:03 +00:00
//
2017-10-13 17:50:28 +00:00
# ifdef BEF_PUSHDEPTH
2014-11-03 04:45:18 +00:00
void GLBE_PolyOffsetStencilShadow ( qboolean foobar ) ;
2017-10-13 17:50:28 +00:00
# else
void GLBE_PolyOffsetStencilShadow ( void ) ;
# endif
2010-07-11 02:22:39 +00:00
//Called from shadowmapping code into backend
2019-07-02 04:12:20 +00:00
void GLBE_BaseEntTextures ( const qbyte * worldpvs , const int * worldareas ) ;
void D3D9BE_BaseEntTextures ( const qbyte * worldpvs , const int * worldareas ) ;
void D3D11BE_BaseEntTextures ( const qbyte * worldpvs , const int * worldareas ) ;
2011-12-23 03:12:29 +00:00
//prebuilds shadow volumes
void Sh_PreGenerateLights ( void ) ;
2009-11-07 13:29:15 +00:00
//Draws lights, called from the backend
2012-05-14 01:41:08 +00:00
void Sh_DrawLights ( qbyte * vis ) ;
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
void Sh_GenerateFakeShadows ( void ) ;
2022-04-23 20:10:18 +00:00
# ifdef RTLIGHTS
2013-11-21 23:02:28 +00:00
void Sh_CheckSettings ( void ) ;
2022-04-23 20:10:18 +00:00
# endif
2012-02-12 05:18:31 +00:00
void SH_FreeShadowMesh ( struct shadowmesh_s * sm ) ;
2012-09-30 05:52:03 +00:00
//frees all memory
2010-07-11 02:22:39 +00:00
void Sh_Shutdown ( void ) ;
2012-09-30 05:52:03 +00:00
//resize any textures to match new screen resize
void Sh_Reset ( void ) ;
2013-10-08 14:28:11 +00:00
qboolean Sh_StencilShadowsActive ( void ) ;
# else
# define Sh_StencilShadowsActive() false
2006-01-28 02:35:40 +00:00
# endif
2011-09-03 03:49:43 +00:00
struct shader_field_names_s
{
char * name ;
2016-07-12 00:40:13 +00:00
int ptype ;
2011-09-05 01:48:23 +00:00
} ;
extern struct shader_field_names_s shader_field_names [ ] ;
2014-03-30 08:55:06 +00:00
extern struct shader_field_names_s shader_unif_names [ ] ;
extern struct shader_field_names_s shader_attr_names [ ] ;
2016-12-19 13:31:05 +00:00
2018-11-19 06:37:25 +00:00
void CLQ1_AddSpriteQuad ( shader_t * shader , vec3_t mid , float radius ) ;
2016-12-19 13:31:05 +00:00
void CLQ1_DrawLine ( shader_t * shader , vec3_t v1 , vec3_t v2 , float r , float g , float b , float a ) ;
void CLQ1_AddOrientedCube ( shader_t * shader , vec3_t mins , vec3_t maxs , float * matrix , float r , float g , float b , float a ) ;
void CL_DrawDebugPlane ( float * normal , float dist , float r , float g , float b , qboolean enqueue ) ;
void CLQ1_AddOrientedCylinder ( shader_t * shader , float radius , float height , qboolean capsule , float * matrix , float r , float g , float b , float a ) ;
2018-04-27 16:40:50 +00:00
void CLQ1_AddOrientedSphere ( shader_t * shader , float radius , float * matrix , float r , float g , float b , float a ) ;
2016-12-19 13:31:05 +00:00
void CLQ1_AddOrientedHalfSphere ( shader_t * shader , float radius , float gap , float * matrix , float r , float g , float b , float a ) ;
2019-07-19 02:13:19 +00:00
2023-09-02 05:57:07 +00:00
extern cvar_t r_fastturb , r_fastsky , r_skyboxname , r_skybox_orientation , r_skybox_autorotate ;
2010-03-14 14:35:56 +00:00
# endif