yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

gl_shader_cache,glasm: Conditionally use typeless image reads extension

This commit is contained in:
ReinUsesLisp 2021-05-21 20:46:40 -03:00 committed by ameerj
parent df406246d9
commit c31521512f
3 changed files with 43 additions and 39 deletions

View File

@ -271,8 +271,7 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
"OPTION NV_shader_storage_buffer;" "OPTION NV_shader_storage_buffer;"
"OPTION NV_gpu_program_fp64;" "OPTION NV_gpu_program_fp64;"
"OPTION NV_bindless_texture;" "OPTION NV_bindless_texture;"
"OPTION ARB_derivative_control;" "OPTION ARB_derivative_control;";
"OPTION EXT_shader_image_load_formatted;";
if (info.uses_int64_bit_atomics) { if (info.uses_int64_bit_atomics) {
header += "OPTION NV_shader_atomic_int64;"; header += "OPTION NV_shader_atomic_int64;";
} }
@ -297,6 +296,9 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
header += "OPTION NV_viewport_array2;"; header += "OPTION NV_viewport_array2;";
} }
} }
if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) {
header += "OPTION EXT_shader_image_load_formatted;";
}
if (stage == Stage::Fragment && runtime_info.force_early_z != 0) { if (stage == Stage::Fragment && runtime_info.force_early_z != 0) {
header += "OPTION NV_early_fragment_tests;"; header += "OPTION NV_early_fragment_tests;";
} }

View File

@ -36,42 +36,6 @@
namespace OpenGL { namespace OpenGL {
namespace { namespace {
// FIXME: Move this somewhere else
const Shader::Profile profile{
.supported_spirv = 0x00010000,
.unified_descriptor_binding = false,
.support_descriptor_aliasing = false,
.support_int8 = false,
.support_int16 = false,
.support_vertex_instance_id = true,
.support_float_controls = false,
.support_separate_denorm_behavior = false,
.support_separate_rounding_mode = false,
.support_fp16_denorm_preserve = false,
.support_fp32_denorm_preserve = false,
.support_fp16_denorm_flush = false,
.support_fp32_denorm_flush = false,
.support_fp16_signed_zero_nan_preserve = false,
.support_fp32_signed_zero_nan_preserve = false,
.support_fp64_signed_zero_nan_preserve = false,
.support_explicit_workgroup_layout = false,
.support_vote = true,
.support_viewport_index_layer_non_geometry = true,
.support_viewport_mask = true,
.support_typeless_image_loads = true,
.support_demote_to_helper_invocation = false,
.support_int64_atomics = false,
.warp_size_potentially_larger_than_guest = true,
.lower_left_origin_mode = true,
.has_broken_spirv_clamp = true,
.has_broken_unsigned_image_offsets = true,
.has_broken_signed_operations = true,
.ignore_nan_fp_comparisons = true,
};
using Shader::Backend::GLASM::EmitGLASM; using Shader::Backend::GLASM::EmitGLASM;
using Shader::Backend::SPIRV::EmitSPIRV; using Shader::Backend::SPIRV::EmitSPIRV;
using Shader::Maxwell::TranslateProgram; using Shader::Maxwell::TranslateProgram;
@ -279,7 +243,43 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
: VideoCommon::ShaderCache{rasterizer_, gpu_memory_, maxwell3d_, kepler_compute_}, : VideoCommon::ShaderCache{rasterizer_, gpu_memory_, maxwell3d_, kepler_compute_},
emu_window{emu_window_}, device{device_}, texture_cache{texture_cache_}, emu_window{emu_window_}, device{device_}, texture_cache{texture_cache_},
buffer_cache{buffer_cache_}, program_manager{program_manager_}, state_tracker{ buffer_cache{buffer_cache_}, program_manager{program_manager_}, state_tracker{
state_tracker_} {} state_tracker_} {
profile = Shader::Profile{
.supported_spirv = 0x00010000,
.unified_descriptor_binding = false,
.support_descriptor_aliasing = false,
.support_int8 = false,
.support_int16 = false,
.support_vertex_instance_id = true,
.support_float_controls = false,
.support_separate_denorm_behavior = false,
.support_separate_rounding_mode = false,
.support_fp16_denorm_preserve = false,
.support_fp32_denorm_preserve = false,
.support_fp16_denorm_flush = false,
.support_fp32_denorm_flush = false,
.support_fp16_signed_zero_nan_preserve = false,
.support_fp32_signed_zero_nan_preserve = false,
.support_fp64_signed_zero_nan_preserve = false,
.support_explicit_workgroup_layout = false,
.support_vote = true,
.support_viewport_index_layer_non_geometry =
device.HasNvViewportArray2() || device.HasVertexViewportLayer(),
.support_viewport_mask = true,
.support_typeless_image_loads = device.HasImageLoadFormatted(),
.support_demote_to_helper_invocation = false,
.support_int64_atomics = false,
.warp_size_potentially_larger_than_guest = true,
.lower_left_origin_mode = true,
.has_broken_spirv_clamp = true,
.has_broken_unsigned_image_offsets = true,
.has_broken_signed_operations = true,
.ignore_nan_fp_comparisons = true,
};
}
ShaderCache::~ShaderCache() = default; ShaderCache::~ShaderCache() = default;

View File

@ -86,6 +86,8 @@ private:
ShaderPools main_pools; ShaderPools main_pools;
std::unordered_map<GraphicsProgramKey, std::unique_ptr<GraphicsProgram>> graphics_cache; std::unordered_map<GraphicsProgramKey, std::unique_ptr<GraphicsProgram>> graphics_cache;
std::unordered_map<ComputeProgramKey, std::unique_ptr<ComputeProgram>> compute_cache; std::unordered_map<ComputeProgramKey, std::unique_ptr<ComputeProgram>> compute_cache;
Shader::Profile profile;
}; };
} // namespace OpenGL } // namespace OpenGL