Merge pull request #5149 from xXPBSXx/fix/agc-texture-snorm-sint-2101010
fix(agc): sample 10_10_10_2 SNorm and SInt textures
This commit is contained in:
commit
b9e0e4ed30
|
|
@ -977,7 +977,7 @@ bool IntegerFormat(VkFormat format) {
|
|||
switch (format) {
|
||||
case VK_FORMAT_R8_UINT: case VK_FORMAT_R8_SINT: case VK_FORMAT_R8G8_UINT: case VK_FORMAT_R8G8_SINT:
|
||||
case VK_FORMAT_R8G8B8A8_UINT: case VK_FORMAT_R8G8B8A8_SINT: case VK_FORMAT_B8G8R8A8_UINT: case VK_FORMAT_B8G8R8A8_SINT:
|
||||
case VK_FORMAT_A8B8G8R8_UINT_PACK32: case VK_FORMAT_A8B8G8R8_SINT_PACK32: case VK_FORMAT_A2R10G10B10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32:
|
||||
case VK_FORMAT_A8B8G8R8_UINT_PACK32: case VK_FORMAT_A8B8G8R8_SINT_PACK32: case VK_FORMAT_A2R10G10B10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_SINT_PACK32:
|
||||
case VK_FORMAT_R16_UINT: case VK_FORMAT_R16_SINT: case VK_FORMAT_R16G16_UINT: case VK_FORMAT_R16G16_SINT:
|
||||
case VK_FORMAT_R16G16B16A16_UINT: case VK_FORMAT_R16G16B16A16_SINT: case VK_FORMAT_R32_UINT: case VK_FORMAT_R32_SINT:
|
||||
case VK_FORMAT_R32G32_UINT: case VK_FORMAT_R32G32_SINT: case VK_FORMAT_R32G32B32_UINT: case VK_FORMAT_R32G32B32_SINT:
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ constexpr FormatEntry kFormatLookup[] = {
|
|||
{29, VK_FORMAT_R16G16_SFLOAT, 4, false},
|
||||
{36, VK_FORMAT_B10G11R11_UFLOAT_PACK32, 4, false},
|
||||
{50, VK_FORMAT_A2B10G10R10_UNORM_PACK32, 4, false},
|
||||
{51, VK_FORMAT_A2B10G10R10_SNORM_PACK32, 4, false},
|
||||
{54, VK_FORMAT_A2B10G10R10_UINT_PACK32, 4, false},
|
||||
{55, VK_FORMAT_A2B10G10R10_SINT_PACK32, 4, false},
|
||||
{56, VK_FORMAT_R8G8B8A8_UNORM, 4, false},
|
||||
{57, VK_FORMAT_R8G8B8A8_SNORM, 4, false},
|
||||
{60, VK_FORMAT_R8G8B8A8_UINT, 4, false},
|
||||
|
|
|
|||
|
|
@ -169,6 +169,15 @@ void RunTextureFormatTests() {
|
|||
Require(!IsBlockCompressed(1), "format 1 must not be block compressed");
|
||||
Require(BlockWidth(1) == 1u && BlockHeight(1) == 1u, "format 1 must have a one-texel block");
|
||||
|
||||
Require(ResolveTextureFormat(50) == VK_FORMAT_A2B10G10R10_UNORM_PACK32, "format 50 must resolve to A2B10G10R10_UNORM");
|
||||
Require(ResolveTextureFormat(51) == VK_FORMAT_A2B10G10R10_SNORM_PACK32, "format 51 must resolve to A2B10G10R10_SNORM");
|
||||
Require(ResolveTextureFormat(54) == VK_FORMAT_A2B10G10R10_UINT_PACK32, "format 54 must resolve to A2B10G10R10_UINT");
|
||||
Require(ResolveTextureFormat(55) == VK_FORMAT_A2B10G10R10_SINT_PACK32, "format 55 must resolve to A2B10G10R10_SINT");
|
||||
for (const std::uint32_t format : {50u, 51u, 54u, 55u}) Require(BytesPerElement(format) == 4u && !IsBlockCompressed(format), "packed 10-bit format " + std::to_string(format) + " must be four bytes and not block compressed");
|
||||
Require(ShaderRecompiler::SampledTextureNumericClass(ShaderRecompiler::IrBufferFormat::Format10_10_10_2SNorm) == ShaderRecompiler::IrTextureNumericClass::Float, "format 51 must sample as float");
|
||||
Require(ShaderRecompiler::SampledTextureNumericClass(ShaderRecompiler::IrBufferFormat::Format10_10_10_2SInt) == ShaderRecompiler::IrTextureNumericClass::Sint, "format 55 must sample as signed integer");
|
||||
Require(ShaderRecompiler::SampledTextureNumericClass(ShaderRecompiler::IrBufferFormat::Format10_10_10_2UInt) == ShaderRecompiler::IrTextureNumericClass::Uint, "format 54 must sample as unsigned integer");
|
||||
|
||||
Require(ResolveTextureFormat(56) == VK_FORMAT_R8G8B8A8_UNORM, "format 56 must resolve to R8G8B8A8_UNORM");
|
||||
Require(BytesPerElement(56) == 4u, "format 56 must be four bytes wide");
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct FormatInfo {
|
|||
bool sint32;
|
||||
};
|
||||
|
||||
constexpr std::array<FormatInfo, 80> kFormatInfoTable {{
|
||||
constexpr std::array<FormatInfo, 82> kFormatInfoTable {{
|
||||
{IrBufferFormat::Format8UNorm, true, false, false},
|
||||
{IrBufferFormat::Format8SNorm, true, false, false},
|
||||
{IrBufferFormat::Format8UInt, true, true, false},
|
||||
|
|
@ -40,7 +40,9 @@ constexpr std::array<FormatInfo, 80> kFormatInfoTable {{
|
|||
{IrBufferFormat::Format11_11_10Float, true, false, false},
|
||||
{IrBufferFormat::Format10_11_11Float, true, true, false},
|
||||
{IrBufferFormat::Format10_10_10_2UNorm, true, false, false},
|
||||
{IrBufferFormat::Format10_10_10_2SNorm, true, false, false},
|
||||
{IrBufferFormat::Format10_10_10_2UInt, true, true, false},
|
||||
{IrBufferFormat::Format10_10_10_2SInt, true, false, true},
|
||||
{IrBufferFormat::Format8_8_8_8UNorm, true, false, false},
|
||||
{IrBufferFormat::Format8_8_8_8SNorm, true, false, false},
|
||||
{IrBufferFormat::Format8_8_8_8UInt, true, true, false},
|
||||
|
|
|
|||
Loading…
Reference in New Issue