summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/host1x/codecs/codec.cpp2
-rw-r--r--src/video_core/host1x/codecs/h264.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_compute_pipeline.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_graphics_pipeline.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp8
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.cpp12
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp19
-rw-r--r--src/video_core/textures/texture.cpp4
11 files changed, 44 insertions, 37 deletions
diff --git a/src/video_core/host1x/codecs/codec.cpp b/src/video_core/host1x/codecs/codec.cpp
index da07a556f..220cce28a 100644
--- a/src/video_core/host1x/codecs/codec.cpp
+++ b/src/video_core/host1x/codecs/codec.cpp
@@ -247,7 +247,7 @@ void Codec::Initialize() {
247 av_codec = avcodec_find_decoder(codec); 247 av_codec = avcodec_find_decoder(codec);
248 248
249 InitializeAvCodecContext(); 249 InitializeAvCodecContext();
250 if (Settings::values.nvdec_emulation.GetValue() == Settings::NvdecEmulation::GPU) { 250 if (Settings::values.nvdec_emulation.GetValue() == Settings::NvdecEmulation::Gpu) {
251 InitializeGpuDecoder(); 251 InitializeGpuDecoder();
252 } 252 }
253 if (const int res = avcodec_open2(av_codec_ctx, av_codec, nullptr); res < 0) { 253 if (const int res = avcodec_open2(av_codec_ctx, av_codec, nullptr); res < 0) {
diff --git a/src/video_core/host1x/codecs/h264.cpp b/src/video_core/host1x/codecs/h264.cpp
index 862904e39..ece79b1e2 100644
--- a/src/video_core/host1x/codecs/h264.cpp
+++ b/src/video_core/host1x/codecs/h264.cpp
@@ -84,7 +84,7 @@ std::span<const u8> H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters
84 84
85 // TODO (ameerj): Where do we get this number, it seems to be particular for each stream 85 // TODO (ameerj): Where do we get this number, it seems to be particular for each stream
86 const auto nvdec_decoding = Settings::values.nvdec_emulation.GetValue(); 86 const auto nvdec_decoding = Settings::values.nvdec_emulation.GetValue();
87 const bool uses_gpu_decoding = nvdec_decoding == Settings::NvdecEmulation::GPU; 87 const bool uses_gpu_decoding = nvdec_decoding == Settings::NvdecEmulation::Gpu;
88 const u32 max_num_ref_frames = uses_gpu_decoding ? 6u : 16u; 88 const u32 max_num_ref_frames = uses_gpu_decoding ? 6u : 16u;
89 writer.WriteUe(max_num_ref_frames); 89 writer.WriteUe(max_num_ref_frames);
90 writer.WriteBit(false); 90 writer.WriteBit(false);
diff --git a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp
index f9ca55c36..d70501860 100644
--- a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp
+++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp
@@ -34,13 +34,13 @@ ComputePipeline::ComputePipeline(const Device& device, TextureCache& texture_cac
34 : texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, 34 : texture_cache{texture_cache_}, buffer_cache{buffer_cache_},
35 program_manager{program_manager_}, info{info_} { 35 program_manager{program_manager_}, info{info_} {
36 switch (device.GetShaderBackend()) { 36 switch (device.GetShaderBackend()) {
37 case Settings::ShaderBackend::GLSL: 37 case Settings::ShaderBackend::Glsl:
38 source_program = CreateProgram(code, GL_COMPUTE_SHADER); 38 source_program = CreateProgram(code, GL_COMPUTE_SHADER);
39 break; 39 break;
40 case Settings::ShaderBackend::GLASM: 40 case Settings::ShaderBackend::Glasm:
41 assembly_program = CompileProgram(code, GL_COMPUTE_PROGRAM_NV); 41 assembly_program = CompileProgram(code, GL_COMPUTE_PROGRAM_NV);
42 break; 42 break;
43 case Settings::ShaderBackend::SPIRV: 43 case Settings::ShaderBackend::SpirV:
44 source_program = CreateProgram(code_v, GL_COMPUTE_SHADER); 44 source_program = CreateProgram(code_v, GL_COMPUTE_SHADER);
45 break; 45 break;
46 } 46 }
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index 33e63c17d..ee140c9c2 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -177,15 +177,15 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
177 has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data; 177 has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
178 178
179 shader_backend = Settings::values.shader_backend.GetValue(); 179 shader_backend = Settings::values.shader_backend.GetValue();
180 use_assembly_shaders = shader_backend == Settings::ShaderBackend::GLASM && 180 use_assembly_shaders = shader_backend == Settings::ShaderBackend::Glasm &&
181 GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 && 181 GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 &&
182 GLAD_GL_NV_transform_feedback && GLAD_GL_NV_transform_feedback2; 182 GLAD_GL_NV_transform_feedback && GLAD_GL_NV_transform_feedback2;
183 if (shader_backend == Settings::ShaderBackend::GLASM && !use_assembly_shaders) { 183 if (shader_backend == Settings::ShaderBackend::Glasm && !use_assembly_shaders) {
184 LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported"); 184 LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported");
185 shader_backend = Settings::ShaderBackend::GLSL; 185 shader_backend = Settings::ShaderBackend::Glsl;
186 } 186 }
187 187
188 if (shader_backend == Settings::ShaderBackend::GLSL && is_nvidia) { 188 if (shader_backend == Settings::ShaderBackend::Glsl && is_nvidia) {
189 const std::string_view driver_version = version.substr(13); 189 const std::string_view driver_version = version.substr(13);
190 const int version_major = 190 const int version_major =
191 std::atoi(driver_version.substr(0, driver_version.find(".")).data()); 191 std::atoi(driver_version.substr(0, driver_version.find(".")).data());
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
index 71f720c63..f822fa856 100644
--- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
+++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
@@ -236,18 +236,18 @@ GraphicsPipeline::GraphicsPipeline(const Device& device, TextureCache& texture_c
236 force_context_flush](ShaderContext::Context*) mutable { 236 force_context_flush](ShaderContext::Context*) mutable {
237 for (size_t stage = 0; stage < 5; ++stage) { 237 for (size_t stage = 0; stage < 5; ++stage) {
238 switch (backend) { 238 switch (backend) {
239 case Settings::ShaderBackend::GLSL: 239 case Settings::ShaderBackend::Glsl:
240 if (!sources_[stage].empty()) { 240 if (!sources_[stage].empty()) {
241 source_programs[stage] = CreateProgram(sources_[stage], Stage(stage)); 241 source_programs[stage] = CreateProgram(sources_[stage], Stage(stage));
242 } 242 }
243 break; 243 break;
244 case Settings::ShaderBackend::GLASM: 244 case Settings::ShaderBackend::Glasm:
245 if (!sources_[stage].empty()) { 245 if (!sources_[stage].empty()) {
246 assembly_programs[stage] = 246 assembly_programs[stage] =
247 CompileProgram(sources_[stage], AssemblyStage(stage)); 247 CompileProgram(sources_[stage], AssemblyStage(stage));
248 } 248 }
249 break; 249 break;
250 case Settings::ShaderBackend::SPIRV: 250 case Settings::ShaderBackend::SpirV:
251 if (!sources_spirv_[stage].empty()) { 251 if (!sources_spirv_[stage].empty()) {
252 source_programs[stage] = CreateProgram(sources_spirv_[stage], Stage(stage)); 252 source_programs[stage] = CreateProgram(sources_spirv_[stage], Stage(stage));
253 } 253 }
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 7e1d7f92e..618cb6354 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -522,14 +522,14 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
522 const auto runtime_info{ 522 const auto runtime_info{
523 MakeRuntimeInfo(key, program, previous_program, glasm_use_storage_buffers, use_glasm)}; 523 MakeRuntimeInfo(key, program, previous_program, glasm_use_storage_buffers, use_glasm)};
524 switch (device.GetShaderBackend()) { 524 switch (device.GetShaderBackend()) {
525 case Settings::ShaderBackend::GLSL: 525 case Settings::ShaderBackend::Glsl:
526 ConvertLegacyToGeneric(program, runtime_info); 526 ConvertLegacyToGeneric(program, runtime_info);
527 sources[stage_index] = EmitGLSL(profile, runtime_info, program, binding); 527 sources[stage_index] = EmitGLSL(profile, runtime_info, program, binding);
528 break; 528 break;
529 case Settings::ShaderBackend::GLASM: 529 case Settings::ShaderBackend::Glasm:
530 sources[stage_index] = EmitGLASM(profile, runtime_info, program, binding); 530 sources[stage_index] = EmitGLASM(profile, runtime_info, program, binding);
531 break; 531 break;
532 case Settings::ShaderBackend::SPIRV: 532 case Settings::ShaderBackend::SpirV:
533 ConvertLegacyToGeneric(program, runtime_info); 533 ConvertLegacyToGeneric(program, runtime_info);
534 sources_spirv[stage_index] = EmitSPIRV(profile, runtime_info, program, binding); 534 sources_spirv[stage_index] = EmitSPIRV(profile, runtime_info, program, binding);
535 break; 535 break;
@@ -582,13 +582,13 @@ std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
582 std::string code{}; 582 std::string code{};
583 std::vector<u32> code_spirv; 583 std::vector<u32> code_spirv;
584 switch (device.GetShaderBackend()) { 584 switch (device.GetShaderBackend()) {
585 case Settings::ShaderBackend::GLSL: 585 case Settings::ShaderBackend::Glsl:
586 code = EmitGLSL(profile, program); 586 code = EmitGLSL(profile, program);
587 break; 587 break;
588 case Settings::ShaderBackend::GLASM: 588 case Settings::ShaderBackend::Glasm:
589 code = EmitGLASM(profile, info, program); 589 code = EmitGLASM(profile, info, program);
590 break; 590 break;
591 case Settings::ShaderBackend::SPIRV: 591 case Settings::ShaderBackend::SpirV:
592 code_spirv = EmitSPIRV(profile, program); 592 code_spirv = EmitSPIRV(profile, program);
593 break; 593 break;
594 } 594 }
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 3b446be07..9cafd2983 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -232,10 +232,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
232[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime, 232[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
233 const VideoCommon::ImageInfo& info) { 233 const VideoCommon::ImageInfo& info) {
234 if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) { 234 if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) {
235 return Settings::values.accelerate_astc.GetValue() && 235 return Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::Gpu &&
236 Settings::values.astc_recompression.GetValue() == 236 Settings::values.astc_recompression.GetValue() ==
237 Settings::AstcRecompression::Uncompressed && 237 Settings::AstcRecompression::Uncompressed;
238 !Settings::values.async_astc.GetValue();
239 } 238 }
240 // Disable other accelerated uploads for now as they don't implement swizzled uploads 239 // Disable other accelerated uploads for now as they don't implement swizzled uploads
241 return false; 240 return false;
@@ -267,7 +266,8 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
267[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime, 266[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime,
268 const VideoCommon::ImageInfo& info) { 267 const VideoCommon::ImageInfo& info) {
269 if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) { 268 if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
270 return Settings::values.async_astc.GetValue(); 269 return Settings::values.accelerate_astc.GetValue() ==
270 Settings::AstcDecodeMode::CpuAsynchronous;
271 } 271 }
272 return false; 272 return false;
273} 273}
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 2a74c1d05..6b8d4e554 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -473,7 +473,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
473 glBindTextureUnit(0, screen_info.display_texture); 473 glBindTextureUnit(0, screen_info.display_texture);
474 474
475 auto anti_aliasing = Settings::values.anti_aliasing.GetValue(); 475 auto anti_aliasing = Settings::values.anti_aliasing.GetValue();
476 if (anti_aliasing > Settings::AntiAliasing::LastAA) { 476 if (anti_aliasing >= Settings::AntiAliasing::MaxEnum) {
477 LOG_ERROR(Render_OpenGL, "Invalid antialiasing option selected {}", anti_aliasing); 477 LOG_ERROR(Render_OpenGL, "Invalid antialiasing option selected {}", anti_aliasing);
478 anti_aliasing = Settings::AntiAliasing::None; 478 anti_aliasing = Settings::AntiAliasing::None;
479 Settings::values.anti_aliasing.SetValue(anti_aliasing); 479 Settings::values.anti_aliasing.SetValue(anti_aliasing);
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp
index d3cddac69..81ef98f61 100644
--- a/src/video_core/renderer_vulkan/vk_swapchain.cpp
+++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp
@@ -45,8 +45,8 @@ static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
45 return mode; 45 return mode;
46 } 46 }
47 switch (mode) { 47 switch (mode) {
48 case Settings::VSyncMode::FIFO: 48 case Settings::VSyncMode::Fifo:
49 case Settings::VSyncMode::FIFORelaxed: 49 case Settings::VSyncMode::FifoRelaxed:
50 if (has_mailbox) { 50 if (has_mailbox) {
51 return Settings::VSyncMode::Mailbox; 51 return Settings::VSyncMode::Mailbox;
52 } else if (has_imm) { 52 } else if (has_imm) {
@@ -59,8 +59,8 @@ static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
59 }(); 59 }();
60 if ((setting == Settings::VSyncMode::Mailbox && !has_mailbox) || 60 if ((setting == Settings::VSyncMode::Mailbox && !has_mailbox) ||
61 (setting == Settings::VSyncMode::Immediate && !has_imm) || 61 (setting == Settings::VSyncMode::Immediate && !has_imm) ||
62 (setting == Settings::VSyncMode::FIFORelaxed && !has_fifo_relaxed)) { 62 (setting == Settings::VSyncMode::FifoRelaxed && !has_fifo_relaxed)) {
63 setting = Settings::VSyncMode::FIFO; 63 setting = Settings::VSyncMode::Fifo;
64 } 64 }
65 65
66 switch (setting) { 66 switch (setting) {
@@ -68,9 +68,9 @@ static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
68 return VK_PRESENT_MODE_IMMEDIATE_KHR; 68 return VK_PRESENT_MODE_IMMEDIATE_KHR;
69 case Settings::VSyncMode::Mailbox: 69 case Settings::VSyncMode::Mailbox:
70 return VK_PRESENT_MODE_MAILBOX_KHR; 70 return VK_PRESENT_MODE_MAILBOX_KHR;
71 case Settings::VSyncMode::FIFO: 71 case Settings::VSyncMode::Fifo:
72 return VK_PRESENT_MODE_FIFO_KHR; 72 return VK_PRESENT_MODE_FIFO_KHR;
73 case Settings::VSyncMode::FIFORelaxed: 73 case Settings::VSyncMode::FifoRelaxed:
74 return VK_PRESENT_MODE_FIFO_RELAXED_KHR; 74 return VK_PRESENT_MODE_FIFO_RELAXED_KHR;
75 default: 75 default:
76 return VK_PRESENT_MODE_FIFO_KHR; 76 return VK_PRESENT_MODE_FIFO_KHR;
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index bf6ad6c79..53d749bd4 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -817,7 +817,7 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
817 : device{device_}, scheduler{scheduler_}, memory_allocator{memory_allocator_}, 817 : device{device_}, scheduler{scheduler_}, memory_allocator{memory_allocator_},
818 staging_buffer_pool{staging_buffer_pool_}, blit_image_helper{blit_image_helper_}, 818 staging_buffer_pool{staging_buffer_pool_}, blit_image_helper{blit_image_helper_},
819 render_pass_cache{render_pass_cache_}, resolution{Settings::values.resolution_info} { 819 render_pass_cache{render_pass_cache_}, resolution{Settings::values.resolution_info} {
820 if (Settings::values.accelerate_astc) { 820 if (Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::Gpu) {
821 astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, 821 astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool,
822 compute_pass_descriptor_queue, memory_allocator); 822 compute_pass_descriptor_queue, memory_allocator);
823 } 823 }
@@ -1301,12 +1301,19 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
1301 runtime->ViewFormats(info.format))), 1301 runtime->ViewFormats(info.format))),
1302 aspect_mask(ImageAspectMask(info.format)) { 1302 aspect_mask(ImageAspectMask(info.format)) {
1303 if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { 1303 if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
1304 if (Settings::values.async_astc.GetValue()) { 1304 switch (Settings::values.accelerate_astc.GetValue()) {
1305 case Settings::AstcDecodeMode::Gpu:
1306 if (Settings::values.astc_recompression.GetValue() ==
1307 Settings::AstcRecompression::Uncompressed &&
1308 info.size.depth == 1) {
1309 flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
1310 }
1311 break;
1312 case Settings::AstcDecodeMode::CpuAsynchronous:
1305 flags |= VideoCommon::ImageFlagBits::AsynchronousDecode; 1313 flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
1306 } else if (Settings::values.astc_recompression.GetValue() == 1314 break;
1307 Settings::AstcRecompression::Uncompressed && 1315 default:
1308 Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) { 1316 break;
1309 flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
1310 } 1317 }
1311 flags |= VideoCommon::ImageFlagBits::Converted; 1318 flags |= VideoCommon::ImageFlagBits::Converted;
1312 flags |= VideoCommon::ImageFlagBits::CostlyLoad; 1319 flags |= VideoCommon::ImageFlagBits::CostlyLoad;
diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp
index d8b88d9bc..39c08b5ae 100644
--- a/src/video_core/textures/texture.cpp
+++ b/src/video_core/textures/texture.cpp
@@ -72,12 +72,12 @@ float TSCEntry::MaxAnisotropy() const noexcept {
72 } 72 }
73 const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); 73 const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue();
74 s32 added_anisotropic{}; 74 s32 added_anisotropic{};
75 if (anisotropic_settings == 0) { 75 if (anisotropic_settings == Settings::AnisotropyMode::Automatic) {
76 added_anisotropic = Settings::values.resolution_info.up_scale >> 76 added_anisotropic = Settings::values.resolution_info.up_scale >>
77 Settings::values.resolution_info.down_shift; 77 Settings::values.resolution_info.down_shift;
78 added_anisotropic = std::max(added_anisotropic - 1, 0); 78 added_anisotropic = std::max(added_anisotropic - 1, 0);
79 } else { 79 } else {
80 added_anisotropic = Settings::values.max_anisotropy.GetValue() - 1U; 80 added_anisotropic = static_cast<u32>(Settings::values.max_anisotropy.GetValue()) - 1U;
81 } 81 }
82 return static_cast<float>(1U << (max_anisotropy + added_anisotropic)); 82 return static_cast<float>(1U << (max_anisotropy + added_anisotropic));
83} 83}