diff --git a/src/gpu/renderer.cpp b/src/gpu/renderer.cpp index ac8dfc3c..915762e3 100755 --- a/src/gpu/renderer.cpp +++ b/src/gpu/renderer.cpp @@ -436,10 +436,10 @@ void Renderer::SetBlendEquation(BlendEquation rgb, BlendEquation alpha) s1[i] = D3DBLENDOP_SUBTRACT; break; case BlendEquation::ReverseSubtract: s1[i] = D3DBLENDOP_REVSUBTRACT; break; - case BlendEquation::Max: - s1[i] = D3DBLENDOP_MAX; break; case BlendEquation::Min: s1[i] = D3DBLENDOP_MIN; break; + case BlendEquation::Max: + s1[i] = D3DBLENDOP_MAX; break; } } @@ -459,17 +459,16 @@ void Renderer::SetBlendEquation(BlendEquation rgb, BlendEquation alpha) s1[i] = GL_FUNC_SUBTRACT; break; case BlendEquation::ReverseSubtract: s1[i] = GL_FUNC_REVERSE_SUBTRACT; break; +#if defined GL_MIN && defined GL_MAX + case BlendEquation::Min: + s1[i] = GL_MIN; break; case BlendEquation::Max: -#if defined GL_MAX s1[i] = GL_MAX; break; #else - s1[i] = GL_MAX_EXT; break; -#endif case BlendEquation::Min: -#if defined GL_MIN - s1[i] = GL_MIN; break; -#else s1[i] = GL_MIN_EXT; break; + case BlendEquation::Max: + s1[i] = GL_MAX_EXT; break; #endif } } diff --git a/src/lol/gpu/renderer.h b/src/lol/gpu/renderer.h index 6e8ccda8..fd2fbdce 100755 --- a/src/lol/gpu/renderer.h +++ b/src/lol/gpu/renderer.h @@ -22,160 +22,106 @@ namespace lol class RendererData; /* A list of bitmasks to clear a render buffer. */ -struct ClearMask +enum class ClearMask : uint8_t { - enum Value - { - /* Note: D3D9 doesn't appear to support the accumulation buffer, - * and it is a deprecated OpenGL feature. No reason to support it. */ - Color = 1 << 0, - Depth = 1 << 1, - Stencil = 1 << 2, - - All = 0xffffffff - } - m_value; - - inline ClearMask(Value v) : m_value(v) {} - inline ClearMask(uint64_t i) : m_value((Value)i) {} - inline operator Value() { return m_value; } + /* Note: D3D9 doesn't appear to support the accumulation buffer, + * and it is a deprecated OpenGL feature. No reason to support it. */ + Color = 1 << 0, + Depth = 1 << 1, + Stencil = 1 << 2, + + All = 0xff, }; +static inline ClearMask operator |(ClearMask const &a, ClearMask const &b) +{ + return ClearMask((uint8_t)a | (uint8_t)b); +} + +static inline bool operator &(ClearMask const &a, ClearMask const &b) +{ + return (bool)((uint8_t)a & (uint8_t)b); +} + /* A safe enum to indicate the blend equation. */ -struct BlendEquation +enum class BlendEquation : uint8_t { - enum Value - { - Add, - Subtract, - ReverseSubtract, - Min, - Max, - } - m_value; - - inline BlendEquation() : m_value(Add) {} - inline BlendEquation(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Add, + Subtract, + ReverseSubtract, + Min, + Max, }; /* A safe enum to indicate the blending factors. */ -struct BlendFunc +enum class BlendFunc : uint8_t { - enum Value - { - Disabled, - Zero, - One, - SrcColor, - OneMinusSrcColor, - DstColor, - OneMinusDstColor, - SrcAlpha, - OneMinusSrcAlpha, - DstAlpha, - OneMinusDstAlpha, - ConstantColor, - OneMinusConstantColor, - ConstantAlpha, - OneMinusConstantAlpha, - } - m_value; - - inline BlendFunc() : m_value(Zero) {} - inline BlendFunc(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Disabled, + Zero, + One, + SrcColor, + OneMinusSrcColor, + DstColor, + OneMinusDstColor, + SrcAlpha, + OneMinusSrcAlpha, + DstAlpha, + OneMinusDstAlpha, + ConstantColor, + OneMinusConstantColor, + ConstantAlpha, + OneMinusConstantAlpha, }; /* A safe enum to indicate the face culling mode. */ -struct CullMode +enum class CullMode : uint8_t { - enum Value - { - Disabled, - Clockwise, - CounterClockwise, - } - m_value; - - inline CullMode() : m_value(Disabled) {} - inline CullMode(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Disabled, + Clockwise, + CounterClockwise, }; /* A safe enum to indicate the polygon mode. */ -struct PolygonMode +enum class PolygonMode : uint8_t { - enum Value - { - Fill, - Line, - Point, - } - m_value; - - inline PolygonMode() : m_value(Fill) {} - inline PolygonMode(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Fill, + Line, + Point, }; /* A safe enum to indicate the depth test mode. */ -struct DepthFunc +enum class DepthFunc : uint8_t { - enum Value - { - Disabled, - Never, - Less, - Equal, - LessOrEqual, - Greater, - NotEqual, - GreaterOrEqual, - Always, - } - m_value; - - inline DepthFunc() : m_value(Disabled) {} - inline DepthFunc(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Disabled, + Never, + Less, + Equal, + LessOrEqual, + Greater, + NotEqual, + GreaterOrEqual, + Always, }; /* A safe enum to indicate the depth mask. */ -struct DepthMask +enum class DepthMask : uint8_t { - enum Value - { - Disabled, - Enabled, - } - m_value; - - inline DepthMask() : m_value(Disabled) {} - inline DepthMask(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Disabled, + Enabled, }; /* A safe enum to indicate the alpha test mode. */ -struct AlphaFunc +enum class AlphaFunc : uint8_t { - enum Value - { - Disabled, - Never, - Less, - Equal, - LessOrEqual, - Greater, - NotEqual, - GreaterOrEqual, - Always, - } - m_value; - - inline AlphaFunc() : m_value(Disabled) {} - inline AlphaFunc(Value v) : m_value(v) {} - inline operator Value() { return m_value; } + Disabled, + Never, + Less, + Equal, + LessOrEqual, + Greater, + NotEqual, + GreaterOrEqual, + Always, }; class Renderer