mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 861039 - Update ANGLE to r2042. - r=bjacob
This commit is contained in:
parent
e4ecb53d2c
commit
baa41416e7
@ -4283,6 +4283,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
SH_ENFORCE_PACKING_RESTRICTIONS;
|
||||
|
||||
// we want to do this everywhere, but:
|
||||
//TODO: Enable on windows:
|
||||
#ifndef XP_WIN // to do this on Windows, we need ANGLE r1719, 1733, 1734.
|
||||
#ifndef XP_MACOSX // to do this on Mac, we need to do it only on Mac OSX > 10.6 as this
|
||||
// causes the shader compiler in 10.6 to crash
|
||||
@ -4309,7 +4310,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
}
|
||||
|
||||
if (!ShCompile(compiler, &s, 1, compileOptions)) {
|
||||
int len = 0;
|
||||
size_t len = 0;
|
||||
ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &len);
|
||||
|
||||
if (len) {
|
||||
@ -4325,15 +4326,15 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
return;
|
||||
}
|
||||
|
||||
int num_attributes = 0;
|
||||
size_t num_attributes = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTES, &num_attributes);
|
||||
int num_uniforms = 0;
|
||||
size_t num_uniforms = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_UNIFORMS, &num_uniforms);
|
||||
int attrib_max_length = 0;
|
||||
size_t attrib_max_length = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &attrib_max_length);
|
||||
int uniform_max_length = 0;
|
||||
size_t uniform_max_length = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_UNIFORM_MAX_LENGTH, &uniform_max_length);
|
||||
int mapped_max_length = 0;
|
||||
size_t mapped_max_length = 0;
|
||||
ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mapped_max_length);
|
||||
|
||||
shader->mAttribMaxNameLength = attrib_max_length;
|
||||
@ -4346,10 +4347,11 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
nsAutoArrayPtr<char> uniform_name(new char[uniform_max_length+1]);
|
||||
nsAutoArrayPtr<char> mapped_name(new char[mapped_max_length+1]);
|
||||
|
||||
for (int i = 0; i < num_uniforms; i++) {
|
||||
int length, size;
|
||||
for (size_t i = 0; i < num_uniforms; i++) {
|
||||
size_t length;
|
||||
int size;
|
||||
ShDataType type;
|
||||
ShGetActiveUniform(compiler, i,
|
||||
ShGetActiveUniform(compiler, (int)i,
|
||||
&length, &size, &type,
|
||||
uniform_name,
|
||||
mapped_name);
|
||||
@ -4374,10 +4376,11 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
|
||||
if (useShaderSourceTranslation) {
|
||||
|
||||
for (int i = 0; i < num_attributes; i++) {
|
||||
int length, size;
|
||||
for (size_t i = 0; i < num_attributes; i++) {
|
||||
size_t length;
|
||||
int size;
|
||||
ShDataType type;
|
||||
ShGetActiveAttrib(compiler, i,
|
||||
ShGetActiveAttrib(compiler, (int)i,
|
||||
&length, &size, &type,
|
||||
attribute_name,
|
||||
mapped_name);
|
||||
@ -4386,7 +4389,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
nsDependentCString(mapped_name)));
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
size_t len = 0;
|
||||
ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &len);
|
||||
|
||||
nsAutoCString translatedSrc;
|
||||
|
9
gfx/angle/.gitignore
vendored
9
gfx/angle/.gitignore
vendored
@ -1,9 +0,0 @@
|
||||
Debug
|
||||
Release
|
||||
*.sdf
|
||||
*.ncb
|
||||
*.suo
|
||||
*.vcproj.*
|
||||
*.vcxproj.user
|
||||
patches-*
|
||||
*.target.mk
|
@ -12,7 +12,6 @@ TransGaming Inc.
|
||||
3DLabs Inc. Ltd.
|
||||
|
||||
Adobe Systems Inc.
|
||||
Apple Inc.
|
||||
Autodesk, Inc.
|
||||
Cloud Party, Inc.
|
||||
Intel Corporation
|
||||
@ -31,3 +30,4 @@ Boying Lu
|
||||
Aitor Moreno
|
||||
Yuri O'Donnell
|
||||
Josh Soref
|
||||
Evan Wallace
|
||||
|
@ -36,6 +36,7 @@ Google Inc.
|
||||
Ben Vanik
|
||||
Adrienne Walker
|
||||
thestig@chromium.org
|
||||
Justin Schuh
|
||||
|
||||
Adobe Systems Inc.
|
||||
Alexandru Chiculita
|
||||
|
@ -1,6 +1,6 @@
|
||||
deps = {
|
||||
"trunk/third_party/gyp":
|
||||
"http://gyp.googlecode.com/svn/trunk@1080",
|
||||
"http://gyp.googlecode.com/svn/trunk@1564",
|
||||
|
||||
"trunk/third_party/googletest":
|
||||
"http://googletest.googlecode.com/svn/trunk@573", #release 1.6.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2002-2010 The ANGLE Project Authors.
|
||||
// Copyright (C) 2002-2013 The ANGLE Project Authors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -17,14 +17,14 @@ endif
|
||||
|
||||
# The below is a rough translation of build_angle.gypi:
|
||||
DEFINES += -DANGLE_DISABLE_TRACE
|
||||
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0
|
||||
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1
|
||||
|
||||
# Target: 'preprocessor'
|
||||
# src/compiler/preprocessor:
|
||||
VPATH += $(srcdir)/src/compiler/preprocessor
|
||||
CPPSRCS += \
|
||||
PreprocessorDiagnostics.cpp \
|
||||
PreprocessorDirectiveHandler.cpp \
|
||||
DiagnosticsBase.cpp \
|
||||
DirectiveHandlerBase.cpp \
|
||||
DirectiveParser.cpp \
|
||||
ExpressionParser.cpp \
|
||||
Input.cpp \
|
||||
@ -48,7 +48,6 @@ DEFINES += -DCOMPILER_IMPLEMENTATION
|
||||
VPATH += $(srcdir)/src/compiler
|
||||
# src/compiler:
|
||||
CPPSRCS += \
|
||||
ArrayBoundsClamper.cpp \
|
||||
BuiltInFunctionEmulator.cpp \
|
||||
Compiler.cpp \
|
||||
compiler_debug.cpp \
|
||||
@ -95,6 +94,12 @@ CPPSRCS += \
|
||||
RestrictVertexShaderTiming.cpp \
|
||||
$(NULL)
|
||||
|
||||
VPATH += $(srcdir)/src/third_party/compiler
|
||||
# src/third_party/compiler:
|
||||
CPPSRCS += \
|
||||
ArrayBoundsClamper.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
CPPSRCS += ossource_win.cpp
|
||||
else
|
||||
|
@ -1,6 +1,6 @@
|
||||
This is the ANGLE project, from http://code.google.com/p/angleproject/
|
||||
|
||||
Current revision: r1561
|
||||
Current revision: r2042
|
||||
|
||||
|
||||
== Applied local patches ==
|
||||
@ -13,11 +13,12 @@ In this order:
|
||||
To: "src/compiler/compiler_debug.{cpp,h}"
|
||||
Repair includes accordingly.
|
||||
|
||||
angle-build-dedupe-preproc-files.patch:
|
||||
Rename: "src/compiler/preprocessor/Diagnostics.cpp"
|
||||
To: "src/compiler/preprocessor/PreprocessorDiagnostics.cpp"
|
||||
Rename: "src/compiler/preprocessor/DirectiveHandler.cpp"
|
||||
To: "src/compiler/preprocessor/PreprocessorDirectiveHandler.cpp"
|
||||
angle-build-d3dcompiler-list.patch:
|
||||
Move `ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES` define from make files to
|
||||
Display.cpp, where it's used.
|
||||
|
||||
angle-build-khrplatform-h-path.patch:
|
||||
Fix include path for khrplatform.h.
|
||||
|
||||
angle-long-ident-spooky-hash.patch:
|
||||
Use Spooky Hash for long identifier hashing. See bug 676071.
|
||||
@ -25,13 +26,10 @@ In this order:
|
||||
angle-faceforward-emu.patch:
|
||||
Adds emulation for faceforward(float,float,float), which is needed to
|
||||
prevent crashing on Mac+Intel. See bug 771406.
|
||||
|
||||
angle-r1638.patch
|
||||
Adds uniform array index clamping on non-Windows platforms.
|
||||
Windows would require r1719, r1733, r1734.
|
||||
|
||||
angle-cross-compilation.patch
|
||||
Fixes cross compilation on case sensitive OSes.
|
||||
|
||||
angle-default-clamp-strat.patch:
|
||||
Fixes TCompiler::Init to treat `resources.ArrayIndexClampingStrategy`
|
||||
as a request for the default strategy.
|
||||
|
||||
In addition to these patches, the Makefile.in files are ours, they're not present in
|
||||
upsteam ANGLE. Therefore, changes made to the Makefile.in files should not be stored
|
||||
|
28
gfx/angle/angle-build-d3dcompiler-list.patch
Normal file
28
gfx/angle/angle-build-d3dcompiler-list.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From: Jeff Gilbert <jgilbert@mozilla.com>
|
||||
|
||||
diff --git a/gfx/angle/src/libEGL/Display.cpp b/gfx/angle/src/libEGL/Display.cpp
|
||||
--- a/gfx/angle/src/libEGL/Display.cpp
|
||||
+++ b/gfx/angle/src/libEGL/Display.cpp
|
||||
@@ -26,16 +26,22 @@
|
||||
// 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)
|
||||
|
||||
+#define ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES \
|
||||
+ { \
|
||||
+ TEXT("d3dcompiler_46.dll"), \
|
||||
+ TEXT("d3dcompiler_43.dll") \
|
||||
+ }
|
||||
+
|
||||
namespace egl
|
||||
{
|
||||
namespace
|
||||
{
|
||||
typedef std::map<EGLNativeDisplayType, Display*> DisplayMap;
|
||||
DisplayMap displays;
|
||||
}
|
||||
|
@ -58,13 +58,13 @@ diff --git a/gfx/angle/src/compiler/OutputGLSLBase.cpp b/gfx/angle/src/compiler/
|
||||
-#include "compiler/debug.h"
|
||||
+#include "compiler/compiler_debug.h"
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
namespace
|
||||
{
|
||||
TString arrayBrackets(const TType& type)
|
||||
{
|
||||
ASSERT(type.isArray());
|
||||
TInfoSinkBase out;
|
||||
out << "[" << type.getArraySize() << "]";
|
||||
diff --git a/gfx/angle/src/compiler/OutputHLSL.cpp b/gfx/angle/src/compiler/OutputHLSL.cpp
|
||||
--- a/gfx/angle/src/compiler/OutputHLSL.cpp
|
||||
+++ b/gfx/angle/src/compiler/OutputHLSL.cpp
|
||||
@ -79,14 +79,14 @@ diff --git a/gfx/angle/src/compiler/OutputHLSL.cpp b/gfx/angle/src/compiler/Outp
|
||||
#include "common/angleutils.h"
|
||||
-#include "compiler/debug.h"
|
||||
+#include "compiler/compiler_debug.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/UnfoldShortCircuit.h"
|
||||
#include "compiler/SearchSymbol.h"
|
||||
#include "compiler/DetectDiscontinuity.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SearchSymbol.h"
|
||||
#include "compiler/UnfoldShortCircuit.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include <cfloat>
|
||||
#include <stdio.h>
|
||||
diff --git a/gfx/angle/src/compiler/Types.h b/gfx/angle/src/compiler/Types.h
|
||||
--- a/gfx/angle/src/compiler/Types.h
|
||||
+++ b/gfx/angle/src/compiler/Types.h
|
||||
|
@ -1,8 +0,0 @@
|
||||
From: Jeff Gilbert <jgilbert@mozilla.com>
|
||||
|
||||
diff --git a/gfx/angle/src/compiler/preprocessor/Diagnostics.cpp b/gfx/angle/src/compiler/preprocessor/PreprocessorDiagnostics.cpp
|
||||
rename from gfx/angle/src/compiler/preprocessor/Diagnostics.cpp
|
||||
rename to gfx/angle/src/compiler/preprocessor/PreprocessorDiagnostics.cpp
|
||||
diff --git a/gfx/angle/src/compiler/preprocessor/DirectiveHandler.cpp b/gfx/angle/src/compiler/preprocessor/PreprocessorDirectiveHandler.cpp
|
||||
rename from gfx/angle/src/compiler/preprocessor/DirectiveHandler.cpp
|
||||
rename to gfx/angle/src/compiler/preprocessor/PreprocessorDirectiveHandler.cpp
|
24
gfx/angle/angle-build-khrplatform-h-path.patch
Normal file
24
gfx/angle/angle-build-khrplatform-h-path.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From: Jeff Gilbert <jgilbert@mozilla.com>
|
||||
|
||||
diff --git a/gfx/angle/include/GLSLANG/ShaderLang.h b/gfx/angle/include/GLSLANG/ShaderLang.h
|
||||
--- a/gfx/angle/include/GLSLANG/ShaderLang.h
|
||||
+++ b/gfx/angle/include/GLSLANG/ShaderLang.h
|
||||
@@ -18,17 +18,17 @@
|
||||
#else // defined(WIN32)
|
||||
#define COMPILER_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#else // defined(COMPONENT_BUILD)
|
||||
#define COMPILER_EXPORT
|
||||
#endif
|
||||
|
||||
-#include "KHR/khrplatform.h"
|
||||
+#include "khrplatform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
// and the shading language compiler.
|
||||
//
|
||||
|
||||
#ifdef __cplusplus
|
@ -1,27 +0,0 @@
|
||||
From: Jacek Caban <jacek@codeweavers.com>
|
||||
Fixed ANGLE cross compilation on case sensitive OSes
|
||||
|
||||
|
||||
diff --git a/gfx/angle/src/libEGL/Display.h b/gfx/angle/src/libEGL/Display.h
|
||||
index aedc8e7..2162265 100644
|
||||
--- a/gfx/angle/src/libEGL/Display.h
|
||||
+++ b/gfx/angle/src/libEGL/Display.h
|
||||
@@ -11,17 +11,17 @@
|
||||
#ifndef LIBEGL_DISPLAY_H_
|
||||
#define LIBEGL_DISPLAY_H_
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <d3d9.h>
|
||||
-#include <D3Dcompiler.h>
|
||||
+#include <d3dcompiler.h>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "libGLESv2/Context.h"
|
||||
|
||||
#include "libEGL/Config.h"
|
||||
#include "libEGL/ShaderCache.h"
|
52
gfx/angle/angle-default-clamp-strat.patch
Normal file
52
gfx/angle/angle-default-clamp-strat.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From: Jeff Gilbert <jgilbert@mozilla.com>
|
||||
|
||||
diff --git a/gfx/angle/src/compiler/Compiler.cpp b/gfx/angle/src/compiler/Compiler.cpp
|
||||
--- a/gfx/angle/src/compiler/Compiler.cpp
|
||||
+++ b/gfx/angle/src/compiler/Compiler.cpp
|
||||
@@ -124,18 +124,21 @@ bool TCompiler::Init(const ShBuiltInReso
|
||||
TScopedPoolAllocator scopedAlloc(&allocator, false);
|
||||
|
||||
// Generate built-in symbol table.
|
||||
if (!InitBuiltInSymbolTable(resources))
|
||||
return false;
|
||||
InitExtensionBehavior(resources, extensionBehavior);
|
||||
fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
|
||||
|
||||
- arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
|
||||
- clampingStrategy = resources.ArrayIndexClampingStrategy;
|
||||
+ // ArrayIndexClampingStrategy's enum starts at 1, so 0 is 'default'.
|
||||
+ if (resources.ArrayIndexClampingStrategy) {
|
||||
+ clampingStrategy = resources.ArrayIndexClampingStrategy;
|
||||
+ }
|
||||
+ arrayBoundsClamper.SetClampingStrategy(clampingStrategy);
|
||||
|
||||
hashFunction = resources.HashFunction;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TCompiler::compile(const char* const shaderStrings[],
|
||||
size_t numStrings,
|
||||
diff --git a/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp b/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
|
||||
--- a/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
|
||||
+++ b/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
|
||||
@@ -72,16 +72,19 @@ private:
|
||||
ArrayBoundsClamper::ArrayBoundsClamper()
|
||||
: mClampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC)
|
||||
, mArrayBoundsClampDefinitionNeeded(false)
|
||||
{
|
||||
}
|
||||
|
||||
void ArrayBoundsClamper::SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy)
|
||||
{
|
||||
+ ASSERT(clampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC ||
|
||||
+ clampingStrategy == SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION);
|
||||
+
|
||||
mClampingStrategy = clampingStrategy;
|
||||
}
|
||||
|
||||
void ArrayBoundsClamper::MarkIndirectArrayBoundsForClamping(TIntermNode* root)
|
||||
{
|
||||
ASSERT(root);
|
||||
|
||||
ArrayBoundsClamperMarker clamper;
|
@ -1,10 +1,10 @@
|
||||
# HG changeset patch
|
||||
# Parent 6a165b9e45205190517515abec94429715303081
|
||||
# Parent 262218204644915abb2add8aa52195c24035c293
|
||||
|
||||
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
|
||||
--- a/gfx/angle/Makefile.in
|
||||
+++ b/gfx/angle/Makefile.in
|
||||
@@ -73,16 +73,17 @@ CPPSRCS += \
|
||||
@@ -84,16 +84,17 @@ CPPSRCS += \
|
||||
intermOut.cpp \
|
||||
IntermTraverse.cpp \
|
||||
MapLongVariableNames.cpp \
|
||||
@ -37,7 +37,7 @@ diff --git a/gfx/angle/src/compiler/MapLongVariableNames.cpp b/gfx/angle/src/com
|
||||
|
||||
namespace {
|
||||
|
||||
TString mapLongName(int id, const TString& name, bool isGlobal)
|
||||
TString mapLongName(size_t id, const TString& name, bool isGlobal)
|
||||
{
|
||||
ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
|
||||
TStringStream stream;
|
||||
@ -723,7 +723,7 @@ new file mode 100644
|
||||
diff --git a/gfx/angle/src/libGLESv2/Makefile.in b/gfx/angle/src/libGLESv2/Makefile.in
|
||||
--- a/gfx/angle/src/libGLESv2/Makefile.in
|
||||
+++ b/gfx/angle/src/libGLESv2/Makefile.in
|
||||
@@ -86,16 +86,17 @@ CPPSRCS += \
|
||||
@@ -91,16 +91,17 @@ CPPSRCS += \
|
||||
intermOut.cpp \
|
||||
IntermTraverse.cpp \
|
||||
MapLongVariableNames.cpp \
|
||||
|
@ -1,475 +0,0 @@
|
||||
# HG changeset patch
|
||||
# Parent faf255e4400222ee23c29ddcc76fb3dce56145f4
|
||||
|
||||
diff --git a/gfx/angle/AUTHORS b/gfx/angle/AUTHORS
|
||||
--- a/gfx/angle/AUTHORS
|
||||
+++ b/gfx/angle/AUTHORS
|
||||
@@ -7,16 +7,17 @@
|
||||
# Name or Organization
|
||||
# Email addresses for individuals are tracked elsewhere to avoid spam.
|
||||
|
||||
Google Inc.
|
||||
TransGaming Inc.
|
||||
3DLabs Inc. Ltd.
|
||||
|
||||
Adobe Systems Inc.
|
||||
+Apple Inc.
|
||||
Autodesk, Inc.
|
||||
Cloud Party, Inc.
|
||||
Intel Corporation
|
||||
Mozilla Corporation
|
||||
Turbulenz
|
||||
Klarälvdalens Datakonsult AB
|
||||
|
||||
Jacek Caban
|
||||
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
|
||||
--- a/gfx/angle/Makefile.in
|
||||
+++ b/gfx/angle/Makefile.in
|
||||
@@ -51,16 +51,17 @@ LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/include/KHR \
|
||||
-I$(srcdir)/src
|
||||
|
||||
DEFINES += -DCOMPILER_IMPLEMENTATION
|
||||
|
||||
VPATH += $(srcdir)/src/compiler
|
||||
# src/compiler:
|
||||
CPPSRCS += \
|
||||
+ ArrayBoundsClamper.cpp \
|
||||
BuiltInFunctionEmulator.cpp \
|
||||
Compiler.cpp \
|
||||
compiler_debug.cpp \
|
||||
DetectRecursion.cpp \
|
||||
Diagnostics.cpp \
|
||||
DirectiveHandler.cpp \
|
||||
ForLoopUnroll.cpp \
|
||||
glslang_lex.cpp \
|
||||
diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla
|
||||
--- a/gfx/angle/README.mozilla
|
||||
+++ b/gfx/angle/README.mozilla
|
||||
@@ -21,16 +21,20 @@ In this order:
|
||||
|
||||
angle-long-ident-spooky-hash.patch:
|
||||
Use Spooky Hash for long identifier hashing. See bug 676071.
|
||||
|
||||
angle-faceforward-emu.patch:
|
||||
Adds emulation for faceforward(float,float,float), which is needed to
|
||||
prevent crashing on Mac+Intel. See bug 771406.
|
||||
|
||||
+ angle-r1638.patch
|
||||
+ Adds uniform array index clamping on non-Windows platforms.
|
||||
+ Windows would require r1719, r1733, r1734.
|
||||
+
|
||||
In addition to these patches, the Makefile.in files are ours, they're not present in
|
||||
upsteam ANGLE. Therefore, changes made to the Makefile.in files should not be stored
|
||||
in the local .patch files.
|
||||
|
||||
|
||||
== How to do a clean-slate upgrade ==
|
||||
1. Backup our moz-specific files:
|
||||
README.mozilla
|
||||
diff --git a/gfx/angle/include/GLSLANG/ShaderLang.h b/gfx/angle/include/GLSLANG/ShaderLang.h
|
||||
--- a/gfx/angle/include/GLSLANG/ShaderLang.h
|
||||
+++ b/gfx/angle/include/GLSLANG/ShaderLang.h
|
||||
@@ -145,17 +145,23 @@ typedef enum {
|
||||
// restrictions on fragment shaders.
|
||||
// This flag only has an effect if all of the following are true:
|
||||
// - The shader spec is SH_WEBGL_SPEC.
|
||||
// - The compile options contain the SH_TIMING_RESTRICTIONS flag.
|
||||
// - The shader type is SH_FRAGMENT_SHADER.
|
||||
SH_DEPENDENCY_GRAPH = 0x0400,
|
||||
|
||||
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
|
||||
- SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800
|
||||
+ SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
|
||||
+
|
||||
+ // This flag ensures all indirect (expression-based) array indexing
|
||||
+ // is clamped to the bounds of the array. This ensures, for example,
|
||||
+ // that you cannot read off the end of a uniform, whether an array
|
||||
+ // vec234, or mat234 type.
|
||||
+ SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000
|
||||
} ShCompileOptions;
|
||||
|
||||
//
|
||||
// Driver must call this first, once, before doing any other
|
||||
// compiler operations.
|
||||
// If the function succeeds, the return value is nonzero, else zero.
|
||||
//
|
||||
COMPILER_EXPORT int ShInitialize();
|
||||
diff --git a/gfx/angle/src/build_angle.gypi b/gfx/angle/src/build_angle.gypi
|
||||
--- a/gfx/angle/src/build_angle.gypi
|
||||
+++ b/gfx/angle/src/build_angle.gypi
|
||||
@@ -54,16 +54,18 @@
|
||||
'include_dirs': [
|
||||
'.',
|
||||
'../include',
|
||||
],
|
||||
'defines': [
|
||||
'COMPILER_IMPLEMENTATION',
|
||||
],
|
||||
'sources': [
|
||||
+ 'compiler/ArrayBoundsClamper.cpp',
|
||||
+ 'compiler/ArrayBoundsClamper.h',
|
||||
'compiler/BaseTypes.h',
|
||||
'compiler/BuiltInFunctionEmulator.cpp',
|
||||
'compiler/BuiltInFunctionEmulator.h',
|
||||
'compiler/Common.h',
|
||||
'compiler/Compiler.cpp',
|
||||
'compiler/ConstantUnion.h',
|
||||
'compiler/debug.cpp',
|
||||
'compiler/debug.h',
|
||||
diff --git a/gfx/angle/src/compiler/Compiler.cpp b/gfx/angle/src/compiler/Compiler.cpp
|
||||
--- a/gfx/angle/src/compiler/Compiler.cpp
|
||||
+++ b/gfx/angle/src/compiler/Compiler.cpp
|
||||
@@ -1,14 +1,15 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 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.
|
||||
//
|
||||
|
||||
+#include "compiler/ArrayBoundsClamper.h"
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/DetectRecursion.h"
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/Initialize.h"
|
||||
#include "compiler/InitializeParseContext.h"
|
||||
#include "compiler/MapLongVariableNames.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/RenameFunction.h"
|
||||
@@ -187,16 +188,20 @@ bool TCompiler::compile(const char* cons
|
||||
// Unroll for-loop markup needs to happen after validateLimitations pass.
|
||||
if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX))
|
||||
ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(root);
|
||||
|
||||
// Built-in function emulation needs to happen after validateLimitations pass.
|
||||
if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
|
||||
builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(root);
|
||||
|
||||
+ // Clamping uniform array bounds needs to happen after validateLimitations pass.
|
||||
+ if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
|
||||
+ arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
|
||||
+
|
||||
// Call mapLongVariableNames() before collectAttribsUniforms() so in
|
||||
// collectAttribsUniforms() we already have the mapped symbol names and
|
||||
// we could composite mapped and original variable names.
|
||||
// Also, if we hash all the names, then no need to do this for long names.
|
||||
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
|
||||
mapLongVariableNames(root);
|
||||
|
||||
if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS)) {
|
||||
@@ -232,16 +237,17 @@ bool TCompiler::InitBuiltInSymbolTable(c
|
||||
|
||||
builtIns.initialize(shaderType, shaderSpec, resources);
|
||||
return InitializeSymbolTable(builtIns.getBuiltInStrings(),
|
||||
shaderType, shaderSpec, resources, infoSink, symbolTable);
|
||||
}
|
||||
|
||||
void TCompiler::clearResults()
|
||||
{
|
||||
+ arrayBoundsClamper.Cleanup();
|
||||
infoSink.info.erase();
|
||||
infoSink.obj.erase();
|
||||
infoSink.debug.erase();
|
||||
|
||||
attribs.clear();
|
||||
uniforms.clear();
|
||||
|
||||
builtInFunctionEmulator.Cleanup();
|
||||
@@ -348,8 +354,14 @@ const TExtensionBehavior& TCompiler::get
|
||||
{
|
||||
return extensionBehavior;
|
||||
}
|
||||
|
||||
const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
|
||||
{
|
||||
return builtInFunctionEmulator;
|
||||
}
|
||||
+
|
||||
+const ArrayBoundsClamper& TCompiler::getArrayBoundsClamper() const
|
||||
+{
|
||||
+ return arrayBoundsClamper;
|
||||
+}
|
||||
+
|
||||
diff --git a/gfx/angle/src/compiler/OutputGLSLBase.cpp b/gfx/angle/src/compiler/OutputGLSLBase.cpp
|
||||
--- a/gfx/angle/src/compiler/OutputGLSLBase.cpp
|
||||
+++ b/gfx/angle/src/compiler/OutputGLSLBase.cpp
|
||||
@@ -207,18 +207,47 @@ bool TOutputGLSLBase::visitBinary(Visit
|
||||
case EOpVectorTimesMatrixAssign:
|
||||
case EOpVectorTimesScalarAssign:
|
||||
case EOpMatrixTimesScalarAssign:
|
||||
case EOpMatrixTimesMatrixAssign:
|
||||
writeTriplet(visit, "(", " *= ", ")");
|
||||
break;
|
||||
|
||||
case EOpIndexDirect:
|
||||
+ writeTriplet(visit, NULL, "[", "]");
|
||||
+ break;
|
||||
case EOpIndexIndirect:
|
||||
- writeTriplet(visit, NULL, "[", "]");
|
||||
+ if (node->getAddIndexClamp())
|
||||
+ {
|
||||
+ if (visit == InVisit)
|
||||
+ {
|
||||
+ out << "[webgl_int_clamp(";
|
||||
+ }
|
||||
+ else if (visit == PostVisit)
|
||||
+ {
|
||||
+ int maxSize;
|
||||
+ TIntermTyped *left = node->getLeft();
|
||||
+ TType leftType = left->getType();
|
||||
+
|
||||
+ if (left->isArray())
|
||||
+ {
|
||||
+ // The shader will fail validation if the array length is not > 0.
|
||||
+ maxSize = leftType.getArraySize() - 1;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ maxSize = leftType.getNominalSize() - 1;
|
||||
+ }
|
||||
+ out << ", 0, " << maxSize << ")]";
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ writeTriplet(visit, NULL, "[", "]");
|
||||
+ }
|
||||
break;
|
||||
case EOpIndexDirectStruct:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << ".";
|
||||
// TODO(alokp): ASSERT
|
||||
out << hashName(node->getType().getFieldName());
|
||||
visitChildren = false;
|
||||
diff --git a/gfx/angle/src/compiler/ShHandle.h b/gfx/angle/src/compiler/ShHandle.h
|
||||
--- a/gfx/angle/src/compiler/ShHandle.h
|
||||
+++ b/gfx/angle/src/compiler/ShHandle.h
|
||||
@@ -11,16 +11,17 @@
|
||||
// Machine independent part of the compiler private objects
|
||||
// sent as ShHandle to the driver.
|
||||
//
|
||||
// This should not be included by driver code.
|
||||
//
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
+#include "compiler/ArrayBoundsClamper.h"
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/HashNames.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/VariableInfo.h"
|
||||
|
||||
class LongNameMap;
|
||||
@@ -101,30 +102,32 @@ protected:
|
||||
// Returns true if the shader does not use samplers.
|
||||
bool enforceVertexShaderTimingRestrictions(TIntermNode* root);
|
||||
// Returns true if the shader does not use sampler dependent values to affect control
|
||||
// flow or in operations whose time can depend on the input values.
|
||||
bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph& graph);
|
||||
// Get built-in extensions with default behavior.
|
||||
const TExtensionBehavior& getExtensionBehavior() const;
|
||||
|
||||
+ const ArrayBoundsClamper& getArrayBoundsClamper() const;
|
||||
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
|
||||
|
||||
private:
|
||||
ShShaderType shaderType;
|
||||
ShShaderSpec shaderSpec;
|
||||
|
||||
int maxUniformVectors;
|
||||
|
||||
// Built-in symbol table for the given language, spec, and resources.
|
||||
// It is preserved from compile-to-compile.
|
||||
TSymbolTable symbolTable;
|
||||
// Built-in extensions with default behavior.
|
||||
TExtensionBehavior extensionBehavior;
|
||||
|
||||
+ ArrayBoundsClamper arrayBoundsClamper;
|
||||
BuiltInFunctionEmulator builtInFunctionEmulator;
|
||||
|
||||
// Results of compilation.
|
||||
TInfoSink infoSink; // Output sink.
|
||||
TVariableInfoList attribs; // Active attributes in the compiled shader.
|
||||
TVariableInfoList uniforms; // Active uniforms in the compiled shader.
|
||||
|
||||
// Cached copy of the ref-counted singleton.
|
||||
diff --git a/gfx/angle/src/compiler/TranslatorESSL.cpp b/gfx/angle/src/compiler/TranslatorESSL.cpp
|
||||
--- a/gfx/angle/src/compiler/TranslatorESSL.cpp
|
||||
+++ b/gfx/angle/src/compiler/TranslatorESSL.cpp
|
||||
@@ -17,16 +17,19 @@ void TranslatorESSL::translate(TIntermNo
|
||||
|
||||
// Write built-in extension behaviors.
|
||||
writeExtensionBehavior();
|
||||
|
||||
// Write emulated built-in functions if needed.
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, getShaderType() == SH_FRAGMENT_SHADER);
|
||||
|
||||
+ // Write array bounds clamping emulation if needed.
|
||||
+ getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
+
|
||||
// Write translated shader.
|
||||
TOutputESSL outputESSL(sink, getHashFunction(), getNameMap(), getSymbolTable());
|
||||
root->traverse(&outputESSL);
|
||||
}
|
||||
|
||||
void TranslatorESSL::writeExtensionBehavior() {
|
||||
TInfoSinkBase& sink = getInfoSink().obj;
|
||||
const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
|
||||
diff --git a/gfx/angle/src/compiler/TranslatorGLSL.cpp b/gfx/angle/src/compiler/TranslatorGLSL.cpp
|
||||
--- a/gfx/angle/src/compiler/TranslatorGLSL.cpp
|
||||
+++ b/gfx/angle/src/compiler/TranslatorGLSL.cpp
|
||||
@@ -30,12 +30,15 @@ void TranslatorGLSL::translate(TIntermNo
|
||||
|
||||
// Write GLSL version.
|
||||
writeVersion(getShaderType(), root, sink);
|
||||
|
||||
// Write emulated built-in functions if needed.
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, false);
|
||||
|
||||
+ // Write array bounds clamping emulation if needed.
|
||||
+ getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
+
|
||||
// Write translated shader.
|
||||
TOutputGLSL outputGLSL(sink, getHashFunction(), getNameMap(), getSymbolTable());
|
||||
root->traverse(&outputGLSL);
|
||||
}
|
||||
diff --git a/gfx/angle/src/compiler/intermOut.cpp b/gfx/angle/src/compiler/intermOut.cpp
|
||||
--- a/gfx/angle/src/compiler/intermOut.cpp
|
||||
+++ b/gfx/angle/src/compiler/intermOut.cpp
|
||||
@@ -37,17 +37,17 @@ protected:
|
||||
|
||||
TString TType::getCompleteString() const
|
||||
{
|
||||
TStringStream stream;
|
||||
|
||||
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
|
||||
stream << getQualifierString() << " " << getPrecisionString() << " ";
|
||||
if (array)
|
||||
- stream << "array of ";
|
||||
+ stream << "array[" << getArraySize() << "] of ";
|
||||
if (matrix)
|
||||
stream << size << "X" << size << " matrix of ";
|
||||
else if (size > 1)
|
||||
stream << size << "-component vector of ";
|
||||
|
||||
stream << getBasicString();
|
||||
return stream.str();
|
||||
}
|
||||
diff --git a/gfx/angle/src/compiler/intermediate.h b/gfx/angle/src/compiler/intermediate.h
|
||||
--- a/gfx/angle/src/compiler/intermediate.h
|
||||
+++ b/gfx/angle/src/compiler/intermediate.h
|
||||
@@ -386,30 +386,36 @@ protected:
|
||||
TOperator op;
|
||||
};
|
||||
|
||||
//
|
||||
// Nodes for all the basic binary math operators.
|
||||
//
|
||||
class TIntermBinary : public TIntermOperator {
|
||||
public:
|
||||
- TIntermBinary(TOperator o) : TIntermOperator(o) {}
|
||||
+ TIntermBinary(TOperator o) : TIntermOperator(o), addIndexClamp(false) {}
|
||||
|
||||
virtual TIntermBinary* getAsBinaryNode() { return this; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
|
||||
void setLeft(TIntermTyped* n) { left = n; }
|
||||
void setRight(TIntermTyped* n) { right = n; }
|
||||
TIntermTyped* getLeft() const { return left; }
|
||||
TIntermTyped* getRight() const { return right; }
|
||||
bool promote(TInfoSink&);
|
||||
|
||||
+ void setAddIndexClamp() { addIndexClamp = true; }
|
||||
+ bool getAddIndexClamp() { return addIndexClamp; }
|
||||
+
|
||||
protected:
|
||||
TIntermTyped* left;
|
||||
TIntermTyped* right;
|
||||
+
|
||||
+ // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
|
||||
+ bool addIndexClamp;
|
||||
};
|
||||
|
||||
//
|
||||
// Nodes for unary math operators.
|
||||
//
|
||||
class TIntermUnary : public TIntermOperator {
|
||||
public:
|
||||
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
|
||||
diff --git a/gfx/angle/src/compiler/translator_common.vcxproj b/gfx/angle/src/compiler/translator_common.vcxproj
|
||||
--- a/gfx/angle/src/compiler/translator_common.vcxproj
|
||||
+++ b/gfx/angle/src/compiler/translator_common.vcxproj
|
||||
@@ -133,16 +133,17 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4267;4512;4702;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
+ <ClCompile Include="ArrayBoundsClamper.cpp" />
|
||||
<ClCompile Include="BuiltInFunctionEmulator.cpp" />
|
||||
<ClCompile Include="Compiler.cpp" />
|
||||
<ClCompile Include="debug.cpp" />
|
||||
<ClCompile Include="DetectRecursion.cpp" />
|
||||
<ClCompile Include="Diagnostics.cpp" />
|
||||
<ClCompile Include="DirectiveHandler.cpp" />
|
||||
<ClCompile Include="ForLoopUnroll.cpp" />
|
||||
<ClCompile Include="InfoSink.cpp" />
|
||||
@@ -220,16 +221,17 @@
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
+ <ClInclude Include="ArrayBoundsClamper.h" />
|
||||
<ClInclude Include="BaseTypes.h" />
|
||||
<ClInclude Include="BuiltInFunctionEmulator.h" />
|
||||
<ClInclude Include="Common.h" />
|
||||
<ClInclude Include="ConstantUnion.h" />
|
||||
<ClInclude Include="debug.h" />
|
||||
<ClInclude Include="DetectRecursion.h" />
|
||||
<ClInclude Include="Diagnostics.h" />
|
||||
<ClInclude Include="DirectiveHandler.h" />
|
||||
@@ -274,9 +276,9 @@
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
-</Project>
|
||||
\ No newline at end of file
|
||||
+</Project>
|
||||
diff --git a/gfx/angle/src/libGLESv2/Makefile.in b/gfx/angle/src/libGLESv2/Makefile.in
|
||||
--- a/gfx/angle/src/libGLESv2/Makefile.in
|
||||
+++ b/gfx/angle/src/libGLESv2/Makefile.in
|
||||
@@ -64,16 +64,17 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../include/KHR \
|
||||
-I$(srcdir)/..
|
||||
|
||||
DEFINES += -DCOMPILER_IMPLEMENTATION
|
||||
|
||||
VPATH += $(srcdir)/../compiler
|
||||
# src/compiler:
|
||||
CPPSRCS += \
|
||||
+ ArrayBoundsClamper.cpp \
|
||||
BuiltInFunctionEmulator.cpp \
|
||||
Compiler.cpp \
|
||||
compiler_debug.cpp \
|
||||
DetectRecursion.cpp \
|
||||
Diagnostics.cpp \
|
||||
DirectiveHandler.cpp \
|
||||
ForLoopUnroll.cpp \
|
||||
glslang_lex.cpp \
|
@ -69,7 +69,7 @@
|
||||
],
|
||||
'RuntimeTypeInfo': 'false',
|
||||
'WarningLevel': '4',
|
||||
'DisableSpecificWarnings': '4100;4127;4189;4239;4244;4245;4512;4702',
|
||||
'DisableSpecificWarnings': [4100, 4127, 4189, 4239, 4244, 4245, 4512, 4702],
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'FixedBaseAddress': '1',
|
||||
@ -79,11 +79,23 @@
|
||||
# Most of the executables we'll ever create are tests
|
||||
# and utilities with console output.
|
||||
'SubSystem': '1', # /SUBSYSTEM:CONSOLE
|
||||
'AdditionalLibraryDirectories': [
|
||||
'$(ProgramFiles)/Windows Kits/8.0/Lib/win8/um/x86',
|
||||
],
|
||||
},
|
||||
'VCLibrarianTool': {
|
||||
'AdditionalLibraryDirectories': [
|
||||
'$(ProgramFiles)/Windows Kits/8.0/Lib/win8/um/x86',
|
||||
],
|
||||
},
|
||||
'VCResourceCompilerTool': {
|
||||
'Culture': '1033',
|
||||
},
|
||||
},
|
||||
'msvs_system_include_dirs': [
|
||||
'$(ProgramFiles)/Windows Kits/8.0/Include/shared',
|
||||
'$(ProgramFiles)/Windows Kits/8.0/Include/um',
|
||||
],
|
||||
}, # Common
|
||||
'Debug': {
|
||||
'inherit_from': ['Common'],
|
||||
|
@ -9,6 +9,8 @@ Name Strings
|
||||
Contributors
|
||||
|
||||
Nicolas Capens, TransGaming
|
||||
Daniel Koch, TransGaming
|
||||
Shannon Woods, TransGaming
|
||||
Kenneth Russell, Google
|
||||
Vangelis Kokkevis, Google
|
||||
Gregg Tavares, Google
|
||||
@ -17,7 +19,7 @@ Contributors
|
||||
|
||||
Contact
|
||||
|
||||
Daniel Koch, TransGaming (daniel 'at' transgaming.com)
|
||||
Shannon Woods, TransGaming (shannon 'dot' woods 'at' transgaming.com)
|
||||
|
||||
Status
|
||||
|
||||
@ -25,8 +27,8 @@ Status
|
||||
|
||||
Version
|
||||
|
||||
Last Modifed Date: June 4, 2012
|
||||
Revision: #3
|
||||
Last Modified Date: February 25, 2013
|
||||
Revision: #4
|
||||
|
||||
Number
|
||||
|
||||
@ -89,7 +91,7 @@ Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
|
||||
|
||||
If a vertex shader uses..."
|
||||
|
||||
Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterizatoin)
|
||||
Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterization)
|
||||
|
||||
Add the following rows to Table 3.2 (page 62):
|
||||
|
||||
@ -219,8 +221,7 @@ Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterizatoin)
|
||||
below. Otherwise, the texture unit operates in the normal manner.
|
||||
|
||||
Let <D_t> be the depth texture value, provided by the shader's texture lookup
|
||||
function. Then the effective texture value, <L_t> or <A_t> is computed
|
||||
as follows:
|
||||
function. Then the effective texture value is computed as follows:
|
||||
<Tau> = <D_t>
|
||||
|
||||
If the texture image has a base internal format of DEPTH_STENCIL_OES, then
|
||||
@ -228,10 +229,10 @@ Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterizatoin)
|
||||
not include a stencil index component, but includes only the depth
|
||||
component.
|
||||
|
||||
The resulting <Tau> is assigned to <L_t>. In some implementations,
|
||||
<Tau> is also assigned to <A_t>. Thus in table 3.12, textures with
|
||||
depth component data behave as if their base internal format is
|
||||
either LUMINANCE or LUMINANCE_ALPHA."
|
||||
The resulting <Tau> is assigned to <R_t>. In some implementations, <Tau> is
|
||||
also assigned to <G_t>, <B_t>, or <A_t>. Thus in table 3.12, textures with
|
||||
depth component data behave as if their base internal format is RGBA, with
|
||||
values in <G_t>, <B_t>, and <A_t> being implementation dependent."
|
||||
|
||||
Add the following to section 3.7.11 "Mipmap Generation":
|
||||
|
||||
@ -363,8 +364,8 @@ Issues
|
||||
RESOLVED: This extension:
|
||||
- does not support loading pre-baked depth stencil data via
|
||||
TexImage2D or TexSubImage2D.
|
||||
- allows variability in w-component of the sample results from
|
||||
depth textures.
|
||||
- allows variability in the y-, z-, and w-components of the sample
|
||||
results from depth textures.
|
||||
- only supports one level textures.
|
||||
- explicitly lists the errors for unsupported functionality.
|
||||
Since these were not clearly specified in the OES_depth_texture
|
||||
@ -392,6 +393,8 @@ Issues
|
||||
|
||||
Revision History
|
||||
|
||||
02/25/2013 swoods revise to allow texture lookup to guarantee depth values
|
||||
only in red channel of sample result.
|
||||
06/04/2012 dgkoch fix errors, disallow multi-level depth textures.
|
||||
05/30/2012 dgkoch minor updates and add issues.
|
||||
05/23/2012 dgkoch intial revision based on OES_depth_texture and
|
||||
|
@ -24,8 +24,8 @@ Status
|
||||
|
||||
Version
|
||||
|
||||
Last Modified Date: Aug 6, 2010
|
||||
Author Revision: 3
|
||||
Last Modified Date: Sept 22, 2012
|
||||
Author Revision: 4
|
||||
|
||||
Number
|
||||
|
||||
@ -109,7 +109,11 @@ Operations and the Framebuffer)
|
||||
|
||||
"Calling ReadPixels generates INVALID_FRAMEBUFFER_OPERATION if
|
||||
the object bound to READ_FRAMEBUFFER_BINDING_ANGLE is not "framebuffer
|
||||
complete" (section 4.4.4.2)."
|
||||
complete" (section 4.4.4.2). GetIntegerv generates an INVALID_OPERATION
|
||||
error if the object bound to READ_FRAMEBUFFER_BINDING_ANGLE is not
|
||||
framebuffer complete, or if the GL is using a framebuffer object
|
||||
(i.e. READ_FRAMEBUFFER_BINDING_ANGLE is non-zero) and there is no color
|
||||
attachment."
|
||||
|
||||
Insert a new section 4.3.2 titled "Copying Pixels" and renumber the
|
||||
subsequent sections. Add the following text:
|
||||
@ -314,6 +318,10 @@ Errors
|
||||
BlitFramebufferANGLE, ReadPixels, CopyTex{Sub}Image*, is called while the
|
||||
read framebuffer is not framebuffer complete.
|
||||
|
||||
The error INVALID_OPERATION is generated if GetIntegerv is called
|
||||
while the read framebuffer is not framebuffer complete, or if there
|
||||
is no color attachment present on the read framebuffer object.
|
||||
|
||||
The error INVALID_VALUE is generated by BlitFramebufferANGLE if
|
||||
<mask> has any bits set other than those named by
|
||||
COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT.
|
||||
@ -424,4 +432,6 @@ Revision History
|
||||
- improve some error language
|
||||
Revision 3, 2010/08/06
|
||||
- add additional contributors, update implementation status
|
||||
Revision 4, 2012/09/22
|
||||
- document errors for GetIntegerv.
|
||||
|
||||
|
@ -29,7 +29,7 @@ Version
|
||||
|
||||
Number
|
||||
|
||||
OpenGL ES Extension #??
|
||||
OpenGL ES Extension #109
|
||||
|
||||
Dependencies
|
||||
|
||||
|
@ -1,383 +0,0 @@
|
||||
Name
|
||||
|
||||
ANGLE_multiple_render_targets
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_ANGLE_multiple_render_targets
|
||||
|
||||
Contributors
|
||||
|
||||
Contributors to GL_NV_draw_buffers
|
||||
Contributors to GL_NV_fbo_color_attachments
|
||||
Contributors to the OpenGL ES 2.0 specification
|
||||
Contributors to the OpenGLSL ES 1.0.17 specification
|
||||
Contributors to the OpenGL ES 3.0 specification
|
||||
Nicolas Capens, TransGaming Inc.
|
||||
Daniel Koch, TransGaming Inc.
|
||||
Alastair Patrick, Google Inc.
|
||||
Members of the WebGL working group
|
||||
|
||||
Contact
|
||||
|
||||
Daniel Koch <daniel> <at> <transgaming> <dot> <com>
|
||||
|
||||
Status
|
||||
|
||||
Incomplete -- do not implement!
|
||||
|
||||
Version
|
||||
|
||||
Last Modified Data: November 13, 2012
|
||||
Revision: #5
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
|
||||
Dependencies
|
||||
|
||||
OpenGL ES 2.0 is required.
|
||||
|
||||
The extension is written against the OpenGL ES 2.0 specification.
|
||||
|
||||
ANGLE_framebuffer_blit affects the definition of this extension.
|
||||
APPLE_framebuffer_multisample affects the definitin of this extension.
|
||||
|
||||
Overview
|
||||
|
||||
This extension increases the number of available framebuffer object
|
||||
color attachment points, extends OpenGL ES 2.0 to allow multiple output
|
||||
colors, and provides a mechanism for directing those outputs to
|
||||
multiple color buffers.
|
||||
|
||||
This extension is similar to the combination of the GL_NV_draw_buffers
|
||||
and GL_NV_fbo_color_attachments extensions, but imposes certain
|
||||
restrictions informed by the OpenGL ES 3.0 API.
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
void DrawBuffersANGLE(sizei n, const enum *bufs);
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted by the <pname> parameter of GetIntegerv:
|
||||
|
||||
MAX_COLOR_ATTACHMENTS_ANGLE 0x8CDF
|
||||
|
||||
Accepted by the <pname> parameters of GetIntegerv and GetFloatv:
|
||||
|
||||
MAX_DRAW_BUFFERS_ANGLE 0x8824
|
||||
DRAW_BUFFER0_ANGLE 0x8825
|
||||
DRAW_BUFFER1_ANGLE 0x8826
|
||||
DRAW_BUFFER2_ANGLE 0x8827
|
||||
DRAW_BUFFER3_ANGLE 0x8828
|
||||
DRAW_BUFFER4_ANGLE 0x8829
|
||||
DRAW_BUFFER5_ANGLE 0x882A
|
||||
DRAW_BUFFER6_ANGLE 0x882B
|
||||
DRAW_BUFFER7_ANGLE 0x882C
|
||||
DRAW_BUFFER8_ANGLE 0x882D
|
||||
DRAW_BUFFER9_ANGLE 0x882E
|
||||
DRAW_BUFFER10_ANGLE 0x882F
|
||||
DRAW_BUFFER11_ANGLE 0x8830
|
||||
DRAW_BUFFER12_ANGLE 0x8831
|
||||
DRAW_BUFFER13_ANGLE 0x8832
|
||||
DRAW_BUFFER14_ANGLE 0x8833
|
||||
DRAW_BUFFER15_ANGLE 0x8834
|
||||
|
||||
Accepted by the <attachment> parameter of FramebufferRenderbuffer,
|
||||
FramebufferTexture2D and GetFramebufferAttachmentParameteriv, and by
|
||||
the <bufs> parameter of DrawBuffersANGLE:
|
||||
|
||||
COLOR_ATTACHMENT0_ANGLE 0x8CE0
|
||||
COLOR_ATTACHMENT1_ANGLE 0x8CE1
|
||||
COLOR_ATTACHMENT2_ANGLE 0x8CE2
|
||||
COLOR_ATTACHMENT3_ANGLE 0x8CE3
|
||||
COLOR_ATTACHMENT4_ANGLE 0x8CE4
|
||||
COLOR_ATTACHMENT5_ANGLE 0x8CE5
|
||||
COLOR_ATTACHMENT6_ANGLE 0x8CE6
|
||||
COLOR_ATTACHMENT7_ANGLE 0x8CE7
|
||||
COLOR_ATTACHMENT8_ANGLE 0x8CE8
|
||||
COLOR_ATTACHMENT9_ANGLE 0x8CE9
|
||||
COLOR_ATTACHMENT10_ANGLE 0x8CEA
|
||||
COLOR_ATTACHMENT11_ANGLE 0x8CEB
|
||||
COLOR_ATTACHMENT12_ANGLE 0x8CEC
|
||||
COLOR_ATTACHMENT13_ANGLE 0x8CED
|
||||
COLOR_ATTACHMENT14_ANGLE 0x8CEE
|
||||
COLOR_ATTACHMENT15_ANGLE 0x8CEF
|
||||
|
||||
The COLOR_ATTACHMENT0_ANGLE constant is equal to the
|
||||
COLOR_ATTACHMENT0 constant.
|
||||
|
||||
Each COLOR_ATTACHMENT<i>_ANGLE adheres to COLOR_ATTACHMENT<i>_ANGLE
|
||||
= COLOR_ATTACHMENT0_ANGLE + <i>.
|
||||
|
||||
Changes to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
|
||||
|
||||
Section 3.2, (Multisampling). Replace the second paragraph:
|
||||
|
||||
An additional buffer, called the multisample buffer, is added to the
|
||||
window system-provided framebuffer. Pixel sample values, including
|
||||
color, depth, and stencil values, are stored in this buffer. Samples
|
||||
contain separate color values for each fragment color. When the
|
||||
window system-provided framebuffer includes a multisample buffer, it
|
||||
does not include depth or stencil buffers, even if the multisample
|
||||
buffer does not store depth or stencil values. Color buffers do
|
||||
coexist with the multisample buffer, however.
|
||||
|
||||
Section 3.8.2, (Shader Execution) Replace subsection "Shader
|
||||
Outputs":
|
||||
|
||||
The OpenGL ES Shading Language specification describes the values
|
||||
that may be output by a fragment shader. These are gl_FragColor and
|
||||
gl_FragData[n]. The final fragment color values or the final
|
||||
fragment data values written by a fragment shader are clamped to the
|
||||
range [0, 1] and then converted to fixed-point as described in
|
||||
section 2.1.2 for framebuffer color components.
|
||||
|
||||
Writing to gl_FragColor specifies the fragment color (color number
|
||||
zero) that will be used by subsequent stages of the pipeline.
|
||||
Writing to gl_FragData[n] specifies the value of fragment color
|
||||
number n. Any colors, or color components, associated with a
|
||||
fragment that are not written by the fragment shader are undefined.
|
||||
A fragment shader may not statically assign values to both
|
||||
gl_FragColor and gl_FragData. In this case, a compile or link error
|
||||
will result. A shader statically assigns a value to a variable if,
|
||||
after preprocessing, it contains a statement that would write to the
|
||||
variable, whether or not run-time flow of control will cause that
|
||||
statement to be executed.
|
||||
|
||||
Changes to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
|
||||
Operations and the Frame Buffer)
|
||||
|
||||
Insert Table 4.3 (and renumber subsequent tables): Arguments to
|
||||
DrawBuffersANGLE when the context is bound to a framebuffer
|
||||
object, and the buffers they indicate. <i> in
|
||||
COLOR_ATTACHMENT<i>_ANGLE may range from zero to the value of
|
||||
MAX_COLOR_ATTACHMENTS_ANGLE minus one.
|
||||
|
||||
Symbolic Constant Meaning
|
||||
----------------- ---------------------
|
||||
NONE No buffer
|
||||
|
||||
COLOR_ATTACHMENT<i>_ANGLE (see caption) Output fragment color to image
|
||||
attached at color attachment
|
||||
point i
|
||||
|
||||
|
||||
Replace Section 4.2.1, "Selecting a Buffer for Writing" with the following:
|
||||
|
||||
"By default, color values are written into the front buffer for
|
||||
single buffered surfaces or into the back buffer for back buffered
|
||||
surfaces as determined when making the context current. To control
|
||||
the color buffer into which each of the fragment color values is
|
||||
written, DrawBuffersANGLE is used.
|
||||
|
||||
The command
|
||||
|
||||
void DrawBuffersANGLE(sizei n, const enum *bufs);
|
||||
|
||||
defines the draw buffers to which all fragment colors are written.
|
||||
<n> specifies the number of buffers in <bufs>. <bufs> is a pointer
|
||||
to an array of symbolic constants specifying the buffer to which
|
||||
each fragment color is written.
|
||||
|
||||
Each buffer listed in <bufs> must be BACK, NONE, or one of the
|
||||
values from table 4.3. Further, acceptable values for the constants
|
||||
in <bufs> depend on whether the GL is using the default framebuffer
|
||||
(i.e., DRAW_FRAMEBUFFER_BINDING is zero), or a framebuffer object
|
||||
(i.e., DRAW_FRAMEBUFFER_BINDING is non-zero). For more information
|
||||
about framebuffer objects, see section 4.4.
|
||||
|
||||
If the GL is bound to the default framebuffer, then <n> must be 1
|
||||
and the constant must be BACK or NONE. When draw buffer zero is
|
||||
BACK, color values are written into the sole buffer for single-
|
||||
buffered contexts, or into the back buffer for double-buffered
|
||||
contexts. If DrawBuffersANGLE is supplied with a constant other than
|
||||
BACK and NONE, the error INVALID_OPERATION is generated.
|
||||
|
||||
If the GL is bound to a draw framebuffer object, then each of the
|
||||
constants must be one of the values listed in table 4.3.
|
||||
|
||||
In both cases, the draw buffers being defined correspond in order to
|
||||
the respective fragment colors. The draw buffer for fragment
|
||||
colors beyond <n> is set to NONE.
|
||||
|
||||
The maximum number of draw buffers is implementation-dependent. The
|
||||
number of draw buffers supported can be queried by calling
|
||||
GetIntegerv with the symbolic constant MAX_DRAW_BUFFERS_ANGLE. An
|
||||
INVALID_VALUE error is generated if <n> is greater than
|
||||
MAX_DRAW_BUFFERS_ANGLE.
|
||||
|
||||
If the GL is bound to a draw framebuffer object, the <i>th buffer listed
|
||||
in <bufs> must be COLOR_ATTACHMENT<i>_ANGLE or NONE. Specifying a
|
||||
buffer out of order, BACK, or COLOR_ATTACHMENT<m>_ANGLE where <m> is
|
||||
greater than or equal to the value of MAX_COLOR_ATTACHMENTS_ANGLE,
|
||||
will generate the error INVALID_OPERATION.
|
||||
|
||||
If a fragment shader writes to "gl_FragColor", DrawBuffersANGLE
|
||||
specifies a set of draw buffers into which the color written to
|
||||
"gl_FragColor" is written. If a fragment shader writes to
|
||||
"gl_FragData", DrawBuffersANGLE specifies a set of draw buffers
|
||||
into which each of the multiple output colors defined by these
|
||||
variables are separately written. If a fragment shader writes to
|
||||
neither "gl_FragColor" nor "gl_FragData" the values of the
|
||||
fragment colors following shader execution are undefined, and may
|
||||
differ for each fragment color.
|
||||
|
||||
Indicating a buffer or buffers using DrawBuffersANGLE causes
|
||||
subsequent pixel color value writes to affect the indicated
|
||||
buffers. If the GL is bound to a draw framebuffer object and a draw
|
||||
buffer selects an attachment that has no image attached, then that
|
||||
fragment color is not written.
|
||||
|
||||
Specifying NONE as the draw buffer for a fragment color will inhibit
|
||||
that fragment color from being written.
|
||||
|
||||
The state required to handle color buffer selection for each
|
||||
framebuffer is an integer for each supported fragment color. For the
|
||||
default framebuffer, in the initial state the draw buffer for
|
||||
fragment color zero is BACK if there is a default framebuffer
|
||||
associated with the context, otherwise NONE. For framebuffer
|
||||
objects, in the initial state the draw buffer for fragment color
|
||||
zero is COLOR_ATTACHMENT0_ANGLE.
|
||||
|
||||
For both the default framebuffer and framebuffer objects, the
|
||||
initial state of draw buffers for fragment colors other than zero is
|
||||
NONE.
|
||||
|
||||
The value of the draw buffer selected for fragment color <i> can be
|
||||
queried by calling GetIntegerv with the symbolic constant
|
||||
DRAW_BUFFER<i>_ANGLE."
|
||||
|
||||
Replace the second paragraph of Section 4.4.1 (Binding and Managing
|
||||
Framebuffer Objects) with the following:
|
||||
|
||||
"The namespace for framebuffer objects is the unsigned integers, with
|
||||
zero reserved by OpenGL ES to refer to the default framebuffer. A
|
||||
framebuffer object is created by binding an unused name to the
|
||||
target FRAMEBUFFER, DRAW_FRAMEBUFFER, or READ_FRAMEBUFFER. The binding
|
||||
is effected by calling
|
||||
|
||||
void BindFramebuffer(enum target, uint framebuffer);
|
||||
|
||||
with <target> set the desired framebuffer target and <framebuffer> set
|
||||
to the unused name. The resulting framebuffer object is a new state
|
||||
vector. There is a number of color attachment points, plus one each
|
||||
for the depth and stencil attachment points. The number of color attachment
|
||||
points is equal to the value of MAX_COLOR_ATTACHMENTS_ANGLE."
|
||||
|
||||
Changes to Chapter 3 of the OpenGL ES Shading Language 1.0.17 Specification (Basics)
|
||||
|
||||
Add a new section:
|
||||
|
||||
3.4.1 GL_ANGLE_multiple_render_targets Extension
|
||||
|
||||
To use the GL_ANGLE_multiple_render_targets extension in a shader it
|
||||
must be enabled using the #extension directive.
|
||||
|
||||
The shading language preprocessor #define
|
||||
GL_ANGLE_multiple_render_targets will be defined to 1, if the
|
||||
GL_ANGLE_multiple_render_targets extension is supported.
|
||||
|
||||
Dependencies on ANGLE_framebuffer_blit and APPLE_framebuffer_multisample:
|
||||
|
||||
If neither ANGLE_framebuffer_blit nor APPLE_framebuffer_multisample are
|
||||
supported, then all references to "draw framebuffers" should be replaced
|
||||
with references to "framebuffers". References to DRAW_FRAMEBUFFER_BINDING
|
||||
should be replaced with references to FRAMEBUFFER_BINDING. References to
|
||||
DRAW_FRAMEBUFFER and READ_FRAMEBUFFER should be removed.
|
||||
|
||||
If ANGLE_framebuffer_blit is supported, DRAW_FRAMEBUFFER_BINDING, DRAW_FRAMEBUFFER
|
||||
and READ_FRAMEBUFFER all refer to corresponding _ANGLE suffixed names
|
||||
(they have the same token values).
|
||||
|
||||
If APPLE_framebuffer_multisample is supported, DRAW_FRAMEBUFFER_BINDING,
|
||||
DRAW_FRAMEBUFFER and READ_FRAMEBUFFER all refer to the corresponding _APPLE
|
||||
suffixed names (they have the same token values).
|
||||
|
||||
Errors
|
||||
|
||||
<TBD>
|
||||
|
||||
New State
|
||||
|
||||
Add Table 6.X Framebuffer (State per framebuffer object):
|
||||
|
||||
State Type Get Command Initial Value Description
|
||||
--------------- ---- ------------ ------------- -----------
|
||||
DRAW_BUFFER<i>_ANGLE Z10* GetIntegerv see 4.2.1 Draw buffer selected
|
||||
for fragment color i
|
||||
|
||||
Add to Table 6.18 (Implementation Dependent Values)
|
||||
|
||||
Get value Type Get Cmnd Minimum Value Description Sec.
|
||||
------------------------ ---- ----------- ------------- ----------- -----
|
||||
MAX_DRAW_BUFFERS_ANGLE Z+ GetIntegerv 1 Maximum number of 4.2.1
|
||||
active draw buffers
|
||||
MAX_COLOR_ATTACHMENTS_ANGLE Z+ GetIntegerv 1 Number of framebuffer 4.4.1
|
||||
color attachment points
|
||||
Issues
|
||||
|
||||
See ARB_draw_buffers for relevant issues.
|
||||
|
||||
1) Differences from NV_draw_buffers + NV_fbo_color_attachments?
|
||||
|
||||
- interactions with blit_framebuffer
|
||||
- MAX limits are global instead of per-fbo (TBD - Issue 2)
|
||||
- no broadcast from gl_FragColor (TBD - Issue 3)
|
||||
- can be used to with default framebuffer to set NONE/BACK (TBD - Issue 4)
|
||||
|
||||
2) Should the MAX_DRAW_BUFFERS_ANGLE and MAX_COLOR_ATTACHMENTS_ANGLE limits
|
||||
be per-framebuffer values or implementation dependent constants?
|
||||
|
||||
DISCUSSION: In ARB_draw_buffers this was per-context (see Issue 2).
|
||||
EXT_framebuffer_object (and subsequently ARB_framebuffer_object, and GL 3.0
|
||||
through GL 4.2) made these queries framebuffer-dependent.
|
||||
However GL in 4.3 and GLES 3.0, these limits were moved from
|
||||
framebuffer-dependent state to implementation-dependent state after
|
||||
much discussion (Bug 7990).
|
||||
|
||||
NV_draw_buffers has MAX_DRAW_BUFFERS listed as per-framebuffer state,
|
||||
but NV_fbo_color_attachments has MAX_COLOR_ATTACHMENTS as an
|
||||
implementation-dependent constant.
|
||||
|
||||
This is relevant because some implementations are not able to support
|
||||
multisampling in conjuction with multiple color attachments. If the
|
||||
query is per-framebuffer, they can report a maximum of one attachment
|
||||
when there are multisampled attachments, but a higher limit when only
|
||||
single-sampled attachments are present.
|
||||
|
||||
3) Should we support broadcast from gl_FragColor to all gl_FragData[x]
|
||||
or should it be synonymous with gl_FragData[0]?
|
||||
|
||||
DISCUSSION: With NV_draw_buffers, writing to gl_FragColor writes to all
|
||||
the enabled draw buffers (ie broadcast). In OpenGL ES 3.0 when using
|
||||
ESSL 1.0, gl_FragColor is equivalent to writing a single output to
|
||||
gl_FragData[0] and multiple outputs are not possible. When using ESSL 3.0,
|
||||
only user-defined out variables may be used.
|
||||
|
||||
If broadcast is supported, some implementations may have to replace
|
||||
writes to gl_FragColor with replicated writes to all possible gl_FragData
|
||||
locations when this extension is enabled.
|
||||
|
||||
4) Should we allow DrawBuffersANGLE to be called when the default FBO is bound?
|
||||
|
||||
DISCUSSION: NV_draw_buffers specifies that DrawBuffersNV errors with
|
||||
INVALID_OPERATION when the default FBO is bound. OpenGL ES 3.0 allows
|
||||
DrawBuffers to toggle between BACK and NONE on the default FBO.
|
||||
|
||||
An implementation that does not natively support disabling the drawbuffer
|
||||
on the default FBO could emulate this by disabling color writes.
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
11/13/2012 dgkoch add revision history
|
||||
add text from updated ES 3.0 spec
|
||||
add issues for discussion
|
||||
10/16/2012 kbr update name string
|
||||
10/16/2012 kbr remove restrition requiring draw buffer 0 to be non-NULL
|
||||
10/12/2012 kbr remove references to GetDoublev and ReadBuffer
|
||||
10/11/2012 kbr initial draft extension
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
Name
|
||||
|
||||
ANGLE_pack_reverse_row_order
|
||||
@ -27,7 +26,7 @@ Version
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
OpenGL ES Extension #110
|
||||
|
||||
Dependencies
|
||||
|
||||
|
@ -4,6 +4,7 @@ Name
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_ANGLE_texture_compression_dxt1
|
||||
GL_ANGLE_texture_compression_dxt3
|
||||
GL_ANGLE_texture_compression_dxt5
|
||||
|
||||
@ -23,27 +24,36 @@ Status
|
||||
|
||||
Version
|
||||
|
||||
Last Modified Date: Aug 2, 2011
|
||||
Last Modified Date: Sept 22, 2012
|
||||
Author Revision: 2
|
||||
|
||||
Number
|
||||
|
||||
OpenGL ES Extension #..
|
||||
OpenGL ES Extension #111
|
||||
|
||||
Dependencies
|
||||
|
||||
Requires OpenGL ES 2.0.
|
||||
Requires OpenGL ES 1.0.
|
||||
|
||||
The extension is written against the OpenGL ES 2.0 specification.
|
||||
|
||||
Overview
|
||||
|
||||
These extensions are exactly the same as EXT_texture_compression_dxt1
|
||||
except they expose the formats COMPRESSED_RGBA_S3TC_DXT3_ANGLE and
|
||||
COMPRESSED_RGBA_S3TC_DXT5_ANGLE respectively.
|
||||
except they additionally expose the COMPRESSED_RGBA_S3TC_DXT3_ANGLE and
|
||||
COMPRESSED_RGBA_S3TC_DXT5_ANGLE formats and have a size restrictions
|
||||
such that the size must be a multiple of four (except for mip levels
|
||||
where the dimensions are either 2 or 1).
|
||||
|
||||
See EXT_texture_compression_dxt1 for the full list of changes. Also
|
||||
see EXT_texture_compression_s3tc for a description of the formats.
|
||||
|
||||
IP Status
|
||||
|
||||
A license to the S3TC Intellectual Property may be necessary for
|
||||
implementation of this extension. You should consult with your
|
||||
Attorney to determine the need for a license.
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None.
|
||||
@ -57,17 +67,97 @@ New Tokens
|
||||
Accepted by the <internalformat> parameter of CompressedTexImage2D
|
||||
and the <format> parameter of CompressedTexSubImage2D:
|
||||
|
||||
COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0
|
||||
COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1
|
||||
COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
|
||||
COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
|
||||
|
||||
Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
|
||||
|
||||
Add the following to Section 3.7.3 (Compressed Texture Images)
|
||||
(at the end of the description of the CompressedTexImage2D command):
|
||||
|
||||
Compressed Internal Format Base Internal Format
|
||||
========================== ====================
|
||||
COMPRESSED_RGB_S3TC_DXT1_ANGLE RGB
|
||||
COMPRESSED_RGBA_S3TC_DXT1_ANGLE RGBA
|
||||
COMPRESSED_RGBA_S3TC_DXT3_ANGLE RGBA
|
||||
COMPRESSED_RGBA_S3TC_DXT5_ANGLE RGBA
|
||||
|
||||
Table 3.x: Specific Compressed Internal Formats
|
||||
|
||||
If <internalformat> is one of the S3TC formats listed in Table 3.x,
|
||||
the compressed texture is stored in the appropriate S3TC compressed
|
||||
texture format (see Appendix). The GL and the S3TC texture compression
|
||||
algorithm support only 2D images without borders.
|
||||
|
||||
CompressedTexImage2D will produce the INVALID_OPERATION error when
|
||||
<internalformat> is one of the values from Table 3.x under the following
|
||||
conditions:
|
||||
|
||||
* <border> is non-zero.
|
||||
* <width> is not one, two, or a multiple of four.
|
||||
* <height> is not one, two, or a multiple of four.
|
||||
|
||||
Add the following to Section 3.7.3 (Compressed Texture Images)
|
||||
(at the end of the description of the CompressedTexSubImage2D command):
|
||||
|
||||
If the internal format of the texture image being modified is listed
|
||||
in Table 3.x, the texture is stored in the appropriate S3TC compressed
|
||||
texture format (see Appendix). Since DXT/S3TC images are easily edited
|
||||
along 4x4 texel boundaries, the limitations of CompressedTexSubImage2D
|
||||
are relaxed. CompressedTexSubImage2D will result in an INVALID_OPERATION
|
||||
error only if one of the following conditions occurs:
|
||||
|
||||
* <width> is not a multiple of four or equal to TEXTURE_WIDTH.
|
||||
* <height> is not a multipls of four or equal to TEXTURE_HEIGHT.
|
||||
* <xoffset> or <yoffset> is not a multiple of four.
|
||||
* <format> does not match the internal format of the texture image
|
||||
being modified.
|
||||
|
||||
The following restrictions at the end of section 3.7.3 do not apply
|
||||
to S3TC DXT texture formats, since subimage modification is straightforward
|
||||
as long as the subimage is properly aligned.
|
||||
|
||||
Errors
|
||||
|
||||
None.
|
||||
INVALID_OPERATION is generated by CompressedTexImage2D if <internalformat>
|
||||
is one of the compressed internal formats from Table 3.x and any of the
|
||||
following apply:
|
||||
- <border> is not equal to zero.
|
||||
- <width> is not one, two, or a multiple of four.
|
||||
- <height> is not one, two, or a multiple of four.
|
||||
|
||||
INVALID_OPERATION is generated by TexImage2D and CopyTexImage2D if
|
||||
<internalformat> is one of the compressed internal formats from
|
||||
Table 3.x.
|
||||
|
||||
INVALID_OPERATION is generated by TexSubImage2D and CopyTexSubImage2D
|
||||
if the internal format of the texture currently bound to <target> is
|
||||
one of the compressed internal formats from Table 3.x.
|
||||
|
||||
INVALID_OPERATION is generated by CompressedTexSubImage2D if <format>
|
||||
is one of the compressed interal formats from Table 3.x and any of the
|
||||
following apply:
|
||||
- <width> is not a multiple of four or equal to TEXTURE_WIDTH;
|
||||
- <height> is not a multiple of four or equal to TEXTURE_HEIGHT;
|
||||
- <xoffset> or <yoffset> is not a multiple of four;
|
||||
- <format> does not match the internal format of the texture image
|
||||
being modified.
|
||||
|
||||
New State
|
||||
|
||||
None.
|
||||
|
||||
Appendix:
|
||||
|
||||
The format for the S3TC Compressed Texture Images Formats is documented
|
||||
in the appendix of EXT_texture_compression_s3tc.
|
||||
|
||||
Revision History
|
||||
|
||||
Revision 1, 2010/08/06 - gman
|
||||
- Initial revision
|
||||
Revision 2, 2012/09/22 - dgkoch
|
||||
- Added DXT1 formats and documented multiple of 4 restriction.
|
||||
|
||||
|
@ -26,7 +26,7 @@ Version
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
OpenGL ES Extension #112
|
||||
|
||||
Dependencies
|
||||
|
||||
|
@ -28,7 +28,7 @@ Version
|
||||
|
||||
Number
|
||||
|
||||
OpenGL ES Extension #??
|
||||
OpenGL ES Extension #113
|
||||
|
||||
Dependencies
|
||||
|
||||
|
542
gfx/angle/extensions/EXT_draw_buffers.txt
Normal file
542
gfx/angle/extensions/EXT_draw_buffers.txt
Normal file
@ -0,0 +1,542 @@
|
||||
Name
|
||||
|
||||
EXT_draw_buffers
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_EXT_draw_buffers
|
||||
|
||||
Contributors
|
||||
|
||||
Contributors to GL_NV_draw_buffers
|
||||
Contributors to GL_NV_fbo_color_attachments
|
||||
Contributors to the OpenGL ES 2.0 specification
|
||||
Contributors to the OpenGLSL ES 1.0.17 specification
|
||||
Contributors to the OpenGL ES 3.0 specification
|
||||
Nicolas Capens, TransGaming Inc.
|
||||
Daniel Koch, TransGaming Inc.
|
||||
Alastair Patrick, Google Inc.
|
||||
Kenneth Russell, Google Inc.
|
||||
Greg Roth, NVIDIA Corporation
|
||||
Ben Bowman, Imagination Technologies
|
||||
Members of the WebGL and OpenGL ES working groups
|
||||
|
||||
Contact
|
||||
|
||||
Daniel Koch (daniel 'at' transgaming.com)
|
||||
|
||||
Status
|
||||
|
||||
Draft Complete
|
||||
|
||||
Version
|
||||
|
||||
Last Modified Date: January 30, 2013
|
||||
Revision: #7
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
|
||||
Dependencies
|
||||
|
||||
OpenGL ES 2.0 is required.
|
||||
|
||||
The extension is written against the OpenGL ES 2.0 specification.
|
||||
|
||||
ANGLE_framebuffer_blit affects the definition of this extension.
|
||||
APPLE_framebuffer_multisample affects the definitin of this extension.
|
||||
|
||||
Overview
|
||||
|
||||
This extension increases the number of available framebuffer object
|
||||
color attachment points, extends OpenGL ES 2.0 to allow multiple output
|
||||
colors, and provides a mechanism for directing those outputs to
|
||||
multiple color buffers.
|
||||
|
||||
This extension is similar to the combination of the GL_NV_draw_buffers
|
||||
and GL_NV_fbo_color_attachments extensions, but imposes certain
|
||||
restrictions informed by the OpenGL ES 3.0 API.
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
void DrawBuffersEXT(sizei n, const enum *bufs);
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted by the <pname> parameter of GetIntegerv:
|
||||
|
||||
MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
|
||||
|
||||
Accepted by the <pname> parameters of GetIntegerv and GetFloatv:
|
||||
|
||||
MAX_DRAW_BUFFERS_EXT 0x8824
|
||||
DRAW_BUFFER0_EXT 0x8825
|
||||
DRAW_BUFFER1_EXT 0x8826
|
||||
DRAW_BUFFER2_EXT 0x8827
|
||||
DRAW_BUFFER3_EXT 0x8828
|
||||
DRAW_BUFFER4_EXT 0x8829
|
||||
DRAW_BUFFER5_EXT 0x882A
|
||||
DRAW_BUFFER6_EXT 0x882B
|
||||
DRAW_BUFFER7_EXT 0x882C
|
||||
DRAW_BUFFER8_EXT 0x882D
|
||||
DRAW_BUFFER9_EXT 0x882E
|
||||
DRAW_BUFFER10_EXT 0x882F
|
||||
DRAW_BUFFER11_EXT 0x8830
|
||||
DRAW_BUFFER12_EXT 0x8831
|
||||
DRAW_BUFFER13_EXT 0x8832
|
||||
DRAW_BUFFER14_EXT 0x8833
|
||||
DRAW_BUFFER15_EXT 0x8834
|
||||
|
||||
Accepted by the <attachment> parameter of FramebufferRenderbuffer,
|
||||
FramebufferTexture2D and GetFramebufferAttachmentParameteriv, and by
|
||||
the <bufs> parameter of DrawBuffersEXT:
|
||||
|
||||
COLOR_ATTACHMENT0_EXT 0x8CE0
|
||||
COLOR_ATTACHMENT1_EXT 0x8CE1
|
||||
COLOR_ATTACHMENT2_EXT 0x8CE2
|
||||
COLOR_ATTACHMENT3_EXT 0x8CE3
|
||||
COLOR_ATTACHMENT4_EXT 0x8CE4
|
||||
COLOR_ATTACHMENT5_EXT 0x8CE5
|
||||
COLOR_ATTACHMENT6_EXT 0x8CE6
|
||||
COLOR_ATTACHMENT7_EXT 0x8CE7
|
||||
COLOR_ATTACHMENT8_EXT 0x8CE8
|
||||
COLOR_ATTACHMENT9_EXT 0x8CE9
|
||||
COLOR_ATTACHMENT10_EXT 0x8CEA
|
||||
COLOR_ATTACHMENT11_EXT 0x8CEB
|
||||
COLOR_ATTACHMENT12_EXT 0x8CEC
|
||||
COLOR_ATTACHMENT13_EXT 0x8CED
|
||||
COLOR_ATTACHMENT14_EXT 0x8CEE
|
||||
COLOR_ATTACHMENT15_EXT 0x8CEF
|
||||
|
||||
The COLOR_ATTACHMENT0_EXT constant is equal to the
|
||||
COLOR_ATTACHMENT0 constant.
|
||||
|
||||
Each COLOR_ATTACHMENT<i>_EXT adheres to COLOR_ATTACHMENT<i>_EXT
|
||||
= COLOR_ATTACHMENT0_EXT + <i>.
|
||||
|
||||
Changes to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
|
||||
|
||||
Section 3.2, (Multisampling). Replace the second paragraph:
|
||||
|
||||
An additional buffer, called the multisample buffer, is added to the
|
||||
window system-provided framebuffer. Pixel sample values, including
|
||||
color, depth, and stencil values, are stored in this buffer. Samples
|
||||
contain separate color values for each fragment color. When the
|
||||
window system-provided framebuffer includes a multisample buffer, it
|
||||
does not include depth or stencil buffers, even if the multisample
|
||||
buffer does not store depth or stencil values. Color buffers do
|
||||
coexist with the multisample buffer, however.
|
||||
|
||||
Section 3.8.2, (Shader Execution) Replace subsection "Shader
|
||||
Outputs":
|
||||
|
||||
The OpenGL ES Shading Language specification describes the values
|
||||
that may be output by a fragment shader. These are gl_FragColor and
|
||||
gl_FragData[n]. The final fragment color values or the final
|
||||
fragment data values written by a fragment shader are clamped to the
|
||||
range [0, 1] and then converted to fixed-point as described in
|
||||
section 2.1.2 for framebuffer color components.
|
||||
|
||||
Writing to gl_FragColor specifies the fragment color (color number
|
||||
zero) that will be used by subsequent stages of the pipeline.
|
||||
Writing to gl_FragData[n] specifies the value of fragment color
|
||||
number n. Any colors, or color components, associated with a
|
||||
fragment that are not written by the fragment shader are undefined.
|
||||
A fragment shader may not statically assign values to both
|
||||
gl_FragColor and gl_FragData. In this case, a compile or link error
|
||||
will result. A shader statically assigns a value to a variable if,
|
||||
after preprocessing, it contains a statement that would write to the
|
||||
variable, whether or not run-time flow of control will cause that
|
||||
statement to be executed.
|
||||
|
||||
Changes to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
|
||||
Operations and the Frame Buffer)
|
||||
|
||||
Modify the overview of Chapter 4 and replace the sentences
|
||||
of the fifth paragraph which read:
|
||||
|
||||
"The name of the color buffer of an application-created framebuffer
|
||||
object is COLOR_ATTACHMENT0. The names of the depth and stencil buffers
|
||||
are DEPTH_ATTACHMENT and STENCIL_ATTACHMENT."
|
||||
|
||||
With the following:
|
||||
|
||||
"A framebuffer object has an array of color buffer attachment points,
|
||||
numbered zero through <n>, a depth buffer attachment point, and a
|
||||
stencil buffer attachment point."
|
||||
|
||||
Insert Table 4.3 to Section 4.2.1 (and renumber subsequent tables):
|
||||
|
||||
Symbolic Constant Meaning
|
||||
----------------- ---------------------
|
||||
NONE No buffer
|
||||
|
||||
COLOR_ATTACHMENT<i>_EXT (see caption) Output fragment color to image
|
||||
attached at color attachment
|
||||
point i
|
||||
|
||||
Table 4.3: Arguments to DrawBuffersEXT when the context is bound to a
|
||||
framebuffer object, and the buffers they indicate. <i> in
|
||||
COLOR_ATTACHMENT<i>_EXT may range from zero to the value of
|
||||
MAX_COLOR_ATTACHMENTS_EXT minus one.
|
||||
|
||||
Replace Section 4.2.1, "Selecting a Buffer for Writing" with the following:
|
||||
|
||||
"By default, color values are written into the front buffer for
|
||||
single buffered surfaces or into the back buffer for back buffered
|
||||
surfaces as determined when making the context current. To control
|
||||
the color buffer into which each of the fragment color values is
|
||||
written, DrawBuffersEXT is used.
|
||||
|
||||
The command
|
||||
|
||||
void DrawBuffersEXT(sizei n, const enum *bufs);
|
||||
|
||||
defines the draw buffers to which all fragment colors are written.
|
||||
<n> specifies the number of buffers in <bufs>. <bufs> is a pointer
|
||||
to an array of symbolic constants specifying the buffer to which
|
||||
each fragment color is written.
|
||||
|
||||
Each buffer listed in <bufs> must be BACK, NONE, or one of the
|
||||
values from table 4.3. Further, acceptable values for the constants
|
||||
in <bufs> depend on whether the GL is using the default framebuffer
|
||||
(i.e., DRAW_FRAMEBUFFER_BINDING is zero), or a framebuffer object
|
||||
(i.e., DRAW_FRAMEBUFFER_BINDING is non-zero). For more information
|
||||
about framebuffer objects, see section 4.4.
|
||||
|
||||
If the GL is bound to the default framebuffer, then <n> must be 1
|
||||
and the constant must be BACK or NONE. When draw buffer zero is
|
||||
BACK, color values are written into the sole buffer for single-
|
||||
buffered contexts, or into the back buffer for double-buffered
|
||||
contexts. If DrawBuffersEXT is supplied with a constant other than
|
||||
BACK and NONE, the error INVALID_OPERATION is generated.
|
||||
|
||||
If the GL is bound to a draw framebuffer object, then each of the
|
||||
constants must be one of the values listed in table 4.3.
|
||||
|
||||
In both cases, the draw buffers being defined correspond in order to
|
||||
the respective fragment colors. The draw buffer for fragment
|
||||
colors beyond <n> is set to NONE.
|
||||
|
||||
The maximum number of draw buffers is implementation-dependent. The
|
||||
number of draw buffers supported can be queried by calling
|
||||
GetIntegerv with the symbolic constant MAX_DRAW_BUFFERS_EXT. An
|
||||
INVALID_VALUE error is generated if <n> is greater than
|
||||
MAX_DRAW_BUFFERS_EXT.
|
||||
|
||||
If the GL is bound to a draw framebuffer object, the <i>th buffer listed
|
||||
in <bufs> must be COLOR_ATTACHMENT<i>_EXT or NONE. Specifying a
|
||||
buffer out of order, BACK, or COLOR_ATTACHMENT<m>_EXT where <m> is
|
||||
greater than or equal to the value of MAX_COLOR_ATTACHMENTS_EXT,
|
||||
will generate the error INVALID_OPERATION.
|
||||
|
||||
If a fragment shader writes to "gl_FragColor", DrawBuffersEXT
|
||||
specifies the set of draw buffers into which the color
|
||||
written to "gl_FragColor" is written. If a fragment shader writes to
|
||||
"gl_FragData", DrawBuffersEXT specifies a set of draw buffers
|
||||
into which each of the multiple output colors defined by these
|
||||
variables are separately written. If a fragment shader writes to
|
||||
neither "gl_FragColor" nor "gl_FragData" the values of the
|
||||
fragment colors following shader execution are undefined, and may
|
||||
differ for each fragment color.
|
||||
|
||||
Indicating a buffer or buffers using DrawBuffersEXT causes
|
||||
subsequent pixel color value writes to affect the indicated
|
||||
buffers. If the GL is bound to a draw framebuffer object and a draw
|
||||
buffer selects an attachment that has no image attached, then that
|
||||
fragment color is not written.
|
||||
|
||||
Specifying NONE as the draw buffer for a fragment color will inhibit
|
||||
that fragment color from being written.
|
||||
|
||||
The state required to handle color buffer selection for each
|
||||
framebuffer is an integer for each supported fragment color. For the
|
||||
default framebuffer, in the initial state the draw buffer for
|
||||
fragment color zero is BACK if there is a default framebuffer
|
||||
associated with the context, otherwise NONE. For framebuffer
|
||||
objects, in the initial state the draw buffer for fragment color
|
||||
zero is COLOR_ATTACHMENT0_EXT.
|
||||
|
||||
For both the default framebuffer and framebuffer objects, the
|
||||
initial state of draw buffers for fragment colors other than zero is
|
||||
NONE.
|
||||
|
||||
The value of the draw buffer selected for fragment color <i> can be
|
||||
queried by calling GetIntegerv with the symbolic constant
|
||||
DRAW_BUFFER<i>_EXT."
|
||||
|
||||
Modify Section 4.2.3 (Clearing the Buffers) and replace the first
|
||||
two paragraphs with the following:
|
||||
|
||||
"The GL provides a means for setting portions of every pixel in a
|
||||
particular buffer to the same value. The argument to
|
||||
|
||||
void Clear(bitfield buf);
|
||||
|
||||
is the bitwise OR of a number of values indicating which buffers are
|
||||
to be cleared. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, and
|
||||
STENCIL_BUFFER_BIT, indicating the buffers currently enabled for color
|
||||
writing, the depth buffer, and the stencil buffer (see below),
|
||||
respectively. The value to which each buffer is cleared depends on
|
||||
the setting of the clear value for that buffer. If the mask is not a
|
||||
bitwise OR of the specified values, then the error INVALID_VALUE is
|
||||
generated.
|
||||
|
||||
void ClearColor(clampf r, clampf, g, clampf b, clampf a);
|
||||
|
||||
sets the clear value for fixed-point color buffers. Each of the
|
||||
specified components is clamped to [0, 1] and converted to fixed-point
|
||||
as described in section 2.1.2 for framebuffer color components."
|
||||
|
||||
Replace the second paragraph of Section 4.4.1 (Binding and Managing
|
||||
Framebuffer Objects) with the following:
|
||||
|
||||
"The namespace for framebuffer objects is the unsigned integers, with
|
||||
zero reserved by OpenGL ES to refer to the default framebuffer. A
|
||||
framebuffer object is created by binding an unused name to the
|
||||
target FRAMEBUFFER, DRAW_FRAMEBUFFER, or READ_FRAMEBUFFER. The binding
|
||||
is effected by calling
|
||||
|
||||
void BindFramebuffer(enum target, uint framebuffer);
|
||||
|
||||
with <target> set the desired framebuffer target and <framebuffer> set
|
||||
to the unused name. The resulting framebuffer object is a new state
|
||||
vector. There is a number of color attachment points, plus one each
|
||||
for the depth and stencil attachment points. The number of color attachment
|
||||
points is equal to the value of MAX_COLOR_ATTACHMENTS_EXT."
|
||||
|
||||
Replace the third item in the bulleted list in Section 4.4.1 (Binding
|
||||
and Managing Framebuffer Objects) with the following:
|
||||
|
||||
" * The only color buffer bitplanes are the ones defined by the
|
||||
framebuffer attachments points named COLOR_ATTACHMENT0_EXT through
|
||||
COLOR_ATTACHMENT<n>_EXT."
|
||||
|
||||
Modify Section 4.4.3 (Renderbuffer Objects) in the
|
||||
"Attaching Renderbuffer Images to a Framebuffer" subsection as follows:
|
||||
|
||||
Insert the following table:
|
||||
|
||||
Name of attachment
|
||||
---------------------------------------
|
||||
COLOR_ATTACHMENT<i>_EXT (see caption)
|
||||
DEPTH_ATTACHMENT
|
||||
STENCIL_ATTACHMENT
|
||||
|
||||
Table 4.x: Framebuffer attachment points. <i> in COLOR_ATTACHMENT<i>_EXT
|
||||
may range from zero to the value of MAX_COLOR_ATTACHMENTS_EXT minus 1.
|
||||
|
||||
Modify the third sentence of the paragraph following the definition of
|
||||
FramebufferRenderbuffer to be as follows:
|
||||
|
||||
"<attachment> should be set to one of the attachment points of the
|
||||
framebuffer listed in Table 4.x."
|
||||
|
||||
Modify Section 4.4.3 (Renderbuffer Objects) in the "Attaching Texture
|
||||
Images to a Framebuffer" subsection as follows:
|
||||
|
||||
Modify the last sentence of the paragraph following the definition of
|
||||
FramebufferTexture2D to be as follows:
|
||||
|
||||
"<attachment> must be one of the attachment points of the framebuffer
|
||||
listed in Table 4.x."
|
||||
|
||||
Modify Section 4.4.5 (Framebuffer Completeness) and replace the 3rd
|
||||
item in the bulleted list in the "Framebuffer Attachment Completeness"
|
||||
subsection with the following:
|
||||
|
||||
" * If <attachment> is COLOR_ATTACHMENT<i>_EXT, then <image> must
|
||||
have a color-renderable internal format."
|
||||
|
||||
Changes to Chapter 6 of the OpenGL ES 2.0 Specification (State and
|
||||
State Requests)
|
||||
|
||||
In section 6.1.3 (Enumerated Queries) modify the third sentence in
|
||||
the definition of GetFramebufferAttachmentParameteriv to be as follows:
|
||||
|
||||
"<attachment> must be one of the attachment points of the framebuffer
|
||||
listed in Table 4.x."
|
||||
|
||||
Changes to Chapter 3 of the OpenGL ES Shading Language 1.0.17 Specification (Basics)
|
||||
|
||||
Add a new section:
|
||||
|
||||
3.4.1 GL_EXT_draw_buffers Extension
|
||||
|
||||
To use the GL_EXT_draw_buffers extension in a shader it
|
||||
must be enabled using the #extension directive.
|
||||
|
||||
The shading language preprocessor #define
|
||||
GL_EXT_draw_buffers will be defined to 1, if the
|
||||
GL_EXT_draw_buffers extension is supported.
|
||||
|
||||
Dependencies on ANGLE_framebuffer_blit and APPLE_framebuffer_multisample:
|
||||
|
||||
If neither ANGLE_framebuffer_blit nor APPLE_framebuffer_multisample are
|
||||
supported, then all references to "draw framebuffers" should be replaced
|
||||
with references to "framebuffers". References to DRAW_FRAMEBUFFER_BINDING
|
||||
should be replaced with references to FRAMEBUFFER_BINDING. References to
|
||||
DRAW_FRAMEBUFFER and READ_FRAMEBUFFER should be removed.
|
||||
|
||||
If ANGLE_framebuffer_blit is supported, DRAW_FRAMEBUFFER_BINDING, DRAW_FRAMEBUFFER
|
||||
and READ_FRAMEBUFFER all refer to corresponding _ANGLE suffixed names
|
||||
(they have the same token values).
|
||||
|
||||
If APPLE_framebuffer_multisample is supported, DRAW_FRAMEBUFFER_BINDING,
|
||||
DRAW_FRAMEBUFFER and READ_FRAMEBUFFER all refer to the corresponding _APPLE
|
||||
suffixed names (they have the same token values).
|
||||
|
||||
Errors
|
||||
|
||||
The INVALID_OPERATION error is generated if DrawBuffersEXT is called
|
||||
when the default framebuffer is bound and any of the following conditions
|
||||
hold:
|
||||
- <n> is greater than 1 and less than MAX_DRAW_BUFFERS_EXT,
|
||||
- <bufs> contains a value other than BACK or NONE.
|
||||
|
||||
The INVALID_OPERATION error is generated if DrawBuffersEXT is called
|
||||
when bound to a draw framebuffer object and any of the following
|
||||
conditions hold:
|
||||
- the <i>th value in <bufs> is not COLOR_ATTACHMENT<i>_EXT or NONE.
|
||||
|
||||
The INVALID_VALUE error is generated if DrawBuffersEXT is called
|
||||
with a value of <n> which is greater than MAX_DRAW_BUFFERS_EXT.
|
||||
|
||||
The INVALID_ENUM error is generated by FramebufferRenderbuffer if
|
||||
the <attachment> parameter is not one of the values listed in Table 4.x.
|
||||
|
||||
The INVALID_ENUM error is generated by FramebufferTexture2D if
|
||||
the <attachment> parameter is not one of the values listed in Table 4.x.
|
||||
|
||||
The INVALID_ENUM error is generated by GetFramebufferAttachmentParameteriv
|
||||
if the <attachment> parameter is not one of the values listed in Table 4.x.
|
||||
|
||||
New State
|
||||
|
||||
Add Table 6.X Framebuffer (State per framebuffer object):
|
||||
|
||||
State Type Get Command Initial Value Description
|
||||
------------------ ---- ------------ ------------- -----------
|
||||
DRAW_BUFFER<i>_EXT Z10* GetIntegerv see 4.2.1 Draw buffer selected
|
||||
for fragment color i
|
||||
|
||||
Add to Table 6.18 (Implementation Dependent Values)
|
||||
|
||||
Get value Type Get Cmnd Minimum Value Description Sec.
|
||||
-------------------- ---- ----------- ------------- ----------- -----
|
||||
MAX_DRAW_BUFFERS_EXT Z+ GetIntegerv 1 Maximum number of 4.2.1
|
||||
active draw buffers
|
||||
MAX_COLOR_ATTACHMENTS_EXT Z+ GetIntegerv 1 Number of framebuffer 4.4.1
|
||||
color attachment points
|
||||
Issues
|
||||
|
||||
See ARB_draw_buffers for relevant issues.
|
||||
|
||||
1) What are the differences between this extension and NV_draw_buffers
|
||||
+ NV_fbo_color_attachments?
|
||||
|
||||
RESOLVED. This extension:
|
||||
- adds interactions with blit_framebuffer and the separate
|
||||
draw/read binding points
|
||||
- The draw buffer and color attachment limits are global instead
|
||||
of per-fbo (see Issue 2)
|
||||
- can be used to with default framebuffer to set NONE/BACK (see Issue 4)
|
||||
- retains the ordering restrictions on color attachments that are
|
||||
imposed by ES 3.0.
|
||||
|
||||
2) Should the MAX_DRAW_BUFFERS_EXT and MAX_COLOR_ATTACHMENTS_EXT limits
|
||||
be per-framebuffer values or implementation dependent constants?
|
||||
|
||||
DISCUSSION: In ARB_draw_buffers this was per-context (see Issue 2).
|
||||
EXT_framebuffer_object (and subsequently ARB_framebuffer_object, and GL 3.0
|
||||
through GL 4.2) made these queries framebuffer-dependent.
|
||||
However in GL 4.3 and GLES 3.0, these limits were changed from
|
||||
framebuffer-dependent state to implementation-dependent state after
|
||||
much discussion (Bug 7990).
|
||||
|
||||
NV_draw_buffers has MAX_DRAW_BUFFERS listed as per-framebuffer state,
|
||||
but NV_fbo_color_attachments has MAX_COLOR_ATTACHMENTS as an
|
||||
implementation-dependent constant.
|
||||
|
||||
This is relevant because some implementations are not able to support
|
||||
multisampling in conjuction with multiple color attachments. If the
|
||||
query is per-framebuffer, they can report a maximum of one attachment
|
||||
when there are multisampled attachments, but a higher limit when only
|
||||
single-sampled attachments are present.
|
||||
|
||||
RESOLVED. Make this global context state as this is most consistent
|
||||
with GLES 3.0 and updated GL drivers. In an implementation cannot
|
||||
support multisampling in conjunction with multiple color attachments,
|
||||
perhaps such an implementation could report FBO incomplete in this
|
||||
situation, but this is less than desirable.
|
||||
|
||||
3) Should we support broadcast from gl_FragColor to all gl_FragData[x]
|
||||
or should it be synonymous with gl_FragData[0]?
|
||||
|
||||
DISCUSSION: With NV_draw_buffers, writing to gl_FragColor writes to all
|
||||
the enabled draw buffers (ie broadcast). In OpenGL ES 3.0 when using
|
||||
ESSL 1.0, gl_FragColor is equivalent to writing a single output to
|
||||
gl_FragData[0] and multiple outputs are not possible. When using ESSL 3.0,
|
||||
only user-defined out variables may be used.
|
||||
|
||||
If broadcast is supported, some implementations may have to replace
|
||||
writes to gl_FragColor with replicated writes to all possible gl_FragData
|
||||
locations when this extension is enabled.
|
||||
|
||||
RESOLVED: Writes to gl_FragColor are broadcast to all enabled color
|
||||
buffers. ES 3.0 using ESSL 1.0 doesn't support broadcast because
|
||||
ESSL 1.0 was not extended to have multiple color outputs (but that is
|
||||
what this extension adds). ESSL 3.0 doesn't support the broadcast because
|
||||
it doesn't have the gl_FragColor variable at all, and only has user-
|
||||
defined out variables. This extension extends ESSL 1.0 to have multiple
|
||||
color outputs. Broadcasting from gl_FragColor to all enabled color
|
||||
buffers is the most consistent with existing draw buffer extensions to
|
||||
date (both NV_draw_buffers and desktop GL).
|
||||
|
||||
4) Should we allow DrawBuffersEXT to be called when the default FBO is
|
||||
bound?
|
||||
|
||||
DISCUSSION: NV_draw_buffers specifies that DrawBuffersNV errors with
|
||||
INVALID_OPERATION when the default FBO is bound. OpenGL ES 3.0 allows
|
||||
DrawBuffers to toggle between BACK and NONE on the default FBO.
|
||||
|
||||
An implementation that does not natively support disabling the drawbuffer
|
||||
on the default FBO could emulate this by disabling color writes.
|
||||
|
||||
RESOLVED: Allow DrawBuffersEXT to be called for the default FBO. This
|
||||
is more forward looking and is compatible with ES 3.0.
|
||||
|
||||
5) What are the requirements on the color attachment sizes and formats?
|
||||
|
||||
RESOLVED: ES 2.0 requires that all color buffers attached to application-
|
||||
created framebuffer objects must have the same number of bitplanes
|
||||
(Chapter 4 overview p91). ES 2.0 also requires that all attached images
|
||||
have the same width and height (Section 4.4.5 Framebuffer Completeness).
|
||||
This extension does not lift those requirements, and failing to meet
|
||||
them will result in an incomplete FBO.
|
||||
|
||||
6) Does this have any interactions with glClear?
|
||||
|
||||
RESOLVED: Yes. When multiple color buffers are enabled for writing,
|
||||
glClear clears all of the color buffers. Added language clarifying
|
||||
that glClear and glClearColor may affect multiple color buffers.
|
||||
|
||||
Revision History
|
||||
|
||||
01/30/2013 dgkoch add issue 6 and clear interactions
|
||||
renamed to EXT_draw_buffers based on feedback
|
||||
changed resolution of issue 3.
|
||||
01/23/2013 dgkoch add resolutions to issues 2-4.
|
||||
add issue 5.
|
||||
Add Table 4.x and update various explicit
|
||||
references to COLOR_ATTACHMENT0.
|
||||
Add errors.
|
||||
11/13/2012 dgkoch add revision history
|
||||
add text from updated ES 3.0 spec
|
||||
add issues for discussion
|
||||
10/16/2012 kbr update name string
|
||||
10/16/2012 kbr remove restrition requiring draw buffer 0 to be non-NULL
|
||||
10/12/2012 kbr remove references to GetDoublev and ReadBuffer
|
||||
10/11/2012 kbr initial draft extension
|
||||
|
@ -24,6 +24,7 @@
|
||||
#endif
|
||||
|
||||
#include "khrplatform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
@ -36,7 +37,7 @@ extern "C" {
|
||||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented everytime the API changes.
|
||||
#define SH_VERSION 107
|
||||
#define ANGLE_SH_VERSION 110
|
||||
|
||||
//
|
||||
// The names of the following enums have been derived by replacing GL prefix
|
||||
@ -155,10 +156,21 @@ typedef enum {
|
||||
// This flag ensures all indirect (expression-based) array indexing
|
||||
// is clamped to the bounds of the array. This ensures, for example,
|
||||
// that you cannot read off the end of a uniform, whether an array
|
||||
// vec234, or mat234 type.
|
||||
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
|
||||
// specified in the ShBuiltInResources when constructing the
|
||||
// compiler, selects the strategy for the clamping implementation.
|
||||
SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000
|
||||
} ShCompileOptions;
|
||||
|
||||
// Defines alternate strategies for implementing array index clamping.
|
||||
typedef enum {
|
||||
// Use the clamp intrinsic for array index clamping.
|
||||
SH_CLAMP_WITH_CLAMP_INTRINSIC = 1,
|
||||
|
||||
// Use a user-defined function for array index clamping.
|
||||
SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION
|
||||
} ShArrayIndexClampingStrategy;
|
||||
|
||||
//
|
||||
// Driver must call this first, once, before doing any other
|
||||
// compiler operations.
|
||||
@ -173,7 +185,7 @@ COMPILER_EXPORT int ShFinalize();
|
||||
|
||||
// The 64 bits hash function. The first parameter is the input string; the
|
||||
// second parameter is the string length.
|
||||
typedef khronos_uint64_t (*ShHashFunction64)(const char*, unsigned int);
|
||||
typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t);
|
||||
|
||||
//
|
||||
// Implementation dependent built-in resources (constants and extensions).
|
||||
@ -196,11 +208,20 @@ typedef struct
|
||||
int OES_standard_derivatives;
|
||||
int OES_EGL_image_external;
|
||||
int ARB_texture_rectangle;
|
||||
int EXT_draw_buffers;
|
||||
|
||||
// Set to 1 if highp precision is supported in the fragment language.
|
||||
// Default is 0.
|
||||
int FragmentPrecisionHigh;
|
||||
|
||||
// Name Hashing.
|
||||
// Set a 64 bit hash function to enable user-defined name hashing.
|
||||
// Default is NULL.
|
||||
ShHashFunction64 HashFunction;
|
||||
|
||||
// Selects a strategy to use when implementing array index clamping.
|
||||
// Default is SH_CLAMP_WITH_CLAMP_INTRINSIC.
|
||||
ShArrayIndexClampingStrategy ArrayIndexClampingStrategy;
|
||||
} ShBuiltInResources;
|
||||
|
||||
//
|
||||
@ -264,7 +285,7 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
|
||||
COMPILER_EXPORT int ShCompile(
|
||||
const ShHandle handle,
|
||||
const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions
|
||||
);
|
||||
|
||||
@ -292,11 +313,11 @@ COMPILER_EXPORT int ShCompile(
|
||||
// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
|
||||
// null termination character.
|
||||
// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
|
||||
//
|
||||
//
|
||||
// params: Requested parameter
|
||||
COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
|
||||
ShShaderInfo pname,
|
||||
int* params);
|
||||
size_t* params);
|
||||
|
||||
// Returns nul-terminated information log for a compiled shader.
|
||||
// Parameters:
|
||||
@ -339,7 +360,7 @@ COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
|
||||
// mappedName are the same.
|
||||
COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -366,7 +387,7 @@ COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
|
||||
// mappedName are the same.
|
||||
COMPILER_EXPORT void ShGetActiveUniform(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
|
@ -9,7 +9,8 @@
|
||||
'target_defaults': {
|
||||
'defines': [
|
||||
'ANGLE_DISABLE_TRACE',
|
||||
'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ L"d3dcompiler_46.dll", L"d3dcompiler_43.dll" }',
|
||||
'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1',
|
||||
'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }',
|
||||
],
|
||||
},
|
||||
'targets': [
|
||||
@ -19,10 +20,10 @@
|
||||
'include_dirs': [
|
||||
],
|
||||
'sources': [
|
||||
'compiler/preprocessor/Diagnostics.cpp',
|
||||
'compiler/preprocessor/Diagnostics.h',
|
||||
'compiler/preprocessor/DirectiveHandler.cpp',
|
||||
'compiler/preprocessor/DirectiveHandler.h',
|
||||
'compiler/preprocessor/DiagnosticsBase.cpp',
|
||||
'compiler/preprocessor/DiagnosticsBase.h',
|
||||
'compiler/preprocessor/DirectiveHandlerBase.cpp',
|
||||
'compiler/preprocessor/DirectiveHandlerBase.h',
|
||||
'compiler/preprocessor/DirectiveParser.cpp',
|
||||
'compiler/preprocessor/DirectiveParser.h',
|
||||
'compiler/preprocessor/ExpressionParser.cpp',
|
||||
@ -46,6 +47,10 @@
|
||||
'compiler/preprocessor/Tokenizer.cpp',
|
||||
'compiler/preprocessor/Tokenizer.h',
|
||||
],
|
||||
# TODO(jschuh): http://crbug.com/167187
|
||||
'msvs_disabled_warnings': [
|
||||
4267,
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'translator_common',
|
||||
@ -59,8 +64,6 @@
|
||||
'COMPILER_IMPLEMENTATION',
|
||||
],
|
||||
'sources': [
|
||||
'compiler/ArrayBoundsClamper.cpp',
|
||||
'compiler/ArrayBoundsClamper.h',
|
||||
'compiler/BaseTypes.h',
|
||||
'compiler/BuiltInFunctionEmulator.cpp',
|
||||
'compiler/BuiltInFunctionEmulator.h',
|
||||
@ -136,9 +139,13 @@
|
||||
'compiler/timing/RestrictFragmentShaderTiming.h',
|
||||
'compiler/timing/RestrictVertexShaderTiming.cpp',
|
||||
'compiler/timing/RestrictVertexShaderTiming.h',
|
||||
'third_party/compiler/ArrayBoundsClamper.cpp',
|
||||
'third_party/compiler/ArrayBoundsClamper.h',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
# TODO(jschuh): http://crbug.com/167187 size_t -> int
|
||||
'msvs_disabled_warnings': [ 4267 ],
|
||||
'sources': ['compiler/ossource_win.cpp'],
|
||||
}, { # else: posix
|
||||
'sources': ['compiler/ossource_posix.cpp'],
|
||||
@ -172,6 +179,8 @@
|
||||
'compiler/VersionGLSL.cpp',
|
||||
'compiler/VersionGLSL.h',
|
||||
],
|
||||
# TODO(jschuh): http://crbug.com/167187 size_t -> int
|
||||
'msvs_disabled_warnings': [ 4267 ],
|
||||
},
|
||||
],
|
||||
'conditions': [
|
||||
@ -202,6 +211,8 @@
|
||||
'compiler/SearchSymbol.cpp',
|
||||
'compiler/SearchSymbol.h',
|
||||
],
|
||||
# TODO(jschuh): http://crbug.com/167187 size_t -> int
|
||||
'msvs_disabled_warnings': [ 4267 ],
|
||||
},
|
||||
{
|
||||
'target_name': 'libGLESv2',
|
||||
@ -210,7 +221,6 @@
|
||||
'include_dirs': [
|
||||
'.',
|
||||
'../include',
|
||||
'$(DXSDK_DIR)/include',
|
||||
],
|
||||
'sources': [
|
||||
'common/angleutils.h',
|
||||
@ -264,9 +274,10 @@
|
||||
'libGLESv2/utilities.cpp',
|
||||
'libGLESv2/utilities.h',
|
||||
],
|
||||
# TODO(jschuh): http://crbug.com/167187 size_t -> int
|
||||
'msvs_disabled_warnings': [ 4267 ],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'AdditionalLibraryDirectories': ['$(DXSDK_DIR)/lib/x86'],
|
||||
'AdditionalDependencies': [
|
||||
'd3d9.lib',
|
||||
],
|
||||
@ -280,7 +291,6 @@
|
||||
'include_dirs': [
|
||||
'.',
|
||||
'../include',
|
||||
'$(DXSDK_DIR)/include',
|
||||
],
|
||||
'sources': [
|
||||
'common/angleutils.h',
|
||||
@ -301,17 +311,14 @@
|
||||
'libEGL/Surface.cpp',
|
||||
'libEGL/Surface.h',
|
||||
],
|
||||
# TODO(jschuh): http://crbug.com/167187 size_t -> int
|
||||
'msvs_disabled_warnings': [ 4267 ],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'AdditionalLibraryDirectories': ['$(DXSDK_DIR)/lib/x86'],
|
||||
'AdditionalDependencies': [
|
||||
'd3d9.lib',
|
||||
'dxguid.lib',
|
||||
'dwmapi.lib',
|
||||
],
|
||||
'DelayLoadDLLs': [
|
||||
'dwmapi.dll',
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -10,8 +10,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "common/system.h"
|
||||
#include <d3d9.h>
|
||||
#include <windows.h>
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
30
gfx/angle/src/common/system.h
Normal file
30
gfx/angle/src/common/system.h
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 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.
|
||||
//
|
||||
|
||||
// system.h: Includes Windows system headers and undefines macros that conflict.
|
||||
|
||||
#ifndef COMMON_SYSTEM_H
|
||||
#define COMMON_SYSTEM_H
|
||||
|
||||
#if !defined(WIN32_LEAN_AND_MEAN)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <d3d9.h>
|
||||
#include <D3Dcompiler.h>
|
||||
#include <d3d9types.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#if defined(min)
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#if defined(max)
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#endif // COMMON_SYSTEM_H
|
@ -1,10 +1,12 @@
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
#define BUILD_VERSION 0
|
||||
#define BUILD_REVISION 1560
|
||||
#define BUILD_REVISION 2040
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
|
||||
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
|
||||
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
|
||||
|
||||
#define VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
|
||||
|
@ -16,7 +16,7 @@ enum TPrecision
|
||||
EbpUndefined,
|
||||
EbpLow,
|
||||
EbpMedium,
|
||||
EbpHigh,
|
||||
EbpHigh
|
||||
};
|
||||
|
||||
inline const char* getPrecisionString(TPrecision p)
|
||||
@ -47,7 +47,7 @@ enum TBasicType
|
||||
EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
|
||||
EbtStruct,
|
||||
EbtAddress, // should be deprecated??
|
||||
EbtInvariant, // used as a type when qualifying a previously declared variable as being invariant
|
||||
EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
|
||||
};
|
||||
|
||||
inline const char* getBasicString(TBasicType t)
|
||||
@ -114,7 +114,7 @@ enum TQualifier
|
||||
EvqFragData,
|
||||
|
||||
// end of list
|
||||
EvqLast,
|
||||
EvqLast
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -4,7 +4,6 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/ArrayBoundsClamper.h"
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/DetectRecursion.h"
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
@ -20,6 +19,7 @@
|
||||
#include "compiler/depgraph/DependencyGraphOutput.h"
|
||||
#include "compiler/timing/RestrictFragmentShaderTiming.h"
|
||||
#include "compiler/timing/RestrictVertexShaderTiming.h"
|
||||
#include "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
bool isWebGLBasedSpec(ShShaderSpec spec)
|
||||
{
|
||||
@ -38,6 +38,7 @@ bool InitializeSymbolTable(
|
||||
// The builtins deliberately don't specify precisions for the function
|
||||
// arguments and return types. For that reason we don't try to check them.
|
||||
TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, 0, false, NULL, infoSink);
|
||||
parseContext.fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
|
||||
|
||||
GlobalParseContext = &parseContext;
|
||||
|
||||
@ -102,6 +103,8 @@ TShHandleBase::~TShHandleBase() {
|
||||
TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
|
||||
: shaderType(type),
|
||||
shaderSpec(spec),
|
||||
fragmentPrecisionHigh(false),
|
||||
clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
|
||||
builtInFunctionEmulator(type)
|
||||
{
|
||||
longNameMap = LongNameMap::GetInstance();
|
||||
@ -124,6 +127,13 @@ bool TCompiler::Init(const ShBuiltInResources& resources)
|
||||
if (!InitBuiltInSymbolTable(resources))
|
||||
return false;
|
||||
InitExtensionBehavior(resources, extensionBehavior);
|
||||
fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
|
||||
|
||||
// ArrayIndexClampingStrategy's enum starts at 1, so 0 is 'default'.
|
||||
if (resources.ArrayIndexClampingStrategy) {
|
||||
clampingStrategy = resources.ArrayIndexClampingStrategy;
|
||||
}
|
||||
arrayBoundsClamper.SetClampingStrategy(clampingStrategy);
|
||||
|
||||
hashFunction = resources.HashFunction;
|
||||
|
||||
@ -131,7 +141,7 @@ bool TCompiler::Init(const ShBuiltInResources& resources)
|
||||
}
|
||||
|
||||
bool TCompiler::compile(const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions)
|
||||
{
|
||||
TScopedPoolAllocator scopedAlloc(&allocator, true);
|
||||
@ -146,7 +156,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
|
||||
// First string is path of source file if flag is set. The actual source follows.
|
||||
const char* sourcePath = NULL;
|
||||
int firstSource = 0;
|
||||
size_t firstSource = 0;
|
||||
if (compileOptions & SH_SOURCE_PATH)
|
||||
{
|
||||
sourcePath = shaderStrings[0];
|
||||
@ -157,6 +167,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
|
||||
shaderType, shaderSpec, compileOptions, true,
|
||||
sourcePath, infoSink);
|
||||
parseContext.fragmentPrecisionHigh = fragmentPrecisionHigh;
|
||||
GlobalParseContext = &parseContext;
|
||||
|
||||
// We preserve symbols at the built-in level from compile-to-compile.
|
||||
@ -355,13 +366,17 @@ const TExtensionBehavior& TCompiler::getExtensionBehavior() const
|
||||
return extensionBehavior;
|
||||
}
|
||||
|
||||
const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
|
||||
{
|
||||
return builtInFunctionEmulator;
|
||||
}
|
||||
|
||||
const ArrayBoundsClamper& TCompiler::getArrayBoundsClamper() const
|
||||
{
|
||||
return arrayBoundsClamper;
|
||||
}
|
||||
|
||||
ShArrayIndexClampingStrategy TCompiler::getArrayIndexClampingStrategy() const
|
||||
{
|
||||
return clampingStrategy;
|
||||
}
|
||||
|
||||
const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
|
||||
{
|
||||
return builtInFunctionEmulator;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -14,6 +14,7 @@ public:
|
||||
ConstantUnion()
|
||||
{
|
||||
iConst = 0;
|
||||
type = EbtVoid;
|
||||
}
|
||||
|
||||
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
|
||||
|
@ -16,11 +16,26 @@ namespace sh
|
||||
{
|
||||
bool DetectLoopDiscontinuity::traverse(TIntermNode *node)
|
||||
{
|
||||
mLoopDepth = 0;
|
||||
mLoopDiscontinuity = false;
|
||||
node->traverse(this);
|
||||
return mLoopDiscontinuity;
|
||||
}
|
||||
|
||||
bool DetectLoopDiscontinuity::visitLoop(Visit visit, TIntermLoop *loop)
|
||||
{
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
++mLoopDepth;
|
||||
}
|
||||
else if (visit == PostVisit)
|
||||
{
|
||||
--mLoopDepth;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
|
||||
{
|
||||
if (mLoopDiscontinuity)
|
||||
@ -28,14 +43,19 @@ bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mLoopDepth)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (node->getFlowOp())
|
||||
{
|
||||
case EOpKill:
|
||||
break;
|
||||
case EOpBreak:
|
||||
case EOpContinue:
|
||||
mLoopDiscontinuity = true;
|
||||
case EOpReturn:
|
||||
mLoopDiscontinuity = true;
|
||||
break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
|
@ -23,8 +23,10 @@ class DetectLoopDiscontinuity : public TIntermTraverser
|
||||
|
||||
protected:
|
||||
bool visitBranch(Visit visit, TIntermBranch *node);
|
||||
bool visitLoop(Visit visit, TIntermLoop *loop);
|
||||
bool visitAggregate(Visit visit, TIntermAggregate *node);
|
||||
|
||||
int mLoopDepth;
|
||||
bool mLoopDiscontinuity;
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_DIAGNOSTICS_H_
|
||||
#define COMPILER_DIAGNOSTICS_H_
|
||||
|
||||
#include "compiler/preprocessor/Diagnostics.h"
|
||||
#include "compiler/preprocessor/DiagnosticsBase.h"
|
||||
|
||||
class TInfoSink;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/Pragma.h"
|
||||
#include "compiler/preprocessor/DirectiveHandler.h"
|
||||
#include "compiler/preprocessor/DirectiveHandlerBase.h"
|
||||
|
||||
class TDiagnostics;
|
||||
|
||||
|
@ -16,7 +16,7 @@ typedef enum
|
||||
EBhEnable,
|
||||
EBhWarn,
|
||||
EBhDisable,
|
||||
EBhUndefined,
|
||||
EBhUndefined
|
||||
} TBehavior;
|
||||
|
||||
inline const char* getBehaviorString(TBehavior b)
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -210,6 +210,6 @@ int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
|
||||
int ForLoopUnroll::evaluateIntConstant(TIntermConstantUnion* node)
|
||||
{
|
||||
ASSERT((node != NULL) && (node->getUnionArrayPointer() != NULL));
|
||||
return node->getUnionArrayPointer()->getIConst();
|
||||
return node->getIConst(0);
|
||||
}
|
||||
|
||||
|
@ -654,4 +654,6 @@ void InitExtensionBehavior(const ShBuiltInResources& resources,
|
||||
extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
|
||||
if (resources.ARB_texture_rectangle)
|
||||
extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined;
|
||||
if (resources.EXT_draw_buffers)
|
||||
extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -593,7 +593,7 @@ TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nod
|
||||
//
|
||||
|
||||
if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
|
||||
if (cond->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getBConst() == true)
|
||||
if (cond->getAsConstantUnion()->getBConst(0) == true)
|
||||
return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence, nodePair.node1->getLine()) : NULL;
|
||||
else
|
||||
return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence, nodePair.node2->getLine()) : NULL;
|
||||
@ -647,7 +647,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
|
||||
//
|
||||
|
||||
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
|
||||
if (cond->getAsConstantUnion()->getUnionArrayPointer()->getBConst())
|
||||
if (cond->getAsConstantUnion()->getBConst(0))
|
||||
return trueBlock;
|
||||
else
|
||||
return falseBlock;
|
||||
@ -846,6 +846,7 @@ bool TIntermUnary::promote(TInfoSink&)
|
||||
}
|
||||
|
||||
setType(operand->getType());
|
||||
type.setQualifier(EvqTemporary);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1162,7 +1163,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
||||
case EbtFloat:
|
||||
if (rightUnionArray[i] == 0.0f) {
|
||||
infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
|
||||
tempConstArray[i].setFConst(FLT_MAX);
|
||||
tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
|
||||
} else
|
||||
tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
|
||||
break;
|
||||
@ -1377,7 +1378,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
||||
|
||||
TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
|
||||
{
|
||||
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
|
||||
int size = node->getType().getObjectSize();
|
||||
|
||||
ConstantUnion *leftUnionArray = new ConstantUnion[size];
|
||||
@ -1388,13 +1388,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
case EbtFloat:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getIConst()));
|
||||
leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getBConst()));
|
||||
leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
|
||||
break;
|
||||
case EbtFloat:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
leftUnionArray[i].setFConst(static_cast<float>(node->getFConst(i)));
|
||||
break;
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
|
||||
@ -1404,13 +1404,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
case EbtInt:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getBConst()));
|
||||
leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
|
||||
break;
|
||||
case EbtFloat:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getFConst()));
|
||||
leftUnionArray[i].setIConst(static_cast<int>(node->getFConst(i)));
|
||||
break;
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
|
||||
@ -1420,13 +1420,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
case EbtBool:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getIConst() != 0);
|
||||
leftUnionArray[i].setBConst(node->getIConst(i) != 0);
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
leftUnionArray[i].setBConst(node->getBConst(i));
|
||||
break;
|
||||
case EbtFloat:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getFConst() != 0.0f);
|
||||
leftUnionArray[i].setBConst(node->getFConst(i) != 0.0f);
|
||||
break;
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
TString mapLongName(int id, const TString& name, bool isGlobal)
|
||||
TString mapLongName(size_t id, const TString& name, bool isGlobal)
|
||||
{
|
||||
ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
|
||||
TStringStream stream;
|
||||
@ -77,7 +77,7 @@ void LongNameMap::Insert(const char* originalName, const char* mappedName)
|
||||
originalName, mappedName));
|
||||
}
|
||||
|
||||
int LongNameMap::Size() const
|
||||
size_t LongNameMap::Size() const
|
||||
{
|
||||
return mLongNameMap.size();
|
||||
}
|
||||
@ -122,7 +122,7 @@ TString MapLongVariableNames::mapGlobalLongName(const TString& name)
|
||||
const char* mappedName = mGlobalMap->Find(name.c_str());
|
||||
if (mappedName != NULL)
|
||||
return mappedName;
|
||||
int id = mGlobalMap->Size();
|
||||
size_t id = mGlobalMap->Size();
|
||||
TString rt = mapLongName(id, name, true);
|
||||
mGlobalMap->Insert(name.c_str(), rt.c_str());
|
||||
return rt;
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
void Insert(const char* originalName, const char* mappedName);
|
||||
|
||||
// Return the number of entries in the map.
|
||||
int Size() const;
|
||||
size_t Size() const;
|
||||
|
||||
private:
|
||||
LongNameMap();
|
||||
|
@ -7,10 +7,11 @@
|
||||
#include "compiler/OutputESSL.h"
|
||||
|
||||
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable)
|
||||
: TOutputGLSLBase(objSink, hashFunction, nameMap, symbolTable)
|
||||
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ class TOutputESSL : public TOutputGLSLBase
|
||||
{
|
||||
public:
|
||||
TOutputESSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable);
|
||||
|
@ -7,10 +7,11 @@
|
||||
#include "compiler/OutputGLSL.h"
|
||||
|
||||
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable)
|
||||
: TOutputGLSLBase(objSink, hashFunction, nameMap, symbolTable)
|
||||
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ class TOutputGLSL : public TOutputGLSLBase
|
||||
{
|
||||
public:
|
||||
TOutputGLSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable);
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
#include "compiler/compiler_debug.h"
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
namespace
|
||||
{
|
||||
TString arrayBrackets(const TType& type)
|
||||
@ -38,12 +40,14 @@ bool isSingleStatement(TIntermNode* node) {
|
||||
} // namespace
|
||||
|
||||
TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable)
|
||||
: TIntermTraverser(true, true, true),
|
||||
mObjSink(objSink),
|
||||
mDeclaringVariables(false),
|
||||
mClampingStrategy(clampingStrategy),
|
||||
mHashFunction(hashFunction),
|
||||
mNameMap(nameMap),
|
||||
mSymbolTable(symbolTable)
|
||||
@ -155,7 +159,7 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
|
||||
{
|
||||
switch (pConstUnion->getType())
|
||||
{
|
||||
case EbtFloat: out << pConstUnion->getFConst(); break;
|
||||
case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion->getFConst())); break;
|
||||
case EbtInt: out << pConstUnion->getIConst(); break;
|
||||
case EbtBool: out << pConstUnion->getBConst(); break;
|
||||
default: UNREACHABLE();
|
||||
@ -219,7 +223,11 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
|
||||
{
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << "[webgl_int_clamp(";
|
||||
if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
|
||||
out << "[int(clamp(float(";
|
||||
} else {
|
||||
out << "[webgl_int_clamp(";
|
||||
}
|
||||
}
|
||||
else if (visit == PostVisit)
|
||||
{
|
||||
@ -236,7 +244,12 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
|
||||
{
|
||||
maxSize = leftType.getNominalSize() - 1;
|
||||
}
|
||||
out << ", 0, " << maxSize << ")]";
|
||||
|
||||
if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
|
||||
out << "), 0.0, float(" << maxSize << ")))]";
|
||||
} else {
|
||||
out << ", 0, " << maxSize << ")]";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -249,7 +262,13 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
|
||||
{
|
||||
out << ".";
|
||||
// TODO(alokp): ASSERT
|
||||
out << hashName(node->getType().getFieldName());
|
||||
TString fieldName = node->getType().getFieldName();
|
||||
|
||||
const TType& structType = node->getLeft()->getType();
|
||||
if (!mSymbolTable.findBuiltIn(structType.getTypeName()))
|
||||
fieldName = hashName(fieldName);
|
||||
|
||||
out << fieldName;
|
||||
visitChildren = false;
|
||||
}
|
||||
break;
|
||||
|
@ -17,6 +17,7 @@ class TOutputGLSLBase : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
TOutputGLSLBase(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable);
|
||||
@ -62,8 +63,11 @@ private:
|
||||
|
||||
ForLoopUnroll mLoopUnroll;
|
||||
|
||||
ShArrayIndexClampingStrategy mClampingStrategy;
|
||||
|
||||
// name hashing.
|
||||
ShHashFunction64 mHashFunction;
|
||||
|
||||
NameMap& mNameMap;
|
||||
|
||||
TSymbolTable& mSymbolTable;
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "compiler/compiler_debug.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/UnfoldShortCircuit.h"
|
||||
#include "compiler/SearchSymbol.h"
|
||||
#include "compiler/DetectDiscontinuity.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SearchSymbol.h"
|
||||
#include "compiler/UnfoldShortCircuit.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace sh
|
||||
{
|
||||
@ -98,7 +99,7 @@ OutputHLSL::~OutputHLSL()
|
||||
|
||||
void OutputHLSL::output()
|
||||
{
|
||||
mContainsLoopDiscontinuity = containsLoopDiscontinuity(mContext.treeRoot);
|
||||
mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
|
||||
|
||||
mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
|
||||
header();
|
||||
@ -973,7 +974,7 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
|
||||
|
||||
if (element)
|
||||
{
|
||||
int i = element->getUnionArrayPointer()[0].getIConst();
|
||||
int i = element->getIConst(0);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@ -1778,7 +1779,7 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
|
||||
{
|
||||
bool wasDiscontinuous = mInsideDiscontinuousLoop;
|
||||
|
||||
if (!mInsideDiscontinuousLoop)
|
||||
if (mContainsLoopDiscontinuity && !mInsideDiscontinuousLoop)
|
||||
{
|
||||
mInsideDiscontinuousLoop = containsLoopDiscontinuity(node);
|
||||
}
|
||||
@ -1976,7 +1977,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
|
||||
if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
|
||||
{
|
||||
index = symbol;
|
||||
initial = constant->getUnionArrayPointer()[0].getIConst();
|
||||
initial = constant->getIConst(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1998,7 +1999,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
|
||||
if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
|
||||
{
|
||||
comparator = test->getOp();
|
||||
limit = constant->getUnionArrayPointer()[0].getIConst();
|
||||
limit = constant->getIConst(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2019,7 +2020,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
|
||||
{
|
||||
if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
|
||||
{
|
||||
int value = constant->getUnionArrayPointer()[0].getIConst();
|
||||
int value = constant->getIConst(0);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
@ -2565,7 +2566,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
|
||||
{
|
||||
switch (constUnion->getType())
|
||||
{
|
||||
case EbtFloat: out << constUnion->getFConst(); break;
|
||||
case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
|
||||
case EbtInt: out << constUnion->getIConst(); break;
|
||||
case EbtBool: out << constUnion->getBConst(); break;
|
||||
default: UNREACHABLE();
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -33,7 +33,7 @@ bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TV
|
||||
enum {
|
||||
exyzw,
|
||||
ergba,
|
||||
estpq,
|
||||
estpq
|
||||
} fieldSet[4];
|
||||
|
||||
for (int i = 0; i < fields.num; ++i) {
|
||||
@ -286,7 +286,7 @@ bool TParseContext::lValueErrorCheck(int line, const char* op, TIntermTyped* nod
|
||||
|
||||
for (TIntermSequence::iterator p = aggrNode->getSequence().begin();
|
||||
p != aggrNode->getSequence().end(); p++) {
|
||||
int value = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getIConst();
|
||||
int value = (*p)->getAsTyped()->getAsConstantUnion()->getIConst(0);
|
||||
offset[value]++;
|
||||
if (offset[value] > 1) {
|
||||
error(line, " l-value of swizzle cannot have duplicate components", op);
|
||||
@ -493,7 +493,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
|
||||
bool overFull = false;
|
||||
bool matrixInMatrix = false;
|
||||
bool arrayArg = false;
|
||||
for (int i = 0; i < function.getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < function.getParamCount(); ++i) {
|
||||
const TParameter& param = function.getParam(i);
|
||||
size += param.type->getObjectSize();
|
||||
|
||||
@ -512,7 +512,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
|
||||
if (constType)
|
||||
type->setQualifier(EvqConst);
|
||||
|
||||
if (type->isArray() && type->getArraySize() != function.getParamCount()) {
|
||||
if (type->isArray() && static_cast<size_t>(type->getArraySize()) != function.getParamCount()) {
|
||||
error(line, "array constructor needs one argument per array element", "constructor");
|
||||
return true;
|
||||
}
|
||||
@ -680,7 +680,7 @@ bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
|
||||
return true;
|
||||
}
|
||||
|
||||
size = constant->getUnionArrayPointer()->getIConst();
|
||||
size = constant->getIConst(0);
|
||||
|
||||
if (size <= 0) {
|
||||
error(line, "array size must be a positive integer", "");
|
||||
@ -1313,7 +1313,6 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
|
||||
ConstantUnion *unionArray;
|
||||
if (tempConstantNode) {
|
||||
unionArray = tempConstantNode->getUnionArrayPointer();
|
||||
ASSERT(unionArray);
|
||||
|
||||
if (!unionArray) {
|
||||
return node;
|
||||
@ -1507,7 +1506,7 @@ bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldT
|
||||
//
|
||||
// Returns 0 for success.
|
||||
//
|
||||
int PaParseStrings(int count, const char* const string[], const int length[],
|
||||
int PaParseStrings(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context) {
|
||||
if ((count == 0) || (string == NULL))
|
||||
return 1;
|
||||
|
@ -58,6 +58,7 @@ struct TParseContext {
|
||||
const TType* currentFunctionType; // the return type of the function that's currently being parsed
|
||||
bool functionReturnsValue; // true if a non-void function has a return
|
||||
bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
|
||||
bool fragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
|
||||
TString HashErrMsg;
|
||||
bool AfterEOF;
|
||||
TDiagnostics diagnostics;
|
||||
@ -134,7 +135,7 @@ struct TParseContext {
|
||||
bool structNestingErrorCheck(TSourceLoc line, const TType& fieldType);
|
||||
};
|
||||
|
||||
int PaParseStrings(int count, const char* const string[], const int length[],
|
||||
int PaParseStrings(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context);
|
||||
|
||||
#endif // _PARSER_HELPER_INCLUDED_
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/ArrayBoundsClamper.h"
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/HashNames.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/VariableInfo.h"
|
||||
#include "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
class LongNameMap;
|
||||
class TCompiler;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
|
||||
bool Init(const ShBuiltInResources& resources);
|
||||
bool compile(const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions);
|
||||
|
||||
// Get results of the last compilation.
|
||||
@ -108,6 +108,7 @@ protected:
|
||||
const TExtensionBehavior& getExtensionBehavior() const;
|
||||
|
||||
const ArrayBoundsClamper& getArrayBoundsClamper() const;
|
||||
ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const;
|
||||
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
|
||||
|
||||
private:
|
||||
@ -121,8 +122,10 @@ private:
|
||||
TSymbolTable symbolTable;
|
||||
// Built-in extensions with default behavior.
|
||||
TExtensionBehavior extensionBehavior;
|
||||
bool fragmentPrecisionHigh;
|
||||
|
||||
ArrayBoundsClamper arrayBoundsClamper;
|
||||
ShArrayIndexClampingStrategy clampingStrategy;
|
||||
BuiltInFunctionEmulator builtInFunctionEmulator;
|
||||
|
||||
// Results of compilation.
|
||||
|
@ -21,18 +21,18 @@
|
||||
//
|
||||
|
||||
static bool checkActiveUniformAndAttribMaxLengths(const ShHandle handle,
|
||||
int expectedValue)
|
||||
size_t expectedValue)
|
||||
{
|
||||
int activeUniformLimit = 0;
|
||||
size_t activeUniformLimit = 0;
|
||||
ShGetInfo(handle, SH_ACTIVE_UNIFORM_MAX_LENGTH, &activeUniformLimit);
|
||||
int activeAttribLimit = 0;
|
||||
size_t activeAttribLimit = 0;
|
||||
ShGetInfo(handle, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttribLimit);
|
||||
return (expectedValue == activeUniformLimit && expectedValue == activeAttribLimit);
|
||||
}
|
||||
|
||||
static bool checkMappedNameMaxLength(const ShHandle handle, int expectedValue)
|
||||
static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
|
||||
{
|
||||
int mappedNameMaxLength = 0;
|
||||
size_t mappedNameMaxLength = 0;
|
||||
ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength);
|
||||
return (expectedValue == mappedNameMaxLength);
|
||||
}
|
||||
@ -40,7 +40,7 @@ static bool checkMappedNameMaxLength(const ShHandle handle, int expectedValue)
|
||||
static void getVariableInfo(ShShaderInfo varType,
|
||||
const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -69,14 +69,14 @@ static void getVariableInfo(ShShaderInfo varType,
|
||||
// This size must match that queried by
|
||||
// SH_ACTIVE_UNIFORM_MAX_LENGTH and SH_ACTIVE_ATTRIBUTE_MAX_LENGTH
|
||||
// in ShGetInfo, below.
|
||||
int activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
size_t activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
ASSERT(checkActiveUniformAndAttribMaxLengths(handle, activeUniformAndAttribLength));
|
||||
strncpy(name, varInfo.name.c_str(), activeUniformAndAttribLength);
|
||||
name[activeUniformAndAttribLength - 1] = 0;
|
||||
if (mappedName) {
|
||||
// This size must match that queried by
|
||||
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
|
||||
int maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
size_t maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
|
||||
strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
|
||||
mappedName[maxMappedNameLength - 1] = 0;
|
||||
@ -125,9 +125,15 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
|
||||
resources->OES_standard_derivatives = 0;
|
||||
resources->OES_EGL_image_external = 0;
|
||||
resources->ARB_texture_rectangle = 0;
|
||||
resources->EXT_draw_buffers = 0;
|
||||
|
||||
// Disable highp precision in fragment shader by default.
|
||||
resources->FragmentPrecisionHigh = 0;
|
||||
|
||||
// Disable name hashing by default.
|
||||
resources->HashFunction = NULL;
|
||||
|
||||
resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
|
||||
}
|
||||
|
||||
//
|
||||
@ -175,7 +181,7 @@ void ShDestruct(ShHandle handle)
|
||||
int ShCompile(
|
||||
const ShHandle handle,
|
||||
const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions)
|
||||
{
|
||||
if (!InitThread())
|
||||
@ -193,7 +199,7 @@ int ShCompile(
|
||||
return success ? 1 : 0;
|
||||
}
|
||||
|
||||
void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
|
||||
void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
|
||||
{
|
||||
if (!handle || !params)
|
||||
return;
|
||||
@ -281,7 +287,7 @@ void ShGetObjectCode(const ShHandle handle, char* objCode)
|
||||
|
||||
void ShGetActiveAttrib(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -293,7 +299,7 @@ void ShGetActiveAttrib(const ShHandle handle,
|
||||
|
||||
void ShGetActiveUniform(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -324,24 +330,24 @@ void ShGetNameHashingEntry(const ShHandle handle,
|
||||
++it;
|
||||
|
||||
size_t len = it->first.length() + 1;
|
||||
int max_len = 0;
|
||||
size_t max_len = 0;
|
||||
ShGetInfo(handle, SH_NAME_MAX_LENGTH, &max_len);
|
||||
if (static_cast<int>(len) > max_len) {
|
||||
if (len > max_len) {
|
||||
ASSERT(false);
|
||||
len = max_len;
|
||||
}
|
||||
strncpy(name, it->first.c_str(), len);
|
||||
// To be on the safe side in case the source is longer than expected.
|
||||
name[len] = '\0';
|
||||
name[len - 1] = '\0';
|
||||
|
||||
len = it->second.length() + 1;
|
||||
max_len = 0;
|
||||
ShGetInfo(handle, SH_HASHED_NAME_MAX_LENGTH, &max_len);
|
||||
if (static_cast<int>(len) > max_len) {
|
||||
if (len > max_len) {
|
||||
ASSERT(false);
|
||||
len = max_len;
|
||||
}
|
||||
strncpy(hashedName, it->second.c_str(), len);
|
||||
// To be on the safe side in case the source is longer than expected.
|
||||
hashedName[len] = '\0';
|
||||
hashedName[len - 1] = '\0';
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ public:
|
||||
void setDefined() { defined = true; }
|
||||
bool isDefined() { return defined; }
|
||||
|
||||
int getParamCount() const { return static_cast<int>(parameters.size()); }
|
||||
const TParameter& getParam(int i) const { return parameters[i]; }
|
||||
size_t getParamCount() const { return parameters.size(); }
|
||||
const TParameter& getParam(size_t i) const { return parameters[i]; }
|
||||
|
||||
virtual void dump(TInfoSink &infoSink) const;
|
||||
TFunction(const TFunction&, TStructureMap& remapper);
|
||||
@ -323,10 +323,16 @@ public:
|
||||
void dump(TInfoSink &infoSink) const;
|
||||
void copyTable(const TSymbolTable& copyOf);
|
||||
|
||||
void setDefaultPrecision( TBasicType type, TPrecision prec ){
|
||||
if( type != EbtFloat && type != EbtInt ) return; // Only set default precision for int/float
|
||||
bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
|
||||
if (IsSampler(type.type))
|
||||
return true; // Skip sampler types for the time being
|
||||
if (type.type != EbtFloat && type.type != EbtInt)
|
||||
return false; // Only set default precision for int/float
|
||||
if (type.size != 1 || type.matrix || type.array)
|
||||
return false; // Not allowed to set for aggregate types
|
||||
int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
|
||||
precisionStack[indexOfLastElement][type] = prec; // Uses map operator [], overwrites the current value
|
||||
precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value
|
||||
return true;
|
||||
}
|
||||
|
||||
// Searches down the precisionStack for a precision qualifier for the specified TBasicType
|
||||
|
@ -26,7 +26,7 @@ void TranslatorESSL::translate(TIntermNode* root) {
|
||||
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
|
||||
// Write translated shader.
|
||||
TOutputESSL outputESSL(sink, getHashFunction(), getNameMap(), getSymbolTable());
|
||||
TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
|
||||
root->traverse(&outputESSL);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,6 @@ void TranslatorGLSL::translate(TIntermNode* root) {
|
||||
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
|
||||
// Write translated shader.
|
||||
TOutputGLSL outputGLSL(sink, getHashFunction(), getNameMap(), getSymbolTable());
|
||||
TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
|
||||
root->traverse(&outputGLSL);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -111,6 +111,8 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
|
||||
|
||||
out << mOutputHLSL->typeString(node->getType()) << " s" << i << ";\n";
|
||||
|
||||
out << "{\n";
|
||||
|
||||
mTemporaryIndex = i + 1;
|
||||
node->getCondition()->traverse(this);
|
||||
out << "if(";
|
||||
@ -135,6 +137,8 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
|
||||
out << ";\n"
|
||||
"}\n";
|
||||
|
||||
out << "}\n";
|
||||
|
||||
mTemporaryIndex = i + 1;
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
|
||||
return true;
|
||||
|
||||
// List of param indices for which loop indices are used as argument.
|
||||
typedef std::vector<int> ParamIndex;
|
||||
typedef std::vector<size_t> ParamIndex;
|
||||
ParamIndex pIndex;
|
||||
TIntermSequence& params = node->getSequence();
|
||||
for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
|
||||
|
@ -85,7 +85,7 @@ int VariablePacker::GetNumRows(ShDataType type)
|
||||
case SH_FLOAT_MAT3:
|
||||
return 3;
|
||||
case SH_FLOAT_MAT2:
|
||||
return 1;
|
||||
return 2;
|
||||
case SH_FLOAT_VEC4:
|
||||
case SH_INT_VEC4:
|
||||
case SH_BOOL_VEC4:
|
||||
|
@ -8,7 +8,7 @@ struct TParseContext;
|
||||
extern int glslang_initialize(TParseContext* context);
|
||||
extern int glslang_finalize(TParseContext* context);
|
||||
|
||||
extern int glslang_scan(int count,
|
||||
extern int glslang_scan(size_t count,
|
||||
const char* const string[],
|
||||
const int length[],
|
||||
TParseContext* context);
|
||||
|
@ -51,7 +51,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
||||
#define YY_INPUT(buf, result, max_size) \
|
||||
result = string_input(buf, max_size, yyscanner);
|
||||
|
||||
static int string_input(char* buf, int max_size, yyscan_t yyscanner);
|
||||
static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
|
||||
static int check_type(yyscan_t yyscanner);
|
||||
static int reserved_word(yyscan_t yyscanner);
|
||||
%}
|
||||
@ -203,10 +203,10 @@ O [0-7]
|
||||
return check_type(yyscanner);
|
||||
}
|
||||
|
||||
0[xX]{H}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
0{O}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
0[xX]{H}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
0{O}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
0{D}+ { context->error(yylineno, "Invalid Octal number.", yytext); context->recover(); return 0;}
|
||||
{D}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
{D}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
|
||||
{D}+{E} { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
|
||||
{D}+"."{D}*({E})? { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
|
||||
@ -272,11 +272,11 @@ O [0-7]
|
||||
|
||||
%%
|
||||
|
||||
int string_input(char* buf, int max_size, yyscan_t yyscanner) {
|
||||
yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
|
||||
pp::Token token;
|
||||
yyget_extra(yyscanner)->preprocessor.lex(&token);
|
||||
int len = token.type == pp::Token::LAST ? 0 : token.text.size();
|
||||
if ((len > 0) && (len < max_size))
|
||||
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
|
||||
if (len < max_size)
|
||||
memcpy(buf, token.text.c_str(), len);
|
||||
yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line), yyscanner);
|
||||
|
||||
@ -341,7 +341,7 @@ int glslang_finalize(TParseContext* context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int glslang_scan(int count, const char* const string[], const int length[],
|
||||
int glslang_scan(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context) {
|
||||
yyrestart(NULL, context->scanner);
|
||||
yyset_lineno(EncodeSourceLoc(0, 1), context->scanner);
|
||||
@ -357,6 +357,9 @@ int glslang_scan(int count, const char* const string[], const int length[],
|
||||
iter != extBehavior.end(); ++iter) {
|
||||
context->preprocessor.predefineMacro(iter->first.c_str(), 1);
|
||||
}
|
||||
if (context->fragmentPrecisionHigh)
|
||||
context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -38,6 +38,9 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
|
||||
#define YYLEX_PARAM context->scanner
|
||||
%}
|
||||
|
||||
@ -242,36 +245,36 @@ postfix_expression
|
||||
}
|
||||
if ($1->getType().getQualifier() == EvqConst && $3->getQualifier() == EvqConst) {
|
||||
if ($1->isArray()) { // constant folding for arrays
|
||||
$$ = context->addConstArrayNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
|
||||
$$ = context->addConstArrayNode($3->getAsConstantUnion()->getIConst(0), $1, $2.line);
|
||||
} else if ($1->isVector()) { // constant folding for vectors
|
||||
TVectorFields fields;
|
||||
fields.num = 1;
|
||||
fields.offsets[0] = $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
|
||||
fields.offsets[0] = $3->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array
|
||||
$$ = context->addConstVectorNode(fields, $1, $2.line);
|
||||
} else if ($1->isMatrix()) { // constant folding for matrices
|
||||
$$ = context->addConstMatrixNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
|
||||
$$ = context->addConstMatrixNode($3->getAsConstantUnion()->getIConst(0), $1, $2.line);
|
||||
}
|
||||
} else {
|
||||
if ($3->getQualifier() == EvqConst) {
|
||||
if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !$1->isArray() ) {
|
||||
if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getIConst(0) && !$1->isArray() ) {
|
||||
std::stringstream extraInfoStream;
|
||||
extraInfoStream << "field selection out of range '" << $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
|
||||
extraInfoStream << "field selection out of range '" << $3->getAsConstantUnion()->getIConst(0) << "'";
|
||||
std::string extraInfo = extraInfoStream.str();
|
||||
context->error($2.line, "", "[", extraInfo.c_str());
|
||||
context->recover();
|
||||
} else {
|
||||
if ($1->isArray()) {
|
||||
if ($1->getType().getArraySize() == 0) {
|
||||
if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
|
||||
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, $2.line))
|
||||
if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getIConst(0)) {
|
||||
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getIConst(0), true, $2.line))
|
||||
context->recover();
|
||||
} else {
|
||||
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), 0, false, $2.line))
|
||||
context->recover();
|
||||
}
|
||||
} else if ( $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= $1->getType().getArraySize()) {
|
||||
} else if ( $3->getAsConstantUnion()->getIConst(0) >= $1->getType().getArraySize()) {
|
||||
std::stringstream extraInfoStream;
|
||||
extraInfoStream << "array index out of range '" << $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
|
||||
extraInfoStream << "array index out of range '" << $3->getAsConstantUnion()->getIConst(0) << "'";
|
||||
std::string extraInfo = extraInfoStream.str();
|
||||
context->error($2.line, "", "[", extraInfo.c_str());
|
||||
context->recover();
|
||||
@ -521,7 +524,7 @@ function_call
|
||||
$$->getAsAggregate()->setName(fnCandidate->getMangledName());
|
||||
|
||||
TQualifier qual;
|
||||
for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||
qual = fnCandidate->getParam(i).type->getQualifier();
|
||||
if (qual == EvqOut || qual == EvqInOut) {
|
||||
if (context->lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
|
||||
@ -962,7 +965,7 @@ declaration
|
||||
prototype->setType(function.getReturnType());
|
||||
prototype->setName(function.getName());
|
||||
|
||||
for (int i = 0; i < function.getParamCount(); i++)
|
||||
for (size_t i = 0; i < function.getParamCount(); i++)
|
||||
{
|
||||
const TParameter ¶m = function.getParam(i);
|
||||
if (param.name != 0)
|
||||
@ -988,7 +991,14 @@ declaration
|
||||
$$ = $1.intermAggregate;
|
||||
}
|
||||
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
|
||||
context->symbolTable.setDefaultPrecision( $3.type, $2 );
|
||||
if (($2 == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
|
||||
context->error($1.line, "precision is not supported in fragment shader", "highp");
|
||||
context->recover();
|
||||
}
|
||||
if (!context->symbolTable.setDefaultPrecision( $3, $2 )) {
|
||||
context->error($1.line, "illegal type argument for default precision qualifier", getBasicString($3.type));
|
||||
context->recover();
|
||||
}
|
||||
$$ = 0;
|
||||
}
|
||||
;
|
||||
@ -1009,7 +1019,7 @@ function_prototype
|
||||
context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
|
||||
context->recover();
|
||||
}
|
||||
for (int i = 0; i < prevDec->getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
|
||||
if (prevDec->getParam(i).type->getQualifier() != $1->getParam(i).type->getQualifier()) {
|
||||
context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString());
|
||||
context->recover();
|
||||
@ -2079,7 +2089,7 @@ function_definition
|
||||
// knows where to find parameters.
|
||||
//
|
||||
TIntermAggregate* paramNodes = new TIntermAggregate;
|
||||
for (int i = 0; i < function->getParamCount(); i++) {
|
||||
for (size_t i = 0; i < function->getParamCount(); i++) {
|
||||
const TParameter& param = function->getParam(i);
|
||||
if (param.name != 0) {
|
||||
TVariable *variable = new TVariable(param.name, *param.type);
|
||||
@ -2139,4 +2149,3 @@ function_definition
|
||||
int glslang_parse(TParseContext* context) {
|
||||
return yyparse(context);
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
typedef uint64_t flex_uint64_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
@ -191,6 +192,11 @@ typedef void* yyscan_t;
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#define EOB_ACT_CONTINUE_SCAN 0
|
||||
#define EOB_ACT_END_OF_FILE 1
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
@ -204,7 +210,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
*/
|
||||
#define YY_LESS_LINENO(n) \
|
||||
do { \
|
||||
int yyl;\
|
||||
yy_size_t yyl;\
|
||||
for ( yyl = n; yyl < yyleng; ++yyl )\
|
||||
if ( yytext[yyl] == '\n' )\
|
||||
--yylineno;\
|
||||
@ -226,11 +232,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
|
||||
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
@ -248,7 +249,7 @@ struct yy_buffer_state
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_n_chars;
|
||||
yy_size_t yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
@ -327,7 +328,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
|
||||
|
||||
YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
|
||||
|
||||
void *yyalloc (yy_size_t ,yyscan_t yyscanner );
|
||||
void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
|
||||
@ -378,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
||||
*/
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
yyg->yytext_ptr = yy_bp; \
|
||||
yyleng = (size_t) (yy_cp - yy_bp); \
|
||||
yyleng = (yy_size_t) (yy_cp - yy_bp); \
|
||||
yyg->yy_hold_char = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
@ -820,7 +821,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
||||
#define YY_INPUT(buf, result, max_size) \
|
||||
result = string_input(buf, max_size, yyscanner);
|
||||
|
||||
static int string_input(char* buf, int max_size, yyscan_t yyscanner);
|
||||
static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
|
||||
static int check_type(yyscan_t yyscanner);
|
||||
static int reserved_word(yyscan_t yyscanner);
|
||||
|
||||
@ -843,8 +844,8 @@ struct yyguts_t
|
||||
size_t yy_buffer_stack_max; /**< capacity of stack. */
|
||||
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
|
||||
char yy_hold_char;
|
||||
int yy_n_chars;
|
||||
int yyleng_r;
|
||||
yy_size_t yy_n_chars;
|
||||
yy_size_t yyleng_r;
|
||||
char *yy_c_buf_p;
|
||||
int yy_init;
|
||||
int yy_start;
|
||||
@ -897,7 +898,7 @@ FILE *yyget_out (yyscan_t yyscanner );
|
||||
|
||||
void yyset_out (FILE * out_str ,yyscan_t yyscanner );
|
||||
|
||||
int yyget_leng (yyscan_t yyscanner );
|
||||
yy_size_t yyget_leng (yyscan_t yyscanner );
|
||||
|
||||
char *yyget_text (yyscan_t yyscanner );
|
||||
|
||||
@ -966,7 +967,7 @@ static int input (yyscan_t yyscanner );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
int n; \
|
||||
yy_size_t n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@ -1125,7 +1126,7 @@ yy_find_action:
|
||||
|
||||
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
|
||||
{
|
||||
int yyl;
|
||||
yy_size_t yyl;
|
||||
for ( yyl = 0; yyl < yyleng; ++yyl )
|
||||
if ( yytext[yyl] == '\n' )
|
||||
|
||||
@ -1542,11 +1543,11 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 99:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
{ yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 100:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
{ yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 101:
|
||||
YY_RULE_SETUP
|
||||
@ -1554,7 +1555,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 102:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
{ yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 103:
|
||||
YY_RULE_SETUP
|
||||
@ -1963,7 +1964,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
else
|
||||
{
|
||||
int num_to_read =
|
||||
yy_size_t num_to_read =
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
|
||||
while ( num_to_read <= 0 )
|
||||
@ -1977,7 +1978,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
if ( b->yy_is_our_buffer )
|
||||
{
|
||||
int new_size = b->yy_buf_size * 2;
|
||||
yy_size_t new_size = b->yy_buf_size * 2;
|
||||
|
||||
if ( new_size <= 0 )
|
||||
b->yy_buf_size += b->yy_buf_size / 8;
|
||||
@ -2008,7 +2009,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
/* Read in more data. */
|
||||
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
||||
yyg->yy_n_chars, (size_t) num_to_read );
|
||||
yyg->yy_n_chars, num_to_read );
|
||||
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
|
||||
}
|
||||
@ -2133,7 +2134,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
else
|
||||
{ /* need more input */
|
||||
int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
||||
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
||||
++yyg->yy_c_buf_p;
|
||||
|
||||
switch ( yy_get_next_buffer( yyscanner ) )
|
||||
@ -2157,7 +2158,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
if ( yywrap(yyscanner ) )
|
||||
return EOF;
|
||||
return 0;
|
||||
|
||||
if ( ! yyg->yy_did_buffer_switch_on_eof )
|
||||
YY_NEW_FILE;
|
||||
@ -2420,7 +2421,7 @@ void yypop_buffer_state (yyscan_t yyscanner)
|
||||
*/
|
||||
static void yyensure_buffer_stack (yyscan_t yyscanner)
|
||||
{
|
||||
int num_to_alloc;
|
||||
yy_size_t num_to_alloc;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
if (!yyg->yy_buffer_stack) {
|
||||
@ -2518,12 +2519,11 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
||||
* @param yyscanner The scanner object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
|
||||
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
yy_size_t n, i;
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
@ -2673,7 +2673,7 @@ FILE *yyget_out (yyscan_t yyscanner)
|
||||
/** Get the length of the current token.
|
||||
* @param yyscanner The scanner object.
|
||||
*/
|
||||
int yyget_leng (yyscan_t yyscanner)
|
||||
yy_size_t yyget_leng (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
return yyleng;
|
||||
@ -2948,11 +2948,11 @@ void yyfree (void * ptr , yyscan_t yyscanner)
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
int string_input(char* buf, int max_size, yyscan_t yyscanner) {
|
||||
yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
|
||||
pp::Token token;
|
||||
yyget_extra(yyscanner)->preprocessor.lex(&token);
|
||||
int len = token.type == pp::Token::LAST ? 0 : token.text.size();
|
||||
if ((len > 0) && (len < max_size))
|
||||
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
|
||||
if (len < max_size)
|
||||
memcpy(buf, token.text.c_str(), len);
|
||||
yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line),yyscanner);
|
||||
|
||||
@ -3017,7 +3017,7 @@ int glslang_finalize(TParseContext* context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int glslang_scan(int count, const char* const string[], const int length[],
|
||||
int glslang_scan(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context) {
|
||||
yyrestart(NULL,context->scanner);
|
||||
yyset_lineno(EncodeSourceLoc(0, 1),context->scanner);
|
||||
@ -3033,6 +3033,9 @@ int glslang_scan(int count, const char* const string[], const int length[],
|
||||
iter != extBehavior.end(); ++iter) {
|
||||
context->preprocessor.predefineMacro(iter->first.c_str(), 1);
|
||||
}
|
||||
if (context->fragmentPrecisionHigh)
|
||||
context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,9 @@
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
|
||||
#define YYLEX_PARAM context->scanner
|
||||
|
||||
|
||||
@ -657,27 +660,27 @@ static const yytype_int16 yyrhs[] =
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint16 yyrline[] =
|
||||
{
|
||||
0, 165, 165, 200, 203, 216, 221, 226, 232, 235,
|
||||
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
|
||||
0, 168, 168, 203, 206, 219, 224, 229, 235, 238,
|
||||
317, 320, 421, 431, 444, 452, 552, 555, 563, 567,
|
||||
574, 578, 585, 591, 600, 608, 663, 670, 680, 683,
|
||||
693, 703, 724, 725, 726, 731, 732, 741, 753, 754,
|
||||
762, 773, 777, 778, 788, 798, 808, 821, 822, 832,
|
||||
845, 849, 853, 857, 858, 871, 872, 885, 886, 899,
|
||||
900, 917, 918, 931, 932, 933, 934, 935, 939, 942,
|
||||
953, 961, 988, 993, 1007, 1045, 1048, 1055, 1063, 1084,
|
||||
1105, 1116, 1145, 1150, 1160, 1165, 1175, 1178, 1181, 1184,
|
||||
1190, 1197, 1200, 1222, 1240, 1264, 1287, 1291, 1309, 1317,
|
||||
1349, 1369, 1458, 1467, 1490, 1493, 1499, 1507, 1515, 1523,
|
||||
1533, 1540, 1543, 1546, 1552, 1555, 1570, 1574, 1578, 1582,
|
||||
1591, 1596, 1601, 1606, 1611, 1616, 1621, 1626, 1631, 1636,
|
||||
1642, 1648, 1654, 1659, 1664, 1673, 1682, 1687, 1700, 1700,
|
||||
1714, 1714, 1723, 1726, 1741, 1777, 1781, 1787, 1795, 1811,
|
||||
1815, 1819, 1820, 1826, 1827, 1828, 1829, 1830, 1834, 1835,
|
||||
1835, 1835, 1845, 1846, 1850, 1850, 1851, 1851, 1856, 1859,
|
||||
1869, 1872, 1878, 1879, 1883, 1891, 1895, 1905, 1910, 1927,
|
||||
1927, 1932, 1932, 1939, 1939, 1947, 1950, 1956, 1959, 1965,
|
||||
1969, 1976, 1983, 1990, 1997, 2008, 2017, 2021, 2028, 2031,
|
||||
2037, 2037
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -2168,36 +2171,36 @@ yyreduce:
|
||||
}
|
||||
if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
|
||||
if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
|
||||
(yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
|
||||
(yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
|
||||
} else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
|
||||
TVectorFields fields;
|
||||
fields.num = 1;
|
||||
fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
|
||||
fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array
|
||||
(yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
|
||||
} else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
|
||||
(yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
|
||||
(yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
|
||||
}
|
||||
} else {
|
||||
if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
|
||||
if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
|
||||
if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
|
||||
std::stringstream extraInfoStream;
|
||||
extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
|
||||
extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
|
||||
std::string extraInfo = extraInfoStream.str();
|
||||
context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
|
||||
context->recover();
|
||||
} else {
|
||||
if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
|
||||
if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
|
||||
if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
|
||||
if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
|
||||
if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
|
||||
if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), true, (yyvsp[(2) - (4)].lex).line))
|
||||
context->recover();
|
||||
} else {
|
||||
if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
|
||||
context->recover();
|
||||
}
|
||||
} else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
|
||||
} else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
|
||||
std::stringstream extraInfoStream;
|
||||
extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
|
||||
extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
|
||||
std::string extraInfo = extraInfoStream.str();
|
||||
context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
|
||||
context->recover();
|
||||
@ -2465,7 +2468,7 @@ yyreduce:
|
||||
(yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
|
||||
|
||||
TQualifier qual;
|
||||
for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||
qual = fnCandidate->getParam(i).type->getQualifier();
|
||||
if (qual == EvqOut || qual == EvqInOut) {
|
||||
if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
|
||||
@ -3051,7 +3054,7 @@ yyreduce:
|
||||
prototype->setType(function.getReturnType());
|
||||
prototype->setName(function.getName());
|
||||
|
||||
for (int i = 0; i < function.getParamCount(); i++)
|
||||
for (size_t i = 0; i < function.getParamCount(); i++)
|
||||
{
|
||||
const TParameter ¶m = function.getParam(i);
|
||||
if (param.name != 0)
|
||||
@ -3085,7 +3088,14 @@ yyreduce:
|
||||
case 73:
|
||||
|
||||
{
|
||||
context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
|
||||
if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
|
||||
context->error((yyvsp[(1) - (4)].lex).line, "precision is not supported in fragment shader", "highp");
|
||||
context->recover();
|
||||
}
|
||||
if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
|
||||
context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
|
||||
context->recover();
|
||||
}
|
||||
(yyval.interm.intermNode) = 0;
|
||||
}
|
||||
break;
|
||||
@ -3107,7 +3117,7 @@ yyreduce:
|
||||
context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
|
||||
context->recover();
|
||||
}
|
||||
for (int i = 0; i < prevDec->getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
|
||||
if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
|
||||
context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
|
||||
context->recover();
|
||||
@ -4473,7 +4483,7 @@ yyreduce:
|
||||
// knows where to find parameters.
|
||||
//
|
||||
TIntermAggregate* paramNodes = new TIntermAggregate;
|
||||
for (int i = 0; i < function->getParamCount(); i++) {
|
||||
for (size_t i = 0; i < function->getParamCount(); i++) {
|
||||
const TParameter& param = function->getParam(i);
|
||||
if (param.name != 0) {
|
||||
TVariable *variable = new TVariable(param.name, *param.type);
|
||||
@ -4750,4 +4760,3 @@ int glslang_parse(TParseContext* context) {
|
||||
return yyparse(context);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2013 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.
|
||||
//
|
||||
@ -183,7 +183,7 @@ enum TOperator {
|
||||
EOpVectorTimesScalarAssign,
|
||||
EOpMatrixTimesScalarAssign,
|
||||
EOpMatrixTimesMatrixAssign,
|
||||
EOpDivAssign,
|
||||
EOpDivAssign
|
||||
};
|
||||
|
||||
extern const char* getOperatorString(TOperator op);
|
||||
@ -269,7 +269,7 @@ protected:
|
||||
enum TLoopType {
|
||||
ELoopFor,
|
||||
ELoopWhile,
|
||||
ELoopDoWhile,
|
||||
ELoopDoWhile
|
||||
};
|
||||
|
||||
class TIntermLoop : public TIntermNode {
|
||||
@ -358,7 +358,10 @@ public:
|
||||
TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
|
||||
|
||||
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
|
||||
void setUnionArrayPointer(ConstantUnion *c) { unionArrayPointer = c; }
|
||||
|
||||
int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
|
||||
float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
|
||||
bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
|
||||
|
||||
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
|
@ -44,8 +44,8 @@
|
||||
typedef DWORD OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
|
||||
#elif defined(ANGLE_OS_POSIX)
|
||||
typedef unsigned int OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
|
||||
typedef pthread_key_t OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX (static_cast<OS_TLSIndex>(-1))
|
||||
#endif // ANGLE_OS_WIN
|
||||
|
||||
OS_TLSIndex OS_AllocTLSIndex();
|
||||
|
@ -151,6 +151,13 @@ bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
|
||||
|
||||
void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
|
||||
{
|
||||
if (!node->getUnionArrayPointer())
|
||||
{
|
||||
// The constant was not initialized, this should already have been logged
|
||||
assert(infoSink.info.size() != 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ConstantUnion* leftUnionArray = unionArray;
|
||||
int instanceSize = type.getObjectSize();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
|
||||
#include <cassert>
|
||||
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "DirectiveHandler.h"
|
||||
#include "DirectiveHandlerBase.h"
|
||||
|
||||
namespace pp
|
||||
{
|
@ -10,8 +10,8 @@
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DirectiveHandler.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "DirectiveHandlerBase.h"
|
||||
#include "ExpressionParser.h"
|
||||
#include "MacroExpander.h"
|
||||
#include "Token.h"
|
||||
|
@ -85,7 +85,11 @@
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Triggered by the auto-generated pplval variable.
|
||||
#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#else
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(disable: 4065 4701)
|
||||
#endif
|
||||
@ -95,7 +99,7 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Lexer.h"
|
||||
#include "Token.h"
|
||||
|
||||
@ -105,6 +109,8 @@ typedef __int64 YYSTYPE;
|
||||
#include <stdint.h>
|
||||
typedef intmax_t YYSTYPE;
|
||||
#endif // _MSC_VER
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
@ -467,9 +473,9 @@ static const yytype_int8 yyrhs[] =
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 85, 85, 92, 93, 96, 99, 102, 105, 108,
|
||||
111, 114, 117, 120, 123, 126, 129, 132, 135, 138,
|
||||
151, 164, 167, 170, 173, 176, 179
|
||||
0, 90, 90, 97, 98, 101, 104, 107, 110, 113,
|
||||
116, 119, 122, 125, 128, 131, 134, 137, 140, 143,
|
||||
156, 169, 172, 175, 178, 181, 184
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,11 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Triggered by the auto-generated pplval variable.
|
||||
#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#else
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(disable: 4065 4701)
|
||||
#endif
|
||||
@ -32,7 +36,7 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Lexer.h"
|
||||
#include "Token.h"
|
||||
|
||||
@ -42,6 +46,8 @@ typedef __int64 YYSTYPE;
|
||||
#include <stdint.h>
|
||||
typedef intmax_t YYSTYPE;
|
||||
#endif // _MSC_VER
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
|
@ -17,25 +17,24 @@ Input::Input() : mCount(0), mString(0)
|
||||
{
|
||||
}
|
||||
|
||||
Input::Input(int count, const char* const string[], const int length[]) :
|
||||
Input::Input(size_t count, const char* const string[], const int length[]) :
|
||||
mCount(count),
|
||||
mString(string)
|
||||
{
|
||||
assert(mCount >= 0);
|
||||
mLength.reserve(mCount);
|
||||
for (int i = 0; i < mCount; ++i)
|
||||
for (size_t i = 0; i < mCount; ++i)
|
||||
{
|
||||
int len = length ? length[i] : -1;
|
||||
mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
|
||||
}
|
||||
}
|
||||
|
||||
int Input::read(char* buf, int maxSize)
|
||||
size_t Input::read(char* buf, size_t maxSize)
|
||||
{
|
||||
int nRead = 0;
|
||||
size_t nRead = 0;
|
||||
while ((nRead < maxSize) && (mReadLoc.sIndex < mCount))
|
||||
{
|
||||
int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
|
||||
size_t size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
|
||||
size = std::min(size, maxSize);
|
||||
std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
|
||||
nRead += size;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef COMPILER_PREPROCESSOR_INPUT_H_
|
||||
#define COMPILER_PREPROCESSOR_INPUT_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <vector>
|
||||
|
||||
namespace pp
|
||||
@ -17,18 +18,18 @@ class Input
|
||||
{
|
||||
public:
|
||||
Input();
|
||||
Input(int count, const char* const string[], const int length[]);
|
||||
Input(size_t count, const char* const string[], const int length[]);
|
||||
|
||||
int count() const { return mCount; }
|
||||
const char* string(int index) const { return mString[index]; }
|
||||
int length(int index) const { return mLength[index]; }
|
||||
size_t count() const { return mCount; }
|
||||
const char* string(size_t index) const { return mString[index]; }
|
||||
size_t length(size_t index) const { return mLength[index]; }
|
||||
|
||||
int read(char* buf, int maxSize);
|
||||
size_t read(char* buf, size_t maxSize);
|
||||
|
||||
struct Location
|
||||
{
|
||||
int sIndex; // String index;
|
||||
int cIndex; // Char index.
|
||||
size_t sIndex; // String index;
|
||||
size_t cIndex; // Char index.
|
||||
|
||||
Location() : sIndex(0), cIndex(0) { }
|
||||
};
|
||||
@ -36,9 +37,9 @@ class Input
|
||||
|
||||
private:
|
||||
// Input.
|
||||
int mCount;
|
||||
size_t mCount;
|
||||
const char* const* mString;
|
||||
std::vector<int> mLength;
|
||||
std::vector<size_t> mLength;
|
||||
|
||||
Location mReadLoc;
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Token.h"
|
||||
|
||||
namespace pp
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "DirectiveParser.h"
|
||||
#include "Macro.h"
|
||||
#include "MacroExpander.h"
|
||||
@ -48,7 +48,7 @@ Preprocessor::~Preprocessor()
|
||||
delete mImpl;
|
||||
}
|
||||
|
||||
bool Preprocessor::init(int count,
|
||||
bool Preprocessor::init(size_t count,
|
||||
const char* const string[],
|
||||
const int length[])
|
||||
{
|
||||
|
@ -7,6 +7,8 @@
|
||||
#ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_
|
||||
#define COMPILER_PREPROCESSOR_PREPROCESSOR_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "pp_utils.h"
|
||||
|
||||
namespace pp
|
||||
@ -32,7 +34,7 @@ class Preprocessor
|
||||
// Each element in the length array may contain the length of the
|
||||
// corresponding string or a value less than 0 to indicate that the string
|
||||
// is null terminated.
|
||||
bool init(int count, const char* const string[], const int length[]);
|
||||
bool init(size_t count, const char* const string[], const int length[]);
|
||||
// Adds a pre-defined macro.
|
||||
void predefineMacro(const char* name, int value);
|
||||
|
||||
|
@ -56,6 +56,7 @@ typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
typedef uint64_t flex_uint64_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
@ -179,6 +180,11 @@ typedef void* yyscan_t;
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#define EOB_ACT_CONTINUE_SCAN 0
|
||||
#define EOB_ACT_END_OF_FILE 1
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
@ -201,11 +207,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
|
||||
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
@ -223,7 +224,7 @@ struct yy_buffer_state
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_n_chars;
|
||||
yy_size_t yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
@ -302,7 +303,7 @@ static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
|
||||
|
||||
YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
|
||||
|
||||
void *ppalloc (yy_size_t ,yyscan_t yyscanner );
|
||||
void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
|
||||
@ -353,7 +354,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
||||
*/
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
yyg->yytext_ptr = yy_bp; \
|
||||
yyleng = (size_t) (yy_cp - yy_bp); \
|
||||
yyleng = (yy_size_t) (yy_cp - yy_bp); \
|
||||
yyg->yy_hold_char = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
@ -516,7 +517,7 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
|
||||
|
||||
#include "Tokenizer.h"
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Token.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
@ -575,8 +576,8 @@ struct yyguts_t
|
||||
size_t yy_buffer_stack_max; /**< capacity of stack. */
|
||||
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
|
||||
char yy_hold_char;
|
||||
int yy_n_chars;
|
||||
int yyleng_r;
|
||||
yy_size_t yy_n_chars;
|
||||
yy_size_t yyleng_r;
|
||||
char *yy_c_buf_p;
|
||||
int yy_init;
|
||||
int yy_start;
|
||||
@ -633,7 +634,7 @@ FILE *ppget_out (yyscan_t yyscanner );
|
||||
|
||||
void ppset_out (FILE * out_str ,yyscan_t yyscanner );
|
||||
|
||||
int ppget_leng (yyscan_t yyscanner );
|
||||
yy_size_t ppget_leng (yyscan_t yyscanner );
|
||||
|
||||
char *ppget_text (yyscan_t yyscanner );
|
||||
|
||||
@ -700,7 +701,7 @@ static int input (yyscan_t yyscanner );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
int n; \
|
||||
yy_size_t n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@ -1118,13 +1119,14 @@ case YY_STATE_EOF(COMMENT):
|
||||
// Set the location for EOF token manually.
|
||||
pp::Input* input = &yyextra->input;
|
||||
pp::Input::Location* scanLoc = &yyextra->scanLoc;
|
||||
int sIndexMax = std::max(0, input->count() - 1);
|
||||
yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
|
||||
if (scanLoc->sIndex != sIndexMax)
|
||||
{
|
||||
// We can only reach here if there are empty strings at the
|
||||
// end of the input.
|
||||
scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
|
||||
yyfileno = sIndexMax; yylineno = 1;
|
||||
// FIXME: this is not 64-bit clean.
|
||||
yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
|
||||
}
|
||||
yylloc->file = yyfileno;
|
||||
yylloc->line = yylineno;
|
||||
@ -1328,7 +1330,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
else
|
||||
{
|
||||
int num_to_read =
|
||||
yy_size_t num_to_read =
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
|
||||
while ( num_to_read <= 0 )
|
||||
@ -1342,7 +1344,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
if ( b->yy_is_our_buffer )
|
||||
{
|
||||
int new_size = b->yy_buf_size * 2;
|
||||
yy_size_t new_size = b->yy_buf_size * 2;
|
||||
|
||||
if ( new_size <= 0 )
|
||||
b->yy_buf_size += b->yy_buf_size / 8;
|
||||
@ -1373,7 +1375,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
/* Read in more data. */
|
||||
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
||||
yyg->yy_n_chars, (size_t) num_to_read );
|
||||
yyg->yy_n_chars, num_to_read );
|
||||
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
|
||||
}
|
||||
@ -1498,7 +1500,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
else
|
||||
{ /* need more input */
|
||||
int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
||||
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
||||
++yyg->yy_c_buf_p;
|
||||
|
||||
switch ( yy_get_next_buffer( yyscanner ) )
|
||||
@ -1522,7 +1524,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
if ( ppwrap(yyscanner ) )
|
||||
return EOF;
|
||||
return 0;
|
||||
|
||||
if ( ! yyg->yy_did_buffer_switch_on_eof )
|
||||
YY_NEW_FILE;
|
||||
@ -1778,7 +1780,7 @@ void pppop_buffer_state (yyscan_t yyscanner)
|
||||
*/
|
||||
static void ppensure_buffer_stack (yyscan_t yyscanner)
|
||||
{
|
||||
int num_to_alloc;
|
||||
yy_size_t num_to_alloc;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
if (!yyg->yy_buffer_stack) {
|
||||
@ -1876,12 +1878,11 @@ YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
||||
* @param yyscanner The scanner object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
|
||||
YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
yy_size_t n, i;
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
@ -1991,7 +1992,7 @@ FILE *ppget_out (yyscan_t yyscanner)
|
||||
/** Get the length of the current token.
|
||||
* @param yyscanner The scanner object.
|
||||
*/
|
||||
int ppget_leng (yyscan_t yyscanner)
|
||||
yy_size_t ppget_leng (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
return yyleng;
|
||||
@ -2294,9 +2295,8 @@ Tokenizer::~Tokenizer()
|
||||
destroyScanner();
|
||||
}
|
||||
|
||||
bool Tokenizer::init(int count, const char* const string[], const int length[])
|
||||
bool Tokenizer::init(size_t count, const char* const string[], const int length[])
|
||||
{
|
||||
if (count < 0) return false;
|
||||
if ((count > 0) && (string == 0)) return false;
|
||||
|
||||
mContext.input = Input(count, string, length);
|
||||
|
@ -37,7 +37,7 @@ class Tokenizer : public Lexer
|
||||
Tokenizer(Diagnostics* diagnostics);
|
||||
~Tokenizer();
|
||||
|
||||
bool init(int count, const char* const string[], const int length[]);
|
||||
bool init(size_t count, const char* const string[], const int length[]);
|
||||
|
||||
void setFileNumber(int file);
|
||||
void setLineNumber(int line);
|
||||
|
@ -25,7 +25,7 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
|
||||
%{
|
||||
#include "Tokenizer.h"
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Token.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
@ -239,13 +239,14 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
|
||||
// Set the location for EOF token manually.
|
||||
pp::Input* input = &yyextra->input;
|
||||
pp::Input::Location* scanLoc = &yyextra->scanLoc;
|
||||
int sIndexMax = std::max(0, input->count() - 1);
|
||||
yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
|
||||
if (scanLoc->sIndex != sIndexMax)
|
||||
{
|
||||
// We can only reach here if there are empty strings at the
|
||||
// end of the input.
|
||||
scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
|
||||
yyfileno = sIndexMax; yylineno = 1;
|
||||
// FIXME: this is not 64-bit clean.
|
||||
yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
|
||||
}
|
||||
yylloc->file = yyfileno;
|
||||
yylloc->line = yylineno;
|
||||
@ -278,9 +279,8 @@ Tokenizer::~Tokenizer()
|
||||
destroyScanner();
|
||||
}
|
||||
|
||||
bool Tokenizer::init(int count, const char* const string[], const int length[])
|
||||
bool Tokenizer::init(size_t count, const char* const string[], const int length[])
|
||||
{
|
||||
if (count < 0) return false;
|
||||
if ((count > 0) && (string == 0)) return false;
|
||||
|
||||
mContext.input = Input(count, string, length);
|
||||
|
@ -134,8 +134,8 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Diagnostics.cpp" />
|
||||
<ClCompile Include="DirectiveHandler.cpp" />
|
||||
<ClCompile Include="DiagnosticsBase.cpp" />
|
||||
<ClCompile Include="DirectiveHandlerBase.cpp" />
|
||||
<ClCompile Include="DirectiveParser.cpp" />
|
||||
<ClCompile Include="ExpressionParser.cpp" />
|
||||
<ClCompile Include="Input.cpp" />
|
||||
|
@ -138,7 +138,6 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ArrayBoundsClamper.cpp" />
|
||||
<ClCompile Include="BuiltInFunctionEmulator.cpp" />
|
||||
<ClCompile Include="Compiler.cpp" />
|
||||
<ClCompile Include="debug.cpp" />
|
||||
@ -174,6 +173,7 @@
|
||||
<ClCompile Include="depgraph\DependencyGraphTraverse.cpp" />
|
||||
<ClCompile Include="timing\RestrictFragmentShaderTiming.cpp" />
|
||||
<ClCompile Include="timing\RestrictVertexShaderTiming.cpp" />
|
||||
<ClCompile Include="..\third_party\compiler\ArrayBoundsClamper.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="glslang.l">
|
||||
@ -226,7 +226,6 @@
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ArrayBoundsClamper.h" />
|
||||
<ClInclude Include="BaseTypes.h" />
|
||||
<ClInclude Include="BuiltInFunctionEmulator.h" />
|
||||
<ClInclude Include="Common.h" />
|
||||
@ -267,6 +266,7 @@
|
||||
<ClInclude Include="depgraph\DependencyGraph.h" />
|
||||
<ClInclude Include="depgraph\DependencyGraphBuilder.h" />
|
||||
<ClInclude Include="depgraph\DependencyGraphOutput.h" />
|
||||
<ClInclude Include="..\third_party\compiler\ArrayBoundsClamper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="preprocessor\preprocessor.vcxproj">
|
||||
|
@ -31,6 +31,12 @@
|
||||
#define ANGLE_ENABLE_D3D9EX 1
|
||||
#endif // !defined(ANGLE_ENABLE_D3D9EX)
|
||||
|
||||
#define ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES \
|
||||
{ \
|
||||
TEXT("d3dcompiler_46.dll"), \
|
||||
TEXT("d3dcompiler_43.dll") \
|
||||
}
|
||||
|
||||
namespace egl
|
||||
{
|
||||
namespace
|
||||
@ -477,6 +483,10 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
|
||||
|
||||
bool Display::createDevice()
|
||||
{
|
||||
if (!isInitialized())
|
||||
{
|
||||
return error(EGL_NOT_INITIALIZED, false);
|
||||
}
|
||||
D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
|
||||
DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
|
||||
|
||||
@ -908,16 +918,18 @@ D3DADAPTER_IDENTIFIER9 *Display::getAdapterIdentifier()
|
||||
|
||||
bool Display::testDeviceLost()
|
||||
{
|
||||
bool isLost = false;
|
||||
|
||||
if (mDeviceEx)
|
||||
{
|
||||
return FAILED(mDeviceEx->CheckDeviceState(NULL));
|
||||
isLost = FAILED(mDeviceEx->CheckDeviceState(NULL));
|
||||
}
|
||||
else if (mDevice)
|
||||
{
|
||||
return FAILED(mDevice->TestCooperativeLevel());
|
||||
isLost = FAILED(mDevice->TestCooperativeLevel());
|
||||
}
|
||||
|
||||
return false; // No device yet, so no reset required
|
||||
return isLost;
|
||||
}
|
||||
|
||||
bool Display::testDeviceResettable()
|
||||
@ -1141,7 +1153,7 @@ float Display::getTextureFilterAnisotropySupport() const
|
||||
// Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per the spec
|
||||
if ((mDeviceCaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) && (mDeviceCaps.MaxAnisotropy >= 2))
|
||||
{
|
||||
return mDeviceCaps.MaxAnisotropy;
|
||||
return static_cast<float>(mDeviceCaps.MaxAnisotropy);
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
@ -11,12 +11,9 @@
|
||||
#ifndef LIBEGL_DISPLAY_H_
|
||||
#define LIBEGL_DISPLAY_H_
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include "common/system.h"
|
||||
#include <d3d9.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <D3Dcompiler.h>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# 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.
|
||||
@ -21,6 +20,11 @@ STL_FLAGS =
|
||||
# support
|
||||
ENABLE_CXX_EXCEPTIONS = 1
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
# Enable unwind semantics for exception handlers in response to warning C4530.
|
||||
OS_CPPFLAGS += -EHsc
|
||||
endif
|
||||
|
||||
# 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.
|
||||
@ -30,7 +34,7 @@ OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS)
|
||||
DEFINES += -DANGLE_BUILD -DNOMINMAX -DLIBEGL_EXPORTS -D_CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
DEFINES += -DANGLE_DISABLE_TRACE
|
||||
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0
|
||||
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1
|
||||
|
||||
ifndef MOZ_DEBUG
|
||||
DEFINES += -D_SECURE_SCL=0
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include "libEGL/main.h"
|
||||
#include "libEGL/Display.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
|
||||
namespace egl
|
||||
{
|
||||
|
||||
@ -78,24 +76,6 @@ bool Surface::initialize()
|
||||
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 && (getComparableOSVersion() >= versionWindowsVista)) {
|
||||
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: 0x%08X", result);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -343,6 +323,38 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Surface::recreateAdditionalSwapChain()
|
||||
{
|
||||
if (!mSwapChain)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IDirect3DDevice9 *device = mDisplay->getDevice();
|
||||
if (device == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
D3DPRESENT_PARAMETERS presentParameters;
|
||||
HRESULT result = mSwapChain->GetPresentParameters(&presentParameters);
|
||||
ASSERT(SUCCEEDED(result));
|
||||
|
||||
IDirect3DSwapChain9* newSwapChain = NULL;
|
||||
result = device->CreateAdditionalSwapChain(&presentParameters, &newSwapChain);
|
||||
if (FAILED(result))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mSwapChain->Release();
|
||||
mSwapChain = newSwapChain;
|
||||
|
||||
mBackBuffer->Release();
|
||||
result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
|
||||
ASSERT(SUCCEEDED(result));
|
||||
}
|
||||
|
||||
bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
|
||||
{
|
||||
if (!mSwapChain)
|
||||
|
@ -64,6 +64,8 @@ class Surface
|
||||
virtual void setBoundTexture(gl::Texture2D *texture);
|
||||
virtual gl::Texture2D *getBoundTexture() const;
|
||||
|
||||
void recreateAdditionalSwapChain();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(Surface);
|
||||
|
||||
|
@ -93,9 +93,9 @@
|
||||
<DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>dwmapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
@ -127,9 +127,9 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
|
||||
<DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>dwmapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
@ -167,9 +167,9 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>dwmapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
@ -204,9 +204,9 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>dwmapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "libGLESv2/Context.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "libEGL/Display.h"
|
||||
|
||||
@ -35,6 +36,16 @@
|
||||
|
||||
namespace gl
|
||||
{
|
||||
static const char* makeStaticString(const std::string& str)
|
||||
{
|
||||
static std::set<std::string> strings;
|
||||
std::set<std::string>::iterator it = strings.find(str);
|
||||
if (it != strings.end())
|
||||
return it->c_str();
|
||||
|
||||
return strings.insert(str).first->c_str();
|
||||
}
|
||||
|
||||
Context::Context(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess) : mConfig(config)
|
||||
{
|
||||
ASSERT(robustAccess == false); // Unimplemented
|
||||
@ -147,6 +158,9 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext, boo
|
||||
mState.unpackAlignment = 4;
|
||||
mState.packReverseRowOrder = false;
|
||||
|
||||
mExtensionString = NULL;
|
||||
mRendererString = NULL;
|
||||
|
||||
mVertexDataManager = NULL;
|
||||
mIndexDataManager = NULL;
|
||||
mBlit = NULL;
|
||||
@ -317,7 +331,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
|
||||
mSupportsLuminanceAlphaTextures = mDisplay->getLuminanceAlphaTextureSupport();
|
||||
mSupportsDepthTextures = mDisplay->getDepthTextureSupport();
|
||||
mSupportsTextureFilterAnisotropy = mMaxTextureAnisotropy >= 2.0f;
|
||||
|
||||
mSupportsDerivativeInstructions = (mDeviceCaps.PS20Caps.Caps & D3DPS20CAPS_GRADIENTINSTRUCTIONS) != 0;
|
||||
mSupports32bitIndices = mDeviceCaps.MaxVertexIndex >= (1 << 16);
|
||||
|
||||
mNumCompressedTextureFormats = 0;
|
||||
@ -2665,6 +2679,21 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
(rect.right - rect.left) * fastPixelSize);
|
||||
continue;
|
||||
}
|
||||
else if (desc.Format == D3DFMT_A8R8G8B8 &&
|
||||
format == GL_RGBA &&
|
||||
type == GL_UNSIGNED_BYTE)
|
||||
{
|
||||
// Fast path for swapping red with blue
|
||||
for (int i = 0; i < rect.right - rect.left; i++)
|
||||
{
|
||||
unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
|
||||
*(unsigned int*)(dest + 4 * i + j * outputPitch) =
|
||||
(argb & 0xFF00FF00) | // Keep alpha and green
|
||||
(argb & 0x00FF0000) >> 16 | // Move red to blue
|
||||
(argb & 0x000000FF) << 16; // Move blue to red
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rect.right - rect.left; i++)
|
||||
{
|
||||
@ -3621,6 +3650,11 @@ bool Context::supportsTextureFilterAnisotropy() const
|
||||
return mSupportsTextureFilterAnisotropy;
|
||||
}
|
||||
|
||||
bool Context::supportsDerivativeInstructions() const
|
||||
{
|
||||
return mSupportsDerivativeInstructions;
|
||||
}
|
||||
|
||||
float Context::getTextureMaxAnisotropy() const
|
||||
{
|
||||
return mMaxTextureAnisotropy;
|
||||
@ -3872,124 +3906,144 @@ void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
|
||||
// Vendor extensions
|
||||
void Context::initExtensionString()
|
||||
{
|
||||
mExtensionString = "";
|
||||
std::string extensionString = "";
|
||||
|
||||
// OES extensions
|
||||
if (supports32bitIndices())
|
||||
{
|
||||
mExtensionString += "GL_OES_element_index_uint ";
|
||||
extensionString += "GL_OES_element_index_uint ";
|
||||
}
|
||||
|
||||
mExtensionString += "GL_OES_packed_depth_stencil ";
|
||||
mExtensionString += "GL_OES_get_program_binary ";
|
||||
mExtensionString += "GL_OES_rgb8_rgba8 ";
|
||||
mExtensionString += "GL_OES_standard_derivatives ";
|
||||
extensionString += "GL_OES_packed_depth_stencil ";
|
||||
extensionString += "GL_OES_get_program_binary ";
|
||||
extensionString += "GL_OES_rgb8_rgba8 ";
|
||||
if (supportsDerivativeInstructions())
|
||||
{
|
||||
extensionString += "GL_OES_standard_derivatives ";
|
||||
}
|
||||
|
||||
if (supportsFloat16Textures())
|
||||
{
|
||||
mExtensionString += "GL_OES_texture_half_float ";
|
||||
extensionString += "GL_OES_texture_half_float ";
|
||||
}
|
||||
if (supportsFloat16LinearFilter())
|
||||
{
|
||||
mExtensionString += "GL_OES_texture_half_float_linear ";
|
||||
extensionString += "GL_OES_texture_half_float_linear ";
|
||||
}
|
||||
if (supportsFloat32Textures())
|
||||
{
|
||||
mExtensionString += "GL_OES_texture_float ";
|
||||
extensionString += "GL_OES_texture_float ";
|
||||
}
|
||||
if (supportsFloat32LinearFilter())
|
||||
{
|
||||
mExtensionString += "GL_OES_texture_float_linear ";
|
||||
extensionString += "GL_OES_texture_float_linear ";
|
||||
}
|
||||
|
||||
if (supportsNonPower2Texture())
|
||||
{
|
||||
mExtensionString += "GL_OES_texture_npot ";
|
||||
extensionString += "GL_OES_texture_npot ";
|
||||
}
|
||||
|
||||
// Multi-vendor (EXT) extensions
|
||||
if (supportsOcclusionQueries())
|
||||
{
|
||||
mExtensionString += "GL_EXT_occlusion_query_boolean ";
|
||||
extensionString += "GL_EXT_occlusion_query_boolean ";
|
||||
}
|
||||
|
||||
mExtensionString += "GL_EXT_read_format_bgra ";
|
||||
mExtensionString += "GL_EXT_robustness ";
|
||||
extensionString += "GL_EXT_read_format_bgra ";
|
||||
extensionString += "GL_EXT_robustness ";
|
||||
|
||||
if (supportsDXT1Textures())
|
||||
{
|
||||
mExtensionString += "GL_EXT_texture_compression_dxt1 ";
|
||||
extensionString += "GL_EXT_texture_compression_dxt1 ";
|
||||
}
|
||||
|
||||
if (supportsTextureFilterAnisotropy())
|
||||
{
|
||||
mExtensionString += "GL_EXT_texture_filter_anisotropic ";
|
||||
extensionString += "GL_EXT_texture_filter_anisotropic ";
|
||||
}
|
||||
|
||||
mExtensionString += "GL_EXT_texture_format_BGRA8888 ";
|
||||
mExtensionString += "GL_EXT_texture_storage ";
|
||||
extensionString += "GL_EXT_texture_format_BGRA8888 ";
|
||||
extensionString += "GL_EXT_texture_storage ";
|
||||
|
||||
// ANGLE-specific extensions
|
||||
if (supportsDepthTextures())
|
||||
{
|
||||
mExtensionString += "GL_ANGLE_depth_texture ";
|
||||
extensionString += "GL_ANGLE_depth_texture ";
|
||||
}
|
||||
|
||||
mExtensionString += "GL_ANGLE_framebuffer_blit ";
|
||||
extensionString += "GL_ANGLE_framebuffer_blit ";
|
||||
if (getMaxSupportedSamples() != 0)
|
||||
{
|
||||
mExtensionString += "GL_ANGLE_framebuffer_multisample ";
|
||||
extensionString += "GL_ANGLE_framebuffer_multisample ";
|
||||
}
|
||||
|
||||
if (supportsInstancing())
|
||||
{
|
||||
mExtensionString += "GL_ANGLE_instanced_arrays ";
|
||||
extensionString += "GL_ANGLE_instanced_arrays ";
|
||||
}
|
||||
|
||||
mExtensionString += "GL_ANGLE_pack_reverse_row_order ";
|
||||
extensionString += "GL_ANGLE_pack_reverse_row_order ";
|
||||
|
||||
if (supportsDXT3Textures())
|
||||
{
|
||||
mExtensionString += "GL_ANGLE_texture_compression_dxt3 ";
|
||||
extensionString += "GL_ANGLE_texture_compression_dxt3 ";
|
||||
}
|
||||
if (supportsDXT5Textures())
|
||||
{
|
||||
mExtensionString += "GL_ANGLE_texture_compression_dxt5 ";
|
||||
extensionString += "GL_ANGLE_texture_compression_dxt5 ";
|
||||
}
|
||||
|
||||
mExtensionString += "GL_ANGLE_texture_usage ";
|
||||
mExtensionString += "GL_ANGLE_translated_shader_source ";
|
||||
extensionString += "GL_ANGLE_texture_usage ";
|
||||
extensionString += "GL_ANGLE_translated_shader_source ";
|
||||
|
||||
// Other vendor-specific extensions
|
||||
if (supportsEventQueries())
|
||||
{
|
||||
mExtensionString += "GL_NV_fence ";
|
||||
extensionString += "GL_NV_fence ";
|
||||
}
|
||||
|
||||
std::string::size_type end = mExtensionString.find_last_not_of(' ');
|
||||
std::string::size_type end = extensionString.find_last_not_of(' ');
|
||||
if (end != std::string::npos)
|
||||
{
|
||||
mExtensionString.resize(end+1);
|
||||
extensionString.resize(end+1);
|
||||
}
|
||||
|
||||
mExtensionString = makeStaticString(extensionString);
|
||||
}
|
||||
|
||||
const char *Context::getExtensionString() const
|
||||
{
|
||||
return mExtensionString.c_str();
|
||||
return mExtensionString;
|
||||
}
|
||||
|
||||
void Context::initRendererString()
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 *identifier = mDisplay->getAdapterIdentifier();
|
||||
|
||||
mRendererString = "ANGLE (";
|
||||
mRendererString += identifier->Description;
|
||||
mRendererString += ")";
|
||||
std::ostringstream rendererString;
|
||||
rendererString << "ANGLE (";
|
||||
|
||||
rendererString << identifier->Description;
|
||||
|
||||
if (mDisplay->isD3d9ExDevice())
|
||||
{
|
||||
rendererString << " Direct3D9Ex";
|
||||
}
|
||||
else
|
||||
{
|
||||
rendererString << " Direct3D9";
|
||||
}
|
||||
|
||||
rendererString << " vs_" << D3DSHADER_VERSION_MAJOR(mDeviceCaps.VertexShaderVersion) << "_" << D3DSHADER_VERSION_MINOR(mDeviceCaps.VertexShaderVersion);
|
||||
rendererString << " ps_" << D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion) << "_" << D3DSHADER_VERSION_MINOR(mDeviceCaps.PixelShaderVersion) << ")";
|
||||
|
||||
mRendererString = makeStaticString(rendererString.str());
|
||||
}
|
||||
|
||||
const char *Context::getRendererString() const
|
||||
{
|
||||
return mRendererString.c_str();
|
||||
return mRendererString;
|
||||
}
|
||||
|
||||
void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||
|
@ -509,6 +509,7 @@ class Context
|
||||
bool supportsNonPower2Texture() const;
|
||||
bool supportsInstancing() const;
|
||||
bool supportsTextureFilterAnisotropy() const;
|
||||
bool supportsDerivativeInstructions() const;
|
||||
|
||||
bool getCurrentReadFormatType(GLenum *format, GLenum *type);
|
||||
|
||||
@ -575,8 +576,8 @@ class Context
|
||||
QueryMap mQueryMap;
|
||||
HandleAllocator mQueryHandleAllocator;
|
||||
|
||||
std::string mExtensionString;
|
||||
std::string mRendererString;
|
||||
const char *mExtensionString;
|
||||
const char *mRendererString;
|
||||
|
||||
VertexDataManager *mVertexDataManager;
|
||||
IndexDataManager *mIndexDataManager;
|
||||
@ -645,6 +646,7 @@ class Context
|
||||
bool mSupportsDepthTextures;
|
||||
bool mSupports32bitIndices;
|
||||
bool mSupportsTextureFilterAnisotropy;
|
||||
bool mSupportsDerivativeInstructions;
|
||||
int mNumCompressedTextureFormats;
|
||||
|
||||
// state caching flags
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
#include "libGLESv2/D3DConstantTable.h"
|
||||
|
||||
#include "common/system.h"
|
||||
#include <d3d9.h>
|
||||
#include <d3d9types.h>
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#include "libGLESv2/BinaryStream.h"
|
||||
|
@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# 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.
|
||||
@ -22,8 +21,13 @@ STL_FLAGS =
|
||||
# support
|
||||
ENABLE_CXX_EXCEPTIONS = 1
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
# Enable unwind semantics for exception handlers in response to warning C4530.
|
||||
OS_CPPFLAGS += -EHsc
|
||||
endif
|
||||
|
||||
# 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)
|
||||
@ -36,15 +40,16 @@ endif
|
||||
|
||||
# The below is a rough translation of build_angle.gypi,
|
||||
# copied from src/Makefile.in.
|
||||
|
||||
DEFINES += -DANGLE_DISABLE_TRACE
|
||||
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0
|
||||
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1
|
||||
|
||||
# Target: 'preprocessor'
|
||||
# src/compiler/preprocessor:
|
||||
VPATH += $(srcdir)/../compiler/preprocessor
|
||||
CPPSRCS += \
|
||||
PreprocessorDiagnostics.cpp \
|
||||
PreprocessorDirectiveHandler.cpp \
|
||||
DiagnosticsBase.cpp \
|
||||
DirectiveHandlerBase.cpp \
|
||||
DirectiveParser.cpp \
|
||||
ExpressionParser.cpp \
|
||||
Input.cpp \
|
||||
@ -58,7 +63,7 @@ CPPSRCS += \
|
||||
|
||||
# Target: 'translator_common'
|
||||
# Requires: 'preprocessor'
|
||||
LOCAL_INCLUDES = \
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../include \
|
||||
-I$(srcdir)/../../include/KHR \
|
||||
-I$(srcdir)/..
|
||||
@ -68,7 +73,6 @@ DEFINES += -DCOMPILER_IMPLEMENTATION
|
||||
VPATH += $(srcdir)/../compiler
|
||||
# src/compiler:
|
||||
CPPSRCS += \
|
||||
ArrayBoundsClamper.cpp \
|
||||
BuiltInFunctionEmulator.cpp \
|
||||
Compiler.cpp \
|
||||
compiler_debug.cpp \
|
||||
@ -115,6 +119,12 @@ CPPSRCS += \
|
||||
RestrictVertexShaderTiming.cpp \
|
||||
$(NULL)
|
||||
|
||||
VPATH += $(srcdir)/../third_party/compiler
|
||||
# src/third_party/compiler:
|
||||
CPPSRCS += \
|
||||
ArrayBoundsClamper.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
CPPSRCS += ossource_win.cpp
|
||||
else
|
||||
@ -188,15 +198,9 @@ TextureSSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
|
||||
|
||||
OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
|
||||
OS_LIBS += -ld3d9
|
||||
ifdef MOZ_D3DX9_VERSION
|
||||
OS_LIBS += -ld3dcompiler_$(MOZ_D3DX9_VERSION)
|
||||
else
|
||||
OS_LIBS += -ld3dcompiler
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
|
||||
"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/D3DCompiler.lib"
|
||||
EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib"
|
||||
|
||||
endif
|
||||
|
@ -1648,7 +1648,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
|
||||
|
||||
int version = 0;
|
||||
stream.read(&version);
|
||||
if (version != BUILD_REVISION)
|
||||
if (version != VERSION_DWORD)
|
||||
{
|
||||
infoLog.append("Invalid program binary version.");
|
||||
return false;
|
||||
@ -1687,7 +1687,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
|
||||
stream.read(&mUsedPixelSamplerRange);
|
||||
stream.read(&mUsesPointSize);
|
||||
|
||||
unsigned int size;
|
||||
size_t size;
|
||||
stream.read(&size);
|
||||
if (stream.error())
|
||||
{
|
||||
@ -1789,7 +1789,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
|
||||
BinaryOutputStream stream;
|
||||
|
||||
stream.write(GL_PROGRAM_BINARY_ANGLE);
|
||||
stream.write(BUILD_REVISION);
|
||||
stream.write(VERSION_DWORD);
|
||||
|
||||
for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
|
||||
{
|
||||
|
@ -235,8 +235,9 @@ void Shader::initializeCompiler()
|
||||
resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
|
||||
resources.MaxFragmentUniformVectors = context->getMaximumFragmentUniformVectors();
|
||||
resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
|
||||
resources.OES_standard_derivatives = 1;
|
||||
resources.OES_standard_derivatives = context->supportsDerivativeInstructions() ? 1 : 0;
|
||||
// resources.OES_EGL_image_external = getDisplay()->isD3d9ExDevice() ? 1 : 0; // TODO: commented out until the extension is actually supported.
|
||||
resources.FragmentPrecisionHigh = 1; // Shader Model 2+ always supports FP24 (s16e7) which corresponds to highp
|
||||
|
||||
mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources);
|
||||
mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources);
|
||||
@ -351,14 +352,14 @@ void Shader::compileToHLSL(void *compiler)
|
||||
|
||||
if (result)
|
||||
{
|
||||
int objCodeLen = 0;
|
||||
size_t objCodeLen = 0;
|
||||
ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
|
||||
mHlsl = new char[objCodeLen];
|
||||
ShGetObjectCode(compiler, mHlsl);
|
||||
}
|
||||
else
|
||||
{
|
||||
int infoLogLen = 0;
|
||||
size_t infoLogLen = 0;
|
||||
ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
|
||||
mInfoLog = new char[infoLogLen];
|
||||
ShGetInfoLog(compiler, mInfoLog);
|
||||
|
@ -11,7 +11,8 @@
|
||||
|
||||
#include <intrin.h>
|
||||
#include <math.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user