Use unsigned enum base types to use them as state bitfields.
BUG=17878699
Change-Id: Ib112ddf399ebd22676a775cdb6e6927e8f8ce25f
Reviewed-on: https://swiftshader-review.googlesource.com/1202
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Renderer/Context.cpp b/src/Renderer/Context.cpp
index fcc7f03..eb4c135 100644
--- a/src/Renderer/Context.cpp
+++ b/src/Renderer/Context.cpp
@@ -37,7 +37,7 @@
bool complementaryDepthBuffer = false;
bool postBlendSRGB = false;
bool exactColorRounding = false;
- Context::TransparencyAntialiasing transparencyAntialiasing = Context::TRANSPARENCY_NONE;
+ TransparencyAntialiasing transparencyAntialiasing = TRANSPARENCY_NONE;
bool forceClearRegisters = false;
Context::Context()
@@ -266,10 +266,10 @@
colorWriteMask[2] = 0x0000000F;
colorWriteMask[3] = 0x0000000F;
- ambientMaterialSource = MATERIAL;
- diffuseMaterialSource = COLOR1;
- specularMaterialSource = COLOR2;
- emissiveMaterialSource = MATERIAL;
+ ambientMaterialSource = MATERIAL_MATERIAL;
+ diffuseMaterialSource = MATERIAL_COLOR1;
+ specularMaterialSource = MATERIAL_COLOR2;
+ emissiveMaterialSource = MATERIAL_MATERIAL;
colorVertexEnable = true;
fogEnable = false;
@@ -459,7 +459,7 @@
return isDrawPoint(true) && (input[PointSize] || (!preTransformed && pointScaleActive()));
}
- Context::FogMode Context::pixelFogActive()
+ FogMode Context::pixelFogActive()
{
if(fogActive())
{
@@ -620,69 +620,69 @@
return lightingEnable && lightEnable[i];
}
- Context::MaterialSource Context::vertexDiffuseMaterialSourceActive()
+ MaterialSource Context::vertexDiffuseMaterialSourceActive()
{
if(vertexShader)
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
- if(diffuseMaterialSource == MATERIAL || !colorVertexEnable ||
- (diffuseMaterialSource == COLOR1 && !input[Color0]) ||
- (diffuseMaterialSource == COLOR2 && !input[Color1]))
+ if(diffuseMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
+ (diffuseMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
+ (diffuseMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
return diffuseMaterialSource;
}
- Context::MaterialSource Context::vertexSpecularMaterialSourceActive()
+ MaterialSource Context::vertexSpecularMaterialSourceActive()
{
if(vertexShader)
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
- if(specularMaterialSource == MATERIAL || !colorVertexEnable ||
- (specularMaterialSource == COLOR1 && !input[Color0]) ||
- (specularMaterialSource == COLOR2 && !input[Color1]))
+ if(specularMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
+ (specularMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
+ (specularMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
return specularMaterialSource;
}
- Context::MaterialSource Context::vertexAmbientMaterialSourceActive()
+ MaterialSource Context::vertexAmbientMaterialSourceActive()
{
if(vertexShader)
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
- if(ambientMaterialSource == MATERIAL || !colorVertexEnable ||
- (ambientMaterialSource == COLOR1 && !input[Color0]) ||
- (ambientMaterialSource == COLOR2 && !input[Color1]))
+ if(ambientMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
+ (ambientMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
+ (ambientMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
return ambientMaterialSource;
}
- Context::MaterialSource Context::vertexEmissiveMaterialSourceActive()
+ MaterialSource Context::vertexEmissiveMaterialSourceActive()
{
if(vertexShader)
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
- if(emissiveMaterialSource == MATERIAL || !colorVertexEnable ||
- (emissiveMaterialSource == COLOR1 && !input[Color0]) ||
- (emissiveMaterialSource == COLOR2 && !input[Color1]))
+ if(emissiveMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
+ (emissiveMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
+ (emissiveMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{
- return MATERIAL;
+ return MATERIAL_MATERIAL;
}
return emissiveMaterialSource;
@@ -721,7 +721,7 @@
return colorBlend || alphaBlend;
}
- Context::BlendFactor Context::sourceBlendFactor()
+ BlendFactor Context::sourceBlendFactor()
{
if(!alphaBlendEnable) return BLEND_ONE;
@@ -742,7 +742,7 @@
return sourceBlendFactorState;
}
- Context::BlendFactor Context::destBlendFactor()
+ BlendFactor Context::destBlendFactor()
{
if(!alphaBlendEnable) return BLEND_ZERO;
@@ -763,7 +763,7 @@
return destBlendFactorState;
}
- Context::BlendOperation Context::blendOperation()
+ BlendOperation Context::blendOperation()
{
if(!alphaBlendEnable) return BLENDOP_SOURCE;
@@ -875,7 +875,7 @@
return blendOperationState;
}
- Context::BlendFactor Context::sourceBlendFactorAlpha()
+ BlendFactor Context::sourceBlendFactorAlpha()
{
if(!separateAlphaBlendEnable)
{
@@ -901,7 +901,7 @@
}
}
- Context::BlendFactor Context::destBlendFactorAlpha()
+ BlendFactor Context::destBlendFactorAlpha()
{
if(!separateAlphaBlendEnable)
{
@@ -927,7 +927,7 @@
}
}
- Context::BlendOperation Context::blendOperationAlpha()
+ BlendOperation Context::blendOperationAlpha()
{
if(!separateAlphaBlendEnable)
{
@@ -1084,7 +1084,7 @@
return normalizeNormals;
}
- Context::FogMode Context::vertexFogModeActive()
+ FogMode Context::vertexFogModeActive()
{
if(vertexShader || !fogActive())
{
@@ -1104,7 +1104,7 @@
return rangeFogEnable;
}
- Context::TexGen Context::texGenActive(int stage)
+ TexGen Context::texGenActive(int stage)
{
if(vertexShader || !texCoordActive(stage))
{
diff --git a/src/Renderer/Context.hpp b/src/Renderer/Context.hpp
index 571f7c0..29aee0b 100644
--- a/src/Renderer/Context.hpp
+++ b/src/Renderer/Context.hpp
@@ -49,202 +49,202 @@
PositionT = 15
};
+ enum DrawType : unsigned int
+ {
+ DRAW_POINTLIST,
+ DRAW_LINELIST,
+ DRAW_LINESTRIP,
+ DRAW_LINELOOP,
+ DRAW_TRIANGLELIST,
+ DRAW_TRIANGLESTRIP,
+ DRAW_TRIANGLEFAN,
+
+ DRAW_INDEXEDPOINTLIST8,
+ DRAW_INDEXEDLINELIST8,
+ DRAW_INDEXEDLINESTRIP8,
+ DRAW_INDEXEDLINELOOP8,
+ DRAW_INDEXEDTRIANGLELIST8,
+ DRAW_INDEXEDTRIANGLESTRIP8,
+ DRAW_INDEXEDTRIANGLEFAN8,
+
+ DRAW_INDEXEDPOINTLIST16,
+ DRAW_INDEXEDLINELIST16,
+ DRAW_INDEXEDLINESTRIP16,
+ DRAW_INDEXEDLINELOOP16,
+ DRAW_INDEXEDTRIANGLELIST16,
+ DRAW_INDEXEDTRIANGLESTRIP16,
+ DRAW_INDEXEDTRIANGLEFAN16,
+
+ DRAW_INDEXEDPOINTLIST32,
+ DRAW_INDEXEDLINELIST32,
+ DRAW_INDEXEDLINESTRIP32,
+ DRAW_INDEXEDLINELOOP32,
+ DRAW_INDEXEDTRIANGLELIST32,
+ DRAW_INDEXEDTRIANGLESTRIP32,
+ DRAW_INDEXEDTRIANGLEFAN32,
+
+ DRAW_LAST = DRAW_INDEXEDTRIANGLEFAN32
+ };
+
+ enum FillMode : unsigned int
+ {
+ FILL_SOLID,
+ FILL_WIREFRAME,
+ FILL_VERTEX,
+
+ FILL_LAST = FILL_VERTEX
+ };
+
+ enum ShadingMode : unsigned int
+ {
+ SHADING_FLAT,
+ SHADING_GOURAUD,
+
+ SHADING_LAST = SHADING_GOURAUD
+ };
+
+ enum DepthCompareMode : unsigned int
+ {
+ DEPTH_ALWAYS,
+ DEPTH_NEVER,
+ DEPTH_EQUAL,
+ DEPTH_NOTEQUAL,
+ DEPTH_LESS,
+ DEPTH_LESSEQUAL,
+ DEPTH_GREATER,
+ DEPTH_GREATEREQUAL,
+
+ DEPTH_LAST = DEPTH_GREATEREQUAL
+ };
+
+ enum StencilCompareMode : unsigned int
+ {
+ STENCIL_ALWAYS,
+ STENCIL_NEVER,
+ STENCIL_EQUAL,
+ STENCIL_NOTEQUAL,
+ STENCIL_LESS,
+ STENCIL_LESSEQUAL,
+ STENCIL_GREATER,
+ STENCIL_GREATEREQUAL,
+
+ STENCIL_LAST = STENCIL_GREATEREQUAL
+ };
+
+ enum StencilOperation : unsigned int
+ {
+ OPERATION_KEEP,
+ OPERATION_ZERO,
+ OPERATION_REPLACE,
+ OPERATION_INCRSAT,
+ OPERATION_DECRSAT,
+ OPERATION_INVERT,
+ OPERATION_INCR,
+ OPERATION_DECR,
+
+ OPERATION_LAST = OPERATION_DECR
+ };
+
+ enum AlphaCompareMode : unsigned int
+ {
+ ALPHA_ALWAYS,
+ ALPHA_NEVER,
+ ALPHA_EQUAL,
+ ALPHA_NOTEQUAL,
+ ALPHA_LESS,
+ ALPHA_LESSEQUAL,
+ ALPHA_GREATER,
+ ALPHA_GREATEREQUAL,
+
+ ALPHA_LAST = ALPHA_GREATEREQUAL
+ };
+
+ enum CullMode : unsigned int
+ {
+ CULL_NONE,
+ CULL_CLOCKWISE,
+ CULL_COUNTERCLOCKWISE,
+
+ CULL_LAST = CULL_COUNTERCLOCKWISE
+ };
+
+ enum BlendFactor : unsigned int
+ {
+ BLEND_ZERO,
+ BLEND_ONE,
+ BLEND_SOURCE,
+ BLEND_INVSOURCE,
+ BLEND_DEST,
+ BLEND_INVDEST,
+ BLEND_SOURCEALPHA,
+ BLEND_INVSOURCEALPHA,
+ BLEND_DESTALPHA,
+ BLEND_INVDESTALPHA,
+ BLEND_SRCALPHASAT,
+ BLEND_CONSTANT,
+ BLEND_INVCONSTANT,
+ BLEND_CONSTANTALPHA,
+ BLEND_INVCONSTANTALPHA,
+
+ BLEND_LAST = BLEND_INVCONSTANT
+ };
+
+ enum BlendOperation : unsigned int
+ {
+ BLENDOP_ADD,
+ BLENDOP_SUB,
+ BLENDOP_INVSUB,
+ BLENDOP_MIN,
+ BLENDOP_MAX,
+
+ BLENDOP_SOURCE, // Copy source
+ BLENDOP_DEST, // Copy dest
+ BLENDOP_NULL, // Nullify result
+
+ BLENDOP_LAST = BLENDOP_NULL
+ };
+
+ enum MaterialSource : unsigned int
+ {
+ MATERIAL_MATERIAL,
+ MATERIAL_COLOR1,
+ MATERIAL_COLOR2,
+
+ MATERIAL_LAST = MATERIAL_COLOR2
+ };
+
+ enum FogMode : unsigned int
+ {
+ FOG_NONE,
+ FOG_LINEAR,
+ FOG_EXP,
+ FOG_EXP2,
+
+ FOG_LAST = FOG_EXP2
+ };
+
+ enum TexGen : unsigned int
+ {
+ TEXGEN_PASSTHRU,
+ TEXGEN_NORMAL,
+ TEXGEN_POSITION,
+ TEXGEN_REFLECTION,
+ TEXGEN_SPHEREMAP,
+
+ TEXGEN_LAST = TEXGEN_SPHEREMAP
+ };
+
+ enum TransparencyAntialiasing : unsigned int
+ {
+ TRANSPARENCY_NONE,
+ TRANSPARENCY_ALPHA_TO_COVERAGE,
+
+ TRANSPARENCY_LAST = TRANSPARENCY_ALPHA_TO_COVERAGE
+ };
+
class Context
{
public:
- enum DrawType
- {
- DRAW_POINTLIST,
- DRAW_LINELIST,
- DRAW_LINESTRIP,
- DRAW_LINELOOP,
- DRAW_TRIANGLELIST,
- DRAW_TRIANGLESTRIP,
- DRAW_TRIANGLEFAN,
-
- DRAW_INDEXEDPOINTLIST8,
- DRAW_INDEXEDLINELIST8,
- DRAW_INDEXEDLINESTRIP8,
- DRAW_INDEXEDLINELOOP8,
- DRAW_INDEXEDTRIANGLELIST8,
- DRAW_INDEXEDTRIANGLESTRIP8,
- DRAW_INDEXEDTRIANGLEFAN8,
-
- DRAW_INDEXEDPOINTLIST16,
- DRAW_INDEXEDLINELIST16,
- DRAW_INDEXEDLINESTRIP16,
- DRAW_INDEXEDLINELOOP16,
- DRAW_INDEXEDTRIANGLELIST16,
- DRAW_INDEXEDTRIANGLESTRIP16,
- DRAW_INDEXEDTRIANGLEFAN16,
-
- DRAW_INDEXEDPOINTLIST32,
- DRAW_INDEXEDLINELIST32,
- DRAW_INDEXEDLINESTRIP32,
- DRAW_INDEXEDLINELOOP32,
- DRAW_INDEXEDTRIANGLELIST32,
- DRAW_INDEXEDTRIANGLESTRIP32,
- DRAW_INDEXEDTRIANGLEFAN32,
-
- DRAW_LAST = DRAW_INDEXEDTRIANGLEFAN32
- };
-
- enum FillMode
- {
- FILL_SOLID,
- FILL_WIREFRAME,
- FILL_VERTEX,
-
- FILL_LAST = FILL_VERTEX
- };
-
- enum ShadingMode
- {
- SHADING_FLAT,
- SHADING_GOURAUD,
-
- SHADING_LAST = SHADING_GOURAUD
- };
-
- enum DepthCompareMode
- {
- DEPTH_ALWAYS,
- DEPTH_NEVER,
- DEPTH_EQUAL,
- DEPTH_NOTEQUAL,
- DEPTH_LESS,
- DEPTH_LESSEQUAL,
- DEPTH_GREATER,
- DEPTH_GREATEREQUAL,
-
- DEPTH_LAST = DEPTH_GREATEREQUAL
- };
-
- enum StencilCompareMode
- {
- STENCIL_ALWAYS,
- STENCIL_NEVER,
- STENCIL_EQUAL,
- STENCIL_NOTEQUAL,
- STENCIL_LESS,
- STENCIL_LESSEQUAL,
- STENCIL_GREATER,
- STENCIL_GREATEREQUAL,
-
- STENCIL_LAST = STENCIL_GREATEREQUAL
- };
-
- enum StencilOperation
- {
- OPERATION_KEEP,
- OPERATION_ZERO,
- OPERATION_REPLACE,
- OPERATION_INCRSAT,
- OPERATION_DECRSAT,
- OPERATION_INVERT,
- OPERATION_INCR,
- OPERATION_DECR,
-
- OPERATION_LAST = OPERATION_DECR
- };
-
- enum AlphaCompareMode
- {
- ALPHA_ALWAYS,
- ALPHA_NEVER,
- ALPHA_EQUAL,
- ALPHA_NOTEQUAL,
- ALPHA_LESS,
- ALPHA_LESSEQUAL,
- ALPHA_GREATER,
- ALPHA_GREATEREQUAL,
-
- ALPHA_LAST = ALPHA_GREATEREQUAL
- };
-
- enum CullMode
- {
- CULL_NONE,
- CULL_CLOCKWISE,
- CULL_COUNTERCLOCKWISE,
-
- CULL_LAST = CULL_COUNTERCLOCKWISE
- };
-
- enum BlendFactor
- {
- BLEND_ZERO,
- BLEND_ONE,
- BLEND_SOURCE,
- BLEND_INVSOURCE,
- BLEND_DEST,
- BLEND_INVDEST,
- BLEND_SOURCEALPHA,
- BLEND_INVSOURCEALPHA,
- BLEND_DESTALPHA,
- BLEND_INVDESTALPHA,
- BLEND_SRCALPHASAT,
- BLEND_CONSTANT,
- BLEND_INVCONSTANT,
- BLEND_CONSTANTALPHA,
- BLEND_INVCONSTANTALPHA,
-
- BLEND_LAST = BLEND_INVCONSTANT
- };
-
- enum BlendOperation
- {
- BLENDOP_ADD,
- BLENDOP_SUB,
- BLENDOP_INVSUB,
- BLENDOP_MIN,
- BLENDOP_MAX,
-
- BLENDOP_SOURCE, // Copy source
- BLENDOP_DEST, // Copy dest
- BLENDOP_NULL, // Nullify result
-
- BLENDOP_LAST = BLENDOP_NULL
- };
-
- enum MaterialSource
- {
- MATERIAL,
- COLOR1,
- COLOR2,
-
- MATERIAL_LAST = COLOR2
- };
-
- enum FogMode
- {
- FOG_NONE,
- FOG_LINEAR,
- FOG_EXP,
- FOG_EXP2,
-
- FOG_LAST = FOG_EXP2
- };
-
- enum TexGen
- {
- TEXGEN_PASSTHRU,
- TEXGEN_NORMAL,
- TEXGEN_POSITION,
- TEXGEN_REFLECTION,
- TEXGEN_SPHEREMAP,
-
- TEXGEN_LAST = TEXGEN_SPHEREMAP
- };
-
- enum TransparencyAntialiasing
- {
- TRANSPARENCY_NONE,
- TRANSPARENCY_ALPHA_TO_COVERAGE,
-
- TRANSPARENCY_LAST = TRANSPARENCY_ALPHA_TO_COVERAGE
- };
-
Context();
~Context();
@@ -288,9 +288,9 @@
bool setBlendOperation(BlendOperation blendOperation);
bool setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable);
- bool setSourceBlendFactorAlpha(Context::BlendFactor sourceBlendFactorAlpha);
- bool setDestBlendFactorAlpha(Context::BlendFactor destBlendFactorAlpha);
- bool setBlendOperationAlpha(Context::BlendOperation blendOperationAlpha);
+ bool setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha);
+ bool setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha);
+ bool setBlendOperationAlpha(BlendOperation blendOperationAlpha);
bool setColorWriteMask(int index, int colorWriteMask);
bool setWriteSRGB(bool sRGB);
@@ -298,7 +298,7 @@
// Active fixed-function pixel pipeline states
bool fogActive();
bool pointSizeActive();
- Context::FogMode pixelFogActive();
+ FogMode pixelFogActive();
bool depthWriteActive();
bool alphaTestActive();
bool depthBufferActive();
@@ -414,7 +414,7 @@
bool textureWrapActive;
unsigned char textureWrap[16];
- Context::TexGen texGen[8];
+ TexGen texGen[8];
bool localViewer;
bool normalizeNormals;
int textureTransformCount[8];
diff --git a/src/Renderer/PixelProcessor.cpp b/src/Renderer/PixelProcessor.cpp
index 0fbf0ea..5a45e48 100644
--- a/src/Renderer/PixelProcessor.cpp
+++ b/src/Renderer/PixelProcessor.cpp
@@ -24,7 +24,7 @@
namespace sw
{
extern bool complementaryDepthBuffer;
- extern Context::TransparencyAntialiasing transparencyAntialiasing;
+ extern TransparencyAntialiasing transparencyAntialiasing;
extern bool perspectiveCorrection;
bool precachePixel = false;
@@ -425,12 +425,12 @@
context->setDepthBufferEnable(depthBufferEnable);
}
- void PixelProcessor::setDepthCompare(Context::DepthCompareMode depthCompareMode)
+ void PixelProcessor::setDepthCompare(DepthCompareMode depthCompareMode)
{
context->depthCompareMode = depthCompareMode;
}
- void PixelProcessor::setAlphaCompare(Context::AlphaCompareMode alphaCompareMode)
+ void PixelProcessor::setAlphaCompare(AlphaCompareMode alphaCompareMode)
{
context->alphaCompareMode = alphaCompareMode;
}
@@ -445,7 +445,7 @@
context->alphaTestEnable = alphaTestEnable;
}
- void PixelProcessor::setCullMode(Context::CullMode cullMode)
+ void PixelProcessor::setCullMode(CullMode cullMode)
{
context->cullMode = cullMode;
}
@@ -460,7 +460,7 @@
context->stencilEnable = stencilEnable;
}
- void PixelProcessor::setStencilCompare(Context::StencilCompareMode stencilCompareMode)
+ void PixelProcessor::setStencilCompare(StencilCompareMode stencilCompareMode)
{
context->stencilCompareMode = stencilCompareMode;
}
@@ -489,17 +489,17 @@
stencilCCW.set(context->stencilReferenceCCW, stencilMaskCCW, context->stencilWriteMaskCCW);
}
- void PixelProcessor::setStencilFailOperation(Context::StencilOperation stencilFailOperation)
+ void PixelProcessor::setStencilFailOperation(StencilOperation stencilFailOperation)
{
context->stencilFailOperation = stencilFailOperation;
}
- void PixelProcessor::setStencilPassOperation(Context::StencilOperation stencilPassOperation)
+ void PixelProcessor::setStencilPassOperation(StencilOperation stencilPassOperation)
{
context->stencilPassOperation = stencilPassOperation;
}
- void PixelProcessor::setStencilZFailOperation(Context::StencilOperation stencilZFailOperation)
+ void PixelProcessor::setStencilZFailOperation(StencilOperation stencilZFailOperation)
{
context->stencilZFailOperation = stencilZFailOperation;
}
@@ -521,22 +521,22 @@
context->twoSidedStencil = enable;
}
- void PixelProcessor::setStencilCompareCCW(Context::StencilCompareMode stencilCompareMode)
+ void PixelProcessor::setStencilCompareCCW(StencilCompareMode stencilCompareMode)
{
context->stencilCompareModeCCW = stencilCompareMode;
}
- void PixelProcessor::setStencilFailOperationCCW(Context::StencilOperation stencilFailOperation)
+ void PixelProcessor::setStencilFailOperationCCW(StencilOperation stencilFailOperation)
{
context->stencilFailOperationCCW = stencilFailOperation;
}
- void PixelProcessor::setStencilPassOperationCCW(Context::StencilOperation stencilPassOperation)
+ void PixelProcessor::setStencilPassOperationCCW(StencilOperation stencilPassOperation)
{
context->stencilPassOperationCCW = stencilPassOperation;
}
- void PixelProcessor::setStencilZFailOperationCCW(Context::StencilOperation stencilZFailOperation)
+ void PixelProcessor::setStencilZFailOperationCCW(StencilOperation stencilZFailOperation)
{
context->stencilZFailOperationCCW = stencilZFailOperation;
}
@@ -665,12 +665,12 @@
factor.invBlendConstant4F[3][3] = 1 - blendConstant.a;
}
- void PixelProcessor::setFillMode(Context::FillMode fillMode)
+ void PixelProcessor::setFillMode(FillMode fillMode)
{
context->fillMode = fillMode;
}
- void PixelProcessor::setShadingMode(Context::ShadingMode shadingMode)
+ void PixelProcessor::setShadingMode(ShadingMode shadingMode)
{
context->shadingMode = shadingMode;
}
@@ -680,17 +680,17 @@
context->setAlphaBlendEnable(alphaBlendEnable);
}
- void PixelProcessor::setSourceBlendFactor(Context::BlendFactor sourceBlendFactor)
+ void PixelProcessor::setSourceBlendFactor(BlendFactor sourceBlendFactor)
{
context->setSourceBlendFactor(sourceBlendFactor);
}
- void PixelProcessor::setDestBlendFactor(Context::BlendFactor destBlendFactor)
+ void PixelProcessor::setDestBlendFactor(BlendFactor destBlendFactor)
{
context->setDestBlendFactor(destBlendFactor);
}
- void PixelProcessor::setBlendOperation(Context::BlendOperation blendOperation)
+ void PixelProcessor::setBlendOperation(BlendOperation blendOperation)
{
context->setBlendOperation(blendOperation);
}
@@ -700,17 +700,17 @@
context->setSeparateAlphaBlendEnable(separateAlphaBlendEnable);
}
- void PixelProcessor::setSourceBlendFactorAlpha(Context::BlendFactor sourceBlendFactorAlpha)
+ void PixelProcessor::setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha)
{
context->setSourceBlendFactorAlpha(sourceBlendFactorAlpha);
}
- void PixelProcessor::setDestBlendFactorAlpha(Context::BlendFactor destBlendFactorAlpha)
+ void PixelProcessor::setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha)
{
context->setDestBlendFactorAlpha(destBlendFactorAlpha);
}
- void PixelProcessor::setBlendOperationAlpha(Context::BlendOperation blendOperationAlpha)
+ void PixelProcessor::setBlendOperationAlpha(BlendOperation blendOperationAlpha)
{
context->setBlendOperationAlpha(blendOperationAlpha);
}
@@ -773,7 +773,7 @@
fog.densityE2 = replicate(fogDensity * 1.201122f); // 1/e^(x^2) = 2^(-(x*1.20)^2)
}
- void PixelProcessor::setPixelFogMode(Context::FogMode fogMode)
+ void PixelProcessor::setPixelFogMode(FogMode fogMode)
{
context->pixelFogMode = fogMode;
}
@@ -831,7 +831,7 @@
{
state.alphaCompareMode = context->alphaCompareMode;
- state.transparencyAntialiasing = context->getMultiSampleCount() > 1 ? transparencyAntialiasing : Context::TRANSPARENCY_NONE;
+ state.transparencyAntialiasing = context->getMultiSampleCount() > 1 ? transparencyAntialiasing : TRANSPARENCY_NONE;
}
state.depthWriteEnable = context->depthWriteActive();
@@ -870,7 +870,7 @@
state.fogActive = context->fogActive();
state.pixelFogMode = context->pixelFogActive();
- state.wBasedFog = context->wBasedFog && context->pixelFogActive() != Context::FOG_NONE;
+ state.wBasedFog = context->wBasedFog && context->pixelFogActive() != FOG_NONE;
state.perspective = context->perspectiveActive();
if(context->alphaBlendActive())
@@ -934,7 +934,7 @@
const bool point = context->isDrawPoint(true);
const bool sprite = context->pointSpriteActive();
- const bool flatShading = (context->shadingMode == Context::SHADING_FLAT) || point;
+ const bool flatShading = (context->shadingMode == SHADING_FLAT) || point;
if(context->pixelShaderVersion() < 0x0300)
{
diff --git a/src/Renderer/PixelProcessor.hpp b/src/Renderer/PixelProcessor.hpp
index df1876d..143a834 100644
--- a/src/Renderer/PixelProcessor.hpp
+++ b/src/Renderer/PixelProcessor.hpp
@@ -31,54 +31,54 @@
int shaderID;
- unsigned int depthOverride : 1;
- unsigned int shaderContainsKill : 1;
+ bool depthOverride : 1;
+ bool shaderContainsKill : 1;
- unsigned int depthCompareMode : BITS(Context::DEPTH_LAST);
- unsigned int alphaCompareMode : BITS(Context::ALPHA_LAST);
- unsigned int depthWriteEnable : 1;
- unsigned int quadLayoutDepthBuffer : 1;
+ DepthCompareMode depthCompareMode : BITS(DEPTH_LAST);
+ AlphaCompareMode alphaCompareMode : BITS(ALPHA_LAST);
+ bool depthWriteEnable : 1;
+ bool quadLayoutDepthBuffer : 1;
- unsigned int stencilActive : 1;
- unsigned int stencilCompareMode : BITS(Context::STENCIL_LAST);
- unsigned int stencilFailOperation : BITS(Context::OPERATION_LAST);
- unsigned int stencilPassOperation : BITS(Context::OPERATION_LAST);
- unsigned int stencilZFailOperation : BITS(Context::OPERATION_LAST);
- unsigned int noStencilMask : 1;
- unsigned int noStencilWriteMask : 1;
- unsigned int stencilWriteMasked : 1;
- unsigned int twoSidedStencil : 1;
- unsigned int stencilCompareModeCCW : BITS(Context::STENCIL_LAST);
- unsigned int stencilFailOperationCCW : BITS(Context::OPERATION_LAST);
- unsigned int stencilPassOperationCCW : BITS(Context::OPERATION_LAST);
- unsigned int stencilZFailOperationCCW : BITS(Context::OPERATION_LAST);
- unsigned int noStencilMaskCCW : 1;
- unsigned int noStencilWriteMaskCCW : 1;
- unsigned int stencilWriteMaskedCCW : 1;
+ bool stencilActive : 1;
+ StencilCompareMode stencilCompareMode : BITS(STENCIL_LAST);
+ StencilOperation stencilFailOperation : BITS(OPERATION_LAST);
+ StencilOperation stencilPassOperation : BITS(OPERATION_LAST);
+ StencilOperation stencilZFailOperation : BITS(OPERATION_LAST);
+ bool noStencilMask : 1;
+ bool noStencilWriteMask : 1;
+ bool stencilWriteMasked : 1;
+ bool twoSidedStencil : 1;
+ StencilCompareMode stencilCompareModeCCW : BITS(STENCIL_LAST);
+ StencilOperation stencilFailOperationCCW : BITS(OPERATION_LAST);
+ StencilOperation stencilPassOperationCCW : BITS(OPERATION_LAST);
+ StencilOperation stencilZFailOperationCCW : BITS(OPERATION_LAST);
+ bool noStencilMaskCCW : 1;
+ bool noStencilWriteMaskCCW : 1;
+ bool stencilWriteMaskedCCW : 1;
- unsigned int depthTestActive : 1;
- unsigned int fogActive : 1;
- unsigned int pixelFogMode : BITS(Context::FOG_LAST);
- unsigned int specularAdd : 1;
- unsigned int occlusionEnabled : 1;
- unsigned int wBasedFog : 1;
- unsigned int perspective : 1;
+ bool depthTestActive : 1;
+ bool fogActive : 1;
+ FogMode pixelFogMode : BITS(FOG_LAST);
+ bool specularAdd : 1;
+ bool occlusionEnabled : 1;
+ bool wBasedFog : 1;
+ bool perspective : 1;
- unsigned int alphaBlendActive : 1;
- unsigned int sourceBlendFactor : BITS(Context::BLEND_LAST);
- unsigned int destBlendFactor : BITS(Context::BLEND_LAST);
- unsigned int blendOperation : BITS(Context::BLENDOP_LAST);
- unsigned int sourceBlendFactorAlpha : BITS(Context::BLEND_LAST);
- unsigned int destBlendFactorAlpha : BITS(Context::BLEND_LAST);
- unsigned int blendOperationAlpha : BITS(Context::BLENDOP_LAST);
+ bool alphaBlendActive : 1;
+ BlendFactor sourceBlendFactor : BITS(BLEND_LAST);
+ BlendFactor destBlendFactor : BITS(BLEND_LAST);
+ BlendOperation blendOperation : BITS(BLENDOP_LAST);
+ BlendFactor sourceBlendFactorAlpha : BITS(BLEND_LAST);
+ BlendFactor destBlendFactorAlpha : BITS(BLEND_LAST);
+ BlendOperation blendOperationAlpha : BITS(BLENDOP_LAST);
- unsigned int colorWriteMask : 16; // (four times four component bit mask)
- unsigned char targetFormat[4];
- unsigned int writeSRGB : 1;
- unsigned int multiSample : 3;
- unsigned int multiSampleMask : 4;
- unsigned int transparencyAntialiasing : BITS(Context::TRANSPARENCY_LAST);
- unsigned int centroid : 1;
+ unsigned int colorWriteMask : 16; // (four times four component bit mask)
+ Format targetFormat[4];
+ bool writeSRGB : 1;
+ unsigned int multiSample : 3;
+ unsigned int multiSampleMask : 4;
+ TransparencyAntialiasing transparencyAntialiasing : BITS(TRANSPARENCY_LAST);
+ bool centroid : 1;
Sampler::State sampler[16];
TextureStage::State textureStage[8];
@@ -88,7 +88,7 @@
unsigned char component : 4;
unsigned char flat : 4;
unsigned char project : 2;
- unsigned char centroid : 1;
+ bool centroid : 1;
};
union
@@ -117,12 +117,12 @@
bool alphaTestActive() const
{
- return alphaCompareMode != Context::ALPHA_ALWAYS;
+ return alphaCompareMode != ALPHA_ALWAYS;
}
bool pixelFogActive() const
{
- return pixelFogMode != Context::FOG_NONE;
+ return pixelFogMode != FOG_NONE;
}
unsigned int hash;
@@ -225,45 +225,45 @@
virtual void setWriteSRGB(bool sRGB);
virtual void setDepthBufferEnable(bool depthBufferEnable);
- virtual void setDepthCompare(Context::DepthCompareMode depthCompareMode);
- virtual void setAlphaCompare(Context::AlphaCompareMode alphaCompareMode);
+ virtual void setDepthCompare(DepthCompareMode depthCompareMode);
+ virtual void setAlphaCompare(AlphaCompareMode alphaCompareMode);
virtual void setDepthWriteEnable(bool depthWriteEnable);
virtual void setAlphaTestEnable(bool alphaTestEnable);
- virtual void setCullMode(Context::CullMode cullMode);
+ virtual void setCullMode(CullMode cullMode);
virtual void setColorWriteMask(int index, int rgbaMask);
virtual void setStencilEnable(bool stencilEnable);
- virtual void setStencilCompare(Context::StencilCompareMode stencilCompareMode);
+ virtual void setStencilCompare(StencilCompareMode stencilCompareMode);
virtual void setStencilReference(int stencilReference);
virtual void setStencilMask(int stencilMask);
- virtual void setStencilFailOperation(Context::StencilOperation stencilFailOperation);
- virtual void setStencilPassOperation(Context::StencilOperation stencilPassOperation);
- virtual void setStencilZFailOperation(Context::StencilOperation stencilZFailOperation);
+ virtual void setStencilFailOperation(StencilOperation stencilFailOperation);
+ virtual void setStencilPassOperation(StencilOperation stencilPassOperation);
+ virtual void setStencilZFailOperation(StencilOperation stencilZFailOperation);
virtual void setStencilWriteMask(int stencilWriteMask);
virtual void setTwoSidedStencil(bool enable);
- virtual void setStencilCompareCCW(Context::StencilCompareMode stencilCompareMode);
+ virtual void setStencilCompareCCW(StencilCompareMode stencilCompareMode);
virtual void setStencilReferenceCCW(int stencilReference);
virtual void setStencilMaskCCW(int stencilMask);
- virtual void setStencilFailOperationCCW(Context::StencilOperation stencilFailOperation);
- virtual void setStencilPassOperationCCW(Context::StencilOperation stencilPassOperation);
- virtual void setStencilZFailOperationCCW(Context::StencilOperation stencilZFailOperation);
+ virtual void setStencilFailOperationCCW(StencilOperation stencilFailOperation);
+ virtual void setStencilPassOperationCCW(StencilOperation stencilPassOperation);
+ virtual void setStencilZFailOperationCCW(StencilOperation stencilZFailOperation);
virtual void setStencilWriteMaskCCW(int stencilWriteMask);
virtual void setTextureFactor(const Color<float> &textureFactor);
virtual void setBlendConstant(const Color<float> &blendConstant);
- virtual void setFillMode(Context::FillMode fillMode);
- virtual void setShadingMode(Context::ShadingMode shadingMode);
+ virtual void setFillMode(FillMode fillMode);
+ virtual void setShadingMode(ShadingMode shadingMode);
virtual void setAlphaBlendEnable(bool alphaBlendEnable);
- virtual void setSourceBlendFactor(Context::BlendFactor sourceBlendFactor);
- virtual void setDestBlendFactor(Context::BlendFactor destBlendFactor);
- virtual void setBlendOperation(Context::BlendOperation blendOperation);
+ virtual void setSourceBlendFactor(BlendFactor sourceBlendFactor);
+ virtual void setDestBlendFactor(BlendFactor destBlendFactor);
+ virtual void setBlendOperation(BlendOperation blendOperation);
virtual void setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable);
- virtual void setSourceBlendFactorAlpha(Context::BlendFactor sourceBlendFactorAlpha);
- virtual void setDestBlendFactorAlpha(Context::BlendFactor destBlendFactorAlpha);
- virtual void setBlendOperationAlpha(Context::BlendOperation blendOperationAlpha);
+ virtual void setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha);
+ virtual void setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha);
+ virtual void setBlendOperationAlpha(BlendOperation blendOperationAlpha);
virtual void setAlphaReference(int alphaReference);
@@ -273,7 +273,7 @@
virtual void setFogEnd(float end);
virtual void setFogColor(Color<float> fogColor);
virtual void setFogDensity(float fogDensity);
- virtual void setPixelFogMode(Context::FogMode fogMode);
+ virtual void setPixelFogMode(FogMode fogMode);
virtual void setPerspectiveCorrection(bool perspectiveCorrection);
diff --git a/src/Renderer/QuadRasterizer.cpp b/src/Renderer/QuadRasterizer.cpp
index a11cf18..d15c895 100644
--- a/src/Renderer/QuadRasterizer.cpp
+++ b/src/Renderer/QuadRasterizer.cpp
@@ -173,7 +173,7 @@
if(veryEarlyDepthTest && state.multiSample == 1)
{
- if(!state.stencilActive && state.depthTestActive && (state.depthCompareMode == Context::DEPTH_LESSEQUAL || state.depthCompareMode == Context::DEPTH_LESS)) // FIXME: Both modes ok?
+ if(!state.stencilActive && state.depthTestActive && (state.depthCompareMode == DEPTH_LESSEQUAL || state.depthCompareMode == DEPTH_LESS)) // FIXME: Both modes ok?
{
Float4 xxxx = Float4(Float(x0)) + *Pointer<Float4>(r.primitive + OFFSET(Primitive,xQuad), 16);
diff --git a/src/Renderer/Renderer.cpp b/src/Renderer/Renderer.cpp
index 41a3cbb..20038bd 100644
--- a/src/Renderer/Renderer.cpp
+++ b/src/Renderer/Renderer.cpp
@@ -51,7 +51,7 @@
extern bool complementaryDepthBuffer;
extern bool postBlendSRGB;
extern bool exactColorRounding;
- extern Context::TransparencyAntialiasing transparencyAntialiasing;
+ extern TransparencyAntialiasing transparencyAntialiasing;
extern bool forceClearRegisters;
extern bool precacheVertex;
@@ -191,7 +191,7 @@
blitter.blit(source, sRect, dest, dRect, filter);
}
- void Renderer::draw(Context::DrawType drawType, unsigned int indexOffset, unsigned int count, bool update)
+ void Renderer::draw(DrawType drawType, unsigned int indexOffset, unsigned int count, bool update)
{
#ifndef NDEBUG
if(count < minPrimitives || count > maxPrimitives)
@@ -237,14 +237,14 @@
{
switch(context->fillMode)
{
- case Context::FILL_SOLID:
+ case FILL_SOLID:
setupPrimitives = setupSolidTriangles;
break;
- case Context::FILL_WIREFRAME:
+ case FILL_WIREFRAME:
setupPrimitives = setupWireframeTriangle;
batch = 1;
break;
- case Context::FILL_VERTEX:
+ case FILL_VERTEX:
setupPrimitives = setupVertexTriangle;
batch = 1;
break;
@@ -440,7 +440,7 @@
data->factor = factor;
- if(pixelState.transparencyAntialiasing == Context::TRANSPARENCY_ALPHA_TO_COVERAGE)
+ if(pixelState.transparencyAntialiasing == TRANSPARENCY_ALPHA_TO_COVERAGE)
{
float ref = (float)context->alphaReference * (1.0f / 255.0f);
float margin = sw::min(ref, 1.0f - ref);
@@ -954,7 +954,7 @@
switch(draw->drawType)
{
- case Context::DRAW_POINTLIST:
+ case DRAW_POINTLIST:
{
unsigned int index = start;
@@ -968,7 +968,7 @@
}
}
break;
- case Context::DRAW_LINELIST:
+ case DRAW_LINELIST:
{
unsigned int index = 2 * start;
@@ -982,7 +982,7 @@
}
}
break;
- case Context::DRAW_LINESTRIP:
+ case DRAW_LINESTRIP:
{
unsigned int index = start;
@@ -996,7 +996,7 @@
}
}
break;
- case Context::DRAW_LINELOOP:
+ case DRAW_LINELOOP:
{
unsigned int index = start;
@@ -1010,7 +1010,7 @@
}
}
break;
- case Context::DRAW_TRIANGLELIST:
+ case DRAW_TRIANGLELIST:
{
unsigned int index = 3 * start;
@@ -1024,7 +1024,7 @@
}
}
break;
- case Context::DRAW_TRIANGLESTRIP:
+ case DRAW_TRIANGLESTRIP:
{
unsigned int index = start;
@@ -1038,7 +1038,7 @@
}
}
break;
- case Context::DRAW_TRIANGLEFAN:
+ case DRAW_TRIANGLEFAN:
{
unsigned int index = start;
@@ -1052,7 +1052,7 @@
}
}
break;
- case Context::DRAW_INDEXEDPOINTLIST8:
+ case DRAW_INDEXEDPOINTLIST8:
{
const unsigned char *index = (const unsigned char*)indices + start;
@@ -1066,7 +1066,7 @@
}
}
break;
- case Context::DRAW_INDEXEDPOINTLIST16:
+ case DRAW_INDEXEDPOINTLIST16:
{
const unsigned short *index = (const unsigned short*)indices + start;
@@ -1080,7 +1080,7 @@
}
}
break;
- case Context::DRAW_INDEXEDPOINTLIST32:
+ case DRAW_INDEXEDPOINTLIST32:
{
const unsigned int *index = (const unsigned int*)indices + start;
@@ -1094,7 +1094,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINELIST8:
+ case DRAW_INDEXEDLINELIST8:
{
const unsigned char *index = (const unsigned char*)indices + 2 * start;
@@ -1108,7 +1108,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINELIST16:
+ case DRAW_INDEXEDLINELIST16:
{
const unsigned short *index = (const unsigned short*)indices + 2 * start;
@@ -1122,7 +1122,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINELIST32:
+ case DRAW_INDEXEDLINELIST32:
{
const unsigned int *index = (const unsigned int*)indices + 2 * start;
@@ -1136,7 +1136,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINESTRIP8:
+ case DRAW_INDEXEDLINESTRIP8:
{
const unsigned char *index = (const unsigned char*)indices + start;
@@ -1150,7 +1150,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINESTRIP16:
+ case DRAW_INDEXEDLINESTRIP16:
{
const unsigned short *index = (const unsigned short*)indices + start;
@@ -1164,7 +1164,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINESTRIP32:
+ case DRAW_INDEXEDLINESTRIP32:
{
const unsigned int *index = (const unsigned int*)indices + start;
@@ -1178,7 +1178,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINELOOP8:
+ case DRAW_INDEXEDLINELOOP8:
{
const unsigned char *index = (const unsigned char*)indices;
@@ -1190,7 +1190,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINELOOP16:
+ case DRAW_INDEXEDLINELOOP16:
{
const unsigned short *index = (const unsigned short*)indices;
@@ -1202,7 +1202,7 @@
}
}
break;
- case Context::DRAW_INDEXEDLINELOOP32:
+ case DRAW_INDEXEDLINELOOP32:
{
const unsigned int *index = (const unsigned int*)indices;
@@ -1214,7 +1214,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLELIST8:
+ case DRAW_INDEXEDTRIANGLELIST8:
{
const unsigned char *index = (const unsigned char*)indices + 3 * start;
@@ -1228,7 +1228,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLELIST16:
+ case DRAW_INDEXEDTRIANGLELIST16:
{
const unsigned short *index = (const unsigned short*)indices + 3 * start;
@@ -1242,7 +1242,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLELIST32:
+ case DRAW_INDEXEDTRIANGLELIST32:
{
const unsigned int *index = (const unsigned int*)indices + 3 * start;
@@ -1256,7 +1256,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLESTRIP8:
+ case DRAW_INDEXEDTRIANGLESTRIP8:
{
const unsigned char *index = (const unsigned char*)indices + start;
@@ -1270,7 +1270,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLESTRIP16:
+ case DRAW_INDEXEDTRIANGLESTRIP16:
{
const unsigned short *index = (const unsigned short*)indices + start;
@@ -1284,7 +1284,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLESTRIP32:
+ case DRAW_INDEXEDTRIANGLESTRIP32:
{
const unsigned int *index = (const unsigned int*)indices + start;
@@ -1298,7 +1298,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLEFAN8:
+ case DRAW_INDEXEDTRIANGLEFAN8:
{
const unsigned char *index = (const unsigned char*)indices;
@@ -1310,7 +1310,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLEFAN16:
+ case DRAW_INDEXEDTRIANGLEFAN16:
{
const unsigned short *index = (const unsigned short*)indices;
@@ -1322,7 +1322,7 @@
}
}
break;
- case Context::DRAW_INDEXEDTRIANGLEFAN32:
+ case DRAW_INDEXEDTRIANGLEFAN32:
{
const unsigned int *index = (const unsigned int*)indices;
@@ -1403,11 +1403,11 @@
float d = (v0.y * v1.x - v0.x * v1.y) * v2.w + (v0.x * v2.y - v0.y * v2.x) * v1.w + (v2.x * v1.y - v1.x * v2.y) * v0.w;
- if(state.cullMode == Context::CULL_CLOCKWISE)
+ if(state.cullMode == CULL_CLOCKWISE)
{
if(d >= 0) return 0;
}
- else if(state.cullMode == Context::CULL_COUNTERCLOCKWISE)
+ else if(state.cullMode == CULL_COUNTERCLOCKWISE)
{
if(d <= 0) return 0;
}
@@ -1460,11 +1460,11 @@
float d = (v0.y * v1.x - v0.x * v1.y) * v2.w + (v0.x * v2.y - v0.y * v2.x) * v1.w + (v2.x * v1.y - v1.x * v2.y) * v0.w;
- if(state.cullMode == Context::CULL_CLOCKWISE)
+ if(state.cullMode == CULL_CLOCKWISE)
{
if(d >= 0) return 0;
}
- else if(state.cullMode == Context::CULL_COUNTERCLOCKWISE)
+ else if(state.cullMode == CULL_COUNTERCLOCKWISE)
{
if(d <= 0) return 0;
}
@@ -1997,7 +1997,7 @@
context->sampleMask = mask;
}
- void Renderer::setTransparencyAntialiasing(Context::TransparencyAntialiasing transparencyAntialiasing)
+ void Renderer::setTransparencyAntialiasing(TransparencyAntialiasing transparencyAntialiasing)
{
sw::transparencyAntialiasing = transparencyAntialiasing;
}
@@ -2488,9 +2488,9 @@
switch(configuration.transparencyAntialiasing)
{
- case 0: transparencyAntialiasing = Context::TRANSPARENCY_NONE; break;
- case 1: transparencyAntialiasing = Context::TRANSPARENCY_ALPHA_TO_COVERAGE; break;
- default: transparencyAntialiasing = Context::TRANSPARENCY_NONE; break;
+ case 0: transparencyAntialiasing = TRANSPARENCY_NONE; break;
+ case 1: transparencyAntialiasing = TRANSPARENCY_ALPHA_TO_COVERAGE; break;
+ default: transparencyAntialiasing = TRANSPARENCY_NONE; break;
}
switch(configuration.threadCount)
diff --git a/src/Renderer/Renderer.hpp b/src/Renderer/Renderer.hpp
index 3756a47..3a867a4 100644
--- a/src/Renderer/Renderer.hpp
+++ b/src/Renderer/Renderer.hpp
@@ -165,7 +165,7 @@
~DrawCall();
- Context::DrawType drawType;
+ DrawType drawType;
int batchSize;
Routine *vertexRoutine;
@@ -270,12 +270,12 @@
virtual ~Renderer();
virtual void blit(Surface *source, const Rect &sRect, Surface *dest, const Rect &dRect, bool filter);
- virtual void draw(Context::DrawType drawType, unsigned int indexOffset, unsigned int count, bool update = true);
+ virtual void draw(DrawType drawType, unsigned int indexOffset, unsigned int count, bool update = true);
virtual void setIndexBuffer(Resource *indexBuffer);
virtual void setMultiSampleMask(unsigned int mask);
- virtual void setTransparencyAntialiasing(Context::TransparencyAntialiasing transparencyAntialiasing);
+ virtual void setTransparencyAntialiasing(TransparencyAntialiasing transparencyAntialiasing);
virtual void setTextureResource(unsigned int sampler, Resource *resource);
virtual void setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type);
diff --git a/src/Renderer/Sampler.hpp b/src/Renderer/Sampler.hpp
index 2132a06..180a4b8 100644
--- a/src/Renderer/Sampler.hpp
+++ b/src/Renderer/Sampler.hpp
@@ -72,7 +72,7 @@
SAMPLER_VERTEX
};
- enum TextureType
+ enum TextureType : unsigned int
{
TEXTURE_NULL,
TEXTURE_2D,
@@ -82,7 +82,7 @@
TEXTURE_LAST = TEXTURE_3D
};
- enum FilterType
+ enum FilterType : unsigned int
{
FILTER_POINT,
FILTER_GATHER,
@@ -92,7 +92,7 @@
FILTER_LAST = FILTER_ANISOTROPIC
};
- enum MipmapType
+ enum MipmapType : unsigned int
{
MIPMAP_NONE,
MIPMAP_POINT,
@@ -101,7 +101,7 @@
MIPMAP_LAST = MIPMAP_LINEAR
};
- enum AddressingMode
+ enum AddressingMode : unsigned int
{
ADDRESSING_WRAP,
ADDRESSING_CLAMP,
@@ -119,18 +119,18 @@
{
State();
- unsigned int textureType : BITS(TEXTURE_LAST);
- unsigned int textureFormat : BITS(FORMAT_LAST);
- unsigned int textureFilter : BITS(FILTER_LAST);
- unsigned int addressingModeU : BITS(ADDRESSING_LAST);
- unsigned int addressingModeV : BITS(ADDRESSING_LAST);
- unsigned int addressingModeW : BITS(ADDRESSING_LAST);
- unsigned int mipmapFilter : BITS(FILTER_LAST);
- unsigned int hasNPOTTexture : 1;
- unsigned int sRGB : 1;
+ TextureType textureType : BITS(TEXTURE_LAST);
+ Format textureFormat : BITS(FORMAT_LAST);
+ FilterType textureFilter : BITS(FILTER_LAST);
+ AddressingMode addressingModeU : BITS(ADDRESSING_LAST);
+ AddressingMode addressingModeV : BITS(ADDRESSING_LAST);
+ AddressingMode addressingModeW : BITS(ADDRESSING_LAST);
+ MipmapType mipmapFilter : BITS(FILTER_LAST);
+ bool hasNPOTTexture : 1;
+ bool sRGB : 1;
#if PERF_PROFILE
- bool compressedFormat : 1;
+ bool compressedFormat : 1;
#endif
};
diff --git a/src/Renderer/SetupProcessor.cpp b/src/Renderer/SetupProcessor.cpp
index 65bc334..b673dd7 100644
--- a/src/Renderer/SetupProcessor.cpp
+++ b/src/Renderer/SetupProcessor.cpp
@@ -76,7 +76,7 @@
state.isDrawLine = context->isDrawLine(true);
state.isDrawTriangle = context->isDrawTriangle(false);
state.isDrawSolidTriangle = context->isDrawTriangle(true);
- state.interpolateZ = context->depthBufferActive() || context->pixelFogActive() != Context::FOG_NONE || vPosZW;
+ state.interpolateZ = context->depthBufferActive() || context->pixelFogActive() != FOG_NONE || vPosZW;
state.interpolateW = context->perspectiveActive() || vPosZW;
state.perspective = context->perspectiveActive();
state.pointSprite = context->pointSpriteActive();
@@ -114,7 +114,7 @@
const bool point = context->isDrawPoint(true);
const bool sprite = context->pointSpriteActive();
- const bool flatShading = (context->shadingMode == Context::SHADING_FLAT) || point;
+ const bool flatShading = (context->shadingMode == SHADING_FLAT) || point;
if(context->vertexShader && context->pixelShader)
{
diff --git a/src/Renderer/SetupProcessor.hpp b/src/Renderer/SetupProcessor.hpp
index 1e57940..8220686 100644
--- a/src/Renderer/SetupProcessor.hpp
+++ b/src/Renderer/SetupProcessor.hpp
@@ -34,27 +34,27 @@
{
unsigned int computeHash();
- unsigned int isDrawPoint : 1;
- unsigned int isDrawLine : 1;
- unsigned int isDrawTriangle : 1;
- unsigned int isDrawSolidTriangle : 1;
- unsigned int interpolateZ : 1;
- unsigned int interpolateW : 1;
- unsigned int perspective : 1;
- unsigned int pointSprite : 1;
- unsigned int positionRegister : 4;
- unsigned int pointSizeRegister : 4;
- unsigned int cullMode : BITS(Context::CULL_LAST);
- unsigned int twoSidedStencil : 1;
- unsigned int slopeDepthBias : 1;
- unsigned int vFace : 1;
- unsigned int multiSample : 3; // 1, 2 or 4
+ bool isDrawPoint : 1;
+ bool isDrawLine : 1;
+ bool isDrawTriangle : 1;
+ bool isDrawSolidTriangle : 1;
+ bool interpolateZ : 1;
+ bool interpolateW : 1;
+ bool perspective : 1;
+ bool pointSprite : 1;
+ unsigned int positionRegister : 4;
+ unsigned int pointSizeRegister : 4;
+ CullMode cullMode : BITS(CULL_LAST);
+ bool twoSidedStencil : 1;
+ bool slopeDepthBias : 1;
+ bool vFace : 1;
+ unsigned int multiSample : 3; // 1, 2 or 4
struct Gradient
{
unsigned char attribute : 6;
- unsigned char flat : 1;
- unsigned char wrap : 1;
+ bool flat : 1;
+ bool wrap : 1;
};
union
diff --git a/src/Renderer/Stream.hpp b/src/Renderer/Stream.hpp
index 66ba633..5bf9862 100644
--- a/src/Renderer/Stream.hpp
+++ b/src/Renderer/Stream.hpp
@@ -18,7 +18,7 @@
{
class Resource;
- enum StreamType
+ enum StreamType : unsigned int
{
STREAMTYPE_COLOR, // 4 normalized unsigned bytes, ZYXW order
STREAMTYPE_UDEC3, // 3 unsigned 10-bit fields
diff --git a/src/Renderer/Surface.hpp b/src/Renderer/Surface.hpp
index 130bd0b..8ed6351 100644
--- a/src/Renderer/Surface.hpp
+++ b/src/Renderer/Surface.hpp
@@ -30,7 +30,7 @@
int y1; // Exclusive
};
- enum Format
+ enum Format : unsigned char
{
FORMAT_NULL,
diff --git a/src/Renderer/VertexProcessor.cpp b/src/Renderer/VertexProcessor.cpp
index ce8feda..dec0e9c 100644
--- a/src/Renderer/VertexProcessor.cpp
+++ b/src/Renderer/VertexProcessor.cpp
@@ -292,7 +292,7 @@
context->fogEnable = fogEnable;
}
- void VertexProcessor::setVertexFogMode(Context::FogMode fogMode)
+ void VertexProcessor::setVertexFogMode(FogMode fogMode)
{
context->vertexFogMode = fogMode;
}
@@ -302,22 +302,22 @@
context->setColorVertexEnable(colorVertexEnable);
}
- void VertexProcessor::setDiffuseMaterialSource(Context::MaterialSource diffuseMaterialSource)
+ void VertexProcessor::setDiffuseMaterialSource(MaterialSource diffuseMaterialSource)
{
context->setDiffuseMaterialSource(diffuseMaterialSource);
}
- void VertexProcessor::setSpecularMaterialSource(Context::MaterialSource specularMaterialSource)
+ void VertexProcessor::setSpecularMaterialSource(MaterialSource specularMaterialSource)
{
context->setSpecularMaterialSource(specularMaterialSource);
}
- void VertexProcessor::setAmbientMaterialSource(Context::MaterialSource ambientMaterialSource)
+ void VertexProcessor::setAmbientMaterialSource(MaterialSource ambientMaterialSource)
{
context->setAmbientMaterialSource(ambientMaterialSource);
}
- void VertexProcessor::setEmissiveMaterialSource(Context::MaterialSource emissiveMaterialSource)
+ void VertexProcessor::setEmissiveMaterialSource(MaterialSource emissiveMaterialSource)
{
context->setEmissiveMaterialSource(emissiveMaterialSource);
}
@@ -414,7 +414,7 @@
}
}
- void VertexProcessor::setTexGen(unsigned int stage, Context::TexGen texGen)
+ void VertexProcessor::setTexGen(unsigned int stage, TexGen texGen)
{
if(stage < 8)
{
diff --git a/src/Renderer/VertexProcessor.hpp b/src/Renderer/VertexProcessor.hpp
index 3def5ba..5f30f1a 100644
--- a/src/Renderer/VertexProcessor.hpp
+++ b/src/Renderer/VertexProcessor.hpp
@@ -45,40 +45,40 @@
uint64_t shaderID;
- unsigned int fixedFunction : 1;
- unsigned int shaderContainsTexldl : 1;
- unsigned int positionRegister : 4;
- unsigned int pointSizeRegister : 4; // 0xF signifies no vertex point size
+ bool fixedFunction : 1;
+ bool shaderContainsTexldl : 1;
+ unsigned int positionRegister : 4;
+ unsigned int pointSizeRegister : 4; // 0xF signifies no vertex point size
- unsigned int vertexBlendMatrixCount : 3;
- unsigned int indexedVertexBlendEnable : 1;
- unsigned int vertexNormalActive : 1;
- unsigned int normalizeNormals : 1;
- unsigned int vertexLightingActive : 1;
- unsigned int diffuseActive : 1;
- unsigned int specularActive : 1;
- unsigned int vertexSpecularActive : 1;
- unsigned int vertexLightActive : 8;
- unsigned int vertexDiffuseMaterialSourceActive : BITS(Context::MATERIAL_LAST);
- unsigned int vertexSpecularMaterialSourceActive : BITS(Context::MATERIAL_LAST);
- unsigned int vertexAmbientMaterialSourceActive : BITS(Context::MATERIAL_LAST);
- unsigned int vertexEmissiveMaterialSourceActive : BITS(Context::MATERIAL_LAST);
- unsigned int fogActive : 1;
- unsigned int vertexFogMode : BITS(Context::FOG_LAST);
- unsigned int rangeFogActive : 1;
- unsigned int localViewerActive : 1;
- unsigned int pointSizeActive : 1;
- unsigned int pointScaleActive : 1;
+ unsigned int vertexBlendMatrixCount : 3;
+ bool indexedVertexBlendEnable : 1;
+ bool vertexNormalActive : 1;
+ bool normalizeNormals : 1;
+ bool vertexLightingActive : 1;
+ bool diffuseActive : 1;
+ bool specularActive : 1;
+ bool vertexSpecularActive : 1;
+ unsigned int vertexLightActive : 8;
+ MaterialSource vertexDiffuseMaterialSourceActive : BITS(MATERIAL_LAST);
+ MaterialSource vertexSpecularMaterialSourceActive : BITS(MATERIAL_LAST);
+ MaterialSource vertexAmbientMaterialSourceActive : BITS(MATERIAL_LAST);
+ MaterialSource vertexEmissiveMaterialSourceActive : BITS(MATERIAL_LAST);
+ bool fogActive : 1;
+ FogMode vertexFogMode : BITS(FOG_LAST);
+ bool rangeFogActive : 1;
+ bool localViewerActive : 1;
+ bool pointSizeActive : 1;
+ bool pointScaleActive : 1;
- unsigned int preTransformed : 1;
- unsigned int superSampling : 1;
- unsigned int multiSampling : 1;
+ bool preTransformed : 1;
+ bool superSampling : 1;
+ bool multiSampling : 1;
struct TextureState
{
- unsigned char texGenActive : BITS(Context::TEXGEN_LAST);
+ TexGen texGenActive : BITS(TEXGEN_LAST);
unsigned char textureTransformCountActive : 3;
- unsigned char texCoordIndexActive : 3;
+ unsigned char texCoordIndexActive : 3;
};
TextureState textureState[8];
@@ -92,9 +92,9 @@
return count != 0;
}
- unsigned int type : BITS(STREAMTYPE_LAST);
- unsigned int count : 3;
- unsigned int normalized : 1;
+ StreamType type : BITS(STREAMTYPE_LAST);
+ unsigned int count : 3;
+ bool normalized : 1;
};
struct Output
@@ -206,14 +206,14 @@
virtual void setLightRange(unsigned int light, float lightRange);
virtual void setFogEnable(bool fogEnable);
- virtual void setVertexFogMode(Context::FogMode fogMode);
+ virtual void setVertexFogMode(FogMode fogMode);
virtual void setRangeFogEnable(bool enable);
virtual void setColorVertexEnable(bool colorVertexEnable);
- virtual void setDiffuseMaterialSource(Context::MaterialSource diffuseMaterialSource);
- virtual void setSpecularMaterialSource(Context::MaterialSource specularMaterialSource);
- virtual void setAmbientMaterialSource(Context::MaterialSource ambientMaterialSource);
- virtual void setEmissiveMaterialSource(Context::MaterialSource emissiveMaterialSource);
+ virtual void setDiffuseMaterialSource(MaterialSource diffuseMaterialSource);
+ virtual void setSpecularMaterialSource(MaterialSource specularMaterialSource);
+ virtual void setAmbientMaterialSource(MaterialSource ambientMaterialSource);
+ virtual void setEmissiveMaterialSource(MaterialSource emissiveMaterialSource);
virtual void setMaterialEmission(const Color<float> &emission);
virtual void setMaterialAmbient(const Color<float> &materialAmbient);
@@ -225,7 +225,7 @@
virtual void setVertexBlendMatrixCount(unsigned int vertexBlendMatrixCount);
virtual void setTextureWrap(unsigned int stage, int mask);
- virtual void setTexGen(unsigned int stage, Context::TexGen texGen);
+ virtual void setTexGen(unsigned int stage, TexGen texGen);
virtual void setLocalViewer(bool localViewer);
virtual void setNormalizeNormals(bool normalizeNormals);
virtual void setTextureMatrix(int stage, const Matrix &T);