1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[util] Replace countof with std::size

This commit is contained in:
Georg Lehmann 2021-09-10 09:39:14 +02:00 committed by Joshie
parent 5f9d5f1053
commit 827c7a892c
5 changed files with 6 additions and 15 deletions

View File

@ -69,9 +69,9 @@ namespace dxvk {
const char* desc = options.customDeviceDesc.empty() ? props.deviceName : options.customDeviceDesc.c_str();
const char* driver = GetDriverDLL(DxvkGpuVendor(vendorId));
std::strncpy(pIdentifier->Description, desc, countof(pIdentifier->Description));
std::strncpy(pIdentifier->DeviceName, device.DeviceName, countof(pIdentifier->DeviceName)); // The GDI device name. Not the actual device name.
std::strncpy(pIdentifier->Driver, driver, countof(pIdentifier->Driver)); // This is the driver's dll.
std::strncpy(pIdentifier->Description, desc, std::size(pIdentifier->Description));
std::strncpy(pIdentifier->DeviceName, device.DeviceName, std::size(pIdentifier->DeviceName)); // The GDI device name. Not the actual device name.
std::strncpy(pIdentifier->Driver, driver, std::size(pIdentifier->Driver)); // This is the driver's dll.
pIdentifier->DeviceIdentifier = guid;
pIdentifier->DeviceId = deviceId;

View File

@ -6541,7 +6541,7 @@ namespace dxvk {
});
auto UploadVertexBlendData = [&](auto data) {
for (uint32_t i = 0; i < countof(data->WorldView); i++)
for (uint32_t i = 0; i < std::size(data->WorldView); i++)
data->WorldView[i] = m_state.transforms[GetTransformIndex(D3DTS_VIEW)] * m_state.transforms[GetTransformIndex(D3DTS_WORLDMATRIX(i))];
};

View File

@ -2404,7 +2404,7 @@ namespace dxvk {
std::hash<uint32_t> uint32hash;
for (uint32_t i = 0; i < countof(key.Data.Primitive); i++)
for (uint32_t i = 0; i < std::size(key.Data.Primitive); i++)
state.add(uint32hash(key.Data.Primitive[i]));
return state;
@ -2417,7 +2417,7 @@ namespace dxvk {
std::hash<uint32_t> uint32hash;
for (uint32_t i = 0; i < caps::TextureStageCount; i++) {
for (uint32_t j = 0; j < countof(key.Stages[i].Primitive); j++)
for (uint32_t j = 0; j < std::size(key.Stages[i].Primitive); j++)
state.add(uint32hash(key.Stages[i].Primitive[j]));
}

View File

@ -37,7 +37,6 @@
#include "../util/util_likely.h"
#include "../util/util_math.h"
#include "../util/util_monitor.h"
#include "../util/util_misc.h"
#include "../util/util_string.h"
// Missed definitions in Wine/MinGW.

View File

@ -1,8 +0,0 @@
#pragma once
namespace dxvk {
template <typename T, size_t n>
size_t countof(const T(&)[n]) { return n; }
}