suyu/src/video_core/renderer_vulkan/maxwell_to_vk.h

75 lines
2.4 KiB
C++
Raw Normal View History

2019-03-02 22:34:11 +01:00
// Copyright 2019 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "common/common_types.h"
#include "video_core/engines/maxwell_3d.h"
#include "video_core/surface.h"
#include "video_core/textures/texture.h"
#include "video_core/vulkan_common/vulkan_device.h"
#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
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
struct FormatInfo {
2020-03-27 05:33:21 +01:00
VkFormat format;
bool attachable;
bool storage;
};
/**
* 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
2020-03-27 05:33:21 +01:00
VkShaderStageFlagBits ShaderStage(Tegra::Engines::ShaderType stage);
2019-03-02 22:34:11 +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
VkIndexType IndexFormat(const Device& device, 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
VkCullModeFlagBits CullFace(Maxwell::CullFace cull_face);
2019-03-02 22:34:11 +01:00
2020-03-27 05:33:21 +01:00
VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle);
2019-03-02 22:34:11 +01:00
VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle);
VkSamplerReductionMode SamplerReduction(Tegra::Texture::SamplerReduction reduction);
2019-03-02 22:34:11 +01:00
} // namespace Vulkan::MaxwellToVK