Removes D3D types from the Config class
TRAC #21819
Signed-off-by: Daniel Koch
Author: Shannon Woods
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1347 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/angleutils.h b/src/common/angleutils.h
index ff9730c..45f9102 100644
--- a/src/common/angleutils.h
+++ b/src/common/angleutils.h
@@ -23,4 +23,7 @@
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE
+#define GL_BGRA4_ANGLEX 0x6ABC
+#define GL_BGR5_A1_ANGLEX 0x6ABD
+
#endif // COMMON_ANGLEUTILS_H_
diff --git a/src/libEGL/Config.cpp b/src/libEGL/Config.cpp
index af4d8e2..23a0daf 100644
--- a/src/libEGL/Config.cpp
+++ b/src/libEGL/Config.cpp
@@ -13,39 +13,38 @@
#include <algorithm>
#include <vector>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
#include "common/debug.h"
using namespace std;
namespace egl
{
-Config::Config(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
- : mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
+Config::Config(EGLenum displayFormat, EGLint displayWidth, EGLint displayHeight, EGLint minInterval, EGLint maxInterval,
+ EGLenum renderTargetFormat, EGLenum depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
+ : mDisplayFormat(displayFormat), mDisplayWidth(displayWidth), mDisplayHeight(displayHeight), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat),
+ mMultiSample(multiSample)
{
- set(displayMode, minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
+ set(minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
}
-void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
+void Config::set(EGLint minInterval, EGLint maxInterval, EGLenum renderTargetFormat, EGLenum depthStencilFormat,
+ EGLint multiSample, EGLint texWidth, EGLint texHeight)
{
mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE;
switch (renderTargetFormat)
{
- case D3DFMT_A1R5G5B5:
+ case GL_RGB5_A1:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 5;
mBlueSize = 5;
mAlphaSize = 1;
break;
- case D3DFMT_A2R10G10B10:
- mBufferSize = 32;
- mRedSize = 10;
- mGreenSize = 10;
- mBlueSize = 10;
- mAlphaSize = 2;
- break;
- case D3DFMT_A8R8G8B8:
+ case GL_RGBA8_OES:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
@@ -53,14 +52,14 @@
mAlphaSize = 8;
mBindToTextureRGBA = true;
break;
- case D3DFMT_R5G6B5:
+ case GL_RGB565:
mBufferSize = 16;
mRedSize = 5;
mGreenSize = 6;
mBlueSize = 5;
mAlphaSize = 0;
break;
- case D3DFMT_X8R8G8B8:
+ case GL_RGB8_OES:
mBufferSize = 32;
mRedSize = 8;
mGreenSize = 8;
@@ -75,52 +74,32 @@
mLuminanceSize = 0;
mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER;
- mConfigCaveat = (displayMode.Format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
+ mConfigCaveat = (mDisplayFormat == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
mConfigID = 0;
mConformant = EGL_OPENGL_ES2_BIT;
switch (depthStencilFormat)
{
- case D3DFMT_UNKNOWN:
+ case GL_NONE:
mDepthSize = 0;
mStencilSize = 0;
break;
-// case D3DFMT_D16_LOCKABLE:
-// mDepthSize = 16;
-// mStencilSize = 0;
-// break;
- case D3DFMT_D32:
+ case GL_DEPTH_COMPONENT32_OES:
mDepthSize = 32;
mStencilSize = 0;
break;
- case D3DFMT_D15S1:
- mDepthSize = 15;
- mStencilSize = 1;
- break;
- case D3DFMT_D24S8:
+ case GL_DEPTH24_STENCIL8_OES:
mDepthSize = 24;
mStencilSize = 8;
break;
- case D3DFMT_D24X8:
+ case GL_DEPTH_COMPONENT24_OES:
mDepthSize = 24;
mStencilSize = 0;
break;
- case D3DFMT_D24X4S4:
- mDepthSize = 24;
- mStencilSize = 4;
- break;
- case D3DFMT_D16:
+ case GL_DEPTH_COMPONENT16:
mDepthSize = 16;
mStencilSize = 0;
break;
-// case D3DFMT_D32F_LOCKABLE:
-// mDepthSize = 32;
-// mStencilSize = 0;
-// break;
-// case D3DFMT_D24FS8:
-// mDepthSize = 24;
-// mStencilSize = 8;
-// break;
default:
UNREACHABLE();
}
@@ -251,10 +230,11 @@
{
}
-void ConfigSet::add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
+void ConfigSet::add(EGLenum displayFormat, EGLint displayWidth, EGLint displayHeight, EGLint minSwapInterval, EGLint maxSwapInterval,
+ EGLenum renderTargetFormat, EGLenum depthStencilFormat,EGLint multiSample, EGLint texWidth, EGLint texHeight)
{
- Config config(displayMode, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
-
+ Config config(displayFormat, displayWidth, displayHeight, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat,
+ multiSample, texWidth, texHeight);
mSet.insert(config);
}
diff --git a/src/libEGL/Config.h b/src/libEGL/Config.h
index 89e2875..d241adc 100644
--- a/src/libEGL/Config.h
+++ b/src/libEGL/Config.h
@@ -13,7 +13,6 @@
#define EGLAPI
#include <EGL/egl.h>
-#include <d3d9.h>
#include <set>
@@ -26,15 +25,19 @@
class Config
{
public:
- Config(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
+ Config(EGLenum displayFormat, EGLint displayWidth, EGLint displayHeight, EGLint minSwapInterval, EGLint maxSwapInterval,
+ EGLenum renderTargetFormat, EGLenum depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
- void set(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
+ void set(EGLint minSwapInterval, EGLint maxSwapInterval, EGLenum renderTargetFormat, EGLenum depthStencilFormat,
+ EGLint multiSample, EGLint texWidth, EGLint texHeight);
EGLConfig getHandle() const;
- const D3DDISPLAYMODE mDisplayMode;
- const D3DFORMAT mRenderTargetFormat;
- const D3DFORMAT mDepthStencilFormat;
+ const EGLenum mRenderTargetFormat;
+ const EGLenum mDepthStencilFormat;
const EGLint mMultiSample;
+ const EGLint mDisplayWidth;
+ const EGLint mDisplayHeight;
+ const EGLenum mDisplayFormat;
EGLint mBufferSize; // Depth of the color buffer
EGLint mRedSize; // Bits of Red in the color buffer
@@ -98,7 +101,8 @@
public:
ConfigSet();
- void add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
+ void add(EGLenum displayFormat, EGLint displayWidth, EGLint displayHeight, EGLint minSwapInterval, EGLint maxSwapInterval,
+ EGLenum renderTargetFormat, EGLenum depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
size_t size() const;
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
const egl::Config *get(EGLConfig configHandle);
diff --git a/src/libEGL/Display.cpp b/src/libEGL/Display.cpp
index dac14f4..43134c2 100644
--- a/src/libEGL/Display.cpp
+++ b/src/libEGL/Display.cpp
@@ -16,7 +16,6 @@
#include "common/debug.h"
#include "libGLESv2/mathutil.h"
-#include "libGLESv2/utilities.h"
#include "libEGL/main.h"
@@ -60,6 +59,8 @@
return GL_DEPTH_COMPONENT16;
case D3DFMT_D24S8:
return GL_DEPTH24_STENCIL8_OES;
+ case D3DFMT_UNKNOWN:
+ return GL_NONE; // This case diverges from the one in utilities-- but this function gets removed imminently.
default:
UNREACHABLE();
}
@@ -215,7 +216,8 @@
{
// FIXME: enumerate multi-sampling
- configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, 0,
+ configSet.add(ConvertBackBufferFormat(currentDisplayMode.Format), currentDisplayMode.Width, currentDisplayMode.Height, mMinSwapInterval, mMaxSwapInterval,
+ ConvertBackBufferFormat(renderTargetFormat), ConvertDepthStencilFormat(depthStencilFormat), 0,
mRenderer->getMaxTextureWidth(), mRenderer->getMaxTextureHeight());
}
}
diff --git a/src/libEGL/Surface.cpp b/src/libEGL/Surface.cpp
index 57014e4..a63eb45 100644
--- a/src/libEGL/Surface.cpp
+++ b/src/libEGL/Surface.cpp
@@ -228,7 +228,7 @@
}
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
- mConfig->mRenderTargetFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
+ ConvertRenderbufferFormat(mConfig->mRenderTargetFormat), D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
if (FAILED(result))
{
@@ -280,9 +280,9 @@
if (mWindow)
{
D3DPRESENT_PARAMETERS presentParameters = {0};
- presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
+ presentParameters.AutoDepthStencilFormat = ConvertRenderbufferFormat(mConfig->mDepthStencilFormat);
presentParameters.BackBufferCount = 1;
- presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat;
+ presentParameters.BackBufferFormat = ConvertRenderbufferFormat(mConfig->mRenderTargetFormat);
presentParameters.EnableAutoDepthStencil = FALSE;
presentParameters.Flags = 0;
presentParameters.hDeviceWindow = getWindowHandle();
@@ -334,7 +334,8 @@
if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN)
{
- result = device->CreateDepthStencilSurface(backbufferWidth, backbufferHeight, mConfig->mDepthStencilFormat, D3DMULTISAMPLE_NONE,
+ result = device->CreateDepthStencilSurface(backbufferWidth, backbufferHeight,
+ ConvertRenderbufferFormat(mConfig->mDepthStencilFormat), D3DMULTISAMPLE_NONE,
0, FALSE, &mDepthStencil, NULL);
if (FAILED(result))
@@ -689,7 +690,7 @@
return mTexture;
}
-D3DFORMAT Surface::getFormat() const
+EGLenum Surface::getFormat() const
{
return mConfig->mRenderTargetFormat;
}
diff --git a/src/libEGL/Surface.h b/src/libEGL/Surface.h
index 40bd702..930c827 100644
--- a/src/libEGL/Surface.h
+++ b/src/libEGL/Surface.h
@@ -59,7 +59,7 @@
virtual EGLenum getTextureFormat() const;
virtual EGLenum getTextureTarget() const;
- virtual D3DFORMAT getFormat() const;
+ virtual EGLenum getFormat() const;
virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const;
diff --git a/src/libGLESv2/Context.h b/src/libGLESv2/Context.h
index b795306..d50cc15 100644
--- a/src/libGLESv2/Context.h
+++ b/src/libGLESv2/Context.h
@@ -78,10 +78,7 @@
MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,
MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
- MAX_DRAW_BUFFERS = 1,
-
- GL_BGRA4_ANGLEX = 0x6ABC,
- GL_BGR5_A1_ANGLEX = 0x6ABD
+ MAX_DRAW_BUFFERS = 1
};
enum QueryType
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index 467a970..14a6b8c 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -1835,20 +1835,7 @@
{
releaseTexImage();
- GLint internalformat;
-
- switch(surface->getFormat())
- {
- case D3DFMT_A8R8G8B8:
- internalformat = GL_RGBA8_OES;
- break;
- case D3DFMT_X8R8G8B8:
- internalformat = GL_RGB8_OES;
- break;
- default:
- UNIMPLEMENTED();
- return;
- }
+ GLint internalformat = surface->getFormat();
mImageArray[0].redefine(internalformat, surface->getWidth(), surface->getHeight(), true);