Commit graph

491 commits

Author SHA1 Message Date
Dwayne Slater
234161ba62 Make byteround less expensive (thanks hrydgard!) 2018-04-07 18:26:14 -04:00
Dwayne Slater
734279ff22 Round TEV outputs and the final fragment output in GLSL
Fixes water effect in SM3DL
2018-04-07 16:43:56 -04:00
Weiyi Wang
972db17247
Merge pull request #3497 from wwylele/texture-cube-new
gl_rasterizer: implement TextureCube
2018-04-06 12:41:40 +03:00
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
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
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
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
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
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
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
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
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