mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 13:01:19 +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
123 lines
3.8 KiB
C++
123 lines
3.8 KiB
C++
/* Included at the beginning of library source files, after all other #include lines.
|
|
Sets up helpful macros and services used in my source code. They don't need
|
|
module an annoying module prefix on their names since they are defined after
|
|
all other #include lines. */
|
|
|
|
#ifndef BLARGG_SOURCE_H
|
|
#define BLARGG_SOURCE_H
|
|
|
|
// If debugging is enabled, abort program if expr is false. Meant for checking
|
|
// internal state and consistency. A failed assertion indicates a bug in the module.
|
|
// void assert( bool expr );
|
|
#include <assert.h>
|
|
|
|
// If debugging is enabled and expr is false, abort program. Meant for checking
|
|
// caller-supplied parameters and operations that are outside the control of the
|
|
// module. A failed requirement indicates a bug outside the module.
|
|
// void require( bool expr );
|
|
#undef require
|
|
#define require( expr ) assert( expr )
|
|
|
|
// Use to provide hints to compiler for optimized code layout in situations where we
|
|
// can almost always expect a conditional to go one way or the other. Should only be
|
|
// used in situations where an unexpected branch is truly exceptional though!
|
|
#undef likely
|
|
#undef unlikely
|
|
#ifdef __GNUC__
|
|
#define likely( x ) __builtin_expect(x, 1)
|
|
#define unlikely( x ) __builtin_expect(x, 0)
|
|
#else
|
|
#define likely( x ) (x)
|
|
#define unlikely( x ) (x)
|
|
#endif
|
|
|
|
// Like printf() except output goes to debug log file. Might be defined to do
|
|
// nothing (not even evaluate its arguments).
|
|
// void debug_printf( const char* format, ... );
|
|
static inline void blargg_dprintf_( const char*, ... ) { }
|
|
#undef debug_printf
|
|
#define debug_printf (1) ? (void) 0 : blargg_dprintf_
|
|
|
|
// If enabled, evaluate expr and if false, make debug log entry with source file
|
|
// and line. Meant for finding situations that should be examined further, but that
|
|
// don't indicate a problem. In all cases, execution continues normally.
|
|
#undef check
|
|
#define check( expr ) ((void) 0)
|
|
|
|
// If expr yields error string, return it from current function, otherwise continue.
|
|
#undef RETURN_ERR
|
|
#define RETURN_ERR( expr ) do { \
|
|
blargg_err_t blargg_return_err_ = (expr); \
|
|
if ( blargg_return_err_ ) return blargg_return_err_; \
|
|
} while ( 0 )
|
|
|
|
// If ptr is 0, return out of memory error string.
|
|
#undef CHECK_ALLOC
|
|
#define CHECK_ALLOC( ptr ) do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 )
|
|
|
|
// Avoid any macros which evaluate their arguments multiple times
|
|
#undef min
|
|
#undef max
|
|
|
|
#define DEF_MIN_MAX( type ) \
|
|
static inline type min( type x, type y ) { if ( x < y ) return x; return y; }\
|
|
static inline type max( type x, type y ) { if ( y < x ) return x; return y; }
|
|
|
|
DEF_MIN_MAX( int )
|
|
DEF_MIN_MAX( unsigned )
|
|
DEF_MIN_MAX( long )
|
|
DEF_MIN_MAX( unsigned long )
|
|
DEF_MIN_MAX( float )
|
|
DEF_MIN_MAX( double )
|
|
|
|
#undef DEF_MIN_MAX
|
|
|
|
/*
|
|
// using const references generates crappy code, and I am currenly only using these
|
|
// for built-in types, so they take arguments by value
|
|
|
|
// TODO: remove
|
|
inline int min( int x, int y )
|
|
template<class T>
|
|
inline T min( T x, T y )
|
|
{
|
|
if ( x < y )
|
|
return x;
|
|
return y;
|
|
}
|
|
|
|
template<class T>
|
|
inline T max( T x, T y )
|
|
{
|
|
if ( x < y )
|
|
return y;
|
|
return x;
|
|
}
|
|
*/
|
|
|
|
// TODO: good idea? bad idea?
|
|
#undef byte
|
|
#define byte byte_
|
|
typedef unsigned char byte;
|
|
|
|
// Setup compiler defines useful for exporting required public API symbols in gme.cpp
|
|
#ifndef BLARGG_EXPORT
|
|
#if defined (_WIN32) && defined(BLARGG_BUILD_DLL)
|
|
#define BLARGG_EXPORT __declspec(dllexport)
|
|
#elif defined (LIBGME_VISIBILITY)
|
|
#define BLARGG_EXPORT __attribute__((visibility ("default")))
|
|
#else
|
|
#define BLARGG_EXPORT
|
|
#endif
|
|
#endif
|
|
|
|
// deprecated
|
|
#define BLARGG_CHECK_ALLOC CHECK_ALLOC
|
|
#define BLARGG_RETURN_ERR RETURN_ERR
|
|
|
|
// BLARGG_SOURCE_BEGIN: If defined, #included, allowing redefition of debug_printf and check
|
|
#ifdef BLARGG_SOURCE_BEGIN
|
|
#include BLARGG_SOURCE_BEGIN
|
|
#endif
|
|
|
|
#endif
|