Re: [PATCH 2/2] wined3d: Print opcode names instead of enum values.
On 3 December 2015 at 11:04, Józef Kucia <jkucia(a)codeweavers.com> wrote:
+const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx) +{ + if (handler_idx >= sizeof(shader_opcode_names) / sizeof(*shader_opcode_names)) + { + FIXME("Unrecognized shader instruction handler %#x.\n", handler_idx); + return "UNRECOGNIZED"; You can do something like "wine_dbg_sprintf("UNRECOGNIZED(%#x)", handler_idx);" and have it print the handler_idx. (See also e.g. debug_d3dstate().) Note that we could also move this to utils.c, not sure if that's worth it.
On Thu, Dec 3, 2015 at 4:48 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
On 3 December 2015 at 11:04, Józef Kucia <jkucia(a)codeweavers.com> wrote:
+const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx) +{ + if (handler_idx >= sizeof(shader_opcode_names) / sizeof(*shader_opcode_names)) + { + FIXME("Unrecognized shader instruction handler %#x.\n", handler_idx); + return "UNRECOGNIZED"; You can do something like "wine_dbg_sprintf("UNRECOGNIZED(%#x)", handler_idx);" and have it print the handler_idx. (See also e.g. debug_d3dstate().) Note that we could also move this to utils.c, not sure if that's worth it.
I agree that wine_dbg_sprintf is probably better. However this code should never be executed unless something is very wrong.
participants (2)
-
Henri Verbeet -
Józef Kucia