GSdx-d3d11: Ported SW blending variables from OGL to DX11 PSSelector/BSSelector/pixel shader.

This commit is contained in:
hibye8313 2019-06-06 11:56:22 -04:00 committed by lightningterror
parent 718042e6a6
commit 6bdd4ff186
3 changed files with 33 additions and 4 deletions

View File

@ -102,6 +102,7 @@ public:
GSVector4i FbMask; GSVector4i FbMask;
GSVector4 TC_OffsetHack; GSVector4 TC_OffsetHack;
GSVector4 Af;
PSConstantBuffer() PSConstantBuffer()
{ {
@ -113,6 +114,7 @@ public:
MskFix = GSVector4i::zero(); MskFix = GSVector4i::zero();
ChannelShuffle = GSVector4i::zero(); ChannelShuffle = GSVector4i::zero();
FbMask = GSVector4i::zero(); FbMask = GSVector4i::zero();
Af = GSVector4::zero();
} }
__forceinline bool Update(const PSConstantBuffer* cb) __forceinline bool Update(const PSConstantBuffer* cb)
@ -120,7 +122,8 @@ public:
GSVector4i* a = (GSVector4i*)this; GSVector4i* a = (GSVector4i*)this;
GSVector4i* b = (GSVector4i*)cb; GSVector4i* b = (GSVector4i*)cb;
if(!((a[0] == b[0]) /*& (a[1] == b1)*/ & (a[2] == b[2]) & (a[3] == b[3]) & (a[4] == b[4]) & (a[5] == b[5]) & (a[6] == b[6]) & (a[7] == b[7])).alltrue()) // if WH matches HalfTexel does too if(!((a[0] == b[0]) /*& (a[1] == b1)*/ & (a[2] == b[2]) & (a[3] == b[3]) & (a[4] == b[4]) & (a[5] == b[5]) &
(a[6] == b[6]) & (a[7] == b[7]) & (a[9] == b[9])).alltrue()) // if WH matches HalfTexel does too
{ {
a[0] = b[0]; a[0] = b[0];
a[1] = b[1]; a[1] = b[1];
@ -130,6 +133,7 @@ public:
a[5] = b[5]; a[5] = b[5];
a[6] = b[6]; a[6] = b[6];
a[7] = b[7]; a[7] = b[7];
a[9] = b[9];
return true; return true;
} }
@ -207,7 +211,12 @@ public:
uint32 fbmask:1; uint32 fbmask:1;
// Blend and Colclip // Blend and Colclip
uint32 blend_a:2;
uint32 blend_b:2;
uint32 blend_c:2;
uint32 blend_d:2;
uint32 clr1:1; uint32 clr1:1;
uint32 hdr:1;
// Others ways to fetch the texture // Others ways to fetch the texture
uint32 channel:3; uint32 channel:3;
@ -220,7 +229,7 @@ public:
uint32 point_sampler:1; uint32 point_sampler:1;
uint32 invalid_tex0:1; // Lupin the 3rd uint32 invalid_tex0:1; // Lupin the 3rd
uint32 _free:27; uint32 _free:18;
}; };
uint64 key; uint64 key;
@ -286,6 +295,7 @@ public:
uint32 wg:1; uint32 wg:1;
uint32 wb:1; uint32 wb:1;
uint32 wa:1; uint32 wa:1;
uint32 accu_blend:1;
}; };
struct struct
@ -298,7 +308,7 @@ public:
uint32 key; uint32 key;
}; };
operator uint32() {return key & 0x1fff;} operator uint32() {return key & 0x3fff;}
OMBlendSelector() : key(0) {} OMBlendSelector() : key(0) {}

View File

@ -207,7 +207,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
if(i == m_ps.end()) if(i == m_ps.end())
{ {
std::string str[26]; std::string str[31];
str[0] = format("%d", sel.fst); str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms); str[1] = format("%d", sel.wms);
@ -235,6 +235,11 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
str[23] = format("%d", sel.fmt >> 2); str[23] = format("%d", sel.fmt >> 2);
str[24] = format("%d", sel.invalid_tex0); str[24] = format("%d", sel.invalid_tex0);
str[25] = format("%d", m_upscale_multiplier ? m_upscale_multiplier : 1); str[25] = format("%d", m_upscale_multiplier ? m_upscale_multiplier : 1);
str[26] = format("%d", sel.hdr);
str[27] = format("%d", sel.blend_a);
str[28] = format("%d", sel.blend_b);
str[29] = format("%d", sel.blend_c);
str[30] = format("%d", sel.blend_d);
D3D_SHADER_MACRO macro[] = D3D_SHADER_MACRO macro[] =
{ {
@ -264,6 +269,11 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
{"PS_PAL_FMT", str[23].c_str() }, {"PS_PAL_FMT", str[23].c_str() },
{"PS_INVALID_TEX0", str[24].c_str() }, {"PS_INVALID_TEX0", str[24].c_str() },
{"PS_SCALE_FACTOR", str[25].c_str() }, {"PS_SCALE_FACTOR", str[25].c_str() },
{"PS_HDR", str[26].c_str() },
{"PS_BLEND_A", str[27].c_str() },
{"PS_BLEND_B", str[28].c_str() },
{"PS_BLEND_C", str[29].c_str() },
{"PS_BLEND_D", str[30].c_str() },
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -44,8 +44,15 @@
#define PS_URBAN_CHAOS_HLE 0 #define PS_URBAN_CHAOS_HLE 0
#define PS_INVALID_TEX0 0 #define PS_INVALID_TEX0 0
#define PS_SCALE_FACTOR 1 #define PS_SCALE_FACTOR 1
#define PS_HDR 0
#define PS_BLEND_A 0
#define PS_BLEND_B 0
#define PS_BLEND_C 0
#define PS_BLEND_D 0
#endif #endif
#define SW_BLEND (PS_BLEND_A || PS_BLEND_B || PS_BLEND_D)
struct VS_INPUT struct VS_INPUT
{ {
float2 st : TEXCOORD0; float2 st : TEXCOORD0;
@ -106,6 +113,8 @@ cbuffer cb1
int4 ChannelShuffle; int4 ChannelShuffle;
uint4 FbMask; uint4 FbMask;
float4 TC_OffsetHack; float4 TC_OffsetHack;
float Af;
float3 _pad;
}; };
cbuffer cb2 cbuffer cb2