mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 11:26:56 +02:00
shader: decode buffer formats once
This commit is contained in:
@@ -238,28 +238,13 @@ constexpr BufferFormatInfo GetFormatInfo(Prospero::BufferFormat format) {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr bool IsKnownFormat(Prospero::BufferFormat format) {
|
||||
return GetFormatInfo(format).type != ComponentType::Unknown;
|
||||
}
|
||||
|
||||
constexpr uint32_t GetFormatComponentCount(Prospero::BufferFormat format) {
|
||||
return GetFormatInfo(format).component_count;
|
||||
}
|
||||
|
||||
constexpr uint32_t GetFormatComponentByteOffset(Prospero::BufferFormat format, uint32_t component) {
|
||||
const auto info = GetFormatInfo(format);
|
||||
constexpr uint32_t GetFormatComponentByteOffset(const BufferFormatInfo& info, uint32_t component) {
|
||||
if (component >= info.component_count) {
|
||||
return 0;
|
||||
}
|
||||
return info.packed_bitfield ? 0u : info.component_bit_offset[component] / 8u;
|
||||
}
|
||||
|
||||
constexpr bool CanUseTypedBufferLoad(Prospero::BufferFormat format) {
|
||||
const auto info = GetFormatInfo(format);
|
||||
return info.type != ComponentType::Unknown && !info.packed_bitfield &&
|
||||
info.component_bits[0] == 32u;
|
||||
}
|
||||
|
||||
} // namespace Libs::Graphics::ShaderRecompiler::Format
|
||||
|
||||
#endif /* EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_BUFFERFORMAT_H_ */
|
||||
|
||||
Reference in New Issue
Block a user