Changeset 112300 in webkit


Ignore:
Timestamp:
Mar 27, 2012 12:19:18 PM (12 years ago)
Author:
dino@apple.com
Message:

Update ANGLE in WebKit https://bugs.webkit.org/show_bug.cgi?id=81717

Reviewed by Kenneth Russell.

Update angleproject to r1009. Synced the source directory
between the angle repository and WebKit. Ran the OS X Lion
version of Bison over the glslang.l input which generates
a slightly different output than angle provided.

Converted tabs to spaces in preprocessor/new files.

  • include/EGL/eglext.h:
  • include/GLES2/gl2ext.h:
  • include/GLSLANG/ShaderLang.h:
  • src/common/RefCountObject.cpp: Renamed from Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.cpp.

(RefCountObject::RefCountObject):
(RefCountObject::~RefCountObject):
(RefCountObject::addRef):
(RefCountObject::release):
(RefCountObjectBindingPointer::set):

  • src/common/RefCountObject.h: Renamed from Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.h.

(RefCountObject):
(RefCountObject::id):
(RefCountObjectBindingPointer):
(RefCountObjectBindingPointer::RefCountObjectBindingPointer):
(RefCountObjectBindingPointer::~RefCountObjectBindingPointer):
(RefCountObjectBindingPointer::get):
(RefCountObjectBindingPointer::id):
(RefCountObjectBindingPointer::operator ! ):
(BindingPointer):
(BindingPointer::set):
(BindingPointer::get):
(BindingPointer::operator -> ):

  • src/common/debug.cpp:

(gl::output):

  • src/common/version.h:
  • src/compiler/BaseTypes.h:
  • src/compiler/Compiler.cpp:

(TCompiler::TCompiler):
(TCompiler::~TCompiler):
(TCompiler::mapLongVariableNames):

  • src/compiler/ConstantUnion.h:

(ConstantUnion::ConstantUnion):
(ConstantUnion::operator==):
(ConstantUnion::operator>):
(ConstantUnion::operator<):

  • src/compiler/Intermediate.cpp:

(TIntermConstantUnion::fold):

  • src/compiler/MapLongVariableNames.cpp:

(LongNameMap::LongNameMap):
(LongNameMap::~LongNameMap):
(LongNameMap::GetInstance):
(LongNameMap::Release):
(LongNameMap::Find):
(LongNameMap::Insert):
(LongNameMap::Size):
(MapLongVariableNames::MapLongVariableNames):
(MapLongVariableNames::visitSymbol):
(MapLongVariableNames::mapGlobalLongName):

  • src/compiler/MapLongVariableNames.h:

(LongNameMap):
(MapLongVariableNames):

  • src/compiler/OutputHLSL.cpp:

(sh::OutputHLSL::OutputHLSL):
(sh::OutputHLSL::header):
(sh::OutputHLSL::visitSymbol):
(sh::OutputHLSL::visitUnary):
(sh::OutputHLSL::visitAggregate):
(sh::OutputHLSL::visitLoop):
(sh::OutputHLSL::handleExcessiveLoop):
(sh::OutputHLSL::typeString):
(sh::OutputHLSL::addConstructor):
(sh::OutputHLSL::decorateUniform):

  • src/compiler/OutputHLSL.h:

(OutputHLSL):

  • src/compiler/PoolAlloc.cpp:

(TAllocation::checkGuardBlock):

  • src/compiler/ShHandle.h:

(TCompiler):

  • src/compiler/SymbolTable.cpp:
  • src/compiler/SymbolTable.h:

(TSymbolTable):
(TSymbolTable::getOuterLevel):

  • src/compiler/VariableInfo.cpp:

(getVariableDataType):

  • src/compiler/glslang.l:
  • src/compiler/glslang.y:
  • src/compiler/glslang_lex.cpp:

(yy_buffer_state):
(yyguts_t):
(input):
(yyensure_buffer_stack):
(yy_scan_bytes):
(yyget_leng):

  • src/compiler/glslang_tab.cpp:
  • src/compiler/osinclude.h:
  • src/compiler/preprocessor/cpp.c:
  • src/compiler/preprocessor/memory.c:
  • src/compiler/preprocessor/new/Context.cpp: Added.

(isMacroNameReserved):
(pp):
(pp::Context::Context):
(pp::Context::~Context):
(pp::Context::init):
(pp::Context::process):
(pp::Context::defineMacro):
(pp::Context::undefineMacro):
(pp::Context::isMacroDefined):
(pp::Context::reset):
(pp::Context::defineBuiltInMacro):

  • src/compiler/preprocessor/new/Context.h: Added.

(pp):
(Context):
(pp::Context::lexer):
(pp::Context::output):

  • src/compiler/preprocessor/new/Input.cpp: Added.

(pp):
(pp::Input::Input):
(pp::Input::eof):
(pp::Input::read):
(pp::Input::getChar):
(pp::Input::peekChar):
(pp::Input::switchToNextString):
(pp::Input::isStringEmpty):
(pp::Input::stringLength):

  • src/compiler/preprocessor/new/Input.h: Added.

(pp):
(Input):
(pp::Input::error):
(pp::Input::stringIndex):

  • src/compiler/preprocessor/new/Macro.cpp: Added.

(pp):
(pp::Macro::Macro):
(pp::Macro::~Macro):

  • src/compiler/preprocessor/new/Macro.h: Added.

(pp):
(Macro):
(pp::Macro::type):
(pp::Macro::identifier):
(pp::Macro::parameters):
(pp::Macro::replacements):

  • src/compiler/preprocessor/new/Preprocessor.cpp: Added.

(pp):
(pp::Preprocessor::Preprocessor):
(pp::Preprocessor::~Preprocessor):
(pp::Preprocessor::init):
(pp::Preprocessor::process):
(pp::Preprocessor::reset):

  • src/compiler/preprocessor/new/Preprocessor.h: Added.

(pp):
(Preprocessor):
(pp::Preprocessor::begin):
(pp::Preprocessor::end):

  • src/compiler/preprocessor/new/Token.cpp: Added.

(pp):
(pp::Token::encodeLocation):
(pp::Token::decodeLocation):
(pp::Token::Token):
(pp::Token::~Token):
(pp::operator<<):

  • src/compiler/preprocessor/new/Token.h: Added.

(pp):
(Token):
(pp::Token::location):
(pp::Token::type):
(pp::Token::value):

  • src/compiler/preprocessor/new/generate_parser.sh: Added.
  • src/compiler/preprocessor/new/pp.l: Added.
  • src/compiler/preprocessor/new/pp.y: Added.
  • src/compiler/preprocessor/new/pp_lex.cpp: Added.

(yy_buffer_state):
(yy_trans_info):
(yyguts_t):
(yy_get_previous_state):
(yy_try_NUL_trans):
(input):
(pprestart):
(pp_switch_to_buffer):
(pp_load_buffer_state):
(pp_create_buffer):
(pp_delete_buffer):
(pp_init_buffer):
(pp_flush_buffer):
(pppush_buffer_state):
(pppop_buffer_state):
(ppensure_buffer_stack):
(pp_scan_buffer):
(pp_scan_string):
(pp_scan_bytes):
(yy_push_state):
(yy_pop_state):
(yy_top_state):
(yy_fatal_error):
(ppget_extra):
(ppget_lineno):
(ppget_column):
(ppget_in):
(ppget_out):
(ppget_leng):
(ppget_text):
(ppset_extra):
(ppset_lineno):
(ppset_column):
(ppset_in):
(ppset_out):
(ppget_debug):
(ppset_debug):
(ppget_lval):
(ppset_lval):
(ppget_lloc):
(ppset_lloc):
(pplex_init):
(pplex_init_extra):
(yy_init_globals):
(pplex_destroy):
(yy_flex_strncpy):
(yy_flex_strlen):
(ppalloc):
(pprealloc):
(ppfree):
(extractMacroName):
(pp):
(pp::Context::readInput):
(pp::Context::initLexer):
(pp::Context::destroyLexer):

  • src/compiler/preprocessor/new/pp_tab.cpp: Added.

(YYLTYPE):
(yysyntax_error):
(yyerror):
(pushConditionalBlock):
(popConditionalBlock):
(pp::Context::parse):

  • src/compiler/preprocessor/new/pp_tab.h: Added.

(YYLTYPE):

  • src/compiler/preprocessor/new/stl_utils.h: Added.

(pp):
(Delete):
(pp::Delete::operator()):
(DeleteSecond):
(pp::DeleteSecond::operator()):

  • src/compiler/preprocessor/new/token_type.h: Added.
  • src/compiler/preprocessor/scanner.c:

(yylex_CPP):

  • src/compiler/preprocessor/symbols.c:
  • src/compiler/preprocessor/tokens.c:
  • src/libEGL/Config.cpp:

(egl::ConfigSet::getConfigs):

  • src/libEGL/Display.cpp:

(egl::Display::initialize):
(egl::Display::terminate):
(egl::Display::restoreLostDevice):
(egl::Display::sync):
(egl):
(egl::Display::allocateEventQuery):
(egl::Display::freeEventQuery):
(egl::Display::getFloat32TextureSupport):
(egl::Display::getFloat16TextureSupport):
(egl::Display::getEventQuerySupport):
(egl::Display::initExtensionString):
(egl::Display::shareHandleSupported):
(egl::Display::getOcclusionQuerySupport):
(egl::Display::getInstancingSupport):

  • src/libEGL/Display.h:

(Display):
(egl::Display::isD3d9ExDevice):

  • src/libEGL/Surface.cpp:

(egl::Surface::resetSwapChain):

  • src/libEGL/libEGL.cpp:
  • src/libEGL/libEGL.vcproj:
  • src/libGLESv2/Blit.cpp:

(gl::Blit::setCommonBlitState):

  • src/libGLESv2/Buffer.h:

(Buffer):

  • src/libGLESv2/Context.cpp:

(gl::Context::Context):
(gl::Context::~Context):
(gl::Context::makeCurrent):
(gl::Context::getActiveQuery):
(gl):
(gl::Context::createFence):
(gl::Context::createQuery):
(gl::Context::deleteQuery):
(gl::Context::beginQuery):
(gl::Context::endQuery):
(gl::Context::getQuery):
(gl::Context::applyVertexBuffer):
(gl::Context::applyIndexBuffer):
(gl::Context::readPixels):
(gl::Context::clear):
(gl::Context::drawArrays):
(gl::Context::drawElements):
(gl::Context::sync):
(gl::Context::drawLineLoop):
(gl::Context::supportsOcclusionQueries):
(gl::Context::supportsInstancing):
(gl::Context::setVertexAttribDivisor):
(gl::Context::initExtensionString):
(gl::VertexDeclarationCache::applyDeclaration):
(gl::VertexDeclarationCache::markStateDirty):

  • src/libGLESv2/Context.h:

(gl):
(gl::VertexAttribute::VertexAttribute):
(State):
(VertexDeclarationCache):
(Context):

  • src/libGLESv2/Fence.cpp:

(gl::Fence::Fence):
(gl::Fence::~Fence):
(gl::Fence::setFence):

  • src/libGLESv2/Fence.h:

(egl):
(Fence):

  • src/libGLESv2/Framebuffer.cpp:

(gl::Framebuffer::lookupRenderbuffer):
(gl::Framebuffer::detachTexture):
(gl::Framebuffer::completeness):

  • src/libGLESv2/Framebuffer.h:
  • src/libGLESv2/IndexDataManager.cpp:

(gl::IndexDataManager::IndexDataManager):
(gl::IndexDataManager::~IndexDataManager):
(gl::computeRange):
(gl::IndexDataManager::prepareIndexData):
(gl::IndexDataManager::getCountingIndices):
(gl):

  • src/libGLESv2/IndexDataManager.h:

(IndexDataManager):

  • src/libGLESv2/Program.cpp:

(gl::Program::getUniformLocation):
(gl::Program::setUniform1fv):
(gl::Program::setUniform2fv):
(gl::Program::setUniform3fv):
(gl::Program::setUniform4fv):
(gl::Program::setUniform1iv):
(gl::Program::setUniform2iv):
(gl::Program::setUniform3iv):
(gl::Program::setUniform4iv):
(gl::Program::packVaryings):
(gl::Program::linkVaryings):
(gl::Program::defineUniform):
(gl::Program::createUniform):
(gl::Program::applyUniformnbv):
(gl::Program::applyUniform1iv):
(gl::Program::applyUniform2iv):
(gl::Program::applyUniform3iv):
(gl::Program::applyUniform4iv):
(gl::Program::getInfoLog):

  • src/libGLESv2/Program.h:

(Program):

  • src/libGLESv2/Query.cpp: Added.

(gl):
(gl::Query::Query):
(gl::Query::~Query):
(gl::Query::begin):
(gl::Query::end):
(gl::Query::getResult):
(gl::Query::isResultAvailable):
(gl::Query::getType):
(gl::Query::testQuery):

  • src/libGLESv2/Query.h: Added.

(gl):
(Query):

  • src/libGLESv2/Renderbuffer.cpp:

(gl):
(gl::RenderbufferInterface::addProxyRef):
(gl::RenderbufferInterface::releaseProxy):
(gl::RenderbufferTexture::RenderbufferTexture):
(gl::RenderbufferTexture::~RenderbufferTexture):
(gl::RenderbufferTexture::addProxyRef):
(gl::RenderbufferTexture::releaseProxy):
(gl::Renderbuffer::addRef):
(gl::Renderbuffer::release):

  • src/libGLESv2/Renderbuffer.h:

(gl):
(RenderbufferInterface):
(RenderbufferTexture):
(Renderbuffer):

  • src/libGLESv2/Shader.cpp:

(gl::Shader::Shader):
(gl::Shader::getInfoLog):
(gl::Shader::getSourceImpl):
(gl):
(gl::Shader::initializeCompiler):
(gl::Shader::parseVaryings):
(gl::Shader::uncompile):
(gl::Shader::compileToHLSL):
(gl::VertexShader::uncompile):
(gl::VertexShader::compile):
(gl::VertexShader::parseAttributes):
(gl::FragmentShader::compile):

  • src/libGLESv2/Shader.h:

(Shader):
(VertexShader):

  • src/libGLESv2/Texture.cpp:

(gl::Texture2D::Texture2D):
(gl::Texture2D::~Texture2D):
(gl):
(gl::Texture2D::addProxyRef):
(gl::Texture2D::releaseProxy):
(gl::Texture2D::getRenderbuffer):
(gl::TextureCubeMap::TextureCubeMap):
(gl::TextureCubeMap::~TextureCubeMap):
(gl::TextureCubeMap::addProxyRef):
(gl::TextureCubeMap::releaseProxy):
(gl::TextureCubeMap::isSamplerComplete):
(gl::TextureCubeMap::convertToRenderTarget):
(gl::TextureCubeMap::getRenderbuffer):

  • src/libGLESv2/Texture.h:

(Texture):
(Texture2D):
(TextureCubeMap):

  • src/libGLESv2/VertexDataManager.cpp:

(gl::VertexDataManager::writeAttributeData):
(gl::VertexDataManager::prepareVertexData):
(gl::VertexDataManager::spaceRequired):
(gl):

  • src/libGLESv2/VertexDataManager.h:

(TranslatedAttribute):
(VertexDataManager):

  • src/libGLESv2/libGLESv2.cpp:
  • src/libGLESv2/libGLESv2.def:
  • src/libGLESv2/libGLESv2.vcproj:
  • src/libGLESv2/utilities.cpp:

(gl::IsInternalTextureTarget):

  • src/libGLESv2/utilities.h:

(gl):

Location:
trunk/Source/ThirdParty/ANGLE
Files:
21 added
60 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r110306 r112300  
     12012-03-26  Dean Jackson  <dino@apple.com>
     2
     3        Update ANGLE in WebKit
     4        https://bugs.webkit.org/show_bug.cgi?id=81717
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Update angleproject to r1009. Synced the source directory
     9        between the angle repository and WebKit. Ran the OS X Lion
     10        version of Bison over the glslang.l input which generates
     11        a slightly different output than angle provided.
     12
     13        * include/EGL/eglext.h:
     14        * include/GLES2/gl2ext.h:
     15        * include/GLSLANG/ShaderLang.h:
     16        * src/common/RefCountObject.cpp: Renamed from Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.cpp.
     17        (RefCountObject::RefCountObject):
     18        (RefCountObject::~RefCountObject):
     19        (RefCountObject::addRef):
     20        (RefCountObject::release):
     21        (RefCountObjectBindingPointer::set):
     22        * src/common/RefCountObject.h: Renamed from Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.h.
     23        (RefCountObject):
     24        (RefCountObject::id):
     25        (RefCountObjectBindingPointer):
     26        (RefCountObjectBindingPointer::RefCountObjectBindingPointer):
     27        (RefCountObjectBindingPointer::~RefCountObjectBindingPointer):
     28        (RefCountObjectBindingPointer::get):
     29        (RefCountObjectBindingPointer::id):
     30        (RefCountObjectBindingPointer::operator ! ):
     31        (BindingPointer):
     32        (BindingPointer::set):
     33        (BindingPointer::get):
     34        (BindingPointer::operator -> ):
     35        * src/common/debug.cpp:
     36        (gl::output):
     37        * src/common/version.h:
     38        * src/compiler/BaseTypes.h:
     39        * src/compiler/Compiler.cpp:
     40        (TCompiler::TCompiler):
     41        (TCompiler::~TCompiler):
     42        (TCompiler::mapLongVariableNames):
     43        * src/compiler/ConstantUnion.h:
     44        (ConstantUnion::ConstantUnion):
     45        (ConstantUnion::operator==):
     46        (ConstantUnion::operator>):
     47        (ConstantUnion::operator<):
     48        * src/compiler/Intermediate.cpp:
     49        (TIntermConstantUnion::fold):
     50        * src/compiler/MapLongVariableNames.cpp:
     51        (LongNameMap::LongNameMap):
     52        (LongNameMap::~LongNameMap):
     53        (LongNameMap::GetInstance):
     54        (LongNameMap::Release):
     55        (LongNameMap::Find):
     56        (LongNameMap::Insert):
     57        (LongNameMap::Size):
     58        (MapLongVariableNames::MapLongVariableNames):
     59        (MapLongVariableNames::visitSymbol):
     60        (MapLongVariableNames::mapGlobalLongName):
     61        * src/compiler/MapLongVariableNames.h:
     62        (LongNameMap):
     63        (MapLongVariableNames):
     64        * src/compiler/OutputHLSL.cpp:
     65        (sh::OutputHLSL::OutputHLSL):
     66        (sh::OutputHLSL::header):
     67        (sh::OutputHLSL::visitSymbol):
     68        (sh::OutputHLSL::visitUnary):
     69        (sh::OutputHLSL::visitAggregate):
     70        (sh::OutputHLSL::visitLoop):
     71        (sh::OutputHLSL::handleExcessiveLoop):
     72        (sh::OutputHLSL::typeString):
     73        (sh::OutputHLSL::addConstructor):
     74        (sh::OutputHLSL::decorateUniform):
     75        * src/compiler/OutputHLSL.h:
     76        (OutputHLSL):
     77        * src/compiler/PoolAlloc.cpp:
     78        (TAllocation::checkGuardBlock):
     79        * src/compiler/ShHandle.h:
     80        (TCompiler):
     81        * src/compiler/SymbolTable.cpp:
     82        * src/compiler/SymbolTable.h:
     83        (TSymbolTable):
     84        (TSymbolTable::getOuterLevel):
     85        * src/compiler/VariableInfo.cpp:
     86        (getVariableDataType):
     87        * src/compiler/glslang.l:
     88        * src/compiler/glslang.y:
     89        * src/compiler/glslang_lex.cpp:
     90        (yy_buffer_state):
     91        (yyguts_t):
     92        (input):
     93        (yyensure_buffer_stack):
     94        (yy_scan_bytes):
     95        (yyget_leng):
     96        * src/compiler/glslang_tab.cpp:
     97        * src/compiler/osinclude.h:
     98        * src/compiler/preprocessor/cpp.c:
     99        * src/compiler/preprocessor/memory.c:
     100        * src/compiler/preprocessor/new/Context.cpp: Added.
     101        (isMacroNameReserved):
     102        (pp):
     103        (pp::Context::Context):
     104        (pp::Context::~Context):
     105        (pp::Context::init):
     106        (pp::Context::process):
     107        (pp::Context::defineMacro):
     108        (pp::Context::undefineMacro):
     109        (pp::Context::isMacroDefined):
     110        (pp::Context::reset):
     111        (pp::Context::defineBuiltInMacro):
     112        * src/compiler/preprocessor/new/Context.h: Added.
     113        (pp):
     114        (Context):
     115        (pp::Context::lexer):
     116        (pp::Context::output):
     117        * src/compiler/preprocessor/new/Input.cpp: Added.
     118        (pp):
     119        (pp::Input::Input):
     120        (pp::Input::eof):
     121        (pp::Input::read):
     122        (pp::Input::getChar):
     123        (pp::Input::peekChar):
     124        (pp::Input::switchToNextString):
     125        (pp::Input::isStringEmpty):
     126        (pp::Input::stringLength):
     127        * src/compiler/preprocessor/new/Input.h: Added.
     128        (pp):
     129        (Input):
     130        (pp::Input::error):
     131        (pp::Input::stringIndex):
     132        * src/compiler/preprocessor/new/Macro.cpp: Added.
     133        (pp):
     134        (pp::Macro::Macro):
     135        (pp::Macro::~Macro):
     136        * src/compiler/preprocessor/new/Macro.h: Added.
     137        (pp):
     138        (Macro):
     139        (pp::Macro::type):
     140        (pp::Macro::identifier):
     141        (pp::Macro::parameters):
     142        (pp::Macro::replacements):
     143        * src/compiler/preprocessor/new/Preprocessor.cpp: Added.
     144        (pp):
     145        (pp::Preprocessor::Preprocessor):
     146        (pp::Preprocessor::~Preprocessor):
     147        (pp::Preprocessor::init):
     148        (pp::Preprocessor::process):
     149        (pp::Preprocessor::reset):
     150        * src/compiler/preprocessor/new/Preprocessor.h: Added.
     151        (pp):
     152        (Preprocessor):
     153        (pp::Preprocessor::begin):
     154        (pp::Preprocessor::end):
     155        * src/compiler/preprocessor/new/Token.cpp: Added.
     156        (pp):
     157        (pp::Token::encodeLocation):
     158        (pp::Token::decodeLocation):
     159        (pp::Token::Token):
     160        (pp::Token::~Token):
     161        (pp::operator<<):
     162        * src/compiler/preprocessor/new/Token.h: Added.
     163        (pp):
     164        (Token):
     165        (pp::Token::location):
     166        (pp::Token::type):
     167        (pp::Token::value):
     168        * src/compiler/preprocessor/new/generate_parser.sh: Added.
     169        * src/compiler/preprocessor/new/pp.l: Added.
     170        * src/compiler/preprocessor/new/pp.y: Added.
     171        * src/compiler/preprocessor/new/pp_lex.cpp: Added.
     172        (yy_buffer_state):
     173        (yy_trans_info):
     174        (yyguts_t):
     175        (yy_get_previous_state):
     176        (yy_try_NUL_trans):
     177        (input):
     178        (pprestart):
     179        (pp_switch_to_buffer):
     180        (pp_load_buffer_state):
     181        (pp_create_buffer):
     182        (pp_delete_buffer):
     183        (pp_init_buffer):
     184        (pp_flush_buffer):
     185        (pppush_buffer_state):
     186        (pppop_buffer_state):
     187        (ppensure_buffer_stack):
     188        (pp_scan_buffer):
     189        (pp_scan_string):
     190        (pp_scan_bytes):
     191        (yy_push_state):
     192        (yy_pop_state):
     193        (yy_top_state):
     194        (yy_fatal_error):
     195        (ppget_extra):
     196        (ppget_lineno):
     197        (ppget_column):
     198        (ppget_in):
     199        (ppget_out):
     200        (ppget_leng):
     201        (ppget_text):
     202        (ppset_extra):
     203        (ppset_lineno):
     204        (ppset_column):
     205        (ppset_in):
     206        (ppset_out):
     207        (ppget_debug):
     208        (ppset_debug):
     209        (ppget_lval):
     210        (ppset_lval):
     211        (ppget_lloc):
     212        (ppset_lloc):
     213        (pplex_init):
     214        (pplex_init_extra):
     215        (yy_init_globals):
     216        (pplex_destroy):
     217        (yy_flex_strncpy):
     218        (yy_flex_strlen):
     219        (ppalloc):
     220        (pprealloc):
     221        (ppfree):
     222        (extractMacroName):
     223        (pp):
     224        (pp::Context::readInput):
     225        (pp::Context::initLexer):
     226        (pp::Context::destroyLexer):
     227        * src/compiler/preprocessor/new/pp_tab.cpp: Added.
     228        (YYLTYPE):
     229        (yysyntax_error):
     230        (yyerror):
     231        (pushConditionalBlock):
     232        (popConditionalBlock):
     233        (pp::Context::parse):
     234        * src/compiler/preprocessor/new/pp_tab.h: Added.
     235        (YYLTYPE):
     236        * src/compiler/preprocessor/new/stl_utils.h: Added.
     237        (pp):
     238        (Delete):
     239        (pp::Delete::operator()):
     240        (DeleteSecond):
     241        (pp::DeleteSecond::operator()):
     242        * src/compiler/preprocessor/new/token_type.h: Added.
     243        * src/compiler/preprocessor/scanner.c:
     244        (yylex_CPP):
     245        * src/compiler/preprocessor/symbols.c:
     246        * src/compiler/preprocessor/tokens.c:
     247        * src/libEGL/Config.cpp:
     248        (egl::ConfigSet::getConfigs):
     249        * src/libEGL/Display.cpp:
     250        (egl::Display::initialize):
     251        (egl::Display::terminate):
     252        (egl::Display::restoreLostDevice):
     253        (egl::Display::sync):
     254        (egl):
     255        (egl::Display::allocateEventQuery):
     256        (egl::Display::freeEventQuery):
     257        (egl::Display::getFloat32TextureSupport):
     258        (egl::Display::getFloat16TextureSupport):
     259        (egl::Display::getEventQuerySupport):
     260        (egl::Display::initExtensionString):
     261        (egl::Display::shareHandleSupported):
     262        (egl::Display::getOcclusionQuerySupport):
     263        (egl::Display::getInstancingSupport):
     264        * src/libEGL/Display.h:
     265        (Display):
     266        (egl::Display::isD3d9ExDevice):
     267        * src/libEGL/Surface.cpp:
     268        (egl::Surface::resetSwapChain):
     269        * src/libEGL/libEGL.cpp:
     270        * src/libEGL/libEGL.vcproj:
     271        * src/libGLESv2/Blit.cpp:
     272        (gl::Blit::setCommonBlitState):
     273        * src/libGLESv2/Buffer.h:
     274        (Buffer):
     275        * src/libGLESv2/Context.cpp:
     276        (gl::Context::Context):
     277        (gl::Context::~Context):
     278        (gl::Context::makeCurrent):
     279        (gl::Context::getActiveQuery):
     280        (gl):
     281        (gl::Context::createFence):
     282        (gl::Context::createQuery):
     283        (gl::Context::deleteQuery):
     284        (gl::Context::beginQuery):
     285        (gl::Context::endQuery):
     286        (gl::Context::getQuery):
     287        (gl::Context::applyVertexBuffer):
     288        (gl::Context::applyIndexBuffer):
     289        (gl::Context::readPixels):
     290        (gl::Context::clear):
     291        (gl::Context::drawArrays):
     292        (gl::Context::drawElements):
     293        (gl::Context::sync):
     294        (gl::Context::drawLineLoop):
     295        (gl::Context::supportsOcclusionQueries):
     296        (gl::Context::supportsInstancing):
     297        (gl::Context::setVertexAttribDivisor):
     298        (gl::Context::initExtensionString):
     299        (gl::VertexDeclarationCache::applyDeclaration):
     300        (gl::VertexDeclarationCache::markStateDirty):
     301        * src/libGLESv2/Context.h:
     302        (gl):
     303        (gl::VertexAttribute::VertexAttribute):
     304        (State):
     305        (VertexDeclarationCache):
     306        (Context):
     307        * src/libGLESv2/Fence.cpp:
     308        (gl::Fence::Fence):
     309        (gl::Fence::~Fence):
     310        (gl::Fence::setFence):
     311        * src/libGLESv2/Fence.h:
     312        (egl):
     313        (Fence):
     314        * src/libGLESv2/Framebuffer.cpp:
     315        (gl::Framebuffer::lookupRenderbuffer):
     316        (gl::Framebuffer::detachTexture):
     317        (gl::Framebuffer::completeness):
     318        * src/libGLESv2/Framebuffer.h:
     319        * src/libGLESv2/IndexDataManager.cpp:
     320        (gl::IndexDataManager::IndexDataManager):
     321        (gl::IndexDataManager::~IndexDataManager):
     322        (gl::computeRange):
     323        (gl::IndexDataManager::prepareIndexData):
     324        (gl::IndexDataManager::getCountingIndices):
     325        (gl):
     326        * src/libGLESv2/IndexDataManager.h:
     327        (IndexDataManager):
     328        * src/libGLESv2/Program.cpp:
     329        (gl::Program::getUniformLocation):
     330        (gl::Program::setUniform1fv):
     331        (gl::Program::setUniform2fv):
     332        (gl::Program::setUniform3fv):
     333        (gl::Program::setUniform4fv):
     334        (gl::Program::setUniform1iv):
     335        (gl::Program::setUniform2iv):
     336        (gl::Program::setUniform3iv):
     337        (gl::Program::setUniform4iv):
     338        (gl::Program::packVaryings):
     339        (gl::Program::linkVaryings):
     340        (gl::Program::defineUniform):
     341        (gl::Program::createUniform):
     342        (gl::Program::applyUniformnbv):
     343        (gl::Program::applyUniform1iv):
     344        (gl::Program::applyUniform2iv):
     345        (gl::Program::applyUniform3iv):
     346        (gl::Program::applyUniform4iv):
     347        (gl::Program::getInfoLog):
     348        * src/libGLESv2/Program.h:
     349        (Program):
     350        * src/libGLESv2/Query.cpp: Added.
     351        (gl):
     352        (gl::Query::Query):
     353        (gl::Query::~Query):
     354        (gl::Query::begin):
     355        (gl::Query::end):
     356        (gl::Query::getResult):
     357        (gl::Query::isResultAvailable):
     358        (gl::Query::getType):
     359        (gl::Query::testQuery):
     360        * src/libGLESv2/Query.h: Added.
     361        (gl):
     362        (Query):
     363        * src/libGLESv2/Renderbuffer.cpp:
     364        (gl):
     365        (gl::RenderbufferInterface::addProxyRef):
     366        (gl::RenderbufferInterface::releaseProxy):
     367        (gl::RenderbufferTexture::RenderbufferTexture):
     368        (gl::RenderbufferTexture::~RenderbufferTexture):
     369        (gl::RenderbufferTexture::addProxyRef):
     370        (gl::RenderbufferTexture::releaseProxy):
     371        (gl::Renderbuffer::addRef):
     372        (gl::Renderbuffer::release):
     373        * src/libGLESv2/Renderbuffer.h:
     374        (gl):
     375        (RenderbufferInterface):
     376        (RenderbufferTexture):
     377        (Renderbuffer):
     378        * src/libGLESv2/Shader.cpp:
     379        (gl::Shader::Shader):
     380        (gl::Shader::getInfoLog):
     381        (gl::Shader::getSourceImpl):
     382        (gl):
     383        (gl::Shader::initializeCompiler):
     384        (gl::Shader::parseVaryings):
     385        (gl::Shader::uncompile):
     386        (gl::Shader::compileToHLSL):
     387        (gl::VertexShader::uncompile):
     388        (gl::VertexShader::compile):
     389        (gl::VertexShader::parseAttributes):
     390        (gl::FragmentShader::compile):
     391        * src/libGLESv2/Shader.h:
     392        (Shader):
     393        (VertexShader):
     394        * src/libGLESv2/Texture.cpp:
     395        (gl::Texture2D::Texture2D):
     396        (gl::Texture2D::~Texture2D):
     397        (gl):
     398        (gl::Texture2D::addProxyRef):
     399        (gl::Texture2D::releaseProxy):
     400        (gl::Texture2D::getRenderbuffer):
     401        (gl::TextureCubeMap::TextureCubeMap):
     402        (gl::TextureCubeMap::~TextureCubeMap):
     403        (gl::TextureCubeMap::addProxyRef):
     404        (gl::TextureCubeMap::releaseProxy):
     405        (gl::TextureCubeMap::isSamplerComplete):
     406        (gl::TextureCubeMap::convertToRenderTarget):
     407        (gl::TextureCubeMap::getRenderbuffer):
     408        * src/libGLESv2/Texture.h:
     409        (Texture):
     410        (Texture2D):
     411        (TextureCubeMap):
     412        * src/libGLESv2/VertexDataManager.cpp:
     413        (gl::VertexDataManager::writeAttributeData):
     414        (gl::VertexDataManager::prepareVertexData):
     415        (gl::VertexDataManager::spaceRequired):
     416        (gl):
     417        * src/libGLESv2/VertexDataManager.h:
     418        (TranslatedAttribute):
     419        (VertexDataManager):
     420        * src/libGLESv2/libGLESv2.cpp:
     421        * src/libGLESv2/libGLESv2.def:
     422        * src/libGLESv2/libGLESv2.vcproj:
     423        * src/libGLESv2/utilities.cpp:
     424        (gl::IsInternalTextureTarget):
     425        * src/libGLESv2/utilities.h:
     426        (gl):
     427
    14282012-03-09  Ashod Nakashian  <ashodnakashian@yahoo.com>
    2429
  • trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h

    r104363 r112300  
    77
    88/*
    9 ** Copyright (c) 2007-2010 The Khronos Group Inc.
     9** Copyright (c) 2007-2012 The Khronos Group Inc.
    1010**
    1111** Permission is hereby granted, free of charge, to any person obtaining a
     
    3535/* Header file version number */
    3636/* Current version at http://www.khronos.org/registry/egl/ */
    37 /* $Revision: 15052 $ on $Date: 2011-07-06 17:43:46 -0700 (Wed, 06 Jul 2011) $ */
    38 #define EGL_EGLEXT_VERSION 10
     37/* $Revision: 16473 $ on $Date: 2012-01-04 02:20:48 -0800 (Wed, 04 Jan 2012) $ */
     38#define EGL_EGLEXT_VERSION 11
    3939
    4040#ifndef EGL_KHR_config_attribs
     
    179179#ifndef EGL_NV_coverage_sample
    180180#define EGL_NV_coverage_sample 1
    181 #define EGL_COVERAGE_BUFFERS_NV 0x30E0
    182 #define EGL_COVERAGE_SAMPLES_NV 0x30E1
     181#define EGL_COVERAGE_BUFFERS_NV                 0x30E0
     182#define EGL_COVERAGE_SAMPLES_NV                 0x30E1
    183183#endif
    184184
    185185#ifndef EGL_NV_depth_nonlinear
    186186#define EGL_NV_depth_nonlinear 1
    187 #define EGL_DEPTH_ENCODING_NV 0x30E2
     187#define EGL_DEPTH_ENCODING_NV                   0x30E2
    188188#define EGL_DEPTH_ENCODING_NONE_NV 0
    189 #define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
     189#define EGL_DEPTH_ENCODING_NONLINEAR_NV         0x30E3
    190190#endif
    191191
     
    302302#endif
    303303
     304#ifndef EGL_ANGLE_software_display
     305#define EGL_ANGLE_software_display 1
     306#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
     307#endif
     308
    304309#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
    305310#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
    306311#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE   0x3200
    307 #endif
    308 
    309 #ifndef EGL_ANGLE_software_display
    310 #define EGL_ANGLE_software_display 1
    311 #define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
    312312#endif
    313313
     
    319319#endif
    320320
    321 #ifndef EGL_EXT_create_context_robustness
    322 #define EGL_EXT_create_context_robustness 1
    323 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT                0x30BF
    324 #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT  0x3138
    325 #define EGL_NO_RESET_NOTIFICATION_EXT                       0x31BE
    326 #define EGL_LOSE_CONTEXT_ON_RESET_EXT                       0x31BF
    327 #endif
    328 
    329321#if KHRONOS_SUPPORT_INT64   /* EGLTimeKHR requires 64-bit uint support */
    330322#ifndef EGL_NV_system_time
     
    342334#endif
    343335
     336#ifndef EGL_EXT_create_context_robustness
     337#define EGL_EXT_create_context_robustness 1
     338#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT    0x30BF
     339#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
     340#define EGL_NO_RESET_NOTIFICATION_EXT           0x31BE
     341#define EGL_LOSE_CONTEXT_ON_RESET_EXT           0x31BF
     342#endif
     343
    344344#ifdef __cplusplus
    345345}
  • trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h

    r104363 r112300  
    22#define __gl2ext_h_
    33
    4 /* $Revision: 15049 $ on $Date:: 2011-07-06 17:28:16 -0700 #$ */
     4/* $Revision: 16482 $ on $Date:: 2012-01-04 13:44:55 -0500 #$ */
    55
    66#ifdef __cplusplus
     
    234234#endif
    235235
     236/* GL_ANGLE_instanced_arrays */
     237#ifndef GL_ANGLE_instanced_arrays
     238#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE                    0x88FE
     239#endif
     240
    236241/*------------------------------------------------------------------------*
    237242 * APPLE extension tokens
     
    288293#endif
    289294
     295/* GL_EXT_color_buffer_half_float */
     296#ifndef GL_EXT_color_buffer_half_float
     297#define GL_RGBA16F_EXT                                          0x881A
     298#define GL_RGB16F_EXT                                           0x881B
     299#define GL_RG16F_EXT                                            0x822F
     300#define GL_R16F_EXT                                             0x822D
     301#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT            0x8211
     302#define GL_UNSIGNED_NORMALIZED_EXT                              0x8C17
     303#endif
     304
     305/* GL_EXT_debug_label */
     306#ifndef GL_EXT_debug_label
     307#define GL_PROGRAM_PIPELINE_OBJECT_EXT                          0x8A4F
     308#define GL_PROGRAM_OBJECT_EXT                                   0x8B40
     309#define GL_SHADER_OBJECT_EXT                                    0x8B48
     310#define GL_BUFFER_OBJECT_EXT                                    0x9151
     311#define GL_QUERY_OBJECT_EXT                                     0x9153
     312#define GL_VERTEX_ARRAY_OBJECT_EXT                              0x9154
     313#endif
     314
     315/* GL_EXT_debug_marker */
     316/* No new tokens introduced by this extension. */
     317
    290318/* GL_EXT_discard_framebuffer */
    291319#ifndef GL_EXT_discard_framebuffer
     
    295323#endif
    296324
     325/* GL_EXT_multisampled_render_to_texture */
     326#ifndef GL_EXT_multisampled_render_to_texture
     327#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT           0x8D6C
     328#define GL_RENDERBUFFER_SAMPLES_EXT                             0x9133
     329#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT               0x9134
     330#define GL_MAX_SAMPLES_EXT                                      0x9135
     331#endif
     332
    297333/* GL_EXT_multi_draw_arrays */
    298334/* No new tokens introduced by this extension. */
     335
     336/* GL_EXT_occlusion_query_boolean */
     337#ifndef GL_EXT_occlusion_query_boolean
     338#define GL_ANY_SAMPLES_PASSED_EXT                               0x8C2F
     339#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT                  0x8D6A
     340#define GL_CURRENT_QUERY_EXT                                    0x8865
     341#define GL_QUERY_RESULT_EXT                                     0x8866
     342#define GL_QUERY_RESULT_AVAILABLE_EXT                           0x8867
     343#endif
    299344
    300345/* GL_EXT_read_format_bgra */
     
    305350#endif
    306351
    307 /* GL_EXT_shader_texture_lod */
    308 /* No new tokens introduced by this extension. */
    309 
    310 /* GL_EXT_texture_filter_anisotropic */
    311 #ifndef GL_EXT_texture_filter_anisotropic
    312 #define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
    313 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
    314 #endif
    315 
    316 /* GL_EXT_texture_format_BGRA8888 */
    317 #ifndef GL_EXT_texture_format_BGRA8888
    318 #define GL_BGRA_EXT                                             0x80E1
    319 #endif
    320 
    321 /* GL_EXT_texture_type_2_10_10_10_REV */
    322 #ifndef GL_EXT_texture_type_2_10_10_10_REV
    323 #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
    324 #endif
    325 
    326 /* GL_EXT_texture_compression_dxt1 */
    327 #ifndef GL_EXT_texture_compression_dxt1
    328 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                         0x83F0
    329 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                        0x83F1
    330 #endif
    331 
    332 /* GL_EXT_unpack_subimage */
    333 #ifndef GL_EXT_unpack_subimage
    334 #define GL_UNPACK_ROW_LENGTH                                    0x0CF2
    335 #define GL_UNPACK_SKIP_ROWS                                     0x0CF3
    336 #define GL_UNPACK_SKIP_PIXELS                                   0x0CF4
    337 #endif
    338 
    339352/* GL_EXT_robustness */
    340353#ifndef GL_EXT_robustness
     354/* reuse GL_NO_ERROR */
    341355#define GL_GUILTY_CONTEXT_RESET_EXT                             0x8253
    342356#define GL_INNOCENT_CONTEXT_RESET_EXT                           0x8254
     
    348362#endif
    349363
     364/* GL_EXT_separate_shader_objects */
     365#ifndef GL_EXT_separate_shader_objects
     366#define GL_VERTEX_SHADER_BIT_EXT                                0x00000001
     367#define GL_FRAGMENT_SHADER_BIT_EXT                              0x00000002
     368#define GL_ALL_SHADER_BITS_EXT                                  0xFFFFFFFF
     369#define GL_PROGRAM_SEPARABLE_EXT                                0x8258
     370#define GL_ACTIVE_PROGRAM_EXT                                   0x8259
     371#define GL_PROGRAM_PIPELINE_BINDING_EXT                         0x825A
     372#endif
     373
     374/* GL_EXT_shader_texture_lod */
     375/* No new tokens introduced by this extension. */
     376
     377/* GL_EXT_shadow_samplers */
     378#ifndef GL_EXT_shadow_samplers
     379#define GL_TEXTURE_COMPARE_MODE_EXT                             0x884C
     380#define GL_TEXTURE_COMPARE_FUNC_EXT                             0x884D
     381#define GL_COMPARE_REF_TO_TEXTURE_EXT                           0x884E
     382#endif
     383
     384/* GL_EXT_sRGB */
     385#ifndef GL_EXT_sRGB
     386#define GL_SRGB_EXT                                             0x8C40
     387#define GL_SRGB_ALPHA_EXT                                       0x8C42
     388#define GL_SRGB8_ALPHA8_EXT                                     0x8C43
     389#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT            0x8210
     390#endif
     391
     392/* GL_EXT_texture_compression_dxt1 */
     393#ifndef GL_EXT_texture_compression_dxt1
     394#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                         0x83F0
     395#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                        0x83F1
     396#endif
     397
     398/* GL_EXT_texture_filter_anisotropic */
     399#ifndef GL_EXT_texture_filter_anisotropic
     400#define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
     401#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
     402#endif
     403
     404/* GL_EXT_texture_format_BGRA8888 */
     405#ifndef GL_EXT_texture_format_BGRA8888
     406#define GL_BGRA_EXT                                             0x80E1
     407#endif
     408
     409/* GL_EXT_texture_rg */
     410#ifndef GL_EXT_texture_rg
     411#define GL_RED_EXT                                              0x1903
     412#define GL_RG_EXT                                               0x8227
     413#define GL_R8_EXT                                               0x8229
     414#define GL_RG8_EXT                                              0x822B
     415#endif
     416
    350417/* GL_EXT_texture_storage */
    351418#ifndef GL_EXT_texture_storage
    352419#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT                         0x912F
    353 #define GL_ALPHA8_EXT                                           0x803C
     420#define GL_ALPHA8_EXT                                           0x803C 
    354421#define GL_LUMINANCE8_EXT                                       0x8040
    355422#define GL_LUMINANCE8_ALPHA8_EXT                                0x8045
    356 /* OES_texture_float dependent internal formats */
    357 #define GL_RGBA32F_EXT                                          0x8814  /* reuse tokens from ARB_texture_float */
     423#define GL_RGBA32F_EXT                                          0x8814 
    358424#define GL_RGB32F_EXT                                           0x8815
    359425#define GL_ALPHA32F_EXT                                         0x8816
    360426#define GL_LUMINANCE32F_EXT                                     0x8818
    361427#define GL_LUMINANCE_ALPHA32F_EXT                               0x8819
    362 /* OES_texture_half_float dependent internal formats */
    363 #define GL_RGBA16F_EXT                                          0x881A /* reuse tokens from ARB_texture_float */
     428/* reuse GL_RGBA16F_EXT */
    364429#define GL_RGB16F_EXT                                           0x881B
    365430#define GL_ALPHA16F_EXT                                         0x881C
    366431#define GL_LUMINANCE16F_EXT                                     0x881E
    367432#define GL_LUMINANCE_ALPHA16F_EXT                               0x881F
    368 /* EXT_texture_type_2_10_10_10_REV dependent internal formats */
    369 #define GL_RGB10_A2_EXT                                         0x8059  /* reuse tokens from EXT_texture */
     433#define GL_RGB10_A2_EXT                                         0x8059 
    370434#define GL_RGB10_EXT                                            0x8052
    371 /* EXT_texture_format_BGRA8888 dependent internal formats */
    372435#define GL_BGRA8_EXT                                            0x93A1
     436#endif
     437
     438/* GL_EXT_texture_type_2_10_10_10_REV */
     439#ifndef GL_EXT_texture_type_2_10_10_10_REV
     440#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
     441#endif
     442
     443/* GL_EXT_unpack_subimage */
     444#ifndef GL_EXT_unpack_subimage
     445#define GL_UNPACK_ROW_LENGTH                                    0x0CF2
     446#define GL_UNPACK_SKIP_ROWS                                     0x0CF3
     447#define GL_UNPACK_SKIP_PIXELS                                   0x0CF4
    373448#endif
    374449
     
    882957#endif
    883958
     959/* GL_ANGLE_instanced_arrays */
     960#ifndef GL_ANGLE_instanced_arrays
     961#define GL_ANGLE_instanced_arrays 1
     962#ifdef GL_GLEXT_PROTOTYPES
     963GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor);
     964GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
     965GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
     966#endif
     967typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
     968typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
     969typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
     970#endif
     971
    884972/*------------------------------------------------------------------------*
    885973 * APPLE extension functions
     
    9351023#endif
    9361024
     1025/* GL_EXT_color_buffer_half_float */
     1026#ifndef GL_EXT_color_buffer_half_float
     1027#define GL_EXT_color_buffer_half_float 1
     1028#endif
     1029
     1030/* GL_EXT_debug_label */
     1031#ifndef GL_EXT_debug_label
     1032#define GL_EXT_debug_label 1
     1033#ifdef GL_GLEXT_PROTOTYPES
     1034GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
     1035GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
     1036#endif
     1037typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
     1038typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
     1039#endif
     1040
     1041/* GL_EXT_debug_marker */
     1042#ifndef GL_EXT_debug_marker
     1043#define GL_EXT_debug_marker 1
     1044#ifdef GL_GLEXT_PROTOTYPES
     1045GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
     1046GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
     1047GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
     1048#endif
     1049typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
     1050typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
     1051typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
     1052#endif
     1053
    9371054/* GL_EXT_discard_framebuffer */
    9381055#ifndef GL_EXT_discard_framebuffer
     
    9421059#endif
    9431060typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
     1061#endif
     1062
     1063/* GL_EXT_multisampled_render_to_texture */
     1064#ifndef GL_EXT_multisampled_render_to_texture
     1065#define GL_EXT_multisampled_render_to_texture 1
     1066#ifdef GL_GLEXT_PROTOTYPES
     1067GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
     1068GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
     1069#endif
     1070typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
     1071typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
    9441072#endif
    9451073
     
    9541082#endif
    9551083
     1084/* GL_EXT_occlusion_query_boolean */
     1085#ifndef GL_EXT_occlusion_query_boolean
     1086#define GL_EXT_occlusion_query_boolean 1
     1087#ifdef GL_GLEXT_PROTOTYPES
     1088GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
     1089GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
     1090GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
     1091GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
     1092GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
     1093GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
     1094GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
     1095#endif
     1096typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
     1097typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
     1098typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
     1099typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
     1100typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
     1101typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
     1102typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
     1103#endif
     1104
    9561105/* GL_EXT_read_format_bgra */
    9571106#ifndef GL_EXT_read_format_bgra
     
    9591108#endif
    9601109
     1110/* GL_EXT_robustness */
     1111#ifndef GL_EXT_robustness
     1112#define GL_EXT_robustness 1
     1113#ifdef GL_GLEXT_PROTOTYPES
     1114GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
     1115GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
     1116GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
     1117GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
     1118#endif
     1119typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
     1120typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
     1121typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
     1122typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
     1123#endif
     1124
     1125/* GL_EXT_separate_shader_objects */
     1126#ifndef GL_EXT_separate_shader_objects
     1127#define GL_EXT_separate_shader_objects 1
     1128#ifdef GL_GLEXT_PROTOTYPES
     1129GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
     1130GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
     1131GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
     1132GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
     1133GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
     1134GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
     1135GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
     1136GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
     1137GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
     1138GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x);
     1139GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y);
     1140GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z);
     1141GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
     1142GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x);
     1143GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y);
     1144GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
     1145GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
     1146GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
     1147GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
     1148GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
     1149GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
     1150GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1151GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1152GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1153GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1154GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
     1155GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
     1156GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
     1157GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
     1158GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
     1159#endif
     1160typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
     1161typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
     1162typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
     1163typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
     1164typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
     1165typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
     1166typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
     1167typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
     1168typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
     1169typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x);
     1170typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y);
     1171typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
     1172typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
     1173typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x);
     1174typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
     1175typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
     1176typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
     1177typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
     1178typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
     1179typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
     1180typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
     1181typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1182typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1183typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1184typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
     1185typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
     1186typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
     1187typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
     1188typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
     1189typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
     1190#endif
     1191
    9611192/* GL_EXT_shader_texture_lod */
    9621193#ifndef GL_EXT_shader_texture_lod
     
    9641195#endif
    9651196
     1197/* GL_EXT_shadow_samplers */
     1198#ifndef GL_EXT_shadow_samplers
     1199#define GL_EXT_shadow_samplers 1
     1200#endif
     1201
     1202/* GL_EXT_sRGB */
     1203#ifndef GL_EXT_sRGB
     1204#define GL_EXT_sRGB 1
     1205#endif
     1206
     1207/* GL_EXT_texture_compression_dxt1 */
     1208#ifndef GL_EXT_texture_compression_dxt1
     1209#define GL_EXT_texture_compression_dxt1 1
     1210#endif
     1211
    9661212/* GL_EXT_texture_filter_anisotropic */
    9671213#ifndef GL_EXT_texture_filter_anisotropic
     
    9741220#endif
    9751221
     1222/* GL_EXT_texture_rg */
     1223#ifndef GL_EXT_texture_rg
     1224#define GL_EXT_texture_rg 1
     1225#endif
     1226
     1227/* GL_EXT_texture_storage */
     1228#ifndef GL_EXT_texture_storage
     1229#define GL_EXT_texture_storage 1
     1230#ifdef GL_GLEXT_PROTOTYPES
     1231GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
     1232GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
     1233GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
     1234GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
     1235GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
     1236GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
     1237#endif
     1238typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
     1239typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
     1240typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
     1241typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
     1242typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
     1243typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
     1244#endif
     1245
    9761246/* GL_EXT_texture_type_2_10_10_10_REV */
    9771247#ifndef GL_EXT_texture_type_2_10_10_10_REV
     
    9791249#endif
    9801250
    981 /* GL_EXT_texture_compression_dxt1 */
    982 #ifndef GL_EXT_texture_compression_dxt1
    983 #define GL_EXT_texture_compression_dxt1 1
    984 #endif
    985 
    9861251/* GL_EXT_unpack_subimage */
    9871252#ifndef GL_EXT_unpack_subimage
    9881253#define GL_EXT_unpack_subimage 1
    989 #endif
    990 
    991 /* GL_EXT_robustness */
    992 #ifndef GL_EXT_robustness
    993 #define GL_EXT_robustness 1
    994 #ifdef GL_GLEXT_PROTOTYPES
    995 GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
    996 GL_APICALL void   GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
    997 GL_APICALL void   GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
    998 GL_APICALL void   GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
    999 #endif /* GL_GLEXT_PROTOTYPES */
    1000 typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
    1001 typedef void   (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
    1002 typedef void   (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
    1003 typedef void   (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
    1004 #endif
    1005 
    1006 /* GL_EXT_texture_storage */
    1007 #ifndef GL_EXT_texture_storage
    1008 #define GL_EXT_texture_storage 1
    1009 #ifdef GL_GLEXT_PROTOTYPES
    1010 GL_APICALL void GL_APIENTRY TexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
    1011 #endif /* GL_GLEXT_PROTOTYPES */
    1012 typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXT) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
    10131254#endif
    10141255
  • trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h

    r104363 r112300  
    7878  SH_SAMPLER_2D     = 0x8B5E,
    7979  SH_SAMPLER_CUBE   = 0x8B60,
    80   SH_SAMPLER_2D_RECT_ARB = 0x8B63
     80  SH_SAMPLER_2D_RECT_ARB = 0x8B63,
     81  SH_SAMPLER_EXTERNAL_OES = 0x8D66
    8182} ShDataType;
    8283
  • trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.cpp

    • Property svn:keywords set to Date Author Id Revision HeadURL
    r112294 r112300  
    1111
    1212#include "RefCountObject.h"
    13 
    14 namespace gl
    15 {
    1613
    1714RefCountObject::RefCountObject(GLuint id)
     
    4946    mObject = newObject;
    5047}
    51 
    52 }
  • trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h

    • Property svn:keywords set to Date Author Id Revision HeadURL
    r112294 r112300  
    1010// (Concretely, textures, buffers and renderbuffers.)
    1111
    12 #ifndef LIBGLESV2_REFCOUNTOBJECT_H_
    13 #define LIBGLESV2_REFCOUNTOBJECT_H_
     12#ifndef COMMON_REFCOUNTOBJECT_H_
     13#define COMMON_REFCOUNTOBJECT_H_
    1414
    1515#include <cstddef>
     
    1919
    2020#include "common/debug.h"
    21 
    22 namespace gl
    23 {
    2421
    2522class RefCountObject
     
    6663};
    6764
    68 }
    69 
    70 #endif   // LIBGLESV2_REFCOUNTOBJECT_H_
     65#endif   // COMMON_REFCOUNTOBJECT_H_
  • trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp

    r104363 r112300  
    2424    if (perfActive())
    2525    {
    26         char message[4096];
     26        char message[32768];
    2727        int len = vsprintf_s(message, format, vararg);
    2828        if (len < 0)
     
    3232
    3333        // There are no ASCII variants of these D3DPERF functions.
    34         wchar_t wideMessage[4096];
     34        wchar_t wideMessage[32768];
    3535        for (int i = 0; i < len; ++i)
    3636        {
  • trunk/Source/ThirdParty/ANGLE/src/common/version.h

    r104363 r112300  
    22#define MINOR_VERSION 0
    33#define BUILD_VERSION 0
    4 #define BUILD_REVISION 939
     4#define BUILD_REVISION 1009
    55
    66#define STRINGIFY(x) #x
  • trunk/Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h

    r104363 r112300  
    4848    EbtStruct,
    4949    EbtAddress,            // should be deprecated??
     50    EbtInvariant,          // used as a type when qualifying a previously declared variable as being invariant
    5051};
    5152
  • trunk/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    99#include "compiler/ForLoopUnroll.h"
    1010#include "compiler/Initialize.h"
     11#include "compiler/MapLongVariableNames.h"
    1112#include "compiler/ParseHelper.h"
    1213#include "compiler/ShHandle.h"
    1314#include "compiler/ValidateLimitations.h"
    14 #include "compiler/MapLongVariableNames.h"
    1515
    1616namespace {
     
    9292      builtInFunctionEmulator(type)
    9393{
     94    longNameMap = LongNameMap::GetInstance();
    9495}
    9596
    9697TCompiler::~TCompiler()
    9798{
     99    ASSERT(longNameMap);
     100    longNameMap->Release();
    98101}
    99102
     
    247250void TCompiler::mapLongVariableNames(TIntermNode* root)
    248251{
    249     MapLongVariableNames map(varyingLongNameMap);
     252    ASSERT(longNameMap);
     253    MapLongVariableNames map(longNameMap);
    250254    root->traverse(&map);
    251255}
  • trunk/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h

    r95901 r112300  
    1212class ConstantUnion {
    1313public:
     14    ConstantUnion()
     15    {
     16        iConst = 0;
     17    }
    1418
    1519    POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)       
     
    5559            return false;
    5660        }
    57 
    58         return false;
    5961    }
    6062
     
    9092            return false;   // Invalid operation, handled at semantic analysis
    9193        }
    92 
    93         return false;
    9494    }
    9595
     
    105105            return false;   // Invalid operation, handled at semantic analysis
    106106        }
    107 
    108         return false;
    109107    }
    110108
  • trunk/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp

    r95901 r112300  
    13721372        return newNode;
    13731373    }
    1374 
    1375     return this;
    13761374}
    13771375
  • trunk/Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.cpp

    r104363 r112300  
    99namespace {
    1010
    11 TString mapLongName(int id, const TString& name, bool isVarying)
     11TString mapLongName(int id, const TString& name, bool isGlobal)
    1212{
    1313    ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
    1414    TStringStream stream;
    1515    stream << "webgl_";
    16     if (isVarying)
    17         stream << "v";
     16    if (isGlobal)
     17        stream << "g";
    1818    stream << id << "_";
    1919    stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size());
     
    2121}
    2222
     23LongNameMap* gLongNameMapInstance = NULL;
     24
    2325}  // anonymous namespace
    2426
    25 MapLongVariableNames::MapLongVariableNames(
    26     std::map<std::string, std::string>& varyingLongNameMap)
    27     : mVaryingLongNameMap(varyingLongNameMap)
     27LongNameMap::LongNameMap()
     28    : refCount(0)
    2829{
     30}
     31
     32LongNameMap::~LongNameMap()
     33{
     34}
     35
     36// static
     37LongNameMap* LongNameMap::GetInstance()
     38{
     39    if (gLongNameMapInstance == NULL)
     40        gLongNameMapInstance = new LongNameMap;
     41    gLongNameMapInstance->refCount++;
     42    return gLongNameMapInstance;
     43}
     44
     45void LongNameMap::Release()
     46{
     47    ASSERT(gLongNameMapInstance == this);
     48    ASSERT(refCount > 0);
     49    refCount--;
     50    if (refCount == 0) {
     51        delete gLongNameMapInstance;
     52        gLongNameMapInstance = NULL;
     53    }
     54}
     55
     56const char* LongNameMap::Find(const char* originalName) const
     57{
     58    std::map<std::string, std::string>::const_iterator it = mLongNameMap.find(
     59        originalName);
     60    if (it != mLongNameMap.end())
     61        return (*it).second.c_str();
     62    return NULL;
     63}
     64
     65void LongNameMap::Insert(const char* originalName, const char* mappedName)
     66{
     67    mLongNameMap.insert(std::map<std::string, std::string>::value_type(
     68        originalName, mappedName));
     69}
     70
     71int LongNameMap::Size() const
     72{
     73    return mLongNameMap.size();
     74}
     75
     76MapLongVariableNames::MapLongVariableNames(LongNameMap* globalMap)
     77{
     78    ASSERT(globalMap);
     79    mGlobalMap = globalMap;
    2980}
    3081
     
    4091          case EvqUniform:
    4192            symbol->setSymbol(
    42                 mapVaryingLongName(symbol->getSymbol()));
     93                mapGlobalLongName(symbol->getSymbol()));
    4394            break;
    4495          default:
     
    57108}
    58109
    59 TString MapLongVariableNames::mapVaryingLongName(const TString& name)
     110TString MapLongVariableNames::mapGlobalLongName(const TString& name)
    60111{
    61     std::map<std::string, std::string>::const_iterator it = mVaryingLongNameMap.find(name.c_str());
    62     if (it != mVaryingLongNameMap.end())
    63         return (*it).second.c_str();
    64 
    65     int id = mVaryingLongNameMap.size();
    66     TString mappedName = mapLongName(id, name, true);
    67     mVaryingLongNameMap.insert(
    68         std::map<std::string, std::string>::value_type(name.c_str(), mappedName.c_str()));
    69     return mappedName;
     112    ASSERT(mGlobalMap);
     113    const char* mappedName = mGlobalMap->Find(name.c_str());
     114    if (mappedName != NULL)
     115        return mappedName;
     116    int id = mGlobalMap->Size();
     117    TString rt = mapLongName(id, name, true);
     118    mGlobalMap->Insert(name.c_str(), rt.c_str());
     119    return rt;
    70120}
  • trunk/Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    1616#define MAX_SHORTENED_IDENTIFIER_SIZE 32
    1717
     18// This is a ref-counted singleton. GetInstance() returns a pointer to the
     19// singleton, and after use, call Release(). GetInstance() and Release() should
     20// be paired.
     21class LongNameMap {
     22public:
     23    static LongNameMap* GetInstance();
     24    void Release();
     25
     26    // Return the mapped name if <originalName, mappedName> is in the map;
     27    // otherwise, return NULL.
     28    const char* Find(const char* originalName) const;
     29
     30    // Insert a pair into the map.
     31    void Insert(const char* originalName, const char* mappedName);
     32
     33    // Return the number of entries in the map.
     34    int Size() const;
     35
     36private:
     37    LongNameMap();
     38    ~LongNameMap();
     39
     40    size_t refCount;
     41    std::map<std::string, std::string> mLongNameMap;
     42};
     43
    1844// Traverses intermediate tree to map attributes and uniforms names that are
    1945// longer than MAX_SHORTENED_IDENTIFIER_SIZE to MAX_SHORTENED_IDENTIFIER_SIZE.
    2046class MapLongVariableNames : public TIntermTraverser {
    2147public:
    22     MapLongVariableNames(std::map<std::string, std::string>& varyingLongNameMap);
     48    MapLongVariableNames(LongNameMap* globalMap);
    2349
    2450    virtual void visitSymbol(TIntermSymbol*);
     
    2652
    2753private:
    28     TString mapVaryingLongName(const TString& name);
     54    TString mapGlobalLongName(const TString& name);
    2955
    30     std::map<std::string, std::string>& mVaryingLongNameMap;
     56    LongNameMap* mGlobalMap;
    3157};
    3258
  • trunk/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    6868    mUsesEqualBVec3 = false;
    6969    mUsesEqualBVec4 = false;
    70     mUsesAtan2 = false;
     70    mUsesAtan2_1 = false;
     71    mUsesAtan2_2 = false;
     72    mUsesAtan2_3 = false;
     73    mUsesAtan2_4 = false;
    7174
    7275    mScopeDepth = 0;
     
    140143                    if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
    141144                    {
    142                         uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type.isArray()) + arrayString(type) + ";\n";
     145                        uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
    143146                    }
    144147                }
     
    304307                    if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
    305308                    {
    306                         uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type.isArray()) + arrayString(type) + ";\n";
     309                        uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
    307310                    }
    308311                }
     
    704707    }
    705708
    706     if (mUsesAtan2)
     709    if (mUsesAtan2_1)
    707710    {
    708711        out << "float atanyx(float y, float x)\n"
     
    712715               "}\n";
    713716    }
     717
     718    if (mUsesAtan2_2)
     719    {
     720        out << "float2 atanyx(float2 y, float2 x)\n"
     721               "{\n"
     722               "    if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
     723               "    if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
     724               "    return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n"
     725               "}\n";
     726    }
     727
     728    if (mUsesAtan2_3)
     729    {
     730        out << "float3 atanyx(float3 y, float3 x)\n"
     731               "{\n"
     732               "    if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
     733               "    if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
     734               "    if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
     735               "    return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n"
     736               "}\n";
     737    }
     738
     739    if (mUsesAtan2_4)
     740    {
     741        out << "float4 atanyx(float4 y, float4 x)\n"
     742               "{\n"
     743               "    if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
     744               "    if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
     745               "    if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
     746               "    if(x[3] == 0 && y[3] == 0) x[3] = 1;\n"
     747               "    return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]), atan2(y[3], x[3]));\n"
     748               "}\n";
     749    }
    714750}
    715751
     
    760796        {
    761797            mReferencedUniforms.insert(name.c_str());
    762             out << decorateUniform(name, node->isArray());
     798            out << decorateUniform(name, node->getType());
    763799        }
    764800        else if (qualifier == EvqAttribute)
     
    10331069bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
    10341070{
    1035     TInfoSinkBase &out = mBody;
    1036 
    10371071    switch (node->getOp())
    10381072    {
     
    11111145bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
    11121146{
    1113     ShShaderType shaderType = mContext.shaderType;
    11141147    TInfoSinkBase &out = mBody;
    11151148
     
    12531286        }
    12541287        break;
    1255       case EOpComma:            outputTriplet(visit, "", ", ", "");                break;
     1288      case EOpComma:            outputTriplet(visit, "(", ", ", ")");                break;
    12561289      case EOpFunction:
    12571290        {
     
    12801313                    if (symbol)
    12811314                    {
     1315                        if (symbol->getType().getStruct())
     1316                        {
     1317                            addConstructor(symbol->getType(), scopedStruct(symbol->getType().getTypeName()), NULL);
     1318                        }
     1319
    12821320                        out << argumentString(symbol);
    12831321
     
    14981536      case EOpAtan:
    14991537        ASSERT(node->getSequence().size() == 2);   // atan(x) is a unary operator
    1500         mUsesAtan2 = true;
     1538        switch (node->getSequence()[0]->getAsTyped()->getNominalSize())
     1539        {
     1540          case 1: mUsesAtan2_1 = true; break;
     1541          case 2: mUsesAtan2_2 = true; break;
     1542          case 3: mUsesAtan2_3 = true; break;
     1543          case 4: mUsesAtan2_4 = true; break;
     1544          default: UNREACHABLE();
     1545        }
    15011546        outputTriplet(visit, "atanyx(", ", ", ")");
    15021547        break;
     
    15961641    if (node->getType() == ELoopDoWhile)
    15971642    {
    1598         out << "do\n";
     1643        out << "{do\n";
    15991644
    16001645        outputLineDirective(node->getLine());
     
    16031648    else
    16041649    {
    1605         out << "for(";
     1650        out << "{for(";
    16061651       
    16071652        if (node->getInit())
     
    16451690        node->getCondition()->traverse(this);
    16461691
    1647         out << ")";
    1648     }
    1649 
    1650     out << ";\n";
     1692        out << ");";
     1693    }
     1694
     1695    out << "}\n";
    16511696
    16521697    return false;
     
    18401885            while (iterations > 0)
    18411886            {
    1842                 int remainder = (limit - initial) % increment;
    18431887                int clampedLimit = initial + increment * std::min(255, iterations);
    18441888
     
    20202064          case EbtSamplerCube:
    20212065            return "samplerCUBE";
     2066          case EbtSamplerExternalOES:
     2067            return "sampler2D";
    20222068        }
    20232069    }
     
    20592105    {
    20602106        return;   // Nameless structures don't have constructors
     2107    }
     2108
     2109    if (type.getStruct() && mStructNames.find(decorate(name)) != mStructNames.end())
     2110    {
     2111        return;   // Already added
    20612112    }
    20622113
     
    23712422}
    23722423
    2373 TString OutputHLSL::decorateUniform(const TString &string, bool array)
    2374 {
    2375     if (array)
     2424TString OutputHLSL::decorateUniform(const TString &string, const TType &type)
     2425{
     2426    if (type.isArray())
    23762427    {
    23772428        return "ar_" + string;   // Allows identifying arrays of size 1
     2429    }
     2430    else if (type.getBasicType() == EbtSamplerExternalOES)
     2431    {
     2432        return "ex_" + string;
    23782433    }
    23792434   
  • trunk/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    3333    static TString initializer(const TType &type);
    3434    static TString decorate(const TString &string);                      // Prepends an underscore to avoid naming clashes
    35     static TString decorateUniform(const TString &string, bool array);
     35    static TString decorateUniform(const TString &string, const TType &type);
    3636
    3737  protected:
     
    114114    bool mUsesEqualBVec3;
    115115    bool mUsesEqualBVec4;
    116     bool mUsesAtan2;
     116    bool mUsesAtan2_1;
     117    bool mUsesAtan2_2;
     118    bool mUsesAtan2_3;
     119    bool mUsesAtan2_4;
    117120
    118121    typedef std::set<TString> Constructors;
  • trunk/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp

    r95901 r112300  
    158158
    159159            // We don't print the assert message.  It's here just to be helpful.
    160             sprintf(assertMsg, "PoolAlloc: Damage %s %lu byte allocation at 0x%p\n",
     160#if defined(_MSC_VER)
     161            sprintf(assertMsg, "PoolAlloc: Damage %s %Iu byte allocation at 0x%p\n",
    161162                    locText, size, data());
     163#else
     164            sprintf(assertMsg, "PoolAlloc: Damage %s %zu byte allocation at 0x%p\n",
     165                    locText, size, data());
     166#endif
    162167            assert(0 && "PoolAlloc: Damage in guard block");
    163168        }
  • trunk/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    2323#include "compiler/VariableInfo.h"
    2424
     25class LongNameMap;
    2526class TCompiler;
    2627
     
    101102    TVariableInfoList uniforms;  // Active uniforms in the compiled shader.
    102103
    103     // Pair of long varying varibale name <originalName, mappedName>.
    104     std::map<std::string, std::string> varyingLongNameMap;
     104    // Cached copy of the ref-counted singleton.
     105    LongNameMap* longNameMap;
    105106};
    106107
  • trunk/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp

    r104363 r112300  
    99// are documented in the header file.
    1010//
     11
     12#if defined(_MSC_VER)
     13#pragma warning(disable: 4718)
     14#endif
    1115
    1216#include "compiler/SymbolTable.h"
  • trunk/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h

    r95901 r112300  
    303303        return table[1];
    304304    }
     305
     306    TSymbolTableLevel* getOuterLevel() {
     307        assert(table.size() >= 2);
     308        return table[currentLevel() - 1];
     309    }
     310
    305311    void relateToOperator(const char* name, TOperator op) {
    306312        table[0]->relateToOperator(name, op);
  • trunk/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp

    r104363 r112300  
    6464      case EbtSampler2D: return SH_SAMPLER_2D;
    6565      case EbtSamplerCube: return SH_SAMPLER_CUBE;
     66      case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
    6667      case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
    6768      default: UNREACHABLE();
  • trunk/Source/ThirdParty/ANGLE/src/compiler/glslang.l

    r104379 r112300  
    2222
    2323// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
     24
     25// Ignore errors in auto-generated code.
     26#if defined(__GNUC__)
     27#pragma GCC diagnostic ignored "-Wunused-function"
     28#pragma GCC diagnostic ignored "-Wunused-variable"
     29#pragma GCC diagnostic ignored "-Wswitch-enum"
     30#elif defined(_MSC_VER)
     31#pragma warning(disable: 4065)
     32#pragma warning(disable: 4189)
     33#pragma warning(disable: 4505)
     34#pragma warning(disable: 4701)
     35#endif
    2436}
    2537
     
    484496                break;
    485497            default:
    486                 ;
     498                break;
    487499            }
    488500            return;
  • trunk/Source/ThirdParty/ANGLE/src/compiler/glslang.y

    r104363 r112300  
    2222
    2323// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
     24
     25// Ignore errors in auto-generated code.
     26#if defined(__GNUC__)
     27#pragma GCC diagnostic ignored "-Wunused-function"
     28#pragma GCC diagnostic ignored "-Wunused-variable"
     29#pragma GCC diagnostic ignored "-Wswitch-enum"
     30#elif defined(_MSC_VER)
     31#pragma warning(disable: 4065)
     32#pragma warning(disable: 4189)
     33#pragma warning(disable: 4505)
     34#pragma warning(disable: 4701)
     35#endif
    2436
    2537#include "compiler/SymbolTable.h"
     
    130142%type <interm.intermNode> for_init_statement compound_statement_no_new_scope
    131143%type <interm.nodePair> selection_rest_statement for_rest_statement
    132 %type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope
     144%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope statement_with_scope
    133145%type <interm> single_declaration init_declarator_list
    134146
     
    969981        prototype->setOp(EOpPrototype);
    970982        $$ = prototype;
     983
     984        context->symbolTable.pop();
    971985    }
    972986    | init_declarator_list SEMICOLON {
     
    10131027        $$.line = $2.line;
    10141028
    1015         context->symbolTable.insert(*$$.function);
     1029        // We're at the inner scope level of the function's arguments and body statement.
     1030        // Add the function prototype to the surrounding scope instead.
     1031        context->symbolTable.getOuterLevel()->insert(*$$.function);
    10161032    }
    10171033    ;
     
    10711087        function = new TFunction($2.string, type);
    10721088        $$ = function;
     1089       
     1090        context->symbolTable.push();
    10731091    }
    10741092    ;
     
    11721190    }
    11731191    | init_declarator_list COMMA IDENTIFIER {
     1192        if ($1.type.type == EbtInvariant && !$3.symbol)
     1193        {
     1194            context->error($3.line, "undeclared identifier declared as invariant", $3.string->c_str(), "");
     1195            context->recover();
     1196        }
     1197
    11741198        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line);
    11751199        $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, symbol, $3.line);
     
    13361360    | INVARIANT IDENTIFIER {
    13371361        VERTEX_ONLY("invariant declaration", $1.line);
    1338         $$.qualifier = EvqInvariantVaryingOut;
    1339         $$.intermAggregate = 0;
     1362        if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "invariant varying"))
     1363            context->recover();
     1364        $$.type.setBasic(EbtInvariant, EvqInvariantVaryingOut, $2.line);
     1365        if (!$2.symbol)
     1366        {
     1367            context->error($2.line, "undeclared identifier declared as invariant", $2.string->c_str(), "");
     1368            context->recover();
     1369           
     1370            $$.intermAggregate = 0;
     1371        }
     1372        else
     1373        {
     1374            TIntermSymbol *symbol = context->intermediate.addSymbol(0, *$2.string, TType($$.type), $2.line);
     1375            $$.intermAggregate = context->intermediate.makeAggregate(symbol, $2.line);
     1376        }
    13401377    }
    13411378
     
    18011838    ;
    18021839
     1840statement_with_scope
     1841    : { context->symbolTable.push(); } compound_statement_no_new_scope { context->symbolTable.pop(); $$ = $2; }
     1842    | { context->symbolTable.push(); } simple_statement                { context->symbolTable.pop(); $$ = $2; }
     1843    ;
     1844
    18031845compound_statement_no_new_scope
    18041846    // Statement that doesn't create a new scope, for selection_statement, iteration_statement
     
    18381880
    18391881selection_rest_statement
    1840     : statement ELSE statement {
     1882    : statement_with_scope ELSE statement_with_scope {
    18411883        $$.node1 = $1;
    18421884        $$.node2 = $3;
    18431885    }
    1844     | statement {
     1886    | statement_with_scope {
    18451887        $$.node1 = $1;
    18461888        $$.node2 = 0;
     
    18791921        --context->loopNestingLevel;
    18801922    }
    1881     | DO { ++context->loopNestingLevel; } statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
     1923    | DO { ++context->loopNestingLevel; } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
    18821924        if (context->boolErrorCheck($8.line, $6))
    18831925            context->recover();
     
    20142056            }
    20152057        }
    2016 
    2017         //
    2018         // New symbol table scope for body of function plus its arguments
    2019         //
    2020         context->symbolTable.push();
    20212058
    20222059        //
     
    20722109            context->recover();
    20732110        }
    2074         context->symbolTable.pop();
     2111       
    20752112        $$ = context->intermediate.growAggregate($1.intermAggregate, $3, 0);
    20762113        context->intermediate.setAggregateOperator($$, EOpFunction, $1.line);
     
    20862123        if ($3 && $3->getAsAggregate())
    20872124            $$->getAsAggregate()->setEndLine($3->getAsAggregate()->getEndLine());
     2125
     2126        context->symbolTable.pop();
    20882127    }
    20892128    ;
  • trunk/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp

    r104379 r112300  
    1 #line 17 "./compiler/glslang.l"
     1#line 17 "./glslang.l"
    22//
    33// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
     
    88// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
    99
    10 
    11 
    12 #line 13 "./compiler/glslang_lex.cpp"
     10// Ignore errors in auto-generated code.
     11#if defined(__GNUC__)
     12#pragma GCC diagnostic ignored "-Wunused-function"
     13#pragma GCC diagnostic ignored "-Wunused-variable"
     14#pragma GCC diagnostic ignored "-Wswitch-enum"
     15#elif defined(_MSC_VER)
     16#pragma warning(disable: 4065)
     17#pragma warning(disable: 4189)
     18#pragma warning(disable: 4505)
     19#pragma warning(disable: 4701)
     20#endif
     21
     22
     23
     24#line 25 "./glslang_lex.cpp"
    1325
    1426#define  YY_INT_ALIGNED short int
     
    180192#endif
    181193
    182 #ifndef YY_TYPEDEF_YY_SIZE_T
    183 #define YY_TYPEDEF_YY_SIZE_T
    184 typedef size_t yy_size_t;
    185 #endif
    186 
    187194#define EOB_ACT_CONTINUE_SCAN 0
    188195#define EOB_ACT_END_OF_FILE 1
     
    198205    #define  YY_LESS_LINENO(n) \
    199206            do { \
    200                 yy_size_t yyl;\
     207                int yyl;\
    201208                for ( yyl = n; yyl < yyleng; ++yyl )\
    202209                    if ( yytext[yyl] == '\n' )\
     
    220227#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
    221228
     229#ifndef YY_TYPEDEF_YY_SIZE_T
     230#define YY_TYPEDEF_YY_SIZE_T
     231typedef size_t yy_size_t;
     232#endif
     233
    222234#ifndef YY_STRUCT_YY_BUFFER_STATE
    223235#define YY_STRUCT_YY_BUFFER_STATE
     
    237249         * characters.
    238250         */
    239         yy_size_t yy_n_chars;
     251        int yy_n_chars;
    240252
    241253        /* Whether we "own" the buffer - i.e., we know we created it,
     
    316328YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
    317329YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
    318 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
     330YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
    319331
    320332void *yyalloc (yy_size_t ,yyscan_t yyscanner );
     
    810822    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
    811823    char yy_hold_char;
    812     yy_size_t yy_n_chars;
    813     yy_size_t yyleng_r;
     824    int yy_n_chars;
     825    int yyleng_r;
    814826    char *yy_c_buf_p;
    815827    int yy_init;
     
    864876void yyset_out  (FILE * out_str ,yyscan_t yyscanner );
    865877
    866 yy_size_t yyget_leng (yyscan_t yyscanner );
     878int yyget_leng (yyscan_t yyscanner );
    867879
    868880char *yyget_text (yyscan_t yyscanner );
     
    18981910        else
    18991911                {
    1900                         yy_size_t num_to_read =
     1912                        int num_to_read =
    19011913                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
    19021914
     
    19121924                        if ( b->yy_is_our_buffer )
    19131925                                {
    1914                                 yy_size_t new_size = b->yy_buf_size * 2;
     1926                                int new_size = b->yy_buf_size * 2;
    19151927
    19161928                                if ( new_size <= 0 )
     
    19431955                /* Read in more data. */
    19441956                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
    1945                         yyg->yy_n_chars, num_to_read );
     1957                        yyg->yy_n_chars, (size_t) num_to_read );
    19461958
    19471959                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
     
    20682080                else
    20692081                        { /* need more input */
    2070                         yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
     2082                        int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
    20712083                        ++yyg->yy_c_buf_p;
    20722084
     
    20922104                                        {
    20932105                                        if ( yywrap(yyscanner ) )
    2094                                                 return 0;
     2106                                                return EOF;
    20952107
    20962108                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
     
    23552367static void yyensure_buffer_stack (yyscan_t yyscanner)
    23562368{
    2357         yy_size_t num_to_alloc;
     2369        int num_to_alloc;
    23582370    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
    23592371
     
    24532465 * @return the newly allocated buffer state object.
    24542466 */
    2455 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
     2467YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
    24562468{
    24572469        YY_BUFFER_STATE b;
    24582470        char *buf;
    2459         yy_size_t n, i;
     2471        yy_size_t n;
     2472        int i;
    24602473   
    24612474        /* Get memory for full buffer, including space for trailing EOB's. */
     
    26072620 * @param yyscanner The scanner object.
    26082621 */
    2609 yy_size_t yyget_leng  (yyscan_t yyscanner)
     2622int yyget_leng  (yyscan_t yyscanner)
    26102623{
    26112624    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     
    31173130                break;
    31183131            default:
    3119                 ;
     3132                break;
    31203133            }
    31213134            return;
  • trunk/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp

    r104379 r112300  
    264264
    265265//
    266 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     266// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    267267// Use of this source code is governed by a BSD-style license that can be
    268268// found in the LICENSE file.
     
    270270
    271271// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
     272
     273// Ignore errors in auto-generated code.
     274#if defined(__GNUC__)
     275#pragma GCC diagnostic ignored "-Wunused-function"
     276#pragma GCC diagnostic ignored "-Wunused-variable"
     277#pragma GCC diagnostic ignored "-Wswitch-enum"
     278#elif defined(_MSC_VER)
     279#pragma warning(disable: 4065)
     280#pragma warning(disable: 4189)
     281#pragma warning(disable: 4505)
     282#pragma warning(disable: 4701)
     283#endif
    272284
    273285#include "compiler/SymbolTable.h"
     
    585597#define YYFINAL  71
    586598/* YYLAST -- Last index in YYTABLE.  */
    587 #define YYLAST   1370
     599#define YYLAST   1416
    588600
    589601/* YYNTOKENS -- Number of terminals.  */
    590602#define YYNTOKENS  96
    591603/* YYNNTS -- Number of nonterminals.  */
    592 #define YYNNTS  80
     604#define YYNNTS  83
    593605/* YYNRULES -- Number of rules.  */
    594 #define YYNRULES  197
     606#define YYNRULES  201
    595607/* YYNRULES -- Number of states.  */
    596 #define YYNSTATES  300
     608#define YYNSTATES  304
    597609
    598610/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
     
    665677     392,   393,   399,   401,   404,   408,   410,   414,   416,   421,
    666678     423,   425,   427,   429,   431,   433,   435,   437,   439,   442,
    667      443,   444,   450,   452,   454,   457,   461,   463,   466,   468,
    668      471,   477,   481,   483,   485,   490,   491,   498,   499,   508,
    669      509,   517,   519,   521,   523,   524,   527,   531,   534,   537,
    670      540,   544,   547,   549,   552,   554,   556,   557
     679     443,   444,   450,   452,   454,   455,   458,   459,   462,   465,
     680     469,   471,   474,   476,   479,   485,   489,   491,   493,   498,
     681     499,   506,   507,   516,   517,   525,   527,   529,   531,   532,
     682     535,   539,   542,   545,   548,   552,   555,   557,   560,   562,
     683     564,   565
    671684};
    672685
     
    674687static const yytype_int16 yyrhs[] =
    675688{
    676      172,     0,    -1,    45,    -1,    97,    -1,    48,    -1,    47,
     689     175,     0,    -1,    45,    -1,    97,    -1,    48,    -1,    47,
    677690      -1,    49,    -1,    72,   124,    73,    -1,    98,    -1,    99,
    678691      74,   100,    75,    -1,   101,    -1,    99,    78,    50,    -1,
     
    717730     148,    79,   149,    -1,    45,    -1,    45,    74,   125,    75,
    718731      -1,   122,    -1,   126,    -1,   154,    -1,   153,    -1,   151,
    719       -1,   160,    -1,   161,    -1,   164,    -1,   171,    -1,    76,
    720       77,    -1,    -1,    -1,    76,   155,   159,   156,    77,    -1,
    721      158,    -1,   153,    -1,    76,    77,    -1,    76,   159,    77,
    722       -1,   152,    -1,   159,   152,    -1,    82,    -1,   124,    82,
    723       -1,    18,    72,   124,    73,   162,    -1,   152,    16,   152,
    724       -1,   152,    -1,   124,    -1,   137,    45,    81,   150,    -1,
    725       -1,    40,    72,   165,   163,    73,   157,    -1,    -1,    15,
    726      166,   152,    40,    72,   124,    73,    82,    -1,    -1,    17,
    727       72,   167,   168,   170,    73,   157,    -1,   160,    -1,   151,
    728       -1,   163,    -1,    -1,   169,    82,    -1,   169,    82,   124,
    729       -1,    14,    82,    -1,    13,    82,    -1,    20,    82,    -1,
    730       20,   124,    82,    -1,    19,    82,    -1,   173,    -1,   172,
    731      173,    -1,   174,    -1,   126,    -1,    -1,   127,   175,   158,
    732       -1
     732      -1,   163,    -1,   164,    -1,   167,    -1,   174,    -1,    76,
     733      77,    -1,    -1,    -1,    76,   155,   162,   156,    77,    -1,
     734     161,    -1,   153,    -1,    -1,   159,   161,    -1,    -1,   160,
     735     153,    -1,    76,    77,    -1,    76,   162,    77,    -1,   152,
     736      -1,   162,   152,    -1,    82,    -1,   124,    82,    -1,    18,
     737      72,   124,    73,   165,    -1,   158,    16,   158,    -1,   158,
     738      -1,   124,    -1,   137,    45,    81,   150,    -1,    -1,    40,
     739      72,   168,   166,    73,   157,    -1,    -1,    15,   169,   158,
     740      40,    72,   124,    73,    82,    -1,    -1,    17,    72,   170,
     741     171,   173,    73,   157,    -1,   163,    -1,   151,    -1,   166,
     742      -1,    -1,   172,    82,    -1,   172,    82,   124,    -1,    14,
     743      82,    -1,    13,    82,    -1,    20,    82,    -1,    20,   124,
     744      82,    -1,    19,    82,    -1,   176,    -1,   175,   176,    -1,
     745     177,    -1,   126,    -1,    -1,   127,   178,   161,    -1
    733746};
    734747
     
    736749static const yytype_uint16 yyrline[] =
    737750{
    738        0,   153,   153,   188,   191,   204,   209,   214,   220,   223,
    739      296,   299,   408,   418,   431,   439,   538,   541,   549,   553,
    740      560,   564,   571,   577,   586,   594,   649,   656,   666,   669,
    741      679,   689,   710,   711,   712,   717,   718,   727,   739,   740,
    742      748,   759,   763,   764,   774,   784,   794,   807,   808,   818,
    743      831,   835,   839,   843,   844,   857,   858,   871,   872,   885,
    744      886,   903,   904,   917,   918,   919,   920,   921,   925,   928,
    745      939,   947,   972,   977,   984,  1020,  1023,  1030,  1038,  1059,
    746     1078,  1089,  1118,  1123,  1133,  1138,  1148,  1151,  1154,  1157,
    747     1163,  1170,  1173,  1189,  1207,  1231,  1254,  1258,  1276,  1284,
    748     1316,  1336,  1412,  1421,  1444,  1447,  1453,  1461,  1469,  1477,
    749     1487,  1494,  1497,  1500,  1506,  1509,  1524,  1528,  1532,  1536,
    750     1545,  1550,  1555,  1560,  1565,  1570,  1575,  1580,  1585,  1590,
    751     1596,  1602,  1608,  1613,  1618,  1627,  1636,  1641,  1654,  1654,
    752     1668,  1668,  1677,  1680,  1695,  1731,  1735,  1741,  1749,  1765,
    753     1769,  1773,  1774,  1780,  1781,  1782,  1783,  1784,  1788,  1789,
    754     1789,  1789,  1799,  1800,  1805,  1808,  1818,  1821,  1827,  1828,
    755     1832,  1840,  1844,  1854,  1859,  1876,  1876,  1881,  1881,  1888,
    756     1888,  1896,  1899,  1905,  1908,  1914,  1918,  1925,  1932,  1939,
    757     1946,  1957,  1966,  1970,  1977,  1980,  1986,  1986
     751       0,   165,   165,   200,   203,   216,   221,   226,   232,   235,
     752     308,   311,   420,   430,   443,   451,   550,   553,   561,   565,
     753     572,   576,   583,   589,   598,   606,   661,   668,   678,   681,
     754     691,   701,   722,   723,   724,   729,   730,   739,   751,   752,
     755     760,   771,   775,   776,   786,   796,   806,   819,   820,   830,
     756     843,   847,   851,   855,   856,   869,   870,   883,   884,   897,
     757     898,   915,   916,   929,   930,   931,   932,   933,   937,   940,
     758     951,   959,   986,   991,   998,  1036,  1039,  1046,  1054,  1075,
     759    1096,  1107,  1136,  1141,  1151,  1156,  1166,  1169,  1172,  1175,
     760    1181,  1188,  1191,  1213,  1231,  1255,  1278,  1282,  1300,  1308,
     761    1340,  1360,  1449,  1458,  1481,  1484,  1490,  1498,  1506,  1514,
     762    1524,  1531,  1534,  1537,  1543,  1546,  1561,  1565,  1569,  1573,
     763    1582,  1587,  1592,  1597,  1602,  1607,  1612,  1617,  1622,  1627,
     764    1633,  1639,  1645,  1650,  1655,  1664,  1673,  1678,  1691,  1691,
     765    1705,  1705,  1714,  1717,  1732,  1768,  1772,  1778,  1786,  1802,
     766    1806,  1810,  1811,  1817,  1818,  1819,  1820,  1821,  1825,  1826,
     767    1826,  1826,  1836,  1837,  1841,  1841,  1842,  1842,  1847,  1850,
     768    1860,  1863,  1869,  1870,  1874,  1882,  1886,  1896,  1901,  1918,
     769    1918,  1923,  1923,  1930,  1930,  1938,  1941,  1947,  1950,  1956,
     770    1960,  1967,  1974,  1981,  1988,  1999,  2008,  2012,  2019,  2022,
     771    2028,  2028
    758772};
    759773#endif
     
    803817  "declaration_statement", "statement", "simple_statement",
    804818  "compound_statement", "@3", "@4", "statement_no_new_scope",
    805   "compound_statement_no_new_scope", "statement_list",
    806   "expression_statement", "selection_statement",
    807   "selection_rest_statement", "condition", "iteration_statement", "@5",
    808   "@6", "@7", "for_init_statement", "conditionopt", "for_rest_statement",
     819  "statement_with_scope", "@5", "@6", "compound_statement_no_new_scope",
     820  "statement_list", "expression_statement", "selection_statement",
     821  "selection_rest_statement", "condition", "iteration_statement", "@7",
     822  "@8", "@9", "for_init_statement", "conditionopt", "for_rest_statement",
    809823  "jump_statement", "translation_unit", "external_declaration",
    810   "function_definition", "@8", 0
     824  "function_definition", "@10", 0
    811825};
    812826#endif
     
    849863     145,   143,   146,   146,   147,   148,   148,   149,   149,   150,
    850864     151,   152,   152,   153,   153,   153,   153,   153,   154,   155,
    851      156,   154,   157,   157,   158,   158,   159,   159,   160,   160,
    852      161,   162,   162,   163,   163,   165,   164,   166,   164,   167,
    853      164,   168,   168,   169,   169,   170,   170,   171,   171,   171,
    854      171,   171,   172,   172,   173,   173,   175,   174
     865     156,   154,   157,   157,   159,   158,   160,   158,   161,   161,
     866     162,   162,   163,   163,   164,   165,   165,   166,   166,   168,
     867     167,   169,   167,   170,   167,   171,   171,   172,   172,   173,
     868     173,   174,   174,   174,   174,   174,   175,   175,   176,   176,
     869     178,   177
    855870};
    856871
     
    874889       0,     5,     1,     2,     3,     1,     3,     1,     4,     1,
    875890       1,     1,     1,     1,     1,     1,     1,     1,     2,     0,
    876        0,     5,     1,     1,     2,     3,     1,     2,     1,     2,
    877        5,     3,     1,     1,     4,     0,     6,     0,     8,     0,
    878        7,     1,     1,     1,     0,     2,     3,     2,     2,     2,
    879        3,     2,     1,     2,     1,     1,     0,     3
     891       0,     5,     1,     1,     0,     2,     0,     2,     2,     3,
     892       1,     2,     1,     2,     5,     3,     1,     1,     4,     0,
     893       6,     0,     8,     0,     7,     1,     1,     1,     0,     2,
     894       3,     2,     2,     2,     3,     2,     1,     2,     1,     1,
     895       0,     3
    880896};
    881897
     
    888904     118,   123,   124,   125,   126,   127,   128,   120,   121,   122,
    889905     129,   130,   131,   108,   106,     0,   116,   132,   133,   134,
    890      135,   137,   195,   196,     0,    76,    86,     0,    91,    96,
    891        0,   102,     0,   109,   114,   136,     0,   192,   194,   107,
     906     135,   137,   199,   200,     0,    76,    86,     0,    91,    96,
     907       0,   102,     0,   109,   114,   136,     0,   196,   198,   107,
    892908     101,     0,     0,   140,    71,     0,    74,    86,     0,    87,
    893909      88,    89,    77,     0,    86,     0,    72,    97,   103,   110,
    894        0,     1,   193,     0,   138,     0,     0,   197,    78,    83,
     910       0,     1,   197,     0,   138,     0,     0,   201,    78,    83,
    895911      85,    90,     0,    92,    79,     0,     0,     2,     5,     4,
    896912       6,    27,     0,     0,     0,    34,    33,    32,     3,     8,
     
    898914      38,    41,    42,    47,    50,    51,    52,    53,    55,    57,
    899915      59,    70,     0,    25,    73,     0,     0,     0,   142,     0,
    900        0,   177,     0,     0,     0,     0,     0,   159,   164,   168,
    901       35,    61,    68,     0,   150,     0,   114,   153,   166,   152,
     916       0,   181,     0,     0,     0,     0,     0,   159,   168,   172,
     917      35,    61,    68,     0,   150,     0,   114,   153,   170,   152,
    902918     151,     0,   154,   155,   156,   157,    80,    82,    84,     0,
    903919       0,    98,     0,   149,   100,    29,    30,     0,    12,    13,
     
    905921       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    906922       0,     0,     0,   115,     0,   147,     0,   145,   141,   143,
    907      188,   187,     0,   179,     0,   191,   189,     0,   175,   158,
    908        0,    64,    65,    66,    67,    63,     0,     0,   169,   165,
    909      167,     0,    93,     0,    95,    99,     7,     0,    14,    26,
     923     192,   191,   166,   183,     0,   195,   193,     0,   179,   158,
     924       0,    64,    65,    66,    67,    63,     0,     0,   173,   169,
     925     171,     0,    93,     0,    95,    99,     7,     0,    14,    26,
    910926      11,    17,    23,    36,    37,    40,    39,    45,    46,    43,
    911927      44,    48,    49,    54,    56,    58,     0,   139,     0,     0,
    912      144,     0,     0,     0,   190,     0,   160,    62,    69,     0,
    913       94,     9,     0,     0,   146,     0,   182,   181,   184,     0,
    914      173,     0,     0,     0,    81,    60,   148,     0,   183,     0,
    915        0,   172,   170,     0,     0,   161,     0,   185,     0,     0,
    916        0,   163,   176,   162,     0,   186,   180,   171,   174,   178
     928     144,     0,     0,     0,     0,     0,   194,     0,   160,    62,
     929      69,     0,    94,     9,     0,     0,   146,     0,   165,   167,
     930     186,   185,   188,   166,   177,     0,     0,     0,    81,    60,
     931     148,     0,   187,     0,     0,   176,   174,     0,     0,   161,
     932       0,   189,     0,   166,     0,   163,   180,   162,     0,   190,
     933     184,   175,   178,   182
    917934};
    918935
     
    926943      38,    39,    40,    41,    42,    43,   123,    45,   125,    75,
    927944     127,   128,   196,   197,   164,   147,   148,   149,   150,   210,
    928      273,   292,   293,   151,   152,   153,   282,   272,   154,   255,
    929      202,   252,   268,   279,   280,   155,    46,    47,    48,    55
     945     277,   296,   251,   252,   253,   297,   151,   152,   153,   286,
     946     276,   154,   257,   202,   254,   272,   283,   284,   155,    46,
     947      47,    48,    55
    930948};
    931949
    932950/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    933951   STATE-NUM.  */
    934 #define YYPACT_NINF -251
     952#define YYPACT_NINF -266
    935953static const yytype_int16 yypact[] =
    936954{
    937     1250,   -17,  -251,  -251,  -251,   113,  -251,  -251,  -251,  -251,
    938     -251,  -251,  -251,  -251,  -251,  -251,  -251,  -251,  -251,  -251,
    939     -251,  -251,  -251,  -251,  -251,   -39,  -251,  -251,  -251,  -251,
    940     -251,  -251,  -251,   -65,   -34,   -10,    21,   -32,  -251,    28,
    941      207,  -251,  1324,  -251,    56,  -251,  1206,  -251,  -251,  -251,
    942     -251,  1324,    74,  -251,  -251,    86,  -251,    71,    95,  -251,
    943     -251,  -251,  -251,   207,   119,   120,  -251,   -56,  -251,  -251,
    944      971,  -251,  -251,    84,  -251,   207,   287,  -251,  -251,  -251,
    945     -251,   124,   207,   -59,  -251,   773,   971,    98,  -251,  -251,
    946     -251,  -251,   971,   971,   971,  -251,  -251,  -251,  -251,  -251,
    947       35,  -251,  -251,  -251,   100,    -9,  1037,   102,  -251,   971,
    948      -27,    -1,  -251,   -24,    99,  -251,  -251,  -251,   112,   111,
    949      -51,  -251,   103,  -251,  -251,   207,   135,  1106,  -251,   101,
    950      104,  -251,   109,   115,   106,   839,   117,   107,  -251,  -251,
    951       39,  -251,  -251,   -11,  -251,   -65,    54,  -251,  -251,  -251,
    952     -251,   371,  -251,  -251,  -251,  -251,   116,  -251,  -251,   905,
    953      971,  -251,   118,  -251,  -251,  -251,  -251,     8,  -251,  -251,
    954      971,  1287,  -251,  -251,   971,   125,  -251,  -251,  -251,   971,
    955      971,   971,   971,   971,   971,   971,   971,   971,   971,   971,
    956      971,   971,   971,  -251,  1149,   122,    17,  -251,  -251,  -251,
    957     -251,  -251,   455,  -251,   971,  -251,  -251,    32,  -251,  -251,
    958      455,  -251,  -251,  -251,  -251,  -251,   971,   971,  -251,  -251,
    959     -251,   971,  -251,   123,  -251,  -251,  -251,   126,   121,  -251,
    960      127,  -251,  -251,  -251,  -251,   -27,   -27,  -251,  -251,  -251,
    961     -251,   -24,   -24,  -251,   112,   111,    79,  -251,   971,   135,
    962     -251,   151,   623,    11,  -251,   707,   455,  -251,  -251,   128,
    963     -251,  -251,   971,   130,  -251,   134,  -251,  -251,   707,   455,
    964      121,   147,   136,   131,  -251,  -251,  -251,   971,  -251,   132,
    965      142,   200,  -251,   139,   539,  -251,    19,   971,   539,   455,
    966      971,  -251,  -251,  -251,   140,   121,  -251,  -251,  -251,  -251
     955    1253,   -20,  -266,  -266,  -266,   148,  -266,  -266,  -266,  -266,
     956    -266,  -266,  -266,  -266,  -266,  -266,  -266,  -266,  -266,  -266,
     957    -266,  -266,  -266,  -266,  -266,   -39,  -266,  -266,  -266,  -266,
     958    -266,  -266,  -266,   -18,    -2,     6,    21,   -61,  -266,    51,
     959    1296,  -266,  1370,  -266,    25,  -266,  1209,  -266,  -266,  -266,
     960    -266,  1370,    42,  -266,  -266,    50,  -266,    71,    95,  -266,
     961    -266,  -266,  -266,  1296,   123,   105,  -266,     9,  -266,  -266,
     962     974,  -266,  -266,    81,  -266,  1296,   290,  -266,  -266,  -266,
     963    -266,   125,  1296,   -13,  -266,   776,   974,    99,  -266,  -266,
     964    -266,  -266,   974,   974,   974,  -266,  -266,  -266,  -266,  -266,
     965      35,  -266,  -266,  -266,   100,    -6,  1040,   104,  -266,   974,
     966      36,   -64,  -266,   -21,   102,  -266,  -266,  -266,   113,   117,
     967     -51,  -266,   108,  -266,  -266,  1296,   129,  1109,  -266,    97,
     968     103,  -266,   112,   114,   106,   842,   115,   116,  -266,  -266,
     969      39,  -266,  -266,   -43,  -266,   -18,    47,  -266,  -266,  -266,
     970    -266,   374,  -266,  -266,  -266,  -266,   118,  -266,  -266,   908,
     971     974,  -266,   120,  -266,  -266,  -266,  -266,    19,  -266,  -266,
     972     974,  1333,  -266,  -266,   974,   119,  -266,  -266,  -266,   974,
     973     974,   974,   974,   974,   974,   974,   974,   974,   974,   974,
     974     974,   974,   974,  -266,  1152,   122,   -29,  -266,  -266,  -266,
     975    -266,  -266,   121,  -266,   974,  -266,  -266,     5,  -266,  -266,
     976     458,  -266,  -266,  -266,  -266,  -266,   974,   974,  -266,  -266,
     977    -266,   974,  -266,   137,  -266,  -266,  -266,   138,   111,  -266,
     978     142,  -266,  -266,  -266,  -266,    36,    36,  -266,  -266,  -266,
     979    -266,   -21,   -21,  -266,   113,   117,    82,  -266,   974,   129,
     980    -266,   175,    50,   626,   710,    38,  -266,   197,   458,  -266,
     981    -266,   141,  -266,  -266,   974,   155,  -266,   145,  -266,  -266,
     982    -266,  -266,   197,   121,   111,   186,   159,   160,  -266,  -266,
     983    -266,   974,  -266,   166,   176,   236,  -266,   174,   542,  -266,
     984      43,   974,   542,   121,   974,  -266,  -266,  -266,   177,   111,
     985    -266,  -266,  -266,  -266
    967986};
    968987
     
    970989static const yytype_int16 yypgoto[] =
    971990{
    972     -251,  -251,  -251,  -251,  -251,  -251,  -251,    50,  -251,  -251,
    973     -251,  -251,   -44,  -251,   -21,  -251,   -62,   -20,  -251,  -251,
    974     -251,    34,    36,    33,  -251,   -66,   -83,  -251,   -92,   -73,
    975        7,    13,  -251,  -251,  -251,   143,   170,   176,   159,  -251,
    976     -251,  -247,   -22,   -30,   237,   -15,     0,  -251,  -251,  -251,
    977      129,  -122,  -251,    -6,  -159,    -8,  -140,  -250,  -251,  -251,
    978     -251,   -41,   202,    48,     9,  -251,  -251,    -5,  -251,  -251,
    979     -251,  -251,  -251,  -251,  -251,  -251,  -251,   213,  -251,  -251
     991    -266,  -266,  -266,  -266,  -266,  -266,  -266,    85,  -266,  -266,
     992    -266,  -266,   -44,  -266,   -15,  -266,   -55,   -19,  -266,  -266,
     993    -266,    72,    70,    73,  -266,   -66,   -83,  -266,   -92,   -73,
     994      13,    14,  -266,  -266,  -266,   180,   206,   201,   184,  -266,
     995    -266,  -241,   -25,   -30,   262,    -4,     0,  -266,  -266,  -266,
     996     143,  -122,  -266,    22,  -145,    16,  -144,  -226,  -266,  -266,
     997    -266,   -17,  -265,  -266,  -266,   -54,    63,    20,  -266,  -266,
     998       4,  -266,  -266,  -266,  -266,  -266,  -266,  -266,  -266,  -266,
     999     231,  -266,  -266
    9801000};
    9811001
     
    9841004   number is the opposite.  If zero, do what YYDEFACT says.
    9851005   If YYTABLE_NINF, syntax error.  */
    986 #define YYTABLE_NINF -117
     1006#define YYTABLE_NINF -165
    9871007static const yytype_int16 yytable[] =
    9881008{
    989       44,   224,   167,   163,   121,   199,    52,    32,   271,   191,
    990       68,   220,   162,    33,    64,   159,    84,    54,    85,   121,
    991       49,   271,   160,   176,    58,    86,   108,    69,    50,     6,
    992        7,   183,   184,    81,   291,    64,    73,    53,   291,    56,
    993       44,   108,    44,   207,   192,   126,    44,    65,   165,   166,
    994       66,    44,    81,    32,    59,    60,    61,    23,    24,    33,
    995      179,   180,   251,    44,   173,   178,   185,   186,   217,    57,
    996      174,   218,   199,    67,    58,    44,   146,   163,   228,     6,
    997        7,   226,    44,   181,   269,   182,   223,   217,   168,   169,
    998      217,   232,   294,   121,   -75,   126,   249,   126,   217,   250,
     1009      44,    77,   167,   163,   121,   199,    52,   220,   285,   191,
     1010      68,    64,   162,    32,    33,   224,   275,    49,    65,   121,
     1011     181,    66,   182,   176,    58,    50,   108,   269,   301,     6,
     1012       7,   275,    64,    81,   183,   184,   217,    53,    69,   218,
     1013      44,   108,    44,   207,   192,   126,    44,    73,   165,   166,
     1014     249,    44,    81,   250,    59,    60,    61,    23,    24,    32,
     1015      33,   159,   295,    44,    54,   178,   295,   173,   160,   185,
     1016     186,    56,   199,   174,    58,    44,   146,   163,   228,     6,
     1017       7,    84,    44,    85,   217,    57,   223,   256,   168,   169,
     1018      86,   232,   226,   121,   -75,   126,    67,   126,   217,    70,
    9991019     246,   211,   212,   213,    59,    60,    61,    23,    24,   170,
    1000      214,   217,   253,   171,   254,   108,   220,     2,     3,     4,
    1001      215,   237,   238,   239,   240,    44,   -25,    44,    70,   281,
    1002       70,   298,    49,   257,   258,   233,   234,   108,   108,   108,
    1003      108,   108,   108,   108,   108,   108,   108,   108,   259,   297,
    1004       74,   146,    59,    60,    61,   121,   187,   188,   217,   262,
    1005      235,   236,    76,   270,   126,    83,   124,   241,   242,   156,
    1006      -26,   189,   190,   172,   177,   263,   270,   108,   193,   275,
    1007      195,   203,   121,   200,   209,   286,   201,   204,   205,   208,
    1008      221,   265,   283,   225,    44,   295,   248,  -116,   260,   -27,
    1009      217,   261,   146,   274,   108,   276,   277,   163,   285,   284,
    1010      146,     2,     3,     4,   287,   288,   289,     8,     9,    10,
    1011      290,   231,   299,   243,   245,   157,   244,    78,    11,    12,
     1020     214,   273,   255,   171,   220,   108,   298,   217,    74,   -25,
     1021     215,    70,   217,   179,   180,    44,    76,    44,   237,   238,
     1022     239,   240,    49,   259,   260,   233,   234,   108,   108,   108,
     1023     108,   108,   108,   108,   108,   108,   108,   108,   261,   302,
     1024      83,   146,     2,     3,     4,   121,    59,    60,    61,   187,
     1025     188,   217,   264,   124,   126,   274,   235,   236,   241,   242,
     1026     156,   -26,   189,   172,   195,   265,   177,   108,   190,   200,
     1027     274,   279,   121,   193,   203,   201,   204,   208,   205,   290,
     1028     217,  -116,   221,   209,    44,   225,   248,  -164,   268,   299,
     1029      58,     2,     3,     4,   108,     6,     7,     8,     9,    10,
     1030     146,   163,   262,   263,   -27,   267,   278,   281,    11,    12,
    10121031      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
    1013       82,   158,    51,   264,   266,    25,    26,   296,    27,    28,
    1014       29,    30,   146,    31,   194,   146,   146,    77,   256,    72,
    1015        0,   267,     0,   278,     0,     0,     0,     0,   146,   146,
     1032     280,   287,   288,    23,    24,    25,    26,   289,    27,    28,
     1033      29,    30,    87,    31,    88,    89,    90,    91,   291,   292,
     1034      92,    93,   293,   146,   146,   294,   231,   146,   146,   303,
     1035     244,   243,   157,    78,   245,    82,   158,    51,   194,    94,
     1036     270,   266,   146,   258,   271,   300,   282,    72,     0,     0,
     1037      95,    96,     0,    97,     0,     0,     0,     0,   146,     0,
     1038       0,     0,   146,     1,     2,     3,     4,     5,     6,     7,
     1039       8,     9,    10,   129,   130,   131,     0,   132,   133,   134,
     1040     135,    11,    12,    13,    14,    15,    16,    17,    18,    19,
     1041      20,    21,    22,     0,     0,     0,    23,    24,    25,    26,
     1042     136,    27,    28,    29,    30,    87,    31,    88,    89,    90,
     1043      91,     0,     0,    92,    93,     0,     0,     0,     0,     0,
    10161044       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1017        0,     0,     0,     0,   146,     0,     0,     0,   146,   146,
    1018        1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
    1019      129,   130,   131,     0,   132,   133,   134,   135,    11,    12,
    1020       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
    1021        0,     0,     0,    23,    24,    25,    26,   136,    27,    28,
    1022       29,    30,    87,    31,    88,    89,    90,    91,     0,     0,
    1023       92,    93,     0,     0,     0,     0,     0,     0,     0,     0,
    1024        0,     0,     0,     0,     0,     0,     0,     0,     0,    94,
    1025        0,     0,     0,   137,   138,     0,     0,     0,     0,   139,
    1026       95,    96,     0,    97,     1,     2,     3,     4,     5,     6,
    1027        7,     8,     9,    10,   129,   130,   131,     0,   132,   133,
    1028      134,   135,    11,    12,    13,    14,    15,    16,    17,    18,
    1029       19,    20,    21,    22,     0,     0,     0,    23,    24,    25,
    1030       26,   136,    27,    28,    29,    30,    87,    31,    88,    89,
    1031       90,    91,     0,     0,    92,    93,     0,     0,     0,     0,
     1045       0,     0,    94,     0,     0,     0,   137,   138,     0,     0,
     1046       0,     0,   139,    95,    96,     0,    97,     1,     2,     3,
     1047       4,     5,     6,     7,     8,     9,    10,   129,   130,   131,
     1048       0,   132,   133,   134,   135,    11,    12,    13,    14,    15,
     1049      16,    17,    18,    19,    20,    21,    22,     0,     0,     0,
     1050      23,    24,    25,    26,   136,    27,    28,    29,    30,    87,
     1051      31,    88,    89,    90,    91,     0,     0,    92,    93,     0,
    10321052       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1033        0,     0,     0,    94,     0,     0,     0,   137,   219,     0,
    1034        0,     0,     0,   139,    95,    96,     0,    97,     1,     2,
    1035        3,     4,     5,     6,     7,     8,     9,    10,   129,   130,
    1036      131,     0,   132,   133,   134,   135,    11,    12,    13,    14,
    1037       15,    16,    17,    18,    19,    20,    21,    22,     0,     0,
    1038        0,    23,    24,    25,    26,   136,    27,    28,    29,    30,
    1039       87,    31,    88,    89,    90,    91,     0,     0,    92,    93,
     1053       0,     0,     0,     0,     0,     0,    94,     0,     0,     0,
     1054     137,   219,     0,     0,     0,     0,   139,    95,    96,     0,
     1055      97,     1,     2,     3,     4,     5,     6,     7,     8,     9,
     1056      10,   129,   130,   131,     0,   132,   133,   134,   135,    11,
     1057      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
     1058      22,     0,     0,     0,    23,    24,    25,    26,   136,    27,
     1059      28,    29,    30,    87,    31,    88,    89,    90,    91,     0,
     1060       0,    92,    93,     0,     0,     0,     0,     0,     0,     0,
    10401061       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1041        0,     0,     0,     0,     0,     0,     0,    94,     0,     0,
    1042        0,   137,     0,     0,     0,     0,     0,   139,    95,    96,
    1043        0,    97,     1,     2,     3,     4,     5,     6,     7,     8,
    1044        9,    10,   129,   130,   131,     0,   132,   133,   134,   135,
     1062      94,     0,     0,     0,   137,     0,     0,     0,     0,     0,
     1063     139,    95,    96,     0,    97,     1,     2,     3,     4,     5,
     1064       6,     7,     8,     9,    10,   129,   130,   131,     0,   132,
     1065     133,   134,   135,    11,    12,    13,    14,    15,    16,    17,
     1066      18,    19,    20,    21,    22,     0,     0,     0,    23,    24,
     1067      25,    26,   136,    27,    28,    29,    30,    87,    31,    88,
     1068      89,    90,    91,     0,     0,    92,    93,     0,     0,     0,
     1069       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1070       0,     0,     0,     0,    94,     0,     0,     0,    76,     0,
     1071       0,     0,     0,     0,   139,    95,    96,     0,    97,     1,
     1072       2,     3,     4,     5,     6,     7,     8,     9,    10,   129,
     1073     130,   131,     0,   132,   133,   134,   135,    11,    12,    13,
     1074      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
     1075       0,     0,    23,    24,    25,    26,   136,    27,    28,    29,
     1076      30,    87,    31,    88,    89,    90,    91,     0,     0,    92,
     1077      93,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1078       0,     0,     0,     0,     0,     0,     0,     0,    94,     0,
     1079       0,     0,     0,     0,     0,     0,     0,     0,   139,    95,
     1080      96,     0,    97,     1,     2,     3,     4,     5,     6,     7,
     1081       8,     9,    10,     0,     0,     0,     0,     0,     0,     0,
     1082       0,    11,    12,    13,    14,    15,    16,    17,    18,    19,
     1083      20,    21,    22,     0,     0,     0,    23,    24,    25,    26,
     1084       0,    27,    28,    29,    30,    87,    31,    88,    89,    90,
     1085      91,     0,     0,    92,    93,     0,     0,     0,     0,     0,
     1086       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1087       0,     0,    94,     0,     0,     0,     8,     9,    10,     0,
     1088       0,     0,   139,    95,    96,     0,    97,    11,    12,    13,
     1089      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
     1090       0,     0,     0,     0,    25,    26,     0,    27,    28,    29,
     1091      30,    87,    31,    88,    89,    90,    91,     0,     0,    92,
     1092      93,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1093       0,     0,     0,     0,     0,     0,     0,     0,    94,     0,
     1094       0,   161,     8,     9,    10,     0,     0,     0,     0,    95,
     1095      96,     0,    97,    11,    12,    13,    14,    15,    16,    17,
     1096      18,    19,    20,    21,    22,     0,     0,     0,     0,     0,
     1097      25,    26,     0,    27,    28,    29,    30,    87,    31,    88,
     1098      89,    90,    91,     0,     0,    92,    93,     0,     0,     0,
     1099       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1100       0,     0,     0,     0,    94,     0,     0,     0,     8,     9,
     1101      10,     0,     0,     0,   206,    95,    96,     0,    97,    11,
     1102      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
     1103      22,     0,     0,     0,     0,     0,    25,    26,     0,    27,
     1104      28,    29,    30,    87,    31,    88,    89,    90,    91,     0,
     1105       0,    92,    93,     0,     0,     0,     0,     0,     0,     0,
     1106       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1107      94,     0,     0,   222,     8,     9,    10,     0,     0,     0,
     1108       0,    95,    96,     0,    97,    11,    12,    13,    14,    15,
     1109      16,    17,    18,    19,    20,    21,    22,     0,     0,     0,
     1110       0,     0,    25,    26,     0,    27,    28,    29,    30,    87,
     1111      31,    88,    89,    90,    91,     0,     0,    92,    93,     0,
     1112       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1113       0,     0,     0,     0,     0,     0,    94,     0,     0,     0,
     1114       8,     9,    10,     0,     0,     0,     0,    95,    96,     0,
     1115      97,    11,    12,    13,    14,    15,    16,    17,    18,    19,
     1116      20,    21,    22,     0,     0,     0,     0,     0,    25,   175,
     1117       0,    27,    28,    29,    30,    87,    31,    88,    89,    90,
     1118      91,     0,     0,    92,    93,     0,     0,     0,     0,     0,
     1119       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     1120       0,     0,    94,     2,     3,     4,     0,     0,     0,     8,
     1121       9,    10,     0,    95,    96,     0,    97,     0,     0,     0,
    10451122      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
    1046       21,    22,     0,     0,     0,    23,    24,    25,    26,   136,
    1047       27,    28,    29,    30,    87,    31,    88,    89,    90,    91,
    1048        0,     0,    92,    93,     0,     0,     0,     0,     0,     0,
    1049        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1050        0,    94,     0,     0,     0,    76,     0,     0,     0,     0,
    1051        0,   139,    95,    96,     0,    97,     1,     2,     3,     4,
     1123      21,    22,     0,     0,     0,     0,     0,    25,    26,     0,
     1124      27,    28,    29,    30,     0,    31,     2,     3,     4,     0,
     1125       0,     0,     8,     9,    10,     0,     0,     0,     0,     0,
     1126       0,     0,     0,    11,    12,    13,    14,    15,    16,    17,
     1127      18,    19,    20,    21,    22,     0,   198,     0,     0,     0,
     1128      25,    26,     0,    27,    28,    29,    30,     0,    31,     0,
     1129       0,     0,     0,     0,     0,     0,     0,     0,     0,    71,
     1130       0,     0,     1,     2,     3,     4,     5,     6,     7,     8,
     1131       9,    10,     0,     0,     0,     0,     0,     0,     0,   247,
     1132      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
     1133      21,    22,     0,     0,     0,    23,    24,    25,    26,     0,
     1134      27,    28,    29,    30,     0,    31,     1,     2,     3,     4,
    10521135       5,     6,     7,     8,     9,    10,     0,     0,     0,     0,
    10531136       0,     0,     0,     0,    11,    12,    13,    14,    15,    16,
    10541137      17,    18,    19,    20,    21,    22,     0,     0,     0,    23,
    1055       24,    25,    26,     0,    27,    28,    29,    30,    87,    31,
    1056       88,    89,    90,    91,     0,     0,    92,    93,     0,     0,
    1057        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1058        0,     0,     0,     0,     0,    94,     0,     0,     0,     0,
    1059        0,     0,     0,     0,     0,   139,    95,    96,     0,    97,
    1060       58,     2,     3,     4,     0,     6,     7,     8,     9,    10,
    1061        0,     0,     0,     0,     0,     0,     0,     0,    11,    12,
    1062       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
    1063        0,     0,     0,    23,    24,    25,    26,     0,    27,    28,
    1064       29,    30,    87,    31,    88,    89,    90,    91,     0,     0,
    1065       92,    93,     0,     0,     0,     0,     0,     0,     0,     0,
    1066        0,     0,     0,     0,     0,     0,     0,     0,     0,    94,
    1067        0,     0,     0,     8,     9,    10,     0,     0,     0,     0,
    1068       95,    96,     0,    97,    11,    12,    13,    14,    15,    16,
    1069       17,    18,    19,    20,    21,    22,     0,     0,     0,     0,
    1070        0,    25,    26,     0,    27,    28,    29,    30,    87,    31,
    1071       88,    89,    90,    91,     0,     0,    92,    93,     0,     0,
    1072        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1073        0,     0,     0,     0,     0,    94,     0,     0,   161,     8,
    1074        9,    10,     0,     0,     0,     0,    95,    96,     0,    97,
    1075       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
    1076       21,    22,     0,     0,     0,     0,     0,    25,    26,     0,
    1077       27,    28,    29,    30,    87,    31,    88,    89,    90,    91,
    1078        0,     0,    92,    93,     0,     0,     0,     0,     0,     0,
    1079        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1080        0,    94,     0,     0,     0,     8,     9,    10,     0,     0,
    1081        0,   206,    95,    96,     0,    97,    11,    12,    13,    14,
    1082       15,    16,    17,    18,    19,    20,    21,    22,     0,     0,
    1083        0,     0,     0,    25,    26,     0,    27,    28,    29,    30,
    1084       87,    31,    88,    89,    90,    91,     0,     0,    92,    93,
    1085        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1086        0,     0,     0,     0,     0,     0,     0,    94,     0,     0,
    1087      222,     8,     9,    10,     0,     0,     0,     0,    95,    96,
    1088        0,    97,    11,    12,    13,    14,    15,    16,    17,    18,
    1089       19,    20,    21,    22,     0,     0,     0,     0,     0,    25,
    1090       26,     0,    27,    28,    29,    30,    87,    31,    88,    89,
    1091       90,    91,     0,     0,    92,    93,     0,     0,     0,     0,
    1092        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1093        0,     0,     0,    94,     0,     0,     0,     8,     9,    10,
    1094        0,     0,     0,     0,    95,    96,     0,    97,    11,    12,
    1095       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
    1096        0,     0,     0,     0,     0,    25,   175,     0,    27,    28,
    1097       29,    30,    87,    31,    88,    89,    90,    91,     0,     0,
    1098       92,    93,     0,     0,     0,     0,     0,     0,     0,     0,
    1099        0,     0,     0,     0,     0,     0,     0,     0,     0,    94,
     1138      24,    25,    26,     0,    27,    28,    29,    30,     0,    31,
    11001139       2,     3,     4,     0,     0,     0,     8,     9,    10,     0,
    1101       95,    96,     0,    97,     0,     0,     0,    11,    12,    13,
     1140       0,     0,     0,     0,     0,     0,     0,    11,    12,    13,
    11021141      14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
    11031142       0,     0,     0,     0,    25,    26,     0,    27,    28,    29,
    1104       30,     0,    31,     2,     3,     4,     0,     0,     0,     8,
    1105        9,    10,     0,     0,     0,     0,     0,     0,     0,     0,
    1106       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
    1107       21,    22,     0,   198,     0,     0,     0,    25,    26,     0,
    1108       27,    28,    29,    30,     0,    31,     0,     0,     0,     0,
    1109        0,     0,     0,     0,     0,     0,    71,     0,     0,     1,
    1110        2,     3,     4,     5,     6,     7,     8,     9,    10,     0,
    1111        0,     0,     0,     0,     0,     0,   247,    11,    12,    13,
    1112       14,    15,    16,    17,    18,    19,    20,    21,    22,     0,
    1113        0,     0,    23,    24,    25,    26,     0,    27,    28,    29,
    1114       30,     0,    31,     1,     2,     3,     4,     5,     6,     7,
    1115        8,     9,    10,     0,     0,     0,     0,     0,     0,     0,
     1143      30,     0,    31,     8,     9,    10,     0,     0,     0,     0,
     1144       0,     0,     0,     0,    11,    12,    13,    14,    15,    16,
     1145      17,    18,    19,    20,    21,    22,     0,     0,     0,     0,
     1146       0,    25,    26,     0,    27,    28,    29,    30,   229,    31,
     1147       8,     9,    10,   230,     0,     0,     0,     0,     0,     0,
    11161148       0,    11,    12,    13,    14,    15,    16,    17,    18,    19,
    1117       20,    21,    22,     0,     0,     0,    23,    24,    25,    26,
    1118        0,    27,    28,    29,    30,     0,    31,     8,     9,    10,
    1119        0,     0,     0,     0,     0,     0,     0,     0,    11,    12,
    1120       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
    1121        0,     0,     0,     0,     0,    25,    26,     0,    27,    28,
    1122       29,    30,   229,    31,     8,     9,    10,   230,     0,     0,
    1123        0,     0,     0,     0,     0,    11,    12,    13,    14,    15,
    1124       16,    17,    18,    19,    20,    21,    22,     0,     0,     0,
    1125        0,     0,    25,    26,     0,    27,    28,    29,    30,     0,
    1126       31
     1149      20,    21,    22,     0,     0,     0,     0,     0,    25,    26,
     1150       0,    27,    28,    29,    30,     0,    31
    11271151};
    11281152
    11291153static const yytype_int16 yycheck[] =
    11301154{
    1131        0,   160,    94,    86,    70,   127,    45,     0,   255,    60,
    1132       40,   151,    85,     0,    36,    74,    72,    82,    74,    85,
    1133       37,   268,    81,   106,     3,    81,    70,    42,    45,     8,
    1134        9,    55,    56,    63,   284,    57,    51,    76,   288,    73,
    1135       40,    85,    42,   135,    95,    75,    46,    79,    92,    93,
    1136       82,    51,    82,    46,    33,    34,    35,    36,    37,    46,
    1137       87,    88,   202,    63,    73,   109,    90,    91,    79,    79,
    1138       79,    82,   194,    45,     3,    75,    76,   160,   170,     8,
    1139        9,    73,    82,    84,    73,    86,   159,    79,    53,    54,
    1140       79,   174,    73,   159,    73,   125,    79,   127,    79,    82,
     1155       0,    55,    94,    86,    70,   127,    45,   151,   273,    60,
     1156      40,    36,    85,     0,     0,   160,   257,    37,    79,    85,
     1157      84,    82,    86,   106,     3,    45,    70,   253,   293,     8,
     1158       9,   272,    57,    63,    55,    56,    79,    76,    42,    82,
     1159      40,    85,    42,   135,    95,    75,    46,    51,    92,    93,
     1160      79,    51,    82,    82,    33,    34,    35,    36,    37,    46,
     1161      46,    74,   288,    63,    82,   109,   292,    73,    81,    90,
     1162      91,    73,   194,    79,     3,    75,    76,   160,   170,     8,
     1163       9,    72,    82,    74,    79,    79,   159,    82,    53,    54,
     1164      81,   174,    73,   159,    73,   125,    45,   127,    79,    74,
    11411165     192,    62,    63,    64,    33,    34,    35,    36,    37,    74,
    1142       71,    79,   204,    78,    82,   159,   256,     4,     5,     6,
    1143       81,   183,   184,   185,   186,   125,    72,   127,    74,   269,
    1144       74,   290,    37,   216,   217,   179,   180,   181,   182,   183,
    1145      184,   185,   186,   187,   188,   189,   190,   191,   221,   289,
    1146       76,   151,    33,    34,    35,   221,    57,    58,    79,    80,
    1147      181,   182,    76,   255,   194,    45,    82,   187,   188,    45,
    1148       72,    59,    61,    73,    72,   248,   268,   221,    75,   262,
    1149       45,    72,   248,    82,    77,   277,    82,    72,    82,    72,
    1150       74,    40,    45,    75,   194,   287,    74,    72,    75,    72,
    1151       79,    75,   202,    75,   248,    75,    72,   290,    77,    73,
    1152      210,     4,     5,     6,    82,    73,    16,    10,    11,    12,
    1153       81,   171,    82,   189,   191,    82,   190,    57,    21,    22,
     1166      71,    73,   204,    78,   258,   159,    73,    79,    76,    72,
     1167      81,    74,    79,    87,    88,   125,    76,   127,   183,   184,
     1168     185,   186,    37,   216,   217,   179,   180,   181,   182,   183,
     1169     184,   185,   186,   187,   188,   189,   190,   191,   221,   294,
     1170      45,   151,     4,     5,     6,   221,    33,    34,    35,    57,
     1171      58,    79,    80,    82,   194,   257,   181,   182,   187,   188,
     1172      45,    72,    59,    73,    45,   248,    72,   221,    61,    82,
     1173     272,   264,   248,    75,    72,    82,    72,    72,    82,   281,
     1174      79,    72,    74,    77,   194,    75,    74,    76,   252,   291,
     1175       3,     4,     5,     6,   248,     8,     9,    10,    11,    12,
     1176     210,   294,    75,    75,    72,    40,    75,    72,    21,    22,
    11541177      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
    1155       64,    82,     5,   249,   252,    38,    39,   288,    41,    42,
    1156       43,    44,   252,    46,   125,   255,   256,    55,   210,    46,
    1157       -1,   252,    -1,   268,    -1,    -1,    -1,    -1,   268,   269,
     1178      75,    45,    73,    36,    37,    38,    39,    77,    41,    42,
     1179      43,    44,    45,    46,    47,    48,    49,    50,    82,    73,
     1180      53,    54,    16,   253,   254,    81,   171,   257,   258,    82,
     1181     190,   189,    82,    57,   191,    64,    82,     5,   125,    72,
     1182     254,   249,   272,   210,   254,   292,   272,    46,    -1,    -1,
     1183      83,    84,    -1,    86,    -1,    -1,    -1,    -1,   288,    -1,
     1184      -1,    -1,   292,     3,     4,     5,     6,     7,     8,     9,
     1185      10,    11,    12,    13,    14,    15,    -1,    17,    18,    19,
     1186      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
     1187      30,    31,    32,    -1,    -1,    -1,    36,    37,    38,    39,
     1188      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
     1189      50,    -1,    -1,    53,    54,    -1,    -1,    -1,    -1,    -1,
    11581190      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1159       -1,    -1,    -1,    -1,   284,    -1,    -1,    -1,   288,   289,
    1160        3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
    1161       13,    14,    15,    -1,    17,    18,    19,    20,    21,    22,
    1162       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
    1163       -1,    -1,    -1,    36,    37,    38,    39,    40,    41,    42,
    1164       43,    44,    45,    46,    47,    48,    49,    50,    -1,    -1,
    1165       53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1166       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,
    1167       -1,    -1,    -1,    76,    77,    -1,    -1,    -1,    -1,    82,
    1168       83,    84,    -1,    86,     3,     4,     5,     6,     7,     8,
    1169        9,    10,    11,    12,    13,    14,    15,    -1,    17,    18,
    1170       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
    1171       29,    30,    31,    32,    -1,    -1,    -1,    36,    37,    38,
    1172       39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
    1173       49,    50,    -1,    -1,    53,    54,    -1,    -1,    -1,    -1,
     1191      -1,    -1,    72,    -1,    -1,    -1,    76,    77,    -1,    -1,
     1192      -1,    -1,    82,    83,    84,    -1,    86,     3,     4,     5,
     1193       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
     1194      -1,    17,    18,    19,    20,    21,    22,    23,    24,    25,
     1195      26,    27,    28,    29,    30,    31,    32,    -1,    -1,    -1,
     1196      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
     1197      46,    47,    48,    49,    50,    -1,    -1,    53,    54,    -1,
    11741198      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1175       -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    77,    -1,
    1176       -1,    -1,    -1,    82,    83,    84,    -1,    86,     3,     4,
    1177        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
    1178       15,    -1,    17,    18,    19,    20,    21,    22,    23,    24,
    1179       25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
    1180       -1,    36,    37,    38,    39,    40,    41,    42,    43,    44,
    1181       45,    46,    47,    48,    49,    50,    -1,    -1,    53,    54,
     1199      -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,
     1200      76,    77,    -1,    -1,    -1,    -1,    82,    83,    84,    -1,
     1201      86,     3,     4,     5,     6,     7,     8,     9,    10,    11,
     1202      12,    13,    14,    15,    -1,    17,    18,    19,    20,    21,
     1203      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
     1204      32,    -1,    -1,    -1,    36,    37,    38,    39,    40,    41,
     1205      42,    43,    44,    45,    46,    47,    48,    49,    50,    -1,
     1206      -1,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    11821207      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1183       -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
    1184       -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    83,    84,
    1185       -1,    86,     3,     4,     5,     6,     7,     8,     9,    10,
    1186       11,    12,    13,    14,    15,    -1,    17,    18,    19,    20,
     1208      72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
     1209      82,    83,    84,    -1,    86,     3,     4,     5,     6,     7,
     1210       8,     9,    10,    11,    12,    13,    14,    15,    -1,    17,
     1211      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
     1212      28,    29,    30,    31,    32,    -1,    -1,    -1,    36,    37,
     1213      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
     1214      48,    49,    50,    -1,    -1,    53,    54,    -1,    -1,    -1,
     1215      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1216      -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,
     1217      -1,    -1,    -1,    -1,    82,    83,    84,    -1,    86,     3,
     1218       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
     1219      14,    15,    -1,    17,    18,    19,    20,    21,    22,    23,
     1220      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
     1221      -1,    -1,    36,    37,    38,    39,    40,    41,    42,    43,
     1222      44,    45,    46,    47,    48,    49,    50,    -1,    -1,    53,
     1223      54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1224      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,
     1225      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    82,    83,
     1226      84,    -1,    86,     3,     4,     5,     6,     7,     8,     9,
     1227      10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1228      -1,    21,    22,    23,    24,    25,    26,    27,    28,    29,
     1229      30,    31,    32,    -1,    -1,    -1,    36,    37,    38,    39,
     1230      -1,    41,    42,    43,    44,    45,    46,    47,    48,    49,
     1231      50,    -1,    -1,    53,    54,    -1,    -1,    -1,    -1,    -1,
     1232      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1233      -1,    -1,    72,    -1,    -1,    -1,    10,    11,    12,    -1,
     1234      -1,    -1,    82,    83,    84,    -1,    86,    21,    22,    23,
     1235      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
     1236      -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,
     1237      44,    45,    46,    47,    48,    49,    50,    -1,    -1,    53,
     1238      54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1239      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,
     1240      -1,    75,    10,    11,    12,    -1,    -1,    -1,    -1,    83,
     1241      84,    -1,    86,    21,    22,    23,    24,    25,    26,    27,
     1242      28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,
     1243      38,    39,    -1,    41,    42,    43,    44,    45,    46,    47,
     1244      48,    49,    50,    -1,    -1,    53,    54,    -1,    -1,    -1,
     1245      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1246      -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    10,    11,
     1247      12,    -1,    -1,    -1,    82,    83,    84,    -1,    86,    21,
     1248      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
     1249      32,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,
     1250      42,    43,    44,    45,    46,    47,    48,    49,    50,    -1,
     1251      -1,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1252      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1253      72,    -1,    -1,    75,    10,    11,    12,    -1,    -1,    -1,
     1254      -1,    83,    84,    -1,    86,    21,    22,    23,    24,    25,
     1255      26,    27,    28,    29,    30,    31,    32,    -1,    -1,    -1,
     1256      -1,    -1,    38,    39,    -1,    41,    42,    43,    44,    45,
     1257      46,    47,    48,    49,    50,    -1,    -1,    53,    54,    -1,
     1258      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1259      -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,
     1260      10,    11,    12,    -1,    -1,    -1,    -1,    83,    84,    -1,
     1261      86,    21,    22,    23,    24,    25,    26,    27,    28,    29,
     1262      30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,
     1263      -1,    41,    42,    43,    44,    45,    46,    47,    48,    49,
     1264      50,    -1,    -1,    53,    54,    -1,    -1,    -1,    -1,    -1,
     1265      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1266      -1,    -1,    72,     4,     5,     6,    -1,    -1,    -1,    10,
     1267      11,    12,    -1,    83,    84,    -1,    86,    -1,    -1,    -1,
    11871268      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
    1188       31,    32,    -1,    -1,    -1,    36,    37,    38,    39,    40,
    1189       41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
    1190       -1,    -1,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,
    1191       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1192       -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
    1193       -1,    82,    83,    84,    -1,    86,     3,     4,     5,     6,
     1269      31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,
     1270      41,    42,    43,    44,    -1,    46,     4,     5,     6,    -1,
     1271      -1,    -1,    10,    11,    12,    -1,    -1,    -1,    -1,    -1,
     1272      -1,    -1,    -1,    21,    22,    23,    24,    25,    26,    27,
     1273      28,    29,    30,    31,    32,    -1,    77,    -1,    -1,    -1,
     1274      38,    39,    -1,    41,    42,    43,    44,    -1,    46,    -1,
     1275      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     0,
     1276      -1,    -1,     3,     4,     5,     6,     7,     8,     9,    10,
     1277      11,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,
     1278      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
     1279      31,    32,    -1,    -1,    -1,    36,    37,    38,    39,    -1,
     1280      41,    42,    43,    44,    -1,    46,     3,     4,     5,     6,
    11941281       7,     8,     9,    10,    11,    12,    -1,    -1,    -1,    -1,
    11951282      -1,    -1,    -1,    -1,    21,    22,    23,    24,    25,    26,
    11961283      27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    36,
    1197       37,    38,    39,    -1,    41,    42,    43,    44,    45,    46,
    1198       47,    48,    49,    50,    -1,    -1,    53,    54,    -1,    -1,
    1199       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1200       -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    -1,
    1201       -1,    -1,    -1,    -1,    -1,    82,    83,    84,    -1,    86,
    1202        3,     4,     5,     6,    -1,     8,     9,    10,    11,    12,
    1203       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,    22,
    1204       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
    1205       -1,    -1,    -1,    36,    37,    38,    39,    -1,    41,    42,
    1206       43,    44,    45,    46,    47,    48,    49,    50,    -1,    -1,
    1207       53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1208       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,
    1209       -1,    -1,    -1,    10,    11,    12,    -1,    -1,    -1,    -1,
    1210       83,    84,    -1,    86,    21,    22,    23,    24,    25,    26,
     1284      37,    38,    39,    -1,    41,    42,    43,    44,    -1,    46,
     1285       4,     5,     6,    -1,    -1,    -1,    10,    11,    12,    -1,
     1286      -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,    22,    23,
     1287      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
     1288      -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,
     1289      44,    -1,    46,    10,    11,    12,    -1,    -1,    -1,    -1,
     1290      -1,    -1,    -1,    -1,    21,    22,    23,    24,    25,    26,
    12111291      27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,
    12121292      -1,    38,    39,    -1,    41,    42,    43,    44,    45,    46,
    1213       47,    48,    49,    50,    -1,    -1,    53,    54,    -1,    -1,
    1214       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1215       -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    75,    10,
    1216       11,    12,    -1,    -1,    -1,    -1,    83,    84,    -1,    86,
    1217       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
    1218       31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,
    1219       41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
    1220       -1,    -1,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,
    1221       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1222       -1,    72,    -1,    -1,    -1,    10,    11,    12,    -1,    -1,
    1223       -1,    82,    83,    84,    -1,    86,    21,    22,    23,    24,
    1224       25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
    1225       -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,    44,
    1226       45,    46,    47,    48,    49,    50,    -1,    -1,    53,    54,
    1227       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1228       -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
    1229       75,    10,    11,    12,    -1,    -1,    -1,    -1,    83,    84,
    1230       -1,    86,    21,    22,    23,    24,    25,    26,    27,    28,
    1231       29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,
    1232       39,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
    1233       49,    50,    -1,    -1,    53,    54,    -1,    -1,    -1,    -1,
    1234       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1235       -1,    -1,    -1,    72,    -1,    -1,    -1,    10,    11,    12,
    1236       -1,    -1,    -1,    -1,    83,    84,    -1,    86,    21,    22,
    1237       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
    1238       -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,
    1239       43,    44,    45,    46,    47,    48,    49,    50,    -1,    -1,
    1240       53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1241       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    72,
    1242        4,     5,     6,    -1,    -1,    -1,    10,    11,    12,    -1,
    1243       83,    84,    -1,    86,    -1,    -1,    -1,    21,    22,    23,
    1244       24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
    1245       -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,    43,
    1246       44,    -1,    46,     4,     5,     6,    -1,    -1,    -1,    10,
    1247       11,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    1248       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
    1249       31,    32,    -1,    77,    -1,    -1,    -1,    38,    39,    -1,
    1250       41,    42,    43,    44,    -1,    46,    -1,    -1,    -1,    -1,
    1251       -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,    -1,     3,
    1252        4,     5,     6,     7,     8,     9,    10,    11,    12,    -1,
    1253       -1,    -1,    -1,    -1,    -1,    -1,    77,    21,    22,    23,
    1254       24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
    1255       -1,    -1,    36,    37,    38,    39,    -1,    41,    42,    43,
    1256       44,    -1,    46,     3,     4,     5,     6,     7,     8,     9,
    1257       10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     1293      10,    11,    12,    50,    -1,    -1,    -1,    -1,    -1,    -1,
    12581294      -1,    21,    22,    23,    24,    25,    26,    27,    28,    29,
    1259       30,    31,    32,    -1,    -1,    -1,    36,    37,    38,    39,
    1260       -1,    41,    42,    43,    44,    -1,    46,    10,    11,    12,
    1261       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    21,    22,
    1262       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
    1263       -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    41,    42,
    1264       43,    44,    45,    46,    10,    11,    12,    50,    -1,    -1,
    1265       -1,    -1,    -1,    -1,    -1,    21,    22,    23,    24,    25,
    1266       26,    27,    28,    29,    30,    31,    32,    -1,    -1,    -1,
    1267       -1,    -1,    38,    39,    -1,    41,    42,    43,    44,    -1,
    1268       46
     1295      30,    31,    32,    -1,    -1,    -1,    -1,    -1,    38,    39,
     1296      -1,    41,    42,    43,    44,    -1,    46
    12691297};
    12701298
     
    12771305      30,    31,    32,    36,    37,    38,    39,    41,    42,    43,
    12781306      44,    46,   126,   127,   128,   129,   130,   135,   136,   137,
    1279      138,   139,   140,   141,   142,   143,   172,   173,   174,    37,
    1280       45,   140,    45,    76,    82,   175,    73,    79,     3,    33,
     1307     138,   139,   140,   141,   142,   143,   175,   176,   177,    37,
     1308      45,   140,    45,    76,    82,   178,    73,    79,     3,    33,
    12811309      34,    35,   132,   133,   138,    79,    82,    45,   139,   141,
    1282       74,     0,   173,   141,    76,   145,    76,   158,   132,   131,
     1310      74,     0,   176,   141,    76,   145,    76,   161,   132,   131,
    12831311     134,   139,   133,    45,    72,    74,    81,    45,    47,    48,
    12841312      49,    50,    53,    54,    72,    83,    84,    86,    97,    98,
     
    12881316      14,    15,    17,    18,    19,    20,    40,    76,    77,    82,
    12891317     108,   121,   122,   124,   126,   127,   142,   151,   152,   153,
    1290      154,   159,   160,   161,   164,   171,    45,   131,   134,    74,
     1318     154,   162,   163,   164,   167,   174,    45,   131,   134,    74,
    12911319      81,    75,   125,   122,   150,   108,   108,   124,    53,    54,
    12921320      74,    78,    73,    73,    79,    39,   122,    72,   108,    87,
    12931321      88,    84,    86,    55,    56,    90,    91,    57,    58,    59,
    12941322      61,    60,    95,    75,   146,    45,   148,   149,    77,   147,
    1295       82,    82,   166,    72,    72,    82,    82,   124,    72,    77,
     1323      82,    82,   169,    72,    72,    82,    82,   124,    72,    77,
    12961324     155,    62,    63,    64,    71,    81,   123,    79,    82,    77,
    12971325     152,    74,    75,   125,   150,    75,    73,   100,   124,    45,
    12981326      50,   103,   122,   108,   108,   110,   110,   112,   112,   112,
    12991327     112,   113,   113,   117,   118,   119,   124,    77,    74,    79,
    1300       82,   152,   167,   124,    82,   165,   159,   122,   122,   125,
    1301       75,    75,    80,   125,   149,    40,   151,   160,   168,    73,
    1302      124,   137,   163,   156,    75,   122,    75,    72,   163,   169,
    1303      170,   152,   162,    45,    73,    77,   124,    82,    73,    16,
    1304       81,   153,   157,   158,    73,   124,   157,   152,   150,    82
     1328      82,   158,   159,   160,   170,   124,    82,   168,   162,   122,
     1329     122,   125,    75,    75,    80,   125,   149,    40,   161,   153,
     1330     151,   163,   171,    73,   124,   137,   166,   156,    75,   122,
     1331      75,    72,   166,   172,   173,   158,   165,    45,    73,    77,
     1332     124,    82,    73,    16,    81,   153,   157,   161,    73,   124,
     1333     157,   158,   150,    82
    13051334};
    13061335
     
    31303159        prototype->setOp(EOpPrototype);
    31313160        (yyval.interm.intermNode) = prototype;
     3161
     3162        context->symbolTable.pop();
    31323163    ;}
    31333164    break;
     
    31833214        (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
    31843215
    3185         context->symbolTable.insert(*(yyval.interm).function);
     3216        // We're at the inner scope level of the function's arguments and body statement.
     3217        // Add the function prototype to the surrounding scope instead.
     3218        context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
    31863219    ;}
    31873220    break;
     
    32513284        function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
    32523285        (yyval.interm.function) = function;
     3286       
     3287        context->symbolTable.push();
    32533288    ;}
    32543289    break;
     
    33773412
    33783413    {
     3414        if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
     3415        {
     3416            context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str(), "");
     3417            context->recover();
     3418        }
     3419
    33793420        TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
    33803421        (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
     
    35743615    {
    35753616        VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
    3576         (yyval.interm).qualifier = EvqInvariantVaryingOut;
    3577         (yyval.interm).intermAggregate = 0;
     3617        if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
     3618            context->recover();
     3619        (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
     3620        if (!(yyvsp[(2) - (2)].lex).symbol)
     3621        {
     3622            context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str(), "");
     3623            context->recover();
     3624           
     3625            (yyval.interm).intermAggregate = 0;
     3626        }
     3627        else
     3628        {
     3629            TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
     3630            (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
     3631        }
    35783632    ;}
    35793633    break;
     
    41674221  case 164:
    41684222
     4223    { context->symbolTable.push(); ;}
     4224    break;
     4225
     4226  case 165:
     4227
     4228    { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); ;}
     4229    break;
     4230
     4231  case 166:
     4232
     4233    { context->symbolTable.push(); ;}
     4234    break;
     4235
     4236  case 167:
     4237
     4238    { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); ;}
     4239    break;
     4240
     4241  case 168:
     4242
    41694243    {
    41704244        (yyval.interm.intermNode) = 0;
     
    41724246    break;
    41734247
    4174   case 165:
     4248  case 169:
    41754249
    41764250    {
     
    41834257    break;
    41844258
    4185   case 166:
     4259  case 170:
    41864260
    41874261    {
     
    41904264    break;
    41914265
    4192   case 167:
     4266  case 171:
    41934267
    41944268    {
     
    41974271    break;
    41984272
    4199   case 168:
     4273  case 172:
    42004274
    42014275    { (yyval.interm.intermNode) = 0; ;}
    42024276    break;
    42034277
    4204   case 169:
     4278  case 173:
    42054279
    42064280    { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
    42074281    break;
    42084282
    4209   case 170:
     4283  case 174:
    42104284
    42114285    {
     
    42164290    break;
    42174291
    4218   case 171:
     4292  case 175:
    42194293
    42204294    {
     
    42244298    break;
    42254299
    4226   case 172:
     4300  case 176:
    42274301
    42284302    {
     
    42324306    break;
    42334307
    4234   case 173:
     4308  case 177:
    42354309
    42364310    {
     
    42414315    break;
    42424316
    4243   case 174:
     4317  case 178:
    42444318
    42454319    {
     
    42594333    break;
    42604334
    4261   case 175:
     4335  case 179:
    42624336
    42634337    { context->symbolTable.push(); ++context->loopNestingLevel; ;}
    42644338    break;
    42654339
    4266   case 176:
     4340  case 180:
    42674341
    42684342    {
     
    42734347    break;
    42744348
    4275   case 177:
     4349  case 181:
    42764350
    42774351    { ++context->loopNestingLevel; ;}
    42784352    break;
    42794353
    4280   case 178:
     4354  case 182:
    42814355
    42824356    {
     
    42894363    break;
    42904364
    4291   case 179:
     4365  case 183:
    42924366
    42934367    { context->symbolTable.push(); ++context->loopNestingLevel; ;}
    42944368    break;
    42954369
    4296   case 180:
     4370  case 184:
    42974371
    42984372    {
     
    43034377    break;
    43044378
    4305   case 181:
     4379  case 185:
    43064380
    43074381    {
     
    43104384    break;
    43114385
    4312   case 182:
     4386  case 186:
    43134387
    43144388    {
     
    43174391    break;
    43184392
    4319   case 183:
     4393  case 187:
    43204394
    43214395    {
     
    43244398    break;
    43254399
    4326   case 184:
     4400  case 188:
    43274401
    43284402    {
     
    43314405    break;
    43324406
    4333   case 185:
     4407  case 189:
    43344408
    43354409    {
     
    43394413    break;
    43404414
    4341   case 186:
     4415  case 190:
    43424416
    43434417    {
     
    43474421    break;
    43484422
    4349   case 187:
     4423  case 191:
    43504424
    43514425    {
     
    43584432    break;
    43594433
    4360   case 188:
     4434  case 192:
    43614435
    43624436    {
     
    43694443    break;
    43704444
    4371   case 189:
     4445  case 193:
    43724446
    43734447    {
     
    43804454    break;
    43814455
    4382   case 190:
     4456  case 194:
    43834457
    43844458    {
     
    43954469    break;
    43964470
    4397   case 191:
     4471  case 195:
    43984472
    43994473    {
     
    44034477    break;
    44044478
    4405   case 192:
     4479  case 196:
    44064480
    44074481    {
     
    44114485    break;
    44124486
    4413   case 193:
     4487  case 197:
    44144488
    44154489    {
     
    44194493    break;
    44204494
    4421   case 194:
     4495  case 198:
    44224496
    44234497    {
     
    44264500    break;
    44274501
    4428   case 195:
     4502  case 199:
    44294503
    44304504    {
     
    44334507    break;
    44344508
    4435   case 196:
     4509  case 200:
    44364510
    44374511    {
     
    44654539            }
    44664540        }
    4467 
    4468         //
    4469         // New symbol table scope for body of function plus its arguments
    4470         //
    4471         context->symbolTable.push();
    44724541
    44734542        //
     
    45184587    break;
    45194588
    4520   case 197:
     4589  case 201:
    45214590
    45224591    {
     
    45274596            context->recover();
    45284597        }
    4529         context->symbolTable.pop();
     4598       
    45304599        (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
    45314600        context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
     
    45414610        if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
    45424611            (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
     4612
     4613        context->symbolTable.pop();
    45434614    ;}
    45444615    break;
  • trunk/Source/ThirdParty/ANGLE/src/compiler/osinclude.h

    r104363 r112300  
    1717#elif defined(__APPLE__) || defined(__linux__) || \
    1818      defined(__FreeBSD__) || defined(__OpenBSD__) || \
    19       defined(__sun) || defined(ANDROID)
     19      defined(__sun) || defined(ANDROID) || \
     20      defined(__GLIBC__) || defined(__GNU__)
    2021#define ANGLE_OS_POSIX
    2122#else
  • trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c

    r89330 r112300  
    5353
    5454#include "compiler/preprocessor/slglobals.h"
     55
     56#if defined(_MSC_VER)
     57#pragma warning(disable: 4054)
     58#pragma warning(disable: 4152)
     59#pragma warning(disable: 4706)
     60#endif
    5561
    5662static int CPPif(yystypepp * yylvalpp);
  • trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c

    r66675 r112300  
    5252
    5353#include "compiler/preprocessor/memory.h"
     54
     55#if defined(_MSC_VER)
     56#pragma warning(disable: 4706)
     57#endif
    5458
    5559// default alignment and chunksize, if called with 0 arguments
  • trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c

    r89330 r112300  
    666666        }
    667667    }
    668 
    669     return 0;
    670668} // yylex
    671669
  • trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c

    r66675 r112300  
    5151
    5252#include "compiler/preprocessor/slglobals.h"
     53
     54#if defined(_MSC_VER)
     55#pragma warning(disable: 4706)
     56#endif
    5357
    5458///////////////////////////////////////////////////////////////////////////////////////////////
  • trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c

    r76091 r112300  
    5454#include "compiler/preprocessor/slglobals.h"
    5555#include "compiler/util.h"
     56
     57#if defined(_MSC_VER)
     58#pragma warning(disable: 4054)
     59#pragma warning(disable: 4152)
     60#endif
    5661
    5762///////////////////////////////////////////////////////////////////////////////////////////////
  • trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp

    r95901 r112300  
    322322              case EGL_DEPTH_SIZE:                match = config->mDepthSize >= attribute[1];                       break;
    323323              case EGL_STENCIL_SIZE:              match = config->mStencilSize >= attribute[1];                     break;
    324               case EGL_CONFIG_CAVEAT:             match = config->mConfigCaveat == attribute[1];                    break;
     324              case EGL_CONFIG_CAVEAT:             match = config->mConfigCaveat == (EGLenum) attribute[1];          break;
    325325              case EGL_CONFIG_ID:                 match = config->mConfigID == attribute[1];                        break;
    326326              case EGL_LEVEL:                     match = config->mLevel >= attribute[1];                           break;
    327               case EGL_NATIVE_RENDERABLE:         match = config->mNativeRenderable == attribute[1];                break;
     327              case EGL_NATIVE_RENDERABLE:         match = config->mNativeRenderable == (EGLBoolean) attribute[1];   break;
    328328              case EGL_NATIVE_VISUAL_TYPE:        match = config->mNativeVisualType == attribute[1];                break;
    329329              case EGL_SAMPLES:                   match = config->mSamples >= attribute[1];                         break;
    330330              case EGL_SAMPLE_BUFFERS:            match = config->mSampleBuffers >= attribute[1];                   break;
    331331              case EGL_SURFACE_TYPE:              match = (config->mSurfaceType & attribute[1]) == attribute[1];    break;
    332               case EGL_TRANSPARENT_TYPE:          match = config->mTransparentType == attribute[1];                 break;
     332              case EGL_TRANSPARENT_TYPE:          match = config->mTransparentType == (EGLenum) attribute[1];       break;
    333333              case EGL_TRANSPARENT_BLUE_VALUE:    match = config->mTransparentBlueValue == attribute[1];            break;
    334334              case EGL_TRANSPARENT_GREEN_VALUE:   match = config->mTransparentGreenValue == attribute[1];           break;
    335335              case EGL_TRANSPARENT_RED_VALUE:     match = config->mTransparentRedValue == attribute[1];             break;
    336               case EGL_BIND_TO_TEXTURE_RGB:       match = config->mBindToTextureRGB == attribute[1];                break;
    337               case EGL_BIND_TO_TEXTURE_RGBA:      match = config->mBindToTextureRGBA == attribute[1];               break;
     336              case EGL_BIND_TO_TEXTURE_RGB:       match = config->mBindToTextureRGB == (EGLBoolean) attribute[1];   break;
     337              case EGL_BIND_TO_TEXTURE_RGBA:      match = config->mBindToTextureRGBA == (EGLBoolean) attribute[1];  break;
    338338              case EGL_MIN_SWAP_INTERVAL:         match = config->mMinSwapInterval == attribute[1];                 break;
    339339              case EGL_MAX_SWAP_INTERVAL:         match = config->mMaxSwapInterval == attribute[1];                 break;
    340340              case EGL_LUMINANCE_SIZE:            match = config->mLuminanceSize >= attribute[1];                   break;
    341341              case EGL_ALPHA_MASK_SIZE:           match = config->mAlphaMaskSize >= attribute[1];                   break;
    342               case EGL_COLOR_BUFFER_TYPE:         match = config->mColorBufferType == attribute[1];                 break;
     342              case EGL_COLOR_BUFFER_TYPE:         match = config->mColorBufferType == (EGLenum) attribute[1];       break;
    343343              case EGL_RENDERABLE_TYPE:           match = (config->mRenderableType & attribute[1]) == attribute[1]; break;
    344344              case EGL_MATCH_NATIVE_PIXMAP:       match = false; UNIMPLEMENTED();                                   break;
  • trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    1717#include "common/debug.h"
    1818#include "libGLESv2/mathutil.h"
     19#include "libGLESv2/utilities.h"
    1920
    2021#include "libEGL/main.h"
     
    288289    mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
    289290
     291    if (!createDevice())
     292    {
     293        terminate();
     294        return false;
     295    }
     296
    290297    return true;
    291298}
     
    301308    {
    302309        destroyContext(*mContextSet.begin());
     310    }
     311
     312    while (!mEventQueryPool.empty())
     313    {
     314        mEventQueryPool.back()->Release();
     315        mEventQueryPool.pop_back();
    303316    }
    304317
     
    724737    }
    725738
     739    while (!mEventQueryPool.empty())
     740    {
     741        mEventQueryPool.back()->Release();
     742        mEventQueryPool.pop_back();
     743    }
     744
    726745    if (!resetDevice())
    727746    {
     
    866885      default:
    867886        return false;
     887    }
     888}
     889
     890void Display::sync(bool block)
     891{
     892    HRESULT result;
     893
     894    IDirect3DQuery9* query = allocateEventQuery();
     895    if (!query)
     896    {
     897        return;
     898    }
     899
     900    result = query->Issue(D3DISSUE_END);
     901    ASSERT(SUCCEEDED(result));
     902
     903    do
     904    {
     905        result = query->GetData(NULL, 0, D3DGETDATA_FLUSH);
     906
     907        if(block && result == S_FALSE)
     908        {
     909            // Keep polling, but allow other threads to do something useful first
     910            Sleep(0);
     911            // explicitly check for device loss
     912            // some drivers seem to return S_FALSE even if the device is lost
     913            // instead of D3DERR_DEVICELOST like they should
     914            if (testDeviceLost())
     915            {
     916                result = D3DERR_DEVICELOST;
     917            }
     918        }
     919    }
     920    while(block && result == S_FALSE);
     921
     922    freeEventQuery(query);
     923
     924    if (isDeviceLostError(result))
     925    {
     926        notifyDeviceLost();
     927    }
     928}
     929
     930IDirect3DQuery9* Display::allocateEventQuery()
     931{
     932    IDirect3DQuery9 *query = NULL;
     933
     934    if (mEventQueryPool.empty())
     935    {
     936        HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
     937        ASSERT(SUCCEEDED(result));
     938    }
     939    else
     940    {
     941        query = mEventQueryPool.back();
     942        mEventQueryPool.pop_back();
     943    }
     944
     945    return query;
     946}
     947
     948void Display::freeEventQuery(IDirect3DQuery9* query)
     949{
     950    if (mEventQueryPool.size() > 1000)
     951    {
     952        query->Release();
     953    }
     954    else
     955    {
     956        mEventQueryPool.push_back(query);
    868957    }
    869958}
     
    9191008                                                     D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
    9201009
    921     if (!filtering && !renderable)
     1010    if (!*filtering && !*renderable)
    9221011    {
    9231012        return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
     
    9471036                                                    D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
    9481037
    949     if (!filtering && !renderable)
     1038    if (!*filtering && !*renderable)
    9501039    {
    9511040        return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
     
    10121101bool Display::getEventQuerySupport()
    10131102{
    1014     IDirect3DQuery9 *query;
    1015     HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
    1016     if (SUCCEEDED(result))
    1017     {
    1018         query->Release();
    1019     }
    1020 
    1021     return result != D3DERR_NOTAVAILABLE;
     1103    IDirect3DQuery9 *query = allocateEventQuery();
     1104    if (query)
     1105    {
     1106        freeEventQuery(query);
     1107        return true;
     1108    }
     1109    else
     1110    {
     1111        return false;
     1112    }
    10221113}
    10231114
     
    10471138{
    10481139    HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
    1049     bool isd3d9ex = isD3d9ExDevice();
    10501140
    10511141    mExtensionString = "";
     
    10551145
    10561146    // ANGLE-specific extensions
    1057     if (isd3d9ex)
     1147    if (shareHandleSupported())
    10581148    {
    10591149        mExtensionString += "EGL_ANGLE_d3d_share_handle_client_buffer ";
     
    10671157    }
    10681158
    1069     if (isd3d9ex)
     1159    if (shareHandleSupported())
    10701160    {
    10711161        mExtensionString += "EGL_ANGLE_surface_d3d_texture_2d_share_handle ";
     
    10841174{
    10851175    return mExtensionString.c_str();
     1176}
     1177
     1178bool Display::shareHandleSupported() const
     1179{
     1180    // PIX doesn't seem to support using share handles, so disable them.
     1181    return isD3d9ExDevice() && !gl::perfActive();
    10861182}
    10871183
     
    11101206}
    11111207
    1112 }
     1208bool Display::getOcclusionQuerySupport() const
     1209{
     1210    if (!isInitialized())
     1211    {
     1212        return false;
     1213    }
     1214
     1215    IDirect3DQuery9 *query = NULL;
     1216    HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &query);
     1217   
     1218    if (SUCCEEDED(result) && query)
     1219    {
     1220        query->Release();
     1221        return true;
     1222    }
     1223    else
     1224    {
     1225        return false;
     1226    }
     1227}
     1228
     1229bool Display::getInstancingSupport() const
     1230{
     1231    return mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
     1232}
     1233
     1234}
  • trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    1919
    2020#include <set>
     21#include <vector>
    2122
    2223#include "libGLESv2/Context.h"
     
    6465    virtual bool testDeviceLost();
    6566    virtual bool testDeviceResettable();
     67    virtual void sync(bool block);
     68    virtual IDirect3DQuery9* allocateEventQuery();
     69    virtual void freeEventQuery(IDirect3DQuery9* query);
    6670    virtual void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
    6771    virtual bool getDXT1TextureSupport();
     
    7579    virtual bool getVertexTextureSupport() const;
    7680    virtual bool getNonPower2TextureSupport() const;
     81    virtual bool getOcclusionQuerySupport() const;
     82    virtual bool getInstancingSupport() const;
    7783    virtual D3DPOOL getBufferPool(DWORD usage) const;
    7884    virtual D3DPOOL getTexturePool(bool renderable) const;
     
    8187    bool isDeviceLost();
    8288
    83     bool isD3d9ExDevice() { return mD3d9Ex != NULL; }
     89    bool isD3d9ExDevice() const { return mD3d9Ex != NULL; }
    8490    const char *getExtensionString() const;
     91    bool shareHandleSupported() const;
    8592
    8693  private:
     
    104111    IDirect3DDevice9 *mDevice;
    105112    IDirect3DDevice9Ex *mDeviceEx;  // Might be null if D3D9Ex is not supported.
     113
     114    // A pool of event queries that are currently unused.
     115    std::vector<IDirect3DQuery9*> mEventQueryPool;
     116
    106117    D3DCAPS9 mDeviceCaps;
    107118    D3DADAPTER_IDENTIFIER9 mAdapterIdentifier;
  • trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp

    r104363 r112300  
    254254    } else {
    255255        HANDLE *pShareHandle = NULL;
    256         if (mDisplay->isD3d9ExDevice()) {
     256        if (mDisplay->shareHandleSupported()) {
    257257            pShareHandle = &mShareHandle;
    258258        }
  • trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp

    r104363 r112300  
    106106        return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
    107107    }
    108 
    109     return EGL_NO_DISPLAY;
    110108}
    111109
     
    138136        return error(EGL_BAD_ALLOC, EGL_FALSE);
    139137    }
    140 
    141     return EGL_FALSE;
    142138}
    143139
     
    163159        return error(EGL_BAD_ALLOC, EGL_FALSE);
    164160    }
    165 
    166     return EGL_FALSE;
    167161}
    168162
     
    198192        return error(EGL_BAD_ALLOC, (const char*)NULL);
    199193    }
    200 
    201     return NULL;
    202194}
    203195
     
    235227        return error(EGL_BAD_ALLOC, EGL_FALSE);
    236228    }
    237 
    238     return EGL_FALSE;
    239229}
    240230
     
    274264        return error(EGL_BAD_ALLOC, EGL_FALSE);
    275265    }
    276 
    277     return EGL_FALSE;
    278266}
    279267
     
    303291        return error(EGL_BAD_ALLOC, EGL_FALSE);
    304292    }
    305 
    306     return EGL_FALSE;
    307293}
    308294
     
    334320        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
    335321    }
    336 
    337     return EGL_NO_SURFACE;
    338322}
    339323
     
    358342        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
    359343    }
    360 
    361     return EGL_NO_SURFACE;
    362344}
    363345
     
    384366        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
    385367    }
    386 
    387     return EGL_NO_SURFACE;
    388368}
    389369
     
    415395        return error(EGL_BAD_ALLOC, EGL_FALSE);
    416396    }
    417 
    418     return EGL_FALSE;
    419397}
    420398
     
    502480        return error(EGL_BAD_ALLOC, EGL_FALSE);
    503481    }
    504 
    505     return EGL_FALSE;
    506482}
    507483
     
    541517        return error(EGL_BAD_ALLOC, EGL_FALSE);
    542518    }
    543 
    544     return EGL_FALSE;
    545519}
    546520
     
    570544        return error(EGL_BAD_ALLOC, EGL_FALSE);
    571545    }
    572 
    573     return EGL_FALSE;
    574546}
    575547
     
    588560        return error(EGL_BAD_ALLOC, EGL_FALSE);
    589561    }
    590 
    591     return EGL_FALSE;
    592562}
    593563
     
    606576        return error(EGL_BAD_ALLOC, EGL_FALSE);
    607577    }
    608 
    609     return EGL_FALSE;
    610578}
    611579
     
    624592        return error(EGL_BAD_ALLOC, EGL_FALSE);
    625593    }
    626 
    627     return EGL_FALSE;
    628594}
    629595
     
    654620        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
    655621    }
    656 
    657     return EGL_NO_SURFACE;
    658622}
    659623
     
    681645        return error(EGL_BAD_ALLOC, EGL_FALSE);
    682646    }
    683 
    684     return EGL_FALSE;
    685647}
    686648
     
    730692        return error(EGL_BAD_ALLOC, EGL_FALSE);
    731693    }
    732 
    733     return EGL_FALSE;
    734694}
    735695
     
    776736        return error(EGL_BAD_ALLOC, EGL_FALSE);
    777737    }
    778 
    779     return EGL_FALSE;
    780738}
    781739
     
    808766        return error(EGL_BAD_ALLOC, EGL_FALSE);
    809767    }
    810 
    811     return EGL_FALSE;
    812768}
    813769
     
    837793                    {
    838794                        return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);   // Unimplemented
    839                         robust_access = true;
     795                        // robust_access = true;
    840796                    }
    841797                    else if (attribute[1] != EGL_FALSE)
     
    882838        return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
    883839    }
    884 
    885     return EGL_NO_CONTEXT;
    886840}
    887841
     
    913867        return error(EGL_BAD_ALLOC, EGL_FALSE);
    914868    }
    915 
    916     return EGL_FALSE;
    917869}
    918870
     
    954906            UNIMPLEMENTED();   // FIXME
    955907        }
    956 
    957         egl::Surface* previousDraw = static_cast<egl::Surface*>(egl::getCurrentDrawSurface());
    958         egl::Surface* previousRead = static_cast<egl::Surface*>(egl::getCurrentReadSurface());
    959908
    960909        egl::setCurrentDisplay(dpy);
     
    970919        return error(EGL_BAD_ALLOC, EGL_FALSE);
    971920    }
    972 
    973     return EGL_FALSE;
    974921}
    975922
     
    988935        return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
    989936    }
    990 
    991     return EGL_NO_CONTEXT;
    992937}
    993938
     
    1017962        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
    1018963    }
    1019 
    1020     return EGL_NO_SURFACE;
    1021964}
    1022965
     
    1035978        return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
    1036979    }
    1037 
    1038     return EGL_NO_DISPLAY;
    1039980}
    1040981
     
    10621003        return error(EGL_BAD_ALLOC, EGL_FALSE);
    10631004    }
     1005}
     1006
     1007EGLBoolean __stdcall eglWaitGL(void)
     1008{
     1009    EVENT("()");
     1010
     1011    try
     1012    {
     1013        UNIMPLEMENTED();   // FIXME
     1014
     1015        return success(0);
     1016    }
     1017    catch(std::bad_alloc&)
     1018    {
     1019        return error(EGL_BAD_ALLOC, EGL_FALSE);
     1020    }
     1021}
     1022
     1023EGLBoolean __stdcall eglWaitNative(EGLint engine)
     1024{
     1025    EVENT("(EGLint engine = %d)", engine);
     1026
     1027    try
     1028    {
     1029        UNIMPLEMENTED();   // FIXME
     1030
     1031        return success(0);
     1032    }
     1033    catch(std::bad_alloc&)
     1034    {
     1035        return error(EGL_BAD_ALLOC, EGL_FALSE);
     1036    }
     1037}
     1038
     1039EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
     1040{
     1041    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
     1042
     1043    try
     1044    {
     1045        egl::Display *display = static_cast<egl::Display*>(dpy);
     1046        egl::Surface *eglSurface = (egl::Surface*)surface;
     1047
     1048        if (!validateSurface(display, eglSurface))
     1049        {
     1050            return EGL_FALSE;
     1051        }
     1052
     1053        if (display->isDeviceLost())
     1054        {
     1055            return error(EGL_CONTEXT_LOST, EGL_FALSE);
     1056        }
     1057
     1058        if (surface == EGL_NO_SURFACE)
     1059        {
     1060            return error(EGL_BAD_SURFACE, EGL_FALSE);
     1061        }
     1062
     1063        if (eglSurface->swap())
     1064        {
     1065            return success(EGL_TRUE);
     1066        }
     1067    }
     1068    catch(std::bad_alloc&)
     1069    {
     1070        return error(EGL_BAD_ALLOC, EGL_FALSE);
     1071    }
    10641072
    10651073    return EGL_FALSE;
    10661074}
    10671075
    1068 EGLBoolean __stdcall eglWaitGL(void)
    1069 {
    1070     EVENT("()");
    1071 
    1072     try
    1073     {
     1076EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
     1077{
     1078    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)", dpy, surface, target);
     1079
     1080    try
     1081    {
     1082        egl::Display *display = static_cast<egl::Display*>(dpy);
     1083        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
     1084
     1085        if (!validateSurface(display, eglSurface))
     1086        {
     1087            return EGL_FALSE;
     1088        }
     1089
     1090        if (display->isDeviceLost())
     1091        {
     1092            return error(EGL_CONTEXT_LOST, EGL_FALSE);
     1093        }
     1094
    10741095        UNIMPLEMENTED();   // FIXME
    10751096
     
    10801101        return error(EGL_BAD_ALLOC, EGL_FALSE);
    10811102    }
    1082 
    1083     return EGL_FALSE;
    1084 }
    1085 
    1086 EGLBoolean __stdcall eglWaitNative(EGLint engine)
    1087 {
    1088     EVENT("(EGLint engine = %d)", engine);
    1089 
    1090     try
    1091     {
    1092         UNIMPLEMENTED();   // FIXME
    1093 
    1094         return success(0);
    1095     }
    1096     catch(std::bad_alloc&)
    1097     {
    1098         return error(EGL_BAD_ALLOC, EGL_FALSE);
    1099     }
    1100 
    1101     return EGL_FALSE;
    1102 }
    1103 
    1104 EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
    1105 {
    1106     EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
    1107 
    1108     try
    1109     {
    1110         egl::Display *display = static_cast<egl::Display*>(dpy);
    1111         egl::Surface *eglSurface = (egl::Surface*)surface;
    1112 
    1113         if (!validateSurface(display, eglSurface))
    1114         {
    1115             return EGL_FALSE;
    1116         }
    1117 
    1118         if (display->isDeviceLost())
    1119         {
    1120             return error(EGL_CONTEXT_LOST, EGL_FALSE);
    1121         }
    1122 
    1123         if (surface == EGL_NO_SURFACE)
    1124         {
    1125             return error(EGL_BAD_SURFACE, EGL_FALSE);
    1126         }
    1127 
    1128         if (eglSurface->swap())
    1129         {
    1130             return success(EGL_TRUE);
    1131         }
    1132     }
    1133     catch(std::bad_alloc&)
    1134     {
    1135         return error(EGL_BAD_ALLOC, EGL_FALSE);
    1136     }
    1137 
    1138     return EGL_FALSE;
    1139 }
    1140 
    1141 EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
    1142 {
    1143     EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)", dpy, surface, target);
    1144 
    1145     try
    1146     {
    1147         egl::Display *display = static_cast<egl::Display*>(dpy);
    1148         egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
    1149 
    1150         if (!validateSurface(display, eglSurface))
    1151         {
    1152             return EGL_FALSE;
    1153         }
    1154 
    1155         if (display->isDeviceLost())
    1156         {
    1157             return error(EGL_CONTEXT_LOST, EGL_FALSE);
    1158         }
    1159 
    1160         UNIMPLEMENTED();   // FIXME
    1161 
    1162         return success(0);
    1163     }
    1164     catch(std::bad_alloc&)
    1165     {
    1166         return error(EGL_BAD_ALLOC, EGL_FALSE);
    1167     }
    1168 
    1169     return EGL_FALSE;
    11701103}
    11711104
     
    12401173        return error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
    12411174    }
    1242 
    1243     return NULL;
    1244 }
    1245 }
     1175}
     1176}
  • trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.vcproj

    r104363 r112300  
    5151                                RuntimeLibrary="1"
    5252                                UsePrecompiledHeader="0"
    53                                 WarningLevel="3"
     53                                WarningLevel="4"
     54                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
    5455                                Detect64BitPortabilityProblems="false"
    5556                                DebugInformationFormat="4"
     57                                WarnAsError="true"
    5658                        />
    5759                        <Tool
     
    130132                                RuntimeLibrary="0"
    131133                                UsePrecompiledHeader="0"
    132                                 WarningLevel="3"
     134                                WarningLevel="4"
     135                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
    133136                                Detect64BitPortabilityProblems="false"
    134137                                DebugInformationFormat="3"
     138                                WarnAsError="true"
    135139                        />
    136140                        <Tool
     
    212216                                RuntimeLibrary="1"
    213217                                UsePrecompiledHeader="0"
    214                                 WarningLevel="3"
     218                                WarningLevel="4"
     219                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
    215220                                Detect64BitPortabilityProblems="false"
    216221                                DebugInformationFormat="3"
     222                                WarnAsError="true"
    217223                        />
    218224                        <Tool
     
    292298                                RuntimeLibrary="0"
    293299                                UsePrecompiledHeader="0"
    294                                 WarningLevel="3"
     300                                WarningLevel="4"
     301                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
    295302                                Detect64BitPortabilityProblems="false"
    296303                                DebugInformationFormat="3"
     304                                WarnAsError="true"
    297305                        />
    298306                        <Tool
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp

    r95901 r112300  
    505505    RECT scissorRect = {0};   // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
    506506    device->SetScissorRect(&scissorRect);
     507
     508    for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     509    {
     510        device->SetStreamSourceFreq(i, 1);
     511    }
    507512}
    508513
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h

    r95901 r112300  
    1919
    2020#include "common/angleutils.h"
    21 #include "libGLESv2/RefCountObject.h"
     21#include "common/RefCountObject.h"
    2222
    2323namespace gl
     
    4949
    5050    GLubyte *mContents;
    51     size_t mSize;
     51    GLsizeiptr mSize;
    5252    GLenum mUsage;
    5353
    5454    StaticVertexBuffer *mStaticVertexBuffer;
    5555    StaticIndexBuffer *mStaticIndexBuffer;
    56     size_t mUnmodifiedDataUse;
     56    GLsizeiptr mUnmodifiedDataUse;
    5757};
    5858
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    2323#include "libGLESv2/FrameBuffer.h"
    2424#include "libGLESv2/Program.h"
     25#include "libGLESv2/Query.h"
    2526#include "libGLESv2/RenderBuffer.h"
    2627#include "libGLESv2/Shader.h"
     
    3132#undef near
    3233#undef far
    33 
    34 namespace
    35 {
    36     enum { CLOSING_INDEX_BUFFER_SIZE = 4096 };
    37 }
    3834
    3935namespace gl
     
    153149    mIndexDataManager = NULL;
    154150    mBlit = NULL;
    155     mClosingIB = NULL;
     151    mLineLoopIB = NULL;
    156152
    157153    mInvalidEnum = false;
     
    171167    mSupportsDXT5Textures = false;
    172168    mSupportsEventQueries = false;
     169    mSupportsOcclusionQueries = false;
    173170    mNumCompressedTextureFormats = 0;
    174171    mMaxSupportedSamples = 0;
     
    199196    }
    200197
     198    while (!mQueryMap.empty())
     199    {
     200        deleteQuery(mQueryMap.begin()->first);
     201    }
     202
    201203    while (!mMultiSampleSupport.empty())
    202204    {
     
    221223    {
    222224        mState.vertexAttribute[i].mBoundBuffer.set(NULL);
     225    }
     226
     227    for (int i = 0; i < QUERY_TYPE_COUNT; i++)
     228    {
     229        mState.activeQuery[i].set(NULL);
    223230    }
    224231
     
    233240    delete mIndexDataManager;
    234241    delete mBlit;
    235     delete mClosingIB;
     242    delete mLineLoopIB;
    236243
    237244    if (mMaskedClearSavedState)
     
    256263        mBlit = new Blit(this);
    257264
    258         mSupportsShaderModel3 = mDeviceCaps.PixelShaderVersion == D3DPS_VERSION(3, 0);
     265        mSupportsShaderModel3 = mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
    259266        mSupportsVertexTexture = mDisplay->getVertexTextureSupport();
    260267        mSupportsNonPower2Texture = mDisplay->getNonPower2TextureSupport();
     268        mSupportsInstancing = mDisplay->getInstancingSupport();
    261269
    262270        mMaxTextureDimension = std::min(std::min((int)mDeviceCaps.MaxTextureWidth, (int)mDeviceCaps.MaxTextureHeight),
     
    295303
    296304        mSupportsEventQueries = mDisplay->getEventQuerySupport();
     305        mSupportsOcclusionQueries = mDisplay->getOcclusionQuerySupport();
    297306        mSupportsDXT1Textures = mDisplay->getDXT1TextureSupport();
    298307        mSupportsDXT3Textures = mDisplay->getDXT3TextureSupport();
     
    806815}
    807816
     817GLuint Context::getActiveQuery(GLenum target) const
     818{
     819    Query *queryObject = NULL;
     820   
     821    switch (target)
     822    {
     823      case GL_ANY_SAMPLES_PASSED_EXT:
     824        queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED].get();
     825        break;
     826      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
     827        queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE].get();
     828        break;
     829      default:
     830        ASSERT(false);
     831    }
     832
     833    if (queryObject)
     834    {
     835        return queryObject->id();
     836    }
     837    else
     838    {
     839        return 0;
     840    }
     841}
     842
    808843void Context::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
    809844{
     
    906941    GLuint handle = mFenceHandleAllocator.allocate();
    907942
    908     mFenceMap[handle] = new Fence;
     943    mFenceMap[handle] = new Fence(mDisplay);
     944
     945    return handle;
     946}
     947
     948// Returns an unused query name
     949GLuint Context::createQuery()
     950{
     951    GLuint handle = mQueryHandleAllocator.allocate();
     952
     953    mQueryMap[handle] = NULL;
    909954
    910955    return handle;
     
    9751020        delete fenceObject->second;
    9761021        mFenceMap.erase(fenceObject);
     1022    }
     1023}
     1024
     1025void Context::deleteQuery(GLuint query)
     1026{
     1027    QueryMap::iterator queryObject = mQueryMap.find(query);
     1028    if (queryObject != mQueryMap.end())
     1029    {
     1030        mQueryHandleAllocator.release(queryObject->first);
     1031        if (queryObject->second)
     1032        {
     1033            queryObject->second->release();
     1034        }
     1035        mQueryMap.erase(queryObject);
    9771036    }
    9781037}
     
    10941153}
    10951154
     1155void Context::beginQuery(GLenum target, GLuint query)
     1156{
     1157    // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id> 
     1158    // of zero, if the active query object name for <target> is non-zero (for the 
     1159    // targets ANY_SAMPLES_PASSED_EXT and ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, if 
     1160    // the active query for either target is non-zero), if <id> is the name of an
     1161    // existing query object whose type does not match <target>, or if <id> is the
     1162    // active query object name for any query type, the error INVALID_OPERATION is
     1163    // generated.
     1164
     1165    // Ensure no other queries are active
     1166    // NOTE: If other queries than occlusion are supported, we will need to check
     1167    // separately that:
     1168    //    a) The query ID passed is not the current active query for any target/type
     1169    //    b) There are no active queries for the requested target (and in the case
     1170    //       of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
     1171    //       no query may be active for either if glBeginQuery targets either.
     1172    for (int i = 0; i < QUERY_TYPE_COUNT; i++)
     1173    {
     1174        if (mState.activeQuery[i].get() != NULL)
     1175        {
     1176            return error(GL_INVALID_OPERATION);
     1177        }
     1178    }
     1179
     1180    QueryType qType;
     1181    switch (target)
     1182    {
     1183      case GL_ANY_SAMPLES_PASSED_EXT:
     1184        qType = QUERY_ANY_SAMPLES_PASSED;
     1185        break;
     1186      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
     1187        qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
     1188        break;
     1189      default:
     1190        ASSERT(false);
     1191        return;
     1192    }
     1193
     1194    Query *queryObject = getQuery(query, true, target);
     1195
     1196    // check that name was obtained with glGenQueries
     1197    if (!queryObject)
     1198    {
     1199        return error(GL_INVALID_OPERATION);
     1200    }
     1201
     1202    // check for type mismatch
     1203    if (queryObject->getType() != target)
     1204    {
     1205        return error(GL_INVALID_OPERATION);
     1206    }
     1207
     1208    // set query as active for specified target
     1209    mState.activeQuery[qType].set(queryObject);
     1210
     1211    // begin query
     1212    queryObject->begin();
     1213}
     1214
     1215void Context::endQuery(GLenum target)
     1216{
     1217    QueryType qType;
     1218
     1219    switch (target)
     1220    {
     1221      case GL_ANY_SAMPLES_PASSED_EXT:
     1222        qType = QUERY_ANY_SAMPLES_PASSED;
     1223        break;
     1224      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
     1225        qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
     1226        break;
     1227      default:
     1228        ASSERT(false);
     1229        return;
     1230    }
     1231
     1232    Query *queryObject = mState.activeQuery[qType].get();
     1233
     1234    if (queryObject == NULL)
     1235    {
     1236        return error(GL_INVALID_OPERATION);
     1237    }
     1238
     1239    queryObject->end();
     1240
     1241    mState.activeQuery[qType].set(NULL);
     1242}
     1243
    10961244void Context::setFramebufferZero(Framebuffer *buffer)
    10971245{
     
    11351283    {
    11361284        return fence->second;
     1285    }
     1286}
     1287
     1288Query *Context::getQuery(unsigned int handle, bool create, GLenum type)
     1289{
     1290    QueryMap::iterator query = mQueryMap.find(handle);
     1291
     1292    if (query == mQueryMap.end())
     1293    {
     1294        return NULL;
     1295    }
     1296    else
     1297    {
     1298        if (!query->second && create)
     1299        {
     1300            query->second = new Query(handle, type);
     1301            query->second->addRef();
     1302        }
     1303        return query->second;
    11371304    }
    11381305}
     
    20802247}
    20812248
    2082 GLenum Context::applyVertexBuffer(GLint first, GLsizei count)
     2249GLenum Context::applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw)
    20832250{
    20842251    TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS];
    20852252
    2086     GLenum err = mVertexDataManager->prepareVertexData(first, count, attributes);
     2253    GLenum err = mVertexDataManager->prepareVertexData(first, count, attributes, instances);
    20872254    if (err != GL_NO_ERROR)
    20882255    {
     
    20902257    }
    20912258
    2092     return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, getCurrentProgram());
     2259    return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, getCurrentProgram(), instances, repeatDraw);
    20932260}
    20942261
    20952262// Applies the indices and element array bindings to the Direct3D 9 device
    2096 GLenum Context::applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
     2263GLenum Context::applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
    20972264{
    20982265    GLenum err = mIndexDataManager->prepareIndexData(type, count, mState.elementArrayBuffer.get(), indices, indexInfo);
     
    22642431    IDirect3DSurface9 *systemSurface = NULL;
    22652432    bool directToPixels = getPackReverseRowOrder() && getPackAlignment() <= 4 && mDisplay->isD3d9ExDevice() &&
    2266                           x == 0 && y == 0 && width == desc.Width && height == desc.Height &&
     2433                          x == 0 && y == 0 && UINT(width) == desc.Width && UINT(height) == desc.Height &&
    22672434                          desc.Format == D3DFMT_A8R8G8B8 && format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE;
    22682435    if (directToPixels)
     
    24472614                UNIMPLEMENTED();   // FIXME
    24482615                UNREACHABLE();
     2616                return;
    24492617            }
    24502618
     
    26392807            mDevice->SetRenderState(D3DRS_TEXTUREFACTOR, color);
    26402808            mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
     2809           
     2810            for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     2811            {
     2812                mDevice->SetStreamSourceFreq(i, 1);
     2813            }
    26412814
    26422815            hr = mDevice->EndStateBlock(&mMaskedClearSavedState);
     
    26982871        mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
    26992872
     2873        for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     2874        {
     2875            mDevice->SetStreamSourceFreq(i, 1);
     2876        }
     2877
    27002878        float quad[4][4];   // A quadrilateral covering the target, aligned to match the edges
    27012879        quad[0][0] = -0.5f;
     
    27402918}
    27412919
    2742 void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
     2920void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
    27432921{
    27442922    if (!mState.currentProgram)
     
    27652943    applyState(mode);
    27662944
    2767     GLenum err = applyVertexBuffer(first, count);
     2945    GLsizei repeatDraw = 1;
     2946    GLenum err = applyVertexBuffer(first, count, instances, &repeatDraw);
    27682947    if (err != GL_NO_ERROR)
    27692948    {
     
    27832962        mDisplay->startScene();
    27842963       
    2785         mDevice->DrawPrimitive(primitiveType, 0, primitiveCount);
    2786 
    2787         if (mode == GL_LINE_LOOP)   // Draw the last segment separately
    2788         {
    2789             drawClosingLine(0, count - 1, 0);
    2790         }
    2791     }
    2792 }
    2793 
    2794 void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
     2964        if (mode == GL_LINE_LOOP)
     2965        {
     2966            drawLineLoop(count, GL_NONE, NULL, 0);
     2967        }
     2968        else if (instances > 0)
     2969        {
     2970            StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
     2971            if (countingIB)
     2972            {
     2973                if (mAppliedIBSerial != countingIB->getSerial())
     2974                {
     2975                    mDevice->SetIndices(countingIB->getBuffer());
     2976                    mAppliedIBSerial = countingIB->getSerial();
     2977                }
     2978
     2979                for (int i = 0; i < repeatDraw; i++)
     2980                {
     2981                    mDevice->DrawIndexedPrimitive(primitiveType, 0, 0, count, 0, primitiveCount);
     2982                }
     2983            }
     2984            else
     2985            {
     2986                ERR("Could not create a counting index buffer for glDrawArraysInstanced.");
     2987                return error(GL_OUT_OF_MEMORY);
     2988            }
     2989        }
     2990        else   // Regular case
     2991        {
     2992            mDevice->DrawPrimitive(primitiveType, 0, primitiveCount);
     2993        }
     2994    }
     2995}
     2996
     2997void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances)
    27952998{
    27962999    if (!mState.currentProgram)
     
    28303033
    28313034    GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
    2832     err = applyVertexBuffer(indexInfo.minIndex, vertexCount);
     3035    GLsizei repeatDraw = 1;
     3036    err = applyVertexBuffer(indexInfo.minIndex, vertexCount, instances, &repeatDraw);
    28333037    if (err != GL_NO_ERROR)
    28343038    {
     
    28483052        mDisplay->startScene();
    28493053
    2850         mDevice->DrawIndexedPrimitive(primitiveType, -(INT)indexInfo.minIndex, indexInfo.minIndex, vertexCount, indexInfo.startIndex, primitiveCount);
    2851 
    2852         if (mode == GL_LINE_LOOP)   // Draw the last segment separately
    2853         {
    2854             drawClosingLine(count, type, indices, indexInfo.minIndex);
     3054        if (mode == GL_LINE_LOOP)
     3055        {
     3056            drawLineLoop(count, type, indices, indexInfo.minIndex);   
     3057        }
     3058        else
     3059        {
     3060            for (int i = 0; i < repeatDraw; i++)
     3061            {
     3062                mDevice->DrawIndexedPrimitive(primitiveType, -(INT)indexInfo.minIndex, indexInfo.minIndex, vertexCount, indexInfo.startIndex, primitiveCount);
     3063            }
    28553064        }
    28563065    }
     
    28603069void Context::sync(bool block)
    28613070{
    2862     egl::Display *display = getDisplay();
    2863     IDirect3DQuery9 *eventQuery = NULL;
    2864     HRESULT result;
    2865 
    2866     result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &eventQuery);
    2867     if (FAILED(result))
    2868     {
    2869         ERR("CreateQuery failed hr=%x\n", result);
    2870         if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
    2871         {
    2872             return error(GL_OUT_OF_MEMORY);
    2873         }
    2874         ASSERT(false);
    2875         return;
    2876     }
    2877 
    2878     result = eventQuery->Issue(D3DISSUE_END);
    2879     if (FAILED(result))
    2880     {
    2881         ERR("eventQuery->Issue(END) failed hr=%x\n", result);
    2882         ASSERT(false);
    2883         eventQuery->Release();
    2884         return;
    2885     }
    2886 
    2887     do
    2888     {
    2889         result = eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
    2890 
    2891         if(block && result == S_FALSE)
    2892         {
    2893             // Keep polling, but allow other threads to do something useful first
    2894             Sleep(0);
    2895             // explicitly check for device loss
    2896             // some drivers seem to return S_FALSE even if the device is lost
    2897             // instead of D3DERR_DEVICELOST like they should
    2898             if (display->testDeviceLost())
    2899             {
    2900                 result = D3DERR_DEVICELOST;
    2901             }
    2902         }
    2903     }
    2904     while(block && result == S_FALSE);
    2905 
    2906     eventQuery->Release();
    2907 
    2908     if (checkDeviceLost(result))
    2909     {
    2910         error(GL_OUT_OF_MEMORY);
    2911     }
    2912 }
    2913 
    2914 void Context::drawClosingLine(unsigned int first, unsigned int last, int minIndex)
    2915 {
    2916     IDirect3DIndexBuffer9 *indexBuffer = NULL;
    2917     bool succeeded = false;
    2918     UINT offset;
    2919 
    2920     if (supports32bitIndices())
    2921     {
    2922         const int spaceNeeded = 2 * sizeof(unsigned int);
    2923 
    2924         if (!mClosingIB)
    2925         {
    2926             mClosingIB = new StreamingIndexBuffer(mDevice, CLOSING_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
    2927         }
    2928 
    2929         mClosingIB->reserveSpace(spaceNeeded, GL_UNSIGNED_INT);
    2930 
    2931         unsigned int *data = static_cast<unsigned int*>(mClosingIB->map(spaceNeeded, &offset));
    2932         if (data)
    2933         {
    2934             data[0] = last;
    2935             data[1] = first;
    2936             mClosingIB->unmap();
    2937             offset /= 4;
    2938             succeeded = true;
    2939         }
    2940     }
    2941     else
    2942     {
    2943         const int spaceNeeded = 2 * sizeof(unsigned short);
    2944 
    2945         if (!mClosingIB)
    2946         {
    2947             mClosingIB = new StreamingIndexBuffer(mDevice, CLOSING_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
    2948         }
    2949 
    2950         mClosingIB->reserveSpace(spaceNeeded, GL_UNSIGNED_SHORT);
    2951 
    2952         unsigned short *data = static_cast<unsigned short*>(mClosingIB->map(spaceNeeded, &offset));
    2953         if (data)
    2954         {
    2955             data[0] = last;
    2956             data[1] = first;
    2957             mClosingIB->unmap();
    2958             offset /= 2;
    2959             succeeded = true;
    2960         }
    2961     }
    2962    
    2963     if (succeeded)
    2964     {
    2965         mDevice->SetIndices(mClosingIB->getBuffer());
    2966         mAppliedIBSerial = mClosingIB->getSerial();
    2967 
    2968         mDevice->DrawIndexedPrimitive(D3DPT_LINELIST, -minIndex, minIndex, last, offset, 1);
    2969     }
    2970     else
    2971     {
    2972         ERR("Could not create an index buffer for closing a line loop.");
    2973         error(GL_OUT_OF_MEMORY);
    2974     }
    2975 }
    2976 
    2977 void Context::drawClosingLine(GLsizei count, GLenum type, const void *indices, int minIndex)
    2978 {
    2979     unsigned int first = 0;
    2980     unsigned int last = 0;
    2981 
    2982     if (mState.elementArrayBuffer.get())
     3071    mDisplay->sync(block);
     3072}
     3073
     3074void Context::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex)
     3075{
     3076    // Get the raw indices for an indexed draw
     3077    if (type != GL_NONE && mState.elementArrayBuffer.get())
    29833078    {
    29843079        Buffer *indexBuffer = mState.elementArrayBuffer.get();
     
    29873082    }
    29883083
    2989     switch (type)
    2990     {
    2991       case GL_UNSIGNED_BYTE:
    2992         first = static_cast<const GLubyte*>(indices)[0];
    2993         last = static_cast<const GLubyte*>(indices)[count - 1];
    2994         break;
    2995       case GL_UNSIGNED_SHORT:
    2996         first = static_cast<const GLushort*>(indices)[0];
    2997         last = static_cast<const GLushort*>(indices)[count - 1];
    2998         break;
    2999       case GL_UNSIGNED_INT:
    3000         first = static_cast<const GLuint*>(indices)[0];
    3001         last = static_cast<const GLuint*>(indices)[count - 1];
    3002         break;
    3003       default: UNREACHABLE();
    3004     }
    3005 
    3006     drawClosingLine(first, last, minIndex);
     3084    UINT startIndex = 0;
     3085    bool succeeded = false;
     3086
     3087    if (supports32bitIndices())
     3088    {
     3089        const int spaceNeeded = (count + 1) * sizeof(unsigned int);
     3090
     3091        if (!mLineLoopIB)
     3092        {
     3093            mLineLoopIB = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
     3094        }
     3095
     3096        if (mLineLoopIB)
     3097        {
     3098            mLineLoopIB->reserveSpace(spaceNeeded, GL_UNSIGNED_INT);
     3099
     3100            UINT offset = 0;
     3101            unsigned int *data = static_cast<unsigned int*>(mLineLoopIB->map(spaceNeeded, &offset));
     3102            startIndex = offset / 4;
     3103           
     3104            if (data)
     3105            {
     3106                switch (type)
     3107                {
     3108                  case GL_NONE:   // Non-indexed draw
     3109                    for (int i = 0; i < count; i++)
     3110                    {
     3111                        data[i] = i;
     3112                    }
     3113                    data[count] = 0;
     3114                    break;
     3115                  case GL_UNSIGNED_BYTE:
     3116                    for (int i = 0; i < count; i++)
     3117                    {
     3118                        data[i] = static_cast<const GLubyte*>(indices)[i];
     3119                    }
     3120                    data[count] = static_cast<const GLubyte*>(indices)[0];
     3121                    break;
     3122                  case GL_UNSIGNED_SHORT:
     3123                    for (int i = 0; i < count; i++)
     3124                    {
     3125                        data[i] = static_cast<const GLushort*>(indices)[i];
     3126                    }
     3127                    data[count] = static_cast<const GLushort*>(indices)[0];
     3128                    break;
     3129                  case GL_UNSIGNED_INT:
     3130                    for (int i = 0; i < count; i++)
     3131                    {
     3132                        data[i] = static_cast<const GLuint*>(indices)[i];
     3133                    }
     3134                    data[count] = static_cast<const GLuint*>(indices)[0];
     3135                    break;
     3136                  default: UNREACHABLE();
     3137                }
     3138
     3139                mLineLoopIB->unmap();
     3140                succeeded = true;
     3141            }
     3142        }
     3143    }
     3144    else
     3145    {
     3146        const int spaceNeeded = (count + 1) * sizeof(unsigned short);
     3147
     3148        if (!mLineLoopIB)
     3149        {
     3150            mLineLoopIB = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
     3151        }
     3152
     3153        if (mLineLoopIB)
     3154        {
     3155            mLineLoopIB->reserveSpace(spaceNeeded, GL_UNSIGNED_SHORT);
     3156
     3157            UINT offset = 0;
     3158            unsigned short *data = static_cast<unsigned short*>(mLineLoopIB->map(spaceNeeded, &offset));
     3159            startIndex = offset / 2;
     3160           
     3161            if (data)
     3162            {
     3163                switch (type)
     3164                {
     3165                  case GL_NONE:   // Non-indexed draw
     3166                    for (int i = 0; i < count; i++)
     3167                    {
     3168                        data[i] = i;
     3169                    }
     3170                    data[count] = 0;
     3171                    break;
     3172                  case GL_UNSIGNED_BYTE:
     3173                    for (int i = 0; i < count; i++)
     3174                    {
     3175                        data[i] = static_cast<const GLubyte*>(indices)[i];
     3176                    }
     3177                    data[count] = static_cast<const GLubyte*>(indices)[0];
     3178                    break;
     3179                  case GL_UNSIGNED_SHORT:
     3180                    for (int i = 0; i < count; i++)
     3181                    {
     3182                        data[i] = static_cast<const GLushort*>(indices)[i];
     3183                    }
     3184                    data[count] = static_cast<const GLushort*>(indices)[0];
     3185                    break;
     3186                  case GL_UNSIGNED_INT:
     3187                    for (int i = 0; i < count; i++)
     3188                    {
     3189                        data[i] = static_cast<const GLuint*>(indices)[i];
     3190                    }
     3191                    data[count] = static_cast<const GLuint*>(indices)[0];
     3192                    break;
     3193                  default: UNREACHABLE();
     3194                }
     3195
     3196                mLineLoopIB->unmap();
     3197                succeeded = true;
     3198            }
     3199        }
     3200    }
     3201   
     3202    if (succeeded)
     3203    {
     3204        if (mAppliedIBSerial != mLineLoopIB->getSerial())
     3205        {
     3206            mDevice->SetIndices(mLineLoopIB->getBuffer());
     3207            mAppliedIBSerial = mLineLoopIB->getSerial();
     3208        }
     3209
     3210        mDevice->DrawIndexedPrimitive(D3DPT_LINESTRIP, -minIndex, minIndex, count, startIndex, count);
     3211    }
     3212    else
     3213    {
     3214        ERR("Could not create a looping index buffer for GL_LINE_LOOP.");
     3215        return error(GL_OUT_OF_MEMORY);
     3216    }
    30073217}
    30083218
     
    31633373}
    31643374
     3375bool Context::supportsOcclusionQueries() const
     3376{
     3377    return mSupportsOcclusionQueries;
     3378}
     3379
    31653380bool Context::supportsDXT1Textures() const
    31663381{
     
    32463461{
    32473462    return mSupportsNonPower2Texture;
     3463}
     3464
     3465bool Context::supportsInstancing() const
     3466{
     3467    return mSupportsInstancing;
    32483468}
    32493469
     
    34363656}
    34373657
     3658void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
     3659{
     3660    ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
     3661
     3662    mState.vertexAttribute[index].mDivisor = divisor;
     3663}
     3664
    34383665// keep list sorted in following order
    34393666// OES extensions
     
    34773704
    34783705    // Multi-vendor (EXT) extensions
     3706    if (supportsOcclusionQueries())
     3707    {
     3708        mExtensionString += "GL_EXT_occlusion_query_boolean ";
     3709    }
     3710
    34793711    mExtensionString += "GL_EXT_read_format_bgra ";
    34803712    mExtensionString += "GL_EXT_robustness ";
     
    34933725    {
    34943726        mExtensionString += "GL_ANGLE_framebuffer_multisample ";
     3727    }
     3728
     3729    if (supportsInstancing())
     3730    {
     3731        mExtensionString += "GL_ANGLE_instanced_arrays ";
    34953732    }
    34963733
     
    38384075}
    38394076
    3840 GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], Program *program)
    3841 {
     4077GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], Program *program, GLsizei instances, GLsizei *repeatDraw)
     4078{
     4079    *repeatDraw = 1;
     4080
     4081    int indexedAttribute = MAX_VERTEX_ATTRIBS;
     4082    int instancedAttribute = MAX_VERTEX_ATTRIBS;
     4083
     4084    if (instances > 0)
     4085    {
     4086        // Find an indexed attribute to be mapped to D3D stream 0
     4087        for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     4088        {
     4089            if (attributes[i].active)
     4090            {
     4091                if (indexedAttribute == MAX_VERTEX_ATTRIBS)
     4092                {
     4093                    if (attributes[i].divisor == 0)
     4094                    {
     4095                        indexedAttribute = i;
     4096                    }
     4097                }
     4098                else if (instancedAttribute == MAX_VERTEX_ATTRIBS)
     4099                {
     4100                    if (attributes[i].divisor != 0)
     4101                    {
     4102                        instancedAttribute = i;
     4103                    }
     4104                }
     4105                else break;   // Found both an indexed and instanced attribute
     4106            }
     4107        }
     4108
     4109        if (indexedAttribute == MAX_VERTEX_ATTRIBS)
     4110        {
     4111            return GL_INVALID_OPERATION;
     4112        }
     4113    }
     4114
    38424115    D3DVERTEXELEMENT9 elements[MAX_VERTEX_ATTRIBS + 1];
    38434116    D3DVERTEXELEMENT9 *element = &elements[0];
     
    38474120        if (attributes[i].active)
    38484121        {
    3849             if (mAppliedVBs[i].serial != attributes[i].serial ||
    3850                 mAppliedVBs[i].stride != attributes[i].stride ||
    3851                 mAppliedVBs[i].offset != attributes[i].offset)
    3852             {
    3853                 device->SetStreamSource(i, attributes[i].vertexBuffer, attributes[i].offset, attributes[i].stride);
    3854                 mAppliedVBs[i].serial = attributes[i].serial;
    3855                 mAppliedVBs[i].stride = attributes[i].stride;
    3856                 mAppliedVBs[i].offset = attributes[i].offset;
    3857             }
    3858 
    3859             element->Stream = i;
     4122            int stream = i;
     4123
     4124            if (instances > 0)
     4125            {
     4126                // Due to a bug on ATI cards we can't enable instancing when none of the attributes are instanced.
     4127                if (instancedAttribute == MAX_VERTEX_ATTRIBS)
     4128                {
     4129                    *repeatDraw = instances;
     4130                }
     4131                else
     4132                {
     4133                    if (i == indexedAttribute)
     4134                    {
     4135                        stream = 0;
     4136                    }
     4137                    else if (i == 0)
     4138                    {
     4139                        stream = indexedAttribute;
     4140                    }
     4141
     4142                    UINT frequency = 1;
     4143                   
     4144                    if (attributes[i].divisor == 0)
     4145                    {
     4146                        frequency = D3DSTREAMSOURCE_INDEXEDDATA | instances;
     4147                    }
     4148                    else
     4149                    {
     4150                        frequency = D3DSTREAMSOURCE_INSTANCEDATA | attributes[i].divisor;
     4151                    }
     4152                   
     4153                    device->SetStreamSourceFreq(stream, frequency);
     4154                    mInstancingEnabled = true;
     4155                }
     4156            }
     4157
     4158            if (mAppliedVBs[stream].serial != attributes[i].serial ||
     4159                mAppliedVBs[stream].stride != attributes[i].stride ||
     4160                mAppliedVBs[stream].offset != attributes[i].offset)
     4161            {
     4162                device->SetStreamSource(stream, attributes[i].vertexBuffer, attributes[i].offset, attributes[i].stride);
     4163                mAppliedVBs[stream].serial = attributes[i].serial;
     4164                mAppliedVBs[stream].stride = attributes[i].stride;
     4165                mAppliedVBs[stream].offset = attributes[i].offset;
     4166            }
     4167
     4168            element->Stream = stream;
    38604169            element->Offset = 0;
    38614170            element->Type = attributes[i].type;
     
    38674176    }
    38684177
     4178    if (instances == 0 || instancedAttribute == MAX_VERTEX_ATTRIBS)
     4179    {
     4180        if (mInstancingEnabled)
     4181        {
     4182            for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     4183            {
     4184                device->SetStreamSourceFreq(i, 1);
     4185            }
     4186
     4187            mInstancingEnabled = false;
     4188        }
     4189    }
     4190
    38694191    static const D3DVERTEXELEMENT9 end = D3DDECL_END();
    38704192    *(element++) = end;
     
    39214243
    39224244    mLastSetVDecl = NULL;
     4245    mInstancingEnabled = true;   // Forces it to be disabled when not used
    39234246}
    39244247
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    2222
    2323#include "common/angleutils.h"
     24#include "common/RefCountObject.h"
    2425#include "libGLESv2/ResourceManager.h"
    2526#include "libGLESv2/HandleAllocator.h"
    26 #include "libGLESv2/RefCountObject.h"
    2727
    2828namespace egl
     
    5656class Blit;
    5757class Fence;
     58class Query;
    5859
    5960enum
    6061{
     62    D3D9_MAX_FLOAT_CONSTANTS = 256,
     63    D3D9_MAX_BOOL_CONSTANTS = 16,
     64    D3D9_MAX_INT_CONSTANTS = 16,
     65
    6166    MAX_VERTEX_ATTRIBS = 16,
    62     MAX_VERTEX_UNIFORM_VECTORS = 256 - 2,   // 256 is the minimum for SM2, and in practice the maximum for DX9. Reserve space for dx_HalfPixelSize and dx_DepthRange.
     67    MAX_VERTEX_UNIFORM_VECTORS = D3D9_MAX_FLOAT_CONSTANTS - 2,   // Reserve space for dx_HalfPixelSize and dx_DepthRange.
    6368    MAX_VARYING_VECTORS_SM2 = 8,
    6469    MAX_VARYING_VECTORS_SM3 = 10,
     
    7479};
    7580
     81enum QueryType
     82{
     83    QUERY_ANY_SAMPLES_PASSED,
     84    QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
     85
     86    QUERY_TYPE_COUNT
     87};
     88
    7689const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
    7790const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
     
    92105{
    93106  public:
    94     VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false)
     107    VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
    95108    {
    96109        mCurrentValue[0] = 0.0f;
     
    135148    bool mArrayEnabled;   // From glEnable/DisableVertexAttribArray
    136149    float mCurrentValue[4];   // From glVertexAttrib
     150    unsigned int mDivisor;
    137151};
    138152
     
    217231    VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
    218232    BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF];
     233    BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
    219234
    220235    GLint unpackAlignment;
     
    230245    ~VertexDeclarationCache();
    231246
    232     GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], Program *program);
     247    GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], Program *program, GLsizei instances, GLsizei *repeatDraw);
    233248
    234249    void markStateDirty();
     
    248263    VBData mAppliedVBs[MAX_VERTEX_ATTRIBS];
    249264    IDirect3DVertexDeclaration9 *mLastSetVDecl;
     265    bool mInstancingEnabled;
    250266
    251267    struct VertexDeclCacheEntry
     
    348364    GLuint getArrayBufferHandle() const;
    349365
     366    GLuint getActiveQuery(GLenum target) const;
     367
    350368    void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
    351369    const VertexAttribute &getVertexAttribState(unsigned int attribNum);
     
    386404    GLuint createFence();
    387405    void deleteFence(GLuint fence);
     406   
     407    // Queries are owned by the Context;
     408    GLuint createQuery();
     409    void deleteQuery(GLuint query);
    388410
    389411    void bindArrayBuffer(GLuint buffer);
     
    396418    void useProgram(GLuint program);
    397419
     420    void beginQuery(GLenum target, GLuint query);
     421    void endQuery(GLenum target);
     422
    398423    void setFramebufferZero(Framebuffer *framebuffer);
    399424
     
    401426
    402427    void setVertexAttrib(GLuint index, const GLfloat *values);
     428    void setVertexAttribDivisor(GLuint index, GLuint divisor);
    403429
    404430    Buffer *getBuffer(GLuint handle);
     
    409435    Framebuffer *getFramebuffer(GLuint handle);
    410436    Renderbuffer *getRenderbuffer(GLuint handle);
     437    Query *getQuery(GLuint handle, bool create, GLenum type);
    411438
    412439    Buffer *getArrayBuffer();
     
    427454    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
    428455    void clear(GLbitfield mask);
    429     void drawArrays(GLenum mode, GLint first, GLsizei count);
    430     void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
     456    void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
     457    void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
    431458    void sync(bool block);   // flush/finish
    432459
    433         // Draw the last segment of a line loop
    434     void drawClosingLine(unsigned int first, unsigned int last, int minIndex);
    435     void drawClosingLine(GLsizei count, GLenum type, const void *indices, int minIndex);
     460    void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex);
    436461
    437462    void recordInvalidEnum();
     
    459484    const char *getRendererString() const;
    460485    bool supportsEventQueries() const;
     486    bool supportsOcclusionQueries() const;
    461487    bool supportsDXT1Textures() const;
    462488    bool supportsDXT3Textures() const;
     
    472498    bool supports32bitIndices() const;
    473499    bool supportsNonPower2Texture() const;
     500    bool supportsInstancing() const;
    474501
    475502    void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
     
    486513    bool applyRenderTarget(bool ignoreViewport);
    487514    void applyState(GLenum drawMode);
    488     GLenum applyVertexBuffer(GLint first, GLsizei count);
    489     GLenum applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
     515    GLenum applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw);
     516    GLenum applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
    490517    void applyShaders();
    491518    void applyTextures();
     
    522549    HandleAllocator mFenceHandleAllocator;
    523550
     551    typedef stdext::hash_map<GLuint, Query*> QueryMap;
     552    QueryMap mQueryMap;
     553    HandleAllocator mQueryHandleAllocator;
     554
    524555    std::string mExtensionString;
    525556    std::string mRendererString;
     
    530561    Blit *mBlit;
    531562
    532     StreamingIndexBuffer *mClosingIB;
     563    StreamingIndexBuffer *mLineLoopIB;
    533564   
    534565    BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
     
    567598    bool mSupportsVertexTexture;
    568599    bool mSupportsNonPower2Texture;
     600    bool mSupportsInstancing;
    569601    int  mMaxRenderbufferDimension;
    570602    int  mMaxTextureDimension;
     
    574606    GLsizei mMaxSupportedSamples;
    575607    bool mSupportsEventQueries;
     608    bool mSupportsOcclusionQueries;
    576609    bool mSupportsDXT1Textures;
    577610    bool mSupportsDXT3Textures;
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp

    r104363 r112300  
    1414{
    1515
    16 Fence::Fence()
    17 {
     16Fence::Fence(egl::Display* display)
     17{
     18    mDisplay = display;
    1819    mQuery = NULL;
    1920    mCondition = GL_NONE;
     
    2526    if (mQuery != NULL)
    2627    {
    27         mQuery->Release();
    28         mQuery = NULL;
     28        mDisplay->freeEventQuery(mQuery);
    2929    }
    3030}
     
    3939void Fence::setFence(GLenum condition)
    4040{
    41     if (mQuery != NULL)
     41    if (!mQuery)
    4242    {
    43         mQuery->Release();
    44         mQuery = NULL;
    45     }
    46 
    47     if (FAILED(getDevice()->CreateQuery(D3DQUERYTYPE_EVENT, &mQuery)))
    48     {
    49         return error(GL_OUT_OF_MEMORY);
     43        mQuery = mDisplay->allocateEventQuery();
     44        if (!mQuery)
     45        {
     46            return error(GL_OUT_OF_MEMORY);
     47        }
    5048    }
    5149
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h

    r95901 r112300  
    1616#include "common/angleutils.h"
    1717
     18namespace egl
     19{
     20class Display;
     21}
     22
    1823namespace gl
    1924{
     
    2227{
    2328  public:
    24     Fence();
     29    explicit Fence(egl::Display* display);
    2530    virtual ~Fence();
    2631
     
    3439    DISALLOW_COPY_AND_ASSIGN(Fence);
    3540
     41    egl::Display* mDisplay;
    3642    IDirect3DQuery9* mQuery;
    3743    GLenum mCondition;
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp

    r104363 r112300  
    4545        buffer = context->getRenderbuffer(handle);
    4646    }
    47     else if (IsTextureTarget(type))
     47    else if (IsInternalTextureTarget(type))
    4848    {
    4949        buffer = context->getTexture(handle)->getRenderbuffer(type);
     
    7777void Framebuffer::detachTexture(GLuint texture)
    7878{
    79     if (mColorbufferPointer.id() == texture && IsTextureTarget(mColorbufferType))
     79    if (mColorbufferPointer.id() == texture && IsInternalTextureTarget(mColorbufferType))
    8080    {
    8181        mColorbufferType = GL_NONE;
     
    8383    }
    8484
    85     if (mDepthbufferPointer.id() == texture && IsTextureTarget(mDepthbufferType))
     85    if (mDepthbufferPointer.id() == texture && IsInternalTextureTarget(mDepthbufferType))
    8686    {
    8787        mDepthbufferType = GL_NONE;
     
    8989    }
    9090
    91     if (mStencilbufferPointer.id() == texture && IsTextureTarget(mStencilbufferType))
     91    if (mStencilbufferPointer.id() == texture && IsInternalTextureTarget(mStencilbufferType))
    9292    {
    9393        mStencilbufferType = GL_NONE;
     
    269269            }
    270270        }
    271         else if (IsTextureTarget(mColorbufferType))
     271        else if (IsInternalTextureTarget(mColorbufferType))
    272272        {
    273273            if (IsCompressed(colorbuffer->getInternalFormat()))
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h

    r104363 r112300  
    1616
    1717#include "common/angleutils.h"
    18 #include "libGLESv2/RefCountObject.h"
     18#include "common/RefCountObject.h"
    1919
    2020namespace gl
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    1616#include "libGLESv2/main.h"
    1717
    18 namespace
    19 {
    20     enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
    21 }
    22 
    2318namespace gl
    2419{
     
    4944        ERR("Failed to allocate the streaming index buffer(s).");
    5045    }
     46
     47    mCountingBuffer = NULL;
    5148}
    5249
     
    5552    delete mStreamingBufferShort;
    5653    delete mStreamingBufferInt;
     54    delete mCountingBuffer;
    5755}
    5856
     
    9391}
    9492
    95 void computeRange(GLenum type, const void *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex)
     93void computeRange(GLenum type, const GLvoid *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex)
    9694{
    9795    if (type == GL_UNSIGNED_BYTE)
     
    110108}
    111109
    112 GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const void *indices, TranslatedIndexData *translated)
     110GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated)
    113111{
    114112    if (!mStreamingBufferShort)
     
    229227}
    230228
     229StaticIndexBuffer *IndexDataManager::getCountingIndices(GLsizei count)
     230{
     231    if (count <= 65536)   // 16-bit indices
     232    {
     233        const unsigned int spaceNeeded = count * sizeof(unsigned short);
     234
     235        if (!mCountingBuffer || mCountingBuffer->size() < spaceNeeded)
     236        {
     237            delete mCountingBuffer;
     238            mCountingBuffer = new StaticIndexBuffer(mDevice);
     239            mCountingBuffer->reserveSpace(spaceNeeded, GL_UNSIGNED_SHORT);
     240
     241            UINT offset;
     242            unsigned short *data = static_cast<unsigned short*>(mCountingBuffer->map(spaceNeeded, &offset));
     243       
     244            if (data)
     245            {
     246                for(int i = 0; i < count; i++)
     247                {
     248                    data[i] = i;
     249                }
     250
     251                mCountingBuffer->unmap();
     252            }
     253        }
     254    }
     255    else if (mStreamingBufferInt)   // 32-bit indices supported
     256    {
     257        const unsigned int spaceNeeded = count * sizeof(unsigned int);
     258
     259        if (!mCountingBuffer || mCountingBuffer->size() < spaceNeeded)
     260        {
     261            delete mCountingBuffer;
     262            mCountingBuffer = new StaticIndexBuffer(mDevice);
     263            mCountingBuffer->reserveSpace(spaceNeeded, GL_UNSIGNED_INT);
     264
     265            UINT offset;
     266            unsigned int *data = static_cast<unsigned int*>(mCountingBuffer->map(spaceNeeded, &offset));
     267       
     268            if (data)
     269            {
     270                for(int i = 0; i < count; i++)
     271                {
     272                    data[i] = i;
     273                }
     274               
     275                mCountingBuffer->unmap();
     276            }
     277        }
     278    }
     279    else return NULL;
     280   
     281    return mCountingBuffer;
     282}
     283
    231284IndexBuffer::IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format) : mDevice(device), mBufferSize(size), mIndexBuffer(NULL)
    232285{
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    1818
    1919#include "libGLESv2/Context.h"
     20
     21namespace
     22{
     23    enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
     24}
    2025
    2126namespace gl
     
    124129    virtual ~IndexDataManager();
    125130
    126     GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated);
     131    GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated);
     132    StaticIndexBuffer *getCountingIndices(GLsizei count);
    127133
    128134  private:
     
    136142    StreamingIndexBuffer *mStreamingBufferShort;
    137143    StreamingIndexBuffer *mStreamingBufferInt;
     144    StaticIndexBuffer *mCountingBuffer;
    138145};
    139146
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    271271GLint Program::getUniformLocation(std::string name)
    272272{
    273     int subscript = 0;
     273    unsigned int subscript = 0;
    274274
    275275    // Strip any trailing array operator and retrieve the subscript
     
    334334
    335335        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    336         GLboolean *boolParams = new GLboolean[count];
     336        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element;
    337337
    338338        for (int i = 0; i < count; ++i)
     
    347347            }
    348348        }
    349 
    350         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean),
    351                boolParams, sizeof(GLboolean) * count);
    352 
    353         delete [] boolParams;
    354349    }
    355350    else
     
    401396        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    402397
    403         GLboolean *boolParams = new GLboolean[count * 2];
     398        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 2;
    404399
    405400        for (int i = 0; i < count * 2; ++i)
     
    414409            }
    415410        }
    416 
    417         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 2,
    418                boolParams, 2 * sizeof(GLboolean) * count);
    419 
    420         delete [] boolParams;
    421411    }
    422412    else
     
    467457
    468458        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    469         GLboolean *boolParams = new GLboolean[count * 3];
     459        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 3;
    470460
    471461        for (int i = 0; i < count * 3; ++i)
     
    480470            }
    481471        }
    482 
    483         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 3,
    484                boolParams, 3 * sizeof(GLboolean) * count);
    485 
    486         delete [] boolParams;
    487472    }
    488473    else
     
    524509
    525510        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    526         GLboolean *boolParams = new GLboolean[count * 4];
     511        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 4;
    527512
    528513        for (int i = 0; i < count * 4; ++i)
     
    537522            }
    538523        }
    539 
    540         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 4,
    541                boolParams, 4 * sizeof(GLboolean) * count);
    542 
    543         delete [] boolParams;
    544524    }
    545525    else
     
    714694
    715695        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    716         GLboolean *boolParams = new GLboolean[count];
     696        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element;
    717697
    718698        for (int i = 0; i < count; ++i)
     
    727707            }
    728708        }
    729 
    730         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean),
    731                boolParams, sizeof(GLboolean) * count);
    732 
    733         delete [] boolParams;
    734709    }
    735710    else
     
    771746
    772747        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    773         GLboolean *boolParams = new GLboolean[count * 2];
     748        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 2;
    774749
    775750        for (int i = 0; i < count * 2; ++i)
     
    784759            }
    785760        }
    786 
    787         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 2,
    788                boolParams, 2 * sizeof(GLboolean) * count);
    789 
    790         delete [] boolParams;
    791761    }
    792762    else
     
    828798
    829799        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    830         GLboolean *boolParams = new GLboolean[count * 3];
     800        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 3;
    831801
    832802        for (int i = 0; i < count * 3; ++i)
     
    841811            }
    842812        }
    843 
    844         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 3,
    845                boolParams, 3 * sizeof(GLboolean) * count);
    846 
    847         delete [] boolParams;
    848813    }
    849814    else
     
    885850
    886851        count = std::min(arraySize - (int)mUniformIndex[location].element, count);
    887         GLboolean *boolParams = new GLboolean[count * 4];
     852        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 4;
    888853
    889854        for (int i = 0; i < count * 4; ++i)
     
    898863            }
    899864        }
    900 
    901         memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 4,
    902                boolParams, 4 * sizeof(GLboolean) * count);
    903 
    904         delete [] boolParams;
    905865    }
    906866    else
     
    11861146    const int maxVaryingVectors = context->getMaximumVaryingVectors();
    11871147
    1188     for (VaryingList::iterator varying = mFragmentShader->varyings.begin(); varying != mFragmentShader->varyings.end(); varying++)
     1148    for (VaryingList::iterator varying = mFragmentShader->mVaryings.begin(); varying != mFragmentShader->mVaryings.end(); varying++)
    11891149    {
    11901150        int n = VariableRowCount(varying->type) * varying->size;
     
    13371297
    13381298    // Reset the varying register assignments
    1339     for (VaryingList::iterator fragVar = mFragmentShader->varyings.begin(); fragVar != mFragmentShader->varyings.end(); fragVar++)
     1299    for (VaryingList::iterator fragVar = mFragmentShader->mVaryings.begin(); fragVar != mFragmentShader->mVaryings.end(); fragVar++)
    13401300    {
    13411301        fragVar->reg = -1;
     
    13431303    }
    13441304
    1345     for (VaryingList::iterator vtxVar = mVertexShader->varyings.begin(); vtxVar != mVertexShader->varyings.end(); vtxVar++)
     1305    for (VaryingList::iterator vtxVar = mVertexShader->mVaryings.begin(); vtxVar != mVertexShader->mVaryings.end(); vtxVar++)
    13461306    {
    13471307        vtxVar->reg = -1;
     
    13701330    }
    13711331
    1372     for (VaryingList::iterator input = mFragmentShader->varyings.begin(); input != mFragmentShader->varyings.end(); input++)
     1332    for (VaryingList::iterator input = mFragmentShader->mVaryings.begin(); input != mFragmentShader->mVaryings.end(); input++)
    13731333    {
    13741334        bool matched = false;
    13751335
    1376         for (VaryingList::iterator output = mVertexShader->varyings.begin(); output != mVertexShader->varyings.end(); output++)
     1336        for (VaryingList::iterator output = mVertexShader->mVaryings.begin(); output != mVertexShader->mVaryings.end(); output++)
    13771337        {
    13781338            if (output->name == input->name)
     
    14851445    }
    14861446
    1487     for (VaryingList::iterator varying = mVertexShader->varyings.begin(); varying != mVertexShader->varyings.end(); varying++)
     1447    for (VaryingList::iterator varying = mVertexShader->mVaryings.begin(); varying != mVertexShader->mVaryings.end(); varying++)
    14881448    {
    14891449        if (varying->reg >= 0)
     
    15531513                  "{\n";
    15541514   
    1555     for (VaryingList::iterator varying = mFragmentShader->varyings.begin(); varying != mFragmentShader->varyings.end(); varying++)
     1515    for (VaryingList::iterator varying = mFragmentShader->mVaryings.begin(); varying != mFragmentShader->mVaryings.end(); varying++)
    15561516    {
    15571517        if (varying->reg >= 0)
     
    16291589    }
    16301590
    1631     for (VaryingList::iterator varying = mFragmentShader->varyings.begin(); varying != mFragmentShader->varyings.end(); varying++)
     1591    for (VaryingList::iterator varying = mFragmentShader->mVaryings.begin(); varying != mFragmentShader->mVaryings.end(); varying++)
    16321592    {
    16331593        if (varying->reg >= 0)
     
    19431903}
    19441904
    1945 bool Program::defineUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &_name)
     1905bool Program::defineUniform(const D3DXCONSTANT_DESC &constantDescription, const std::string &_name)
    19461906{
    19471907    Uniform *uniform = createUniform(constantDescription, _name);
     
    19841944}
    19851945
    1986 Uniform *Program::createUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &_name)
     1946Uniform *Program::createUniform(const D3DXCONSTANT_DESC &constantDescription, const std::string &_name)
    19871947{
    19881948    if (constantDescription.Rows == 1)   // Vectors and scalars
     
    20862046void Program::applyUniformnbv(Uniform *targetUniform, GLsizei count, int width, const GLboolean *v)
    20872047{
    2088     float *vector = NULL;
    2089     BOOL *boolVector = NULL;
     2048    float vector[D3D9_MAX_FLOAT_CONSTANTS * 4];
     2049    BOOL boolVector[D3D9_MAX_BOOL_CONSTANTS];
    20902050
    20912051    if (targetUniform->ps.registerCount && targetUniform->ps.registerSet == D3DXRS_FLOAT4 ||
    20922052        targetUniform->vs.registerCount && targetUniform->vs.registerSet == D3DXRS_FLOAT4)
    20932053    {
    2094         vector = new float[4 * count];
    2095 
     2054        ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
    20962055        for (int i = 0; i < count; i++)
    20972056        {
     
    21132072        targetUniform->vs.registerCount && targetUniform->vs.registerSet == D3DXRS_BOOL)
    21142073    {
    2115         boolVector = new BOOL[count * width];
    2116         for (int i = 0; i < count * width; i++)
     2074        int psCount = targetUniform->ps.registerSet == D3DXRS_BOOL ? targetUniform->ps.registerCount : 0;
     2075        int vsCount = targetUniform->vs.registerSet == D3DXRS_BOOL ? targetUniform->vs.registerCount : 0;
     2076        int copyCount = std::min(count * width, std::max(psCount, vsCount));
     2077        ASSERT(copyCount <= D3D9_MAX_BOOL_CONSTANTS);
     2078        for (int i = 0; i < copyCount; i++)
    21172079        {
    21182080            boolVector[i] = v[i] != GL_FALSE;
     
    21452107        else UNREACHABLE();
    21462108    }
    2147 
    2148     delete [] vector;
    2149     delete [] boolVector;
    21502109}
    21512110
     
    21672126bool Program::applyUniform1iv(Uniform *targetUniform, GLsizei count, const GLint *v)
    21682127{
    2169     D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
     2128    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
     2129    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
    21702130
    21712131    for (int i = 0; i < count; i++)
     
    22222182    }
    22232183
    2224     delete [] vector;
    2225 
    22262184    return true;
    22272185}
     
    22292187bool Program::applyUniform2iv(Uniform *targetUniform, GLsizei count, const GLint *v)
    22302188{
    2231     D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
     2189    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
     2190    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
    22322191
    22332192    for (int i = 0; i < count; i++)
     
    22402199    applyUniformniv(targetUniform, count, vector);
    22412200
    2242     delete[] vector;
    2243 
    22442201    return true;
    22452202}
     
    22472204bool Program::applyUniform3iv(Uniform *targetUniform, GLsizei count, const GLint *v)
    22482205{
    2249     D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
     2206    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
     2207    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
    22502208
    22512209    for (int i = 0; i < count; i++)
     
    22582216    applyUniformniv(targetUniform, count, vector);
    22592217
    2260     delete[] vector;
    2261 
    22622218    return true;
    22632219}
     
    22652221bool Program::applyUniform4iv(Uniform *targetUniform, GLsizei count, const GLint *v)
    22662222{
    2267     D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
     2223    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
     2224    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
    22682225
    22692226    for (int i = 0; i < count; i++)
     
    22752232
    22762233    applyUniformniv(targetUniform, count, vector);
    2277 
    2278     delete [] vector;
    22792234
    22802235    return true;
     
    25022457    if (mInfoLog)
    25032458    {
    2504         while (index < bufSize - 1 && index < (int)strlen(mInfoLog))
    2505         {
    2506             infoLog[index] = mInfoLog[index];
    2507             index++;
    2508         }
     2459        index = std::min(bufSize - 1, (int)strlen(mInfoLog));
     2460        memcpy(infoLog, mInfoLog, index);
    25092461    }
    25102462
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h

    r104363 r112300  
    155155    bool linkUniforms(ID3DXConstantTable *constantTable);
    156156    bool defineUniform(const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name = "");
    157     bool defineUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &name);
    158     Uniform *createUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &name);
     157    bool defineUniform(const D3DXCONSTANT_DESC &constantDescription, const std::string &name);
     158    Uniform *createUniform(const D3DXCONSTANT_DESC &constantDescription, const std::string &name);
    159159    bool applyUniformnfv(Uniform *targetUniform, const GLfloat *v);
    160160    bool applyUniform1iv(Uniform *targetUniform, GLsizei count, const GLint *v);
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp

    r104363 r112300  
    2323}
    2424
     25// The default case for classes inherited from RenderbufferInterface is not to
     26// need to do anything upon the reference count to the parent Renderbuffer incrementing
     27// or decrementing.
     28void RenderbufferInterface::addProxyRef(const Renderbuffer *proxy)
     29{
     30}
     31
     32void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy)
     33{
     34}
     35
    2536GLuint RenderbufferInterface::getRedSize() const
    2637{
     
    5364}
    5465
    55 RenderbufferTexture::RenderbufferTexture(Texture *texture, GLenum target) : mTexture(texture), mTarget(target)
    56 {
     66RenderbufferTexture::RenderbufferTexture(Texture *texture, GLenum target) : mTarget(target)
     67{
     68    mTexture.set(texture);
    5769}
    5870
    5971RenderbufferTexture::~RenderbufferTexture()
    6072{
     73    mTexture.set(NULL);
     74}
     75
     76// Textures need to maintain their own reference count for references via
     77// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
     78void RenderbufferTexture::addProxyRef(const Renderbuffer *proxy)
     79{
     80    mTexture->addProxyRef(proxy);
     81}
     82
     83void RenderbufferTexture::releaseProxy(const Renderbuffer *proxy)
     84{
     85    mTexture->releaseProxy(proxy);
    6186}
    6287
     
    110135{
    111136    delete mInstance;
     137}
     138
     139// The RenderbufferInterface contained in this Renderbuffer may need to maintain
     140// its own reference count, so we pass it on here.
     141void Renderbuffer::addRef() const
     142{
     143    mInstance->addProxyRef(this);
     144
     145    RefCountObject::addRef();
     146}
     147
     148void Renderbuffer::release() const
     149{
     150    mInstance->releaseProxy(this);
     151
     152    RefCountObject::release();
    112153}
    113154
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h

    r104363 r112300  
    1818
    1919#include "common/angleutils.h"
    20 #include "libGLESv2/RefCountObject.h"
     20#include "common/RefCountObject.h"
    2121
    2222namespace gl
    2323{
    2424class Texture;
     25class Renderbuffer;
    2526class Colorbuffer;
    2627class DepthStencilbuffer;
     
    3233
    3334    virtual ~RenderbufferInterface() {};
     35
     36    virtual void addProxyRef(const Renderbuffer *proxy);
     37    virtual void releaseProxy(const Renderbuffer *proxy);
    3438
    3539    virtual IDirect3DSurface9 *getRenderTarget() = 0;
     
    6266    virtual ~RenderbufferTexture();
    6367
     68    void addProxyRef(const Renderbuffer *proxy);
     69    void releaseProxy(const Renderbuffer *proxy);
     70
    6471    IDirect3DSurface9 *getRenderTarget();
    6572    IDirect3DSurface9 *getDepthStencil();
     
    7683    DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture);
    7784
    78     Texture *mTexture;
     85    BindingPointer <Texture> mTexture;
    7986    GLenum mTarget;
    8087};
     
    128135
    129136    virtual ~Renderbuffer();
     137
     138    // These functions from RefCountObject are overloaded here because
     139    // Textures need to maintain their own count of references to them via
     140    // Renderbuffers/RenderbufferTextures. These functions invoke those
     141    // reference counting functions on the RenderbufferInterface.
     142    void addRef() const;
     143    void release() const;
    130144
    131145    IDirect3DSurface9 *getRenderTarget();
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    2828    mInfoLog = NULL;
    2929
    30     // Perform a one-time initialization of the shader compiler (or after being destructed by releaseCompiler)
     30    uncompile();
     31    initializeCompiler();
     32
     33    mRefCount = 0;
     34    mDeleteStatus = false;
     35}
     36
     37Shader::~Shader()
     38{
     39    delete[] mSource;
     40    delete[] mHlsl;
     41    delete[] mInfoLog;
     42}
     43
     44GLuint Shader::getHandle() const
     45{
     46    return mHandle;
     47}
     48
     49void Shader::setSource(GLsizei count, const char **string, const GLint *length)
     50{
     51    delete[] mSource;
     52    int totalLength = 0;
     53
     54    for (int i = 0; i < count; i++)
     55    {
     56        if (length && length[i] >= 0)
     57        {
     58            totalLength += length[i];
     59        }
     60        else
     61        {
     62            totalLength += (int)strlen(string[i]);
     63        }
     64    }
     65
     66    mSource = new char[totalLength + 1];
     67    char *code = mSource;
     68
     69    for (int i = 0; i < count; i++)
     70    {
     71        int stringLength;
     72
     73        if (length && length[i] >= 0)
     74        {
     75            stringLength = length[i];
     76        }
     77        else
     78        {
     79            stringLength = (int)strlen(string[i]);
     80        }
     81
     82        strncpy(code, string[i], stringLength);
     83        code += stringLength;
     84    }
     85
     86    mSource[totalLength] = '\0';
     87}
     88
     89int Shader::getInfoLogLength() const
     90{
     91    if (!mInfoLog)
     92    {
     93        return 0;
     94    }
     95    else
     96    {
     97       return strlen(mInfoLog) + 1;
     98    }
     99}
     100
     101void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
     102{
     103    int index = 0;
     104
     105    if (mInfoLog)
     106    {
     107        index = std::min(bufSize - 1, (int)strlen(mInfoLog));
     108        memcpy(infoLog, mInfoLog, index);
     109    }
     110
     111    if (bufSize)
     112    {
     113        infoLog[index] = '\0';
     114    }
     115
     116    if (length)
     117    {
     118        *length = index;
     119    }
     120}
     121
     122int Shader::getSourceLength() const
     123{
     124    if (!mSource)
     125    {
     126        return 0;
     127    }
     128    else
     129    {
     130       return strlen(mSource) + 1;
     131    }
     132}
     133
     134int Shader::getTranslatedSourceLength() const
     135{
     136    if (!mHlsl)
     137    {
     138        return 0;
     139    }
     140    else
     141    {
     142       return strlen(mHlsl) + 1;
     143    }
     144}
     145
     146void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer)
     147{
     148    int index = 0;
     149
     150    if (source)
     151    {
     152        index = std::min(bufSize - 1, (int)strlen(source));
     153        memcpy(buffer, source, index);
     154    }
     155
     156    if (bufSize)
     157    {
     158        buffer[index] = '\0';
     159    }
     160
     161    if (length)
     162    {
     163        *length = index;
     164    }
     165}
     166
     167void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer)
     168{
     169    getSourceImpl(mSource, bufSize, length, buffer);
     170}
     171
     172void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
     173{
     174    getSourceImpl(mHlsl, bufSize, length, buffer);
     175}
     176
     177bool Shader::isCompiled()
     178{
     179    return mHlsl != NULL;
     180}
     181
     182const char *Shader::getHLSL()
     183{
     184    return mHlsl;
     185}
     186
     187void Shader::addRef()
     188{
     189    mRefCount++;
     190}
     191
     192void Shader::release()
     193{
     194    mRefCount--;
     195
     196    if (mRefCount == 0 && mDeleteStatus)
     197    {
     198        mResourceManager->deleteShader(mHandle);
     199    }
     200}
     201
     202unsigned int Shader::getRefCount() const
     203{
     204    return mRefCount;
     205}
     206
     207bool Shader::isFlaggedForDeletion() const
     208{
     209    return mDeleteStatus;
     210}
     211
     212void Shader::flagForDeletion()
     213{
     214    mDeleteStatus = true;
     215}
     216
     217// Perform a one-time initialization of the shader compiler (or after being destructed by releaseCompiler)
     218void Shader::initializeCompiler()
     219{
    31220    if (!mFragmentCompiler)
    32221    {
     
    48237            resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
    49238            resources.OES_standard_derivatives = 1;
     239            // resources.OES_EGL_image_external = getDisplay()->isD3d9ExDevice() ? 1 : 0; // TODO: commented out until the extension is actually supported.
    50240
    51241            mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources);
     
    53243        }
    54244    }
    55 
    56     mRefCount = 0;
    57     mDeleteStatus = false;
    58 }
    59 
    60 Shader::~Shader()
    61 {
    62     delete[] mSource;
    63     delete[] mHlsl;
    64     delete[] mInfoLog;
    65 }
    66 
    67 GLuint Shader::getHandle() const
    68 {
    69     return mHandle;
    70 }
    71 
    72 void Shader::setSource(GLsizei count, const char **string, const GLint *length)
    73 {
    74     delete[] mSource;
    75     int totalLength = 0;
    76 
    77     for (int i = 0; i < count; i++)
    78     {
    79         if (length && length[i] >= 0)
    80         {
    81             totalLength += length[i];
    82         }
    83         else
    84         {
    85             totalLength += (int)strlen(string[i]);
    86         }
    87     }
    88 
    89     mSource = new char[totalLength + 1];
    90     char *code = mSource;
    91 
    92     for (int i = 0; i < count; i++)
    93     {
    94         int stringLength;
    95 
    96         if (length && length[i] >= 0)
    97         {
    98             stringLength = length[i];
    99         }
    100         else
    101         {
    102             stringLength = (int)strlen(string[i]);
    103         }
    104 
    105         strncpy(code, string[i], stringLength);
    106         code += stringLength;
    107     }
    108 
    109     mSource[totalLength] = '\0';
    110 }
    111 
    112 int Shader::getInfoLogLength() const
    113 {
    114     if (!mInfoLog)
    115     {
    116         return 0;
    117     }
    118     else
    119     {
    120        return strlen(mInfoLog) + 1;
    121     }
    122 }
    123 
    124 void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
    125 {
    126     int index = 0;
    127 
    128     if (mInfoLog)
    129     {
    130         while (index < bufSize - 1 && index < (int)strlen(mInfoLog))
    131         {
    132             infoLog[index] = mInfoLog[index];
    133             index++;
    134         }
    135     }
    136 
    137     if (bufSize)
    138     {
    139         infoLog[index] = '\0';
    140     }
    141 
    142     if (length)
    143     {
    144         *length = index;
    145     }
    146 }
    147 
    148 int Shader::getSourceLength() const
    149 {
    150     if (!mSource)
    151     {
    152         return 0;
    153     }
    154     else
    155     {
    156        return strlen(mSource) + 1;
    157     }
    158 }
    159 
    160 int Shader::getTranslatedSourceLength() const
    161 {
    162     if (!mHlsl)
    163     {
    164         return 0;
    165     }
    166     else
    167     {
    168        return strlen(mHlsl) + 1;
    169     }
    170 }
    171 
    172 void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer)
    173 {
    174     int index = 0;
    175 
    176     if (source)
    177     {
    178         while (index < bufSize - 1 && index < (int)strlen(source))
    179         {
    180             buffer[index] = source[index];
    181             index++;
    182         }
    183     }
    184 
    185     if (bufSize)
    186     {
    187         buffer[index] = '\0';
    188     }
    189 
    190     if (length)
    191     {
    192         *length = index;
    193     }
    194 }
    195 
    196 void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer)
    197 {
    198     getSourceImpl(mSource, bufSize, length, buffer);
    199 }
    200 
    201 void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
    202 {
    203     getSourceImpl(mHlsl, bufSize, length, buffer);
    204 }
    205 
    206 bool Shader::isCompiled()
    207 {
    208     return mHlsl != NULL;
    209 }
    210 
    211 const char *Shader::getHLSL()
    212 {
    213     return mHlsl;
    214 }
    215 
    216 void Shader::addRef()
    217 {
    218     mRefCount++;
    219 }
    220 
    221 void Shader::release()
    222 {
    223     mRefCount--;
    224 
    225     if (mRefCount == 0 && mDeleteStatus)
    226     {
    227         mResourceManager->deleteShader(mHandle);
    228     }
    229 }
    230 
    231 unsigned int Shader::getRefCount() const
    232 {
    233     return mRefCount;
    234 }
    235 
    236 bool Shader::isFlaggedForDeletion() const
    237 {
    238     return mDeleteStatus;
    239 }
    240 
    241 void Shader::flagForDeletion()
    242 {
    243     mDeleteStatus = true;
    244245}
    245246
     
    282283            }
    283284
    284             varyings.push_back(Varying(parseType(varyingType), varyingName, size, array != NULL));
     285            mVaryings.push_back(Varying(parseType(varyingType), varyingName, size, array != NULL));
    285286
    286287            input = strstr(input, ";") + 2;
     
    294295}
    295296
    296 void Shader::compileToHLSL(void *compiler)
    297 {
    298     if (isCompiled() || !mSource)
    299     {
    300         return;
    301     }
    302 
     297// initialize/clean up previous state
     298void Shader::uncompile()
     299{
     300    // set by compileToHLSL
     301    delete[] mHlsl;
     302    mHlsl = NULL;
    303303    delete[] mInfoLog;
    304304    mInfoLog = NULL;
     305
     306    // set by parseVaryings
     307    mVaryings.clear();
     308
     309    mUsesFragCoord = false;
     310    mUsesFrontFacing = false;
     311    mUsesPointSize = false;
     312    mUsesPointCoord = false;
     313}
     314
     315void Shader::compileToHLSL(void *compiler)
     316{
     317    // ensure we don't pass a NULL source to the compiler
     318    char *source = "\0";
     319    if (mSource)
     320    {
     321        source = mSource;
     322    }
     323
     324    // ensure the compiler is loaded
     325    initializeCompiler();
    305326
    306327    int compileOptions = SH_OBJECT_CODE;
     
    309330    {
    310331        sourcePath = getTempPath();
    311         writeFile(sourcePath.c_str(), mSource, strlen(mSource));
     332        writeFile(sourcePath.c_str(), source, strlen(source));
    312333        compileOptions |= SH_LINE_DIRECTIVES;
    313334    }
     
    316337    if (sourcePath.empty())
    317338    {
    318         result = ShCompile(compiler, &mSource, 1, compileOptions);
     339        result = ShCompile(compiler, &source, 1, compileOptions);
    319340    }
    320341    else
     
    323344        {
    324345            sourcePath.c_str(),
    325             mSource
     346            source
    326347        };
    327348
     
    478499}
    479500
     501void VertexShader::uncompile()
     502{
     503    Shader::uncompile();
     504
     505    // set by ParseAttributes
     506    mAttributes.clear();
     507};
     508
    480509void VertexShader::compile()
    481510{
     511    uncompile();
     512
    482513    compileToHLSL(mVertexCompiler);
    483514    parseAttributes();
     
    506537void VertexShader::parseAttributes()
    507538{
    508     if (mHlsl)
    509     {
    510         const char *input = strstr(mHlsl, "// Attributes") + 14;
     539    const char *hlsl = getHLSL();
     540    if (hlsl)
     541    {
     542        const char *input = strstr(hlsl, "// Attributes") + 14;
    511543
    512544        while(true)
     
    544576void FragmentShader::compile()
    545577{
     578    uncompile();
     579
    546580    compileToHLSL(mFragmentCompiler);
    547581    parseVaryings();
    548     varyings.sort(compareVarying);
    549 }
    550 }
     582    mVaryings.sort(compareVarying);
     583}
     584}
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    6363
    6464    virtual void compile() = 0;
     65    virtual void uncompile();
    6566    bool isCompiled();
    6667    const char *getHLSL();
     
    7576
    7677  protected:
    77     DISALLOW_COPY_AND_ASSIGN(Shader);
    78 
    7978    void parseVaryings();
    8079
     
    8685    static bool compareVarying(const Varying &x, const Varying &y);
    8786
     87    VaryingList mVaryings;
     88
     89    bool mUsesFragCoord;
     90    bool mUsesFrontFacing;
     91    bool mUsesPointSize;
     92    bool mUsesPointCoord;
     93
     94    static void *mFragmentCompiler;
     95    static void *mVertexCompiler;
     96
     97  private:
     98    DISALLOW_COPY_AND_ASSIGN(Shader);
     99
     100    void initializeCompiler();
     101
    88102    const GLuint mHandle;
    89103    unsigned int mRefCount;     // Number of program objects this shader is attached to
     
    94108    char *mInfoLog;
    95109
    96     VaryingList varyings;
    97 
    98     bool mUsesFragCoord;
    99     bool mUsesFrontFacing;
    100     bool mUsesPointSize;
    101     bool mUsesPointCoord;
    102 
    103110    ResourceManager *mResourceManager;
    104 
    105     static void *mFragmentCompiler;
    106     static void *mVertexCompiler;
    107111};
    108112
     
    134138    virtual GLenum getType();
    135139    virtual void compile();
     140    virtual void uncompile();
    136141    int getSemanticIndex(const std::string &attributeName);
    137142
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp

    r104363 r112300  
    17231723    mTexStorage = NULL;
    17241724    mSurface = NULL;
     1725    mColorbufferProxy = NULL;
     1726    mProxyRefs = 0;
    17251727}
    17261728
    17271729Texture2D::~Texture2D()
    17281730{
    1729     mColorbufferProxy.set(NULL);
     1731    mColorbufferProxy = NULL;
    17301732
    17311733    delete mTexStorage;
     
    17371739        mSurface = NULL;
    17381740    }
     1741}
     1742
     1743// We need to maintain a count of references to renderbuffers acting as
     1744// proxies for this texture, so that we do not attempt to use a pointer
     1745// to a renderbuffer proxy which has been deleted.
     1746void Texture2D::addProxyRef(const Renderbuffer *proxy)
     1747{
     1748    mProxyRefs++;
     1749}
     1750
     1751void Texture2D::releaseProxy(const Renderbuffer *proxy)
     1752{
     1753    if (mProxyRefs > 0)
     1754        mProxyRefs--;
     1755
     1756    if (mProxyRefs == 0)
     1757        mColorbufferProxy = NULL;
    17391758}
    17401759
     
    22952314    }
    22962315
    2297     if (mColorbufferProxy.get() == NULL)
    2298     {
    2299         mColorbufferProxy.set(new Renderbuffer(id(), new RenderbufferTexture(this, target)));
    2300     }
    2301 
    2302     return mColorbufferProxy.get();
     2316    if (mColorbufferProxy == NULL)
     2317    {
     2318        mColorbufferProxy = new Renderbuffer(id(), new RenderbufferTexture(this, target));
     2319    }
     2320
     2321    return mColorbufferProxy;
    23032322}
    23042323
     
    23842403{
    23852404    mTexStorage = NULL;
     2405    for (int i = 0; i < 6; i++)
     2406    {
     2407        mFaceProxies[i] = NULL;
     2408        mFaceProxyRefs[i] = 0;
     2409    }
    23862410}
    23872411
     
    23902414    for (int i = 0; i < 6; i++)
    23912415    {
    2392         mFaceProxies[i].set(NULL);
     2416        mFaceProxies[i] = NULL;
    23932417    }
    23942418
    23952419    delete mTexStorage;
    23962420    mTexStorage = NULL;
     2421}
     2422
     2423// We need to maintain a count of references to renderbuffers acting as
     2424// proxies for this texture, so that the texture is not deleted while
     2425// proxy references still exist. If the reference count drops to zero,
     2426// we set our proxy pointer NULL, so that a new attempt at referencing
     2427// will cause recreation.
     2428void TextureCubeMap::addProxyRef(const Renderbuffer *proxy)
     2429{
     2430    for (int i = 0; i < 6; i++)
     2431    {
     2432        if (mFaceProxies[i] == proxy)
     2433            mFaceProxyRefs[i]++;
     2434    }
     2435}
     2436
     2437void TextureCubeMap::releaseProxy(const Renderbuffer *proxy)
     2438{
     2439    for (int i = 0; i < 6; i++)
     2440    {
     2441        if (mFaceProxies[i] == proxy)
     2442        {
     2443            if (mFaceProxyRefs[i] > 0)
     2444                mFaceProxyRefs[i]--;
     2445
     2446            if (mFaceProxyRefs[i] == 0)
     2447                mFaceProxies[i] = NULL;
     2448        }
     2449    }
    23972450}
    23982451
     
    25252578        mipmapping = true;
    25262579        break;
    2527       default: UNREACHABLE();
     2580      default:
     2581        UNREACHABLE();
     2582        return false;
    25282583    }
    25292584
     
    26942749        if (mTexStorage != NULL)
    26952750        {
    2696             egl::Display *display = getDisplay();
    2697             IDirect3DDevice9 *device = display->getDevice();
    2698 
    26992751            int levels = levelCount();
    27002752            for (int f = 0; f < 6; f++)
     
    29963048    unsigned int face = faceIndex(target);
    29973049
    2998     if (mFaceProxies[face].get() == NULL)
    2999     {
    3000         mFaceProxies[face].set(new Renderbuffer(id(), new RenderbufferTexture(this, target)));
    3001     }
    3002 
    3003     return mFaceProxies[face].get();
     3050    if (mFaceProxies[face] == NULL)
     3051    {
     3052        mFaceProxies[face] = new Renderbuffer(id(), new RenderbufferTexture(this, target));
     3053    }
     3054
     3055    return mFaceProxies[face];
    30043056}
    30053057
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h

    r104363 r112300  
    1818#include <d3d9.h>
    1919
     20#include "common/debug.h"
     21#include "common/RefCountObject.h"
    2022#include "libGLESv2/Renderbuffer.h"
    21 #include "libGLESv2/RefCountObject.h"
    2223#include "libGLESv2/utilities.h"
    23 #include "common/debug.h"
    2424
    2525namespace egl
     
    174174    virtual ~Texture();
    175175
     176    virtual void addProxyRef(const Renderbuffer *proxy) = 0;
     177    virtual void releaseProxy(const Renderbuffer *proxy) = 0;
     178
    176179    virtual GLenum getTarget() const = 0;
    177180
     
    278281
    279282    ~Texture2D();
     283
     284    void addProxyRef(const Renderbuffer *proxy);
     285    void releaseProxy(const Renderbuffer *proxy);
    280286
    281287    virtual GLenum getTarget() const;
     
    324330    egl::Surface *mSurface;
    325331
    326     BindingPointer<Renderbuffer> mColorbufferProxy;
     332    // A specific internal reference count is kept for colorbuffer proxy references,
     333    // because, as the renderbuffer acting as proxy will maintain a binding pointer
     334    // back to this texture, there would be a circular reference if we used a binding
     335    // pointer here. This reference count will cause the pointer to be set to NULL if
     336    // the count drops to zero, but will not cause deletion of the Renderbuffer.
     337    Renderbuffer *mColorbufferProxy;
     338    unsigned int mProxyRefs;
    327339};
    328340
     
    352364
    353365    ~TextureCubeMap();
     366
     367    void addProxyRef(const Renderbuffer *proxy);
     368    void releaseProxy(const Renderbuffer *proxy);
    354369
    355370    virtual GLenum getTarget() const;
     
    406421    TextureStorageCubeMap *mTexStorage;
    407422
    408     BindingPointer<Renderbuffer> mFaceProxies[6];
     423    // A specific internal reference count is kept for colorbuffer proxy references,
     424    // because, as the renderbuffer acting as proxy will maintain a binding pointer
     425    // back to this texture, there would be a circular reference if we used a binding
     426    // pointer here. This reference count will cause the pointer to be set to NULL if
     427    // the count drops to zero, but will not cause deletion of the Renderbuffer.
     428    Renderbuffer *mFaceProxies[6];
     429    unsigned int *mFaceProxyRefs[6];
    409430};
    410431}
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    6666}
    6767
    68 std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
     68std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances)
    6969{
    7070    Buffer *buffer = attribute.mBoundBuffer.get();
     
    7979    if (vertexBuffer)
    8080    {
    81         output = vertexBuffer->map(attribute, spaceRequired(attribute, count), &streamOffset);
     81        output = vertexBuffer->map(attribute, spaceRequired(attribute, count, instances), &streamOffset);
    8282    }
    8383
     
    101101    }
    102102
    103     input += inputStride * start;
     103    if (instances == 0 || attribute.mDivisor == 0)
     104    {
     105        input += inputStride * start;
     106    }
    104107
    105108    if (converter.identity && inputStride == elementSize)
     
    117120}
    118121
    119 GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *translated)
     122GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
    120123{
    121124    if (!mStreamingBuffer)
     
    145148                {
    146149                    int totalCount = elementsInBuffer(attribs[i], buffer->size());
    147                     staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount));
     150                    staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount, 0));
    148151                }
    149152                else if (staticBuffer->lookupAttribute(attribs[i]) == -1)
     
    160163                            if (staticBuffer == previousStaticBuffer)
    161164                            {
    162                                 mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[previous], count));
     165                                mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[previous], count, instances));
    163166                            }
    164167                        }
    165168                    }
    166169
    167                     mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
     170                    mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count, instances));
    168171
    169172                    buffer->invalidateStaticData();
     
    172175            else
    173176            {
    174                 mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
     177                mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count, instances));
    175178            }
    176179        }
     
    226229                        int startIndex = attribs[i].mOffset / attribs[i].stride();
    227230
    228                         streamOffset = writeAttributeData(staticBuffer, -startIndex, totalCount, attribs[i]);
     231                        streamOffset = writeAttributeData(staticBuffer, -startIndex, totalCount, attribs[i], 0);
    229232                    }
    230233
    231234                    if (streamOffset != -1)
    232235                    {
    233                         streamOffset += (start + attribs[i].mOffset / attribs[i].stride()) * converter.outputElementSize;
     236                        streamOffset += (attribs[i].mOffset / attribs[i].stride()) * converter.outputElementSize;
     237
     238                        if (instances == 0 || attribs[i].mDivisor == 0)
     239                        {
     240                            streamOffset += start * converter.outputElementSize;
     241                        }
    234242                    }
    235243                }
    236244                else
    237245                {
    238                     streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]);
     246                    streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i], instances);
    239247                }
    240248
     
    246254                translated[i].vertexBuffer = vertexBuffer->getBuffer();
    247255                translated[i].serial = vertexBuffer->getSerial();
     256                translated[i].divisor = attribs[i].mDivisor;
     257
    248258                translated[i].type = converter.d3dDeclType;
    249259                translated[i].stride = converter.outputElementSize;
     
    278288                translated[i].vertexBuffer = mCurrentValueBuffer[i]->getBuffer();
    279289                translated[i].serial = mCurrentValueBuffer[i]->getSerial();
     290                translated[i].divisor = 0;
    280291
    281292                translated[i].type = D3DDECLTYPE_FLOAT4;
     
    302313}
    303314
    304 std::size_t VertexDataManager::spaceRequired(const VertexAttribute &attrib, std::size_t count) const
    305 {
    306     return formatConverter(attrib).outputElementSize * count;
     315std::size_t VertexDataManager::spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const
     316{
     317    size_t elementSize = formatConverter(attrib).outputElementSize;
     318
     319    if (instances == 0 || attrib.mDivisor == 0)
     320    {
     321        return elementSize * count;
     322    }
     323    else
     324    {
     325        return elementSize * ((instances + attrib.mDivisor - 1) / attrib.mDivisor);
     326    }
    307327}
    308328
     
    498518    }
    499519
     520#define TRANSLATIONS_FOR_TYPE_NO_NORM(type)                                                                                                                                                                 \
     521    {                                                                                                                                                                                                       \
     522        { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
     523        { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
     524    }
     525
    500526const VertexDataManager::TranslationDescription VertexDataManager::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
    501527{
     
    504530    TRANSLATIONS_FOR_TYPE(GL_SHORT),
    505531    TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
    506     TRANSLATIONS_FOR_TYPE(GL_FIXED),
    507     TRANSLATIONS_FOR_TYPE(GL_FLOAT)
     532    TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FIXED),
     533    TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FLOAT)
    508534};
    509535
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.h

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    3232    IDirect3DVertexBuffer9 *vertexBuffer;
    3333    unsigned int serial;
     34    unsigned int divisor;
    3435};
    3536
     
    118119    void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
    119120
    120     GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs);
     121    GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
    121122
    122123  private:
    123124    DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
    124125
    125     std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
    126     std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
     126    std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const;
     127    std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances);
    127128
    128129    Context *const mContext;
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp

    r104363 r112300  
    11//
    2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
     2// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style license that can be
    44// found in the LICENSE file.
     
    2828#include "libGLESv2/Shader.h"
    2929#include "libGLESv2/Texture.h"
     30#include "libGLESv2/Query.h"
    3031
    3132bool validImageSize(GLint level, GLsizei width, GLsizei height)
     
    197198                return error(GL_INVALID_OPERATION);
    198199            }
     200        }
     201    }
     202    catch(std::bad_alloc&)
     203    {
     204        return error(GL_OUT_OF_MEMORY);
     205    }
     206}
     207
     208void __stdcall glBeginQueryEXT(GLenum target, GLuint id)
     209{
     210    EVENT("(GLenum target = 0x%X, GLuint %d)", target, id);
     211
     212    try
     213    {
     214        switch (target)
     215        {
     216          case GL_ANY_SAMPLES_PASSED_EXT:
     217          case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
     218              break;
     219          default:
     220              return error(GL_INVALID_ENUM);
     221        }
     222
     223        if (id == 0)
     224        {
     225            return error(GL_INVALID_OPERATION);
     226        }
     227
     228        gl::Context *context = gl::getNonLostContext();
     229
     230        if (context)
     231        {
     232            context->beginQuery(target, id);
    199233        }
    200234    }
     
    9891023    try
    9901024    {
    991         if (!gl::IsTextureTarget(target))
     1025        if (!gl::IsInternalTextureTarget(target))
    9921026        {
    9931027            return error(GL_INVALID_ENUM);
     
    12781312    try
    12791313    {
    1280         if (!gl::IsTextureTarget(target))
     1314        if (!gl::IsInternalTextureTarget(target))
    12811315        {
    12821316            return error(GL_INVALID_ENUM);
     
    15861620
    15871621            context->deleteProgram(program);
     1622        }
     1623    }
     1624    catch(std::bad_alloc&)
     1625    {
     1626        return error(GL_OUT_OF_MEMORY);
     1627    }
     1628}
     1629
     1630void __stdcall glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
     1631{
     1632    EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids);
     1633
     1634    try
     1635    {
     1636        if (n < 0)
     1637        {
     1638            return error(GL_INVALID_VALUE);
     1639        }
     1640
     1641        gl::Context *context = gl::getNonLostContext();
     1642
     1643        if (context)
     1644        {
     1645            for (int i = 0; i < n; i++)
     1646            {
     1647                context->deleteQuery(ids[i]);
     1648            }
    15881649        }
    15891650    }
     
    18831944        if (context)
    18841945        {
    1885             context->drawArrays(mode, first, count);
     1946            context->drawArrays(mode, first, count, 0);
     1947        }
     1948    }
     1949    catch(std::bad_alloc&)
     1950    {
     1951        return error(GL_OUT_OF_MEMORY);
     1952    }
     1953}
     1954
     1955void __stdcall glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
     1956{
     1957    EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount);
     1958
     1959    try
     1960    {
     1961        if (count < 0 || first < 0 || primcount < 0)
     1962        {
     1963            return error(GL_INVALID_VALUE);
     1964        }
     1965
     1966        if (primcount > 0)
     1967        {
     1968            gl::Context *context = gl::getNonLostContext();
     1969
     1970            if (context)
     1971            {
     1972                context->drawArrays(mode, first, count, primcount);
     1973            }
    18861974        }
    18871975    }
     
    19232011            }
    19242012       
    1925             context->drawElements(mode, count, type, indices);
     2013            context->drawElements(mode, count, type, indices, 0);
     2014        }
     2015    }
     2016    catch(std::bad_alloc&)
     2017    {
     2018        return error(GL_OUT_OF_MEMORY);
     2019    }
     2020}
     2021
     2022void __stdcall glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)
     2023{
     2024    EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)",
     2025          mode, count, type, indices, primcount);
     2026
     2027    try
     2028    {
     2029        if (count < 0 || primcount < 0)
     2030        {
     2031            return error(GL_INVALID_VALUE);
     2032        }
     2033
     2034        if (primcount > 0)
     2035        {
     2036            gl::Context *context = gl::getNonLostContext();
     2037
     2038            if (context)
     2039            {
     2040                switch (type)
     2041                {
     2042                  case GL_UNSIGNED_BYTE:
     2043                  case GL_UNSIGNED_SHORT:
     2044                    break;
     2045                  case GL_UNSIGNED_INT:
     2046                    if (!context->supports32bitIndices())
     2047                    {
     2048                        return error(GL_INVALID_ENUM);   
     2049                    }
     2050                    break;
     2051                  default:
     2052                    return error(GL_INVALID_ENUM);
     2053                }
     2054           
     2055                context->drawElements(mode, count, type, indices, primcount);
     2056            }
    19262057        }
    19272058    }
     
    19882119}
    19892120
     2121void __stdcall glEndQueryEXT(GLenum target)
     2122{
     2123    EVENT("GLenum target = 0x%X)", target);
     2124
     2125    try
     2126    {
     2127        switch (target)
     2128        {
     2129          case GL_ANY_SAMPLES_PASSED_EXT:
     2130          case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
     2131              break;
     2132          default:
     2133              return error(GL_INVALID_ENUM);
     2134        }
     2135
     2136        gl::Context *context = gl::getNonLostContext();
     2137
     2138        if (context)
     2139        {
     2140            context->endQuery(target);
     2141        }
     2142    }
     2143    catch(std::bad_alloc&)
     2144    {
     2145        return error(GL_OUT_OF_MEMORY);
     2146    }
     2147}
     2148
    19902149void __stdcall glFinishFenceNV(GLuint fence)
    19912150{
     
    23662525}
    23672526
     2527void __stdcall glGenQueriesEXT(GLsizei n, GLuint* ids)
     2528{
     2529    EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
     2530
     2531    try
     2532    {
     2533        if (n < 0)
     2534        {
     2535            return error(GL_INVALID_VALUE);
     2536        }
     2537
     2538        gl::Context *context = gl::getNonLostContext();
     2539
     2540        if (context)
     2541        {
     2542            for (int i = 0; i < n; i++)
     2543            {
     2544                ids[i] = context->createQuery();
     2545            }
     2546        }
     2547    }
     2548    catch(std::bad_alloc&)
     2549    {
     2550        return error(GL_OUT_OF_MEMORY);
     2551    }
     2552}
     2553
    23682554void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
    23692555{
     
    28613047                attachmentObjectType = attachmentType;
    28623048            }
    2863             else if (gl::IsTextureTarget(attachmentType))
     3049            else if (gl::IsInternalTextureTarget(attachmentType))
    28643050            {
    28653051                attachmentObjectType = GL_TEXTURE;
    28663052            }
    2867             else UNREACHABLE();
     3053            else
     3054            {
     3055                UNREACHABLE();
     3056                return;
     3057            }
    28683058
    28693059            switch (pname)
     
    30953285}
    30963286
     3287void __stdcall glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
     3288{
     3289    EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params);
     3290
     3291    try
     3292    {
     3293        switch (pname)
     3294        {
     3295          case GL_CURRENT_QUERY_EXT:
     3296            break;
     3297          default:
     3298            return error(GL_INVALID_ENUM);
     3299        }
     3300
     3301        gl::Context *context = gl::getNonLostContext();
     3302
     3303        if (context)
     3304        {
     3305            params[0] = context->getActiveQuery(target);
     3306        }
     3307    }
     3308    catch(std::bad_alloc&)
     3309    {
     3310        return error(GL_OUT_OF_MEMORY);
     3311    }
     3312}
     3313
     3314void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
     3315{
     3316    EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params);
     3317
     3318    try
     3319    {
     3320        switch (pname)
     3321        {
     3322          case GL_QUERY_RESULT_EXT:
     3323          case GL_QUERY_RESULT_AVAILABLE_EXT:
     3324            break;
     3325          default:
     3326            return error(GL_INVALID_ENUM);
     3327        }
     3328        gl::Context *context = gl::getNonLostContext();
     3329
     3330        if (context)
     3331        {
     3332            gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
     3333
     3334            if (!queryObject)
     3335            {
     3336                return error(GL_INVALID_OPERATION);
     3337            }
     3338
     3339            if (context->getActiveQuery(queryObject->getType()) == id)
     3340            {
     3341                return error(GL_INVALID_OPERATION);
     3342            }
     3343
     3344            switch(pname)
     3345            {
     3346              case GL_QUERY_RESULT_EXT:
     3347                params[0] = queryObject->getResult();
     3348                break;
     3349              case GL_QUERY_RESULT_AVAILABLE_EXT:
     3350                params[0] = queryObject->isResultAvailable();
     3351                break;
     3352              default:
     3353                ASSERT(false);
     3354            }
     3355        }
     3356    }
     3357    catch(std::bad_alloc&)
     3358    {
     3359        return error(GL_OUT_OF_MEMORY);
     3360    }
     3361}
     3362
    30973363void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
    30983364{
     
    33663632        return error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
    33673633    }
    3368 
    3369     return NULL;
    33703634}
    33713635
     
    37263990                }
    37273991                break;
     3992              case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
     3993                *params = (GLfloat)attribState.mDivisor;
     3994                break;
    37283995              default: return error(GL_INVALID_ENUM);
    37293996            }
     
    37794046                    params[i] = (GLint)(currentValue > 0.0f ? floor(currentValue + 0.5f) : ceil(currentValue - 0.5f));
    37804047                }
     4048                break;
     4049              case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
     4050                *params = (GLint)attribState.mDivisor;
    37814051                break;
    37824052              default: return error(GL_INVALID_ENUM);
     
    39944264}
    39954265
     4266GLboolean __stdcall glIsQueryEXT(GLuint id)
     4267{
     4268    EVENT("(GLuint id = %d)", id);
     4269
     4270    try
     4271    {
     4272        if (id == 0)
     4273        {
     4274            return GL_FALSE;
     4275        }
     4276
     4277        gl::Context *context = gl::getNonLostContext();
     4278
     4279        if (context)
     4280        {
     4281            gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
     4282
     4283            if (queryObject)
     4284            {
     4285                return GL_TRUE;
     4286            }
     4287        }
     4288    }
     4289    catch(std::bad_alloc&)
     4290    {
     4291        return error(GL_OUT_OF_MEMORY, GL_FALSE);
     4292    }
     4293
     4294    return GL_FALSE;
     4295}
     4296
    39964297GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer)
    39974298{
     
    47075008        }
    47085009
    4709         if (internalformat != format)
     5010        if (internalformat != GLint(format))
    47105011        {
    47115012            return error(GL_INVALID_OPERATION);
     
    51695470    try
    51705471    {
    5171         if (!gl::IsTextureTarget(target))
     5472        if (!gl::IsInternalTextureTarget(target))
    51725473        {
    51735474            return error(GL_INVALID_ENUM);
     
    59926293        {
    59936294            context->setVertexAttrib(index, values);
     6295        }
     6296    }
     6297    catch(std::bad_alloc&)
     6298    {
     6299        return error(GL_OUT_OF_MEMORY);
     6300    }
     6301}
     6302
     6303void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
     6304{
     6305    EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
     6306
     6307    try
     6308    {
     6309        if (index >= gl::MAX_VERTEX_ATTRIBS)
     6310        {
     6311            return error(GL_INVALID_VALUE);
     6312        }
     6313
     6314        gl::Context *context = gl::getNonLostContext();
     6315
     6316        if (context)
     6317        {
     6318            context->setVertexAttribDivisor(index, divisor);
    59946319        }
    59956320    }
     
    61656490        {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT},
    61666491        {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT},
     6492        {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT},
     6493        {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT},
     6494        {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT},
     6495        {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT},
     6496        {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT},
     6497        {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT},
     6498        {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT},
     6499        {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE},
     6500        {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE},
     6501        {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE},
    61676502    };
    61686503
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def

    r104363 r112300  
    161161    glGetnUniformfvEXT              @163
    162162    glGetnUniformivEXT              @164
     163    glGenQueriesEXT                 @165
     164    glDeleteQueriesEXT              @166
     165    glIsQueryEXT                    @167
     166    glBeginQueryEXT                 @168
     167    glEndQueryEXT                   @169
     168    glGetQueryivEXT                 @170
     169    glGetQueryObjectuivEXT          @171
     170    glVertexAttribDivisorANGLE      @172
     171    glDrawArraysInstancedANGLE      @173
     172    glDrawElementsInstancedANGLE    @174
    163173
    164174    ; EGL dependencies
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.vcproj

    r104363 r112300  
    5151                                RuntimeLibrary="1"
    5252                                UsePrecompiledHeader="0"
    53                                 WarningLevel="3"
     53                                WarningLevel="4"
     54                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
    5455                                Detect64BitPortabilityProblems="false"
    5556                                DebugInformationFormat="4"
     57                                WarnAsError="true"
    5658                        />
    5759                        <Tool
     
    129131                                RuntimeLibrary="0"
    130132                                UsePrecompiledHeader="0"
    131                                 WarningLevel="3"
     133                                WarningLevel="4"
     134                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702;4718"
    132135                                Detect64BitPortabilityProblems="false"
    133136                                DebugInformationFormat="3"
     137                                WarnAsError="true"
    134138                        />
    135139                        <Tool
     
    211215                                RuntimeLibrary="1"
    212216                                UsePrecompiledHeader="0"
    213                                 WarningLevel="3"
     217                                WarningLevel="4"
     218                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702;4718"
    214219                                Detect64BitPortabilityProblems="false"
    215220                                DebugInformationFormat="3"
     221                                WarnAsError="true"
    216222                        />
    217223                        <Tool
     
    290296                                RuntimeLibrary="0"
    291297                                UsePrecompiledHeader="0"
    292                                 WarningLevel="3"
     298                                WarningLevel="4"
     299                                DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702;4718"
    293300                                Detect64BitPortabilityProblems="false"
    294301                                DebugInformationFormat="3"
     302                                WarnAsError="true"
    295303                        />
    296304                        <Tool
     
    394402                        </File>
    395403                        <File
    396                                 RelativePath=".\RefCountObject.cpp"
     404                                RelativePath=".\Query.cpp"
     405                                >
     406                        </File>
     407                        <File
     408                                RelativePath="..\common\RefCountObject.cpp"
    397409                                >
    398410                        </File>
     
    480492                        </File>
    481493                        <File
    482                                 RelativePath=".\RefCountObject.h"
     494                                RelativePath=".\Query.h"
     495                                >
     496                        </File>
     497                        <File
     498                                RelativePath="..\common\RefCountObject.h"
    483499                                >
    484500                        </File>
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp

    r104363 r112300  
    329329}
    330330
    331 bool IsTextureTarget(GLenum target)
     331bool IsInternalTextureTarget(GLenum target)
    332332{
    333333    return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
  • trunk/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h

    r104363 r112300  
    3838bool IsCompressed(GLenum format);
    3939bool IsCubemapTextureTarget(GLenum target);
    40 bool IsTextureTarget(GLenum target);
     40bool IsInternalTextureTarget(GLenum target);
    4141bool CheckTextureFormatType(GLenum format, GLenum type);
    4242GLenum ExtractFormat(GLenum internalformat);
Note: See TracChangeset for help on using the changeset viewer.