summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/decode/texture.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-07-23shader: Remove old shader managementReinUsesLisp1-935/+0
2021-02-15Review 1Kelebek11-1/+1
2021-02-15Implement texture offset support for TexelFetch and TextureGather and add offsets for TldsKelebek11-2/+9
Formatting
2020-12-30video_core: Rewrite the texture cacheReinUsesLisp1-27/+29
The current texture cache has several points that hurt maintainability and performance. It's easy to break unrelated parts of the cache when doing minor changes. The cache can easily forget valuable information about the cached textures by CPU writes or simply by its normal usage.The current texture cache has several points that hurt maintainability and performance. It's easy to break unrelated parts of the cache when doing minor changes. The cache can easily forget valuable information about the cached textures by CPU writes or simply by its normal usage. This commit aims to address those issues.
2020-12-07video_core: Remove unnecessary enum class casting in logging messagesLioncash1-5/+4
fmt now automatically prints the numeric value of an enum class member by default, so we don't need to use casts any more. Reduces the line noise a bit.
2020-10-28shader: Partially implement texture cube array shadowReinUsesLisp1-1/+0
This implements texture cube arrays with shadow comparisons but doesn't fix the asserts related to it. Fixes out of bounds reads on swizzle constructors and makes them use bounds checked ::at instead of the unsafe operator[].
2020-10-08shader/texture: Implement CUBE texture type for TMML and fix arraysReinUsesLisp1-19/+22
TMML takes an array argument that has no known meaning, this one appears as the first component in gpr8 followed by s, t and r. Skip this component when arrays are being used. Also implement CUBE texture types. - Used by Pikmin 3: Deluxe Demo.
2020-09-17decoder/texture: Eliminate narrowing conversion in GetTldCode()Lioncash1-1/+1
The assignment was previously truncating a u64 value to a bool.
2020-06-05shader/texture: Join separate image and sampler pairs offlineReinUsesLisp1-18/+37
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
2020-04-23shader/texture: Support multiple unknown sampler propertiesReinUsesLisp1-51/+74
This allows deducing some properties from the texture instruction before asking the runtime. By doing this we can handle type mismatches in some instructions from the renderer instead of the shader decoder. Fixes texelFetch issues with games using 2D texture instructions on a 1D sampler.
2020-04-23shader_ir: Turn classes into data structuresReinUsesLisp1-49/+50
2020-04-17decode/texture: Resolve unused variable warnings.Lioncash1-5/+7
Some variables aren't used, so we can remove these. Unfortunately, diagnostics are still reported on structured bindings even when annotated with [[maybe_unused]], so we need to unpack the elements that we want to use manually.
2020-04-17decode/texture: Collapse loop down into std::generateLioncash1-3/+1
Same behavior, less code.
2020-04-17decode/texture: Eliminate trivial missing field initializer warningsLioncash1-3/+4
We can just specify the initializers.
2020-04-10shader/texture: Remove type mismatches management from shader decoderReinUsesLisp1-14/+0
Since commit e22816a5bb we handle type mismatches from the CPU. We don't need to hack our shader decoder due to game bugs anymore. Removed in this commit.
2020-03-09video_core: Rename "const buffer locker" to "registry"ReinUsesLisp1-2/+3
2020-02-21shader/texture: Fix illegal 3D texture assertReinUsesLisp1-1/+1
Fix typo in the illegal 3D texture assert logic. We care about catching arrayed 3D textures or 3D shadow textures, not regular 3D textures.
2020-02-15shader/texture: Allow 2D shadow arrays and simplify codeReinUsesLisp1-43/+28
Shadow sampler 2D arrays are supported on OpenGL, so there's no reason to forbid these. Enable textureLod usage on these. Minor style changes.
2020-02-02shader: Remove curly braces initializers on shared pointersReinUsesLisp1-2/+2
2020-01-25Shader_IR: Address feedback.Fernando Sahmkow1-1/+2
2020-01-24Shader_IR: Change name of TrackSampler function so it does not confuse with the type.Fernando Sahmkow1-1/+1
2020-01-24Shader_IR: Propagate bindless index into the GL compiler.Fernando Sahmkow1-16/+24
2020-01-24Shader_IR: deduce size of indexed samplersFernando Sahmkow1-4/+5
2020-01-24Shader_IR: Setup Indexed Samplers on the IRFernando Sahmkow1-20/+46
2020-01-09shader_ir/texture: Simplify AOFFI codeReinUsesLisp1-10/+6
2020-01-04Shader_IR: Implement TXD Array.Fernando Sahmkow1-5/+12
This commit extends the compilation of TXD to support array samplers on TXD.
2019-12-18shader/texture: Properly shrink unused entries in size mismatchesReinUsesLisp1-4/+9
When a image format mismatches we were inserting zeroes to the texture itself. This was not handling cases were the mismatch uses less coordinates than the guest shader code. Address that by resizing the vector.
2019-12-16shader/texture: Implement TLD4.PTPReinUsesLisp1-18/+56
2019-12-16shader/texture: Enable arrayed TLD4ReinUsesLisp1-1/+0
2019-12-16shader/texture: Implement AOFFI for TLD4SReinUsesLisp1-13/+18
2019-12-16shader/texture: Remove unnecesary parenthesisReinUsesLisp1-2/+2
2019-12-12Shader_IR: Correct TLD4S Depth Compare.Fernando Sahmkow1-5/+12
2019-12-12Shader_Ir: Correct TLD4S encoding and implement f16 flag.Fernando Sahmkow1-9/+12
2019-12-12Shader_Ir: default failed tracks on bindless samplers to null values.Fernando Sahmkow1-22/+75
2019-11-23shader/texture: Handle TLDS texture type mismatchesReinUsesLisp1-1/+10
Some games like "Fire Emblem: Three Houses" bind 2D textures to offsets used by instructions of 1D textures. To handle the discrepancy this commit uses the the texture type from the binding and modifies the emitted code IR to build a valid backend expression. E.g.: Bound texture is 2D and instruction is 1D, the emitted IR samples a 2D texture in the coordinate ivec2(X, 0).
2019-11-23shader/texture: Deduce texture buffers from lockerReinUsesLisp1-61/+41
Instead of specializing shaders to separate texture buffers from 1D textures, use the locker to deduce them while they are being decoded.
2019-11-18Shader_IR: Address FeedbackFernando Sahmkow1-5/+2
2019-11-14Shader_IR: Implement TXD instruction.Fernando Sahmkow1-7/+49
2019-11-07shader/texture: Remove NODEP warningsReinUsesLisp1-35/+0
These warnings don't offer meaningful information while decoding shaders. Remove them.
2019-10-31Shader_IR: Fix regression on TLD4Fernando Sahmkow1-4/+3
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.
2019-10-30Shader_IR: Fix TLD4 and add Bindless Variant.Fernando Sahmkow1-8/+24
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.
2019-10-30shader/node: Unpack bindless texture encodingReinUsesLisp1-28/+31
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.
2019-10-26Shader_IR: Address Feedback.Fernando Sahmkow1-22/+16
2019-10-25Shader_IR: allow lookup of texture samplers within the shader_ir for instructions that don't provide itFernando Sahmkow1-18/+54
2019-10-22Shader_Ir: Fix TLD4S from using a component mask.Fernando Sahmkow1-4/+4
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.
2019-07-17shader_ir: Rename Get/SetTemporal to Get/SetTemporaryLioncash1-13/+13
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-15shader: Allow tracking of indirect buffers without variable offsetReinUsesLisp1-6/+2
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-07shader/texture: Add F16 support for TLDSReinUsesLisp1-1/+7
2019-06-24decode/texture: Address feedbackReinUsesLisp1-0/+1
2019-06-21shader: Implement texture buffersReinUsesLisp1-0/+44
2019-06-06shader: Use shared_ptr to store nodes and move initialization to fileReinUsesLisp1-4/+5
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-05-10video_core/shader/decode/texture: Remove unused variable from GetTld4Code()Lioncash1-1/+0
2019-05-04shader/decode/texture: Remove unused variableLioncash1-1/+0
This isn't used anywhere, so we can get rid of it.
2019-04-26shader_ir/texture: Fix sampler const buffer key shiftReinUsesLisp1-1/+1
2019-04-08Adapt Bindless to work with AOFFIFernando Sahmkow1-7/+18
2019-04-08Move ConstBufferAccessor to Maxwell3d, correct mistakes and clang format.Fernando Sahmkow1-1/+2
2019-04-08Fix TMMLFernando Sahmkow1-5/+7
2019-04-08Refactor GetTextureCode and GetTexCode to use an optional instead of optional parametersFernando Sahmkow1-23/+24
2019-04-08Implement TXQ_BFernando Sahmkow1-2/+8
2019-04-08Implement TMML_BFernando Sahmkow1-5/+10
2019-04-08Corrections to TEX_BFernando Sahmkow1-4/+5
2019-04-08Unify both sampler types.Fernando Sahmkow1-10/+12
2019-04-08Implement Bindless Samplers and TEX_B in the IR.Fernando Sahmkow1-6/+52
2019-03-31shader_ir/decode: Silent implicit sign conversion warningMat M1-2/+2
Co-Authored-By: ReinUsesLisp <reinuseslisp@airmail.cc>
2019-03-30shader_ir/decode: Implement AOFFI for TEX and TLD4ReinUsesLisp1-24/+88
2019-02-26shader/decode: Remove extras from MetaTextureReinUsesLisp1-14/+23
2019-02-26shader/decode: Split memory and texture instructions decodingReinUsesLisp1-210/+3
2019-02-14shader_decompiler: Improve Accuracy of Attribute Interpolation.Fernando Sahmkow1-1/+1
2019-02-12gl_shader_decompiler: Re-implement TLDS lodReinUsesLisp1-1/+1
2019-02-07shader_ir: Remove F4 prefix to texture operationsReinUsesLisp1-8/+7
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.
2019-02-07shader_ir: Clean texture management codeReinUsesLisp1-96/+58
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.
2019-02-03Fix TXQ not using the component mask.Fernando Sahmkow1-6/+9
2019-02-03shader_ir/memory: Add ST_L 64 and 128 bits storesReinUsesLisp1-3/+11
2019-02-03shader_ir: Rename BasicBlock to NodeBlockReinUsesLisp1-5/+4
It's not always used as a basic block. Rename it for consistency.
2019-02-03shader_ir: Pass decoded nodes as a whole instead of per basic blocksReinUsesLisp1-2/+3
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.
2019-02-03shader_ir/memory: Add LD_L 128 bits loadsReinUsesLisp1-7/+19
2019-02-03shader_bytecode: Rename BytesN enums to BitsNReinUsesLisp1-4/+4
2019-02-03shader_ir/memory: Add LD_L 64 bits loadsReinUsesLisp1-6/+17
2019-01-30shader_ir: Unify constant buffer offset valuesReinUsesLisp1-3/+3
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.
2019-01-30shader_decode: Implement LDG and basic cbuf trackingReinUsesLisp1-0/+49
2019-01-15shader_ir: Pass to decoder functions basic block's codeReinUsesLisp1-1/+1
2019-01-15shader_ir: Remove composite primitives and use temporals insteadReinUsesLisp1-145/+149
2019-01-15shader_decode: Use proper primitive namesReinUsesLisp1-2/+2
2019-01-15shader_ir: Remove RZ and use Register::ZeroIndex insteadReinUsesLisp1-6/+11
2019-01-15shader_decode: Implement TEXS.F16ReinUsesLisp1-13/+25
2019-01-15shader_decode: Implement TLDS (untested)ReinUsesLisp1-8/+61
2019-01-15shader_decode: Update TLD4 reflecting #1862 changesReinUsesLisp1-52/+49
2019-01-15shader_ir: Fixup TEX and TEXS and partially fix TLD4 decompilingReinUsesLisp1-50/+49
2019-01-15shader_decode: Implement ST_LReinUsesLisp1-0/+17
2019-01-15shader_decode: Implement LD_LReinUsesLisp1-0/+18
2019-01-15shader_decode: Implement LD_CReinUsesLisp1-0/+31
2019-01-15shader_decode: Implement TMMLReinUsesLisp1-3/+45
2019-01-15shader_decode: Implement TEX and TXQReinUsesLisp1-0/+219
2019-01-15shader_decode: Implement TEXS (F32)ReinUsesLisp1-0/+199
2019-01-15shader_decode: Implement ST_AReinUsesLisp1-0/+30
2019-01-15shader_decode: Implement LD_AReinUsesLisp1-1/+39
2019-01-15shader_ir: Initial implementationReinUsesLisp1-0/+24