Commit graph

54 commits

Author SHA1 Message Date
Steveice10 50f22d1f59
video_core: Abstract shader generators. (#6990)
* video_core: Abstract shader generators.

* shader: Extract common generator structures and move generators to specific namespaces.

* shader: Minor fixes and clean-up.
2023-09-30 02:06:06 -07:00
GPUCode 928f352c94
renderer_gl: Use explicit bindings (#6940)
* renderer_gl: Use explicit bindings

* gl_state: Match shadow order with vulkan
2023-09-07 21:42:22 +03:00
GPUCode 1159e4d928
video_core: Take factors into account with min/max blending functions (#6925)
* sw_framebuffer: Take factors into account for min/max blending

* renderer_gl: Take factors into account for min/max blending

* Address review comments

* gl_shader_gen: Fix frambuffer fetch on qcom and mali

* renderer_opengl: Add fallback path for mesa

* gl_shader_gen: Avoid emitting blend emulation if minmax_factor is present
2023-08-30 21:26:28 +03:00
GPUCode 88ea66053e
Miscallenious fixes to gl backend and qt frontend (#6834)
* renderer_gl: Make rasterizer normal class member

* It doesn't need to be heap allocated anymore

* gl_rasterizer: Remove default_texture

* It's unused

* gl_rasterizer: General cleanup

* gl_rasterizer: Lower case lambdas

* Match style with review comments from vulkan backend

* rasterizer_cache: Prevent memory leak

* Since the switch from shared_ptr these surfaces were no longer being destroyed properly. Use our garbage collector for that purpose to destroy it safely for both backends

* rasterizer_cache: Make temp copy of old surface

* The custom surface would override the memory region of the old region resulting in garbage data, this ensures the custom surface is constructed correctly

* citra_qt: Manually create dialog tabs

* Allows for custom constructors which is very useful. While at it, global state is now eliminated from configuration

* citra_qt: Eliminate global system usage

* core: Remove global system usage in memory and HIO

* citra_qt: Use qOverload

* tests: Run clang format

* gl_texture_runtime: Fix surface scaling
2023-08-02 01:40:39 +03:00
GPUCode cf9bb90ae3
code: Use std::span where appropriate (#6658)
* code: Use std::span when possible

* code: Prefix memcpy and memcmp with std::
2023-07-07 01:52:40 +03:00
Vitor K 34de77d429
Various miscelaneous changes (#6496) 2023-05-03 17:24:10 +02:00
GPUCode 06f3c90cfb
Custom textures rewrite (#6452)
* common: Add thread pool from yuzu

* Is really useful for asynchronous operations like shader compilation and custom textures, will be used in following PRs

* core: Improve ImageInterface

* Provide a default implementation so frontends don't have to duplicate code registering the lodepng version

* Add a dds version too which we will use in the next commit

* rasterizer_cache: Rewrite custom textures

* There's just too much to talk about here, look at the PR description for more details

* rasterizer_cache: Implement basic pack configuration file

* custom_tex_manager: Flip dumped textures

* custom_tex_manager: Optimize custom texture hashing

* If no convertions are needed then we can hash the decoded data directly removing the needed for duplicate decode

* custom_tex_manager: Implement asynchronous texture loading

* The file loading and decoding is offloaded into worker threads, while the upload itself still occurs in the main thread to avoid having to manage shared contexts

* Address review comments

* custom_tex_manager: Introduce custom material support

* video_core: Move custom textures to separate directory

* Also split the files to make the code cleaner

* gl_texture_runtime: Generate mipmaps for material

* custom_tex_manager: Prevent memory overflow when preloading

* externals: Add dds-ktx as submodule

* string_util: Return vector from SplitString

* No code benefits from passing it as an argument

* custom_textures: Use json config file

* gl_rasterizer: Only bind material for unit 0

* Address review comments
2023-04-27 07:38:28 +03:00
GPUCode 71d4a85957 video_core: Disable async shader loading with strict contexts 2023-04-03 14:32:13 +03:00
GPUCode b5d6f645bd
Prepare frontend for multiple graphics APIs (#6347)
* externals: Update dynarmic

* settings: Introduce GraphicsAPI enum

* For now it's OpenGL only but will be expanded upon later

* citra_qt: Introduce backend agnostic context management

* Mostly a direct port from yuzu

* core: Simplify context acquire

* settings: Add option to create debug contexts

* renderer_opengl: Abstract initialization to Driver

* This commit also updates glad and adds some useful extensions which we will use in part 2

* Rasterizer construction is moved to the specific renderer instead of RendererBase.
  Software rendering has been disable to achieve this but will be brought back in the next commit.

* video_core: Remove Init/Shutdown methods from renderer

* The constructor and destructor can do the same job

* In addition move opengl function loading to Qt since SDL already does this. Also remove ErrorVideoCore which is never reached

* citra_qt: Decouple software renderer from opengl part 1

* citra: Decouple software renderer from opengl part 2

* android: Decouple software renderer from opengl part 3

* swrasterizer: Decouple software renderer from opengl part 4

* This commit simply enforces the renderer naming conventions in the software renderer

* video_core: Move RendererBase to VideoCore

* video_core: De-globalize screenshot state

* video_core: Pass system to the renderers

* video_core: Commonize shader uniform data

* video_core: Abstract backend agnostic rasterizer operations

* bootmanager: Remove references to OpenGL for macOS

OpenGL macOS headers definitions clash heavily with each other

* citra_qt: Proper title for api settings

* video_core: Reduce boost usage

* bootmanager: Fix hide mouse option

Remove event handlers from RenderWidget for events that are
already handled by the parent GRenderWindow.
Also enable mouse tracking on the RenderWidget.

* android: Remove software from graphics api list

* code: Address review comments

* citra: Port per-game settings read

* Having to update the default value for all backends is a pain so lets centralize it

* android: Rename to OpenGLES

---------

Co-authored-by: MerryMage <MerryMage@users.noreply.github.com>
Co-authored-by: Vitor Kiguchi <vitor-kiguchi@hotmail.com>
2023-03-27 14:29:17 +03:00
Tobias bb05d8c12a
src/CMakeLists: Enforce multiple warnings on MSVC (#5692) 2022-11-09 23:14:28 +01:00
GPUCode cbd5d1c15c
Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115) 2022-09-21 18:36:12 +02:00
SachinVin baecc18d8c
Partially Revert "renderer_opengl: Remove amd hacks and legacy paths" (#6122)
This reverts commit 07a69b7c7b.
2022-09-10 15:35:13 +05:30
emufan4568 12f84e18dc externals: Upgrade glad to latest version
* Also change some mentions to OpenGL 3.3 to 4.3
2022-08-22 23:44:03 +03:00
emufan4568 31e6b553dc video_core: Run clang format 2022-08-22 08:00:30 +03:00
emufan4568 e6137d7874 renderer_opengl: Remove GLvec* types
* The common types already exist and provide all the functionality required, why invent new types?
2022-08-21 12:22:58 +03:00
emufan4568 2726fe66db renderer_opengl: Header cleanup
* Should help with building times
2022-08-21 02:22:57 +03:00
emufan4568 07a69b7c7b renderer_opengl: Remove amd hacks and legacy paths
* AMDs new driver fixed many issues in the OpenGL driver. No reason to
  keep these hacks. In addition the upgrade to 4.3 guarantees the
  existance of required extensions, so no need to check for them
2022-08-21 01:52:49 +03:00
pawelniegowski ff81fb04b4 Fix MakeCurrent and shader issues with AMD 22.7 driver 2022-07-29 12:26:18 +02:00
SachinVin b5ac9e4946
Backport non-seperable disk shader from android (#5976)
* VideoCore: Backport Shader cache for non separable shaders

android: disk_shader_cache: remove redundant lookup

* disk_shader_cache: dont compile dumped shaders

* cleanup Seperable shader loading

* gl_shader_disk_cache.cpp: remove redundant checks

* Skip compiling non seperable raws

* gl_shader_manager.cpp: Skip `GLAD_GL_ARB_get_program_binary` check on GLES
2022-04-02 11:57:14 +05:30
SachinVin 6183b5d76c
Merge pull request #5823 from SachinVin/dyn
Android: Backport easy stuff
2021-10-03 18:58:20 +05:30
SachinVin d4e85e2bb5
video_core: Disable disk shader cache when GL_ARB_get_program_binary is unsupported (#5785) 2021-10-03 18:57:34 +05:30
bunnei e028eb91c0 video_core: gl_shader_manager: Only set shader samplers on fragment shader.
- Avoids unnecessary uniform errors.
2021-09-29 22:51:13 +05:30
weihuoya cddd447506 use separate texture buffer for light and fog
gl_state.cpp: Fix typo in texture buffer LUT

gl_state.cpp: Initialize texture_buffer_lut_lf
2021-07-24 23:36:53 +05:30
SachinVin 842031a2eb
Fix Disk shader cache when accurate multiplication is off (#5711)
* renderer_opengl.cpp: fix sanitize_mul check for disk shader cache

* Partially revert "Band-aid solution for 'Disk Shader Cache' (#5188)"

This reverts commit 2e0ce86c9e.

* Disable `disk_shader_cache` checkbox when `hw_renderer` is off
2021-05-16 10:45:02 +02:00
FearlessTobi 20139141f7 video_core: Remove unnecessary enum class casting in logging messages
fmt now automatically prints the numeric value of an enum class member by default, so we don't need to use casts any more.

Reduces the line noise in our code a bit.

Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
2020-12-28 16:50:23 +01:00
gal20 8b82a228f0
change result back to std::optional 2020-11-14 21:46:29 +02:00
gal20 5055212063
Update src/video_core/renderer_opengl/gl_shader_manager.cpp
Co-authored-by: Marshall Mohror <mohror64@gmail.com>
2020-11-14 21:45:30 +02:00
gal20 03c002ee2a
make result not optional
This fixes crash when hardware shader is enabled in the flatpak version
2020-11-14 19:58:12 +02:00
Lioncash f2a7fe05c3 gl_shader_manager: Make use of std::nullopt where applicable
Prevents the internal buffer in the std::optional from being zeroed out
unnecessarily and instead sets the validity byte only in some
implementations.

While we're at it, we can make use of std::move to eliminate unnecessary
heap reallocations from occurring.
2020-05-04 23:00:11 -04:00
Lioncash ca4f7266c0 gl_shader_manager: Remove unused variable within LoadDiskCache() 2020-04-30 22:48:57 -04:00
Lioncash 138539c9a0 gl_shader_manager: Eliminate variable shadowing
Resolves a few -Wshadow warnings.
2020-04-30 22:46:58 -04:00
Lioncash 2d83b39532 gl_shader_manager: Avoid unnecessary std::vector copy in LoadDiskCache()
Same behavior, but without an unnecessary reallocation.
2020-04-30 22:43:03 -04:00
Lioncash c72d9b806b gl_shader_manager: std::move std::string where applicable
Prevents unnecessary copies from occurring. In the case of ShaderCache,
we can just remove the parameter, given it's unused.
2020-04-18 21:40:21 -04:00
James Rowe e95bc52b3d Only check for sanitize_mul if theres a shader in the cache 2020-01-16 08:35:52 -07:00
James Rowe cf4125a6a5 Only load precompiled shaders if their sanitize_mul setting matches 2020-01-15 21:10:37 -07:00
James Rowe 45bc5b465e Add a error log for unsupported configurations for disk cache 2020-01-15 19:58:34 -07:00
James Rowe 2d86bc6db5 Rename InvalidateTransferable to InvalidateAll to match what it does 2020-01-15 19:58:34 -07:00
James Rowe 7092ba8480 Only add shaders to precompiled cache if they are new 2020-01-15 19:58:34 -07:00
James Rowe 061a33477f Properly bind the shader sampler and uniform bindings 2020-01-15 19:58:34 -07:00
James Rowe 4e9ec4efd0 Add shader disk caching 2020-01-15 19:58:33 -07:00
Weiyi Wang dd3ba7bd21 opengl: remove hw geometry shader related stuff 2019-08-18 20:07:50 -04:00
Tobias 46e8237e7e Port yuzu-emu/yuzu#1137: "renderer_opengl: Namespace OpenGL code" (#4423)
* renderer_opengl: Namespace OpenGL code

Namespaces all OpenGL code under the OpenGL namespace.

Prevents polluting the global namespace and allows clear distinction
between other renderers' code in the future.

* Also namespace TextureCubeConfig
2018-11-16 23:29:10 -08:00
B3n30 d37a2270d6 Replace boost::optional with std::optional where possible 2018-10-05 13:51:09 +02:00
Weiyi Wang 7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
wwylele 266f2b6242 gl_rasterizer: only apply AMD hack when the vendor is AMD 2018-07-31 22:58:17 +03:00
Valentin Vanelslande fef231dc5b
gl_shader_manager: fix macro 2018-06-30 11:24:38 -05:00
Markus Wick 831d4f9aeb gl_rasterizer: Use the shared texture buffer for the proctex lut. 2018-06-22 17:20:55 +02:00
Markus Wick 1ca6d2ea8d gl_rasterizer: Use the shared texture buffer for the noise, color and alpha map. 2018-06-22 17:20:55 +02:00
Markus Wick 63fb7dcc1b gl_rasterizer: Use the shared texture buffer for the fog lut. 2018-06-22 17:20:55 +02:00
Markus Wick 4679487640 gl_rasterizer: Use the shared texture buffer for the lighting lut. 2018-06-22 17:20:54 +02:00