mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Seems we need high precision for fog on PowerVR. #4287 might be fixed by this.
This commit is contained in:
parent
1595ac3386
commit
5d47aabb08
2 changed files with 11 additions and 10 deletions
|
@ -195,7 +195,6 @@ void ComputeFragmentShaderID(FragmentShaderID *id) {
|
|||
}
|
||||
|
||||
// Missing: Z depth range
|
||||
// Also, logic ops etc, of course. Urgh.
|
||||
void GenerateFragmentShader(char *buffer) {
|
||||
char *p = buffer;
|
||||
|
||||
|
@ -235,7 +234,7 @@ void GenerateFragmentShader(char *buffer) {
|
|||
if (enableAlphaTest || enableColorTest) {
|
||||
WRITE(p, "uniform vec4 u_alphacolorref;\n");
|
||||
}
|
||||
if (gstate.isTextureMapEnabled())
|
||||
if (gstate.isTextureMapEnabled() && gstate.getTextureFunction() == GE_TEXFUNC_BLEND)
|
||||
WRITE(p, "uniform lowp vec3 u_texenv;\n");
|
||||
|
||||
WRITE(p, "varying lowp vec4 v_color0;\n");
|
||||
|
@ -243,7 +242,7 @@ void GenerateFragmentShader(char *buffer) {
|
|||
WRITE(p, "varying lowp vec3 v_color1;\n");
|
||||
if (enableFog) {
|
||||
WRITE(p, "uniform lowp vec3 u_fogcolor;\n");
|
||||
WRITE(p, "varying mediump float v_fogdepth;\n");
|
||||
WRITE(p, "varying highp float v_fogdepth;\n");
|
||||
}
|
||||
if (doTexture)
|
||||
{
|
||||
|
@ -356,9 +355,9 @@ void GenerateFragmentShader(char *buffer) {
|
|||
u32 colorTestMask = gstate.getColorTestMask();
|
||||
if (colorTestFuncs[colorTestFunc][0] != '#') {
|
||||
if (gl_extensions.gpuVendor == GPU_VENDOR_POWERVR)
|
||||
WRITE(p, "if (roundTo255thv(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
|
||||
WRITE(p, " if (roundTo255thv(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
|
||||
else
|
||||
WRITE(p, "if (roundAndScaleTo255v(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
|
||||
WRITE(p, " if (roundAndScaleTo255v(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,10 +143,12 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
|||
// Remove lowp/mediump in non-mobile implementations
|
||||
WRITE(p, "#define lowp\n");
|
||||
WRITE(p, "#define mediump\n");
|
||||
WRITE(p, "#define highp\n");
|
||||
#else
|
||||
// Need to remove lowp/mediump for Mac
|
||||
WRITE(p, "#define lowp\n");
|
||||
WRITE(p, "#define mediump\n");
|
||||
WRITE(p, "#define highp\n");
|
||||
#endif
|
||||
|
||||
int lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
|
@ -203,6 +205,8 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
|||
// Add all the uniforms we'll need to transform properly.
|
||||
}
|
||||
|
||||
bool prescale = g_Config.bPrescaleUV && !throughmode && gstate.getTextureFunction() == 0;
|
||||
|
||||
if (useHWTransform) {
|
||||
// When transforming by hardware, we need a great deal more uniforms...
|
||||
WRITE(p, "uniform mat4 u_world;\n");
|
||||
|
@ -219,7 +223,7 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
|||
}
|
||||
#endif
|
||||
}
|
||||
if (doTexture) {
|
||||
if (doTexture && (!prescale || gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP)) {
|
||||
WRITE(p, "uniform vec4 u_uvscaleoffset;\n");
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -259,7 +263,7 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
|||
WRITE(p, "uniform lowp vec4 u_matambientalpha;\n"); // matambient + matalpha
|
||||
|
||||
if (enableFog) {
|
||||
WRITE(p, "uniform mediump vec2 u_fogcoef;\n");
|
||||
WRITE(p, "uniform highp vec2 u_fogcoef;\n");
|
||||
}
|
||||
|
||||
WRITE(p, "varying lowp vec4 v_color0;\n");
|
||||
|
@ -270,7 +274,7 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
|||
else
|
||||
WRITE(p, "varying mediump vec2 v_texcoord;\n");
|
||||
}
|
||||
if (enableFog) WRITE(p, "varying mediump float v_fogdepth;\n");
|
||||
if (enableFog) WRITE(p, "varying highp float v_fogdepth;\n");
|
||||
|
||||
WRITE(p, "void main() {\n");
|
||||
|
||||
|
@ -518,8 +522,6 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
|||
|
||||
// Step 3: UV generation
|
||||
if (doTexture) {
|
||||
bool prescale = g_Config.bPrescaleUV && !throughmode && gstate.getTextureFunction() == 0;
|
||||
|
||||
switch (gstate.getUVGenMode()) {
|
||||
case GE_TEXMAP_TEXTURE_COORDS: // Scale-offset. Easy.
|
||||
case GE_TEXMAP_UNKNOWN: // Not sure what this is, but Riviera uses it. Treating as coords works.
|
||||
|
|
Loading…
Add table
Reference in a new issue