2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-03-02 22:34:11 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-06-23 07:41:00 +02:00
|
|
|
#include "shader_recompiler/stage.h"
|
2019-03-02 22:34:11 +01:00
|
|
|
#include "video_core/engines/maxwell_3d.h"
|
|
|
|
#include "video_core/surface.h"
|
|
|
|
#include "video_core/textures/texture.h"
|
2020-12-26 05:19:46 +01:00
|
|
|
#include "video_core/vulkan_common/vulkan_device.h"
|
2020-12-25 01:30:11 +01:00
|
|
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
2019-03-02 22:34:11 +01:00
|
|
|
|
|
|
|
namespace Vulkan::MaxwellToVK {
|
|
|
|
|
|
|
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
|
|
|
using PixelFormat = VideoCore::Surface::PixelFormat;
|
|
|
|
|
|
|
|
namespace Sampler {
|
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkFilter Filter(Tegra::Texture::TextureFilter filter);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkSamplerMipmapMode MipmapMode(Tegra::Texture::TextureMipmapFilter mipmap_filter);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-12-26 05:10:53 +01:00
|
|
|
VkSamplerAddressMode WrapMode(const Device& device, Tegra::Texture::WrapMode wrap_mode,
|
2020-03-27 05:33:21 +01:00
|
|
|
Tegra::Texture::TextureFilter filter);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
|
|
|
} // namespace Sampler
|
|
|
|
|
2019-12-13 06:44:45 +01:00
|
|
|
struct FormatInfo {
|
2020-03-27 05:33:21 +01:00
|
|
|
VkFormat format;
|
2019-12-13 06:44:45 +01:00
|
|
|
bool attachable;
|
|
|
|
bool storage;
|
|
|
|
};
|
|
|
|
|
2021-01-16 01:37:17 +01:00
|
|
|
/**
|
|
|
|
* Returns format properties supported in the host
|
|
|
|
* @param device Host device
|
|
|
|
* @param format_type Type of image the buffer will use
|
|
|
|
* @param with_srgb True when the format can be sRGB when converted to another format (ASTC)
|
|
|
|
* @param pixel_format Guest pixel format to describe
|
|
|
|
*/
|
|
|
|
[[nodiscard]] FormatInfo SurfaceFormat(const Device& device, FormatType format_type, bool with_srgb,
|
|
|
|
PixelFormat pixel_format);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2021-06-23 07:41:00 +02:00
|
|
|
VkShaderStageFlagBits ShaderStage(Shader::Stage stage);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-12-26 05:10:53 +01:00
|
|
|
VkPrimitiveTopology PrimitiveTopology(const Device& device, Maxwell::PrimitiveTopology topology);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2021-01-17 00:48:58 +01:00
|
|
|
VkIndexType IndexFormat(Maxwell::IndexFormat index_format);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkStencilOp StencilOp(Maxwell::StencilOp stencil_op);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkBlendOp BlendEquation(Maxwell::Blend::Equation equation);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkBlendFactor BlendFactor(Maxwell::Blend::Factor factor);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkFrontFace FrontFace(Maxwell::FrontFace front_face);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2021-01-24 08:03:36 +01:00
|
|
|
VkCullModeFlagBits CullFace(Maxwell::CullFace cull_face);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2021-04-16 03:46:11 +02:00
|
|
|
VkPolygonMode PolygonMode(Maxwell::PolygonMode polygon_mode);
|
|
|
|
|
2020-03-27 05:33:21 +01:00
|
|
|
VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle);
|
2019-03-02 22:34:11 +01:00
|
|
|
|
2020-05-04 23:31:17 +02:00
|
|
|
VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle);
|
|
|
|
|
2020-12-30 06:25:23 +01:00
|
|
|
VkSamplerReductionMode SamplerReduction(Tegra::Texture::SamplerReduction reduction);
|
|
|
|
|
2021-03-19 23:28:31 +01:00
|
|
|
VkSampleCountFlagBits MsaaMode(Tegra::Texture::MsaaMode msaa_mode);
|
|
|
|
|
2019-03-02 22:34:11 +01:00
|
|
|
} // namespace Vulkan::MaxwellToVK
|