Skip to content

Commit

Permalink
Fix handling of DECAL texture function when TCC is 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpd002 committed Aug 26, 2024
1 parent b7f5a6d commit 2f6fd7b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions Source/gs/GSH_Direct3D9/GSH_Direct3D9_Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Nuanceur::CShaderBuilder CGSH_Direct3D9::GeneratePixelShader(SHADERCAPS caps)
NewFloat4(b, 0, 0, 0, 0), NewFloat4(b, 1, 1, 1, 1));
break;
case TEX0_FUNCTION_DECAL:
//TODO: Replace A with fragment's A if tex has no alpha channel.
break;
default:
assert(0);
Expand Down
4 changes: 4 additions & 0 deletions Source/gs/GSH_OpenGL/GSH_OpenGL_Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ Framework::OpenGl::CShader CGSH_OpenGL::GenerateFragmentShader(const SHADERCAPS&
}
break;
case TEX0_FUNCTION_DECAL:
if(!caps.texHasAlpha)
{
shaderBuilder << " textureColor.a = v_color.a;" << std::endl;
}
break;
case TEX0_FUNCTION_HIGHLIGHT:
shaderBuilder << " textureColor.rgb = clamp(textureColor.rgb * v_color.rgb * 2.0, 0.0, 1.0) + v_color.aaa;" << std::endl;
Expand Down
5 changes: 4 additions & 1 deletion Source/gs/GSH_Vulkan/GSH_VulkanDrawDesktop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,10 @@ Framework::Vulkan::CShaderModule CDrawDesktop::CreateFragmentShader(const PIPELI
}
break;
case CGSHandler::TEX0_FUNCTION_DECAL:
//Nothing to do
if(!caps.textureHasAlpha)
{
textureColor = NewFloat4(textureColor->xyz(), inputColor->w());
}
break;
case CGSHandler::TEX0_FUNCTION_HIGHLIGHT:
{
Expand Down
5 changes: 4 additions & 1 deletion Source/gs/GSH_Vulkan/GSH_VulkanDrawMobile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,10 @@ Framework::Vulkan::CShaderModule CDrawMobile::CreateDrawFragmentShader(const PIP
}
break;
case CGSHandler::TEX0_FUNCTION_DECAL:
//Nothing to do
if(!caps.textureHasAlpha)
{
textureColor = NewFloat4(textureColor->xyz(), inputColor->w());
}
break;
case CGSHandler::TEX0_FUNCTION_HIGHLIGHT:
{
Expand Down

0 comments on commit 2f6fd7b

Please sign in to comment.