Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_d3drender.c @ 2222:926294b2bb4e
Emphasized the separation between SDL_Surface and SDL_Texture
- SDL_Surface is a system memory representation of pixel data
- SDL_Texture is a video memory representation of pixel data
The concept of SDL_Surface with SDL_HWSURFACE is no longer used.
Separated SDL_Texture types by usage rather than memory type
- SDL_TEXTUREACCESS_STATIC is for rarely changed pixel data,
can be placed in video memory.
- SDL_TEXTUREACCESS_STREAMING is for frequently changing pixel
data, usually placed in system memory or AGP memory.
Optimized the SDL_compat usage of the OpenGL renderer by only
using one copy of the framebuffer instead of two.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 11 Aug 2007 20:54:31 +0000 |
parents | 3863ba81c1d6 |
children | e1da92da346c |
comparison
equal
deleted
inserted
replaced
2221:1d75c38e1e5c | 2222:926294b2bb4e |
---|---|
457 { | 457 { |
458 D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; | 458 D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; |
459 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 459 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
460 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 460 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
461 D3D_TextureData *data; | 461 D3D_TextureData *data; |
462 D3DPOOL pool; | |
463 HRESULT result; | 462 HRESULT result; |
464 | 463 |
465 data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data)); | 464 data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data)); |
466 if (!data) { | 465 if (!data) { |
467 SDL_OutOfMemory(); | 466 SDL_OutOfMemory(); |
468 return -1; | 467 return -1; |
469 } | 468 } |
470 | 469 |
471 texture->driverdata = data; | 470 texture->driverdata = data; |
472 | 471 |
473 #if 1 | |
474 /* FIXME: Do we want non-managed textures? | |
475 They need to be freed on device reset and then reloaded by the app... | |
476 */ | |
477 texture->access = SDL_TEXTUREACCESS_LOCAL; | |
478 #endif | |
479 if (texture->access == SDL_TEXTUREACCESS_LOCAL) { | |
480 pool = D3DPOOL_MANAGED; | |
481 } else { | |
482 pool = D3DPOOL_DEFAULT; | |
483 } | |
484 result = | 472 result = |
485 IDirect3DDevice9_CreateTexture(renderdata->device, texture->w, | 473 IDirect3DDevice9_CreateTexture(renderdata->device, texture->w, |
486 texture->h, 1, 0, | 474 texture->h, 1, 0, |
487 PixelFormatToD3DFMT(texture->format), | 475 PixelFormatToD3DFMT(texture->format), |
488 pool, &data->texture, NULL); | 476 D3DPOOL_MANAGED, &data->texture, NULL); |
489 if (FAILED(result)) { | 477 if (FAILED(result)) { |
490 D3D_SetError("CreateTexture()", result); | 478 D3D_SetError("CreateTexture()", result); |
491 return -1; | 479 return -1; |
492 } | 480 } |
493 | 481 |
626 D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; | 614 D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; |
627 RECT d3drect; | 615 RECT d3drect; |
628 D3DLOCKED_RECT locked; | 616 D3DLOCKED_RECT locked; |
629 HRESULT result; | 617 HRESULT result; |
630 | 618 |
631 if (texture->access != SDL_TEXTUREACCESS_LOCAL) { | |
632 SDL_SetError("Can't lock remote video memory"); | |
633 return -1; | |
634 } | |
635 | |
636 d3drect.left = rect->x; | 619 d3drect.left = rect->x; |
637 d3drect.right = rect->x + rect->w; | 620 d3drect.right = rect->x + rect->w; |
638 d3drect.top = rect->y; | 621 d3drect.top = rect->y; |
639 d3drect.bottom = rect->y + rect->h; | 622 d3drect.bottom = rect->y + rect->h; |
640 | 623 |