GSdx: Add an enum for channel fetch.

This commit is contained in:
lightningterror 2018-10-23 11:52:27 +02:00
parent a25f3ccdda
commit 0cbbf2daf9
2 changed files with 21 additions and 9 deletions

View File

@ -28,7 +28,8 @@
#include "GSAlignedClass.h" #include "GSAlignedClass.h"
#include "GSOsdManager.h" #include "GSOsdManager.h"
enum ShaderConvert { enum ShaderConvert
{
ShaderConvert_COPY = 0, ShaderConvert_COPY = 0,
ShaderConvert_RGBA8_TO_16_BITS, ShaderConvert_RGBA8_TO_16_BITS,
ShaderConvert_DATM_1, ShaderConvert_DATM_1,
@ -52,6 +53,17 @@ enum ShaderConvert {
ShaderConvert_Count ShaderConvert_Count
}; };
enum ChannelFetch
{
ChannelFetch_NONE = 0,
ChannelFetch_RED = 1,
ChannelFetch_GREEN = 2,
ChannelFetch_BLUE = 3,
ChannelFetch_ALPHA = 4,
ChannelFetch_GXBY = 6,
ChannelFetch_RGB = 7,
};
#pragma pack(push, 1) #pragma pack(push, 1)
class MergeConstantBuffer class MergeConstantBuffer

View File

@ -402,14 +402,14 @@ void GSRendererOGL::EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::
if (m_channel_shuffle) { if (m_channel_shuffle) {
if (m_game.title == CRC::GT4 || m_game.title == CRC::GT3 || m_game.title == CRC::GTConcept || m_game.title == CRC::TouristTrophy) { if (m_game.title == CRC::GT4 || m_game.title == CRC::GT3 || m_game.title == CRC::GTConcept || m_game.title == CRC::TouristTrophy) {
GL_INS("Gran Turismo RGB Channel"); GL_INS("Gran Turismo RGB Channel");
m_ps_sel.channel = 7; m_ps_sel.channel = ChannelFetch_RGB;
m_context->TEX0.TFX = TFX_DECAL; m_context->TEX0.TFX = TFX_DECAL;
*rt = tex->m_from_target; *rt = tex->m_from_target;
} else if (m_game.title == CRC::Tekken5) { } else if (m_game.title == CRC::Tekken5) {
if (m_context->FRAME.FBW == 1) { if (m_context->FRAME.FBW == 1) {
// Used in stages: Secret Garden, Acid Rain, Moonlit Wilderness // Used in stages: Secret Garden, Acid Rain, Moonlit Wilderness
GL_INS("Tekken5 RGB Channel"); GL_INS("Tekken5 RGB Channel");
m_ps_sel.channel = 7; m_ps_sel.channel = ChannelFetch_RGB;
m_context->FRAME.FBMSK = 0xFF000000; m_context->FRAME.FBMSK = 0xFF000000;
// 12 pages: 2 calls by channel, 3 channels, 1 blit // 12 pages: 2 calls by channel, 3 channels, 1 blit
// Minus current draw call // Minus current draw call
@ -444,7 +444,7 @@ void GSRendererOGL::EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::
// Read either blue or Alpha. Let's go for Blue ;) // Read either blue or Alpha. Let's go for Blue ;)
// MGS3/Kill Zone // MGS3/Kill Zone
GL_INS("Blue channel"); GL_INS("Blue channel");
m_ps_sel.channel = 3; m_ps_sel.channel = ChannelFetch_BLUE;
} else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MINU & 0x8) == 0)) { } else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MINU & 0x8) == 0)) {
// Read either Red or Green. Let's check the V coordinate. 0-1 is likely top so // Read either Red or Green. Let's check the V coordinate. 0-1 is likely top so
// red. 2-3 is likely bottom so green (actually depends on texture base pointer offset) // red. 2-3 is likely bottom so green (actually depends on texture base pointer offset)
@ -473,20 +473,20 @@ void GSRendererOGL::EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::
if (blue_shift >= 0) { if (blue_shift >= 0) {
GL_INS("Green/Blue channel (%d, %d)", blue_shift, green_shift); GL_INS("Green/Blue channel (%d, %d)", blue_shift, green_shift);
m_ps_sel.channel = 6; m_ps_sel.channel = ChannelFetch_GXBY;
m_context->FRAME.FBMSK = 0x00FFFFFF; m_context->FRAME.FBMSK = 0x00FFFFFF;
} else { } else {
GL_INS("Green channel (wrong mask) (fbmask %x)", m_context->FRAME.FBMSK >> 24); GL_INS("Green channel (wrong mask) (fbmask %x)", m_context->FRAME.FBMSK >> 24);
m_ps_sel.channel = 2; m_ps_sel.channel = ChannelFetch_GREEN;
} }
} else if (green) { } else if (green) {
GL_INS("Green channel"); GL_INS("Green channel");
m_ps_sel.channel = 2; m_ps_sel.channel = ChannelFetch_GREEN;
} else { } else {
// Pop // Pop
GL_INS("Red channel"); GL_INS("Red channel");
m_ps_sel.channel = 1; m_ps_sel.channel = ChannelFetch_RED;
} }
} else { } else {
GL_INS("Channel not supported"); GL_INS("Channel not supported");
@ -1319,7 +1319,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
m_require_full_barrier = true; m_require_full_barrier = true;
// Extract the depth as palette index // Extract the depth as palette index
m_ps_sel.depth_fmt = 1; m_ps_sel.depth_fmt = 1;
m_ps_sel.channel = 3; m_ps_sel.channel = ChannelFetch_BLUE;
dev->PSSetShaderResource(4, ds); dev->PSSetShaderResource(4, ds);
// We need the palette to convert the depth to the correct alpha value. // We need the palette to convert the depth to the correct alpha value.