summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/shader_ir.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shader: Keep track of shaders using warp instructionsReinUsesLisp2019-12-101-0/+5
|
* shader/texture: Deduce texture buffers from lockerReinUsesLisp2019-11-231-4/+9
| | | | | Instead of specializing shaders to separate texture buffers from 1D textures, use the locker to deduce them while they are being decoded.
* video_core: Silence implicit conversion warningsReinUsesLisp2019-11-081-3/+3
|
* Merge pull request #3039 from ReinUsesLisp/cleanup-samplersRodrigo Locatti2019-11-061-7/+5
|\ | | | | shader/node: Unpack bindless texture encoding
| * shader/node: Unpack bindless texture encodingReinUsesLisp2019-10-301-7/+5
| | | | | | | | | | | | | | | | | | Bindless textures were using u64 to pack the buffer and offset from where they come from. Drop this in favor of separated entries in the struct. Remove the usage of std::set in favor of std::list (it's not std::vector to avoid reference invalidations) for samplers and images.
* | Shader_IR: Fix regression on TLD4Fernando Sahmkow2019-10-311-1/+1
| | | | | | | | | | | | Originally on the last commit I thought TLD4 acted the same as TLD4S and didn't have a mask. It actually does have a component mask. This commit corrects that.
* | Shader_IR: Fix TLD4 and add Bindless Variant.Fernando Sahmkow2019-10-301-2/+2
|/ | | | | | This commit fixes an issue where not all 4 results of tld4 were being written, the color component was defaulted to red, among other things. It also implements the bindless variant.
* Merge pull request #2976 from FernandoS27/cache-fast-brx-rebasedRodrigo Locatti2019-10-261-8/+16
|\ | | | | Implement Fast BRX, fix TXQ and addapt the Shader Cache for it
| * gl_shader_decompiler: Move entries to a separate functionReinUsesLisp2019-10-251-6/+6
| |
| * Shader_IR: allow lookup of texture samplers within the shader_ir for instructions that don't provide itFernando Sahmkow2019-10-251-3/+9
| |
| * Shader_Cache: setup connection of ConstBufferLockerFernando Sahmkow2019-10-251-1/+2
| |
| * VideoCore: Unify const buffer accessing along engines and provide ConstBufferLocker class to shaders.Fernando Sahmkow2019-10-251-0/+1
| |
* | Merge pull request #3013 from FernandoS27/tld4s-fixRodrigo Locatti2019-10-261-1/+1
|\ \ | |/ |/| Shader_Ir: Fix TLD4S from using a component mask.
| * Shader_Ir: Fix TLD4S from using a component mask.Fernando Sahmkow2019-10-221-1/+1
| | | | | | | | | | | | TLD4S always outputs 4 values, the previous code checked a component mask and omitted those values that weren't part of it. This commit corrects that and makes sure all 4 values are set.
* | shader_ir/memory: Ignore global memory when tracking failsReinUsesLisp2019-10-221-2/+3
|/ | | | | | | | | | | Ignore global memory operations instead of invoking undefined behaviour when constant buffer tracking fails and we are blasting through asserts, ignore the operation. In the case of LDG this means filling the destination registers with zeroes; for STG this means ignore the instruction as a whole. The default behaviour is still to abort execution on failure.
* vk_shader_compiler: Implement the decompiler in SPIR-VFernando Sahmkow2019-10-051-0/+4
|
* Shader_Ir: Refactor Decompilation process and allow multiple decompilation modes.Fernando Sahmkow2019-10-051-1/+9
|
* gl_shader_decompiler: Implement AST decompilingFernando Sahmkow2019-10-051-8/+17
|
* shader_ir: Declare Manager and pass it to appropiate programs.Fernando Sahmkow2019-10-051-0/+2
|
* Merge pull request #2869 from ReinUsesLisp/suldbunnei2019-09-241-6/+3
|\ | | | | shader/image: Implement SULD and fix SUATOM
| * gl_shader_decompiler: Use uint for images and fix SUATOMReinUsesLisp2019-09-211-6/+3
| | | | | | | | | | | | In the process remove implementation of SUATOM.MIN and SUATOM.MAX as these require a distinction between U32 and S32. These have to be implemented with imageCompSwap loop.
* | VideoCore: Corrections to the MME Inliner and removal of hacky instance management.Fernando Sahmkow2019-09-191-0/+10
|/
* Merge pull request #2784 from ReinUsesLisp/smembunnei2019-09-181-1/+5
|\ | | | | shader_ir: Implement shared memory
| * shader_ir: Implement ST_SReinUsesLisp2019-09-051-1/+5
| | | | | | | | | | This instruction writes to a memory buffer shared with threads within the same work group. It is known as "shared" memory in GLSL.
* | shader/image: Implement SUATOM and fix SUSTReinUsesLisp2019-09-111-2/+8
| |
* | gl_shader_decompiler: Keep track of written images and mark them as modifiedReinUsesLisp2019-09-061-4/+4
|/
* Merge pull request #2758 from ReinUsesLisp/packed-tidbunnei2019-08-291-0/+3
|\ | | | | shader/decode: Implement S2R Tic
| * shader/decode: Implement S2R TicReinUsesLisp2019-07-221-0/+3
| |
* | shader_ir: Implement VOTEReinUsesLisp2019-08-211-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement VOTE using Nvidia's intrinsics. Documentation about these can be found here https://developer.nvidia.com/reading-between-threads-shader-intrinsics Instead of using portable ARB instructions I opted to use Nvidia intrinsics because these are the closest we have to how Tegra X1 hardware renders. To stub VOTE on non-Nvidia drivers (including nouveau) this commit simulates a GPU with a warp size of one, returning what is meaningful for the instruction being emulated: * anyThreadNV(value) -> value * allThreadsNV(value) -> value * allThreadsEqualNV(value) -> true ballotARB, also known as "uint64_t(activeThreadsNV())", emits VOTE.ANY Rd, PT, PT; on nouveau's compiler. This doesn't match exactly to Nvidia's code VOTE.ALL Rd, PT, PT; Which is emulated with activeThreadsNV() by this commit. In theory this shouldn't really matter since .ANY, .ALL and .EQ affect the predicates (set to PT on those cases) and not the registers.
* shader_ir: Rename Get/SetTemporal to Get/SetTemporaryLioncash2019-07-171-4/+4
| | | | | | 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.
* shader_ir: Remove unused includesLioncash2019-07-171-3/+0
| | | | Removes unnecessary header dependencies.
* Merge pull request #2565 from ReinUsesLisp/track-indirectFernando Sahmkow2019-07-161-1/+1
|\ | | | | shader/track: Track indirect buffers
| * shader: Allow tracking of indirect buffers without variable offsetReinUsesLisp2019-07-151-1/+1
| | | | | | | | | | | | 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.
* | Merge pull request #2695 from ReinUsesLisp/layer-viewportFernando Sahmkow2019-07-151-0/+15
|\ \ | |/ |/| gl_shader_decompiler: Implement gl_ViewportIndex and gl_Layer in vertex shaders
| * gl_shader_decompiler: Implement gl_ViewportIndex and gl_Layer in vertex shadersReinUsesLisp2019-07-081-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | shader_ir: Add comments on missing instruction.Fernando Sahmkow2019-07-091-0/+4
| | | | | | | | Also shows Nvidia's address space on comments.
* | shader_ir: Unify blocks in decompiled shaders.Fernando Sahmkow2019-07-091-0/+6
| |
* | shader_ir: Decompile Flow StackFernando Sahmkow2019-07-091-0/+3
| |
* | shader_ir: propagate shader size to the IRFernando Sahmkow2019-07-091-1/+2
| |
* | shader_ir: Remove the old scanner.Fernando Sahmkow2019-07-091-11/+0
|/
* shader: Implement bindless imagesReinUsesLisp2019-06-211-0/+3
|
* shader: Decode SUST and implement backing image functionalityReinUsesLisp2019-06-211-0/+9
|
* shader: Implement texture buffersReinUsesLisp2019-06-211-0/+2
|
* shader: Move Node declarations out of the shader IR headerReinUsesLisp2019-06-071-492/+1
| | | | | | Analysis passes do not have a good reason to depend on shader_ir.h to work on top of nodes. This splits node-related declarations to their own file and leaves the IR in shader_ir.h
* shader: Use shared_ptr to store nodes and move initialization to fileReinUsesLisp2019-06-061-83/+25
| | | | | | | | | 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.
* Merge pull request #2446 from ReinUsesLisp/tidbunnei2019-05-291-1/+7
|\ | | | | shader: Implement S2R Tid{XYZ} and CtaId{XYZ}
| * shader: Implement S2R Tid{XYZ} and CtaId{XYZ}ReinUsesLisp2019-05-201-1/+7
| |
* | Merge pull request #2485 from ReinUsesLisp/generic-memorybunnei2019-05-251-4/+2
|\ \ | | | | | | shader/memory: Implement generic memory stores and loads (ST and LD)
| * | shader/memory: Implement LD (generic memory)ReinUsesLisp2019-05-211-4/+2
| |/
* / shader/shader_ir: Make Comment() take a std::string by valueLioncash2019-05-231-1/+1
|/ | | | | | | | | | | | | | | | | | | | 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).
* Merge pull request #2441 from ReinUsesLisp/al2pbunnei2019-05-191-18/+27
|\ | | | | shader: Implement AL2P and ALD.PHYS
| * shader: Add physical attributes commentariesReinUsesLisp2019-05-031-2/+4
| |
| * gl_shader_decompiler: Implement GLSL physical attributesReinUsesLisp2019-05-031-1/+1
| |
| * shader_ir/memory: Implement physical input attributesReinUsesLisp2019-05-031-3/+17
| |
| * shader: Remove unused AbufNode Ipa modeReinUsesLisp2019-05-031-16/+4
| |
| * shader_ir/memory: Emit AL2P IRReinUsesLisp2019-05-031-0/+5
| |
* | shader/shader_ir: Remove unnecessary inline specifiersLioncash2019-05-191-2/+2
| | | | | | | | | | constexpr internally links by default, so the inline specifier is unnecessary.
* | shader/shader_ir: Simplify constructors for OperationNodeLioncash2019-05-191-15/+6
| | | | | | | | | | | | | | | | | | | | Many of these constructors don't even need to be templated. The only ones that need to be templated are the ones that actually make use of the parameter pack. Even then, since std::vector accepts an initializer list, we can supply the parameter pack directly to it instead of creating our own copy of the list, then copying it again into the std::vector.
* | shader/shader_ir: Remove unnecessary template parameter packs from Operation() overloads where applicableLioncash2019-05-191-2/+0
| | | | | | | | | | These overloads don't actually make use of the parameter pack, so they can be turned into regular non-template function overloads.
* | shader/shader_ir: Mark tracking functions as const member functionsLioncash2019-05-191-3/+4
| | | | | | | | | | These don't actually modify instance state, so they can be marked as const member functions
* | shader/shader_ir: Place implementations of constructor and destructor in cpp fileLioncash2019-05-191-5/+2
|/ | | | | | 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.
* shader_ir: Move Sampler index entry in operand< to sort declarationsReinUsesLisp2019-04-261-2/+2
|
* shader_ir: Add missing entry to Sampler operand< comparisonReinUsesLisp2019-04-261-2/+3
|
* Merge pull request #2409 from ReinUsesLisp/half-floatsbunnei2019-04-201-22/+25
|\ | | | | shader_ir/decode: Miscellaneous fixes to half-float decompilation
| * shader_ir/decode: Fix half float pre-operations and remove MetaHalfArithmeticReinUsesLisp2019-04-161-16/+10
| | | | | | | | | | | | | | 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.
| * shader_ir/decode: Implement half float saturationReinUsesLisp2019-04-161-0/+3
| |
| * renderer_opengl: Implement half float NaN comparisonsReinUsesLisp2019-04-161-6/+12
| |
* | Merge pull request #2348 from FernandoS27/guest-bindlessbunnei2019-04-181-5/+35
|\ \ | | | | | | Implement Bindless Textures on Shader Decompiler and GL backend
| * | Move ConstBufferAccessor to Maxwell3d, correct mistakes and clang format.Fernando Sahmkow2019-04-081-2/+2
| | |
| * | Refactor GetTextureCode and GetTexCode to use an optional instead of optional parametersFernando Sahmkow2019-04-081-11/+9
| | |
| * | Implement Bindless Handling on SetupTextureFernando Sahmkow2019-04-081-4/+3
| | |
| * | Unify both sampler types.Fernando Sahmkow2019-04-081-8/+28
| | |
| * | Implement Bindless Samplers and TEX_B in the IR.Fernando Sahmkow2019-04-081-9/+22
| |/
* / shader_ir: Implement STG, keep track of global memory usage and flushReinUsesLisp2019-04-141-3/+13
|/
* shader_ir/decode: Implement AOFFI for TEX and TLD4ReinUsesLisp2019-03-301-3/+6
|
* shader_ir: Implement immediate register trackingReinUsesLisp2019-03-301-0/+3
|
* shader/decode: Remove extras from MetaTextureReinUsesLisp2019-02-261-1/+3
|
* shader/decode: Split memory and texture instructions decodingReinUsesLisp2019-02-261-0/+1
|
* shader_ir: Remove F4 prefix to texture operationsReinUsesLisp2019-02-071-6/+6
| | | | | | This was originally included because texture operations returned a vec4. These operations now return a single float and the F4 prefix doesn't mean anything.
* shader_ir: Clean texture management codeReinUsesLisp2019-02-071-5/+5
| | | | | | | | | Previous code relied on GLSL parameter order (something that's always ill-formed on an IR design). This approach passes spatial coordiantes through operation nodes and array and depth compare values in the the texture metadata. It still contains an "extra" vector containing generic nodes for bias and component index (for example) which is still a bit ill-formed but it should be better than the previous approach.
* Merge pull request #2083 from ReinUsesLisp/shader-ir-cbuf-trackingbunnei2019-02-071-45/+46
|\ | | | | shader/track: Add a more permissive global memory tracking
| * shader_ir: Rename BasicBlock to NodeBlockReinUsesLisp2019-02-031-46/+46
| | | | | | | | It's not always used as a basic block. Rename it for consistency.
| * shader_ir: Pass decoded nodes as a whole instead of per basic blocksReinUsesLisp2019-02-031-25/+26
| | | | | | | | | | | | | | | | | | Some games call LDG at the top of a basic block, making the tracking heuristic to fail. This commit lets the heuristic the decoded nodes as a whole instead of per basic blocks. This may lead to some false positives but allows it the heuristic to track cases it previously couldn't.
* | gl_shader_disk_cache: Save GLSL and entries into the precompiled fileReinUsesLisp2019-02-071-0/+9
|/
* shader_ir: Unify constant buffer offset valuesReinUsesLisp2019-01-301-1/+1
| | | | | | | Constant buffer values on the shader IR were using different offsets if the access direct or indirect. cbuf34 has a non-multiplied offset while cbuf36 does. On shader decoding this commit multiplies it by four on cbuf34 queries.
* shader_decode: Implement LDG and basic cbuf trackingReinUsesLisp2019-01-301-4/+34
|
* shader/shader_ir: Amend three comment typosLioncash2019-01-281-3/+3
| | | | | Given we're in the area, these are three trivial typos that can be corrected.
* shader/shader_ir: Amend constructor initializer ordering for AbufNodeLioncash2019-01-281-2/+2
| | | | | Orders the class members in the same order that they would actually be initialized in. Gets rid of two compiler warnings.
* shader_ir: Pass to decoder functions basic block's codeReinUsesLisp2019-01-151-25/+25
|
* shader_decode: Improve zero flag implementationReinUsesLisp2019-01-151-2/+7
|
* shader_ir: Remove composite primitives and use temporals insteadReinUsesLisp2019-01-151-30/+30
|
* shader_decode: Use proper primitive namesReinUsesLisp2019-01-151-7/+5
|
* shader_decode: Use BitfieldExtract instead of shift + andReinUsesLisp2019-01-151-2/+7
|
* shader_ir: Remove Ipa primitiveReinUsesLisp2019-01-151-2/+0
|
* shader_ir: Remove RZ and use Register::ZeroIndex insteadReinUsesLisp2019-01-151-2/+0
|
* shader_decode: Implement TEXS.F16ReinUsesLisp2019-01-151-2/+6
|
* video_core: Implement IR based geometry shadersReinUsesLisp2019-01-151-0/+3
|
* shader_decode: Implement VMAD and VSETPReinUsesLisp2019-01-151-0/+4
|
* shader_decode: Implement HSET2ReinUsesLisp2019-01-151-0/+1
|
* shader_decode: Rework HSETP2ReinUsesLisp2019-01-151-7/+8
|
* shader_decode: Implement HFMA2ReinUsesLisp2019-01-151-0/+1
|
* shader_decode: Implement POPCReinUsesLisp2019-01-151-1/+3
|
* shader_decode: Implement TLDS (untested)ReinUsesLisp2019-01-151-0/+4
|
* shader_decode: Update TLD4 reflecting #1862 changesReinUsesLisp2019-01-151-0/+3
|
* shader_ir: Fixup TEX and TEXS and partially fix TLD4 decompilingReinUsesLisp2019-01-151-1/+3
|
* video_core: Address feedbackReinUsesLisp2019-01-151-11/+10
|
* shader_ir: Fixup file inclusions and clang-formatReinUsesLisp2019-01-151-1/+0
|
* shader_ir: Move comment node stringMat M2019-01-151-2/+2
| | | Co-Authored-By: ReinUsesLisp <reinuseslisp@airmail.cc>
* shader_ir: Address feedback to avoid UB in bit castingReinUsesLisp2019-01-151-2/+4
|
* shader_decode: Implement LOP3ReinUsesLisp2019-01-151-0/+2
|
* shader_decode: Implement LOP32IReinUsesLisp2019-01-151-0/+5
|
* shader_decode: Implement TEX and TXQReinUsesLisp2019-01-151-0/+4
|
* shader_decode: Implement TEXS (F32)ReinUsesLisp2019-01-151-0/+18
|
* shader_ir: Add condition code helperReinUsesLisp2019-01-151-0/+3
|
* shader_ir: Add predicate combiner helperReinUsesLisp2019-01-151-0/+3
|
* shader_ir: Add comparison helpersReinUsesLisp2019-01-151-0/+9
|
* shader_ir: Add half float helpersReinUsesLisp2019-01-151-0/+7
|
* shader_ir: Add integer helpersReinUsesLisp2019-01-151-0/+5
|
* shader_ir: Add float helpersReinUsesLisp2019-01-151-0/+5
|
* shader_ir: Add settersReinUsesLisp2019-01-151-0/+8
|
* shader_ir: Add local memory gettersReinUsesLisp2019-01-151-0/+3
|
* shader_ir: Add internal flag gettersReinUsesLisp2019-01-151-0/+2
|
* shader_ir: Add attribute gettersReinUsesLisp2019-01-151-0/+5
|
* shader_ir: Add constant buffer gettersReinUsesLisp2019-01-151-0/+4
|
* shader_ir: Add register getterReinUsesLisp2019-01-151-0/+2
|
* shader_ir: Add immediate node constructorsReinUsesLisp2019-01-151-1/+18
|
* shader_ir: Initial implementationReinUsesLisp2019-01-151-0/+662