citra: Fix build issues with MinGW and MSVC
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
|
#include "common/string_util.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/dumping/backend.h"
|
#include "core/dumping/backend.h"
|
||||||
#include "core/frontend/applets/default_applets.h"
|
#include "core/frontend/applets/default_applets.h"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "video_core/rasterizer_cache/utils.h"
|
#include "video_core/rasterizer_cache/utils.h"
|
||||||
#include "video_core/renderer_opengl/gl_driver.h"
|
#include "video_core/renderer_opengl/gl_driver.h"
|
||||||
|
@ -41,7 +41,6 @@ vk::Format ToVkFormat(VideoCore::PixelFormat format) {
|
|||||||
|
|
||||||
Instance::Instance() {
|
Instance::Instance() {
|
||||||
// Fetch instance independant function pointers
|
// Fetch instance independant function pointers
|
||||||
vk::DynamicLoader dl;
|
|
||||||
auto vkGetInstanceProcAddr =
|
auto vkGetInstanceProcAddr =
|
||||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||||
@ -71,7 +70,6 @@ Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index, bool
|
|||||||
auto window_info = window.GetWindowInfo();
|
auto window_info = window.GetWindowInfo();
|
||||||
|
|
||||||
// Fetch instance independant function pointers
|
// Fetch instance independant function pointers
|
||||||
vk::DynamicLoader dl;
|
|
||||||
auto vkGetInstanceProcAddr =
|
auto vkGetInstanceProcAddr =
|
||||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||||
|
@ -133,6 +133,7 @@ private:
|
|||||||
void CreateAllocator();
|
void CreateAllocator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
vk::DynamicLoader dl;
|
||||||
vk::Device device;
|
vk::Device device;
|
||||||
vk::PhysicalDevice physical_device;
|
vk::PhysicalDevice physical_device;
|
||||||
vk::Instance instance;
|
vk::Instance instance;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
namespace Frontend {
|
namespace Frontend {
|
||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
enum class WindowSystemType : u8;
|
enum class WindowSystemType : u8;
|
||||||
}
|
} // namespace Frontend
|
||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|
||||||
|
@ -185,10 +185,7 @@ RasterizerVulkan::~RasterizerVulkan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const VideoCore::HostTextureTag tag = {
|
const VideoCore::HostTextureTag tag = {
|
||||||
.format = VideoCore::PixelFormat::RGBA8,
|
.format = VideoCore::PixelFormat::RGBA8, .width = 1, .height = 1};
|
||||||
.width = 1,
|
|
||||||
.height = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
runtime.Recycle(tag, std::move(default_texture));
|
runtime.Recycle(tag, std::move(default_texture));
|
||||||
device.destroySampler(default_sampler);
|
device.destroySampler(default_sampler);
|
||||||
@ -1791,10 +1788,9 @@ void RasterizerVulkan::SyncDepthWriteMask() {
|
|||||||
void RasterizerVulkan::SyncStencilTest() {
|
void RasterizerVulkan::SyncStencilTest() {
|
||||||
const auto& regs = Pica::g_state.regs;
|
const auto& regs = Pica::g_state.regs;
|
||||||
|
|
||||||
const bool test_enable =
|
|
||||||
regs.framebuffer.output_merger.stencil_test.enable &&
|
|
||||||
regs.framebuffer.framebuffer.depth_format == Pica::FramebufferRegs::DepthFormat::D24S8;
|
|
||||||
const auto& stencil_test = regs.framebuffer.output_merger.stencil_test;
|
const auto& stencil_test = regs.framebuffer.output_merger.stencil_test;
|
||||||
|
const bool test_enable = stencil_test.enable && regs.framebuffer.framebuffer.depth_format ==
|
||||||
|
Pica::FramebufferRegs::DepthFormat::D24S8;
|
||||||
|
|
||||||
vk::CommandBuffer command_buffer = scheduler.GetRenderCommandBuffer();
|
vk::CommandBuffer command_buffer = scheduler.GetRenderCommandBuffer();
|
||||||
command_buffer.setStencilCompareMask(vk::StencilFaceFlagBits::eFrontAndBack,
|
command_buffer.setStencilCompareMask(vk::StencilFaceFlagBits::eFrontAndBack,
|
||||||
|
@ -69,7 +69,6 @@ void Swapchain::Create(u32 width, u32 height) {
|
|||||||
device.destroySwapchainKHR(old_swapchain);
|
device.destroySwapchainKHR(old_swapchain);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::RenderPass present_renderpass = renderpass_cache.GetPresentRenderpass();
|
|
||||||
auto images = device.getSwapchainImagesKHR(swapchain);
|
auto images = device.getSwapchainImagesKHR(swapchain);
|
||||||
|
|
||||||
// Destroy the previous images
|
// Destroy the previous images
|
||||||
@ -81,7 +80,8 @@ void Swapchain::Create(u32 width, u32 height) {
|
|||||||
swapchain_images.clear();
|
swapchain_images.clear();
|
||||||
swapchain_images.resize(images.size());
|
swapchain_images.resize(images.size());
|
||||||
|
|
||||||
std::ranges::transform(images, swapchain_images.begin(), [&](vk::Image image) -> Image {
|
std::ranges::transform(
|
||||||
|
images, swapchain_images.begin(), [device, this](vk::Image image) -> Image {
|
||||||
const vk::ImageViewCreateInfo view_info = {
|
const vk::ImageViewCreateInfo view_info = {
|
||||||
.image = image,
|
.image = image,
|
||||||
.viewType = vk::ImageViewType::e2D,
|
.viewType = vk::ImageViewType::e2D,
|
||||||
@ -93,9 +93,10 @@ void Swapchain::Create(u32 width, u32 height) {
|
|||||||
.layerCount = 1}};
|
.layerCount = 1}};
|
||||||
|
|
||||||
vk::ImageView image_view = device.createImageView(view_info);
|
vk::ImageView image_view = device.createImageView(view_info);
|
||||||
const std::array attachments{image_view};
|
const std::array attachments = {image_view};
|
||||||
|
|
||||||
const vk::FramebufferCreateInfo framebuffer_info = {.renderPass = present_renderpass,
|
const vk::FramebufferCreateInfo framebuffer_info = {
|
||||||
|
.renderPass = renderpass_cache.GetPresentRenderpass(),
|
||||||
.attachmentCount = 1,
|
.attachmentCount = 1,
|
||||||
.pAttachments = attachments.data(),
|
.pAttachments = attachments.data(),
|
||||||
.width = extent.width,
|
.width = extent.width,
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
#include "video_core/rasterizer_cache/utils.h"
|
#include "video_core/rasterizer_cache/utils.h"
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
#include "video_core/renderer_vulkan/vk_renderpass_cache.h"
|
#include "video_core/renderer_vulkan/vk_renderpass_cache.h"
|
||||||
#include "video_core/renderer_vulkan/vk_task_scheduler.h"
|
#include "video_core/renderer_vulkan/vk_task_scheduler.h"
|
||||||
#include "video_core/renderer_vulkan/vk_texture_runtime.h"
|
#include "video_core/renderer_vulkan/vk_texture_runtime.h"
|
||||||
|
|
||||||
#include <vulkan/vulkan_format_traits.hpp>
|
|
||||||
#include <vk_mem_alloc.h>
|
#include <vk_mem_alloc.h>
|
||||||
|
#include <vulkan/vulkan_format_traits.hpp>
|
||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|
||||||
|
@ -252,8 +252,8 @@ void ConvertABGRToRGBA(std::span<const std::byte> source, std::span<std::byte> d
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConvertD32S8ToD24S8(std::span<const std::byte> source, std::span<std::byte> dest) {
|
void ConvertD32S8ToD24S8(std::span<const std::byte> source, std::span<std::byte> dest) {
|
||||||
u32 depth_offset = 0;
|
std::size_t depth_offset = 0;
|
||||||
u32 stencil_offset = 4 * source.size() / 5;
|
std::size_t stencil_offset = 4 * source.size() / 5;
|
||||||
for (std::size_t i = 0; i < dest.size(); i += 4) {
|
for (std::size_t i = 0; i < dest.size(); i += 4) {
|
||||||
float depth;
|
float depth;
|
||||||
std::memcpy(&depth, source.data() + depth_offset, sizeof(float));
|
std::memcpy(&depth, source.data() + depth_offset, sizeof(float));
|
||||||
@ -287,8 +287,8 @@ void ConvertRGBA8ToRGBA4(std::span<const std::byte> source, std::span<std::byte>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InterleaveD24S8(std::span<const std::byte> source, std::span<std::byte> dest) {
|
void InterleaveD24S8(std::span<const std::byte> source, std::span<std::byte> dest) {
|
||||||
u32 depth_offset = 0;
|
std::size_t depth_offset = 0;
|
||||||
u32 stencil_offset = 3 * source.size() / 4;
|
std::size_t stencil_offset = 3 * source.size() / 4;
|
||||||
for (std::size_t i = 0; i < dest.size(); i += 4) {
|
for (std::size_t i = 0; i < dest.size(); i += 4) {
|
||||||
dest[i] = source[stencil_offset];
|
dest[i] = source[stencil_offset];
|
||||||
std::memcpy(dest.data() + i + 1, source.data() + depth_offset, 3);
|
std::memcpy(dest.data() + i + 1, source.data() + depth_offset, 3);
|
||||||
|
Reference in New Issue
Block a user