# Can't create hardware surfaces (windows XP + geforce3 28.32 drivers + SDL 1.2.4)

**URL:** <https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779>\
**Category:** SDL Development\
**Created:** [June 2, 2002, 4:48am UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779 "2002-06-02T04:48:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yannis\_Deliyannis](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/y/7cd45c/32.png) [@Yannis\_Deliyannis](https://discourse.libsdl.org/u/Yannis_Deliyannis)\
**Post date:** [June 2, 2002, 4:48am UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779/1 "2002-06-02T04:48:00Z")

</div>

hello all,

All my surfaces are created in system memory even though SDL\_GetVideoInfo()  
tells me that hardware acceleration is possible on my video card and even  
though i create my surfaces with the HW\_SURFACE flag.  
I’m coding under win32 (winXP) and using a nvidia geforce3 card with the  
latest drivers (28.32) and the SDL 1.2.4 precompiled library and runtime.  
Any ideas ?

thanks in advance,

@Yannis_Deliyannis

---

<div class="post-metadata">

**Author:** ![Jonathan\_Atkins](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@Jonathan\_Atkins](https://discourse.libsdl.org/u/Jonathan_Atkins)\
**Post date:** [June 2, 2002, 9:40am UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779/2 "2002-06-02T09:40:01Z")

</div>

Yannis Deliyannis wrote:

> hello all,
> 
> All my surfaces are created in system memory even though SDL\_GetVideoInfo()  
> tells me that hardware acceleration is possible on my video card and even  
> though i create my surfaces with the HW\_SURFACE flag.  
> I’m coding under win32 (winXP) and using a nvidia geforce3 card with the  
> latest drivers (28.32) and the SDL 1.2.4 precompiled library and runtime.  
> Any ideas ?

try adding |SDL\_FULLSCREEN also in the SDL\_SetVideoMode call flags parameter

AKAIK, HW surfaces are not available in windowed mode on windows at this time in SDL.–  
-==-  
Jon Atkins  
[http://jcatki.2y.net/](http://jcatki.2y.net/)

---

<div class="post-metadata">

**Author:** ![Yannis\_Deliyannis](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/y/7cd45c/32.png) [@Yannis\_Deliyannis](https://discourse.libsdl.org/u/Yannis_Deliyannis)\
**Post date:** [June 2, 2002, 11:32am UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779/3 "2002-06-02T11:32:00Z")

</div>

> > hello all,
> > 
> > All my surfaces are created in system memory even though  
> > SDL\_GetVideoInfo()  
> > tells me that hardware acceleration is possible on my video card and  
> > even  
> > though i create my surfaces with the HW\_SURFACE flag.  
> > I’m coding under win32 (winXP) and using a nvidia geforce3 card with the  
> > latest drivers (28.32) and the SDL 1.2.4 precompiled library and  
> > runtime.  
> > Any ideas ?
> 
> try adding |SDL\_FULLSCREEN also in the SDL\_SetVideoMode call flags  
> parameter
> 
> AKAIK, HW surfaces are not available in windowed mode on windows at this  
> time in SDL.

I’ve tried launching my app in fullscreen and it only works with software  
surfaces : when i try to create hardware surfaces, the app launches then  
exit abruptly without displaying anything. By tracing the initialisation  
process, i see that it happens just after setting the video mode and  
creating the first surface, both of which are indeed created in video  
memory. It crashes when trying to create the second hardware surface. More  
surprising, the video memory available after creating the screen surface and  
the first offscreen surface is bigger than what it is initially.  
I’ve copied and pasted the stdout.txt log my app is creating when launched :

SDL initialized.  
Hardware surfaces are available (127360K video memory).  
SDL video mode set to 800x600x32.  
Screen is in video memory (128304K video memory).  
Screen has double-buffering enabled.  
SDL loaded bitmap : data\tileset\_normal.bmp on new surface (326 x 62 x 4).  
Screen is in video memory (128304K video memory).

After loading the bitmap on the new surface, the app exits. Shouldn’t the  
video memory be less than the initial value after creating the screen  
surface and the bitmap surface ?  
What i’m also wondering is if my code was bad, why does my app works  
perfectly in software mode and not in hardware (fullscreen in software works  
ok).

any more ideas 😉 ?

@Yannis_Deliyannis

---

<div class="post-metadata">

**Author:** ![Nicolai\_Haehnle](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/cc9497/32.png) [@Nicolai\_Haehnle](https://discourse.libsdl.org/u/Nicolai_Haehnle)\
**Post date:** [June 2, 2002, 11:42am UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779/4 "2002-06-02T11:42:01Z")

</div>

> SDL initialized.  
> Hardware surfaces are available (127360K video memory).  
> SDL video mode set to 800x600x32.  
> Screen is in video memory (128304K video memory).  
> Screen has double-buffering enabled.  
> SDL loaded bitmap : data\tileset\_normal.bmp on new surface (326 x 62 x 4).  
> Screen is in video memory (128304K video memory).
> 
> After loading the bitmap on the new surface, the app exits. Shouldn’t the  
> video memory be less than the initial value after creating the screen  
> surface and the bitmap surface ?

What resolution is your desktop set at? Maybe the desktop uses more video  
memory than the mode you set.

> What i’m also wondering is if my code was bad, why does my app works  
> perfectly in software mode and not in hardware (fullscreen in software  
> works ok).

Maybe you’re trying to access surface memory directly without locking?

cu,  
NicolaiAm Sonntag, 2. Juni 2002 20:30 schrieb Yannis Deliyannis:

---

<div class="post-metadata">

**Author:** ![Yannis\_Deliyannis](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/y/7cd45c/32.png) [@Yannis\_Deliyannis](https://discourse.libsdl.org/u/Yannis_Deliyannis)\
**Post date:** [June 2, 2002, 12:16pm UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779/5 "2002-06-02T12:16:01Z")

</div>

> > After loading the bitmap on the new surface, the app exits. Shouldn’t  
> > the  
> > video memory be less than the initial value after creating the screen  
> > surface and the bitmap surface ?
> 
> What resolution is your desktop set at? Maybe the desktop uses more video  
> memory than the mode you set.

You’re right. My desktop was at 1024x768 and my app was running in 800x600.  
That makes for the difference.  
But when i launch the app in the same resolution as my desktop, the amount  
of video memory now stays the same. Odd ?

> > What i’m also wondering is if my code was bad, why does my app works  
> > perfectly in software mode and not in hardware (fullscreen in software  
> > works ok).
> 
> Maybe you’re trying to access surface memory directly without locking?

Once again, i think you’re right. I’ve managed to trace down the problem to  
my GetPixel() function. I wasn’t locking the surface before accessing it.  
I’m locking it and unlocking it now but it still doesn’t work. Can someone  
post an example of a getpixel() function ?

Thanks for the reply,

@Yannis_Deliyannis

---

<div class="post-metadata">

**Author:** ![Nicolai\_Haehnle](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/cc9497/32.png) [@Nicolai\_Haehnle](https://discourse.libsdl.org/u/Nicolai_Haehnle)\
**Post date:** [June 2, 2002, 1:51pm UTC](https://discourse.libsdl.org/t/cant-create-hardware-surfaces-windows-xp-geforce3-28-32-drivers-sdl-1-2-4/6779/6 "2002-06-02T13:51:01Z")

</div>

[http://sdldoc.csn.ul.ie/guidevideo.php#AEN115](http://sdldoc.csn.ul.ie/guidevideo.php#AEN115) - don’t you just love the FM? ;p

The most likely mistake is that you didn’t use the surface pitch in your  
calculations.

cu,  
NicolaiAm Sonntag, 2. Juni 2002 21:14 schrieb Yannis Deliyannis:

> Once again, i think you’re right. I’ve managed to trace down the problem to  
> my GetPixel() function. I wasn’t locking the surface before accessing it.  
> I’m locking it and unlocking it now but it still doesn’t work. Can someone  
> post an example of a getpixel() function ?
