d3d12: Remove Windows-specific macros

These all have trivial standard or Mesa replacements

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 17:05:29 -08:00 committed by Marge Bot
parent 4358af87e7
commit 244a41d6a8
7 changed files with 13 additions and 12 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -30,6 +30,7 @@
#include "util/rb_tree.h"
#include <assert.h>
#include <stdio.h>
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<vector<%s, 4>%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<vector<%s, 4>%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);
}

View file

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

View file

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