diff --git a/renderdoc/driver/d3d12/d3d12_common.cpp b/renderdoc/driver/d3d12/d3d12_common.cpp index 70c6a4bf4..ffbb2bdf4 100644 --- a/renderdoc/driver/d3d12/d3d12_common.cpp +++ b/renderdoc/driver/d3d12/d3d12_common.cpp @@ -32,6 +32,7 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl, ShaderBindpointMapping *mapping) { } + enum D3D12ResourceBarrierSubresource { D3D12AllSubresources = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES @@ -1359,6 +1360,10 @@ string ToStrHelper::Get(const D3D12_TEXTURE_A default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_TEXTURE_ADDRESS_MODE<%d>", el); } @@ -1366,26 +1371,30 @@ string ToStrHelper::Get(const D3D12_BLEND &el) { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_BLEND_ZERO) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_ONE) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_SRC_COLOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_SRC_COLOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_SRC_ALPHA) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_SRC_ALPHA) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_DEST_ALPHA) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_DEST_ALPHA) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_DEST_COLOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_DEST_COLOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_SRC_ALPHA_SAT) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_BLEND_FACTOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_BLEND_FACTOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_SRC1_COLOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_SRC1_COLOR) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_SRC1_ALPHA) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_INV_SRC1_ALPHA) + case D3D12_BLEND_ZERO: return "ZERO"; + case D3D12_BLEND_ONE: return "ONE"; + case D3D12_BLEND_SRC_COLOR: return "SRC_COLOR"; + case D3D12_BLEND_INV_SRC_COLOR: return "INV_SRC_COLOR"; + case D3D12_BLEND_SRC_ALPHA: return "SRC_ALPHA"; + case D3D12_BLEND_INV_SRC_ALPHA: return "INV_SRC_ALPHA"; + case D3D12_BLEND_DEST_ALPHA: return "DEST_ALPHA"; + case D3D12_BLEND_INV_DEST_ALPHA: return "INV_DEST_ALPHA"; + case D3D12_BLEND_DEST_COLOR: return "DEST_COLOR"; + case D3D12_BLEND_INV_DEST_COLOR: return "INV_DEST_COLOR"; + case D3D12_BLEND_SRC_ALPHA_SAT: return "SRC_ALPHA_SAT"; + case D3D12_BLEND_BLEND_FACTOR: return "BLEND_FACTOR"; + case D3D12_BLEND_INV_BLEND_FACTOR: return "INV_BLEND_FACTOR"; + case D3D12_BLEND_SRC1_COLOR: return "SRC1_COLOR"; + case D3D12_BLEND_INV_SRC1_COLOR: return "INV_SRC1_COLOR"; + case D3D12_BLEND_SRC1_ALPHA: return "SRC1_ALPHA"; + case D3D12_BLEND_INV_SRC1_ALPHA: return "INV_SRC1_ALPHA"; default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_BLEND<%d>", el); } @@ -1393,14 +1402,18 @@ string ToStrHelper::Get(const D3D12_BLEND_OP &el) { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_BLEND_OP_ADD) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_OP_SUBTRACT) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_OP_REV_SUBTRACT) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_OP_MIN) - TOSTR_CASE_STRINGIZE(D3D12_BLEND_OP_MAX) + case D3D12_BLEND_OP_ADD: return "ADD"; + case D3D12_BLEND_OP_SUBTRACT: return "SUBTRACT"; + case D3D12_BLEND_OP_REV_SUBTRACT: return "REV_SUBTRACT"; + case D3D12_BLEND_OP_MIN: return "MIN"; + case D3D12_BLEND_OP_MAX: return "MAX"; default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_BLEND_OP<%d>", el); } @@ -1408,22 +1421,22 @@ string ToStrHelper::Get(const D3D12_LOGIC_OP &el) { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_CLEAR) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_SET) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_COPY) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_COPY_INVERTED) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_NOOP) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_INVERT) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_AND) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_NAND) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_OR) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_NOR) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_XOR) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_EQUIV) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_AND_REVERSE) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_AND_INVERTED) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_OR_REVERSE) - TOSTR_CASE_STRINGIZE(D3D12_LOGIC_OP_OR_INVERTED) + case D3D12_LOGIC_OP_CLEAR: return "CLEAR"; + case D3D12_LOGIC_OP_SET: return "SET"; + case D3D12_LOGIC_OP_COPY: return "COPY"; + case D3D12_LOGIC_OP_COPY_INVERTED: return "COPY_INVERTED"; + case D3D12_LOGIC_OP_NOOP: return "NOOP"; + case D3D12_LOGIC_OP_INVERT: return "INVERT"; + case D3D12_LOGIC_OP_AND: return "AND"; + case D3D12_LOGIC_OP_NAND: return "NAND"; + case D3D12_LOGIC_OP_OR: return "OR"; + case D3D12_LOGIC_OP_NOR: return "NOR"; + case D3D12_LOGIC_OP_XOR: return "XOR"; + case D3D12_LOGIC_OP_EQUIV: return "EQUIV"; + case D3D12_LOGIC_OP_AND_REVERSE: return "AND_REVERSE"; + case D3D12_LOGIC_OP_AND_INVERTED: return "AND_INVERTED"; + case D3D12_LOGIC_OP_OR_REVERSE: return "OR_REVERSE"; + case D3D12_LOGIC_OP_OR_INVERTED: return "OR_INVERTED"; default: break; } @@ -1434,11 +1447,15 @@ string ToStrHelper::Get(const D3D12_FILL_MODE &el) { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_FILL_MODE_WIREFRAME) - TOSTR_CASE_STRINGIZE(D3D12_FILL_MODE_SOLID) + case D3D12_FILL_MODE_WIREFRAME: return "WIREFRAME"; + case D3D12_FILL_MODE_SOLID: return "SOLID"; default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_FILL_MODE<%d>", el); } @@ -1446,12 +1463,16 @@ string ToStrHelper::Get(const D3D12_CULL_MODE &el) { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_CULL_MODE_NONE) - TOSTR_CASE_STRINGIZE(D3D12_CULL_MODE_FRONT) - TOSTR_CASE_STRINGIZE(D3D12_CULL_MODE_BACK) + case D3D12_CULL_MODE_NONE: return "NONE"; + case D3D12_CULL_MODE_FRONT: return "FRONT"; + case D3D12_CULL_MODE_BACK: return "BACK"; default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_CULL_MODE<%d>", el); } @@ -1472,17 +1493,21 @@ string ToStrHelper::Get(const D3D12_COMPARISON_FUN { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_NEVER) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_LESS) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_EQUAL) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_LESS_EQUAL) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_GREATER) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_NOT_EQUAL) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_GREATER_EQUAL) - TOSTR_CASE_STRINGIZE(D3D12_COMPARISON_FUNC_ALWAYS) + case D3D12_COMPARISON_FUNC_NEVER: return "NEVER"; + case D3D12_COMPARISON_FUNC_LESS: return "LESS"; + case D3D12_COMPARISON_FUNC_EQUAL: return "EQUAL"; + case D3D12_COMPARISON_FUNC_LESS_EQUAL: return "LESS_EQUAL"; + case D3D12_COMPARISON_FUNC_GREATER: return "GREATER"; + case D3D12_COMPARISON_FUNC_NOT_EQUAL: return "NOT_EQUAL"; + case D3D12_COMPARISON_FUNC_GREATER_EQUAL: return "GREATER_EQUAL"; + case D3D12_COMPARISON_FUNC_ALWAYS: return "ALWAYS"; default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_COMPARISON_FUNC<%d>", el); } @@ -1502,17 +1527,21 @@ string ToStrHelper::Get(const D3D12_STENCIL_OP &el) { switch(el) { - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_KEEP) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_ZERO) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_REPLACE) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_INCR_SAT) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_DECR_SAT) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_INVERT) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_INCR) - TOSTR_CASE_STRINGIZE(D3D12_STENCIL_OP_DECR) + case D3D12_STENCIL_OP_KEEP: return "KEEP"; + case D3D12_STENCIL_OP_ZERO: return "ZERO"; + case D3D12_STENCIL_OP_REPLACE: return "REPLACE"; + case D3D12_STENCIL_OP_INCR_SAT: return "INCR_SAT"; + case D3D12_STENCIL_OP_DECR_SAT: return "DECR_SAT"; + case D3D12_STENCIL_OP_INVERT: return "INVERT"; + case D3D12_STENCIL_OP_INCR: return "INCR"; + case D3D12_STENCIL_OP_DECR: return "DECR"; default: break; } + // possible for unused fields via 0-initialisation + if((int)el == 0) + return "--"; + return StringFormat::Fmt("D3D12_STENCIL_OP<%d>", el); }