maxwell_to_vk: Reorder filter cases and correct mipmap_filter=None
maxwell_to_vk: Reorder filtering modes to start with None, then Nearest, then Linear. maxwell_to_vk: Logs filter modes under UNREACHABLE_MSG instead of UNIMPLEMENTED_MSG, since any unknown filter modes are invalid and not unimplemented. maxwell_to_vk: Return VK_SAMPLER_MIPMAP_MODE_NEAREST instead of VK_SAMPLER_MIPMAP_MODE_LINEAR when mipmap_filter is None with the description from the VkSamplerCreateInfo(3) man page.
This commit is contained in:
		
							parent
							
								
									8868fb745f
								
							
						
					
					
						commit
						be660e7749
					
				@ -21,29 +21,29 @@ namespace Sampler {
 | 
			
		||||
 | 
			
		||||
VkFilter Filter(Tegra::Texture::TextureFilter filter) {
 | 
			
		||||
    switch (filter) {
 | 
			
		||||
    case Tegra::Texture::TextureFilter::Linear:
 | 
			
		||||
        return VK_FILTER_LINEAR;
 | 
			
		||||
    case Tegra::Texture::TextureFilter::Nearest:
 | 
			
		||||
        return VK_FILTER_NEAREST;
 | 
			
		||||
    case Tegra::Texture::TextureFilter::Linear:
 | 
			
		||||
        return VK_FILTER_LINEAR;
 | 
			
		||||
    }
 | 
			
		||||
    UNIMPLEMENTED_MSG("Unimplemented sampler filter={}", static_cast<u32>(filter));
 | 
			
		||||
    UNREACHABLE_MSG("Invalid sampler filter={}", static_cast<u32>(filter));
 | 
			
		||||
    return {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VkSamplerMipmapMode MipmapMode(Tegra::Texture::TextureMipmapFilter mipmap_filter) {
 | 
			
		||||
    switch (mipmap_filter) {
 | 
			
		||||
    case Tegra::Texture::TextureMipmapFilter::None:
 | 
			
		||||
        // TODO(Rodrigo): None seems to be mapped to OpenGL's mag and min filters without mipmapping
 | 
			
		||||
        // (e.g. GL_NEAREST and GL_LINEAR). Vulkan doesn't have such a thing, find out if we have to
 | 
			
		||||
        // use an image view with a single mipmap level to emulate this.
 | 
			
		||||
        return VK_SAMPLER_MIPMAP_MODE_LINEAR;
 | 
			
		||||
        ;
 | 
			
		||||
    case Tegra::Texture::TextureMipmapFilter::Linear:
 | 
			
		||||
        return VK_SAMPLER_MIPMAP_MODE_LINEAR;
 | 
			
		||||
        // There are no Vulkan filter modes that directly correspond to OpenGL minification filters
 | 
			
		||||
        // of GL_LINEAR or GL_NEAREST, but they can be emulated using
 | 
			
		||||
        // VK_SAMPLER_MIPMAP_MODE_NEAREST, minLod = 0, and maxLod = 0.25, and using minFilter =
 | 
			
		||||
        // VK_FILTER_LINEAR or minFilter = VK_FILTER_NEAREST, respectively.
 | 
			
		||||
        return VK_SAMPLER_MIPMAP_MODE_NEAREST;
 | 
			
		||||
    case Tegra::Texture::TextureMipmapFilter::Nearest:
 | 
			
		||||
        return VK_SAMPLER_MIPMAP_MODE_NEAREST;
 | 
			
		||||
    case Tegra::Texture::TextureMipmapFilter::Linear:
 | 
			
		||||
        return VK_SAMPLER_MIPMAP_MODE_LINEAR;
 | 
			
		||||
    }
 | 
			
		||||
    UNIMPLEMENTED_MSG("Unimplemented sampler mipmap mode={}", static_cast<u32>(mipmap_filter));
 | 
			
		||||
    UNREACHABLE_MSG("Invalid sampler mipmap mode={}", static_cast<u32>(mipmap_filter));
 | 
			
		||||
    return {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -78,10 +78,9 @@ VkSamplerAddressMode WrapMode(const VKDevice& device, Tegra::Texture::WrapMode w
 | 
			
		||||
    case Tegra::Texture::WrapMode::MirrorOnceBorder:
 | 
			
		||||
        UNIMPLEMENTED();
 | 
			
		||||
        return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
 | 
			
		||||
    default:
 | 
			
		||||
        UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode));
 | 
			
		||||
        return {};
 | 
			
		||||
    }
 | 
			
		||||
    UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode));
 | 
			
		||||
    return {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func) {
 | 
			
		||||
@ -288,10 +287,9 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const VKDevice& device,
 | 
			
		||||
        return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
 | 
			
		||||
    case Maxwell::PrimitiveTopology::Patches:
 | 
			
		||||
        return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
 | 
			
		||||
    default:
 | 
			
		||||
        UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology));
 | 
			
		||||
        return {};
 | 
			
		||||
    }
 | 
			
		||||
    UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology));
 | 
			
		||||
    return {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user