Doom 3 engine release and game code
Moderator: InsideQC Admins
Re: Doom 3 engine release and game code
Might be Cg
also the bfg edition is lots faster so im looking forward to see the changes 
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Thought i had nailed the ATI bug with my new version but im still getting reports from users saying that they only get about 2 fps with it sigh
.
Im unable to find out what may cause this but if its the removal of ATI specific render code then i give up :S
Im unable to find out what may cause this but if its the removal of ATI specific render code then i give up :S
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Btw could someone test this ? its a replacement for Doom3's broken code for getting availiable videomem from intel blackbook.
edit nope does not work returns zero videomem :S
- Code: Select all
int Sys_GetVideoRam(void)
{
DWORD i[5] = { 0, 0, 0x27, 0, 0 };
DWORD o[5] = { 0, 0, 0, 0, 0 };
HDC hdc = CreateDC("DISPLAY", 0, 0, 0);
if (hdc == NULL)
{
return 0;
}
int s = ExtEscape(hdc, 0x7032, 0x14, (LPCSTR)i, 0x14, (LPSTR)o);
DeleteDC(hdc);
if (s <= 0)
{
return 0;
}
return (int) o[3] * 1048576;
}
edit nope does not work returns zero videomem :S
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
How about making a guess based on the GL_VERSION? Something like: if it's 2.0 or 2.1 assume 256, if it's 3.x assume 512, 4.x or higher assume 1 GB? Or even just assume at least 1 GB and unlock Ultra mode/etc.
Doom 3's extension getting interface is bugged by the way. It gets extensions based on "GL_ARB_extension_name_goes_here", whereas it should be "GL_ARB_extension_name_goes_here " - the GL spec specifies that the extensions string is space-delimited, and the original code will fail on a driver that exports "GL_ARB_extension_name_goes_here_and_more_text" but not "GL_ARB_extension_name_goes_here".
Or even better, just use GLEW and drop the old "qgl" crap.
Doom 3's extension getting interface is bugged by the way. It gets extensions based on "GL_ARB_extension_name_goes_here", whereas it should be "GL_ARB_extension_name_goes_here " - the GL spec specifies that the extensions string is space-delimited, and the original code will fail on a driver that exports "GL_ARB_extension_name_goes_here_and_more_text" but not "GL_ARB_extension_name_goes_here".
Or even better, just use GLEW and drop the old "qgl" crap.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Doom 3 engine release and game code
glGetString(GL_EXTENSIONS) is removed in gl3 core for reasons like that. 
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: Doom 3 engine release and game code
Yep working on that
still few hurdles im using the source mh provided me with earlier but it has a weird bug that causes models to be lighted oddly.
I also nailed the FPS drop my source has in comparison with normal Doom3 its caused by the shared ARB2/GLSL renderer
the original ARB2 only backend does rendering twice as fast as to what causes it im not sure tbh but maybe mh had an idea. Found out the hard way by reverting draw_arb2.cpp.
I also nailed the FPS drop my source has in comparison with normal Doom3 its caused by the shared ARB2/GLSL renderer
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Rofl well i finally nailed the weird shading but it was not in a place i would have expected
Seems mh's early source was subject to some experimentation so he removed a ton of the image code
like downsampling blendmodes etc. Well the blendmode he had set fubared the model shading
so i reverted most of it and now it works 100%.
http://code.google.com/p/realm/downloads/detail?name=MHDoom3-24-10-2012.7z&can=2&q=
Try it out and let me know how it works for you
im also interrested in hearing if ATI users have any problems with this.
like downsampling blendmodes etc. Well the blendmode he had set fubared the model shading
http://code.google.com/p/realm/downloads/detail?name=MHDoom3-24-10-2012.7z&can=2&q=
Try it out and let me know how it works for you
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
The shared ARB2/GLSL renderer needs to switch back and forth between both shader types in order to draw shadows/surfaces/shadows/surfaces/etc, so there's a lot of "switch off ARB2/switch on GLSL/draw/switch off GLSL/switch on ARB2/draw" and so forth. A GLSL replacement for the shadow program wouldn't be a bad idea to prevent that.
In theory there should be absolutely minimal difference in performance between ARB shaders and GLSL. A really good GLSL compiler could pull some optimizations, including platform-specific optimizations, that hand-written ARB shaders might miss, so if anything GLSL may run faster - provided that switching didn't happen.
GLSL also allows for functionality from higher GL_VERSIONs that can run faster, whereas ARB shaders (with the exception of NVIDIA's proprietary extensions) don't.
So the summary is that there's no future in maintaining the ARB backend, but it does need a full switchover for all of the other shaders first.
Right now I've no major interest in the Doom 3 code; waiting on the BFG edition GPL release, then things should get exciting!
In theory there should be absolutely minimal difference in performance between ARB shaders and GLSL. A really good GLSL compiler could pull some optimizations, including platform-specific optimizations, that hand-written ARB shaders might miss, so if anything GLSL may run faster - provided that switching didn't happen.
GLSL also allows for functionality from higher GL_VERSIONs that can run faster, whereas ARB shaders (with the exception of NVIDIA's proprietary extensions) don't.
So the summary is that there's no future in maintaining the ARB backend, but it does need a full switchover for all of the other shaders first.
Right now I've no major interest in the Doom 3 code; waiting on the BFG edition GPL release, then things should get exciting!
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Doom 3 engine release and game code
Aye also looking forward to see what the BFG edition code looks like
State changes ... shudder well it certainly makes a rather hefty impact on fps :S might explain whats going on.
Btw just for the lulz i tried using your optmized memcpy for copying the matrixes. It netted me an fps increase of 10 fps
nice job m8.
Your old code might be nice for someone as a cleansrc though
it runs pretty well here but im still scared like hell of those ATI users 
State changes ... shudder well it certainly makes a rather hefty impact on fps :S might explain whats going on.
Btw just for the lulz i tried using your optmized memcpy for copying the matrixes. It netted me an fps increase of 10 fps
Your old code might be nice for someone as a cleansrc though
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
reckless wrote:Btw just for the lulz i tried using your optmized memcpy for copying the matrixes. It netted me an fps increase of 10 fpsnice job m8.
Yeah, it's fast.
id's original SIMD memcpy replacements are actually slower than regular memcpy on machines these days. I guess they made sense back in 2004, but nowadays you only really need a memcpy replacement if you've benchmarked and know that it's a slow spot for you.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Doom 3 engine release and game code
Quite a lot slower :/ the SIMD memcpy also uses asm but speedwise they are not nice.
Asm can be a bitch to learn so Hats of for your first attempt to work this nicely
Asm can be a bitch to learn so Hats of for your first attempt to work this nicely
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
reckless wrote:Btw could someone test this ? its a replacement for Doom3's broken code for getting availiable videomem from intel blackbook.
- Code: Select all
int Sys_GetVideoRam(void)
{
DWORD i[5] = { 0, 0, 0x27, 0, 0 };
DWORD o[5] = { 0, 0, 0, 0, 0 };
HDC hdc = CreateDC("DISPLAY", 0, 0, 0);
if (hdc == NULL)
{
return 0;
}
int s = ExtEscape(hdc, 0x7032, 0x14, (LPCSTR)i, 0x14, (LPSTR)o);
DeleteDC(hdc);
if (s <= 0)
{
return 0;
}
return (int) o[3] * 1048576;
}
edit nope does not work returns zero videomem :S
memory stats for ati and nv
- Code: Select all
void R_VideoInfo_f(void){
#ifdef _WIN32
int mem[4];
if (strstr(gl_config.extensions_string, "GL_NVX_gpu_memory_info")) {
Com_Printf("\nNvidia specific memory info:\n");
Com_Printf("\n");
qglGetIntegerv ( GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX , mem);
Com_Printf("dedicated video memory %i MB\n", mem[0] >>10);
qglGetIntegerv ( GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX , mem);
Com_Printf("total available memory %i MB\n", mem[0] >>10);
qglGetIntegerv ( GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX , mem);
Com_Printf("currently unused GPU memory %i MB\n", mem[0] >>10);
qglGetIntegerv ( GPU_MEMORY_INFO_EVICTION_COUNT_NVX , mem);
Com_Printf("count of total evictions seen by system %i MB\n", mem[0] >>10);
qglGetIntegerv ( GPU_MEMORY_INFO_EVICTED_MEMORY_NVX , mem);
Com_Printf("total video memory evicted %i MB\n", mem[0] >>10);
} else
if (strstr(gl_config.extensions_string, "GL_ATI_meminfo")) {
Com_Printf("\nATI/AMD specific memory info:\n");
Com_Printf("\n");
qglGetIntegerv (VBO_FREE_MEMORY_ATI, mem);
Com_Printf("VBO: total memory free in the pool %i MB\n", mem[0] >> 10);
Com_Printf("VBO: largest available free block in the pool %i MB\n", mem[1] >> 10);
Com_Printf("VBO: total auxiliary memory free %i MB\n", mem[2] >> 10);
Com_Printf("VBO: largest auxiliary free block %i MB\n", mem[3] >> 10);
qglGetIntegerv (TEXTURE_FREE_MEMORY_ATI, mem);
Com_Printf("Texture: total memory free in the pool %i MB\n", mem[0] >> 10);
Com_Printf("Texture: largest available free block in the pool %i MB\n", mem[1] >> 10);
Com_Printf("Texture: total auxiliary memory free %i MB\n", mem[2] >> 10);
Com_Printf("Texture: largest auxiliary free block %i MB\n", mem[3] >> 10);
qglGetIntegerv (RENDERBUFFER_FREE_MEMORY_ATI, mem);
Com_Printf("RenderBuffer: total memory free in the pool %i MB\n", mem[0] >> 10);
Com_Printf("RenderBuffer: largest available free block in the pool %i MB\n", mem[1] >> 10);
Com_Printf("RenderBuffer: total auxiliary memory free %i MB\n", mem[2] >> 10);
Com_Printf("RenderBuffer: largest auxiliary free block %i MB\n", mem[3] >> 10);
}
else
#endif
Com_Printf("MemInfo not availabled for your video card or driver!\n");
}
-

Barnes - Posts: 226
- Joined: Thu Dec 24, 2009 2:26 pm
- Location: Russia, Moscow
Re: Doom 3 engine release and game code
Hmm interresting using the VBO's as a way to get videomem
thanks.
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Something to try.
SSE2 version converted from the MACOSX code.
the casts are needed cause msvc will go bonkers if there not there
if someone has an idea for a more correct way lets have a look at it.
SSE2 version converted from the MACOSX code.
- Code: Select all
void R_LocalPointToGlobal (const float modelMatrix[16], const idVec3 &in, idVec3 &out)
{
__m128 m0, m1, m2, m3;
__m128 in0, in1, in2;
float i0, i1, i2;
i0 = in[0];
i1 = in[1];
i2 = in[2];
m0 = _mm_loadu_ps (&modelMatrix[0]);
m1 = _mm_loadu_ps (&modelMatrix[4]);
m2 = _mm_loadu_ps (&modelMatrix[8]);
m3 = _mm_loadu_ps (&modelMatrix[12]);
in0 = _mm_load1_ps (&i0);
in1 = _mm_load1_ps (&i1);
in2 = _mm_load1_ps (&i2);
m0 = _mm_mul_ps (m0, in0);
m1 = _mm_mul_ps (m1, in1);
m2 = _mm_mul_ps (m2, in2);
m0 = _mm_add_ps (m0, m1);
m0 = _mm_add_ps (m0, m2);
m0 = _mm_add_ps (m0, m3);
_mm_store_ss (&out[0], m0);
m1 = (__m128 &) _mm_shuffle_epi32 ((__m128i &) m0, 0x55);
_mm_store_ss (&out[1], m1);
m2 = _mm_movehl_ps (m2, m0);
_mm_store_ss (&out[2], m2);
}
the casts are needed cause msvc will go bonkers if there not there
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Who is online
Users browsing this forum: No registered users and 1 guest