Skip to content
Permalink
Browse files

Remove unused textureswizzle support (we use shaders instead). Univer…

…sally support presenting 5551 format directly.
  • Loading branch information...
hrydgard committed Oct 25, 2019
1 parent 86c781e commit 6c8186d046f6a478cfa3cc07a9c2671f07c1140e
Showing with 10 additions and 24 deletions.
  1. +9 −4 GPU/Software/SoftGpu.cpp
  2. +0 −7 ext/native/thin3d/thin3d.h
  3. +1 −13 ext/native/thin3d/thin3d_vulkan.cpp
@@ -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);
@@ -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;
@@ -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;
}

0 comments on commit 6c8186d

Please sign in to comment.
You can’t perform that action at this time.