VideoCommon: Add option to use old behavior (Fast Texture Sampling)

Co-authored-by: JosJuice <josjuice@gmail.com>
This commit is contained in:
Pokechu22
2021-07-29 17:43:35 -07:00
parent ee80298ca4
commit 93eea7cb13
12 changed files with 46 additions and 1 deletions

View File

@ -537,6 +537,7 @@ void UpdateBoundingBox(float2 rawpos) {{
fmt::arg("efb_height", EFB_HEIGHT), fmt::arg("efb_scale", I_EFBSCALE));
}
if (host_config.manual_texture_sampling)
{
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
{
@ -596,6 +597,21 @@ uint WrapCoord(int coord, uint wrap, int size) {{
"int2 uv, int layer) {{\n");
}
if (!host_config.manual_texture_sampling)
{
out.Write(" float size_s = float(" I_TEXDIMS "[texmap].x * 128);\n"
" float size_t = float(" I_TEXDIMS "[texmap].y * 128);\n"
" float3 coords = float3(float(uv.x) / size_s, float(uv.y) / size_t, layer);\n");
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
{
out.Write(" return iround(255.0 * texture(tex, coords));\n}}\n");
}
else if (api_type == APIType::D3D)
{
out.Write(" return iround(255.0 * tex.Sample(tex_samp, coords));\n}}\n");
}
}
else
{
out.Write(R"(
uint texmode0 = samp_texmode0(texmap);

View File

@ -39,6 +39,7 @@ ShaderHostConfig ShaderHostConfig::GetCurrent()
bits.backend_logic_op = g_ActiveConfig.backend_info.bSupportsLogicOp;
bits.backend_palette_conversion = g_ActiveConfig.backend_info.bSupportsPaletteConversion;
bits.enable_validation_layer = g_ActiveConfig.bEnableValidationLayer;
bits.manual_texture_sampling = !g_ActiveConfig.bFastTextureSampling;
return bits;
}

View File

@ -169,6 +169,7 @@ union ShaderHostConfig
BitField<21, 1, bool, u32> backend_logic_op;
BitField<22, 1, bool, u32> backend_palette_conversion;
BitField<23, 1, bool, u32> enable_validation_layer;
BitField<24, 1, bool, u32> manual_texture_sampling;
static ShaderHostConfig GetCurrent();
};

View File

@ -135,6 +135,7 @@ void VideoConfig::Refresh()
bVertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING);
iEFBAccessTileSize = Config::Get(Config::GFX_HACK_EFB_ACCESS_TILE_SIZE);
iMissingColorValue = Config::Get(Config::GFX_HACK_MISSING_COLOR_VALUE);
bFastTextureSampling = Config::Get(Config::GFX_HACK_FAST_TEXTURE_SAMPLING);
bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE);

View File

@ -135,6 +135,7 @@ struct VideoConfig final
int iLog = 0; // CONF_ bits
int iSaveTargetId = 0; // TODO: Should be dropped
u32 iMissingColorValue = 0;
bool bFastTextureSampling = false;
// Stereoscopy
StereoMode stereo_mode{};