2011-06-20 Zhenyao Mo <zmo@google.com>
authorzmo@google.com <zmo@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Jun 2011 02:23:19 +0000 (02:23 +0000)
committerzmo@google.com <zmo@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Jun 2011 02:23:19 +0000 (02:23 +0000)
        Reviewed by Kenneth Russell.

        Update ANGLE to r696.
        https://bugs.webkit.org/show_bug.cgi?id=56396

        * platform/graphics/ANGLEWebKitBridge.cpp:
        (WebCore::ANGLEWebKitBridge::validateShaderSource): Specify backend.
2011-06-20  Zhenyao Mo  <zmo@google.com>

        Reviewed by Kenneth Russell.

        Update ANGLE to r696
        https://bugs.webkit.org/show_bug.cgi?id=56396

        * ANGLE.xcodeproj/project.pbxproj:
        * include/EGL/eglext.h:
        * include/GLSLANG/ShaderLang.h:
        * src/build_angle.xcodeproj/project.pbxproj:
        * src/common/debug.cpp:
        (gl::output):
        (gl::trace):
        (gl::perfActive):
        (gl::ScopedPerfEventHelper::ScopedPerfEventHelper):
        (gl::ScopedPerfEventHelper::~ScopedPerfEventHelper):
        * src/common/debug.h:
        * src/common/version.h: Added.
        * src/compiler/CodeGenGLSL.cpp:
        (ConstructCompiler):
        * src/compiler/CodeGenHLSL.cpp:
        (ConstructCompiler):
        * src/compiler/Compiler.cpp:
        (TCompiler::compile):
        (TCompiler::mapLongVariableNames):
        (TCompiler::getMappedNameMaxLength):
        (TCompiler::getExtensionBehavior):
        * src/compiler/ConstantUnion.h:
        (ConstantUnion::operator==):
        (ConstantUnion::operator>):
        (ConstantUnion::operator<):
        * src/compiler/ExtensionBehavior.h:
        (getBehaviorString):
        * src/compiler/ForLoopUnroll.cpp: Added.
        (ForLoopUnroll::FillLoopIndexInfo):
        (ForLoopUnroll::Step):
        (ForLoopUnroll::SatisfiesLoopCondition):
        (ForLoopUnroll::NeedsToReplaceSymbolWithValue):
        (ForLoopUnroll::GetLoopIndexValue):
        (ForLoopUnroll::Push):
        (ForLoopUnroll::Pop):
        (ForLoopUnroll::getLoopIncrement):
        (ForLoopUnroll::evaluateIntConstant):
        * src/compiler/ForLoopUnroll.h: Added.
        (ForLoopUnroll::ForLoopUnroll):
        * src/compiler/Initialize.cpp:
        (BuiltInFunctionsVertex):
        * src/compiler/MapLongVariableNames.cpp: Added.
        (MapLongVariableNames::MapLongVariableNames):
        (MapLongVariableNames::visitSymbol):
        (MapLongVariableNames::visitConstantUnion):
        (MapLongVariableNames::visitBinary):
        (MapLongVariableNames::visitUnary):
        (MapLongVariableNames::visitSelection):
        (MapLongVariableNames::visitAggregate):
        (MapLongVariableNames::visitLoop):
        (MapLongVariableNames::visitBranch):
        (MapLongVariableNames::mapVaryingLongName):
        * src/compiler/MapLongVariableNames.h: Added.
        * src/compiler/OutputESSL.cpp: Added.
        (TOutputESSL::TOutputESSL):
        (TOutputESSL::writeVariablePrecision):
        * src/compiler/OutputESSL.h: Added.
        * src/compiler/OutputGLSL.cpp:
        (TOutputGLSL::TOutputGLSL):
        (TOutputGLSL::writeVariablePrecision):
        * src/compiler/OutputGLSL.h:
        * src/compiler/OutputGLSLBase.cpp: Added.
        (TOutputGLSLBase::TOutputGLSLBase):
        (TOutputGLSLBase::writeTriplet):
        (TOutputGLSLBase::writeVariableType):
        (TOutputGLSLBase::writeFunctionParameters):
        (TOutputGLSLBase::writeConstantUnion):
        (TOutputGLSLBase::visitSymbol):
        (TOutputGLSLBase::visitConstantUnion):
        (TOutputGLSLBase::visitBinary):
        (TOutputGLSLBase::visitUnary):
        (TOutputGLSLBase::visitSelection):
        (TOutputGLSLBase::visitAggregate):
        (TOutputGLSLBase::visitLoop):
        (TOutputGLSLBase::visitBranch):
        (TOutputGLSLBase::visitCodeBlock):
        * src/compiler/OutputGLSLBase.h: Added.
        (TOutputGLSLBase::objSink):
        * src/compiler/OutputHLSL.cpp:
        (sh::OutputHLSL::OutputHLSL):
        (sh::OutputHLSL::header):
        (sh::OutputHLSL::visitUnary):
        (sh::OutputHLSL::visitAggregate):
        (sh::OutputHLSL::visitSelection):
        (sh::OutputHLSL::visitLoop):
        (sh::OutputHLSL::visitBranch):
        (sh::OutputHLSL::handleExcessiveLoop):
        (sh::OutputHLSL::outputLineDirective):
        * src/compiler/OutputHLSL.h:
        * src/compiler/ParseHelper.cpp:
        (TParseContext::precisionErrorCheck):
        (TParseContext::constructorErrorCheck):
        (TParseContext::nonInitErrorCheck):
        * src/compiler/ParseHelper.h:
        (TParseContext::TParseContext):
        * src/compiler/ShHandle.h:
        * src/compiler/ShaderLang.cpp:
        (getVariableInfo):
        (ShConstructCompiler):
        (ShGetInfo):
        (ShGetActiveAttrib):
        (ShGetActiveUniform):
        * src/compiler/TranslatorESSL.cpp: Added.
        (TranslatorESSL::TranslatorESSL):
        (TranslatorESSL::translate):
        (TranslatorESSL::writeExtensionBehavior):
        * src/compiler/TranslatorESSL.h: Added.
        * src/compiler/ValidateLimitations.cpp:
        (ValidateLimitations::visitBinary):
        (ValidateLimitations::visitLoop):
        * src/compiler/ValidateLimitations.h:
        * src/compiler/VariableInfo.cpp:
        (getVariableInfo):
        (getBuiltInVariableInfo):
        (getUserDefinedVariableInfo):
        (CollectAttribsUniforms::visitAggregate):
        * src/compiler/VariableInfo.h:
        * src/compiler/VersionGLSL.cpp:
        (TVersionGLSL::visitSymbol):
        (TVersionGLSL::visitConstantUnion):
        (TVersionGLSL::visitBinary):
        (TVersionGLSL::visitUnary):
        (TVersionGLSL::visitSelection):
        (TVersionGLSL::visitAggregate):
        (TVersionGLSL::visitLoop):
        (TVersionGLSL::visitBranch):
        * src/compiler/VersionGLSL.h:
        * src/compiler/glslang.y:
        * src/compiler/glslang_tab.cpp:
        * src/compiler/glslang_tab.h:
        * src/compiler/intermediate.h:
        (TIntermLoop::TIntermLoop):
        (TIntermLoop::setUnrollFlag):
        (TIntermLoop::getUnrollFlag):
        (TIntermSymbol::TIntermSymbol):
        (TIntermSymbol::setId):
        (TIntermSymbol::setSymbol):
        (TIntermSymbol::getOriginalSymbol):
        (TIntermAggregate::TIntermAggregate):
        (TIntermAggregate::setEndLine):
        (TIntermAggregate::getEndLine):
        * src/compiler/preprocessor/atom.c:
        (AddString):
        * src/compiler/preprocessor/compile.h:
        * src/compiler/preprocessor/cpp.c:
        (CPPelse):
        (eval):
        (CPPif):
        (CPPifdef):
        (readCPPline):
        (ChkCorrectElseNesting):
        * src/compiler/preprocessor/cppstruct.c:
        (ResetPreprocessor):
        * src/compiler/preprocessor/scanner.c:
        (byte_scan):
        (yylex_CPP):
        * src/compiler/preprocessor/scanner.h:
        * src/libEGL/Config.cpp:
        (egl::Config::Config):
        (egl::Config::set):
        (egl::ConfigSet::add):
        (egl::ConfigSet::getConfigs):
        * src/libEGL/Config.h:
        * src/libEGL/Display.cpp:
        (egl::Display::Display):
        (egl::Display::initialize):
        (egl::Display::terminate):
        (egl::Display::getConfigAttrib):
        (egl::Display::createDevice):
        (egl::Display::createWindowSurface):
        (egl::Display::createOffscreenSurface):
        (egl::Display::createContext):
        (egl::Display::destroyContext):
        (egl::Display::isInitialized):
        (egl::Display::getAdapterIdentifier):
        (egl::Display::isDeviceLost):
        (egl::Display::getBufferPool):
        (egl::Display::initExtensionString):
        (egl::Display::getExtensionString):
        (egl::Display::getVertexTextureSupport):
        (egl::Display::getNonPower2TextureSupport):
        * src/libEGL/Display.h:
        (egl::Display::isD3d9ExDevice):
        * src/libEGL/Surface.cpp:
        (egl::Surface::Surface):
        (egl::Surface::initialize):
        (egl::Surface::release):
        (egl::Surface::resetSwapChain):
        (egl::SurfaceWindowProc):
        (egl::Surface::subclassWindow):
        (egl::Surface::unsubclassWindow):
        (egl::Surface::swap):
        (egl::Surface::getRenderTarget):
        (egl::Surface::getOffscreenTexture):
        (egl::Surface::getTextureFormat):
        (egl::Surface::getTextureTarget):
        (egl::Surface::setBoundTexture):
        (egl::Surface::getBoundTexture):
        (egl::Surface::getFormat):
        * src/libEGL/Surface.h:
        (egl::Surface::getShareHandle):
        * src/libEGL/libEGL.cpp:
        (validateDisplay):
        (validateConfig):
        (validateContext):
        (validateSurface):
        * src/libEGL/libEGL.rc: Added.
        * src/libEGL/libEGL.vcproj:
        * src/libEGL/main.cpp:
        (DllMain):
        * src/libEGL/main.h:
        * src/libEGL/resource.h: Added.
        * src/libGLESv2/Blit.cpp:
        (gl::Blit::initGeometry):
        (gl::Blit::copy):
        * src/libGLESv2/Blit.h:
        * src/libGLESv2/Buffer.cpp:
        (gl::Buffer::Buffer):
        (gl::Buffer::~Buffer):
        (gl::Buffer::bufferData):
        (gl::Buffer::bufferSubData):
        (gl::Buffer::getStaticVertexBuffer):
        (gl::Buffer::getStaticIndexBuffer):
        (gl::Buffer::invalidateStaticData):
        (gl::Buffer::promoteStaticUsage):
        * src/libGLESv2/Buffer.h:
        * src/libGLESv2/Context.cpp:
        (gl::Context::Context):
        (gl::Context::~Context):
        (gl::Context::makeCurrent):
        (gl::Context::markAllStateDirty):
        (gl::Context::setActiveSampler):
        (gl::Context::createFramebuffer):
        (gl::Context::createFence):
        (gl::Context::deleteFramebuffer):
        (gl::Context::deleteFence):
        (gl::Context::bindTexture2D):
        (gl::Context::bindTextureCubeMap):
        (gl::Context::getTexture2D):
        (gl::Context::getTextureCubeMap):
        (gl::Context::getSamplerTexture):
        (gl::Context::getIntegerv):
        (gl::Context::applyRenderTarget):
        (gl::Context::applyState):
        (gl::Context::applyVertexBuffer):
        (gl::Context::applyShaders):
        (gl::Context::applyTextures):
        (gl::Context::readPixels):
        (gl::Context::clear):
        (gl::Context::drawArrays):
        (gl::Context::drawElements):
        (gl::Context::finish):
        (gl::Context::flush):
        (gl::Context::drawClosingLine):
        (gl::Context::getMaximumVertexTextureImageUnits):
        (gl::Context::getMaximumCombinedTextureImageUnits):
        (gl::Context::supportsNonPower2Texture):
        (gl::Context::detachTexture):
        (gl::Context::getIncompleteTexture):
        (gl::Context::initExtensionString):
        (gl::Context::blitFramebuffer):
        (gl::VertexDeclarationCache::VertexDeclarationCache):
        (gl::VertexDeclarationCache::~VertexDeclarationCache):
        (gl::VertexDeclarationCache::applyDeclaration):
        * src/libGLESv2/Context.h:
        * src/libGLESv2/Framebuffer.cpp:
        (gl::Framebuffer::lookupRenderbuffer):
        (gl::Framebuffer::completeness):
        * src/libGLESv2/Framebuffer.h:
        * src/libGLESv2/HandleAllocator.cpp: Added.
        (gl::HandleAllocator::HandleAllocator):
        (gl::HandleAllocator::~HandleAllocator):
        (gl::HandleAllocator::setBaseHandle):
        (gl::HandleAllocator::allocate):
        (gl::HandleAllocator::release):
        * src/libGLESv2/HandleAllocator.h: Added.
        * src/libGLESv2/IndexDataManager.cpp: Added.
        (gl::IndexDataManager::IndexDataManager):
        (gl::IndexDataManager::~IndexDataManager):
        (gl::convertIndices):
        (gl::computeRange):
        (gl::IndexDataManager::prepareIndexData):
        (gl::IndexDataManager::indexSize):
        (gl::IndexDataManager::typeSize):
        (gl::IndexBuffer::IndexBuffer):
        (gl::IndexBuffer::~IndexBuffer):
        (gl::IndexBuffer::getBuffer):
        (gl::IndexBuffer::unmap):
        (gl::StreamingIndexBuffer::StreamingIndexBuffer):
        (gl::StreamingIndexBuffer::~StreamingIndexBuffer):
        (gl::StreamingIndexBuffer::map):
        (gl::StreamingIndexBuffer::reserveSpace):
        (gl::StaticIndexBuffer::StaticIndexBuffer):
        (gl::StaticIndexBuffer::~StaticIndexBuffer):
        (gl::StaticIndexBuffer::map):
        (gl::StaticIndexBuffer::reserveSpace):
        (gl::StaticIndexBuffer::lookupType):
        (gl::StaticIndexBuffer::lookupRange):
        (gl::StaticIndexBuffer::addRange):
        * src/libGLESv2/IndexDataManager.h: Added.
        (gl::IndexBuffer::size):
        * src/libGLESv2/Program.cpp:
        (gl::Program::getSemanticIndex):
        (gl::Program::getSamplerMapping):
        (gl::Program::getSamplerTextureType):
        (gl::Program::compileToBinary):
        (gl::Program::packVaryings):
        (gl::Program::linkVaryings):
        (gl::Program::link):
        (gl::Program::linkUniforms):
        (gl::Program::defineUniform):
        (gl::Program::applyUniform1iv):
        (gl::Program::appendToInfoLogSanitized):
        (gl::Program::unlink):
        (gl::Program::getActiveUniformMaxLength):
        (gl::Program::validate):
        (gl::Program::validateSamplers):
        * src/libGLESv2/Program.h:
        * src/libGLESv2/Renderbuffer.cpp:
        (gl::Renderbuffer::getWidth):
        (gl::Renderbuffer::getHeight):
        (gl::Renderbuffer::getInternalFormat):
        (gl::Renderbuffer::getRedSize):
        (gl::Renderbuffer::getGreenSize):
        (gl::Renderbuffer::getBlueSize):
        (gl::Renderbuffer::getAlphaSize):
        (gl::Renderbuffer::getDepthSize):
        (gl::Renderbuffer::getStencilSize):
        (gl::Renderbuffer::getSamples):
        (gl::RenderbufferStorage::RenderbufferStorage):
        (gl::RenderbufferStorage::getWidth):
        (gl::RenderbufferStorage::getHeight):
        (gl::RenderbufferStorage::getInternalFormat):
        (gl::RenderbufferStorage::getRedSize):
        (gl::RenderbufferStorage::getGreenSize):
        (gl::RenderbufferStorage::getBlueSize):
        (gl::RenderbufferStorage::getAlphaSize):
        (gl::RenderbufferStorage::getDepthSize):
        (gl::RenderbufferStorage::getStencilSize):
        (gl::RenderbufferStorage::getD3DFormat):
        (gl::Colorbuffer::Colorbuffer):
        (gl::Colorbuffer::getWidth):
        (gl::Colorbuffer::getHeight):
        (gl::Colorbuffer::getInternalFormat):
        (gl::Colorbuffer::getType):
        (gl::Colorbuffer::getD3DFormat):
        (gl::Colorbuffer::isColorbuffer):
        (gl::Colorbuffer::getRenderTarget):
        (gl::DepthStencilbuffer::DepthStencilbuffer):
        (gl::Depthbuffer::Depthbuffer):
        (gl::Stencilbuffer::Stencilbuffer):
        * src/libGLESv2/Renderbuffer.h:
        * src/libGLESv2/ResourceManager.cpp:
        (gl::ResourceManager::createBuffer):
        (gl::ResourceManager::createShader):
        (gl::ResourceManager::createProgram):
        (gl::ResourceManager::createTexture):
        (gl::ResourceManager::createRenderbuffer):
        (gl::ResourceManager::deleteBuffer):
        (gl::ResourceManager::deleteShader):
        (gl::ResourceManager::deleteProgram):
        (gl::ResourceManager::deleteTexture):
        (gl::ResourceManager::deleteRenderbuffer):
        (gl::ResourceManager::checkTextureAllocation):
        * src/libGLESv2/ResourceManager.h:
        * src/libGLESv2/Shader.cpp:
        (gl::Shader::Shader):
        (gl::Shader::compileToHLSL):
        * src/libGLESv2/Shader.h:
        * src/libGLESv2/Texture.cpp:
        (gl::Texture::Image::Image):
        (gl::Texture::Image::~Image):
        (gl::Texture::Image::isRenderable):
        (gl::Texture::Image::getD3DFormat):
        (gl::Texture::Texture):
        (gl::Texture::setMinFilter):
        (gl::Texture::setMagFilter):
        (gl::Texture::setWrapS):
        (gl::Texture::setWrapT):
        (gl::Texture::loadImageData):
        (gl::Texture::loadAlphaImageData):
        (gl::Texture::loadAlphaFloatImageData):
        (gl::Texture::loadAlphaHalfFloatImageData):
        (gl::Texture::loadLuminanceImageData):
        (gl::Texture::loadLuminanceFloatImageData):
        (gl::Texture::loadLuminanceHalfFloatImageData):
        (gl::Texture::loadLuminanceAlphaImageData):
        (gl::Texture::loadLuminanceAlphaFloatImageData):
        (gl::Texture::loadLuminanceAlphaHalfFloatImageData):
        (gl::Texture::loadRGBUByteImageData):
        (gl::Texture::loadRGB565ImageData):
        (gl::Texture::loadRGBFloatImageData):
        (gl::Texture::loadRGBHalfFloatImageData):
        (gl::Texture::loadRGBAUByteImageDataSSE2):
        (gl::Texture::loadRGBAUByteImageData):
        (gl::Texture::loadRGBA4444ImageData):
        (gl::Texture::loadRGBA5551ImageData):
        (gl::Texture::loadRGBAFloatImageData):
        (gl::Texture::loadRGBAHalfFloatImageData):
        (gl::Texture::loadBGRAImageData):
        (gl::Texture::loadCompressedImageData):
        (gl::Texture::createSurface):
        (gl::Texture::setImage):
        (gl::Texture::setCompressedImage):
        (gl::Texture::subImage):
        (gl::Texture::subImageCompressed):
        (gl::Texture::copyToImage):
        (gl::Texture::getTexture):
        (gl::Texture::isDirtyParameter):
        (gl::Texture::isDirtyImage):
        (gl::Texture::resetDirty):
        (gl::Texture::getSerial):
        (gl::Texture::creationLevels):
        (gl::Texture::levelCount):
        (gl::Texture::issueSerial):
        (gl::Texture2D::Texture2D):
        (gl::Texture2D::~Texture2D):
        (gl::Texture2D::getWidth):
        (gl::Texture2D::getHeight):
        (gl::Texture2D::getInternalFormat):
        (gl::Texture2D::getType):
        (gl::Texture2D::getD3DFormat):
        (gl::Texture2D::redefineTexture):
        (gl::Texture2D::setImage):
        (gl::Texture2D::bindTexImage):
        (gl::Texture2D::releaseTexImage):
        (gl::Texture2D::setCompressedImage):
        (gl::Texture2D::commitRect):
        (gl::Texture2D::copyImage):
        (gl::Texture2D::copySubImage):
        (gl::Texture2D::isComplete):
        (gl::Texture2D::isCompressed):
        (gl::Texture2D::getBaseTexture):
        (gl::Texture2D::createTexture):
        (gl::Texture2D::updateTexture):
        (gl::Texture2D::convertToRenderTarget):
        (gl::Texture2D::generateMipmaps):
        (gl::Texture2D::getRenderbuffer):
        (gl::Texture2D::getRenderTarget):
        (gl::TextureCubeMap::getWidth):
        (gl::TextureCubeMap::getHeight):
        (gl::TextureCubeMap::getInternalFormat):
        (gl::TextureCubeMap::getType):
        (gl::TextureCubeMap::getD3DFormat):
        (gl::TextureCubeMap::setImagePosX):
        (gl::TextureCubeMap::setImageNegX):
        (gl::TextureCubeMap::setImagePosY):
        (gl::TextureCubeMap::setImageNegY):
        (gl::TextureCubeMap::setImagePosZ):
        (gl::TextureCubeMap::setImageNegZ):
        (gl::TextureCubeMap::setCompressedImage):
        (gl::TextureCubeMap::commitRect):
        (gl::TextureCubeMap::isComplete):
        (gl::TextureCubeMap::isCompressed):
        (gl::TextureCubeMap::getBaseTexture):
        (gl::TextureCubeMap::createTexture):
        (gl::TextureCubeMap::updateTexture):
        (gl::TextureCubeMap::convertToRenderTarget):
        (gl::TextureCubeMap::setImage):
        (gl::TextureCubeMap::redefineTexture):
        (gl::TextureCubeMap::copyImage):
        (gl::TextureCubeMap::getCubeMapSurface):
        (gl::TextureCubeMap::copySubImage):
        (gl::TextureCubeMap::generateMipmaps):
        (gl::TextureCubeMap::getRenderbuffer):
        (gl::TextureCubeMap::getRenderTarget):
        * src/libGLESv2/Texture.h:
        * src/libGLESv2/VertexDataManager.cpp: Added.
        (gl::VertexDataManager::VertexDataManager):
        (gl::VertexDataManager::~VertexDataManager):
        (gl::VertexDataManager::writeAttributeData):
        (gl::VertexDataManager::prepareVertexData):
        (gl::VertexDataManager::spaceRequired):
        (gl::VertexDataManager::checkVertexCaps):
        (gl::VertexDataManager::typeIndex):
        (gl::VertexBuffer::VertexBuffer):
        (gl::VertexBuffer::~VertexBuffer):
        (gl::VertexBuffer::unmap):
        (gl::VertexBuffer::getBuffer):
        (gl::ConstantVertexBuffer::ConstantVertexBuffer):
        (gl::ConstantVertexBuffer::~ConstantVertexBuffer):
        (gl::ArrayVertexBuffer::ArrayVertexBuffer):
        (gl::ArrayVertexBuffer::~ArrayVertexBuffer):
        (gl::ArrayVertexBuffer::addRequiredSpace):
        (gl::ArrayVertexBuffer::addRequiredSpaceFor):
        (gl::StreamingVertexBuffer::StreamingVertexBuffer):
        (gl::StreamingVertexBuffer::~StreamingVertexBuffer):
        (gl::StreamingVertexBuffer::map):
        (gl::StreamingVertexBuffer::reserveRequiredSpace):
        (gl::StaticVertexBuffer::StaticVertexBuffer):
        (gl::StaticVertexBuffer::~StaticVertexBuffer):
        (gl::StaticVertexBuffer::map):
        (gl::StaticVertexBuffer::reserveRequiredSpace):
        (gl::StaticVertexBuffer::lookupAttribute):
        (gl::VertexDataManager::formatConverter):
        * src/libGLESv2/VertexDataManager.h: Added.
        (gl::ArrayVertexBuffer::size):
        (gl::VertexDataManager::dirtyCurrentValue):
        * src/libGLESv2/libGLESv2.cpp:
        (validImageSize):
        (Extension::glBindTexImage):
        * src/libGLESv2/libGLESv2.def:
        * src/libGLESv2/libGLESv2.rc: Added.
        * src/libGLESv2/libGLESv2.vcproj:
        * src/libGLESv2/main.cpp:
        (error):
        * src/libGLESv2/mathutil.h:
        (gl::clamp):
        (gl::clamp01):
        (gl::transformPixelRect):
        (gl::transformPixelYOffset):
        (gl::adjustWinding):
        (gl::supportsSSE2):
        * src/libGLESv2/resource.h: Added.
        * src/libGLESv2/utilities.cpp:
        (gl::ComputeCompressedPitch):
        (es2dx::ConvertCubeFace):
        (es2dx::ConvertPrimitiveType):
        (es2dx::ConvertRenderbufferFormat):
        (es2dx::GetMultisampleTypeFromSamples):
        (dx2es::GetStencilSize):
        (dx2es::GetAlphaSize):
        (dx2es::GetRedSize):
        (dx2es::GetGreenSize):
        (dx2es::GetBlueSize):
        (dx2es::GetDepthSize):
        (getTempPath):
        (writeFile):
        * src/libGLESv2/utilities.h:
        * src/libGLESv2/vertexconversion.h: Added.
        (gl::Identity::convert):
        (gl::Cast::convert):
        (gl::Normalize::convert):
        (gl::FixedToFloat::convert):
        (gl::SimpleDefaultValues::zero):
        (gl::SimpleDefaultValues::one):
        (gl::NormalizedDefaultValues::zero):
        (gl::NormalizedDefaultValues::one):
        (gl::VertexDataConverter::convertArray):
        (gl::VertexDataConverter::pointerAddBytes):
        (gl::VertexDataConverter::copyComponent):
2011-06-20  Zhenyao Mo  <zmo@google.com>

        Reviewed by Kenneth Russell.

        Update ANGLE to r696
        https://bugs.webkit.org/show_bug.cgi?id=56396

        * fast/canvas/webgl/glsl-conformance.html: Fix a bug in the test (otherwise after the roll this test will fail).
        * platform/chromium/test_expectations.txt: Once this test is fixed, it should pass in chromium.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89330 268f45cc-cd09-0410-ab3c-d52691b4dbfc

99 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/glsl-conformance.html
LayoutTests/platform/chromium/test_expectations.txt
Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
Source/ThirdParty/ANGLE/ChangeLog
Source/ThirdParty/ANGLE/include/EGL/eglext.h
Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj
Source/ThirdParty/ANGLE/src/common/debug.cpp
Source/ThirdParty/ANGLE/src/common/debug.h
Source/ThirdParty/ANGLE/src/common/version.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp
Source/ThirdParty/ANGLE/src/compiler/CodeGenHLSL.cpp
Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp
Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h
Source/ThirdParty/ANGLE/src/compiler/ExtensionBehavior.h
Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/Initialize.cpp
Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp
Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h
Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp
Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h
Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp
Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h
Source/ThirdParty/ANGLE/src/compiler/ShHandle.h
Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp
Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.h
Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp
Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h
Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp
Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h
Source/ThirdParty/ANGLE/src/compiler/glslang.y
Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp
Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h
Source/ThirdParty/ANGLE/src/compiler/intermediate.h
Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c
Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h
Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c
Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c
Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c
Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h
Source/ThirdParty/ANGLE/src/libEGL/Config.cpp
Source/ThirdParty/ANGLE/src/libEGL/Config.h
Source/ThirdParty/ANGLE/src/libEGL/Display.cpp
Source/ThirdParty/ANGLE/src/libEGL/Display.h
Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp
Source/ThirdParty/ANGLE/src/libEGL/Surface.h
Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp
Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libEGL/libEGL.vcproj
Source/ThirdParty/ANGLE/src/libEGL/main.cpp
Source/ThirdParty/ANGLE/src/libEGL/main.h
Source/ThirdParty/ANGLE/src/libEGL/resource.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h
Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h
Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Context.h
Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h
Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Program.h
Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h
Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h
Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h
Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h
Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.cpp [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def
Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.vcproj
Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h
Source/ThirdParty/ANGLE/src/libGLESv2/resource.h [new file with mode: 0644]
Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp
Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h
Source/ThirdParty/ANGLE/src/libGLESv2/vertexconversion.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp

index 6f71323..2d982b7 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-20  Zhenyao Mo  <zmo@google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Update ANGLE to r696
+        https://bugs.webkit.org/show_bug.cgi?id=56396
+
+        * fast/canvas/webgl/glsl-conformance.html: Fix a bug in the test (otherwise after the roll this test will fail).
+        * platform/chromium/test_expectations.txt: Once this test is fixed, it should pass in chromium.
+
 2011-06-20  Kenneth Russell  <kbr@google.com>
 
         Unreviewed Chromium expectations update. Suppressions after recent commits.
index 8864332..38d18f8 100644 (file)
@@ -29,7 +29,8 @@ void main()
 <script id="fshaderWithPrecision" type="text/something-not-javascript">
 void main()
 {
-    gl_FragColor = mediump vec4(1.0,0.0,0.0,1.0);
+    mediump vec4 color = vec4(1.0,0.0,0.0,1.0);
+    gl_FragColor = color;
 }
 </script>
 <script id="vshaderWithDefaultPrecision" type="text/something-not-javascript">
index 53006b4..0abaf43 100644 (file)
@@ -4008,8 +4008,6 @@ BUGRNIWA MAC : editing/selection/vertical-rl-ltr-extend-line-forward-br.html = I
 BUGRNIWA MAC : editing/selection/vertical-rl-ltr-extend-line-forward-p.html = IMAGE PASS
 BUGRNIWA MAC : editing/selection/vertical-rl-ltr-extend-line-forward-wrap.html = IMAGE PASS
 
-BUGCR86563 : fast/canvas/webgl/glsl-conformance.html = TEXT
-
 BUGCR86714 MAC GPU : compositing/tiling/huge-layer-resize.html = CRASH
 BUGCR86714 MAC GPU : media/video-controls-rendering.html = CRASH
 BUGCR86714 MAC GPU : media/video-zoom.html = CRASH
index aa91bdb..ae88aab 100644 (file)
                90D9B11812E11DD6002D4255 /* VariableInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B11012E11DD6002D4255 /* VariableInfo.h */; };
                90D9B11912E11DD6002D4255 /* VersionGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B11112E11DD6002D4255 /* VersionGLSL.cpp */; };
                90D9B11A12E11DD6002D4255 /* VersionGLSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B11212E11DD6002D4255 /* VersionGLSL.h */; };
+               A0AABE2C13AFE81000F2EBD1 /* ForLoopUnroll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0AABE2A13AFE81000F2EBD1 /* ForLoopUnroll.cpp */; };
+               A0AABE2D13AFE81000F2EBD1 /* ForLoopUnroll.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE2B13AFE81000F2EBD1 /* ForLoopUnroll.h */; };
+               A0AABE3013AFE83000F2EBD1 /* MapLongVariableNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0AABE2E13AFE83000F2EBD1 /* MapLongVariableNames.cpp */; };
+               A0AABE3113AFE83000F2EBD1 /* MapLongVariableNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE2F13AFE83000F2EBD1 /* MapLongVariableNames.h */; };
+               A0AABE3413AFE84700F2EBD1 /* OutputGLSLBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0AABE3213AFE84700F2EBD1 /* OutputGLSLBase.cpp */; };
+               A0AABE3513AFE84700F2EBD1 /* OutputGLSLBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE3313AFE84700F2EBD1 /* OutputGLSLBase.h */; };
+               A0AABE4413AFE94500F2EBD1 /* OutputESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0AABE4213AFE94500F2EBD1 /* OutputESSL.cpp */; };
+               A0AABE4513AFE94500F2EBD1 /* OutputESSL.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE4313AFE94500F2EBD1 /* OutputESSL.h */; };
+               A0AABE4813AFE96100F2EBD1 /* TranslatorESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0AABE4613AFE96100F2EBD1 /* TranslatorESSL.cpp */; };
+               A0AABE4913AFE96100F2EBD1 /* TranslatorESSL.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE4713AFE96100F2EBD1 /* TranslatorESSL.h */; };
                FB39D2711200F35A00088E69 /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */; };
                FB39D2751200F35A00088E69 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2261200F35A00088E69 /* debug.cpp */; };
                FB39D2791200F35A00088E69 /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D22A1200F35A00088E69 /* InfoSink.cpp */; };
                90D9B11012E11DD6002D4255 /* VariableInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariableInfo.h; sourceTree = "<group>"; };
                90D9B11112E11DD6002D4255 /* VersionGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VersionGLSL.cpp; sourceTree = "<group>"; };
                90D9B11212E11DD6002D4255 /* VersionGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VersionGLSL.h; sourceTree = "<group>"; };
+               A0AABE2A13AFE81000F2EBD1 /* ForLoopUnroll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ForLoopUnroll.cpp; sourceTree = "<group>"; };
+               A0AABE2B13AFE81000F2EBD1 /* ForLoopUnroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForLoopUnroll.h; sourceTree = "<group>"; };
+               A0AABE2E13AFE83000F2EBD1 /* MapLongVariableNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapLongVariableNames.cpp; sourceTree = "<group>"; };
+               A0AABE2F13AFE83000F2EBD1 /* MapLongVariableNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapLongVariableNames.h; sourceTree = "<group>"; };
+               A0AABE3213AFE84700F2EBD1 /* OutputGLSLBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSLBase.cpp; sourceTree = "<group>"; };
+               A0AABE3313AFE84700F2EBD1 /* OutputGLSLBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputGLSLBase.h; sourceTree = "<group>"; };
+               A0AABE4213AFE94500F2EBD1 /* OutputESSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputESSL.cpp; sourceTree = "<group>"; };
+               A0AABE4313AFE94500F2EBD1 /* OutputESSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputESSL.h; sourceTree = "<group>"; };
+               A0AABE4613AFE96100F2EBD1 /* TranslatorESSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorESSL.cpp; sourceTree = "<group>"; };
+               A0AABE4713AFE96100F2EBD1 /* TranslatorESSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatorESSL.h; sourceTree = "<group>"; };
                FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; };
                FB39D1861200F26200088E69 /* BaseTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = "<group>"; };
                FB39D1871200F26200088E69 /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
                FB39D2201200F35A00088E69 /* compiler */ = {
                        isa = PBXGroup;
                        children = (
+                               A0AABE3213AFE84700F2EBD1 /* OutputGLSLBase.cpp */,
+                               A0AABE3313AFE84700F2EBD1 /* OutputGLSLBase.h */,
+                               A0AABE4613AFE96100F2EBD1 /* TranslatorESSL.cpp */,
+                               A0AABE4713AFE96100F2EBD1 /* TranslatorESSL.h */,
+                               A0AABE4213AFE94500F2EBD1 /* OutputESSL.cpp */,
+                               A0AABE4313AFE94500F2EBD1 /* OutputESSL.h */,
+                               A0AABE2E13AFE83000F2EBD1 /* MapLongVariableNames.cpp */,
+                               A0AABE2F13AFE83000F2EBD1 /* MapLongVariableNames.h */,
+                               A0AABE2A13AFE81000F2EBD1 /* ForLoopUnroll.cpp */,
+                               A0AABE2B13AFE81000F2EBD1 /* ForLoopUnroll.h */,
                                FB39D2441200F35A00088E69 /* preprocessor */,
                                FB39D2211200F35A00088E69 /* BaseTypes.h */,
                                FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */,
                                90D9B11612E11DD6002D4255 /* ValidateLimitations.h in Headers */,
                                90D9B11812E11DD6002D4255 /* VariableInfo.h in Headers */,
                                90D9B11A12E11DD6002D4255 /* VersionGLSL.h in Headers */,
+                               A0AABE2D13AFE81000F2EBD1 /* ForLoopUnroll.h in Headers */,
+                               A0AABE3113AFE83000F2EBD1 /* MapLongVariableNames.h in Headers */,
+                               A0AABE3513AFE84700F2EBD1 /* OutputGLSLBase.h in Headers */,
+                               A0AABE4513AFE94500F2EBD1 /* OutputESSL.h in Headers */,
+                               A0AABE4913AFE96100F2EBD1 /* TranslatorESSL.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                90D9B11512E11DD6002D4255 /* ValidateLimitations.cpp in Sources */,
                                90D9B11712E11DD6002D4255 /* VariableInfo.cpp in Sources */,
                                90D9B11912E11DD6002D4255 /* VersionGLSL.cpp in Sources */,
+                               A0AABE2C13AFE81000F2EBD1 /* ForLoopUnroll.cpp in Sources */,
+                               A0AABE3013AFE83000F2EBD1 /* MapLongVariableNames.cpp in Sources */,
+                               A0AABE3413AFE84700F2EBD1 /* OutputGLSLBase.cpp in Sources */,
+                               A0AABE4413AFE94500F2EBD1 /* OutputESSL.cpp in Sources */,
+                               A0AABE4813AFE96100F2EBD1 /* TranslatorESSL.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index fe1d065..b75ae93 100644 (file)
@@ -1,3 +1,552 @@
+2011-06-20  Zhenyao Mo  <zmo@google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Update ANGLE to r696
+        https://bugs.webkit.org/show_bug.cgi?id=56396
+
+        * ANGLE.xcodeproj/project.pbxproj:
+        * include/EGL/eglext.h:
+        * include/GLSLANG/ShaderLang.h:
+        * src/build_angle.xcodeproj/project.pbxproj:
+        * src/common/debug.cpp:
+        (gl::output):
+        (gl::trace):
+        (gl::perfActive):
+        (gl::ScopedPerfEventHelper::ScopedPerfEventHelper):
+        (gl::ScopedPerfEventHelper::~ScopedPerfEventHelper):
+        * src/common/debug.h:
+        * src/common/version.h: Added.
+        * src/compiler/CodeGenGLSL.cpp:
+        (ConstructCompiler):
+        * src/compiler/CodeGenHLSL.cpp:
+        (ConstructCompiler):
+        * src/compiler/Compiler.cpp:
+        (TCompiler::compile):
+        (TCompiler::mapLongVariableNames):
+        (TCompiler::getMappedNameMaxLength):
+        (TCompiler::getExtensionBehavior):
+        * src/compiler/ConstantUnion.h:
+        (ConstantUnion::operator==):
+        (ConstantUnion::operator>):
+        (ConstantUnion::operator<):
+        * src/compiler/ExtensionBehavior.h:
+        (getBehaviorString):
+        * src/compiler/ForLoopUnroll.cpp: Added.
+        (ForLoopUnroll::FillLoopIndexInfo):
+        (ForLoopUnroll::Step):
+        (ForLoopUnroll::SatisfiesLoopCondition):
+        (ForLoopUnroll::NeedsToReplaceSymbolWithValue):
+        (ForLoopUnroll::GetLoopIndexValue):
+        (ForLoopUnroll::Push):
+        (ForLoopUnroll::Pop):
+        (ForLoopUnroll::getLoopIncrement):
+        (ForLoopUnroll::evaluateIntConstant):
+        * src/compiler/ForLoopUnroll.h: Added.
+        (ForLoopUnroll::ForLoopUnroll):
+        * src/compiler/Initialize.cpp:
+        (BuiltInFunctionsVertex):
+        * src/compiler/MapLongVariableNames.cpp: Added.
+        (MapLongVariableNames::MapLongVariableNames):
+        (MapLongVariableNames::visitSymbol):
+        (MapLongVariableNames::visitConstantUnion):
+        (MapLongVariableNames::visitBinary):
+        (MapLongVariableNames::visitUnary):
+        (MapLongVariableNames::visitSelection):
+        (MapLongVariableNames::visitAggregate):
+        (MapLongVariableNames::visitLoop):
+        (MapLongVariableNames::visitBranch):
+        (MapLongVariableNames::mapVaryingLongName):
+        * src/compiler/MapLongVariableNames.h: Added.
+        * src/compiler/OutputESSL.cpp: Added.
+        (TOutputESSL::TOutputESSL):
+        (TOutputESSL::writeVariablePrecision):
+        * src/compiler/OutputESSL.h: Added.
+        * src/compiler/OutputGLSL.cpp:
+        (TOutputGLSL::TOutputGLSL):
+        (TOutputGLSL::writeVariablePrecision):
+        * src/compiler/OutputGLSL.h:
+        * src/compiler/OutputGLSLBase.cpp: Added.
+        (TOutputGLSLBase::TOutputGLSLBase):
+        (TOutputGLSLBase::writeTriplet):
+        (TOutputGLSLBase::writeVariableType):
+        (TOutputGLSLBase::writeFunctionParameters):
+        (TOutputGLSLBase::writeConstantUnion):
+        (TOutputGLSLBase::visitSymbol):
+        (TOutputGLSLBase::visitConstantUnion):
+        (TOutputGLSLBase::visitBinary):
+        (TOutputGLSLBase::visitUnary):
+        (TOutputGLSLBase::visitSelection):
+        (TOutputGLSLBase::visitAggregate):
+        (TOutputGLSLBase::visitLoop):
+        (TOutputGLSLBase::visitBranch):
+        (TOutputGLSLBase::visitCodeBlock):
+        * src/compiler/OutputGLSLBase.h: Added.
+        (TOutputGLSLBase::objSink):
+        * src/compiler/OutputHLSL.cpp:
+        (sh::OutputHLSL::OutputHLSL):
+        (sh::OutputHLSL::header):
+        (sh::OutputHLSL::visitUnary):
+        (sh::OutputHLSL::visitAggregate):
+        (sh::OutputHLSL::visitSelection):
+        (sh::OutputHLSL::visitLoop):
+        (sh::OutputHLSL::visitBranch):
+        (sh::OutputHLSL::handleExcessiveLoop):
+        (sh::OutputHLSL::outputLineDirective):
+        * src/compiler/OutputHLSL.h:
+        * src/compiler/ParseHelper.cpp:
+        (TParseContext::precisionErrorCheck):
+        (TParseContext::constructorErrorCheck):
+        (TParseContext::nonInitErrorCheck):
+        * src/compiler/ParseHelper.h:
+        (TParseContext::TParseContext):
+        * src/compiler/ShHandle.h:
+        * src/compiler/ShaderLang.cpp:
+        (getVariableInfo):
+        (ShConstructCompiler):
+        (ShGetInfo):
+        (ShGetActiveAttrib):
+        (ShGetActiveUniform):
+        * src/compiler/TranslatorESSL.cpp: Added.
+        (TranslatorESSL::TranslatorESSL):
+        (TranslatorESSL::translate):
+        (TranslatorESSL::writeExtensionBehavior):
+        * src/compiler/TranslatorESSL.h: Added.
+        * src/compiler/ValidateLimitations.cpp:
+        (ValidateLimitations::visitBinary):
+        (ValidateLimitations::visitLoop):
+        * src/compiler/ValidateLimitations.h:
+        * src/compiler/VariableInfo.cpp:
+        (getVariableInfo):
+        (getBuiltInVariableInfo):
+        (getUserDefinedVariableInfo):
+        (CollectAttribsUniforms::visitAggregate):
+        * src/compiler/VariableInfo.h:
+        * src/compiler/VersionGLSL.cpp:
+        (TVersionGLSL::visitSymbol):
+        (TVersionGLSL::visitConstantUnion):
+        (TVersionGLSL::visitBinary):
+        (TVersionGLSL::visitUnary):
+        (TVersionGLSL::visitSelection):
+        (TVersionGLSL::visitAggregate):
+        (TVersionGLSL::visitLoop):
+        (TVersionGLSL::visitBranch):
+        * src/compiler/VersionGLSL.h:
+        * src/compiler/glslang.y:
+        * src/compiler/glslang_tab.cpp:
+        * src/compiler/glslang_tab.h:
+        * src/compiler/intermediate.h:
+        (TIntermLoop::TIntermLoop):
+        (TIntermLoop::setUnrollFlag):
+        (TIntermLoop::getUnrollFlag):
+        (TIntermSymbol::TIntermSymbol):
+        (TIntermSymbol::setId):
+        (TIntermSymbol::setSymbol):
+        (TIntermSymbol::getOriginalSymbol):
+        (TIntermAggregate::TIntermAggregate):
+        (TIntermAggregate::setEndLine):
+        (TIntermAggregate::getEndLine):
+        * src/compiler/preprocessor/atom.c:
+        (AddString):
+        * src/compiler/preprocessor/compile.h:
+        * src/compiler/preprocessor/cpp.c:
+        (CPPelse):
+        (eval):
+        (CPPif):
+        (CPPifdef):
+        (readCPPline):
+        (ChkCorrectElseNesting):
+        * src/compiler/preprocessor/cppstruct.c:
+        (ResetPreprocessor):
+        * src/compiler/preprocessor/scanner.c:
+        (byte_scan):
+        (yylex_CPP):
+        * src/compiler/preprocessor/scanner.h:
+        * src/libEGL/Config.cpp:
+        (egl::Config::Config):
+        (egl::Config::set):
+        (egl::ConfigSet::add):
+        (egl::ConfigSet::getConfigs):
+        * src/libEGL/Config.h:
+        * src/libEGL/Display.cpp:
+        (egl::Display::Display):
+        (egl::Display::initialize):
+        (egl::Display::terminate):
+        (egl::Display::getConfigAttrib):
+        (egl::Display::createDevice):
+        (egl::Display::createWindowSurface):
+        (egl::Display::createOffscreenSurface):
+        (egl::Display::createContext):
+        (egl::Display::destroyContext):
+        (egl::Display::isInitialized):
+        (egl::Display::getAdapterIdentifier):
+        (egl::Display::isDeviceLost):
+        (egl::Display::getBufferPool):
+        (egl::Display::initExtensionString):
+        (egl::Display::getExtensionString):
+        (egl::Display::getVertexTextureSupport):
+        (egl::Display::getNonPower2TextureSupport):
+        * src/libEGL/Display.h:
+        (egl::Display::isD3d9ExDevice):
+        * src/libEGL/Surface.cpp:
+        (egl::Surface::Surface):
+        (egl::Surface::initialize):
+        (egl::Surface::release):
+        (egl::Surface::resetSwapChain):
+        (egl::SurfaceWindowProc):
+        (egl::Surface::subclassWindow):
+        (egl::Surface::unsubclassWindow):
+        (egl::Surface::swap):
+        (egl::Surface::getRenderTarget):
+        (egl::Surface::getOffscreenTexture):
+        (egl::Surface::getTextureFormat):
+        (egl::Surface::getTextureTarget):
+        (egl::Surface::setBoundTexture):
+        (egl::Surface::getBoundTexture):
+        (egl::Surface::getFormat):
+        * src/libEGL/Surface.h:
+        (egl::Surface::getShareHandle):
+        * src/libEGL/libEGL.cpp:
+        (validateDisplay):
+        (validateConfig):
+        (validateContext):
+        (validateSurface):
+        * src/libEGL/libEGL.rc: Added.
+        * src/libEGL/libEGL.vcproj:
+        * src/libEGL/main.cpp:
+        (DllMain):
+        * src/libEGL/main.h:
+        * src/libEGL/resource.h: Added.
+        * src/libGLESv2/Blit.cpp:
+        (gl::Blit::initGeometry):
+        (gl::Blit::copy):
+        * src/libGLESv2/Blit.h:
+        * src/libGLESv2/Buffer.cpp:
+        (gl::Buffer::Buffer):
+        (gl::Buffer::~Buffer):
+        (gl::Buffer::bufferData):
+        (gl::Buffer::bufferSubData):
+        (gl::Buffer::getStaticVertexBuffer):
+        (gl::Buffer::getStaticIndexBuffer):
+        (gl::Buffer::invalidateStaticData):
+        (gl::Buffer::promoteStaticUsage):
+        * src/libGLESv2/Buffer.h:
+        * src/libGLESv2/Context.cpp:
+        (gl::Context::Context):
+        (gl::Context::~Context):
+        (gl::Context::makeCurrent):
+        (gl::Context::markAllStateDirty):
+        (gl::Context::setActiveSampler):
+        (gl::Context::createFramebuffer):
+        (gl::Context::createFence):
+        (gl::Context::deleteFramebuffer):
+        (gl::Context::deleteFence):
+        (gl::Context::bindTexture2D):
+        (gl::Context::bindTextureCubeMap):
+        (gl::Context::getTexture2D):
+        (gl::Context::getTextureCubeMap):
+        (gl::Context::getSamplerTexture):
+        (gl::Context::getIntegerv):
+        (gl::Context::applyRenderTarget):
+        (gl::Context::applyState):
+        (gl::Context::applyVertexBuffer):
+        (gl::Context::applyShaders):
+        (gl::Context::applyTextures):
+        (gl::Context::readPixels):
+        (gl::Context::clear):
+        (gl::Context::drawArrays):
+        (gl::Context::drawElements):
+        (gl::Context::finish):
+        (gl::Context::flush):
+        (gl::Context::drawClosingLine):
+        (gl::Context::getMaximumVertexTextureImageUnits):
+        (gl::Context::getMaximumCombinedTextureImageUnits):
+        (gl::Context::supportsNonPower2Texture):
+        (gl::Context::detachTexture):
+        (gl::Context::getIncompleteTexture):
+        (gl::Context::initExtensionString):
+        (gl::Context::blitFramebuffer):
+        (gl::VertexDeclarationCache::VertexDeclarationCache):
+        (gl::VertexDeclarationCache::~VertexDeclarationCache):
+        (gl::VertexDeclarationCache::applyDeclaration):
+        * src/libGLESv2/Context.h:
+        * src/libGLESv2/Framebuffer.cpp:
+        (gl::Framebuffer::lookupRenderbuffer):
+        (gl::Framebuffer::completeness):
+        * src/libGLESv2/Framebuffer.h:
+        * src/libGLESv2/HandleAllocator.cpp: Added.
+        (gl::HandleAllocator::HandleAllocator):
+        (gl::HandleAllocator::~HandleAllocator):
+        (gl::HandleAllocator::setBaseHandle):
+        (gl::HandleAllocator::allocate):
+        (gl::HandleAllocator::release):
+        * src/libGLESv2/HandleAllocator.h: Added.
+        * src/libGLESv2/IndexDataManager.cpp: Added.
+        (gl::IndexDataManager::IndexDataManager):
+        (gl::IndexDataManager::~IndexDataManager):
+        (gl::convertIndices):
+        (gl::computeRange):
+        (gl::IndexDataManager::prepareIndexData):
+        (gl::IndexDataManager::indexSize):
+        (gl::IndexDataManager::typeSize):
+        (gl::IndexBuffer::IndexBuffer):
+        (gl::IndexBuffer::~IndexBuffer):
+        (gl::IndexBuffer::getBuffer):
+        (gl::IndexBuffer::unmap):
+        (gl::StreamingIndexBuffer::StreamingIndexBuffer):
+        (gl::StreamingIndexBuffer::~StreamingIndexBuffer):
+        (gl::StreamingIndexBuffer::map):
+        (gl::StreamingIndexBuffer::reserveSpace):
+        (gl::StaticIndexBuffer::StaticIndexBuffer):
+        (gl::StaticIndexBuffer::~StaticIndexBuffer):
+        (gl::StaticIndexBuffer::map):
+        (gl::StaticIndexBuffer::reserveSpace):
+        (gl::StaticIndexBuffer::lookupType):
+        (gl::StaticIndexBuffer::lookupRange):
+        (gl::StaticIndexBuffer::addRange):
+        * src/libGLESv2/IndexDataManager.h: Added.
+        (gl::IndexBuffer::size):
+        * src/libGLESv2/Program.cpp:
+        (gl::Program::getSemanticIndex):
+        (gl::Program::getSamplerMapping):
+        (gl::Program::getSamplerTextureType):
+        (gl::Program::compileToBinary):
+        (gl::Program::packVaryings):
+        (gl::Program::linkVaryings):
+        (gl::Program::link):
+        (gl::Program::linkUniforms):
+        (gl::Program::defineUniform):
+        (gl::Program::applyUniform1iv):
+        (gl::Program::appendToInfoLogSanitized):
+        (gl::Program::unlink):
+        (gl::Program::getActiveUniformMaxLength):
+        (gl::Program::validate):
+        (gl::Program::validateSamplers):
+        * src/libGLESv2/Program.h:
+        * src/libGLESv2/Renderbuffer.cpp:
+        (gl::Renderbuffer::getWidth):
+        (gl::Renderbuffer::getHeight):
+        (gl::Renderbuffer::getInternalFormat):
+        (gl::Renderbuffer::getRedSize):
+        (gl::Renderbuffer::getGreenSize):
+        (gl::Renderbuffer::getBlueSize):
+        (gl::Renderbuffer::getAlphaSize):
+        (gl::Renderbuffer::getDepthSize):
+        (gl::Renderbuffer::getStencilSize):
+        (gl::Renderbuffer::getSamples):
+        (gl::RenderbufferStorage::RenderbufferStorage):
+        (gl::RenderbufferStorage::getWidth):
+        (gl::RenderbufferStorage::getHeight):
+        (gl::RenderbufferStorage::getInternalFormat):
+        (gl::RenderbufferStorage::getRedSize):
+        (gl::RenderbufferStorage::getGreenSize):
+        (gl::RenderbufferStorage::getBlueSize):
+        (gl::RenderbufferStorage::getAlphaSize):
+        (gl::RenderbufferStorage::getDepthSize):
+        (gl::RenderbufferStorage::getStencilSize):
+        (gl::RenderbufferStorage::getD3DFormat):
+        (gl::Colorbuffer::Colorbuffer):
+        (gl::Colorbuffer::getWidth):
+        (gl::Colorbuffer::getHeight):
+        (gl::Colorbuffer::getInternalFormat):
+        (gl::Colorbuffer::getType):
+        (gl::Colorbuffer::getD3DFormat):
+        (gl::Colorbuffer::isColorbuffer):
+        (gl::Colorbuffer::getRenderTarget):
+        (gl::DepthStencilbuffer::DepthStencilbuffer):
+        (gl::Depthbuffer::Depthbuffer):
+        (gl::Stencilbuffer::Stencilbuffer):
+        * src/libGLESv2/Renderbuffer.h:
+        * src/libGLESv2/ResourceManager.cpp:
+        (gl::ResourceManager::createBuffer):
+        (gl::ResourceManager::createShader):
+        (gl::ResourceManager::createProgram):
+        (gl::ResourceManager::createTexture):
+        (gl::ResourceManager::createRenderbuffer):
+        (gl::ResourceManager::deleteBuffer):
+        (gl::ResourceManager::deleteShader):
+        (gl::ResourceManager::deleteProgram):
+        (gl::ResourceManager::deleteTexture):
+        (gl::ResourceManager::deleteRenderbuffer):
+        (gl::ResourceManager::checkTextureAllocation):
+        * src/libGLESv2/ResourceManager.h:
+        * src/libGLESv2/Shader.cpp:
+        (gl::Shader::Shader):
+        (gl::Shader::compileToHLSL):
+        * src/libGLESv2/Shader.h:
+        * src/libGLESv2/Texture.cpp:
+        (gl::Texture::Image::Image):
+        (gl::Texture::Image::~Image):
+        (gl::Texture::Image::isRenderable):
+        (gl::Texture::Image::getD3DFormat):
+        (gl::Texture::Texture):
+        (gl::Texture::setMinFilter):
+        (gl::Texture::setMagFilter):
+        (gl::Texture::setWrapS):
+        (gl::Texture::setWrapT):
+        (gl::Texture::loadImageData):
+        (gl::Texture::loadAlphaImageData):
+        (gl::Texture::loadAlphaFloatImageData):
+        (gl::Texture::loadAlphaHalfFloatImageData):
+        (gl::Texture::loadLuminanceImageData):
+        (gl::Texture::loadLuminanceFloatImageData):
+        (gl::Texture::loadLuminanceHalfFloatImageData):
+        (gl::Texture::loadLuminanceAlphaImageData):
+        (gl::Texture::loadLuminanceAlphaFloatImageData):
+        (gl::Texture::loadLuminanceAlphaHalfFloatImageData):
+        (gl::Texture::loadRGBUByteImageData):
+        (gl::Texture::loadRGB565ImageData):
+        (gl::Texture::loadRGBFloatImageData):
+        (gl::Texture::loadRGBHalfFloatImageData):
+        (gl::Texture::loadRGBAUByteImageDataSSE2):
+        (gl::Texture::loadRGBAUByteImageData):
+        (gl::Texture::loadRGBA4444ImageData):
+        (gl::Texture::loadRGBA5551ImageData):
+        (gl::Texture::loadRGBAFloatImageData):
+        (gl::Texture::loadRGBAHalfFloatImageData):
+        (gl::Texture::loadBGRAImageData):
+        (gl::Texture::loadCompressedImageData):
+        (gl::Texture::createSurface):
+        (gl::Texture::setImage):
+        (gl::Texture::setCompressedImage):
+        (gl::Texture::subImage):
+        (gl::Texture::subImageCompressed):
+        (gl::Texture::copyToImage):
+        (gl::Texture::getTexture):
+        (gl::Texture::isDirtyParameter):
+        (gl::Texture::isDirtyImage):
+        (gl::Texture::resetDirty):
+        (gl::Texture::getSerial):
+        (gl::Texture::creationLevels):
+        (gl::Texture::levelCount):
+        (gl::Texture::issueSerial):
+        (gl::Texture2D::Texture2D):
+        (gl::Texture2D::~Texture2D):
+        (gl::Texture2D::getWidth):
+        (gl::Texture2D::getHeight):
+        (gl::Texture2D::getInternalFormat):
+        (gl::Texture2D::getType):
+        (gl::Texture2D::getD3DFormat):
+        (gl::Texture2D::redefineTexture):
+        (gl::Texture2D::setImage):
+        (gl::Texture2D::bindTexImage):
+        (gl::Texture2D::releaseTexImage):
+        (gl::Texture2D::setCompressedImage):
+        (gl::Texture2D::commitRect):
+        (gl::Texture2D::copyImage):
+        (gl::Texture2D::copySubImage):
+        (gl::Texture2D::isComplete):
+        (gl::Texture2D::isCompressed):
+        (gl::Texture2D::getBaseTexture):
+        (gl::Texture2D::createTexture):
+        (gl::Texture2D::updateTexture):
+        (gl::Texture2D::convertToRenderTarget):
+        (gl::Texture2D::generateMipmaps):
+        (gl::Texture2D::getRenderbuffer):
+        (gl::Texture2D::getRenderTarget):
+        (gl::TextureCubeMap::getWidth):
+        (gl::TextureCubeMap::getHeight):
+        (gl::TextureCubeMap::getInternalFormat):
+        (gl::TextureCubeMap::getType):
+        (gl::TextureCubeMap::getD3DFormat):
+        (gl::TextureCubeMap::setImagePosX):
+        (gl::TextureCubeMap::setImageNegX):
+        (gl::TextureCubeMap::setImagePosY):
+        (gl::TextureCubeMap::setImageNegY):
+        (gl::TextureCubeMap::setImagePosZ):
+        (gl::TextureCubeMap::setImageNegZ):
+        (gl::TextureCubeMap::setCompressedImage):
+        (gl::TextureCubeMap::commitRect):
+        (gl::TextureCubeMap::isComplete):
+        (gl::TextureCubeMap::isCompressed):
+        (gl::TextureCubeMap::getBaseTexture):
+        (gl::TextureCubeMap::createTexture):
+        (gl::TextureCubeMap::updateTexture):
+        (gl::TextureCubeMap::convertToRenderTarget):
+        (gl::TextureCubeMap::setImage):
+        (gl::TextureCubeMap::redefineTexture):
+        (gl::TextureCubeMap::copyImage):
+        (gl::TextureCubeMap::getCubeMapSurface):
+        (gl::TextureCubeMap::copySubImage):
+        (gl::TextureCubeMap::generateMipmaps):
+        (gl::TextureCubeMap::getRenderbuffer):
+        (gl::TextureCubeMap::getRenderTarget):
+        * src/libGLESv2/Texture.h:
+        * src/libGLESv2/VertexDataManager.cpp: Added.
+        (gl::VertexDataManager::VertexDataManager):
+        (gl::VertexDataManager::~VertexDataManager):
+        (gl::VertexDataManager::writeAttributeData):
+        (gl::VertexDataManager::prepareVertexData):
+        (gl::VertexDataManager::spaceRequired):
+        (gl::VertexDataManager::checkVertexCaps):
+        (gl::VertexDataManager::typeIndex):
+        (gl::VertexBuffer::VertexBuffer):
+        (gl::VertexBuffer::~VertexBuffer):
+        (gl::VertexBuffer::unmap):
+        (gl::VertexBuffer::getBuffer):
+        (gl::ConstantVertexBuffer::ConstantVertexBuffer):
+        (gl::ConstantVertexBuffer::~ConstantVertexBuffer):
+        (gl::ArrayVertexBuffer::ArrayVertexBuffer):
+        (gl::ArrayVertexBuffer::~ArrayVertexBuffer):
+        (gl::ArrayVertexBuffer::addRequiredSpace):
+        (gl::ArrayVertexBuffer::addRequiredSpaceFor):
+        (gl::StreamingVertexBuffer::StreamingVertexBuffer):
+        (gl::StreamingVertexBuffer::~StreamingVertexBuffer):
+        (gl::StreamingVertexBuffer::map):
+        (gl::StreamingVertexBuffer::reserveRequiredSpace):
+        (gl::StaticVertexBuffer::StaticVertexBuffer):
+        (gl::StaticVertexBuffer::~StaticVertexBuffer):
+        (gl::StaticVertexBuffer::map):
+        (gl::StaticVertexBuffer::reserveRequiredSpace):
+        (gl::StaticVertexBuffer::lookupAttribute):
+        (gl::VertexDataManager::formatConverter):
+        * src/libGLESv2/VertexDataManager.h: Added.
+        (gl::ArrayVertexBuffer::size):
+        (gl::VertexDataManager::dirtyCurrentValue):
+        * src/libGLESv2/libGLESv2.cpp:
+        (validImageSize):
+        (Extension::glBindTexImage):
+        * src/libGLESv2/libGLESv2.def:
+        * src/libGLESv2/libGLESv2.rc: Added.
+        * src/libGLESv2/libGLESv2.vcproj:
+        * src/libGLESv2/main.cpp:
+        (error):
+        * src/libGLESv2/mathutil.h:
+        (gl::clamp):
+        (gl::clamp01):
+        (gl::transformPixelRect):
+        (gl::transformPixelYOffset):
+        (gl::adjustWinding):
+        (gl::supportsSSE2):
+        * src/libGLESv2/resource.h: Added.
+        * src/libGLESv2/utilities.cpp:
+        (gl::ComputeCompressedPitch):
+        (es2dx::ConvertCubeFace):
+        (es2dx::ConvertPrimitiveType):
+        (es2dx::ConvertRenderbufferFormat):
+        (es2dx::GetMultisampleTypeFromSamples):
+        (dx2es::GetStencilSize):
+        (dx2es::GetAlphaSize):
+        (dx2es::GetRedSize):
+        (dx2es::GetGreenSize):
+        (dx2es::GetBlueSize):
+        (dx2es::GetDepthSize):
+        (getTempPath):
+        (writeFile):
+        * src/libGLESv2/utilities.h:
+        * src/libGLESv2/vertexconversion.h: Added.
+        (gl::Identity::convert):
+        (gl::Cast::convert):
+        (gl::Normalize::convert):
+        (gl::FixedToFloat::convert):
+        (gl::SimpleDefaultValues::zero):
+        (gl::SimpleDefaultValues::one):
+        (gl::NormalizedDefaultValues::zero):
+        (gl::NormalizedDefaultValues::one):
+        (gl::VertexDataConverter::convertArray):
+        (gl::VertexDataConverter::pointerAddBytes):
+        (gl::VertexDataConverter::copyComponent):
+
 2011-05-24  David Kilzer  <ddkilzer@apple.com>
 
         Part 2 of 2: <http://webkit.org/b/60805> Enable -Wnewline-eof on ANGLE
index 638e336..b650a50 100644 (file)
@@ -215,6 +215,19 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenu
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
 #endif
 
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index d0664e4..6fe688c 100644 (file)
@@ -17,7 +17,7 @@ extern "C" {
 
 // Version number for shader translation API.
 // It is incremented everytime the API changes.
-#define SH_VERSION 103
+#define SH_VERSION 105
 
 //
 // The names of the following enums have been derived by replacing GL prefix
@@ -36,6 +36,12 @@ typedef enum {
 } ShShaderSpec;
 
 typedef enum {
+  SH_ESSL_OUTPUT = 0x8B45,
+  SH_GLSL_OUTPUT = 0x8B46,
+  SH_HLSL_OUTPUT = 0x8B47
+} ShShaderOutput;
+
+typedef enum {
   SH_NONE           = 0,
   SH_INT            = 0x1404,
   SH_FLOAT          = 0x1406,
@@ -62,16 +68,20 @@ typedef enum {
   SH_ACTIVE_UNIFORMS             =  0x8B86,
   SH_ACTIVE_UNIFORM_MAX_LENGTH   =  0x8B87,
   SH_ACTIVE_ATTRIBUTES           =  0x8B89,
-  SH_ACTIVE_ATTRIBUTE_MAX_LENGTH =  0x8B8A
+  SH_ACTIVE_ATTRIBUTE_MAX_LENGTH =  0x8B8A,
+  SH_MAPPED_NAME_MAX_LENGTH      =  0x8B8B
 } ShShaderInfo;
 
 // Compile options.
 typedef enum {
-  SH_VALIDATE               = 0,
-  SH_VALIDATE_LOOP_INDEXING = 0x0001,
-  SH_INTERMEDIATE_TREE      = 0x0002,
-  SH_OBJECT_CODE            = 0x0004,
-  SH_ATTRIBUTES_UNIFORMS    = 0x0008
+  SH_VALIDATE                = 0,
+  SH_VALIDATE_LOOP_INDEXING  = 0x0001,
+  SH_INTERMEDIATE_TREE       = 0x0002,
+  SH_OBJECT_CODE             = 0x0004,
+  SH_ATTRIBUTES_UNIFORMS     = 0x0008,
+  SH_LINE_DIRECTIVES         = 0x0010,
+  SH_SOURCE_PATH             = 0x0020,
+  SH_MAP_LONG_VARIABLE_NAMES = 0x0040
 } ShCompileOptions;
 
 //
@@ -124,13 +134,17 @@ typedef void* ShHandle;
 //
 // Driver calls these to create and destroy compiler objects.
 //
-// Returns the handle of constructed compiler.
+// Returns the handle of constructed compiler, null if the requested compiler is
+// not supported.
 // Parameters:
 // type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
 // spec: Specifies the language spec the compiler must conform to -
 //       SH_GLES2_SPEC or SH_WEBGL_SPEC.
+// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
+//         or SH_HLSL_OUTPUT.
 // resources: Specifies the built-in resources.
 ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+                             ShShaderOutput output,
                              const ShBuiltInResources* resources);
 void ShDestruct(ShHandle handle);
 
@@ -183,6 +197,8 @@ int ShCompile(
 // SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
 //                               variable name including the null
 //                               termination character.
+// SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
+//                            the null termination character.
 // 
 // params: Requested parameter
 void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params);
@@ -221,12 +237,18 @@ void ShGetObjectCode(const ShHandle handle, char* objCode);
 //       accomodate the attribute variable name. The size of the buffer
 //       required to store the attribute variable name can be obtained by
 //       calling ShGetInfo with SH_ACTIVE_ATTRIBUTE_MAX_LENGTH.
+// mappedName: Returns a null terminated string containing the mapped name of
+//             the attribute variable, It is assumed that mappedName has enough
+//             memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care
+//             about the mapped name. If the name is not mapped, then name and
+//             mappedName are the same.
 void ShGetActiveAttrib(const ShHandle handle,
                        int index,
                        int* length,
                        int* size,
                        ShDataType* type,
-                       char* name);
+                       char* name,
+                       char* mappedName);
 
 // Returns information about an active uniform variable.
 // Parameters:
@@ -242,12 +264,18 @@ void ShGetActiveAttrib(const ShHandle handle,
 //       accomodate the uniform variable name. The size of the buffer required
 //       to store the uniform variable name can be obtained by calling
 //       ShGetInfo with SH_ACTIVE_UNIFORMS_MAX_LENGTH.
+// mappedName: Returns a null terminated string containing the mapped name of
+//             the uniform variable, It is assumed that mappedName has enough
+//             memory (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care
+//             about the mapped name. If the name is not mapped, then name and
+//             mappedName are the same.
 void ShGetActiveUniform(const ShHandle handle,
                         int index,
                         int* length,
                         int* size,
                         ShDataType* type,
-                        char* name);
+                        char* name,
+                        char* mappedName);
 
 #ifdef __cplusplus
 }
index 67f7e29..409b622 100644 (file)
                        buildPhases = (
                        );
                        dependencies = (
-                               FB3C506411F792970081F5BA /* PBXTargetDependency */,
+                               A15E78BECDFF20BC3FFF040A /* PBXTargetDependency */,
+                               BA246CA19435A9FA8AC69146 /* PBXTargetDependency */,
+                               E4A3D33CA49D013550B8BA5F /* PBXTargetDependency */,
                        );
                        name = All;
                        productName = All;
                };
-               31349D665FAE642AEB49135E /* ANGLE Support */ = {
-                       isa = PBXAggregateTarget;
-                       buildConfigurationList = 0AA54825BF5DF0A3FBA92B60 /* Build configuration list for PBXAggregateTarget "ANGLE Support" */;
-                       buildPhases = (
-                               FA0D7125DB06A7A7716A5910 /* Action "flex_glslang" */,
-                               0D513F8B923949C156DB02C5 /* Action "bison_glslang" */,
-                       );
-                       dependencies = (
-                       );
-                       name = "ANGLE Support";
-                       productName = "translator_common Support";
-               };
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
                05563ADFEA15116D7233332F /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */; };
+               08A7933BD2F78A86B90200F6 /* Compiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A118E5003E5C0E253C53839 /* Compiler.cpp */; };
                0A216949103E1E228F9C12F0 /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */; };
+               0AC1897E461A0D4758E3DCE3 /* VersionGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F727AEC906712EC238041464 /* VersionGLSL.cpp */; };
+               0E9456F464E16392D1CCD030 /* ValidateLimitations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B148D967B8D288A8267BFF3A /* ValidateLimitations.cpp */; };
+               0EC09B3B254829F8F1D952D3 /* ForLoopUnroll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC9B647E10F65F66142ECC1 /* ForLoopUnroll.cpp */; };
+               1ED1D2C7C74C6B625AFB1CCF /* VariableInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27C11EE10FED2979931FFC11 /* VariableInfo.cpp */; };
+               296466566D8C0F023A553760 /* SearchSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 228A6DEDDF08DB370394A7AD /* SearchSymbol.cpp */; };
+               2E7C0D3804B8308A493D9B4B /* glslang_tab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F68A6AA811495718A6938C0 /* glslang_tab.cpp */; };
+               3021E0BF1BC8442FF1F2F2B4 /* glslang_lex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73A57C6D413773AEBA3C47A6 /* glslang_lex.cpp */; };
                3065D29E97FAC6E127388D15 /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */; };
                32B1DBCD6B83F2146D787A62 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9B4616A65A5ABEF91FD6DC /* atom.c */; };
                35BE1BBEE6135A1CB0608EA8 /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8058A0A2A0A02386867517EA /* cppstruct.c */; };
                3A96E9CAC8A25AF1564B652C /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 294F442A2606FEC55F12A28E /* memory.c */; };
+               3F18389BCB89370A930667F4 /* TranslatorGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */; };
                40FC189B8A246EDF14C2FDE3 /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEAF6F3126C2EC4397785C3F /* intermOut.cpp */; };
+               4B4BDE7AD6266B39ED43C2D4 /* CodeGenHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */; };
                50DF00005CC4212F6FB1291D /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F7C486C370A72938FE8160F /* Intermediate.cpp */; };
+               55CBD87573B803A173AC9129 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EE7215A7AB4EF71C97D2545 /* util.cpp */; };
+               5F7B52A54DCE8155ED94ECF8 /* OutputHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */; };
                6F9F875017A68ABE5D39FF19 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976C831A75EBE009A9861796 /* ParseHelper.cpp */; };
                888F1382498E2D74AF2801C8 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ABA230FEA3654B030E4C4FB /* debug.cpp */; };
+               896B720BD21F6749A7D83F30 /* MapLongVariableNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF1F83E842901C42D44825 /* MapLongVariableNames.cpp */; };
+               93A41AF036E5EF87B366B563 /* TranslatorESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A3A260F5379A7E2655D40F3 /* TranslatorESSL.cpp */; };
+               9886BCD5D0DD69B6FDE09DD8 /* UnfoldSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3711A48A0BF16B1CBD77AC9 /* UnfoldSelect.cpp */; };
+               9B111B83FB636FD5CDEC32A0 /* OutputGLSLBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDF01F002ADE9DB8A3EF4FE /* OutputGLSLBase.cpp */; };
                9E8DFE1CCEF038BF2B65428C /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */; };
                AC23F58FDD3C55F5CA18EED7 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */; };
                AD85517F086FDCEF3947C403 /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = F013A7240BDAE8A61413D8C0 /* symbols.c */; };
                B4858417E54365BE8CDE3919 /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE258486005F6696CC031622 /* ossource_posix.cpp */; };
                B8BD2685A16B188CCDFB052B /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */; };
                BEBBF4F0819EA3D03977A8FC /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */; };
+               C4AAB2BB4594C0DA318DCB1C /* OutputESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB2917C5B624712364DE4A75 /* OutputESSL.cpp */; };
+               C75EB9292A0DDA45592A8ACF /* OutputGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */; };
                CB7F0EF0D6A89FA8C4DF5513 /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = B75707B393B7EAB7DD9999CB /* cpp.c */; };
+               D56F7D00E9B162E416D37DF0 /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */; };
                E1C7C5DFF0B2DFEC09387F4E /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */; };
                E8C727AA8E9DC5E7B58857DF /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D00745DA9914FDE274D03D5 /* tokens.c */; };
+               E99D6D80DBF05ECE7108B26D /* TranslatorHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */; };
                F098F463EDABCF0769007678 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FF3AA694DF9A4455A813234D /* scanner.c */; };
                F5AE2A292DFAF8C158412AA2 /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */; };
                F6ABD58F8CAB7641D8BFE935 /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */; };
-               FB3C505711F7924A0081F5BA /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */; };
-               FB3C505811F7924A0081F5BA /* OutputGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */; };
-               FB3C505911F7924A0081F5BA /* TranslatorGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */; };
-               FB3C509211F794CE0081F5BA /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ABA230FEA3654B030E4C4FB /* debug.cpp */; };
-               FB3C509311F794CE0081F5BA /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */; };
-               FB3C509411F794CE0081F5BA /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */; };
-               FB3C509511F794CE0081F5BA /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */; };
-               FB3C509611F794CE0081F5BA /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F7C486C370A72938FE8160F /* Intermediate.cpp */; };
-               FB3C509711F794CE0081F5BA /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEAF6F3126C2EC4397785C3F /* intermOut.cpp */; };
-               FB3C509811F794CE0081F5BA /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */; };
-               FB3C509A11F794CE0081F5BA /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE258486005F6696CC031622 /* ossource_posix.cpp */; };
-               FB3C509B11F794CE0081F5BA /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */; };
-               FB3C509C11F794CE0081F5BA /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976C831A75EBE009A9861796 /* ParseHelper.cpp */; };
-               FB3C509D11F794CE0081F5BA /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */; };
-               FB3C509E11F794CE0081F5BA /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */; };
-               FB3C509F11F794CE0081F5BA /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */; };
-               FB3C50A011F794CE0081F5BA /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */; };
-               FB3C50A111F794CE0081F5BA /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */; };
-               FB3C50A411F794FF0081F5BA /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9B4616A65A5ABEF91FD6DC /* atom.c */; };
-               FB3C50A511F794FF0081F5BA /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = B75707B393B7EAB7DD9999CB /* cpp.c */; };
-               FB3C50A611F794FF0081F5BA /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8058A0A2A0A02386867517EA /* cppstruct.c */; };
-               FB3C50A711F794FF0081F5BA /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 294F442A2606FEC55F12A28E /* memory.c */; };
-               FB3C50A811F794FF0081F5BA /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FF3AA694DF9A4455A813234D /* scanner.c */; };
-               FB3C50A911F794FF0081F5BA /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = F013A7240BDAE8A61413D8C0 /* symbols.c */; };
-               FB3C50AA11F794FF0081F5BA /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D00745DA9914FDE274D03D5 /* tokens.c */; };
-               FB3C50AB11F7951B0081F5BA /* TranslatorGLSL.h in Sources */ = {isa = PBXBuildFile; fileRef = DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */; };
-               FB3C50AC11F7951B0081F5BA /* OutputGLSL.h in Sources */ = {isa = PBXBuildFile; fileRef = 93D61CB0BCE54E069D71F920 /* OutputGLSL.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
-               E69BFBE2D1272620E46C3F8A /* PBXContainerItemProxy */ = {
+               1F7242496103EDF29CC25D87 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = DA188D8C6BF8073122539131 /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 31349D665FAE642AEB49135E;
-                       remoteInfo = "translator_common Support";
+                       remoteGlobalIDString = A838E9574B3FF14791DBDAB1;
+                       remoteInfo = translator_hlsl;
                };
-               FB3C506311F792970081F5BA /* PBXContainerItemProxy */ = {
+               55D5F9BF727E4A3B6637802B /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = DA188D8C6BF8073122539131 /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = FB3C505511F7924A0081F5BA;
-                       remoteInfo = angle;
+                       remoteGlobalIDString = 6F4FD35CB3DFC89D70ECD432;
+                       remoteInfo = translator_common;
                };
-               FB3C50D011F79CCC0081F5BA /* PBXContainerItemProxy */ = {
+               60D3546AC27B094D6CA04CD6 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = DA188D8C6BF8073122539131 /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 31349D665FAE642AEB49135E;
-                       remoteInfo = "ANGLE Support";
+                       remoteGlobalIDString = 5892C7A3695330437AFE5714;
+                       remoteInfo = translator_glsl;
                };
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
                056FEADC7D95C6D4C9CF1113 /* scanner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
+               0A118E5003E5C0E253C53839 /* Compiler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Compiler.cpp; sourceTree = "<group>"; };
+               0A3A260F5379A7E2655D40F3 /* TranslatorESSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorESSL.cpp; sourceTree = "<group>"; };
                0C9B4616A65A5ABEF91FD6DC /* atom.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
+               120AD0A3B7642FB5A9AE3A56 /* VersionGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VersionGLSL.h; sourceTree = "<group>"; };
                12EAF028311EEA4753E82818 /* PoolAlloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PoolAlloc.h; sourceTree = "<group>"; };
                153BF06BF12C6F50496C6156 /* localintermediate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = "<group>"; };
+               182BAD50D4E58B884F5EB9F3 /* ForLoopUnroll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ForLoopUnroll.h; sourceTree = "<group>"; };
+               228A6DEDDF08DB370394A7AD /* SearchSymbol.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SearchSymbol.cpp; sourceTree = "<group>"; };
+               27C11EE10FED2979931FFC11 /* VariableInfo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VariableInfo.cpp; sourceTree = "<group>"; };
                27E4C7ED0B82E18DCBEDF1C9 /* BaseTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = "<group>"; };
                294F442A2606FEC55F12A28E /* memory.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
                2A765B86CBAF0D4A3E69DCA7 /* UnfoldSelect.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnfoldSelect.h; sourceTree = "<group>"; };
                2D00745DA9914FDE274D03D5 /* tokens.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
                2E7C9B6E6DB751E12A2F6CB6 /* InitializeGlobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeGlobals.h; sourceTree = "<group>"; };
                3DDDC77216202A4DE1808BDB /* libtranslator_common.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_common.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               3EE7215A7AB4EF71C97D2545 /* util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
+               3F68A6AA811495718A6938C0 /* glslang_tab.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_tab.cpp; sourceTree = "<group>"; };
                3F7C486C370A72938FE8160F /* Intermediate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = "<group>"; };
                4857E18799D332C30EF460C7 /* QualifierAlive.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
                48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = "<group>"; };
+               497C5C24EEF466FB4B50A259 /* glslang.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glslang.h; sourceTree = "<group>"; };
                4ABA230FEA3654B030E4C4FB /* debug.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = debug.cpp; sourceTree = "<group>"; };
+               4FCF32CB2D8A42C930A66B00 /* glslang_tab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glslang_tab.h; sourceTree = "<group>"; };
                528FF201839C6F233E26FFDA /* cpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
                56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderLang.cpp; sourceTree = "<group>"; };
+               57CF1F83E842901C42D44825 /* MapLongVariableNames.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MapLongVariableNames.cpp; sourceTree = "<group>"; };
                580B2A31F7C51A59B40F11A3 /* compile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
                5A21599C59BC1A75A7FABA34 /* OutputHLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputHLSL.h; sourceTree = "<group>"; };
+               5D99354C4D8187D384C81207 /* VariableInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VariableInfo.h; sourceTree = "<group>"; };
+               5DC9B647E10F65F66142ECC1 /* ForLoopUnroll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ForLoopUnroll.cpp; sourceTree = "<group>"; };
                60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = "<group>"; };
+               6BB66AB5873868E23675B6DB /* OutputESSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputESSL.h; sourceTree = "<group>"; };
                6BBC8224B9D8E234D117FA0C /* preprocess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
-               6E02565112E6934D00B3431F /* glslang_lex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_lex.cpp; sourceTree = "<group>"; };
-               6E02565212E6934D00B3431F /* glslang_tab.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_tab.cpp; sourceTree = "<group>"; };
-               6E02565312E6934D00B3431F /* glslang_tab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang_tab.h; sourceTree = "<group>"; };
-               6E02565412E6934D00B3431F /* glslang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang.h; sourceTree = "<group>"; };
                6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = "<group>"; };
                6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorGLSL.cpp; sourceTree = "<group>"; };
+               73A57C6D413773AEBA3C47A6 /* glslang_lex.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_lex.cpp; sourceTree = "<group>"; };
                799DC9611EE2EA3BA7CF5477 /* intermediate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = "<group>"; };
                7C6BB12AB099556CF379D78F /* SymbolTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
                7D9CF376DC5799B4C6B3331E /* symbols.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
                8058A0A2A0A02386867517EA /* cppstruct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
+               81CC4245A8E5AB5584D336F3 /* MapLongVariableNames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MapLongVariableNames.h; sourceTree = "<group>"; };
                831399DEE5DABA09570FB3E7 /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
                8513FAC699DB1558D1D49A48 /* Initialize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Initialize.h; sourceTree = "<group>"; };
                85845FFF5A8E63364308236D /* InitializeParseContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeParseContext.h; sourceTree = "<group>"; };
                89A6F7B1AD3918E64DF76EB1 /* slglobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
+               90254842D72975672C2E9A93 /* ValidateLimitations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ValidateLimitations.h; sourceTree = "<group>"; };
                93D61CB0BCE54E069D71F920 /* OutputGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputGLSL.h; sourceTree = "<group>"; };
                95276AA6B36FC1B1D913FCE4 /* debug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
                976C831A75EBE009A9861796 /* ParseHelper.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = "<group>"; };
                9CED3AFF1E61B45EE1005656 /* atom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
                9D47B1AC82E4EE859AC54243 /* QualifierAlive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QualifierAlive.h; sourceTree = "<group>"; };
                A0CE43631849276A31187C7B /* InitializeDll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeDll.h; sourceTree = "<group>"; };
+               A1644B00E9304C407FDC5F47 /* libtranslator_glsl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_glsl.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               A447F75F33DA4C4C123AC952 /* libtranslator_hlsl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_hlsl.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               A51C728B615B41E1D59E9902 /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
                A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = "<group>"; };
                AA53B6632C76F905DF08E564 /* Types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };
                AE65E139AE10DE9EFAD8D5B1 /* ShHandle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = "<group>"; };
                AE7674C52BDDDB28AF5FFD9F /* unistd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = "<group>"; };
+               B148D967B8D288A8267BFF3A /* ValidateLimitations.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateLimitations.cpp; sourceTree = "<group>"; };
                B2F5CA11EEA92DF2384EFD93 /* ConstantUnion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConstantUnion.h; sourceTree = "<group>"; };
                B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
+               B55B359CF7E486DBC49BBF0A /* OutputGLSLBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputGLSLBase.h; sourceTree = "<group>"; };
                B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
                B75707B393B7EAB7DD9999CB /* cpp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
                B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
                B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = "<group>"; };
+               BCDF01F002ADE9DB8A3EF4FE /* OutputGLSLBase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSLBase.cpp; sourceTree = "<group>"; };
                BE258486005F6696CC031622 /* ossource_posix.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = "<group>"; };
                C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorHLSL.cpp; sourceTree = "<group>"; };
                C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenHLSL.cpp; sourceTree = "<group>"; };
                D13C3693B9E40D37F2FAB34A /* tokens.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
                D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = "<group>"; };
                D40F78CB9BA0C89921FA319D /* RemoveTree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = "<group>"; };
+               D53DDD0CDF15EE1DD01F1A20 /* TranslatorESSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorESSL.h; sourceTree = "<group>"; };
+               DB2917C5B624712364DE4A75 /* OutputESSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputESSL.cpp; sourceTree = "<group>"; };
                DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorGLSL.h; sourceTree = "<group>"; };
                DEAF6F3126C2EC4397785C3F /* intermOut.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
                DEEAFC618A3B33F1FBFE3536 /* MMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = "<group>"; };
                E3711A48A0BF16B1CBD77AC9 /* UnfoldSelect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldSelect.cpp; sourceTree = "<group>"; };
                E3A29B6E9C21B67C25FF0D2B /* TranslatorHLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorHLSL.h; sourceTree = "<group>"; };
                F013A7240BDAE8A61413D8C0 /* symbols.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
+               F3E09DC8E1BF5D2958AACEDE /* SearchSymbol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SearchSymbol.h; sourceTree = "<group>"; };
+               F727AEC906712EC238041464 /* VersionGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VersionGLSL.cpp; sourceTree = "<group>"; };
                F74618F18FE5448115017C44 /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
                F7B2971D4EB3836B94B7ECAF /* InfoSink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoSink.h; sourceTree = "<group>"; };
-               FB3C505D11F7924A0081F5BA /* libangle.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libangle.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               F99E737D3FFD30CA5E354150 /* common.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = common.gypi; path = ../build/common.gypi; sourceTree = "<group>"; };
                FF3AA694DF9A4455A813234D /* scanner.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               FB3C505A11F7924A0081F5BA /* Frameworks */ = {
+               CA71CBA633EFC63166BEC9F3 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               FE3679A0955B25EB7BF116E6 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                196DB6AB006BB83503C7D786 /* Source */ = {
                        isa = PBXGroup;
                        children = (
-                               6E02565112E6934D00B3431F /* glslang_lex.cpp */,
-                               6E02565212E6934D00B3431F /* glslang_tab.cpp */,
-                               6E02565312E6934D00B3431F /* glslang_tab.h */,
-                               6E02565412E6934D00B3431F /* glslang.h */,
                                0E8D65F584FDB84DAABD3969 /* preprocessor */,
                                27E4C7ED0B82E18DCBEDF1C9 /* BaseTypes.h */,
                                B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */,
                                C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */,
                                F74618F18FE5448115017C44 /* Common.h */,
+                               0A118E5003E5C0E253C53839 /* Compiler.cpp */,
                                B2F5CA11EEA92DF2384EFD93 /* ConstantUnion.h */,
+                               5DC9B647E10F65F66142ECC1 /* ForLoopUnroll.cpp */,
+                               182BAD50D4E58B884F5EB9F3 /* ForLoopUnroll.h */,
                                6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */,
                                F7B2971D4EB3836B94B7ECAF /* InfoSink.h */,
                                A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */,
                                C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */,
                                3F7C486C370A72938FE8160F /* Intermediate.cpp */,
                                DEEAFC618A3B33F1FBFE3536 /* MMap.h */,
+                               57CF1F83E842901C42D44825 /* MapLongVariableNames.cpp */,
+                               81CC4245A8E5AB5584D336F3 /* MapLongVariableNames.h */,
+                               DB2917C5B624712364DE4A75 /* OutputESSL.cpp */,
+                               6BB66AB5873868E23675B6DB /* OutputESSL.h */,
                                48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */,
                                93D61CB0BCE54E069D71F920 /* OutputGLSL.h */,
+                               BCDF01F002ADE9DB8A3EF4FE /* OutputGLSLBase.cpp */,
+                               B55B359CF7E486DBC49BBF0A /* OutputGLSLBase.h */,
                                9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */,
                                5A21599C59BC1A75A7FABA34 /* OutputHLSL.h */,
                                976C831A75EBE009A9861796 /* ParseHelper.cpp */,
                                9D47B1AC82E4EE859AC54243 /* QualifierAlive.h */,
                                B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */,
                                D40F78CB9BA0C89921FA319D /* RemoveTree.h */,
+                               228A6DEDDF08DB370394A7AD /* SearchSymbol.cpp */,
+                               F3E09DC8E1BF5D2958AACEDE /* SearchSymbol.h */,
                                AE65E139AE10DE9EFAD8D5B1 /* ShHandle.h */,
                                56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */,
                                B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */,
                                7C6BB12AB099556CF379D78F /* SymbolTable.h */,
+                               0A3A260F5379A7E2655D40F3 /* TranslatorESSL.cpp */,
+                               D53DDD0CDF15EE1DD01F1A20 /* TranslatorESSL.h */,
                                6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */,
                                DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */,
                                C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */,
                                AA53B6632C76F905DF08E564 /* Types.h */,
                                E3711A48A0BF16B1CBD77AC9 /* UnfoldSelect.cpp */,
                                2A765B86CBAF0D4A3E69DCA7 /* UnfoldSelect.h */,
+                               B148D967B8D288A8267BFF3A /* ValidateLimitations.cpp */,
+                               90254842D72975672C2E9A93 /* ValidateLimitations.h */,
+                               27C11EE10FED2979931FFC11 /* VariableInfo.cpp */,
+                               5D99354C4D8187D384C81207 /* VariableInfo.h */,
+                               F727AEC906712EC238041464 /* VersionGLSL.cpp */,
+                               120AD0A3B7642FB5A9AE3A56 /* VersionGLSL.h */,
                                4ABA230FEA3654B030E4C4FB /* debug.cpp */,
                                95276AA6B36FC1B1D913FCE4 /* debug.h */,
+                               497C5C24EEF466FB4B50A259 /* glslang.h */,
+                               73A57C6D413773AEBA3C47A6 /* glslang_lex.cpp */,
+                               3F68A6AA811495718A6938C0 /* glslang_tab.cpp */,
+                               4FCF32CB2D8A42C930A66B00 /* glslang_tab.h */,
                                DEAF6F3126C2EC4397785C3F /* intermOut.cpp */,
                                799DC9611EE2EA3BA7CF5477 /* intermediate.h */,
                                153BF06BF12C6F50496C6156 /* localintermediate.h */,
                                BE258486005F6696CC031622 /* ossource_posix.cpp */,
                                D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */,
                                AE7674C52BDDDB28AF5FFD9F /* unistd.h */,
+                               3EE7215A7AB4EF71C97D2545 /* util.cpp */,
+                               A51C728B615B41E1D59E9902 /* util.h */,
                        );
                        name = Source;
                        path = compiler;
                        isa = PBXGroup;
                        children = (
                                CF2B62E0820C831AF812D000 /* build_angle.gyp */,
+                               F99E737D3FFD30CA5E354150 /* common.gypi */,
                        );
                        name = Build;
                        sourceTree = "<group>";
                        isa = PBXGroup;
                        children = (
                                3DDDC77216202A4DE1808BDB /* libtranslator_common.a */,
-                               FB3C505D11F7924A0081F5BA /* libangle.a */,
+                               A1644B00E9304C407FDC5F47 /* libtranslator_glsl.a */,
+                               A447F75F33DA4C4C123AC952 /* libtranslator_hlsl.a */,
                        );
                        name = Products;
                        sourceTree = "<group>";
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
+               5892C7A3695330437AFE5714 /* translator_glsl */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 8B8815CA2EFE60FD0C0361BF /* Build configuration list for PBXNativeTarget "translator_glsl" */;
+                       buildPhases = (
+                               BABCE721106B5C1527EFEF0D /* Sources */,
+                               CA71CBA633EFC63166BEC9F3 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = translator_glsl;
+                       productName = translator_glsl;
+                       productReference = A1644B00E9304C407FDC5F47 /* libtranslator_glsl.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
                6F4FD35CB3DFC89D70ECD432 /* translator_common */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */;
                        buildRules = (
                        );
                        dependencies = (
-                               291EE04202EC7967835FCC38 /* PBXTargetDependency */,
                        );
                        name = translator_common;
                        productName = translator_common;
                        productReference = 3DDDC77216202A4DE1808BDB /* libtranslator_common.a */;
                        productType = "com.apple.product-type.library.static";
                };
-               FB3C505511F7924A0081F5BA /* angle */ = {
+               A838E9574B3FF14791DBDAB1 /* translator_hlsl */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = FB3C505B11F7924A0081F5BA /* Build configuration list for PBXNativeTarget "angle" */;
+                       buildConfigurationList = C71E79C7829FD796CF621B44 /* Build configuration list for PBXNativeTarget "translator_hlsl" */;
                        buildPhases = (
-                               FB3C505611F7924A0081F5BA /* Sources */,
-                               FB3C505A11F7924A0081F5BA /* Frameworks */,
+                               05F3BCA9518770BE3F1E0A38 /* Sources */,
+                               FE3679A0955B25EB7BF116E6 /* Frameworks */,
                        );
                        buildRules = (
                        );
                        dependencies = (
-                               FB3C50D111F79CCC0081F5BA /* PBXTargetDependency */,
                        );
-                       name = angle;
-                       productName = translator_glsl;
-                       productReference = FB3C505D11F7924A0081F5BA /* libangle.a */;
+                       name = translator_hlsl;
+                       productName = translator_hlsl;
+                       productReference = A447F75F33DA4C4C123AC952 /* libtranslator_hlsl.a */;
                        productType = "com.apple.product-type.library.static";
                };
 /* End PBXNativeTarget section */
                        buildConfigurationList = 0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */;
                        compatibilityVersion = "Xcode 3.1";
                        hasScannedForEncodings = 1;
-                       knownRegions = (
-                               English,
-                               Japanese,
-                               French,
-                               German,
-                       );
                        mainGroup = 5BBEFF9B91738297B95C568D;
                        projectDirPath = "";
                        projectRoot = "";
                        targets = (
                                1563D9916BFDAD853032CE1A /* All */,
                                6F4FD35CB3DFC89D70ECD432 /* translator_common */,
-                               31349D665FAE642AEB49135E /* ANGLE Support */,
-                               FB3C505511F7924A0081F5BA /* angle */,
+                               5892C7A3695330437AFE5714 /* translator_glsl */,
+                               A838E9574B3FF14791DBDAB1 /* translator_hlsl */,
                        );
                };
 /* End PBXProject section */
 
-/* Begin PBXShellScriptBuildPhase section */
-               0D513F8B923949C156DB02C5 /* Action "bison_glslang" */ = {
-                       isa = PBXShellScriptBuildPhase;
+/* Begin PBXSourcesBuildPhase section */
+               05F3BCA9518770BE3F1E0A38 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                       );
-                       inputPaths = (
-                               compiler/glslang.y,
-                       );
-                       name = "Action \"bison_glslang\"";
-                       outputPaths = (
-                               "$(INTERMEDIATE_DIR)/glslang_tab.cpp",
-                               "$(INTERMEDIATE_DIR)/glslang_tab.h",
+                               4B4BDE7AD6266B39ED43C2D4 /* CodeGenHLSL.cpp in Sources */,
+                               5F7B52A54DCE8155ED94ECF8 /* OutputHLSL.cpp in Sources */,
+                               E99D6D80DBF05ECE7108B26D /* TranslatorHLSL.cpp in Sources */,
+                               9886BCD5D0DD69B6FDE09DD8 /* UnfoldSelect.cpp in Sources */,
+                               296466566D8C0F023A553760 /* SearchSymbol.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "echo note: \"Executing bison on compiler/glslang.y\"\nexec bison --no-lines \"--defines=${INTERMEDIATE_DIR}/glslang_tab.h\" \"--skeleton=yacc.c\" \"--output=${INTERMEDIATE_DIR}/glslang_tab.cpp\" compiler/glslang.y\nexit 1\n";
-                       showEnvVarsInLog = 0;
                };
-               FA0D7125DB06A7A7716A5910 /* Action "flex_glslang" */ = {
-                       isa = PBXShellScriptBuildPhase;
+               BABCE721106B5C1527EFEF0D /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                       );
-                       inputPaths = (
-                               compiler/glslang.l,
-                       );
-                       name = "Action \"flex_glslang\"";
-                       outputPaths = (
-                               "$(INTERMEDIATE_DIR)/glslang.cpp",
+                               D56F7D00E9B162E416D37DF0 /* CodeGenGLSL.cpp in Sources */,
+                               0EC09B3B254829F8F1D952D3 /* ForLoopUnroll.cpp in Sources */,
+                               C4AAB2BB4594C0DA318DCB1C /* OutputESSL.cpp in Sources */,
+                               9B111B83FB636FD5CDEC32A0 /* OutputGLSLBase.cpp in Sources */,
+                               C75EB9292A0DDA45592A8ACF /* OutputGLSL.cpp in Sources */,
+                               93A41AF036E5EF87B366B563 /* TranslatorESSL.cpp in Sources */,
+                               3F18389BCB89370A930667F4 /* TranslatorGLSL.cpp in Sources */,
+                               0AC1897E461A0D4758E3DCE3 /* VersionGLSL.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "echo note: \"Executing flex on compiler/glslang.l\"\nexec flex --noline --nounistd \"--outfile=${INTERMEDIATE_DIR}/glslang.cpp\" compiler/glslang.l\nexit 1\n";
-                       showEnvVarsInLog = 0;
                };
-/* End PBXShellScriptBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
                EAA22CA63FD572FCCB913D22 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               08A7933BD2F78A86B90200F6 /* Compiler.cpp in Sources */,
                                888F1382498E2D74AF2801C8 /* debug.cpp in Sources */,
+                               3021E0BF1BC8442FF1F2F2B4 /* glslang_lex.cpp in Sources */,
+                               2E7C0D3804B8308A493D9B4B /* glslang_tab.cpp in Sources */,
                                BEBBF4F0819EA3D03977A8FC /* InfoSink.cpp in Sources */,
                                3065D29E97FAC6E127388D15 /* Initialize.cpp in Sources */,
                                0A216949103E1E228F9C12F0 /* InitializeDll.cpp in Sources */,
                                50DF00005CC4212F6FB1291D /* Intermediate.cpp in Sources */,
                                40FC189B8A246EDF14C2FDE3 /* intermOut.cpp in Sources */,
                                F5AE2A292DFAF8C158412AA2 /* IntermTraverse.cpp in Sources */,
+                               896B720BD21F6749A7D83F30 /* MapLongVariableNames.cpp in Sources */,
                                9E8DFE1CCEF038BF2B65428C /* parseConst.cpp in Sources */,
                                6F9F875017A68ABE5D39FF19 /* ParseHelper.cpp in Sources */,
                                E1C7C5DFF0B2DFEC09387F4E /* PoolAlloc.cpp in Sources */,
                                AC23F58FDD3C55F5CA18EED7 /* RemoveTree.cpp in Sources */,
                                B8BD2685A16B188CCDFB052B /* ShaderLang.cpp in Sources */,
                                F6ABD58F8CAB7641D8BFE935 /* SymbolTable.cpp in Sources */,
+                               55CBD87573B803A173AC9129 /* util.cpp in Sources */,
+                               0E9456F464E16392D1CCD030 /* ValidateLimitations.cpp in Sources */,
+                               1ED1D2C7C74C6B625AFB1CCF /* VariableInfo.cpp in Sources */,
                                32B1DBCD6B83F2146D787A62 /* atom.c in Sources */,
                                CB7F0EF0D6A89FA8C4DF5513 /* cpp.c in Sources */,
                                35BE1BBEE6135A1CB0608EA8 /* cppstruct.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               FB3C505611F7924A0081F5BA /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               FB3C50AB11F7951B0081F5BA /* TranslatorGLSL.h in Sources */,
-                               FB3C50AC11F7951B0081F5BA /* OutputGLSL.h in Sources */,
-                               FB3C50A411F794FF0081F5BA /* atom.c in Sources */,
-                               FB3C50A511F794FF0081F5BA /* cpp.c in Sources */,
-                               FB3C50A611F794FF0081F5BA /* cppstruct.c in Sources */,
-                               FB3C50A711F794FF0081F5BA /* memory.c in Sources */,
-                               FB3C50A811F794FF0081F5BA /* scanner.c in Sources */,
-                               FB3C50A911F794FF0081F5BA /* symbols.c in Sources */,
-                               FB3C50AA11F794FF0081F5BA /* tokens.c in Sources */,
-                               FB3C505711F7924A0081F5BA /* CodeGenGLSL.cpp in Sources */,
-                               FB3C509211F794CE0081F5BA /* debug.cpp in Sources */,
-                               FB3C509311F794CE0081F5BA /* InfoSink.cpp in Sources */,
-                               FB3C509411F794CE0081F5BA /* Initialize.cpp in Sources */,
-                               FB3C509511F794CE0081F5BA /* InitializeDll.cpp in Sources */,
-                               FB3C509611F794CE0081F5BA /* Intermediate.cpp in Sources */,
-                               FB3C509711F794CE0081F5BA /* intermOut.cpp in Sources */,
-                               FB3C509811F794CE0081F5BA /* IntermTraverse.cpp in Sources */,
-                               FB3C509A11F794CE0081F5BA /* ossource_posix.cpp in Sources */,
-                               FB3C505811F7924A0081F5BA /* OutputGLSL.cpp in Sources */,
-                               FB3C509B11F794CE0081F5BA /* parseConst.cpp in Sources */,
-                               FB3C509C11F794CE0081F5BA /* ParseHelper.cpp in Sources */,
-                               FB3C509D11F794CE0081F5BA /* PoolAlloc.cpp in Sources */,
-                               FB3C509E11F794CE0081F5BA /* QualifierAlive.cpp in Sources */,
-                               FB3C509F11F794CE0081F5BA /* RemoveTree.cpp in Sources */,
-                               FB3C50A011F794CE0081F5BA /* ShaderLang.cpp in Sources */,
-                               FB3C50A111F794CE0081F5BA /* SymbolTable.cpp in Sources */,
-                               FB3C505911F7924A0081F5BA /* TranslatorGLSL.cpp in Sources */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXTargetDependency section */
-               291EE04202EC7967835FCC38 /* PBXTargetDependency */ = {
+               A15E78BECDFF20BC3FFF040A /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
-                       target = 31349D665FAE642AEB49135E /* ANGLE Support */;
-                       targetProxy = E69BFBE2D1272620E46C3F8A /* PBXContainerItemProxy */;
+                       target = 6F4FD35CB3DFC89D70ECD432 /* translator_common */;
+                       targetProxy = 55D5F9BF727E4A3B6637802B /* PBXContainerItemProxy */;
                };
-               FB3C506411F792970081F5BA /* PBXTargetDependency */ = {
+               BA246CA19435A9FA8AC69146 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
-                       target = FB3C505511F7924A0081F5BA /* angle */;
-                       targetProxy = FB3C506311F792970081F5BA /* PBXContainerItemProxy */;
+                       target = 5892C7A3695330437AFE5714 /* translator_glsl */;
+                       targetProxy = 60D3546AC27B094D6CA04CD6 /* PBXContainerItemProxy */;
                };
-               FB3C50D111F79CCC0081F5BA /* PBXTargetDependency */ = {
+               E4A3D33CA49D013550B8BA5F /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
-                       target = 31349D665FAE642AEB49135E /* ANGLE Support */;
-                       targetProxy = FB3C50D011F79CCC0081F5BA /* PBXContainerItemProxy */;
+                       target = A838E9574B3FF14791DBDAB1 /* translator_hlsl */;
+                       targetProxy = 1F7242496103EDF29CC25D87 /* PBXContainerItemProxy */;
                };
 /* End PBXTargetDependency section */
 
 /* Begin XCBuildConfiguration section */
-               00BF2EBCBDF5678F4BA2FA92 /* Default */ = {
+               322A8C62423B595E11BAD42D /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               PRODUCT_NAME = "translator_common Support";
+                               PRODUCT_NAME = All;
                        };
-                       name = Default;
+                       name = Debug;
                };
-               1A12AA5D65ACDE71AE089EE3 /* Default */ = {
+               4DA42A78D3B855C9CD8F658D /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "\"ANGLE_DISABLE_TRACE\"",
+                                       "\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
+                               );
+                               HEADER_SEARCH_PATHS = (
+                                       .,
+                                       ../include,
+                               );
+                               PRODUCT_NAME = translator_common;
+                       };
+                       name = Release;
+               };
+               4F851F5BA5FA43E9E0B9CB86 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                PRODUCT_NAME = All;
                        };
-                       name = Default;
+                       name = Release;
                };
-               1F3F1218B5135FBB067DE809 /* Default */ = {
+               88ADC9285519A668808B51EE /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                EXECUTABLE_PREFIX = lib;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "\"ANGLE_DISABLE_TRACE\"",
+                                       "\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
+                               );
                                HEADER_SEARCH_PATHS = (
                                        .,
                                        ../include,
                                );
-                               PRODUCT_NAME = translator_common;
+                               PRODUCT_NAME = translator_glsl;
+                       };
+                       name = Debug;
+               };
+               9DC66E1FF9349CDCC8D52C46 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
+                               SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
+                       };
+                       name = Debug;
+               };
+               AF7C2CD10C6FEA076B141E6E /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "\"ANGLE_DISABLE_TRACE\"",
+                                       "\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
+                               );
+                               HEADER_SEARCH_PATHS = (
+                                       .,
+                                       ../include,
+                               );
+                               PRODUCT_NAME = translator_glsl;
+                       };
+                       name = Release;
+               };
+               B096FAF032DB19AB637D38F0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "\"ANGLE_DISABLE_TRACE\"",
+                                       "\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
+                               );
+                               HEADER_SEARCH_PATHS = (
+                                       .,
+                                       ../include,
+                               );
+                               PRODUCT_NAME = translator_hlsl;
                        };
-                       name = Default;
+                       name = Release;
                };
-               BC5793C9A1FF021A81C66559 /* Default */ = {
+               C4546B14B0EB5EB8C5D39DC2 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_64_BIT)";
-                               CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
                                INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
-                               OBJROOT = "";
-                               ONLY_ACTIVE_ARCH = YES;
                                SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
-                               SYMROOT = "$(BUILD_DIR)";
                        };
-                       name = Default;
+                       name = Release;
+               };
+               F029E0D369FAFEA46BDAFCEE /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "\"ANGLE_DISABLE_TRACE\"",
+                                       "\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
+                               );
+                               HEADER_SEARCH_PATHS = (
+                                       .,
+                                       ../include,
+                               );
+                               PRODUCT_NAME = translator_hlsl;
+                       };
+                       name = Debug;
                };
-               FB3C505C11F7924A0081F5BA /* Default */ = {
+               FF01CDF4594E0FF9E581B319 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                EXECUTABLE_PREFIX = lib;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "\"ANGLE_DISABLE_TRACE\"",
+                                       "\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
+                               );
                                HEADER_SEARCH_PATHS = (
                                        .,
                                        ../include,
                                );
-                               PRODUCT_NAME = angle;
+                               PRODUCT_NAME = translator_common;
                        };
-                       name = Default;
+                       name = Debug;
                };
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-               0AA54825BF5DF0A3FBA92B60 /* Build configuration list for PBXAggregateTarget "ANGLE Support" */ = {
+               0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               00BF2EBCBDF5678F4BA2FA92 /* Default */,
+                               9DC66E1FF9349CDCC8D52C46 /* Debug */,
+                               C4546B14B0EB5EB8C5D39DC2 /* Release */,
                        );
                        defaultConfigurationIsVisible = 1;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Debug;
                };
-               0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */ = {
+               34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               BC5793C9A1FF021A81C66559 /* Default */,
+                               FF01CDF4594E0FF9E581B319 /* Debug */,
+                               4DA42A78D3B855C9CD8F658D /* Release */,
                        );
                        defaultConfigurationIsVisible = 1;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Debug;
                };
-               34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */ = {
+               77CEFB7B40F05B0A804E6B2B /* Build configuration list for PBXAggregateTarget "All" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               1F3F1218B5135FBB067DE809 /* Default */,
+                               322A8C62423B595E11BAD42D /* Debug */,
+                               4F851F5BA5FA43E9E0B9CB86 /* Release */,
                        );
                        defaultConfigurationIsVisible = 1;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Debug;
                };
-               77CEFB7B40F05B0A804E6B2B /* Build configuration list for PBXAggregateTarget "All" */ = {
+               8B8815CA2EFE60FD0C0361BF /* Build configuration list for PBXNativeTarget "translator_glsl" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               1A12AA5D65ACDE71AE089EE3 /* Default */,
+                               88ADC9285519A668808B51EE /* Debug */,
+                               AF7C2CD10C6FEA076B141E6E /* Release */,
                        );
                        defaultConfigurationIsVisible = 1;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Debug;
                };
-               FB3C505B11F7924A0081F5BA /* Build configuration list for PBXNativeTarget "angle" */ = {
+               C71E79C7829FD796CF621B44 /* Build configuration list for PBXNativeTarget "translator_hlsl" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               FB3C505C11F7924A0081F5BA /* Default */,
+                               F029E0D369FAFEA46BDAFCEE /* Debug */,
+                               B096FAF032DB19AB637D38F0 /* Release */,
                        );
                        defaultConfigurationIsVisible = 1;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Debug;
                };
 /* End XCConfigurationList section */
        };
index 3de5d4e..b57f3c5 100644 (file)
@@ -1,44 +1,97 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// debug.cpp: Debugging utilities.
-
-#include "common/debug.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#ifndef TRACE_OUTPUT_FILE
-#define TRACE_OUTPUT_FILE "debug.txt"
-#endif
-
-static bool trace_on = true;
-
-namespace gl
-{
-void trace(const char *format, ...)
-{
-#if !defined(ANGLE_DISABLE_TRACE) 
-    if (trace_on)
-    {
-        if (format)
-        {
-            FILE *file = fopen(TRACE_OUTPUT_FILE, "a");
-
-            if (file)
-            {
-                va_list vararg;
-                va_start(vararg, format);
-                vfprintf(file, format, vararg);
-                va_end(vararg);
-
-                fclose(file);
-            }
-        }
-    }
-#endif // !defined(ANGLE_DISABLE_TRACE)
-}
-}
+//\r
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.\r
+// Use of this source code is governed by a BSD-style license that can be\r
+// found in the LICENSE file.\r
+//\r
+\r
+// debug.cpp: Debugging utilities.\r
+\r
+#include "common/debug.h"\r
+\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+#include <d3d9.h>\r
+#include <windows.h>\r
+\r
+namespace gl\r
+{\r
+\r
+typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);\r
+\r
+static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)\r
+{\r
+#if !defined(ANGLE_DISABLE_PERF)\r
+    if (perfActive())\r
+    {\r
+        char message[4096];\r
+        int len = vsprintf_s(message, format, vararg);\r
+        if (len < 0)\r
+        {\r
+            return;\r
+        }\r
+\r
+        // There are no ASCII variants of these D3DPERF functions.\r
+        wchar_t wideMessage[4096];\r
+        for (int i = 0; i < len; ++i)\r
+        {\r
+            wideMessage[i] = message[i];\r
+        }\r
+        wideMessage[len] = 0;\r
+\r
+        perfFunc(0, wideMessage);\r
+    }\r
+#endif\r
+\r
+#if !defined(ANGLE_DISABLE_TRACE)\r
+#if defined(NDEBUG)\r
+    if (traceFileDebugOnly)\r
+    {\r
+        return;\r
+    }\r
+#endif\r
+\r
+    FILE* file = fopen(TRACE_OUTPUT_FILE, "a");\r
+    if (file)\r
+    {\r
+        vfprintf(file, format, vararg);\r
+        fclose(file);\r
+    }\r
+#endif\r
+}\r
+\r
+void trace(bool traceFileDebugOnly, const char *format, ...)\r
+{\r
+    va_list vararg;\r
+    va_start(vararg, format);\r
+    output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);\r
+    va_end(vararg);\r
+}\r
+\r
+bool perfActive()\r
+{\r
+#if defined(ANGLE_DISABLE_PERF)\r
+    return false;\r
+#else\r
+    static bool active = D3DPERF_GetStatus() != 0;\r
+    return active;\r
+#endif\r
+}\r
+\r
+ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)\r
+{\r
+    va_list vararg;\r
+    va_start(vararg, format);\r
+    output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);\r
+    va_end(vararg);\r
+}\r
+\r
+ScopedPerfEventHelper::~ScopedPerfEventHelper()\r
+{\r
+#if !defined(ANGLE_DISABLE_PERF)\r
+    if (perfActive())\r
+    {\r
+        D3DPERF_EndEvent();\r
+    }\r
+#endif\r
+}\r
+}\r
index 2c4ec70..9828ecf 100644 (file)
 #include <stdio.h>
 #include <assert.h>
 
+#include "common/angleutils.h"
+
+#if !defined(TRACE_OUTPUT_FILE)
+#define TRACE_OUTPUT_FILE "debug.txt"
+#endif
+
 namespace gl
 {
     // Outputs text to the debugging log
-    void trace(const char *format, ...);
+    void trace(bool traceFileDebugOnly, const char *format, ...);
+
+    // Returns whether D3DPERF is active.
+    bool perfActive();
+
+    // Pairs a D3D begin event with an end event.
+    class ScopedPerfEventHelper
+    {
+      public:
+        ScopedPerfEventHelper(const char* format, ...);
+        ~ScopedPerfEventHelper();
+
+      private:
+        DISALLOW_COPY_AND_ASSIGN(ScopedPerfEventHelper);
+    };
 }
 
 // A macro to output a trace of a function call and its arguments to the debugging log
-#if !defined(NDEBUG) && !defined(ANGLE_DISABLE_TRACE) 
-    #define TRACE(message, ...) gl::trace("trace: %s"message"\n", __FUNCTION__, __VA_ARGS__)
+#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
+#define TRACE(message, ...) (void(0))
+#else
+#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#endif
+
+// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
+#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
+#define FIXME(message, ...) (void(0))
 #else
-    #define TRACE(...) ((void)0)
+#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
 #endif
 
-// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing. Will occur even in release mode.
-#define FIXME(message, ...) gl::trace("fixme: %s"message"\n", __FUNCTION__, __VA_ARGS__)
+// A macro to output a function call and its arguments to the debugging log, in case of error.
+#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
+#define ERR(message, ...) (void(0))
+#else
+#define ERR(message, ...) gl::trace(false, "err: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#endif
 
-// A macro to output a function call and its arguments to the debugging log, in case of error. Will occur even in release mode.
-#define ERR(message, ...) gl::trace("err: %s"message"\n", __FUNCTION__, __VA_ARGS__)
+// A macro to log a performance event around a scope.
+#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
+#define EVENT(message, ...) (void(0))
+#else
+#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
+#endif
 
 // A macro asserting a condition and outputting failures to the debug log
+#if !defined(NDEBUG)
 #define ASSERT(expression) do { \
     if(!(expression)) \
         ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
-    assert(expression); \
+        assert(expression); \
     } while(0)
-
+#else
+#define ASSERT(expression) (void(0))
+#endif
 
 // A macro to indicate unimplemented functionality
-#ifndef NDEBUG
-    #define UNIMPLEMENTED() do { \
-        FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
-        assert(false); \
-        } while(0)
+#if !defined(NDEBUG)
+#define UNIMPLEMENTED() do { \
+    FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
+    assert(false); \
+    } while(0)
 #else
     #define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
 #endif
 
 // A macro for code which is not expected to be reached under valid assumptions
-#ifndef NDEBUG
-    #define UNREACHABLE() do { \
-        ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
-        assert(false); \
-        } while(0)
+#if !defined(NDEBUG)
+#define UNREACHABLE() do { \
+    ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
+    assert(false); \
+    } while(0)
 #else
     #define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
 #endif
diff --git a/Source/ThirdParty/ANGLE/src/common/version.h b/Source/ThirdParty/ANGLE/src/common/version.h
new file mode 100644 (file)
index 0000000..4763332
--- /dev/null
@@ -0,0 +1,10 @@
+#define MAJOR_VERSION 0
+#define MINOR_VERSION 0
+#define BUILD_VERSION 0
+#define BUILD_REVISION 696
+
+#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)
index d140b37..226bf8f 100644 (file)
@@ -5,15 +5,24 @@
 //
 
 #include "compiler/TranslatorGLSL.h"
+#include "compiler/TranslatorESSL.h"
 
 //
 // This function must be provided to create the actual
 // compile object used by higher level code.  It returns
 // a subclass of TCompiler.
 //
-TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
+TCompiler* ConstructCompiler(
+    ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
 {
-    return new TranslatorGLSL(type, spec);
+    switch (output) {
+      case SH_GLSL_OUTPUT:
+        return new TranslatorGLSL(type, spec);
+      case SH_ESSL_OUTPUT:
+        return new TranslatorESSL(type, spec);
+      default:
+        return NULL;
+    }
 }
 
 //
index e04e789..f46ff66 100644 (file)
 // compile object used by higher level code.  It returns
 // a subclass of TCompiler.
 //
-TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
+TCompiler* ConstructCompiler(
+    ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
 {
-    return new TranslatorHLSL(type, spec);
+  switch (output) {
+    case SH_HLSL_OUTPUT:
+      return new TranslatorHLSL(type, spec);
+    default:
+      return NULL;
+  }
 }
 
 //
index 649b457..5d86a3e 100644 (file)
@@ -8,6 +8,7 @@
 #include "compiler/ParseHelper.h"
 #include "compiler/ShHandle.h"
 #include "compiler/ValidateLimitations.h"
+#include "compiler/MapLongVariableNames.h"
 
 namespace {
 bool InitializeSymbolTable(
@@ -17,7 +18,9 @@ bool InitializeSymbolTable(
 {
     TIntermediate intermediate(infoSink);
     TExtensionBehavior extBehavior;
-    TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, infoSink);
+    // 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);
 
     GlobalParseContext = &parseContext;
 
@@ -115,9 +118,19 @@ bool TCompiler::compile(const char* const shaderStrings[],
     if (shaderSpec == SH_WEBGL_SPEC)
         compileOptions |= SH_VALIDATE_LOOP_INDEXING;
 
+    // First string is path of source file if flag is set. The actual source follows.
+    const char* sourcePath = NULL;
+    int firstSource = 0;
+    if (compileOptions & SH_SOURCE_PATH)
+    {
+        sourcePath = shaderStrings[0];
+        ++firstSource;
+    }
+
     TIntermediate intermediate(infoSink);
     TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
-                               shaderType, shaderSpec, infoSink);
+                               shaderType, shaderSpec, compileOptions, true,
+                               sourcePath, infoSink);
     GlobalParseContext = &parseContext;
 
     // We preserve symbols at the built-in level from compile-to-compile.
@@ -128,7 +141,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
 
     // Parse shader.
     bool success =
-        (PaParseStrings(numStrings, shaderStrings, NULL, &parseContext) == 0) &&
+        (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
         (parseContext.treeRoot != NULL);
     if (success) {
         TIntermNode* root = parseContext.treeRoot;
@@ -137,14 +150,20 @@ bool TCompiler::compile(const char* const shaderStrings[],
         if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
             success = validateLimitations(root);
 
+        // Call mapLongVariableNames() before collectAttribsUniforms() so in
+        // collectAttribsUniforms() we already have the mapped symbol names and
+        // we could composite mapped and original variable names.
+        if (compileOptions & SH_MAP_LONG_VARIABLE_NAMES)
+            mapLongVariableNames(root);
+
+        if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS))
+            collectAttribsUniforms(root);
+
         if (success && (compileOptions & SH_INTERMEDIATE_TREE))
             intermediate.outputTree(root);
 
         if (success && (compileOptions & SH_OBJECT_CODE))
             translate(root);
-
-        if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS))
-            collectAttribsUniforms(root);
     }
 
     // Cleanup memory.
@@ -187,3 +206,19 @@ void TCompiler::collectAttribsUniforms(TIntermNode* root)
     CollectAttribsUniforms collect(attribs, uniforms);
     root->traverse(&collect);
 }
+
+void TCompiler::mapLongVariableNames(TIntermNode* root)
+{
+    MapLongVariableNames map(varyingLongNameMap);
+    root->traverse(&map);
+}
+
+int TCompiler::getMappedNameMaxLength() const
+{
+    return MAX_IDENTIFIER_NAME_SIZE + 1;
+}
+
+const TExtensionBehavior& TCompiler::getExtensionBehavior() const
+{
+    return extensionBehavior;
+}
index aa1b875..d28a11b 100644 (file)
@@ -26,26 +26,17 @@ public:
 
     bool operator==(const int i) const
     {
-        if (i == iConst)
-            return true;
-
-        return false;
+        return i == iConst;
     }
 
     bool operator==(const float f) const
     {
-        if (f == fConst)
-            return true;
-
-        return false;
+        return f == fConst;
     }
 
     bool operator==(const bool b) const
     {
-        if (b == bConst)
-            return true;
-
-        return false;
+        return b == bConst;
     }
 
     bool operator==(const ConstantUnion& constant) const
@@ -55,20 +46,11 @@ public:
 
         switch (type) {
         case EbtInt:
-            if (constant.iConst == iConst)
-                return true;
-
-            break;
+            return constant.iConst == iConst;
         case EbtFloat:
-            if (constant.fConst == fConst)
-                return true;
-
-            break;
+            return constant.fConst == fConst;
         case EbtBool:
-            if (constant.bConst == bConst)
-                return true;
-
-            break;
+            return constant.bConst == bConst;
         default:
             return false;
         }
@@ -101,18 +83,11 @@ public:
         assert(type == constant.type);
         switch (type) {
         case EbtInt:
-            if (iConst > constant.iConst)
-                return true;
-
-            return false;
+            return iConst > constant.iConst;
         case EbtFloat:
-            if (fConst > constant.fConst)
-                return true;
-
-            return false;
+            return fConst > constant.fConst;
         default:
-            assert(false && "Default missing");
-            return false;
+            return false;   // Invalid operation, handled at semantic analysis
         }
 
         return false;
@@ -123,18 +98,11 @@ public:
         assert(type == constant.type);
         switch (type) {
         case EbtInt:
-            if (iConst < constant.iConst)
-                return true;
-
-            return false;
+            return iConst < constant.iConst;
         case EbtFloat:
-            if (fConst < constant.fConst)
-                return true;
-
-            return false;
+            return fConst < constant.fConst;
         default:
-            assert(false && "Default missing");
-            return false;
+            return false;   // Invalid operation, handled at semantic analysis
         }
 
         return false;
index da96c24..ab5a0a5 100644 (file)
@@ -16,6 +16,22 @@ typedef enum {
     EBhDisable
 } TBehavior;
 
+inline const char* getBehaviorString(TBehavior b)
+{
+    switch(b) {
+      case EBhRequire:
+        return "require";
+      case EBhEnable:
+        return "enable";
+      case EBhWarn:
+        return "warn";
+      case EBhDisable:
+        return "disable";
+      default:
+        return NULL;
+    }
+}
+
 typedef TMap<TString, TBehavior> TExtensionBehavior;
 
 #endif // _EXTENSION_TABLE_INCLUDED_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.cpp b/Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.cpp
new file mode 100644 (file)
index 0000000..d631af4
--- /dev/null
@@ -0,0 +1,172 @@
+//
+// Copyright (c) 2002-2011 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/ForLoopUnroll.h"
+
+void ForLoopUnroll::FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info)
+{
+    ASSERT(node->getType() == ELoopFor);
+    ASSERT(node->getUnrollFlag());
+
+    TIntermNode* init = node->getInit();
+    ASSERT(init != NULL);
+    TIntermAggregate* decl = init->getAsAggregate();
+    ASSERT((decl != NULL) && (decl->getOp() == EOpDeclaration));
+    TIntermSequence& declSeq = decl->getSequence();
+    ASSERT(declSeq.size() == 1);
+    TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
+    ASSERT((declInit != NULL) && (declInit->getOp() == EOpInitialize));
+    TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
+    ASSERT(symbol != NULL);
+    ASSERT(symbol->getBasicType() == EbtInt);
+
+    info.id = symbol->getId();
+
+    ASSERT(declInit->getRight() != NULL);
+    TIntermConstantUnion* initNode = declInit->getRight()->getAsConstantUnion();
+    ASSERT(initNode != NULL);
+
+    info.initValue = evaluateIntConstant(initNode);
+    info.currentValue = info.initValue;
+
+    TIntermNode* cond = node->getCondition();
+    ASSERT(cond != NULL);
+    TIntermBinary* binOp = cond->getAsBinaryNode();
+    ASSERT(binOp != NULL);
+    ASSERT(binOp->getRight() != NULL);
+    ASSERT(binOp->getRight()->getAsConstantUnion() != NULL);
+
+    info.incrementValue = getLoopIncrement(node);
+    info.stopValue = evaluateIntConstant(
+        binOp->getRight()->getAsConstantUnion());
+    info.op = binOp->getOp();
+}
+
+void ForLoopUnroll::Step()
+{
+    ASSERT(mLoopIndexStack.size() > 0);
+    TLoopIndexInfo& info = mLoopIndexStack[mLoopIndexStack.size() - 1];
+    info.currentValue += info.incrementValue;
+}
+
+bool ForLoopUnroll::SatisfiesLoopCondition()
+{
+    ASSERT(mLoopIndexStack.size() > 0);
+    TLoopIndexInfo& info = mLoopIndexStack[mLoopIndexStack.size() - 1];
+    // Relational operator is one of: > >= < <= == or !=.
+    switch (info.op) {
+      case EOpEqual:
+        return (info.currentValue == info.stopValue);
+      case EOpNotEqual:
+        return (info.currentValue != info.stopValue);
+      case EOpLessThan:
+        return (info.currentValue < info.stopValue);
+      case EOpGreaterThan:
+        return (info.currentValue > info.stopValue);
+      case EOpLessThanEqual:
+        return (info.currentValue <= info.stopValue);
+      case EOpGreaterThanEqual:
+        return (info.currentValue >= info.stopValue);
+      default:
+        UNREACHABLE();
+    }
+    return false;
+}
+
+bool ForLoopUnroll::NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol)
+{
+    for (TVector<TLoopIndexInfo>::iterator i = mLoopIndexStack.begin();
+         i != mLoopIndexStack.end();
+         ++i) {
+        if (i->id == symbol->getId())
+            return true;
+    }
+    return false;
+}
+
+int ForLoopUnroll::GetLoopIndexValue(TIntermSymbol* symbol)
+{
+    for (TVector<TLoopIndexInfo>::iterator i = mLoopIndexStack.begin();
+         i != mLoopIndexStack.end();
+         ++i) {
+        if (i->id == symbol->getId())
+            return i->currentValue;
+    }
+    UNREACHABLE();
+    return false;
+}
+
+void ForLoopUnroll::Push(TLoopIndexInfo& info)
+{
+    mLoopIndexStack.push_back(info);
+}
+
+void ForLoopUnroll::Pop()
+{
+    mLoopIndexStack.pop_back();
+}
+
+int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
+{
+    TIntermNode* expr = node->getExpression();
+    ASSERT(expr != NULL);
+    // for expression has one of the following forms:
+    //     loop_index++
+    //     loop_index--
+    //     loop_index += constant_expression
+    //     loop_index -= constant_expression
+    //     ++loop_index
+    //     --loop_index
+    // The last two forms are not specified in the spec, but I am assuming
+    // its an oversight.
+    TIntermUnary* unOp = expr->getAsUnaryNode();
+    TIntermBinary* binOp = unOp ? NULL : expr->getAsBinaryNode();
+
+    TOperator op = EOpNull;
+    TIntermConstantUnion* incrementNode = NULL;
+    if (unOp != NULL) {
+        op = unOp->getOp();
+    } else if (binOp != NULL) {
+        op = binOp->getOp();
+        ASSERT(binOp->getRight() != NULL);
+        incrementNode = binOp->getRight()->getAsConstantUnion();
+        ASSERT(incrementNode != NULL);
+    }
+
+    int increment = 0;
+    // The operator is one of: ++ -- += -=.
+    switch (op) {
+        case EOpPostIncrement:
+        case EOpPreIncrement:
+            ASSERT((unOp != NULL) && (binOp == NULL));
+            increment = 1;
+            break;
+        case EOpPostDecrement:
+        case EOpPreDecrement:
+            ASSERT((unOp != NULL) && (binOp == NULL));
+            increment = -1;
+            break;
+        case EOpAddAssign:
+            ASSERT((unOp == NULL) && (binOp != NULL));
+            increment = evaluateIntConstant(incrementNode);
+            break;
+        case EOpSubAssign:
+            ASSERT((unOp == NULL) && (binOp != NULL));
+            increment = - evaluateIntConstant(incrementNode);
+            break;
+        default:
+            ASSERT(false);
+    }
+
+    return increment;
+}
+
+int ForLoopUnroll::evaluateIntConstant(TIntermConstantUnion* node)
+{
+    ASSERT((node != NULL) && (node->getUnionArrayPointer() != NULL));
+    return node->getUnionArrayPointer()->getIConst();
+}
+
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.h b/Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.h
new file mode 100644 (file)
index 0000000..b2b2b58
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// Copyright (c) 2011 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/intermediate.h"
+
+struct TLoopIndexInfo {
+    int id;
+    int initValue;
+    int stopValue;
+    int incrementValue;
+    TOperator op;
+    int currentValue;
+};
+
+class ForLoopUnroll {
+public:
+    ForLoopUnroll() { }
+
+    void FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info);
+
+    // Update the info.currentValue for the next loop iteration.
+    void Step();
+
+    // Return false if loop condition is no longer satisfied.
+    bool SatisfiesLoopCondition();
+
+    // Check if the symbol is the index of a loop that's unrolled.
+    bool NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol);
+
+    // Return the current value of a given loop index symbol.
+    int GetLoopIndexValue(TIntermSymbol* symbol);
+
+    void Push(TLoopIndexInfo& info);
+    void Pop();
+
+private:
+    int getLoopIncrement(TIntermLoop* node);
+
+    int evaluateIntConstant(TIntermConstantUnion* node);
+
+    TVector<TLoopIndexInfo> mLoopIndexStack;
+};
+
index 12b53fe..74a2de3 100644 (file)
@@ -353,17 +353,15 @@ static TString BuiltInFunctionsVertex(const ShBuiltInResources& resources)
     //
     // Texture Functions.
     //
-    if (resources.MaxVertexTextureImageUnits > 0) {
-        s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);"));
-        s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);"));
-        s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);"));
-        s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);"));
-
-        s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);"));
-        s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);"));
-        s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));
-        s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));
-    }
+    s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);"));
+    s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);"));
+    s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);"));
+    s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);"));
+
+    s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);"));
+    s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);"));
+    s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));
+    s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));
 
     return s;
 }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.cpp b/Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.cpp
new file mode 100644 (file)
index 0000000..c9b6a12
--- /dev/null
@@ -0,0 +1,98 @@
+//
+// Copyright (c) 2002-2011 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/MapLongVariableNames.h"
+
+namespace {
+
+TString mapLongName(int id, const TString& name, bool isVarying)
+{
+    ASSERT(name.size() > MAX_IDENTIFIER_NAME_SIZE);
+    TStringStream stream;
+    stream << "webgl_";
+    if (isVarying)
+        stream << "v";
+    stream << id << "_";
+    stream << name.substr(0, MAX_IDENTIFIER_NAME_SIZE - stream.str().size());
+    return stream.str();
+}
+
+}  // anonymous namespace
+
+MapLongVariableNames::MapLongVariableNames(
+    TMap<TString, TString>& varyingLongNameMap)
+    : mVaryingLongNameMap(varyingLongNameMap)
+{
+}
+
+void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
+{
+    ASSERT(symbol != NULL);
+    if (symbol->getSymbol().size() > MAX_IDENTIFIER_NAME_SIZE) {
+        switch (symbol->getQualifier()) {
+          case EvqVaryingIn:
+          case EvqVaryingOut:
+          case EvqInvariantVaryingIn:
+          case EvqInvariantVaryingOut:
+            symbol->setSymbol(
+                mapVaryingLongName(symbol->getSymbol()));
+            break;
+          default:
+            symbol->setSymbol(
+                mapLongName(symbol->getId(), symbol->getSymbol(), false));
+            break;
+        };
+    }
+}
+
+void MapLongVariableNames::visitConstantUnion(TIntermConstantUnion*)
+{
+}
+
+bool MapLongVariableNames::visitBinary(Visit, TIntermBinary*)
+{
+    return true;
+}
+
+bool MapLongVariableNames::visitUnary(Visit, TIntermUnary*)
+{
+    return true;
+}
+
+bool MapLongVariableNames::visitSelection(Visit, TIntermSelection*)
+{
+    return true;
+}
+
+bool MapLongVariableNames::visitAggregate(Visit, TIntermAggregate*)
+{
+    return true;
+}
+
+bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
+{
+    if (node->getInit())
+        node->getInit()->traverse(this);
+    return true;
+}
+
+bool MapLongVariableNames::visitBranch(Visit, TIntermBranch*)
+{
+    return true;
+}
+
+TString MapLongVariableNames::mapVaryingLongName(const TString& name)
+{
+    TMap<TString, TString>::const_iterator it = mVaryingLongNameMap.find(name);
+    if (it != mVaryingLongNameMap.end())
+        return (*it).second;
+
+    int id = mVaryingLongNameMap.size();
+    TString mappedName = mapLongName(id, name, true);
+    mVaryingLongNameMap.insert(
+        TMap<TString, TString>::value_type(name, mappedName));
+    return mappedName;
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.h b/Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.h
new file mode 100644 (file)
index 0000000..540909e
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2002-2011 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.
+//
+
+#ifndef COMPILER_MAP_LONG_VARIABLE_NAMES_H_
+#define COMPILER_MAP_LONG_VARIABLE_NAMES_H_
+
+#include "GLSLANG/ShaderLang.h"
+
+#include "compiler/intermediate.h"
+#include "compiler/VariableInfo.h"
+
+// This size does not include '\0' in the end.
+#define MAX_IDENTIFIER_NAME_SIZE 32
+
+// Traverses intermediate tree to map attributes and uniforms names that are
+// longer than MAX_IDENTIFIER_NAME_SIZE to MAX_IDENTIFIER_NAME_SIZE.
+class MapLongVariableNames : public TIntermTraverser {
+public:
+    MapLongVariableNames(TMap<TString, TString>& varyingLongNameMap);
+
+    virtual void visitSymbol(TIntermSymbol*);
+    virtual void visitConstantUnion(TIntermConstantUnion*);
+    virtual bool visitBinary(Visit, TIntermBinary*);
+    virtual bool visitUnary(Visit, TIntermUnary*);
+    virtual bool visitSelection(Visit, TIntermSelection*);
+    virtual bool visitAggregate(Visit, TIntermAggregate*);
+    virtual bool visitLoop(Visit, TIntermLoop*);
+    virtual bool visitBranch(Visit, TIntermBranch*);
+
+private:
+    TString mapVaryingLongName(const TString& name);
+
+    TMap<TString, TString>& mVaryingLongNameMap;
+};
+
+#endif  // COMPILER_MAP_LONG_VARIABLE_NAMES_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp
new file mode 100644 (file)
index 0000000..64ee92d
--- /dev/null
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2002-2011 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/OutputESSL.h"
+
+TOutputESSL::TOutputESSL(TInfoSinkBase& objSink)
+    : TOutputGLSLBase(objSink)
+{
+}
+
+bool TOutputESSL::writeVariablePrecision(TPrecision precision)
+{
+    if (precision == EbpUndefined)
+        return false;
+
+    TInfoSinkBase& out = objSink();
+    out << getPrecisionString(precision);
+    return true;
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h b/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h
new file mode 100644 (file)
index 0000000..4fa73c8
--- /dev/null
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2002-2011 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.
+//
+
+#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
+#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
+
+#include "compiler/OutputGLSLBase.h"
+
+class TOutputESSL : public TOutputGLSLBase
+{
+public:
+    TOutputESSL(TInfoSinkBase& objSink);
+
+protected:
+    virtual bool writeVariablePrecision(TPrecision precision);
+};
+
+#endif  // CROSSCOMPILERGLSL_OUTPUTESSL_H_
index 23476f2..dd31b4b 100644 (file)
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2011 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/OutputGLSL.h"
-#include "compiler/debug.h"
-
-namespace
-{
-TString getTypeName(const TType& type)
-{
-    TInfoSinkBase out;
-    if (type.isMatrix())
-    {
-        out << "mat";
-        out << type.getNominalSize();
-    }
-    else if (type.isVector())
-    {
-        switch (type.getBasicType())
-        {
-            case EbtFloat: out << "vec"; break;
-            case EbtInt: out << "ivec"; break;
-            case EbtBool: out << "bvec"; break;
-            default: UNREACHABLE(); break;
-        }
-        out << type.getNominalSize();
-    }
-    else
-    {
-        if (type.getBasicType() == EbtStruct)
-            out << type.getTypeName();
-        else
-            out << type.getBasicString();
-    }
-    return TString(out.c_str());
-}
-
-TString arrayBrackets(const TType& type)
-{
-    ASSERT(type.isArray());
-    TInfoSinkBase out;
-    out << "[" << type.getArraySize() << "]";
-    return TString(out.c_str());
-}
-
-bool isSingleStatement(TIntermNode* node) {
-    if (const TIntermAggregate* aggregate = node->getAsAggregate())
-    {
-        return (aggregate->getOp() != EOpFunction) &&
-               (aggregate->getOp() != EOpSequence);
-    }
-    else if (const TIntermSelection* selection = node->getAsSelectionNode())
-    {
-        // Ternary operators are usually part of an assignment operator.
-        // This handles those rare cases in which they are all by themselves.
-        return selection->usesTernaryOperator();
-    }
-    else if (node->getAsLoopNode())
-    {
-        return false;
-    }
-    return true;
-}
-}  // namespace
 
 TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink)
-    : TIntermTraverser(true, true, true),
-      mObjSink(objSink),
-      mDeclaringVariables(false)
-{
-}
-
-void TOutputGLSL::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
+    : TOutputGLSLBase(objSink)
 {
-    TInfoSinkBase& out = objSink();
-    if (visit == PreVisit && preStr)
-    {
-        out << preStr;
-    }
-    else if (visit == InVisit && inStr)
-    {
-        out << inStr;
-    }
-    else if (visit == PostVisit && postStr)
-    {
-        out << postStr;
-    }
-}
-
-void TOutputGLSL::writeVariableType(const TType& type)
-{
-    TInfoSinkBase& out = objSink();
-    TQualifier qualifier = type.getQualifier();
-    // TODO(alokp): Validate qualifier for variable declarations.
-    if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
-        out << type.getQualifierString() << " ";
-
-    // Declare the struct if we have not done so already.
-    if ((type.getBasicType() == EbtStruct) &&
-        (mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
-    {
-        out << "struct " << type.getTypeName() << "{\n";
-        const TTypeList* structure = type.getStruct();
-        ASSERT(structure != NULL);
-        for (size_t i = 0; i < structure->size(); ++i)
-        {
-            const TType* fieldType = (*structure)[i].type;
-            ASSERT(fieldType != NULL);
-            out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
-            if (fieldType->isArray())
-                out << arrayBrackets(*fieldType);
-            out << ";\n";
-        }
-        out << "}";
-        mDeclaredStructs.insert(type.getTypeName());
-    }
-    else
-    {
-        out << getTypeName(type);
-    }
-}
-
-void TOutputGLSL::writeFunctionParameters(const TIntermSequence& args)
-{
-    TInfoSinkBase& out = objSink();
-    for (TIntermSequence::const_iterator iter = args.begin();
-         iter != args.end(); ++iter)
-    {
-        const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
-        ASSERT(arg != NULL);
-
-        const TType& type = arg->getType();
-        TQualifier qualifier = type.getQualifier();
-        // TODO(alokp): Validate qualifier for function arguments.
-        if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
-            out << type.getQualifierString() << " ";
-
-        out << getTypeName(type);
-
-        const TString& name = arg->getSymbol();
-        if (!name.empty())
-            out << " " << name;
-        if (type.isArray())
-            out << arrayBrackets(type);
-
-        // Put a comma if this is not the last argument.
-        if (iter != args.end() - 1)
-            out << ", ";
-    }
 }
 
-const ConstantUnion* TOutputGLSL::writeConstantUnion(const TType& type,
-                                                     const ConstantUnion* pConstUnion)
+bool TOutputGLSL::writeVariablePrecision(TPrecision)
 {
-    TInfoSinkBase& out = objSink();
-
-    if (type.getBasicType() == EbtStruct)
-    {
-        out << type.getTypeName() << "(";
-        const TTypeList* structure = type.getStruct();
-        ASSERT(structure != NULL);
-        for (size_t i = 0; i < structure->size(); ++i)
-        {
-            const TType* fieldType = (*structure)[i].type;
-            ASSERT(fieldType != NULL);
-            pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
-            if (i != structure->size() - 1) out << ", ";
-        }
-        out << ")";
-    }
-    else
-    {
-        int size = type.getObjectSize();
-        bool writeType = size > 1;
-        if (writeType) out << getTypeName(type) << "(";
-        for (int i = 0; i < size; ++i, ++pConstUnion)
-        {
-            switch (pConstUnion->getType())
-            {
-                case EbtFloat: out << pConstUnion->getFConst(); break;
-                case EbtInt: out << pConstUnion->getIConst(); break;
-                case EbtBool: out << pConstUnion->getBConst(); break;
-                default: UNREACHABLE();
-            }
-            if (i != size - 1) out << ", ";
-        }
-        if (writeType) out << ")";
-    }
-    return pConstUnion;
-}
-
-void TOutputGLSL::visitSymbol(TIntermSymbol* node)
-{
-    TInfoSinkBase& out = objSink();
-    out << node->getSymbol();
-
-    if (mDeclaringVariables && node->getType().isArray())
-        out << arrayBrackets(node->getType());
-}
-
-void TOutputGLSL::visitConstantUnion(TIntermConstantUnion* node)
-{
-    writeConstantUnion(node->getType(), node->getUnionArrayPointer());
-}
-
-bool TOutputGLSL::visitBinary(Visit visit, TIntermBinary* node)
-{
-    bool visitChildren = true;
-    TInfoSinkBase& out = objSink();
-    switch (node->getOp())
-    {
-        case EOpInitialize:
-            if (visit == InVisit)
-            {
-                out << " = ";
-                // RHS of initialize is not being declared.
-                mDeclaringVariables = false;
-            }
-            break;
-        case EOpAssign: writeTriplet(visit, "(", " = ", ")"); break;
-        case EOpAddAssign: writeTriplet(visit, "(", " += ", ")"); break;
-        case EOpSubAssign: writeTriplet(visit, "(", " -= ", ")"); break;
-        case EOpDivAssign: writeTriplet(visit, "(", " /= ", ")"); break;
-        // Notice the fall-through.
-        case EOpMulAssign: 
-        case EOpVectorTimesMatrixAssign:
-        case EOpVectorTimesScalarAssign:
-        case EOpMatrixTimesScalarAssign:
-        case EOpMatrixTimesMatrixAssign:
-            writeTriplet(visit, "(", " *= ", ")");
-            break;
-
-        case EOpIndexDirect:
-        case EOpIndexIndirect:
-            writeTriplet(visit, NULL, "[", "]");
-            break;
-        case EOpIndexDirectStruct:
-            if (visit == InVisit)
-            {
-                out << ".";
-                // TODO(alokp): ASSERT
-                out << node->getType().getFieldName();
-                visitChildren = false;
-            }
-            break;
-        case EOpVectorSwizzle:
-            if (visit == InVisit)
-            {
-                out << ".";
-                TIntermAggregate* rightChild = node->getRight()->getAsAggregate();
-                TIntermSequence& sequence = rightChild->getSequence();
-                for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
-                {
-                    TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
-                    ASSERT(element->getBasicType() == EbtInt);
-                    ASSERT(element->getNominalSize() == 1);
-                    const ConstantUnion& data = element->getUnionArrayPointer()[0];
-                    ASSERT(data.getType() == EbtInt);
-                    switch (data.getIConst())
-                    {
-                        case 0: out << "x"; break;
-                        case 1: out << "y"; break;
-                        case 2: out << "z"; break;
-                        case 3: out << "w"; break;
-                        default: UNREACHABLE(); break;
-                    }
-                }
-                visitChildren = false;
-            }
-            break;
-
-        case EOpAdd: writeTriplet(visit, "(", " + ", ")"); break;
-        case EOpSub: writeTriplet(visit, "(", " - ", ")"); break;
-        case EOpMul: writeTriplet(visit, "(", " * ", ")"); break;
-        case EOpDiv: writeTriplet(visit, "(", " / ", ")"); break;
-        case EOpMod: UNIMPLEMENTED(); break;
-        case EOpEqual: writeTriplet(visit, "(", " == ", ")"); break;
-        case EOpNotEqual: writeTriplet(visit, "(", " != ", ")"); break;
-        case EOpLessThan: writeTriplet(visit, "(", " < ", ")"); break;
-        case EOpGreaterThan: writeTriplet(visit, "(", " > ", ")"); break;
-        case EOpLessThanEqual: writeTriplet(visit, "(", " <= ", ")"); break;
-        case EOpGreaterThanEqual: writeTriplet(visit, "(", " >= ", ")"); break;
-
-        // Notice the fall-through.
-        case EOpVectorTimesScalar:
-        case EOpVectorTimesMatrix:
-        case EOpMatrixTimesVector:
-        case EOpMatrixTimesScalar:
-        case EOpMatrixTimesMatrix:
-            writeTriplet(visit, "(", " * ", ")");
-            break;
-
-        case EOpLogicalOr: writeTriplet(visit, "(", " || ", ")"); break;
-        case EOpLogicalXor: writeTriplet(visit, "(", " ^^ ", ")"); break;
-        case EOpLogicalAnd: writeTriplet(visit, "(", " && ", ")"); break;
-        default: UNREACHABLE(); break;
-    }
-
-    return visitChildren;
-}
-
-bool TOutputGLSL::visitUnary(Visit visit, TIntermUnary* node)
-{
-    switch (node->getOp())
-    {
-        case EOpNegative: writeTriplet(visit, "(-", NULL, ")"); break;
-        case EOpVectorLogicalNot: writeTriplet(visit, "not(", NULL, ")"); break;
-        case EOpLogicalNot: writeTriplet(visit, "(!", NULL, ")"); break;
-
-        case EOpPostIncrement: writeTriplet(visit, "(", NULL, "++)"); break;
-        case EOpPostDecrement: writeTriplet(visit, "(", NULL, "--)"); break;
-        case EOpPreIncrement: writeTriplet(visit, "(++", NULL, ")"); break;
-        case EOpPreDecrement: writeTriplet(visit, "(--", NULL, ")"); break;
-
-        case EOpConvIntToBool:
-        case EOpConvFloatToBool:
-            switch (node->getOperand()->getType().getNominalSize())
-            {
-                case 1: writeTriplet(visit, "bool(", NULL, ")");  break;
-                case 2: writeTriplet(visit, "bvec2(", NULL, ")"); break;
-                case 3: writeTriplet(visit, "bvec3(", NULL, ")"); break;
-                case 4: writeTriplet(visit, "bvec4(", NULL, ")"); break;
-                default: UNREACHABLE();
-            }
-            break;
-        case EOpConvBoolToFloat:
-        case EOpConvIntToFloat:
-            switch (node->getOperand()->getType().getNominalSize())
-            {
-                case 1: writeTriplet(visit, "float(", NULL, ")");  break;
-                case 2: writeTriplet(visit, "vec2(", NULL, ")"); break;
-                case 3: writeTriplet(visit, "vec3(", NULL, ")"); break;
-                case 4: writeTriplet(visit, "vec4(", NULL, ")"); break;
-                default: UNREACHABLE();
-            }
-            break;
-        case EOpConvFloatToInt:
-        case EOpConvBoolToInt:
-            switch (node->getOperand()->getType().getNominalSize())
-            {
-                case 1: writeTriplet(visit, "int(", NULL, ")");  break;
-                case 2: writeTriplet(visit, "ivec2(", NULL, ")"); break;
-                case 3: writeTriplet(visit, "ivec3(", NULL, ")"); break;
-                case 4: writeTriplet(visit, "ivec4(", NULL, ")"); break;
-                default: UNREACHABLE();
-            }
-            break;
-
-        case EOpRadians: writeTriplet(visit, "radians(", NULL, ")"); break;
-        case EOpDegrees: writeTriplet(visit, "degrees(", NULL, ")"); break;
-        case EOpSin: writeTriplet(visit, "sin(", NULL, ")"); break;
-        case EOpCos: writeTriplet(visit, "cos(", NULL, ")"); break;
-        case EOpTan: writeTriplet(visit, "tan(", NULL, ")"); break;
-        case EOpAsin: writeTriplet(visit, "asin(", NULL, ")"); break;
-        case EOpAcos: writeTriplet(visit, "acos(", NULL, ")"); break;
-        case EOpAtan: writeTriplet(visit, "atan(", NULL, ")"); break;
-
-        case EOpExp: writeTriplet(visit, "exp(", NULL, ")"); break;
-        case EOpLog: writeTriplet(visit, "log(", NULL, ")"); break;
-        case EOpExp2: writeTriplet(visit, "exp2(", NULL, ")"); break;
-        case EOpLog2: writeTriplet(visit, "log2(", NULL, ")"); break;
-        case EOpSqrt: writeTriplet(visit, "sqrt(", NULL, ")"); break;
-        case EOpInverseSqrt: writeTriplet(visit, "inversesqrt(", NULL, ")"); break;
-
-        case EOpAbs: writeTriplet(visit, "abs(", NULL, ")"); break;
-        case EOpSign: writeTriplet(visit, "sign(", NULL, ")"); break;
-        case EOpFloor: writeTriplet(visit, "floor(", NULL, ")"); break;
-        case EOpCeil: writeTriplet(visit, "ceil(", NULL, ")"); break;
-        case EOpFract: writeTriplet(visit, "fract(", NULL, ")"); break;
-
-        case EOpLength: writeTriplet(visit, "length(", NULL, ")"); break;
-        case EOpNormalize: writeTriplet(visit, "normalize(", NULL, ")"); break;
-
-        case EOpDFdx: writeTriplet(visit, "dFdx(", NULL, ")"); break;
-        case EOpDFdy: writeTriplet(visit, "dFdy(", NULL, ")"); break;
-        case EOpFwidth: writeTriplet(visit, "fwidth(", NULL, ")"); break;
-
-        case EOpAny: writeTriplet(visit, "any(", NULL, ")"); break;
-        case EOpAll: writeTriplet(visit, "all(", NULL, ")"); break;
-
-        default: UNREACHABLE(); break;
-    }
-
-    return true;
-}
-
-bool TOutputGLSL::visitSelection(Visit visit, TIntermSelection* node)
-{
-    TInfoSinkBase& out = objSink();
-
-    if (node->usesTernaryOperator())
-    {
-        // Notice two brackets at the beginning and end. The outer ones
-        // encapsulate the whole ternary expression. This preserves the
-        // order of precedence when ternary expressions are used in a
-        // compound expression, i.e., c = 2 * (a < b ? 1 : 2).
-        out << "((";
-        node->getCondition()->traverse(this);
-        out << ") ? (";
-        node->getTrueBlock()->traverse(this);
-        out << ") : (";
-        node->getFalseBlock()->traverse(this);
-        out << "))";
-    }
-    else
-    {
-        out << "if (";
-        node->getCondition()->traverse(this);
-        out << ")\n";
-
-        incrementDepth();
-        visitCodeBlock(node->getTrueBlock());
-
-        if (node->getFalseBlock())
-        {
-            out << "else\n";
-            visitCodeBlock(node->getFalseBlock());
-        }
-        decrementDepth();
-    }
-    return false;
-}
-
-bool TOutputGLSL::visitAggregate(Visit visit, TIntermAggregate* node)
-{
-    bool visitChildren = true;
-    TInfoSinkBase& out = objSink();
-    switch (node->getOp())
-    {
-        case EOpSequence: {
-            // Scope the sequences except when at the global scope.
-            if (depth > 0) out << "{\n";
-
-            incrementDepth();
-            const TIntermSequence& sequence = node->getSequence();
-            for (TIntermSequence::const_iterator iter = sequence.begin();
-                 iter != sequence.end(); ++iter)
-            {
-                TIntermNode* node = *iter;
-                ASSERT(node != NULL);
-                node->traverse(this);
-
-                if (isSingleStatement(node))
-                    out << ";\n";
-            }
-            decrementDepth();
-
-            // Scope the sequences except when at the global scope.
-            if (depth > 0) out << "}\n";
-            visitChildren = false;
-            break;
-        }
-        case EOpPrototype: {
-            // Function declaration.
-            ASSERT(visit == PreVisit);
-            TString returnType = getTypeName(node->getType());
-            out << returnType << " " << node->getName();
-
-            out << "(";
-            writeFunctionParameters(node->getSequence());
-            out << ")";
-
-            visitChildren = false;
-            break;
-        }
-        case EOpFunction: {
-            // Function definition.
-            ASSERT(visit == PreVisit);
-            TString returnType = getTypeName(node->getType());
-            TString functionName = TFunction::unmangleName(node->getName());
-            out << returnType << " " << functionName;
-
-            incrementDepth();
-            // Function definition node contains one or two children nodes
-            // representing function parameters and function body. The latter
-            // is not present in case of empty function bodies.
-            const TIntermSequence& sequence = node->getSequence();
-            ASSERT((sequence.size() == 1) || (sequence.size() == 2));
-            TIntermSequence::const_iterator seqIter = sequence.begin();
-
-            // Traverse function parameters.
-            TIntermAggregate* params = (*seqIter)->getAsAggregate();
-            ASSERT(params != NULL);
-            ASSERT(params->getOp() == EOpParameters);
-            params->traverse(this);
-
-            // Traverse function body.
-            TIntermAggregate* body = ++seqIter != sequence.end() ?
-                (*seqIter)->getAsAggregate() : NULL;
-            visitCodeBlock(body);
-            decrementDepth();
-            // Fully processed; no need to visit children.
-            visitChildren = false;
-            break;
-        }
-        case EOpFunctionCall:
-            // Function call.
-            if (visit == PreVisit)
-            {
-                TString functionName = TFunction::unmangleName(node->getName());
-                out << functionName << "(";
-            }
-            else if (visit == InVisit)
-            {
-                out << ", ";
-            }
-            else
-            {
-                out << ")";
-            }
-            break;
-        case EOpParameters: {
-            // Function parameters.
-            ASSERT(visit == PreVisit);
-            out << "(";
-            writeFunctionParameters(node->getSequence());
-            out << ")";
-            visitChildren = false;
-            break;
-        }
-        case EOpDeclaration: {
-            // Variable declaration.
-            if (visit == PreVisit)
-            {
-                const TIntermSequence& sequence = node->getSequence();
-                const TIntermTyped* variable = sequence.front()->getAsTyped();
-                writeVariableType(variable->getType());
-                out << " ";
-                mDeclaringVariables = true;
-            }
-            else if (visit == InVisit)
-            {
-                out << ", ";
-                mDeclaringVariables = true;
-            }
-            else
-            {
-                mDeclaringVariables = false;
-            }
-            break;
-        }
-        case EOpConstructFloat: writeTriplet(visit, "float(", NULL, ")"); break;
-        case EOpConstructVec2: writeTriplet(visit, "vec2(", ", ", ")"); break;
-        case EOpConstructVec3: writeTriplet(visit, "vec3(", ", ", ")"); break;
-        case EOpConstructVec4: writeTriplet(visit, "vec4(", ", ", ")"); break;
-        case EOpConstructBool: writeTriplet(visit, "bool(", NULL, ")"); break;
-        case EOpConstructBVec2: writeTriplet(visit, "bvec2(", ", ", ")"); break;
-        case EOpConstructBVec3: writeTriplet(visit, "bvec3(", ", ", ")"); break;
-        case EOpConstructBVec4: writeTriplet(visit, "bvec4(", ", ", ")"); break;
-        case EOpConstructInt: writeTriplet(visit, "int(", NULL, ")"); break;
-        case EOpConstructIVec2: writeTriplet(visit, "ivec2(", ", ", ")"); break;
-        case EOpConstructIVec3: writeTriplet(visit, "ivec3(", ", ", ")"); break;
-        case EOpConstructIVec4: writeTriplet(visit, "ivec4(", ", ", ")"); break;
-        case EOpConstructMat2: writeTriplet(visit, "mat2(", ", ", ")"); break;
-        case EOpConstructMat3: writeTriplet(visit, "mat3(", ", ", ")"); break;
-        case EOpConstructMat4: writeTriplet(visit, "mat4(", ", ", ")"); break;
-        case EOpConstructStruct:
-            if (visit == PreVisit)
-            {
-                const TType& type = node->getType();
-                ASSERT(type.getBasicType() == EbtStruct);
-                out << type.getTypeName() << "(";
-            }
-            else if (visit == InVisit)
-            {
-                out << ", ";
-            }
-            else
-            {
-                out << ")";
-            }
-            break;
-
-        case EOpLessThan: writeTriplet(visit, "lessThan(", ", ", ")"); break;
-        case EOpGreaterThan: writeTriplet(visit, "greaterThan(", ", ", ")"); break;
-        case EOpLessThanEqual: writeTriplet(visit, "lessThanEqual(", ", ", ")"); break;
-        case EOpGreaterThanEqual: writeTriplet(visit, "greaterThanEqual(", ", ", ")"); break;
-        case EOpVectorEqual: writeTriplet(visit, "equal(", ", ", ")"); break;
-        case EOpVectorNotEqual: writeTriplet(visit, "notEqual(", ", ", ")"); break;
-        case EOpComma: writeTriplet(visit, NULL, ", ", NULL); break;
-
-        case EOpMod: writeTriplet(visit, "mod(", ", ", ")"); break;
-        case EOpPow: writeTriplet(visit, "pow(", ", ", ")"); break;
-        case EOpAtan: writeTriplet(visit, "atan(", ", ", ")"); break;
-        case EOpMin: writeTriplet(visit, "min(", ", ", ")"); break;
-        case EOpMax: writeTriplet(visit, "max(", ", ", ")"); break;
-        case EOpClamp: writeTriplet(visit, "clamp(", ", ", ")"); break;
-        case EOpMix: writeTriplet(visit, "mix(", ", ", ")"); break;
-        case EOpStep: writeTriplet(visit, "step(", ", ", ")"); break;
-        case EOpSmoothStep: writeTriplet(visit, "smoothstep(", ", ", ")"); break;
-
-        case EOpDistance: writeTriplet(visit, "distance(", ", ", ")"); break;
-        case EOpDot: writeTriplet(visit, "dot(", ", ", ")"); break;
-        case EOpCross: writeTriplet(visit, "cross(", ", ", ")"); break;
-        case EOpFaceForward: writeTriplet(visit, "faceforward(", ", ", ")"); break;
-        case EOpReflect: writeTriplet(visit, "reflect(", ", ", ")"); break;
-        case EOpRefract: writeTriplet(visit, "refract(", ", ", ")"); break;
-        case EOpMul: writeTriplet(visit, "matrixCompMult(", ", ", ")"); break;
-
-        default: UNREACHABLE(); break;
-    }
-    return visitChildren;
-}
-
-bool TOutputGLSL::visitLoop(Visit visit, TIntermLoop* node)
-{
-    TInfoSinkBase& out = objSink();
-
-    incrementDepth();
-    // Loop header.
-    TLoopType loopType = node->getType();
-    if (loopType == ELoopFor)  // for loop
-    {
-        out << "for (";
-        if (node->getInit())
-            node->getInit()->traverse(this);
-        out << "; ";
-
-        if (node->getCondition())
-            node->getCondition()->traverse(this);
-        out << "; ";
-
-        if (node->getExpression())
-            node->getExpression()->traverse(this);
-        out << ")\n";
-    }
-    else if (loopType == ELoopWhile)  // while loop
-    {
-        out << "while (";
-        ASSERT(node->getCondition() != NULL);
-        node->getCondition()->traverse(this);
-        out << ")\n";
-    }
-    else  // do-while loop
-    {
-        ASSERT(loopType == ELoopDoWhile);
-        out << "do\n";
-    }
-
-    // Loop body.
-    visitCodeBlock(node->getBody());
-
-    // Loop footer.
-    if (loopType == ELoopDoWhile)  // do-while loop
-    {
-        out << "while (";
-        ASSERT(node->getCondition() != NULL);
-        node->getCondition()->traverse(this);
-        out << ");\n";
-    }
-    decrementDepth();
-
-    // No need to visit children. They have been already processed in
-    // this function.
     return false;
 }
-
-bool TOutputGLSL::visitBranch(Visit visit, TIntermBranch* node)
-{
-    switch (node->getFlowOp())
-    {
-        case EOpKill: writeTriplet(visit, "discard", NULL, NULL); break;
-        case EOpBreak: writeTriplet(visit, "break", NULL, NULL); break;
-        case EOpContinue: writeTriplet(visit, "continue", NULL, NULL); break;
-        case EOpReturn: writeTriplet(visit, "return ", NULL, NULL); break;
-        default: UNREACHABLE(); break;
-    }
-
-    return true;
-}
-
-void TOutputGLSL::visitCodeBlock(TIntermNode* node) {
-    TInfoSinkBase &out = objSink();
-    if (node != NULL)
-    {
-        node->traverse(this);
-        // Single statements not part of a sequence need to be terminated
-        // with semi-colon.
-        if (isSingleStatement(node))
-            out << ";\n";
-    }
-    else
-    {
-        out << "{\n}\n";  // Empty code block.
-    }
-}
index aa203d4..0fe2356 100644 (file)
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2011 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.
 //
@@ -7,43 +7,15 @@
 #ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
 #define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
 
-#include <set>
+#include "compiler/OutputGLSLBase.h"
 
-#include "compiler/intermediate.h"
-#include "compiler/ParseHelper.h"
-
-class TOutputGLSL : public TIntermTraverser
+class TOutputGLSL : public TOutputGLSLBase
 {
 public:
     TOutputGLSL(TInfoSinkBase& objSink);
 
 protected:
-    TInfoSinkBase& objSink() { return mObjSink; }
-    void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
-    void writeVariableType(const TType& type);
-    void writeFunctionParameters(const TIntermSequence& args);
-    const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
-
-    virtual void visitSymbol(TIntermSymbol* node);
-    virtual void visitConstantUnion(TIntermConstantUnion* node);
-    virtual bool visitBinary(Visit visit, TIntermBinary* node);
-    virtual bool visitUnary(Visit visit, TIntermUnary* node);
-    virtual bool visitSelection(Visit visit, TIntermSelection* node);
-    virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
-    virtual bool visitLoop(Visit visit, TIntermLoop* node);
-    virtual bool visitBranch(Visit visit, TIntermBranch* node);
-
-    void visitCodeBlock(TIntermNode* node);
-
-private:
-    TInfoSinkBase& mObjSink;
-    bool mDeclaringVariables;
-
-    // Structs are declared as the tree is traversed. This set contains all
-    // the structs already declared. It is maintained so that a struct is
-    // declared only once.
-    typedef std::set<TString> DeclaredStructs;
-    DeclaredStructs mDeclaredStructs;
+    virtual bool writeVariablePrecision(TPrecision);
 };
 
 #endif  // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp
new file mode 100644 (file)
index 0000000..a0feb07
--- /dev/null
@@ -0,0 +1,707 @@
+//
+// Copyright (c) 2002-2011 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/OutputGLSLBase.h"
+#include "compiler/debug.h"
+
+namespace
+{
+TString getTypeName(const TType& type)
+{
+    TInfoSinkBase out;
+    if (type.isMatrix())
+    {
+        out << "mat";
+        out << type.getNominalSize();
+    }
+    else if (type.isVector())
+    {
+        switch (type.getBasicType())
+        {
+            case EbtFloat: out << "vec"; break;
+            case EbtInt: out << "ivec"; break;
+            case EbtBool: out << "bvec"; break;
+            default: UNREACHABLE(); break;
+        }
+        out << type.getNominalSize();
+    }
+    else
+    {
+        if (type.getBasicType() == EbtStruct)
+            out << type.getTypeName();
+        else
+            out << type.getBasicString();
+    }
+    return TString(out.c_str());
+}
+
+TString arrayBrackets(const TType& type)
+{
+    ASSERT(type.isArray());
+    TInfoSinkBase out;
+    out << "[" << type.getArraySize() << "]";
+    return TString(out.c_str());
+}
+
+bool isSingleStatement(TIntermNode* node) {
+    if (const TIntermAggregate* aggregate = node->getAsAggregate())
+    {
+        return (aggregate->getOp() != EOpFunction) &&
+               (aggregate->getOp() != EOpSequence);
+    }
+    else if (const TIntermSelection* selection = node->getAsSelectionNode())
+    {
+        // Ternary operators are usually part of an assignment operator.
+        // This handles those rare cases in which they are all by themselves.
+        return selection->usesTernaryOperator();
+    }
+    else if (node->getAsLoopNode())
+    {
+        return false;
+    }
+    return true;
+}
+}  // namespace
+
+TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink)
+    : TIntermTraverser(true, true, true),
+      mObjSink(objSink),
+      mDeclaringVariables(false)
+{
+}
+
+void TOutputGLSLBase::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
+{
+    TInfoSinkBase& out = objSink();
+    if (visit == PreVisit && preStr)
+    {
+        out << preStr;
+    }
+    else if (visit == InVisit && inStr)
+    {
+        out << inStr;
+    }
+    else if (visit == PostVisit && postStr)
+    {
+        out << postStr;
+    }
+}
+
+void TOutputGLSLBase::writeVariableType(const TType& type)
+{
+    TInfoSinkBase& out = objSink();
+    TQualifier qualifier = type.getQualifier();
+    // TODO(alokp): Validate qualifier for variable declarations.
+    if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
+        out << type.getQualifierString() << " ";
+    // Declare the struct if we have not done so already.
+    if ((type.getBasicType() == EbtStruct) &&
+        (mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
+    {
+        out << "struct " << type.getTypeName() << "{\n";
+        const TTypeList* structure = type.getStruct();
+        ASSERT(structure != NULL);
+        for (size_t i = 0; i < structure->size(); ++i)
+        {
+            const TType* fieldType = (*structure)[i].type;
+            ASSERT(fieldType != NULL);
+            if (writeVariablePrecision(fieldType->getPrecision()))
+                out << " ";
+            out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
+            if (fieldType->isArray())
+                out << arrayBrackets(*fieldType);
+            out << ";\n";
+        }
+        out << "}";
+        mDeclaredStructs.insert(type.getTypeName());
+    }
+    else
+    {
+        if (writeVariablePrecision(type.getPrecision()))
+            out << " ";
+        out << getTypeName(type);
+    }
+}
+
+void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence& args)
+{
+    TInfoSinkBase& out = objSink();
+    for (TIntermSequence::const_iterator iter = args.begin();
+         iter != args.end(); ++iter)
+    {
+        const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
+        ASSERT(arg != NULL);
+
+        const TType& type = arg->getType();
+        writeVariableType(type);
+
+        const TString& name = arg->getSymbol();
+        if (!name.empty())
+            out << " " << name;
+        if (type.isArray())
+            out << arrayBrackets(type);
+
+        // Put a comma if this is not the last argument.
+        if (iter != args.end() - 1)
+            out << ", ";
+    }
+}
+
+const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
+                                                         const ConstantUnion* pConstUnion)
+{
+    TInfoSinkBase& out = objSink();
+
+    if (type.getBasicType() == EbtStruct)
+    {
+        out << type.getTypeName() << "(";
+        const TTypeList* structure = type.getStruct();
+        ASSERT(structure != NULL);
+        for (size_t i = 0; i < structure->size(); ++i)
+        {
+            const TType* fieldType = (*structure)[i].type;
+            ASSERT(fieldType != NULL);
+            pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
+            if (i != structure->size() - 1) out << ", ";
+        }
+        out << ")";
+    }
+    else
+    {
+        int size = type.getObjectSize();
+        bool writeType = size > 1;
+        if (writeType) out << getTypeName(type) << "(";
+        for (int i = 0; i < size; ++i, ++pConstUnion)
+        {
+            switch (pConstUnion->getType())
+            {
+                case EbtFloat: out << pConstUnion->getFConst(); break;
+                case EbtInt: out << pConstUnion->getIConst(); break;
+                case EbtBool: out << pConstUnion->getBConst(); break;
+                default: UNREACHABLE();
+            }
+            if (i != size - 1) out << ", ";
+        }
+        if (writeType) out << ")";
+    }
+    return pConstUnion;
+}
+
+void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
+{
+    TInfoSinkBase& out = objSink();
+    if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
+        out << mLoopUnroll.GetLoopIndexValue(node);
+    else
+        out << node->getSymbol();
+
+    if (mDeclaringVariables && node->getType().isArray())
+        out << arrayBrackets(node->getType());
+}
+
+void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion* node)
+{
+    writeConstantUnion(node->getType(), node->getUnionArrayPointer());
+}
+
+bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
+{
+    bool visitChildren = true;
+    TInfoSinkBase& out = objSink();
+    switch (node->getOp())
+    {
+        case EOpInitialize:
+            if (visit == InVisit)
+            {
+                out << " = ";
+                // RHS of initialize is not being declared.
+                mDeclaringVariables = false;
+            }
+            break;
+        case EOpAssign: writeTriplet(visit, "(", " = ", ")"); break;
+        case EOpAddAssign: writeTriplet(visit, "(", " += ", ")"); break;
+        case EOpSubAssign: writeTriplet(visit, "(", " -= ", ")"); break;
+        case EOpDivAssign: writeTriplet(visit, "(", " /= ", ")"); break;
+        // Notice the fall-through.
+        case EOpMulAssign: 
+        case EOpVectorTimesMatrixAssign:
+        case EOpVectorTimesScalarAssign:
+        case EOpMatrixTimesScalarAssign:
+        case EOpMatrixTimesMatrixAssign:
+            writeTriplet(visit, "(", " *= ", ")");
+            break;
+
+        case EOpIndexDirect:
+        case EOpIndexIndirect:
+            writeTriplet(visit, NULL, "[", "]");
+            break;
+        case EOpIndexDirectStruct:
+            if (visit == InVisit)
+            {
+                out << ".";
+                // TODO(alokp): ASSERT
+                out << node->getType().getFieldName();
+                visitChildren = false;
+            }
+            break;
+        case EOpVectorSwizzle:
+            if (visit == InVisit)
+            {
+                out << ".";
+                TIntermAggregate* rightChild = node->getRight()->getAsAggregate();
+                TIntermSequence& sequence = rightChild->getSequence();
+                for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
+                {
+                    TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
+                    ASSERT(element->getBasicType() == EbtInt);
+                    ASSERT(element->getNominalSize() == 1);
+                    const ConstantUnion& data = element->getUnionArrayPointer()[0];
+                    ASSERT(data.getType() == EbtInt);
+                    switch (data.getIConst())
+                    {
+                        case 0: out << "x"; break;
+                        case 1: out << "y"; break;
+                        case 2: out << "z"; break;
+                        case 3: out << "w"; break;
+                        default: UNREACHABLE(); break;
+                    }
+                }
+                visitChildren = false;
+            }
+            break;
+
+        case EOpAdd: writeTriplet(visit, "(", " + ", ")"); break;
+        case EOpSub: writeTriplet(visit, "(", " - ", ")"); break;
+        case EOpMul: writeTriplet(visit, "(", " * ", ")"); break;
+        case EOpDiv: writeTriplet(visit, "(", " / ", ")"); break;
+        case EOpMod: UNIMPLEMENTED(); break;
+        case EOpEqual: writeTriplet(visit, "(", " == ", ")"); break;
+        case EOpNotEqual: writeTriplet(visit, "(", " != ", ")"); break;
+        case EOpLessThan: writeTriplet(visit, "(", " < ", ")"); break;
+        case EOpGreaterThan: writeTriplet(visit, "(", " > ", ")"); break;
+        case EOpLessThanEqual: writeTriplet(visit, "(", " <= ", ")"); break;
+        case EOpGreaterThanEqual: writeTriplet(visit, "(", " >= ", ")"); break;
+
+        // Notice the fall-through.
+        case EOpVectorTimesScalar:
+        case EOpVectorTimesMatrix:
+        case EOpMatrixTimesVector:
+        case EOpMatrixTimesScalar:
+        case EOpMatrixTimesMatrix:
+            writeTriplet(visit, "(", " * ", ")");
+            break;
+
+        case EOpLogicalOr: writeTriplet(visit, "(", " || ", ")"); break;
+        case EOpLogicalXor: writeTriplet(visit, "(", " ^^ ", ")"); break;
+        case EOpLogicalAnd: writeTriplet(visit, "(", " && ", ")"); break;
+        default: UNREACHABLE(); break;
+    }
+
+    return visitChildren;
+}
+
+bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary* node)
+{
+    switch (node->getOp())
+    {
+        case EOpNegative: writeTriplet(visit, "(-", NULL, ")"); break;
+        case EOpVectorLogicalNot: writeTriplet(visit, "not(", NULL, ")"); break;
+        case EOpLogicalNot: writeTriplet(visit, "(!", NULL, ")"); break;
+
+        case EOpPostIncrement: writeTriplet(visit, "(", NULL, "++)"); break;
+        case EOpPostDecrement: writeTriplet(visit, "(", NULL, "--)"); break;
+        case EOpPreIncrement: writeTriplet(visit, "(++", NULL, ")"); break;
+        case EOpPreDecrement: writeTriplet(visit, "(--", NULL, ")"); break;
+
+        case EOpConvIntToBool:
+        case EOpConvFloatToBool:
+            switch (node->getOperand()->getType().getNominalSize())
+            {
+                case 1: writeTriplet(visit, "bool(", NULL, ")");  break;
+                case 2: writeTriplet(visit, "bvec2(", NULL, ")"); break;
+                case 3: writeTriplet(visit, "bvec3(", NULL, ")"); break;
+                case 4: writeTriplet(visit, "bvec4(", NULL, ")"); break;
+                default: UNREACHABLE();
+            }
+            break;
+        case EOpConvBoolToFloat:
+        case EOpConvIntToFloat:
+            switch (node->getOperand()->getType().getNominalSize())
+            {
+                case 1: writeTriplet(visit, "float(", NULL, ")");  break;
+                case 2: writeTriplet(visit, "vec2(", NULL, ")"); break;
+                case 3: writeTriplet(visit, "vec3(", NULL, ")"); break;
+                case 4: writeTriplet(visit, "vec4(", NULL, ")"); break;
+                default: UNREACHABLE();
+            }
+            break;
+        case EOpConvFloatToInt:
+        case EOpConvBoolToInt:
+            switch (node->getOperand()->getType().getNominalSize())
+            {
+                case 1: writeTriplet(visit, "int(", NULL, ")");  break;
+                case 2: writeTriplet(visit, "ivec2(", NULL, ")"); break;
+                case 3: writeTriplet(visit, "ivec3(", NULL, ")"); break;
+                case 4: writeTriplet(visit, "ivec4(", NULL, ")"); break;
+                default: UNREACHABLE();
+            }
+            break;
+
+        case EOpRadians: writeTriplet(visit, "radians(", NULL, ")"); break;
+        case EOpDegrees: writeTriplet(visit, "degrees(", NULL, ")"); break;
+        case EOpSin: writeTriplet(visit, "sin(", NULL, ")"); break;
+        case EOpCos: writeTriplet(visit, "cos(", NULL, ")"); break;
+        case EOpTan: writeTriplet(visit, "tan(", NULL, ")"); break;
+        case EOpAsin: writeTriplet(visit, "asin(", NULL, ")"); break;
+        case EOpAcos: writeTriplet(visit, "acos(", NULL, ")"); break;
+        case EOpAtan: writeTriplet(visit, "atan(", NULL, ")"); break;
+
+        case EOpExp: writeTriplet(visit, "exp(", NULL, ")"); break;
+        case EOpLog: writeTriplet(visit, "log(", NULL, ")"); break;
+        case EOpExp2: writeTriplet(visit, "exp2(", NULL, ")"); break;
+        case EOpLog2: writeTriplet(visit, "log2(", NULL, ")"); break;
+        case EOpSqrt: writeTriplet(visit, "sqrt(", NULL, ")"); break;
+        case EOpInverseSqrt: writeTriplet(visit, "inversesqrt(", NULL, ")"); break;
+
+        case EOpAbs: writeTriplet(visit, "abs(", NULL, ")"); break;
+        case EOpSign: writeTriplet(visit, "sign(", NULL, ")"); break;
+        case EOpFloor: writeTriplet(visit, "floor(", NULL, ")"); break;
+        case EOpCeil: writeTriplet(visit, "ceil(", NULL, ")"); break;
+        case EOpFract: writeTriplet(visit, "fract(", NULL, ")"); break;
+
+        case EOpLength: writeTriplet(visit, "length(", NULL, ")"); break;
+        case EOpNormalize: writeTriplet(visit, "normalize(", NULL, ")"); break;
+
+        case EOpDFdx: writeTriplet(visit, "dFdx(", NULL, ")"); break;
+        case EOpDFdy: writeTriplet(visit, "dFdy(", NULL, ")"); break;
+        case EOpFwidth: writeTriplet(visit, "fwidth(", NULL, ")"); break;
+
+        case EOpAny: writeTriplet(visit, "any(", NULL, ")"); break;
+        case EOpAll: writeTriplet(visit, "all(", NULL, ")"); break;
+
+        default: UNREACHABLE(); break;
+    }
+
+    return true;
+}
+
+bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
+{
+    TInfoSinkBase& out = objSink();
+
+    if (node->usesTernaryOperator())
+    {
+        // Notice two brackets at the beginning and end. The outer ones
+        // encapsulate the whole ternary expression. This preserves the
+        // order of precedence when ternary expressions are used in a
+        // compound expression, i.e., c = 2 * (a < b ? 1 : 2).
+        out << "((";
+        node->getCondition()->traverse(this);
+        out << ") ? (";
+        node->getTrueBlock()->traverse(this);
+        out << ") : (";
+        node->getFalseBlock()->traverse(this);
+        out << "))";
+    }
+    else
+    {
+        out << "if (";
+        node->getCondition()->traverse(this);
+        out << ")\n";
+
+        incrementDepth();
+        visitCodeBlock(node->getTrueBlock());
+
+        if (node->getFalseBlock())
+        {
+            out << "else\n";
+            visitCodeBlock(node->getFalseBlock());
+        }
+        decrementDepth();
+    }
+    return false;
+}
+
+bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+    bool visitChildren = true;
+    TInfoSinkBase& out = objSink();
+    switch (node->getOp())
+    {
+        case EOpSequence: {
+            // Scope the sequences except when at the global scope.
+            if (depth > 0) out << "{\n";
+
+            incrementDepth();
+            const TIntermSequence& sequence = node->getSequence();
+            for (TIntermSequence::const_iterator iter = sequence.begin();
+                 iter != sequence.end(); ++iter)
+            {
+                TIntermNode* node = *iter;
+                ASSERT(node != NULL);
+                node->traverse(this);
+
+                if (isSingleStatement(node))
+                    out << ";\n";
+            }
+            decrementDepth();
+
+            // Scope the sequences except when at the global scope.
+            if (depth > 0) out << "}\n";
+            visitChildren = false;
+            break;
+        }
+        case EOpPrototype: {
+            // Function declaration.
+            ASSERT(visit == PreVisit);
+            TString returnType = getTypeName(node->getType());
+            out << returnType << " " << node->getName();
+
+            out << "(";
+            writeFunctionParameters(node->getSequence());
+            out << ")";
+
+            visitChildren = false;
+            break;
+        }
+        case EOpFunction: {
+            // Function definition.
+            ASSERT(visit == PreVisit);
+            writeVariableType(node->getType());
+            out << " " << TFunction::unmangleName(node->getName());
+
+            incrementDepth();
+            // Function definition node contains one or two children nodes
+            // representing function parameters and function body. The latter
+            // is not present in case of empty function bodies.
+            const TIntermSequence& sequence = node->getSequence();
+            ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+            TIntermSequence::const_iterator seqIter = sequence.begin();
+
+            // Traverse function parameters.
+            TIntermAggregate* params = (*seqIter)->getAsAggregate();
+            ASSERT(params != NULL);
+            ASSERT(params->getOp() == EOpParameters);
+            params->traverse(this);
+
+            // Traverse function body.
+            TIntermAggregate* body = ++seqIter != sequence.end() ?
+                (*seqIter)->getAsAggregate() : NULL;
+            visitCodeBlock(body);
+            decrementDepth();
+            // Fully processed; no need to visit children.
+            visitChildren = false;
+            break;
+        }
+        case EOpFunctionCall:
+            // Function call.
+            if (visit == PreVisit)
+            {
+                TString functionName = TFunction::unmangleName(node->getName());
+                out << functionName << "(";
+            }
+            else if (visit == InVisit)
+            {
+                out << ", ";
+            }
+            else
+            {
+                out << ")";
+            }
+            break;
+        case EOpParameters: {
+            // Function parameters.
+            ASSERT(visit == PreVisit);
+            out << "(";
+            writeFunctionParameters(node->getSequence());
+            out << ")";
+            visitChildren = false;
+            break;
+        }
+        case EOpDeclaration: {
+            // Variable declaration.
+            if (visit == PreVisit)
+            {
+                const TIntermSequence& sequence = node->getSequence();
+                const TIntermTyped* variable = sequence.front()->getAsTyped();
+                writeVariableType(variable->getType());
+                out << " ";
+                mDeclaringVariables = true;
+            }
+            else if (visit == InVisit)
+            {
+                out << ", ";
+                mDeclaringVariables = true;
+            }
+            else
+            {
+                mDeclaringVariables = false;
+            }
+            break;
+        }
+        case EOpConstructFloat: writeTriplet(visit, "float(", NULL, ")"); break;
+        case EOpConstructVec2: writeTriplet(visit, "vec2(", ", ", ")"); break;
+        case EOpConstructVec3: writeTriplet(visit, "vec3(", ", ", ")"); break;
+        case EOpConstructVec4: writeTriplet(visit, "vec4(", ", ", ")"); break;
+        case EOpConstructBool: writeTriplet(visit, "bool(", NULL, ")"); break;
+        case EOpConstructBVec2: writeTriplet(visit, "bvec2(", ", ", ")"); break;
+        case EOpConstructBVec3: writeTriplet(visit, "bvec3(", ", ", ")"); break;
+        case EOpConstructBVec4: writeTriplet(visit, "bvec4(", ", ", ")"); break;
+        case EOpConstructInt: writeTriplet(visit, "int(", NULL, ")"); break;
+        case EOpConstructIVec2: writeTriplet(visit, "ivec2(", ", ", ")"); break;
+        case EOpConstructIVec3: writeTriplet(visit, "ivec3(", ", ", ")"); break;
+        case EOpConstructIVec4: writeTriplet(visit, "ivec4(", ", ", ")"); break;
+        case EOpConstructMat2: writeTriplet(visit, "mat2(", ", ", ")"); break;
+        case EOpConstructMat3: writeTriplet(visit, "mat3(", ", ", ")"); break;
+        case EOpConstructMat4: writeTriplet(visit, "mat4(", ", ", ")"); break;
+        case EOpConstructStruct:
+            if (visit == PreVisit)
+            {
+                const TType& type = node->getType();
+                ASSERT(type.getBasicType() == EbtStruct);
+                out << type.getTypeName() << "(";
+            }
+            else if (visit == InVisit)
+            {
+                out << ", ";
+            }
+            else
+            {
+                out << ")";
+            }
+            break;
+
+        case EOpLessThan: writeTriplet(visit, "lessThan(", ", ", ")"); break;
+        case EOpGreaterThan: writeTriplet(visit, "greaterThan(", ", ", ")"); break;
+        case EOpLessThanEqual: writeTriplet(visit, "lessThanEqual(", ", ", ")"); break;
+        case EOpGreaterThanEqual: writeTriplet(visit, "greaterThanEqual(", ", ", ")"); break;
+        case EOpVectorEqual: writeTriplet(visit, "equal(", ", ", ")"); break;
+        case EOpVectorNotEqual: writeTriplet(visit, "notEqual(", ", ", ")"); break;
+        case EOpComma: writeTriplet(visit, NULL, ", ", NULL); break;
+
+        case EOpMod: writeTriplet(visit, "mod(", ", ", ")"); break;
+        case EOpPow: writeTriplet(visit, "pow(", ", ", ")"); break;
+        case EOpAtan: writeTriplet(visit, "atan(", ", ", ")"); break;
+        case EOpMin: writeTriplet(visit, "min(", ", ", ")"); break;
+        case EOpMax: writeTriplet(visit, "max(", ", ", ")"); break;
+        case EOpClamp: writeTriplet(visit, "clamp(", ", ", ")"); break;
+        case EOpMix: writeTriplet(visit, "mix(", ", ", ")"); break;
+        case EOpStep: writeTriplet(visit, "step(", ", ", ")"); break;
+        case EOpSmoothStep: writeTriplet(visit, "smoothstep(", ", ", ")"); break;
+
+        case EOpDistance: writeTriplet(visit, "distance(", ", ", ")"); break;
+        case EOpDot: writeTriplet(visit, "dot(", ", ", ")"); break;
+        case EOpCross: writeTriplet(visit, "cross(", ", ", ")"); break;
+        case EOpFaceForward: writeTriplet(visit, "faceforward(", ", ", ")"); break;
+        case EOpReflect: writeTriplet(visit, "reflect(", ", ", ")"); break;
+        case EOpRefract: writeTriplet(visit, "refract(", ", ", ")"); break;
+        case EOpMul: writeTriplet(visit, "matrixCompMult(", ", ", ")"); break;
+
+        default: UNREACHABLE(); break;
+    }
+    return visitChildren;
+}
+
+bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
+{
+    TInfoSinkBase& out = objSink();
+
+    incrementDepth();
+    // Loop header.
+    TLoopType loopType = node->getType();
+    if (loopType == ELoopFor)  // for loop
+    {
+        if (!node->getUnrollFlag()) {
+            out << "for (";
+            if (node->getInit())
+                node->getInit()->traverse(this);
+            out << "; ";
+
+            if (node->getCondition())
+                node->getCondition()->traverse(this);
+            out << "; ";
+
+            if (node->getExpression())
+                node->getExpression()->traverse(this);
+            out << ")\n";
+        }
+    }
+    else if (loopType == ELoopWhile)  // while loop
+    {
+        out << "while (";
+        ASSERT(node->getCondition() != NULL);
+        node->getCondition()->traverse(this);
+        out << ")\n";
+    }
+    else  // do-while loop
+    {
+        ASSERT(loopType == ELoopDoWhile);
+        out << "do\n";
+    }
+
+    // Loop body.
+    if (node->getUnrollFlag())
+    {
+        TLoopIndexInfo indexInfo;
+        mLoopUnroll.FillLoopIndexInfo(node, indexInfo);
+        mLoopUnroll.Push(indexInfo);
+        while (mLoopUnroll.SatisfiesLoopCondition())
+        {
+            visitCodeBlock(node->getBody());
+            mLoopUnroll.Step();
+        }
+        mLoopUnroll.Pop();
+    }
+    else
+    {
+        visitCodeBlock(node->getBody());
+    }
+
+    // Loop footer.
+    if (loopType == ELoopDoWhile)  // do-while loop
+    {
+        out << "while (";
+        ASSERT(node->getCondition() != NULL);
+        node->getCondition()->traverse(this);
+        out << ");\n";
+    }
+    decrementDepth();
+
+    // No need to visit children. They have been already processed in
+    // this function.
+    return false;
+}
+
+bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch* node)
+{
+    switch (node->getFlowOp())
+    {
+        case EOpKill: writeTriplet(visit, "discard", NULL, NULL); break;
+        case EOpBreak: writeTriplet(visit, "break", NULL, NULL); break;
+        case EOpContinue: writeTriplet(visit, "continue", NULL, NULL); break;
+        case EOpReturn: writeTriplet(visit, "return ", NULL, NULL); break;
+        default: UNREACHABLE(); break;
+    }
+
+    return true;
+}
+
+void TOutputGLSLBase::visitCodeBlock(TIntermNode* node) {
+    TInfoSinkBase &out = objSink();
+    if (node != NULL)
+    {
+        node->traverse(this);
+        // Single statements not part of a sequence need to be terminated
+        // with semi-colon.
+        if (isSingleStatement(node))
+            out << ";\n";
+    }
+    else
+    {
+        out << "{\n}\n";  // Empty code block.
+    }
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h
new file mode 100644 (file)
index 0000000..efd0b5f
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2002-2011 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.
+//
+
+#ifndef CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
+#define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
+
+#include <set>
+
+#include "compiler/ForLoopUnroll.h"
+#include "compiler/intermediate.h"
+#include "compiler/ParseHelper.h"
+
+class TOutputGLSLBase : public TIntermTraverser
+{
+public:
+    TOutputGLSLBase(TInfoSinkBase& objSink);
+
+protected:
+    TInfoSinkBase& objSink() { return mObjSink; }
+    void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
+    void writeVariableType(const TType& type);
+    virtual bool writeVariablePrecision(TPrecision precision) = 0;
+    void writeFunctionParameters(const TIntermSequence& args);
+    const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
+
+    virtual void visitSymbol(TIntermSymbol* node);
+    virtual void visitConstantUnion(TIntermConstantUnion* node);
+    virtual bool visitBinary(Visit visit, TIntermBinary* node);
+    virtual bool visitUnary(Visit visit, TIntermUnary* node);
+    virtual bool visitSelection(Visit visit, TIntermSelection* node);
+    virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
+    virtual bool visitLoop(Visit visit, TIntermLoop* node);
+    virtual bool visitBranch(Visit visit, TIntermBranch* node);
+
+    void visitCodeBlock(TIntermNode* node);
+
+private:
+    TInfoSinkBase& mObjSink;
+    bool mDeclaringVariables;
+
+    // Structs are declared as the tree is traversed. This set contains all
+    // the structs already declared. It is maintained so that a struct is
+    // declared only once.
+    typedef std::set<TString> DeclaredStructs;
+    DeclaredStructs mDeclaredStructs;
+
+    ForLoopUnroll mLoopUnroll;
+};
+
+#endif  // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
index 57e99d2..afa8f04 100644 (file)
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2011 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,8 +33,11 @@ OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, tr
     mUsesTexture2D_bias = false;
     mUsesTexture2DProj = false;
     mUsesTexture2DProj_bias = false;
+    mUsesTexture2DProjLod = false;
+    mUsesTexture2DLod = false;
     mUsesTextureCube = false;
     mUsesTextureCube_bias = false;
+    mUsesTextureCubeLod = false;
     mUsesDepthRange = false;
     mUsesFragCoord = false;
     mUsesPointCoord = false;
@@ -196,11 +199,25 @@ void OutputHLSL::header()
         out <<  uniforms;
         out << "\n";
 
+        // The texture fetch functions "flip" the Y coordinate in one way or another. This is because textures are stored
+        // according to the OpenGL convention, i.e. (0, 0) is "bottom left", rather than the D3D convention where (0, 0)
+        // is "top left". Since the HLSL texture fetch functions expect textures to be stored according to the D3D
+        // convention, the Y coordinate passed to these functions is adjusted to compensate.
+        //
+        // The simplest case is texture2D where the mapping is Y -> 1-Y, which maps [0, 1] -> [1, 0].
+        //
+        // The texture2DProj functions are more complicated because the projection divides by either Z or W. For the vec3
+        // case, the mapping is Y -> Z-Y or Y/Z -> 1-Y/Z, which again maps [0, 1] -> [1, 0].
+        //
+        // For cube textures the mapping is Y -> -Y, which maps [-1, 1] -> [1, -1]. This is not sufficient on its own for the
+        // +Y and -Y faces, which are now on the "wrong sides" of the cube. This is compensated for by exchanging the
+        // +Y and -Y faces everywhere else throughout the code.
+        
         if (mUsesTexture2D)
         {
             out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
                    "{\n"
-                   "    return tex2D(s, t);\n"
+                   "    return tex2D(s, float2(t.x, 1 - t.y));\n"
                    "}\n"
                    "\n";
         }
@@ -209,7 +226,7 @@ void OutputHLSL::header()
         {
             out << "float4 gl_texture2D(sampler2D s, float2 t, float bias)\n"
                    "{\n"
-                   "    return tex2Dbias(s, float4(t.x, t.y, 0, bias));\n"
+                   "    return tex2Dbias(s, float4(t.x, 1 - t.y, 0, bias));\n"
                    "}\n"
                    "\n";
         }
@@ -218,12 +235,12 @@ void OutputHLSL::header()
         {
             out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
                    "{\n"
-                   "    return tex2Dproj(s, float4(t.x, t.y, 0, t.z));\n"
+                   "    return tex2Dproj(s, float4(t.x, t.z - t.y, 0, t.z));\n"
                    "}\n"
                    "\n"
                    "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
                    "{\n"
-                   "    return tex2Dproj(s, t);\n"
+                   "    return tex2Dproj(s, float4(t.x, t.w - t.y, t.z, t.w));\n"
                    "}\n"
                    "\n";
         }
@@ -232,12 +249,12 @@ void OutputHLSL::header()
         {
             out << "float4 gl_texture2DProj(sampler2D s, float3 t, float bias)\n"
                    "{\n"
-                   "    return tex2Dbias(s, float4(t.x / t.z, t.y / t.z, 0, bias));\n"
+                   "    return tex2Dbias(s, float4(t.x / t.z, 1 - (t.y / t.z), 0, bias));\n"
                    "}\n"
                    "\n"
                    "float4 gl_texture2DProj(sampler2D s, float4 t, float bias)\n"
                    "{\n"
-                   "    return tex2Dbias(s, float4(t.x / t.w, t.y / t.w, 0, bias));\n"
+                   "    return tex2Dbias(s, float4(t.x / t.w, 1 - (t.y / t.w), 0, bias));\n"
                    "}\n"
                    "\n";
         }
@@ -246,7 +263,7 @@ void OutputHLSL::header()
         {
             out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
                    "{\n"
-                   "    return texCUBE(s, t);\n"
+                   "    return texCUBE(s, float3(t.x, -t.y, t.z));\n"
                    "}\n"
                    "\n";
         }
@@ -255,7 +272,7 @@ void OutputHLSL::header()
         {
             out << "float4 gl_textureCube(samplerCUBE s, float3 t, float bias)\n"
                    "{\n"
-                   "    return texCUBEbias(s, float4(t.x, t.y, t.z, bias));\n"
+                   "    return texCUBEbias(s, float4(t.x, -t.y, t.z, bias));\n"
                    "}\n"
                    "\n";
         }
@@ -331,6 +348,84 @@ void OutputHLSL::header()
                "\n";
         out <<  uniforms;
         out << "\n";
+
+        // The texture fetch functions "flip" the Y coordinate in one way or another. This is because textures are stored
+        // according to the OpenGL convention, i.e. (0, 0) is "bottom left", rather than the D3D convention where (0, 0)
+        // is "top left". Since the HLSL texture fetch functions expect textures to be stored according to the D3D
+        // convention, the Y coordinate passed to these functions is adjusted to compensate.
+        //
+        // The simplest case is texture2D where the mapping is Y -> 1-Y, which maps [0, 1] -> [1, 0].
+        //
+        // The texture2DProj functions are more complicated because the projection divides by either Z or W. For the vec3
+        // case, the mapping is Y -> Z-Y or Y/Z -> 1-Y/Z, which again maps [0, 1] -> [1, 0].
+        //
+        // For cube textures the mapping is Y -> -Y, which maps [-1, 1] -> [1, -1]. This is not sufficient on its own for the
+        // +Y and -Y faces, which are now on the "wrong sides" of the cube. This is compensated for by exchanging the
+        // +Y and -Y faces everywhere else throughout the code.
+        
+        if (mUsesTexture2D)
+        {
+            out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
+                   "{\n"
+                   "    return tex2Dlod(s, float4(t.x, 1 - t.y, 0, 0));\n"
+                   "}\n"
+                   "\n";
+        }
+
+        if (mUsesTexture2DLod)
+        {
+            out << "float4 gl_texture2DLod(sampler2D s, float2 t, float lod)\n"
+                   "{\n"
+                   "    return tex2Dlod(s, float4(t.x, 1 - t.y, 0, lod));\n"
+                   "}\n"
+                   "\n";
+        }
+
+        if (mUsesTexture2DProj)
+        {
+            out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
+                   "{\n"
+                   "    return tex2Dlod(s, float4(t.x / t.z, 1 - t.y / t.z, 0, 0));\n"
+                   "}\n"
+                   "\n"
+                   "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
+                   "{\n"
+                   "    return tex2Dlod(s, float4(t.x / t.w, 1 - t.y / t.w, 0, 0));\n"
+                   "}\n"
+                   "\n";
+        }
+
+        if (mUsesTexture2DProjLod)
+        {
+            out << "float4 gl_texture2DProjLod(sampler2D s, float3 t, float lod)\n"
+                   "{\n"
+                   "    return tex2Dlod(s, float4(t.x / t.z, 1 - t.y / t.z, 0, lod));\n"
+                   "}\n"
+                   "\n"
+                   "float4 gl_texture2DProjLod(sampler2D s, float4 t, float lod)\n"
+                   "{\n"
+                   "    return tex2Dlod(s, float4(t.x / t.w, 1 - t.y / t.w, 0, lod));\n"
+                   "}\n"
+                   "\n";
+        }
+
+        if (mUsesTextureCube)
+        {
+            out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
+                   "{\n"
+                   "    return texCUBElod(s, float4(t.x, -t.y, t.z, 0));\n"
+                   "}\n"
+                   "\n";
+        }
+
+        if (mUsesTextureCubeLod)
+        {
+            out << "float4 gl_textureCubeLod(samplerCUBE s, float3 t, float lod)\n"
+                   "{\n"
+                   "    return texCUBElod(s, float4(t.x, -t.y, t.z, lod));\n"
+                   "}\n"
+                   "\n";
+        }
     }
 
     if (mUsesFragCoord)
@@ -968,7 +1063,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
       case EOpLength:           outputTriplet(visit, "length(", "", ")");    break;
       case EOpNormalize:        outputTriplet(visit, "normalize(", "", ")"); break;
       case EOpDFdx:             outputTriplet(visit, "ddx(", "", ")");       break;
-      case EOpDFdy:             outputTriplet(visit, "ddy(", "", ")");       break;
+      case EOpDFdy:             outputTriplet(visit, "(-ddy(", "", "))");    break;
       case EOpFwidth:           outputTriplet(visit, "fwidth(", "", ")");    break;        
       case EOpAny:              outputTriplet(visit, "any(", "", ")");       break;
       case EOpAll:              outputTriplet(visit, "all(", "", ")");       break;
@@ -989,6 +1084,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
         {
             if (mInsideFunction)
             {
+                outputLineDirective(node->getLine());
                 out << "{\n";
 
                 mScopeDepth++;
@@ -1005,6 +1101,8 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
 
             for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++)
             {
+                outputLineDirective((*sit)->getLine());
+
                 if (isSingleStatement(*sit))
                 {
                     mUnfoldSelect->traverse(*sit);
@@ -1017,6 +1115,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
 
             if (mInsideFunction)
             {
+                outputLineDirective(node->getEndLine());
                 out << "}\n";
 
                 mScopeDepth--;
@@ -1157,13 +1256,16 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
 
                 sequence.erase(sequence.begin());
 
-                out << ")\n"
-                       "{\n";
-
+                out << ")\n";
+                
+                outputLineDirective(node->getLine());
+                out << "{\n";
+                
                 mInsideFunction = true;
             }
             else if (visit == PostVisit)
             {
+                outputLineDirective(node->getEndLine());
                 out << "}\n";
 
                 mInsideFunction = false;
@@ -1226,15 +1328,33 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
                     }
                     else if (name == "texture2DLod")
                     {
-                        UNIMPLEMENTED();   // Requires the vertex shader texture sampling extension
+                        if (node->getSequence().size() == 3)
+                        {
+                            mUsesTexture2DLod = true;
+                        }
+                        else UNREACHABLE();
+
+                        out << "gl_texture2DLod(";
                     }
                     else if (name == "texture2DProjLod")
                     {
-                        UNIMPLEMENTED();   // Requires the vertex shader texture sampling extension
+                        if (node->getSequence().size() == 3)
+                        {
+                            mUsesTexture2DProjLod = true;
+                        }
+                        else UNREACHABLE();
+
+                        out << "gl_texture2DProjLod(";
                     }
                     else if (name == "textureCubeLod")
                     {
-                        UNIMPLEMENTED();   // Requires the vertex shader texture sampling extension
+                        if (node->getSequence().size() == 3)
+                        {
+                            mUsesTextureCubeLod = true;
+                        }
+                        else UNREACHABLE();
+
+                        out << "gl_textureCubeLod(";
                     }
                     else UNREACHABLE();
                 }
@@ -1388,23 +1508,30 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
 
         node->getCondition()->traverse(this);
 
-        out << ")\n"
-               "{\n";
+        out << ")\n";
+        
+        outputLineDirective(node->getLine());
+        out << "{\n";
 
         if (node->getTrueBlock())
         {
             node->getTrueBlock()->traverse(this);
         }
 
+        outputLineDirective(node->getLine());
         out << ";}\n";
 
         if (node->getFalseBlock())
         {
-            out << "else\n"
-                   "{\n";
+            out << "else\n";
+
+            outputLineDirective(node->getFalseBlock()->getLine());
+            out << "{\n";
 
+            outputLineDirective(node->getFalseBlock()->getLine());
             node->getFalseBlock()->traverse(this);
 
+            outputLineDirective(node->getFalseBlock()->getLine());
             out << ";}\n";
         }
     }
@@ -1428,8 +1555,10 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
 
     if (node->getType() == ELoopDoWhile)
     {
-        out << "do\n"
-               "{\n";
+        out << "do\n";
+
+        outputLineDirective(node->getLine());
+        out << "{\n";
     }
     else
     {
@@ -1469,8 +1598,10 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
             node->getExpression()->traverse(this);
         }
 
-        out << ")\n"
-               "{\n";
+        out << ")\n";
+        
+        outputLineDirective(node->getLine());
+        out << "{\n";
     }
 
     if (node->getBody())
@@ -1478,10 +1609,12 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
         node->getBody()->traverse(this);
     }
 
+    outputLineDirective(node->getLine());
     out << "}\n";
 
     if (node->getType() == ELoopDoWhile)
     {
+        outputLineDirective(node->getCondition()->getLine());
         out << "while(\n";
 
         node->getCondition()->traverse(this);
@@ -1500,9 +1633,9 @@ bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
 
     switch (node->getFlowOp())
     {
-      case EOpKill:     outputTriplet(visit, "discard", "", "");  break;
-      case EOpBreak:    outputTriplet(visit, "break", "", "");    break;
-      case EOpContinue: outputTriplet(visit, "continue", "", ""); break;
+      case EOpKill:     outputTriplet(visit, "discard;\n", "", "");  break;
+      case EOpBreak:    outputTriplet(visit, "break;\n", "", "");    break;
+      case EOpContinue: outputTriplet(visit, "continue;\n", "", ""); break;
       case EOpReturn:
         if (visit == PreVisit)
         {
@@ -1517,7 +1650,10 @@ bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
         }
         else if (visit == PostVisit)
         {
-            out << ";\n";
+            if (node->getExpression())
+            {
+                out << ";\n";
+            }
         }
         break;
       default: UNREACHABLE();
@@ -1669,7 +1805,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
 
         if (comparator == EOpLessThan)
         {
-            int iterations = (limit - initial + 1) / increment;
+            int iterations = (limit - initial) / increment;
 
             if (iterations <= 255)
             {
@@ -1678,8 +1814,8 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
 
             while (iterations > 0)
             {
-                int remainder = (limit - initial + 1) % increment;
-                int clampedLimit = initial + increment * std::min(255, iterations) - 1 - remainder;
+                int remainder = (limit - initial) % increment;
+                int clampedLimit = initial + increment * std::min(255, iterations);
 
                 // for(int index = initial; index < clampedLimit; index += increment)
 
@@ -1697,14 +1833,17 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
                 index->traverse(this);
                 out << " += ";
                 out << increment;
-                out << ")\n"
-                       "{\n";
+                out << ")\n";
+                
+                outputLineDirective(node->getLine());
+                out << "{\n";
 
                 if (node->getBody())
                 {
                     node->getBody()->traverse(this);
                 }
 
+                outputLineDirective(node->getLine());
                 out << "}\n";
 
                 initial += 255 * increment;
@@ -1737,6 +1876,22 @@ void OutputHLSL::outputTriplet(Visit visit, const TString &preString, const TStr
     }
 }
 
+void OutputHLSL::outputLineDirective(int line)
+{
+    if ((mContext.compileOptions & SH_LINE_DIRECTIVES) && (line > 0))
+    {
+        mBody << "\n";
+        mBody << "#line " << line;
+
+        if (mContext.sourcePath)
+        {
+            mBody << " \"" << mContext.sourcePath << "\"";
+        }
+        
+        mBody << "\n";
+    }
+}
+
 TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
 {
     TQualifier qualifier = symbol->getQualifier();
index ddbd077..805561a 100644 (file)
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2011 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.
 //
@@ -49,6 +49,7 @@ class OutputHLSL : public TIntermTraverser
     bool isSingleStatement(TIntermNode *node);
     bool handleExcessiveLoop(TIntermLoop *node);
     void outputTriplet(Visit visit, const TString &preString, const TString &inString, const TString &postString);
+    void outputLineDirective(int line);
     TString argumentString(const TIntermSymbol *symbol);
     int vectorSize(const TType &type) const;
 
@@ -75,10 +76,13 @@ class OutputHLSL : public TIntermTraverser
     // Parameters determining what goes in the header output
     bool mUsesTexture2D;
     bool mUsesTexture2D_bias;
+    bool mUsesTexture2DLod;
     bool mUsesTexture2DProj;
     bool mUsesTexture2DProj_bias;
+    bool mUsesTexture2DProjLod;
     bool mUsesTextureCube;
     bool mUsesTextureCube_bias;
+    bool mUsesTextureCubeLod;
     bool mUsesDepthRange;
     bool mUsesFragCoord;
     bool mUsesPointCoord;
index e149430..3f0836d 100644 (file)
@@ -261,6 +261,8 @@ void TParseContext::binaryOpError(int line, const char* op, TString left, TStrin
 }
 
 bool TParseContext::precisionErrorCheck(int line, TPrecision precision, TBasicType type){
+    if (!checksPrecisionErrors)
+        return false;
     switch( type ){
     case EbtFloat:
         if( precision == EbpUndefined ){
@@ -560,7 +562,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
         }
     }
 
-    TIntermTyped* typed = node->getAsTyped();
+    TIntermTyped *typed = node ? node->getAsTyped() : 0;
     if (typed == 0) {
         error(line, "constructor argument does not have a type", "constructor", "");
         return true;
@@ -882,16 +884,17 @@ bool TParseContext::nonInitConstErrorCheck(int line, TString& identifier, TPubli
 //
 // Returns true if there was an error.
 //
-bool TParseContext::nonInitErrorCheck(int line, TString& identifier, TPublicType& type)
+bool TParseContext::nonInitErrorCheck(int line, TString& identifier, TPublicType& type, TVariable*& variable)
 {
     if (reservedErrorCheck(line, identifier))
         recover();
 
-    TVariable* variable = new TVariable(&identifier, TType(type));
+    variable = new TVariable(&identifier, TType(type));
 
     if (! symbolTable.insert(*variable)) {
         error(line, "redefinition", variable->getName().c_str(), "");
         delete variable;
+        variable = 0;
         return true;
     }
 
index cb6e0d0..8637d89 100644 (file)
@@ -30,16 +30,18 @@ struct TPragma {
 // they can be passed to the parser without needing a global.
 //
 struct TParseContext {
-    TParseContext(TSymbolTable& symt, const TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, TInfoSink& is) :
-            intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), treeRoot(0),
+    TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) :
+            intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), compileOptions(options), checksPrecisionErrors(checksPrecErrors), sourcePath(sourcePath), treeRoot(0),
             recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
             inTypeParen(false), scanner(NULL), contextPragma(true, false) {  }
     TIntermediate& intermediate; // to hold and build a parse tree
     TSymbolTable& symbolTable;   // symbol table that goes with the language currently being parsed
-    TExtensionBehavior extensionBehavior;  // mapping between supported extensions and current behavior.
+    TExtensionBehavior& extensionBehavior;  // mapping between supported extensions and current behavior.
     TInfoSink& infoSink;
     ShShaderType shaderType;              // vertex or fragment language (future: pack or unpack)
     ShShaderSpec shaderSpec;              // The language specification compiler conforms to - GLES2 or WebGL.
+    int compileOptions;
+    const char* sourcePath;      // Path of source file or NULL.
     TIntermNode* treeRoot;       // root of parse tree being created
     bool recoveredFromError;     // true if a parse error has occurred, but we continue to parse
     int numErrors;
@@ -48,6 +50,7 @@ struct TParseContext {
     bool inTypeParen;            // true if in parentheses, looking only for an identifier
     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.
 
     void error(TSourceLoc loc, const char *reason, const char* token,
                const char* extraInfoFormat, ...);
@@ -79,7 +82,7 @@ struct TParseContext {
     bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
     bool containsSampler(TType& type);
     bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type);
-    bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type);
+    bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type, TVariable*& variable);
     bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
     bool extensionErrorCheck(int line, const TString&);
     const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0);
index d134ea7..bf61d29 100644 (file)
@@ -57,6 +57,7 @@ public:
     TInfoSink& getInfoSink() { return infoSink; }
     const TVariableInfoList& getAttribs() const { return attribs; }
     const TVariableInfoList& getUniforms() const { return uniforms; }
+    int getMappedNameMaxLength() const;
 
 protected:
     ShShaderType getShaderType() const { return shaderType; }
@@ -70,8 +71,12 @@ protected:
     bool validateLimitations(TIntermNode* root);
     // Collect info for all attribs and uniforms.
     void collectAttribsUniforms(TIntermNode* root);
+    // Map long variable names into shorter ones.
+    void mapLongVariableNames(TIntermNode* root);
     // Translate to object code.
     virtual void translate(TIntermNode* root) = 0;
+    // Get built-in extensions with default behavior.
+    const TExtensionBehavior& getExtensionBehavior() const;
 
 private:
     ShShaderType shaderType;
@@ -87,6 +92,9 @@ private:
     TInfoSink infoSink;  // Output sink.
     TVariableInfoList attribs;  // Active attributes in the compiled shader.
     TVariableInfoList uniforms;  // Active uniforms in the compiled shader.
+
+    // Pair of long varying varibale name <originalName, mappedName>.
+    TMap<TString, TString> varyingLongNameMap;
 };
 
 //
@@ -98,7 +106,8 @@ private:
 // destroy the machine dependent objects, which contain the
 // above machine independent information.
 //
-TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec);
+TCompiler* ConstructCompiler(
+    ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
 void DeleteCompiler(TCompiler*);
 
 #endif // _SHHANDLE_INCLUDED_
index 6cac61d..ab8799c 100644 (file)
@@ -37,7 +37,8 @@ static void getVariableInfo(ShShaderInfo varType,
                             int* length,
                             int* size,
                             ShDataType* type,
-                            char* name)
+                            char* name,
+                            char* mappedName)
 {
     if (!handle || !size || !type || !name)
         return;
@@ -59,6 +60,8 @@ static void getVariableInfo(ShShaderInfo varType,
     *size = varInfo.size;
     *type = varInfo.type;
     strcpy(name, varInfo.name.c_str());
+    if (mappedName)
+        strcpy(mappedName, varInfo.mappedName.c_str());
 }
 
 //
@@ -107,12 +110,13 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
 // Driver calls these to create and destroy compiler objects.
 //
 ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+                             ShShaderOutput output,
                              const ShBuiltInResources* resources)
 {
     if (!InitThread())
         return 0;
 
-    TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec));
+    TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec, output));
     TCompiler* compiler = base->getAsCompiler();
     if (compiler == 0)
         return 0;
@@ -194,7 +198,9 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
     case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
         *params = getVariableMaxLength(compiler->getAttribs());
         break;
-
+    case SH_MAPPED_NAME_MAX_LENGTH:
+        *params = compiler->getMappedNameMaxLength();
+        break;
     default: UNREACHABLE();
     }
 }
@@ -236,10 +242,11 @@ void ShGetActiveAttrib(const ShHandle handle,
                        int* length,
                        int* size,
                        ShDataType* type,
-                       char* name)
+                       char* name,
+                       char* mappedName)
 {
     getVariableInfo(SH_ACTIVE_ATTRIBUTES,
-                    handle, index, length, size, type, name);
+                    handle, index, length, size, type, name, mappedName);
 }
 
 void ShGetActiveUniform(const ShHandle handle,
@@ -247,8 +254,9 @@ void ShGetActiveUniform(const ShHandle handle,
                         int* length,
                         int* size,
                         ShDataType* type,
-                        char* name)
+                        char* name,
+                        char* mappedName)
 {
     getVariableInfo(SH_ACTIVE_UNIFORMS,
-                    handle, index, length, size, type, name);
+                    handle, index, length, size, type, name, mappedName);
 }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp
new file mode 100644 (file)
index 0000000..bb201a4
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2002-2011 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/TranslatorESSL.h"
+
+#include "compiler/OutputESSL.h"
+
+TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
+    : TCompiler(type, spec) {
+}
+
+void TranslatorESSL::translate(TIntermNode* root) {
+    TInfoSinkBase& sink = getInfoSink().obj;
+
+    // Write built-in extension behaviors.
+    writeExtensionBehavior();
+
+    // Write translated shader.
+    TOutputESSL outputESSL(sink);
+    root->traverse(&outputESSL);
+}
+
+void TranslatorESSL::writeExtensionBehavior() {
+    TInfoSinkBase& sink = getInfoSink().obj;
+    const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
+         iter != extensionBehavior.end(); ++iter) {
+        sink << "#extension " << iter->first << " : "
+             << getBehaviorString(iter->second) << "\n";
+    }
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.h b/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.h
new file mode 100644 (file)
index 0000000..a1196bd
--- /dev/null
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2002-2011 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.
+//
+
+#ifndef COMPILER_TRANSLATORESSL_H_
+#define COMPILER_TRANSLATORESSL_H_
+
+#include "compiler/ShHandle.h"
+
+class TranslatorESSL : public TCompiler {
+public:
+    TranslatorESSL(ShShaderType type, ShShaderSpec spec);
+
+protected:
+    virtual void translate(TIntermNode* root);
+
+private:
+    void writeExtensionBehavior();
+};
+
+#endif  // COMPILER_TRANSLATORESSL_H_
index 886f693..b46e4b9 100644 (file)
@@ -17,6 +17,17 @@ bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
     return false;
 }
 
+void MarkLoopForUnroll(const TIntermSymbol* symbol, TLoopStack& stack) {
+    for (TLoopStack::iterator i = stack.begin(); i != stack.end(); ++i) {
+        if (i->index.id == symbol->getId()) {
+            ASSERT(i->loop != NULL);
+            i->loop->setUnrollFlag(true);
+            return;
+        }
+    }
+    UNREACHABLE();
+}
+
 // Traverses a node to check if it represents a constant index expression.
 // Definition:
 // constant-index-expressions are a superset of constant-expressions.
@@ -54,6 +65,48 @@ private:
     bool mValid;
     const TLoopStack& mLoopStack;
 };
+
+// Traverses a node to check if it uses a loop index.
+// If an int loop index is used in its body as a sampler array index,
+// mark the loop for unroll.
+class ValidateLoopIndexExpr : public TIntermTraverser {
+public:
+    ValidateLoopIndexExpr(TLoopStack& stack)
+        : mUsesFloatLoopIndex(false),
+          mUsesIntLoopIndex(false),
+          mLoopStack(stack) {}
+
+    bool usesFloatLoopIndex() const { return mUsesFloatLoopIndex; }
+    bool usesIntLoopIndex() const { return mUsesIntLoopIndex; }
+
+    virtual void visitSymbol(TIntermSymbol* symbol) {
+        if (IsLoopIndex(symbol, mLoopStack)) {
+            switch (symbol->getBasicType()) {
+              case EbtFloat:
+                mUsesFloatLoopIndex = true;
+                break;
+              case EbtInt:
+                mUsesIntLoopIndex = true;
+                MarkLoopForUnroll(symbol, mLoopStack);
+                break;
+              default:
+                UNREACHABLE();
+            }
+        }
+    }
+    virtual void visitConstantUnion(TIntermConstantUnion*) {}
+    virtual bool visitBinary(Visit, TIntermBinary*) { return true; }
+    virtual bool visitUnary(Visit, TIntermUnary*) { return true; }
+    virtual bool visitSelection(Visit, TIntermSelection*) { return true; }
+    virtual bool visitAggregate(Visit, TIntermAggregate*) { return true; }
+    virtual bool visitLoop(Visit, TIntermLoop*) { return true; }
+    virtual bool visitBranch(Visit, TIntermBranch*) { return true; }
+
+private:
+    bool mUsesFloatLoopIndex;
+    bool mUsesIntLoopIndex;
+    TLoopStack& mLoopStack;
+};
 }  // namespace
 
 ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
@@ -80,7 +133,28 @@ bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
     // Check indexing.
     switch (node->getOp()) {
       case EOpIndexDirect:
+        validateIndexing(node);
+        break;
       case EOpIndexIndirect:
+#if defined(__APPLE__)
+        // Loop unrolling is a work-around for a Mac Cg compiler bug where it
+        // crashes when a sampler array's index is also the loop index.
+        // Once Apple fixes this bug, we should remove the code in this CL.
+        // See http://codereview.appspot.com/4331048/.
+        if ((node->getLeft() != NULL) && (node->getRight() != NULL) &&
+            (node->getLeft()->getAsSymbolNode())) {
+            TIntermSymbol* symbol = node->getLeft()->getAsSymbolNode();
+            if (IsSampler(symbol->getBasicType()) && symbol->isArray()) {
+                ValidateLoopIndexExpr validate(mLoopStack);
+                node->getRight()->traverse(&validate);
+                if (validate.usesFloatLoopIndex()) {
+                    error(node->getLine(),
+                          "sampler array index is float loop index",
+                          "for");
+                }
+            }
+        }
+#endif
         validateIndexing(node);
         break;
       default: break;
@@ -120,6 +194,7 @@ bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
 
     TLoopInfo info;
     memset(&info, 0, sizeof(TLoopInfo));
+    info.loop = node;
     if (!validateForLoopHeader(node, &info))
         return false;
 
index a4f5a28..dd2e5bf 100644 (file)
@@ -13,6 +13,7 @@ struct TLoopInfo {
     struct TIndex {
         int id;  // symbol id.
     } index;
+    TIntermLoop* loop;
 };
 typedef TVector<TLoopInfo> TLoopStack;
 
index ad2e08f..a13a896 100644 (file)
@@ -70,32 +70,37 @@ static ShDataType getVariableDataType(const TType& type)
 
 static void getBuiltInVariableInfo(const TType& type,
                                    const TString& name,
+                                   const TString& mappedName,
                                    TVariableInfoList& infoList);
 static void getUserDefinedVariableInfo(const TType& type,
                                        const TString& name,
+                                       const TString& mappedName,
                                        TVariableInfoList& infoList);
 
 // Returns info for an attribute or uniform.
 static void getVariableInfo(const TType& type,
                             const TString& name,
+                            const TString& mappedName,
                             TVariableInfoList& infoList)
 {
     if (type.getBasicType() == EbtStruct) {
         if (type.isArray()) {
             for (int i = 0; i < type.getArraySize(); ++i) {
                 TString lname = name + arrayBrackets(i);
-                getUserDefinedVariableInfo(type, lname, infoList);
+                TString lmappedName = mappedName + arrayBrackets(i);
+                getUserDefinedVariableInfo(type, lname, lmappedName, infoList);
             }
         } else {
-            getUserDefinedVariableInfo(type, name, infoList);
+            getUserDefinedVariableInfo(type, name, mappedName, infoList);
         }
     } else {
-        getBuiltInVariableInfo(type, name, infoList);
+        getBuiltInVariableInfo(type, name, mappedName, infoList);
     }
 }
 
 void getBuiltInVariableInfo(const TType& type,
                             const TString& name,
+                            const TString& mappedName,
                             TVariableInfoList& infoList)
 {
     ASSERT(type.getBasicType() != EbtStruct);
@@ -103,9 +108,11 @@ void getBuiltInVariableInfo(const TType& type,
     TVariableInfo varInfo;
     if (type.isArray()) {
         varInfo.name = (name + "[0]").c_str();
+        varInfo.mappedName = (mappedName + "[0]").c_str();
         varInfo.size = type.getArraySize();
     } else {
         varInfo.name = name.c_str();
+        varInfo.mappedName = mappedName.c_str();
         varInfo.size = 1;
     }
     varInfo.type = getVariableDataType(type);
@@ -114,16 +121,17 @@ void getBuiltInVariableInfo(const TType& type,
 
 void getUserDefinedVariableInfo(const TType& type,
                                 const TString& name,
+                                const TString& mappedName,
                                 TVariableInfoList& infoList)
 {
     ASSERT(type.getBasicType() == EbtStruct);
 
-    TString lname = name + ".";
     const TTypeList* structure = type.getStruct();
     for (size_t i = 0; i < structure->size(); ++i) {
         const TType* fieldType = (*structure)[i].type;
         getVariableInfo(*fieldType,
-                        lname + fieldType->getFieldName(),
+                        name + "." + fieldType->getFieldName(),
+                        mappedName + "." + fieldType->getFieldName(),
                         infoList);
     }
 }
@@ -186,7 +194,9 @@ bool CollectAttribsUniforms::visitAggregate(Visit, TIntermAggregate* node)
                 // cannot be initialized in a shader, we must have only
                 // TIntermSymbol nodes in the sequence.
                 ASSERT(variable != NULL);
-                getVariableInfo(variable->getType(), variable->getSymbol(),
+                getVariableInfo(variable->getType(),
+                                variable->getOriginalSymbol(),
+                                variable->getSymbol(),
                                 infoList);
             }
         }
index 15a5c57..667acaf 100644 (file)
@@ -1,9 +1,12 @@
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2011 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.
 //
 
+#ifndef COMPILER_VARIABLE_INFO_H_
+#define COMPILER_VARIABLE_INFO_H_
+
 #include "GLSLANG/ShaderLang.h"
 #include "compiler/intermediate.h"
 
@@ -11,6 +14,7 @@
 // It is currently being used to store info about active attribs and uniforms.
 struct TVariableInfo {
     TPersistString name;
+    TPersistString mappedName;
     ShDataType type;
     int size;
 };
@@ -36,3 +40,4 @@ private:
     TVariableInfoList& mUniforms;
 };
 
+#endif  // COMPILER_VARIABLE_INFO_H_
index 3f87820..26cee05 100644 (file)
@@ -9,13 +9,17 @@
 static const int GLSL_VERSION_110 = 110;
 static const int GLSL_VERSION_120 = 120;
 
-// We need to scan for two things:
+// We need to scan for three things:
 // 1. "invariant" keyword: This can occur in both - vertex and fragment shaders
 //    but only at the global scope.
 // 2. "gl_PointCoord" built-in variable: This can only occur in fragment shader
 //    but inside any scope.
-// So we need to scan the entire fragment shader but only the global scope
-// of vertex shader.
+// 3. Call to a matrix constructor with another matrix as argument.
+//    (These constructors were reserved in GLSL version 1.10.)
+//
+// If it weren't for (3) then we would only need to scan the global
+// scope of the vertex shader. However, we need to scan the entire
+// shader in both cases.
 //
 // TODO(alokp): The following two cases of invariant decalaration get lost
 // during parsing - they do not get carried over to the intermediate tree.
@@ -34,40 +38,32 @@ TVersionGLSL::TVersionGLSL(ShShaderType type)
 
 void TVersionGLSL::visitSymbol(TIntermSymbol* node)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
-
     if (node->getSymbol() == "gl_PointCoord")
         updateVersion(GLSL_VERSION_120);
 }
 
 void TVersionGLSL::visitConstantUnion(TIntermConstantUnion*)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
 }
 
 bool TVersionGLSL::visitBinary(Visit, TIntermBinary*)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
     return true;
 }
 
 bool TVersionGLSL::visitUnary(Visit, TIntermUnary*)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
     return true;
 }
 
 bool TVersionGLSL::visitSelection(Visit, TIntermSelection*)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
     return true;
 }
 
 bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
 {
-    // We need to scan the entire fragment shader but only the global scope
-    // of vertex shader.
-    bool visitChildren = mShaderType == SH_FRAGMENT_SHADER ? true : false;
+    bool visitChildren = true;
 
     switch (node->getOp()) {
       case EOpSequence:
@@ -83,6 +79,19 @@ bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
         }
         break;
       }
+      case EOpConstructMat2:
+      case EOpConstructMat3:
+      case EOpConstructMat4: {
+        const TIntermSequence& sequence = node->getSequence();
+        if (sequence.size() == 1) {
+          TIntermTyped* typed = sequence.front()->getAsTyped();
+          if (typed && typed->isMatrix()) {
+            updateVersion(GLSL_VERSION_120);
+          }
+        }
+        break;
+      }
+
       default: break;
     }
 
@@ -91,13 +100,11 @@ bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
 
 bool TVersionGLSL::visitLoop(Visit, TIntermLoop*)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
     return true;
 }
 
 bool TVersionGLSL::visitBranch(Visit, TIntermBranch*)
 {
-    ASSERT(mShaderType == SH_FRAGMENT_SHADER);
     return true;
 }
 
index 64d002b..376fcb8 100644 (file)
 //   - invariant keyword and its support.
 //   - c++ style name hiding rules.
 //   - built-in variable gl_PointCoord for fragment shaders.
+//   - matrix constructors taking matrix as argument.
 //
 class TVersionGLSL : public TIntermTraverser {
 public:
     TVersionGLSL(ShShaderType type);
 
-    // Returns 120 if "invariant" keyword or "gl_PointCoord" is used
-    // in the shader. Else 110 is returned.
+    // Returns 120 if "invariant" keyword, "gl_PointCoord", or
+    // matrix/matrix constructors are used in the shader. Else 110 is
+    // returned.
     int getVersion() { return mVersion; }
 
     virtual void visitSymbol(TIntermSymbol*);
index 5eae4b5..d05f441 100644 (file)
@@ -591,17 +591,10 @@ function_call_header
 // Grammar Note:  Constructors look like functions, but are recognized as types.
 
 function_identifier
-    : type_specifier {
+    : type_specifier_nonarray {
         //
         // Constructor
         //
-        if ($1.array) {
-            // Constructors for arrays are not allowed.
-            context->error($1.line, "cannot construct this type", "array", "");
-            context->recover();
-            $1.setArray(false);
-        }
-
         TOperator op = EOpNull;
         if ($1.userDef) {
             op = EOpConstructStruct;
@@ -1176,16 +1169,10 @@ parameter_type_specifier
 init_declarator_list
     : single_declaration {
         $$ = $1;
-        
-        if ($$.type.precision == EbpUndefined) {
-            $$.type.precision = context->symbolTable.getDefaultPrecision($1.type.type);
-            if (context->precisionErrorCheck($1.line, $$.type.precision, $1.type.type)) {
-                context->recover();
-            }
-        }
     }
     | init_declarator_list COMMA IDENTIFIER {
-        $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line), $3.line);
+        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line);
+        $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, symbol, $3.line);
         
         if (context->structQualifierErrorCheck($3.line, $$.type))
             context->recover();
@@ -1193,8 +1180,11 @@ init_declarator_list
         if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type))
             context->recover();
 
-        if (context->nonInitErrorCheck($3.line, *$3.string, $$.type))
+        TVariable* variable = 0;
+        if (context->nonInitErrorCheck($3.line, *$3.string, $$.type, variable))
             context->recover();
+        if (symbol && variable)
+            symbol->setId(variable->getUniqueId());
     }
     | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
         if (context->structQualifierErrorCheck($3.line, $1.type))
@@ -1230,12 +1220,12 @@ init_declarator_list
             if (context->arraySizeErrorCheck($4.line, $5, size))
                 context->recover();
             $1.type.setArray(true, size);
-            TVariable* variable;
+            TVariable* variable = 0;
             if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
                 context->recover();
             TType type = TType($1.type);
             type.setArraySize(size);
-            $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, type, $3.line), $3.line);
+            $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *$3.string, type, $3.line), $3.line);
         }
     }
     | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
@@ -1266,7 +1256,8 @@ single_declaration
         $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType($1), $1.line), $1.line);
     }
     | fully_specified_type IDENTIFIER {
-        $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line);
+        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line);
+        $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line);
         
         if (context->structQualifierErrorCheck($2.line, $$.type))
             context->recover();
@@ -1276,28 +1267,19 @@ single_declaration
             
             $$.type = $1;
 
-        if (context->nonInitErrorCheck($2.line, *$2.string, $$.type))
+        TVariable* variable = 0;
+        if (context->nonInitErrorCheck($2.line, *$2.string, $$.type, variable))
             context->recover();
+        if (variable && symbol)
+            symbol->setId(variable->getUniqueId());
     }
     | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
-        $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line);
-        
-        if (context->structQualifierErrorCheck($2.line, $1))
-            context->recover();
-
-        if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
-            context->recover();
+        context->error($2.line, "unsized array declarations not supported", $2.string->c_str(), "");
+        context->recover();
 
+        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line);
+        $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line);
         $$.type = $1;
-
-        if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifierErrorCheck($3.line, $1))
-            context->recover();
-        else {
-            $1.setArray(true);
-            TVariable* variable;
-            if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
-                context->recover();
-        }
     }
     | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
         TType type = TType($1);
@@ -1305,7 +1287,8 @@ single_declaration
         if (context->arraySizeErrorCheck($2.line, $4, size))
             context->recover();
         type.setArraySize(size);
-        $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, type, $2.line), $2.line);
+        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, type, $2.line);
+        $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line);
         
         if (context->structQualifierErrorCheck($2.line, $1))
             context->recover();
@@ -1323,9 +1306,11 @@ single_declaration
                 context->recover();
 
             $1.setArray(true, size);
-            TVariable* variable;
+            TVariable* variable = 0;
             if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
                 context->recover();
+            if (variable && symbol)
+                symbol->setId(variable->getUniqueId());
         }
     }
     | fully_specified_type IDENTIFIER EQUAL initializer {
@@ -1491,6 +1476,13 @@ type_qualifier
 type_specifier
     : type_specifier_no_prec {
         $$ = $1;
+
+        if ($$.precision == EbpUndefined) {
+            $$.precision = context->symbolTable.getDefaultPrecision($1.type);
+            if (context->precisionErrorCheck($1.line, $$.precision, $1.type)) {
+                context->recover();
+            }
+        }
     }
     | precision_qualifier type_specifier_no_prec {
         $$ = $2;
@@ -1694,6 +1686,7 @@ struct_declaration
             type->setBasicType($1.type);
             type->setNominalSize($1.size);
             type->setMatrix($1.matrix);
+            type->setPrecision($1.precision);
 
             // don't allow arrays of arrays
             if (type->isArray()) {
@@ -1770,8 +1763,10 @@ simple_statement
 compound_statement
     : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
     | LEFT_BRACE { context->symbolTable.push(); } statement_list { context->symbolTable.pop(); } RIGHT_BRACE {
-        if ($3 != 0)
+        if ($3 != 0) {
             $3->setOp(EOpSequence);
+            $3->setEndLine($5.line);
+        }
         $$ = $3;
     }
     ;
@@ -1787,8 +1782,10 @@ compound_statement_no_new_scope
         $$ = 0;
     }
     | LEFT_BRACE statement_list RIGHT_BRACE {
-        if ($2)
+        if ($2) {
             $2->setOp(EOpSequence);
+            $2->setEndLine($3.line);
+        }
         $$ = $2;
     }
     ;
@@ -2061,6 +2058,9 @@ function_definition
         $$->getAsAggregate()->setOptimize(context->contextPragma.optimize);
         $$->getAsAggregate()->setDebug(context->contextPragma.debug);
         $$->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
+
+        if ($3 && $3->getAsAggregate())
+            $$->getAsAggregate()->setEndLine($3->getAsAggregate()->getEndLine());
     }
     ;
 
index d00c7a3..47ca2ee 100644 (file)
@@ -325,7 +325,7 @@ typedef union YYSTYPE
         };
     } interm;
 }
-/* Line 187 of yacc.c.  */
+/* Line 193 of yacc.c.  */
 
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -415,7 +415,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -580,7 +580,7 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  69
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   1334
+#define YYLAST   1362
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  94
@@ -674,7 +674,7 @@ static const yytype_int16 yyrhs[] =
       97,    51,    -1,    97,    52,    -1,   122,    -1,   100,    -1,
      101,    -1,    97,    76,   101,    -1,   103,    71,    -1,   102,
       71,    -1,   104,    39,    -1,   104,    -1,   104,   120,    -1,
-     103,    77,   120,    -1,   105,    70,    -1,   137,    -1,    43,
+     103,    77,   120,    -1,   105,    70,    -1,   140,    -1,    43,
       -1,    48,    -1,    97,    -1,    51,   106,    -1,    52,   106,
       -1,   107,   106,    -1,    84,    -1,    82,    -1,    81,    -1,
      106,    -1,   108,    85,   106,    -1,   108,    86,   106,    -1,
@@ -731,24 +731,24 @@ static const yytype_uint16 yyrline[] =
 {
        0,   153,   153,   188,   191,   204,   209,   214,   220,   223,
      296,   299,   408,   418,   431,   439,   538,   541,   549,   553,
-     560,   564,   571,   577,   586,   594,   656,   663,   673,   676,
-     686,   696,   717,   718,   719,   724,   725,   734,   746,   747,
-     755,   766,   770,   771,   781,   791,   801,   814,   815,   825,
-     838,   842,   846,   850,   851,   864,   865,   878,   879,   892,
-     893,   910,   911,   924,   925,   926,   927,   928,   932,   935,
-     946,   954,   979,   984,   991,  1027,  1030,  1037,  1045,  1066,
-    1085,  1096,  1125,  1130,  1140,  1145,  1155,  1158,  1161,  1164,
-    1170,  1177,  1187,  1199,  1217,  1241,  1264,  1268,  1282,  1302,
-    1331,  1351,  1427,  1436,  1459,  1462,  1468,  1476,  1484,  1492,
-    1495,  1502,  1505,  1508,  1514,  1517,  1532,  1536,  1540,  1544,
-    1553,  1558,  1563,  1568,  1573,  1578,  1583,  1588,  1593,  1598,
-    1604,  1610,  1616,  1621,  1626,  1631,  1644,  1657,  1665,  1668,
-    1683,  1714,  1718,  1724,  1732,  1748,  1752,  1756,  1757,  1763,
-    1764,  1765,  1766,  1767,  1771,  1772,  1772,  1772,  1780,  1781,
-    1786,  1789,  1797,  1800,  1806,  1807,  1811,  1819,  1823,  1833,
-    1838,  1855,  1855,  1860,  1860,  1867,  1867,  1875,  1878,  1884,
-    1887,  1893,  1897,  1904,  1911,  1918,  1925,  1936,  1945,  1949,
-    1956,  1959,  1965,  1965
+     560,   564,   571,   577,   586,   594,   649,   656,   666,   669,
+     679,   689,   710,   711,   712,   717,   718,   727,   739,   740,
+     748,   759,   763,   764,   774,   784,   794,   807,   808,   818,
+     831,   835,   839,   843,   844,   857,   858,   871,   872,   885,
+     886,   903,   904,   917,   918,   919,   920,   921,   925,   928,
+     939,   947,   972,   977,   984,  1020,  1023,  1030,  1038,  1059,
+    1078,  1089,  1118,  1123,  1133,  1138,  1148,  1151,  1154,  1157,
+    1163,  1170,  1173,  1189,  1207,  1231,  1254,  1258,  1276,  1284,
+    1316,  1336,  1412,  1421,  1444,  1447,  1453,  1461,  1469,  1477,
+    1487,  1494,  1497,  1500,  1506,  1509,  1524,  1528,  1532,  1536,
+    1545,  1550,  1555,  1560,  1565,  1570,  1575,  1580,  1585,  1590,
+    1596,  1602,  1608,  1613,  1618,  1623,  1636,  1649,  1657,  1660,
+    1675,  1707,  1711,  1717,  1725,  1741,  1745,  1749,  1750,  1756,
+    1757,  1758,  1759,  1760,  1764,  1765,  1765,  1765,  1775,  1776,
+    1781,  1784,  1794,  1797,  1803,  1804,  1808,  1816,  1820,  1830,
+    1835,  1852,  1852,  1857,  1857,  1864,  1864,  1872,  1875,  1881,
+    1884,  1890,  1894,  1901,  1908,  1915,  1922,  1933,  1942,  1946,
+    1953,  1956,  1962,  1962
 };
 #endif
 
@@ -892,10 +892,10 @@ static const yytype_uint8 yydefact[] =
       38,    41,    42,    47,    50,    51,    52,    53,    55,    57,
       59,    70,     0,    25,    73,     0,   143,     0,   141,   137,
      139,     0,     0,   173,     0,     0,     0,     0,     0,   155,
-     160,   164,    35,    61,    68,     0,   146,     0,   102,   149,
+     160,   164,    35,    61,    68,     0,   146,     0,   114,   149,
      162,   148,   147,     0,   150,   151,   152,   153,    80,    82,
       84,     0,     0,    98,     0,   145,   100,    29,    30,     0,
-      12,    13,     0,     0,    19,    18,     0,   116,    22,    24,
+      12,    13,     0,     0,    19,    18,     0,    20,    22,    24,
       31,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,   115,   136,     0,     0,   140,
      184,   183,     0,   175,     0,   187,   185,     0,   171,   154,
@@ -917,7 +917,7 @@ static const yytype_int16 yydefgoto[] =
      106,   107,   142,   109,   110,   111,   112,   113,   114,   115,
      116,   117,   118,   119,   120,   143,   144,   216,   145,   122,
      146,   147,    32,    33,    34,    79,    60,    61,    80,    35,
-      36,    37,    38,   123,    40,    41,    42,    43,    74,    75,
+      36,    37,    38,    39,    40,    41,   123,    43,    74,    75,
      127,   128,   166,   149,   150,   151,   152,   210,   270,   288,
      289,   153,   154,   155,   278,   269,   156,   253,   202,   250,
      265,   275,   276,   157,    44,    45,    46,    53
@@ -928,86 +928,86 @@ static const yytype_int16 yydefgoto[] =
 #define YYPACT_NINF -250
 static const yytype_int16 yypact[] =
 {
-    1225,    36,  -250,  -250,  -250,   150,  -250,  -250,  -250,  -250,
+    1218,   -13,  -250,  -250,  -250,   137,  -250,  -250,  -250,  -250,
     -250,  -250,  -250,  -250,  -250,  -250,  -250,  -250,  -250,  -250,
-    -250,  -250,  -250,  -250,  -250,   -33,  -250,  -250,  -250,  -250,
-    -250,   -60,   -22,   -17,    21,   -62,  -250,    22,  1266,  -250,
-    1290,  -250,    11,  -250,  1138,  -250,  -250,  -250,  -250,  1290,
-      14,  1266,  -250,    27,  -250,    34,    41,  -250,  -250,  -250,
-    -250,  1266,   129,    61,  -250,    17,  -250,  -250,   908,  -250,
-    -250,    31,  1266,    72,  1042,  -250,   283,  -250,  -250,  -250,
-    -250,    90,  1266,   -46,  -250,   194,   908,    65,  -250,  -250,
-    -250,  -250,   908,   908,   908,  -250,  -250,  -250,  -250,  -250,
-     -40,  -250,  -250,  -250,    80,   -25,   975,    87,  -250,   908,
-      35,    13,  -250,   -26,    68,  -250,  -250,  -250,   110,   109,
-     -54,  -250,    96,  -250,  -250,  1083,    98,    33,  -250,  -250,
-    -250,    91,    92,  -250,   104,   107,    99,   760,   108,   105,
-    -250,  -250,    24,  -250,  -250,    37,  -250,   -60,   112,  -250,
-    -250,  -250,  -250,   365,  -250,  -250,  -250,  -250,   111,  -250,
-    -250,   827,   908,  -250,   113,  -250,  -250,  -250,  -250,     4,
-    -250,  -250,   908,  1179,  -250,  -250,   908,   114,  -250,  -250,
-    -250,   908,   908,   908,   908,   908,   908,   908,   908,   908,
-     908,   908,   908,   908,   908,  -250,  -250,   908,    72,  -250,
-    -250,  -250,   447,  -250,   908,  -250,  -250,    42,  -250,  -250,
-     447,  -250,  -250,  -250,  -250,  -250,   908,   908,  -250,  -250,
-    -250,   908,  -250,   115,  -250,  -250,  -250,   116,   117,  -250,
-     120,  -250,  -250,  -250,  -250,    35,    35,  -250,  -250,  -250,
-    -250,   -26,   -26,  -250,   110,   109,    51,   119,  -250,   144,
-     611,    23,  -250,   693,   447,  -250,  -250,   122,  -250,  -250,
-     908,  -250,   123,  -250,  -250,   693,   447,   117,   153,   126,
-     128,  -250,  -250,   908,  -250,   127,   137,   171,  -250,   130,
-     529,  -250,    28,   908,   529,   447,   908,  -250,  -250,  -250,
-     131,   117,  -250,  -250,  -250,  -250
+    -250,  -250,  -250,  -250,  -250,   -28,  -250,  -250,  -250,  -250,
+    -250,   -55,   -38,    -4,    33,   -20,  -250,    44,  1259,  -250,
+    1318,  -250,    18,  -250,  1176,  -250,  -250,  -250,  -250,  1318,
+     -22,  1259,  -250,    29,  -250,    85,    73,  -250,  -250,  -250,
+    -250,  1259,   113,    70,  -250,    13,  -250,  -250,   949,  -250,
+    -250,    49,  1259,    90,  1080,  -250,   283,  -250,  -250,  -250,
+    -250,   101,  1259,   -56,  -250,   757,   949,    80,  -250,  -250,
+    -250,  -250,   949,   949,   949,  -250,  -250,  -250,  -250,  -250,
+     -33,  -250,  -250,  -250,    81,   -15,  1013,    92,  -250,   949,
+      52,   -75,  -250,   -25,    40,  -250,  -250,  -250,   106,   105,
+     -46,  -250,    93,  -250,  -250,  1121,    95,     9,  -250,  -250,
+    -250,    88,    89,  -250,   100,   102,    91,   821,   104,   103,
+    -250,  -250,    66,  -250,  -250,    20,  -250,   -55,    79,  -250,
+    -250,  -250,  -250,   365,  -250,  -250,  -250,  -250,   107,  -250,
+    -250,   885,   949,  -250,   109,  -250,  -250,  -250,  -250,    -6,
+    -250,  -250,   949,  1283,  -250,  -250,   949,   110,  -250,  -250,
+    -250,   949,   949,   949,   949,   949,   949,   949,   949,   949,
+     949,   949,   949,   949,   949,  -250,  -250,   949,    90,  -250,
+    -250,  -250,   447,  -250,   949,  -250,  -250,    34,  -250,  -250,
+     447,  -250,  -250,  -250,  -250,  -250,   949,   949,  -250,  -250,
+    -250,   949,  -250,   111,  -250,  -250,  -250,   112,    99,  -250,
+     116,  -250,  -250,  -250,  -250,    52,    52,  -250,  -250,  -250,
+    -250,   -25,   -25,  -250,   106,   105,    77,   114,  -250,   125,
+     611,     4,  -250,   693,   447,  -250,  -250,   115,  -250,  -250,
+     949,  -250,   119,  -250,  -250,   693,   447,    99,   134,   122,
+     108,  -250,  -250,   949,  -250,   117,   123,   174,  -250,   120,
+     529,  -250,     7,   949,   529,   447,   949,  -250,  -250,  -250,
+     118,    99,  -250,  -250,  -250,  -250
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -250,  -250,  -250,  -250,  -250,  -250,  -250,    39,  -250,  -250,
-    -250,  -250,   -45,  -250,   -18,  -250,   -79,   -30,  -250,  -250,
-    -250,    38,    52,    20,  -250,   -63,   -85,  -250,   -92,   -71,
-       6,     9,  -250,  -250,  -250,   132,   172,   166,   148,  -250,
-    -250,  -246,   -21,     0,   226,   -24,  -250,  -250,   162,   -66,
-    -250,    45,  -159,    -3,  -136,  -249,  -250,  -250,  -250,   -36,
-     196,    46,     1,  -250,  -250,   -13,  -250,  -250,  -250,  -250,
-    -250,  -250,  -250,  -250,  -250,   211,  -250,  -250
+    -250,  -250,  -250,  -250,  -250,  -250,  -250,    22,  -250,  -250,
+    -250,  -250,    31,  -250,   -27,  -250,   -79,   -30,  -250,  -250,
+    -250,     5,     8,    12,  -250,   -63,   -85,  -250,   -92,   -82,
+      10,    11,  -250,  -250,  -250,   121,   149,   144,   126,  -250,
+    -250,  -233,   -21,   -24,   202,   -23,     0,  -250,   139,   -66,
+    -250,    27,  -156,   -41,  -149,  -249,  -250,  -250,  -250,   -58,
+     176,    17,   -19,  -250,  -250,   -35,  -250,  -250,  -250,  -250,
+    -250,  -250,  -250,  -250,  -250,   188,  -250,  -250
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -76
+#define YYTABLE_NINF -117
 static const yytype_int16 yytable[] =
 {
-      39,   165,   169,   224,   193,   121,    30,   268,   130,    31,
-      50,   170,   171,    62,   164,    63,    67,   220,    64,   268,
-      52,   178,   121,   108,    56,    71,   161,   185,   186,     6,
-       7,   287,   172,   162,    62,   287,   173,    56,    66,   194,
-     108,    51,     6,     7,    39,   207,   175,   167,   168,    54,
-      30,    73,   176,    31,    57,    58,    59,    23,    24,   130,
-      55,    81,   187,   188,   180,    65,   249,    57,    58,    59,
-      23,    24,    73,    47,    73,   226,   148,   165,    47,    48,
-     228,   217,    81,    68,   211,   212,   213,    84,    72,    85,
-     223,   232,   -75,   214,   266,   183,    86,   184,   121,   290,
-     217,    76,   246,   215,    83,   217,   237,   238,   239,   240,
-     198,   124,   251,   199,   217,   126,   108,   218,   220,   217,
-     181,   182,   252,   189,   190,    73,   247,   294,   217,   260,
-     277,   255,   256,   158,   121,   -26,   233,   234,   108,   108,
-     108,   108,   108,   108,   108,   108,   108,   108,   108,   293,
-     257,   174,   108,   148,     2,     3,     4,   179,   121,   241,
-     242,   267,    57,    58,    59,   235,   236,   191,   192,   195,
-     197,   200,   201,   267,   203,   272,   108,   204,   208,   205,
-     209,   282,   -25,   221,   262,   -20,   225,   285,   258,   259,
-     -27,   291,   261,   273,   217,   271,   279,   280,     2,     3,
-       4,   165,   148,   281,     8,     9,    10,   283,   284,   286,
-     148,   295,   231,   245,   159,    11,    12,    13,    14,    15,
-      16,    17,    18,    19,    20,    21,    22,    78,    82,   243,
-     160,    49,    25,    26,   125,    27,    28,    87,    29,    88,
-      89,    90,    91,   248,   244,    92,    93,   263,   292,    77,
-     148,   264,   274,   148,   148,    70,   254,     0,     0,     0,
-       0,     0,     0,     0,    94,   148,   148,   163,     0,     0,
-       0,     0,     0,     0,     0,    95,    96,     0,    97,     0,
+      42,   165,   169,   164,   220,   121,   224,   183,   130,   184,
+      30,    31,   193,    62,    66,    50,   161,    67,   170,   171,
+     268,   178,   121,   162,    47,    52,    71,    73,   185,   186,
+      48,   287,   268,    54,    62,   287,    56,    81,    42,   172,
+      42,     6,     7,   173,    42,   207,    51,   194,    73,    42,
+      73,    42,    72,   249,    30,    31,   175,    63,    81,   130,
+      64,    42,   176,   187,   188,   226,    57,    58,    59,    23,
+      24,   217,    42,    55,    42,   266,   148,   165,   290,   223,
+     228,   217,    42,    84,   217,    85,   198,    65,    56,   199,
+      68,   232,    86,     6,     7,   189,   190,   217,   121,   108,
+     218,    73,   246,    76,   -75,   220,   237,   238,   239,   240,
+      47,   217,   251,    83,   252,   247,   108,   277,    57,    58,
+      59,    23,    24,   167,   168,    42,   211,   212,   213,   124,
+     294,   255,   256,   126,   121,   214,   293,   181,   182,   257,
+     180,     2,     3,     4,   158,   215,    57,    58,    59,   -25,
+     -26,    68,   174,   148,   217,   260,   235,   236,   121,   241,
+     242,   267,   179,   191,   192,   262,   195,   197,   200,   201,
+     203,   205,   204,   267,   208,   272,   217,   279,   209,   221,
+    -116,   282,   225,   281,   258,   259,   -27,   261,   271,   273,
+     285,   291,   108,   280,   284,   231,   243,   283,   295,   286,
+     244,   165,   148,   159,    78,   245,    82,    49,   160,   263,
+     148,   125,   233,   234,   108,   108,   108,   108,   108,   108,
+     108,   108,   108,   108,   108,   248,   292,   254,   108,    77,
+     274,   264,    70,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     148,     0,   108,   148,   148,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   148,   148,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      148,     0,     0,     0,   148,   148,     1,     2,     3,     4,
        5,     6,     7,     8,     9,    10,   131,   132,   133,     0,
      134,   135,   136,   137,    11,    12,    13,    14,    15,    16,
@@ -1056,96 +1056,99 @@ static const yytype_int16 yytable[] =
       24,    25,    26,     0,    27,    28,    87,    29,    88,    89,
       90,    91,     0,     0,    92,    93,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    94,     2,     3,     4,     0,     0,     0,
-       8,     9,    10,     0,    95,    96,     0,    97,     0,     0,
-       0,    11,    12,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,    22,     0,     0,     0,     0,     0,    25,    26,
-       0,    27,    28,    87,    29,    88,    89,    90,    91,     0,
-       0,    92,    93,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      94,     2,     3,     4,     0,     0,     0,     8,     9,    10,
-     206,    95,    96,     0,    97,     0,     0,     0,    11,    12,
+       0,     0,     0,    94,     0,     0,     0,     8,     9,    10,
+       0,     0,     0,     0,    95,    96,     0,    97,    11,    12,
       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
        0,     0,     0,     0,     0,    25,    26,     0,    27,    28,
       87,    29,    88,    89,    90,    91,     0,     0,    92,    93,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,    94,     0,     0,
-     222,     0,     0,     0,     0,     0,     0,     0,    95,    96,
-       0,    97,     2,     3,     4,     0,     0,     0,     8,     9,
-      10,     0,     0,     0,     0,     0,     0,     0,     0,    11,
-      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
-      22,     0,     0,     0,     0,     0,    25,    26,     0,    27,
-      28,    87,    29,    88,    89,    90,    91,     0,     0,    92,
-      93,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    94,     2,
-       3,     4,     0,     0,     0,     8,     9,    10,     0,    95,
-      96,     0,    97,     0,     0,     0,    11,    12,    13,    14,
+     163,