Commit 989b208c by Chris Forbes

Remove partial logic op support

Pastel 1.0 does not need to implement logic ops. From discussion with capn@, the existing support was only ever partial, and covered the exact needs of a special project. Change-Id: I3003227c4d29ab5d39e0ae6385207c87d22931e2 Reviewed-on: https://swiftshader-review.googlesource.com/c/25828Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 10547589
...@@ -229,9 +229,6 @@ namespace sw ...@@ -229,9 +229,6 @@ namespace sw
writeSRGB = false; writeSRGB = false;
sampleMask = 0xFFFFFFFF; sampleMask = 0xFFFFFFFF;
colorLogicOpEnabled = false;
logicalOperation = VK_LOGIC_OP_COPY;
} }
bool Context::setDepthBufferEnable(bool depthBufferEnable) bool Context::setDepthBufferEnable(bool depthBufferEnable)
...@@ -311,20 +308,6 @@ namespace sw ...@@ -311,20 +308,6 @@ namespace sw
return modified; return modified;
} }
bool Context::setColorLogicOpEnabled(bool enabled)
{
bool modified = (Context::colorLogicOpEnabled != enabled);
Context::colorLogicOpEnabled = enabled;
return modified;
}
bool Context::setLogicalOperation(VkLogicOp logicalOperation)
{
bool modified = (Context::logicalOperation != logicalOperation);
Context::logicalOperation = logicalOperation;
return modified;
}
bool Context::depthWriteActive() bool Context::depthWriteActive()
{ {
if(!depthBufferActive()) return false; if(!depthBufferActive()) return false;
...@@ -365,11 +348,6 @@ namespace sw ...@@ -365,11 +348,6 @@ namespace sw
return colorBlend || alphaBlend; return colorBlend || alphaBlend;
} }
VkLogicOp Context::colorLogicOp()
{
return colorLogicOpEnabled ? logicalOperation : VK_LOGIC_OP_COPY;
}
VkBlendFactor Context::sourceBlendFactor() VkBlendFactor Context::sourceBlendFactor()
{ {
if(!alphaBlendEnable) return VK_BLEND_FACTOR_ONE; if(!alphaBlendEnable) return VK_BLEND_FACTOR_ONE;
......
...@@ -137,9 +137,6 @@ namespace sw ...@@ -137,9 +137,6 @@ namespace sw
bool setColorWriteMask(int index, int colorWriteMask); bool setColorWriteMask(int index, int colorWriteMask);
bool setWriteSRGB(bool sRGB); bool setWriteSRGB(bool sRGB);
bool setColorLogicOpEnabled(bool colorLogicOpEnabled);
bool setLogicalOperation(VkLogicOp logicalOperation);
bool depthWriteActive(); bool depthWriteActive();
bool alphaTestActive(); bool alphaTestActive();
bool depthBufferActive(); bool depthBufferActive();
...@@ -233,9 +230,6 @@ namespace sw ...@@ -233,9 +230,6 @@ namespace sw
unsigned int sampleMask; unsigned int sampleMask;
unsigned int multiSampleMask; unsigned int multiSampleMask;
int sampleCount; int sampleCount;
bool colorLogicOpEnabled;
VkLogicOp logicalOperation;
}; };
} }
......
...@@ -94,16 +94,6 @@ namespace sw ...@@ -94,16 +94,6 @@ namespace sw
context->setWriteSRGB(sRGB); context->setWriteSRGB(sRGB);
} }
void PixelProcessor::setColorLogicOpEnabled(bool colorLogicOpEnabled)
{
context->setColorLogicOpEnabled(colorLogicOpEnabled);
}
void PixelProcessor::setLogicalOperation(VkLogicOp logicalOperation)
{
context->setLogicalOperation(logicalOperation);
}
void PixelProcessor::setDepthBufferEnable(bool depthBufferEnable) void PixelProcessor::setDepthBufferEnable(bool depthBufferEnable)
{ {
context->setDepthBufferEnable(depthBufferEnable); context->setDepthBufferEnable(depthBufferEnable);
...@@ -431,8 +421,6 @@ namespace sw ...@@ -431,8 +421,6 @@ namespace sw
state.blendOperationAlpha = context->blendOperationAlpha(); state.blendOperationAlpha = context->blendOperationAlpha();
} }
state.logicalOperation = context->colorLogicOp();
for(int i = 0; i < RENDERTARGETS; i++) for(int i = 0; i < RENDERTARGETS; i++)
{ {
state.colorWriteMask |= context->colorWriteActive(i) << (4 * i); state.colorWriteMask |= context->colorWriteActive(i) << (4 * i);
......
...@@ -77,8 +77,6 @@ namespace sw ...@@ -77,8 +77,6 @@ namespace sw
bool centroid; bool centroid;
bool frontFaceCCW; bool frontFaceCCW;
VkLogicOp logicalOperation;
Sampler::State sampler[TEXTURE_IMAGE_UNITS]; Sampler::State sampler[TEXTURE_IMAGE_UNITS];
}; };
......
...@@ -122,7 +122,6 @@ namespace sw ...@@ -122,7 +122,6 @@ namespace sw
if(state.multiSampleMask & (1 << q)) if(state.multiSampleMask & (1 << q))
{ {
alphaBlend(index, buffer, color, x); alphaBlend(index, buffer, color, x);
logicOperation(index, buffer, color, x);
writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]); writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
} }
} }
......
...@@ -1083,101 +1083,6 @@ namespace sw ...@@ -1083,101 +1083,6 @@ namespace sw
} }
} }
void PixelRoutine::logicOperation(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x)
{
if(state.logicalOperation == VK_LOGIC_OP_COPY)
{
return;
}
Vector4s pixel;
readPixel(index, cBuffer, x, pixel);
switch(state.logicalOperation)
{
case VK_LOGIC_OP_CLEAR:
current.x = UShort4(0);
current.y = UShort4(0);
current.z = UShort4(0);
break;
case VK_LOGIC_OP_SET:
current.x = UShort4(0xFFFFu);
current.y = UShort4(0xFFFFu);
current.z = UShort4(0xFFFFu);
break;
case VK_LOGIC_OP_COPY:
ASSERT(false); // Optimized out
break;
case VK_LOGIC_OP_COPY_INVERTED:
current.x = ~current.x;
current.y = ~current.y;
current.z = ~current.z;
break;
case VK_LOGIC_OP_NO_OP:
current.x = pixel.x;
current.y = pixel.y;
current.z = pixel.z;
break;
case VK_LOGIC_OP_INVERT:
current.x = ~pixel.x;
current.y = ~pixel.y;
current.z = ~pixel.z;
break;
case VK_LOGIC_OP_AND:
current.x = pixel.x & current.x;
current.y = pixel.y & current.y;
current.z = pixel.z & current.z;
break;
case VK_LOGIC_OP_NAND:
current.x = ~(pixel.x & current.x);
current.y = ~(pixel.y & current.y);
current.z = ~(pixel.z & current.z);
break;
case VK_LOGIC_OP_OR:
current.x = pixel.x | current.x;
current.y = pixel.y | current.y;
current.z = pixel.z | current.z;
break;
case VK_LOGIC_OP_NOR:
current.x = ~(pixel.x | current.x);
current.y = ~(pixel.y | current.y);
current.z = ~(pixel.z | current.z);
break;
case VK_LOGIC_OP_XOR:
current.x = pixel.x ^ current.x;
current.y = pixel.y ^ current.y;
current.z = pixel.z ^ current.z;
break;
case VK_LOGIC_OP_EQUIVALENT:
current.x = ~(pixel.x ^ current.x);
current.y = ~(pixel.y ^ current.y);
current.z = ~(pixel.z ^ current.z);
break;
case VK_LOGIC_OP_AND_REVERSE:
current.x = ~pixel.x & current.x;
current.y = ~pixel.y & current.y;
current.z = ~pixel.z & current.z;
break;
case VK_LOGIC_OP_AND_INVERTED:
current.x = pixel.x & ~current.x;
current.y = pixel.y & ~current.y;
current.z = pixel.z & ~current.z;
break;
case VK_LOGIC_OP_OR_REVERSE:
current.x = ~pixel.x | current.x;
current.y = ~pixel.y | current.y;
current.z = ~pixel.z | current.z;
break;
case VK_LOGIC_OP_OR_INVERTED:
current.x = pixel.x | ~current.x;
current.y = pixel.y | ~current.y;
current.z = pixel.z | ~current.z;
break;
default:
ASSERT(false);
}
}
void PixelRoutine::writeColor(int index, Pointer<Byte> &cBuffer, Int &x, Vector4s &current, Int &sMask, Int &zMask, Int &cMask) void PixelRoutine::writeColor(int index, Pointer<Byte> &cBuffer, Int &x, Vector4s &current, Int &sMask, Int &zMask, Int &cMask)
{ {
if((postBlendSRGB && state.writeSRGB) || isSRGB(index)) if((postBlendSRGB && state.writeSRGB) || isSRGB(index))
......
...@@ -51,7 +51,6 @@ namespace sw ...@@ -51,7 +51,6 @@ namespace sw
// Raster operations // Raster operations
void alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x); void alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x);
void logicOperation(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x);
void writeColor(int index, Pointer<Byte> &cBuffer, Int &i, Vector4s &current, Int &sMask, Int &zMask, Int &cMask); void writeColor(int index, Pointer<Byte> &cBuffer, Int &i, Vector4s &current, Int &sMask, Int &zMask, Int &cMask);
void alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x); void alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x);
void writeColor(int index, Pointer<Byte> &cBuffer, Int &i, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask); void writeColor(int index, Pointer<Byte> &cBuffer, Int &i, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask);
......
...@@ -366,8 +366,6 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -366,8 +366,6 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
context.colorLogicOpEnabled = colorBlendState->logicOpEnable;
context.logicalOperation = colorBlendState->logicOp;
blendConstants.r = colorBlendState->blendConstants[0]; blendConstants.r = colorBlendState->blendConstants[0];
blendConstants.g = colorBlendState->blendConstants[1]; blendConstants.g = colorBlendState->blendConstants[1];
blendConstants.b = colorBlendState->blendConstants[2]; blendConstants.b = colorBlendState->blendConstants[2];
......
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