Skip to content

Commit

Permalink
small correction for vertex rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinob committed Mar 18, 2018
1 parent 357bdf0 commit 123ae5c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Source/Core/Common/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const std::string scm_rev_str = "Ishiiruka-Dolphin"
#endif

const std::string scm_rev_git_str = SCM_REV_STR;
const std::string scm_rev_cache_str = "201803052332";
const std::string scm_rev_cache_str = "201803181949";
const std::string scm_desc_str = SCM_DESC_STR;
const std::string scm_branch_str = SCM_BRANCH_STR;
const std::string scm_distributor_str = SCM_DISTRIBUTOR_STR;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/TessellationShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ inline void GenerateTessellationShader(ShaderCode& out, const Tessellation_shade
" result.pos.z = result.pos.w * " I_DEPTHPARAMS ".x - result.pos.z * " I_DEPTHPARAMS ".y;\n"
" result.pos.xy *= sign(" I_DEPTHPARAMS ".zw * float2(-1.0, 1.0));\n"
" result.pos.xy = result.pos.xy + result.pos.w * " I_DEPTHPARAMS".zw;\n"
" if (result.pos.w == 1.0)\n"
" if (result.pos.w == 1.0 && " I_VIEWPARAMS ".x > 0.0)\n"
" {\n"
" result.pos.xy = round(result.pos.xy * " I_VIEWPARAMS ".xy) * " I_VIEWPARAMS ".zw;\n"
" result.pos.xy = round((result.pos.xy + float2(1.0, 1.0)) * " I_VIEWPARAMS ".xy) * " I_VIEWPARAMS ".zw - float2(1.0,1.0);\n"
" }\n"
" return result;\n}"
);
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/UberShaderVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ void GenVertexShader(ShaderCode& out, API_TYPE ApiType, const ShaderHostConfig&
// we need to correct this by converting our
// clip-space position into the Wii's screen-space
// acquire the right pixel and then convert it back
out.Write("if (o.pos.w == 1.0)\n");
out.Write("if (o.pos.w == 1.0 && " I_VIEWPARAMS ".x > 0.0)\n");
out.Write("{\n");
out.Write("\to.pos.xy = round(o.pos.xy * " I_VIEWPARAMS ".xy) * " I_VIEWPARAMS ".zw;\n");
out.Write("\to.pos.xy = round((o.pos.xy + float2(1.0, 1.0)) * " I_VIEWPARAMS ".xy) * " I_VIEWPARAMS ".zw - float2(1.0,1.0);\n");
out.Write("}\n");

if (ApiType == API_OPENGL || ApiType == API_VULKAN)
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/VertexShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ inline void GenerateVertexShader(ShaderCode& out, API_TYPE api_type, const verte
// we need to correct this by converting our
// clip-space position into the Wii's screen-space
// acquire the right pixel and then convert it back
out.Write("if (o.pos.w == 1.0)\n");
out.Write("if (o.pos.w == 1.0 && " I_VIEWPARAMS ".x > 0.0)\n");
out.Write("{\n");
out.Write("\to.pos.xy = round(o.pos.xy * " I_VIEWPARAMS ".xy) * " I_VIEWPARAMS ".zw;\n");
out.Write("\to.pos.xy = round((o.pos.xy + float2(1.0, 1.0)) * " I_VIEWPARAMS ".xy) * " I_VIEWPARAMS ".zw - float2(1.0,1.0);\n");
out.Write("}\n");
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/VertexShaderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ void VertexShaderManager::SetConstants()
pixel_center_correction * pixel_size_x,
pixel_center_correction * pixel_size_y);
m_buffer.SetConstant4(C_VIEWPARAMS,
viewport_width * 0.5f,
bUseVertexRounding ? viewport_width * 0.5f : -1.0f,
viewport_height * 0.5f,
pixel_size_x,
pixel_size_y);
Expand Down

0 comments on commit 123ae5c

Please sign in to comment.