diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 048749e3099..b6bb1fdd823 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -35,6 +35,8 @@ int u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, enum pipe_cap param) { + assert(param < PIPE_CAP_LAST); + /* Let's keep these sorted by position in p_defines.h. */ switch (param) { case PIPE_CAP_NPOT_TEXTURES: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 6be9dde3039..8b9c58797b7 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -91,6 +91,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) { const uint16_t class_3d = nouveau_screen(pscreen)->class_3d; struct nouveau_device *dev = nouveau_screen(pscreen)->device; + static bool debug_cap_printed[PIPE_CAP_LAST] = {}; switch (param) { /* non-boolean caps */ @@ -389,7 +390,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; default: - debug_printf("%s: unhandled cap %d\n", __func__, param); + if (!debug_cap_printed[param]) { + debug_printf("%s: unhandled cap %d\n", __func__, param); + debug_cap_printed[param] = true; + } /* fallthrough */ /* caps where we want the default value */ case PIPE_CAP_DMABUF: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index 265cc7ecee3..95d8a29d31b 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -109,6 +109,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) const uint16_t class_3d = nouveau_screen(pscreen)->class_3d; const struct nouveau_screen *screen = nouveau_screen(pscreen); struct nouveau_device *dev = screen->device; + static bool debug_cap_printed[PIPE_CAP_LAST] = {}; switch (param) { /* non-boolean caps */ @@ -431,7 +432,10 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; default: - debug_printf("%s: unhandled cap %d\n", __func__, param); + if (!debug_cap_printed[param]) { + debug_printf("%s: unhandled cap %d\n", __func__, param); + debug_cap_printed[param] = true; + } /* fallthrough */ /* caps where we want the default value */ case PIPE_CAP_DMABUF: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 3b984b716ca..db595c73728 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -977,6 +977,9 @@ enum pipe_cap PIPE_CAP_SHADER_ATOMIC_INT64, PIPE_CAP_DEVICE_PROTECTED_CONTENT, PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0, + + PIPE_CAP_LAST, + /* XXX do not add caps after PIPE_CAP_LAST! */ }; /**