Vulkan CP: Fix calculating an invalid copy destination base address when sizeof(texel) != 4
This commit is contained in:
@@ -88,6 +88,66 @@ enum class TextureFormat : uint32_t {
|
||||
kUnknown = 0xFFFFFFFFu,
|
||||
};
|
||||
|
||||
inline size_t GetTexelSize(TextureFormat format) {
|
||||
switch (format) {
|
||||
case TextureFormat::k_1_5_5_5:
|
||||
return 2;
|
||||
break;
|
||||
case TextureFormat::k_2_10_10_10:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_4_4_4_4:
|
||||
return 2;
|
||||
break;
|
||||
case TextureFormat::k_5_6_5:
|
||||
return 2;
|
||||
break;
|
||||
case TextureFormat::k_8:
|
||||
return 1;
|
||||
break;
|
||||
case TextureFormat::k_8_8:
|
||||
return 2;
|
||||
break;
|
||||
case TextureFormat::k_8_8_8_8:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_16:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_16_FLOAT:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_16_16:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_16_16_FLOAT:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_16_16_16_16:
|
||||
return 8;
|
||||
break;
|
||||
case TextureFormat::k_16_16_16_16_FLOAT:
|
||||
return 8;
|
||||
break;
|
||||
case TextureFormat::k_32_FLOAT:
|
||||
return 4;
|
||||
break;
|
||||
case TextureFormat::k_32_32_FLOAT:
|
||||
return 8;
|
||||
break;
|
||||
case TextureFormat::k_32_32_32_32_FLOAT:
|
||||
return 16;
|
||||
break;
|
||||
case TextureFormat::k_10_11_11:
|
||||
case TextureFormat::k_11_11_10:
|
||||
return 4;
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(format);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline TextureFormat ColorFormatToTextureFormat(ColorFormat color_format) {
|
||||
return static_cast<TextureFormat>(color_format);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user