// Increments refcount on surface. // caller must Release() the returned surface gl::Error TextureStorage9_2D::getSurfaceLevel(GLenum target, int level, bool dirty, IDirect3DSurface9 **outSurface) { ASSERT(target == GL_TEXTURE_2D); UNUSED_ASSERTION_VARIABLE(target); IDirect3DBaseTexture9 *baseTexture = NULL; gl::Error error = getBaseTexture(&baseTexture); if (error.isError()) { return error; } IDirect3DTexture9 *texture = static_cast<IDirect3DTexture9*>(baseTexture); HRESULT result = texture->GetSurfaceLevel(level + mTopLevel, outSurface); ASSERT(SUCCEEDED(result)); if (FAILED(result)) { return gl::Error(GL_OUT_OF_MEMORY, "Failed to get the surface from a texture, result: 0x%X.", result); } // With managed textures the driver needs to be informed of updates to the lower mipmap levels if (level + mTopLevel != 0 && isManaged() && dirty) { texture->AddDirtyRect(NULL); } return gl::Error(GL_NO_ERROR); }
// Increments refcount on surface. // caller must Release() the returned surface angle::Result TextureStorage9_2D::getSurfaceLevel(const gl::Context *context, gl::TextureTarget target, int level, bool dirty, IDirect3DSurface9 **outSurface) { ASSERT(target == gl::TextureTarget::_2D); IDirect3DBaseTexture9 *baseTexture = nullptr; ANGLE_TRY(getBaseTexture(context, &baseTexture)); IDirect3DTexture9 *texture = static_cast<IDirect3DTexture9 *>(baseTexture); HRESULT result = texture->GetSurfaceLevel(level + mTopLevel, outSurface); ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to get the surface from a texture"); // With managed textures the driver needs to be informed of updates to the lower mipmap levels if (level + mTopLevel != 0 && isManaged() && dirty) { texture->AddDirtyRect(nullptr); } return angle::Result::Continue; }