Disable scissor test when clearing on OpenGL (#4029)
This commit is contained in:
@@ -13,6 +13,7 @@ RenderPass::RenderPass(gl::CommandEncoder& commandEncoder_,
|
||||
debugGroup(commandEncoder.createDebugGroup(name)) {
|
||||
descriptor.renderable.getResource<gl::RenderableResource>().bind();
|
||||
const auto clearDebugGroup(commandEncoder.createDebugGroup("clear"));
|
||||
commandEncoder.context.setScissorTest({.x = 0, .y = 0, .width = 0, .height = 0});
|
||||
commandEncoder.context.clear(descriptor.clearColor, descriptor.clearDepth, descriptor.clearStencil);
|
||||
}
|
||||
|
||||
|
||||
@@ -230,9 +230,7 @@ void RenderPass::setScissorRect(MTL::ScissorRect rect) {
|
||||
if (rect.height + rect.y > height) {
|
||||
rect.height = height - rect.y;
|
||||
}
|
||||
if (rect.x != 0 || rect.y != 0 || rect.width != 0 || rect.height != 0) {
|
||||
encoder->setScissorRect(rect);
|
||||
}
|
||||
encoder->setScissorRect(rect);
|
||||
currentScissorRect = rect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ void RenderTarget::render(RenderOrchestrator& orchestrator, const RenderTree& re
|
||||
.clearStencil = {}});
|
||||
|
||||
const gfx::ScissorRect prevScissorRect = parameters.scissorRect;
|
||||
parameters.scissorRect = {.x = 0, .y = 0, .width = 0, .height = 0};
|
||||
const auto& size = getTexture()->getSize();
|
||||
parameters.scissorRect = {.x = 0, .y = 0, .width = size.width, .height = size.height};
|
||||
|
||||
// Run layer tweakers to update any dynamic elements
|
||||
parameters.currentLayer = 0;
|
||||
|
||||
@@ -188,20 +188,16 @@ void Renderer::Impl::render(const RenderTree& renderTree, const std::shared_ptr<
|
||||
const TransformState& state = renderTreeParameters.transformParams.state;
|
||||
const Size& size = state.getSize();
|
||||
const EdgeInsets& frustumOffset = state.getFrustumOffset();
|
||||
gfx::ScissorRect scissorRect = {.x = 0, .y = 0, .width = 0, .height = 0};
|
||||
if (!frustumOffset.isFlush()) {
|
||||
scissorRect = {
|
||||
.x = static_cast<int32_t>(frustumOffset.left() * pixelRatio),
|
||||
const gfx::ScissorRect scissorRect = {
|
||||
.x = static_cast<int32_t>(frustumOffset.left() * pixelRatio),
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
.y = static_cast<int32_t>(frustumOffset.bottom() * pixelRatio),
|
||||
.y = static_cast<int32_t>(frustumOffset.bottom() * pixelRatio),
|
||||
#else
|
||||
.y = static_cast<int32_t>(frustumOffset.top() * pixelRatio),
|
||||
.y = static_cast<int32_t>(frustumOffset.top() * pixelRatio),
|
||||
#endif
|
||||
.width = static_cast<uint32_t>((size.width - (frustumOffset.left() + frustumOffset.right())) * pixelRatio),
|
||||
.height = static_cast<uint32_t>((size.height - (frustumOffset.top() + frustumOffset.bottom())) *
|
||||
pixelRatio),
|
||||
};
|
||||
}
|
||||
.width = static_cast<uint32_t>((size.width - (frustumOffset.left() + frustumOffset.right())) * pixelRatio),
|
||||
.height = static_cast<uint32_t>((size.height - (frustumOffset.top() + frustumOffset.bottom())) * pixelRatio),
|
||||
};
|
||||
|
||||
PaintParameters parameters{
|
||||
context,
|
||||
|
||||
@@ -429,10 +429,7 @@ void PipelineInfo::setDynamicValues(const RendererBackend& backend, const vk::Un
|
||||
const vk::Viewport viewport(0.0f, 0.0f, viewExtent.width, viewExtent.height, 0.0f, 1.0f);
|
||||
|
||||
buffer->setViewport(0, viewport, dispatcher);
|
||||
if (scissorRect.offset.x != 0 || scissorRect.offset.y != 0 || scissorRect.extent.width != 0 ||
|
||||
scissorRect.extent.height != 0) {
|
||||
buffer->setScissor(0, scissorRect, dispatcher);
|
||||
}
|
||||
buffer->setScissor(0, scissorRect, dispatcher);
|
||||
}
|
||||
|
||||
std::vector<vk::DynamicState> PipelineInfo::getDynamicStates(const RendererBackend& backend) const {
|
||||
@@ -453,10 +450,7 @@ std::vector<vk::DynamicState> PipelineInfo::getDynamicStates(const RendererBacke
|
||||
}
|
||||
|
||||
dynamicStates.push_back(vk::DynamicState::eViewport);
|
||||
if (scissorRect.offset.x != 0 || scissorRect.offset.y != 0 || scissorRect.extent.width != 0 ||
|
||||
scissorRect.extent.height != 0) {
|
||||
dynamicStates.push_back(vk::DynamicState::eScissor);
|
||||
}
|
||||
dynamicStates.push_back(vk::DynamicState::eScissor);
|
||||
|
||||
return dynamicStates;
|
||||
}
|
||||
|
||||
@@ -841,14 +841,11 @@ void Drawable::draw(PaintParameters& parameters) const {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parameters.scissorRect.x != 0 || parameters.scissorRect.y != 0 || parameters.scissorRect.width != 0 ||
|
||||
parameters.scissorRect.height != 0) {
|
||||
wgpuRenderPassEncoderSetScissorRect(renderPassEncoder,
|
||||
parameters.scissorRect.x,
|
||||
parameters.scissorRect.y,
|
||||
parameters.scissorRect.width,
|
||||
parameters.scissorRect.height);
|
||||
}
|
||||
wgpuRenderPassEncoderSetScissorRect(renderPassEncoder,
|
||||
parameters.scissorRect.x,
|
||||
parameters.scissorRect.y,
|
||||
parameters.scissorRect.width,
|
||||
parameters.scissorRect.height);
|
||||
|
||||
uint32_t bufferSlot = 0;
|
||||
for (const auto& binding : uniqueBindings) {
|
||||
|
||||
@@ -175,6 +175,7 @@ RenderPass::RenderPass(CommandEncoder& commandEncoder_, const char* name, const
|
||||
auto size = descriptor.renderable.getSize();
|
||||
wgpuRenderPassEncoderSetViewport(
|
||||
impl->encoder, 0.0f, 0.0f, static_cast<float>(size.width), static_cast<float>(size.height), 0.0f, 1.0f);
|
||||
wgpuRenderPassEncoderSetScissorRect(impl->encoder, 0, 0, size.width, size.height);
|
||||
} else {
|
||||
mbgl::Log::Error(mbgl::Event::Render, "WebGPU: Failed to begin render pass");
|
||||
impl->colorView = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user