Remove unused textureswizzle support (we use shaders instead). Universally support presenting 5551 format directly.

This commit is contained in:
Henrik Rydgård committed 2019-10-26 00:46:56 +02:00
1 parent d9a9a9dd88
commit a2c23bd377
3 files changed
+10 -24

No files matched your search

+9 -4
View File
@@ -198,8 +198,6 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
// RB swapped, compensate with a shader.
desc.format = Draw::DataFormat::A1R5G5B5_UNORM_PACK16;
pipeline = texColorRBSwizzle;
} else {
// Shouldn't happen (once I'm done with the backends).
}
desc.width = displayStride_ == 0 ? srcwidth : displayStride_;
desc.height = srcheight;
@@ -217,10 +215,17 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
desc.height = srcheight;
desc.initData.push_back(data);
desc.format = Draw::DataFormat::R8G8B8A8_UNORM;
} else if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN && displayFormat_ == GE_FORMAT_5551) {
} else if (displayFormat_ == GE_FORMAT_5551) {
u8 *data = Memory::GetPointer(displayFramebuf_);
desc.swizzle = Draw::TextureSwizzle::BGRA;
desc.format = Draw::DataFormat::A1R5G5B5_UNORM_PACK16;
if (draw_->GetDataFormatSupport(Draw::DataFormat::A1B5G5R5_UNORM_PACK16) & Draw::FMT_TEXTURE) {
// The perfect one.
desc.format = Draw::DataFormat::A1B5G5R5_UNORM_PACK16;
} else if (draw_->GetDataFormatSupport(Draw::DataFormat::A1R5G5B5_UNORM_PACK16) & Draw::FMT_TEXTURE) {
// RB swapped, compensate with a shader.
desc.format = Draw::DataFormat::A1R5G5B5_UNORM_PACK16;
pipeline = texColorRBSwizzle;
}
desc.width = displayStride_ == 0 ? srcwidth : displayStride_;
desc.height = srcheight;
desc.initData.push_back(data);
-7
View File
@@ -516,16 +516,9 @@ struct DeviceCaps {
std::string deviceName; // The device name to use when creating the thin3d context, to get the same one.
};
// Some predefined swizzle
enum class TextureSwizzle {
NO_SWIZZLE = 0,
BGRA = 1,
};
struct TextureDesc {
TextureType type;
DataFormat format;
TextureSwizzle swizzle;
int width;
int height;
int depth;
+1 -13
View File
@@ -700,19 +700,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur
usageBits |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}
VkComponentMapping mapping{}; // Defaults to no swizzle
switch (desc.swizzle) {
case TextureSwizzle::NO_SWIZZLE:
break;
case TextureSwizzle::BGRA:
mapping.r = VK_COMPONENT_SWIZZLE_B;
mapping.g = VK_COMPONENT_SWIZZLE_G;
mapping.b = VK_COMPONENT_SWIZZLE_R;
mapping.a = VK_COMPONENT_SWIZZLE_A;
break;
}
if (!vkTex_->CreateDirect(cmd, alloc, width_, height_, mipLevels_, vulkanFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, usageBits, &mapping)) {
if (!vkTex_->CreateDirect(cmd, alloc, width_, height_, mipLevels_, vulkanFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, usageBits)) {
ELOG("Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_);
return false;
}