Allocates a texture rather than an offscreen plain surface for new textures.

TRAC #12908 Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@396 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent d36c2971
...@@ -307,17 +307,22 @@ void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei ...@@ -307,17 +307,22 @@ void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei
void Texture::setImage(GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *img) void Texture::setImage(GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *img)
{ {
IDirect3DTexture9 *newTexture = NULL;
IDirect3DSurface9 *newSurface = NULL; IDirect3DSurface9 *newSurface = NULL;
if (width != 0 && height != 0) if (width != 0 && height != 0)
{ {
HRESULT result = getDevice()->CreateOffscreenPlainSurface(width, height, selectFormat(format), D3DPOOL_SYSTEMMEM, &newSurface, NULL); //HRESULT result = getDevice()->CreateOffscreenPlainSurface(width, height, selectFormat(format), D3DPOOL_SYSTEMMEM, &newSurface, NULL);
HRESULT result = getDevice()->CreateTexture(width, height, 1, NULL, selectFormat(format), D3DPOOL_SYSTEMMEM, &newTexture, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return error(GL_OUT_OF_MEMORY); return error(GL_OUT_OF_MEMORY);
} }
newTexture->GetSurfaceLevel(0, &newSurface);
newTexture->Release();
} }
if (img->surface) img->surface->Release(); if (img->surface) img->surface->Release();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment