Moves Image & Renderer into rx namespace
TRAC #22002
Signed-off-by: Daniel Koch
Author: Shannon Woods
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1414 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/Blit.cpp b/src/libGLESv2/renderer/Blit.cpp
index 935ca0d..a6cd826 100644
--- a/src/libGLESv2/renderer/Blit.cpp
+++ b/src/libGLESv2/renderer/Blit.cpp
@@ -212,7 +212,7 @@
return true;
}
-bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorage2D *storage, GLint level)
+bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level)
{
// D3D9_REPLACE
IDirect3DSurface9 *source = framebuffer->getRenderTarget();
@@ -235,7 +235,7 @@
return result;
}
-bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorageCubeMap *storage, GLenum target, GLint level)
+bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level)
{
// D3D9_REPLACE
IDirect3DSurface9 *source = framebuffer->getRenderTarget();
diff --git a/src/libGLESv2/renderer/Blit.h b/src/libGLESv2/renderer/Blit.h
index ee7f128..bdb0175 100644
--- a/src/libGLESv2/renderer/Blit.h
+++ b/src/libGLESv2/renderer/Blit.h
@@ -35,8 +35,8 @@
// Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
- bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorage2D *storage, GLint level);
- bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorageCubeMap *storage, GLenum target, GLint level);
+ bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level);
+ bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level);
// Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
diff --git a/src/libGLESv2/renderer/Image.cpp b/src/libGLESv2/renderer/Image.cpp
index f3ffba4..79773e3 100644
--- a/src/libGLESv2/renderer/Image.cpp
+++ b/src/libGLESv2/renderer/Image.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-// Image.cpp: Implements the gl::Image class, which acts as the interface to
+// Image.cpp: Implements the rx::Image class, which acts as the interface to
// the actual underlying surfaces of a Texture.
#include "libGLESv2/renderer/Image.h"
@@ -19,7 +19,7 @@
#include "libGLESv2/renderer/renderer9_utils.h"
-namespace gl
+namespace rx
{
namespace
@@ -67,10 +67,10 @@
static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2)
{
- dst->R = float32ToFloat16((float16ToFloat32(src1->R) + float16ToFloat32(src2->R)) * 0.5f);
- dst->G = float32ToFloat16((float16ToFloat32(src1->G) + float16ToFloat32(src2->G)) * 0.5f);
- dst->B = float32ToFloat16((float16ToFloat32(src1->B) + float16ToFloat32(src2->B)) * 0.5f);
- dst->A = float32ToFloat16((float16ToFloat32(src1->A) + float16ToFloat32(src2->A)) * 0.5f);
+ dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
+ dst->G = gl::float32ToFloat16((gl::float16ToFloat32(src1->G) + gl::float16ToFloat32(src2->G)) * 0.5f);
+ dst->B = gl::float32ToFloat16((gl::float16ToFloat32(src1->B) + gl::float16ToFloat32(src2->B)) * 0.5f);
+ dst->A = gl::float32ToFloat16((gl::float16ToFloat32(src1->A) + gl::float16ToFloat32(src2->A)) * 0.5f);
}
};
@@ -312,7 +312,7 @@
int levelToFetch = 0;
GLsizei requestWidth = mWidth;
GLsizei requestHeight = mHeight;
- MakeValidSize(true, IsCompressed(mInternalFormat), &requestWidth, &requestHeight, &levelToFetch);
+ gl::MakeValidSize(true, gl::IsCompressed(mInternalFormat), &requestWidth, &requestHeight, &levelToFetch);
IDirect3DDevice9 *device = mRenderer->getDevice(); // D3D9_REPLACE
@@ -492,12 +492,12 @@
}
- GLsizei inputPitch = ComputePitch(width, mInternalFormat, unpackAlignment);
+ GLsizei inputPitch = gl::ComputePitch(width, mInternalFormat, unpackAlignment);
switch (mInternalFormat)
{
case GL_ALPHA8_EXT:
- if (supportsSSE2())
+ if (gl::supportsSSE2())
{
loadAlphaDataSSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
}
@@ -537,7 +537,7 @@
loadRGB565Data(width, height, inputPitch, input, locked.Pitch, locked.pBits);
break;
case GL_RGBA8_OES:
- if (supportsSSE2())
+ if (gl::supportsSSE2())
{
loadRGBAUByteDataSSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
}
@@ -970,8 +970,8 @@
return;
}
- GLsizei inputSize = ComputeCompressedSize(width, height, mInternalFormat);
- GLsizei inputPitch = ComputeCompressedPitch(width, mInternalFormat);
+ GLsizei inputSize = gl::ComputeCompressedSize(width, height, mInternalFormat);
+ GLsizei inputPitch = gl::ComputeCompressedPitch(width, mInternalFormat);
int rows = inputSize / inputPitch;
for (int i = 0; i < rows; ++i)
{
@@ -982,7 +982,7 @@
}
// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
-void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
+void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
{
IDirect3DSurface9 *renderTarget = source->getRenderTarget();
diff --git a/src/libGLESv2/renderer/Image.h b/src/libGLESv2/renderer/Image.h
index a30dc71..15f58ab 100644
--- a/src/libGLESv2/renderer/Image.h
+++ b/src/libGLESv2/renderer/Image.h
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-// Image.h: Defines the gl::Image class, which acts as the interface to
+// Image.h: Defines the rx::Image class, which acts as the interface to
// the actual underlying surfaces of a Texture.
#ifndef LIBGLESV2_RENDERER_IMAGE_H_
@@ -16,16 +16,16 @@
#include "common/debug.h"
+namespace gl
+{
+class Framebuffer;
+}
+
namespace rx
{
class Renderer9;
-}
-
-namespace gl
-{
class TextureStorage2D;
class TextureStorageCubeMap;
-class Framebuffer;
class Image
{
@@ -36,7 +36,7 @@
static void GenerateMipmap(Image *dest, Image *source);
static void Image::CopyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
- bool redefine(rx::Renderer9 *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
+ bool redefine(Renderer9 *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
void markDirty() {mDirty = true;}
void markClean() {mDirty = false;}
@@ -103,7 +103,7 @@
void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
const void *input);
- void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
+ void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
private:
DISALLOW_COPY_AND_ASSIGN(Image);
@@ -121,7 +121,7 @@
bool mDirty;
- rx::Renderer9 *mRenderer;
+ Renderer9 *mRenderer;
D3DPOOL mD3DPool; // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable.
D3DFORMAT mD3DFormat;
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index 907c166..9199a2b 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -37,15 +37,10 @@
class Display;
}
-namespace gl
+namespace rx
{
class TextureStorage2D;
class TextureStorageCubeMap;
-}
-
-namespace rx
-{
-
class Blit;
struct ConfigDesc
@@ -114,11 +109,11 @@
virtual GLsizei getMaxSupportedSamples() const = 0;
- virtual bool copyToRenderTarget(gl::TextureStorage2D *dest, gl::TextureStorage2D *source) = 0;
- virtual bool copyToRenderTarget(gl::TextureStorageCubeMap *dest, gl::TextureStorageCubeMap *source) = 0;
+ virtual bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source) = 0;
+ virtual bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source) = 0;
- virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorage2D *storage, GLint level) = 0;
- virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorageCubeMap *storage, GLenum target, GLint level) = 0;
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level) = 0;
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level) = 0;
protected:
egl::Display *mDisplay;
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index 4e9a477..d88d33f 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -515,14 +515,14 @@
return 1;
}
-bool Renderer11::copyToRenderTarget(gl::TextureStorage2D *dest, gl::TextureStorage2D *source)
+bool Renderer11::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source)
{
// TODO
UNIMPLEMENTED();
return false;
}
-bool Renderer11::copyToRenderTarget(gl::TextureStorageCubeMap *dest, gl::TextureStorageCubeMap *source)
+bool Renderer11::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source)
{
// TODO
UNIMPLEMENTED();
diff --git a/src/libGLESv2/renderer/Renderer11.h b/src/libGLESv2/renderer/Renderer11.h
index 112b70f..0997ad4 100644
--- a/src/libGLESv2/renderer/Renderer11.h
+++ b/src/libGLESv2/renderer/Renderer11.h
@@ -83,8 +83,8 @@
virtual GLsizei getMaxSupportedSamples() const;
- virtual bool copyToRenderTarget(gl::TextureStorage2D *dest, gl::TextureStorage2D *source);
- virtual bool copyToRenderTarget(gl::TextureStorageCubeMap *dest, gl::TextureStorageCubeMap *source);
+ virtual bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source);
+ virtual bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source);
// D3D11-renderer specific methods
ID3D11Device *getDevice() { return mDevice; }
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index 0254b84..44c8f56 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -576,7 +576,7 @@
if (texture)
{
- gl::TextureStorage *texStorage = texture->getNativeTexture();
+ TextureStorage *texStorage = texture->getNativeTexture();
if (texStorage)
{
d3dTexture = texStorage->getBaseTexture();
@@ -1059,7 +1059,7 @@
return D3DFMT_A8R8G8B8;
}
-bool Renderer9::copyToRenderTarget(gl::TextureStorage2D *dest, gl::TextureStorage2D *source)
+bool Renderer9::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source)
{
bool result = false;
@@ -1084,7 +1084,7 @@
return result;
}
-bool Renderer9::copyToRenderTarget(gl::TextureStorageCubeMap *dest, gl::TextureStorageCubeMap *source)
+bool Renderer9::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source)
{
bool result = false;
@@ -1130,13 +1130,13 @@
}
bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset,
- gl::TextureStorage2D *storage, GLint level)
+ TextureStorage2D *storage, GLint level)
{
return mBlit->copy(framebuffer, sourceRect, destFormat, xoffset, yoffset, storage, level);
}
bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset,
- gl::TextureStorageCubeMap *storage, GLenum target, GLint level)
+ TextureStorageCubeMap *storage, GLenum target, GLint level)
{
return mBlit->copy(framebuffer, sourceRect, destFormat, xoffset, yoffset, storage, target, level);
}
@@ -1180,7 +1180,7 @@
if (SUCCEEDED(result))
{
- gl::Image::CopyLockableSurfaces(surf, source);
+ Image::CopyLockableSurfaces(surf, source);
result = device->UpdateSurface(surf, NULL, dest, NULL);
surf->Release();
}
diff --git a/src/libGLESv2/renderer/Renderer9.h b/src/libGLESv2/renderer/Renderer9.h
index 01e79d8..c4fd36c 100644
--- a/src/libGLESv2/renderer/Renderer9.h
+++ b/src/libGLESv2/renderer/Renderer9.h
@@ -111,11 +111,11 @@
D3DFORMAT ConvertTextureInternalFormat(GLint internalformat);
- virtual bool copyToRenderTarget(gl::TextureStorage2D *dest, gl::TextureStorage2D *source);
- virtual bool copyToRenderTarget(gl::TextureStorageCubeMap *dest, gl::TextureStorageCubeMap *source);
+ virtual bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source);
+ virtual bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source);
- virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorage2D *storage, GLint level);
- virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, gl::TextureStorageCubeMap *storage, GLenum target, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level);
bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
diff --git a/src/libGLESv2/renderer/TextureStorage.cpp b/src/libGLESv2/renderer/TextureStorage.cpp
index 0743db4..acb5488 100644
--- a/src/libGLESv2/renderer/TextureStorage.cpp
+++ b/src/libGLESv2/renderer/TextureStorage.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-// TextureStorage.cpp: Implements the abstract gl::TextureStorage class and its concrete derived
+// TextureStorage.cpp: Implements the abstract rx::TextureStorage class and its concrete derived
// classes TextureStorage2D and TextureStorageCubeMap, which act as the interface to the
// D3D-side texture.
@@ -17,11 +17,11 @@
#include "common/debug.h"
-namespace gl
+namespace rx
{
unsigned int TextureStorage::mCurrentTextureSerial = 1;
-TextureStorage::TextureStorage(rx::Renderer9 *renderer, DWORD usage)
+TextureStorage::TextureStorage(Renderer9 *renderer, DWORD usage)
: mD3DUsage(usage),
mD3DPool(renderer->getTexturePool(usage)),
mRenderer(renderer),
@@ -115,15 +115,15 @@
return getBaseTexture() ? getBaseTexture()->GetLevelCount() - getLodOffset() : 0;
}
-TextureStorage2D::TextureStorage2D(rx::Renderer9 *renderer, rx::SwapChain *swapchain) : TextureStorage(renderer, D3DUSAGE_RENDERTARGET), mRenderTargetSerial(RenderbufferStorage::issueSerial())
+TextureStorage2D::TextureStorage2D(Renderer9 *renderer, rx::SwapChain *swapchain) : TextureStorage(renderer, D3DUSAGE_RENDERTARGET), mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
{
IDirect3DTexture9 *surfaceTexture = swapchain->getOffscreenTexture();
mTexture = surfaceTexture;
}
-TextureStorage2D::TextureStorage2D(rx::Renderer9 *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
+TextureStorage2D::TextureStorage2D(Renderer9 *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
: TextureStorage(renderer, GetTextureUsage(renderer->ConvertTextureInternalFormat(internalformat), usage, forceRenderable)),
- mRenderTargetSerial(RenderbufferStorage::issueSerial())
+ mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
{
mTexture = NULL;
// if the width or height is not positive this should be treated as an incomplete texture
@@ -131,7 +131,7 @@
if (width > 0 && height > 0)
{
IDirect3DDevice9 *device = renderer->getDevice(); // D3D9_REPLACE
- MakeValidSize(false, gl::IsCompressed(internalformat), &width, &height, &mLodOffset);
+ gl::MakeValidSize(false, gl::IsCompressed(internalformat), &width, &height, &mLodOffset);
HRESULT result = device->CreateTexture(width, height, levels ? levels + mLodOffset : 0, getUsage(),
renderer->ConvertTextureInternalFormat(internalformat), getPool(), &mTexture, NULL);
@@ -196,9 +196,9 @@
return mRenderTargetSerial;
}
-TextureStorageCubeMap::TextureStorageCubeMap(rx::Renderer9 *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
+TextureStorageCubeMap::TextureStorageCubeMap(Renderer9 *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
: TextureStorage(renderer, GetTextureUsage(renderer->ConvertTextureInternalFormat(internalformat), usage, forceRenderable)),
- mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
+ mFirstRenderTargetSerial(gl::RenderbufferStorage::issueCubeSerials())
{
mTexture = NULL;
// if the size is not positive this should be treated as an incomplete texture
@@ -207,7 +207,7 @@
{
IDirect3DDevice9 *device = renderer->getDevice();
int height = size;
- MakeValidSize(false, gl::IsCompressed(internalformat), &size, &height, &mLodOffset);
+ gl::MakeValidSize(false, gl::IsCompressed(internalformat), &size, &height, &mLodOffset);
HRESULT result = device->CreateCubeTexture(size, levels ? levels + mLodOffset : 0, getUsage(),
renderer->ConvertTextureInternalFormat(internalformat), getPool(), &mTexture, NULL);
@@ -270,7 +270,7 @@
unsigned int TextureStorageCubeMap::getRenderTargetSerial(GLenum target) const
{
- return mFirstRenderTargetSerial + TextureCubeMap::faceIndex(target);
+ return mFirstRenderTargetSerial + gl::TextureCubeMap::faceIndex(target);
}
}
\ No newline at end of file
diff --git a/src/libGLESv2/renderer/TextureStorage.h b/src/libGLESv2/renderer/TextureStorage.h
index 1a05b60..440bac9 100644
--- a/src/libGLESv2/renderer/TextureStorage.h
+++ b/src/libGLESv2/renderer/TextureStorage.h
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-// TextureStorage.h: Defines the abstract gl::TextureStorage class and its concrete derived
+// TextureStorage.h: Defines the abstract rx::TextureStorage class and its concrete derived
// classes TextureStorage2D and TextureStorageCubeMap, which act as the interface to the
// D3D-side texture.
@@ -22,10 +22,7 @@
class Renderer9;
class SwapChain;
class Blit;
-}
-namespace gl
-{
class TextureStorage
{
public: