GSdx-d3d: Reformat GSRendererDX11.cpp.

This commit is contained in:
lightningterror 2018-10-08 07:19:07 +02:00
parent e5565d32b1
commit 201e7d1430
1 changed files with 47 additions and 23 deletions

View File

@ -27,16 +27,19 @@
GSRendererDX11::GSRendererDX11()
: GSRendererDX(new GSTextureCache11(this), GSVector2(-0.5f))
{
if (theApp.GetConfigB("UserHacks")) {
if (theApp.GetConfigB("UserHacks"))
{
UserHacks_unscale_pt_ln = theApp.GetConfigB("UserHacks_unscale_point_line");
} else {
}
else
{
UserHacks_unscale_pt_ln = false;
}
}
bool GSRendererDX11::CreateDevice(GSDevice* dev)
{
if(!__super::CreateDevice(dev))
if (!__super::CreateDevice(dev))
return false;
return true;
@ -48,7 +51,8 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask()
GSVertex* v = &m_vertex.buff[0];
// Note: D3D1011 is limited and can't read the current framebuffer so we can't have PS_FBMASK and PS_WRITE_RG shaders ported and working.
if (m_texture_shuffle) {
if (m_texture_shuffle)
{
m_ps_sel.shuffle = 1;
m_ps_sel.dfmt = 0;
@ -64,9 +68,11 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask()
m_ps_sel.read_ba = (tex_pos > 112 && tex_pos < 144);
// Convert the vertex info to a 32 bits color format equivalent
if (PRIM->FST) {
if (PRIM->FST)
{
for(size_t i = 0; i < count; i += 2) {
for(size_t i = 0; i < count; i += 2)
{
if (write_ba)
v[i].XYZ.X -= 128u;
else
@ -89,10 +95,13 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask()
v[i+1].XYZ.Y = (uint16)tmp.z;
v[i+1].V = (uint16)tmp.w;
}
} else {
}
else
{
const float offset_8pix = 8.0f / tw;
for(size_t i = 0; i < count; i += 2) {
for(size_t i = 0; i < count; i += 2)
{
if (write_ba)
v[i].XYZ.X -= 128u;
else
@ -127,33 +136,46 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask()
om_bsel.wrgba = 0;
// 2 Select the new mask (Please someone put SSE here)
if (rg_mask != 0xFF) {
if (write_ba) {
if (rg_mask != 0xFF)
{
if (write_ba)
{
om_bsel.wb = 1;
} else {
}
else
{
om_bsel.wr = 1;
}
} else if ((fbmask & 0xFF) != 0xFF) {
}
else if ((fbmask & 0xFF) != 0xFF)
{
#ifdef _DEBUG
fprintf(stderr, "Please fix me! wb %u wr %u\n", om_bsel.wb, om_bsel.wr);
#endif
//ASSERT(0);
}
if (ba_mask != 0xFF) {
if (write_ba) {
if (ba_mask != 0xFF)
{
if (write_ba)
{
om_bsel.wa = 1;
} else {
}
else
{
om_bsel.wg = 1;
}
} else if ((fbmask & 0xFF) != 0xFF) {
}
else if ((fbmask & 0xFF) != 0xFF)
{
#ifdef _DEBUG
fprintf(stderr, "Please fix me! wa %u wg %u\n", om_bsel.wa, om_bsel.wg);
#endif
//ASSERT(0);
}
} else {
}
else
{
m_ps_sel.dfmt = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt;
om_bsel.wrgba = ~GSVector4i::load((int)m_context->FRAME.FBMSK).eq8(GSVector4i::xffffffff()).mask();
@ -171,7 +193,8 @@ void GSRendererDX11::SetupIA(const float& sx, const float& sy)
switch (m_vt.m_primclass)
{
case GS_POINT_CLASS:
if (unscale_hack) {
if (unscale_hack)
{
m_gs_sel.point = 1;
gs_cb.PointSize = GSVector2(16.0f * sx, 16.0f * sy);
}
@ -179,7 +202,8 @@ void GSRendererDX11::SetupIA(const float& sx, const float& sy)
t = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
break;
case GS_LINE_CLASS:
if (unscale_hack) {
if (unscale_hack)
{
m_gs_sel.line = 1;
gs_cb.PointSize = GSVector2(16.0f * sx, 16.0f * sy);
}
@ -201,17 +225,17 @@ void GSRendererDX11::SetupIA(const float& sx, const float& sy)
void* ptr = NULL;
if(dev->IAMapVertexBuffer(&ptr, sizeof(GSVertex), m_vertex.next))
if (dev->IAMapVertexBuffer(&ptr, sizeof(GSVertex), m_vertex.next))
{
GSVector4i::storent(ptr, m_vertex.buff, sizeof(GSVertex) * m_vertex.next);
if(UserHacks_WildHack && !isPackedUV_HackFlag)
if (UserHacks_WildHack && !isPackedUV_HackFlag)
{
GSVertex* RESTRICT d = (GSVertex*)ptr;
for(unsigned int i = 0; i < m_vertex.next; i++)
{
if(PRIM->TME && PRIM->FST) d[i].UV &= 0x3FEF3FEF;
if (PRIM->TME && PRIM->FST) d[i].UV &= 0x3FEF3FEF;
}
}