mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
GPU/ShaderGen: Use smaller position epsilon on PowerVR
This commit is contained in:
parent
df3427bb41
commit
eaab0cc033
|
@ -91,7 +91,7 @@ std::string GPU_HW_ShaderGen::GenerateBatchVertexShader(bool textured)
|
||||||
// OpenGL seems to be off by one pixel in the Y direction due to lower-left origin, but only on
|
// OpenGL seems to be off by one pixel in the Y direction due to lower-left origin, but only on
|
||||||
// Intel and NVIDIA drivers. AMD is fine. V3D requires coordinates to be slightly offset even further.
|
// Intel and NVIDIA drivers. AMD is fine. V3D requires coordinates to be slightly offset even further.
|
||||||
#if API_OPENGL || API_OPENGL_ES
|
#if API_OPENGL || API_OPENGL_ES
|
||||||
#ifdef DRIVER_V3D
|
#ifdef DRIVER_HACK_POS_EPSILON
|
||||||
CONSTANT float POS_EPSILON = 0.0001;
|
CONSTANT float POS_EPSILON = 0.0001;
|
||||||
#else
|
#else
|
||||||
CONSTANT float POS_EPSILON = 0.00001;
|
CONSTANT float POS_EPSILON = 0.00001;
|
||||||
|
|
|
@ -102,10 +102,11 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
|
||||||
ss << "#extension GL_ARB_blend_func_extended : require\n";
|
ss << "#extension GL_ARB_blend_func_extended : require\n";
|
||||||
|
|
||||||
// Test for V3D driver - we have to fudge coordinates slightly.
|
// Test for V3D driver - we have to fudge coordinates slightly.
|
||||||
if (std::strstr(reinterpret_cast<const char*>(glGetString(GL_VENDOR)), "Broadcom") &&
|
if ((std::strstr(reinterpret_cast<const char*>(glGetString(GL_VENDOR)), "Broadcom") &&
|
||||||
std::strstr(reinterpret_cast<const char*>(glGetString(GL_RENDERER)), "V3D"))
|
std::strstr(reinterpret_cast<const char*>(glGetString(GL_RENDERER)), "V3D")) ||
|
||||||
|
std::strstr(reinterpret_cast<const char*>(glGetString(GL_RENDERER)), "PowerVR"))
|
||||||
{
|
{
|
||||||
ss << "#define DRIVER_V3D 1\n";
|
ss << "#define DRIVER_HACK_POS_EPSILON 1\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_render_api == HostDisplay::RenderAPI::OpenGL)
|
else if (m_render_api == HostDisplay::RenderAPI::OpenGL)
|
||||||
|
@ -349,7 +350,7 @@ void ShaderGen::DeclareVertexEntryPoint(
|
||||||
for (u32 i = 0; i < num_texcoord_outputs; i++)
|
for (u32 i = 0; i < num_texcoord_outputs; i++)
|
||||||
ss << " " << qualifier << "float2 v_tex" << i << ";\n";
|
ss << " " << qualifier << "float2 v_tex" << i << ";\n";
|
||||||
|
|
||||||
for (const auto &[qualifiers, name] : additional_outputs)
|
for (const auto& [qualifiers, name] : additional_outputs)
|
||||||
{
|
{
|
||||||
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
||||||
ss << " " << qualifier_to_use << " " << name << ";\n";
|
ss << " " << qualifier_to_use << " " << name << ";\n";
|
||||||
|
@ -366,7 +367,7 @@ void ShaderGen::DeclareVertexEntryPoint(
|
||||||
for (u32 i = 0; i < num_texcoord_outputs; i++)
|
for (u32 i = 0; i < num_texcoord_outputs; i++)
|
||||||
ss << qualifier << "out float2 v_tex" << i << ";\n";
|
ss << qualifier << "out float2 v_tex" << i << ";\n";
|
||||||
|
|
||||||
for (const auto &[qualifiers, name] : additional_outputs)
|
for (const auto& [qualifiers, name] : additional_outputs)
|
||||||
{
|
{
|
||||||
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
||||||
ss << qualifier_to_use << " out " << name << ";\n";
|
ss << qualifier_to_use << " out " << name << ";\n";
|
||||||
|
@ -408,7 +409,7 @@ void ShaderGen::DeclareVertexEntryPoint(
|
||||||
ss << " " << qualifier << "out float2 v_tex" << i << " : TEXCOORD" << i << ",\n";
|
ss << " " << qualifier << "out float2 v_tex" << i << " : TEXCOORD" << i << ",\n";
|
||||||
|
|
||||||
u32 additional_counter = num_texcoord_outputs;
|
u32 additional_counter = num_texcoord_outputs;
|
||||||
for (const auto &[qualifiers, name] : additional_outputs)
|
for (const auto& [qualifiers, name] : additional_outputs)
|
||||||
{
|
{
|
||||||
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
||||||
ss << " " << qualifier_to_use << " out " << name << " : TEXCOORD" << additional_counter << ",\n";
|
ss << " " << qualifier_to_use << " out " << name << " : TEXCOORD" << additional_counter << ",\n";
|
||||||
|
@ -442,7 +443,7 @@ void ShaderGen::DeclareFragmentEntryPoint(
|
||||||
for (u32 i = 0; i < num_texcoord_inputs; i++)
|
for (u32 i = 0; i < num_texcoord_inputs; i++)
|
||||||
ss << " " << qualifier << "float2 v_tex" << i << ";\n";
|
ss << " " << qualifier << "float2 v_tex" << i << ";\n";
|
||||||
|
|
||||||
for (const auto &[qualifiers, name] : additional_inputs)
|
for (const auto& [qualifiers, name] : additional_inputs)
|
||||||
{
|
{
|
||||||
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
||||||
ss << " " << qualifier_to_use << " " << name << ";\n";
|
ss << " " << qualifier_to_use << " " << name << ";\n";
|
||||||
|
@ -459,7 +460,7 @@ void ShaderGen::DeclareFragmentEntryPoint(
|
||||||
for (u32 i = 0; i < num_texcoord_inputs; i++)
|
for (u32 i = 0; i < num_texcoord_inputs; i++)
|
||||||
ss << qualifier << "in float2 v_tex" << i << ";\n";
|
ss << qualifier << "in float2 v_tex" << i << ";\n";
|
||||||
|
|
||||||
for (const auto &[qualifiers, name] : additional_inputs)
|
for (const auto& [qualifiers, name] : additional_inputs)
|
||||||
{
|
{
|
||||||
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
||||||
ss << qualifier_to_use << " in " << name << ";\n";
|
ss << qualifier_to_use << " in " << name << ";\n";
|
||||||
|
@ -512,7 +513,7 @@ void ShaderGen::DeclareFragmentEntryPoint(
|
||||||
ss << " " << qualifier << "in float2 v_tex" << i << " : TEXCOORD" << i << ",\n";
|
ss << " " << qualifier << "in float2 v_tex" << i << " : TEXCOORD" << i << ",\n";
|
||||||
|
|
||||||
u32 additional_counter = num_texcoord_inputs;
|
u32 additional_counter = num_texcoord_inputs;
|
||||||
for (const auto &[qualifiers, name] : additional_inputs)
|
for (const auto& [qualifiers, name] : additional_inputs)
|
||||||
{
|
{
|
||||||
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
const char* qualifier_to_use = (std::strlen(qualifiers) > 0) ? qualifiers : qualifier;
|
||||||
ss << " " << qualifier_to_use << " in " << name << " : TEXCOORD" << additional_counter << ",\n";
|
ss << " " << qualifier_to_use << " in " << name << " : TEXCOORD" << additional_counter << ",\n";
|
||||||
|
|
Loading…
Reference in a new issue