Commit graph

1069 commits

Author SHA1 Message Date
Weiyi Wang a9544ca015
Merge pull request #3580 from daniellimws/common-fmt
common: Migrate logging macros
2018-04-06 12:38:08 +03:00
Weiyi Wang e3d25bc6d0
Merge pull request #3567 from wwylele/pica-glsl
renderer_opengl: add PICA->GLSL shader decompiler
2018-04-05 14:39:27 +03:00
Weiyi Wang acb02d300c
Merge pull request #3518 from wwylele/hashable-struct
Common/Hash: abstract HashableStruct from GLShader::PicaShaderConfig
2018-04-05 14:39:12 +03:00
James Rowe 1fecead2ff
Merge pull request #3624 from wwylele/sync-uniform
gl_rasterizer: move shader uniform sync from SetShader() to ctor
2018-04-05 00:30:38 -06:00
wwylele 0d84c5a0b6 gl_rasterizer: move state syncing from ctor to its own function 2018-04-04 17:23:55 +03:00
wwylele c2719feda2 gl_rasterizer: move shader uniform sync from SetShader() to ctor 2018-04-03 09:27:23 +03:00
Valentin Vanelslande c9ab184ec7 pica_to_gl: Migrate logging macros (#3608) 2018-04-02 09:31:28 -06:00
wwylele 9ffd400685 gl_shader_decompiler: add missing headers/rename GetXXX to MoveXXX to reflect that they move the data 2018-04-02 17:34:54 +03:00
wwylele 11c2f11872 gl_shader_decompiler: return error on decompilation failure
Internally these errors are handled by exceptions. Only fallbackable errors (that can be handled by CPU shader emulation) is reported. Completely ill-formed shader is still ASSERTed. Code logic related stuff is DEBUG_ASSERTed
2018-04-02 17:34:54 +03:00
wwylele 4991b15ee5 gl_shader_decompiler: some small fixes
- remove unnecessary ";"
- use std::tie for lexicographical ordering
- simplify loop condition
    The offset always has step +1 on each iteration, so it would just hit one of the two boundary anyway
2018-04-02 17:34:54 +03:00
wwylele f8a292f920 renderer_opengl: add PICA->GLSL shader decompiler 2018-04-02 17:34:54 +03:00
James Rowe 384849232b
Merge pull request #3516 from wwylele/shadow-sw
SwRasterizer: Implement shadow mapping
2018-03-31 23:29:22 -06:00
Lioncash 7d331a469f pica_to_gl: Use std::array where applicable
Removes the need to use the ARRAY_SIZE macro
2018-03-31 00:58:49 -04:00
Tobias bb6251f35f video_core: Remove Unreachable for invalid BlendEquation modes (#3595)
* video_core: Remove Unreachable statement

* Lower log level to ERROR
2018-03-29 17:53:55 -06:00
Lioncash 27a3d44b16 gl_rasterizer: Fix incorrect comparison against src_surface in AccelerateTextureCopy()
This should actually be comparing the validity of the destination
surface.
2018-03-28 21:13:57 -04:00
Daniel Lim Wee Soong 98760336be video_core/shader/shader: Remove include cinttypes 2018-03-28 22:40:16 +08:00
Daniel Lim Wee Soong 968569aa61 Replace format specifiers for all usages of ASSERT_MSG 2018-03-27 23:28:42 +08:00
Weiyi Wang 9e4f670ea9
Merge pull request #3484 from wwylele/highlight-fix
pica/lighting: compute highlight clamp after one-/two-sided diffuse pass
2018-03-18 23:41:27 +02:00
Mat M 79d1bcf5ba
Merge pull request #3506 from MerryMage/mov-gl_resource_manager
gl_resource_manager: Use std::exchange in move assignment operators and constructors
2018-03-17 16:30:58 -04:00
Markus Wick ac92664aa7 OGL: Use stream buffer for vertex data. 2018-03-17 02:02:39 +01:00
Phantom 50598fbbf4 stream buffer 2018-03-17 02:02:39 +01:00
MerryMage e3f9bfd850 gl_resource_manager: Use std::exchange instead of std::swap in move assignment operators and constructors
Move assignment operators and move constructors should ideally leave the object moved from in a state where resources aren't accessable.
2018-03-16 23:47:49 +00:00
wwylele 30cc8c10cd
Common/Hash: abstract HashableStruct from GLShader::PicaShaderConfig 2018-03-14 00:12:40 +02:00
wwylele 9f8ff7b04e swrasterizer: implement shadow map rendering 2018-03-13 13:07:07 +02:00
wwylele ae75d3032f swrasterizer: implement shadow map sampling 2018-03-13 12:56:19 +02:00
wwylele ce2ad7436e swrasterizer/lighting: implement shadow attenuation 2018-03-13 12:56:19 +02:00
wwylele 889d8aaab3 gl_rasterizer/cache: only reallocate cubemap when size/format mismatch 2018-03-11 13:31:29 +02:00
wwylele 15e8664ef7 gl_rasterizer: implement texture cube 2018-03-10 01:15:06 +02:00
wwylele 92c7bb9d20 pica/gl_shader: optimize ternary operator 2018-03-10 01:14:05 +02:00
wwylele 0d6db4a0b3 lighting: compute highlight clamp after one-/two-sided diffuse pass 2018-03-10 01:14:05 +02:00
James Rowe f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
bunnei 3cda637cb1
Merge pull request #3478 from j-selby/libpng-switch
Remove PICA image dumping, burn libpng
2018-03-07 18:03:38 -05:00
Vamsi Krishna 04cc8fb537 Discard Gas mode renders (#3486)
* Discard gas_mode renders

This discards the gas_mode / fog effect from games that use it and allows the games to display without it.  Note that gas mode is still unimplemented and will LOG<CRITICAL>.
This bypasses #3287. (Doesn't fix it)

* fix clang
2018-03-07 18:02:36 -05:00
James 077a519338 Remove unused DUMP_TEXTURES definition 2018-03-07 09:13:24 +11:00
James 9829a84fc6 Remove PICA image dumping/libpng 2018-03-07 09:10:54 +11:00
Weiyi Wang 4befbddc34
Merge pull request #3281 from jroweboy/texcache-pt2
Texture Cache Rework
2018-03-05 11:57:25 +02:00
wwylele c2515ff39d clang-format fix 2018-03-05 11:09:20 +02:00
James Rowe 1d419bac1b Disable accelerated texture copy for Texture surfaces 2018-03-04 22:06:09 -07:00
James Rowe 18456ff9e6 Address Lioncash's comments 2018-02-05 20:31:50 -07:00
Phantom 9e16a3c449 ConvertD24S8toABGR: fix fb attachment 2018-01-31 08:55:39 -07:00
Phantom d813bc5eb5 D24S8 to RGBA8 conversion 2018-01-31 08:55:19 -07:00
Phantom db21154142 GetFramebufferSurfaces: Remove an assert that is no longer correct 2018-01-31 08:54:19 -07:00
James Rowe b002511df0
citra-qt: Add customizable speed limit target (#3353)
citra-qt: Add customizable speed limit target

* Update SDL config for the new frame_limit option
* Made max lag time a function of target speed percent.
* Added a checkbox to enable/disable frame limiter
* UI: Prevent frame_limit from under/overflowing
* UI: Hide target speed percent when frame limiter is off
* Disable frame limit spin box when framelimit isn't enabled
2018-01-25 22:24:40 -07:00
Phantom 88f6521511 AccelerateTextureCopy: Better support for contiguous copy 2018-01-20 18:39:27 -07:00
Yuri Kunde Schlesner d93ee65164 Common: Add convenience function for hashing a struct 2018-01-15 13:43:37 -08:00
Dwayne Slater 41929371dc Optimize AttributeBuffer to OutputVertex conversion (#3283)
Optimize AttributeBuffer to OutputVertex conversion

First I unrolled the inner loop, then I pushed semantics validation
outside of the hotloop.

I also added overflow slots to avoid conditional branches.

Super Mario 3D Land's intro runs at almost full speed when compiled with
Clang, and theres a noticible speed increase in MSVC. GCC hasn't been
tested but I'm confident in its ability to optimize this code.
2018-01-02 15:32:33 -08:00
Phantom 7f1aec8fbb Support for textures smaller than 8*8 2017-12-30 07:42:32 +01:00
Phantom be1d0cee1e Fix viewport to surface rect clamping 2017-12-29 17:07:01 +01:00
Phantom 19672cfee8 CachedSurface: Add microprofile scopes for UploadGLTexture and DownloadGLTexture 2017-12-29 17:01:37 +01:00
Phantom 1591fa8d3d Remove read_framebuffer_handle and draw_framebuffer_handle from CachedSurface 2017-12-29 17:00:09 +01:00
James Rowe 1c4d1d1ace Move trasnfer_framebuffer to a member of RasterCache. Address review comments 2017-12-23 16:10:32 -07:00
James Rowe 10fb9242ae Fix clang format 2017-12-23 16:10:32 -07:00
James Rowe 4e053220a8 When downloading from a surface into gl_buffer, ingore any x/y offsets in rect and use 0,0 as the origin 2017-12-23 16:10:31 -07:00
James Rowe 7e673af527 Remove the correct intervals from the surface when validating 2017-12-23 16:10:31 -07:00
James Rowe ac4c589ab5 Workaround for ICE on gcc5 2017-12-23 16:10:31 -07:00
Phantom 9a6a452857 Fix broken surface validation logic since removal of the reinterpret hack 2017-12-23 16:10:30 -07:00
Phantom f893daa4a2 Perform the same checks on TexCopy params that SW does 2017-12-23 16:10:30 -07:00
James Rowe 91fad7010b Fix compilation on mac and linux 2017-12-23 16:10:30 -07:00
James Rowe 34ff77f5f7 Revert "OpenGL Cache: Ignore format reinterpretation hack"
Testing found a few games that did some crazy things which breaks the
assumptions made in that commit.
2017-12-23 16:10:29 -07:00
James Rowe 72034b772d Minor style changes 2017-12-23 16:10:29 -07:00
James Rowe 0498d34d18 OpenGL Cache: Ignore format reinterpretation hack
Several games such as Smash will cause some regions that are cached on
the gpu to be revalidated, but (seemingly) we can just ignore these
cases. If the data is already found on the gpu in dirty_regions, then we
validate those, and skip flushing that region from cpu.

Its unknown if this breaks any games, but it does speed up many games.
Additionally, it removes outlines in the pokemon games.
2017-12-23 16:10:29 -07:00
James Rowe 5b872c41d8 OpenGL Cache: Reorder methods
The previous commits added the methods where they were located
originally to try to get an easy to read diff between changes. This
commit fixes compliation since the static methods are now declared
before they are used.
2017-12-23 16:10:28 -07:00
James Rowe 24e187891f OpenGL Rasterizer: Update to use the new cache 2017-12-23 16:10:28 -07:00
James Rowe e5adb6a26b OpenGL Cache: Add the rest of the Cache methods
Fills in the rasterizer cache methods using the helper methods added in
the previous commits.
2017-12-23 16:10:27 -07:00
James Rowe 81ea32d1e0 OpenGL Cache: Refactor Surface Cache interface
Changes the public interface of the surface cache to make it easier to
use. Reintroduces the cached page count cached pages that was removed in
an earlier commit.
2017-12-23 16:10:27 -07:00
James Rowe 3e1cbb7d14 OpenGL Cache: Split CachedSurface
Breaks CachedSurface into two classes, the parameters used to create or
find a cached surface, and the actual cached surface. This also adds a
few helper methods for getting surfaces from cache
2017-12-23 16:10:27 -07:00
James Rowe 0b98b768f5 OpenGL Cache: Add surface utility functions
Separates creating and filling surfaces into static functions that
can be reused from the different RasterizerCache methods.
2017-12-23 16:10:26 -07:00
James Rowe e9e2d444ef OpenGL Cache: Optimize Morton Copy to copy in tiles
Compiles two lookup arrays of functions for the different
configurations of Morton Copy.
2017-12-23 16:10:26 -07:00
James Rowe 160ac25527 OpenGL State: Change setters so they don't directly write to curstate 2017-12-23 16:10:25 -07:00
James Rowe 13606a6d0b Memory: Remove count of cached pages and add InvalidateRegion
In a future commit, the count of cached pages will be reintroduced in
the actual surface cache. Also adds an Invalidate only to the cache
which marks a region as invalid in order to try to avoid a costly flush
from 3ds memory
2017-12-23 16:10:25 -07:00
James Rowe c821c14908 Settings: Change resolution scaling to an integer instead of a float 2017-12-23 16:10:25 -07:00
Subv 3652809408 HLE: Convert GSP_GPU to ServiceFramework.
The only functional change is the error handling of GSP_GPU::ReadHWRegs function. We previously didn't return error codes (not even for success). The new returns were found by reverse engineering the GSP module.
2017-12-21 10:30:22 -05:00
Tillmann Karras fd3ec6be30 video_core: fix infinity and NaN conversions 2017-12-14 19:51:58 +00:00
Yuri Kunde Schlesner aecd2b85fe
Merge pull request #3261 from MerryMage/DPH
shader_jit_x64_compiler: Use haddps for horizontal summation
2017-12-13 09:09:42 -05:00
bunnei 4695f12a08
Merge pull request #3264 from lioncash/cmake-target
CMakeLists: Derive the source directory grouping from targets themselves
2017-12-12 14:34:51 -05:00
MerryMage 6c199e4699 fixup! shader_jit_x64_compiler: Use haddps for horizontal summation 2017-12-12 15:37:00 +00:00
Lioncash ab021d163e CMakeLists: Derive the source directory grouping from targets themselves
Removes the need to store to separate SRC and HEADER variables,
and then construct the target in most cases.
2017-12-11 21:11:52 -05:00
Yuri Kunde Schlesner ae7240a2cb
Merge pull request #3097 from ds84182/round-primary-color-swrast
Round primary color in swrast
2017-12-11 20:06:21 -05:00
MerryMage efec8fe513 shader_jit_x64_compiler: Use haddps for horizontal summation 2017-12-10 22:04:30 +00:00
Yuri Kunde Schlesner 230a7557f1 Shader: Store AttributeBuffers in GS output buffer
This also does the output masking early at EMIT time, instead of when a
triangle is sent to the vertex handler.
2017-12-09 20:33:59 -08:00
Yuri Kunde Schlesner 0184419814 Shader: Refactor output_mask copy loop to function 2017-12-09 20:31:24 -08:00
Tillmann Karras 1c2750d5bd video_core: optimize NaN check 2017-12-05 22:34:22 +00:00
MerryMage c1aef260af shader_jit_x64_compiler: Remove ABI overhead of LG2 and EX2
This involves reimplementing log2f and exp2f.
2017-11-30 18:17:35 +00:00
MerryMage 235a251d3c tests: Add tests for x64 shader jit
Tests LG2 and EX2 instructions
2017-11-30 18:17:35 +00:00
Dwayne Slater fcc141a327 Maintain the PICA's 8 bits of color precision when using the interpolated primary color
This matches the software renderer by using round.
The actual hardware rounds the results up instead of flooring.
2017-11-29 16:49:04 -05:00
Dwayne Slater 350082ab75 Fix logic ops not being enabled in the OpenGL renderer 2017-11-29 16:30:19 -05:00
Dwayne Slater dc48deaecc Round primary color inputs in software rasterizer
OpenGL version coming soon.
2017-11-29 16:30:18 -05:00
James Rowe 9d9693c13d Revert "Extracted the attribute setup and draw commands into their own functions"
This reverts commit b3b34a1e76. This
commit causes a performance regression for not enough benefits
2017-11-16 11:46:17 -07:00
wwylele 47c0c87c47 video_core: clean format warnings 2017-11-01 12:35:32 +02:00
Dragios 3e26b0dee5 swrasterizer folder minor edit 2017-10-27 09:44:45 +08:00
Dragios 9b3eb69973 Utilize vector function instead 2017-10-26 23:50:20 +08:00
Dragios 84054b7cd8 Get rid of narrowing conversion warning 2017-10-24 00:02:46 +08:00
Dragios 520929dd6d Fix typo for -Wunused-local-typedefs 2017-10-22 15:56:50 +08:00
Huw Pascoe b3b34a1e76 Extracted the attribute setup and draw commands into their own functions 2017-10-04 01:08:29 +01:00
Huw Pascoe a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
Subv a321bce378 Disable unary operator- on Math::Vec2/Vec3/Vec4 for unsigned types.
It is unlikely we will ever use this without first doing a Cast to a signed type.
Fixes 9 "unary minus operator applied to unsigned type, result still unsigned" warnings on MSVC2017.3
2017-09-27 09:06:41 -05:00
B3n30 dc6a365337 Merge pull request #2951 from huwpascoe/perf-4
Optimized Morton
2017-09-25 08:28:55 +02:00
Huw Pascoe 903906da3b Optimized Float<M,E> multiplication
Before:

ucomiss xmm1, xmm1
jp      .L9
pxor    xmm2, xmm2
mov     edx, 1
ucomiss xmm0, xmm2
setp    al
cmovne  eax, edx
test    al, al
jne     .L9
.L3:
movaps  xmm0, xmm2
ret
.L9:
ucomiss xmm0, xmm0
jp      .L10
pxor    xmm2, xmm2
mov     edx, 1
ucomiss xmm1, xmm2
setp    al
cmovne  eax, edx
test    al, al
je      .L3

After:

movaps  xmm2, xmm1
mulss   xmm2, xmm0
ucomiss xmm2, xmm2
jnp     .L3
ucomiss xmm1, xmm0
jnp     .L11
.L3:
movaps  xmm0, xmm2
ret
.L11:
pxor    xmm2, xmm2
jmp     .L3
2017-09-25 00:54:02 +01:00
Huw Pascoe 876aa82c29 Optimized Morton 2017-09-24 22:27:14 +01:00
James Rowe 93930a966f Merge pull request #2921 from jroweboy/batch-fix-2
GPU: Add draw for immediate and batch modes
2017-09-24 07:57:16 -06:00