Commit graph

47 commits

Author SHA1 Message Date
Fernando Sahmkow
7b55e1c0b1 Shader_Ir: Refactor Decompilation process and allow multiple decompilation modes. 2019-10-04 18:52:50 -04:00
Fernando Sahmkow
5d3c5df7f4 gl_shader_decompiler: Implement AST decompiling 2019-10-04 18:52:50 -04:00
Fernando Sahmkow
f1ed22419c shader_ir: Declare Manager and pass it to appropiate programs. 2019-10-04 18:52:49 -04:00
Fernando Sahmkow
ae03b1ebc7 VideoCore: Corrections to the MME Inliner and removal of hacky instance management. 2019-09-19 11:41:29 -04:00
ReinUsesLisp
df0203dd87 shader_ir: Implement ST_S
This instruction writes to a memory buffer shared with threads within
the same work group. It is known as "shared" memory in GLSL.
2019-09-05 01:38:37 -03:00
ReinUsesLisp
11138d67ad shader/decode: Implement S2R Tic 2019-07-22 16:16:10 -03:00
Lioncash
41e2ad0f26 shader_ir: std::move Node instance where applicable
These are std::shared_ptr instances underneath the hood, which means
copying them isn't as cheap as a regular pointer. Particularly so on
weakly-ordered systems.

This avoids atomic reference count increments and decrements where they
aren't necessary for the core set of operations.
2019-07-16 19:49:23 -04:00
Lioncash
4d02d971de shader_ir: Rename Get/SetTemporal to Get/SetTemporary
This is more accurate in terms of describing what the functions are
actually doing. Temporal relates to time, not the setting of a temporary
itself.
2019-07-16 19:47:43 -04:00
Fernando Sahmkow
52f9840512 Merge pull request #2565 from ReinUsesLisp/track-indirect
shader/track: Track indirect buffers
2019-07-16 14:58:35 -04:00
Fernando Sahmkow
e221290cb7 Merge pull request #2695 from ReinUsesLisp/layer-viewport
gl_shader_decompiler: Implement gl_ViewportIndex and gl_Layer in vertex shaders
2019-07-15 16:28:07 -04:00
ReinUsesLisp
a54be6ef96 shader: Allow tracking of indirect buffers without variable offset
While changing this code, simplify tracking code to allow returning
the base address node, this way callers don't have to manually rebuild
it on each invocation.
2019-07-14 22:36:44 -03:00
Fernando Sahmkow
92be9d01aa shader_ir: propagate shader size to the IR 2019-07-09 08:14:37 -04:00
ReinUsesLisp
a650406899 gl_shader_decompiler: Implement gl_ViewportIndex and gl_Layer in vertex shaders
This commit implements gl_ViewportIndex and gl_Layer in vertex and
geometry shaders. In the case it's used in a vertex shader, it requires
ARB_shader_viewport_layer_array. This extension is available on AMD and
Nvidia devices (mesa and proprietary drivers), but not available on
Intel on any platform. At the moment of writing this description I don't
know if this is a hardware limitation or a driver limitation.

In the case that ARB_shader_viewport_layer_array is not available,
writes to these registers on a vertex shader are ignored, with the
appropriate logging.
2019-07-07 20:42:55 -03:00
ReinUsesLisp
fd392543e8 shader: Use shared_ptr to store nodes and move initialization to file
Instead of having a vector of unique_ptr stored in a vector and
returning star pointers to this, use shared_ptr. While changing
initialization code, move it to a separate file when possible.

This is a first step to allow code analysis and node generation beyond
the ShaderIR class.
2019-06-05 20:41:52 -03:00
Lioncash
6dfd67b016 shader/shader_ir: Make Comment() take a std::string by value
This allows for forming comment nodes without making unnecessary copies
of the std::string instance.

e.g. previously:

Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]",
        cbuf->GetIndex(), cbuf_offset));

Would result in a copy of the string being created, as CommentNode()
takes a std::string by value (a const ref passed to a value parameter
results in a copy).

Now, only one instance of the string is ever moved around. (fmt::format
returns a std::string, and since it's returned from a function by value,
this is a prvalue (which can be treated like an rvalue), so it's moved
into Comment's string parameter), we then move it into the CommentNode
constructor, which then moves the string into its member variable).
2019-05-23 03:01:55 -03:00
bunnei
5127e54674 Merge pull request #2441 from ReinUsesLisp/al2p
shader: Implement AL2P and ALD.PHYS
2019-05-19 14:02:58 -04:00
Lioncash
c410a37168 shader/shader_ir: Place implementations of constructor and destructor in cpp file
Given the class contains quite a lot of non-trivial types, place the
constructor and destructor within the cpp file to avoid inlining
construction and destruction code everywhere the class is used.
2019-05-19 04:02:02 -04:00
ReinUsesLisp
d6193e2e36 shader: Add physical attributes commentaries 2019-05-02 21:46:25 -03:00
ReinUsesLisp
f96020b2ae shader_ir/memory: Implement physical input attributes 2019-05-02 21:46:25 -03:00
ReinUsesLisp
f6194ce3fe shader: Remove unused AbufNode Ipa mode 2019-05-02 21:46:25 -03:00
bunnei
673cfd89c1 Merge pull request #2322 from ReinUsesLisp/wswitch
video_core: Silent -Wswitch warnings
2019-04-28 22:24:58 -04:00
ReinUsesLisp
7a56d07632 video_core: Silent -Wswitch warnings 2019-04-18 15:54:39 -03:00
ReinUsesLisp
6ea1afc2bc shader_ir/decode: Fix half float pre-operations and remove MetaHalfArithmetic
Operations done before the main half float operation (like HAdd) were
managing a packed value instead of the unpacked one. Adding an unpacked
operation allows us to drop the per-operand MetaHalfArithmetic entry,
simplifying the code overall.
2019-04-15 21:16:10 -03:00
ReinUsesLisp
6d47914b88 shader_ir/decode: Implement half float saturation 2019-04-15 21:16:10 -03:00
ReinUsesLisp
a87fe3ea63 renderer_opengl: Implement half float NaN comparisons 2019-04-15 21:13:26 -03:00
ReinUsesLisp
b6a805df3b shader_ir: Avoid using static on heap-allocated objects
Using static here might be faster at runtime, but it adds a heap
allocation called before main.
2019-04-15 21:12:43 -03:00
ReinUsesLisp
92c948999b shader_ir: Rename BasicBlock to NodeBlock
It's not always used as a basic block. Rename it for consistency.
2019-02-03 17:21:20 -03:00
ReinUsesLisp
719c83a4c2 shader_decode: Improve zero flag implementation 2019-01-15 17:54:53 -03:00
ReinUsesLisp
c75f5c634a shader_ir: Remove composite primitives and use temporals instead 2019-01-15 17:54:53 -03:00
ReinUsesLisp
44fce20a01 shader_decode: Use BitfieldExtract instead of shift + and 2019-01-15 17:54:53 -03:00
ReinUsesLisp
5896358e4a shader_decode: Rework HSETP2 2019-01-15 17:54:53 -03:00
ReinUsesLisp
9cf3fe7511 shader_decode: Implement POPC 2019-01-15 17:54:52 -03:00
ReinUsesLisp
dc93729f47 video_core: Return safe values after an assert hits 2019-01-15 17:54:52 -03:00
ReinUsesLisp
74ee18de5e shader_ir: Add condition code helper 2019-01-15 17:54:50 -03:00
ReinUsesLisp
283dd9fb61 shader_ir: Add predicate combiner helper 2019-01-15 17:54:49 -03:00
ReinUsesLisp
d28033adca shader_ir: Add comparison helpers 2019-01-15 17:54:49 -03:00
ReinUsesLisp
c0d053482c shader_ir: Add half float helpers 2019-01-15 17:54:49 -03:00
ReinUsesLisp
e46dd3ce5f shader_ir: Add integer helpers 2019-01-15 17:54:49 -03:00
ReinUsesLisp
b91929bf10 shader_ir: Add float helpers 2019-01-15 17:54:49 -03:00
ReinUsesLisp
83e750c9ae shader_ir: Add setters 2019-01-15 17:54:49 -03:00
ReinUsesLisp
394f906044 shader_ir: Add local memory getters 2019-01-15 17:54:49 -03:00
ReinUsesLisp
311d1af657 shader_ir: Add internal flag getters 2019-01-15 17:54:49 -03:00
ReinUsesLisp
a66682374f shader_ir: Add attribute getters 2019-01-15 17:54:49 -03:00
ReinUsesLisp
9d5d96500c shader_ir: Add constant buffer getters 2019-01-15 17:54:49 -03:00
ReinUsesLisp
7f89f99c60 shader_ir: Add register getter 2019-01-15 17:54:49 -03:00
ReinUsesLisp
f43041efe1 shader_ir: Add immediate node constructors 2019-01-15 17:54:49 -03:00
ReinUsesLisp
25f868d8be shader_ir: Initial implementation 2019-01-15 17:54:49 -03:00