ソースを参照

Vulkan: Fixed an issue where sRGB textures weren't being enabled when requested

BearishSun 9 年 前
コミット
6312a50d96

+ 4 - 2
Source/BansheeVulkanRenderAPI/Source/BsVulkanRenderTexture.cpp

@@ -71,7 +71,8 @@ namespace bs
 
 			fbDesc.color[i].image = image;
 			fbDesc.color[i].view = image->getView(surface, true);
-			fbDesc.color[i].format = VulkanUtility::getPixelFormat(texture->getProperties().getFormat());
+			fbDesc.color[i].format = VulkanUtility::getPixelFormat(texture->getProperties().getFormat(),
+																   texture->getProperties().isHardwareGammaEnabled());
 		}
 
 		if(mDepthStencilSurface != nullptr)
@@ -110,7 +111,8 @@ namespace bs
 
 				fbDesc.depth.image = image;
 				fbDesc.depth.view = image->getView(surface, true);
-				fbDesc.depth.format = VulkanUtility::getPixelFormat(texture->getProperties().getFormat());
+				fbDesc.depth.format = VulkanUtility::getPixelFormat(texture->getProperties().getFormat(),
+																	texture->getProperties().isHardwareGammaEnabled());
 				fbDesc.depth.baseLayer = view->getFirstArraySlice();
 			}
 		}

+ 2 - 2
Source/BansheeVulkanRenderAPI/Source/BsVulkanTexture.cpp

@@ -18,7 +18,7 @@ namespace bs
 		desc.image = image;
 		desc.memory = memory;
 		desc.type = props.getTextureType();
-		desc.format = VulkanUtility::getPixelFormat(props.getFormat());
+		desc.format = VulkanUtility::getPixelFormat(props.getFormat(), props.isHardwareGammaEnabled());
 		desc.numFaces = props.getNumFaces();
 		desc.numMipLevels = props.getNumMipmaps() + 1;
 		desc.isDepthStencil = (props.getUsage() & TU_DEPTHSTENCIL) != 0;
@@ -426,7 +426,7 @@ namespace bs
 			}
 		}
 
-		mImageCI.format = VulkanUtility::getPixelFormat(props.getFormat());
+		mImageCI.format = VulkanUtility::getPixelFormat(props.getFormat(), props.isHardwareGammaEnabled());
 		mImageCI.extent = { props.getWidth(), props.getHeight(), props.getDepth() };
 		mImageCI.mipLevels = props.getNumMipmaps() + 1;
 		mImageCI.arrayLayers = props.getNumFaces();