The server tree of https://code.moenext.com/nanahira/ygopro.git, branch server, commit 52c868ce071ea0f2fcb0cf39bf2fb4151d12b90c, stock: gframe/, premake5.lua, .ci/, LICENSE, and gframe/ygopro.rc + .ico (upstream keeps them in resource/ and copies them in before building). No game assets, no scripts, no ocgcore submodule: the core is ../core. The third-party sources upstream's Windows CI downloads are vendored here at the positions its premake expects, each with its premake fragment from upstream's premake/ folder inside it: lua 5.4.8, sqlite 3.53.3, libevent 2.1.13-stable (tests, samples and autotools helpers left out; the files its Windows prebuild copies into include/ left out), zlib 1.3.2 (contrib and examples left out), xz 5.8.3 (src/liblzma + src/common only), and irrlicht 1.9 from mycard at 20f86d25: include/ plus the source/Irrlicht headers and the 11 .cpp files the server's zip reader project compiles. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
375 lines
12 KiB
C++
375 lines
12 KiB
C++
// Copyright (C) 2002-2022 Thomas Alten
|
|
// This file is part of the "Irrlicht Engine".
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
#ifndef S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED
|
|
#define S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED
|
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
//! ignore c++ core guidelines checkers
|
|
/** The Microsoft compiler */
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1929)
|
|
#pragma warning(disable : 26446) // Warning C26446 Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
|
|
#pragma warning(disable : 26481) // Warning C26481 Don't use pointer arithmetic. Use span instead (bounds.1).
|
|
#pragma warning(disable : 26485) // Warning C26485 Expression '': No array to pointer decay (bounds.3).
|
|
#pragma warning(disable : 26493) // Warning C26493 Don't use C-style casts. (bounds.4).
|
|
#endif
|
|
|
|
// don't want intend on namespaces (autoformat)
|
|
#define burning_namespace_start namespace irr { namespace video {
|
|
#define burning_namespace_end } /* end namespace video*/ } /* end namespace irr */
|
|
|
|
// Generic Render Flags for burning's video rasterizer
|
|
// defined now in irrlicht compile config
|
|
|
|
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
|
|
#undef BURNINGVIDEO_RENDERER_BEAUTIFUL
|
|
|
|
#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
|
#define SOFTWARE_DRIVER_2_SUBTEXEL
|
|
#define SOFTWARE_DRIVER_2_BILINEAR
|
|
#define SOFTWARE_DRIVER_2_LIGHTING
|
|
#define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
|
#define SOFTWARE_DRIVER_2_USE_SEPARATE_SPECULAR_COLOR
|
|
#define SOFTWARE_DRIVER_2_USE_WBUFFER
|
|
#define SOFTWARE_DRIVER_2_32BIT
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A8R8G8B8
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A8R8G8B8
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 0x100000
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 16
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 1
|
|
#define SOFTWARE_DRIVER_2_CLIPPING
|
|
#define SOFTWARE_DRIVER_2_2D_AS_3D
|
|
#define SOFTWARE_DRIVER_2_INTERLACED
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_SCALE
|
|
|
|
#endif
|
|
|
|
#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL
|
|
#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
|
#define SOFTWARE_DRIVER_2_SUBTEXEL
|
|
#define SOFTWARE_DRIVER_2_BILINEAR
|
|
#define SOFTWARE_DRIVER_2_LIGHTING
|
|
#define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
|
#define SOFTWARE_DRIVER_2_USE_SEPARATE_SPECULAR_COLOR
|
|
#define SOFTWARE_DRIVER_2_USE_WBUFFER
|
|
#define SOFTWARE_DRIVER_2_32BIT
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A8R8G8B8
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A8R8G8B8
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 0x100000
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 16
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 1
|
|
#define SOFTWARE_DRIVER_2_CLIPPING
|
|
#define SOFTWARE_DRIVER_2_2D_AS_3D
|
|
#define SOFTWARE_DRIVER_2_INTERLACED
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_SCALE
|
|
#endif
|
|
|
|
//! Set Flags for Windows Mobile
|
|
#ifdef BURNINGVIDEO_RENDERER_CE
|
|
#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
|
#define SOFTWARE_DRIVER_2_SUBTEXEL
|
|
//#define SOFTWARE_DRIVER_2_BILINEAR
|
|
//#define SOFTWARE_DRIVER_2_LIGHTING
|
|
#define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
|
#define SOFTWARE_DRIVER_2_USE_WBUFFER
|
|
#define SOFTWARE_DRIVER_2_16BIT
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A1R5G5B5
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A1R5G5B5
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 64
|
|
//#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 4
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 8
|
|
//#define SOFTWARE_DRIVER_2_CLIPPING
|
|
#define SOFTWARE_DRIVER_2_2D_AS_2D
|
|
#endif
|
|
|
|
#ifdef BURNINGVIDEO_RENDERER_FAST
|
|
#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
|
#define SOFTWARE_DRIVER_2_SUBTEXEL
|
|
//#define SOFTWARE_DRIVER_2_BILINEAR
|
|
//#define SOFTWARE_DRIVER_2_LIGHTING
|
|
#define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
|
#define SOFTWARE_DRIVER_2_USE_WBUFFER
|
|
#define SOFTWARE_DRIVER_2_16BIT
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 256
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A1R5G5B5
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A1R5G5B5
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 4
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 8
|
|
#define SOFTWARE_DRIVER_2_CLIPPING
|
|
#define SOFTWARE_DRIVER_2_2D_AS_2D
|
|
#define SOFTWARE_DRIVER_2_INTERLACED
|
|
#endif
|
|
|
|
#ifdef BURNINGVIDEO_RENDERER_ULTRA_FAST
|
|
#define BURNINGVIDEO_RENDERER_FAST
|
|
|
|
//#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
|
//#define SOFTWARE_DRIVER_2_SUBTEXEL
|
|
//#define SOFTWARE_DRIVER_2_BILINEAR
|
|
//#define SOFTWARE_DRIVER_2_LIGHTING
|
|
#define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
|
//#define SOFTWARE_DRIVER_2_USE_WBUFFER
|
|
#define SOFTWARE_DRIVER_2_16BIT
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 256
|
|
#define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A1R5G5B5
|
|
#define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A1R5G5B5
|
|
//#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 1
|
|
#define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 1
|
|
//#define SOFTWARE_DRIVER_2_CLIPPING
|
|
#define SOFTWARE_DRIVER_2_2D_AS_2D
|
|
#define SOFTWARE_DRIVER_2_INTERLACED
|
|
#endif
|
|
|
|
|
|
#ifndef REALINLINE
|
|
#ifdef _MSC_VER
|
|
#define REALINLINE __forceinline
|
|
#else
|
|
#define REALINLINE inline
|
|
#endif
|
|
#endif
|
|
|
|
#define reciprocal_zero(x) ((x) != 0.f ? 1.f / (x):0.f)
|
|
#define reciprocal_zero_pos_underflow(x) ((x) != 0.f ? 1.f / (x):0.f)
|
|
#define reciprocal_one(x) ((x) != 0.f ? 1.f / (x):1.f)
|
|
|
|
//Control Scanline output
|
|
#define SOFTWARE_DRIVER_2_STEP_X 1
|
|
#define SOFTWARE_DRIVER_2_STEP_Y 1
|
|
|
|
// null check necessary (burningvideo only)
|
|
#define fill_step_y(y) ((y) != 0.f ? (float)1.f / (y):0.f)
|
|
static inline float fill_step_x(float x) { return x != 0.f ? (float)SOFTWARE_DRIVER_2_STEP_X / x : 0.f; }
|
|
|
|
#define interlace_control_bit 1
|
|
#define interlace_control_mask ((1<<interlace_control_bit)-1)
|
|
union interlaced_control
|
|
{
|
|
struct {
|
|
unsigned enable : 1;
|
|
unsigned bypass : 1;
|
|
unsigned nr : interlace_control_bit;
|
|
|
|
unsigned target_scalex : 2; // 0 means 1
|
|
unsigned target_scaley : 2;
|
|
|
|
unsigned tex_scalex : 2; // 0 means 1
|
|
unsigned tex_scaley : 2;
|
|
} m;
|
|
unsigned raw;
|
|
};
|
|
struct interlace_scanline_data { unsigned int y; };
|
|
|
|
static inline interlaced_control interlaced_disabled()
|
|
{
|
|
interlaced_control v;
|
|
v.raw = 0;
|
|
v.m.bypass = 1;
|
|
return v;
|
|
}
|
|
#if defined(SOFTWARE_DRIVER_2_INTERLACED)
|
|
#define interlace_scanline_active ((((unsigned)line.y) & interlace_control_mask) == RenderTarget.interlaced.m.nr)
|
|
#define if_interlace_scanline_active if (interlace_scanline_active)
|
|
#define if_interlace_scanline if ( RenderTarget.interlaced.m.bypass || interlace_scanline_active )
|
|
#else
|
|
#define if_interlace_scanline_active
|
|
#define if_interlace_scanline
|
|
#endif
|
|
|
|
#define if_scissor_test_y if ((~TL_Flag & TL_SCISSOR) || ((line.y >= Scissor.y0) & (line.y <= Scissor.y1)))
|
|
#define if_scissor_test_x if ((~TL_Flag & TL_SCISSOR) || ((i+xStart >= Scissor.x0) & (i+xStart <= Scissor.x1)))
|
|
|
|
// https://inst.eecs.berkeley.edu/~cs184/sp04/as/as2/assgn-02_faqs.html
|
|
#define fill_convention_top(y) (s32) ceilf(y)
|
|
#define fill_convention_down(y) (((s32) ceilf(y))-1)
|
|
#define fill_convention_left(x) (s32) ceilf(x)
|
|
#define fill_convention_right(x) (((s32) ceilf(x-1.f)))
|
|
|
|
#if 0
|
|
// http://www.chrishecker.com/images/9/97/Gdmtex2.pdf
|
|
#define fill_convention_top(y) (s32) ceilf(y)
|
|
#define fill_convention_down(y) (((s32) ceilf(y))-1)
|
|
#define fill_convention_left(x) (s32) ceilf(x)
|
|
#define fill_convention_right(x) (((s32) ceilf(x))-1)
|
|
#endif
|
|
|
|
#define fill_convention_none(x) (s32) (x)
|
|
#define fill_convention_edge(x) (s32) floorf(fabsf(x))
|
|
|
|
//fixpoint
|
|
//#define fill_convention_top_left(x) 65536 - int(65536.0f - x)
|
|
//#define fill_convention_right(x) 65535 - int(65536.0f - x)
|
|
|
|
|
|
//Check that coordinates are in render target/window space
|
|
//#define SOFTWARE_DRIVER_2_DO_CLIPCHECK
|
|
#if defined (SOFTWARE_DRIVER_2_DO_CLIPCHECK) && defined(_WIN32)
|
|
#define SOFTWARE_DRIVER_2_CLIPCHECK if( xStart < 0 || xStart + dx >= (s32)RenderTarget->getDimension().Width || line.y < 0 || line.y >= (s32) RenderTarget->getDimension().Height ) __debugbreak()
|
|
#define SOFTWARE_DRIVER_2_CLIPCHECK_REF if( pShader.xStart < 0 || pShader.xStart + pShader.dx >= (s32)RenderTarget->getDimension().Width || line.y < 0 || line.y >= (s32) RenderTarget->getDimension().Height ) __debugbreak()
|
|
#define SOFTWARE_DRIVER_2_CLIPCHECK_WIRE if( aposx < 0 || aposx >= (s32)RenderTarget->getDimension().Width || aposy < 0 || aposy >= (s32) RenderTarget->getDimension().Height ) __debugbreak()
|
|
|
|
inline float reciprocal_zero_no(const float x)
|
|
{
|
|
if (x * x <= 0.00001f) __debugbreak();
|
|
return 1.f / x;
|
|
}
|
|
#else
|
|
#define SOFTWARE_DRIVER_2_CLIPCHECK
|
|
#define SOFTWARE_DRIVER_2_CLIPCHECK_REF
|
|
#define SOFTWARE_DRIVER_2_CLIPCHECK_WIRE
|
|
|
|
#define reciprocal_zero_no(x) 1.f/x
|
|
#endif
|
|
|
|
//!scanline renderer emulate line
|
|
enum edge_test_flag
|
|
{
|
|
edge_test_pass = 1, //! not wireframe
|
|
edge_test_left = 0,
|
|
edge_test_first_line = 2,
|
|
edge_test_point = 4
|
|
};
|
|
//if any edge test flag is set result=1 else 0. ( pass height test for degenerate triangle )
|
|
#define reciprocal_edge(x) ((x) != 0.f ? 1.f / (x):(~EdgeTestPass)&1)
|
|
|
|
//! normalize from fixed point Color Max to fixed point [0;1]
|
|
#define fix_color_norm(x) x = (x+1) >> COLOR_MAX_LOG2
|
|
|
|
//! from 1 bit to 5 bit
|
|
#if defined(SOFTWARE_DRIVER_2_32BIT)
|
|
#define fix_alpha_color_max(x)
|
|
#else
|
|
#define fix_alpha_color_max(x) if (x) x = (x << COLOR_MAX_LOG2) - 1
|
|
#endif
|
|
|
|
// Check windows
|
|
#if _WIN32 || _WIN64
|
|
#if _WIN64
|
|
#define ENV64BIT
|
|
#else
|
|
#define ENV32BIT
|
|
#endif
|
|
#endif
|
|
|
|
// Check GCC
|
|
#if defined(__GNUC__)
|
|
#if __x86_64__ || __ppc64__
|
|
#define ENV64BIT
|
|
#else
|
|
#define ENV32BIT
|
|
#endif
|
|
#endif
|
|
|
|
#if defined(ENV64BIT) && defined(BURNINGVIDEO_RENDERER_BEAUTIFUL)
|
|
typedef float ipoltype;
|
|
#else
|
|
typedef float ipoltype;
|
|
#endif
|
|
|
|
#define ipol_lower_equal_0(n) ((n) <= (ipoltype)0.0)
|
|
#define ipol_lower_0(n) ((n) < (ipoltype)0.0)
|
|
#define ipol_greater_0(n) ((n) > (ipoltype)0.0)
|
|
|
|
#if (_MSC_VER > 1700 )
|
|
#define burning_restrict __restrict
|
|
#else
|
|
#define burning_restrict
|
|
#endif
|
|
|
|
#if 0 && defined(_MSC_VER) && (_MSC_VER > 1500) && !defined(_DEBUG)
|
|
#pragma auto_inline(on)
|
|
#pragma inline_depth(255)
|
|
#pragma inline_recursion(on)
|
|
#endif
|
|
|
|
|
|
#define burning_stringify(s) #s
|
|
#define burning_create_indirect(s) create_##s
|
|
#define burning_create(s) burning_create_indirect(s)
|
|
|
|
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
|
|
#define snprintf_irr sprintf_s
|
|
#elif defined(__APPLE__)
|
|
#define snprintf_irr snprintf
|
|
#elif !defined(__CYGWIN__)
|
|
#define swprintf_irr _snwprintf
|
|
#define snprintf_irr _snprintf
|
|
#endif
|
|
|
|
#define sprintf_countof(x) ((sizeof(x) / sizeof(x[0]))-1)
|
|
|
|
|
|
//#define EVDF_DEPTH_CLAMP (video::E_VIDEO_DRIVER_FEATURE) 43
|
|
// #define ECFN_DISABLED 0
|
|
|
|
namespace irr {
|
|
namespace video {
|
|
|
|
//! Enumeration of cube texture surfaces
|
|
enum E_CUBE_SURFACE
|
|
{
|
|
ECS_POSX = 0,
|
|
ECS_NEGX,
|
|
ECS_POSY,
|
|
ECS_NEGY,
|
|
ECS_POSZ,
|
|
ECS_NEGZ
|
|
};
|
|
|
|
//! Enum for the flags of clear buffer
|
|
enum E_CLEAR_BUFFER_FLAG
|
|
{
|
|
ECBF_NONE = 0,
|
|
ECBF_COLOR = 1,
|
|
ECBF_DEPTH = 2,
|
|
ECBF_STENCIL = 4,
|
|
ECBF_ALL = ECBF_COLOR | ECBF_DEPTH | ECBF_STENCIL
|
|
};
|
|
}
|
|
}
|
|
#endif // PATCH_SUPERTUX_8_0_1_with_1_9_0
|
|
|
|
//! Size of a static C-style array.
|
|
#define array_size(_arr) ((sizeof(_arr)/sizeof(*_arr)))
|
|
|
|
//! Compiler Align
|
|
#if defined(_MSC_VER)
|
|
#if defined(ENV64BIT)
|
|
#define ALIGN(x) __declspec(align(x))
|
|
#else
|
|
// ALIGN(16) not working in 32Bit Compiler
|
|
#define ALIGN(x) __declspec(align(8))
|
|
#endif
|
|
#elif defined(__GNUC__)
|
|
#define ALIGN(x) __attribute__ ((aligned(x)))
|
|
#else
|
|
#define ALIGN(x)
|
|
#endif
|
|
|
|
#if !defined(irr_unreferenced_parameter)
|
|
#define irr_unreferenced_parameter(P) (void)(P)
|
|
#endif
|
|
|
|
// Burning Shader Language
|
|
#define bl_uniform_p(var,name) ((const var*)glsl.MaterialLink->shader->getUniform(name,BL_UNIFORM_FLOAT))
|
|
#define bl_uniform(var,name) const var& name = *bl_uniform_p(var,#name)
|
|
|
|
//! Testing Burning Video GLSL Emulation
|
|
//#define burning_glsl_emu_test
|
|
|
|
// testing STK Shader
|
|
#if !defined(PATCH_SUPERTUX_8_0_1_with_1_9_0_Shader)
|
|
//#define PATCH_SUPERTUX_8_0_1_with_1_9_0_Shader
|
|
#endif
|
|
|
|
|
|
#endif // S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED
|