Skip to content
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

nv2a: Replace some non-critical assertions with debug macros #8

Merged
merged 1 commit into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
nv2a: Replace some non-critical assertions with debug macros
In the event these features are utilized, execution may still continue,
albeit with the likely possibility graphical problems of varying degree.
This patch replaces hard assertions with debug print statements when
configured to do so.
  • Loading branch information
mborgerson committed Jun 11, 2020
commit 021e2818e4260522ec85af513d0edfd169a757d2
26 changes: 26 additions & 0 deletions hw/xbox/nv2a/nv2a_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,30 @@ void gl_debug_frame_terminator(void);
# define NV2A_GL_DFRAME_TERMINATOR() do { } while (0)
#endif

/* Debug prints to identify when unimplemented or unconfirmed features
* are being exercised. These cases likely result in graphical problems of
* varying degree, but should otherwise not crash the system. Enable this
* macro for debugging.
*/
// #define DEBUG_NV2A_FEATURES 1

#ifdef DEBUG_NV2A_FEATURES

/* Feature which has not yet been confirmed */
#define NV2A_UNCONFIRMED(format, ...) do { \
fprintf(stderr, "nv2a: Warning unconfirmed feature: " format "\n", ## __VA_ARGS__); \
} while (0)

/* Feature which is not implemented */
#define NV2A_UNIMPLEMENTED(format, ...) do { \
fprintf(stderr, "nv2a: Warning unimplemented feature: " format "\n", ## __VA_ARGS__); \
} while (0)

#else

#define NV2A_UNCONFIRMED(...) do {} while (0)
#define NV2A_UNIMPLEMENTED(...) do {} while (0)

#endif

#endif
10 changes: 5 additions & 5 deletions hw/xbox/nv2a/nv2a_pgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ static void pgraph_method(NV2AState *d,

} else {
NV2A_GL_DPRINTF(true, "EMPTY NV097_SET_BEGIN_END");
assert(false);
NV2A_UNCONFIRMED("EMPTY NV097_SET_BEGIN_END");
}

/* End of visibility testing */
Expand Down Expand Up @@ -3650,10 +3650,10 @@ static void pgraph_bind_textures(NV2AState *d)
}

/* Check for unsupported features */
assert(!(filter & NV_PGRAPH_TEXFILTER0_ASIGNED));
assert(!(filter & NV_PGRAPH_TEXFILTER0_RSIGNED));
assert(!(filter & NV_PGRAPH_TEXFILTER0_GSIGNED));
assert(!(filter & NV_PGRAPH_TEXFILTER0_BSIGNED));
if (filter & NV_PGRAPH_TEXFILTER0_ASIGNED) NV2A_UNIMPLEMENTED("NV_PGRAPH_TEXFILTER0_ASIGNED");
if (filter & NV_PGRAPH_TEXFILTER0_RSIGNED) NV2A_UNIMPLEMENTED("NV_PGRAPH_TEXFILTER0_RSIGNED");
if (filter & NV_PGRAPH_TEXFILTER0_GSIGNED) NV2A_UNIMPLEMENTED("NV_PGRAPH_TEXFILTER0_GSIGNED");
if (filter & NV_PGRAPH_TEXFILTER0_BSIGNED) NV2A_UNIMPLEMENTED("NV_PGRAPH_TEXFILTER0_BSIGNED");

glActiveTexture(GL_TEXTURE0 + i);
if (!enabled) {
Expand Down
16 changes: 8 additions & 8 deletions hw/xbox/nv2a/nv2a_psh.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,37 +647,37 @@ static QString* psh_convert(struct PixelShader *ps)
case PS_TEXTUREMODES_BRDF:
qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_BRDF */\n",
i);
assert(false); /* Unimplemented */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_BRDF");
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 */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_ST");
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 */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_ZW");
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 */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_RFLCT_DIFF");
break;
case PS_TEXTUREMODES_DOT_RFLCT_SPEC:
qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_RFLCT_SPEC */\n",
i);
assert(false); /* Unimplemented */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_RFLCT_SPEC");
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 */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_STR_3D");
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 */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_STR_CUBE");
break;
case PS_TEXTUREMODES_DPNDNT_AR:
assert(!ps->state.rect_tex[i]);
Expand All @@ -698,7 +698,7 @@ static QString* psh_convert(struct PixelShader *ps)
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 */
NV2A_UNIMPLEMENTED("PS_TEXTUREMODES_DOT_RFLCT_SPEC_CONST");
break;
default:
fprintf(stderr, "Unknown ps tex mode: 0x%x\n", ps->tex_modes[i]);
Expand Down
1 change: 0 additions & 1 deletion hw/xbox/nv2a/nv2a_shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "qemu/osdep.h"
#include "qemu-common.h"
#include "nv2a_debug.h"
#include "nv2a_shaders_common.h"
#include "nv2a_shaders.h"

Expand Down
2 changes: 2 additions & 0 deletions hw/xbox/nv2a/nv2a_shaders_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#ifndef HW_NV2A_SHADERS_COMMON_H
#define HW_NV2A_SHADERS_COMMON_H

#include "nv2a_debug.h"

#define STRUCT_VERTEX_DATA "struct VertexData {\n" \
" float inv_w;\n" \
" vec4 D0;\n" \
Expand Down