Commit graph

1572 commits

Author SHA1 Message Date
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
James Rowe 19d41dcc6e Remove pipeline.gpu_mode and fix minor issues 2017-09-23 09:28:20 -06:00
Yuri Kunde Schlesner a7758b0b36 Merge pull request #2928 from huwpascoe/master
Fixed framebuffer warning
2017-09-22 04:06:38 +02:00
Huw Pascoe a234e4c200 Improved performance of FromAttributeBuffer
Ternary operator is optimized by the compiler
whereas std::min() is meant to return a value.

I've noticed a 5%-10% emulation speed increase.
2017-09-17 15:56:36 +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
James Rowe ad0b57f407 GPU: Add draw for immediate and batch modes
PR #1461 introduced a regression where some games would change configuration
even while in the poorly named "drawing" mode, which broke the heuristic
citra was using to determine when to draw the batch. This change adds
back in a draw call for batching, and also adds in a draw call in
immediate mode each time it adds a triangle.
2017-09-11 09:21:43 -06:00
bunnei 11baa40d75 Merge pull request #2865 from wwylele/gs++
PICA: implemented geometry shader
2017-09-07 23:02:59 -04: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
Weiyi Wang 647f017c6d Merge pull request #2892 from Subv/warnings2
Warnings: Fixed a few missing-return warnings in video_core.
2017-08-28 03:21:51 -05:00
Subv da88f3b8f0 Warnings: Fixed a few missing-return warnings in video_core. 2017-08-26 11:58:22 -05:00
wwylele 417cb45e3f SwRasterizer/Clipper: flip the sign convention to match PICA and OpenGL 2017-08-25 07:26:45 +03:00
wwylele addbcd5784 gl_rasterizer: implement custom clip plane 2017-08-25 07:26:45 +03:00
wwylele ea51a3af26 SwRasterizer: implement custom clip plane 2017-08-24 15:34:27 +03:00
wwylele 17c6104d2a gl_rasterizer/lighting: more accurate CP formula 2017-08-22 09:34:44 +03:00
wwylele b5aa570354 SwRasterizer/Lighting: implement LUT input CP 2017-08-22 09:34:44 +03:00
wwylele 3e478ca131 SwRasterizer/Lighting: implement bump mapping 2017-08-22 09:34:44 +03:00
wwylele 63b6e802cd swrasterizer: remove invalid TODO
This function is called in clipping, before the pespective divide, and is not used in later rasterization. Thus it doesn't need perspective correction.
2017-08-21 08:03:07 +03:00
wwylele 72b26ac32f swrasterizer/clipper: remove tested TODO
hwtested. Current implementation is the correct behavior
2017-08-21 08:03:07 +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
Yuri Kunde Schlesner 46d1ca768d Merge pull request #2872 from wwylele/sw-geo-factor
SwRasterizer/Lighting: implement geometric factor
2017-08-20 17:49:42 -07:00
James Rowe 8afa81ac1b Merge pull request #2871 from wwylele/sw-spotlight
SwRasterizer/Lighting: implement spot light
2017-08-19 20:10:24 -06:00
wwylele 0f35755572 pica/command_processor: build geometry pipeline and run geometry shader
The geometry pipeline manages data transfer between VS, GS and primitive assembler. It has known four modes:
 - no GS mode: sends VS output directly to the primitive assembler (what citra currently does)
 - GS mode 0: sends VS output to GS input registers, and sends GS output to primitive assembler
 - GS mode 1: sends VS output to GS uniform registers, and sends GS output to primitive assembler. It also takes an index from the index buffer at the beginning of each primitive for determine the primitive size.
 - GS mode 2: similar to mode 1, but doesn't take the index and uses a fixed primitive size.
hwtest shows that immediate mode also supports GS (at least for mode 0), so the geometry pipeline gets refactored into its own class for supporting both drawing mode.
In the immediate mode, some games don't set the pipeline registers to a valid value until the first attribute input, so a geometry pipeline reset flag is set in `pipeline.vs_default_attributes_setup.index` trigger, and the actual pipeline reconfigure is triggered in the first attribute input.
In the normal drawing mode with index buffer, the vertex cache is a little bit modified to support the geometry pipeline. Instead of OutputVertex, it now holds AttributeBuffer, which is the input to the geometry pipeline. The AttributeBuffer->OutputVertex conversion is done inside the pipeline vertex handler. The actual hardware vertex cache is believed to be implemented in a similar way (because this is the only way that makes sense).
Both geometry pipeline and GS unit rely on states preservation across drawing call, so they are put into the global state. In the future, the other three vertex shader units should be also placed in the global state, and a scheduler should be implemented on top of the four units. Note that the current gs_unit already allows running VS on it in the future.
2017-08-19 10:13:20 +03:00
wwylele 8285ca4ad8 pica/shader/jit: implement SETEMIT and EMIT 2017-08-19 10:13:20 +03:00
wwylele 36981a5aa6 pica/primitive_assembly: Handle winding for GS primitive
hwtest shows that, although GS always emit a group of three vertices as one primitive, it still respects to the topology type, as if the three vertices are input into the primitive assembler independently and sequentially. It is also shown that the winding flag in SETEMIT only takes effect for Shader topology type, which is believed to be the actual difference between List and Shader (hence removed the TODO). However, only Shader topology type is observed in official games when GS is in use, so the other mode seems to be just unintended usage.
2017-08-19 10:13:20 +03:00
wwylele bb63ae3052 correct constness 2017-08-19 10:13:20 +03:00
wwylele 28128348f2 pica/shader/interpreter: implement SETEMIT and EMIT 2017-08-19 10:13:20 +03:00
wwylele 46c6973d2b pica/shader: extend UnitState for GS
Among four shader units in pica, a special unit can be configured to run both VS and GS program. GSUnitState represents this unit, which extends UnitState (which represents the other three normal units) with extra state for primitive emitting. It uses lots of raw pointers to represent internal structure in order to keep it standard layout type for JIT to access.
This unit doesn't handle triangle winding (inverting) itself; instead, it calls a WindingSetter handler. This will be explained in the following commits
2017-08-19 10:13:20 +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
wwylele 945f9a1b04 SwRasterizer/Lighting: implement spot light 2017-08-11 01:19:10 +03:00
wwylele 14ee32c46a SwRasterizer/Lighting: implement geometric factor 2017-08-11 01:18:43 +03:00
wwylele 5d9d42f0d0 SwRasterizer/Lighting: use make_tuple instead of constructor
implicit tuple constructor is a c++17 thing, which is not supported by some not-so-old libraries. Play safe for now
2017-08-10 12:19:58 +03:00
wwylele db309b2423 pica/regs: layout geometry shader configuration regs
All the register meanings are derived from ctrulib (3dbrew is outdated for most of them)
2017-08-10 01:53:08 +03:00
Weiyi Wang 792dee47a7 Merge pull request #2822 from wwylele/sw_lighting-2
Implement fragment lighting in the sw renderer (take 2)
2017-08-09 18:54:29 +03:00
wwylele baa24f4ea9 pica: upload shared shader code to both unit 2017-08-07 10:30:05 +03:00
wwylele 2252a63f80 SwRasterizer/Lighting: shorten file name 2017-08-03 13:51:22 +03:00
wwylele eda28266fb SwRasterizer/Lighting: move to its own file 2017-08-02 22:20:40 +03:00
wwylele 48b4105871 SwRasterizer/Lighting: reduce confusion 2017-08-02 22:07:15 +03:00
wwylele c59ed47608 SwRasterizer/Lighting: move quaternion normalization to the caller 2017-08-02 22:05:53 +03:00
wwylele c89f804a01 pica/shader_interpreter: fix off-by-one in LOOP 2017-07-27 13:48:27 +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 4feff63ffa SwRasterizer/Lighting: dist atten lut input need to be clamp 2017-07-11 22:19:00 +03:00
wwylele 56e5425e59 SwRasterizer/Lighting: unify float suffix 2017-07-11 22:15:35 +03:00
wwylele e415558a4f SwRasterizer/Lighting: get rid of nested return 2017-07-11 22:15:35 +03:00
wwylele c6d1472513 SwRasterizer/Lighting: refactor GetLutValue into a function.
merging similar pattern. Also makes the code more similar to the gl one
2017-07-11 22:15:35 +03:00
wwylele f13cf506e0 SwRasterizer: only interpolate quat and view when lighting is enabled 2017-07-11 21:35:57 +03:00
wwylele efc655aec0 SwRasterizer/Lighting: pass lighting state as parameter 2017-07-11 20:06:26 +03:00
Subv 9906feefbd SwRasterizer/Lighting: Move the clamp highlight calculation to the end of the per-light loop body. 2017-07-11 19:39:15 +03:00
Subv 7526af5e52 SwRasterizer/Lighting: Move the lighting enable check outside the ComputeFragmentsColors function. 2017-07-11 19:39:15 +03:00
Subv b8229a7684 SwRasterizer/Lighting: Do not use global registers state in ComputeFragmentsColors. 2017-07-11 19:39:15 +03:00
Subv 7bc467e872 SwRasterizer/Lighting: Do not use global state in LookupLightingLut. 2017-07-11 19:39:15 +03:00
Subv 37ac2b6657 SwRasterizer/Lighting: Fixed a bug where the distance attenuation bias was being set to the dist atten scale. 2017-07-11 19:39:15 +03:00
Subv 6250f52e93 SwRasterizer: Fixed a few conversion warnings and moved per-light values into the per-light loop. 2017-07-11 19:39:15 +03:00
Subv 2d69a9b8bf SwRasterizer: Run clang-format 2017-07-11 19:39:15 +03:00
Subv 73566ff7a9 SwRasterizer: Flip the vertex quaternions before clipping (if necessary). 2017-07-11 19:39:15 +03:00
Subv 2a75837bc3 SwRasterizer: Corrected the light LUT lookups. 2017-07-11 19:39:15 +03:00
Subv f2d4d5c219 SwRasterizer: Corrected the light LUT lookups. 2017-07-11 19:39:15 +03:00
Subv 80b6fc592e SwRasterizer: Fixed the lighting lut lookup function. 2017-07-11 19:39:15 +03:00
Subv 10b0bea060 SwRasterizer: Calculate fresnel for fragment lighting. 2017-07-11 19:39:15 +03:00
Subv 46b8c8e1da SwRasterizer: Calculate specular_1 for fragment lighting. 2017-07-11 19:39:15 +03:00
Subv be25e78b07 SwRasterizer: Calculate specular_0 for fragment lighting. 2017-07-11 19:39:15 +03:00
Subv b2f472a2b1 SwRasterizer: Implement primary fragment color. 2017-07-11 19:39:15 +03: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
Yuri Kunde Schlesner d0888f8548 Merge pull request #2776 from wwylele/geo-factor
Fragment lighting: implement geometric factor
2017-06-18 14:18:48 -07:00
wwylele 5a454173a8 gl_rasterizer/lighting: use the formula from the paper for germetic factor 2017-06-18 10:29:02 +03:00
Yuri Kunde Schlesner f6715f98f5 Stop using reserved operator names (and/or/xor) with Xbyak
Also has the Dynarmic upgrade with the same change
2017-06-17 12:20:22 -07: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
bunnei 54ea95cca7 Merge pull request #2721 from wwylele/texture-cube
swrasterizer: implemented TextureCube
2017-05-30 10:21:05 -04: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
wwylele b5addf8fb8 pica: prepare registers for spotlight 2017-05-30 10:54:58 +03:00
Yuri Kunde Schlesner a4f88c7d7c Merge pull request #2734 from yuriks/cmake-imported-libs
CMake: Use CMake target properties for all libraries
2017-05-29 15:12:21 -07:00
wwylele 0b9bb082c3 swrasterizer: implement TextureCube 2017-05-29 22:28:48 +03:00
wwylele 077cc683e5 pica: add registers for texture cube 2017-05-29 22:03:08 +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 d736cca848 CMake: Create INTERFACE targets for microprofile and nihstro 2017-05-27 22:34:52 -07:00
Yuri Kunde Schlesner 4660bc1c78 CMake: Use IMPORTED target for libpng 2017-05-27 20:44:51 -07:00
Yuri Kunde Schlesner 7b81903756 CMake: Correct inter-module dependencies and library visibility
Modules didn't correctly define their dependencies before, which relied
on the frontends implicitly including every module for linking to
succeed.

Also changed every target_link_libraries call to specify visibility of
dependencies to avoid leaking definitions to dependents when not
necessary.
2017-05-27 18:41:24 -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
Yuri Kunde Schlesner bae3799bd5 Merge pull request #2697 from wwylele/proctex
Implemented Procedural Texture (Texture Unit 3)
2017-05-24 21:37:42 -07:00
wwylele 36526c63ef swrasterizer: add missing tc0_w and fragment lighting attribute processing 2017-05-21 09:09:15 +03:00
wwylele 4d62e75fb2 gl_rasterizer: implement procedural texture 2017-05-20 13:50:50 +03:00
wwylele ade45b5b99 pica/swrasterizer: implement procedural texture 2017-05-20 13:50:50 +03:00
wwylele 393fee10a2 pica: use correct register value for shader bool_uniforms
variable value is not masked. the masked and combined register value should be used instead
2017-05-17 22:14:09 +03:00
Yuri Kunde Schlesner 8d558777a6 Merge pull request #2703 from wwylele/pica-reg-revise
pica: correct bit field length for some registers
2017-05-16 10:00:37 -07:00
wwylele 86ee1f6101 pica: correct bit field length for some registers 2017-05-16 19:24:06 +03:00
Jannik Vogel ba722be2ac Pica: Write GS registers
This adds the handlers for the geometry shader register writes which will call the functions from the previous commit to update registers for the GS.
2017-05-12 16:22:37 +02:00
Jannik Vogel 3fd3775d35 Pica: Write shader registers in functions
The commit after this one adds GS register writes, so this moves the VS handlers into functions so they can be re-used and extended more easily.
2017-05-12 16:22:37 +02:00
Jannik Vogel 925724c990 Pica: Set program code / swizzle data limit to 4096
One of the later commits will enable writing to GS regs.
It turns out that on startup, most games will write 4096 GS program words.

The current limit of 1024 would hence result in 3072 (4096 - 1024) error messages:
```
HW.GPU <Error> video_core/shader/shader.cpp:WriteProgramCode:229: Invalid GS program offset 1024
```

New constants have been introduced to represent these limits.
The swizzle data size has also been raised. This matches the given field sizes of [GPUREG_SH_OPDESCS_INDEX](https://3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_SH_OPDESCS_INDEX) and [GPUREG_SH_CODETRANSFER_INDEX](https://www.3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_SH_CODETRANSFER_INDEX) (12 bit = [0; 4095]).
2017-05-11 15:01:27 +02: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
Jannik Vogel 1b397c77fa Pica/Regs: Correct bit width for blend-equations 2017-04-08 18:33:17 +02: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
Mat M 0cb52ee74a Doxygen: Amend minor issues (#2593)
Corrects a few issues with regards to Doxygen documentation, for example:

- Incorrect parameter referencing.
- Missing @param tags.
- Typos in @param tags.

and a few minor other issues.
2017-02-26 17:58:51 -08: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
Weiyi Wang e085e6a768 video_core: remove #pragma once in cpp file (#2570) 2017-02-15 00:16:50 -08:00
Yuri Kunde Schlesner 426fda1d52 SWRasterizer: Move more framebuffer functions to file 2017-02-12 18:13:04 -08:00
Yuri Kunde Schlesner 1683cb0ec9 SWRasterizer: Move texturing functions to their own file 2017-02-12 18:12:37 -08:00
Yuri Kunde Schlesner f9026e8a7a SWRasterizer: Convert large no-capture lambdas to standalone functions 2017-02-12 18:11:05 -08:00
Yuri Kunde Schlesner e1ad7d69b9 SWRasterizer: Move framebuffer operation functions to their own file 2017-02-12 18:11:03 -08:00
Yuri Kunde Schlesner e24717bca0 VideoCore: Move software rasterizer files to sub-directory 2017-02-12 18:08:11 -08:00
Yuri Kunde Schlesner e10b11a5d0 video_core/shader: Document sanitized MUL operation 2017-02-12 13:29:14 -08:00
Yuri Kunde Schlesner 443bb3d522 Merge pull request #2550 from yuriks/pica-refactor2
Small VideoCore cleanups
2017-02-12 12:33:26 -08:00
Yuri Kunde Schlesner e2fa1ca5e1 video_core: Fix benign out-of-bounds indexing of array (#2553)
The resulting pointer wasn't written to unless the index was verified as
valid, but that's still UB and triggered debug checks in MSVC.

Reported by garrettboast on IRC
2017-02-10 20:51:09 -08:00
Yuri Kunde Schlesner 553e672777 VideoCore: Split u64 Pica reg unions into 2 separate u32 unions
This eliminates UB when aliasing it with the array of u32 regs, and
is compatible with non-LE architectures.
2017-02-09 00:04:25 -08:00
Yuri Kunde Schlesner bfb1531352 VideoCore: Force enum sizes to u32 in LightingRegs
All enums that are used with BitField must have their type forced to u32
to ensure correctness.
2017-02-09 00:04:24 -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 f241bb72f5 Pica/Regs: Use binary search to look up reg names
This gets rid of the static unordered_map. Also changes the return type
const char*, avoiding unnecessary allocations (the result was only used
by calling .c_str() on it.)
2017-02-09 00:04:24 -08:00
Yuri Kunde Schlesner 602f57da38 VideoCore: Use union to index into Regs struct
Also remove some unused members.
2017-02-08 22:13:25 -08:00
Yuri Kunde Schlesner 2889372e47 Merge pull request #2482 from yuriks/pica-refactor
Split up monolithic Regs struct
2017-02-08 22:07:34 -08:00
Lectem f146a6d45a Use std::array<u8,2> instead of u8[2] to fix MSVC build 2017-02-05 14:55:51 +01:00
Yuri Kunde Schlesner 5759d94b5c VideoCore: Move Regs to its own file 2017-02-04 13:59:12 -08:00
Yuri Kunde Schlesner f7c7f422c6 VideoCore: Split shader regs from Regs struct 2017-02-04 13:59:11 -08:00
Yuri Kunde Schlesner 8fca90b5d5 VideoCore: Split geometry pipeline regs from Regs struct 2017-02-04 13:59:11 -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 c74787a11c Pica/Texture: Move part of ETC1 decoding to new file and cleanups 2017-02-04 12:33:28 -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
wwylele 6dc1d6e568 ShaderJIT: add 16 dummy bytes at the bottom of the stack 2017-02-03 14:53:38 +02:00
Weiyi Wang 0b9c59ff22 Common/x64: remove legacy emitter and abi (#2504)
These are not used any more since we moved shader JIT to xbyak.
2017-01-31 01:06:42 -08:00
Merry f7e96dc068 shader_jit_x64_compiler: esi and edi should be persistent (#2500) 2017-01-31 00:38:31 -08:00
Yuri Kunde Schlesner 37a4ea046d VideoCore: Make PrimitiveAssembler const-correct 2017-01-29 21:31:38 -08:00
Yuri Kunde Schlesner dcdffabfe6 VideoCore: Extract swrast-specific data from OutputVertex 2017-01-29 21:31:38 -08:00
Yuri Kunde Schlesner 8ed9f9d49f VideoCore/Shader: Clean up OutputVertex::FromAttributeBuffer
This also fixes a long-standing but neverthless harmless memory
corruption bug, whech the padding of the OutputVertex struct would get
corrupted by unused attributes.
2017-01-29 21:31:38 -08:00
Yuri Kunde Schlesner 92bf5c88e6 VideoCore: Split shader output writing from semantic loading 2017-01-29 21:31:37 -08:00
Yuri Kunde Schlesner 335df895b9 VideoCore: Consistently use shader configuration to load attributes 2017-01-29 21:31:37 -08:00
Yuri Kunde Schlesner fccb28d2e9 VideoCore: Use correct register for immediate mode attribute count 2017-01-29 21:31:36 -08:00
Yuri Kunde Schlesner ab6954e942 VideoCore: Rename some types to more accurate names 2017-01-29 21:31:36 -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
Yuri Kunde Schlesner 0e9081b973 VideoCore/Shader: Move entry_point to SetupBatch 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner 0f64274145 VideoCore/Shader: Move per-batch ShaderEngine state into ShaderSetup 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner 6fa3687afc Shader: Remove OutputRegisters struct 2017-01-25 18:53:25 -08:00
Yuri Kunde Schlesner 9ea5eacf91 Shader: Initialize conditional_code in interpreter
This doesn't belong in LoadInputVertex because it also happens for
non-VS invocations. Since it's not used by the JIT it seems adequate to
initialize it in the interpreter which is the only thing that cares
about them.
2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner 1a2acc3baa Shader: Don't read ShaderSetup from global state 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner fa4ac279a7 shader_jit_x64: Don't read program from global state 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner ade7ed7c5f VideoCore/Shader: Move ProduceDebugInfo to InterpreterEngine 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner 114d6b2f97 VideoCore/Shader: Split interpreter and JIT into separate ShaderEngines 2017-01-25 18:53:24 -08:00
Yuri Kunde Schlesner 8eefc62833 VideoCore/Shader: Rename shader_jit_x64{ => _compiler}.{cpp,h} 2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner dd4a1672a7 VideoCore/Shader: Split shader uniform state and shader engine
Currently there's only a single dummy implementation, which will be
split in a following commit.
2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner bd82cffd0b VideoCore/Shader: Add constness to methods 2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner 1e1f939817 VideoCore/Shader: Use only entry_point as ShaderSetup param
This removes all implicit dependency of ShaderState on global PICA
state.
2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner e3caf669b0 VideoCore/Shader: Use self instead of g_state.vs in ShaderSetup 2017-01-25 18:53:23 -08:00
Yuri Kunde Schlesner 34d581f2dc VideoCore/Shader: Extract input vertex loading code into function 2017-01-25 18:53:20 -08:00
Kloen 5cc94c17f6 video_core: fix shader.cpp signed / unsigned warning 2017-01-23 16:53:31 +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
Jonathan Hao c18cb1b192 Fix some warnings (#2399) 2017-01-04 13:48:29 -03: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
bunnei 3a1eaf2efc Merge pull request #2318 from yuriks/trace-opt
VideoCore: Inline IsPicaTracing
2016-12-18 21:15:24 -05:00
Yuri Kunde Schlesner c135317de1 VideoCore/Shader: Extract DebugData out from UnitState 2016-12-16 00:16:25 -08:00
Yuri Kunde Schlesner 6e7e767645 Remove unnecessary cast 2016-12-16 00:15:55 -08:00
Yuri Kunde Schlesner b5e3599704 VideoCore/Shader: Extract evaluate_condition lambda to function scope 2016-12-16 00:15:51 -08:00
Yuri Kunde Schlesner 960578f4e1 VideoCore/Shader: Extract call lambda up a scope and remove unused param 2016-12-15 23:08:05 -08:00
Yuri Kunde Schlesner e4e962bc7c VideoCore/Shader: Remove dynamic control flow in (Get)UniformOffset 2016-12-15 23:08:05 -08:00
Yuri Kunde Schlesner d27cb1dedc VideoCore/Shader: Move DebugData to a separate file 2016-12-15 23:08:05 -08:00
Yuri Kunde Schlesner fb9e856b91 shader_jit_x64: Use LOOPCOUNT_REG as a 64-bit reg when indexing 2016-12-15 10:02:42 -08:00
Yuri Kunde Schlesner ac9f937477 VideoCore: Make profiling scope more representative 2016-12-14 22:52:09 -08:00
Yuri Kunde Schlesner 945f554b84 VideoCore: Inline IsPicaTracing
Speeds up ALBW main menu slightly (~3%)
2016-12-14 22:06:40 -08:00
Yuri Kunde Schlesner f00ada3363 VideoCore: Eliminate an unnecessary copy in the drawcall loop 2016-12-14 21:00:29 -08:00
Yuri Kunde Schlesner 5ff3206207 shader_jit_x64: Use Reg32 for LOOP* registers, eliminating casts 2016-12-14 20:06:09 -08:00
Yuri Kunde Schlesner f4e98ecf3f VideoCore: Convert x64 shader JIT to use Xbyak for assembly 2016-12-14 20:06:08 -08:00
Lioncash 963aedd8cc Add all services to the Service namespace
Previously there was a split where some of the services were in the
Service namespace and others were not.
2016-12-11 00:07:27 +00: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
emmauss c4e4fa53d9 Implement Frame rate limiter (#2223)
* implement frame limiter

* fixes
2016-12-06 14:33:19 -05: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
Yuri Kunde Schlesner 4f0f88bc6a Merge pull request #2259 from JayFoxRox/fix-fallback
shader_jit: Fix non-SSE4.1 path where FLR would not truncate
2016-12-03 22:11:39 -08:00
Jannik Vogel 2d8097eecc shader_jit: Fix non-SSE4.1 path where FLR would not truncate 2016-12-04 04:26:33 +01:00
Yuri Kunde Schlesner 4d5e42240c clang-format: Fix coding style 2016-12-03 01:32:46 -08:00
Jannik Vogel e2cb7d7833 shader_jit: Load LOOPCOUNT_REG and LOOPINC 4 bit left-shifted 2016-12-02 04:33:15 +01: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
Yuri Kunde Schlesner e279a6955e Merge pull request #2222 from linkmauve/die-frameskip-die
Remove the broken frame_skip option
2016-11-27 16:01:45 -08:00
Emmanuel Gil Peyrot 0820c99462 GPU: Remove the broken frame_skip option.
Fixes #1960.
2016-11-27 21:19:56 +00: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
jphalimi 82210ab480 Cache Vertices instead of Output registers (#2165)
This patch brings +3% performance improvement on average. It removes
ToVertex() as an important hotspot of the emulator.
2016-11-23 23:10:34 -05:00
wwylele 75affa13f7 Fix format error from #2195 2016-11-22 20:17:28 +02:00
bunnei 2de470c9b2 Merge pull request #2195 from Subv/factor_check
GPU/CiTrace: Avoid calling GetTextures() when not necessary.
2016-11-19 22:21:11 -05:00
Subv 050e9be15b GPU/CiTrace: Avoid calling GetTextures() when not necessary. 2016-11-19 19:27:00 -05:00
James Rowe f68f37b520 Merge pull request #2194 from jroweboy/extremely-minor-clangformat-change
Minor formatting change
2016-11-19 13:51:14 -07:00
James Rowe 19acec351c Minor formatting change 2016-11-19 13:35:07 -07: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
Ricardo de Almeida Gonzaga 13d46f6820 Fix typos 2016-10-20 12:26:59 -02:00
bunnei d989102c9c Merge pull request #2082 from yuriks/shader-interp-crash
Fix/mask crash in shader debugger in Mii Maker
2016-10-06 19:35:37 -04: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 d9a904f9cb VideoCore: Shader interpreter cleanups 2016-09-29 21:15:49 -07:00
Yuri Kunde Schlesner 26b68313b9 VideoCore: Fix out-of-bounds read in ShaderSetup::ProduceDebugInfo
As far as I can tell, memset was replaced by a fill without correcting
the parameter type, causing an out-of-bounds array read in the Vec4
constructor.
2016-09-29 21:11:36 -07: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 f120e78b56 Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07: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
Yuri Kunde Schlesner a3afeb4687 VideoCore: Fix dangling lambda context in shader interpreter
The static meant that after the first execution, these lambda context
would be pointing to a random location on the stack. Fixes a random
crash when using the interpreter.
2016-09-15 22:15:11 -07:00
bunnei 09063dc5bb Merge pull request #2032 from bunnei/qt-graphics
Qt graphics configure & V-Sync option
2016-08-31 22:20:54 -04:00
Jannik Vogel 7a79fa7a90 OpenGL: Avoid error on unsupported lighting LUT 2016-08-30 19:30:26 +02:00
bunnei 08ad9b36d4 config: Add a setting for graphics V-Sync. 2016-08-29 21:42:30 -04: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
scurest 0f9274fe24 Remove superfluous std::move in return std::move(local_var) 2016-06-25 13:26:21 -05:00
Jannik Vogel a12571c709 OpenGL: Implement fog 2016-06-07 00:06:28 +02:00
Jannik Vogel ebee2513a9 Rasterizer: Implement fog 2016-06-07 00:06:28 +02:00
Jannik Vogel 57855a1701 Pica: Add fog state 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
bunnei 552018c50a Merge pull request #1812 from JayFoxRox/refactor-shader
Retrieve shader result from new OutputRegisters-type
2016-05-31 18:12:56 -04:00
bunnei 201a7af92a Merge pull request #1846 from JayFoxRox/missing-dirty-lighting
OpenGL: Set shader_dirty on lighting changes
2016-05-26 17:35:12 -04:00
bunnei a316fbb15a Merge pull request #1733 from lioncash/vert_loader
VertexLoader: Minor changes
2016-05-23 21:13:34 -04: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
Jannik Vogel d77279a415 Refactor Tev stage dumper 2016-05-21 03:11:27 +02:00
Jannik Vogel 324c21c922 Extend Tev stage dumper 2016-05-21 03:08:59 +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 ff0fa86b17 Retrieve shader result from new OutputRegisters-type 2016-05-16 18:55:51 +02:00
linkmauve f40fabd688 Merge pull request #1787 from JayFoxRox/refactor-jit
Refactor JIT
2016-05-16 17:54:45 +01: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 1308afe2c2 Use new shader-jit signature for interpreter 2016-05-13 09:41:55 +02:00
Jannik Vogel 4e01e9ffc5 Refactor access to state in shader-jit 2016-05-13 09:20:14 +02:00
Jannik Vogel 5864cb7e00 OpenGL: Support blend equation 2016-05-12 22:57:40 +02:00
Jannik Vogel 7e756faaba Move program_counter and call_stack from UnitState to interpreter 2016-05-12 19:05:42 +02:00
Jannik Vogel 6c6d99ca51 Move default_attributes into Pica state 2016-05-12 19:05:41 +02:00
bunnei f6eb62d062 Merge pull request #1690 from JayFoxRox/tex-type-3
Pica: Implement texture type 3 (Projection2D)
2016-05-11 21:47:08 -04:00
Jannik Vogel ae7a82fa1c Turn ShaderSetup into struct 2016-05-11 23:48:24 +02:00
Jannik Vogel 5a7306d6df OpenGL: Implement texture type 3 2016-05-11 08:07:37 +02:00
Jannik Vogel 4311297eb1 Rasterizer: Implement texture type 3 2016-05-11 08:07:36 +02:00
Jannik Vogel 2f8e8e1455 Pica: Add tc0.w to OutputVertex 2016-05-11 08:07:36 +02:00
Jannik Vogel 9cfebb9334 Pica: Add texture type to state 2016-05-11 08:07:36 +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
Lioncash 6d5f2a3cff vertex_loader: Correct forward declaration of InputVertex
It's actually a struct, not a class.
2016-05-08 23:08:18 -04:00
Lioncash 5587383eb7 vertex_loader: Provide an assertion for ensuring the loader has been setup
Also adds an assert to ensure that Setup is not called more than once
during a VertexLoader's lifetime.
2016-05-08 23:08:12 -04:00
Lioncash 1357724cd9 vertex_loader: Add constructors to facilitate immediate and two-step initialization 2016-05-08 23:03:32 -04:00
Lioncash 769f4a7018 vertex_loader: initialize_num_total_attributes.
Keeps the public API sane.
2016-05-08 23:03:32 -04:00
Lioncash 8ea5e7dfb5 vertex_loader: Use std::array instead of raw C arrays 2016-05-08 23:03:32 -04:00
Lioncash a286b61f75 vertex_loader: Correct header ordering 2016-05-08 23:01:26 -04: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 7a77b8356c Pica: Rename VertexLoaded breakpoint to VertexShaderInvocation 2016-05-04 10:21:51 +02:00
Jannik Vogel f74652d2fe Pica: Use a union for PicaShaderConfig 2016-05-03 15:06:49 +02:00
Jannik Vogel 5fc8eb227a Pica: Add TevStageConfigRaw to PicaShaderConfig (MSVC workaround) 2016-05-03 15:06:46 +02:00
Jannik Vogel f3f7018c9e Pica: Make PicaShaderConfig trivially_copyable and clear it before use 2016-05-03 14:10:11 +02:00
Jannik Vogel 5ec1140f8b OpenGL: Don't copy const_color (Reverts #1745) 2016-05-03 12:34:52 +02:00
Jannik Vogel 696cb197a5 Pica: Replace logic in shader.cpp with loop 2016-05-03 01:40:47 +02:00
bunnei 15d0e98267 Merge pull request #1741 from linkmauve/iwyu-video_core
Fix video_core includes (and dependencies) using include-what-you-use
2016-05-01 17:44:57 -04:00
Jannik Vogel 7e0d6903ff OpenGL: Copy TevStageConfig using a loop. Fixes bug: const_color not copied 2016-05-01 16:35:54 +02:00
Jannik Vogel aab41604f7 OpenGL: border_color was never set. Fixed. (#1740) 2016-04-30 12:20:23 -07:00
Emmanuel Gil Peyrot 691a42fe98 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
Jannik Vogel 49bfe9bf91 Remove TGA dumper 2016-04-30 09:43:59 +02:00
bunnei 90243c56fb Merge pull request #1730 from hrydgard/vertex-loader
* Remove late accesses to attribute_config

* Refactor: Extract VertexLoader from command_processor.cpp.

Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.

* Move "&" to their proper place, add missing includes and make some properly relative.

* Don't keep base_address in the loader, it doesn't belong there (with it, the loader can't be cached).

* Optimize the vertex loader, nearly doubling its speed.

* Debugger fix

* Move and rename the MemoryAccesses class to MemoryAccessTracker.
2016-04-29 09:42:47 -04:00
Yuri Kunde Schlesner e3a8292495 Common: Remove section measurement from profiler (#1731)
This has been entirely superseded by MicroProfile. The rest of the code
can go when a simpler frametime/FPS meter is added to the GUI.
2016-04-29 00:07:10 -07:00
Henrik Rydgard a86d7cacc1 Move and rename the MemoryAccesses class to MemoryAccessTracker. 2016-04-29 08:50:21 +02:00
Henrik Rydgard a442ee07f4 Debugger fix 2016-04-28 22:30:01 +02:00
Henrik Rydgard 251f29dd7f Optimize the vertex loader, nearly doubling its speed. 2016-04-28 22:21:39 +02:00
Henrik Rydgard 2403e86cbb Don't keep base_address in the loader, it doesn't belong there (with it, the loader can't be cached). 2016-04-28 20:17:35 +02:00
Henrik Rydgard d00e2340c6 Move "&" to their proper place, add missing includes and make some properly relative. 2016-04-28 19:40:11 +02:00
Henrik Rydgard 47ff008817 Refactor: Extract VertexLoader from command_processor.cpp.
Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.
2016-04-28 19:05:55 +02:00
Henrik Rydgard 0cf15f64ef Remove late accesses to attribute_config 2016-04-28 18:07:34 +02:00
bunnei 15c907317c Merge pull request #1710 from hrydgard/optimize-event-breakpoints
Replace std::map with std::array for graphics event breakpoints
2016-04-25 21:37:43 -04:00
Sam Spilsbury 656a442433 shader: Shader size is long uint, not uint. 2016-04-25 00:40:03 +08:00
Sam Spilsbury c6709d97bc shader: Handle non-CALL opcodes with a break 2016-04-25 00:39:54 +08:00
Sam Spilsbury bbffa6ad69 shader: Format string must be provided inline and not as a variable 2016-04-24 23:40:52 +08:00
Henrik Rydgard 01a1555b5d Replace std::map with std::array for graphics event breakpoints, and allow the compiler to inline. Saves 1%+ in vertex heavy situations. 2016-04-24 14:19:49 +02:00
Sam Spilsbury 39d4994c15 pica: Handle default lighting case 2016-04-23 11:54:02 +08:00
tfarley 562f36a144 HWRasterizer: reorder declarations to match defs 2016-04-22 10:52:02 -04:00
tfarley 3268cab26b HWRasterizer: sync specular uniform for new shaders 2016-04-22 10:48:00 -04:00
bunnei bab30bcd6e Merge pull request #1436 from tfarley/hw-tex-forwarding
Hardware Renderer Texture Forwarding
2016-04-22 08:15:51 -04:00
tfarley 22f3a7e94c HWRasterizer: Texture forwarding 2016-04-21 17:27:56 -04:00
tfarley e46d086189 Config: Add scaled resolution option 2016-04-21 17:27:48 -04:00
bunnei 14cc1ed911 Merge pull request #1655 from JayFoxRox/hw-dot3
OpenGL: Implement color combiner Operation::Dot3_RGB
2016-04-21 16:39:36 -04:00
bunnei 142a5dc3f5 Merge pull request #1625 from JayFoxRox/sw-blend-func
Rasterizer: Allow all blend factors for alpha blend-func
2016-04-17 20:20:15 -04:00
Jannik Vogel e2b63a2dd7 Rasterizer: Allow all blend factors for alpha blend-func 2016-04-17 22:44:24 +02:00
Lioncash 4501a9eb50 debug_utils: use std::make_unique for initializing PicaTrace 2016-04-14 22:05:28 -04:00
bunnei aff35d3e58 Merge pull request #1665 from lioncash/file
IOFile: Minor API changes
2016-04-14 16:28:15 -04:00
bunnei d7fe2784cc shader_jit_x64: Rename RuntimeAssert to Compile_Assert. 2016-04-13 23:04:53 -04:00
bunnei 3f623b2561 shader_jit_x64.cpp: Rename JitCompiler to JitShader. 2016-04-13 23:04:53 -04:00
bunnei 847fb951e2 shader_jit_x64: Free memory that's no longer needed after compilation. 2016-04-13 23:04:52 -04:00
bunnei 60aa72e117 shader_jit_x64: Use a sorted vector instead of a set for keeping track of return addresses. 2016-04-13 23:04:52 -04:00
bunnei 60749f2cda shader_jit_x64: Use CALL/RET instead of JMP for subroutines. 2016-04-13 23:04:52 -04:00
bunnei 1d45b57939 shader_jit_x64: Separate initialization and code generation for readability. 2016-04-13 23:04:50 -04:00
bunnei 6e0319eec9 shader_jit_x64: Get rid of unnecessary last_program_counter variable. 2016-04-13 23:04:49 -04:00
bunnei f3afe24594 shader_jit_x64: Execute certain asserts at runtime.
- This is because we compile the full shader code space, and therefore its common to compile malformed instructions.
2016-04-13 23:04:49 -04:00
bunnei ffcf7ecee9 shader: Remove unused 'state' argument from 'Setup' function. 2016-04-13 23:04:48 -04:00
bunnei a5a74eb121 shader_jit_x64: Specify shader main offset at runtime. 2016-04-13 23:04:47 -04:00
bunnei c9d10de644 shader_jit_x64: Allocate each program independently and persist for emu session. 2016-04-13 23:04:47 -04:00
bunnei 4632791a40 shader_jit_x64: Rewrite flow control to support arbitrary CALL and JMP instructions. 2016-04-13 23:04:44 -04:00
bunnei 135aec7bea shader_jit_x64: Fix strict memory aliasing issues. 2016-04-13 23:04:43 -04:00
Lioncash a4120ca66c file_util: Don't expose IOFile internals through the API 2016-04-13 20:17:17 -04:00
Jannik Vogel ff7c798d86 Pica: Remove geometry dumper (PICA_DUMP_GEOMETRY) 2016-04-10 22:07:06 +02:00
Jannik Vogel 0ad050f85d OpenGL: Implement color combiner Operation::Dot3_RGB 2016-04-10 15:31:24 +02:00
Jannik Vogel 35a92b4097 OpenGL: Respect buffer-write allow registers 2016-04-08 22:57:11 +02:00
Jannik Vogel c6bbc41984 OpenGL: Split buffer-write mask sync into seperate functions 2016-04-08 22:42:44 +02:00
Jannik Vogel fa24df7340 Rasterizer: Respect buffer-write allow registers 2016-04-08 22:35:22 +02:00
Jannik Vogel d47605b2ed OpenGL: Keep stencil-test and framebuffer.depth_format in sync 2016-04-08 22:35:17 +02:00
bunnei 6e750ae12d Merge pull request #1639 from linkmauve/fix-double-framebuffer-check
OpenGL: Fix a double framebuffer completeness checks.
2016-04-07 19:52:02 -04:00
Mathew Maidment aa6380e5bc Merge pull request #1643 from MerryMage/make_unique
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 20:10:11 -04:00
MerryMage a06dcfeb61 Common: Remove Common::make_unique, use std::make_unique 2016-04-05 13:31:17 +01:00
Emmanuel Gil Peyrot 3219be8ee0 OpenGL: Fix a double framebuffer completeness checks. 2016-04-03 17:00:44 +01:00
Jannik Vogel 693cbc1f8f OpenGL: Check for framebuffer completeness 2016-04-03 17:06:05 +02:00
Jannik Vogel c26b141407 Avoid warnings by casting to size_t for ARRAY_SIZE() comparisons 2016-04-01 02:14:43 +02:00
Yuri Kunde Schlesner 81004211dd Pica: Improve accuracy of immediate-mode support
This partially fixes Etrian Odyssey IV.
2016-03-23 20:18:40 -07:00
Yuri Kunde Schlesner 0c447e0a06 OpenGL: Don't attempt to draw empty triangle batches
Our code did not handle this well, causing random crashes in some
situations.
2016-03-23 20:02:05 -07:00
bunnei ebbba0d381 Merge pull request #1508 from JayFoxRox/vs-output-map
Respect vs output map
2016-03-22 11:59:12 -04:00
bunnei 784c5539ea Merge pull request #1538 from lioncash/dot
shader_interpreter: use std::inner_product for the dot product
2016-03-20 00:35:06 -04:00
bunnei 58852bedbf Merge pull request #1535 from JayFoxRox/fix-align
PICA: Alignment happens locally in vertex
2016-03-17 20:00:00 -04:00
Lioncash 63e956cc7a video_core: Don't cast away const 2016-03-17 02:01:38 -04:00
Lioncash 4d89df8df2 shader_interpreter: use std::inner_product for the dot product
Same thing, less code.
2016-03-17 01:00:30 -04:00
Lioncash c928b04eee core/video_core: Make NumIds functions constexpr 2016-03-17 00:29:47 -04:00
Lioncash 39baad9926 core/video_core: Don't cast away const in subscript operators
Not to say these subscript operators aren't totally ugly as is.
2016-03-17 00:27:15 -04:00
Jannik Vogel 7eef9ebc3b PICA: Alignment happens locally in vertex 2016-03-17 02:24:20 +01:00
bunnei 55f24e1cf4 Merge pull request #1519 from JayFoxRox/vp-offset-fix
PICA: Fix viewport offset
2016-03-16 14:19:53 -04:00
bunnei 96cafbe4cc Merge pull request #1503 from bunnei/clear-jit-cache
Clear JIT cache
2016-03-16 13:18:51 -04:00
Jannik Vogel 9aad2f29bb PICA: Fix MAD/MADI encoding 2016-03-15 20:01:25 +01:00
Jannik Vogel 964cfaea47 PICA: Fix viewport offset 2016-03-14 18:37:33 +01:00
Jannik Vogel f746a00964 Respect vs output map 2016-03-14 13:03:34 +01:00
Jannik Vogel a66c186e81 PICA: Align vertex attributes 2016-03-13 04:54:23 +01:00
bunnei 6efb710b28 shader_jit_x64: Clear cache after code space fills up. 2016-03-12 12:15:49 -05:00
bunnei c103759cdc shader_jit_x64: Make assert outputs more useful & cleanup formatting. 2016-03-12 12:06:28 -05:00
bunnei 46f78b7f19 shader: Update log message to use proper log class. 2016-03-12 12:03:32 -05:00
Yuri Kunde Schlesner 305e63d9ea Merge pull request #1475 from lioncash/align
Common: Get rid of alignment macros
2016-03-09 20:08:38 -08:00
bunnei 4a2d1571bc Merge pull request #1474 from lioncash/renderer
renderer_base: Minor changes
2016-03-09 10:57:38 -05:00
Lioncash 88d604383e Common: Get rid of alignment macros
The gl rasterizer already uses alignas,
so we may as well move everything over.
2016-03-09 01:31:14 -05:00
bunnei 8530a2d7df Merge pull request #1344 from LittleWhite-tb/error-output
Output errors in GUI
2016-03-08 23:12:04 -05:00
Lioncash 4b5b32e721 renderer_base: In-class initialize variables 2016-03-08 21:46:47 -05:00
Lioncash be913040a8 render_base: Clarify/normalize getter functions 2016-03-08 21:45:24 -05:00
Lioncash bf76afc68d renderer_base: Don't directly expose the rasterizer unique_ptr
There's no reason to allow direct access to the unique_ptr instance. Only
its contained pointer.
2016-03-08 21:31:44 -05:00
LittleWhite 4be68dddfb Improve error report from Init() functions
Add error popup when citra initialization failed
2016-03-08 22:05:25 +01:00
Yuri Kunde Schlesner c58bc25d5b Pica: Write depth value even when depth test is disabled
This has been confirmed on hardware. Fixes Etrian Odyssey IV.
2016-03-05 20:16:20 -08:00
Dwayne Slater 6b775034dd Add immediate mode vertex submission 2016-03-02 22:16:38 -05:00
bunnei 2b00bdec1f Merge pull request #1424 from MerryMage/lut_init
renderer_opengl: Initalise fragment shader LUT textures
2016-02-25 19:36:27 -05:00
MerryMage 0801363840 renderer_opengl: Initalise fragment shader LUT textures 2016-02-26 00:12:38 +00:00
bunnei e04e6aabbc Merge pull request #1395 from ds84182/padding-attributes
Add support for padding vertex attributes
2016-02-24 18:15:16 -08:00
Dwayne Slater ed8072b48b Fix out of bounds array access when loading a component >= 12 2016-02-20 19:03:14 -05:00
Dwayne Slater 82fc075ff6 Add support for padding vertex attributes 2016-02-20 19:00:31 -05:00
MerryMage 6c71858c5c BitField: Make trivially copyable and remove assignment operator 2016-02-12 19:51:16 +00:00
bunnei 19557aaab3 pica: Cleanup lighting register definitions and documentation. 2016-02-05 17:20:25 -05:00
bunnei c4d318f691 gl_rasterizer: Use alignas(16) instead of explicit padding. 2016-02-05 17:20:24 -05:00
bunnei aaa7beeda8 renderer_opengl: Use GLvec3/GLvec4 aliases for commonly used types. 2016-02-05 17:20:23 -05:00
bunnei 8e9318f20a gl_rasterizer: Fix issue with interpolation of opposite quaternions. 2016-02-05 17:20:23 -05:00
bunnei b694423d09 pica_types: Fix typo in docstring. 2016-02-05 17:20:22 -05:00
bunnei a949fd5f25 pica_types: Replace float24/20/16 with a template class. 2016-02-05 17:20:22 -05:00
bunnei d171822dce command_processor: Add an assertion to ensure LUTs are not written past their boundaries. 2016-02-05 17:20:20 -05:00
bunnei 310a1c30ca gl_rasterizer: Remove unnecessary casts. 2016-02-05 17:20:19 -05:00
bunnei c229503f4a gl_rasterizer: Fix PicaShaderConfig on GCC. 2016-02-05 17:20:19 -05:00
bunnei 9dfb223d26 gl_rasterizer: Initial implementation of bump mapping. 2016-02-05 17:20:19 -05:00
bunnei 449902b558 gl_shader_gen: Fix bug in LUT range (should within range [0, 255] not [0, 256]). 2016-02-05 17:20:17 -05:00
bunnei 348c9c9ff3 gl_shader_gen: Implement lighting red, green, and blue reflection. 2016-02-05 17:20:16 -05:00
bunnei 01b407638c gl_shader_gen: View should be normalized. 2016-02-05 17:20:15 -05:00
bunnei c37de30cfc gl_shader_gen: Implement fragment lighting fresnel effect. 2016-02-05 17:20:13 -05:00
bunnei 0e67c21c9e gl_shader_gen: Implement fragment lighting specular 1 component. 2016-02-05 17:19:16 -05:00
bunnei 781b046579 gl_shader_gen: Add support for D0 LUT scaling. 2016-02-05 17:18:36 -05:00
bunnei 3d89dacd56 gl_shader_gen: Refactor lighting config to match Pica register naming.
- Also implement D0 LUT enable.
2016-02-05 17:17:35 -05:00
bunnei 6307999116 pica: Cleanup and add some comments to lighting registers. 2016-02-05 17:17:34 -05:00
bunnei 6878ba7608 gl_rasterizer: Minor naming refactor on Pica register naming. 2016-02-05 17:17:33 -05:00
bunnei 76f303538b gl_shader_gen: Reorganize and cleanup lighting code.
- No functional difference.
2016-02-05 17:17:33 -05:00
bunnei 5f3bad8fb1 gl_shader_gen: Fix directional lights. 2016-02-05 17:17:32 -05:00
bunnei bdc72d0904 gl_shader_gen: Fix bug with lighting where clamp highlights was only applied to last light. 2016-02-05 17:17:32 -05:00
bunnei 603b619cbe gl_shader_gen: View vector needs to be normalized when computing half angle vector. 2016-02-05 17:17:31 -05:00
bunnei 021cb0bced renderer_opengl: Use textures for fragment shader LUTs instead of UBOs.
- Gets us LUT interpolation for free.
- Some older Intel GPU drivers did not support the big UBOs needed to store the LUTs.
2016-02-05 17:17:31 -05:00
bunnei bf89870437 renderer_opengl: Initial implementation of basic specular lighting. 2016-02-05 17:17:30 -05:00
bunnei e34fa6365f renderer_opengl: Implement HW fragment lighting distance attenuation. 2016-02-05 17:17:30 -05:00
bunnei e9af70eaf3 renderer_opengl: Implement HW fragment lighting LUTs within our default UBO. 2016-02-05 17:17:29 -05:00
bunnei afbef52516 renderer_opengl: Implement diffuse component of HW fragment lighting. 2016-02-05 17:17:29 -05:00
bunnei b003075570 pica: Implement decoding of basic fragment lighting components.
- Diffuse
- Distance attenuation
- float16/float20 types
- Vertex Shader 'view' output
2016-02-05 17:17:28 -05:00
bunnei 281bc90ad2 pica: Implement fragment lighting LUTs. 2016-02-05 17:17:27 -05:00
bunnei 4369767c72 pica: Add decodings for distance attenuation and LUT registers. 2016-02-05 17:17:26 -05:00
bunnei 38c7b20475 pica: Add pica_types module and move float24 definition. 2016-02-05 17:17:26 -05:00
tfarley a15f4d1590 hwrasterizer: Use proper cached fb addr/size 2016-02-03 15:52:34 -05:00
Yuri Kunde Schlesner 05356543d9 OpenGL: Downgrade GL_DEBUG_SEVERITY_NOTIFICATION to Debug logging level
The nVidia driver is *extremely* spammy on this category, sending a
message on every buffer or texture upload, slowing down the emulator and
making the log useless.
2016-02-02 22:44:13 -08:00
bunnei a43f8d2fb7 Merge pull request #1367 from yuriks/jit-jmp
Shader JIT: Fix off-by-one error when compiling JMPs
2016-01-27 09:19:28 -05:00
bunnei c407b6ce2f Merge pull request #1369 from yuriks/jmpu-inverted
Shader: Implement "invert condition" feature of IFU instruction
2016-01-26 09:58:16 -05:00
Yuri Kunde Schlesner d01d1f7e01 Debugger: Use 3dbrew names for GPU registers
This list was imported from the 3dbrew wiki page and is pretty much
complete.
2016-01-24 20:29:44 -08:00
Yuri Kunde Schlesner 083d2d89a5 Shader: Implement "invert condition" feature of IFU instruction
If the bit 0 of the JMPU instruction is set, then the jump condition
will be inverted. That is, a jump will happen when the boolean is false
instead of when it is true.
2016-01-24 20:29:06 -08:00
Yuri Kunde Schlesner c1071c1ff7 Shader JIT: Fix off-by-one error when compiling JMPs
There was a mistake in the JMP code which meant that one instruction at
the destination would be skipped when the jump was taken. This commit
also changes the meaning of the culprit parameter to make it less
confusing and avoid similar mistakes in the future.
2016-01-24 02:15:56 -08:00
bunnei 0b6cc0592d Merge pull request #1334 from tfarley/hw-depth-modifiers
hwrasterizer: Use depth offset
2016-01-20 22:27:33 -05:00
tfarley f53dbafdae hwrasterizer: Use depth offset 2016-01-20 21:57:59 -05:00
Lioncash 4966568076 command_processor: Get rid of variable shadowing 2016-01-17 02:22:51 -05:00
bunnei 6a261e825c Merge pull request #1196 from linkmauve/khr_debug
Add optional GL_KHR_debug support
2016-01-12 22:54:52 -05:00
Lioncash 5e17a586da video_core: Make the renderer global a unique_ptr 2015-12-30 08:52:01 -05:00
Lioncash 97dc9634a2 swrasterizer: Add missing override specifier 2015-12-29 18:35:38 -05:00
Yuri Kunde Schlesner 015d7b9779 VideoCore: Sync state after changing rasterizers
This fixes various bugs that appear in the HW rasterizer after switching
between it and the SW one during emulation.
2015-12-20 17:37:15 -08:00
Yuri Kunde Schlesner 402692c08d Merge pull request #1267 from yuriks/flipped-framebuffer
OpenGL: Flip framebuffers during transfer rather than when rendering
2015-12-09 20:35:15 -08:00
bunnei 3013f26d70 Merge pull request #1269 from Subv/triangle_fan
GPU/PrimitiveAssembler: Fixed drawing triangle fans.
2015-12-08 10:27:40 -05:00
Yuri Kunde Schlesner 195fedccf0 VideoCore: Unify interface to OpenGL and SW rasterizers
This removes explicit checks sprinkled all over the codebase to instead
just have the SW rasterizer expose an implementation with no-ops for
most operations.
2015-12-07 20:20:38 -08:00
Yuri Kunde Schlesner 03835d04f4 VideoCore: Rename HWRasterizer methods to be less confusing 2015-12-06 19:08:37 -08:00
Yuri Kunde Schlesner da80ece8b9 OpenGL: Rename cache functions to better match what they actually do 2015-12-06 17:02:52 -08:00
Subv 7b33e163b9 GPU/PrimitiveAssembler: Fixed drawing triangle fans.
It was skipping the second vertex assignment and using uninitialized garbage when assembling the corresponding triangle.
2015-12-06 10:48:05 -05:00
Yuri Kunde Schlesner cf81e08389 OpenGL: Flip framebuffers during transfer rather than when rendering 2015-12-04 22:23:39 -08:00
Yuri Kunde Schlesner 95dbc6eb0e OpenGL: Add support for glFrontFace in the state tracker 2015-12-04 21:58:26 -08:00
Yuri Kunde Schlesner e9c209ccc8 PICA: Properly emulate 1-stage delay in the combiner buffer
This was discovered and verified by @fincs. The tev combiner buffer
actually lags behind by one stage, meaning stage 1 reads the initial
color, stage 2 reads stage 0's output, and so on.

Fixes character portraits in Fire Emblem: Awakening and world textures
in Zelda: ALBW. Closes #1140.
2015-11-30 22:45:18 -08:00
bunnei f008dfbaca renderer_opengl: Fix uniform issues introduced with kemenaran/avoid-explicit-uniform-location. 2015-11-25 22:33:24 -05:00
Pierre de La Morinerie 0735630744 Use regular uniform location
The support for GL_ARB_explicit_uniform_location is not that good
(53% according to http://feedback.wildfiregames.com/report/opengl/feature/GL_ARB_explicit_uniform_location).

This fix the shader compilation on Intel HD 4000 (#1222).
2015-11-25 11:56:11 +01:00
Subv 823ce62f2f FragShader: Use an UBO instead of several individual uniforms 2015-11-18 21:03:56 -05:00
Subv 7a37dba75b GPU/Loaders: Log an error when a loader tries to load from a component beyond the available ones (12).
Related to #1170
2015-11-09 21:16:11 -05:00
Emmanuel Gil Peyrot 53df67376d OpenGL: Log GL_KHR_debug messages we receive
This allows the driver to communicate errors, warnings and improvement
suggestions about our usage of the API.
2015-10-24 02:30:51 +01:00
bunnei 74186a5f01 gl_shader_gen: Use explicit locations for vertex shader attributes. 2015-10-21 22:29:56 -04:00
bunnei e663f5c914 gl_shader_gen: Optimize code for AppendAlphaTestCondition.
- Also add a comment to AppendColorCombiner.
2015-10-21 22:29:56 -04:00
bunnei e7b1f2ae0a gl_rasterizer: Define enum types for each vertex texcoord attribute. 2015-10-21 21:59:47 -04:00
bunnei 0ebcff710e gl_shader_gen: Various cleanups to shader generation. 2015-10-21 21:59:44 -04:00
bunnei 240a3b80d9 gl_rasterizer: Use MMH3 hash for shader cache hey.
- Includes a check to confirm no hash collisions.
2015-10-21 21:58:59 -04:00
bunnei 71edb55114 gl_shader_gen: Require explicit uniform locations.
- Fixes uniform issue on AMD.
2015-10-21 21:54:56 -04:00
bunnei 5ef2df056d gl_shader_gen: Rename 'o' to 'attr' in vertex/fragment shaders. 2015-10-21 21:53:19 -04:00
bunnei c2c4faef4c gl_shader_gen: AppendAlphaModifier default should be 0.0, not vec4(0.0). 2015-10-21 21:53:18 -04:00
bunnei bd833b8dd8 gl_shader_gen: Fix bug where TEV stage outputs should be clamped. 2015-10-21 21:53:18 -04:00
bunnei f2e7f7e101 gl_rasterizer: Add documentation to ShaderCacheKey. 2015-10-21 21:53:17 -04:00
bunnei 4b5141954e gl_shader_gen: Add additional function documentation. 2015-10-21 21:53:17 -04:00
bunnei 2a0a86f629 gl_shader_util: Cleanup header file + add docstring. 2015-10-21 21:53:16 -04:00
bunnei a74774257e gl_shader_gen: Various cleanups + moved TEV stage generation to its own function. 2015-10-21 21:53:16 -04:00
bunnei c86b9d4242 renderer_opengl: Refactor shader generation/caching to be more organized + various cleanups. 2015-10-21 21:53:14 -04:00
bunnei 3c057bd3d8 gl_rasterizer: Move logic for creating ShaderCacheKey to a static function. 2015-10-21 21:53:05 -04:00
bunnei b02a533d94 gl_shader_util: Use vec3 constants for AppendColorCombiner. 2015-10-21 21:51:24 -04:00
bunnei 37b0aa5af7 gl_rasterizer: Fix typo in uploading TEV const color uniforms. 2015-10-21 21:51:24 -04:00
bunnei 82f3e6dc69 gl_shader_util: Fix precision bug with alpha testing.
- Alpha testing is not done with float32 precision, this makes the HW renderer match the SW renderer.
2015-10-21 21:51:23 -04:00
Subv e3f4233cef Initial implementation of fragment shader generation with caching. 2015-10-21 21:51:23 -04:00
Emmanuel Gil Peyrot 14af5919ba CitraQt, SkyEye, Loader, VideoCore: Remove newlines in LOG_* calls.
The LOG_* function itself already appends one.
2015-10-09 22:14:56 +01:00
Rohit Nirmal 32391cffdd Silence -Wsign-compare warnings. 2015-10-06 22:16:15 -05:00
Martin Lindhe bafb7afba2 fix some xcode 7.0 warnings 2015-09-29 23:11:09 +02:00
Lioncash 751fbfdcc3 general: Silence some warnings when using clang 2015-09-16 08:51:53 -04:00
Lioncash aec28ed91e video_core: Reorganize headers 2015-09-11 07:31:15 -04:00
Lioncash 1fa772393b video_core: Remove unnecessary includes from headers 2015-09-11 00:10:03 -04:00
bunnei a008b28659 Merge pull request #1133 from lioncash/emplace-back
gl_rasterizer: Replace push_back calls with emplace_back in AddTriangle
2015-09-10 15:07:06 -04:00
bunnei 0d5604fdcb Merge pull request #1136 from lioncash/proto
renderer_opengl: Remove unimplemented function declaration
2015-09-10 11:29:33 -04:00
Lioncash 8a3428f16c renderer_opengl: Remove unimplemented function declaration 2015-09-10 10:45:44 -04:00
Lioncash 526eb33d1e video_core: Remove unused variables 2015-09-10 10:26:21 -04:00
Lioncash 7b72b71605 gl_rasterizer: Replace push_back calls with emplace_back in AddTriangle 2015-09-10 00:20:30 -04:00
aroulin 1484a23530 Shader JIT: Use SCALE constant from emitter 2015-09-07 16:50:28 +02:00
aroulin 87e3b9ffc0 Shader: Fix size_t to int casts of register offsets 2015-09-07 16:50:28 +02:00
Yuri Kunde Schlesner b044c047c4 OpenGL: Use Sampler Objects to decouple sampler config from textures
Fixes #978
2015-09-03 15:09:51 -03:00
Yuri Kunde Schlesner 466e608c19 OpenGL: Remove ugly and endian-unsafe color pointer casts 2015-09-03 15:09:51 -03:00
Yuri Kunde Schlesner ec28f037e6 OpenGL: Add support for Sampler Objects to state tracker 2015-09-03 15:09:50 -03:00
Yuri Kunde Schlesner cc19a76656 Merge pull request #1087 from yuriks/opengl-glad
Replace the previous OpenGL loader with a glad-generated 3.3 one
2015-09-03 15:07:01 -03:00
bunnei 918ca40c68 Merge pull request #1088 from aroulin/x64-emitter-abi-call
x64: Proper stack alignment in shader JIT function calls
2015-09-02 08:46:58 -04:00
aroulin ba998b85a1 video_core: Fix format specifiers warnings 2015-09-02 08:20:00 +02:00
aroulin 179ad35c2e x64: Proper stack alignment in shader JIT function calls
Import Dolphin stack handling and register saving routines
Also removes the x86 parts from abi files
2015-09-01 23:39:52 +02:00
Tony Wasserka 071510b367 Merge pull request #1092 from Subv/vertex_offset
Pica: Add the vertex_offset register to the Pica registers map.
2015-08-31 18:17:59 +02:00
Subv 58a04c0776 Pica: Added the primitive_restart register (0x25f) to the registers map. 2015-08-31 09:14:18 -05:00
Subv 149ea561a6 Pica: Add the vertex_offset register to the Pica registers map. 2015-08-31 07:02:30 -05:00
aroulin 84959be150 Shader JIT: Fix SGE/SGEI NaN behavior
SGE was incorrectly emulated w.r.t. NaN behavior as the CMPSS SSE
instruction was used with NLT
2015-08-31 08:16:15 +02:00
bunnei e77dc4e9d2 Merge pull request #1059 from Subv/vertex_offset
GPU: Implemented register 0x22A PICA_REG_DRAW_VERTEX_OFFSET
2015-08-30 17:12:33 -04:00
Subv 12a11472f1 GPU: Implemented register 0x22A.
This is the equivalent of the "first" parameter in glDrawArrays, it tells the GPU the vertex index at which to start rendering.

Register 0x22A doesn't affect indexed rendering.
2015-08-30 15:46:22 -05:00
Yuri Kunde Schlesner a1a5570e97 Replace the previous OpenGL loader with a glad-generated 3.3 one
The main advantage of switching to glad from glLoadGen is that, apart
from being actively maintained, it supports a customizable entrypoint
loader function, which makes it possible to also support OpenGL ES.
2015-08-30 08:45:56 -03:00
bunnei 58e9f78844 Merge pull request #1049 from Subv/stencil
Rasterizer: Corrected the stencil implementation.
2015-08-29 20:06:25 -04:00
Yuri Kunde Schlesner c5a4025b65 Merge pull request #1065 from yuriks/shader-fp
Shader FP compliance fixes
2015-08-27 16:34:13 -07:00
bunnei f3cef178e3 gl_rasterizer_cache: Detect and ignore unnecessary texture flushes. 2015-08-27 19:07:53 -04:00
aroulin f52d8c1a9b Shader JIT: Fix float to integer rounding in MOVA
MOVA converts new address register values from floats to integers using truncation
2015-08-27 15:26:41 +02:00
archshift dd0e1061ef Shader JIT: ifdef out reference to ifdef'd out shader_map
shader_map was only defined on x86 architectures, but was cleared on shutdown
with no ifdef protection. Ifdef this out so non-x86 architectures can be built.
2015-08-26 22:28:19 +00:00
Yuri Kunde Schlesner 0fcabd2b11 Integrate the MicroProfile profiling library
This brings goodies such as a configurable user interface and
multi-threaded timeline view.
2015-08-24 22:16:28 -03:00
bunnei afd45d1d7f Merge pull request #1063 from Subv/hw_renderer_debug_fb
HWRenderer: Only reload the framebuffer from gpu memory if the hw renderer is in use during a breakpoint
2015-08-24 13:02:44 -04:00
Subv 583d777b1a HWRenderer: Added a workaround for the Intel Windows driver bug that causes glTexSubImage2D to not change the stencil buffer.
Reported here https://communities.intel.com/message/324464
2015-08-24 11:28:28 -05:00
Yuri Kunde Schlesner eff10959de fixup! Shaders: Fix multiplications between 0.0 and inf 2015-08-24 02:10:11 -03:00
Yuri Kunde Schlesner d8ef20c856 Shader JIT: Tiny micro-optimization in DPH 2015-08-24 01:48:37 -03:00
Yuri Kunde Schlesner 630a850d4d Shaders: Fix multiplications between 0.0 and inf
The PICA200 semantics for multiplication are so that when multiplying
inf by exactly 0.0, the result is 0.0, instead of NaN, as defined by
IEEE. This is relied upon by games.

Fixes #1024 (missing OoT interface items)
2015-08-24 01:48:15 -03:00
Yuri Kunde Schlesner 082b74fa24 Shaders: Explicitly conform to PICA semantics in MAX/MIN 2015-08-24 01:46:58 -03:00
Yuri Kunde Schlesner 76247170df Shader JIT: Add name to second scratch register (XMM4) 2015-08-24 01:46:10 -03:00
Lioncash fa5076eb9b shader_jit: Replace two MDisp usages with MatR 2015-08-24 00:39:50 -04:00
Yuri Kunde Schlesner 455147ee95 Shader JIT: Fix CMP NaN behavior to match hardware 2015-08-24 01:29:40 -03:00
bunnei 83c214f6d8 Merge pull request #1062 from aroulin/shader-rcp-rsq
Shader: RCP and RSQ computes only the 1st component
2015-08-23 17:56:35 -04:00
Subv d1b9383d86 HWRenderer: Only reload the framebuffer from gpu memory if the hw renderer is in use during a breakpoint. 2015-08-23 15:26:17 -05:00
aroulin 03c5cfead4 Shader: Use std::sqrt for float instead of sqrt 2015-08-23 22:03:07 +02:00
aroulin fa552f11ef Shader: RCP and RSQ computes only the 1st component 2015-08-23 22:01:17 +02:00
aroulin 2f1514b904 Shader: implement DPH/DPHI in JIT 2015-08-22 11:09:53 +02:00
aroulin 2e7cf2f6cf Shader: implement DPH/DPHI in interpreter
Tests revealed that the component with w=1 is
SRC1 and not SRC2, it is now fixed on 3dbrew.
2015-08-22 11:09:53 +02:00
Subv 0c7da9b815 HWRasterizer: Implemented stencil ops 6 and 7. 2015-08-21 11:05:56 -05:00
Subv 7c1f84a92b SWRasterizer: Implemented stencil ops 6 and 7.
IncrementWrap and DecrementWrap, verified with hwtests.
2015-08-21 11:01:42 -05:00
Subv e43eb130d4 HWRasterizer: Implemented stencil op 1 (GL_ZERO) 2015-08-21 10:59:49 -05:00
Subv fef1462371 SWRasterizer: Implemented stencil action 1 (GL_ZERO).
Verified with hwtests.
2015-08-21 10:35:25 -05:00
Subv b3e530d005 SWRasterizer: Removed a todo. Verified with hwtests. 2015-08-21 10:09:15 -05:00
Subv 8e6336d96b SWRenderer: The stencil depth_pass action is executed even if depth testing is disabled.
The HW renderer already did this.
2015-08-21 09:48:43 -05:00
Subv e74825e3d0 Rasterizer: Abstract duplicated stencil code into a lambda. 2015-08-21 09:45:36 -05:00
Subv 46f660a789 GLRasterizer: Implemented stencil testing in the hw renderer. 2015-08-20 10:11:09 -05:00
Subv 186873420f GPU/Rasterizer: Corrected the stencil implementation.
Verified the behavior with hardware tests.
2015-08-20 10:10:35 -05:00
aroulin f3e8f42718 Shader: implement SGE, SGEI and SLT in JIT 2015-08-19 14:29:39 +02:00
aroulin 863730f6a7 Shader: implement SGE, SGEI in interpreter 2015-08-19 14:29:39 +02:00
bunnei 3c5ff418ca Merge pull request #1047 from aroulin/shader-ex2-lg2
Shader: Save caller-saved registers in JIT before a CALL
2015-08-18 22:02:25 -04:00
aroulin 2f9eb98f03 Shader: Save caller-saved registers in JIT before a CALL 2015-08-19 03:40:07 +02:00
bunnei 026379ed55 Merge pull request #1037 from aroulin/shader-ex2-lg2
Shader: Implement EX2 and LG2 in interpreter/JIT
2015-08-18 19:42:32 -04:00
bunnei 1f18c9f8dd Merge pull request #1034 from yuriks/rg8-textures
videocore: Added RG8 texture support
2015-08-16 22:17:12 -04:00
aroulin 7d3a6016d6 Shader: implement EX2 and LG2 in JIT 2015-08-17 01:12:34 +02:00
LittleWhite 9d6748fa94 Fix Linux GCC 4.9 build (complaining about undeclared memset) 2015-08-16 17:21:08 +02:00
aroulin 638e47c04d Shader: implement EX2 and LG2 in interpreter 2015-08-16 15:54:30 +02:00
Tony Wasserka 96820ae42a Build fix for Debug configurations. 2015-08-16 15:14:54 +02:00
Tony Wasserka f5144e6c10 Merge pull request #997 from Lectem/cmdlist_full_debug
citra-qt: Improve pica command list widget (add mask, fix some issues)
2015-08-16 13:34:45 +02:00
Tony Wasserka 33ba604fd9 Introduce a shader tracer to allow inspection of input/output values for each processed instruction. 2015-08-16 14:12:11 +02:00
Tony Wasserka 2e3601f415 Pica/DebugUtils: Include uniform information into shader dumps. 2015-08-16 13:22:01 +02:00
Tony Wasserka 4cb302c8ae citra-qt: Improve shader debugger.
Now supports dumping the current shader and recognizes a larger number of output semantics.
2015-08-16 13:22:00 +02:00
Patrick Martin 5b65d95310 videocore: Added RG8 texture support 2015-08-16 02:21:50 -03:00
bunnei db97090cad Shader: Use a POD struct for registers. 2015-08-15 18:03:27 -04:00
bunnei b39c053785 Rename ARCHITECTURE_X64 definition to ARCHITECTURE_x86_64. 2015-08-15 18:03:27 -04:00
bunnei 0ee00861f6 Common: Cleanup CPU capability detection code. 2015-08-15 18:03:26 -04:00
bunnei a1942238f5 Common: Move cpu_detect to x64 directory. 2015-08-15 18:03:26 -04:00
bunnei bd7e691f78 x64: Refactor to remove fake interfaces and general cleanups. 2015-08-15 18:03:25 -04:00
bunnei cfb354f11f JIT: Support negative address offsets. 2015-08-15 18:01:22 -04:00
bunnei 094ae6fadb Shader: Initial implementation of x86_x64 JIT compiler for Pica vertex shaders.
- Config: Add an option for selecting to use shader JIT or interpreter.
- Qt: Add a menu option for enabling/disabling the shader JIT.
2015-08-15 18:01:07 -04:00
bunnei d67e2f78b7 Common: Added MurmurHash3 hash function for general-purpose use. 2015-08-15 17:33:46 -04:00
bunnei 3f69c2039d Shader: Define a common interface for running vertex shader programs. 2015-08-15 17:33:44 -04:00
bunnei 18527b9e21 Shader: Move shader code to its own subdirectory, "shader". 2015-08-15 17:33:42 -04:00
bunnei 642b9b5030 GPU: Refactor "VertexShader" namespace to "Shader".
- Also renames "vertex_shader.*" to "shader_interpreter.*"
2015-08-15 17:33:41 -04:00
bunnei 35f3360663 Merge pull request #893 from linkmauve/remove-uint._t-int._t
Replace standard uint*_t and int*_t with CommonTypes’ u* and s* types
2015-08-11 17:55:24 -04:00
Emmanuel Gil Peyrot 5115d0177e ARM Core, Video Core, CitraQt, Citrace: Use CommonTypes types instead of the standard u?int*_t types. 2015-08-11 22:38:44 +01:00
Yuri Kunde Schlesner 254582aa35 OpenGL: Fix state tracking in situations with reused object handles
If an OpenGL object is created, bound to a binding using the state
tracker, and then destroyed, a newly created object can be assigned the
same numeric handle by OpenGL. However, even though it is a new object,
and thus needs to be bound to the binding again, the state tracker
compared the current and previous handles and concluded that no change
needed to be made, leading to failure to bind objects in certain cases.

This manifested as broken text in VVVVVV, which this commit fixes along
with similar texturing problems in other games.
2015-08-06 00:59:37 -03:00
Yuri Kunde Schlesner ff68db61bc OpenGL: Remove redundant texture.enable_2d field from OpenGLState
All uses of this field where it's false can just set the texture id to 0
instead.
2015-08-05 22:55:22 -03:00
Yuri Kunde Schlesner a96502edd3 Videocore: Implement simple vertex caching
This gives a ~2/3 reduction in the amount of vertices that need to be
processed through the vertex loaders and the vertex shader, yielding a
good speedup.
2015-08-04 23:41:47 -03:00
bunnei bb7eb5c574 Merge pull request #1006 from yuriks/fb-commit-profile
OpenGL: Add a profiler category measuring framebuffer readback
2015-07-30 10:39:38 -04:00
bunnei 31c1bb901b Merge pull request #963 from yuriks/gpu-fixes
Misc. GPU vertex loading fixes
2015-07-29 16:45:17 -04:00
Yuri Kunde Schlesner 428154da45 OpenGL: Add a profiler category measuring framebuffer readback 2015-07-28 17:37:46 -03:00
bunnei e1a3fed6ff Merge pull request #991 from yuriks/globjects
OpenGL: Make OpenGL object resource wrappers fully inline
2015-07-26 16:37:33 -04:00
bunnei cb76453ec4 Merge pull request #992 from yuriks/hot-path-debug
VideoCore: #ifdef out some debugging routines
2015-07-26 11:45:51 -04:00
Lectem facb2555a9 citra-qt/debug_utils: Use lock_guard everywhere
unique_lock were being used as lock_guards.
Also replaced manual lock/unlock by lock_guard for harmonization.
2015-07-26 16:28:44 +02:00
Lectem e663751f8b citra-qt/command list: Add mask column 2015-07-26 16:23:12 +02:00
Yuri Kunde Schlesner 1762267de4 OpenGL: Make OpenGL object resource wrappers fully inline
The functions are so simple that having them separate only bloats the
code and hinders optimization.
2015-07-26 10:58:58 -03:00
Tony Wasserka 72237a9305 Merge pull request #987 from yuriks/regnames
Videocore: Don't reinitialize register name map on every query.
2015-07-26 15:56:56 +02:00
Yuri Kunde Schlesner e130dac7de Videocore: Don't reinitialize register name map on every query
This greatly speeds up the command list debug widget.
2015-07-26 10:10:10 -03:00
Yuri Kunde Schlesner 4909a1486e Videocore: Simplify variables in vertex shader interpreter
Simplifies the code and gives a tiny speed-up.
2015-07-26 08:49:35 -03:00
Yuri Kunde Schlesner 877d2a0e48 Videocore: Replace std::stack in shader interpreter with static_vector
Shaves off 1/3rd of the vertex shader time in Fire Emblem
2015-07-26 08:49:35 -03:00
Yuri Kunde Schlesner 13347997ba VideoCore: #ifdef out some debugging routines
Some disabled debugging functionality was being called from rendering
routines in VideoCore. Although disabled, many of them still allocated
memory or did some extra work that was enough to show up in a profiler.
Gives a slight (~2ms) speedup.
2015-07-26 06:55:47 -03:00
Yuri Kunde Schlesner 00529c71d4 Address error that remained in last merge 2015-07-25 16:54:51 -03:00
Yuri Kunde Schlesner 9a0f9f12cd Merge pull request #892 from zawata/another-warning-fixes
Yet More Warning Fixes
2015-07-25 12:50:32 -07:00
Tony Wasserka 1760eb5ca6 Merge pull request #980 from Subv/more_breakpoints
Qt/GPU Breakpoints: Added three more breakpoint types.
2015-07-24 01:58:11 +02:00
Yuri Kunde Schlesner 1fe9b0b82e VideoCore: Fix values of unset components in input attribute arrays
If an input attribute array had a field with less than 4 components, the
remaining components were left unset if not specified by a default
vertex attribute. If neither mechanism would set a component, it would
assume a garbage value.

It has been verified that the hardware behavior is to instead to set the
missing components from the fixed default of (0 0 0 1). The default
vertex attribute values aren't used at all if a vertex array is
specified for that attribute.

Fixes UI graphics on Fire Emblem: Awakening, a small texturing glitch
when selecting a character in Cubic Ninja, as well as eliminating the
unset-W hack which was required for Ocarina of Time to not have
garbled triangles.

This change has been tested against hardware.
2015-07-23 16:51:25 -03:00
Yuri Kunde Schlesner 4e09202226 VideoCore: Saturate vertex colors before interpolating
During testing, it was discovered that hardware does not interpolate
colors output by the vertex shader as-is. Rather, it drops the sign and
saturates the value to 1.0. This is done before interpolation, such that
(e.g.) interpolating outputs 1.5 and -0.5 is equivalent to as if the
shader had output the values 1.0 and 0.5 instead, with the interpolated
value never crossing 0.0.

This change has been tested against hardware.
2015-07-23 16:51:24 -03:00
Subv 6c0ea5f5e8 Qt/GPU Breakpoints: Added three more breakpoint types:
* IncomingDisplayTransfer: Triggered just before a display transfer is performed.
* GSPCommandProcessed: Triggered right after a GSP command is processed.
* BufferSwapped: Triggered when the frames flip
2015-07-23 11:47:34 -05:00
bunnei cea45af64d Merge pull request #977 from yuriks/glenable-tex2d
GL Renderer: Remove erroneous glEnable(GL_TEXTURE_2D) calls
2015-07-23 10:07:35 -04:00
Subv 7b4961e968 Rasterizer/GL: Set the border color when binding a texture. 2015-07-22 18:41:37 -05:00
Yuri Kunde Schlesner e5c4fe0098 GL Renderer: Remove erroneous glEnable(GL_TEXTURE_2D) calls
In OpenGL 3, texturing is always enabled, and this call is invalid.
While it produced no effect in the rest of the execution, it wouldn't
have the intended effect of disabling texturing for that unit. Instead
bind a null texture to the unit.
2015-07-22 01:22:09 -03:00
bunnei 3a5352baf8 Merge pull request #968 from Subv/texture_filtering
GPU: Added registers for min and mag texture filters
2015-07-21 18:27:50 -04:00
Subv 009e34f08a GPU: Added registers for min and mag texture filters and implemented them in the hw renderer. 2015-07-21 16:26:09 -05:00
Tony Wasserka aa6dfdb827 Merge pull request #929 from neobrain/geoshader_definitions
Pica/Shader: Add geometry shader definitions.
2015-07-21 15:24:48 +02:00
bunnei 9a3b21bcf9 Merge pull request #944 from Subv/spam
GLRasterizer: Don't try to get a pointer to the depth buffer if it doesn't exist.
2015-07-19 22:40:57 -04:00
Yuri Kunde Schlesner ae985bf500 Pica: Correct switched S/T texture wrapping registers
This was found and hwtested by Lectem
2015-07-19 19:27:23 -03:00
Yuri Kunde Schlesner 5a75cf8fd2 Pica: Fix DP3 instruction, which wasn't assigning to the w component 2015-07-19 19:01:59 -03:00
Subv a694caeee0 GLRasterizer: Don't try to get a pointer to the depth buffer if it doesn't exist. 2015-07-19 14:09:23 -05:00
Subv 3600c32483 Rasterizer/Textures: Fixed a bug where the I4 format would get twice the real stride.
Also added its name to the texture viewer widget
2015-07-19 13:15:23 -05:00
zawata 6933a50aeb Vertex Shader : Undo casting 2015-07-19 04:12:42 -07:00
zawata 04756bdaf6 Video_Core : Type fixes 2015-07-19 04:12:40 -07:00
zawata f7050021de Video_Core: Finally fix pesky warning 2015-07-19 04:08:44 -07:00
zawata 017437e8d7 Video_Core : Change Tabs to Spaces
This really should be universalized, I keep getting errors creating
commits because lines I've edited use tabs instead of spaces(and yes I
did read the contributing guide and i know they are supposed to be
spaces)
2015-07-19 03:59:50 -07:00
zawata 716120da3d Video_Core : Fix Conversion Warnings 2015-07-19 03:59:49 -07:00
Tony Wasserka 33568494af Pica/Shader: Add geometry shader definitions. 2015-07-15 17:31:57 +02:00
Tony Wasserka 0ea2319f3c Merge pull request #931 from neobrain/move_default_attr_handler
Pica/CommandProcessor: Move default attribute setup to the proper position.
2015-07-15 17:22:50 +02:00
Tony Wasserka aeec12dc33 Pica/CommandProcessor: Move default attribute setup to the proper position. 2015-07-15 17:56:38 +02:00
Tony Wasserka d2c3ecc8d8 Pica/Clipper: Output proper number of triangles in debugging logs. 2015-07-15 18:01:43 +02:00
Lectem d08e9b29e2 VideoCore: Implement the DOT3_RGB combiner 2015-07-14 02:16:10 -03:00
Tony Wasserka 5e79706db2 Pica: Implement stencil testing. 2015-07-13 23:54:39 +02:00
Tony Wasserka 0799b40caa Clean up command_processor.cpp. 2015-07-13 22:27:21 +02:00
Tony Wasserka 902fa4da52 Add CiTrace recording support.
This is exposed in the GUI as a new "CiTrace Recording" widget.

Playback is implemented by a standalone 3DS homebrew application (which only runs reliably within Citra currently; on an actual 3DS it will often crash still).
2015-07-13 22:27:20 +02:00
Tony Wasserka ae7120f5d9 Merge pull request #907 from Lectem/clamp_to_border
Add GL_CLAMP_TO_BORDER support.
2015-07-12 03:19:46 +02:00
Lectem 58d1c6398e Added GL_CLAMP_TO_BORDER support 2015-07-09 22:23:26 +02:00
Emmanuel Gil Peyrot 4964a359e1 Core: Cleanup hw includes. 2015-06-28 00:46:39 +01:00
Emmanuel Gil Peyrot f48b28ad27 Core, VideoCore: Replace or fix exit() calls. 2015-06-28 00:36:55 +01:00
Emmanuel Gil Peyrot 45c4781544 CitraQt: Cleanup includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 22ae87530b Common: Cleanup emu_window includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 596b7c4f63 Common: Cleanup key_map includes. 2015-06-28 00:36:54 +01:00
zawata 92bfec0566 VideoCore: Fix floating point warning 2015-06-26 21:38:04 -07:00
Emmanuel Gil Peyrot 94fc644430 VideoCore: Log the GL driver’s vendor and renderer. 2015-06-16 00:02:23 +01:00
Yuri Kunde Schlesner 9b7d85a4f5 video_core: add extra braces around initializer
Trivial change and fixes several warnings in the clang build.
2015-06-14 00:33:08 -03:00
tfarley 26bc816d7a Renderer formatting edits 2015-06-08 19:19:15 -04:00
tfarley 66b0d799ee Render-to-texture flush, interval math fix 2015-06-08 19:18:20 -04:00
tfarley 5025b35563 Liberal texture unbind (clout menu) 2015-06-08 19:18:19 -04:00
tfarley fa2c92a3ac Depth format fix (crush3d intro/black screens) 2015-06-08 19:18:18 -04:00
tfarley d42275f11c Implemented glColorMask 2015-06-08 19:18:17 -04:00
archshift 0414ad20cb Merge pull request #811 from archshift/commonify
Commonify video_core utility headers
2015-05-31 09:55:29 -07:00
bunnei 33b9abb91e Pica: Use zero for the SecondaryFragmentColor source.
- This is a workaround until we support fragment lighting.
2015-05-31 01:52:42 -04:00
bunnei dcbc653b90 rasterizer: Remove unnecessary 'using' for BlendEquation. 2015-05-31 01:52:42 -04:00
bunnei e6ace38815 Pica: Implement LogicOp function. 2015-05-31 01:52:41 -04:00
bunnei 3b5ff61201 rasterizer: Implement AddSigned combiner function for alpha channel. 2015-05-31 01:52:40 -04:00
bunnei 1574c44586 vertex_shader: Use address offset on src2 in inverted mode. 2015-05-31 01:52:40 -04:00
bunnei 02c9fe202c Pica: Implement command buffer execution registers. 2015-05-31 01:52:39 -04:00
bunnei 4ac6c1a3b5 vertex_shader: Implement SLT/SLTI instructions. 2015-05-31 01:27:50 -04:00
bunnei 875bd29766 vertex_shader: Implement MIN instruction. 2015-05-31 01:27:49 -04:00
archshift 76690392bf Move video_core/color.h to common/color.h 2015-05-30 11:17:37 -07:00
archshift 5df2d1b5f7 Move video_core/math.h to common/vector_math.h
The file only contained vector manipulation code, and such widely-useable code doesn't belong in video_core.
2015-05-30 11:17:36 -07:00
Emmanuel Gil Peyrot b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
Lioncash 951353558e gl_state: Remove unnecessary const specifier on Apply 2015-05-23 00:58:32 -04:00
Lioncash dc587fa295 video_core/utils: Remove unused variables in GetMortonOffset 2015-05-23 00:38:37 -04:00
bunnei 1b42d55a9d Pica: Create 'State' structure and move state memory there. 2015-05-22 22:59:42 -04:00
Lioncash 23d5df9d9c gl_state: Fix a condition typo in Apply 2015-05-22 19:49:12 -04:00
tfarley 05dc633a8c OpenGL renderer 2015-05-22 15:51:18 -07:00
bunnei f0365f28c2 Merge pull request #772 from lioncash/warn
core/video_core: Fix a few warnings when compiling on MSVC.
2015-05-18 08:08:49 -04:00
Subv 24d9416930 GPU/DefaultAttributes: Clear up a comment in command_processor 2015-05-17 14:13:11 -05:00
Subv 658c44af5c GPU/DefaultAttributes: Let the attribute data from the loaders overwrite the default attributes, if set.
closes #735
2015-05-17 11:52:17 -05:00
Yuri Kunde Schlesner 7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
Lioncash 497f4bee0c pica: Add the ULL specifier in IsDefaultAttribute
This is necessary otherwise there are warnings about a 32-bit result being casted to a 64-bit value.
2015-05-14 14:23:23 -04:00
Yuri Kunde Schlesner def5913d19 GPU: Add more fine grained profiling for vertex shader and rasterization 2015-05-12 15:59:52 -03:00
archshift 40310e2132 Implement I4 texture format
@neobrain, could you confirm that this is correct?

It's been tested with various different games and fixes different textures, including in Animal Crossing, Kirby Triple Deluxe, and SMB3D.
2015-05-10 18:59:22 -07:00
bunnei 23e8be573e rasterizer: Implemented combiner output scaling. 2015-05-09 22:26:17 -04:00
bunnei ff767eeb40 rasterizer: Implemented AddSigned combiner op. 2015-05-09 22:12:39 -04:00
bunnei 547da374b8 rasterizer: Fixed a depth testing bug. 2015-05-09 22:12:38 -04:00
bunnei a806b420a6 rasterizer: Implement combiner buffer input. 2015-05-09 22:12:36 -04:00
bunnei 44927f0306 rasterizer: Return zero'd vectors on error conditions. 2015-05-09 22:12:35 -04:00
bunnei 692a74c09e vertex_shader: Implement FLR instruction. 2015-05-09 22:12:34 -04:00
bunnei f935130a0f vertex_shader: Implement MADI instruction.
nihstro: Update submodule to latest upstream/master to support MADI instruction decoding.
2015-05-09 22:12:34 -04:00
Yuri Kunde Schlesner 17a8cae003 Memory: Add GetPhysicalPointer helper function 2015-05-09 04:02:32 -03:00
Yuri Kunde Schlesner 28a9e4c1d5 Memory: Support more regions in the VAddr-PAddr translation functions
Also adds better documentation and removes the one-off reimplementation
of the function in pica.h.
2015-05-09 03:08:11 -03:00
Yuri Kunde Schlesner 1c0b87edc2 Memory: Re-organize and rename memory area address constants 2015-05-09 01:29:52 -03:00
Yuri Kunde Schlesner 4f4d230dac Merge pull request #721 from yuriks/more-cleanups
More cleanups
2015-05-07 11:45:45 -07:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
bunnei 337f1e1b96 Merge pull request #695 from Subv/crash_f
GPU: Implemented default vertex shader attributes.
2015-05-06 19:33:03 -04:00
Subv 0e5ca080a8 GPU: Implemented default vertex shader attributes.
Fixes some games crashing.
2015-05-06 18:11:46 -05:00
Emmanuel Gil Peyrot 36b48082d5 VideoCore: Remove a superfluous auto variable declaration in debug_utils. 2015-04-29 13:37:12 +02:00
Rohit Nirmal f15c142c5e Silence some -Wsign-compare warnings. 2015-04-09 18:55:01 -05:00
Gareth Higgins 8060c519a6 Changed occurences of colour to color for consistency 2015-04-05 02:36:43 -04:00
archshift cae89fb315 Allow the user to set the background clear color during emulation
The background color can be seen at the sides of the bottom screen or when the window is wider than normal.
2015-04-03 15:35:51 -07:00
bunnei c1f5cb7dd5 Merge pull request #652 from neobrain/shader_output_fix
Pica/VertexShader: Fix a bug caused due to incorrect assumptions of consecutive output register tables.
2015-03-16 18:35:34 -04:00
Emmanuel Gil Peyrot 92fd2a1ee3 VideoCore: Add static_cast around expressions where the compiler doesn’t deduce the right type. 2015-03-16 15:14:04 +01:00
Tony Wasserka e4f5ec6272 Pica/VertexShader: Fix a bug caused due to incorrect assumptions of consecutive output register tables.
We now write create a temporary buffer for output registers and copy all of them to the actual output vertex structure after the shader has run. This is technically not necessary, but it's easier to vectorize in the future.
2015-03-12 14:18:46 +01:00
bunnei b56829df02 Merge pull request #629 from archshift/lcdfb
Implement SetLcdForceBlack and add implementation for color filling in the GPU code
2015-03-10 18:08:55 -04:00
bunnei ec5bc54575 Merge pull request #643 from Subv/dem_feels
GPU: Implemented more depth buffer formats.
2015-03-09 22:06:30 -04:00
Subv 1248e291f0 GPU: Added the stencil test structure to the Pica Regs struct. 2015-03-09 20:13:21 -05:00
Subv 414b0741c4 GPU: Implemented more depth buffer formats.
This fixes the horizontal lines in Picross E, Cubic Ninja, Cave Story 3D and possibly others
2015-03-09 20:12:39 -05:00
archshift 041e99b613 Added LCD registers, and implementation for color filling in OGL code. 2015-03-09 15:51:41 -07:00
Tony Wasserka 5742367341 Pica/PrimitiveAssembly: Fix triangle strips and fans being generated with incorrect winding order. 2015-03-09 21:49:49 +01:00
archshift 7d43aef4d0 Update nihstro submodule to the initial release version.
Includes more opcodes to implement in the future.
2015-03-08 13:52:38 -07:00
bunnei 06bf471581 Merge pull request #636 from bunnei/refactor-screen-win
Set framebuffer layout from EmuWindow.
2015-03-07 18:18:40 -05:00
bunnei 9960c49c21 Set framebuffer layout from EmuWindow. 2015-03-07 17:21:19 -05:00
Subv 4b8d4d0ed5 GPU/Textures: Fixed ETC texture decoding. 2015-03-07 16:21:54 -05:00
Tony Wasserka 93e32bce72 Merge pull request #538 from yuriks/perf-stat
Add profiling infrastructure and widget
2015-03-07 15:30:40 +01:00
bunnei 34c31db14a GPU: Added RGB565/RGB8 framebuffer support and various cleanups.
- Centralizes color format encode/decode functions.
- Fixes endianness issues.
- Implements remaining framebuffer formats in the debugger.
2015-03-03 18:26:03 -05:00
Yuri Kunde Schlesner cd1fbfcf1b Add profiling infrastructure and widget 2015-03-01 21:47:13 -03:00
archshift 7f9ee69a2b Added RGBA5551 compatibility in the rasterizer
This allows Virtual Console games to display properly.
2015-02-27 19:15:08 -08:00
Subv c564c21668 GPU: Implemented bits 3 and 1 from the display transfer flags.
Bit 3 is used to specify a raw copy, where no processing is done to the data, seems to behave exactly as a DMA.
Bit 1 is used to specify whether to convert from a tiled format to a linear format or viceversa.
2015-02-26 21:17:14 -05:00
Yuri Kunde Schlesner ea3c99f3a2 Video core: Fix A4 texture decoding
It was trying to take the LSB from `coarse_x`, which would always be 0
and thus would always return the same texel from each byte. To add
insult to the injury, the conditional was actually the wrong way around
too.

Fixes blocky text in OoT.
2015-02-25 23:05:14 -03:00
Yuri Kunde Schlesner 3c50da6fc0 Video core: Fix pixelation/blockiness in textures.
This was caused during morton decoding by me not masking the bits of
each coordinate before merging them, so the bits from x could set bits
in y if it was >255.
2015-02-25 22:16:01 -03:00
bunnei ed255ebaec Rasterizer: Add support for RGBA4 framebuffer format. 2015-02-24 19:58:33 -05:00
bunnei 733c19ddd3 Rasterize with the correct color component order.
- Fixes a regression with #594.
2015-02-22 13:57:24 -05:00
Tony Wasserka 34f21334ad Merge pull request #593 from Subv/search_problem
Pica/VertexShader: Fixed LOOP with more than one iteration.
2015-02-22 15:51:12 +01:00
Subv 9a03e9c61d Pica/VertexShader: Fixed LOOP with more than one iteration.
Previously it wouldn't jump back to the start of the loop code once it reached the end of the block.
Fixes the texture problems in a lot of games.
2015-02-21 12:52:21 -05:00
bunnei 5f9939070e Merge pull request #588 from archshift/somebranch
Sweeping cleanup of Common
2015-02-20 11:41:30 -05:00
archshift 302f0b32f5 Remove duplication of INSERT_PADDING_WORDS between pica.h and gpu.h 2015-02-19 22:26:25 -08:00
Subv 5410367ebf Rasterizer: Fixed a warning in GetWrappedTexCoord.
Redeclaring the variable inside the switch was causing weird behavior.
2015-02-18 23:52:47 -05:00
bunnei ec8f2210e3 Merge pull request #580 from lioncash/emplace
core/video_core: Use in-place construction where possible
2015-02-18 17:36:34 -05:00
Tony Wasserka 2eee3a87f9 Pica/Rasterizer: Replace exit() calls with UNIMPLEMENTED(). 2015-02-18 14:52:27 +01:00
Tony Wasserka 6e5a903286 Pica/Rasterizer: Make some local lambdas static. 2015-02-18 14:50:28 +01:00
Tony Wasserka 1561204342 Pica/BlendUnit: Implement separate color/alpha blend equations. 2015-02-18 14:50:28 +01:00
Tony Wasserka 81ebb4d682 Pica/TextureEnvironment: Add a note. 2015-02-18 14:50:28 +01:00
Tony Wasserka e11fb96408 Pica/TextureEnvironment: Treat texture combiner source 1 as the PrimaryColor.
Not really sure where the difference is, but some applications seem to use this 1:1 the same way...
2015-02-18 14:50:28 +01:00
Tony Wasserka 04cd06d5c2 Pica/TextureEnvironment: Add support for the MAD-like texture combiners and clean up texture environment logic. 2015-02-18 14:50:28 +01:00
Tony Wasserka 087edcfbec Pica/OutputMerger: Fix flipped framebuffers. 2015-02-18 14:50:28 +01:00