This commit is contained in:
Henrik Rydgård 2020-10-31 11:08:01 +01:00
parent 3d4fc7c696
commit 7a63b5e69e
3 changed files with 17 additions and 15 deletions

View File

@ -24,10 +24,12 @@
#include <unistd.h>
#endif
#include "Common/Log.h"
#include "Common/TimeUtil.h"
namespace net {
void Init()
{
#ifdef _WIN32
@ -45,7 +47,6 @@ void Shutdown()
}
bool DNSResolve(const std::string &host, const std::string &service, addrinfo **res, std::string &error, DNSType type) {
#if PPSSPP_PLATFORM(SWITCH)
// Force IPv4 lookups.
if (type == DNSType::IPV6) {

View File

@ -468,7 +468,8 @@ bool GenerateFragmentShaderGLSL(const FShaderID &id, char *buffer, const GLSLSha
}
if (doTexture) {
std::string texcoord = StringFromFormat("%sv_texcoord", compat.inPrefix);
char texcoord[64];
snprintf(texcoord, sizeof(texcoord), "%sv_texcoord", compat.inPrefix);
// TODO: Not sure the right way to do this for projection.
// This path destroys resolution on older PowerVR no matter what I do if projection is needed,
// so we disable it on SGX 540 and lesser, and live with the consequences.
@ -507,7 +508,7 @@ bool GenerateFragmentShaderGLSL(const FShaderID &id, char *buffer, const GLSLSha
}
WRITE(p, " vec2 fixedcoord = vec2(%s, %s);\n", ucoord.c_str(), vcoord.c_str());
texcoord = "fixedcoord";
truncate_cpy(texcoord, "fixedcoord");
// We already projected it.
doTextureProjection = false;
}
@ -517,28 +518,28 @@ bool GenerateFragmentShaderGLSL(const FShaderID &id, char *buffer, const GLSLSha
if (doTextureProjection) {
WRITE(p, " vec4 t = tex.Sample(samp, %sv_texcoord.xy / %sv_texcoord.z)%s;\n", compat.inPrefix, compat.inPrefix, bgraTexture ? ".bgra" : "");
} else {
WRITE(p, " vec4 t = tex.Sample(samp, %s.xy)%s;\n", texcoord.c_str(), bgraTexture ? ".bgra" : "");
WRITE(p, " vec4 t = tex.Sample(samp, %s.xy)%s;\n", texcoord, bgraTexture ? ".bgra" : "");
}
} else if (compat.shaderLanguage == HLSL_D3D9) {
if (doTextureProjection) {
WRITE(p, " vec4 t = tex2Dproj(tex, vec4(%sv_texcoord.x, %sv_texcoord.y, 0, %sv_texcoord.z))%s;\n", compat.inPrefix, compat.inPrefix, compat.inPrefix, bgraTexture ? ".bgra" : "");
} else {
WRITE(p, " vec4 t = tex2D(tex, %s.xy)%s;\n", texcoord.c_str(), bgraTexture ? ".bgra" : "");
WRITE(p, " vec4 t = tex2D(tex, %s.xy)%s;\n", texcoord, bgraTexture ? ".bgra" : "");
}
} else {
if (doTextureProjection) {
WRITE(p, " vec4 t = %sProj(tex, %s);\n", compat.texture, texcoord.c_str());
WRITE(p, " vec4 t = %sProj(tex, %s);\n", compat.texture, texcoord);
} else {
WRITE(p, " vec4 t = %s(tex, %s.xy);\n", compat.texture, texcoord.c_str());
WRITE(p, " vec4 t = %s(tex, %s.xy);\n", compat.texture, texcoord);
}
}
} else {
if (doTextureProjection) {
// We don't use textureProj because we need better control and it's probably not much of a savings anyway.
// However it is good for precision on older hardware like PowerVR.
WRITE(p, " vec2 uv = %s.xy/%s.z;\n vec2 uv_round;\n", texcoord.c_str(), texcoord.c_str());
WRITE(p, " vec2 uv = %s.xy/%s.z;\n vec2 uv_round;\n", texcoord, texcoord);
} else {
WRITE(p, " vec2 uv = %s.xy;\n vec2 uv_round;\n", texcoord.c_str());
WRITE(p, " vec2 uv = %s.xy;\n vec2 uv_round;\n", texcoord);
}
WRITE(p, " vec2 tsize = vec2(textureSize(tex, 0));\n");
WRITE(p, " vec2 fraction;\n");

View File

@ -597,6 +597,9 @@ void ShaderManagerGLES::DetectShaderLanguage() {
compat.glslES30 = true;
compat.bitwiseOps = true;
compat.texelFetch = "texelFetch";
compat.varying_vs = "out";
compat.varying_fs = "in";
compat.attribute = "in";
} else {
compat.shaderLanguage = ShaderLanguage::GLSL_140;
compat.glslVersionNumber = 100; // GLSL ES 1.0
@ -619,6 +622,9 @@ void ShaderManagerGLES::DetectShaderLanguage() {
compat.glslES30 = true;
compat.bitwiseOps = true;
compat.texelFetch = "texelFetch";
compat.varying_vs = "out";
compat.varying_fs = "in";
compat.attribute = "in";
} else if (gl_extensions.VersionGEThan(3, 0, 0)) {
compat.shaderLanguage = ShaderLanguage::GLSL_140;
compat.glslVersionNumber = 130;
@ -652,12 +658,6 @@ void ShaderManagerGLES::DetectShaderLanguage() {
compat.lastFragData = "gl_LastFragColorARM";
}
}
if (compat.glslES30 || gl_extensions.IsCoreContext) {
compat.varying_vs = "out";
compat.varying_fs = "in";
compat.attribute = "in";
}
}
void ShaderManagerGLES::Clear() {