diff --git a/hw/xbox/dsp/dsp_dma.c b/hw/xbox/dsp/dsp_dma.c index 2097b97875..667134ecb9 100644 --- a/hw/xbox/dsp/dsp_dma.c +++ b/hw/xbox/dsp/dsp_dma.c @@ -96,6 +96,7 @@ static void dsp_dma_run(DSPDMAState *s) item_mask = 0x00FFFFFF; break; default: + fprintf(stderr, "Unknown dsp dma format: 0x%x\n", format); assert(false); break; } diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index 21a8397525..c80084ea95 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -2820,7 +2820,9 @@ static void pgraph_method(NV2AState *d, bytes_per_pixel = 4; break; default: + fprintf(stderr, "Unknown blit surface format: 0x%x\n", context_surfaces->color_format); assert(false); + break; } hwaddr source_dma_len, dest_dma_len; @@ -3223,6 +3225,7 @@ static void pgraph_method(NV2AState *d, case NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_CONSTANT_ALPHA: factor = NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_CONSTANT_ALPHA; break; default: + fprintf(stderr, "Unknown blend source factor: 0x%x\n", parameter); assert(false); break; } @@ -3265,6 +3268,7 @@ static void pgraph_method(NV2AState *d, case NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_CONSTANT_ALPHA: factor = NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_CONSTANT_ALPHA; break; default: + fprintf(stderr, "Unknown blend destination factor: 0x%x\n", parameter); assert(false); break; } @@ -3411,6 +3415,7 @@ static void pgraph_method(NV2AState *d, case NV097_SET_FRONT_FACE_V_CCW: ccw = true; break; default: + fprintf(stderr, "Unknown front face: 0x%x\n", parameter); assert(false); break; } @@ -3845,6 +3850,7 @@ static void pgraph_method(NV2AState *d, vertex_attribute->converted_count = 3 * vertex_attribute->count; break; default: + fprintf(stderr, "Unknown vertex type: 0x%x\n", vertex_attribute->format); assert(false); break; } @@ -4556,6 +4562,7 @@ static void pgraph_method(NV2AState *d, break; } default: + fprintf(stderr, "Unknown zeta surface format: 0x%x\n", pg->surface_shape.zeta_format); assert(false); break; } diff --git a/hw/xbox/nv2a_psh.c b/hw/xbox/nv2a_psh.c index cf5e3222b9..40775b576e 100644 --- a/hw/xbox/nv2a_psh.c +++ b/hw/xbox/nv2a_psh.c @@ -585,8 +585,73 @@ static QString* psh_convert(struct PixelShader *ps) case PS_TEXTUREMODES_PASSTHRU: qstring_append_fmt(vars, "vec4 t%d = pT%d;\n", i, i); break; + case PS_TEXTUREMODES_CLIPPLANE: { + int j; + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_CLIPPLANE */\n", + i); + for (j = 0; j < 4; j++) { + qstring_append_fmt(vars, " if(pT%d.%c %s 0.0) { discard; };\n", + i, "xyzw"[j], + ps->state.compare_mode[i][j] ? ">=" : "<"); + } + break; + } + case PS_TEXTUREMODES_BUMPENVMAP: + assert(!ps->state.rect_tex[i]); + sampler_type = "sampler2D"; + qstring_append_fmt(preflight, "uniform mat2 bumpMat%d;\n", i); + /* FIXME: Do bumpMat swizzle on CPU before upload */ + qstring_append_fmt(vars, "vec4 t%d = texture(texSamp%d, pT%d.xy + t%d.rg * mat2(bumpMat%d[0].xy,bumpMat%d[1].yx));\n", + i, i, i, ps->input_tex[i], i, i); + break; + case PS_TEXTUREMODES_BUMPENVMAP_LUM: + qstring_append_fmt(preflight, "uniform float bumpScale%d;\n", i); + qstring_append_fmt(preflight, "uniform float bumpOffset%d;\n", i); + qstring_append_fmt(ps->code, "/* BUMPENVMAP_LUM for stage %d */\n", i); + qstring_append_fmt(ps->code, "t%d = t%d * (bumpScale%d * t%d.b + bumpOffset%d);\n", + i, i, i, ps->input_tex[i], i); + /* Now the same as BUMPENVMAP */ + assert(!ps->state.rect_tex[i]); + sampler_type = "sampler2D"; + qstring_append_fmt(preflight, "uniform mat2 bumpMat%d;\n", i); + /* FIXME: Do bumpMat swizzle on CPU before upload */ + qstring_append_fmt(vars, "vec4 t%d = texture(texSamp%d, pT%d.xy + t%d.rg * mat2(bumpMat%d[0].xy,bumpMat%d[1].yx));\n", + i, i, i, ps->input_tex[i], i, i); + break; + case PS_TEXTUREMODES_BRDF: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_BRDF */\n", + i); + assert(false); /* Unimplemented */ + break; + case PS_TEXTUREMODES_DOT_ST: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_ST */\n", + i); + assert(false); /* Unimplemented */ + break; + case PS_TEXTUREMODES_DOT_ZW: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_ZW */\n", + i); + assert(false); /* Unimplemented */ + break; + case PS_TEXTUREMODES_DOT_RFLCT_DIFF: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_RFLCT_DIFF */\n", + i); + assert(false); /* Unimplemented */ + break; case PS_TEXTUREMODES_DOT_RFLCT_SPEC: - assert(false); + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_RFLCT_SPEC */\n", + i); + assert(false); /* Unimplemented */ + break; + case PS_TEXTUREMODES_DOT_STR_3D: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_STR_3D */\n", + i); + assert(false); /* Unimplemented */ + break; + case PS_TEXTUREMODES_DOT_STR_CUBE: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_STR_CUBE */\n", + i); + assert(false); /* Unimplemented */ break; case PS_TEXTUREMODES_DPNDNT_AR: assert(!ps->state.rect_tex[i]); @@ -600,38 +665,17 @@ static QString* psh_convert(struct PixelShader *ps) qstring_append_fmt(vars, "vec4 t%d = texture(texSamp%d, t%d.gb);\n", i, i, ps->input_tex[i]); break; - case PS_TEXTUREMODES_BUMPENVMAP_LUM: - qstring_append_fmt(preflight, "uniform float bumpScale%d;\n", i); - qstring_append_fmt(preflight, "uniform float bumpOffset%d;\n", i); - qstring_append_fmt(ps->code, "/* BUMPENVMAP_LUM for stage %d */\n", i); - qstring_append_fmt(ps->code, "t%d = t%d * (bumpScale%d * t%d.b + bumpOffset%d);\n", - i, i, i, ps->input_tex[i], i); - /* No break here! Extension of BUMPENVMAP */ - case PS_TEXTUREMODES_BUMPENVMAP: - assert(!ps->state.rect_tex[i]); - sampler_type = "sampler2D"; - qstring_append_fmt(preflight, "uniform mat2 bumpMat%d;\n", i); - /* FIXME: Do bumpMat swizzle on CPU before upload */ - qstring_append_fmt(vars, "vec4 t%d = texture(texSamp%d, pT%d.xy + t%d.rg * mat2(bumpMat%d[0].xy,bumpMat%d[1].yx));\n", - i, i, i, ps->input_tex[i], i, i); - break; - case PS_TEXTUREMODES_CLIPPLANE: { - int j; - qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_CLIPPLANE */\n", - i); - for (j = 0; j < 4; j++) { - qstring_append_fmt(vars, " if(pT%d.%c %s 0.0) { discard; };\n", - i, "xyzw"[j], - ps->state.compare_mode[i][j] ? ">=" : "<"); - } - break; - } case PS_TEXTUREMODES_DOTPRODUCT: qstring_append_fmt(vars, "vec4 t%d = vec4(dot(pT%d.xyz, t%d.rgb));\n", i, i, ps->input_tex[i]); break; + case PS_TEXTUREMODES_DOT_RFLCT_SPEC_CONST: + qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_RFLCT_SPEC_CONST */\n", + i); + assert(false); /* Unimplemented */ + break; default: - printf("%x\n", ps->tex_modes[i]); + fprintf(stderr, "Unknown ps tex mode: 0x%x\n", ps->tex_modes[i]); assert(false); break; } diff --git a/hw/xbox/nv2a_vsh.c b/hw/xbox/nv2a_vsh.c index 8de65963cc..bf3f5f3bf3 100644 --- a/hw/xbox/nv2a_vsh.c +++ b/hw/xbox/nv2a_vsh.c @@ -363,8 +363,9 @@ static QString* decode_opcode_input(const uint32_t *shader_token, } break; default: - printf("Param: 0x%x\n", param); + fprintf(stderr, "Unknown vs param: 0x%x\n", param); assert(false); + break; } qstring_append(ret_str, tmp);