Commit a0f4be85 by Nicolas Capens Committed by Nicolas Capens

Use unsigned enum base types to use them as state bitfields.

BUG=17878699 Change-Id: Ib112ddf399ebd22676a775cdb6e6927e8f8ce25f Reviewed-on: https://swiftshader-review.googlesource.com/1202Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 77278999
...@@ -1725,7 +1725,7 @@ void Context::applyState(GLenum drawMode) ...@@ -1725,7 +1725,7 @@ void Context::applyState(GLenum drawMode)
} }
else else
{ {
device->setCullMode(sw::Context::CULL_NONE); device->setCullMode(sw::CULL_NONE);
} }
if(mDepthStateDirty) if(mDepthStateDirty)
...@@ -1874,11 +1874,11 @@ void Context::applyState(GLenum drawMode) ...@@ -1874,11 +1874,11 @@ void Context::applyState(GLenum drawMode)
{ {
if(mState.sampleAlphaToCoverage) if(mState.sampleAlphaToCoverage)
{ {
device->setTransparencyAntialiasing(sw::Context::TRANSPARENCY_ALPHA_TO_COVERAGE); device->setTransparencyAntialiasing(sw::TRANSPARENCY_ALPHA_TO_COVERAGE);
} }
else else
{ {
device->setTransparencyAntialiasing(sw::Context::TRANSPARENCY_NONE); device->setTransparencyAntialiasing(sw::TRANSPARENCY_NONE);
} }
if(mState.sampleCoverage) if(mState.sampleCoverage)
......
...@@ -37,48 +37,48 @@ namespace gl ...@@ -37,48 +37,48 @@ namespace gl
renderTarget = 0; renderTarget = 0;
setDepthBufferEnable(true); setDepthBufferEnable(true);
setFillMode(Context::FILL_SOLID); setFillMode(FILL_SOLID);
setShadingMode(Context::SHADING_GOURAUD); setShadingMode(SHADING_GOURAUD);
setDepthWriteEnable(true); setDepthWriteEnable(true);
setAlphaTestEnable(false); setAlphaTestEnable(false);
setSourceBlendFactor(Context::BLEND_ONE); setSourceBlendFactor(BLEND_ONE);
setDestBlendFactor(Context::BLEND_ZERO); setDestBlendFactor(BLEND_ZERO);
setCullMode(Context::CULL_COUNTERCLOCKWISE); setCullMode(CULL_COUNTERCLOCKWISE);
setDepthCompare(Context::DEPTH_LESSEQUAL); setDepthCompare(DEPTH_LESSEQUAL);
setAlphaReference(0); setAlphaReference(0);
setAlphaCompare(Context::ALPHA_ALWAYS); setAlphaCompare(ALPHA_ALWAYS);
setAlphaBlendEnable(false); setAlphaBlendEnable(false);
setFogEnable(false); setFogEnable(false);
setSpecularEnable(false); setSpecularEnable(false);
setFogColor(0); setFogColor(0);
setPixelFogMode(Context::FOG_NONE); setPixelFogMode(FOG_NONE);
setFogStart(0.0f); setFogStart(0.0f);
setFogEnd(1.0f); setFogEnd(1.0f);
setFogDensity(1.0f); setFogDensity(1.0f);
setRangeFogEnable(false); setRangeFogEnable(false);
setStencilEnable(false); setStencilEnable(false);
setStencilFailOperation(Context::OPERATION_KEEP); setStencilFailOperation(OPERATION_KEEP);
setStencilZFailOperation(Context::OPERATION_KEEP); setStencilZFailOperation(OPERATION_KEEP);
setStencilPassOperation(Context::OPERATION_KEEP); setStencilPassOperation(OPERATION_KEEP);
setStencilCompare(Context::STENCIL_ALWAYS); setStencilCompare(STENCIL_ALWAYS);
setStencilReference(0); setStencilReference(0);
setStencilMask(0xFFFFFFFF); setStencilMask(0xFFFFFFFF);
setStencilWriteMask(0xFFFFFFFF); setStencilWriteMask(0xFFFFFFFF);
setVertexFogMode(Context::FOG_NONE); setVertexFogMode(FOG_NONE);
setClipFlags(0); setClipFlags(0);
setPointSize(1.0f); setPointSize(1.0f);
setPointSizeMin(0.125f); setPointSizeMin(0.125f);
setPointSpriteEnable(false); setPointSpriteEnable(false);
setPointSizeMax(8192.0f); setPointSizeMax(8192.0f);
setColorWriteMask(0, 0x0000000F); setColorWriteMask(0, 0x0000000F);
setBlendOperation(Context::BLENDOP_ADD); setBlendOperation(BLENDOP_ADD);
scissorEnable = false; scissorEnable = false;
setSlopeDepthBias(0.0f); setSlopeDepthBias(0.0f);
setTwoSidedStencil(false); setTwoSidedStencil(false);
setStencilFailOperationCCW(Context::OPERATION_KEEP); setStencilFailOperationCCW(OPERATION_KEEP);
setStencilZFailOperationCCW(Context::OPERATION_KEEP); setStencilZFailOperationCCW(OPERATION_KEEP);
setStencilPassOperationCCW(Context::OPERATION_KEEP); setStencilPassOperationCCW(OPERATION_KEEP);
setStencilCompareCCW(Context::STENCIL_ALWAYS); setStencilCompareCCW(STENCIL_ALWAYS);
setColorWriteMask(1, 0x0000000F); setColorWriteMask(1, 0x0000000F);
setColorWriteMask(2, 0x0000000F); setColorWriteMask(2, 0x0000000F);
setColorWriteMask(3, 0x0000000F); setColorWriteMask(3, 0x0000000F);
...@@ -86,9 +86,9 @@ namespace gl ...@@ -86,9 +86,9 @@ namespace gl
setWriteSRGB(false); setWriteSRGB(false);
setDepthBias(0.0f); setDepthBias(0.0f);
setSeparateAlphaBlendEnable(false); setSeparateAlphaBlendEnable(false);
setSourceBlendFactorAlpha(Context::BLEND_ONE); setSourceBlendFactorAlpha(BLEND_ONE);
setDestBlendFactorAlpha(Context::BLEND_ZERO); setDestBlendFactorAlpha(BLEND_ZERO);
setBlendOperationAlpha(Context::BLENDOP_ADD); setBlendOperationAlpha(BLENDOP_ADD);
for(int i = 0; i < 16; i++) for(int i = 0; i < 16; i++)
{ {
...@@ -313,19 +313,19 @@ namespace gl ...@@ -313,19 +313,19 @@ namespace gl
return; return;
} }
Context::DrawType drawType; DrawType drawType;
if(indexSize == 4) if(indexSize == 4)
{ {
switch(type) switch(type)
{ {
case DRAW_POINTLIST: drawType = Context::DRAW_INDEXEDPOINTLIST32; break; case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST32; break;
case DRAW_LINELIST: drawType = Context::DRAW_INDEXEDLINELIST32; break; case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST32; break;
case DRAW_LINESTRIP: drawType = Context::DRAW_INDEXEDLINESTRIP32; break; case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP32; break;
case DRAW_LINELOOP: drawType = Context::DRAW_INDEXEDLINELOOP32; break; case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP32; break;
case DRAW_TRIANGLELIST: drawType = Context::DRAW_INDEXEDTRIANGLELIST32; break; case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST32; break;
case DRAW_TRIANGLESTRIP: drawType = Context::DRAW_INDEXEDTRIANGLESTRIP32; break; case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP32; break;
case DRAW_TRIANGLEFAN: drawType = Context::DRAW_INDEXEDTRIANGLEFAN32; break; case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN32; break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
...@@ -333,13 +333,13 @@ namespace gl ...@@ -333,13 +333,13 @@ namespace gl
{ {
switch(type) switch(type)
{ {
case DRAW_POINTLIST: drawType = Context::DRAW_INDEXEDPOINTLIST16; break; case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST16; break;
case DRAW_LINELIST: drawType = Context::DRAW_INDEXEDLINELIST16; break; case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST16; break;
case DRAW_LINESTRIP: drawType = Context::DRAW_INDEXEDLINESTRIP16; break; case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP16; break;
case DRAW_LINELOOP: drawType = Context::DRAW_INDEXEDLINELOOP16; break; case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP16; break;
case DRAW_TRIANGLELIST: drawType = Context::DRAW_INDEXEDTRIANGLELIST16; break; case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST16; break;
case DRAW_TRIANGLESTRIP: drawType = Context::DRAW_INDEXEDTRIANGLESTRIP16; break; case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP16; break;
case DRAW_TRIANGLEFAN: drawType = Context::DRAW_INDEXEDTRIANGLEFAN16; break; case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN16; break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
...@@ -347,13 +347,13 @@ namespace gl ...@@ -347,13 +347,13 @@ namespace gl
{ {
switch(type) switch(type)
{ {
case DRAW_POINTLIST: drawType = Context::DRAW_INDEXEDPOINTLIST8; break; case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST8; break;
case DRAW_LINELIST: drawType = Context::DRAW_INDEXEDLINELIST8; break; case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST8; break;
case DRAW_LINESTRIP: drawType = Context::DRAW_INDEXEDLINESTRIP8; break; case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP8; break;
case DRAW_LINELOOP: drawType = Context::DRAW_INDEXEDLINELOOP8; break; case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP8; break;
case DRAW_TRIANGLELIST: drawType = Context::DRAW_INDEXEDTRIANGLELIST8; break; case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST8; break;
case DRAW_TRIANGLESTRIP: drawType = Context::DRAW_INDEXEDTRIANGLESTRIP8; break; case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP8; break;
case DRAW_TRIANGLEFAN: drawType = Context::DRAW_INDEXEDTRIANGLEFAN8; break; case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN8; break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
...@@ -373,17 +373,17 @@ namespace gl ...@@ -373,17 +373,17 @@ namespace gl
setIndexBuffer(0); setIndexBuffer(0);
Context::DrawType drawType; DrawType drawType;
switch(primitiveType) switch(primitiveType)
{ {
case DRAW_POINTLIST: drawType = Context::DRAW_POINTLIST; break; case DRAW_POINTLIST: drawType = sw::DRAW_POINTLIST; break;
case DRAW_LINELIST: drawType = Context::DRAW_LINELIST; break; case DRAW_LINELIST: drawType = sw::DRAW_LINELIST; break;
case DRAW_LINESTRIP: drawType = Context::DRAW_LINESTRIP; break; case DRAW_LINESTRIP: drawType = sw::DRAW_LINESTRIP; break;
case DRAW_LINELOOP: drawType = Context::DRAW_LINELOOP; break; case DRAW_LINELOOP: drawType = sw::DRAW_LINELOOP; break;
case DRAW_TRIANGLELIST: drawType = Context::DRAW_TRIANGLELIST; break; case DRAW_TRIANGLELIST: drawType = sw::DRAW_TRIANGLELIST; break;
case DRAW_TRIANGLESTRIP: drawType = Context::DRAW_TRIANGLESTRIP; break; case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_TRIANGLESTRIP; break;
case DRAW_TRIANGLEFAN: drawType = Context::DRAW_TRIANGLEFAN; break; case DRAW_TRIANGLEFAN: drawType = sw::DRAW_TRIANGLEFAN; break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
......
...@@ -442,40 +442,40 @@ namespace gl ...@@ -442,40 +442,40 @@ namespace gl
namespace es2sw namespace es2sw
{ {
sw::Context::DepthCompareMode ConvertDepthComparison(GLenum comparison) sw::DepthCompareMode ConvertDepthComparison(GLenum comparison)
{ {
switch(comparison) switch(comparison)
{ {
case GL_NEVER: return sw::Context::DEPTH_NEVER; case GL_NEVER: return sw::DEPTH_NEVER;
case GL_ALWAYS: return sw::Context::DEPTH_ALWAYS; case GL_ALWAYS: return sw::DEPTH_ALWAYS;
case GL_LESS: return sw::Context::DEPTH_LESS; case GL_LESS: return sw::DEPTH_LESS;
case GL_LEQUAL: return sw::Context::DEPTH_LESSEQUAL; case GL_LEQUAL: return sw::DEPTH_LESSEQUAL;
case GL_EQUAL: return sw::Context::DEPTH_EQUAL; case GL_EQUAL: return sw::DEPTH_EQUAL;
case GL_GREATER: return sw::Context::DEPTH_GREATER; case GL_GREATER: return sw::DEPTH_GREATER;
case GL_GEQUAL: return sw::Context::DEPTH_GREATEREQUAL; case GL_GEQUAL: return sw::DEPTH_GREATEREQUAL;
case GL_NOTEQUAL: return sw::Context::DEPTH_NOTEQUAL; case GL_NOTEQUAL: return sw::DEPTH_NOTEQUAL;
default: UNREACHABLE(); default: UNREACHABLE();
} }
return sw::Context::DEPTH_ALWAYS; return sw::DEPTH_ALWAYS;
} }
sw::Context::StencilCompareMode ConvertStencilComparison(GLenum comparison) sw::StencilCompareMode ConvertStencilComparison(GLenum comparison)
{ {
switch(comparison) switch(comparison)
{ {
case GL_NEVER: return sw::Context::STENCIL_NEVER; case GL_NEVER: return sw::STENCIL_NEVER;
case GL_ALWAYS: return sw::Context::STENCIL_ALWAYS; case GL_ALWAYS: return sw::STENCIL_ALWAYS;
case GL_LESS: return sw::Context::STENCIL_LESS; case GL_LESS: return sw::STENCIL_LESS;
case GL_LEQUAL: return sw::Context::STENCIL_LESSEQUAL; case GL_LEQUAL: return sw::STENCIL_LESSEQUAL;
case GL_EQUAL: return sw::Context::STENCIL_EQUAL; case GL_EQUAL: return sw::STENCIL_EQUAL;
case GL_GREATER: return sw::Context::STENCIL_GREATER; case GL_GREATER: return sw::STENCIL_GREATER;
case GL_GEQUAL: return sw::Context::STENCIL_GREATEREQUAL; case GL_GEQUAL: return sw::STENCIL_GREATEREQUAL;
case GL_NOTEQUAL: return sw::Context::STENCIL_NOTEQUAL; case GL_NOTEQUAL: return sw::STENCIL_NOTEQUAL;
default: UNREACHABLE(); default: UNREACHABLE();
} }
return sw::Context::STENCIL_ALWAYS; return sw::STENCIL_ALWAYS;
} }
sw::Color<float> ConvertColor(gl::Color color) sw::Color<float> ConvertColor(gl::Color color)
...@@ -483,62 +483,62 @@ namespace es2sw ...@@ -483,62 +483,62 @@ namespace es2sw
return sw::Color<float>(color.red, color.green, color.blue, color.alpha); return sw::Color<float>(color.red, color.green, color.blue, color.alpha);
} }
sw::Context::BlendFactor ConvertBlendFunc(GLenum blend) sw::BlendFactor ConvertBlendFunc(GLenum blend)
{ {
switch(blend) switch(blend)
{ {
case GL_ZERO: return sw::Context::BLEND_ZERO; case GL_ZERO: return sw::BLEND_ZERO;
case GL_ONE: return sw::Context::BLEND_ONE; case GL_ONE: return sw::BLEND_ONE;
case GL_SRC_COLOR: return sw::Context::BLEND_SOURCE; case GL_SRC_COLOR: return sw::BLEND_SOURCE;
case GL_ONE_MINUS_SRC_COLOR: return sw::Context::BLEND_INVSOURCE; case GL_ONE_MINUS_SRC_COLOR: return sw::BLEND_INVSOURCE;
case GL_DST_COLOR: return sw::Context::BLEND_DEST; case GL_DST_COLOR: return sw::BLEND_DEST;
case GL_ONE_MINUS_DST_COLOR: return sw::Context::BLEND_INVDEST; case GL_ONE_MINUS_DST_COLOR: return sw::BLEND_INVDEST;
case GL_SRC_ALPHA: return sw::Context::BLEND_SOURCEALPHA; case GL_SRC_ALPHA: return sw::BLEND_SOURCEALPHA;
case GL_ONE_MINUS_SRC_ALPHA: return sw::Context::BLEND_INVSOURCEALPHA; case GL_ONE_MINUS_SRC_ALPHA: return sw::BLEND_INVSOURCEALPHA;
case GL_DST_ALPHA: return sw::Context::BLEND_DESTALPHA; case GL_DST_ALPHA: return sw::BLEND_DESTALPHA;
case GL_ONE_MINUS_DST_ALPHA: return sw::Context::BLEND_INVDESTALPHA; case GL_ONE_MINUS_DST_ALPHA: return sw::BLEND_INVDESTALPHA;
case GL_CONSTANT_COLOR: return sw::Context::BLEND_CONSTANT; case GL_CONSTANT_COLOR: return sw::BLEND_CONSTANT;
case GL_ONE_MINUS_CONSTANT_COLOR: return sw::Context::BLEND_INVCONSTANT; case GL_ONE_MINUS_CONSTANT_COLOR: return sw::BLEND_INVCONSTANT;
case GL_CONSTANT_ALPHA: return sw::Context::BLEND_CONSTANTALPHA; case GL_CONSTANT_ALPHA: return sw::BLEND_CONSTANTALPHA;
case GL_ONE_MINUS_CONSTANT_ALPHA: return sw::Context::BLEND_INVCONSTANTALPHA; case GL_ONE_MINUS_CONSTANT_ALPHA: return sw::BLEND_INVCONSTANTALPHA;
case GL_SRC_ALPHA_SATURATE: return sw::Context::BLEND_SRCALPHASAT; case GL_SRC_ALPHA_SATURATE: return sw::BLEND_SRCALPHASAT;
default: UNREACHABLE(); default: UNREACHABLE();
} }
return sw::Context::BLEND_ZERO; return sw::BLEND_ZERO;
} }
sw::Context::BlendOperation ConvertBlendOp(GLenum blendOp) sw::BlendOperation ConvertBlendOp(GLenum blendOp)
{ {
switch(blendOp) switch(blendOp)
{ {
case GL_FUNC_ADD: return sw::Context::BLENDOP_ADD; case GL_FUNC_ADD: return sw::BLENDOP_ADD;
case GL_FUNC_SUBTRACT: return sw::Context::BLENDOP_SUB; case GL_FUNC_SUBTRACT: return sw::BLENDOP_SUB;
case GL_FUNC_REVERSE_SUBTRACT: return sw::Context::BLENDOP_INVSUB; case GL_FUNC_REVERSE_SUBTRACT: return sw::BLENDOP_INVSUB;
case GL_MIN_EXT: return sw::Context::BLENDOP_MIN; case GL_MIN_EXT: return sw::BLENDOP_MIN;
case GL_MAX_EXT: return sw::Context::BLENDOP_MAX; case GL_MAX_EXT: return sw::BLENDOP_MAX;
default: UNREACHABLE(); default: UNREACHABLE();
} }
return sw::Context::BLENDOP_ADD; return sw::BLENDOP_ADD;
} }
sw::Context::StencilOperation ConvertStencilOp(GLenum stencilOp) sw::StencilOperation ConvertStencilOp(GLenum stencilOp)
{ {
switch(stencilOp) switch(stencilOp)
{ {
case GL_ZERO: return sw::Context::OPERATION_ZERO; case GL_ZERO: return sw::OPERATION_ZERO;
case GL_KEEP: return sw::Context::OPERATION_KEEP; case GL_KEEP: return sw::OPERATION_KEEP;
case GL_REPLACE: return sw::Context::OPERATION_REPLACE; case GL_REPLACE: return sw::OPERATION_REPLACE;
case GL_INCR: return sw::Context::OPERATION_INCRSAT; case GL_INCR: return sw::OPERATION_INCRSAT;
case GL_DECR: return sw::Context::OPERATION_DECRSAT; case GL_DECR: return sw::OPERATION_DECRSAT;
case GL_INVERT: return sw::Context::OPERATION_INVERT; case GL_INVERT: return sw::OPERATION_INVERT;
case GL_INCR_WRAP: return sw::Context::OPERATION_INCR; case GL_INCR_WRAP: return sw::OPERATION_INCR;
case GL_DECR_WRAP: return sw::Context::OPERATION_DECR; case GL_DECR_WRAP: return sw::OPERATION_DECR;
default: UNREACHABLE(); default: UNREACHABLE();
} }
return sw::Context::OPERATION_KEEP; return sw::OPERATION_KEEP;
} }
sw::AddressingMode ConvertTextureWrap(GLenum wrap) sw::AddressingMode ConvertTextureWrap(GLenum wrap)
...@@ -554,20 +554,20 @@ namespace es2sw ...@@ -554,20 +554,20 @@ namespace es2sw
return sw::ADDRESSING_WRAP; return sw::ADDRESSING_WRAP;
} }
sw::Context::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace) sw::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace)
{ {
switch(cullFace) switch(cullFace)
{ {
case GL_FRONT: case GL_FRONT:
return (frontFace == GL_CCW ? sw::Context::CULL_CLOCKWISE : sw::Context::CULL_COUNTERCLOCKWISE); return (frontFace == GL_CCW ? sw::CULL_CLOCKWISE : sw::CULL_COUNTERCLOCKWISE);
case GL_BACK: case GL_BACK:
return (frontFace == GL_CCW ? sw::Context::CULL_COUNTERCLOCKWISE : sw::Context::CULL_CLOCKWISE); return (frontFace == GL_CCW ? sw::CULL_COUNTERCLOCKWISE : sw::CULL_CLOCKWISE);
case GL_FRONT_AND_BACK: case GL_FRONT_AND_BACK:
return sw::Context::CULL_NONE; // culling will be handled during draw return sw::CULL_NONE; // culling will be handled during draw
default: UNREACHABLE(); default: UNREACHABLE();
} }
return sw::Context::CULL_COUNTERCLOCKWISE; return sw::CULL_COUNTERCLOCKWISE;
} }
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha) unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha)
......
...@@ -55,14 +55,14 @@ namespace gl ...@@ -55,14 +55,14 @@ namespace gl
namespace es2sw namespace es2sw
{ {
sw::Context::DepthCompareMode ConvertDepthComparison(GLenum comparison); sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);
sw::Context::StencilCompareMode ConvertStencilComparison(GLenum comparison); sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);
sw::Color<float> ConvertColor(gl::Color color); sw::Color<float> ConvertColor(gl::Color color);
sw::Context::BlendFactor ConvertBlendFunc(GLenum blend); sw::BlendFactor ConvertBlendFunc(GLenum blend);
sw::Context::BlendOperation ConvertBlendOp(GLenum blendOp); sw::BlendOperation ConvertBlendOp(GLenum blendOp);
sw::Context::StencilOperation ConvertStencilOp(GLenum stencilOp); sw::StencilOperation ConvertStencilOp(GLenum stencilOp);
sw::AddressingMode ConvertTextureWrap(GLenum wrap); sw::AddressingMode ConvertTextureWrap(GLenum wrap);
sw::Context::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace); sw::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace);
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha); unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
sw::FilterType ConvertMagFilter(GLenum magFilter); sw::FilterType ConvertMagFilter(GLenum magFilter);
void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy); void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);
......
...@@ -37,7 +37,7 @@ namespace sw ...@@ -37,7 +37,7 @@ namespace sw
bool complementaryDepthBuffer = false; bool complementaryDepthBuffer = false;
bool postBlendSRGB = false; bool postBlendSRGB = false;
bool exactColorRounding = false; bool exactColorRounding = false;
Context::TransparencyAntialiasing transparencyAntialiasing = Context::TRANSPARENCY_NONE; TransparencyAntialiasing transparencyAntialiasing = TRANSPARENCY_NONE;
bool forceClearRegisters = false; bool forceClearRegisters = false;
Context::Context() Context::Context()
...@@ -266,10 +266,10 @@ namespace sw ...@@ -266,10 +266,10 @@ namespace sw
colorWriteMask[2] = 0x0000000F; colorWriteMask[2] = 0x0000000F;
colorWriteMask[3] = 0x0000000F; colorWriteMask[3] = 0x0000000F;
ambientMaterialSource = MATERIAL; ambientMaterialSource = MATERIAL_MATERIAL;
diffuseMaterialSource = COLOR1; diffuseMaterialSource = MATERIAL_COLOR1;
specularMaterialSource = COLOR2; specularMaterialSource = MATERIAL_COLOR2;
emissiveMaterialSource = MATERIAL; emissiveMaterialSource = MATERIAL_MATERIAL;
colorVertexEnable = true; colorVertexEnable = true;
fogEnable = false; fogEnable = false;
...@@ -459,7 +459,7 @@ namespace sw ...@@ -459,7 +459,7 @@ namespace sw
return isDrawPoint(true) && (input[PointSize] || (!preTransformed && pointScaleActive())); return isDrawPoint(true) && (input[PointSize] || (!preTransformed && pointScaleActive()));
} }
Context::FogMode Context::pixelFogActive() FogMode Context::pixelFogActive()
{ {
if(fogActive()) if(fogActive())
{ {
...@@ -620,69 +620,69 @@ namespace sw ...@@ -620,69 +620,69 @@ namespace sw
return lightingEnable && lightEnable[i]; return lightingEnable && lightEnable[i];
} }
Context::MaterialSource Context::vertexDiffuseMaterialSourceActive() MaterialSource Context::vertexDiffuseMaterialSourceActive()
{ {
if(vertexShader) if(vertexShader)
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
if(diffuseMaterialSource == MATERIAL || !colorVertexEnable || if(diffuseMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
(diffuseMaterialSource == COLOR1 && !input[Color0]) || (diffuseMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
(diffuseMaterialSource == COLOR2 && !input[Color1])) (diffuseMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
return diffuseMaterialSource; return diffuseMaterialSource;
} }
Context::MaterialSource Context::vertexSpecularMaterialSourceActive() MaterialSource Context::vertexSpecularMaterialSourceActive()
{ {
if(vertexShader) if(vertexShader)
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
if(specularMaterialSource == MATERIAL || !colorVertexEnable || if(specularMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
(specularMaterialSource == COLOR1 && !input[Color0]) || (specularMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
(specularMaterialSource == COLOR2 && !input[Color1])) (specularMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
return specularMaterialSource; return specularMaterialSource;
} }
Context::MaterialSource Context::vertexAmbientMaterialSourceActive() MaterialSource Context::vertexAmbientMaterialSourceActive()
{ {
if(vertexShader) if(vertexShader)
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
if(ambientMaterialSource == MATERIAL || !colorVertexEnable || if(ambientMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
(ambientMaterialSource == COLOR1 && !input[Color0]) || (ambientMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
(ambientMaterialSource == COLOR2 && !input[Color1])) (ambientMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
return ambientMaterialSource; return ambientMaterialSource;
} }
Context::MaterialSource Context::vertexEmissiveMaterialSourceActive() MaterialSource Context::vertexEmissiveMaterialSourceActive()
{ {
if(vertexShader) if(vertexShader)
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
if(emissiveMaterialSource == MATERIAL || !colorVertexEnable || if(emissiveMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
(emissiveMaterialSource == COLOR1 && !input[Color0]) || (emissiveMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
(emissiveMaterialSource == COLOR2 && !input[Color1])) (emissiveMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
{ {
return MATERIAL; return MATERIAL_MATERIAL;
} }
return emissiveMaterialSource; return emissiveMaterialSource;
...@@ -721,7 +721,7 @@ namespace sw ...@@ -721,7 +721,7 @@ namespace sw
return colorBlend || alphaBlend; return colorBlend || alphaBlend;
} }
Context::BlendFactor Context::sourceBlendFactor() BlendFactor Context::sourceBlendFactor()
{ {
if(!alphaBlendEnable) return BLEND_ONE; if(!alphaBlendEnable) return BLEND_ONE;
...@@ -742,7 +742,7 @@ namespace sw ...@@ -742,7 +742,7 @@ namespace sw
return sourceBlendFactorState; return sourceBlendFactorState;
} }
Context::BlendFactor Context::destBlendFactor() BlendFactor Context::destBlendFactor()
{ {
if(!alphaBlendEnable) return BLEND_ZERO; if(!alphaBlendEnable) return BLEND_ZERO;
...@@ -763,7 +763,7 @@ namespace sw ...@@ -763,7 +763,7 @@ namespace sw
return destBlendFactorState; return destBlendFactorState;
} }
Context::BlendOperation Context::blendOperation() BlendOperation Context::blendOperation()
{ {
if(!alphaBlendEnable) return BLENDOP_SOURCE; if(!alphaBlendEnable) return BLENDOP_SOURCE;
...@@ -875,7 +875,7 @@ namespace sw ...@@ -875,7 +875,7 @@ namespace sw
return blendOperationState; return blendOperationState;
} }
Context::BlendFactor Context::sourceBlendFactorAlpha() BlendFactor Context::sourceBlendFactorAlpha()
{ {
if(!separateAlphaBlendEnable) if(!separateAlphaBlendEnable)
{ {
...@@ -901,7 +901,7 @@ namespace sw ...@@ -901,7 +901,7 @@ namespace sw
} }
} }
Context::BlendFactor Context::destBlendFactorAlpha() BlendFactor Context::destBlendFactorAlpha()
{ {
if(!separateAlphaBlendEnable) if(!separateAlphaBlendEnable)
{ {
...@@ -927,7 +927,7 @@ namespace sw ...@@ -927,7 +927,7 @@ namespace sw
} }
} }
Context::BlendOperation Context::blendOperationAlpha() BlendOperation Context::blendOperationAlpha()
{ {
if(!separateAlphaBlendEnable) if(!separateAlphaBlendEnable)
{ {
...@@ -1084,7 +1084,7 @@ namespace sw ...@@ -1084,7 +1084,7 @@ namespace sw
return normalizeNormals; return normalizeNormals;
} }
Context::FogMode Context::vertexFogModeActive() FogMode Context::vertexFogModeActive()
{ {
if(vertexShader || !fogActive()) if(vertexShader || !fogActive())
{ {
...@@ -1104,7 +1104,7 @@ namespace sw ...@@ -1104,7 +1104,7 @@ namespace sw
return rangeFogEnable; return rangeFogEnable;
} }
Context::TexGen Context::texGenActive(int stage) TexGen Context::texGenActive(int stage)
{ {
if(vertexShader || !texCoordActive(stage)) if(vertexShader || !texCoordActive(stage))
{ {
......
...@@ -49,202 +49,202 @@ namespace sw ...@@ -49,202 +49,202 @@ namespace sw
PositionT = 15 PositionT = 15
}; };
class Context enum DrawType : unsigned int
{ {
public: DRAW_POINTLIST,
enum DrawType DRAW_LINELIST,
{ DRAW_LINESTRIP,
DRAW_POINTLIST, DRAW_LINELOOP,
DRAW_LINELIST, DRAW_TRIANGLELIST,
DRAW_LINESTRIP, DRAW_TRIANGLESTRIP,
DRAW_LINELOOP, DRAW_TRIANGLEFAN,
DRAW_TRIANGLELIST,
DRAW_TRIANGLESTRIP, DRAW_INDEXEDPOINTLIST8,
DRAW_TRIANGLEFAN, DRAW_INDEXEDLINELIST8,
DRAW_INDEXEDLINESTRIP8,
DRAW_INDEXEDPOINTLIST8, DRAW_INDEXEDLINELOOP8,
DRAW_INDEXEDLINELIST8, DRAW_INDEXEDTRIANGLELIST8,
DRAW_INDEXEDLINESTRIP8, DRAW_INDEXEDTRIANGLESTRIP8,
DRAW_INDEXEDLINELOOP8, DRAW_INDEXEDTRIANGLEFAN8,
DRAW_INDEXEDTRIANGLELIST8,
DRAW_INDEXEDTRIANGLESTRIP8, DRAW_INDEXEDPOINTLIST16,
DRAW_INDEXEDTRIANGLEFAN8, DRAW_INDEXEDLINELIST16,
DRAW_INDEXEDLINESTRIP16,
DRAW_INDEXEDPOINTLIST16, DRAW_INDEXEDLINELOOP16,
DRAW_INDEXEDLINELIST16, DRAW_INDEXEDTRIANGLELIST16,
DRAW_INDEXEDLINESTRIP16, DRAW_INDEXEDTRIANGLESTRIP16,
DRAW_INDEXEDLINELOOP16, DRAW_INDEXEDTRIANGLEFAN16,
DRAW_INDEXEDTRIANGLELIST16,
DRAW_INDEXEDTRIANGLESTRIP16, DRAW_INDEXEDPOINTLIST32,
DRAW_INDEXEDTRIANGLEFAN16, DRAW_INDEXEDLINELIST32,
DRAW_INDEXEDLINESTRIP32,
DRAW_INDEXEDPOINTLIST32, DRAW_INDEXEDLINELOOP32,
DRAW_INDEXEDLINELIST32, DRAW_INDEXEDTRIANGLELIST32,
DRAW_INDEXEDLINESTRIP32, DRAW_INDEXEDTRIANGLESTRIP32,
DRAW_INDEXEDLINELOOP32, DRAW_INDEXEDTRIANGLEFAN32,
DRAW_INDEXEDTRIANGLELIST32,
DRAW_INDEXEDTRIANGLESTRIP32, DRAW_LAST = DRAW_INDEXEDTRIANGLEFAN32
DRAW_INDEXEDTRIANGLEFAN32, };
DRAW_LAST = DRAW_INDEXEDTRIANGLEFAN32 enum FillMode : unsigned int
}; {
FILL_SOLID,
enum FillMode FILL_WIREFRAME,
{ FILL_VERTEX,
FILL_SOLID,
FILL_WIREFRAME, FILL_LAST = FILL_VERTEX
FILL_VERTEX, };
FILL_LAST = FILL_VERTEX
};
enum ShadingMode enum ShadingMode : unsigned int
{ {
SHADING_FLAT, SHADING_FLAT,
SHADING_GOURAUD, SHADING_GOURAUD,
SHADING_LAST = 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
};
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:
Context(); Context();
~Context(); ~Context();
...@@ -288,9 +288,9 @@ namespace sw ...@@ -288,9 +288,9 @@ namespace sw
bool setBlendOperation(BlendOperation blendOperation); bool setBlendOperation(BlendOperation blendOperation);
bool setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable); bool setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable);
bool setSourceBlendFactorAlpha(Context::BlendFactor sourceBlendFactorAlpha); bool setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha);
bool setDestBlendFactorAlpha(Context::BlendFactor destBlendFactorAlpha); bool setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha);
bool setBlendOperationAlpha(Context::BlendOperation blendOperationAlpha); bool setBlendOperationAlpha(BlendOperation blendOperationAlpha);
bool setColorWriteMask(int index, int colorWriteMask); bool setColorWriteMask(int index, int colorWriteMask);
bool setWriteSRGB(bool sRGB); bool setWriteSRGB(bool sRGB);
...@@ -298,7 +298,7 @@ namespace sw ...@@ -298,7 +298,7 @@ namespace sw
// Active fixed-function pixel pipeline states // Active fixed-function pixel pipeline states
bool fogActive(); bool fogActive();
bool pointSizeActive(); bool pointSizeActive();
Context::FogMode pixelFogActive(); FogMode pixelFogActive();
bool depthWriteActive(); bool depthWriteActive();
bool alphaTestActive(); bool alphaTestActive();
bool depthBufferActive(); bool depthBufferActive();
...@@ -414,7 +414,7 @@ namespace sw ...@@ -414,7 +414,7 @@ namespace sw
bool textureWrapActive; bool textureWrapActive;
unsigned char textureWrap[16]; unsigned char textureWrap[16];
Context::TexGen texGen[8]; TexGen texGen[8];
bool localViewer; bool localViewer;
bool normalizeNormals; bool normalizeNormals;
int textureTransformCount[8]; int textureTransformCount[8];
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
namespace sw namespace sw
{ {
extern bool complementaryDepthBuffer; extern bool complementaryDepthBuffer;
extern Context::TransparencyAntialiasing transparencyAntialiasing; extern TransparencyAntialiasing transparencyAntialiasing;
extern bool perspectiveCorrection; extern bool perspectiveCorrection;
bool precachePixel = false; bool precachePixel = false;
...@@ -425,12 +425,12 @@ namespace sw ...@@ -425,12 +425,12 @@ namespace sw
context->setDepthBufferEnable(depthBufferEnable); context->setDepthBufferEnable(depthBufferEnable);
} }
void PixelProcessor::setDepthCompare(Context::DepthCompareMode depthCompareMode) void PixelProcessor::setDepthCompare(DepthCompareMode depthCompareMode)
{ {
context->depthCompareMode = depthCompareMode; context->depthCompareMode = depthCompareMode;
} }
void PixelProcessor::setAlphaCompare(Context::AlphaCompareMode alphaCompareMode) void PixelProcessor::setAlphaCompare(AlphaCompareMode alphaCompareMode)
{ {
context->alphaCompareMode = alphaCompareMode; context->alphaCompareMode = alphaCompareMode;
} }
...@@ -445,7 +445,7 @@ namespace sw ...@@ -445,7 +445,7 @@ namespace sw
context->alphaTestEnable = alphaTestEnable; context->alphaTestEnable = alphaTestEnable;
} }
void PixelProcessor::setCullMode(Context::CullMode cullMode) void PixelProcessor::setCullMode(CullMode cullMode)
{ {
context->cullMode = cullMode; context->cullMode = cullMode;
} }
...@@ -460,7 +460,7 @@ namespace sw ...@@ -460,7 +460,7 @@ namespace sw
context->stencilEnable = stencilEnable; context->stencilEnable = stencilEnable;
} }
void PixelProcessor::setStencilCompare(Context::StencilCompareMode stencilCompareMode) void PixelProcessor::setStencilCompare(StencilCompareMode stencilCompareMode)
{ {
context->stencilCompareMode = stencilCompareMode; context->stencilCompareMode = stencilCompareMode;
} }
...@@ -489,17 +489,17 @@ namespace sw ...@@ -489,17 +489,17 @@ namespace sw
stencilCCW.set(context->stencilReferenceCCW, stencilMaskCCW, context->stencilWriteMaskCCW); stencilCCW.set(context->stencilReferenceCCW, stencilMaskCCW, context->stencilWriteMaskCCW);
} }
void PixelProcessor::setStencilFailOperation(Context::StencilOperation stencilFailOperation) void PixelProcessor::setStencilFailOperation(StencilOperation stencilFailOperation)
{ {
context->stencilFailOperation = stencilFailOperation; context->stencilFailOperation = stencilFailOperation;
} }
void PixelProcessor::setStencilPassOperation(Context::StencilOperation stencilPassOperation) void PixelProcessor::setStencilPassOperation(StencilOperation stencilPassOperation)
{ {
context->stencilPassOperation = stencilPassOperation; context->stencilPassOperation = stencilPassOperation;
} }
void PixelProcessor::setStencilZFailOperation(Context::StencilOperation stencilZFailOperation) void PixelProcessor::setStencilZFailOperation(StencilOperation stencilZFailOperation)
{ {
context->stencilZFailOperation = stencilZFailOperation; context->stencilZFailOperation = stencilZFailOperation;
} }
...@@ -521,22 +521,22 @@ namespace sw ...@@ -521,22 +521,22 @@ namespace sw
context->twoSidedStencil = enable; context->twoSidedStencil = enable;
} }
void PixelProcessor::setStencilCompareCCW(Context::StencilCompareMode stencilCompareMode) void PixelProcessor::setStencilCompareCCW(StencilCompareMode stencilCompareMode)
{ {
context->stencilCompareModeCCW = stencilCompareMode; context->stencilCompareModeCCW = stencilCompareMode;
} }
void PixelProcessor::setStencilFailOperationCCW(Context::StencilOperation stencilFailOperation) void PixelProcessor::setStencilFailOperationCCW(StencilOperation stencilFailOperation)
{ {
context->stencilFailOperationCCW = stencilFailOperation; context->stencilFailOperationCCW = stencilFailOperation;
} }
void PixelProcessor::setStencilPassOperationCCW(Context::StencilOperation stencilPassOperation) void PixelProcessor::setStencilPassOperationCCW(StencilOperation stencilPassOperation)
{ {
context->stencilPassOperationCCW = stencilPassOperation; context->stencilPassOperationCCW = stencilPassOperation;
} }
void PixelProcessor::setStencilZFailOperationCCW(Context::StencilOperation stencilZFailOperation) void PixelProcessor::setStencilZFailOperationCCW(StencilOperation stencilZFailOperation)
{ {
context->stencilZFailOperationCCW = stencilZFailOperation; context->stencilZFailOperationCCW = stencilZFailOperation;
} }
...@@ -665,12 +665,12 @@ namespace sw ...@@ -665,12 +665,12 @@ namespace sw
factor.invBlendConstant4F[3][3] = 1 - blendConstant.a; factor.invBlendConstant4F[3][3] = 1 - blendConstant.a;
} }
void PixelProcessor::setFillMode(Context::FillMode fillMode) void PixelProcessor::setFillMode(FillMode fillMode)
{ {
context->fillMode = fillMode; context->fillMode = fillMode;
} }
void PixelProcessor::setShadingMode(Context::ShadingMode shadingMode) void PixelProcessor::setShadingMode(ShadingMode shadingMode)
{ {
context->shadingMode = shadingMode; context->shadingMode = shadingMode;
} }
...@@ -680,17 +680,17 @@ namespace sw ...@@ -680,17 +680,17 @@ namespace sw
context->setAlphaBlendEnable(alphaBlendEnable); context->setAlphaBlendEnable(alphaBlendEnable);
} }
void PixelProcessor::setSourceBlendFactor(Context::BlendFactor sourceBlendFactor) void PixelProcessor::setSourceBlendFactor(BlendFactor sourceBlendFactor)
{ {
context->setSourceBlendFactor(sourceBlendFactor); context->setSourceBlendFactor(sourceBlendFactor);
} }
void PixelProcessor::setDestBlendFactor(Context::BlendFactor destBlendFactor) void PixelProcessor::setDestBlendFactor(BlendFactor destBlendFactor)
{ {
context->setDestBlendFactor(destBlendFactor); context->setDestBlendFactor(destBlendFactor);
} }
void PixelProcessor::setBlendOperation(Context::BlendOperation blendOperation) void PixelProcessor::setBlendOperation(BlendOperation blendOperation)
{ {
context->setBlendOperation(blendOperation); context->setBlendOperation(blendOperation);
} }
...@@ -700,17 +700,17 @@ namespace sw ...@@ -700,17 +700,17 @@ namespace sw
context->setSeparateAlphaBlendEnable(separateAlphaBlendEnable); context->setSeparateAlphaBlendEnable(separateAlphaBlendEnable);
} }
void PixelProcessor::setSourceBlendFactorAlpha(Context::BlendFactor sourceBlendFactorAlpha) void PixelProcessor::setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha)
{ {
context->setSourceBlendFactorAlpha(sourceBlendFactorAlpha); context->setSourceBlendFactorAlpha(sourceBlendFactorAlpha);
} }
void PixelProcessor::setDestBlendFactorAlpha(Context::BlendFactor destBlendFactorAlpha) void PixelProcessor::setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha)
{ {
context->setDestBlendFactorAlpha(destBlendFactorAlpha); context->setDestBlendFactorAlpha(destBlendFactorAlpha);
} }
void PixelProcessor::setBlendOperationAlpha(Context::BlendOperation blendOperationAlpha) void PixelProcessor::setBlendOperationAlpha(BlendOperation blendOperationAlpha)
{ {
context->setBlendOperationAlpha(blendOperationAlpha); context->setBlendOperationAlpha(blendOperationAlpha);
} }
...@@ -773,7 +773,7 @@ namespace sw ...@@ -773,7 +773,7 @@ namespace sw
fog.densityE2 = replicate(fogDensity * 1.201122f); // 1/e^(x^2) = 2^(-(x*1.20)^2) 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; context->pixelFogMode = fogMode;
} }
...@@ -831,7 +831,7 @@ namespace sw ...@@ -831,7 +831,7 @@ namespace sw
{ {
state.alphaCompareMode = context->alphaCompareMode; 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(); state.depthWriteEnable = context->depthWriteActive();
...@@ -870,7 +870,7 @@ namespace sw ...@@ -870,7 +870,7 @@ namespace sw
state.fogActive = context->fogActive(); state.fogActive = context->fogActive();
state.pixelFogMode = context->pixelFogActive(); 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(); state.perspective = context->perspectiveActive();
if(context->alphaBlendActive()) if(context->alphaBlendActive())
...@@ -934,7 +934,7 @@ namespace sw ...@@ -934,7 +934,7 @@ namespace sw
const bool point = context->isDrawPoint(true); const bool point = context->isDrawPoint(true);
const bool sprite = context->pointSpriteActive(); 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) if(context->pixelShaderVersion() < 0x0300)
{ {
......
...@@ -173,7 +173,7 @@ namespace sw ...@@ -173,7 +173,7 @@ namespace sw
if(veryEarlyDepthTest && state.multiSample == 1) 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); Float4 xxxx = Float4(Float(x0)) + *Pointer<Float4>(r.primitive + OFFSET(Primitive,xQuad), 16);
......
...@@ -51,7 +51,7 @@ namespace sw ...@@ -51,7 +51,7 @@ namespace sw
extern bool complementaryDepthBuffer; extern bool complementaryDepthBuffer;
extern bool postBlendSRGB; extern bool postBlendSRGB;
extern bool exactColorRounding; extern bool exactColorRounding;
extern Context::TransparencyAntialiasing transparencyAntialiasing; extern TransparencyAntialiasing transparencyAntialiasing;
extern bool forceClearRegisters; extern bool forceClearRegisters;
extern bool precacheVertex; extern bool precacheVertex;
...@@ -191,7 +191,7 @@ namespace sw ...@@ -191,7 +191,7 @@ namespace sw
blitter.blit(source, sRect, dest, dRect, filter); 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 #ifndef NDEBUG
if(count < minPrimitives || count > maxPrimitives) if(count < minPrimitives || count > maxPrimitives)
...@@ -237,14 +237,14 @@ namespace sw ...@@ -237,14 +237,14 @@ namespace sw
{ {
switch(context->fillMode) switch(context->fillMode)
{ {
case Context::FILL_SOLID: case FILL_SOLID:
setupPrimitives = setupSolidTriangles; setupPrimitives = setupSolidTriangles;
break; break;
case Context::FILL_WIREFRAME: case FILL_WIREFRAME:
setupPrimitives = setupWireframeTriangle; setupPrimitives = setupWireframeTriangle;
batch = 1; batch = 1;
break; break;
case Context::FILL_VERTEX: case FILL_VERTEX:
setupPrimitives = setupVertexTriangle; setupPrimitives = setupVertexTriangle;
batch = 1; batch = 1;
break; break;
...@@ -440,7 +440,7 @@ namespace sw ...@@ -440,7 +440,7 @@ namespace sw
data->factor = factor; 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 ref = (float)context->alphaReference * (1.0f / 255.0f);
float margin = sw::min(ref, 1.0f - ref); float margin = sw::min(ref, 1.0f - ref);
...@@ -954,7 +954,7 @@ namespace sw ...@@ -954,7 +954,7 @@ namespace sw
switch(draw->drawType) switch(draw->drawType)
{ {
case Context::DRAW_POINTLIST: case DRAW_POINTLIST:
{ {
unsigned int index = start; unsigned int index = start;
...@@ -968,7 +968,7 @@ namespace sw ...@@ -968,7 +968,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_LINELIST: case DRAW_LINELIST:
{ {
unsigned int index = 2 * start; unsigned int index = 2 * start;
...@@ -982,7 +982,7 @@ namespace sw ...@@ -982,7 +982,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_LINESTRIP: case DRAW_LINESTRIP:
{ {
unsigned int index = start; unsigned int index = start;
...@@ -996,7 +996,7 @@ namespace sw ...@@ -996,7 +996,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_LINELOOP: case DRAW_LINELOOP:
{ {
unsigned int index = start; unsigned int index = start;
...@@ -1010,7 +1010,7 @@ namespace sw ...@@ -1010,7 +1010,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_TRIANGLELIST: case DRAW_TRIANGLELIST:
{ {
unsigned int index = 3 * start; unsigned int index = 3 * start;
...@@ -1024,7 +1024,7 @@ namespace sw ...@@ -1024,7 +1024,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_TRIANGLESTRIP: case DRAW_TRIANGLESTRIP:
{ {
unsigned int index = start; unsigned int index = start;
...@@ -1038,7 +1038,7 @@ namespace sw ...@@ -1038,7 +1038,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_TRIANGLEFAN: case DRAW_TRIANGLEFAN:
{ {
unsigned int index = start; unsigned int index = start;
...@@ -1052,7 +1052,7 @@ namespace sw ...@@ -1052,7 +1052,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDPOINTLIST8: case DRAW_INDEXEDPOINTLIST8:
{ {
const unsigned char *index = (const unsigned char*)indices + start; const unsigned char *index = (const unsigned char*)indices + start;
...@@ -1066,7 +1066,7 @@ namespace sw ...@@ -1066,7 +1066,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDPOINTLIST16: case DRAW_INDEXEDPOINTLIST16:
{ {
const unsigned short *index = (const unsigned short*)indices + start; const unsigned short *index = (const unsigned short*)indices + start;
...@@ -1080,7 +1080,7 @@ namespace sw ...@@ -1080,7 +1080,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDPOINTLIST32: case DRAW_INDEXEDPOINTLIST32:
{ {
const unsigned int *index = (const unsigned int*)indices + start; const unsigned int *index = (const unsigned int*)indices + start;
...@@ -1094,7 +1094,7 @@ namespace sw ...@@ -1094,7 +1094,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINELIST8: case DRAW_INDEXEDLINELIST8:
{ {
const unsigned char *index = (const unsigned char*)indices + 2 * start; const unsigned char *index = (const unsigned char*)indices + 2 * start;
...@@ -1108,7 +1108,7 @@ namespace sw ...@@ -1108,7 +1108,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINELIST16: case DRAW_INDEXEDLINELIST16:
{ {
const unsigned short *index = (const unsigned short*)indices + 2 * start; const unsigned short *index = (const unsigned short*)indices + 2 * start;
...@@ -1122,7 +1122,7 @@ namespace sw ...@@ -1122,7 +1122,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINELIST32: case DRAW_INDEXEDLINELIST32:
{ {
const unsigned int *index = (const unsigned int*)indices + 2 * start; const unsigned int *index = (const unsigned int*)indices + 2 * start;
...@@ -1136,7 +1136,7 @@ namespace sw ...@@ -1136,7 +1136,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINESTRIP8: case DRAW_INDEXEDLINESTRIP8:
{ {
const unsigned char *index = (const unsigned char*)indices + start; const unsigned char *index = (const unsigned char*)indices + start;
...@@ -1150,7 +1150,7 @@ namespace sw ...@@ -1150,7 +1150,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINESTRIP16: case DRAW_INDEXEDLINESTRIP16:
{ {
const unsigned short *index = (const unsigned short*)indices + start; const unsigned short *index = (const unsigned short*)indices + start;
...@@ -1164,7 +1164,7 @@ namespace sw ...@@ -1164,7 +1164,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINESTRIP32: case DRAW_INDEXEDLINESTRIP32:
{ {
const unsigned int *index = (const unsigned int*)indices + start; const unsigned int *index = (const unsigned int*)indices + start;
...@@ -1178,7 +1178,7 @@ namespace sw ...@@ -1178,7 +1178,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINELOOP8: case DRAW_INDEXEDLINELOOP8:
{ {
const unsigned char *index = (const unsigned char*)indices; const unsigned char *index = (const unsigned char*)indices;
...@@ -1190,7 +1190,7 @@ namespace sw ...@@ -1190,7 +1190,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINELOOP16: case DRAW_INDEXEDLINELOOP16:
{ {
const unsigned short *index = (const unsigned short*)indices; const unsigned short *index = (const unsigned short*)indices;
...@@ -1202,7 +1202,7 @@ namespace sw ...@@ -1202,7 +1202,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDLINELOOP32: case DRAW_INDEXEDLINELOOP32:
{ {
const unsigned int *index = (const unsigned int*)indices; const unsigned int *index = (const unsigned int*)indices;
...@@ -1214,7 +1214,7 @@ namespace sw ...@@ -1214,7 +1214,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLELIST8: case DRAW_INDEXEDTRIANGLELIST8:
{ {
const unsigned char *index = (const unsigned char*)indices + 3 * start; const unsigned char *index = (const unsigned char*)indices + 3 * start;
...@@ -1228,7 +1228,7 @@ namespace sw ...@@ -1228,7 +1228,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLELIST16: case DRAW_INDEXEDTRIANGLELIST16:
{ {
const unsigned short *index = (const unsigned short*)indices + 3 * start; const unsigned short *index = (const unsigned short*)indices + 3 * start;
...@@ -1242,7 +1242,7 @@ namespace sw ...@@ -1242,7 +1242,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLELIST32: case DRAW_INDEXEDTRIANGLELIST32:
{ {
const unsigned int *index = (const unsigned int*)indices + 3 * start; const unsigned int *index = (const unsigned int*)indices + 3 * start;
...@@ -1256,7 +1256,7 @@ namespace sw ...@@ -1256,7 +1256,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLESTRIP8: case DRAW_INDEXEDTRIANGLESTRIP8:
{ {
const unsigned char *index = (const unsigned char*)indices + start; const unsigned char *index = (const unsigned char*)indices + start;
...@@ -1270,7 +1270,7 @@ namespace sw ...@@ -1270,7 +1270,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLESTRIP16: case DRAW_INDEXEDTRIANGLESTRIP16:
{ {
const unsigned short *index = (const unsigned short*)indices + start; const unsigned short *index = (const unsigned short*)indices + start;
...@@ -1284,7 +1284,7 @@ namespace sw ...@@ -1284,7 +1284,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLESTRIP32: case DRAW_INDEXEDTRIANGLESTRIP32:
{ {
const unsigned int *index = (const unsigned int*)indices + start; const unsigned int *index = (const unsigned int*)indices + start;
...@@ -1298,7 +1298,7 @@ namespace sw ...@@ -1298,7 +1298,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLEFAN8: case DRAW_INDEXEDTRIANGLEFAN8:
{ {
const unsigned char *index = (const unsigned char*)indices; const unsigned char *index = (const unsigned char*)indices;
...@@ -1310,7 +1310,7 @@ namespace sw ...@@ -1310,7 +1310,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLEFAN16: case DRAW_INDEXEDTRIANGLEFAN16:
{ {
const unsigned short *index = (const unsigned short*)indices; const unsigned short *index = (const unsigned short*)indices;
...@@ -1322,7 +1322,7 @@ namespace sw ...@@ -1322,7 +1322,7 @@ namespace sw
} }
} }
break; break;
case Context::DRAW_INDEXEDTRIANGLEFAN32: case DRAW_INDEXEDTRIANGLEFAN32:
{ {
const unsigned int *index = (const unsigned int*)indices; const unsigned int *index = (const unsigned int*)indices;
...@@ -1403,11 +1403,11 @@ namespace sw ...@@ -1403,11 +1403,11 @@ namespace sw
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; 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; if(d >= 0) return 0;
} }
else if(state.cullMode == Context::CULL_COUNTERCLOCKWISE) else if(state.cullMode == CULL_COUNTERCLOCKWISE)
{ {
if(d <= 0) return 0; if(d <= 0) return 0;
} }
...@@ -1460,11 +1460,11 @@ namespace sw ...@@ -1460,11 +1460,11 @@ namespace sw
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; 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; if(d >= 0) return 0;
} }
else if(state.cullMode == Context::CULL_COUNTERCLOCKWISE) else if(state.cullMode == CULL_COUNTERCLOCKWISE)
{ {
if(d <= 0) return 0; if(d <= 0) return 0;
} }
...@@ -1997,7 +1997,7 @@ namespace sw ...@@ -1997,7 +1997,7 @@ namespace sw
context->sampleMask = mask; context->sampleMask = mask;
} }
void Renderer::setTransparencyAntialiasing(Context::TransparencyAntialiasing transparencyAntialiasing) void Renderer::setTransparencyAntialiasing(TransparencyAntialiasing transparencyAntialiasing)
{ {
sw::transparencyAntialiasing = transparencyAntialiasing; sw::transparencyAntialiasing = transparencyAntialiasing;
} }
...@@ -2488,9 +2488,9 @@ namespace sw ...@@ -2488,9 +2488,9 @@ namespace sw
switch(configuration.transparencyAntialiasing) switch(configuration.transparencyAntialiasing)
{ {
case 0: transparencyAntialiasing = Context::TRANSPARENCY_NONE; break; case 0: transparencyAntialiasing = TRANSPARENCY_NONE; break;
case 1: transparencyAntialiasing = Context::TRANSPARENCY_ALPHA_TO_COVERAGE; break; case 1: transparencyAntialiasing = TRANSPARENCY_ALPHA_TO_COVERAGE; break;
default: transparencyAntialiasing = Context::TRANSPARENCY_NONE; break; default: transparencyAntialiasing = TRANSPARENCY_NONE; break;
} }
switch(configuration.threadCount) switch(configuration.threadCount)
......
...@@ -165,7 +165,7 @@ namespace sw ...@@ -165,7 +165,7 @@ namespace sw
~DrawCall(); ~DrawCall();
Context::DrawType drawType; DrawType drawType;
int batchSize; int batchSize;
Routine *vertexRoutine; Routine *vertexRoutine;
...@@ -270,12 +270,12 @@ namespace sw ...@@ -270,12 +270,12 @@ namespace sw
virtual ~Renderer(); virtual ~Renderer();
virtual void blit(Surface *source, const Rect &sRect, Surface *dest, const Rect &dRect, bool filter); 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 setIndexBuffer(Resource *indexBuffer);
virtual void setMultiSampleMask(unsigned int mask); 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 setTextureResource(unsigned int sampler, Resource *resource);
virtual void setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type); virtual void setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type);
......
...@@ -72,7 +72,7 @@ namespace sw ...@@ -72,7 +72,7 @@ namespace sw
SAMPLER_VERTEX SAMPLER_VERTEX
}; };
enum TextureType enum TextureType : unsigned int
{ {
TEXTURE_NULL, TEXTURE_NULL,
TEXTURE_2D, TEXTURE_2D,
...@@ -82,7 +82,7 @@ namespace sw ...@@ -82,7 +82,7 @@ namespace sw
TEXTURE_LAST = TEXTURE_3D TEXTURE_LAST = TEXTURE_3D
}; };
enum FilterType enum FilterType : unsigned int
{ {
FILTER_POINT, FILTER_POINT,
FILTER_GATHER, FILTER_GATHER,
...@@ -92,7 +92,7 @@ namespace sw ...@@ -92,7 +92,7 @@ namespace sw
FILTER_LAST = FILTER_ANISOTROPIC FILTER_LAST = FILTER_ANISOTROPIC
}; };
enum MipmapType enum MipmapType : unsigned int
{ {
MIPMAP_NONE, MIPMAP_NONE,
MIPMAP_POINT, MIPMAP_POINT,
...@@ -101,7 +101,7 @@ namespace sw ...@@ -101,7 +101,7 @@ namespace sw
MIPMAP_LAST = MIPMAP_LINEAR MIPMAP_LAST = MIPMAP_LINEAR
}; };
enum AddressingMode enum AddressingMode : unsigned int
{ {
ADDRESSING_WRAP, ADDRESSING_WRAP,
ADDRESSING_CLAMP, ADDRESSING_CLAMP,
...@@ -119,18 +119,18 @@ namespace sw ...@@ -119,18 +119,18 @@ namespace sw
{ {
State(); State();
unsigned int textureType : BITS(TEXTURE_LAST); TextureType textureType : BITS(TEXTURE_LAST);
unsigned int textureFormat : BITS(FORMAT_LAST); Format textureFormat : BITS(FORMAT_LAST);
unsigned int textureFilter : BITS(FILTER_LAST); FilterType textureFilter : BITS(FILTER_LAST);
unsigned int addressingModeU : BITS(ADDRESSING_LAST); AddressingMode addressingModeU : BITS(ADDRESSING_LAST);
unsigned int addressingModeV : BITS(ADDRESSING_LAST); AddressingMode addressingModeV : BITS(ADDRESSING_LAST);
unsigned int addressingModeW : BITS(ADDRESSING_LAST); AddressingMode addressingModeW : BITS(ADDRESSING_LAST);
unsigned int mipmapFilter : BITS(FILTER_LAST); MipmapType mipmapFilter : BITS(FILTER_LAST);
unsigned int hasNPOTTexture : 1; bool hasNPOTTexture : 1;
unsigned int sRGB : 1; bool sRGB : 1;
#if PERF_PROFILE #if PERF_PROFILE
bool compressedFormat : 1; bool compressedFormat : 1;
#endif #endif
}; };
......
...@@ -76,7 +76,7 @@ namespace sw ...@@ -76,7 +76,7 @@ namespace sw
state.isDrawLine = context->isDrawLine(true); state.isDrawLine = context->isDrawLine(true);
state.isDrawTriangle = context->isDrawTriangle(false); state.isDrawTriangle = context->isDrawTriangle(false);
state.isDrawSolidTriangle = context->isDrawTriangle(true); 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.interpolateW = context->perspectiveActive() || vPosZW;
state.perspective = context->perspectiveActive(); state.perspective = context->perspectiveActive();
state.pointSprite = context->pointSpriteActive(); state.pointSprite = context->pointSpriteActive();
...@@ -114,7 +114,7 @@ namespace sw ...@@ -114,7 +114,7 @@ namespace sw
const bool point = context->isDrawPoint(true); const bool point = context->isDrawPoint(true);
const bool sprite = context->pointSpriteActive(); 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) if(context->vertexShader && context->pixelShader)
{ {
......
...@@ -34,27 +34,27 @@ namespace sw ...@@ -34,27 +34,27 @@ namespace sw
{ {
unsigned int computeHash(); unsigned int computeHash();
unsigned int isDrawPoint : 1; bool isDrawPoint : 1;
unsigned int isDrawLine : 1; bool isDrawLine : 1;
unsigned int isDrawTriangle : 1; bool isDrawTriangle : 1;
unsigned int isDrawSolidTriangle : 1; bool isDrawSolidTriangle : 1;
unsigned int interpolateZ : 1; bool interpolateZ : 1;
unsigned int interpolateW : 1; bool interpolateW : 1;
unsigned int perspective : 1; bool perspective : 1;
unsigned int pointSprite : 1; bool pointSprite : 1;
unsigned int positionRegister : 4; unsigned int positionRegister : 4;
unsigned int pointSizeRegister : 4; unsigned int pointSizeRegister : 4;
unsigned int cullMode : BITS(Context::CULL_LAST); CullMode cullMode : BITS(CULL_LAST);
unsigned int twoSidedStencil : 1; bool twoSidedStencil : 1;
unsigned int slopeDepthBias : 1; bool slopeDepthBias : 1;
unsigned int vFace : 1; bool vFace : 1;
unsigned int multiSample : 3; // 1, 2 or 4 unsigned int multiSample : 3; // 1, 2 or 4
struct Gradient struct Gradient
{ {
unsigned char attribute : 6; unsigned char attribute : 6;
unsigned char flat : 1; bool flat : 1;
unsigned char wrap : 1; bool wrap : 1;
}; };
union union
......
...@@ -18,7 +18,7 @@ namespace sw ...@@ -18,7 +18,7 @@ namespace sw
{ {
class Resource; class Resource;
enum StreamType enum StreamType : unsigned int
{ {
STREAMTYPE_COLOR, // 4 normalized unsigned bytes, ZYXW order STREAMTYPE_COLOR, // 4 normalized unsigned bytes, ZYXW order
STREAMTYPE_UDEC3, // 3 unsigned 10-bit fields STREAMTYPE_UDEC3, // 3 unsigned 10-bit fields
......
...@@ -30,7 +30,7 @@ namespace sw ...@@ -30,7 +30,7 @@ namespace sw
int y1; // Exclusive int y1; // Exclusive
}; };
enum Format enum Format : unsigned char
{ {
FORMAT_NULL, FORMAT_NULL,
......
...@@ -292,7 +292,7 @@ namespace sw ...@@ -292,7 +292,7 @@ namespace sw
context->fogEnable = fogEnable; context->fogEnable = fogEnable;
} }
void VertexProcessor::setVertexFogMode(Context::FogMode fogMode) void VertexProcessor::setVertexFogMode(FogMode fogMode)
{ {
context->vertexFogMode = fogMode; context->vertexFogMode = fogMode;
} }
...@@ -302,22 +302,22 @@ namespace sw ...@@ -302,22 +302,22 @@ namespace sw
context->setColorVertexEnable(colorVertexEnable); context->setColorVertexEnable(colorVertexEnable);
} }
void VertexProcessor::setDiffuseMaterialSource(Context::MaterialSource diffuseMaterialSource) void VertexProcessor::setDiffuseMaterialSource(MaterialSource diffuseMaterialSource)
{ {
context->setDiffuseMaterialSource(diffuseMaterialSource); context->setDiffuseMaterialSource(diffuseMaterialSource);
} }
void VertexProcessor::setSpecularMaterialSource(Context::MaterialSource specularMaterialSource) void VertexProcessor::setSpecularMaterialSource(MaterialSource specularMaterialSource)
{ {
context->setSpecularMaterialSource(specularMaterialSource); context->setSpecularMaterialSource(specularMaterialSource);
} }
void VertexProcessor::setAmbientMaterialSource(Context::MaterialSource ambientMaterialSource) void VertexProcessor::setAmbientMaterialSource(MaterialSource ambientMaterialSource)
{ {
context->setAmbientMaterialSource(ambientMaterialSource); context->setAmbientMaterialSource(ambientMaterialSource);
} }
void VertexProcessor::setEmissiveMaterialSource(Context::MaterialSource emissiveMaterialSource) void VertexProcessor::setEmissiveMaterialSource(MaterialSource emissiveMaterialSource)
{ {
context->setEmissiveMaterialSource(emissiveMaterialSource); context->setEmissiveMaterialSource(emissiveMaterialSource);
} }
...@@ -414,7 +414,7 @@ namespace sw ...@@ -414,7 +414,7 @@ namespace sw
} }
} }
void VertexProcessor::setTexGen(unsigned int stage, Context::TexGen texGen) void VertexProcessor::setTexGen(unsigned int stage, TexGen texGen)
{ {
if(stage < 8) if(stage < 8)
{ {
......
...@@ -45,40 +45,40 @@ namespace sw ...@@ -45,40 +45,40 @@ namespace sw
uint64_t shaderID; uint64_t shaderID;
unsigned int fixedFunction : 1; bool fixedFunction : 1;
unsigned int shaderContainsTexldl : 1; bool shaderContainsTexldl : 1;
unsigned int positionRegister : 4; unsigned int positionRegister : 4;
unsigned int pointSizeRegister : 4; // 0xF signifies no vertex point size unsigned int pointSizeRegister : 4; // 0xF signifies no vertex point size
unsigned int vertexBlendMatrixCount : 3; unsigned int vertexBlendMatrixCount : 3;
unsigned int indexedVertexBlendEnable : 1; bool indexedVertexBlendEnable : 1;
unsigned int vertexNormalActive : 1; bool vertexNormalActive : 1;
unsigned int normalizeNormals : 1; bool normalizeNormals : 1;
unsigned int vertexLightingActive : 1; bool vertexLightingActive : 1;
unsigned int diffuseActive : 1; bool diffuseActive : 1;
unsigned int specularActive : 1; bool specularActive : 1;
unsigned int vertexSpecularActive : 1; bool vertexSpecularActive : 1;
unsigned int vertexLightActive : 8; unsigned int vertexLightActive : 8;
unsigned int vertexDiffuseMaterialSourceActive : BITS(Context::MATERIAL_LAST); MaterialSource vertexDiffuseMaterialSourceActive : BITS(MATERIAL_LAST);
unsigned int vertexSpecularMaterialSourceActive : BITS(Context::MATERIAL_LAST); MaterialSource vertexSpecularMaterialSourceActive : BITS(MATERIAL_LAST);
unsigned int vertexAmbientMaterialSourceActive : BITS(Context::MATERIAL_LAST); MaterialSource vertexAmbientMaterialSourceActive : BITS(MATERIAL_LAST);
unsigned int vertexEmissiveMaterialSourceActive : BITS(Context::MATERIAL_LAST); MaterialSource vertexEmissiveMaterialSourceActive : BITS(MATERIAL_LAST);
unsigned int fogActive : 1; bool fogActive : 1;
unsigned int vertexFogMode : BITS(Context::FOG_LAST); FogMode vertexFogMode : BITS(FOG_LAST);
unsigned int rangeFogActive : 1; bool rangeFogActive : 1;
unsigned int localViewerActive : 1; bool localViewerActive : 1;
unsigned int pointSizeActive : 1; bool pointSizeActive : 1;
unsigned int pointScaleActive : 1; bool pointScaleActive : 1;
unsigned int preTransformed : 1; bool preTransformed : 1;
unsigned int superSampling : 1; bool superSampling : 1;
unsigned int multiSampling : 1; bool multiSampling : 1;
struct TextureState struct TextureState
{ {
unsigned char texGenActive : BITS(Context::TEXGEN_LAST); TexGen texGenActive : BITS(TEXGEN_LAST);
unsigned char textureTransformCountActive : 3; unsigned char textureTransformCountActive : 3;
unsigned char texCoordIndexActive : 3; unsigned char texCoordIndexActive : 3;
}; };
TextureState textureState[8]; TextureState textureState[8];
...@@ -92,9 +92,9 @@ namespace sw ...@@ -92,9 +92,9 @@ namespace sw
return count != 0; return count != 0;
} }
unsigned int type : BITS(STREAMTYPE_LAST); StreamType type : BITS(STREAMTYPE_LAST);
unsigned int count : 3; unsigned int count : 3;
unsigned int normalized : 1; bool normalized : 1;
}; };
struct Output struct Output
...@@ -206,14 +206,14 @@ namespace sw ...@@ -206,14 +206,14 @@ namespace sw
virtual void setLightRange(unsigned int light, float lightRange); virtual void setLightRange(unsigned int light, float lightRange);
virtual void setFogEnable(bool fogEnable); virtual void setFogEnable(bool fogEnable);
virtual void setVertexFogMode(Context::FogMode fogMode); virtual void setVertexFogMode(FogMode fogMode);
virtual void setRangeFogEnable(bool enable); virtual void setRangeFogEnable(bool enable);
virtual void setColorVertexEnable(bool colorVertexEnable); virtual void setColorVertexEnable(bool colorVertexEnable);
virtual void setDiffuseMaterialSource(Context::MaterialSource diffuseMaterialSource); virtual void setDiffuseMaterialSource(MaterialSource diffuseMaterialSource);
virtual void setSpecularMaterialSource(Context::MaterialSource specularMaterialSource); virtual void setSpecularMaterialSource(MaterialSource specularMaterialSource);
virtual void setAmbientMaterialSource(Context::MaterialSource ambientMaterialSource); virtual void setAmbientMaterialSource(MaterialSource ambientMaterialSource);
virtual void setEmissiveMaterialSource(Context::MaterialSource emissiveMaterialSource); virtual void setEmissiveMaterialSource(MaterialSource emissiveMaterialSource);
virtual void setMaterialEmission(const Color<float> &emission); virtual void setMaterialEmission(const Color<float> &emission);
virtual void setMaterialAmbient(const Color<float> &materialAmbient); virtual void setMaterialAmbient(const Color<float> &materialAmbient);
...@@ -225,7 +225,7 @@ namespace sw ...@@ -225,7 +225,7 @@ namespace sw
virtual void setVertexBlendMatrixCount(unsigned int vertexBlendMatrixCount); virtual void setVertexBlendMatrixCount(unsigned int vertexBlendMatrixCount);
virtual void setTextureWrap(unsigned int stage, int mask); 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 setLocalViewer(bool localViewer);
virtual void setNormalizeNormals(bool normalizeNormals); virtual void setNormalizeNormals(bool normalizeNormals);
virtual void setTextureMatrix(int stage, const Matrix &T); virtual void setTextureMatrix(int stage, const Matrix &T);
......
...@@ -153,9 +153,9 @@ namespace sw ...@@ -153,9 +153,9 @@ namespace sw
Float4 interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective); Float4 interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective);
Float4 interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective); Float4 interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective);
void stencilTest(Registers &r, Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &cMask); void stencilTest(Registers &r, Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &cMask);
void stencilTest(Registers &r, Byte8 &value, Context::StencilCompareMode stencilCompareMode, bool CCW); void stencilTest(Registers &r, Byte8 &value, StencilCompareMode stencilCompareMode, bool CCW);
void stencilOperation(Registers &r, Byte8 &newValue, Byte8 &bufferValue, Context::StencilOperation stencilPassOperation, Context::StencilOperation stencilZFailOperation, Context::StencilOperation stencilFailOperation, bool CCW, Int &zMask, Int &sMask); void stencilOperation(Registers &r, Byte8 &newValue, Byte8 &bufferValue, StencilOperation stencilPassOperation, StencilOperation stencilZFailOperation, StencilOperation stencilFailOperation, bool CCW, Int &zMask, Int &sMask);
void stencilOperation(Registers &r, Byte8 &output, Byte8 &bufferValue, Context::StencilOperation operation, bool CCW); void stencilOperation(Registers &r, Byte8 &output, Byte8 &bufferValue, StencilOperation operation, bool CCW);
Bool depthTest(Registers &r, Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &sMask, Int &zMask, Int &cMask); Bool depthTest(Registers &r, Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &sMask, Int &zMask, Int &cMask);
void blendTexture(Registers &r, Vector4i &temp, Vector4i &texture, int stage); void blendTexture(Registers &r, Vector4i &temp, Vector4i &texture, int stage);
void alphaTest(Registers &r, Int &aMask, Short4 &alpha); void alphaTest(Registers &r, Int &aMask, Short4 &alpha);
...@@ -177,12 +177,12 @@ namespace sw ...@@ -177,12 +177,12 @@ namespace sw
void clampColor(Vector4f oC[4]); void clampColor(Vector4f oC[4]);
void rasterOperation(Vector4i &current, Registers &r, Float4 &fog, Pointer<Byte> &cBuffer, Int &x, Int sMask[4], Int zMask[4], Int cMask[4]); void rasterOperation(Vector4i &current, Registers &r, Float4 &fog, Pointer<Byte> &cBuffer, Int &x, Int sMask[4], Int zMask[4], Int cMask[4]);
void rasterOperation(Vector4f oC[4], Registers &r, Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]); void rasterOperation(Vector4f oC[4], Registers &r, Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]);
void blendFactor(Registers &r, const Vector4i &blendFactor, const Vector4i &current, const Vector4i &pixel, Context::BlendFactor blendFactorActive); void blendFactor(Registers &r, const Vector4i &blendFactor, const Vector4i &current, const Vector4i &pixel, BlendFactor blendFactorActive);
void blendFactorAlpha(Registers &r, const Vector4i &blendFactor, const Vector4i &current, const Vector4i &pixel, Context::BlendFactor blendFactorAlphaActive); void blendFactorAlpha(Registers &r, const Vector4i &blendFactor, const Vector4i &current, const Vector4i &pixel, BlendFactor blendFactorAlphaActive);
void alphaBlend(Registers &r, int index, Pointer<Byte> &cBuffer, Vector4i &current, Int &x); void alphaBlend(Registers &r, int index, Pointer<Byte> &cBuffer, Vector4i &current, Int &x);
void writeColor(Registers &r, int index, Pointer<Byte> &cBuffer, Int &i, Vector4i &current, Int &sMask, Int &zMask, Int &cMask); void writeColor(Registers &r, int index, Pointer<Byte> &cBuffer, Int &i, Vector4i &current, Int &sMask, Int &zMask, Int &cMask);
void blendFactor(Registers &r, const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, Context::BlendFactor blendFactorActive); void blendFactor(Registers &r, const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorActive);
void blendFactorAlpha(Registers &r, const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, Context::BlendFactor blendFactorAlphaActive); void blendFactorAlpha(Registers &r, const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorAlphaActive);
void alphaBlend(Registers &r, int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x); void alphaBlend(Registers &r, int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x);
void writeColor(Registers &r, int index, Pointer<Byte> &cBuffer, Int &i, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask); void writeColor(Registers &r, int index, Pointer<Byte> &cBuffer, Int &i, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask);
void writeStencil(Registers &r, Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &zMask, Int &cMask); void writeStencil(Registers &r, Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &zMask, Int &cMask);
......
...@@ -95,11 +95,11 @@ namespace sw ...@@ -95,11 +95,11 @@ namespace sw
A = IfThenElse(w0w1w2 < 0, -A, A); A = IfThenElse(w0w1w2 < 0, -A, A);
if(state.cullMode == Context::CULL_CLOCKWISE) if(state.cullMode == CULL_CLOCKWISE)
{ {
If(A >= 0.0f) Return(false); If(A >= 0.0f) Return(false);
} }
else if(state.cullMode == Context::CULL_COUNTERCLOCKWISE) else if(state.cullMode == CULL_COUNTERCLOCKWISE)
{ {
If(A <= 0.0f) Return(false); If(A <= 0.0f) Return(false);
} }
......
...@@ -297,18 +297,18 @@ namespace sw ...@@ -297,18 +297,18 @@ namespace sw
Vector4f diff; Vector4f diff;
if(state.vertexDiffuseMaterialSourceActive == Context::MATERIAL) if(state.vertexDiffuseMaterialSourceActive == MATERIAL_MATERIAL)
{ {
diff.x = diff.y = diff.z = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialDiffuse)); // FIXME: Unpack diff.x = diff.y = diff.z = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialDiffuse)); // FIXME: Unpack
diff.x = diff.x.xxxx; diff.x = diff.x.xxxx;
diff.y = diff.y.yyyy; diff.y = diff.y.yyyy;
diff.z = diff.z.zzzz; diff.z = diff.z.zzzz;
} }
else if(state.vertexDiffuseMaterialSourceActive == Context::COLOR1) else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR1)
{ {
diff = r.v[Color0]; diff = r.v[Color0];
} }
else if(state.vertexDiffuseMaterialSourceActive == Context::COLOR2) else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR2)
{ {
diff = r.v[Color1]; diff = r.v[Color1];
} }
...@@ -347,7 +347,7 @@ namespace sw ...@@ -347,7 +347,7 @@ namespace sw
Vector4f spec; Vector4f spec;
if(state.vertexSpecularMaterialSourceActive == Context::MATERIAL) if(state.vertexSpecularMaterialSourceActive == MATERIAL_MATERIAL)
{ {
Float4 materialSpecular = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialSpecular)); // FIXME: Unpack Float4 materialSpecular = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialSpecular)); // FIXME: Unpack
...@@ -355,11 +355,11 @@ namespace sw ...@@ -355,11 +355,11 @@ namespace sw
spec.y = materialSpecular.y; spec.y = materialSpecular.y;
spec.z = materialSpecular.z; spec.z = materialSpecular.z;
} }
else if(state.vertexSpecularMaterialSourceActive == Context::COLOR1) else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR1)
{ {
spec = r.v[Color0]; spec = r.v[Color0];
} }
else if(state.vertexSpecularMaterialSourceActive == Context::COLOR2) else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR2)
{ {
spec = r.v[Color1]; spec = r.v[Color1];
} }
...@@ -391,7 +391,7 @@ namespace sw ...@@ -391,7 +391,7 @@ namespace sw
r.o[D0].y = r.o[D0].y + globalAmbient.y; r.o[D0].y = r.o[D0].y + globalAmbient.y;
r.o[D0].z = r.o[D0].z + globalAmbient.z; r.o[D0].z = r.o[D0].z + globalAmbient.z;
if(state.vertexAmbientMaterialSourceActive == Context::MATERIAL) if(state.vertexAmbientMaterialSourceActive == MATERIAL_MATERIAL)
{ {
Float4 materialAmbient = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialAmbient)); // FIXME: Unpack Float4 materialAmbient = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialAmbient)); // FIXME: Unpack
...@@ -399,7 +399,7 @@ namespace sw ...@@ -399,7 +399,7 @@ namespace sw
r.o[D0].y = r.o[D0].y * materialAmbient.y; r.o[D0].y = r.o[D0].y * materialAmbient.y;
r.o[D0].z = r.o[D0].z * materialAmbient.z; r.o[D0].z = r.o[D0].z * materialAmbient.z;
} }
else if(state.vertexAmbientMaterialSourceActive == Context::COLOR1) else if(state.vertexAmbientMaterialSourceActive == MATERIAL_COLOR1)
{ {
Vector4f materialDiffuse = r.v[Color0]; Vector4f materialDiffuse = r.v[Color0];
...@@ -407,7 +407,7 @@ namespace sw ...@@ -407,7 +407,7 @@ namespace sw
r.o[D0].y = r.o[D0].y * materialDiffuse.y; r.o[D0].y = r.o[D0].y * materialDiffuse.y;
r.o[D0].z = r.o[D0].z * materialDiffuse.z; r.o[D0].z = r.o[D0].z * materialDiffuse.z;
} }
else if(state.vertexAmbientMaterialSourceActive == Context::COLOR2) else if(state.vertexAmbientMaterialSourceActive == MATERIAL_COLOR2)
{ {
Vector4f materialSpecular = r.v[Color1]; Vector4f materialSpecular = r.v[Color1];
...@@ -422,7 +422,7 @@ namespace sw ...@@ -422,7 +422,7 @@ namespace sw
r.o[D0].z = r.o[D0].z + diffuseSum.z; r.o[D0].z = r.o[D0].z + diffuseSum.z;
// Emissive // Emissive
if(state.vertexEmissiveMaterialSourceActive == Context::MATERIAL) if(state.vertexEmissiveMaterialSourceActive == MATERIAL_MATERIAL)
{ {
Float4 materialEmission = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialEmission)); // FIXME: Unpack Float4 materialEmission = *Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialEmission)); // FIXME: Unpack
...@@ -430,7 +430,7 @@ namespace sw ...@@ -430,7 +430,7 @@ namespace sw
r.o[D0].y = r.o[D0].y + materialEmission.y; r.o[D0].y = r.o[D0].y + materialEmission.y;
r.o[D0].z = r.o[D0].z + materialEmission.z; r.o[D0].z = r.o[D0].z + materialEmission.z;
} }
else if(state.vertexEmissiveMaterialSourceActive == Context::COLOR1) else if(state.vertexEmissiveMaterialSourceActive == MATERIAL_COLOR1)
{ {
Vector4f materialSpecular = r.v[Color0]; Vector4f materialSpecular = r.v[Color0];
...@@ -438,7 +438,7 @@ namespace sw ...@@ -438,7 +438,7 @@ namespace sw
r.o[D0].y = r.o[D0].y + materialSpecular.y; r.o[D0].y = r.o[D0].y + materialSpecular.y;
r.o[D0].z = r.o[D0].z + materialSpecular.z; r.o[D0].z = r.o[D0].z + materialSpecular.z;
} }
else if(state.vertexEmissiveMaterialSourceActive == Context::COLOR2) else if(state.vertexEmissiveMaterialSourceActive == MATERIAL_COLOR2)
{ {
Vector4f materialSpecular = r.v[Color1]; Vector4f materialSpecular = r.v[Color1];
...@@ -449,16 +449,16 @@ namespace sw ...@@ -449,16 +449,16 @@ namespace sw
else ASSERT(false); else ASSERT(false);
// Diffuse alpha component // Diffuse alpha component
if(state.vertexDiffuseMaterialSourceActive == Context::MATERIAL) if(state.vertexDiffuseMaterialSourceActive == MATERIAL_MATERIAL)
{ {
r.o[D0].w = Float4(*Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialDiffuse[0]))).wwww; // FIXME: Unpack r.o[D0].w = Float4(*Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialDiffuse[0]))).wwww; // FIXME: Unpack
} }
else if(state.vertexDiffuseMaterialSourceActive == Context::COLOR1) else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR1)
{ {
Vector4f alpha = r.v[Color0]; Vector4f alpha = r.v[Color0];
r.o[D0].w = alpha.w; r.o[D0].w = alpha.w;
} }
else if(state.vertexDiffuseMaterialSourceActive == Context::COLOR2) else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR2)
{ {
Vector4f alpha = r.v[Color1]; Vector4f alpha = r.v[Color1];
r.o[D0].w = alpha.w; r.o[D0].w = alpha.w;
...@@ -468,16 +468,16 @@ namespace sw ...@@ -468,16 +468,16 @@ namespace sw
if(state.vertexSpecularActive) if(state.vertexSpecularActive)
{ {
// Specular alpha component // Specular alpha component
if(state.vertexSpecularMaterialSourceActive == Context::MATERIAL) if(state.vertexSpecularMaterialSourceActive == MATERIAL_MATERIAL)
{ {
r.o[D1].w = Float4(*Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialSpecular[3]))).wwww; // FIXME: Unpack r.o[D1].w = Float4(*Pointer<Float4>(r.data + OFFSET(DrawData,ff.materialSpecular[3]))).wwww; // FIXME: Unpack
} }
else if(state.vertexSpecularMaterialSourceActive == Context::COLOR1) else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR1)
{ {
Vector4f alpha = r.v[Color0]; Vector4f alpha = r.v[Color0];
r.o[D1].w = alpha.w; r.o[D1].w = alpha.w;
} }
else if(state.vertexSpecularMaterialSourceActive == Context::COLOR2) else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR2)
{ {
Vector4f alpha = r.v[Color1]; Vector4f alpha = r.v[Color1];
r.o[D1].w = alpha.w; r.o[D1].w = alpha.w;
...@@ -490,7 +490,7 @@ namespace sw ...@@ -490,7 +490,7 @@ namespace sw
{ {
switch(state.vertexFogMode) switch(state.vertexFogMode)
{ {
case Context::FOG_NONE: case FOG_NONE:
if(state.specularActive) if(state.specularActive)
{ {
r.o[Fog].x = r.o[D1].w; r.o[Fog].x = r.o[D1].w;
...@@ -500,9 +500,9 @@ namespace sw ...@@ -500,9 +500,9 @@ namespace sw
r.o[Fog].x = Float4(0.0f); r.o[Fog].x = Float4(0.0f);
} }
break; break;
case Context::FOG_LINEAR: case FOG_LINEAR:
case Context::FOG_EXP: case FOG_EXP:
case Context::FOG_EXP2: case FOG_EXP2:
if(!state.rangeFogActive) if(!state.rangeFogActive)
{ {
r.o[Fog].x = r.o[Pos].z; r.o[Fog].x = r.o[Pos].z;
...@@ -542,7 +542,7 @@ namespace sw ...@@ -542,7 +542,7 @@ namespace sw
switch(state.textureState[stage].texGenActive) switch(state.textureState[stage].texGenActive)
{ {
case Context::TEXGEN_PASSTHRU: case TEXGEN_PASSTHRU:
{ {
Vector4f v = r.v[TexCoord0 + i]; Vector4f v = r.v[TexCoord0 + i];
...@@ -575,7 +575,7 @@ namespace sw ...@@ -575,7 +575,7 @@ namespace sw
} }
} }
break; break;
case Context::TEXGEN_NORMAL: case TEXGEN_NORMAL:
{ {
Vector4f Nc; // Normal vector in camera space Vector4f Nc; // Normal vector in camera space
...@@ -598,7 +598,7 @@ namespace sw ...@@ -598,7 +598,7 @@ namespace sw
r.o[T0 + stage].w = Nc.w; r.o[T0 + stage].w = Nc.w;
} }
break; break;
case Context::TEXGEN_POSITION: case TEXGEN_POSITION:
{ {
Vector4f Pn = transformBlend(r, r.v[Position], Pointer<Byte>(r.data + OFFSET(DrawData,ff.cameraTransformT)), true); // Position in camera space Vector4f Pn = transformBlend(r, r.v[Position], Pointer<Byte>(r.data + OFFSET(DrawData,ff.cameraTransformT)), true); // Position in camera space
...@@ -610,7 +610,7 @@ namespace sw ...@@ -610,7 +610,7 @@ namespace sw
r.o[T0 + stage].w = Pn.w; r.o[T0 + stage].w = Pn.w;
} }
break; break;
case Context::TEXGEN_REFLECTION: case TEXGEN_REFLECTION:
{ {
Vector4f R; // Reflection vector Vector4f R; // Reflection vector
...@@ -661,7 +661,7 @@ namespace sw ...@@ -661,7 +661,7 @@ namespace sw
r.o[T0 + stage].w = R.w; r.o[T0 + stage].w = R.w;
} }
break; break;
case Context::TEXGEN_SPHEREMAP: case TEXGEN_SPHEREMAP:
{ {
Vector4f R; // Reflection vector Vector4f R; // Reflection vector
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment