summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/node.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shader/texture: Join separate image and sampler pairs offlineReinUsesLisp2020-06-051-43/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Games using D3D idioms can join images and samplers when a shader executes, instead of baking them into a combined sampler image. This is also possible on Vulkan. One approach to this solution would be to use separate samplers on Vulkan and leave this unimplemented on OpenGL, but we can't do this because there's no consistent way of determining which constant buffer holds a sampler and which one an image. We could in theory find the first bit and if it's in the TIC area, it's an image; but this falls apart when an image or sampler handle use an index of zero. The used approach is to track for a LOP.OR operation (this is done at an IR level, not at an ISA level), track again the constant buffers used as source and store this pair. Then, outside of shader execution, join the sample and image pair with a bitwise or operation. This approach won't work on games that truly use separate samplers in a meaningful way. For example, pooling textures in a 2D array and determining at runtime what sampler to use. This invalidates OpenGL's disk shader cache :) - Used mostly by D3D ports to Switch
* shader/other: Implement MEMBAR.CTSReinUsesLisp2020-05-271-2/+3
| | | | | This silences an assertion we were hitting and uses workgroup memory barriers when the game requests it.
* Merge pull request #3981 from ReinUsesLisp/barbunnei2020-05-261-0/+1
|\ | | | | shader/other: Implement BAR.SYNC 0x0
| * shader/other: Implement BAR.SYNC 0x0ReinUsesLisp2020-05-221-0/+1
| | | | | | | | | | Trivially implement this particular case of BAR. Unless games use OpenCL or CUDA barriers, we shouldn't hit any other case here.
* | shader/other: Implement thread comparisons (NV_shader_thread_group)ReinUsesLisp2020-05-221-0/+5
|/ | | | | | | | | | | Hardware S2R special registers match gl_Thread*MaskNV. We can trivially implement these using Nvidia's extension on OpenGL or naively stubbing them with the ARB instructions to match. This might cause issues if the host device warp size doesn't match Nvidia's. That said, this is unlikely on proper shaders. Refer to the attached url for more documentation about these flags. https://www.khronos.org/registry/OpenGL/extensions/NV/NV_shader_thread_group.txt
* shader_ir: Separate float-point comparisons in ordered and unorderedReinUsesLisp2020-05-091-7/+14
| | | | | This allows us to use native SPIR-V instructions without having to manually check for NAN.
* Merge pull request #3693 from ReinUsesLisp/clean-samplersbunnei2020-05-021-104/+25
|\ | | | | shader/texture: Support multiple unknown sampler properties
| * shader_ir: Turn classes into data structuresReinUsesLisp2020-04-231-104/+25
| |
* | shader/arithmetic_integer: Implement CC for IADDReinUsesLisp2020-04-261-0/+2
|/
* shader/memory: Implement RED.E.ADDReinUsesLisp2020-04-061-0/+14
| | | | | | | | Implements a reduction operation. It's an atomic operation that doesn't return a value. This commit introduces another primitive because some shading languages might have a primitive for reduction operations.
* shader: node - update correct commentNguyen Dac Nam2020-03-301-15/+15
|
* shader_decode: add Atomic op for common usageNguyen Dac Nam2020-03-301-1/+15
|
* shader: Simplify indexed sampler usagesReinUsesLisp2020-02-241-1/+1
|
* shader: Remove curly braces initializers on shared pointersReinUsesLisp2020-02-021-2/+2
|
* Merge pull request #3282 from FernandoS27/indexed-samplersbunnei2020-02-021-5/+82
|\ | | | | Partially implement Indexed samplers in general and specific code in GLSL
| * Shader_IR: Address feedback.Fernando Sahmkow2020-01-251-7/+7
| |
| * Shader_IR: Propagate bindless index into the GL compiler.Fernando Sahmkow2020-01-241-1/+1
| |
| * Shader_IR: Implement Injectable Custom Variables to the IR.Fernando Sahmkow2020-01-241-1/+16
| |
| * Shader_IR: deduce size of indexed samplersFernando Sahmkow2020-01-241-4/+18
| |
| * Shader_IR: Implement initial code for tracking indexed samplers.Fernando Sahmkow2020-01-241-0/+48
| |
* | shader/memory: Implement ATOM.ADDReinUsesLisp2020-01-261-1/+1
|/ | | | | | | | | | | | | ATOM operates atomically on global memory. For now only add ATOM.ADD since that's what was found in commercial games. This asserts for ATOM.ADD.S32 (handling the others as unimplemented), although ATOM.ADD.U32 shouldn't be any different. This change forces us to change the default type on SPIR-V storage buffers from float to uint. We could also alias the buffers, but it's simpler for now to just use uint. While we are at it, abstract the code to avoid repetition.
* shader/memory: Implement ATOMS.ADD.U32ReinUsesLisp2020-01-161-0/+2
|
* Shader_IR: Address FeedbackFernando Sahmkow2020-01-041-5/+5
|
* Shader_IR: add the ability to amend code in the shader ir.Fernando Sahmkow2019-12-301-3/+25
| | | | | | | This commit introduces a mechanism by which shader IR code can be amended and extended. This useful for track algorithms where certain information can derived from before the track such as indexes to array samplers.
* shader/texture: Implement TLD4.PTPReinUsesLisp2019-12-161-0/+1
|
* shader: Implement MEMBAR.GLReinUsesLisp2019-12-101-0/+2
| | | | Implement using memoryBarrier in GLSL and OpMemoryBarrier on SPIR-V.
* shader_ir/other: Implement S2R InvocationIdReinUsesLisp2019-12-101-0/+1
|
* shader_ir/memory: Implement patch storesReinUsesLisp2019-12-101-3/+17
|
* Merge pull request #3109 from FernandoS27/new-instrbunnei2019-12-071-0/+4
|\ | | | | Implement FLO & TXD Instructions on GPU Shaders
| * Shader_IR: Implement TXD instruction.Fernando Sahmkow2019-11-141-0/+2
| |
| * Shader_IR: Implement FLO instruction.Fernando Sahmkow2019-11-141-0/+2
| |
* | shader/texture: Deduce texture buffers from lockerReinUsesLisp2019-11-231-4/+10
|/ | | | | Instead of specializing shaders to separate texture buffers from 1D textures, use the locker to deduce them while they are being decoded.
* shader_ir/warp: Implement FSWZADDReinUsesLisp2019-11-081-0/+1
|
* gl_shader_decompiler: Reimplement shuffles with platform agnostic intrinsicsReinUsesLisp2019-11-081-9/+2
|
* shader/node: Unpack bindless texture encodingReinUsesLisp2019-10-301-61/+40
| | | | | | | | | 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/node: std::move Meta instance within OperationNode constructorLioncash2019-10-161-1/+1
| | | | Allows usages of the constructor to avoid an unnecessary copy.
* gl_shader_decompiler: Use uint for images and fix SUATOMReinUsesLisp2019-09-211-26/+20
| | | | | | 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.
* shader/image: Implement SULD and remove irrelevant codeReinUsesLisp2019-09-211-1/+3
| | | | | * Implement SULD as float. * Remove conditional declaration of GL_ARB_shader_viewport_layer_array.
* Merge pull request #2855 from ReinUsesLisp/shflbunnei2019-09-201-0/+10
|\ | | | | shader_ir/warp: Implement SHFL for Nvidia devices
| * shader_ir/warp: Implement SHFLReinUsesLisp2019-09-171-0/+10
| |
* | Merge pull request #2784 from ReinUsesLisp/smembunnei2019-09-181-1/+15
|\ \ | |/ |/| shader_ir: Implement shared memory
| * shader_ir: Implement ST_SReinUsesLisp2019-09-051-1/+15
| | | | | | | | | | 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-14/+43
| |
* | gl_shader_decompiler: Keep track of written images and mark them as modifiedReinUsesLisp2019-09-061-17/+31
| |
* | kepler_compute: Implement texture queriesReinUsesLisp2019-09-061-0/+4
|/
* shader_ir: Implement VOTEReinUsesLisp2019-08-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Implement F16 Variants of F2F, F2I, I2F.Fernando Sahmkow2019-07-201-11/+14
| | | | | This commit takes care of implementing the F16 Variants of the conversion instructions and makes sure conversions are done.
* shader/half_set_predicate: Fix HSETP2 implementationReinUsesLisp2019-07-201-2/+1
|
* shader_ir: Unify blocks in decompiled shaders.Fernando Sahmkow2019-07-091-6/+6
|
* shader_ir: Implement BRX & BRA.CCFernando Sahmkow2019-07-091-0/+1
|
* texture_cache: Style and CorrectionsFernando Sahmkow2019-06-211-1/+2
|
* shader: Implement bindless imagesReinUsesLisp2019-06-211-0/+9
|
* shader: Decode SUST and implement backing image functionalityReinUsesLisp2019-06-211-1/+41
|
* shader: Split SSY and PBK stackReinUsesLisp2019-06-071-1/+6
| | | | | | | | | | | Hardware testing revealed that SSY and PBK push to a different stack, allowing code like this: SSY label1; PBK label2; SYNC; label1: PBK; label2: EXIT;
* shader/node: Minor changesReinUsesLisp2019-06-071-50/+54
| | | | | | | Reflect std::shared_ptr nature of Node on initializers and remove constant members in nodes. Add some commentaries.
* shader: Move Node declarations out of the shader IR headerReinUsesLisp2019-06-071-0/+510
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