fteqw/engine/sw/sw.h

185 lines
4.2 KiB
C
Raw Normal View History

typedef struct
{
texcom_t com;
char name[64];
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
{
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);
texid_tf SW_LoadTexture(char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags);
texid_tf SW_LoadTexture8Pal24(char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
texid_tf SW_LoadTexture8Pal32(char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags);
texid_tf SW_LoadCompressed(char *name);
texid_tf SW_FindTexture(char *identifier, unsigned int flags);
------------------------------------------------------------------------ r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines removed MAX_VISEDICTS limit. PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default. TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW. added android multitouch emulation for windows/rawinput (in_simulatemultitouch). split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature. now using utf-8 for windows consoles. qcc warnings/errors now give clickable console links for quick+easy editing. disabled menutint when the currently active item changes contrast or gamma (for OneManClan). Added support for drawfont/drawfontscale. tweaked the qcvm a little to reduce the number of pointers. .doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up. windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings. fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen. editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts. Added support for .framegroups files for psk(psa) and iqm formats. True support for ezquake's colour codes. Mutually exclusive with background colours. path command output slightly more readable. added support for digest_hex (MD4, SHA1, CRC16). skingroups now colourmap correctly. Fix terrain colour hints, and litdata from the wrong bsp. fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported). remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother. fix v *= v.x and similar opcodes. fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported. fteqcc: fixed '#if 1 == 3 && 4' parsing. fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable. fteqcc: copyright message now includes compile date instead. fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile. fteqccgui: the output window is now focused and scrolls down as compilation progresses. pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue. rewrote prespawn/modelist/soundlist code. server tracks progress now. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
texid_tf SW_AllocNewTexture(char *identifier, int w, int h, unsigned int flags);
void SW_Upload(texid_t tex, char *name, uploadfmt_t fmt, void *data, void *palette, int width, int height, unsigned int flags);
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, struct texnums_s *texnums, 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);
void SWBE_SelectDLight(struct dlight_s *dl, vec3_t colour);
qboolean SWBE_LightCullModel(vec3_t org, struct model_s *model);
void SWBE_Set2D(void);