mirror of https://github.com/PCSX2/pcsx2.git
Gsdx: Point Sampler changes.
Re add point sampler to OpenGL. Fixes graphical issues when Allow 8-bit textures is enabled on AMD gpus. Issue: https://forums.pcsx2.net/Thread-GSDX-Hardware-mode-Bug-Report-Allow-8-bit-Texture Adjust the code to be easier to read, and execute the gl code only on amd - suggested by Gregory. Remove useless ATI_SUCKS define in tfx shader.It wasn't used anywhere outside of the shader.
This commit is contained in:
parent
4060bcf9c9
commit
d7cdbf6f27
|
@ -961,7 +961,7 @@ GLuint GSDeviceOGL::CompilePS(PSSelector sel)
|
|||
+ format("#define PS_COLCLIP %d\n", sel.colclip)
|
||||
+ format("#define PS_DATE %d\n", sel.date)
|
||||
+ format("#define PS_TCOFFSETHACK %d\n", sel.tcoffsethack)
|
||||
//+ format("#define PS_POINT_SAMPLER %d\n", sel.point_sampler)
|
||||
+ format("#define PS_POINT_SAMPLER %d\n", sel.point_sampler)
|
||||
+ format("#define PS_BLEND_A %d\n", sel.blend_a)
|
||||
+ format("#define PS_BLEND_B %d\n", sel.blend_b)
|
||||
+ format("#define PS_BLEND_C %d\n", sel.blend_c)
|
||||
|
|
|
@ -301,8 +301,9 @@ public:
|
|||
uint32 tex_is_fb:1; // Jak Shadows
|
||||
uint32 automatic_lod:1;
|
||||
uint32 manual_lod:1;
|
||||
uint32 point_sampler:1;
|
||||
|
||||
uint32 _free2:11;
|
||||
uint32 _free2:10;
|
||||
};
|
||||
|
||||
uint64 key;
|
||||
|
|
|
@ -300,7 +300,7 @@ void GSRendererDX::EmulateTextureSampler(const GSTextureCache::Source* tex)
|
|||
|
||||
m_ps_sel.rt = tex->m_target;
|
||||
m_ps_sel.spritehack = tex->m_spritehack_t;
|
||||
m_ps_sel.point_sampler = !(bilinear && !shader_emulated_sampler);
|
||||
m_ps_sel.point_sampler = !bilinear || shader_emulated_sampler;
|
||||
|
||||
if (PRIM->FST)
|
||||
{
|
||||
|
|
|
@ -391,7 +391,7 @@ void GSRendererOGL::EmulateTextureShuffleAndFbmask()
|
|||
// The safe and accurate path (but slow)
|
||||
GL_INS("FBMASK SW emulated fb_mask:%x on %d bits format", m_context->FRAME.FBMSK,
|
||||
(GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt == 2) ? 16 : 32);
|
||||
m_require_full_barrier = true;;
|
||||
m_require_full_barrier = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -816,6 +816,7 @@ void GSRendererOGL::EmulateTextureSampler(const GSTextureCache::Source* tex)
|
|||
m_ps_sel.tcc = m_context->TEX0.TCC;
|
||||
|
||||
m_ps_sel.ltf = bilinear && shader_emulated_sampler;
|
||||
m_ps_sel.point_sampler = GLLoader::vendor_id_amd && (!bilinear || shader_emulated_sampler);
|
||||
|
||||
int w = tex->m_texture->GetWidth();
|
||||
int h = tex->m_texture->GetHeight();
|
||||
|
|
|
@ -82,6 +82,15 @@ vec4 sample_c(vec2 uv)
|
|||
return texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
#else
|
||||
|
||||
#if PS_POINT_SAMPLER
|
||||
// Weird issue with ATI cards (happens on at least HD 4xxx and 5xxx),
|
||||
// it looks like they add 127/128 of a texel to sampling coordinates
|
||||
// occasionally causing point sampling to erroneously round up.
|
||||
// I'm manually adjusting coordinates to the centre of texels here,
|
||||
// though the centre is just paranoia, the top left corner works fine.
|
||||
uv = (trunc(uv * WH.zw) + vec2(0.5, 0.5)) / WH.zw;
|
||||
#endif
|
||||
|
||||
#if PS_AUTOMATIC_LOD == 1
|
||||
return texture(TextureSampler, uv);
|
||||
#elif PS_MANUAL_LOD == 1
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
#define FMT_24 1
|
||||
#define FMT_16 2
|
||||
|
||||
// And I say this as an ATI user.
|
||||
#define ATI_SUCKS 1
|
||||
|
||||
#if SHADER_MODEL >= 0x400
|
||||
|
||||
#ifndef VS_BPPZ
|
||||
|
@ -116,7 +113,7 @@ cbuffer cb2
|
|||
|
||||
float4 sample_c(float2 uv)
|
||||
{
|
||||
if (ATI_SUCKS && PS_POINT_SAMPLER)
|
||||
if (PS_POINT_SAMPLER)
|
||||
{
|
||||
// Weird issue with ATI cards (happens on at least HD 4xxx and 5xxx),
|
||||
// it looks like they add 127/128 of a texel to sampling coordinates
|
||||
|
|
Loading…
Reference in New Issue