fteqw/engine/sw/sw.h

180 lines
3.8 KiB
C
Raw Normal View History

typedef struct
{
int pwidth;
int pheight;
int pwidthmask;
int pheightmask;
int pitch;
unsigned int data[1];
} swimage_t;
typedef struct
{
float matrix[16];
vec4_t viewplane;
} swuniforms_t;
typedef struct
{
volatile unsigned int readpoint; //the command queue point its reading from
void *thread;
#ifdef _DEBUG
float idletime;
float activetime;
#endif
unsigned int interlaceline;
unsigned int interlacemod;
unsigned int threadnum; //for relocating viewport info
unsigned int *vpdbuf;
unsigned int *vpcbuf;
unsigned int vpwidth;
unsigned int vpheight;
swuniforms_t u;
qintptr_t vpcstride;
struct workqueue_s *wq;
} swthread_t;
typedef struct
{
int scoord[2];
float zicoord;
vec4_t vcoord;
vec2_t tccoord;
vec2_t lmcoord;
byte_vec4_t colour;
unsigned int clipflags; /*1=left,2=right,4=top,8=bottom,16=near*/
} swvert_t;
#define WQ_SIZE 1024*1024*8
#define WQ_MASK (WQ_SIZE-1)
#define WQ_MAXTHREADS 64
struct workqueue_s
{
unsigned int numthreads;
qbyte queue[WQ_SIZE];
volatile unsigned int pos;
swthread_t swthreads[WQ_MAXTHREADS];
};
extern struct workqueue_s commandqueue;
enum wqcmd_e
{
WTC_DIE,
WTC_SYNC,
WTC_NEWFRAME,
WTC_NOOP,
WTC_VIEWPORT,
WTC_TRIFAN,
WTC_TRISOUP,
WTC_SPANS,
WTC_UNIFORMS
};
enum
{
CLIP_LEFT_FLAG = 1,
CLIP_RIGHT_FLAG = 2,
CLIP_TOP_FLAG = 4,
CLIP_BOTTOM_FLAG = 8,
CLIP_NEAR_FLAG = 16,
CLIP_FAR_FLAG = 32
};
typedef union
{
unsigned char align[16];
struct wqcom_s
{
enum wqcmd_e command;
unsigned int cmdsize;
} com;
struct
{
struct wqcom_s com;
swimage_t *texture;
int numverts;
swvert_t verts[1];
} trifan;
struct
{
struct wqcom_s com;
swimage_t *texture;
int numverts;
int numidx;
swvert_t verts[1];
} trisoup;
struct
{
struct wqcom_s com;
unsigned int *cbuf;
unsigned int *dbuf;
unsigned int width;
unsigned int height;
qintptr_t stride;
unsigned int interlace;
unsigned int framenum;
qboolean cleardepth;
qboolean clearcolour;
} viewport;
struct
{
struct wqcom_s com;
swuniforms_t u;
} uniforms;
struct
{
int foo;
} spans;
} wqcom_t;
void SWRast_EndCommand(struct workqueue_s *wq, wqcom_t *com);
wqcom_t *SWRast_BeginCommand(struct workqueue_s *wq, int cmdtype, unsigned int size);
void SWRast_Sync(struct workqueue_s *wq);
qboolean SW_VID_Init(rendererstate_t *info, unsigned char *palette);
void SW_VID_DeInit(void);
qboolean SW_VID_ApplyGammaRamps (unsigned short *ramps);
char *SW_VID_GetRGBInfo(int prepad, int *truevidwidth, int *truevidheight);
void SW_VID_SetWindowCaption(char *msg);
void SW_VID_SwapBuffers(void);
void SW_VID_UpdateViewport(wqcom_t *com);
void SW_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
qboolean SW_LoadTextureMips (texid_t tex, struct pendingtextureinfo *mips);
void SW_DestroyTexture (texid_t tex);
void SWBE_SelectMode(backendmode_t mode);
void SWBE_DrawMesh_List(shader_t *shader, int nummeshes, struct mesh_s **mesh, struct vbo_s *vbo, struct texnums_s *texnums, unsigned int be_flags);
void SWBE_DrawMesh_Single(shader_t *shader, struct mesh_s *meshchain, struct vbo_s *vbo, unsigned int be_flags);
void SWBE_SubmitBatch(struct batch_s *batch);
struct batch_s *SWBE_GetTempBatch(void);
void SWBE_DrawWorld(qboolean drawworld, qbyte *vis);
void SWBE_Init(void);
void SWBE_GenBrushModelVBO(struct model_s *mod);
void SWBE_ClearVBO(struct vbo_s *vbo);
void SWBE_UploadAllLightmaps(void);
void SWBE_SelectEntity(struct entity_s *ent);
qboolean SWBE_SelectDLight(struct dlight_s *dl, vec3_t colour, vec3_t axis[3], unsigned int lmode);
qboolean SWBE_LightCullModel(vec3_t org, struct model_s *model);
rewrote ban code, merging bans+nonbans+cuffs+mute+cripple+deaf+lagged+vip. added timeouts. new penalties have no dedicated command. use the addip command for it. maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
2014-03-30 09:55:06 +01:00
void SWBE_RenderToTextureUpdate2d(qboolean destchanged);
void SWBE_Set2D(void);