mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Merge pull request #10292 from OatmealDome/lodbias-take-two
PixelShaderGen: Use LOD bias when sampling texture on Metal and OpenGL ES
This commit is contained in:
@ -648,7 +648,19 @@ uint WrapCoord(int coord, uint wrap, int size) {{
|
||||
" 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");
|
||||
if (!host_config.backend_sampler_lod_bias)
|
||||
{
|
||||
out.Write(" uint texmode0 = samp_texmode0(texmap);\n"
|
||||
" float lod_bias = {} / 256.0f;\n"
|
||||
" return iround(255.0 * texture(tex, coords, lod_bias));\n",
|
||||
BitfieldExtract<&SamplerState::TM0::lod_bias>("texmode0"));
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write(" return iround(255.0 * texture(tex, coords));\n");
|
||||
}
|
||||
|
||||
out.Write("}}\n");
|
||||
}
|
||||
else if (api_type == APIType::D3D)
|
||||
{
|
||||
|
@ -42,6 +42,7 @@ ShaderHostConfig ShaderHostConfig::GetCurrent()
|
||||
bits.manual_texture_sampling = !g_ActiveConfig.bFastTextureSampling;
|
||||
bits.manual_texture_sampling_custom_texture_sizes =
|
||||
g_ActiveConfig.ManualTextureSamplingWithHiResTextures();
|
||||
bits.backend_sampler_lod_bias = g_ActiveConfig.backend_info.bSupportsLodBiasInSampler;
|
||||
return bits;
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,7 @@ union ShaderHostConfig
|
||||
BitField<23, 1, bool, u32> enable_validation_layer;
|
||||
BitField<24, 1, bool, u32> manual_texture_sampling;
|
||||
BitField<25, 1, bool, u32> manual_texture_sampling_custom_texture_sizes;
|
||||
BitField<26, 1, bool, u32> backend_sampler_lod_bias;
|
||||
|
||||
static ShaderHostConfig GetCurrent();
|
||||
};
|
||||
|
@ -233,6 +233,7 @@ struct VideoConfig final
|
||||
bool bSupportsPipelineCacheData = false;
|
||||
bool bSupportsCoarseDerivatives = false;
|
||||
bool bSupportsTextureQueryLevels = false;
|
||||
bool bSupportsLodBiasInSampler = false;
|
||||
} backend_info;
|
||||
|
||||
// Utility
|
||||
|
Reference in New Issue
Block a user