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
parent e7b2f056
...@@ -23,4 +23,7 @@ ...@@ -23,4 +23,7 @@
#define VENDOR_ID_INTEL 0x8086 #define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE #define VENDOR_ID_NVIDIA 0x10DE
#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD
#endif // COMMON_ANGLEUTILS_H_ #endif // COMMON_ANGLEUTILS_H_
...@@ -13,39 +13,38 @@ ...@@ -13,39 +13,38 @@
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include "common/debug.h" #include "common/debug.h"
using namespace std; using namespace std;
namespace egl namespace egl
{ {
Config::Config(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight) Config::Config(EGLenum displayFormat, EGLint displayWidth, EGLint displayHeight, EGLint minInterval, EGLint maxInterval,
: mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample) 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; mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE; mBindToTextureRGBA = EGL_FALSE;
switch (renderTargetFormat) switch (renderTargetFormat)
{ {
case D3DFMT_A1R5G5B5: case GL_RGB5_A1:
mBufferSize = 16; mBufferSize = 16;
mRedSize = 5; mRedSize = 5;
mGreenSize = 5; mGreenSize = 5;
mBlueSize = 5; mBlueSize = 5;
mAlphaSize = 1; mAlphaSize = 1;
break; break;
case D3DFMT_A2R10G10B10: case GL_RGBA8_OES:
mBufferSize = 32;
mRedSize = 10;
mGreenSize = 10;
mBlueSize = 10;
mAlphaSize = 2;
break;
case D3DFMT_A8R8G8B8:
mBufferSize = 32; mBufferSize = 32;
mRedSize = 8; mRedSize = 8;
mGreenSize = 8; mGreenSize = 8;
...@@ -53,14 +52,14 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter ...@@ -53,14 +52,14 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mAlphaSize = 8; mAlphaSize = 8;
mBindToTextureRGBA = true; mBindToTextureRGBA = true;
break; break;
case D3DFMT_R5G6B5: case GL_RGB565:
mBufferSize = 16; mBufferSize = 16;
mRedSize = 5; mRedSize = 5;
mGreenSize = 6; mGreenSize = 6;
mBlueSize = 5; mBlueSize = 5;
mAlphaSize = 0; mAlphaSize = 0;
break; break;
case D3DFMT_X8R8G8B8: case GL_RGB8_OES:
mBufferSize = 32; mBufferSize = 32;
mRedSize = 8; mRedSize = 8;
mGreenSize = 8; mGreenSize = 8;
...@@ -75,52 +74,32 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter ...@@ -75,52 +74,32 @@ void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInter
mLuminanceSize = 0; mLuminanceSize = 0;
mAlphaMaskSize = 0; mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER; mColorBufferType = EGL_RGB_BUFFER;
mConfigCaveat = (displayMode.Format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG; mConfigCaveat = (mDisplayFormat == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
mConfigID = 0; mConfigID = 0;
mConformant = EGL_OPENGL_ES2_BIT; mConformant = EGL_OPENGL_ES2_BIT;
switch (depthStencilFormat) switch (depthStencilFormat)
{ {
case D3DFMT_UNKNOWN: case GL_NONE:
mDepthSize = 0; mDepthSize = 0;
mStencilSize = 0; mStencilSize = 0;
break; break;
// case D3DFMT_D16_LOCKABLE: case GL_DEPTH_COMPONENT32_OES:
// mDepthSize = 16;
// mStencilSize = 0;
// break;
case D3DFMT_D32:
mDepthSize = 32; mDepthSize = 32;
mStencilSize = 0; mStencilSize = 0;
break; break;
case D3DFMT_D15S1: case GL_DEPTH24_STENCIL8_OES:
mDepthSize = 15;
mStencilSize = 1;
break;
case D3DFMT_D24S8:
mDepthSize = 24; mDepthSize = 24;
mStencilSize = 8; mStencilSize = 8;
break; break;
case D3DFMT_D24X8: case GL_DEPTH_COMPONENT24_OES:
mDepthSize = 24; mDepthSize = 24;
mStencilSize = 0; mStencilSize = 0;
break; break;
case D3DFMT_D24X4S4: case GL_DEPTH_COMPONENT16:
mDepthSize = 24;
mStencilSize = 4;
break;
case D3DFMT_D16:
mDepthSize = 16; mDepthSize = 16;
mStencilSize = 0; mStencilSize = 0;
break; break;
// case D3DFMT_D32F_LOCKABLE:
// mDepthSize = 32;
// mStencilSize = 0;
// break;
// case D3DFMT_D24FS8:
// mDepthSize = 24;
// mStencilSize = 8;
// break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
...@@ -251,10 +230,11 @@ ConfigSet::ConfigSet() ...@@ -251,10 +230,11 @@ ConfigSet::ConfigSet()
{ {
} }
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); mSet.insert(config);
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#define EGLAPI #define EGLAPI
#include <EGL/egl.h> #include <EGL/egl.h>
#include <d3d9.h>
#include <set> #include <set>
...@@ -26,15 +25,19 @@ class Display; ...@@ -26,15 +25,19 @@ class Display;
class Config class Config
{ {
public: 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; EGLConfig getHandle() const;
const D3DDISPLAYMODE mDisplayMode; const EGLenum mRenderTargetFormat;
const D3DFORMAT mRenderTargetFormat; const EGLenum mDepthStencilFormat;
const D3DFORMAT mDepthStencilFormat;
const EGLint mMultiSample; const EGLint mMultiSample;
const EGLint mDisplayWidth;
const EGLint mDisplayHeight;
const EGLenum mDisplayFormat;
EGLint mBufferSize; // Depth of the color buffer EGLint mBufferSize; // Depth of the color buffer
EGLint mRedSize; // Bits of Red in the color buffer EGLint mRedSize; // Bits of Red in the color buffer
...@@ -98,7 +101,8 @@ class ConfigSet ...@@ -98,7 +101,8 @@ class ConfigSet
public: public:
ConfigSet(); 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; size_t size() const;
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
const egl::Config *get(EGLConfig configHandle); const egl::Config *get(EGLConfig configHandle);
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "common/debug.h" #include "common/debug.h"
#include "libGLESv2/mathutil.h" #include "libGLESv2/mathutil.h"
#include "libGLESv2/utilities.h"
#include "libEGL/main.h" #include "libEGL/main.h"
...@@ -60,6 +59,8 @@ GLenum ConvertDepthStencilFormat(D3DFORMAT format) ...@@ -60,6 +59,8 @@ GLenum ConvertDepthStencilFormat(D3DFORMAT format)
return GL_DEPTH_COMPONENT16; return GL_DEPTH_COMPONENT16;
case D3DFMT_D24S8: case D3DFMT_D24S8:
return GL_DEPTH24_STENCIL8_OES; 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: default:
UNREACHABLE(); UNREACHABLE();
} }
...@@ -215,7 +216,8 @@ bool Display::initialize() ...@@ -215,7 +216,8 @@ bool Display::initialize()
{ {
// FIXME: enumerate multi-sampling // 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()); mRenderer->getMaxTextureWidth(), mRenderer->getMaxTextureHeight());
} }
} }
......
...@@ -228,7 +228,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight) ...@@ -228,7 +228,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
} }
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET, result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
mConfig->mRenderTargetFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle); ConvertRenderbufferFormat(mConfig->mRenderTargetFormat), D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -280,9 +280,9 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight) ...@@ -280,9 +280,9 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if (mWindow) if (mWindow)
{ {
D3DPRESENT_PARAMETERS presentParameters = {0}; D3DPRESENT_PARAMETERS presentParameters = {0};
presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat; presentParameters.AutoDepthStencilFormat = ConvertRenderbufferFormat(mConfig->mDepthStencilFormat);
presentParameters.BackBufferCount = 1; presentParameters.BackBufferCount = 1;
presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat; presentParameters.BackBufferFormat = ConvertRenderbufferFormat(mConfig->mRenderTargetFormat);
presentParameters.EnableAutoDepthStencil = FALSE; presentParameters.EnableAutoDepthStencil = FALSE;
presentParameters.Flags = 0; presentParameters.Flags = 0;
presentParameters.hDeviceWindow = getWindowHandle(); presentParameters.hDeviceWindow = getWindowHandle();
...@@ -334,7 +334,8 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight) ...@@ -334,7 +334,8 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN) 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); 0, FALSE, &mDepthStencil, NULL);
if (FAILED(result)) if (FAILED(result))
...@@ -689,7 +690,7 @@ gl::Texture2D *Surface::getBoundTexture() const ...@@ -689,7 +690,7 @@ gl::Texture2D *Surface::getBoundTexture() const
return mTexture; return mTexture;
} }
D3DFORMAT Surface::getFormat() const EGLenum Surface::getFormat() const
{ {
return mConfig->mRenderTargetFormat; return mConfig->mRenderTargetFormat;
} }
......
...@@ -59,7 +59,7 @@ class Surface ...@@ -59,7 +59,7 @@ class Surface
virtual EGLenum getTextureFormat() const; virtual EGLenum getTextureFormat() const;
virtual EGLenum getTextureTarget() const; virtual EGLenum getTextureTarget() const;
virtual D3DFORMAT getFormat() const; virtual EGLenum getFormat() const;
virtual void setBoundTexture(gl::Texture2D *texture); virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const; virtual gl::Texture2D *getBoundTexture() const;
......
...@@ -78,10 +78,7 @@ enum ...@@ -78,10 +78,7 @@ enum
MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF, 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_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_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
MAX_DRAW_BUFFERS = 1, MAX_DRAW_BUFFERS = 1
GL_BGRA4_ANGLEX = 0x6ABC,
GL_BGR5_A1_ANGLEX = 0x6ABD
}; };
enum QueryType enum QueryType
......
...@@ -1835,20 +1835,7 @@ void Texture2D::bindTexImage(egl::Surface *surface) ...@@ -1835,20 +1835,7 @@ void Texture2D::bindTexImage(egl::Surface *surface)
{ {
releaseTexImage(); releaseTexImage();
GLint internalformat; GLint internalformat = surface->getFormat();
switch(surface->getFormat())
{
case D3DFMT_A8R8G8B8:
internalformat = GL_RGBA8_OES;
break;
case D3DFMT_X8R8G8B8:
internalformat = GL_RGB8_OES;
break;
default:
UNIMPLEMENTED();
return;
}
mImageArray[0].redefine(internalformat, surface->getWidth(), surface->getHeight(), true); mImageArray[0].redefine(internalformat, surface->getWidth(), surface->getHeight(), true);
......
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