Hash :
76d3e6e0
Author :
Date :
2012-10-31T19:55:33
Rename renderer namespace to rx Trac #21999 Author: Shannon Woods Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1379 736b8ea6-26fd-11df-bfd4-992fa37f6226
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
//
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// TextureStorage.h: Defines the abstract gl::TextureStorage class and its concrete derived
// classes TextureStorage2D and TextureStorageCubeMap, which act as the interface to the
// D3D-side texture.
#ifndef LIBGLESV2_TEXTURESTORAGE_H_
#define LIBGLESV2_TEXTURESTORAGE_H_
#define GL_APICALL
#include <GLES2/gl2.h>
#include <d3d9.h>
#include "common/debug.h"
namespace rx
{
class SwapChain;
}
namespace gl
{
class Blit;
class TextureStorage
{
public:
explicit TextureStorage(DWORD usage);
virtual ~TextureStorage();
static DWORD GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable);
static bool IsTextureFormatRenderable(D3DFORMAT format);
static D3DFORMAT ConvertTextureInternalFormat(GLint internalformat);
static Blit *getBlitter();
bool isRenderTarget() const;
bool isManaged() const;
D3DPOOL getPool() const;
DWORD getUsage() const;
unsigned int getTextureSerial() const;
virtual IDirect3DBaseTexture9 *getBaseTexture() const = 0;
virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
int getLodOffset() const;
int levelCount();
protected:
static bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
int mLodOffset;
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage);
const DWORD mD3DUsage;
const D3DPOOL mD3DPool;
const unsigned int mTextureSerial;
static unsigned int issueTextureSerial();
static unsigned int mCurrentTextureSerial;
};
class TextureStorage2D : public TextureStorage
{
public:
explicit TextureStorage2D(rx::SwapChain *swapchain);
TextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
virtual ~TextureStorage2D();
static bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source);
IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty);
virtual IDirect3DBaseTexture9 *getBaseTexture() const;
void generateMipmap(int level);
virtual unsigned int getRenderTargetSerial(GLenum target) const;
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage2D);
IDirect3DTexture9 *mTexture;
const unsigned int mRenderTargetSerial;
};
class TextureStorageCubeMap : public TextureStorage
{
public:
TextureStorageCubeMap(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
virtual ~TextureStorageCubeMap();
static bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source);
IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty);
virtual IDirect3DBaseTexture9 *getBaseTexture() const;
void generateMipmap(int face, int level);
virtual unsigned int getRenderTargetSerial(GLenum target) const;
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorageCubeMap);
IDirect3DCubeTexture9 *mTexture;
const unsigned int mFirstRenderTargetSerial;
};
}
#endif // LIBGLESV2_TEXTURESTORAGE_H_