Skip to content

Commit

Permalink
merge some changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinob committed Sep 2, 2016
1 parent 8d11705 commit 4d2ade6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 0 additions & 3 deletions Source/Core/Core/HW/DVDInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ static int s_dtk = 0;
static u64 s_last_read_offset;
static u64 s_last_read_time;

// GC-AM only
static unsigned char s_media_buffer[0x40];

static int s_eject_disc;
static int s_insert_disc;

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/PixelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static UPEAlphaModeConfReg m_AlphaModeConf;
static UPEAlphaReadReg m_AlphaRead;
static UPECtrlReg m_Control;

std::mutex s_token_finish_mutex;
static std::mutex s_token_finish_mutex;
static u16 s_token;
static u16 s_token_pending;
static bool s_token_interrupt_pending;
Expand Down
7 changes: 5 additions & 2 deletions Source/Core/VideoCommon/VertexShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,11 @@ inline void GenerateVertexShader(ShaderCode& out, const vertex_shader_uid_data&

// Since we're adjusting z for the depth range before the perspective divide, we have to do our
// own clipping. We want to clip so that -w <= z <= 0, which matches the console -1..0 range.
out.Write("o.clipDist.x = o.pos.z + o.pos.w;\n"); // Near: z < -w
out.Write("o.clipDist.y = -o.pos.z;\n"); // Far: z > 0
// We adjust our depth value for clipping purposes to match the perspective projection in the
// software backend, which is a hack to fix Sonic Adventure and Unleashed games.
out.Write("float clipDepth = o.pos.z * (1.0 - 1e-7);\n");
out.Write("o.clipDist.x = clipDepth + o.pos.w;\n"); // Near: z < -w
out.Write("o.clipDist.y = -clipDepth;\n"); // Far: z > 0
}
// Adjust z for the depth range. We're using an equation which incorperates a depth inversion,
// so we can map the console -1..0 range to the 0..1 range used in the depth buffer.
Expand Down
7 changes: 3 additions & 4 deletions Source/Core/VideoCommon/VertexShaderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ void VertexShaderManager::SetConstants()
}
else
{
rangez = abs(rangez) / 16777215.0f;
rangez = fabs(rangez) / 16777215.0f;
if (xfmem.viewport.zRange < 0.0f)
{
farz = farz / 16777215.0f;
Expand Down Expand Up @@ -495,7 +495,7 @@ void VertexShaderManager::SetConstants()
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
// Hack to fix depth clipping precision issues (such as Sonic Adventure UI)
g_fProjectionMatrix[14] = -(1.0f + FLT_EPSILON);
g_fProjectionMatrix[14] = g_ActiveConfig.backend_info.APIType & API_D3D9 ? (-(1.0f + FLT_EPSILON)) : -1.0f;
g_fProjectionMatrix[15] = 0.0f;

// Heuristic to detect if a GameCube game is in 16:9 anamorphic widescreen mode.
Expand Down Expand Up @@ -549,8 +549,7 @@ void VertexShaderManager::SetConstants()
g_fProjectionMatrix[14] = 0.0f;

// Hack to fix depth clipping precision issues (such as Sonic Unleashed UI)
// Turn it off for Nvidia 3D Vision, because it can't handle such a projection matrix
g_fProjectionMatrix[15] = (g_ActiveConfig.iStereoMode == STEREO_3DVISION) ? 1.0f : 1.0f + FLT_EPSILON;
g_fProjectionMatrix[15] = (g_ActiveConfig.backend_info.APIType & API_D3D9) ? 1.0f + FLT_EPSILON : 1.0f;

SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
Expand Down

0 comments on commit 4d2ade6

Please sign in to comment.