1 // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED__
\r
6 #define __S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
10 // Generic Render Flags for burning's video rasterizer
\r
11 // defined now in irrlicht compile config
\r
13 #if 1 && defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
\r
14 #undef BURNINGVIDEO_RENDERER_BEAUTIFUL
\r
16 #define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
\r
17 #define SOFTWARE_DRIVER_2_SUBTEXEL
\r
18 #define SOFTWARE_DRIVER_2_BILINEAR
\r
19 #define SOFTWARE_DRIVER_2_LIGHTING
\r
20 #define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
\r
21 //#define SOFTWARE_DRIVER_2_USE_SEPARATE_SPECULAR_COLOR
\r
22 #define SOFTWARE_DRIVER_2_USE_WBUFFER
\r
23 #define SOFTWARE_DRIVER_2_32BIT
\r
24 #define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A8R8G8B8
\r
25 #define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A8R8G8B8
\r
26 #define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 256
\r
27 #define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
\r
28 #define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 8
\r
29 #define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 1
\r
30 #define SOFTWARE_DRIVER_2_SCANLINE_MAG_MIN
\r
31 #define SOFTWARE_DRIVER_2_CLIPPING
\r
32 #define SOFTWARE_DRIVER_2_2D_AS_3D
\r
33 #define SOFTWARE_DRIVER_2_INTERLACED
\r
37 #ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL
\r
38 #define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
\r
39 #define SOFTWARE_DRIVER_2_SUBTEXEL
\r
40 #define SOFTWARE_DRIVER_2_BILINEAR
\r
41 #define SOFTWARE_DRIVER_2_LIGHTING
\r
42 #define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
\r
43 #define SOFTWARE_DRIVER_2_USE_SEPARATE_SPECULAR_COLOR
\r
44 #define SOFTWARE_DRIVER_2_USE_WBUFFER
\r
45 #define SOFTWARE_DRIVER_2_32BIT
\r
46 #define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A8R8G8B8
\r
47 #define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A8R8G8B8
\r
48 #define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 0x100000
\r
49 #define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
\r
50 #define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 16
\r
51 #define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 1
\r
52 #define SOFTWARE_DRIVER_2_SCANLINE_MAG_MIN
\r
53 #define SOFTWARE_DRIVER_2_CLIPPING
\r
54 #define SOFTWARE_DRIVER_2_2D_AS_3D
\r
55 #define SOFTWARE_DRIVER_2_INTERLACED
\r
58 //! Set Flags for Windows Mobile
\r
59 #ifdef BURNINGVIDEO_RENDERER_CE
\r
60 #define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
\r
61 #define SOFTWARE_DRIVER_2_SUBTEXEL
\r
62 //#define SOFTWARE_DRIVER_2_BILINEAR
\r
63 //#define SOFTWARE_DRIVER_2_LIGHTING
\r
64 #define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
\r
65 #define SOFTWARE_DRIVER_2_USE_WBUFFER
\r
66 #define SOFTWARE_DRIVER_2_16BIT
\r
67 #define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A1R5G5B5
\r
68 #define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A1R5G5B5
\r
69 #define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 64
\r
70 //#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
\r
71 #define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 4
\r
72 #define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 8
\r
73 #define SOFTWARE_DRIVER_2_SCANLINE_MAG_MIN
\r
74 //#define SOFTWARE_DRIVER_2_CLIPPING
\r
75 #define SOFTWARE_DRIVER_2_2D_AS_2D
\r
78 #ifdef BURNINGVIDEO_RENDERER_FAST
\r
79 #define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
\r
80 #define SOFTWARE_DRIVER_2_SUBTEXEL
\r
81 //#define SOFTWARE_DRIVER_2_BILINEAR
\r
82 //#define SOFTWARE_DRIVER_2_LIGHTING
\r
83 #define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
\r
84 #define SOFTWARE_DRIVER_2_USE_WBUFFER
\r
85 #define SOFTWARE_DRIVER_2_16BIT
\r
86 #define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 256
\r
87 #define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A1R5G5B5
\r
88 #define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A1R5G5B5
\r
89 #define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 4
\r
90 #define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 8
\r
91 #define SOFTWARE_DRIVER_2_SCANLINE_MAG_MIN
\r
92 #define SOFTWARE_DRIVER_2_CLIPPING
\r
93 #define SOFTWARE_DRIVER_2_2D_AS_2D
\r
94 #define SOFTWARE_DRIVER_2_INTERLACED
\r
97 #ifdef BURNINGVIDEO_RENDERER_ULTRA_FAST
\r
98 #define BURNINGVIDEO_RENDERER_FAST
\r
100 //#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
\r
101 //#define SOFTWARE_DRIVER_2_SUBTEXEL
\r
102 //#define SOFTWARE_DRIVER_2_BILINEAR
\r
103 //#define SOFTWARE_DRIVER_2_LIGHTING
\r
104 #define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
\r
105 //#define SOFTWARE_DRIVER_2_USE_WBUFFER
\r
106 #define SOFTWARE_DRIVER_2_16BIT
\r
107 #define SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE 128
\r
108 #define SOFTWARE_DRIVER_2_TEXTURE_COLOR_FORMAT ECF_A1R5G5B5
\r
109 #define SOFTWARE_DRIVER_2_RENDERTARGET_COLOR_FORMAT ECF_A1R5G5B5
\r
110 //#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
\r
111 #define SOFTWARE_DRIVER_2_MIPMAPPING_MAX 1
\r
112 #define SOFTWARE_DRIVER_2_MIPMAPPING_MIN_SIZE 1
\r
113 #define SOFTWARE_DRIVER_2_SCANLINE_MAG_MIN
\r
114 //#define SOFTWARE_DRIVER_2_CLIPPING
\r
115 #define SOFTWARE_DRIVER_2_2D_AS_2D
\r
116 #define SOFTWARE_DRIVER_2_INTERLACED
\r
122 #define REALINLINE __forceinline
\r
124 #define REALINLINE inline
\r
128 #define reciprocal_zero(x) ((x) != 0.f ? 1.f / (x):0.f)
\r
129 #define reciprocal_one(x) ((x) != 0.f ? 1.f / (x):1.f)
\r
131 //Control Scanline output
\r
132 #define SOFTWARE_DRIVER_2_STEP_X 1
\r
133 #define SOFTWARE_DRIVER_2_STEP_Y 1
\r
135 // null check necessary (burningvideo only)
\r
136 #define fill_step_y(y) ((y) != 0.f ? (float)1.f / (y):0.f)
\r
137 static inline float fill_step_x(float x) { return x != 0.f ? (float)SOFTWARE_DRIVER_2_STEP_X / x : 0.f; }
\r
139 #define interlace_control_bit 1
\r
140 #define interlace_control_mask ((1<<interlace_control_bit)-1)
\r
141 struct interlaced_control
\r
143 unsigned enable : 1;
\r
144 unsigned bypass : 1;
\r
145 unsigned nr : interlace_control_bit;
\r
147 struct interlace_scanline_data { unsigned int y; };
\r
149 static inline interlaced_control interlace_disabled()
\r
151 interlaced_control v;
\r
157 #if defined(SOFTWARE_DRIVER_2_INTERLACED)
\r
158 #define interlace_scanline if ( Interlaced.bypass | ((line.y & interlace_control_mask) == Interlaced.nr) )
\r
159 #define interlace_scanline_enabled if ( (line.y & interlace_control_mask) == Interlaced.nr )
\r
160 //#define interlace_scanline if ( Interlaced.disabled | (((line.y >> (interlace_control_bit-1) ) & 1) == (Interlaced.nr & 1)) )
\r
161 //#define interlace_scanline
\r
163 #define interlace_scanline
\r
164 #define interlace_scanline_enabled
\r
167 #define scissor_test_y if ((~TL_Flag & TL_SCISSOR) || ((line.y >= Scissor.y0) & (line.y <= Scissor.y1)))
\r
168 #define scissor_test_x if ((~TL_Flag & TL_SCISSOR) || ((i+xStart >= Scissor.x0) & (i+xStart <= Scissor.x1)))
\r
170 #define fill_convention_left(x) (s32) ceilf(x)
\r
171 #define fill_convention_right(x) ((s32) ceilf(x))-1
\r
172 #define fill_convention_none(x) (s32) (x)
\r
173 #define fill_convention_edge(x) (s32) floorf(fabsf(x)+0.f)
\r
174 //#define fill_convention_left(x) 65536 - int(65536.0f - x)
\r
175 //#define fill_convention_right(x) 65535 - int(65536.0f - x)
\r
178 //Check coordinates are in render target/window space
\r
179 //#define SOFTWARE_DRIVER_2_DO_CLIPCHECK
\r
180 #if defined (SOFTWARE_DRIVER_2_DO_CLIPCHECK) && defined(_WIN32)
\r
181 #define SOFTWARE_DRIVER_2_CLIPCHECK if( xStart < 0 || xStart + dx >= (s32)RenderTarget->getDimension().Width || line.y < 0 || line.y >= (s32) RenderTarget->getDimension().Height ) __debugbreak()
\r
182 #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()
\r
183 #define SOFTWARE_DRIVER_2_CLIPCHECK_WIRE if( aposx < 0 || aposx >= (s32)RenderTarget->getDimension().Width || aposy < 0 || aposy >= (s32) RenderTarget->getDimension().Height ) __debugbreak()
\r
185 inline float reciprocal_zero_no(const float x)
\r
187 if (x * x <= 0.00001f) __debugbreak();
\r
191 #define SOFTWARE_DRIVER_2_CLIPCHECK
\r
192 #define SOFTWARE_DRIVER_2_CLIPCHECK_REF
\r
193 #define SOFTWARE_DRIVER_2_CLIPCHECK_WIRE
\r
195 #define reciprocal_zero_no(x) 1.f/x
\r
198 //!scanline renderer emulate line
\r
199 enum edge_test_flag
\r
201 edge_test_pass = 1, //! not wireframe
\r
202 edge_test_left = 0,
\r
203 edge_test_first_line = 2,
\r
204 edge_test_point = 4
\r
206 //if any edge test flag is set result=1 else 0. ( pass height test for degenerate triangle )
\r
207 #define reciprocal_edge(x) ((x) != 0.f ? 1.f / (x):(~EdgeTestPass)&1)
\r
209 //! normalize from fixed point Color Max to fixed point [0;1]
\r
210 #define fix_color_norm(x) x = (x+1) >> COLOR_MAX_LOG2
\r
212 //! from 1 bit to 5 bit
\r
213 #if defined(SOFTWARE_DRIVER_2_32BIT)
\r
214 #define fix_alpha_color_max(x)
\r
216 #define fix_alpha_color_max(x) if (x) x = (x << COLOR_MAX_LOG2) - 1
\r
220 #if _WIN32 || _WIN64
\r
230 #if __x86_64__ || __ppc64__
\r
237 #if defined(ENV64BIT) && defined(BURNINGVIDEO_RENDERER_BEAUTIFUL)
\r
238 typedef float ipoltype;
\r
240 typedef float ipoltype;
\r
243 #define ipol_lower_equal_0(n) ((n) <= (ipoltype)0.0)
\r
244 #define ipol_greater_0(n) ((n) > (ipoltype)0.0)
\r
246 #if (_MSC_VER > 1700 )
\r
247 #define burning_restrict __restrict
\r
249 #define burning_restrict
\r
253 if (condition) state |= mask; else state &= ~mask;
\r
255 static inline void burning_setbit(size_t& state, int condition, size_t mask)
\r
257 if (condition) state |= mask;
\r
258 else state &= ~mask;
\r
262 if (condition) state |= m; else state &= ~m;
\r
264 REALINLINE void burning_setbit32(unsigned int& state, int condition, const unsigned int mask)
\r
266 // 0, or any positive to mask
\r
267 //s32 conmask = -condition >> 31;
\r
268 state ^= ((-condition >> 31) ^ state) & mask;
\r
271 #define burning_stringify(s) #s
\r
272 #define burning_create_indirect(s) create_##s
\r
273 #define burning_create(s) burning_create_indirect(s)
\r
276 #if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
\r
277 #define snprintf_irr sprintf_s
\r
278 #define EVDF_DEPTH_CLAMP 43
\r
279 #define E_CUBE_SURFACE int
\r
280 #define ECFN_DISABLED 0
\r
285 //! Enum for the flags of clear buffer
\r
286 enum E_CLEAR_BUFFER_FLAG
\r
292 ECBF_ALL = ECBF_COLOR | ECBF_DEPTH | ECBF_STENCIL
\r
295 //! For SMaterial.ZWriteEnable
\r
304 #endif // PATCH_SUPERTUX_8_0_1_with_1_9_0
\r
306 //! Size of a static C-style array.
\r
307 #define array_size(_arr) ((sizeof(_arr)/sizeof(*_arr)))
\r
310 #if defined(_MSC_VER)
\r
311 #define ALIGN(x) __declspec(align(x))
\r
312 #elif defined(__GNUC__)
\r
313 #define ALIGN(x) __attribute__ ((aligned(x)))
\r
318 #endif // __S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED__
\r