Search found 63 matches
- Sun May 06, 2012 4:03 pm
- Forum: OpenGL Programming
- Topic: Optimizing
- Replies: 25
- Views: 20636
Re: Optimizing
I finally got it working properly. There was a problem with glTexSubImage2D, where it wouldn't wrap to the starting rectangle-specified column of each row in the source buffer, screwing up the lightmap textures. I ended up uploading the entire width of each changed area. I had to change this: qglTex...
- Sat May 05, 2012 5:50 am
- Forum: Engine Programming
- Topic: External Texture Load Speed
- Replies: 22
- Views: 3516
Re: External Texture Load Speed
Based on Baker's approach, I whipped up some quick code that returns a bit flag based on file extension. This can be easily customized based on what file types an engine uses. More than 32 extensions will require a 64-bit integer type. char *type_extensions[] = { "bsp", "md2", &q...
- Thu Apr 26, 2012 11:00 pm
- Forum: Engine Programming
- Topic: External Texture Load Speed
- Replies: 22
- Views: 3516
Re: External Texture Load Speed
The first thing I did was to make sure that it wasn't trying to load each replacement texture more than once (this is in Q2, BTW, so there is no set of textures in the BSP, just surfaces with texture names). If you use a hash table, you'll just end up string comparing every entry in pak files that d...
- Mon Apr 23, 2012 1:38 am
- Forum: OpenGL Programming
- Topic: Optimizing
- Replies: 25
- Views: 20636
Re: Optimizing
Spike: That lightmap_surfaces pointer array is just a leftover from the old, removed two-pass lightmap blending code. I might repurpose it, though.
mh: Do the existing checks handle updates for the first frame when a surface is no longer dynamically lit, so that dlights are removed?
mh: Do the existing checks handle updates for the first frame when a surface is no longer dynamically lit, so that dlights are removed?
- Sun Apr 22, 2012 5:45 pm
- Forum: OpenGL Programming
- Topic: Optimizing
- Replies: 25
- Views: 20636
Re: Optimizing
Unfortunately, Q2 doesn't use texturechains for lightmapped surfaces, but only for warp and transparent surfaces. Also, aren't texture arrays incompatible with using fixed pipeline functions? It will be a while before I'm doing everything with fragment programs. But an array for updated copies of li...
- Sun Apr 22, 2012 3:34 am
- Forum: OpenGL Programming
- Topic: Optimizing
- Replies: 25
- Views: 20636
Re: Optimizing
Quake2 uses a temp lightmap image slot for the updates it does per-surface right before rendering each face. Batching these at the start of each frame will obviously require creating a second set of lightmap textures that are updated copies of the originals. Minimizing uploads means updating each li...
- Sat Apr 07, 2012 7:02 pm
- Forum: Engine Programming
- Topic: String Safety
- Replies: 56
- Views: 15444
Re: String Safety
I induced an _vnsprinf overflow in KMQ2 (built under VS2008, I _vsnprinted the startup GL extension strings into a too-small buffer), and it didn't cause a crash. There were a few corrupt-looking chars at the end of the text, but KMQ2 didn't experience an error or crash. The only place in KMQ2 where...
- Thu Apr 05, 2012 1:45 am
- Forum: OpenGL Programming
- Topic: Optimizing
- Replies: 25
- Views: 20636
Re: Optimizing
That's GL_RGBA for all lightmaps, right? By scheduling updates you mean creating a set of dynamic lightmaps with dlights/lightstyles blended in BEFORE rendering world surfaces?mh wrote:[*]Changing lightmaps to native GPU formats and scheduling updates to reduce pipeline stalls.
- Wed Apr 04, 2012 11:15 pm
- Forum: Engine Programming
- Topic: String Safety
- Replies: 56
- Views: 15444
Re: String Safety
You still didn't answer my question of whether calls to _vsnprintf that don't capture the return value are unsafe, or if I could safely handle return values of -1, like this: void Com_sprintf (char *dest, int size, char *fmt, ...) { int len; va_list argptr; char bigbuffer[0x10000]; va_start (argptr,...
- Wed Apr 04, 2012 5:57 pm
- Forum: Engine Programming
- Topic: String Safety
- Replies: 56
- Views: 15444
Re: String Safety
Does the return -1 trigger a fault in _vsnprintf, or in the code that calls it, if that code expects an unsigned value for the return or something? TTimo used this in the released Q3 source (abstracted as Q_vsnprintf), and never used the return value. This is the only place in my source that uses th...
- Mon Apr 02, 2012 10:49 pm
- Forum: Engine Programming
- Topic: String Safety
- Replies: 56
- Views: 15444
Re: String Safety
There's also Q_strncatz from QFusion and Quake2Evolved: void Q_strncatz (char *dst, const char *src, int dstSize) { if (!dst) Com_Error(ERR_FATAL, "Q_strncatz: NULL dst"); if (!src) Com_Error(ERR_FATAL, "Q_strncatz: NULL src"); if (dstSize < 1) Com_Error(ERR_FATAL, "Q_strnca...
- Tue Mar 27, 2012 7:25 pm
- Forum: Engine Programming
- Topic: DEBUGGING without DEBUG
- Replies: 20
- Views: 3619
Re: DEBUGGING without DEBUG
It was the byte order functions, or more specifically the function pointers that are bound on startup after detecting byte order. I did a build that bypassed them, hardcoding function calls, and it worked perfectly. After referring to the RtCW source, I found that the pointers needed to be static to...
- Mon Mar 26, 2012 4:06 pm
- Forum: Engine Programming
- Topic: DEBUGGING without DEBUG
- Replies: 20
- Views: 3619
Re: DEBUGGING without DEBUG
I switched everything to _vsnprintf 2.5 years ago when the driver-induced crashes first started happening. EDIT: The crash happens after the renderer init, when a driver-related crash like that would happen. The main menu and its images have always already loaded. It usually happens when it's attemp...
- Mon Mar 26, 2012 4:33 am
- Forum: Engine Programming
- Topic: DEBUGGING without DEBUG
- Replies: 20
- Views: 3619
Re: DEBUGGING without DEBUG
Just tried it again since I added PNG support (addition of libpng). The old Com_Dprintf additions don't prevent the crash anymore, and the crash now happens somewhere in the cinematic code (I added Com_Dprintf outputs before each function call). It happens in slightly different places with each buil...
- Mon Mar 26, 2012 12:50 am
- Forum: Engine Programming
- Topic: DEBUGGING without DEBUG
- Replies: 20
- Views: 3619
Re: DEBUGGING without DEBUG
I've had a vaguely similar problem when compiling KMQ2 under newer Visual Studio versions (2003 and all later versions) and not under under VC6, which I have used for a long time. Debug builds work fine, but release builds always crash on startup. I used the process of elimination to find out it was...