Commit 895aa621 by Nicolas Capens

Eliminate intermediate primitive type translation.

Bug 21305111 Change-Id: I3803f274f25a25ec60f0f5cbfc4af0151f39ad04 Reviewed-on: https://swiftshader-review.googlesource.com/4505Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent ae05d655
......@@ -189,7 +189,7 @@ Context::Context(const egl::Config *config, const Context *shareContext)
lightModelTwoSide = false;
matrixMode = GL_MODELVIEW;
for(int i = 0; i < MAX_TEXTURE_UNITS; i++)
{
texture2Denabled[i] = false;
......@@ -2044,7 +2044,7 @@ void Context::applyTextures()
for(int unit = 0; unit < MAX_TEXTURE_UNITS; unit++)
{
Texture *texture = nullptr;
if(textureExternalEnabled[unit])
{
texture = getSamplerTexture(unit, TEXTURE_EXTERNAL);
......@@ -2685,10 +2685,10 @@ void Context::clear(GLbitfield mask)
void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
{
PrimitiveType primitiveType;
sw::DrawType primitiveType;
int primitiveCount;
if(!es2sw::ConvertPrimitiveType(mode, count, primitiveType, primitiveCount))
if(!es2sw::ConvertPrimitiveType(mode, count, GL_NONE, primitiveType, primitiveCount))
return error(GL_INVALID_ENUM);
if(primitiveCount <= 0)
......@@ -2724,10 +2724,10 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *
return error(GL_INVALID_OPERATION);
}
PrimitiveType primitiveType;
sw::DrawType primitiveType;
int primitiveCount;
if(!es2sw::ConvertPrimitiveType(mode, count, primitiveType, primitiveCount))
if(!es2sw::ConvertPrimitiveType(mode, count, type, primitiveType, primitiveCount))
return error(GL_INVALID_ENUM);
if(primitiveCount <= 0)
......@@ -2760,7 +2760,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *
if(!cullSkipsDraw(mode))
{
device->drawIndexedPrimitive(primitiveType, indexInfo.indexOffset, primitiveCount, IndexDataManager::typeSize(type));
device->drawIndexedPrimitive(primitiveType, indexInfo.indexOffset, primitiveCount);
}
}
......
......@@ -31,8 +31,8 @@ namespace es1
Device::Device(Context *context) : Renderer(context, OpenGL, true), context(context)
{
depthStencil = 0;
renderTarget = 0;
depthStencil = nullptr;
renderTarget = nullptr;
setDepthBufferEnable(true);
setFillMode(FILL_SOLID);
......@@ -120,17 +120,17 @@ namespace es1
}
Device::~Device()
{
{
if(depthStencil)
{
depthStencil->release();
depthStencil = 0;
depthStencil = nullptr;
}
if(renderTarget)
{
renderTarget->release();
renderTarget = 0;
renderTarget = nullptr;
}
delete context;
......@@ -191,7 +191,7 @@ namespace es1
if(width > scissorRect.x1 - scissorRect.x0) width = scissorRect.x1 - scissorRect.x0;
if(height > scissorRect.y1 - scissorRect.y0) height = scissorRect.y1 - scissorRect.y0;
}
depthStencil->clearDepthBuffer(z, x0, y0, width, height);
}
......@@ -225,7 +225,7 @@ namespace es1
ERR("Invalid parameters: %dx%d", width, height);
return 0;
}
bool lockable = true;
switch(format)
......@@ -277,90 +277,30 @@ namespace es1
ERR("Out of memory");
return 0;
}
return surface;
}
void Device::drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize)
void Device::drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount)
{
if(!bindResources() || !primitiveCount)
{
return;
}
DrawType drawType;
if(indexSize == 4)
{
switch(type)
{
case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST32; break;
case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST32; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP32; break;
case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP32; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST32; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP32; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN32; break;
default: UNREACHABLE(type);
}
}
else if(indexSize == 2)
{
switch(type)
{
case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST16; break;
case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST16; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP16; break;
case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP16; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST16; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP16; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN16; break;
default: UNREACHABLE(type);
}
}
else if(indexSize == 1)
{
switch(type)
{
case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST8; break;
case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST8; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP8; break;
case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP8; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST8; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP8; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN8; break;
default: UNREACHABLE(type);
}
}
else UNREACHABLE(indexSize);
draw(drawType, indexOffset, primitiveCount);
draw(type, indexOffset, primitiveCount);
}
void Device::drawPrimitive(PrimitiveType primitiveType, unsigned int primitiveCount)
void Device::drawPrimitive(sw::DrawType type, unsigned int primitiveCount)
{
if(!bindResources() || !primitiveCount)
{
return;
}
setIndexBuffer(0);
DrawType drawType;
switch(primitiveType)
{
case DRAW_POINTLIST: drawType = sw::DRAW_POINTLIST; break;
case DRAW_LINELIST: drawType = sw::DRAW_LINELIST; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_LINESTRIP; break;
case DRAW_LINELOOP: drawType = sw::DRAW_LINELOOP; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_TRIANGLELIST; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_TRIANGLESTRIP; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_TRIANGLEFAN; break;
default: UNREACHABLE(primitiveType);
}
setIndexBuffer(nullptr);
draw(drawType, 0, primitiveCount);
draw(type, 0, primitiveCount);
}
void Device::setDepthStencilSurface(egl::Image *depthStencil)
......@@ -424,7 +364,7 @@ namespace es1
ERR("Invalid parameters");
return false;
}
int sWidth = source->getWidth();
int sHeight = source->getHeight();
int dWidth = dest->getWidth();
......@@ -535,7 +475,7 @@ namespace es1
destBytes[4 * x + 3] = 0xFF;
}
}
sourceBytes += sourcePitch;
destBytes += destPitch;
}
......@@ -560,7 +500,7 @@ namespace es1
return true;
}
bool Device::bindViewport()
{
if(viewport.width <= 0 || viewport.height <= 0)
......@@ -580,7 +520,7 @@ namespace es1
scissor.x1 = scissorRect.x1;
scissor.y0 = scissorRect.y0;
scissor.y1 = scissorRect.y1;
setScissor(scissor);
}
else
......@@ -590,7 +530,7 @@ namespace es1
scissor.x1 = viewport.x0 + viewport.width;
scissor.y0 = viewport.y0;
scissor.y1 = viewport.y0 + viewport.height;
if(renderTarget)
{
scissor.x0 = max(scissor.x0, 0);
......@@ -617,7 +557,7 @@ namespace es1
view.height = (float)viewport.height;
view.minZ = viewport.minZ;
view.maxZ = viewport.maxZ;
Renderer::setViewport(view);
return true;
......
......@@ -23,17 +23,6 @@ namespace es1
{
class Texture;
enum PrimitiveType
{
DRAW_POINTLIST,
DRAW_LINELIST,
DRAW_LINESTRIP,
DRAW_LINELOOP,
DRAW_TRIANGLELIST,
DRAW_TRIANGLESTRIP,
DRAW_TRIANGLEFAN
};
struct Viewport
{
int x0;
......@@ -56,8 +45,8 @@ namespace es1
virtual void clearStencil(unsigned int stencil, unsigned int mask);
virtual egl::Image *createDepthStencilSurface(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
virtual egl::Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable);
virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize);
virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount);
virtual void drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount);
virtual void drawPrimitive(sw::DrawType type, unsigned int primiveCount);
virtual void setDepthStencilSurface(egl::Image *newDepthStencil);
virtual void setScissorEnable(bool enable);
virtual void setRenderTarget(int index, egl::Image *renderTarget);
......
......@@ -434,42 +434,54 @@ namespace es2sw
}
}
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es1::PrimitiveType &swPrimitiveType, int &primitiveCount)
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, GLenum elementType, sw::DrawType &drawType, int &primitiveCount)
{
switch(primitiveType)
{
case GL_POINTS:
swPrimitiveType = es1::DRAW_POINTLIST;
drawType = sw::DRAW_POINTLIST;
primitiveCount = elementCount;
break;
case GL_LINES:
swPrimitiveType = es1::DRAW_LINELIST;
drawType = sw::DRAW_LINELIST;
primitiveCount = elementCount / 2;
break;
case GL_LINE_LOOP:
swPrimitiveType = es1::DRAW_LINELOOP;
drawType = sw::DRAW_LINELOOP;
primitiveCount = elementCount;
break;
case GL_LINE_STRIP:
swPrimitiveType = es1::DRAW_LINESTRIP;
drawType = sw::DRAW_LINESTRIP;
primitiveCount = elementCount - 1;
break;
case GL_TRIANGLES:
swPrimitiveType = es1::DRAW_TRIANGLELIST;
drawType = sw::DRAW_TRIANGLELIST;
primitiveCount = elementCount / 3;
break;
case GL_TRIANGLE_STRIP:
swPrimitiveType = es1::DRAW_TRIANGLESTRIP;
drawType = sw::DRAW_TRIANGLESTRIP;
primitiveCount = elementCount - 2;
break;
case GL_TRIANGLE_FAN:
swPrimitiveType = es1::DRAW_TRIANGLEFAN;
drawType = sw::DRAW_TRIANGLEFAN;
primitiveCount = elementCount - 2;
break;
default:
return false;
}
sw::DrawType elementSize;
switch(elementType)
{
case GL_NONE: elementSize = sw::DRAW_NONINDEXED; break;
case GL_UNSIGNED_BYTE: elementSize = sw::DRAW_INDEXED8; break;
case GL_UNSIGNED_SHORT: elementSize = sw::DRAW_INDEXED16; break;
case GL_UNSIGNED_INT: elementSize = sw::DRAW_INDEXED32; break;
default: return false;
}
drawType = sw::DrawType(drawType | elementSize);
return true;
}
......
......@@ -59,7 +59,7 @@ namespace es2sw
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
sw::MipmapType ConvertMipMapFilter(GLenum minFilter);
sw::FilterType ConvertTextureFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es1::PrimitiveType &swPrimitiveType, int &primitiveCount);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, GLenum elementType, sw::DrawType &swPrimitiveType, int &primitiveCount);
sw::Format ConvertRenderbufferFormat(GLenum format);
sw::TextureStage::StageOperation ConvertCombineOperation(GLenum operation);
sw::TextureStage::SourceArgument ConvertSourceArgument(GLenum argument);
......
......@@ -3436,10 +3436,10 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan
return error(GL_INVALID_OPERATION);
}
PrimitiveType primitiveType;
sw::DrawType primitiveType;
int primitiveCount;
if(!es2sw::ConvertPrimitiveType(mode, count, primitiveType, primitiveCount))
if(!es2sw::ConvertPrimitiveType(mode, count, GL_NONE, primitiveType, primitiveCount))
return error(GL_INVALID_ENUM);
if(primitiveCount <= 0)
......@@ -3491,10 +3491,10 @@ void Context::drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
return error(GL_INVALID_OPERATION);
}
PrimitiveType primitiveType;
sw::DrawType primitiveType;
int primitiveCount;
if(!es2sw::ConvertPrimitiveType(mode, count, primitiveType, primitiveCount))
if(!es2sw::ConvertPrimitiveType(mode, count, type, primitiveType, primitiveCount))
return error(GL_INVALID_ENUM);
if(primitiveCount <= 0)
......@@ -3537,7 +3537,7 @@ void Context::drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
if(!cullSkipsDraw(mode))
{
device->drawIndexedPrimitive(primitiveType, indexInfo.indexOffset, primitiveCount, IndexDataManager::typeSize(type));
device->drawIndexedPrimitive(primitiveType, indexInfo.indexOffset, primitiveCount);
}
}
}
......
......@@ -299,86 +299,26 @@ namespace es2
return surface;
}
void Device::drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize)
void Device::drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount)
{
if(!bindResources() || !primitiveCount)
{
return;
}
DrawType drawType;
if(indexSize == 4)
{
switch(type)
{
case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST32; break;
case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST32; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP32; break;
case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP32; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST32; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP32; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN32; break;
default: UNREACHABLE(type);
}
}
else if(indexSize == 2)
{
switch(type)
{
case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST16; break;
case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST16; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP16; break;
case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP16; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST16; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP16; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN16; break;
default: UNREACHABLE(type);
}
}
else if(indexSize == 1)
{
switch(type)
{
case DRAW_POINTLIST: drawType = sw::DRAW_INDEXEDPOINTLIST8; break;
case DRAW_LINELIST: drawType = sw::DRAW_INDEXEDLINELIST8; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_INDEXEDLINESTRIP8; break;
case DRAW_LINELOOP: drawType = sw::DRAW_INDEXEDLINELOOP8; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_INDEXEDTRIANGLELIST8; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_INDEXEDTRIANGLESTRIP8; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_INDEXEDTRIANGLEFAN8; break;
default: UNREACHABLE(type);
}
}
else UNREACHABLE(indexSize);
draw(drawType, indexOffset, primitiveCount);
draw(type, indexOffset, primitiveCount);
}
void Device::drawPrimitive(PrimitiveType primitiveType, unsigned int primitiveCount)
void Device::drawPrimitive(sw::DrawType type, unsigned int primitiveCount)
{
if(!bindResources() || !primitiveCount)
{
return;
}
setIndexBuffer(0);
DrawType drawType;
switch(primitiveType)
{
case DRAW_POINTLIST: drawType = sw::DRAW_POINTLIST; break;
case DRAW_LINELIST: drawType = sw::DRAW_LINELIST; break;
case DRAW_LINESTRIP: drawType = sw::DRAW_LINESTRIP; break;
case DRAW_LINELOOP: drawType = sw::DRAW_LINELOOP; break;
case DRAW_TRIANGLELIST: drawType = sw::DRAW_TRIANGLELIST; break;
case DRAW_TRIANGLESTRIP: drawType = sw::DRAW_TRIANGLESTRIP; break;
case DRAW_TRIANGLEFAN: drawType = sw::DRAW_TRIANGLEFAN; break;
default: UNREACHABLE(primitiveType);
}
setIndexBuffer(nullptr);
draw(drawType, 0, primitiveCount);
draw(type, 0, primitiveCount);
}
void Device::setDepthStencilSurface(egl::Image *depthStencil)
......
......@@ -23,17 +23,6 @@ namespace es2
{
class Texture;
enum PrimitiveType
{
DRAW_POINTLIST,
DRAW_LINELIST,
DRAW_LINESTRIP,
DRAW_LINELOOP,
DRAW_TRIANGLELIST,
DRAW_TRIANGLESTRIP,
DRAW_TRIANGLEFAN
};
struct Viewport
{
int x0;
......@@ -56,8 +45,8 @@ namespace es2
virtual void clearStencil(unsigned int stencil, unsigned int mask);
virtual egl::Image *createDepthStencilSurface(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
virtual egl::Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable);
virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize);
virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount);
virtual void drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount);
virtual void drawPrimitive(sw::DrawType type, unsigned int primiveCount);
virtual void setDepthStencilSurface(egl::Image *newDepthStencil);
virtual void setPixelShader(sw::PixelShader *shader);
virtual void setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
......
......@@ -1234,42 +1234,54 @@ namespace es2sw
}
}
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es2::PrimitiveType &swPrimitiveType, int &primitiveCount)
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, GLenum elementType, sw::DrawType &drawType, int &primitiveCount)
{
switch(primitiveType)
{
case GL_POINTS:
swPrimitiveType = es2::DRAW_POINTLIST;
drawType = sw::DRAW_POINTLIST;
primitiveCount = elementCount;
break;
case GL_LINES:
swPrimitiveType = es2::DRAW_LINELIST;
drawType = sw::DRAW_LINELIST;
primitiveCount = elementCount / 2;
break;
case GL_LINE_LOOP:
swPrimitiveType = es2::DRAW_LINELOOP;
drawType = sw::DRAW_LINELOOP;
primitiveCount = elementCount;
break;
case GL_LINE_STRIP:
swPrimitiveType = es2::DRAW_LINESTRIP;
drawType = sw::DRAW_LINESTRIP;
primitiveCount = elementCount - 1;
break;
case GL_TRIANGLES:
swPrimitiveType = es2::DRAW_TRIANGLELIST;
drawType = sw::DRAW_TRIANGLELIST;
primitiveCount = elementCount / 3;
break;
case GL_TRIANGLE_STRIP:
swPrimitiveType = es2::DRAW_TRIANGLESTRIP;
drawType = sw::DRAW_TRIANGLESTRIP;
primitiveCount = elementCount - 2;
break;
case GL_TRIANGLE_FAN:
swPrimitiveType = es2::DRAW_TRIANGLEFAN;
drawType = sw::DRAW_TRIANGLEFAN;
primitiveCount = elementCount - 2;
break;
default:
return false;
}
sw::DrawType elementSize;
switch(elementType)
{
case GL_NONE: elementSize = sw::DRAW_NONINDEXED; break;
case GL_UNSIGNED_BYTE: elementSize = sw::DRAW_INDEXED8; break;
case GL_UNSIGNED_SHORT: elementSize = sw::DRAW_INDEXED16; break;
case GL_UNSIGNED_INT: elementSize = sw::DRAW_INDEXED32; break;
default: return false;
}
drawType = sw::DrawType(drawType | elementSize);
return true;
}
......
......@@ -77,7 +77,7 @@ namespace es2sw
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
sw::MipmapType ConvertMipMapFilter(GLenum minFilter);
sw::FilterType ConvertTextureFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es2::PrimitiveType &swPrimitiveType, int &primitiveCount);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, GLenum elementType, sw::DrawType &swPrimitiveType, int &primitiveCount);
sw::Format ConvertRenderbufferFormat(GLenum format);
}
......
......@@ -216,7 +216,7 @@ namespace sw
textureWrapActive = false;
localViewer = true;
normalizeNormals = false;
for(int i = 0; i < RENDERTARGETS; ++i)
{
renderTarget[i] = 0;
......@@ -231,7 +231,7 @@ namespace sw
stencilPassOperation = OPERATION_KEEP;
stencilZFailOperation = OPERATION_KEEP;
stencilWriteMask = 0xFFFFFFFF;
twoSidedStencil = false;
stencilCompareModeCCW = STENCIL_ALWAYS;
stencilReferenceCCW = 0;
......@@ -361,7 +361,7 @@ namespace sw
{
Context::emissiveMaterialSource = emissiveMaterialSource;
}
void Context::setPointSpriteEnable(bool pointSpriteEnable)
{
Context::pointSpriteEnable = pointSpriteEnable;
......@@ -509,7 +509,7 @@ namespace sw
if(!alphaTestEnable) return false;
if(alphaCompareMode == ALPHA_ALWAYS) return false;
if(alphaReference == 0.0f && alphaCompareMode == ALPHA_GREATEREQUAL) return false;
return true;
}
......@@ -660,7 +660,7 @@ namespace sw
{
return MATERIAL_MATERIAL;
}
return diffuseMaterialSource;
}
......@@ -677,7 +677,7 @@ namespace sw
{
return MATERIAL_MATERIAL;
}
return specularMaterialSource;
}
......@@ -694,7 +694,7 @@ namespace sw
{
return MATERIAL_MATERIAL;
}
return ambientMaterialSource;
}
......@@ -711,7 +711,7 @@ namespace sw
{
return MATERIAL_MATERIAL;
}
return emissiveMaterialSource;
}
......@@ -766,7 +766,7 @@ namespace sw
case BLENDOP_MIN:
return BLEND_ONE;
case BLENDOP_MAX:
return BLEND_ONE;
return BLEND_ONE;
default:
ASSERT(false);
}
......@@ -787,7 +787,7 @@ namespace sw
case BLENDOP_MIN:
return BLEND_ONE;
case BLENDOP_MAX:
return BLEND_ONE;
return BLEND_ONE;
default:
ASSERT(false);
}
......@@ -924,7 +924,7 @@ namespace sw
case BLENDOP_MIN:
return BLEND_ONE;
case BLENDOP_MAX:
return BLEND_ONE;
return BLEND_ONE;
default:
ASSERT(false);
}
......@@ -950,7 +950,7 @@ namespace sw
case BLENDOP_MIN:
return BLEND_ONE;
case BLENDOP_MAX:
return BLEND_ONE;
return BLEND_ONE;
default:
ASSERT(false);
}
......@@ -1145,7 +1145,7 @@ namespace sw
return texGen[stage];
}
int Context::textureTransformCountActive(int stage)
{
if(vertexShader || !texCoordActive(stage))
......@@ -1248,7 +1248,7 @@ namespace sw
// Vertex processor provides diffuse component
bool vertexDiffuse;
if(vertexShader)
{
vertexDiffuse = vertexShader->output[D0][component].active();
......@@ -1311,7 +1311,7 @@ namespace sw
// Vertex processor provides specular component
bool vertexSpecular;
if(!vertexShader)
{
vertexSpecular = input[Color1] || (lightingEnable && specularEnable);
......
......@@ -51,38 +51,43 @@ namespace sw
enum DrawType : unsigned int
{
DRAW_POINTLIST,
DRAW_LINELIST,
DRAW_LINESTRIP,
DRAW_LINELOOP,
DRAW_TRIANGLELIST,
DRAW_TRIANGLESTRIP,
DRAW_TRIANGLEFAN,
DRAW_QUADLIST,
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_POINTLIST = 0x00,
DRAW_LINELIST = 0x01,
DRAW_LINESTRIP = 0x02,
DRAW_LINELOOP = 0x03,
DRAW_TRIANGLELIST = 0x04,
DRAW_TRIANGLESTRIP = 0x05,
DRAW_TRIANGLEFAN = 0x06,
DRAW_QUADLIST = 0x07,
DRAW_NONINDEXED = 0x00,
DRAW_INDEXED8 = 0x10,
DRAW_INDEXED16 = 0x20,
DRAW_INDEXED32 = 0x30,
DRAW_INDEXEDPOINTLIST8 = DRAW_POINTLIST | DRAW_INDEXED8,
DRAW_INDEXEDLINELIST8 = DRAW_LINELIST | DRAW_INDEXED8,
DRAW_INDEXEDLINESTRIP8 = DRAW_LINESTRIP | DRAW_INDEXED8,
DRAW_INDEXEDLINELOOP8 = DRAW_LINELOOP | DRAW_INDEXED8,
DRAW_INDEXEDTRIANGLELIST8 = DRAW_TRIANGLELIST | DRAW_INDEXED8,
DRAW_INDEXEDTRIANGLESTRIP8 = DRAW_TRIANGLESTRIP | DRAW_INDEXED8,
DRAW_INDEXEDTRIANGLEFAN8 = DRAW_TRIANGLEFAN | DRAW_INDEXED8,
DRAW_INDEXEDPOINTLIST16 = DRAW_POINTLIST | DRAW_INDEXED16,
DRAW_INDEXEDLINELIST16 = DRAW_LINELIST | DRAW_INDEXED16,
DRAW_INDEXEDLINESTRIP16 = DRAW_LINESTRIP | DRAW_INDEXED16,
DRAW_INDEXEDLINELOOP16 = DRAW_LINELOOP | DRAW_INDEXED16,
DRAW_INDEXEDTRIANGLELIST16 = DRAW_TRIANGLELIST | DRAW_INDEXED16,
DRAW_INDEXEDTRIANGLESTRIP16 = DRAW_TRIANGLESTRIP | DRAW_INDEXED16,
DRAW_INDEXEDTRIANGLEFAN16 = DRAW_TRIANGLEFAN | DRAW_INDEXED16,
DRAW_INDEXEDPOINTLIST32 = DRAW_POINTLIST | DRAW_INDEXED32,
DRAW_INDEXEDLINELIST32 = DRAW_LINELIST | DRAW_INDEXED32,
DRAW_INDEXEDLINESTRIP32 = DRAW_LINESTRIP | DRAW_INDEXED32,
DRAW_INDEXEDLINELOOP32 = DRAW_LINELOOP | DRAW_INDEXED32,
DRAW_INDEXEDTRIANGLELIST32 = DRAW_TRIANGLELIST | DRAW_INDEXED32,
DRAW_INDEXEDTRIANGLESTRIP32 = DRAW_TRIANGLESTRIP | DRAW_INDEXED32,
DRAW_INDEXEDTRIANGLEFAN32 = DRAW_TRIANGLEFAN | DRAW_INDEXED32,
DRAW_LAST = DRAW_INDEXEDTRIANGLEFAN32
};
......@@ -95,7 +100,7 @@ namespace sw
FILL_LAST = FILL_VERTEX
};
enum ShadingMode : unsigned int
{
SHADING_FLAT,
......@@ -283,7 +288,7 @@ namespace sw
void init();
const float &exp2Bias(); // NOTE: Needs address for JIT
const Point &getLightPosition(int light);
void setGlobalMipmapBias(float bias);
......@@ -404,7 +409,7 @@ namespace sw
StencilOperation stencilPassOperation;
StencilOperation stencilZFailOperation;
int stencilWriteMask;
bool twoSidedStencil;
StencilCompareMode stencilCompareModeCCW;
int stencilReferenceCCW;
......@@ -422,7 +427,7 @@ namespace sw
CullMode cullMode;
float alphaReference;
TextureStage textureStage[8];
Sampler sampler[TOTAL_IMAGE_UNITS];
......
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