Skip to content

Commit

Permalink
Merge pull request #218 from actionquake/skullernet-master1014
Browse files Browse the repository at this point in the history
Skullernet master1014
  • Loading branch information
darkshade9 authored Oct 14, 2024
2 parents 81dab91 + 1b95904 commit 2fa4d6b
Show file tree
Hide file tree
Showing 33 changed files with 1,117 additions and 354 deletions.
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/1_bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ assignees: ''

Make sure the bug is reproducible with latest Q2PRO version. If you compile
Q2PRO yourself, update to the latest version from git master. If you are using
prebuilt Windows binaries, update to the latest version available from
https://skuller.net/q2pro/nightly/
prebuilt Windows binaries, update to the latest nightly build.

### Important information

Expand Down Expand Up @@ -51,3 +50,8 @@ Provide a link to the log file created by launching `q2pro +set developer 1
If Q2PRO crashes, provide a crash report (Windows) or a backtrace (Linux). On
Linux, backtrace can be created by launching Q2PRO with `gdb q2pro --args
[...]` and typing `bt` after the crash.

### Compilation issues

If reporting a building / compilation issue, provide `meson setup` command
line and full console output.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 nasm python3-pip ninja-build
sudo python3 -m pip install meson
sudo apt-get install -y gcc-mingw-w64 nasm meson ninja-build
- name: Build
run: |
Expand Down
7 changes: 5 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,14 @@ with SIMD support:

Meson needs correct cross build definition file for compilation. Example
cross-files can be found in `.ci` subdirectory (available in git
repository, but not source tarball).
repository, but not source tarball). Note that these cross-files are specific
to CI scripts and shouldn't be used directly (you'll need, at least, to
customize default `pkg-config` search path). Refer to Meson documentation for
more info.

Setup build directory:

meson setup --cross-file .ci/x86_64-w64-mingw32.txt -Dwrap_mode=forcefallback builddir
meson setup --cross-file x86_64-w64-mingw32.txt -Dwrap_mode=forcefallback builddir

Build:

Expand Down
9 changes: 9 additions & 0 deletions doc/client.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,15 @@ gl_md5_distance::
the viewer, otherwise use original model. Default value is 2048. Setting
this to 0 disables distance LOD.

gl_gpulerp::
Enables alias model interpolation on GPU for potential rendering
speedup. Default value is 1 (auto). If using OpenGL core profile, this
option is always enabled. If not using GLSL backend, this option is always
disabled.
- 0 — disabled
- 1 — auto (enabled on OpenGL 4.3 and higher)
- 2 — force enabled

gl_glowmap_intensity::
Intensity factor for entity glowmaps. Default value is 0.75.

Expand Down
2 changes: 1 addition & 1 deletion inc/refresh/refresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ typedef enum {
IF_OPAQUE = BIT(8), // known to be opaque
IF_DEFAULT_FLARE = BIT(9), // default flare hack
IF_CUBEMAP = BIT(10), // cubemap (or part of it)
IF_CLASSIC_SKY = BIT(11), // split in two halves

// these flags only affect R_RegisterImage() behavior,
// and are not stored in image
IF_OPTIONAL = BIT(16), // don't warn if not found
IF_KEEP_EXTENSION = BIT(17), // don't override extension
IF_CLASSIC_SKY = BIT(18), // split in two halves
} imageflags_t;

typedef enum {
Expand Down
5 changes: 3 additions & 2 deletions inc/system/hunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ typedef struct {

void Hunk_Init(void);
void Hunk_Begin(memhunk_t *hunk, size_t maxsize);
void *Hunk_TryAlloc(memhunk_t *hunk, size_t size);
void *Hunk_Alloc(memhunk_t *hunk, size_t size);
void *Hunk_TryAlloc(memhunk_t *hunk, size_t size, size_t align);
void *Hunk_Alloc(memhunk_t *hunk, size_t size, size_t align);
void Hunk_FreeToWatermark(memhunk_t *hunk, size_t size);
void Hunk_End(memhunk_t *hunk);
void Hunk_Free(memhunk_t *hunk);
24 changes: 15 additions & 9 deletions src/client/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ void CL_EmitDemoFrame(void)
// emit and flush frame
emit_delta_frame(oldframe, &cl.frame, lastframe, FRAME_CUR);

if (cls.demo.buffer.cursize + msg_write.cursize > cls.demo.buffer.maxsize) {
if (msg_write.overflowed) {
Com_WPrintf("%s: message buffer overflowed\n", __func__);
} else if (cls.demo.buffer.cursize + msg_write.cursize > cls.demo.buffer.maxsize) {
Com_DPrintf("Demo frame overflowed (%u + %u > %u)\n",
cls.demo.buffer.cursize, msg_write.cursize, cls.demo.buffer.maxsize);
cls.demo.frames_dropped++;
Expand Down Expand Up @@ -850,16 +852,20 @@ void CL_EmitDemoSnapshot(void)
MSG_WriteByte(svc_layout);
MSG_WriteString(cl.layout);

snap = Z_Malloc(sizeof(*snap) + msg_write.cursize - 1);
snap->framenum = cls.demo.frames_read;
snap->filepos = pos;
snap->msglen = msg_write.cursize;
memcpy(snap->data, msg_write.data, msg_write.cursize);
if (msg_write.overflowed) {
Com_WPrintf("%s: message buffer overflowed\n", __func__);
} else {
snap = Z_Malloc(sizeof(*snap) + msg_write.cursize - 1);
snap->framenum = cls.demo.frames_read;
snap->filepos = pos;
snap->msglen = msg_write.cursize;
memcpy(snap->data, msg_write.data, msg_write.cursize);

cls.demo.snapshots = Z_Realloc(cls.demo.snapshots, sizeof(cls.demo.snapshots[0]) * Q_ALIGN(cls.demo.numsnapshots + 1, MIN_SNAPSHOTS));
cls.demo.snapshots[cls.demo.numsnapshots++] = snap;
cls.demo.snapshots = Z_Realloc(cls.demo.snapshots, sizeof(cls.demo.snapshots[0]) * Q_ALIGN(cls.demo.numsnapshots + 1, MIN_SNAPSHOTS));
cls.demo.snapshots[cls.demo.numsnapshots++] = snap;

Com_DPrintf("[%d] snaplen %u\n", cls.demo.frames_read, msg_write.cursize);
Com_DPrintf("[%d] snaplen %u\n", cls.demo.frames_read, msg_write.cursize);
}

SZ_Clear(&msg_write);

Expand Down
17 changes: 17 additions & 0 deletions src/client/gtv.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ static byte gtv_send_buffer[MAX_GTS_MSGLEN*2];

static byte gtv_message_buffer[MAX_MSGLEN];

static void drop_client(const char *reason);

static void build_gamestate(void)
{
centity_t *ent;
Expand Down Expand Up @@ -177,6 +179,13 @@ void CL_GTV_EmitFrame(void)

MSG_WriteShort(0); // end of packetentities

// check for overflow
if (msg_write.overflowed) {
SZ_Clear(&msg_write);
drop_client("frame overflowed");
return;
}

SZ_Write(&cls.gtv.message, msg_write.data, msg_write.cursize);
SZ_Clear(&msg_write);
}
Expand Down Expand Up @@ -264,6 +273,14 @@ void CL_GTV_Resume(void)

build_gamestate();
emit_gamestate();

// check for overflow
if (msg_write.overflowed) {
SZ_Clear(&msg_write);
drop_client("gamestate overflowed");
return;
}

write_message(GTS_STREAM_DATA);
SZ_Clear(&msg_write);
}
Expand Down
12 changes: 7 additions & 5 deletions src/common/bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ static cvar_t *map_visibility_patch;
===============================================================================
*/

#define BSP_ALIGN 64

#define BSP_ALLOC(size) \
Hunk_Alloc(&bsp->hunk, size)
Hunk_Alloc(&bsp->hunk, size, BSP_ALIGN)

#define BSP_ERROR(msg) \
Com_SetLastError(va("%s: %s", __func__, msg))
Expand Down Expand Up @@ -544,9 +546,9 @@ static size_t BSP_ParseLightgridHeader(bsp_t *bsp, const byte *in, size_t filele
}

return
Q_ALIGN(sizeof(grid->nodes[0]) * grid->numnodes, 64) +
Q_ALIGN(sizeof(grid->leafs[0]) * grid->numleafs, 64) +
Q_ALIGN(sizeof(grid->samples[0]) * grid->numsamples * grid->numstyles, 64);
Q_ALIGN(sizeof(grid->nodes[0]) * grid->numnodes, BSP_ALIGN) +
Q_ALIGN(sizeof(grid->leafs[0]) * grid->numleafs, BSP_ALIGN) +
Q_ALIGN(sizeof(grid->samples[0]) * grid->numsamples * grid->numstyles, BSP_ALIGN);
}

static bool BSP_ValidateLightgrid_r(const lightgrid_t *grid, uint32_t nodenum)
Expand Down Expand Up @@ -812,7 +814,7 @@ int BSP_Load(const char *name, bsp_t **bsp_p)
count++;

// round to cacheline
memsize += Q_ALIGN(count * info->memsize, 64);
memsize += Q_ALIGN(count * info->memsize, BSP_ALIGN);
maxpos = max(maxpos, ofs + len);
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void Com_Error(error_type_t code, const char *fmt, ...)
// overlap with one of the arguments!
memcpy(com_errorMsg, msg, len + 1);

// fix up drity message buffers
// fix up dirty message buffers
MSG_Init();

// abort any console redirects
Expand Down
8 changes: 3 additions & 5 deletions src/common/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,12 @@ void SetupRotationMatrix(vec3_t matrix[3], const vec3_t dir, float degrees)
void RotatePointAroundVector(vec3_t out, const vec3_t dir, const vec3_t in, float degrees)
{
vec3_t matrix[3];
vec3_t tmp;
vec3_t temp;

SetupRotationMatrix(matrix, dir, degrees);

VectorCopy(in, tmp);
out[0] = DotProduct(tmp, matrix[0]);
out[1] = DotProduct(tmp, matrix[1]);
out[2] = DotProduct(tmp, matrix[2]);
VectorCopy(in, temp);
VectorRotate(temp, matrix, out);
}

#if USE_MD5
Expand Down
11 changes: 4 additions & 7 deletions src/common/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,16 @@ const usercmd_t nullUserCmd;
=============
MSG_Init
Initialize default buffers, clearing allow overflow/underflow flags.
This is the only place where writing buffer is initialized. Writing buffer is
never allowed to overflow.
Reading buffer is reinitialized in many other places. Reinitializing will set
the allow underflow flag as appropriate.
Initialize default buffers (also called from Com_Error).
This is the only place where writing buffer is initialized.
=============
*/
void MSG_Init(void)
{
SZ_Init(&msg_read, msg_read_buffer, MAX_MSGLEN, "msg_read");
SZ_Init(&msg_write, msg_write_buffer, MAX_MSGLEN, "msg_write");
msg_read.allowunderflow = true;
msg_write.allowoverflow = true;
}


Expand Down
1 change: 1 addition & 0 deletions src/refresh/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ static void GL_DrawDebugLines(void)
return;

GL_LoadMatrix(glr.viewmatrix);
GL_LoadUniforms();
GL_BindTexture(TMU_TEXTURE, TEXNUM_WHITE);
GL_BindArrays(VA_NULLMODEL);
GL_ArrayBits(GLA_VERTEX | GLA_COLOR);
Expand Down
Loading

0 comments on commit 2fa4d6b

Please sign in to comment.