Bug 663162 - Update ANGLE to r686 - r=joedrew

Just an ANGLE update, plus updating the list of failed tests on WinXP, also now properly reporting on unexpeced success (using todo(true) instead of ok(false))
This commit is contained in:
Benoit Jacob 2011-06-10 14:59:08 -04:00
parent a88761845c
commit 66919c207e
34 changed files with 737 additions and 812 deletions

View File

@ -234,7 +234,7 @@ function start() {
Reporter.prototype.finishedTestSuite = function() {
for (var i = 0; i < testsExpectedToFail.length; ++i)
if (testsSuccessful.indexOf(testsExpectedToFail[i]) != -1)
ok(false, 'Test expected to fail, but passed: ' + testsExpectedToFail[i]);
todo(true, 'Test expected to fail, but passed: ' + testsExpectedToFail[i]);
statusTextNode.textContent = 'Finished';
SimpleTest.finish();
}
@ -363,6 +363,13 @@ function start() {
.replace(/\r/g, '') // convert to unix line breaks
.split('\n');
if (kIsWindows && !kIsWindowsVistaOrHigher) {
testsExpectedToFail.push('conformance/framebuffer-object-attachment.html'); // NVIDIA 190.42 doesnt support DEPTH_STENCIL
testsExpectedToFail.push('conformance/gl-get-active-attribute.html'); // bug in NVIDIA 190.42, fixed in newer drivers
testsExpectedToFail.push('conformance/gl-uniform-bool.html'); // bug in NVIDIA 190.42, fixed in newer drivers
testsExpectedToFail.push('conformance/tex-image-and-sub-image-2d-with-array-buffer-view.html'); // ???
}
var testsToIgnore = [];
var testsSuccessful = [];

View File

@ -14,15 +14,16 @@ TransGaming Inc.
Shannon Woods
Google Inc.
Brent Austin
John Bauman
Henry Bridge
N. Duca
Nat Duca
Vangelis Kokkevis
Alok Priyadarshi
Alastair Patrick
Alok Priyadarshi
Kenneth Russell
Adrienne Walker
Ben Vanik
Adrienne Walker
Mozilla Corp.
Vladimir Vukicevic

View File

@ -7,18 +7,20 @@ Current revision: r653
In this order:
angle-nspr-misc.patch - don't bother with ANGLE_OS detection with NSPR
angle-renaming.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
angle-makefiles.patch - Mozilla Makefiles for ANGLE
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
== How to update this ANGLE copy ==
1. Unapply patches
2. Apply diff with new ANGLE version
3. Reapply patches. Check for newly created/deleted files.
4. For each file creation/deletetion recorded in step 3, update our makefiles (angle-makefiles.patch) accordingly
3. Reapply patches.
4. Check for changes in src/build_angle.gyp, update our Makefile.in files accordingly. Note that a single file may be recorded in more than one Makefile.
== Visual Studio Solution Files ==
Ignore these. We don't use them anymore. We use custom Makefiles (see angle-makefiles.patch)
Ignore these. We don't use them anymore. We use custom Makefiles.
== Generated parser code==

View File

@ -0,0 +1,54 @@
# HG changeset patch
# Parent 09fc6e32e6c5d4cdcb3c01f6849ccb8cdae7e8e0
diff --git a/gfx/angle/src/libGLESv2/Texture.cpp b/gfx/angle/src/libGLESv2/Texture.cpp
--- a/gfx/angle/src/libGLESv2/Texture.cpp
+++ b/gfx/angle/src/libGLESv2/Texture.cpp
@@ -8,16 +8,22 @@
// Texture2D and TextureCubeMap. Implements GL texture objects and related
// functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
#include "libGLESv2/Texture.h"
#include <d3dx9tex.h>
#include <algorithm>
+
+#if _MSC_VER <= 1400
+#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
+#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
+#endif
+
#include <intrin.h>
#include "common/debug.h"
#include "libEGL/Display.h"
#include "libGLESv2/main.h"
#include "libGLESv2/mathutil.h"
diff --git a/gfx/angle/src/libGLESv2/mathutil.h b/gfx/angle/src/libGLESv2/mathutil.h
--- a/gfx/angle/src/libGLESv2/mathutil.h
+++ b/gfx/angle/src/libGLESv2/mathutil.h
@@ -3,16 +3,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// mathutil.h: Math and bit manipulation functions.
#ifndef LIBGLESV2_MATHUTIL_H_
#define LIBGLESV2_MATHUTIL_H_
+
+#if _MSC_VER <= 1400
+#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
+#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
+#endif
#include <intrin.h>
#include <math.h>
#include <windows.h>
namespace gl
{
inline bool isPow2(int x)

View File

@ -1,466 +0,0 @@
# HG changeset patch
# Parent 855fadd845692a09149ece53933c65113e05bb4f
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -76,16 +76,18 @@ CPPSRCS = \
RemoveTree.cpp \
ShaderLang.cpp \
SymbolTable.cpp \
VariableInfo.cpp \
compilerdebug.cpp \
ossource_nspr.cpp \
util.cpp \
ValidateLimitations.cpp \
+ ForLoopUnroll.cpp \
+ MapLongVariableNames.cpp \
$(NULL)
# flex/yacc generated files
CPPSRCS += \
glslang_lex.cpp \
glslang_tab.cpp \
$(NULL)
@@ -101,16 +103,17 @@ CPPSRCS += \
# can be selected.
## HLSL translator backend
##CPPSRCS += \
## CodeGenHLSL.cpp \
## OutputHLSL.cpp \
## TranslatorHLSL.cpp \
## UnfoldSelect.cpp \
+## SearchSymbol.cpp \
## $(NULL)
CSRCS = \
atom.c \
cpp.c \
cppstruct.c \
memory.c \
scanner.c \
@@ -119,77 +122,29 @@ CSRCS = \
$(NULL)
DEFINES += -DANGLE_USE_NSPR -DANGLE_BUILD
ifndef MOZ_ENABLE_LIBXUL
EXTRA_DSO_LDOPTS = $(MOZ_COMPONENT_LIBS)
endif
+# ANGLE only on Win32 for now, the solution isn't set up
+# for 64-bit yet. This is handled by MOZ_ANGLE which the configure script
+# leaves undefined in the 64-bit case.
+ifdef MOZ_ANGLE
+
+# libEGL depends on (links against!) libGLESv2!
+DIRS = src/libGLESv2 src/libEGL
+
+libs::
+ expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
+ expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
+
+endif
+
include $(topsrcdir)/config/rules.mk
# We have to filter out -pedantic, because of
# comma-at-end-of-enumerator list failures. We can try to get this fixed
# upstream at some point.
CXXFLAGS := $(filter-out -pedantic,$(CXXFLAGS))
CFLAGS := $(filter-out -pedantic,$(CFLAGS))
-
-# ANGLE only on Win32 for now, the solution isn't set up
-# for 64-bit yet. This is handled by MOZ_ANGLE which the configure script
-# leaves undefined in the 64-bit case.
-ifdef MOZ_ANGLE
-ifdef MOZ_DEBUG
-ANGLE_DIR = Debug
-else
-ANGLE_DIR = Release
-endif
-
-ifdef MOZ_DIRECTX_SDK_PATH
-# export is needed for INCLUDE and LIB because devenv //useenv will read these env vars
-export INCLUDE := $(INCLUDE);$(MOZ_DIRECTX_SDK_PATH)\include
-export LIB := $(LIB);$(MOZ_DIRECTX_SDK_PATH)\lib\$(MOZ_DIRECTX_SDK_CPU_SUFFIX)
-endif
-
-ANGLE_DEP_PATTERNS = \
- src/common/*.cpp src/common/*.h \
- src/compiler/*.cpp src/compiler/*.h \
- src/compiler/preprocessor/*.cpp src/compiler/preprocessor/*.h \
- src/libEGL/*.cpp src/libEGL/*.h \
- src/libGLESv2/*.cpp src/libGLESv2/*.h \
- $(NULL)
-
-ANGLE_DEPS = $(filter-out Gen_glslang.cpp Gen_glslang_tab.cpp glslang_tab.h,$(wildcard $(ANGLE_DEP_PATTERNS)))
-
-libs:: libGLESv2.dll libEGL.dll
- $(INSTALL) $(IFLAGS2) libGLESv2.dll libEGL.dll $(MOZ_D3DX9_DLL) $(MOZ_D3DCOMPILER_DLL) $(DIST)/bin
-
-# we don't want this to attempt to parallel-build these dlls;
-# building one will build both.
-libGLESv2.dll: libEGL.dll
-
-libEGL.dll: $(GLOBAL_DEPS) $(ANGLE_DEPS)
- @(echo "=== Building ANGLE via devenv.exe ===" \
- && rm -rf angle-build && mkdir angle-build \
- && cp -r $(srcdir)/src $(srcdir)/include angle-build \
- && cd angle-build/src \
- && echo "Upgrading solution..." \
- && devenv angle.sln //upgrade \
- && echo "Tweaking project files to use ASLR and DEP..." \
- && ( find . -name '*proj' | xargs \
- perl -i.bak -p \
- -e 'BEGIN{undef $/;} s/<RandomizedBaseAddress>([^<^>])*<\/RandomizedBaseAddress>/<RandomizedBaseAddress>true<\/RandomizedBaseAddress>/sgmi;' \
- -e 'BEGIN{undef $/;} s/<DataExecutionPrevention>([^<^>])*<\/DataExecutionPrevention>/<DataExecutionPrevention>true<\/DataExecutionPrevention>/sgmi;' \
- -e 's/RandomizedBaseAddress\=\"0\"/RandomizedBaseAddress\=\"1\"/g;' \
- -e 's/DataExecutionPrevention\=\"0\"/DataExecutionPrevention\=\"1\"/g;' \
- ) \
- && echo "Building solution, target $(ANGLE_DIR)|Win32..." \
- && ( devenv angle.sln //useenv //build "$(ANGLE_DIR)|Win32" //out ../../angle-build-log.txt \
- || (cat ../../angle-build-log.txt && exit 1) \
- ) \
- && echo "Copying dlls..." \
- && cp $(ANGLE_DIR)/*.dll ../.. \
- && cd ../.. \
- && echo "Extracting dlls from cab file..." \
- && expand "$(MOZ_D3DX9_CAB)" . -F:$(MOZ_D3DX9_DLL) \
- && expand "$(MOZ_D3DCOMPILER_CAB)" . -F:$(MOZ_D3DCOMPILER_DLL) \
- )
-
-endif
diff --git a/gfx/angle/src/libEGL/Makefile.in b/gfx/angle/src/libEGL/Makefile.in
new file mode 100644
--- /dev/null
+++ b/gfx/angle/src/libEGL/Makefile.in
@@ -0,0 +1,142 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is gecko.
+#
+# The Initial Developer of the Original Code is Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = libegl
+# On Windows, we don't automatically get "lib" prepended, but we need it.
+LIBRARY_NAME = libEGL
+MODULE_NAME = libegl
+FORCE_SHARED_LIB=1
+
+# ANGLE uses the STL, so we can't use our derpy STL wrappers.
+STL_FLAGS=
+
+# ANGLE uses exceptions internally, so we need to have exception handling
+# support
+ENABLE_CXX_EXCEPTIONS=1
+
+# Since we're building off in our own world, we don't want to have
+# mozilla-config.h and -DMOZILLA_CLIENT automatically included and defined, so
+# we just overwrite OS_COMPILE_C(XX)FLAGS.
+OS_COMPILE_CFLAGS = $(OS_CPPFLAGS)
+OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS)
+
+LOCAL_INCLUDES += -I$(srcdir)/../../include -I$(srcdir)/.. -I"$(DXSDK_DIR)/include"
+
+VPATH += $(srcdir)/.. \
+ $(srcdir)/../compiler \
+ $(srcdir)/../compiler/preprocessor \
+ $(srcdir)/../common \
+ $(NULL)
+
+# Translator/compiler first
+
+CPPSRCS = \
+ Compiler.cpp \
+ InfoSink.cpp \
+ Initialize.cpp \
+ InitializeDll.cpp \
+ Intermediate.cpp \
+ intermOut.cpp \
+ IntermTraverse.cpp \
+ MozAngleLink.cpp \
+ parseConst.cpp \
+ ParseHelper.cpp \
+ PoolAlloc.cpp \
+ QualifierAlive.cpp \
+ RemoveTree.cpp \
+ ShaderLang.cpp \
+ SymbolTable.cpp \
+ VariableInfo.cpp \
+ compilerdebug.cpp \
+ ossource_win.cpp \
+ util.cpp \
+ ValidateLimitations.cpp \
+ ForLoopUnroll.cpp \
+ MapLongVariableNames.cpp \
+ $(NULL)
+
+# flex/yacc generated files
+CPPSRCS += \
+ glslang_lex.cpp \
+ glslang_tab.cpp \
+ $(NULL)
+
+# HLSL translator backend
+CPPSRCS += \
+ CodeGenHLSL.cpp \
+ OutputHLSL.cpp \
+ TranslatorHLSL.cpp \
+ UnfoldSelect.cpp \
+ SearchSymbol.cpp \
+ $(NULL)
+
+CSRCS = \
+ atom.c \
+ cpp.c \
+ cppstruct.c \
+ memory.c \
+ scanner.c \
+ symbols.c \
+ tokens.c \
+ $(NULL)
+
+DEFINES += -DANGLE_BUILD -DNOMINMAX -DLIBEGL_EXPORTS -D_CRT_SECURE_NO_DEPRECATE
+
+ifndef MOZ_DEBUG
+DEFINES += -D_SECURE_SCL=0
+endif
+
+CPPSRCS += \
+ debug.cpp \
+ Config.cpp \
+ Display.cpp \
+ libEGL.cpp \
+ main.cpp \
+ Surface.cpp \
+ $(NULL)
+
+DEFFILE = $(srcdir)/libEGL.def
+
+include $(topsrcdir)/config/rules.mk
+
+EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/dxguid.lib" $(DIST)/lib/libGLESv2.lib
diff --git a/gfx/angle/src/libGLESv2/Makefile.in b/gfx/angle/src/libGLESv2/Makefile.in
new file mode 100644
--- /dev/null
+++ b/gfx/angle/src/libGLESv2/Makefile.in
@@ -0,0 +1,157 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is gecko.
+#
+# The Initial Developer of the Original Code is Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = libglesv2
+# On Windows, we don't automatically get "lib" prepended, but we need it.
+LIBRARY_NAME = libGLESv2
+MODULE_NAME = libglesv2
+FORCE_SHARED_LIB=1
+
+# ANGLE uses the STL, so we can't use our derpy STL wrappers.
+STL_FLAGS=
+
+# ANGLE uses exceptions internally, so we need to have exception handling
+# support
+ENABLE_CXX_EXCEPTIONS=1
+
+# Since we're building off in our own world, we don't want to have
+# mozilla-config.h and -DMOZILLA_CLIENT automatically included and defined, so
+# we just overwrite OS_COMPILE_C(XX)FLAGS.
+OS_COMPILE_CFLAGS = $(OS_CPPFLAGS)
+OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS)
+
+LOCAL_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/.. -I"$(DXSDK_DIR)/include"
+
+VPATH += $(srcdir)/..
+VPATH += $(srcdir)/../compiler
+VPATH += $(srcdir)/../compiler/preprocessor
+VPATH += $(srcdir)/../common
+VPATH += $(srcdir)/geometry
+
+# Translator/compiler first
+
+CPPSRCS = \
+ Compiler.cpp \
+ InfoSink.cpp \
+ Initialize.cpp \
+ InitializeDll.cpp \
+ Intermediate.cpp \
+ intermOut.cpp \
+ IntermTraverse.cpp \
+ MozAngleLink.cpp \
+ parseConst.cpp \
+ ParseHelper.cpp \
+ PoolAlloc.cpp \
+ QualifierAlive.cpp \
+ RemoveTree.cpp \
+ ShaderLang.cpp \
+ SymbolTable.cpp \
+ VariableInfo.cpp \
+ compilerdebug.cpp \
+ ossource_win.cpp \
+ util.cpp \
+ ValidateLimitations.cpp \
+ ForLoopUnroll.cpp \
+ MapLongVariableNames.cpp \
+ $(NULL)
+
+# flex/yacc generated files
+CPPSRCS += \
+ glslang_lex.cpp \
+ glslang_tab.cpp \
+ $(NULL)
+
+# HLSL translator backend
+CPPSRCS += \
+ CodeGenHLSL.cpp \
+ OutputHLSL.cpp \
+ TranslatorHLSL.cpp \
+ UnfoldSelect.cpp \
+ SearchSymbol.cpp \
+ $(NULL)
+
+CSRCS = \
+ atom.c \
+ cpp.c \
+ cppstruct.c \
+ memory.c \
+ scanner.c \
+ symbols.c \
+ tokens.c \
+ $(NULL)
+
+DEFINES += -DANGLE_BUILD -DNOMINMAX -DLIBGLESV2_EXPORTS -D_CRT_SECURE_NO_DEPRECATE
+
+ifndef MOZ_DEBUG
+DEFINES += -D_SECURE_SCL=0
+endif
+
+CPPSRCS += \
+ debug.cpp \
+ IndexDataManager.cpp \
+ VertexDataManager.cpp \
+ Blit.cpp \
+ Buffer.cpp \
+ Context.cpp \
+ Fence.cpp \
+ Framebuffer.cpp \
+ libGLESv2.cpp \
+ main.cpp \
+ Program.cpp \
+ RefCountObject.cpp \
+ Renderbuffer.cpp \
+ ResourceManager.cpp \
+ Shader.cpp \
+ Texture.cpp \
+ utilities.cpp \
+ HandleAllocator.cpp \
+ IndexDataManager.cpp \
+ VertexDataManager.cpp \
+ $(NULL)
+
+DEFFILE = $(srcdir)/libGLESv2.def
+
+
+include $(topsrcdir)/config/rules.mk
+
+EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3dx9.lib"
diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -123,16 +123,18 @@ MAKEFILES_gfx="
gfx/Makefile
gfx/ycbcr/Makefile
gfx/layers/Makefile
gfx/src/Makefile
gfx/tests/Makefile
gfx/thebes/Makefile
gfx/qcms/Makefile
gfx/angle/Makefile
+ gfx/angle/src/libGLESv2/Makefile
+ gfx/angle/src/libEGL/Makefile
"
MAKEFILES_htmlparser="
parser/htmlparser/Makefile
parser/htmlparser/public/Makefile
parser/htmlparser/src/Makefile
parser/htmlparser/tests/Makefile
parser/htmlparser/tests/grabpage/Makefile

View File

@ -1,5 +1,5 @@
# HG changeset patch
# Parent 3e177ced3662763eae55f4b741258298609e99aa
# Parent 99de3c7d00973e65e295911b2b8b66c75cfe24bb
diff --git a/gfx/angle/src/compiler/osinclude.h b/gfx/angle/src/compiler/osinclude.h
--- a/gfx/angle/src/compiler/osinclude.h
+++ b/gfx/angle/src/compiler/osinclude.h

View File

@ -1,5 +1,5 @@
# HG changeset patch
# Parent 593e84b864c5470aa43682d308212878b0b4e5d9
# Parent a0dd1332c0e6ebaf429f9a3732b8901f9e46cde0
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@ -17,11 +17,11 @@ diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
ossource_nspr.cpp \
util.cpp \
ValidateLimitations.cpp \
ForLoopUnroll.cpp \
MapLongVariableNames.cpp \
$(NULL)
# flex/yacc generated files
CPPSRCS += \
glslang_lex.cpp \
diff --git a/gfx/angle/src/build_angle.gyp b/gfx/angle/src/build_angle.gyp
--- a/gfx/angle/src/build_angle.gyp
+++ b/gfx/angle/src/build_angle.gyp
@ -157,7 +157,7 @@ diff --git a/gfx/angle/src/compiler/compilerdebug.h b/gfx/angle/src/compiler/com
diff --git a/gfx/angle/src/compiler/osinclude.h b/gfx/angle/src/compiler/osinclude.h
--- a/gfx/angle/src/compiler/osinclude.h
+++ b/gfx/angle/src/compiler/osinclude.h
@@ -32,17 +32,17 @@
@@ -30,17 +30,17 @@
#include <windows.h>
#elif defined(ANGLE_OS_POSIX)
#include <pthread.h>

View File

@ -87,7 +87,32 @@
'target_defaults': {
'msvs_cygwin_dirs': ['../third_party/cygwin'],
},
}]
}],
['OS!="win" and OS!="mac"', {
'target_defaults': {
'cflags': [
'-pthread',
'-fno-exceptions',
],
'ldflags': [
'-pthread',
],
'configurations': {
'Debug': {
'variables': {
'debug_optimize%': '0',
},
'defines': [
'_DEBUG',
],
'cflags': [
'-O>(debug_optimize)',
'-g',
],
}
},
},
}],
],
}

View File

@ -22,6 +22,10 @@ if __name__ == '__main__':
print 'Updating projects from gyp files...'
sys.stdout.flush()
# Set the depth to get the top-level Makefile generated into the
# correct directory. This only has an effect on Linux.
args.append('--depth');
args.append('./trunk');
# Add common.gypi to the include path.
args.append('-I' + os.path.join(script_dir, 'common.gypi'))
# Add all.gyp as the main gyp file to be generated.

View File

@ -27,7 +27,7 @@ static void usage();
static ShShaderType FindShaderType(const char* fileName);
static bool CompileFile(char* fileName, ShHandle compiler, int compileOptions);
static void LogMsg(char* msg, const char* name, const int num, const char* logName);
static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType);
static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongVariableNames);
// If NUM_SOURCE_STRINGS is set to a value > 1, the input file data is
// broken into that many chunks.
@ -75,9 +75,10 @@ int main(int argc, char* argv[])
argc--;
argv++;
for (; (argc >= 1) && (failCode == ESuccess); argc--, argv++) {
if (argv[0][0] == '-' || argv[0][0] == '/') {
if (argv[0][0] == '-') {
switch (argv[0][1]) {
case 'i': compileOptions |= SH_INTERMEDIATE_TREE; break;
case 'm': compileOptions |= SH_MAP_LONG_VARIABLE_NAMES; break;
case 'o': compileOptions |= SH_OBJECT_CODE; break;
case 'u': compileOptions |= SH_ATTRIBUTES_UNIFORMS; break;
default: failCode = EFailUsage;
@ -119,12 +120,12 @@ int main(int argc, char* argv[])
}
if (compiled && (compileOptions & SH_ATTRIBUTES_UNIFORMS)) {
LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE ATTRIBS");
PrintActiveVariables(compiler, SH_ACTIVE_ATTRIBUTES);
PrintActiveVariables(compiler, SH_ACTIVE_ATTRIBUTES, compileOptions & SH_MAP_LONG_VARIABLE_NAMES);
LogMsg("END", "COMPILER", numCompiles, "ACTIVE ATTRIBS");
printf("\n\n");
LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE UNIFORMS");
PrintActiveVariables(compiler, SH_ACTIVE_UNIFORMS);
PrintActiveVariables(compiler, SH_ACTIVE_UNIFORMS, compileOptions & SH_MAP_LONG_VARIABLE_NAMES);
LogMsg("END", "COMPILER", numCompiles, "ACTIVE UNIFORMS");
printf("\n\n");
}
@ -158,9 +159,10 @@ int main(int argc, char* argv[])
//
void usage()
{
printf("Usage: translate [-i -o -u] file1 file2 ...\n"
printf("Usage: translate [-i -m -o -u] file1 file2 ...\n"
"Where: filename = filename ending in .frag or .vert\n"
" -i = print intermediate tree\n"
" -m = map long variable names\n"
" -o = print translated code\n"
" -u = print active attribs and uniforms\n");
}
@ -209,7 +211,7 @@ void LogMsg(char* msg, const char* name, const int num, const char* logName)
printf("#### %s %s %d %s ####\n", msg, name, num, logName);
}
void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongVariableNames)
{
int nameSize = 0;
switch (varType) {
@ -224,6 +226,13 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
if (nameSize <= 1) return;
char* name = new char[nameSize];
char* mappedName = NULL;
if (mapLongVariableNames) {
int mappedNameSize = 0;
ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameSize);
mappedName = new char[mappedNameSize];
}
int activeVars = 0, size = 0;
ShDataType type = SH_NONE;
char* typeName = NULL;
@ -231,10 +240,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
for (int i = 0; i < activeVars; ++i) {
switch (varType) {
case SH_ACTIVE_ATTRIBUTES:
ShGetActiveAttrib(compiler, i, NULL, &size, &type, name, NULL);
ShGetActiveAttrib(compiler, i, NULL, &size, &type, name, mappedName);
break;
case SH_ACTIVE_UNIFORMS:
ShGetActiveUniform(compiler, i, NULL, &size, &type, name, NULL);
ShGetActiveUniform(compiler, i, NULL, &size, &type, name, mappedName);
break;
default: assert(0);
}
@ -258,9 +267,14 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
case SH_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break;
default: assert(0);
}
printf("%d: name:%s type:%s size:%d\n", i, name, typeName, size);
printf("%d: name:%s type:%s size:%d", i, name, typeName, size);
if (mapLongVariableNames)
printf(" mapped name:%s", mappedName);
printf("\n");
}
delete [] name;
if (mappedName)
delete [] mappedName;
}
static bool ReadShaderSource(const char* fileName, ShaderSource& source) {

View File

@ -228,7 +228,11 @@
'AdditionalDependencies': [
'd3d9.lib',
'dxguid.lib',
'dwmapi.lib',
],
'DelayLoadDLLs': [
'dwmapi.dll',
]
}
},
},

View File

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

View File

@ -207,7 +207,7 @@ void TCompiler::collectAttribsUniforms(TIntermNode* root)
void TCompiler::mapLongVariableNames(TIntermNode* root)
{
MapLongVariableNames map;
MapLongVariableNames map(varyingLongNameMap);
root->traverse(&map);
}

View File

@ -8,22 +8,44 @@
namespace {
TString mapLongName(int id, const TString& name)
TString mapLongName(int id, const TString& name, bool isVarying)
{
ASSERT(name.size() > MAX_IDENTIFIER_NAME_SIZE);
TStringStream stream;
stream << "webgl_" << id << "_";
stream << "webgl_";
if (isVarying)
stream << "v";
stream << id << "_";
stream << name.substr(0, MAX_IDENTIFIER_NAME_SIZE - stream.str().size());
return stream.str();
}
} // anonymous namespace
MapLongVariableNames::MapLongVariableNames(
TMap<TString, TString>& varyingLongNameMap)
: mVaryingLongNameMap(varyingLongNameMap)
{
}
void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
{
ASSERT(symbol != NULL);
if (symbol->getSymbol().size() > MAX_IDENTIFIER_NAME_SIZE)
symbol->setSymbol(mapLongName(symbol->getId(), symbol->getSymbol()));
if (symbol->getSymbol().size() > MAX_IDENTIFIER_NAME_SIZE) {
switch (symbol->getQualifier()) {
case EvqVaryingIn:
case EvqVaryingOut:
case EvqInvariantVaryingIn:
case EvqInvariantVaryingOut:
symbol->setSymbol(
mapVaryingLongName(symbol->getSymbol()));
break;
default:
symbol->setSymbol(
mapLongName(symbol->getId(), symbol->getSymbol(), false));
break;
};
}
}
void MapLongVariableNames::visitConstantUnion(TIntermConstantUnion*)
@ -59,3 +81,16 @@ bool MapLongVariableNames::visitBranch(Visit, TIntermBranch*)
{
return true;
}
TString MapLongVariableNames::mapVaryingLongName(const TString& name)
{
TMap<TString, TString>::const_iterator it = mVaryingLongNameMap.find(name);
if (it != mVaryingLongNameMap.end())
return (*it).second;
int id = mVaryingLongNameMap.size();
TString mappedName = mapLongName(id, name, true);
mVaryingLongNameMap.insert(
TMap<TString, TString>::value_type(name, mappedName));
return mappedName;
}

View File

@ -19,7 +19,7 @@
// longer than MAX_IDENTIFIER_NAME_SIZE to MAX_IDENTIFIER_NAME_SIZE.
class MapLongVariableNames : public TIntermTraverser {
public:
MapLongVariableNames() { }
MapLongVariableNames(TMap<TString, TString>& varyingLongNameMap);
virtual void visitSymbol(TIntermSymbol*);
virtual void visitConstantUnion(TIntermConstantUnion*);
@ -29,6 +29,11 @@ public:
virtual bool visitAggregate(Visit, TIntermAggregate*);
virtual bool visitLoop(Visit, TIntermLoop*);
virtual bool visitBranch(Visit, TIntermBranch*);
private:
TString mapVaryingLongName(const TString& name);
TMap<TString, TString>& mVaryingLongNameMap;
};
#endif // COMPILER_MAP_LONG_VARIABLE_NAMES_H_

View File

@ -1880,6 +1880,7 @@ void OutputHLSL::outputLineDirective(int line)
{
if ((mContext.compileOptions & SH_LINE_DIRECTIVES) && (line > 0))
{
mBody << "\n";
mBody << "#line " << line;
if (mContext.sourcePath)

View File

@ -90,6 +90,9 @@ private:
TInfoSink infoSink; // Output sink.
TVariableInfoList attribs; // Active attributes in the compiled shader.
TVariableInfoList uniforms; // Active uniforms in the compiled shader.
// Pair of long varying varibale name <originalName, mappedName>.
TMap<TString, TString> varyingLongNameMap;
};
//

View File

@ -1288,27 +1288,12 @@ single_declaration
symbol->setId(variable->getUniqueId());
}
| fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
context->error($2.line, "unsized array declarations not supported", $2.string->c_str(), "");
context->recover();
TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line);
$$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line);
if (context->structQualifierErrorCheck($2.line, $1))
context->recover();
if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
context->recover();
$$.type = $1;
if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifierErrorCheck($3.line, $1))
context->recover();
else {
$1.setArray(true);
TVariable* variable = 0;
if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
context->recover();
if (variable && symbol)
symbol->setId(variable->getUniqueId());
}
}
| fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
TType type = TType($1);

View File

@ -738,17 +738,17 @@ static const yytype_uint16 yyrline[] =
893, 910, 911, 924, 925, 926, 927, 928, 932, 935,
946, 954, 979, 984, 991, 1027, 1030, 1037, 1045, 1066,
1085, 1096, 1125, 1130, 1140, 1145, 1155, 1158, 1161, 1164,
1170, 1177, 1187, 1203, 1221, 1245, 1268, 1272, 1290, 1313,
1345, 1365, 1441, 1450, 1473, 1476, 1482, 1490, 1498, 1506,
1509, 1516, 1519, 1522, 1528, 1531, 1546, 1550, 1554, 1558,
1567, 1572, 1577, 1582, 1587, 1592, 1597, 1602, 1607, 1612,
1618, 1624, 1630, 1635, 1640, 1645, 1658, 1671, 1679, 1682,
1697, 1728, 1732, 1738, 1746, 1762, 1766, 1770, 1771, 1777,
1778, 1779, 1780, 1781, 1785, 1786, 1786, 1786, 1796, 1797,
1802, 1805, 1815, 1818, 1824, 1825, 1829, 1837, 1841, 1851,
1856, 1873, 1873, 1878, 1878, 1885, 1885, 1893, 1896, 1902,
1905, 1911, 1915, 1922, 1929, 1936, 1943, 1954, 1963, 1967,
1974, 1977, 1983, 1983
1170, 1177, 1187, 1203, 1221, 1245, 1268, 1272, 1290, 1298,
1330, 1350, 1426, 1435, 1458, 1461, 1467, 1475, 1483, 1491,
1494, 1501, 1504, 1507, 1513, 1516, 1531, 1535, 1539, 1543,
1552, 1557, 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597,
1603, 1609, 1615, 1620, 1625, 1630, 1643, 1656, 1664, 1667,
1682, 1713, 1717, 1723, 1731, 1747, 1751, 1755, 1756, 1762,
1763, 1764, 1765, 1766, 1770, 1771, 1771, 1771, 1781, 1782,
1787, 1790, 1800, 1803, 1809, 1810, 1814, 1822, 1826, 1836,
1841, 1858, 1858, 1863, 1863, 1870, 1870, 1878, 1881, 1887,
1890, 1896, 1900, 1907, 1914, 1921, 1928, 1939, 1948, 1952,
1959, 1962, 1968, 1968
};
#endif
@ -3497,27 +3497,12 @@ yyreduce:
case 98:
{
context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
context->recover();
TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
(yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
context->recover();
if (context->nonInitConstErrorCheck((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type)))
context->recover();
(yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
if (context->arrayTypeErrorCheck((yyvsp[(3) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
context->recover();
else {
(yyvsp[(1) - (4)].interm.type).setArray(true);
TVariable* variable = 0;
if (context->arrayErrorCheck((yyvsp[(3) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), variable))
context->recover();
if (variable && symbol)
symbol->setId(variable->getUniqueId());
}
;}
break;

View File

@ -18,8 +18,16 @@
#include "libEGL/main.h"
#define REF_RAST 0 // Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
#define ENABLE_D3D9EX 1 // Enables use of the IDirect3D9Ex interface, when available
// Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
#define REF_RAST 0
// The "Debug This Pixel..." feature in PIX often fails when using the
// D3D9Ex interfaces. In order to get debug pixel to work on a Vista/Win 7
// machine, define "ANGLE_ENABLE_D3D9EX=0" in your project file.
#if !defined(ANGLE_ENABLE_D3D9EX)
// Enables use of the IDirect3D9Ex interface, when available
#define ANGLE_ENABLE_D3D9EX 1
#endif // !defined(ANGLE_ENABLE_D3D9EX)
namespace egl
{
@ -70,7 +78,7 @@ bool Display::initialize()
// Use Direct3D9Ex if available. Among other things, this version is less
// inclined to report a lost context, for example when the user switches
// desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
if (ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
if (ANGLE_ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
{
ASSERT(mD3d9Ex);
mD3d9Ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
@ -535,7 +543,7 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle,
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
if (textureFormat != EGL_NO_TEXTURE && !getNonPow2TextureSupport() && (!gl::isPow2(width) || !gl::isPow2(height)))
if (textureFormat != EGL_NO_TEXTURE && !getNonPower2TextureSupport() && (!gl::isPow2(width) || !gl::isPow2(height)))
{
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
}
@ -581,6 +589,12 @@ EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *sha
}
else if (isDeviceLost()) // Lost device
{
// Release surface resources to make the Reset() succeed
for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
{
(*surface)->release();
}
if (!resetDevice())
{
return NULL;
@ -603,29 +617,14 @@ EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *sha
void Display::destroySurface(egl::Surface *surface)
{
if (surface == egl::getCurrentDrawSurface() || surface == egl::getCurrentReadSurface())
{
surface->setPendingDestroy();
}
else
{
delete surface;
mSurfaceSet.erase(surface);
}
delete surface;
mSurfaceSet.erase(surface);
}
void Display::destroyContext(gl::Context *context)
{
glDestroyContext(context);
mContextSet.erase(context);
if (mContextSet.empty() && mDevice && isDeviceLost()) // Last context of a lost device
{
for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
{
(*surface)->release();
}
}
}
bool Display::isInitialized() const
@ -645,7 +644,7 @@ bool Display::isValidContext(gl::Context *context)
bool Display::isValidSurface(egl::Surface *surface)
{
return mSurfaceSet.find(surface) != mSurfaceSet.end() && !surface->isPendingDestroy();
return mSurfaceSet.find(surface) != mSurfaceSet.end();
}
bool Display::hasExistingWindowSurface(HWND window)
@ -792,11 +791,6 @@ bool Display::getLuminanceAlphaTextureSupport()
return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8L8));
}
bool Display::getNonPow2TextureSupport()
{
return !(mDeviceCaps.TextureCaps & (D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_NONPOW2CONDITIONAL));
}
D3DPOOL Display::getBufferPool(DWORD usage) const
{
if (mD3d9Ex != NULL)
@ -886,4 +880,11 @@ bool Display::getVertexTextureSupport() const
return SUCCEEDED(result);
}
bool Display::getNonPower2TextureSupport() const
{
return !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL);
}
}

View File

@ -68,8 +68,8 @@ class Display
virtual bool getHalfFloatTextureSupport(bool *filtering, bool *renderable);
virtual bool getLuminanceTextureSupport();
virtual bool getLuminanceAlphaTextureSupport();
virtual bool getNonPow2TextureSupport();
virtual bool getVertexTextureSupport() const;
virtual bool getNonPower2TextureSupport() const;
virtual D3DPOOL getBufferPool(DWORD usage) const;
bool isD3d9ExDevice() { return mD3d9Ex != NULL; }

View File

@ -139,4 +139,7 @@ DEFFILE = $(srcdir)/libEGL.def
include $(topsrcdir)/config/rules.mk
EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/dxguid.lib" $(DIST)/lib/libGLESv2.lib
EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" \
"$(MOZ_DIRECTX_SDK_PATH)/lib/x86/dxguid.lib" \
"dwmapi.lib" \
$(DIST)/lib/libGLESv2.lib

View File

@ -18,6 +18,8 @@
#include "libEGL/main.h"
#include "libEGL/Display.h"
#include <dwmapi.h>
namespace egl
{
Surface::Surface(Display *display, const Config *config, HWND window)
@ -38,8 +40,6 @@ Surface::Surface(Display *display, const Config *config, HWND window)
mSwapInterval = -1;
setSwapInterval(1);
mIsPendingDestroy = false;
subclassWindow();
}
@ -60,8 +60,6 @@ Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGL
mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1;
setSwapInterval(1);
mIsPendingDestroy = false;
}
Surface::~Surface()
@ -73,7 +71,29 @@ Surface::~Surface()
bool Surface::initialize()
{
ASSERT(!mSwapChain && !mOffscreenTexture && !mDepthStencil);
return resetSwapChain();
if (!resetSwapChain())
return false;
// Modify present parameters for this window, if we are composited,
// to minimize the amount of queuing done by DWM between our calls to
// present and the actual screen.
if (mWindow && (LOWORD(GetVersion()) >= 0x60)) {
BOOL isComposited;
HRESULT result = DwmIsCompositionEnabled(&isComposited);
if (SUCCEEDED(result) && isComposited) {
DWM_PRESENT_PARAMETERS presentParams;
memset(&presentParams, 0, sizeof(presentParams));
presentParams.cbSize = sizeof(DWM_PRESENT_PARAMETERS);
presentParams.cBuffer = 2;
result = DwmSetPresentParameters(mWindow, &presentParams);
if (FAILED(result))
ERR("Unable to set present parameters: %081X", result);
}
}
return true;
}
void Surface::release()
@ -145,7 +165,24 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
D3DPRESENT_PARAMETERS presentParameters = {0};
HRESULT result;
bool useFlipEx = (LOWORD(GetVersion()) >= 0x61) && mDisplay->isD3d9ExDevice();
// FlipEx causes unseemly stretching when resizing windows AND when one
// draws outside of the WM_PAINT callback. While this is seldom a problem in
// single process applications, it is particuarly noticeable in multiprocess
// applications. Therefore, if the creator process of our window is not in
// the current process, disable use of FlipEx.
DWORD windowPID;
GetWindowThreadProcessId(mWindow, &windowPID);
if(windowPID != GetCurrentProcessId())
useFlipEx = false;
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;
@ -154,7 +191,11 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
presentParameters.MultiSampleQuality = 0; // FIXME: Unimplemented
presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE; // FIXME: Unimplemented
presentParameters.PresentationInterval = mPresentInterval;
presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
// Use flipEx on Win7 or greater.
if(useFlipEx)
presentParameters.SwapEffect = D3DSWAPEFFECT_FLIPEX;
else
presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
presentParameters.Windowed = TRUE;
presentParameters.BackBufferWidth = backbufferWidth;
presentParameters.BackBufferHeight = backbufferHeight;
@ -220,11 +261,14 @@ HWND Surface::getWindowHandle()
#define kSurfaceProperty _TEXT("Egl::SurfaceOwner")
#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc")
static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
if (message == WM_SIZE) {
static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
if (message == WM_SIZE)
{
Surface* surf = reinterpret_cast<Surface*>(GetProp(hwnd, kSurfaceProperty));
if(surf) {
surf->checkForOutOfDateSwapChain();
if(surf)
{
surf->checkForOutOfDateSwapChain();
}
}
WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc));
@ -233,42 +277,55 @@ static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam
void Surface::subclassWindow()
{
if (!mWindow)
return;
if (!mWindow)
{
return;
}
SetLastError(0);
LONG oldWndProc = SetWindowLong(mWindow, GWL_WNDPROC, reinterpret_cast<LONG>(SurfaceWindowProc));
if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS) {
mWindowSubclassed = false;
return;
}
DWORD processId;
DWORD threadId = GetWindowThreadProcessId(mWindow, &processId);
if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
{
return;
}
SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
mWindowSubclassed = true;
SetLastError(0);
LONG oldWndProc = SetWindowLong(mWindow, GWL_WNDPROC, reinterpret_cast<LONG>(SurfaceWindowProc));
if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS)
{
mWindowSubclassed = false;
return;
}
SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
mWindowSubclassed = true;
}
void Surface::unsubclassWindow()
{
if(!mWindowSubclassed)
return;
if(!mWindowSubclassed)
{
return;
}
// un-subclass
LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
// un-subclass
LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
// Check the windowproc is still SurfaceWindowProc.
// If this assert fails, then it is likely the application has subclassed the
// hwnd as well and did not unsubclass before destroying its EGL context. The
// application should be modified to either subclass before initializing the
// EGL context, or to unsubclass before destroying the EGL context.
if(parentWndFunc) {
LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
}
// Check the windowproc is still SurfaceWindowProc.
// If this assert fails, then it is likely the application has subclassed the
// hwnd as well and did not unsubclass before destroying its EGL context. The
// application should be modified to either subclass before initializing the
// EGL context, or to unsubclass before destroying the EGL context.
if(parentWndFunc)
{
LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
}
RemoveProp(mWindow, kSurfaceProperty);
RemoveProp(mWindow, kParentWndProc);
mWindowSubclassed = false;
RemoveProp(mWindow, kSurfaceProperty);
RemoveProp(mWindow, kParentWndProc);
mWindowSubclassed = false;
}
bool Surface::checkForOutOfDateSwapChain()
@ -313,7 +370,6 @@ DWORD Surface::convertInterval(EGLint interval)
return D3DPRESENT_INTERVAL_DEFAULT;
}
bool Surface::swap()
{
if (mSwapChain)
@ -327,7 +383,7 @@ bool Surface::swap()
return error(EGL_BAD_ALLOC, false);
}
if (result == D3DERR_DEVICELOST)
if (result == D3DERR_DEVICELOST || result == D3DERR_DEVICEHUNG || result == D3DERR_DEVICEREMOVED)
{
return error(EGL_CONTEXT_LOST, false);
}
@ -419,13 +475,4 @@ D3DFORMAT Surface::getFormat() const
{
return mConfig->mRenderTargetFormat;
}
void Surface::setPendingDestroy() {
mIsPendingDestroy = true;
}
bool Surface::isPendingDestroy() const {
return mIsPendingDestroy;
}
}

View File

@ -61,9 +61,6 @@ class Surface
virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const;
void setPendingDestroy();
bool isPendingDestroy() const;
private:
DISALLOW_COPY_AND_ASSIGN(Surface);
@ -74,7 +71,6 @@ private:
IDirect3DTexture9* mOffscreenTexture;
HANDLE mShareHandle;
bool mIsPendingDestroy;
void subclassWindow();
void unsubclassWindow();

View File

@ -936,18 +936,6 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
glMakeCurrent(context, display, static_cast<egl::Surface*>(draw));
// If the previous surfaces are still current, this might just flag
// them as pending destruction again, deferring destruction to a future
// eglMakeCurrent or eglTerminate call.
if (previousDraw && previousDraw->isPendingDestroy())
{
eglDestroySurface(dpy, previousDraw);
}
if (previousRead && previousRead != previousDraw && previousRead->isPendingDestroy())
{
eglDestroySurface(dpy, previousRead);
}
return success(EGL_TRUE);
}
catch(std::bad_alloc&)

View File

@ -1,92 +1,266 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject ProjectType="Visual C++" Version="8.00" Name="libEGL" ProjectGUID="{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}" RootNamespace="libEGL" Keyword="Win32Proj" TargetFrameworkVersion="131072">
<Platforms>
<Platform Name="Win32" />
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1">
<Tool Name="VCPreBuildEventTool" />
<Tool Name="VCCustomBuildTool" />
<Tool Name="VCXMLDataGeneratorTool" />
<Tool Name="VCWebServiceProxyGeneratorTool" />
<Tool Name="VCMIDLTool" />
<Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="4" />
<Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" />
<Tool Name="VCPreLinkEventTool" />
<Tool Name="VCLinkerTool" AdditionalDependencies="d3d9.lib dxguid.lib" LinkIncremental="2" ModuleDefinitionFile="libEGL.def" GenerateDebugInformation="true" SubSystem="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" />
<Tool Name="VCALinkTool" />
<Tool Name="VCManifestTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
<Tool Name="VCFxCopTool" />
<Tool Name="VCAppVerifierTool" />
<Tool Name="VCPostBuildEventTool" CommandLine="@echo on&#xD;&#xA;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#xD;&#xA;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#xD;&#xA;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#xD;&#xA;@echo off&#xD;&#xA;" />
</Configuration>
<Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" WholeProgramOptimization="1">
<Tool Name="VCPreBuildEventTool" />
<Tool Name="VCCustomBuildTool" />
<Tool Name="VCXMLDataGeneratorTool" />
<Tool Name="VCWebServiceProxyGeneratorTool" />
<Tool Name="VCMIDLTool" />
<Tool Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0" RuntimeLibrary="0" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" />
<Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" />
<Tool Name="VCPreLinkEventTool" />
<Tool Name="VCLinkerTool" AdditionalDependencies="d3d9.lib dxguid.lib" LinkIncremental="1" ModuleDefinitionFile="libEGL.def" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" />
<Tool Name="VCALinkTool" />
<Tool Name="VCManifestTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
<Tool Name="VCFxCopTool" />
<Tool Name="VCAppVerifierTool" />
<Tool Name="VCPostBuildEventTool" CommandLine="@echo on&#xD;&#xA;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#xD;&#xA;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#xD;&#xA;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#xD;&#xA;@echo off&#xD;&#xA;" />
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File RelativePath=".\Config.cpp">
</File>
<File RelativePath="..\Common\debug.cpp">
</File>
<File RelativePath=".\Display.cpp">
</File>
<File RelativePath=".\libEGL.cpp">
</File>
<File RelativePath=".\main.cpp">
</File>
<File RelativePath=".\Surface.cpp">
</File>
</Filter>
<Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File RelativePath=".\Config.h">
</File>
<File RelativePath=".\Display.h">
</File>
<File RelativePath="..\..\include\EGL\egl.h">
</File>
<File RelativePath="..\..\include\EGL\eglext.h">
</File>
<File RelativePath="..\..\include\EGL\eglplatform.h">
</File>
<File RelativePath=".\main.h">
</File>
<File RelativePath=".\resource.h">
</File>
<File RelativePath=".\Surface.h">
</File>
<File RelativePath="..\common\version.h">
</File>
</Filter>
<File RelativePath=".\libEGL.def">
</File>
<File RelativePath=".\libEGL.rc">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libEGL"
ProjectGUID="{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}"
RootNamespace="libEGL"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dxguid.lib dwmapi.lib"
LinkIncremental="2"
ModuleDefinitionFile="libEGL.def"
DelayLoadDLLs="dwmapi.dll"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib dxguid.lib dwmapi.lib"
LinkIncremental="1"
ModuleDefinitionFile="libEGL.def"
DelayLoadDLLs="dwmapi.lib"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\Config.cpp"
>
</File>
<File
RelativePath="..\Common\debug.cpp"
>
</File>
<File
RelativePath=".\Display.cpp"
>
</File>
<File
RelativePath=".\libEGL.cpp"
>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\Surface.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\Config.h"
>
</File>
<File
RelativePath=".\Display.h"
>
</File>
<File
RelativePath="..\..\include\EGL\egl.h"
>
</File>
<File
RelativePath="..\..\include\EGL\eglext.h"
>
</File>
<File
RelativePath="..\..\include\EGL\eglplatform.h"
>
</File>
<File
RelativePath=".\main.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\Surface.h"
>
</File>
<File
RelativePath="..\common\version.h"
>
</File>
</Filter>
<File
RelativePath=".\libEGL.def"
>
</File>
<File
RelativePath=".\libEGL.rc"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -243,6 +243,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
mSupportsShaderModel3 = mDeviceCaps.PixelShaderVersion == D3DPS_VERSION(3, 0);
mSupportsVertexTexture = display->getVertexTextureSupport();
mSupportsNonPower2Texture = display->getNonPower2TextureSupport();
mMaxTextureDimension = std::min(std::min((int)mDeviceCaps.MaxTextureWidth, (int)mDeviceCaps.MaxTextureHeight),
(int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
@ -1868,6 +1869,7 @@ void Context::applyState(GLenum drawMode)
}
mStencilStateDirty = false;
mFrontFaceDirty = false;
}
if (mMaskStateDirty)
@ -1902,48 +1904,41 @@ void Context::applyState(GLenum drawMode)
if (mSampleStateDirty)
{
if (framebufferObject->isMultisample())
if (mState.sampleAlphaToCoverage)
{
if (mState.sampleAlphaToCoverage)
{
FIXME("Sample alpha to coverage is unimplemented.");
}
FIXME("Sample alpha to coverage is unimplemented.");
}
device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
if (mState.sampleCoverage)
device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
if (mState.sampleCoverage)
{
unsigned int mask = 0;
if (mState.sampleCoverageValue != 0)
{
unsigned int mask = 0;
if (mState.sampleCoverageValue != 0)
float threshold = 0.5f;
for (int i = 0; i < framebufferObject->getSamples(); ++i)
{
float threshold = 0.5f;
mask <<= 1;
for (int i = 0; i < framebufferObject->getSamples(); ++i)
if ((i + 1) * mState.sampleCoverageValue >= threshold)
{
mask <<= 1;
if ((i + 1) * mState.sampleCoverageValue >= threshold)
{
threshold += 1.0f;
mask |= 1;
}
threshold += 1.0f;
mask |= 1;
}
}
if (mState.sampleCoverageInvert)
{
mask = ~mask;
}
device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
}
else
if (mState.sampleCoverageInvert)
{
device->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
mask = ~mask;
}
device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
}
else
{
device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, FALSE);
device->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
}
mSampleStateDirty = false;
@ -1955,8 +1950,6 @@ void Context::applyState(GLenum drawMode)
mDitherStateDirty = false;
}
mFrontFaceDirty = false;
}
GLenum Context::applyVertexBuffer(GLint first, GLsizei count)
@ -3098,6 +3091,11 @@ bool Context::supports32bitIndices() const
return mSupports32bitIndices;
}
bool Context::supportsNonPower2Texture() const
{
return mSupportsNonPower2Texture;
}
void Context::detachBuffer(GLuint buffer)
{
// [OpenGL ES 2.0.24] section 2.9 page 22:
@ -3335,6 +3333,11 @@ void Context::initExtensionString()
mExtensionString += "GL_OES_element_index_uint ";
}
if (supportsNonPower2Texture())
{
mExtensionString += "GL_OES_texture_npot ";
}
std::string::size_type end = mExtensionString.find_last_not_of(' ');
if (end != std::string::npos)
{

View File

@ -447,6 +447,7 @@ class Context
bool supportsLuminanceTextures() const;
bool supportsLuminanceAlphaTextures() const;
bool supports32bitIndices() const;
bool supportsNonPower2Texture() const;
void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@ -523,6 +524,7 @@ class Context
bool mSupportsShaderModel3;
bool mSupportsVertexTexture;
bool mSupportsNonPower2Texture;
int mMaxRenderbufferDimension;
int mMaxTextureDimension;
int mMaxCubeTextureDimension;

View File

@ -268,23 +268,6 @@ bool Framebuffer::hasStencil()
return false;
}
bool Framebuffer::isMultisample()
{
// If the framebuffer is not complete, attachment samples may be mismatched, and it
// cannot be used as a multisample framebuffer. If it is complete, it is required to
// have a color attachment, and all its attachments must have the same number of samples,
// so the number of samples for the colorbuffer will indicate whether the framebuffer is
// multisampled.
if (completeness() == GL_FRAMEBUFFER_COMPLETE && getColorbuffer()->getSamples() > 0)
{
return true;
}
else
{
return false;
}
}
GLenum Framebuffer::completeness()
{
int width = 0;

View File

@ -59,7 +59,6 @@ class Framebuffer
GLuint getStencilbufferHandle();
bool hasStencil();
bool isMultisample();
int getSamples();
virtual GLenum completeness();

View File

@ -15,6 +15,8 @@
#include "libGLESv2/Shader.h"
#include "libGLESv2/utilities.h"
#include <string>
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
#endif
@ -997,7 +999,7 @@ ID3D10Blob *Program::compileToBinary(const char *hlsl, const char *profile, ID3D
{
const char *message = (const char*)errorMessage->GetBufferPointer();
appendToInfoLog("%s\n", message);
appendToInfoLogSanitized(message);
TRACE("\n%s", hlsl);
TRACE("\n%s", message);
@ -2444,6 +2446,35 @@ bool Program::applyUniform4iv(GLint location, GLsizei count, const GLint *v)
return true;
}
// append a santized message to the program info log.
// The D3D compiler includes the current working directory
// in some of the warning or error messages, so lets remove
// any occurrances of those that we find in the log.
void Program::appendToInfoLogSanitized(const char *message)
{
std::string msg(message);
CHAR path[MAX_PATH] = "";
size_t len;
len = GetCurrentDirectoryA(MAX_PATH, path);
if (len > 0 && len < MAX_PATH)
{
size_t found;
do {
found = msg.find(path);
if (found != std::string::npos)
{
// the +1 here is intentional so that we remove
// the trailing '\' that occurs after the path
msg.erase(found, len+1);
}
} while (found != std::string::npos);
}
appendToInfoLog("%s\n", msg.c_str());
}
void Program::appendToInfoLog(const char *format, ...)
{
if (!format)

View File

@ -161,6 +161,7 @@ class Program
void getConstantHandles(Uniform *targetUniform, D3DXHANDLE *constantPS, D3DXHANDLE *constantVS);
void appendToInfoLogSanitized(const char *message);
void appendToInfoLog(const char *info, ...);
void resetInfoLog();

View File

@ -1248,7 +1248,7 @@ unsigned int Texture::getSerial() const
GLint Texture::creationLevels(GLsizei width, GLsizei height, GLint maxlevel) const
{
if (isPow2(width) && isPow2(height))
if ((isPow2(width) && isPow2(height)) || getContext()->supportsNonPower2Texture())
{
return maxlevel;
}
@ -1373,6 +1373,8 @@ void Texture2D::redefineTexture(GLint level, GLenum format, GLsizei width, GLsiz
mSurface->setBoundTexture(NULL);
mSurface = NULL;
}
mColorbufferProxy.set(NULL);
}
}
@ -1600,17 +1602,25 @@ bool Texture2D::isComplete() const
}
}
if ((getWrapS() != GL_CLAMP_TO_EDGE && !isPow2(width))
|| (getWrapT() != GL_CLAMP_TO_EDGE && !isPow2(height)))
bool npot = getContext()->supportsNonPower2Texture();
if (!npot)
{
return false;
if ((getWrapS() != GL_CLAMP_TO_EDGE && !isPow2(width)) ||
(getWrapT() != GL_CLAMP_TO_EDGE && !isPow2(height)))
{
return false;
}
}
if (mipmapping)
{
if (!isPow2(width) || !isPow2(height))
if (!npot)
{
return false;
if (!isPow2(width) || !isPow2(height))
{
return false;
}
}
int q = log2(std::max(width, height));
@ -1787,9 +1797,12 @@ void Texture2D::convertToRenderTarget()
void Texture2D::generateMipmaps()
{
if (!isPow2(mImageArray[0].width) || !isPow2(mImageArray[0].height))
if (!getContext()->supportsNonPower2Texture())
{
return error(GL_INVALID_OPERATION);
if (!isPow2(mImageArray[0].width) || !isPow2(mImageArray[0].height))
{
return error(GL_INVALID_OPERATION);
}
}
// Purge array levels 1 through q and reset them to represent the generated mipmap levels.
@ -2069,12 +2082,25 @@ bool TextureCubeMap::isComplete() const
}
}
if (mipmapping)
bool npot = getContext()->supportsNonPower2Texture();
if (!npot)
{
if (!isPow2(size) && (getWrapS() != GL_CLAMP_TO_EDGE || getWrapT() != GL_CLAMP_TO_EDGE))
if ((getWrapS() != GL_CLAMP_TO_EDGE || getWrapT() != GL_CLAMP_TO_EDGE) && !isPow2(size))
{
return false;
}
}
if (mipmapping)
{
if (!npot)
{
if (!isPow2(size))
{
return false;
}
}
int q = log2(size);
@ -2446,11 +2472,19 @@ bool TextureCubeMap::isCubeComplete() const
void TextureCubeMap::generateMipmaps()
{
if (!isPow2(mImageArray[0][0].width) || !isCubeComplete())
if (!isCubeComplete())
{
return error(GL_INVALID_OPERATION);
}
if (!getContext()->supportsNonPower2Texture())
{
if (!isPow2(mImageArray[0][0].width))
{
return error(GL_INVALID_OPERATION);
}
}
// Purge array levels 1 through q and reset them to represent the generated mipmap levels.
unsigned int q = log2(mImageArray[0][0].width);
for (unsigned int f = 0; f < 6; f++)

View File

@ -28,6 +28,31 @@
#include "libGLESv2/Shader.h"
#include "libGLESv2/Texture.h"
bool validImageSize(GLint level, GLsizei width, GLsizei height)
{
if (level < 0 || width < 0 || height < 0)
{
return false;
}
if (gl::getContext() && gl::getContext()->supportsNonPower2Texture())
{
return true;
}
if (level == 0)
{
return true;
}
if (gl::isPow2(width) && gl::isPow2(height))
{
return true;
}
return false;
}
extern "C"
{
@ -738,12 +763,7 @@ void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum interna
try
{
if (level < 0)
{
return error(GL_INVALID_VALUE);
}
if (width < 0 || height < 0 || (level > 0 && !gl::isPow2(width)) || (level > 0 && !gl::isPow2(height)) || border != 0 || imageSize < 0)
if (!validImageSize(level, width, height) || border != 0 || imageSize < 0)
{
return error(GL_INVALID_VALUE);
}
@ -868,13 +888,7 @@ void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffs
return error(GL_INVALID_ENUM);
}
if (level < 0)
{
return error(GL_INVALID_VALUE);
}
if (xoffset < 0 || yoffset < 0 || width < 0 || height < 0 ||
(level > 0 && !gl::isPow2(width)) || (level > 0 && !gl::isPow2(height)) || imageSize < 0)
if (xoffset < 0 || yoffset < 0 || !validImageSize(level, width, height) || imageSize < 0)
{
return error(GL_INVALID_VALUE);
}
@ -982,12 +996,7 @@ void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalforma
try
{
if (level < 0 || width < 0 || height < 0)
{
return error(GL_INVALID_VALUE);
}
if (level > 0 && (!gl::isPow2(width) || !gl::isPow2(height)))
if (!validImageSize(level, width, height))
{
return error(GL_INVALID_VALUE);
}
@ -4397,12 +4406,7 @@ void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GL
try
{
if (level < 0 || width < 0 || height < 0)
{
return error(GL_INVALID_VALUE);
}
if (level > 0 && (!gl::isPow2(width) || !gl::isPow2(height)))
if (!validImageSize(level, width, height))
{
return error(GL_INVALID_VALUE);
}