1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-08 14:00:05 +00:00

ADO pipeline changes for OpenSSF Best Practices (#477)

This commit is contained in:
Chuck Walbourn 2024-05-17 16:56:19 -07:00 committed by GitHub
parent 5cf134c714
commit 68e726aefc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 1677 additions and 184 deletions

View File

@ -570,7 +570,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(ENABLE_CODE_ANALYSIS) if(ENABLE_CODE_ANALYSIS)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /analyze) target_compile_options(${t} PRIVATE /analyze /WX)
endforeach() endforeach()
endif() endif()

View File

@ -1786,29 +1786,19 @@ namespace
); );
if (result > 0) if (result > 0)
{ {
const char* pstrName = strrchr(strFileA, '\\');
if (!pstrName)
{
pstrName = strFileA;
}
else
{
pstrName++;
}
if (texture && *texture) if (texture && *texture)
{ {
(*texture)->SetPrivateData(WKPDID_D3DDebugObjectName, (*texture)->SetPrivateData(WKPDID_D3DDebugObjectName,
static_cast<UINT>(strnlen_s(pstrName, MAX_PATH)), static_cast<UINT>(result),
pstrName strFileA
); );
} }
if (textureView && *textureView) if (textureView && *textureView)
{ {
(*textureView)->SetPrivateData(WKPDID_D3DDebugObjectName, (*textureView)->SetPrivateData(WKPDID_D3DDebugObjectName,
static_cast<UINT>(strnlen_s(pstrName, MAX_PATH)), static_cast<UINT>(result),
pstrName strFileA
); );
} }
} }

View File

@ -71,7 +71,7 @@ namespace
_In_ IWICBitmap* src, _In_ IWICBitmap* src,
_In_ TEX_FILTER_FLAGS filter, _In_ TEX_FILTER_FLAGS filter,
_In_ const WICPixelFormatGUID& desiredPixelFormat, _In_ const WICPixelFormatGUID& desiredPixelFormat,
_COM_Outptr_ IWICBitmap** dest) noexcept __RPC__deref_out_opt /* needed to match WIC annotation */ IWICBitmap** dest) noexcept
{ {
if (!dest) if (!dest)
return E_POINTER; return E_POINTER;

View File

@ -88,7 +88,7 @@
<AppContainerApplication>true</AppContainerApplication> <AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType> <ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion> <WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision> <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<PreferredToolArchitecture>x64</PreferredToolArchitecture> <PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup> </PropertyGroup>

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,10 @@ For the latest version of DirectXTex, bug reports, etc. please visit the project
## Release Notes ## Release Notes
FOR SECURITY ADVISORIES, see [GitHub](https://github.com/microsoft/DirectXTex/security/advisories).
For a full change history, see [CHANGELOG.md](https://github.com/microsoft/DirectXTex/blob/main/CHANGELOG.md).
* Starting with the July 2022 release, the ``bool forceSRGB`` parameter for the CreateTextureEx and CreateShaderResourceViewEx functions is now a ``CREATETEX_FLAGS`` typed enum bitmask flag parameter. This may have a *breaking change* impact to client code. Replace ``true`` with ``CREATETEX_FORCE_SRGB`` and ``false`` with ``CREATETEX_DEFAULT``. * Starting with the July 2022 release, the ``bool forceSRGB`` parameter for the CreateTextureEx and CreateShaderResourceViewEx functions is now a ``CREATETEX_FLAGS`` typed enum bitmask flag parameter. This may have a *breaking change* impact to client code. Replace ``true`` with ``CREATETEX_FORCE_SRGB`` and ``false`` with ``CREATETEX_DEFAULT``.
* Starting with the June 2020 release, this library makes use of typed enum bitmask flags per the recommendation of the _C++ Standard_ section *17.5.2.1.3 Bitmask types*. This is consistent with Direct3D 12's use of the ``DEFINE_ENUM_FLAG_OPERATORS`` macro. This may have *breaking change* impacts to client code: * Starting with the June 2020 release, this library makes use of typed enum bitmask flags per the recommendation of the _C++ Standard_ section *17.5.2.1.3 Bitmask types*. This is consistent with Direct3D 12's use of the ``DEFINE_ENUM_FLAG_OPERATORS`` macro. This may have *breaking change* impacts to client code:
@ -106,6 +110,8 @@ This project welcomes contributions and suggestions. Most contributions require
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
Tests for new features should also be submitted as a PR to the [Test Suite](https://github.com/walbourn/directxtextest/wiki) repository.
## Code of Conduct ## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

View File

@ -802,29 +802,19 @@ namespace
); );
if (result > 0) if (result > 0)
{ {
const char* pstrName = strrchr(strFileA, '\\');
if (!pstrName)
{
pstrName = strFileA;
}
else
{
pstrName++;
}
if (texture && *texture) if (texture && *texture)
{ {
(*texture)->SetPrivateData(WKPDID_D3DDebugObjectName, (*texture)->SetPrivateData(WKPDID_D3DDebugObjectName,
static_cast<UINT>(strnlen_s(pstrName, MAX_PATH)), static_cast<UINT>(result),
pstrName strFileA
); );
} }
if (textureView && *textureView) if (textureView && *textureView)
{ {
(*textureView)->SetPrivateData(WKPDID_D3DDebugObjectName, (*textureView)->SetPrivateData(WKPDID_D3DDebugObjectName,
static_cast<UINT>(strnlen_s(pstrName, MAX_PATH)), static_cast<UINT>(result),
pstrName strFileA
); );
} }
} }

View File

@ -12,22 +12,50 @@ schedules:
include: include:
- main - main
trigger: none trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
pr: pr:
branches: branches:
include: include:
- main - main
paths: paths:
include: exclude:
- build/DirectXTex-GitHub-Dev17.yml - '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
drafts: false
resources: resources:
repositories: repositories:
- repository: self - repository: self
type: git type: git
ref: refs/heads/main ref: refs/heads/main
trigger: none
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

View File

@ -36,6 +36,7 @@ pool:
variables: variables:
Codeql.Enabled: false Codeql.Enabled: false
VC_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
GITHUB_PAT: $(GITHUBPUBLICTOKEN) GITHUB_PAT: $(GITHUBPUBLICTOKEN)
jobs: jobs:
@ -171,20 +172,13 @@ jobs:
script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxtextest.git Tests script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxtextest.git Tests
workingDirectory: $(Build.SourcesDirectory) workingDirectory: $(Build.SourcesDirectory)
failOnStderr: true failOnStderr: true
- task: ChocolateyCommand@0
displayName: Install Ninja
inputs:
command: 'install'
installPackageId: 'ninja'
- task: CmdLine@2 - task: CmdLine@2
displayName: Setup environment for CMake to use VS displayName: Setup environment for CMake to use VS
inputs: inputs:
script: | script: |
@echo off call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat"
pushd "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath%
for /f "delims=" %%x in ('.\vswhere.exe -latest -property InstallationPath') do set VSPATH=%%x echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
popd
call "%VSPATH%\VC\Auxiliary\Build\vcvarsall.bat" x64
echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin
echo ##vso[task.prependpath]%WindowsSdkBinPath%x64 echo ##vso[task.prependpath]%WindowsSdkBinPath%x64
echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64 echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64
@ -246,14 +240,10 @@ jobs:
inputs: inputs:
Contents: 'out' Contents: 'out'
- task: CmdLine@2 - task: CmdLine@2
displayName: Set LIB for ARM64 displayName: Switch compiler to ARM64
inputs: inputs:
script: | script: |
@echo off call "$(VC_PATH)\Auxiliary\Build\vcvarsamd64_arm64.bat"
pushd "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
for /f "delims=" %%x in ('.\vswhere.exe -latest -property InstallationPath') do set VSPATH=%%x
popd
call "%VSPATH%\VC\Auxiliary\Build\vcvarsall.bat" arm64
echo ##vso[task.setvariable variable=LIB;]%LIB% echo ##vso[task.setvariable variable=LIB;]%LIB%
- task: CMake@1 - task: CMake@1

View File

@ -63,7 +63,7 @@ variables:
Codeql.Enabled: false Codeql.Enabled: false
pool: pool:
vmImage: windows-2022 vmImage: windows-2019
jobs: jobs:
- job: DESKTOP_BUILD - job: DESKTOP_BUILD
@ -223,54 +223,3 @@ jobs:
msbuildArgs: /p:PreferredToolArchitecture=x64 /p:SpectreMitigation=Spectre msbuildArgs: /p:PreferredToolArchitecture=x64 /p:SpectreMitigation=Spectre
platform: ARM64 platform: ARM64
configuration: Release configuration: Release
- job: UWP_BUILD
displayName: 'Universal Windows Platform (UWP)'
timeoutInMinutes: 120
cancelTimeoutInMinutes: 1
steps:
- checkout: self
clean: true
fetchTags: false
- task: VSBuild@1
displayName: Build solution DirectXTex_Windows10_2022.sln 32dbg
inputs:
solution: DirectXTex_Windows10_2022.sln
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: x86
configuration: Debug
- task: VSBuild@1
displayName: Build solution DirectXTex_Windows10_2022.sln 32rel
inputs:
solution: DirectXTex_Windows10_2022.sln
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: x86
configuration: Release
- task: VSBuild@1
displayName: Build solution DirectXTex_Windows10_2022.sln 64dbg
inputs:
solution: DirectXTex_Windows10_2022.sln
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: x64
configuration: Debug
- task: VSBuild@1
displayName: Build solution DirectXTex_Windows10_2022.sln 64rel
inputs:
solution: DirectXTex_Windows10_2022.sln
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: x64
configuration: Release
- task: VSBuild@1
displayName: Build solution DirectXTex_Windows10_2022.sln arm64dbg
inputs:
solution: DirectXTex_Windows10_2022.sln
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: ARM64
configuration: Debug
- task: VSBuild@1
displayName: Build solution DirectXTex_Windows10_2022.sln arm64rel
inputs:
solution: DirectXTex_Windows10_2022.sln
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: ARM64
configuration: Release

View File

@ -13,7 +13,14 @@ schedules:
- main - main
trigger: none trigger: none
pr: none
pr:
branches:
include:
- main
paths:
include:
- build/DirectXTex-SDL.yml
resources: resources:
repositories: repositories:
@ -26,6 +33,7 @@ name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
variables: variables:
Codeql.Enabled: true Codeql.Enabled: true
Codeql.Language: cpp Codeql.Language: cpp
VC_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
VS_GENERATOR: 'Visual Studio 17 2022' VS_GENERATOR: 'Visual Studio 17 2022'
pool: pool:
@ -104,3 +112,37 @@ jobs:
GdnBreakPolicyMinSev: 'Error' GdnBreakPolicyMinSev: 'Error'
- task: ComponentGovernanceComponentDetection@0 - task: ComponentGovernanceComponentDetection@0
displayName: Component Detection displayName: Component Detection
- job: VC_PREFAST
displayName: 'Build using /analyze (PREFAST)'
workspace:
clean: all
steps:
- checkout: self
clean: true
fetchTags: false
- task: CmdLine@2
displayName: Setup environment for CMake to use VS
inputs:
script: |
call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat"
echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath%
echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin
echo ##vso[task.prependpath]%WindowsSdkBinPath%x64
echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64
echo ##vso[task.prependpath]%VCToolsInstallDir%bin\Hostx64\x64
echo ##vso[task.setvariable variable=EXTERNAL_INCLUDE;]%EXTERNAL_INCLUDE%
echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE%
echo ##vso[task.setvariable variable=LIB;]%LIB%
- task: CMake@1
displayName: CMake Config
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug -DENABLE_CODE_ANALYSIS=ON
- task: CMake@1
displayName: CMake Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Debug