Commit graph

1541 commits

Author SHA1 Message Date
emufan4568 2ed89b6448 cached_surface: Add missing include 2022-08-21 17:47:47 +03:00
emufan4568 9b5230c60e rasterizer_cache: Always create TextureDownloaderES
* It's used when dumping textures on desktop, so create it upfront to avoid null checks
2022-08-21 13:35:06 +03:00
emufan4568 1579f96397 rasterizer_cache: Remove remaining OpenGL code 2022-08-21 13:32:02 +03:00
emufan4568 fc450edd14 gl_rasterizer: Fix minor warnings and improve readability 2022-08-21 12:42:32 +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 e834f2b049 gl_resource_manager: Fix bug when allocating 3D textures 2022-08-21 02:24:13 +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
emufan4568 025cd31420 video_core: Bump OpenGL version to 4.3 on desktop
* The current backend heavily depends on many extensions for shadow
  rendering and texture cubes in the fragment shaders. All these
  extensions were incorporated to core in 4.3. Support is practically
  ubiquitous and requiring support for it makes things a lot easier
2022-08-21 01:39:16 +03:00
emufan4568 17ad594a62 rasterizer_cache: Introduce TextureRuntime and separate CachedSurface
* This commit aims to both continue the rasterizer cache cleanup by
  separating CachedSurface into a dedicated header and to start weeding
  out the raw OpenGL code from the cache.

* The latter is achieved by abstracting most texture operations in a new
  class called TextureRuntime. This has many benefits such as making it easier
  to port the functionality to other graphics APIs and the removal of the need
  to pass (read/draw) framebuffer handles everywhere. The filterer and
  reinterpreter get their own sets of FBOs due to this, something that
  might be a performance win since it reduces the state switching
  overhead on the runtime FBOs.
2022-08-21 01:16:48 +03:00
emufan4568 199671301d rasterizer_cache: Header cleanup and copyright date update 2022-08-21 01:16:48 +03:00
emufan4568 f6e3bb54f4 rasterizer_cache: Move utlities and type to separate headers 2022-08-21 01:16:48 +03:00
emufan4568 0fedf11be1 rasterizer_cache: Move depth tuples to cpp file 2022-08-21 01:16:47 +03:00
emufan4568 22acfe4d41 rasterizer_cache: SurfaceParams interface cleanup 2022-08-21 01:16:47 +03:00
emufan4568 cb0816c987 rasterizer_cache: Compute width and height only when used
Solves the compiler warning
2022-08-21 01:16:47 +03:00
emufan4568 6a7d601e42 rasterizer_cache: Factor morton swizzle and pixel format to dedicate headers
* Makes the code cleaner in general by not having to alias PixelFormat and SurfaceType everywhere
2022-08-21 01:16:47 +03:00
emufan4568 efc2db4088 rasterizer_cache: Separate into common directory 2022-08-21 01:16:42 +03:00
pawelniegowski b0c72c2ea7 revert GLSL version change 2022-08-10 16:36:23 +02:00
pawelniegowski ff81fb04b4 Fix MakeCurrent and shader issues with AMD 22.7 driver 2022-07-29 12:26:18 +02:00
BreadFish64 353aaaf665
Merge pull request #6010 from SachinVin/gunman
shader_jit: Fixes for Gunman clive
2022-07-06 23:45:44 -05:00
SachinVin 65611e5b51 Shader jit: Save and restore LOOPCOUNT_REG for nested loops,
also add the assert back for nested loops
update test
2022-05-21 11:24:32 +05:30
Morph de1374c1b9 video_core: Resolve C4267 warning on MSVC 2022-05-18 00:05:41 -04:00
SachinVin 047e238d09 shader_jit: Compile nested loops
and use `T_NEAR` instead of the default in Compile_BREAKC
2022-04-24 23:12:53 +05:30
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 d35a7a8e23
Merge pull request #5804 from weihuoya/minorfx
Minor fx
2022-01-30 21:51:11 +05:30
SachinVin 4e15823db2
gl_format_reinterpreter.cpp: fallback to PBO path on obsolete intel drivers (#5928) 2022-01-24 14:14:28 +05:30
zhang wei afa7f4996f
fx bgr write back on gles (#5924) 2022-01-24 14:14:12 +05:30
trimental 2670b951e1
Fix software renderer for empty texture addresses (#5893) 2022-01-07 11:36:01 -06:00
bunnei 83913e68f3
Merge pull request #5905 from SachinVin/intel
Remove CopyImageSubData; and enable TextureView reinterpreter only on nvidia
2022-01-04 17:41:14 -08:00
SachinVin 5bd146b569 gl_format_reinterpreter.cpp: remove CopyImageSubData; and enable TextureView reinterpreter only on nvidia 2021-12-19 00:38:24 +05:30
SutandoTsukai181 60235827c5 Add Cardboard VR
Based on hrydgard/ppsspp/pull/12449
2021-12-18 16:52:24 +05:30
bunnei b7a156f7c8 android: frontend: Track screen layout separately for orientation.
android framebuffer
2021-12-18 16:52:17 +05:30
SachinVin e8269a9e36 gl_format_reinterpreter.cpp: attempt to skip D24S8 to RGBA8 reinterpretation fast path for older nvidia GPUs,
additionally check for GL_ARB_copy_image in the fallback path
2021-10-06 22:22:26 +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
SachinVin 80799b1e5d gl_shader_gen.cpp: Fix separable shaders when GL_EXT_clip_cull_distance is not supported 2021-10-02 16:38:29 +05:30
SachinVin 80b8d66017 gl_rasterizer.cpp: don't check for GL_ARB_copy_image when using GLES 2021-10-02 16:38:27 +05:30
SachinVin 228f648e3f video_core/CMakeLists.txt: Use toolchain cmake in shader header generator 2021-10-02 16:38:26 +05:30
bunnei 9fbda04891 gl_shader_decompiler: Improve performance of accurate_mul on Android. 2021-10-02 16:38:24 +05:30
xperia64 8a68c58070 Shield TV driver bug workaround
shield tv
2021-10-02 16:38:22 +05:30
SachinVin 703ef0e6f0 gl_shader_gen.cpp:fix implicit type conversion error for gles 2021-10-02 16:38:20 +05:30
zhupengfei 84844e1b24 gl_shader_util: Specify default precision for uimage2D
Otherwise, this causes the application to crash when compiling any shader, on both devices I tested.
2021-10-02 16:38:18 +05:30
BreadFish64 e6b59cb5d8 video_core: implement optimized D24S8->RGBA8 reinterpreters 2021-10-02 16:38:17 +05:30
James Rowe fda121c25c Use immutable storage when available 2021-10-02 16:38:15 +05:30
BreadFish64 b2057e1b62 android: disable OpenGL debug message again 2021-10-02 16:38:15 +05:30
BreadFish64 54b8af1444 video_core: implement GLES depth/stencil downloads
video_core: disable depth/stencil texture download on OpenGL ES

Disable deptch stencil shader in texture_downloader_es for now

enable_depth_stencil

DepthStencil

remove GL_DEBUG_OUTPUT_SYNCHRONOUS
2021-10-02 14:19:27 +05:30
BreadFish64 91f52c2fdb video_core: fix texture filters in GLES
anime4k: reset state.texture_units[0].texture_2d before filtering

clang-fmt
2021-09-29 22:51:16 +05:30
bunnei 6f1c76518c android: renderer_opengl: Various fixes for GLES.
video_core: bump swap chain size for GLES to reduce bottleneck

SWAP_CHAIN_SIZE
2021-09-29 22:51:14 +05:30
bunnei 8a06463c97 android: video_core: Enable HW shadows and texture barrier on GLES. 2021-09-29 22:51:13 +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
bunnei 3b2b9282d3 android: video_core: Require GLES 3.2 in shaders. 2021-09-29 22:51:13 +05:30
bunnei 5a31aa175d android: video_core: gl_rasterizer_cache: Make cache access thread safe. 2021-09-29 22:51:12 +05:30
bunnei a941547c1c android: renderer_opengl: Partially implement glLogicOp on GLES. 2021-07-24 23:37:03 +05:30
bunnei 853acce6c5 android: renderer_opengl: Optimize GetTexImageOES and fix bugs. 2021-07-24 23:37:01 +05:30
bunnei 855d19a468 android: gl_rasterizer_cache: Skip costly shutdown procedure. 2021-07-24 23:37:00 +05:30
SachinVin 4439423313 (jroweboy)gl_rasterizer_cache.cpp: Check Framebuffer Status 2021-07-24 23:36:58 +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
Valeri dd31ed60c0
Add Get(Inv)WindowResolution shader functions (#5818)
Those are available in upstream Dolphin, so it will help with keeping things compatible.
2021-07-24 12:35:33 -05:00
weihuoya b7f0e886d9 make sure initialized, prevent garbage data 2021-06-22 15:15:33 +08:00
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
bunnei 9ff97270cf
Merge pull request #5501 from FearlessTobi/port-1064-3948
Port yuzu-emu/yuzu#1064 and yuzu-emu/yuzu#3948: Changes to Telemetry and CPU feature detection
2021-04-23 22:58:08 -07:00
bunnei 24086d05bb
Merge pull request #5471 from vitor-k/misc
Fix some warnings and some small changes
2021-04-23 22:54:00 -07:00
Vitor Kiguchi 3fb1988b5b gl_rasterizer: check for GL_ARB_copy_image 2021-04-06 00:20:00 -03:00
Vitor Kiguchi 981ffb5090 shader_disk_cache: warn the user when ARB_get_program_binary is not supported. 2021-04-06 00:19:59 -03:00
xperia64 c2d36cde9f
Fix destructor order in rasterizer cache (#5725) 2021-02-21 18:05:27 -05:00
Marshall Mohror e6c479f497
Merge pull request #5710 from BreadFish64/bonk_textures
gl_rasterizer_cache: Remove all fully invalid surfaces from the cache
2021-02-11 19:06:03 -06:00
xperia64 2ddecf35d2
Avoid leaking fences during re-presentation (#5713)
* Avoid leaking fences during re-presentation
2021-02-09 11:32:48 -05:00
Marshall Mohror 5776bdda82
Merge pull request #5546 from FearlessTobi/port-5524
Port yuzu-emu/yuzu#4086 and yuzu-emu/yuzu#4611: Xbyak cleanups
2021-02-08 16:00:18 -06:00
BreadFish64 ff56fdf37d fix recycling custom textures 2021-02-08 15:53:06 -06:00
Marshall Mohror 00c798991c
remove semicolon 2021-02-05 08:25:02 -06:00
Marshall Mohror 6b2e7b77cc
Merge pull request #5657 from FearlessTobi/port-5158
Port yuzu-emu/yuzu#5158: "video_core: Remove unnecessary enum class casting in logging messages"
2021-02-04 10:51:29 -06:00
BreadFish64 a131f9eb74 gl_rasterizer_cache: don't place null textures in the recycler 2021-02-03 13:29:03 -06:00
BreadFish64 85e9ba897d gl_rasterizer_cache: Recycle host textures
Allocating new textures has fairly high driver overhead.
We can avoid some of this by reusing the textures from destroyed surfaces since the game will probably create more textures with the same dimensions and format.
2021-02-02 20:46:25 -06:00
BreadFish64 935e88a580 gl_rasterizer_cache: Remove all fully invalid surfaces from the cache
Some games (e.g. Pilotwings Resort) create many surfaces that are invalidated quickly but were never removed.
This occasionally lead to large lag spikes due to high lookup times and other data structure management overhead.
2021-02-02 20:43:41 -06:00
Lioncash 10f440cb59 common/telemetry: Migrate namespace into the Common namespace
Migrates the Telemetry namespace into the Common namespace to make the
code consistent with the rest of our common code.
2021-01-04 05:17:13 +01:00
Lioncash 9c08409e0e externals: Update Xbyak to 5.96
I made a request on the Xbyak issue tracker to allow some constructors
to be constexpr in order to avoid static constructors from needing to
execute for some of our register constants.

This request was implemented, so this updates Xbyak so that we can make
use of it.
2021-01-04 05:11:18 +01:00
xperia64 94d1f695ee
Use alternate-form formatting for floats after fmt 7.1.2 update (#5654)
* Use alternate-form formatting for floats after 7.1.2  update

* Last two floats
2020-12-28 18:32:36 -05: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
Vitor Kiguchi 8e54e7cf1a fix some conversion warnings 2020-12-06 16:01:59 -03:00
xperia64 4f058c04e8
Fix telemetry-related exit crash from use-after-free (#5617)
* Fix telemetry-related exit crash from use-after-free

* ...clang format
2020-11-22 21:45:14 +08:00
Marshall Mohror a89261d397
Merge pull request #5580 from oneup03/master
Implement Reverse Interlaced 3D
2020-11-16 16:53:05 -06: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
tywald 2e0ce86c9e
Band-aid solution for 'Disk Shader Cache' (#5188)
* Enable 'Accurate Multiplication' by default.

* Move 'Disk Shader Cache' to the 'Advanced' tab

* Prevent enabling 'Disk Shader Cache' when 'Enable Hardware Shader' or 'Accurate Multiplication' is disabled.

* Do not load 'Disk Shader Cache' when 'Accurate Multiplication' is disabled.

* Add a tooltip for 'Disk Shader Cache'.
2020-11-06 10:07:59 -08:00
OneUp03 33d233fffa Add reverse_interlaced uniform flag 2020-10-21 12:27:02 -05:00
OneUp03 a4f57e6910 Implement Reverse Interlaced 3D 2020-10-16 11:41:08 -05:00
FearlessTobi 51d348b087 General: Make use of std::nullopt where applicable
Allows some implementations to avoid completely zeroing out the internal
buffer of the optional, and instead only set the validity byte within
the structure.

This also makes it consistent how we return empty optionals.

Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
2020-10-03 17:25:54 +02:00
xperia64 1128f5f8ee Silence some noisy switch case warning 2020-09-06 16:22:48 -04:00
Vitor Kiguchi a6efc7c1ee Separate the enums from cam/cam.h
The settings.h file doesn't actually need all of the definitions
on cam.h, only some of the enums. They can, therefore, be separated
into another file, which is included by settings.h instead.
The other changes are fixing files that included settings.h and
depended on indirect includes from includes of includes of cam.h
2020-08-19 01:45:57 -03:00
Marshall Mohror f4e727cc19
Merge pull request #5420 from citra-emu/xglTextureBarrier
videocore: When an image is the current framebuffer and is sampled, make a copy instead of using glTextureBarrier
2020-07-07 16:45:27 -05:00
BreadFish64 60282f35fe fix clang format 2020-07-07 16:43:42 -05:00
BreadFish64 662c348b6c fix 2020-06-27 13:23:34 -05:00
BreadFish64 ea2584c54d generic texture allocator 2020-06-27 13:13:37 -05:00
BreadFish64 cae4b7aaf7 Clean up 2020-06-26 15:41:10 -05:00
LC e79de3107e
gl_resource_manager: Make use of noexcept on move constructors and move assignment operators (#5340)
Some of the classes in this file already do this, so we can apply this
to the other ones to be consistent.

Allows these classes to play nicely and not churn copies when used with
standard containers or any other API that makes use of
std::move_if_noexcept.
2020-06-23 11:00:25 -05:00
Marshall Mohror 372c653ec3
Fix clang-format 2020-06-20 14:03:04 -05:00
Marshall Mohror 353780e1c9
Merge pull request #5403 from lioncash/gen2
gl_shader_gen: Minor string cleanups
2020-06-20 13:09:24 -05:00
BreadFish64 b80c6f7534 handle all cases more robustly 2020-06-20 13:01:26 -05:00
BreadFish64 d04071d6b3 video_core/GLES: fix issues cause by missing glTextureBarrier
create a duplicate for sampling instead
2020-06-20 13:01:26 -05:00
LC 8ce81b19be
General: Remove usages of ARRAY_SIZE where applicable. (#5392)
Same behavior, but without our own boilerplate function.
2020-06-19 09:10:45 -05:00
xperia64 1504018a56
Avoid deadlock when stopping video dumping (#5407)
* Avoid deadlock when stopping video dumping

* Use static_cast, make quit atomic

* One more atomic load

* Use suggested lock instead of atomic

* Fix locking
2020-06-18 18:20:57 -04:00
Lioncash 2b031e4eaf gl_shader_gen: std::move strings where applicable
Avoids the creation of a copy when returning.
2020-06-08 06:59:05 -04:00
Lioncash 11792682fb gl_shader_gen: Collapse several format calls into one
Same behavior, but performs one formatting pass without altering the
readability of the formatting.
2020-06-08 06:44:03 -04:00
Lioncash e79e991681 gl_shader_gen: Mark local functions as static where applicable
These aren't used outside of the translation unit.
2020-06-08 06:40:39 -04:00
Lioncash 9645c1e1b2 gl_shader_gen: Eliminate unnecessary std::string construction in AppendProcTexCombineAndMap()
We can make use of a std::string_view here, since only string literals
are used within the switch.
2020-06-08 06:37:41 -04:00
Mat M 51dfc46d3f
gl_rasterizer_cache: Trivial minor cleanups (#5295)
* gl_rasterizer_cache: Mark file-scope functions as static where applicable

Prevents -Wmissing-declaration warnings from occurring and also makes
these functions internally linked.

* gl_rasterizer_cache: Remove unused local std::string variable

Despite being unused, compilers are unable to completely remove any code
gen related to the construction and destruction of this variable, since
the destructor of std::string is non-trivial.

Thus, we can remove it to reduce a minor amount of unnecessary code
generation

* gl_rasterizer_cache: Mark hash implementation as noexcept

This shouldn't throw.

* gl_rasterizer_cache: Remove unused variable in ClearAll()

* gl_rasterizer_cache: Make use of const on references explicit

While declared as auto&, these actually behave as const auto& variables,
due to the constness of the container being iterated. We can make this
explicit for readability sake.

* gl_rasterizer_cache: Resolve truncation warnings

The size is forwarded to a std::memset call, which takes a std::size_t
as its size parameter, so we can just make this change to silence the
warnings.

* gl_rasterizer_cache: Resolve variable shadowing warnings

Prevents a -Wshadow warning from occurring.
2020-05-18 09:19:54 -05:00
Ben 8d27b0714d
Merge pull request #5335 from lioncash/nullopt
gl_shader_manager: Make use of std::nullopt where applicable
2020-05-09 12:36:23 +02:00
Ben 4892d37309
Merge pull request #5336 from lioncash/constexpr
gl_rasterizer_cache: Make use of if constexpr in MortonCopyTile()
2020-05-09 12:36:04 +02:00
Ben 007fb63e47
Merge pull request #5230 from B3n30/circumvent_apple_intel_hw_shader_issue
Add flag to disable seperable shaders for osx Intel GPUs.
2020-05-09 12:34:21 +02:00
Ben 96ebd53466
Merge pull request #5264 from lioncash/gen
gl_shader_gen: Make use of fmt where applicable
2020-05-09 12:28:57 +02:00
Ben e959d44f00
Merge pull request #5262 from lioncash/fmt
gl_shader_decompiler: Make use of fmt with the decompiler
2020-05-09 12:28:34 +02:00
Lioncash cd201cd60f gl_shader_gen: Make use of fmt where applicable
Avoids string churn and makes it significantly easier to read the shader
template strings that are being used as the basis for formatting.
2020-05-08 14:50:48 -04:00
Lioncash 38c8fecb81 gl_rasterizer_cache: Make use of if constexpr in MortonCopyTile()
A trivial change that allows compilers to more rigorously optimize out
code blocks that will never be executed in some scenarios.
2020-05-04 23:08:53 -04: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 016d43df98 gl_shader_decompiler: Make use of fmt with the decompiler
Allows us to avoid even more string churn by allowing the AddLine
function to make use of fmt formatting so the string is formatted all at
once instead of concatenating multiple strings.

This is similar to how yuzu's decompiler works, which I've made function
the same way in the past.
2020-05-04 22:40:33 -04:00
Pengfei Zhu e212dc3a1f
Merge pull request #5297 from lioncash/missing
gl_rasterizer: Amend missing return value in branch in SetupGeometryShader()
2020-05-02 08:07:49 +08:00
Pengfei Zhu 4d7487bd34
Merge pull request #5298 from lioncash/unused
gl_rasterizer: Silence various compilation warnings
2020-05-01 23:34:36 +08:00
Pengfei Zhu 6a0636d631
Merge pull request #5296 from lioncash/flatten
gl_rasterizer_cache: Flatten LoadCustomTexture()
2020-05-01 23:01:47 +08:00
Pengfei Zhu 2eacb11c53
Merge pull request #5292 from lioncash/alloc
gl_shader_manager: Eliminate variable shadowing
2020-05-01 22:57:55 +08:00
Pengfei Zhu 1bb9a71a01
Merge pull request #5291 from lioncash/trunc
renderer_opengl: Resolve compiler truncation warnings
2020-05-01 22:56:46 +08:00
Ben fd1b254635
Merge pull request #5290 from lioncash/shader
gl_shader_gen: Minor interface cleanup
2020-05-01 16:16:25 +02:00
Lioncash 763778e6c0 gl_rasterizer: Make const on references consistent
Applies const to auto& instances that would actually resolve to a const
reference for readability and explicitness.
2020-05-01 06:19:20 -04:00
Lioncash 437453d32b gl_rasterizer: Amend missing return value in branch in SetupGeometryShader()
Previously undefined behavior was being invoked in the case that
geometry shaders weren't supported.
2020-05-01 06:10:32 -04:00
Lioncash 81768bf0c2 gl_rasterizer: Resolve truncation warnings 2020-05-01 06:08:20 -04:00
Lioncash df97021f55 gl_rasterizer: Make use of std::string_view in IsVendorAmd()
Same behavior, no heap allocation.

strings returned from glGetString() are guaranteed to be static strings,
so this is safe to do. They're also guaranteed to be null-terminated.
2020-05-01 05:57:25 -04:00
Lioncash de140a5870 gl_rasterizer: Default destructor in the cpp file 2020-05-01 05:53:40 -04:00
Lioncash ea08178dde gl_rasterizer: Remove unused emu_window variable in RasterizerOpenGL
Silences an unused private variable warning.
2020-05-01 05:52:48 -04:00
Lioncash 59a614a70f gl_rasterizer_cache: Remove unnecessary reference parameter in LoadCustomTexture()
This is only ever used in a self-referential manner, so we can make use
of the texture info member directly.
2020-05-01 05:42:35 -04:00
Lioncash e342f36e02 gl_rasterizer_cache: Flatten LoadCustomTexture()
Makes the control flow much nicer to follow, as we don't store to a
local before returning anymore.
2020-05-01 05:33:47 -04:00
Mat M 85d37c9994
gl_shader_disk: Make use of std::nullopt where applicable (#5293)
Some implementations can use the std::nullopt_t constructor of
std::optional to avoid needing to completely zero out the internal
buffer of the optional and instead only set the validity byte within it.

e.g. Consider the following function:

std::optional<std::vector<ShaderDiskCacheRaw>> fn() {
    return {};
}

With libc++ this will result in the following code generation on x86-64:

Fn():
  mov     rax, rdi
  vxorps  xmm0, xmm0, xmm0
  vmovups ymmword ptr [rdi], ymm0
  vzeroupper
  ret

With libstdc++, we also get the similar equivalent:

Fn():
  vpxor   xmm0, xmm0, xmm0
  mov     rax, rdi
  vmovdqu XMMWORD PTR [rdi], xmm0
  vmovdqu XMMWORD PTR [rdi+16], xmm0
  ret

If we change this function to return std::nullopt instead, then this
simplifies both the code gen from libc++ and libstdc++ down to:

Fn():
  mov     BYTE PTR [rdi+24], 0
  mov     rax, rdi
  ret

Given how little of a change is necessary to result in better code
generation, this is essentially a "free" very minor optimization.
2020-04-30 22:42:32 -05:00
Lioncash f20120e5a7 gl_shader_gen: Mark hash implementations as noexcept
These shouldn't throw at all, so we can mark the interface as such.
2020-04-30 22:57:36 -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 e118cb1e0b renderer_opengl: Resolve compiler truncation warnings
Resolves numerous truncation warnings on MSVC.
2020-04-30 22:26:14 -04:00
Lioncash d23ffe9b42 gl_shader_gen: Mark PicaVSConfig reference parameter as const
This isn't mutated whatsoever, so this can be marked const.
2020-04-30 22:07:25 -04:00
Ben 9dc0f38ffd
Merge pull request #5241 from lioncash/pica
pica_state: Make use of std::array where applicable
2020-04-28 09:01:41 +02:00
Marshall Mohror 8a0b0c2fc7
texture_filters: update ScaleForce (#5270)
* texture_filters: update ScaleForce

* texture_filters: optimize scale_force

* texture_filters/scale_force: optimize final offset calculation
2020-04-27 23:50:47 -05:00
Lioncash 41b7df4a32 command_processor: Resolve undefined behavior type punning
We can use std::memcpy to achieve the same behavior without undefined
behavior. Once Citra moves to C++20 we can convert this over to
std::bit_cast.
2020-04-27 15:35:21 -04:00
Lioncash 5ac4636a14 pica_state: Make use of std::array
Same behavior, stronger typing.
2020-04-27 15:35:18 -04:00
Mat M bc14f485c4
gl_shader_disk_cache: std::move entries in LoadTransferable() (#5249) 2020-04-24 17:49:54 +02:00
Pengfei Zhu 77ffe37c46
Merge pull request #5247 from lioncash/copy3
swrasterizer/proctex: Take regs by const reference
2020-04-24 22:07:03 +08:00
Mat M 8b43dff849
gl_shader_gen: Convert file-scope std::string into a std::string_view (#5263)
Same behavior, no heap allocations at program start up
2020-04-21 20:31:58 -05:00
Marshall Mohror db5b8b9c88
video_core: reduce string allocations in shader decompiler (#5261)
* video_core: reduce string allocations in shader decompiler

* use append for indentation instead of resize

Co-authored-by: Mat M. <mathew1800@gmail.com>
2020-04-20 22:08:58 -05:00
Hamish Milne d5a962cb81
Fix savestates compatibility (#5256)
* Fix savestates compatibility
2020-04-20 16:21:37 +02:00
Sebastian Valle bcc80d0871
Merge pull request #5243 from lioncash/move2
geometry_pipeline: std::move vertex handler in SetVertexHandler()
2020-04-19 21:48:48 -05:00
Sebastian Valle 1469ad339c
Merge pull request #5244 from lioncash/move3
gl_shader_manager: std::move std::string where applicable
2020-04-19 21:48:15 -05:00
Sebastian Valle acf18ce4dd
Merge pull request #5245 from lioncash/guard
video_core: Add missing header guards
2020-04-19 21:47:45 -05:00
Sebastian Valle df92b37bbf
Merge pull request #5248 from lioncash/view
post_processing_opengl: Make use of std::string_view with GetPostProcessingShaderCode()
2020-04-19 21:46:48 -05:00