Skip to content

Commit b920960

Browse files
committed
renderer_vulkan: Remove swapchain image reinterpretation.
1 parent 99a0435 commit b920960

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

src/video_core/renderer_vulkan/vk_instance.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ bool Instance::CreateDevice() {
270270
legacy_vertex_attributes = add_extension(VK_EXT_LEGACY_VERTEX_ATTRIBUTES_EXTENSION_NAME);
271271
image_load_store_lod = add_extension(VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME);
272272
amd_gcn_shader = add_extension(VK_AMD_GCN_SHADER_EXTENSION_NAME);
273-
add_extension(VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME);
274273

275274
// These extensions are promoted by Vulkan 1.3, but for greater compatibility we use Vulkan 1.2
276275
// with extensions.

src/video_core/renderer_vulkan/vk_presenter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void Presenter::RecreateFrame(Frame* frame, u32 width, u32 height) {
380380
const vk::ImageViewCreateInfo view_info = {
381381
.image = frame->image,
382382
.viewType = vk::ImageViewType::e2D,
383-
.format = swapchain.GetViewFormat(),
383+
.format = swapchain.GetSurfaceFormat().format,
384384
.subresourceRange{
385385
.aspectMask = vk::ImageAspectFlagBits::eColor,
386386
.baseMipLevel = 0,

src/video_core/renderer_vulkan/vk_swapchain.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Swapchain::Swapchain(const Instance& instance_, const Frontend::WindowSDL& windo
1717
FindPresentFormat();
1818

1919
Create(window.GetWidth(), window.GetHeight());
20-
ImGui::Core::Initialize(instance, window, image_count, view_format);
20+
ImGui::Core::Initialize(instance, window, image_count, surface_format.format);
2121
}
2222

2323
Swapchain::~Swapchain() {
@@ -57,17 +57,7 @@ void Swapchain::Create(u32 width_, u32 height_) {
5757
const u32 queue_family_indices_count = exclusive ? 1u : 2u;
5858
const vk::SharingMode sharing_mode =
5959
exclusive ? vk::SharingMode::eExclusive : vk::SharingMode::eConcurrent;
60-
const vk::Format view_formats[2] = {
61-
surface_format.format,
62-
view_format,
63-
};
64-
const vk::ImageFormatListCreateInfo format_list = {
65-
.viewFormatCount = 2,
66-
.pViewFormats = view_formats,
67-
};
6860
const vk::SwapchainCreateInfoKHR swapchain_info = {
69-
.pNext = &format_list,
70-
.flags = vk::SwapchainCreateFlagBitsKHR::eMutableFormat,
7161
.surface = surface,
7262
.minImageCount = image_count,
7363
.imageFormat = surface_format.format,
@@ -157,22 +147,20 @@ void Swapchain::FindPresentFormat() {
157147
// If there is a single undefined surface format, the device doesn't care, so we'll just use
158148
// RGBA sRGB.
159149
if (formats[0].format == vk::Format::eUndefined) {
160-
surface_format.format = vk::Format::eR8G8B8A8Srgb;
150+
surface_format.format = vk::Format::eR8G8B8A8Unorm;
161151
surface_format.colorSpace = vk::ColorSpaceKHR::eSrgbNonlinear;
162-
view_format = FormatToUnorm(surface_format.format);
163152
return;
164153
}
165154

166155
// Try to find a suitable format.
167156
for (const vk::SurfaceFormatKHR& sformat : formats) {
168157
vk::Format format = sformat.format;
169-
if (format != vk::Format::eR8G8B8A8Srgb && format != vk::Format::eB8G8R8A8Srgb) {
158+
if (format != vk::Format::eR8G8B8A8Unorm && format != vk::Format::eB8G8R8A8Unorm) {
170159
continue;
171160
}
172161

173162
surface_format.format = format;
174163
surface_format.colorSpace = sformat.colorSpace;
175-
view_format = FormatToUnorm(surface_format.format);
176164
return;
177165
}
178166

@@ -274,7 +262,7 @@ void Swapchain::SetupImages() {
274262
auto [im_view_result, im_view] = device.createImageView(vk::ImageViewCreateInfo{
275263
.image = images[i],
276264
.viewType = vk::ImageViewType::e2D,
277-
.format = FormatToUnorm(surface_format.format),
265+
.format = surface_format.format,
278266
.subresourceRange =
279267
{
280268
.aspectMask = vk::ImageAspectFlagBits::eColor,

src/video_core/renderer_vulkan/vk_swapchain.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ class Swapchain {
6161
return surface_format;
6262
}
6363

64-
vk::Format GetViewFormat() const {
65-
return view_format;
66-
}
67-
6864
vk::SwapchainKHR GetHandle() const {
6965
return swapchain;
7066
}

0 commit comments

Comments
 (0)