Use shader-compiler side {S,U}Scaled format emulation

This commit is contained in:
Billy Laws 2022-10-30 16:23:24 +00:00
parent 579fd04117
commit 6a830dfac5

View File

@ -86,12 +86,14 @@ namespace skyline::gpu::interconnect::maxwell3d {
case engine::VertexAttribute::NumericalType::Unorm: case engine::VertexAttribute::NumericalType::Unorm:
case engine::VertexAttribute::NumericalType::Float: case engine::VertexAttribute::NumericalType::Float:
return Shader::AttributeType::Float; return Shader::AttributeType::Float;
case engine::VertexAttribute::NumericalType::Sscaled:
case engine::VertexAttribute::NumericalType::Sint: case engine::VertexAttribute::NumericalType::Sint:
return Shader::AttributeType::SignedInt; return Shader::AttributeType::SignedInt;
case engine::VertexAttribute::NumericalType::Uscaled:
case engine::VertexAttribute::NumericalType::Uint: case engine::VertexAttribute::NumericalType::Uint:
return Shader::AttributeType::UnsignedInt; return Shader::AttributeType::UnsignedInt;
case engine::VertexAttribute::NumericalType::Sscaled:
return Shader::AttributeType::SignedScaled;
case engine::VertexAttribute::NumericalType::Uscaled:
return Shader::AttributeType::UnsignedScaled;
default: default:
throw exception("Invalid numerical type: {}", static_cast<u8>(attribute.numericalType)); throw exception("Invalid numerical type: {}", static_cast<u8>(attribute.numericalType));
} }
@ -331,6 +333,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
FORMAT_NORM_INT_SCALED_CASE(size, vkFormat); \ FORMAT_NORM_INT_SCALED_CASE(size, vkFormat); \
FORMAT_CASE(size, Float, Sfloat, vkFormat) FORMAT_CASE(size, Float, Sfloat, vkFormat)
// No mobile support scaled formats, so pass as int and the shader compiler will convert to float for us
if (numericalType == engine::VertexAttribute::NumericalType::Sscaled) if (numericalType == engine::VertexAttribute::NumericalType::Sscaled)
numericalType = engine::VertexAttribute::NumericalType::Sint; numericalType = engine::VertexAttribute::NumericalType::Sint;
else if (numericalType == engine::VertexAttribute::NumericalType::Uscaled) else if (numericalType == engine::VertexAttribute::NumericalType::Uscaled)