Bug 787653 - Updated ANGLE to r1267 r=upstream

This commit is contained in:
Jacek Caban 2012-09-07 11:12:54 +02:00
parent f66e09e47d
commit 3e05eaddc6
29 changed files with 299 additions and 237 deletions

View File

@ -15,3 +15,4 @@ Google Inc.
Cloud Party, Inc.
Jacek Caban <cjacek at gmail.com>

View File

@ -1,6 +1,6 @@
This is the ANGLE project, from http://code.google.com/p/angleproject/
Current revision: r1242
Current revision: r1267
== Applied local patches ==

View File

@ -5,6 +5,10 @@
{
'variables': {
'component%': 'static_library',
# angle_code is set to 1 for the core ANGLE targets defined in src/build_angle.gyp.
# angle_code is set to 0 for test code, sample code, and third party code.
# When angle_code is 1, we build with additional warning flags on Mac and Linux.
'angle_code%': 0,
'gcc_or_clang_warnings': [
'-Wall',
'-Wchar-subscripts',
@ -146,6 +150,20 @@
},
},
}],
['angle_code==1', {
'target_defaults': {
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
},
}],
['OS!="win" and OS!="mac"', {
'cflags': ['<@(gcc_or_clang_warnings)']
}],
]
}
}],
],
}

View File

@ -3,6 +3,9 @@
# found in the LICENSE file.
{
'variables': {
'angle_code': 1,
},
'target_defaults': {
'defines': [
'ANGLE_DISABLE_TRACE',
@ -43,16 +46,6 @@
'compiler/preprocessor/new/Tokenizer.cpp',
'compiler/preprocessor/new/Tokenizer.h',
],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
},
}],
['OS=="linux"', {
'cflags': ['<@(gcc_or_clang_warnings)']
}],
],
},
{
'target_name': 'translator_common',
@ -164,14 +157,6 @@
}, { # else: posix
'sources': ['compiler/ossource_posix.cpp'],
}],
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
},
}],
['OS=="linux"', {
'cflags': ['<@(gcc_or_clang_warnings)']
}],
],
},
{
@ -201,16 +186,6 @@
'compiler/VersionGLSL.cpp',
'compiler/VersionGLSL.h',
],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
},
}],
['OS=="linux"', {
'cflags': ['<@(gcc_or_clang_warnings)']
}],
],
},
],
'conditions': [
@ -295,6 +270,7 @@
'libGLESv2/Shader.cpp',
'libGLESv2/Shader.h',
'libGLESv2/Texture.cpp',
'libGLESv2/TextureSSE2.cpp',
'libGLESv2/Texture.h',
'libGLESv2/utilities.cpp',
'libGLESv2/utilities.h',

View File

@ -19,4 +19,8 @@
#define snprintf _snprintf
#endif
#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE
#endif // COMMON_ANGLEUTILS_H_

View File

@ -42,28 +42,30 @@ namespace gl
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define TRACE(message, ...) (void(0))
#else
#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define FIXME(message, ...) (void(0))
#else
#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define ERR(message, ...) (void(0))
#else
#define ERR(message, ...) gl::trace(false, "err: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to log a performance event around a scope.
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define EVENT(message, ...) (void(0))
#else
#elif defined(_MSC_VER)
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
#else
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
#endif
// A macro asserting a condition and outputting failures to the debug log

View File

@ -1,7 +1,7 @@
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 1242
#define BUILD_REVISION 1267
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)

View File

@ -29,8 +29,8 @@ public:
}
private:
const TString& mOldFunctionName;
const TString& mNewFunctionName;
const TString mOldFunctionName;
const TString mNewFunctionName;
};
#endif // COMPILER_RENAME_FUNCTION

View File

@ -337,18 +337,10 @@ postfix_expression
else
$$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst, (int) (*$3.string).size()));
} else {
if (fields.num == 1) {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setIConst(fields.offsets[0]);
TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
$$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
$$->setType(TType($1->getBasicType(), $1->getPrecision()));
} else {
TString vectorString = *$3.string;
TIntermTyped* index = context->intermediate.addSwizzle(fields, $3.line);
$$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
$$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
}
TString vectorString = *$3.string;
TIntermTyped* index = context->intermediate.addSwizzle(fields, $3.line);
$$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
$$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
}
} else if ($1->isMatrix()) {
TMatrixFields fields;

View File

@ -658,26 +658,26 @@ static const yytype_int16 yyrhs[] =
static const yytype_uint16 yyrline[] =
{
0, 165, 165, 200, 203, 216, 221, 226, 232, 235,
314, 317, 426, 436, 449, 457, 557, 560, 568, 572,
579, 583, 590, 596, 605, 613, 668, 675, 685, 688,
698, 708, 729, 730, 731, 736, 737, 746, 758, 759,
767, 778, 782, 783, 793, 803, 813, 826, 827, 837,
850, 854, 858, 862, 863, 876, 877, 890, 891, 904,
905, 922, 923, 936, 937, 938, 939, 940, 944, 947,
958, 966, 993, 998, 1005, 1043, 1046, 1053, 1061, 1082,
1103, 1114, 1143, 1148, 1158, 1163, 1173, 1176, 1179, 1182,
1188, 1195, 1198, 1220, 1238, 1262, 1285, 1289, 1307, 1315,
1347, 1367, 1456, 1465, 1488, 1491, 1497, 1505, 1513, 1521,
1531, 1538, 1541, 1544, 1550, 1553, 1568, 1572, 1576, 1580,
1589, 1594, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634,
1640, 1646, 1652, 1657, 1662, 1671, 1680, 1685, 1698, 1698,
1712, 1712, 1721, 1724, 1739, 1775, 1779, 1785, 1793, 1809,
1813, 1817, 1818, 1824, 1825, 1826, 1827, 1828, 1832, 1833,
1833, 1833, 1843, 1844, 1848, 1848, 1849, 1849, 1854, 1857,
1867, 1870, 1876, 1877, 1881, 1889, 1893, 1903, 1908, 1925,
1925, 1930, 1930, 1937, 1937, 1945, 1948, 1954, 1957, 1963,
1967, 1974, 1981, 1988, 1995, 2006, 2015, 2019, 2026, 2029,
2035, 2035
314, 317, 418, 428, 441, 449, 549, 552, 560, 564,
571, 575, 582, 588, 597, 605, 660, 667, 677, 680,
690, 700, 721, 722, 723, 728, 729, 738, 750, 751,
759, 770, 774, 775, 785, 795, 805, 818, 819, 829,
842, 846, 850, 854, 855, 868, 869, 882, 883, 896,
897, 914, 915, 928, 929, 930, 931, 932, 936, 939,
950, 958, 985, 990, 997, 1035, 1038, 1045, 1053, 1074,
1095, 1106, 1135, 1140, 1150, 1155, 1165, 1168, 1171, 1174,
1180, 1187, 1190, 1212, 1230, 1254, 1277, 1281, 1299, 1307,
1339, 1359, 1448, 1457, 1480, 1483, 1489, 1497, 1505, 1513,
1523, 1530, 1533, 1536, 1542, 1545, 1560, 1564, 1568, 1572,
1581, 1586, 1591, 1596, 1601, 1606, 1611, 1616, 1621, 1626,
1632, 1638, 1644, 1649, 1654, 1663, 1672, 1677, 1690, 1690,
1704, 1704, 1713, 1716, 1731, 1767, 1771, 1777, 1785, 1801,
1805, 1809, 1810, 1816, 1817, 1818, 1819, 1820, 1824, 1825,
1825, 1825, 1835, 1836, 1840, 1840, 1841, 1841, 1846, 1849,
1859, 1862, 1868, 1869, 1873, 1881, 1885, 1895, 1900, 1917,
1917, 1922, 1922, 1929, 1929, 1937, 1940, 1946, 1949, 1955,
1959, 1966, 1973, 1980, 1987, 1998, 2007, 2011, 2018, 2021,
2027, 2027
};
#endif
@ -2271,18 +2271,10 @@ yyreduce:
else
(yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
} else {
if (fields.num == 1) {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setIConst(fields.offsets[0]);
TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
(yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
(yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
} else {
TString vectorString = *(yyvsp[(3) - (3)].lex).string;
TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
(yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
(yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
}
TString vectorString = *(yyvsp[(3) - (3)].lex).string;
TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
(yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
(yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
}
} else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
TMatrixFields fields;

View File

@ -196,6 +196,12 @@ bool Display::initialize()
mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
// ATI cards on XP have problems with non-power-of-two textures.
mSupportsNonPower2Textures = !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
!(getComparableOSVersion() < versionWindowsVista && mAdapterIdentifier.VendorId == VENDOR_ID_AMD);
const D3DFORMAT renderTargetFormats[] =
{
D3DFMT_A1R5G5B5,
@ -1254,9 +1260,7 @@ bool Display::getVertexTextureSupport() const
bool Display::getNonPower2TextureSupport() const
{
return !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL);
return mSupportsNonPower2Textures;
}
bool Display::getOcclusionQuerySupport() const

View File

@ -26,6 +26,19 @@
#include "libEGL/ShaderCache.h"
#include "libEGL/Surface.h"
const int versionWindowsVista = MAKEWORD(0x00, 0x06);
const int versionWindows7 = MAKEWORD(0x01, 0x06);
// Return the version of the operating system in a format suitable for ordering
// comparison.
inline int getComparableOSVersion()
{
DWORD version = GetVersion();
int majorVersion = LOBYTE(LOWORD(version));
int minorVersion = HIBYTE(LOWORD(version));
return MAKEWORD(minorVersion, majorVersion);
}
namespace egl
{
class Display
@ -131,6 +144,7 @@ class Display
EGLint mMaxSwapInterval;
EGLint mMinSwapInterval;
bool mSoftwareDevice;
bool mSupportsNonPower2Textures;
typedef std::set<Surface*> SurfaceSet;
SurfaceSet mSurfaceSet;

View File

@ -11,7 +11,12 @@
#define LIBEGL_SHADER_CACHE_H_
#include <d3d9.h>
#ifdef _MSC_VER
#include <hash_map>
#else
#include <unordered_map>
#endif
namespace egl
{
@ -37,7 +42,7 @@ class ShaderCache
ShaderObject *create(const DWORD *function, size_t length)
{
std::string key(reinterpret_cast<const char*>(function), length);
Map::iterator it = mMap.find(key);
typename Map::iterator it = mMap.find(key);
if (it != mMap.end())
{
it->second->AddRef();
@ -66,7 +71,7 @@ class ShaderCache
void clear()
{
for (Map::iterator it = mMap.begin(); it != mMap.end(); ++it)
for (typename Map::iterator it = mMap.begin(); it != mMap.end(); ++it)
{
it->second->Release();
}
@ -89,7 +94,15 @@ class ShaderCache
return mDevice->CreatePixelShader(function, shader);
}
typedef stdext::hash_map<std::string, ShaderObject*> Map;
#ifndef HASH_MAP
# ifdef _MSC_VER
# define HASH_MAP stdext::hash_map
# else
# define HASH_MAP std::unordered_map
# endif
#endif
typedef HASH_MAP<std::string, ShaderObject*> Map;
Map mMap;
IDirect3DDevice9 *mDevice;

View File

@ -23,22 +23,6 @@
namespace egl
{
namespace
{
const int versionWindowsVista = MAKEWORD(0x00, 0x06);
const int versionWindows7 = MAKEWORD(0x01, 0x06);
// Return the version of the operating system in a format suitable for ordering
// comparison.
int getComparableOSVersion()
{
DWORD version = GetVersion();
int majorVersion = LOBYTE(LOWORD(version));
int minorVersion = HIBYTE(LOWORD(version));
return MAKEWORD(minorVersion, majorVersion);
}
}
Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{
@ -188,28 +172,8 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
// before reallocating them to free up as much video memory as possible.
device->EvictManagedResources();
D3DPRESENT_PARAMETERS presentParameters = {0};
HRESULT result;
presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
// We set BackBufferCount = 1 even when we use D3DSWAPEFFECT_FLIPEX.
// We do this because DirectX docs are a bit vague whether to set this to 1
// or 2. The runtime seems to accept 1, so we speculate that either it is
// forcing it to 2 without telling us, or better, doing something smart
// behind the scenes knowing that we don't need more.
presentParameters.BackBufferCount = 1;
presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat;
presentParameters.EnableAutoDepthStencil = FALSE;
presentParameters.Flags = 0;
presentParameters.hDeviceWindow = getWindowHandle();
presentParameters.MultiSampleQuality = 0; // FIXME: Unimplemented
presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE; // FIXME: Unimplemented
presentParameters.PresentationInterval = mPresentInterval;
presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
presentParameters.Windowed = TRUE;
presentParameters.BackBufferWidth = backbufferWidth;
presentParameters.BackBufferHeight = backbufferHeight;
// Release specific resources to free up memory for the new render target, while the
// old render target still exists for the purpose of preserving its contents.
if (mSwapChain)
@ -243,8 +207,8 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
pShareHandle = &mShareHandle;
}
result = device->CreateTexture(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight, 1, D3DUSAGE_RENDERTARGET,
presentParameters.BackBufferFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
mConfig->mRenderTargetFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
if (FAILED(result))
{
ERR("Could not create offscreen texture: %08lX", result);
@ -274,14 +238,14 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
mWidth, mHeight
};
if (rect.right > static_cast<LONG>(presentParameters.BackBufferWidth))
if (rect.right > static_cast<LONG>(backbufferWidth))
{
rect.right = presentParameters.BackBufferWidth;
rect.right = backbufferWidth;
}
if (rect.bottom > static_cast<LONG>(presentParameters.BackBufferHeight))
if (rect.bottom > static_cast<LONG>(backbufferHeight))
{
rect.bottom = presentParameters.BackBufferHeight;
rect.bottom = backbufferHeight;
}
mDisplay->endScene();
@ -294,6 +258,35 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if (mWindow)
{
D3DPRESENT_PARAMETERS presentParameters = {0};
presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
presentParameters.BackBufferCount = 1;
presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat;
presentParameters.EnableAutoDepthStencil = FALSE;
presentParameters.Flags = 0;
presentParameters.hDeviceWindow = getWindowHandle();
presentParameters.MultiSampleQuality = 0; // FIXME: Unimplemented
presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE; // FIXME: Unimplemented
presentParameters.PresentationInterval = mPresentInterval;
presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
presentParameters.Windowed = TRUE;
presentParameters.BackBufferWidth = backbufferWidth;
presentParameters.BackBufferHeight = backbufferHeight;
// http://crbug.com/140239
// http://crbug.com/143434
//
// Some AMD/Intel switchable systems / drivers appear to round swap chain surfaces to a multiple of 64 pixels in width
// when using the integrated Intel. This rounds the width up rather than down.
//
// Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present. Therefore, when the vendor ID
// is not Intel, the back buffer width must be exactly the same width as the window or horizontal scaling will occur.
D3DADAPTER_IDENTIFIER9* adapterIdentifier = mDisplay->getAdapterIdentifier();
if (adapterIdentifier->VendorId == VENDOR_ID_INTEL)
{
presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
}
result = device->CreateAdditionalSwapChain(&presentParameters, &mSwapChain);
if (FAILED(result))
@ -320,9 +313,8 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN)
{
result = device->CreateDepthStencilSurface(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight,
presentParameters.AutoDepthStencilFormat, presentParameters.MultiSampleType,
presentParameters.MultiSampleQuality, FALSE, &mDepthStencil, NULL);
result = device->CreateDepthStencilSurface(backbufferWidth, backbufferHeight, mConfig->mDepthStencilFormat, D3DMULTISAMPLE_NONE,
0, FALSE, &mDepthStencil, NULL);
if (FAILED(result))
{
@ -343,8 +335,8 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
}
}
mWidth = presentParameters.BackBufferWidth;
mHeight = presentParameters.BackBufferHeight;
mWidth = backbufferWidth;
mHeight = backbufferHeight;
mPresentIntervalDirty = false;
return true;

View File

@ -182,7 +182,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
case EGL_VENDOR:
return success("Google Inc.");
case EGL_VERSION:
return success("1.4 (ANGLE "VERSION_STRING")");
return success("1.4 (ANGLE " VERSION_STRING ")");
}
return error(EGL_BAD_PARAMETER, (const char*)NULL);

View File

@ -20,11 +20,11 @@
#include "libGLESv2/ResourceManager.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Fence.h"
#include "libGLESv2/FrameBuffer.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Query.h"
#include "libGLESv2/RenderBuffer.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/Shader.h"
#include "libGLESv2/Texture.h"
#include "libGLESv2/VertexDataManager.h"
@ -369,6 +369,10 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
{
depthStencil->Release();
}
// Reset pixel shader to null to work around a bug that only happens with Intel GPUs.
// http://crbug.com/110343
mDevice->SetPixelShader(NULL);
markAllStateDirty();
}

View File

@ -17,8 +17,13 @@
#include <EGL/egl.h>
#include <d3d9.h>
#include <string>
#include <map>
#ifdef _MSC_VER
#include <hash_map>
#else
#include <unordered_map>
#endif
#include "common/angleutils.h"
#include "common/RefCountObject.h"
@ -548,15 +553,23 @@ class Context
BindingPointer<Texture2D> mTexture2DZero;
BindingPointer<TextureCubeMap> mTextureCubeMapZero;
typedef stdext::hash_map<GLuint, Framebuffer*> FramebufferMap;
#ifndef HASH_MAP
# ifdef _MSC_VER
# define HASH_MAP stdext::hash_map
# else
# define HASH_MAP std::unordered_map
# endif
#endif
typedef HASH_MAP<GLuint, Framebuffer*> FramebufferMap;
FramebufferMap mFramebufferMap;
HandleAllocator mFramebufferHandleAllocator;
typedef stdext::hash_map<GLuint, Fence*> FenceMap;
typedef HASH_MAP<GLuint, Fence*> FenceMap;
FenceMap mFenceMap;
HandleAllocator mFenceHandleAllocator;
typedef stdext::hash_map<GLuint, Query*> QueryMap;
typedef HASH_MAP<GLuint, Query*> QueryMap;
QueryMap mQueryMap;
HandleAllocator mQueryHandleAllocator;

View File

@ -153,6 +153,7 @@ CPPSRCS += \
ResourceManager.cpp \
Shader.cpp \
Texture.cpp \
TextureSSE2.cpp \
utilities.cpp \
HandleAllocator.cpp \
IndexDataManager.cpp \

View File

@ -2109,9 +2109,11 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DXHAN
{
for (unsigned int arrayIndex = 0; arrayIndex < constantDescription.Elements; arrayIndex++)
{
D3DXHANDLE elementHandle = mConstantTablePS->GetConstantElement(constantHandle, arrayIndex);
for (unsigned int field = 0; field < constantDescription.StructMembers; field++)
{
D3DXHANDLE fieldHandle = mConstantTablePS->GetConstant(constantHandle, field);
D3DXHANDLE fieldHandle = mConstantTablePS->GetConstant(elementHandle, field);
D3DXCONSTANT_DESC fieldDescription;
UINT descriptionCount = 1;

View File

@ -11,8 +11,8 @@
#define LIBGLESV2_PROGRAM_BINARY_H_
#define GL_APICALL
#include <gles2/gl2.h>
#include <gles2/gl2ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <d3dx9.h>
#include <d3dcompiler.h>

View File

@ -11,7 +11,7 @@
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/RenderBuffer.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/Shader.h"
#include "libGLESv2/Texture.h"

View File

@ -13,7 +13,11 @@
#define GL_APICALL
#include <GLES2/gl2.h>
#ifdef _MSC_VER
#include <hash_map>
#else
#include <unordered_map>
#endif
#include "common/angleutils.h"
#include "libGLESv2/HandleAllocator.h"
@ -79,22 +83,30 @@ class ResourceManager
std::size_t mRefCount;
typedef stdext::hash_map<GLuint, Buffer*> BufferMap;
#ifndef HASH_MAP
# ifdef _MSC_VER
# define HASH_MAP stdext::hash_map
# else
# define HASH_MAP std::unordered_map
# endif
#endif
typedef HASH_MAP<GLuint, Buffer*> BufferMap;
BufferMap mBufferMap;
HandleAllocator mBufferHandleAllocator;
typedef stdext::hash_map<GLuint, Shader*> ShaderMap;
typedef HASH_MAP<GLuint, Shader*> ShaderMap;
ShaderMap mShaderMap;
typedef stdext::hash_map<GLuint, Program*> ProgramMap;
typedef HASH_MAP<GLuint, Program*> ProgramMap;
ProgramMap mProgramMap;
HandleAllocator mProgramShaderHandleAllocator;
typedef stdext::hash_map<GLuint, Texture*> TextureMap;
typedef HASH_MAP<GLuint, Texture*> TextureMap;
TextureMap mTextureMap;
HandleAllocator mTextureHandleAllocator;
typedef stdext::hash_map<GLuint, Renderbuffer*> RenderbufferMap;
typedef HASH_MAP<GLuint, Renderbuffer*> RenderbufferMap;
RenderbufferMap mRenderbufferMap;
HandleAllocator mRenderbufferHandleAllocator;
};

View File

@ -12,7 +12,7 @@
#include <string>
#include "GLSLANG/Shaderlang.h"
#include "GLSLANG/ShaderLang.h"
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"

View File

@ -15,6 +15,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
#include <d3dx9.h>
#include <string>
#include <list>
#include <vector>

View File

@ -13,7 +13,6 @@
#include <d3dx9tex.h>
#include <algorithm>
#include <intrin.h>
#include "common/debug.h"
@ -474,46 +473,6 @@ void Image::loadAlphaData(GLsizei width, GLsizei height,
}
}
void Image::loadAlphaDataSSE2(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const
{
const unsigned char *source = NULL;
unsigned int *dest = NULL;
__m128i zeroWide = _mm_setzero_si128();
for (int y = 0; y < height; y++)
{
source = static_cast<const unsigned char*>(input) + y * inputPitch;
dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
int x;
// Make output writes aligned
for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 0xF) != 0 && x < width); x++)
{
dest[x] = static_cast<unsigned int>(source[x]) << 24;
}
for (; x + 7 < width; x += 8)
{
__m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&source[x]));
// Interleave each byte to 16bit, make the lower byte to zero
sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
// Interleave each 16bit to 32bit, make the lower 16bit to zero
__m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
__m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), lo);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x + 4]), hi);
}
// Handle the remainder
for (; x < width; x++)
{
dest[x] = static_cast<unsigned int>(source[x]) << 24;
}
}
}
void Image::loadAlphaFloatData(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const
{
@ -771,48 +730,6 @@ void Image::loadRGBHalfFloatData(GLsizei width, GLsizei height,
}
}
void Image::loadRGBAUByteDataSSE2(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const
{
const unsigned int *source = NULL;
unsigned int *dest = NULL;
__m128i brMask = _mm_set1_epi32(0x00ff00ff);
for (int y = 0; y < height; y++)
{
source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
int x = 0;
// Make output writes aligned
for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
{
unsigned int rgba = source[x];
dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
}
for (; x + 3 < width; x += 4)
{
__m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&source[x]));
// Mask out g and a, which don't change
__m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
// Mask out b and r
__m128i brComponents = _mm_and_si128(sourceData, brMask);
// Swap b and r
__m128i brSwapped = _mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)), _MM_SHUFFLE(2, 3, 0, 1));
__m128i result = _mm_or_si128(gaComponents, brSwapped);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), result);
}
// Perform leftover writes
for (; x < width; x++)
{
unsigned int rgba = source[x];
dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
}
}
}
void Image::loadRGBAUByteData(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const
{

View File

@ -0,0 +1,100 @@
//
// Copyright (c) 2002-2010 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.
//
// TextureSSE2.cpp: Implements SSE2-based functions of gl::Image class. It's
// in a separated file for GCC, which can enable SSE usage only per-file,
// not for code blocks that use SSE2 explicitly.
#include "libGLESv2/Texture.h"
#include <intrin.h>
namespace gl
{
void Image::loadRGBAUByteDataSSE2(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const
{
const unsigned int *source = NULL;
unsigned int *dest = NULL;
__m128i brMask = _mm_set1_epi32(0x00ff00ff);
for (int y = 0; y < height; y++)
{
source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
int x = 0;
// Make output writes aligned
for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
{
unsigned int rgba = source[x];
dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
}
for (; x + 3 < width; x += 4)
{
__m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&source[x]));
// Mask out g and a, which don't change
__m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
// Mask out b and r
__m128i brComponents = _mm_and_si128(sourceData, brMask);
// Swap b and r
__m128i brSwapped = _mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)), _MM_SHUFFLE(2, 3, 0, 1));
__m128i result = _mm_or_si128(gaComponents, brSwapped);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), result);
}
// Perform leftover writes
for (; x < width; x++)
{
unsigned int rgba = source[x];
dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
}
}
}
void Image::loadAlphaDataSSE2(GLsizei width, GLsizei height,
int inputPitch, const void *input, size_t outputPitch, void *output) const
{
const unsigned char *source = NULL;
unsigned int *dest = NULL;
__m128i zeroWide = _mm_setzero_si128();
for (int y = 0; y < height; y++)
{
source = static_cast<const unsigned char*>(input) + y * inputPitch;
dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
int x;
// Make output writes aligned
for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 0xF) != 0 && x < width); x++)
{
dest[x] = static_cast<unsigned int>(source[x]) << 24;
}
for (; x + 7 < width; x += 8)
{
__m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&source[x]));
// Interleave each byte to 16bit, make the lower byte to zero
sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
// Interleave each 16bit to 32bit, make the lower 16bit to zero
__m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
__m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), lo);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x + 4]), hi);
}
// Handle the remainder
for (; x < width; x++)
{
dest[x] = static_cast<unsigned int>(source[x]) << 24;
}
}
}
}

View File

@ -390,11 +390,11 @@ struct VertexTypeFlags
{
};
template <unsigned int capflag, unsigned int declflag>
template <unsigned int _capflag, unsigned int _declflag>
struct VertexTypeFlagsHelper
{
enum { capflag = capflag };
enum { declflag = declflag };
enum { capflag = _capflag };
enum { declflag = _declflag };
};
template <> struct VertexTypeFlags<D3DVT_FLOAT, 1> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT1> { };

View File

@ -3790,9 +3790,9 @@ const GLubyte* __stdcall glGetString(GLenum name)
case GL_RENDERER:
return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
case GL_VERSION:
return (GLubyte*)"OpenGL ES 2.0 (ANGLE "VERSION_STRING")";
return (GLubyte*)"OpenGL ES 2.0 (ANGLE " VERSION_STRING ")";
case GL_SHADING_LANGUAGE_VERSION:
return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE "VERSION_STRING")";
return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " VERSION_STRING ")";
case GL_EXTENSIONS:
return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
default:

View File

@ -428,6 +428,10 @@
RelativePath=".\Texture.cpp"
>
</File>
<File
RelativePath=".\TextureSSE2.cpp"
>
</File>
<File
RelativePath=".\utilities.cpp"
>