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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780>
This commit is contained in:
Jesse Natalie 2020-11-25 16:57:47 -08:00 committed by Marge Bot
parent c3bf781cb0
commit 6060291c0e
4 changed files with 12 additions and 12 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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 ||

View file

@ -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;