This commit is contained in:
Chuck Walbourn 2023-11-15 15:42:41 -08:00 коммит произвёл GitHub
Родитель 89e9a68015
Коммит ef57c4e480
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 69 добавлений и 46 удалений

Просмотреть файл

@ -39,9 +39,9 @@ namespace
_Out_writes_(nVerts) uint32_t *index, _Out_writes_(nVerts) uint32_t *index,
_In_reads_(nVerts) const XMFLOAT3* positions, size_t nVerts) noexcept _In_reads_(nVerts) const XMFLOAT3* positions, size_t nVerts) noexcept
{ {
for (uint32_t vert = 0; vert < nVerts; ++vert) for (size_t vert = 0; vert < nVerts; ++vert)
{ {
index[vert] = vert; index[vert] = static_cast<uint32_t>(vert);
} }
if (nVerts > 1) if (nVerts > 1)

Просмотреть файл

@ -42,15 +42,15 @@ HRESULT __cdecl DirectX::ConcatenateMesh(
return E_FAIL; return E_FAIL;
auto const baseFace = static_cast<uint32_t>(totalFaces); auto const baseFace = static_cast<uint32_t>(totalFaces);
for (uint32_t j = 0; j < nFaces; ++j) for (size_t j = 0; j < nFaces; ++j)
{ {
faceDestMap[j] = baseFace + j; faceDestMap[j] = baseFace + static_cast<uint32_t>(j);
} }
auto const baseVert = static_cast<uint32_t>(totalVerts); auto const baseVert = static_cast<uint32_t>(totalVerts);
for (uint32_t j = 0; j < nVerts; ++j) for (size_t j = 0; j < nVerts; ++j)
{ {
vertexDestMap[j] = baseVert + j; vertexDestMap[j] = baseVert + static_cast<uint32_t>(j);
} }
totalFaces = static_cast<size_t>(newFaceCount); totalFaces = static_cast<size_t>(newFaceCount);

Просмотреть файл

@ -108,9 +108,9 @@ HRESULT DirectX::AttributeSort(
std::vector<intpair_t> list; std::vector<intpair_t> list;
list.reserve(nFaces); list.reserve(nFaces);
for (uint32_t j = 0; j < nFaces; ++j) for (size_t j = 0; j < nFaces; ++j)
{ {
list.emplace_back(intpair_t(attributes[j], j)); list.emplace_back(intpair_t(attributes[j], static_cast<uint32_t>(j)));
} }
std::stable_sort(list.begin(), list.end(), [](const intpair_t& a, const intpair_t& b) noexcept -> bool std::stable_sort(list.begin(), list.end(), [](const intpair_t& a, const intpair_t& b) noexcept -> bool
@ -119,7 +119,7 @@ HRESULT DirectX::AttributeSort(
}); });
auto it = list.begin(); auto it = list.begin();
for (uint32_t j = 0; j < nFaces; ++j, ++it) for (size_t j = 0; j < nFaces; ++j, ++it)
{ {
attributes[j] = it->first; attributes[j] = it->first;
faceRemap[j] = it->second; faceRemap[j] = it->second;

Просмотреть файл

@ -570,12 +570,12 @@ namespace
// inverse remap // inverse remap
memset(faceRemap, 0xff, sizeof(uint32_t) * nFaces); memset(faceRemap, 0xff, sizeof(uint32_t) * nFaces);
for (uint32_t j = 0; j < nFaces; ++j) for (size_t j = 0; j < nFaces; ++j)
{ {
uint32_t f = faceRemapInverse[j]; uint32_t f = faceRemapInverse[j];
if (f < nFaces) if (f < nFaces)
{ {
faceRemap[f] = j; faceRemap[f] = static_cast<uint32_t>(j);
} }
} }
@ -751,12 +751,12 @@ namespace
// inverse remap // inverse remap
memset(faceRemap, 0xff, sizeof(uint32_t) * nFaces); memset(faceRemap, 0xff, sizeof(uint32_t) * nFaces);
for (uint32_t j = 0; j < nFaces; ++j) for (size_t j = 0; j < nFaces; ++j)
{ {
uint32_t f = faceRemapInverse[j]; uint32_t f = faceRemapInverse[j];
if (f < nFaces) if (f < nFaces)
{ {
faceRemap[f] = j; faceRemap[f] = static_cast<uint32_t>(j);
} }
} }

Просмотреть файл

@ -853,7 +853,7 @@ HRESULT DirectX::FinalizeVBAndPointReps(
HRESULT hr = SwapVertices(vb, stride, nVerts, pointRep, vertexRemap); HRESULT hr = SwapVertices(vb, stride, nVerts, pointRep, vertexRemap);
// clean up point reps for any removed vertices // clean up point reps for any removed vertices
for (uint32_t i = 0; i < nVerts; ++i) for (size_t i = 0; i < nVerts; ++i)
{ {
if (vertexRemap[i] == UNUSED32) if (vertexRemap[i] == UNUSED32)
{ {

Просмотреть файл

@ -164,7 +164,7 @@ HRESULT VBReader::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl)
ComputeInputLayout(reinterpret_cast<const D3D11_INPUT_ELEMENT_DESC*>(vbDecl), nDecl, offsets, mDefaultStrides); ComputeInputLayout(reinterpret_cast<const D3D11_INPUT_ELEMENT_DESC*>(vbDecl), nDecl, offsets, mDefaultStrides);
#endif #endif
for (uint32_t j = 0; j < nDecl; ++j) for (size_t j = 0; j < nDecl; ++j)
{ {
if (vbDecl[j].InputSlotClass == PER_INSTANCE_DATA) if (vbDecl[j].InputSlotClass == PER_INSTANCE_DATA)
{ {
@ -177,18 +177,18 @@ HRESULT VBReader::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl)
mInputDesc[j].AlignedByteOffset = offsets[j]; mInputDesc[j].AlignedByteOffset = offsets[j];
auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, j); auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, static_cast<uint32_t>(j));
mSemantics.insert(decl); mSemantics.insert(decl);
// Add common aliases // Add common aliases
if (_stricmp(vbDecl[j].SemanticName, "POSITION") == 0) if (_stricmp(vbDecl[j].SemanticName, "POSITION") == 0)
{ {
auto decl2 = SemanticMap::value_type("SV_Position", j); auto decl2 = SemanticMap::value_type("SV_Position", static_cast<uint32_t>(j));
mSemantics.insert(decl2); mSemantics.insert(decl2);
} }
else if (_stricmp(vbDecl[j].SemanticName, "SV_Position") == 0) else if (_stricmp(vbDecl[j].SemanticName, "SV_Position") == 0)
{ {
auto decl2 = SemanticMap::value_type("POSITION", j); auto decl2 = SemanticMap::value_type("POSITION", static_cast<uint32_t>(j));
mSemantics.insert(decl2); mSemantics.insert(decl2);
} }
} }

Просмотреть файл

@ -163,7 +163,7 @@ HRESULT VBWriter::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl)
ComputeInputLayout(reinterpret_cast<const D3D11_INPUT_ELEMENT_DESC*>(vbDecl), nDecl, offsets, mDefaultStrides); ComputeInputLayout(reinterpret_cast<const D3D11_INPUT_ELEMENT_DESC*>(vbDecl), nDecl, offsets, mDefaultStrides);
#endif #endif
for (uint32_t j = 0; j < nDecl; ++j) for (size_t j = 0; j < nDecl; ++j)
{ {
if (vbDecl[j].InputSlotClass == PER_INSTANCE_DATA) if (vbDecl[j].InputSlotClass == PER_INSTANCE_DATA)
{ {
@ -176,18 +176,18 @@ HRESULT VBWriter::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl)
mInputDesc[j].AlignedByteOffset = offsets[j]; mInputDesc[j].AlignedByteOffset = offsets[j];
auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, j); auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, static_cast<uint32_t>(j));
mSemantics.insert(decl); mSemantics.insert(decl);
// Add common aliases // Add common aliases
if (_stricmp(vbDecl[j].SemanticName, "POSITION") == 0) if (_stricmp(vbDecl[j].SemanticName, "POSITION") == 0)
{ {
auto decl2 = SemanticMap::value_type("SV_Position", j); auto decl2 = SemanticMap::value_type("SV_Position", static_cast<uint32_t>(j));
mSemantics.insert(decl2); mSemantics.insert(decl2);
} }
else if (_stricmp(vbDecl[j].SemanticName, "SV_Position") == 0) else if (_stricmp(vbDecl[j].SemanticName, "SV_Position") == 0)
{ {
auto decl2 = SemanticMap::value_type("POSITION", j); auto decl2 = SemanticMap::value_type("POSITION", static_cast<uint32_t>(j));
mSemantics.insert(decl2); mSemantics.insert(decl2);
} }
} }

Просмотреть файл

@ -114,7 +114,7 @@ namespace
return S_FALSE; return S_FALSE;
// Apply map to indices // Apply map to indices
for (uint32_t j = 0; j < nFaces * 3; ++j) for (size_t j = 0; j < nFaces * 3; ++j)
{ {
index_t i = indices[j]; index_t i = indices[j];
if (i == index_t(-1)) if (i == index_t(-1))

Просмотреть файл

@ -26,6 +26,9 @@
#pragma warning(pop) #pragma warning(pop)
#include <Windows.h> #include <Windows.h>
#ifdef __MINGW32__
#include <unknwn.h>
#endif
#else // !WIN32 #else // !WIN32
#include <wsl/winadapter.h> #include <wsl/winadapter.h>
#include <wsl/wrladapter.h> #include <wsl/wrladapter.h>
@ -103,6 +106,7 @@ public:
for (;; ) for (;; )
{ {
std::wstring strCommand; std::wstring strCommand;
InFile.width(MAX_PATH);
InFile >> strCommand; InFile >> strCommand;
if (!InFile) if (!InFile)
break; break;
@ -327,12 +331,14 @@ public:
else if (0 == wcscmp(strCommand.c_str(), L"mtllib")) else if (0 == wcscmp(strCommand.c_str(), L"mtllib"))
{ {
// Material library // Material library
InFile.width(MAX_PATH);
InFile >> strMaterialFilename; InFile >> strMaterialFilename;
} }
else if (0 == wcscmp(strCommand.c_str(), L"usemtl")) else if (0 == wcscmp(strCommand.c_str(), L"usemtl"))
{ {
// Material // Material
wchar_t strName[MAX_PATH] = {}; wchar_t strName[MAX_PATH] = {};
InFile.width(MAX_PATH);
InFile >> strName; InFile >> strName;
bool bFound = false; bool bFound = false;
@ -429,6 +435,7 @@ public:
{ {
// Switching active materials // Switching active materials
wchar_t strName[MAX_PATH] = {}; wchar_t strName[MAX_PATH] = {};
InFile.width(MAX_PATH);
InFile >> strName; InFile >> strName;
curMaterial = materials.end(); curMaterial = materials.end();

Просмотреть файл

@ -62,7 +62,7 @@ jobs:
# We can use the preinstalled vcpkg instead of the latest when MS Hosted updates their vcpkg to the newer DirectX-Headers # We can use the preinstalled vcpkg instead of the latest when MS Hosted updates their vcpkg to the newer DirectX-Headers
displayName: Fetch VCPKG displayName: Fetch VCPKG
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git
workingDirectory: $(Build.SourcesDirectory) workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2 - task: CmdLine@2
displayName: VCPKG Bootstrap displayName: VCPKG Bootstrap
@ -135,12 +135,12 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch VCPKG displayName: Fetch VCPKG
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git
workingDirectory: $(Build.SourcesDirectory) workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch tests displayName: Fetch tests
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests
- task: CmdLine@2 - task: CmdLine@2
displayName: VCPKG Bootstrap displayName: VCPKG Bootstrap
inputs: inputs:

Просмотреть файл

@ -32,7 +32,7 @@ variables:
jobs: jobs:
- job: DESKTOP_BUILD - job: DESKTOP_BUILD
displayName: 'Win32 Desktop for x64/x86' displayName: 'Win32 Desktop for x64/x86'
timeoutInMinutes: 120 timeoutInMinutes: 60
cancelTimeoutInMinutes: 1 cancelTimeoutInMinutes: 1
steps: steps:
- checkout: self - checkout: self
@ -48,7 +48,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch Tests displayName: Fetch Tests
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests
workingDirectory: $(Build.SourcesDirectory) workingDirectory: $(Build.SourcesDirectory)
failOnStderr: true failOnStderr: true
- task: VSBuild@1 - task: VSBuild@1
@ -144,7 +144,7 @@ jobs:
- job: CMAKE_BUILD - job: CMAKE_BUILD
displayName: 'CMake BUILD_TESTING=ON' displayName: 'CMake BUILD_TESTING=ON'
timeoutInMinutes: 120 timeoutInMinutes: 60
steps: steps:
- checkout: self - checkout: self
clean: true clean: true
@ -159,7 +159,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch Tests displayName: Fetch Tests
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests
workingDirectory: $(Build.SourcesDirectory) workingDirectory: $(Build.SourcesDirectory)
failOnStderr: true failOnStderr: true
- task: ChocolateyCommand@0 - task: ChocolateyCommand@0
@ -194,6 +194,9 @@ jobs:
inputs: inputs:
cwd: '$(Build.SourcesDirectory)' cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Debug -v cmakeArgs: --build out/build/x64-Debug -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1 - task: CMake@1
displayName: CMake (MSVC; x64-Release) Config displayName: CMake (MSVC; x64-Release) Config
inputs: inputs:
@ -204,6 +207,9 @@ jobs:
inputs: inputs:
cwd: '$(Build.SourcesDirectory)' cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Release -v cmakeArgs: --build out/build/x64-Release -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1 - task: CMake@1
displayName: CMake (clang/LLVM; x64-Debug) Config displayName: CMake (clang/LLVM; x64-Debug) Config
inputs: inputs:
@ -214,6 +220,9 @@ jobs:
inputs: inputs:
cwd: '$(Build.SourcesDirectory)' cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Debug-Clang -v cmakeArgs: --build out/build/x64-Debug-Clang -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1 - task: CMake@1
displayName: CMake (clang/LLVM; x64-Release) Config displayName: CMake (clang/LLVM; x64-Release) Config
inputs: inputs:
@ -224,6 +233,9 @@ jobs:
inputs: inputs:
cwd: '$(Build.SourcesDirectory)' cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Release-Clang -v cmakeArgs: --build out/build/x64-Release-Clang -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CmdLine@2 - task: CmdLine@2
displayName: Set LIB for ARM64 displayName: Set LIB for ARM64
inputs: inputs:
@ -245,6 +257,9 @@ jobs:
inputs: inputs:
cwd: '$(Build.SourcesDirectory)' cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/arm64-Debug-Clang -v cmakeArgs: --build out/build/arm64-Debug-Clang -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1 - task: CMake@1
displayName: CMake (clang/LLVM; arm64-Release) Config displayName: CMake (clang/LLVM; arm64-Release) Config
inputs: inputs:

Просмотреть файл

@ -67,7 +67,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch Tests displayName: Fetch Tests
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests
workingDirectory: $(Build.SourcesDirectory) workingDirectory: $(Build.SourcesDirectory)
failOnStderr: true failOnStderr: true
- task: VSBuild@1 - task: VSBuild@1

Просмотреть файл

@ -42,7 +42,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch directx-headers displayName: Fetch directx-headers
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers
- task: CMake@1 - task: CMake@1
displayName: CMake DirectX-Headers displayName: CMake DirectX-Headers
inputs: inputs:
@ -61,7 +61,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch directxmath displayName: Fetch directxmath
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath
- task: CMake@1 - task: CMake@1
displayName: CMake DirectXMath displayName: CMake DirectXMath
inputs: inputs:

Просмотреть файл

@ -61,7 +61,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch directx-headers displayName: Fetch directx-headers
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers
- task: CMake@1 - task: CMake@1
displayName: CMake DirectX-Headers displayName: CMake DirectX-Headers
inputs: inputs:
@ -80,7 +80,7 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: Fetch directxmath displayName: Fetch directxmath
inputs: inputs:
script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath
- task: CMake@1 - task: CMake@1
displayName: CMake DirectXMath displayName: CMake DirectXMath
inputs: inputs:

Просмотреть файл

@ -58,18 +58,19 @@ jobs:
inputs: inputs:
cwd: '$(Build.SourcesDirectory)' cwd: '$(Build.SourcesDirectory)'
cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DENABLE_SPECTRE_MITIGATION=ON' cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DENABLE_SPECTRE_MITIGATION=ON'
- task: Semmle@1 - task: CodeQL3000Init@0
displayName: 'Run CodeQL (Semmle) (C++)'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs: inputs:
sourceCodeDirectory: '$(Build.SourcesDirectory)' Enabled: true
language: 'cpp' - task: VSBuild@1
querySuite: 'Recommended' displayName: 'Build C++ with CodeQL'
timeout: '1800' inputs:
ram: '16384' solution: '$(Build.SourcesDirectory)/out/DirectXMesh.sln'
addProjectDirToScanningExclusionList: true vsVersion: 17.0
buildCommandsString: '"%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/out/DirectXMesh.sln /p:Configuration=Release' platform: x64
configuration: Release
msbuildArchitecture: x64
- task: CodeQL3000Finalize@0
condition: always()
- task: CMake@1 - task: CMake@1
displayName: 'CMake (MSVC): Build x64 Release' displayName: 'CMake (MSVC): Build x64 Release'
inputs: inputs: