summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureConversionShader.cpp
AgeCommit message (Collapse)Author
2023-04-15Common/MathUtil: Move IntLog2 into MathUtil namespaceLioncash
Gets this out of the global namespace.
2023-03-02[[unlikely]] ASSERTMinty-Meeo
and other ASSERT usage changes
2022-08-20VideoCommon: Fix OpenGL ES GPU texture decodingJosJuice
2022-07-21VideoBackends: Add Metal rendererTellowKrinkle
2022-07-19Merge pull request #10874 from JosJuice/cmpr-layoutAdmiral H. Curtiss
VideoCommon: Fix CMPR compute shader layout
2022-07-18VideoCommon: Fix CMPR compute shader layoutJosJuice
Looks like a copy-paste gone wrong. The compute shaders for the other formats use a group size of 8 * 8, whereas the CMPR compute shader is supposed to use a flattened 64 * 1 as I understand it.
2022-07-17Fix OpenGL error on M1 Mac.Joon Park
Followup to #10466. Resolves the following error: ERROR: 0:85: '&' does not operate on 'uvec3' and 'int'
2022-07-16Add notes about precision of YUV->RGB conversion factors for XFBPokechu22
2022-07-16Rework TextureConversionShader for hardware accuracy and simplicityPokechu22
2022-07-16Restructure parameters to TetxureConverterShaderGen/TextureConversionShaderPokechu22
This will be used for later refactoring for increased accuracy.
2022-07-15Remove casts to integers for texture and EFB formatsPokechu22
The only remaining casts for these types that I know of are in TextureInfo (where format_name is set to the int version of the format, and since that affects filenames and probably would break resource packs, I'm not changing it) and in TextureDecoder_Common's TexDecoder_DrawOverlay, which will be handled separately.
2022-07-08Merge pull request #10819 from Dentomologist/fix_shader_compilation_warningsJMC47
VideoCommon: Fix D3D shader compilation warnings
2022-07-08VideoCommon: Fix D3D shader warning X3571 (negative base for pow())Dentomologist
Add abs() to fix "pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them".
2022-06-24D3D / VideoCommon: generate HLSL from SPIRViwubcode
2022-06-16VideoCommon: Reduce duplicates of non-palette-requiring texture decode shadersTellowKrinkle
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2021-03-06Convert BPMemory to BitField and enum classPokechu22
Additional changes: - For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare. (Shift has also been renamed to scale) - In TexMode0, min_filter has been split into min_mip and min_filter. - In TexImage1, image_type is now cache_manually_managed. - The unused bit in GenMode is now exposed. - LPSize's lineaspect is now named adjust_for_aspect_ratio.
2020-11-17VideoCommon: Migrate over to fmtLioncash
Migrates off the printf-based formatting where applicable.
2020-11-09ShaderGenCommon: Rename WriteFmt() to Write()Lioncash
Now that we've converted all of the shader generators over to using fmt, we can drop the old Write() member function and perform a rename operation on the WriteFmt() to turn it into the new Write() function. All changes within this are the removal of a <cstdarg> header, since the previous printf-based Write() required it, and renaming. No functional changes are made at all.
2020-01-23VideoCommon/TextureConversionShader: Make use of fmt where applicableLioncash
Now that we've converted the shader generation over to ShaderCode, we can now make use of the fmt-capable WriteFmt function.
2020-01-23VideoCommon/TextureConversionShader: Convert over to using ShaderCodeLioncash
Migrates the shader generator off the use of a global array, eliminating the use of some global state. This also allows us to move the shader generation over to using fmt in a subsequent change.
2019-12-29Use std::istringstream or std::ostringstream instead of std::stringstream ↵David Korth
where possible. This removes std::iostream from the inheritance chain, which reduces overhead slightly.
2019-07-14TextureConversionShader: Swap bytes for RG8/GB8 formatStenzek
Matches the software renderer.
2019-04-20ShaderGen: Use interface blocks when geometry shaders are supportedStenzek
We don't use explicit locations in OpenGL currently, so this breaks when we use alternative names in the geometry shaders.
2019-03-01TextureConversionShader: fix XFB decoding shaderTillmann Karras
2019-02-28TextureConversionShader: Fix XFB decoding shader for D3DStenzek
D3D has no mix() equivalent with a bool parameter. Compilers should be able to optimize the ternary into a select anyway.
2019-02-19Move most backend functionality to VideoCommonStenzek
2018-05-22EFB2RAM: Apply copy filter as a float coefficient after samplingStenzek
Using 8-bit integer math here lead to precision loss for depth copies, which broke various effects in games, e.g. lens flare in MK:DD. It's unlikely the console implements this as a floating-point multiply (fixed-point perhaps), but since we have the float round trip in our EFB2RAM shaders anyway, it's not going to make things any worse. If we do rewrite our shaders to use integer math completely, then it might be worth switching this conversion back to integers. However, the range of the values (format) should be known, or we should expand all values out to 24-bits first.
2018-05-17Merge pull request #6743 from stenzek/faster-disabled-copy-filterMarkus Wick
TextureConversionShader: Don't sample from adjacent rows when not needed
2018-05-03TextureConversionShader: Don't sample from adjacent rows when not neededStenzek
2018-05-03TextureConversionShader: Fix more implicit conversion errorsStenzek
2018-05-02TextureConversionShader: Fix compile errors in OpenGL ESStenzek
2018-04-29Implement EFB copy filter and gamma in hardware backendsStenzek
Also makes y_scale a dynamic parameter for EFB copies, as it doesn't make sense to keep it as part of the uid, otherwise we're generating redundant shaders.
2018-01-11Some more implicit uint/float conversions in the texture decode shadersJonathan Hamilton
2018-01-11GLSL-ES doesn't allow implicit int/uint conversionsJonathan Hamilton
2017-12-06TextureConversionShader: Use round() instead of roundEven() in HLSLStenzek
HLSL does not define roundEven(), only round(). This means that the output may differ slightly for OpenGL vs Direct3D. However, it ensures consistency across OpenGL drivers, as round() in GLSL can go either way.
2017-12-02Merge pull request #5903 from linkmauve/fix-mp2eMarkus Wick
Round values in swizzlers
2017-12-02VideoCommon: Rename TextureConversionShader namespace.degasus
2017-11-17HybridXFB: Fix lint errorsiwubcode
2017-11-17Video Common: Add XFB decoding via the GPUiwubcode
2017-11-17Video Backends: Implement vertical scaling for xfb copies. This fixes theiwubcode
display of PAL games that run in 50hz mode.
2017-11-17Add support for hybrid XFBiwubcode
2017-08-07VideoCommon: Round values in swizzlers.Emmanuel Gil Peyrot
This was breaking Metroid Prime 2: Echoes’s scanner in some rooms, such as the one in https://fifoci.dolphin-emu.org/dff/mp2-scanner/ It was found on Ivy Bridge on Mesa, the alpha value read back from the EFB was off-by-4 in multiple objects, which was a conversion error because int4() is equivalent to floor() and the value wasn’t always higher.
2017-08-03Video: Clearly separate Texture and EFB Copy formatsN.E.C
Improve bookkeeping around formats. Hopefully make code less confusing. - Rename TlutFormat -> TLUTFormat to follow conventions. - Use enum classes to prevent using a Texture format where an EFB Copy format is expected or vice-versa. - Use common EFBCopyFormat names regardless of depth and YUV configurations.
2017-06-17TextureConversionShader: Use integer math for truncating EFB formatStenzek
2017-04-12TextureConversionShader: fix syntax errorMichael Maltese
Fixes a situation where the following invalid GLSL code is generated: ```glsl float3 texSample0 = texture(samp0, float3(uv0 + float2(0, 0) * sample_offset, 0.0)).rgb; float3 texSample0 = floor(float3 texSample0 * 63.0) / 63.0; float3 texSample1 = texture(samp0, float3(uv0 + float2(1, 0) * sample_offset, 0.0)).rgb; float3 texSample1 = floor(float3 texSample1 * 63.0) / 63.0; ```
2017-04-12TextureConversionShader: Consider source format of EFB for EFB2RAMStenzek
Currently, we use the alpha channel from the EFB even if the current format does not include an alpha channel. Now, the alpha channel is set to 1 if the format does not have an alpha channel, as well as truncating to 5/6 bits per channel. This matches the EFB-to-texture behavior.
2017-04-06TextureConversionShader: Add missing swap for index of C14X2 texturesStenzek
2017-04-06TextureConversionShader: Fix compile error in C14X2 decoderStenzek
2017-04-01VideoCommon: Add texture decoding shader generatorsStenzek