Commit 37f2bd82 by Chris Forbes

Remove more stale renderer plumbing

alphaReference is not used. It previously provided a configurable threshold for alphaToCoverage, before that was explicitly managed by pipeline state. The sample mask is not dynamic state, so it can never change between draws without a complete context change. sRGB write control is not context state, it is determined by the image view format. Bug: b/118386749 Change-Id: Id631732fad52cf6b75c1635bcd7ef464dda10e54 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29649Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent eae5b965
...@@ -149,7 +149,6 @@ namespace sw ...@@ -149,7 +149,6 @@ namespace sw
cullMode = CULL_CLOCKWISE; cullMode = CULL_CLOCKWISE;
frontFacingCCW = true; frontFacingCCW = true;
alphaReference = 0.0f;
depthBias = 0.0f; depthBias = 0.0f;
slopeDepthBias = 0.0f; slopeDepthBias = 0.0f;
...@@ -170,7 +169,6 @@ namespace sw ...@@ -170,7 +169,6 @@ namespace sw
lineWidth = 1.0f; lineWidth = 1.0f;
writeSRGB = false;
sampleMask = 0xFFFFFFFF; sampleMask = 0xFFFFFFFF;
alphaToCoverage = false; alphaToCoverage = false;
} }
...@@ -245,13 +243,6 @@ namespace sw ...@@ -245,13 +243,6 @@ namespace sw
return modified; return modified;
} }
bool Context::setWriteSRGB(bool sRGB)
{
bool modified = (Context::writeSRGB != sRGB);
Context::writeSRGB = sRGB;
return modified;
}
bool Context::depthWriteActive() bool Context::depthWriteActive()
{ {
if(!depthBufferActive()) return false; if(!depthBufferActive()) return false;
......
...@@ -132,8 +132,6 @@ namespace sw ...@@ -132,8 +132,6 @@ namespace sw
VkBlendFactor destBlendFactorAlpha(); VkBlendFactor destBlendFactorAlpha();
VkBlendOp blendOperationAlpha(); VkBlendOp blendOperationAlpha();
VkLogicOp colorLogicOp();
VkPrimitiveTopology topology; VkPrimitiveTopology topology;
bool stencilEnable; bool stencilEnable;
...@@ -144,7 +142,6 @@ namespace sw ...@@ -144,7 +142,6 @@ namespace sw
// Pixel processor states // Pixel processor states
VkCullModeFlags cullMode; VkCullModeFlags cullMode;
bool frontFacingCCW; bool frontFacingCCW;
float alphaReference;
float depthBias; float depthBias;
float slopeDepthBias; float slopeDepthBias;
...@@ -160,11 +157,8 @@ namespace sw ...@@ -160,11 +157,8 @@ namespace sw
void *indexBuffer; void *indexBuffer;
vk::ImageView *renderTarget[RENDERTARGETS]; vk::ImageView *renderTarget[RENDERTARGETS];
unsigned int renderTargetLayer[RENDERTARGETS];
vk::ImageView *depthBuffer; vk::ImageView *depthBuffer;
unsigned int depthBufferLayer;
vk::ImageView *stencilBuffer; vk::ImageView *stencilBuffer;
unsigned int stencilBufferLayer;
vk::PipelineLayout const *pipelineLayout; vk::PipelineLayout const *pipelineLayout;
...@@ -197,7 +191,6 @@ namespace sw ...@@ -197,7 +191,6 @@ namespace sw
float lineWidth; float lineWidth;
int colorWriteMask[RENDERTARGETS]; // RGBA int colorWriteMask[RENDERTARGETS]; // RGBA
bool writeSRGB;
unsigned int sampleMask; unsigned int sampleMask;
unsigned int multiSampleMask; unsigned int multiSampleMask;
int sampleCount; int sampleCount;
......
...@@ -69,27 +69,19 @@ namespace sw ...@@ -69,27 +69,19 @@ namespace sw
routineCache = nullptr; routineCache = nullptr;
} }
void PixelProcessor::setRenderTarget(int index, vk::ImageView* renderTarget, unsigned int layer) void PixelProcessor::setRenderTarget(int index, vk::ImageView* renderTarget)
{ {
context->renderTarget[index] = renderTarget; context->renderTarget[index] = renderTarget;
context->renderTargetLayer[index] = layer;
} }
void PixelProcessor::setDepthBuffer(vk::ImageView *depthBuffer, unsigned int layer) void PixelProcessor::setDepthBuffer(vk::ImageView *depthBuffer)
{ {
context->depthBuffer = depthBuffer; context->depthBuffer = depthBuffer;
context->depthBufferLayer = layer;
} }
void PixelProcessor::setStencilBuffer(vk::ImageView *stencilBuffer, unsigned int layer) void PixelProcessor::setStencilBuffer(vk::ImageView *stencilBuffer)
{ {
context->stencilBuffer = stencilBuffer; context->stencilBuffer = stencilBuffer;
context->stencilBufferLayer = layer;
}
void PixelProcessor::setWriteSRGB(bool sRGB)
{
context->setWriteSRGB(sRGB);
} }
void PixelProcessor::setDepthBufferEnable(bool depthBufferEnable) void PixelProcessor::setDepthBufferEnable(bool depthBufferEnable)
...@@ -323,8 +315,7 @@ namespace sw ...@@ -323,8 +315,7 @@ namespace sw
state.targetFormat[i] = context->renderTargetInternalFormat(i); state.targetFormat[i] = context->renderTargetInternalFormat(i);
} }
state.writeSRGB = context->writeSRGB && context->renderTarget[0] && context->renderTarget[0]->getFormat().isSRGBwritable(); state.multiSample = static_cast<unsigned int>(context->sampleCount);
state.multiSample = context->sampleCount;
state.multiSampleMask = context->multiSampleMask; state.multiSampleMask = context->multiSampleMask;
if(state.multiSample > 1 && context->pixelShader) if(state.multiSample > 1 && context->pixelShader)
......
...@@ -58,7 +58,6 @@ namespace sw ...@@ -58,7 +58,6 @@ namespace sw
unsigned int colorWriteMask; unsigned int colorWriteMask;
VkFormat targetFormat[RENDERTARGETS]; VkFormat targetFormat[RENDERTARGETS];
bool writeSRGB;
unsigned int multiSample; unsigned int multiSample;
unsigned int multiSampleMask; unsigned int multiSampleMask;
bool alphaToCoverage; bool alphaToCoverage;
...@@ -127,20 +126,16 @@ namespace sw ...@@ -127,20 +126,16 @@ namespace sw
virtual ~PixelProcessor(); virtual ~PixelProcessor();
void setRenderTarget(int index, vk::ImageView *renderTarget, unsigned int layer = 0); void setRenderTarget(int index, vk::ImageView *renderTarget);
void setDepthBuffer(vk::ImageView *depthBuffer, unsigned int layer = 0); void setDepthBuffer(vk::ImageView *depthBuffer);
void setStencilBuffer(vk::ImageView *stencilBuffer, unsigned int layer = 0); void setStencilBuffer(vk::ImageView *stencilBuffer);
void setWriteSRGB(bool sRGB);
void setDepthBufferEnable(bool depthBufferEnable); void setDepthBufferEnable(bool depthBufferEnable);
void setDepthCompare(VkCompareOp depthCompareMode); void setDepthCompare(VkCompareOp depthCompareMode);
void setDepthWriteEnable(bool depthWriteEnable); void setDepthWriteEnable(bool depthWriteEnable);
void setCullMode(CullMode cullMode, bool frontFacingCCW); void setCullMode(CullMode cullMode, bool frontFacingCCW);
void setColorWriteMask(int index, int rgbaMask); void setColorWriteMask(int index, int rgbaMask);
void setColorLogicOpEnabled(bool colorLogicOpEnabled);
void setLogicalOperation(VkLogicOp logicalOperation);
void setBlendConstant(const Color<float> &blendConstant); void setBlendConstant(const Color<float> &blendConstant);
void setAlphaBlendEnable(bool alphaBlendEnable); void setAlphaBlendEnable(bool alphaBlendEnable);
......
...@@ -310,7 +310,6 @@ namespace sw ...@@ -310,7 +310,6 @@ namespace sw
updateConfiguration(); updateConfiguration();
int ms = context->sampleCount; int ms = context->sampleCount;
unsigned int oldMultiSampleMask = context->multiSampleMask;
context->multiSampleMask = context->sampleMask & ((unsigned)0xFFFFFFFF >> (32 - ms)); context->multiSampleMask = context->sampleMask & ((unsigned)0xFFFFFFFF >> (32 - ms));
if(!context->multiSampleMask) if(!context->multiSampleMask)
...@@ -330,7 +329,7 @@ namespace sw ...@@ -330,7 +329,7 @@ namespace sw
sync->lock(sw::PRIVATE); sync->lock(sw::PRIVATE);
if(update || oldMultiSampleMask != context->multiSampleMask) if(update)
{ {
vertexState = VertexProcessor::update(topology); vertexState = VertexProcessor::update(topology);
setupState = SetupProcessor::update(); setupState = SetupProcessor::update();
...@@ -507,8 +506,7 @@ namespace sw ...@@ -507,8 +506,7 @@ namespace sw
if(draw->renderTarget[index]) if(draw->renderTarget[index])
{ {
VkOffset3D offset = { 0, 0, static_cast<int32_t>(context->renderTargetLayer[index]) }; data->colorBuffer[index] = (unsigned int*)context->renderTarget[index]->getOffsetPointer({0, 0, 0}, VK_IMAGE_ASPECT_COLOR_BIT);
data->colorBuffer[index] = (unsigned int*)context->renderTarget[index]->getOffsetPointer(offset, VK_IMAGE_ASPECT_COLOR_BIT);
data->colorPitchB[index] = context->renderTarget[index]->rowPitchBytes(VK_IMAGE_ASPECT_COLOR_BIT, 0); data->colorPitchB[index] = context->renderTarget[index]->rowPitchBytes(VK_IMAGE_ASPECT_COLOR_BIT, 0);
data->colorSliceB[index] = context->renderTarget[index]->slicePitchBytes(VK_IMAGE_ASPECT_COLOR_BIT, 0); data->colorSliceB[index] = context->renderTarget[index]->slicePitchBytes(VK_IMAGE_ASPECT_COLOR_BIT, 0);
} }
...@@ -519,16 +517,14 @@ namespace sw ...@@ -519,16 +517,14 @@ namespace sw
if(draw->depthBuffer) if(draw->depthBuffer)
{ {
VkOffset3D offset = { 0, 0, static_cast<int32_t>(context->depthBufferLayer) }; data->depthBuffer = (float*)context->depthBuffer->getOffsetPointer({0, 0, 0}, VK_IMAGE_ASPECT_DEPTH_BIT);
data->depthBuffer = (float*)context->depthBuffer->getOffsetPointer(offset, VK_IMAGE_ASPECT_DEPTH_BIT);
data->depthPitchB = context->depthBuffer->rowPitchBytes(VK_IMAGE_ASPECT_DEPTH_BIT, 0); data->depthPitchB = context->depthBuffer->rowPitchBytes(VK_IMAGE_ASPECT_DEPTH_BIT, 0);
data->depthSliceB = context->depthBuffer->slicePitchBytes(VK_IMAGE_ASPECT_DEPTH_BIT, 0); data->depthSliceB = context->depthBuffer->slicePitchBytes(VK_IMAGE_ASPECT_DEPTH_BIT, 0);
} }
if(draw->stencilBuffer) if(draw->stencilBuffer)
{ {
VkOffset3D offset = { 0, 0, static_cast<int32_t>(context->stencilBufferLayer) }; data->stencilBuffer = (unsigned char*)context->stencilBuffer->getOffsetPointer({0, 0, 0}, VK_IMAGE_ASPECT_STENCIL_BIT);
data->stencilBuffer = (unsigned char*)context->stencilBuffer->getOffsetPointer(offset, VK_IMAGE_ASPECT_STENCIL_BIT);
data->stencilPitchB = context->stencilBuffer->rowPitchBytes(VK_IMAGE_ASPECT_STENCIL_BIT, 0); data->stencilPitchB = context->stencilBuffer->rowPitchBytes(VK_IMAGE_ASPECT_STENCIL_BIT, 0);
data->stencilSliceB = context->stencilBuffer->slicePitchBytes(VK_IMAGE_ASPECT_STENCIL_BIT, 0); data->stencilSliceB = context->stencilBuffer->slicePitchBytes(VK_IMAGE_ASPECT_STENCIL_BIT, 0);
} }
......
...@@ -125,13 +125,6 @@ namespace sw ...@@ -125,13 +125,6 @@ namespace sw
continue; continue;
} }
if(!postBlendSRGB && state.writeSRGB && !isSRGB(index))
{
c[index].x = linearToSRGB(c[index].x);
c[index].y = linearToSRGB(c[index].y);
c[index].z = linearToSRGB(c[index].z);
}
switch(state.targetFormat[index]) switch(state.targetFormat[index])
{ {
case VK_FORMAT_R5G6B5_UNORM_PACK16: case VK_FORMAT_R5G6B5_UNORM_PACK16:
......
...@@ -1104,7 +1104,7 @@ namespace sw ...@@ -1104,7 +1104,7 @@ namespace sw
UNIMPLEMENTED("VkFormat %d", state.targetFormat[index]); UNIMPLEMENTED("VkFormat %d", state.targetFormat[index]);
} }
if((postBlendSRGB && state.writeSRGB) || isSRGB(index)) if(postBlendSRGB || isSRGB(index))
{ {
sRGBtoLinear16_12_16(pixel); sRGBtoLinear16_12_16(pixel);
} }
...@@ -1231,7 +1231,7 @@ namespace sw ...@@ -1231,7 +1231,7 @@ namespace sw
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 || isSRGB(index))
{ {
linearToSRGB16_12_16(current); linearToSRGB16_12_16(current);
} }
...@@ -1857,7 +1857,7 @@ namespace sw ...@@ -1857,7 +1857,7 @@ namespace sw
UNIMPLEMENTED("VkFormat: %d", int(state.targetFormat[index])); UNIMPLEMENTED("VkFormat: %d", int(state.targetFormat[index]));
} }
if((postBlendSRGB && state.writeSRGB) || isSRGB(index)) if(postBlendSRGB || isSRGB(index))
{ {
sRGBtoLinear(pixel.x); sRGBtoLinear(pixel.x);
sRGBtoLinear(pixel.y); sRGBtoLinear(pixel.y);
......
...@@ -429,7 +429,7 @@ void CommandBuffer::ExecutionState::bindAttachments() ...@@ -429,7 +429,7 @@ void CommandBuffer::ExecutionState::bindAttachments()
if (attachmentReference.attachment != VK_ATTACHMENT_UNUSED) if (attachmentReference.attachment != VK_ATTACHMENT_UNUSED)
{ {
auto attachment = renderPassFramebuffer->getAttachment(attachmentReference.attachment); auto attachment = renderPassFramebuffer->getAttachment(attachmentReference.attachment);
renderer->setRenderTarget(i, attachment, 0); renderer->setRenderTarget(i, attachment);
} }
} }
...@@ -439,11 +439,11 @@ void CommandBuffer::ExecutionState::bindAttachments() ...@@ -439,11 +439,11 @@ void CommandBuffer::ExecutionState::bindAttachments()
auto attachment = renderPassFramebuffer->getAttachment(attachmentReference->attachment); auto attachment = renderPassFramebuffer->getAttachment(attachmentReference->attachment);
if (attachment->hasDepthAspect()) if (attachment->hasDepthAspect())
{ {
renderer->setDepthBuffer(attachment, 0); renderer->setDepthBuffer(attachment);
} }
if (attachment->hasStencilAspect()) if (attachment->hasStencilAspect())
{ {
renderer->setStencilBuffer(attachment, 0); renderer->setStencilBuffer(attachment);
} }
} }
} }
......
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