Mesa (master): d3d12: Fix brace-initialization issues
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 1 17:19:59 UTC 2020
Module: Mesa
Branch: master
Commit: 6060291c0e386118b8ae115189d0b0da3bdd4a54
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6060291c0e386118b8ae115189d0b0da3bdd4a54
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Wed Nov 25 16:57:47 2020 -0800
d3d12: Fix brace-initialization issues
For C++ code, we shouldn't use {0}, instead use {} to default-
initialize everything. For code with nested structs/unions, make
sure there's enough braces to appropriately scope initialization.
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780>
---
src/gallium/drivers/d3d12/d3d12_blit.cpp | 4 ++--
src/gallium/drivers/d3d12/d3d12_context.cpp | 2 +-
src/gallium/drivers/d3d12/d3d12_draw.cpp | 2 +-
src/microsoft/compiler/dxil_module.c | 16 ++++++++--------
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/d3d12/d3d12_blit.cpp b/src/gallium/drivers/d3d12/d3d12_blit.cpp
index 04428a3a2ad..c7be8505091 100644
--- a/src/gallium/drivers/d3d12/d3d12_blit.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_blit.cpp
@@ -628,7 +628,7 @@ get_stencil_resolve_vs(struct d3d12_context *ctx)
nir_store_var(&b, pos_out, nir_load_var(&b, pos_in), 0xf);
- struct pipe_shader_state state = { 0 };
+ struct pipe_shader_state state = {};
state.type = PIPE_SHADER_IR_NIR;
state.ir.nir = b.shader;
ctx->stencil_resolve_vs = ctx->base.create_vs_state(&ctx->base, &state);
@@ -684,7 +684,7 @@ get_stencil_resolve_fs(struct d3d12_context *ctx)
nir_store_var(&b, stencil_out, nir_channel(&b, &tex->dest.ssa, 1), 0x1);
- struct pipe_shader_state state = { 0 };
+ struct pipe_shader_state state = {};
state.type = PIPE_SHADER_IR_NIR;
state.ir.nir = b.shader;
ctx->stencil_resolve_fs = ctx->base.create_fs_state(&ctx->base, &state);
diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp
index 33f5329612c..341c8c0a951 100644
--- a/src/gallium/drivers/d3d12/d3d12_context.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_context.cpp
@@ -617,7 +617,7 @@ d3d12_create_sampler_state(struct pipe_context *pctx,
struct d3d12_context *ctx = d3d12_context(pctx);
struct d3d12_screen *screen = d3d12_screen(pctx->screen);
struct d3d12_sampler_state *ss = CALLOC_STRUCT(d3d12_sampler_state);
- D3D12_SAMPLER_DESC desc = {0};
+ D3D12_SAMPLER_DESC desc = {};
if (!state)
return NULL;
diff --git a/src/gallium/drivers/d3d12/d3d12_draw.cpp b/src/gallium/drivers/d3d12/d3d12_draw.cpp
index f7c0ffd16e8..139c9352580 100644
--- a/src/gallium/drivers/d3d12/d3d12_draw.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_draw.cpp
@@ -430,7 +430,7 @@ d3d12_draw_vbo(struct pipe_context *pctx,
struct d3d12_batch *batch;
struct pipe_resource *index_buffer = NULL;
unsigned index_offset = 0;
- enum d3d12_surface_conversion_mode conversion_modes[PIPE_MAX_COLOR_BUFS] = {0};
+ enum d3d12_surface_conversion_mode conversion_modes[PIPE_MAX_COLOR_BUFS] = {};
if (!prim_supported(dinfo->mode) ||
dinfo->index_size == 1 ||
diff --git a/src/microsoft/compiler/dxil_module.c b/src/microsoft/compiler/dxil_module.c
index 262fea3b09f..6f2494bf980 100644
--- a/src/microsoft/compiler/dxil_module.c
+++ b/src/microsoft/compiler/dxil_module.c
@@ -906,12 +906,12 @@ enum type_codes {
TYPE_CODE_FUNCTION = 21
};
-#define LITERAL(x) { DXIL_OP_LITERAL, (x) }
-#define FIXED(x) { DXIL_OP_FIXED, (x) }
-#define VBR(x) { DXIL_OP_VBR, (x) }
-#define ARRAY { DXIL_OP_ARRAY, 0 }
-#define CHAR6 { DXIL_OP_CHAR6, 0 }
-#define BLOB { DXIL_OP_BLOB, 0 }
+#define LITERAL(x) { DXIL_OP_LITERAL, { (x) } }
+#define FIXED(x) { DXIL_OP_FIXED, { (x) } }
+#define VBR(x) { DXIL_OP_VBR, { (x) } }
+#define ARRAY { DXIL_OP_ARRAY, { 0 } }
+#define CHAR6 { DXIL_OP_CHAR6, { 0 } }
+#define BLOB { DXIL_OP_BLOB, { 0 } }
#define TYPE_INDEX FIXED(32)
@@ -1826,8 +1826,8 @@ static unsigned
get_attr_set(struct dxil_module *m, enum dxil_attr_kind attr)
{
struct dxil_attrib attrs[2] = {
- { DXIL_ATTR_ENUM, DXIL_ATTR_KIND_NO_UNWIND },
- { DXIL_ATTR_ENUM, attr }
+ { DXIL_ATTR_ENUM, { DXIL_ATTR_KIND_NO_UNWIND } },
+ { DXIL_ATTR_ENUM, { attr } }
};
int index = 1;
More information about the mesa-commit
mailing list