mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-12 05:11:45 +00:00
040cb17370
# Conflicts: # CMakeLists.txt # libraries/glslang/OGLCompilersDLL/CMakeLists.txt # libraries/glslang/OGLCompilersDLL/InitializeDll.cpp # libraries/glslang/OGLCompilersDLL/InitializeDll.h # libraries/glslang/glslang/CMakeLists.txt # libraries/glslang/glslang/GenericCodeGen/CodeGen.cpp # libraries/glslang/glslang/GenericCodeGen/Link.cpp # libraries/glslang/glslang/Include/BaseTypes.h # libraries/glslang/glslang/Include/Common.h # libraries/glslang/glslang/Include/ConstantUnion.h # libraries/glslang/glslang/Include/InfoSink.h # libraries/glslang/glslang/Include/InitializeGlobals.h # libraries/glslang/glslang/Include/PoolAlloc.h # libraries/glslang/glslang/Include/ResourceLimits.h # libraries/glslang/glslang/Include/ShHandle.h # libraries/glslang/glslang/Include/Types.h # libraries/glslang/glslang/Include/arrays.h # libraries/glslang/glslang/Include/intermediate.h # libraries/glslang/glslang/Include/revision.h # libraries/glslang/glslang/Include/revision.template # libraries/glslang/glslang/MachineIndependent/Constant.cpp # libraries/glslang/glslang/MachineIndependent/InfoSink.cpp # libraries/glslang/glslang/MachineIndependent/Initialize.cpp # libraries/glslang/glslang/MachineIndependent/Initialize.h # libraries/glslang/glslang/MachineIndependent/IntermTraverse.cpp # libraries/glslang/glslang/MachineIndependent/Intermediate.cpp # libraries/glslang/glslang/MachineIndependent/LiveTraverser.h # libraries/glslang/glslang/MachineIndependent/ParseContextBase.cpp # libraries/glslang/glslang/MachineIndependent/ParseHelper.cpp # libraries/glslang/glslang/MachineIndependent/ParseHelper.h # libraries/glslang/glslang/MachineIndependent/PoolAlloc.cpp # libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp # libraries/glslang/glslang/MachineIndependent/RemoveTree.h # libraries/glslang/glslang/MachineIndependent/Scan.cpp # libraries/glslang/glslang/MachineIndependent/Scan.h # libraries/glslang/glslang/MachineIndependent/ScanContext.h # libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp # libraries/glslang/glslang/MachineIndependent/SymbolTable.cpp # libraries/glslang/glslang/MachineIndependent/SymbolTable.h # libraries/glslang/glslang/MachineIndependent/Versions.cpp # libraries/glslang/glslang/MachineIndependent/Versions.h # libraries/glslang/glslang/MachineIndependent/attribute.cpp # libraries/glslang/glslang/MachineIndependent/attribute.h # libraries/glslang/glslang/MachineIndependent/gl_types.h # libraries/glslang/glslang/MachineIndependent/glslang.y # libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp # libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp.h # libraries/glslang/glslang/MachineIndependent/intermOut.cpp # libraries/glslang/glslang/MachineIndependent/iomapper.cpp # libraries/glslang/glslang/MachineIndependent/iomapper.h # libraries/glslang/glslang/MachineIndependent/limits.cpp # libraries/glslang/glslang/MachineIndependent/linkValidate.cpp # libraries/glslang/glslang/MachineIndependent/localintermediate.h # libraries/glslang/glslang/MachineIndependent/parseConst.cpp # libraries/glslang/glslang/MachineIndependent/parseVersions.h # libraries/glslang/glslang/MachineIndependent/pch.cpp # libraries/glslang/glslang/MachineIndependent/pch.h # libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.h # libraries/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h # libraries/glslang/glslang/MachineIndependent/propagateNoContraction.cpp # libraries/glslang/glslang/MachineIndependent/propagateNoContraction.h # libraries/glslang/glslang/MachineIndependent/reflection.cpp # libraries/glslang/glslang/MachineIndependent/reflection.h # libraries/glslang/glslang/OSDependent/Unix/CMakeLists.txt # libraries/glslang/glslang/OSDependent/Unix/ossource.cpp # libraries/glslang/glslang/OSDependent/Windows/CMakeLists.txt # libraries/glslang/glslang/OSDependent/Windows/main.cpp # libraries/glslang/glslang/OSDependent/Windows/ossource.cpp # libraries/glslang/glslang/OSDependent/osinclude.h # libraries/glslang/glslang/Public/ShaderLang.h # libraries/glslang/glslang/updateGrammar # libraries/glslang/spirv/CMakeLists.txt # libraries/glslang/spirv/GLSL.ext.AMD.h # libraries/glslang/spirv/GLSL.ext.EXT.h # libraries/glslang/spirv/GLSL.ext.KHR.h # libraries/glslang/spirv/GLSL.ext.NV.h # libraries/glslang/spirv/GLSL.std.450.h # libraries/glslang/spirv/GlslangToSpv.cpp # libraries/glslang/spirv/GlslangToSpv.h # libraries/glslang/spirv/InReadableOrder.cpp # libraries/glslang/spirv/Logger.cpp # libraries/glslang/spirv/Logger.h # libraries/glslang/spirv/SPVRemapper.cpp # libraries/glslang/spirv/SPVRemapper.h # libraries/glslang/spirv/SpvBuilder.cpp # libraries/glslang/spirv/SpvBuilder.h # libraries/glslang/spirv/SpvPostProcess.cpp # libraries/glslang/spirv/SpvTools.cpp # libraries/glslang/spirv/SpvTools.h # libraries/glslang/spirv/bitutils.h # libraries/glslang/spirv/disassemble.cpp # libraries/glslang/spirv/disassemble.h # libraries/glslang/spirv/doc.cpp # libraries/glslang/spirv/doc.h # libraries/glslang/spirv/hex_float.h # libraries/glslang/spirv/spirv.hpp # libraries/glslang/spirv/spvIR.h # src/CMakeLists.txt
160 lines
4.4 KiB
C++
160 lines
4.4 KiB
C++
// Sets up common environment for Shay Green's libraries.
|
|
// To change configuration options, modify blargg_config.h, not this file.
|
|
|
|
#ifndef BLARGG_COMMON_H
|
|
#define BLARGG_COMMON_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
#include <limits.h>
|
|
|
|
#undef BLARGG_COMMON_H
|
|
// allow blargg_config.h to #include blargg_common.h
|
|
#include "blargg_config.h"
|
|
#ifndef BLARGG_COMMON_H
|
|
#define BLARGG_COMMON_H
|
|
|
|
// BLARGG_RESTRICT: equivalent to restrict, where supported
|
|
#if __GNUC__ >= 3 || _MSC_VER >= 1100
|
|
#define BLARGG_RESTRICT __restrict
|
|
#else
|
|
#define BLARGG_RESTRICT
|
|
#endif
|
|
|
|
// STATIC_CAST(T,expr): Used in place of static_cast<T> (expr)
|
|
#ifndef STATIC_CAST
|
|
#define STATIC_CAST(T,expr) ((T) (expr))
|
|
#endif
|
|
|
|
// blargg_err_t (0 on success, otherwise error string)
|
|
#ifndef blargg_err_t
|
|
typedef const char* blargg_err_t;
|
|
#endif
|
|
|
|
// blargg_vector - very lightweight vector of POD types (no constructor/destructor)
|
|
template<class T>
|
|
class blargg_vector {
|
|
T* begin_;
|
|
size_t size_;
|
|
public:
|
|
blargg_vector() : begin_( 0 ), size_( 0 ) { }
|
|
~blargg_vector() { free( begin_ ); }
|
|
size_t size() const { return size_; }
|
|
T* begin() const { return begin_; }
|
|
T* end() const { return begin_ + size_; }
|
|
blargg_err_t resize( size_t n )
|
|
{
|
|
void* p = realloc( begin_, n * sizeof (T) );
|
|
if ( !p && n )
|
|
return "Out of memory";
|
|
begin_ = (T*) p;
|
|
size_ = n;
|
|
return 0;
|
|
}
|
|
void clear() { void* p = begin_; begin_ = 0; size_ = 0; free( p ); }
|
|
T& operator [] ( size_t n ) const
|
|
{
|
|
assert( n <= size_ ); // <= to allow past-the-end value
|
|
return begin_ [n];
|
|
}
|
|
};
|
|
|
|
#ifndef BLARGG_DISABLE_NOTHROW
|
|
// throw spec mandatory in ISO C++ if operator new can return NULL
|
|
#if __cplusplus >= 199711 || __GNUC__ >= 3
|
|
#define BLARGG_THROWS( spec ) throw spec
|
|
#else
|
|
#define BLARGG_THROWS( spec )
|
|
#endif
|
|
#define BLARGG_DISABLE_NOTHROW \
|
|
void* operator new ( size_t s ) BLARGG_THROWS(()) { return malloc( s ); }\
|
|
void operator delete ( void* p ) { free( p ); }
|
|
#define BLARGG_NEW new
|
|
#else
|
|
#include <new>
|
|
#define BLARGG_NEW new (std::nothrow)
|
|
#endif
|
|
|
|
// BLARGG_4CHAR('a','b','c','d') = 'abcd' (four character integer constant)
|
|
#define BLARGG_4CHAR( a, b, c, d ) \
|
|
((a&0xFF)*0x1000000L + (b&0xFF)*0x10000L + (c&0xFF)*0x100L + (d&0xFF))
|
|
|
|
#define BLARGG_2CHAR( a, b ) \
|
|
((a&0xFF)*0x100L + (b&0xFF))
|
|
|
|
// BOOST_STATIC_ASSERT( expr ): Generates compile error if expr is 0.
|
|
#ifndef BOOST_STATIC_ASSERT
|
|
#ifdef _MSC_VER
|
|
// MSVC6 (_MSC_VER < 1300) fails for use of __LINE__ when /Zl is specified
|
|
#define BOOST_STATIC_ASSERT( expr ) \
|
|
void blargg_failed_( int (*arg) [2 / (int) !!(expr) - 1] )
|
|
#else
|
|
// Some other compilers fail when declaring same function multiple times in class,
|
|
// so differentiate them by line
|
|
#define BOOST_STATIC_ASSERT( expr ) \
|
|
void blargg_failed_( int (*arg) [2 / !!(expr) - 1] [__LINE__] )
|
|
#endif
|
|
#endif
|
|
|
|
// BLARGG_COMPILER_HAS_BOOL: If 0, provides bool support for old compiler. If 1,
|
|
// compiler is assumed to support bool. If undefined, availability is determined.
|
|
#ifndef BLARGG_COMPILER_HAS_BOOL
|
|
#if defined (__MWERKS__)
|
|
#if !__option(bool)
|
|
#define BLARGG_COMPILER_HAS_BOOL 0
|
|
#endif
|
|
#elif defined (_MSC_VER)
|
|
#if _MSC_VER < 1100
|
|
#define BLARGG_COMPILER_HAS_BOOL 0
|
|
#endif
|
|
#elif defined (__GNUC__)
|
|
// supports bool
|
|
#elif __cplusplus < 199711
|
|
#define BLARGG_COMPILER_HAS_BOOL 0
|
|
#endif
|
|
#endif
|
|
#if defined (BLARGG_COMPILER_HAS_BOOL) && !BLARGG_COMPILER_HAS_BOOL
|
|
// If you get errors here, modify your blargg_config.h file
|
|
typedef int bool;
|
|
const bool true = 1;
|
|
const bool false = 0;
|
|
#endif
|
|
|
|
// blargg_long/blargg_ulong = at least 32 bits, int if it's big enough
|
|
|
|
#if INT_MAX < 0x7FFFFFFF || LONG_MAX == 0x7FFFFFFF
|
|
typedef long blargg_long;
|
|
#else
|
|
typedef int blargg_long;
|
|
#endif
|
|
|
|
#if UINT_MAX < 0xFFFFFFFF || ULONG_MAX == 0xFFFFFFFF
|
|
typedef unsigned long blargg_ulong;
|
|
#else
|
|
typedef unsigned blargg_ulong;
|
|
#endif
|
|
|
|
// int8_t etc.
|
|
|
|
// TODO: Add CMake check for this, although I'd likely just point affected
|
|
// persons to a real compiler...
|
|
#if 1 || defined (HAVE_STDINT_H)
|
|
#include <stdint.h>
|
|
#endif
|
|
|
|
#if __GNUC__ >= 3
|
|
#define BLARGG_DEPRECATED __attribute__ ((deprecated))
|
|
#else
|
|
#define BLARGG_DEPRECATED
|
|
#endif
|
|
|
|
// Use in place of "= 0;" for a pure virtual, since these cause calls to std C++ lib.
|
|
// During development, BLARGG_PURE( x ) expands to = 0;
|
|
// virtual int func() BLARGG_PURE( { return 0; } )
|
|
#ifndef BLARGG_PURE
|
|
#define BLARGG_PURE( def ) def
|
|
#endif
|
|
|
|
#endif
|
|
#endif
|