1155 Commits

Author SHA1 Message Date
Kevin Shanahan
afdbc25f00 draw: let R_EmitCachedEdge check the cache for the caller
Move the logic for checking cached edges into R_EmitCached edge to
simplify R_RenderFace (slightly).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 07:36:43 +10:30
Kevin Shanahan
c243cbdf3f draw: tidy up some pointer arithmetic
Hopefully the compiler should optimise this just as well...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 07:03:56 +10:30
Kevin Shanahan
c801b83eab win: Try to work around unstable timers on buggy multicore setups
Apparently there are still some problems with the performance counters on
some Windows systems due to BIOS or driver bugs.

 - http://www.quaddicted.com/forum/viewtopic.php?pid=405#p405
 - http://forums.inside3d.com/viewtopic.php?p=48051#p48051
 - http://forums.inside3d.com/viewtopic.php?p=36239

Found the MS recommendations for this, which says to set CPU affinity...
not so keen on that for now, so let's implement the workaround written up
by MH (thanks!)

Thanks Spirit (http://www.quaddicted.com/) for pointing out this problem.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-07 15:40:49 +10:30
Kevin Shanahan
929d6a47ec render: only re-mark surfaces when the pvs changes
Renamed R_MarkLeaves to R_MarkSurfaces (although it still marks the
leaves and nodes).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 16:18:38 +10:30
Kevin Shanahan
70ed664c7d render: trivial cleanup in R_RecursiveClipBPoly
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 12:21:58 +10:30
Kevin Shanahan
6f0e13ebce render: cleanup in R_DrawSolidClippedSubModelPolygons
Basically just skip to the next loop iteration if polygon is back facing
and reduce the indentation of the rest of the loop body.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 12:13:20 +10:30
Kevin Shanahan
6ab27d2636 build: fix build warning on OpenBSD in rb_tree.h
OpenBSD leaks it's RB_ROOT definition from <net/if.h>, so let's rename
ours to QRB_ROOT.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 10:46:57 +10:30
Kevin Shanahan
78a731eb6c build: Fix build warning on OpenBSD
Also use __MINGW32__ define instead of _WIN32 to fix the ming32 warning.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 10:36:34 +10:30
Kevin Shanahan
989860f7fe world: remove unused function SV_TestPlayerPosition
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 16:12:33 +10:30
Kevin Shanahan
83eb2378be world: make private functions static
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 16:12:04 +10:30
Kevin Shanahan
0fc770a2ec model: split out function to OR together leafbits
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 15:52:11 +10:30
Kevin Shanahan
7785dd4584 model: create a function to efficiently count leafbits
Instead of using the foreach macro.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 15:35:17 +10:30
Kevin Shanahan
cc193e3e1c server: make sv.{pvs,phs} an array of pointers to leafbits_t
Nicely gets rid of the pointer arithmetic elsewhere in the code.

Also revealed a bug I introduced recently - need to skip the last leaf bit
when ORing the PHS together. Also realised we can skip ORing phs set #1
since it's already all ones!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 14:20:47 +10:30
Kevin Shanahan
389bb4acac model: add foreach_leafbit macro to iterate over one bits
Probably the bigger win comes from skipping over big blocks of zeros 32/64
bits at a time, but it was neat to use the ffsl function in there to take
advantage of hardware instructions to find the next set bit (i.e. bsf on
x86).

Cleaned up the proliforation of "unsigned long" throughout the code and
replaced with the leafblock_t typedef.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 12:35:21 +10:30
Kevin Shanahan
62ff8ea5b3 model: allocate the pvs cache after model loading completed
Just to tidy up the "hunk print" output.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-04 21:54:52 +10:30
Kevin Shanahan
510714db69 model: pass the hunk alloc name for GL_SubdivideSurface
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-04 21:54:04 +10:30
Kevin Shanahan
9ca1f1a972 model: add console command to check pvs cache hit/miss stats
Only of interest to someone working on the engine... could tune cache size
if use cases show it's worth it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-04 19:00:08 +10:30
Kevin Shanahan
b5e1863636 model: define a leafbits type for use with PVS/PHS operations
Uses unsigned long instead of byte so we don't need to cast between bytes
and int/long and we can use the long type for the bit tests as well. Had
to rewrite the decompress routine so that the bit order is correct within
the long words.

Things not as neat as I'd like on the QWSV side where the whole PVS/PHS
is decompressed - a bit too much pointer arithmetic to juggle but working
for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-04 18:36:50 +10:30
Kevin Shanahan
9934d75534 gl: get the r_novis pvs from the pvs cache
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 18:46:41 +10:30
Kevin Shanahan
30b140c7bd model: fix thinko in pvs cache search
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 18:27:24 +10:30
Kevin Shanahan
22f7a1821b server: remove static checkpvs buffer from PF_CheckClient
Instead of saving the PVS into a static buffer, save the leaf of the
client entity into the server_t struct and look up the PVS as needed. If
it is done frequently, the PVS cache should stop performance from
becoming too terrible.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 18:15:03 +10:30
Kevin Shanahan
30303ec00f model: trivial API consistency fixes
Constify Mod_PointInLeaf and Mod_{Leaf,Fat}PVS functions. Set a consistent
argument ordering for each, putting the model first. Renamed a couple of
local variables along the way.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 17:53:02 +10:30
Kevin Shanahan
3c40fcf6d4 model: move SV_FatPVS functionality to model.c
Re-implement SV_FatPVS as Mod_FatPVS and move to model.c. The buffer for
the FatPVS can then be allocated the appropraite size at map load time.
Also made the bitwise OR of vis data use unsigned long type for
(potentially) better efficiency.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 17:37:09 +10:30
Kevin Shanahan
9d2943d407 model: use the pvscache space for the novis pvs set
No need to keep a separate hunk of memory for the novis data set, may as
well use the cache space. Also fix the memset to be all ones instead of
zeros.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 09:30:27 +10:30
Kevin Shanahan
c2b6405cad trivial: rename local variable in R_EmitCachedEdge
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 09:18:22 +10:30
Kevin Shanahan
c41be7010a progs: remove debugging printf from PR_SetString
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 09:17:17 +10:30
Kevin Shanahan
d0f1439cee model: allocate space for decompressed leaf vis on the hunk
At level load time, allocate space for decompressed visdata on the hunk.
Not sure that a cache is really necessary in the main case, but wanted to
add it to take care of other users (pr_cmds, sv_main, sv_ents) later.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 19:07:28 +10:30
Kevin Shanahan
8bec64e9cf render: get rid of now unused frustum_indexes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 15:19:29 +10:30
Kevin Shanahan
4dffa95aff render: use BoxOnPlaneSide for view frustum clip tests
A few pieces to this one:
- Convert "minmaxs" member in mnode_t and mleaf_t to vec3_t mins/maxs
- Constify BoxOnPlaneSide arguments
- Rip out the old frustum cull tests and replace with BOPS calls

Should be a small speed improvement, but hard to measure on a modern PC.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 15:09:36 +10:30
Kevin Shanahan
851608c290 render: set the signbits when setting up the frustum planes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 14:04:07 +10:30
Kevin Shanahan
08e004721c mathlib: pull SignbitsForPlane into mathlib
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 13:55:07 +10:30
Kevin Shanahan
5a6da3adf0 mathlib: create PSIDE_* define for BoxOnPlaneSide return values
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 13:34:33 +10:30
Kevin Shanahan
591bf60a39 mathlib: move mplane_t to mathlib
We already had BoxOnPlaneSide needing it in mathlib.h, but now that
clipplane_t also using it, move it from model.h to mathlib.h.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 13:29:21 +10:30
Kevin Shanahan
82f178f89a draw: move the SIDE_* defines to drawhulls.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 12:33:02 +10:30
Kevin Shanahan
05b31ebd75 draw: use an mplane_t for the frustum clipping planes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 11:07:38 +10:30
Kevin Shanahan
f2143bddc4 model: calculate a bounding box for each bsp model surface
Will be used later for frustum clipping.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 10:56:10 +10:30
Kevin Shanahan
dd8c9132d8 render: factor out iterative drawing of node surfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 10:17:46 +10:30
Kevin Shanahan
371e16cbd8 draw: fix (safe) off-by-one error in R_RecursiveClipBPoly
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 10:17:15 +10:30
Kevin Shanahan
e5c7bf9860 draw: use TURB_TEX_SIZE define in D_DrawTurbulent8Span
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 10:13:33 +10:30
Kevin Shanahan
2cde6ead30 draw: remove unnecessary cast from malloc calls
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 10:12:22 +10:30
Kevin Shanahan
82222e3bff bsp: make btof poly stuff local to r_bsp.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 18:20:51 +10:30
Kevin Shanahan
b075c60764 client: raise MAX_VISEDICTS
Thought I had some weird bug with vis info, leaf data or something but it
was just a lack of visedicts. Wicked.bsp now playable :)

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 12:11:13 +10:30
Kevin Shanahan
66d5daa13f net: trivial model limit comment update
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 10:21:12 +10:30
Kevin Shanahan
0001b6b088 gl: bump the gl texture limits
Need a more thorough solution for this, but for now bump the lightmap
block and texture cache limits for recent "big" maps.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 10:19:12 +10:30
Kevin Shanahan
73808ef7db progs: bump the runaway execution limit
Some recent stuff hits the old limit, bump it up for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 10:17:45 +10:30
Kevin Shanahan
02074866f1 net: paranoia check for mtu <= MAX_DATAGRAM
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 10:16:33 +10:30
Kevin Shanahan
c7233c17e3 trivial: whitespace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 10:15:09 +10:30
Kevin Shanahan
65961a4502 server: trivial coding style cleanups in sv_main.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 10:14:07 +10:30
Kevin Shanahan
2701723a74 server: comment silent dropping of particle/sound messages
If not enough room in the send buffer, we silently drop messages about
particles and sounds. Get the byte counts right and make a comment about
this being done intentionally and that it's currently broken...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 09:22:54 +10:30
Kevin Shanahan
1d62b7d047 net: raise the MAX_MSGLEN/MAX_DATAGRAM limits
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-01 09:16:54 +10:30