-
-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ford racing 2 crashes due to shader compilation failure #316
Comments
Seems very similar to #315 - please consider merging these issues into one. |
I was going to but they crash for different reasons |
I would just separate the logs for the games and combine both of them into the same issue post labelled “Games Crashing Due to Shader Compilation Errors” with both title links listed and your hw info, just to tidy up the issue area. As they are both pretty similar and linked to Shader Comp Errors |
should i add it to #54? |
ok squashed |
Title Information
Ford Racing 2-https://xemu.app/titles/454d0007/
Failing Fragment Shader from Ford Racing 2
#version 330
struct VertexData {
float inv_w;
vec4 D0;
vec4 D1;
vec4 B0;
vec4 B1;
float Fog;
vec4 T0;
vec4 T1;
vec4 T2;
vec4 T3;
};
noperspective in VertexData g_vtx;
#define vtx g_vtx
out vec4 fragColor;
uniform vec4 fogColor;
float sign1(float x) {
x *= 255.0;
return (x-128.0)/127.0;
}
float sign2(float x) {
x *= 255.0;
if (x >= 128.0) return (x-255.5)/127.5;
else return (x+0.5)/127.5;
}
float sign3(float x) {
x *= 255.0;
if (x >= 128.0) return (x-256.0)/127.0;
else return (x)/127.0;
}
float sign3_to_0_to_1(float x) {
if (x >= 0) return x/2;
else return 1+x/2;
}
vec3 dotmap_zero_to_one(vec3 col) {
return col;
}
vec3 dotmap_minus1_to_1_d3d(vec3 col) {
return vec3(sign1(col.r),sign1(col.g),sign1(col.b));
}
vec3 dotmap_minus1_to_1_gl(vec3 col) {
return vec3(sign2(col.r),sign2(col.g),sign2(col.b));
}
vec3 dotmap_minus1_to_1(vec3 col) {
return vec3(sign3(col.r),sign3(col.g),sign3(col.b));
}
vec3 dotmap_hilo_1(vec3 col) {
return col;
}
vec3 dotmap_hilo_hemisphere_d3d(vec3 col) {
return col;
}
vec3 dotmap_hilo_hemisphere_gl(vec3 col) {
return col;
}
vec3 dotmap_hilo_hemisphere(vec3 col) {
return col;
}
const float[9] gaussian3x3 = float[9](
1.0/16.0, 2.0/16.0, 1.0/16.0,
2.0/16.0, 4.0/16.0, 2.0/16.0,
1.0/16.0, 2.0/16.0, 1.0/16.0);
const vec2[9] convolution3x3 = vec2[9](
vec2(-1.0,-1.0),vec2(0.0,-1.0),vec2(1.0,-1.0),
vec2(-1.0, 0.0),vec2(0.0, 0.0),vec2(1.0, 0.0),
vec2(-1.0, 1.0),vec2(0.0, 1.0),vec2(1.0, 1.0));
vec4 gaussianFilter2DRectProj(sampler2DRect sampler, vec3 texCoord) {
vec4 sum = vec4(0.0);
for (int i = 0; i < 9; i++) {
sum += gaussian3x3[i]textureProj(sampler,
texCoord + vec3(convolution3x3[i], 0.0));
}
return sum;
}
uniform ivec4 clipRegion[1];
uniform sampler2D texSamp0;
uniform sampler2D texSamp2;
uniform sampler2DRect texSamp3;
uniform float alphaRef;
void main() {
/ Window-clip (Inclusive) */
bool clipContained = false;
for (int i = 0; i < 1; i++) {
bvec4 clipTest = bvec4(lessThan(gl_FragCoord.xy, clipRegion[i].xy),
greaterThan(gl_FragCoord.xy, clipRegion[i].zw));
if (!any(clipTest)) {
clipContained = true;
break;
}
}
if (!clipContained) { discard; }
vec4 pD0 = vtx.D0 / vtx.inv_w;
vec4 pD1 = vtx.D1 / vtx.inv_w;
vec4 pB0 = vtx.B0 / vtx.inv_w;
vec4 pB1 = vtx.B1 / vtx.inv_w;
vec4 pFog = vec4(fogColor.rgb, clamp(vtx.Fog / vtx.inv_w, 0.0, 1.0));
vec4 pT0 = vtx.T0 / vtx.inv_w;
vec4 pT1 = vtx.T1 / vtx.inv_w;
vec4 pT2 = vtx.T2 / vtx.inv_w;
vec4 pT3 = vtx.T3 / vtx.inv_w;
vec4 v0 = pD0;
vec4 v1 = pD1;
vec4 t0 = textureProj(texSamp0, pT0.xyw);
/* PS_TEXTUREMODES_DOTPRODUCT /
float dot1 = dot(pT1.xyz, dotmap_minus1_to_1_d3d(t0.rgb));
vec4 t1 = vec4(0.0);
/ PS_TEXTUREMODES_DOT_ST */
float dot2 = dot(pT2.xyz, dotmap_minus1_to_1_d3d(t0.rgb));
vec4 t2 = texture(texSamp2, vec2(dot1, dot2));
vec4 t3 = textureProj(texSamp3, pT3.xyw);
vec4 r0;
r0.a = t0.a;
// Stage 0
(max(t3.aaa, 0.0) * max(t3.aaa, 0.0)).a = (max(t3.aaa, 0.0) * max(t3.aaa, 0.0)).b;
r0.a = clamp(((max(t3.a, 0.0) * max(t3.a, 0.0))), -1.0, 1.0);
// Stage 1
r0.a = clamp(((max(r0.a, 0.0) * max(r0.a, 0.0))), -1.0, 1.0);
// Final Combiner
fragColor.rgb = max(vec4(0.0).rgb, 0.0) + mix(vec3(max(pFog.rgb, 0.0)), vec3(max(t2.rgb, 0.0)), vec3(max(pFog.aaa, 0.0)));
fragColor.a = max(r0.a, 0.0);
if (!(fragColor.a >= alphaRef)) discard;
}
nv2a: fragment shader compilation failed: Fragment shader failed to compile with the following errors:
ERROR: 0:119: error(# 216) Vector field selection out of range "a"
ERROR: 0:119: error(# 164) l-value required: assign
ERROR: error(# 273) 2 compilation errors. No code generated
Bug Description
Game crash when creating a save due to shader compilation failure.
Steps to reproduce this issue:
Expected Behavior
you should make to the main menu
System Information
The text was updated successfully, but these errors were encountered: