mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-13 23:27:46 +00:00
shader: Add denorm flush support
This commit is contained in:
parent
a2fe90fa60
commit
6350a277a3
20 changed files with 260 additions and 93 deletions
|
@ -131,12 +131,7 @@ ComputePipeline::ComputePipeline(const Device& device, VKDescriptorPool& descrip
|
|||
})} {}
|
||||
|
||||
void ComputePipeline::ConfigureBufferCache(BufferCache& buffer_cache) {
|
||||
u32 enabled_uniforms{};
|
||||
for (const auto& desc : info.constant_buffer_descriptors) {
|
||||
enabled_uniforms |= ((1ULL << desc.count) - 1) << desc.index;
|
||||
}
|
||||
buffer_cache.SetEnabledComputeUniformBuffers(enabled_uniforms);
|
||||
|
||||
buffer_cache.SetEnabledComputeUniformBuffers(info.constant_buffer_mask);
|
||||
buffer_cache.UnbindComputeStorageBuffers();
|
||||
size_t index{};
|
||||
for (const auto& desc : info.storage_buffers_descriptors) {
|
||||
|
|
|
@ -177,7 +177,20 @@ ComputePipeline PipelineCache::CreateComputePipeline(ShaderInfo* shader_info) {
|
|||
if (const std::optional<u128> cached_hash{env.Analyze(qmd.program_start)}) {
|
||||
// TODO: Load from cache
|
||||
}
|
||||
const auto [info, code]{Shader::RecompileSPIRV(env, qmd.program_start)};
|
||||
const auto& float_control{device.FloatControlProperties()};
|
||||
const Shader::Profile profile{
|
||||
.unified_descriptor_binding = true,
|
||||
.support_float_controls = true,
|
||||
.support_separate_denorm_behavior = float_control.denormBehaviorIndependence ==
|
||||
VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR,
|
||||
.support_separate_rounding_mode =
|
||||
float_control.roundingModeIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR,
|
||||
.support_fp16_denorm_preserve = float_control.shaderDenormPreserveFloat16 != VK_FALSE,
|
||||
.support_fp32_denorm_preserve = float_control.shaderDenormPreserveFloat32 != VK_FALSE,
|
||||
.support_fp16_denorm_flush = float_control.shaderDenormFlushToZeroFloat16 != VK_FALSE,
|
||||
.support_fp32_denorm_flush = float_control.shaderDenormFlushToZeroFloat32 != VK_FALSE,
|
||||
};
|
||||
const auto [info, code]{Shader::RecompileSPIRV(profile, env, qmd.program_start)};
|
||||
|
||||
FILE* file = fopen("D:\\shader.spv", "wb");
|
||||
fwrite(code.data(), 4, code.size(), file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue