Commit graph

451 commits

Author SHA1 Message Date
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
c821c14908 Settings: Change resolution scaling to an integer instead of a float 2017-12-23 16:10:25 -07: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
wwylele
47c0c87c47 video_core: clean format warnings 2017-11-01 12:35:32 +02:00
Dragios
520929dd6d Fix typo for -Wunused-local-typedefs 2017-10-22 15:56:50 +08:00
Huw Pascoe
a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
Huw Pascoe
6a110ac5f5 Fixed framebuffer warning 2017-09-17 11:57:06 +01:00
Yuri Kunde Schlesner
699c920991 Merge pull request #2900 from wwylele/clip-2
PICA: implement custom clip plane
2017-09-16 10:23:00 +02:00
bunnei
ff4941fb3a Merge pull request #2914 from wwylele/fresnel-fix
pica/lighting: only apply Fresnel factor for the last light
2017-09-05 10:00:49 -04:00
wwylele
12fbc8c8df pica/lighting: only apply Fresnel factor for the last light 2017-09-03 08:22:03 +03:00
wwylele
e2c41a5891 video_core: report telemetry for gas mode 2017-08-31 12:54:17 +03:00
bunnei
f0e461bf6f Merge pull request #2891 from wwylele/sw-bump
SwRasterizer/Lighting: implement bump mapping
2017-08-30 21:07:30 -04:00
wwylele
addbcd5784 gl_rasterizer: implement custom clip plane 2017-08-25 07:26:45 +03:00
wwylele
17c6104d2a gl_rasterizer/lighting: more accurate CP formula 2017-08-22 09:34:44 +03:00
wwylele
5a4af616c6 gl_shader_gen: simplify and clarify the depth transformation between vertex shader and fragment shader 2017-08-21 08:03:07 +03:00
wwylele
1eca380886 gl_rasterizer: add clipping plane z<=0 defined in PICA 2017-08-21 08:03:07 +03:00
wwylele
686fb3e78c gl_shader_gen: don't call SampleTexture when bump map is not used 2017-08-11 18:35:00 +03:00
Sebastian Valle
c6a2e519ef Merge pull request #2816 from wwylele/proctex-lutlutlut
gl_rasterizer: use texture buffer for proctex LUT
2017-07-22 23:03:48 -05:00
Sebastian Valle
e646bd902d Merge pull request #2834 from wwylele/depth-enable-fix
gl_rasterizer_cache: fix using_depth_fb
2017-07-22 23:02:59 -05:00
bunnei
df8b9863f9 telemetry: Log performance, configuration, and system data. 2017-07-17 21:32:28 -04:00
wwylele
8482933db8 gl_rasterizer: use texture buffer for proctex LUT 2017-07-01 11:02:48 +03:00
wwylele
8978ecb09c gl_rasterizer: use texture buffer for fog LUT 2017-06-22 20:41:00 +03:00
wwylele
f1e377f57e gl_rasterizer: create the texture before applying the state
this is a rebasing error from #2792. It doesn't affect much though, because the later more Apply() call fixes/hides it
2017-06-22 17:47:46 +03:00
wwylele
457659fe01 gl_state: reset 1d textures 2017-06-21 23:13:06 +03:00
wwylele
42f7ca7412 gl_rasterizer: fix glGetUniformLocation type 2017-06-21 23:13:06 +03:00
wwylele
be9e952bdc gl_rasterizer: manage texture ids in one place 2017-06-21 23:13:06 +03:00
wwylele
ab60414122 gl_rasterizer/lighting: fix LUT interpolation 2017-06-21 23:13:06 +03:00
wwylele
5a454173a8 gl_rasterizer/lighting: use the formula from the paper for germetic factor 2017-06-18 10:29:02 +03:00
wwylele
7052d43a67 gl_rasterizer/lighting: implement geometric factor 2017-06-15 14:59:01 +03:00
Yuri Kunde Schlesner
da1bec121a Merge pull request #2762 from wwylele/light-cp-tangent
Fragment lighting: implement lut input 5 (CP) and tangent mapping
2017-06-14 20:08:26 -07:00
Yuri Kunde Schlesner
5fe5ccac42 Merge pull request #2743 from wwylele/wrap-fix
pica/rasterizer: implement/stub texture wrap mode 4-7
2017-06-13 21:28:12 -07:00
Yuri Kunde Schlesner
791cd14c8d Merge pull request #2767 from yuriks/quaternion-flip-comment
OpenGL: Update comment on AreQuaternionsOpposite with new information
2017-06-12 16:31:55 -07:00
wwylele
972548e3ee gl_rasterizer/lighting: Implement tangent mapping 2017-06-11 21:30:53 +03:00
wwylele
40b7d0bf3f gl_rasterizer/lighting: implement lut input 5 (CP) 2017-06-11 21:30:53 +03:00
Sebastian Valle
39c7c1f580 Merge pull request #2727 from wwylele/spot-light
Fragment lighting: implement spot light
2017-06-11 18:23:47 +00:00
wwylele
b3b9468573 gl_rasterizer_cache: depth write is disabled if allow_depth_stencil_write is false 2017-06-10 15:10:34 +03:00
Yuri Kunde Schlesner
ba01a8302a OpenGL: Update comment on AreQuaternionsOpposite with new information
While debugging the software renderer implementation, it was noticed
that this is actually exactly what the hardware does, upgrading the
status of this "hack" to being a proper implementation. And there was
much rejoicing.
2017-06-10 01:55:17 -07:00
wwylele
28d1e73d2f pica/rasterizer: implement/stub texture wrap mode 4-7 2017-06-04 09:47:25 +03:00
wwylele
10906dceec gl_rasterizer: implement spot light 2017-05-30 10:54:58 +03:00
wwylele
686cbf3ac6 gl_rasterizer: sync spot light status 2017-05-30 10:54:58 +03:00
Yuri Kunde Schlesner
3df85a103a Merge pull request #2729 from yuriks/quaternion-fix
OpenGL: Improve accuracy of quaternion interpolation
2017-05-28 01:24:06 -07:00
Yuri Kunde Schlesner
eb10f25025 Move screen size constants from video_core to core
video_core didn't even properly use them, and they were the source of
many otherwise-unnecessary dependencies from core to video_core.
2017-05-27 18:41:24 -07:00
Yuri Kunde Schlesner
6665557ff7 OpenGL: Remove unused RendererOpenGL fields 2017-05-27 18:02:46 -07:00
Yuri Kunde Schlesner
669ef82aee OpenGL: Improve accuracy of quaternion interpolation
Current order of operations (rotate then normalize) seems to produce a
lot more distortion than normalizing and then rotating. This makes Citra
results match pretty closesly with hardware, and indicates that hardware
may also be using lerp instead of slerp to interpolate the quaternions.
2017-05-27 00:13:41 -07:00
wwylele
90c8d09098 gl_shader: refactor texture sampler into its own function 2017-05-27 01:56:22 +03:00
wwylele
4d62e75fb2 gl_rasterizer: implement procedural texture 2017-05-20 13:50:50 +03:00
wwylele
039b293092 pica: shader_dirty if texture2 coord changed 2017-05-05 15:35:17 +03:00
wwylele
0f664ef89d pica: use correct coordinates for texture 2 2017-05-03 22:12:46 +03:00
bunnei
ea53d6085a Merge pull request #2671 from wwylele/dot3-rgba
rasterizer: implement combiner operation 7 (Dot3_RGBA)
2017-04-21 17:03:22 -04:00
wwylele
2c2e872b31 gl_shader_gen: remove TODO about Lerp behaviour verification. The implementation is verified against hardware 2017-04-20 22:56:07 +03:00
wwylele
b624a95205 rasterizer: implement combiner operation 7 (Dot3_RGBA) 2017-04-19 23:48:10 +03:00
Yuri Kunde Schlesner
52a4489d65 OpenGL: Pass Pica regs via parameter 2017-04-17 10:34:45 -07:00
Yuri Kunde Schlesner
a6fd4533f6 OpenGL: Move PicaShaderConfig to gl_shader_gen.h
Also move the implementation of CurrentConfig to the cpp file.
2017-04-16 21:49:32 -07:00
Yuri Kunde Schlesner
40e28f6217 OpenGL: Move Attributes enum to a more appropriate file 2017-04-16 20:47:04 -07:00
wwylele
e02c4b7195 Input: remove unused stuff & clean up
1. removed zl, zr and c-stick from HID::PadState. They are handled by IR, not HID
2. removed button handling in EmuWindow
3. removed key_map
4. cleanup #include
2017-03-01 23:30:57 +02:00
Yuri Kunde Schlesner
fb1979d7e2 Core: Re-write frame limiter
Now based on std::chrono, and also works in terms of emulated time
instead of frames, so we can in the future frame-limit even when the
display is disabled, etc.

The frame limiter can also be enabled along with v-sync now, which
should be useful for those with displays running at more than 60 Hz.
2017-02-26 17:22:04 -08:00
Yuri Kunde Schlesner
b285c2a4ed Core: Make PerfStats internally locked
More ergonomic to use and will be required for upcoming changes.
2017-02-26 17:22:03 -08:00
Yuri Kunde Schlesner
3b4e400333 Remove built-in (non-Microprofile) profiler 2017-02-26 17:22:03 -08:00
Yuri Kunde Schlesner
c75ae6c585 Add performance statistics to status bar 2017-02-26 17:22:03 -08:00
Jannik Vogel
e594e63bb5 OpenGL: Check if uniform block exists before updating it (#2581) 2017-02-18 11:46:26 -08:00
Yuri Kunde Schlesner
af65e1c0a0 OpenGL: Remove unused duplicate of IsPassThroughTevStage
This copy was left behind when the shader generation code was moved to a
separate file.
2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner
60fc0b086f VideoCore: Split regs.h inclusions 2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner
5759d94b5c VideoCore: Move Regs to its own file 2017-02-04 13:59:12 -08:00
Yuri Kunde Schlesner
f443c7e5b0 VideoCore: Split lighting regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner
23713d5dee VideoCore: Split framebuffer regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner
9017093f58 VideoCore: Split texturing regs from Regs struct 2017-02-04 13:59:09 -08:00
Yuri Kunde Schlesner
000e78144c VideoCore: Split rasterizer regs from Regs struct 2017-02-04 13:08:47 -08:00
Yuri Kunde Schlesner
97e06b0a0d Merge pull request #2476 from yuriks/shader-refactor3
Oh No! More shader changes!
2017-02-04 13:02:48 -08:00
Yuri Kunde Schlesner
09a750e866 Pica/Texture: Simplify/cleanup texture tile addressing 2017-02-04 12:33:25 -08:00
Yuri Kunde Schlesner
a1c9ac7845 VideoCore: Move LookupTexture out of debug_utils.h 2017-02-04 12:31:40 -08:00
Yuri Kunde Schlesner
bbc7844021 VideoCore: Change misleading register names
A few registers had names such as "count" or "number" when they actually
contained the maximum (that is, count - 1). This can easily lead to hard
to notice off by one errors.
2017-01-29 21:31:36 -08:00
Kloen
eee37b857b video_core: gl_rasterizer_cache.cpp removed unused type alias 2017-01-30 05:18:28 +01:00
Kloen
6a3a3964b0 video_core: gl_rasterizer.cpp removed unused type alias 2017-01-30 05:16:48 +01:00
Kloen
4652d70572 video_core: silence unused-local-typedef boost related warning on GCC 2017-01-29 21:24:24 +01:00
Kloen
753fea5d65 video_core: gl_rasterizer float to int warning 2017-01-23 16:53:30 +01:00
Kloen
b6063d9a93 video_core: fix gl_rasterizer warning on MSVC 2017-01-23 16:53:30 +01:00
bunnei
22ad9094e6 config: Add option for specifying screen resolution scale factor. 2017-01-07 03:23:22 -05:00
bunnei
2f746e9946 Merge pull request #2367 from JayFoxRox/lighting-lut-quickfix
Lighting LUT Quickfix
2016-12-29 13:41:51 -05:00
Jannik Vogel
6ed4206f87 Minor cleanup in GLSL code 2016-12-25 21:38:10 +01:00
Jannik Vogel
88f409aec9 Offset lighting LUT samples correctly 2016-12-25 21:37:26 +01:00
MerryMage
64f98f4d0f core: Move emu_window and key_map into core
* Removes circular dependences (common should not depend on core)
2016-12-23 13:42:39 +00:00
bunnei
29564d73bd Merge pull request #2319 from yuriks/profile-scopes
VideoCore: Make profiling scope more representative
2016-12-21 13:33:49 -05:00
Albin Bernhardsson
ddec9cb369 Use GL_TRUE when setting color_mask 2016-12-19 19:06:35 +01:00
Yuri Kunde Schlesner
ac9f937477 VideoCore: Make profiling scope more representative 2016-12-14 22:52:09 -08:00
Markus Wick
d0d49bb951 OpenGL: Drop framebuffer completeness check.
This OpenGL call synchronize the worker thread of the nvidia blob.
It can be verified on linux with the __GL_THREADED_OPTIMIZATIONS=1 environment variable.
Those errors should not happen on tested drivers.
It was used as a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=94148
2016-12-07 22:09:13 +01:00
Jannik Vogel
fc4591fa49 ASSERT that shader was linked successfully 2016-12-05 21:11:24 +01:00
Jannik Vogel
4088afe23c Report shader uniform block size in case of mismatch 2016-12-05 21:11:24 +01:00
Jannik Vogel
0edc986861 Print broken shader code to log 2016-12-05 21:11:24 +01:00
Yuri Kunde Schlesner
8a1f96011d OpenGL: Non-zero stride only makes sense for linear buffers 2016-12-04 06:14:27 -08:00
Yuri Kunde Schlesner
2600633b89 OpenGL: Ensure framebuffer binding is restored if completion check fails 2016-12-04 06:14:27 -08:00
Yuri Kunde Schlesner
ba7f213655 OpenGL: Fix DisplayTransfer accel when input width != output width
Fixes #2246, #2261
2016-12-04 05:21:57 -08:00
Subv
e3e4f27447 ClangFormat: Fixed the clang-format errors 2016-11-30 09:37:37 -05:00
Subv
aea9a91100 Build: Fixed a few warnings. 2016-11-29 16:51:53 -05:00
Subv
4623415026 RasterizerGL: Use GL_TRUE and 0xFF in the stencil and depth masks instead of simply true and -1 2016-11-27 13:09:11 -05:00
Subv
743b0e71d9 Rasterizer/Memfill: Set the correct stencil write mask when clearing the stencil buffer. 2016-11-27 12:16:10 -05:00
James Rowe
d9305b0a07 Add default hotkey to swap primary screens.
Also minor style changes
2016-11-05 03:46:43 -06:00
James Rowe
2b1654ad9b Support additional screen layouts.
Allows users to choose a single screen layout or a large screen layout.
Adds a configuration option to change the prominent screen.
2016-11-05 02:55:41 -06:00
bunnei
49b10339bf Merge pull request #2103 from wwylele/gpu-reg-cleanup
GPU: DisplayTransfer & MemoryFill cleanup and param check
2016-10-03 20:21:55 -04:00
Yuri Kunde Schlesner
01667d9a35 OpenGL: Take cached viewport sub-rect into account for scissor
Fixes #1938
2016-09-29 20:55:24 -07:00
wwylele
d2419570b9 rasterizer: separate TextureCopy from DisplayTransfer 2016-09-29 10:01:34 +08:00
Yuri Kunde Schlesner
84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Yuri Kunde Schlesner
396a8d91a4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Jannik Vogel
7a79fa7a90 OpenGL: Avoid error on unsupported lighting LUT 2016-08-30 19:30:26 +02:00
Yuri Kunde Schlesner
ecf6ecf325 OpenGL: Add scaled resolution support to scissor 2016-06-27 22:16:04 -07:00
Yuri Kunde Schlesner
f0b9bc14b6 PICA: Scissor fixes and cleanups 2016-06-27 21:14:39 -07:00
Subv
f9be06b15f PICA: Implement scissor test 2016-06-27 21:14:13 -07:00
Jannik Vogel
a12571c709 OpenGL: Implement fog 2016-06-07 00:06:28 +02:00
Jannik Vogel
c900c092e3 OpenGL: Avoid undefined behaviour for UNIFORM_BLOCK_DATA_SIZE 2016-06-07 00:06:28 +02:00
mailwl
07cc781163 gsp::gpu: Reset g_thread_id in UnregisterInterruptRelayQueue 2016-06-01 09:40:15 +03:00
Jannik Vogel
6a28f46844 OpenGL: Set shader_dirty on lighting changes 2016-05-23 23:28:13 +02:00
Jannik Vogel
30a01584f2 Pica: Name LightSrc.config register 2016-05-23 23:28:13 +02:00
Jannik Vogel
8e905b3af6 Pica: Name lighting.config0 and .config1 registers 2016-05-23 23:28:13 +02:00
Jannik Vogel
068bd6f728 OpenGL: Use uniforms for dist_atten_bias and dist_atten_scale 2016-05-23 23:28:13 +02:00
bunnei
e5599ed300 Merge pull request #1786 from JayFoxRox/blend-equation
OpenGL: Support blend equation
2016-05-16 20:00:21 -04:00
Jannik Vogel
5389dedfa1 OpenGL: Only update depth uniforms if the depth changed 2016-05-14 10:31:18 +02:00
Jannik Vogel
f8a11a664f OpenGL: value-initialize variables which cause uninitialised access otherwise 2016-05-14 10:16:11 +02:00
Jannik Vogel
5864cb7e00 OpenGL: Support blend equation 2016-05-12 22:57:40 +02:00
Jannik Vogel
5a7306d6df OpenGL: Implement texture type 3 2016-05-11 08:07:37 +02:00
bunnei
86ecbdfa4d Merge pull request #1621 from JayFoxRox/w-buffer
Implement W-buffer and fix depth-mapping
2016-05-10 23:00:40 -04:00
Lioncash
75e5d0a6a0 gl_rasterizer: Fix compilation for debug builds 2016-05-10 09:22:02 -04:00
Jannik Vogel
fc9cc21024 OpenGL: Implement W-Buffers and fix depth-mapping 2016-05-10 08:58:52 +02:00
Jannik Vogel
4c98113b57 Pica: Implement W-Buffer in SW rasterizer 2016-05-10 08:58:52 +02:00
linkmauve
006fe5fc0f Merge pull request #1704 from JayFoxRox/pod-config
Pica: PicaShaderConfig is TC and cleared before use
2016-05-10 01:16:53 +01:00
Alexander Laties
0a31e373f1 fixup simple type conversions where possible 2016-05-07 11:41:55 -04:00
Emmanuel Gil Peyrot
aa4d4ff23c Frontends, VideoCore: Move glad initialisation to the frontend
On SDL2 this allows it to use SDL_GL_GetProcAddress() instead of the
default function loader, and fixes a crash when using apitrace with an
EGL context.

On Qt we will need to migrate from QGLWidget to QOpenGLWidget and
QOpenGLContext before we can use gladLoadGLLoader() instead of
gladLoadGL(), since the former doesn’t expose a function loader.
2016-05-06 03:10:14 +01:00
Jannik Vogel
f74652d2fe Pica: Use a union for PicaShaderConfig 2016-05-03 15:06:49 +02:00