Go to file
Sam Lantinga 38549a7bba Fixed bug 2625 - Direct3D9 with SDL_TEXTUREACCESS_TARGET textures causes an application crash
Roberto

I have debugged the code checking the function calls when Direct3D is the renderer, remember that with software and OpenGL renderers, this issue is not happening.

- Create the texture:
SDL_Texture *pTex = SDL_CreateTexture(pRenderer, iFormat, SDL_TEXTUREACCESS_TARGET, pSurf->w, pSurf->h);

- Update the texture:
SDL_UpdateTexture(pTex, NULL, pSurf->pixels, pSurf->pitch);
  SDL_render.c, SDL_UpdateTexture(): return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
    SDL_render_d3d.c, D3D_UpdateTexture(): if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
      SDL_render_d3d.c, D3D_UpdateTextureRep(): if (D3D_CreateStagingTexture(device, texture) < 0) {
        SDL_render_d3d.c, D3D_CreateStagingTexture(): result = IDirect3DDevice9_CreateTexture(..., D3DPOOL_SYSTEMMEM, ...) --> FAIL! with INVALIDCALL code

After checking a bit the Microsoft documentation, I found this:

D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT. (https://msdn.microsoft.com/en-us/library/windows/desktop/bb172625%28v=vs.85%29.aspx)

The call that fails, is using D3DUSAGE_RENDERTARGET with D3DPOOL_SYSTEMMEM which is unsupported, hence the INVALIDCALL return code.
2015-06-04 00:56:11 -07:00
VisualC Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
VisualC-WinRT Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Xcode Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Xcode-iOS Fixed building test programs on the iOS simulator 2015-05-28 18:57:57 -07:00
acinclude Fix a libtool issue with some mingw-w64 cross compilers (thanks, Ozkan!). 2015-05-26 19:54:06 -04:00
android-project Android: Added missing space in three log messages. 2015-05-31 19:23:16 +02:00
build-scripts Script from Sylvain to automate updating the copyright year 2015-05-26 06:27:12 -07:00
cmake Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
debian Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
docs Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
include Fixed SDL_ISPIXELFORMAT_ALPHA to check pixel orders that match pixel type. 2015-05-31 01:45:20 -04:00
premake X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
src Fixed bug 2625 - Direct3D9 with SDL_TEXTUREACCESS_TARGET textures causes an application crash 2015-06-04 00:56:11 -07:00
test testmessage: Try Unicode chars in the title, too. 2015-05-31 23:53:10 -04:00
visualtest Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
.hgignore Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Android.mk Android: Replaced spaces with tab in Android.mk file. 2015-05-06 21:11:06 +02:00
BUGS.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
CMakeLists.txt CMake: Slightly better fix for installation target (thanks, Anthony!). 2015-04-22 20:25:19 -04:00
COPYING.txt Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
CREDITS.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
INSTALL.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.minimal Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.pandora Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.psp Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.wiz Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
README-SDL.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
README.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
SDL2.spec.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
TODO.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
VisualC.html Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
WhatsNew.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
autogen.sh Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
cmake_uninstall.cmake.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
configure X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
configure.in X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
sdl2-config.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
sdl2.m4 Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
sdl2.pc.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00

README.txt

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.


                         Simple DirectMedia Layer

                                  (SDL)

                                Version 2.0

---
http://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting
with README.md

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)