mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-11 05:14:56 +00:00
Merge pull request #3657 from ReinUsesLisp/viewport-zero
vk_rasterizer: Default to 1 viewports with a size of 0
This commit is contained in:
commit
0b132e8cc1
|
@ -62,13 +62,16 @@ constexpr auto ComputeShaderIndex = static_cast<std::size_t>(Tegra::Engines::Sha
|
||||||
|
|
||||||
VkViewport GetViewportState(const VKDevice& device, const Maxwell& regs, std::size_t index) {
|
VkViewport GetViewportState(const VKDevice& device, const Maxwell& regs, std::size_t index) {
|
||||||
const auto& src = regs.viewport_transform[index];
|
const auto& src = regs.viewport_transform[index];
|
||||||
|
const float width = src.scale_x * 2.0f;
|
||||||
|
const float height = src.scale_y * 2.0f;
|
||||||
|
|
||||||
VkViewport viewport;
|
VkViewport viewport;
|
||||||
viewport.x = src.translate_x - src.scale_x;
|
viewport.x = src.translate_x - src.scale_x;
|
||||||
viewport.y = src.translate_y - src.scale_y;
|
viewport.y = src.translate_y - src.scale_y;
|
||||||
viewport.width = src.scale_x * 2.0f;
|
viewport.width = width != 0.0f ? width : 1.0f;
|
||||||
viewport.height = src.scale_y * 2.0f;
|
viewport.height = height != 0.0f ? height : 1.0f;
|
||||||
|
|
||||||
const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne;
|
const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f;
|
||||||
viewport.minDepth = src.translate_z - src.scale_z * reduce_z;
|
viewport.minDepth = src.translate_z - src.scale_z * reduce_z;
|
||||||
viewport.maxDepth = src.translate_z + src.scale_z;
|
viewport.maxDepth = src.translate_z + src.scale_z;
|
||||||
if (!device.IsExtDepthRangeUnrestrictedSupported()) {
|
if (!device.IsExtDepthRangeUnrestrictedSupported()) {
|
||||||
|
|
Loading…
Reference in a new issue