diff --git a/src/gallium/drivers/d3d12/d3d12_blit.cpp b/src/gallium/drivers/d3d12/d3d12_blit.cpp index fbb277b1160..4664511ee6c 100644 --- a/src/gallium/drivers/d3d12/d3d12_blit.cpp +++ b/src/gallium/drivers/d3d12/d3d12_blit.cpp @@ -304,7 +304,7 @@ copy_subregion_no_barriers(struct d3d12_context *ctx, } static_assert(PIPE_MASK_S == 0x20 && PIPE_MASK_Z == 0x10, "unexpected ZS format mask"); - int nsubres = min(src_nres, dst_nres); + int nsubres = MIN2(src_nres, dst_nres); unsigned subresource_copy_mask = nsubres > 1 ? mask >> 4 : 1; for (int subres = 0; subres < nsubres; ++subres) { diff --git a/src/gallium/drivers/d3d12/d3d12_draw.cpp b/src/gallium/drivers/d3d12/d3d12_draw.cpp index dbbbd25605b..4de3b09798b 100644 --- a/src/gallium/drivers/d3d12/d3d12_draw.cpp +++ b/src/gallium/drivers/d3d12/d3d12_draw.cpp @@ -66,8 +66,8 @@ fill_cbv_descriptors(struct d3d12_context *ctx, d3d12_transition_resource_state(ctx, res, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); D3D12_CONSTANT_BUFFER_VIEW_DESC cbv_desc = {}; cbv_desc.BufferLocation = d3d12_resource_gpu_virtual_address(res) + buffer->buffer_offset; - cbv_desc.SizeInBytes = min(D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * 16, - align(buffer->buffer_size, 256)); + cbv_desc.SizeInBytes = MIN2(D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * 16, + align(buffer->buffer_size, 256)); d3d12_batch_reference_resource(batch, res); struct d3d12_descriptor_handle handle; diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.c b/src/gallium/drivers/d3d12/d3d12_nir_passes.c index 94c784c7c08..360f4d1da89 100644 --- a/src/gallium/drivers/d3d12/d3d12_nir_passes.c +++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.c @@ -477,7 +477,7 @@ d3d12_lower_state_vars(nir_shader *nir, struct d3d12_shader *shader) * exists it will be replaced by using the same binding. * In the event there are no other UBO's, use binding slot 1 to * be consistent with other non-default UBO's */ - unsigned binding = max(nir->info.num_ubos, 1); + unsigned binding = MAX2(nir->info.num_ubos, 1); nir_foreach_variable_with_modes_safe(var, nir, nir_var_uniform) { if (var->num_state_slots == 1 && diff --git a/src/microsoft/compiler/dxil_function.c b/src/microsoft/compiler/dxil_function.c index ef2a06980b6..b87c4509eab 100644 --- a/src/microsoft/compiler/dxil_function.c +++ b/src/microsoft/compiler/dxil_function.c @@ -107,7 +107,7 @@ allocate_function_from_predefined(struct dxil_module *mod, const char *name, enum overload_type overload) { - for (unsigned i = 0; i < ARRAYSIZE(predefined_funcs); ++i) { + for (unsigned i = 0; i < ARRAY_SIZE(predefined_funcs); ++i) { if (!strcmp(predefined_funcs[i].base_name, name)) { return dxil_alloc_func(mod, name, overload, predefined_funcs[i].retval_descr, diff --git a/src/microsoft/compiler/dxil_module.c b/src/microsoft/compiler/dxil_module.c index 6f2494bf980..8d856425da7 100644 --- a/src/microsoft/compiler/dxil_module.c +++ b/src/microsoft/compiler/dxil_module.c @@ -30,6 +30,7 @@ #include "util/rb_tree.h" #include +#include void dxil_module_init(struct dxil_module *m, void *ralloc_ctx) @@ -811,11 +812,11 @@ dxil_module_get_res_type(struct dxil_module *m, enum dxil_resource_kind kind, const struct dxil_type *component_type = dxil_module_get_type_from_comp_type(m, comp_type); const struct dxil_type *vec_type = dxil_module_get_vector_type(m, component_type, 4); char class_name[64] = { 0 }; - sprintf_s(class_name, 64, "class.%s%s%s>", - readwrite ? "RW" : "", - get_res_dimension_type_name(kind), - get_res_comp_type_name(comp_type), - get_res_ms_postfix(kind)); + snprintf(class_name, 64, "class.%s%s%s>", + readwrite ? "RW" : "", + get_res_dimension_type_name(kind), + get_res_comp_type_name(comp_type), + get_res_ms_postfix(kind)); return dxil_module_get_struct_type(m, class_name, &vec_type, 1); } diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index afee5a472de..023f4d714fa 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -4019,7 +4019,7 @@ emit_module(struct ntd_context *ctx, nir_shader *s, const struct nir_to_dxil_opt } if (ctx->mod.feats.native_low_precision) - ctx->mod.minor_version = max(ctx->mod.minor_version, 2); + ctx->mod.minor_version = MAX2(ctx->mod.minor_version, 2); return emit_metadata(ctx, s) && dxil_emit_module(&ctx->mod); diff --git a/src/microsoft/resource_state_manager/D3D12ResourceState.cpp b/src/microsoft/resource_state_manager/D3D12ResourceState.cpp index 54872226ef9..528e672fa36 100644 --- a/src/microsoft/resource_state_manager/D3D12ResourceState.cpp +++ b/src/microsoft/resource_state_manager/D3D12ResourceState.cpp @@ -256,7 +256,7 @@ void ResourceStateManager::ProcessTransitioningResource(ID3D12Resource* pTransit bool bAllSubresourcesAtOnce = CurrentState.AreAllSubresourcesSame() && DestinationState.AreAllSubresourcesSame(); D3D12_RESOURCE_BARRIER TransitionDesc; - ZeroMemory(&TransitionDesc, sizeof(TransitionDesc)); + memset(&TransitionDesc, 0, sizeof(TransitionDesc)); TransitionDesc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; TransitionDesc.Transition.pResource = pTransitioningResource;