mirror of https://github.com/PCSX2/pcsx2.git
gsdx ogl: allow to use a separate texture for the channel effect
This commit is contained in:
parent
a9d25efcde
commit
7a5e1d4154
|
@ -777,7 +777,12 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
GL_INS("channel not supported");
|
||||
ASSERT(0);
|
||||
}
|
||||
dev->PSSetShaderResource(4, tex->m_from_target);
|
||||
glTextureBarrier();
|
||||
} else {
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
dev->PSSetShaderResource(4, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1121,7 +1121,10 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
if (GSLocalMemory::m_psm[TEX0.PSM].bpp > 8) {
|
||||
src->m_32_bits_fmt = dst->m_32_bits_fmt;
|
||||
}
|
||||
|
||||
// Keep a trace of origin of the texture
|
||||
src->m_target = true;
|
||||
src->m_from_target = dst->m_texture;
|
||||
|
||||
dst->Update();
|
||||
|
||||
|
@ -1488,6 +1491,7 @@ GSTextureCache::Source::Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFR
|
|||
, m_complete(false)
|
||||
, m_spritehack_t(false)
|
||||
, m_p2t(NULL)
|
||||
, m_from_target(NULL)
|
||||
{
|
||||
m_TEX0 = TEX0;
|
||||
m_TEXA = TEXA;
|
||||
|
|
|
@ -67,6 +67,10 @@ public:
|
|||
bool m_repeating;
|
||||
bool m_spritehack_t;
|
||||
vector<GSVector2i>* m_p2t;
|
||||
// Keep a trace of the target origin. There is no guarantee that pointer will
|
||||
// still be valid on future. However it ought to be good when the source is created
|
||||
// so it can be used to access un-converted data for the current draw call.
|
||||
GSTexture* m_from_target;
|
||||
|
||||
public:
|
||||
Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, uint8* temp, bool dummy_container = false);
|
||||
|
|
|
@ -40,6 +40,7 @@ layout(location = 0, index = 1) out vec4 SV_Target1;
|
|||
|
||||
layout(binding = 1) uniform sampler2D PaletteSampler;
|
||||
layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the image below
|
||||
layout(binding = 4) uniform sampler2D RawTextureSampler;
|
||||
|
||||
#ifndef DISABLE_GL42_image
|
||||
#if PS_DATE > 0
|
||||
|
@ -267,25 +268,25 @@ vec4 sample_depth(vec2 st)
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
vec4 fetch_red()
|
||||
{
|
||||
vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
return sample_p(rt.r) * 255.0f;
|
||||
}
|
||||
|
||||
vec4 fetch_blue()
|
||||
{
|
||||
vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
return sample_p(rt.b) * 255.0f;
|
||||
}
|
||||
|
||||
vec4 fetch_green()
|
||||
{
|
||||
vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
return sample_p(rt.g) * 255.0f;
|
||||
}
|
||||
|
||||
vec4 fetch_alpha()
|
||||
{
|
||||
vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);
|
||||
return sample_p(rt.a) * 255.0f;
|
||||
}
|
||||
|
||||
|
|
|
@ -884,6 +884,7 @@ static const char* const tfx_fs_all_glsl =
|
|||
"\n"
|
||||
"layout(binding = 1) uniform sampler2D PaletteSampler;\n"
|
||||
"layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the image below\n"
|
||||
"layout(binding = 4) uniform sampler2D RawTextureSampler;\n"
|
||||
"\n"
|
||||
"#ifndef DISABLE_GL42_image\n"
|
||||
"#if PS_DATE > 0\n"
|
||||
|
@ -1111,25 +1112,25 @@ static const char* const tfx_fs_all_glsl =
|
|||
"//////////////////////////////////////////////////////////////////////\n"
|
||||
"vec4 fetch_red()\n"
|
||||
"{\n"
|
||||
" vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" return sample_p(rt.r) * 255.0f;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"vec4 fetch_blue()\n"
|
||||
"{\n"
|
||||
" vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" return sample_p(rt.b) * 255.0f;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"vec4 fetch_green()\n"
|
||||
"{\n"
|
||||
" vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" return sample_p(rt.g) * 255.0f;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"vec4 fetch_alpha()\n"
|
||||
"{\n"
|
||||
" vec4 rt = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" vec4 rt = texelFetch(RawTextureSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||
" return sample_p(rt.a) * 255.0f;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
|
Loading…
Reference in New Issue