dramatic fps drop when using transparent texture

Started by
38 comments, last by 21st Century Moose 11 years, 4 months ago

i've attached a program i wrote to test your video settings, tell me if it still gives you an generic rendering context.


Hi slicer4ever, with your program i do get hardware acceleration!!! This program is running on my gpu.
Here is the output

VIDEO CONTEXT INFORMATION
VENDOR: NVIDIA Corporation
RENDER: GeForce GT555M/PCIe/SSE2
VERSION: 4.2.0
COLOR BITS: 32
DEPTH BITS: 24

Can you tell me what did you use to create the window?
Advertisement
ok, so i've dug through sdl to figure out how it initializes the pfd, and similar things, and try these settings:

SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 0); //Changed!
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 0); //Changed!
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 0 ); //Changed!
SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32); //Added!
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 ); //Changed!
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if ( fsaa ) {
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
}
if ( accel ) {
SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 );
}
if ( sync ) {
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 );
} else {
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 );
}
if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}

their is one other thing i'm curiose about, after looking through the code, but let's try this first.
also, sorry about the late response.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Hi,
thanks for the response.
ive made the changes you suggested and still doesnt get HW acceleration. Ive also modified the "bpp" bits per pixel parameter and set it to 0 and get the same result i get by default 8 bpp.

So nothing changed. You want me to try anything else?
hmm, this is a perplexing problem, looking at sdl's source, it does a few things differently then my engine for creating a window/video context, but i don't see why this should cause you not to receive a hardware context.

i'm going to assume you are capable of compiling SDL, if not respond here and i'll see if i can't compile a binary for you with the changes.

note that i'm working with SDL-1.2.15(which a quick look at libsdl.org appears to be still the current version.)

so, my suspicion is that wglChoosePixelFormatARB is the culprit(or at least a parameter to it is causing the problem).

so let's comment out wglChoosePixelFormatARB, and use the default pixel format.
in SDL_wingl.c (src/video/wincommon/), comment lines 147-157.

this should be sufficient since it only uses the arb method if it's available for use(and i'm assuming it is available on most modern hardware), and defaults back to the regular PFD method instead.

so compile sdl, and run the test again, if this creates a hardware context, then it would appear this is the problem(or at least one of the parameter's it recieves creates a bad context). if not, i'm not really certain what the problem is, i'm no guru for sdl's internals, but by the look of things it should be similar to how i do things in my engine.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Hi slicer4ever,

I would rather prefer if u could provide me with the modified SDL library for x86 :) as im not very used to compile libraries with visual studio.
alright, i've compiled the changes:

http://www.sendspace.com/file/6vjaty

i also disabled directX since i don't have the sdk installed, and we arn't using directX, so i don't think it should be a problem.

(note the *D variants are debug versions)
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Hi, ive replaced SDL.lib and SDLmain.lib in release mode and this is what i get with one of the code examples:

Screen BPP: 24
Vendor : Microsoft Corporation
Renderer : GDI Generic
Version : 1.1.0
Extensions : GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture
SDL_GL_RED_SIZE: requested 8, got 8
SDL_GL_GREEN_SIZE: requested 8, got 8
SDL_GL_BLUE_SIZE: requested 8, got 8
SDL_GL_DEPTH_SIZE: requested 24, got 32
SDL_GL_DOUBLEBUFFER: requested 1, got 1
SDL_GL_ACCELERATED_VISUAL: requested 1, got 1

still no hw acceleration.....

i dont know if i should ask in the nvidia forums or rather in the dell xps forums as it's more related to my computer configuration....

Do you have any other idea?
it defiantly would be a good point to post in nvidia forums, i'm finding it difficult to successfully follow SDL's init pathways(so many IFDef's for different OS's/config flags =-/) from what i can tell, it's doing pretty much a 1:1(or very near anyways) with my own engine's window creation code, this is assuming that i'm following the correct config flags.

anyway, i'm going to post my window creation code(cleaned up to work as a stand-alone function):



unsigned char CreateVideoContextWindows(unsigned int BorderFlag=WS_OVERLAPPEDWINDOW, unsigned int BorderFlagEx=WS_EX_APPWINDOW|WS_EX_WINDOWEDGE, const char *ClassName, unsigned char StencilBits, unsigned char AccumBits, unsigned char DepthBits, unsigned char ColorBits){
unsigned int PixelFormat=0;
HINSTANCE m_HInstance = GetModuleHandle(0x0);
HWND m_HWnd = 0x0;
HDC m_HDc = 0x0;
HGLRC m_HGlrc = 0x0;
int m_x = 0;
int m_y = 0;
WNDCLASS WndClass={CS_HREDRAW|CS_VREDRAW|CS_OWNDC, QWWindowsProc, 0, 0, m_HInstance, LoadIcon(0x0, IDI_WINLOGO), LoadCursor(0x0, IDC_ARROW),0x0, 0x0, ClassName};
if(!RegisterClass(&WndClass)){
MessageBox(NULL, "Error: 'RegisterClass'", "ERROR", MB_OK|MB_ICONEXCLAMATION);
return 0;
}
RECT WndRect={0, 0, m_Width, m_Height};
AdjustWindowRectEx(&WndRect, BorderFlag, 0, BorderFlagEx);
if(!(m_HWnd = CreateWindowEx(BorderFlagEx, ClassName, m_Title, WS_CLIPSIBLINGS|WS_CLIPCHILDREN|BorderFlag, m_x, m_y, WndRect.right-WndRect.left, WndRect.bottom-WndRect.top, 0x0, 0x0, m_HInstance, 0x0))){
MessageBox(0x0, "Error: 'CreateWindowEx'", "ERROR", MB_OK|MB_ICONINFORMATION);
UnregisterClass(ClassName, m_HInstance);
return 0;
}
PIXELFORMATDESCRIPTOR pfd={sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, ColorBits, 0, 0, 0, 0, 0, 0, 0, 0, AccumBits, 0, 0, 0, 0, DepthBits, StencilBits, 0, 0, 0, 0, 0, 0};
if(!(m_HDc=GetDC(m_HWnd))){
MessageBox(NULL, "Error: 'GetDC'", "ERROR", MB_OK|MB_ICONINFORMATION);
DestroyWindow(m_HWnd);
UnregisterClass(ClassName, m_HInstance);
return 0;
}
if(!(PixelFormat=ChoosePixelFormat(m_HDc, &pfd))){
MessageBox(NULL, "Error: 'ChoosePixelFormat'", "ERROR", MB_OK|MB_ICONINFORMATION);
ReleaseDC(m_HWnd, m_HDc);
DestroyWindow(m_HWnd);
UnregisterClass(ClassName, m_HInstance);
return 0;
}
if(!SetPixelFormat(m_HDc, PixelFormat, &pfd)){
MessageBox(NULL, "Error: 'SetPixelFormat'", "ERROR", MB_OK|MB_ICONINFORMATION);
ReleaseDC(m_HWnd, m_HDc);
DestroyWindow(m_HWnd);
UnregisterClass(ClassName, m_HInstance);
return 0;
}
if(!(m_HGlrc=wglCreateContext(m_HDc))){
MessageBox(NULL, "Error: 'wglCreateContext'", "ERROR", MB_OK|MB_ICONINFORMATION);
ReleaseDC(m_HWnd, m_HDc);
DestroyWindow(m_HWnd);
UnregisterClass(ClassName, m_HInstance);
return 0;
}
if(!(wglMakeCurrent(m_HDc, m_HGlrc))){
MessageBox(NULL, "Error: 'wglMakeCurrent'", "ERROR", MB_OK|MB_ICONINFORMATION);
wglDeleteContext(m_HGlrc);
ReleaseDC(m_HWnd, m_HDc);
DestroyWindow(m_HWnd);
UnregisterClass(ClassName, m_HInstance);
return 0;
}
SetForegroundWindow(m_HWnd);
SetFocus(m_HWnd);
return 1;
}
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
As stupid as it may sound (and I may have skipped something in this thread)... did you try setting the color buffer to 32-bit instead of 24-bit? Also a 24-bit depth buffer only makes sense with an 8-bit stencil buffer if I recall correctly (both are shared making up a 32-bit buffer together).
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

Also a 24-bit depth buffer only makes sense with an 8-bit stencil buffer if I recall correctly (both are shared making up a 32-bit buffer together).


Context creation should automatically give you 32 bit with 24 bits for depth and the remaining 8 either unused or for stencil (it's important to check this after creation as if it gives you stencil - even if you don't explicitly request it - you will want to clear stencil at the same time as depth in order to get fast clears, but that's a separate matter). Rarely it will give you 16 bit or 32 bit depth but it can happen too.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement