mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-18 13:54:16 +01:00
[dxvk] Added component mapping to image view info
This commit is contained in:
parent
9acc9bf3e0
commit
5739e2f60f
@ -63,12 +63,6 @@ namespace dxvk {
|
|||||||
const Rc<DxvkImage>& image,
|
const Rc<DxvkImage>& image,
|
||||||
const DxvkImageViewCreateInfo& info)
|
const DxvkImageViewCreateInfo& info)
|
||||||
: m_vkd(vkd), m_image(image), m_info(info) {
|
: m_vkd(vkd), m_image(image), m_info(info) {
|
||||||
VkComponentMapping componentMapping;
|
|
||||||
componentMapping.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
|
||||||
componentMapping.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
|
||||||
componentMapping.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
|
||||||
componentMapping.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
|
||||||
|
|
||||||
VkImageSubresourceRange subresourceRange;
|
VkImageSubresourceRange subresourceRange;
|
||||||
subresourceRange.aspectMask = info.aspect;
|
subresourceRange.aspectMask = info.aspect;
|
||||||
subresourceRange.baseMipLevel = info.minLevel;
|
subresourceRange.baseMipLevel = info.minLevel;
|
||||||
@ -83,7 +77,7 @@ namespace dxvk {
|
|||||||
viewInfo.image = image->handle();
|
viewInfo.image = image->handle();
|
||||||
viewInfo.viewType = info.type;
|
viewInfo.viewType = info.type;
|
||||||
viewInfo.format = info.format;
|
viewInfo.format = info.format;
|
||||||
viewInfo.components = componentMapping;
|
viewInfo.components = info.swizzle;
|
||||||
viewInfo.subresourceRange = subresourceRange;
|
viewInfo.subresourceRange = subresourceRange;
|
||||||
|
|
||||||
if (m_vkd->vkCreateImageView(m_vkd->device(), &viewInfo, nullptr, &m_view) != VK_SUCCESS)
|
if (m_vkd->vkCreateImageView(m_vkd->device(), &viewInfo, nullptr, &m_view) != VK_SUCCESS)
|
||||||
|
@ -60,17 +60,26 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
struct DxvkImageViewCreateInfo {
|
struct DxvkImageViewCreateInfo {
|
||||||
/// Image view dimension
|
/// Image view dimension
|
||||||
VkImageViewType type;
|
VkImageViewType type = VK_IMAGE_VIEW_TYPE_2D;
|
||||||
|
|
||||||
/// Pixel format
|
/// Pixel format
|
||||||
VkFormat format;
|
VkFormat format = VK_FORMAT_UNDEFINED;
|
||||||
|
|
||||||
/// Subresources to use in the view
|
/// Subresources to use in the view
|
||||||
VkImageAspectFlags aspect;
|
VkImageAspectFlags aspect = 0;
|
||||||
uint32_t minLevel;
|
|
||||||
uint32_t numLevels;
|
uint32_t minLevel = 0;
|
||||||
uint32_t minLayer;
|
uint32_t numLevels = 0;
|
||||||
uint32_t numLayers;
|
uint32_t minLayer = 0;
|
||||||
|
uint32_t numLayers = 0;
|
||||||
|
|
||||||
|
/// Component mapping. Defaults to identity.
|
||||||
|
VkComponentMapping swizzle = {
|
||||||
|
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
|
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
|
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
|
VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user