Implement RenderPassEncoder::SetViewport: impl on backends
Implement SetViewport on the rest backends: D3D12 and Metal BUG=dawn:53 TEST=dawn_end2end_tests Change-Id: I2e552867080eb8c35db641d1a61b0341d2a0a048 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9020 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
472bd1ec29
commit
c0b8132f55
|
@ -968,6 +968,19 @@ namespace dawn_native { namespace d3d12 {
|
|||
commandList->OMSetStencilRef(cmd->reference);
|
||||
} break;
|
||||
|
||||
case Command::SetViewport: {
|
||||
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
|
||||
D3D12_VIEWPORT viewport;
|
||||
viewport.TopLeftX = cmd->x;
|
||||
viewport.TopLeftY = cmd->y;
|
||||
viewport.Width = cmd->width;
|
||||
viewport.Height = cmd->height;
|
||||
viewport.MinDepth = cmd->minDepth;
|
||||
viewport.MaxDepth = cmd->maxDepth;
|
||||
|
||||
commandList->RSSetViewports(1, &viewport);
|
||||
} break;
|
||||
|
||||
case Command::SetScissorRect: {
|
||||
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
|
||||
D3D12_RECT rect;
|
||||
|
|
|
@ -825,6 +825,19 @@ namespace dawn_native { namespace metal {
|
|||
[encoder setStencilReferenceValue:cmd->reference];
|
||||
} break;
|
||||
|
||||
case Command::SetViewport: {
|
||||
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
|
||||
MTLViewport viewport;
|
||||
viewport.originX = cmd->x;
|
||||
viewport.originY = cmd->y;
|
||||
viewport.width = cmd->width;
|
||||
viewport.height = cmd->height;
|
||||
viewport.znear = cmd->minDepth;
|
||||
viewport.zfar = cmd->maxDepth;
|
||||
|
||||
[encoder setViewport:viewport];
|
||||
} break;
|
||||
|
||||
case Command::SetScissorRect: {
|
||||
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
|
||||
MTLScissorRect rect;
|
||||
|
|
|
@ -811,8 +811,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
case Command::SetViewport: {
|
||||
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
|
||||
gl.Viewport(static_cast<int>(cmd->x), static_cast<int>(cmd->y),
|
||||
static_cast<int>(cmd->width), static_cast<int>(cmd->height));
|
||||
gl.ViewportIndexedf(0, cmd->x, cmd->y, cmd->width, cmd->height);
|
||||
gl.DepthRangef(cmd->minDepth, cmd->maxDepth);
|
||||
} break;
|
||||
|
||||
|
|
|
@ -364,4 +364,4 @@ TEST_P(ViewportTest, ShrinkViewportAndShiftToBottomRightAndApplyDepth) {
|
|||
DoTest(info);
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(ViewportTest, OpenGLBackend, VulkanBackend);
|
||||
DAWN_INSTANTIATE_TEST(ViewportTest, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend);
|
||||
|
|
Loading…
Reference in New Issue