Browse Source

shader: Emulate 64-bit integers when not supported

Useful for mobile and Intel Xe devices.
pull/15/merge
ReinUsesLisp 5 years ago
committed by ameerj
parent
commit
fb166b5ff4
  1. 3
      src/shader_recompiler/frontend/maxwell/translate_program.cpp
  2. 1
      src/video_core/renderer_opengl/gl_device.cpp
  3. 5
      src/video_core/renderer_opengl/gl_device.h
  4. 2
      src/video_core/renderer_opengl/gl_shader_cache.cpp
  5. 2
      src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
  6. 5
      src/video_core/vulkan_common/vulkan_device.h

3
src/shader_recompiler/frontend/maxwell/translate_program.cpp

@ -154,6 +154,9 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
if (!host_info.support_float16) { if (!host_info.support_float16) {
Optimization::LowerFp16ToFp32(program); Optimization::LowerFp16ToFp32(program);
} }
if (!host_info.support_int64) {
Optimization::LowerInt64ToInt32(program);
}
Optimization::SsaRewritePass(program); Optimization::SsaRewritePass(program);
Optimization::GlobalMemoryToStorageBufferPass(program); Optimization::GlobalMemoryToStorageBufferPass(program);

1
src/video_core/renderer_opengl/gl_device.cpp

@ -159,6 +159,7 @@ Device::Device() {
has_debugging_tool_attached = IsDebugToolAttached(extensions); has_debugging_tool_attached = IsDebugToolAttached(extensions);
has_depth_buffer_float = HasExtension(extensions, "GL_NV_depth_buffer_float"); has_depth_buffer_float = HasExtension(extensions, "GL_NV_depth_buffer_float");
has_nv_gpu_shader_5 = GLAD_GL_NV_gpu_shader5; has_nv_gpu_shader_5 = GLAD_GL_NV_gpu_shader5;
has_shader_int64 = HasExtension(extensions, "GL_ARB_gpu_shader_int64");
has_amd_shader_half_float = GLAD_GL_AMD_gpu_shader_half_float; has_amd_shader_half_float = GLAD_GL_AMD_gpu_shader_half_float;
has_sparse_texture_2 = GLAD_GL_ARB_sparse_texture2; has_sparse_texture_2 = GLAD_GL_ARB_sparse_texture2;
warp_size_potentially_larger_than_guest = !is_nvidia && !is_intel; warp_size_potentially_larger_than_guest = !is_nvidia && !is_intel;

5
src/video_core/renderer_opengl/gl_device.h

@ -124,6 +124,10 @@ public:
return has_nv_gpu_shader_5; return has_nv_gpu_shader_5;
} }
bool HasShaderInt64() const {
return has_shader_int64;
}
bool HasAmdShaderHalfFloat() const { bool HasAmdShaderHalfFloat() const {
return has_amd_shader_half_float; return has_amd_shader_half_float;
} }
@ -172,6 +176,7 @@ private:
bool use_driver_cache{}; bool use_driver_cache{};
bool has_depth_buffer_float{}; bool has_depth_buffer_float{};
bool has_nv_gpu_shader_5{}; bool has_nv_gpu_shader_5{};
bool has_shader_int64{};
bool has_amd_shader_half_float{}; bool has_amd_shader_half_float{};
bool has_sparse_texture_2{}; bool has_sparse_texture_2{};
bool warp_size_potentially_larger_than_guest{}; bool warp_size_potentially_larger_than_guest{};

2
src/video_core/renderer_opengl/gl_shader_cache.cpp

@ -211,7 +211,7 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
}, },
host_info{ host_info{
.support_float16 = false, .support_float16 = false,
.support_int64 = true,
.support_int64 = device.HasShaderInt64(),
} { } {
if (use_asynchronous_shaders) { if (use_asynchronous_shaders) {
workers = CreateWorkers(); workers = CreateWorkers();

2
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

@ -315,7 +315,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxw
}; };
host_info = Shader::HostTranslateInfo{ host_info = Shader::HostTranslateInfo{
.support_float16 = device.IsFloat16Supported(), .support_float16 = device.IsFloat16Supported(),
.support_int64 = true,
.support_int64 = device.IsShaderInt64Supported(),
}; };
} }

5
src/video_core/vulkan_common/vulkan_device.h

@ -164,6 +164,11 @@ public:
return is_formatless_image_load_supported; return is_formatless_image_load_supported;
} }
/// Returns true if shader int64 is supported.
bool IsShaderInt64Supported() const {
return is_shader_int64_supported;
}
/// Returns true if shader int16 is supported. /// Returns true if shader int16 is supported.
bool IsShaderInt16Supported() const { bool IsShaderInt16Supported() const {
return is_shader_int16_supported; return is_shader_int16_supported;

Loading…
Cancel
Save