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
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
Ben
ca722f1bb1
Merge pull request #5242 from lioncash/noexcept
...
gl_resource_manager: Make use of noexcept on move assignment and move constructors
2020-04-19 16:56:24 +02:00
Ben
362956a69b
Merge pull request #5240 from lioncash/primitive
...
primitive_assembly: Minor changes
2020-04-19 16:55:56 +02:00
Lioncash
623cc926ed
post_processing_opengl: Make use of std::string_view with GetPostProcessingShaderCode()
...
Same behavior, but doesn't result in an allocating copy of the passed in
string. Particularly given the string is only compared against other
existing strings.
2020-04-18 22:27:44 -04:00
Lioncash
e2533e8edb
swrasterizer/proctex: Take regs and state by const reference
...
Avoids unnecessarily copying 512 bytes and 3584 bytes upon every
invocation.
2020-04-18 22:16:05 -04:00
Lioncash
82b55b763c
swrasterizer/proctex: Make CombineAndMap() internally linked
...
This isn't used outside of this source file, so it can be marked
internally linked.
2020-04-18 22:09:36 -04:00
Lioncash
7a3d4d7642
video_core: Add missing header guards
...
Ensures errors related to multiple inclusions never happen.
2020-04-18 22:06:37 -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
Lioncash
12d4c835db
geometry_pipeline: std::move vertex handler in SetVertexHandler()
...
std::function is allowed to internally allocate, so this prevents
potential reallocations from occurring, should that case ever happen.
2020-04-18 21:26:47 -04:00
Lioncash
12279b22cc
gl_resource_manager: Make use of noexcept on move assignment and move constructors
...
Several standard constructors generally check if objects can be moved in
a non-throwing manner (usually via std::move_if_noexcept) to preserve
its exception guarantees. This means that if these were used with
certain containers any reallocations internally would cause resource
churn, as copies would be necessary instead of moves.
This way, if they're every used in that manner, the right behavior is
always performed.
2020-04-18 21:12:03 -04:00
Lioncash
2cefd16850
primitive_assembly: Mark constructor explicit
...
Prevents any implicit constructions from occurring, given the
constructor isn't a converting constructor.
2020-04-18 20:42:39 -04:00
Lioncash
59bb84b86c
primitive_assembly: Take triangle_handler by reference
...
Avoids copying the std::function when we don't need to. Particularly
given the std::function isn't actually stored anywhere, so there's no
need to move it.
2020-04-18 20:40:45 -04:00
Lioncash
e38e79e27e
primitive_assembly: Make use of std::array where applicable
...
Same behavior, minus any potential implicit array to pointer decay.
2020-04-18 20:39:07 -04:00
Lioncash
dd2a86bed1
video_core: Amend misplaced forward declarations
...
ShaderProgramManager was placed within the wrong namespace. Backend
simply isn't necessary, so it can be removed.
2020-04-18 20:12:22 -04:00
Hamish Milne
7af4b1a18e
Merge branch 'master' into feature/savestates-2
2020-04-17 00:01:43 +01:00