diff --git a/.azuredevops/pipelines/FX11-GitHub-CMake-Dev17.yml b/.azuredevops/pipelines/FX11-GitHub-CMake-Dev17.yml index 00c70a6..bd5872e 100644 --- a/.azuredevops/pipelines/FX11-GitHub-CMake-Dev17.yml +++ b/.azuredevops/pipelines/FX11-GitHub-CMake-Dev17.yml @@ -8,29 +8,29 @@ trigger: branches: include: - - main + - main paths: exclude: - - '*.md' - - LICENSE - - '.github/**' + - '*.md' + - LICENSE + - '.github/**' pr: branches: include: - - main + - main paths: exclude: - - '*.md' - - LICENSE - - '.github/**' + - '*.md' + - LICENSE + - '.github/**' drafts: false resources: repositories: - - repository: self - type: git - ref: refs/heads/main + - repository: self + type: git + ref: refs/heads/main name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) @@ -44,94 +44,100 @@ pool: vmImage: windows-2022 jobs: -- job: CMAKE_BUILD - displayName: CMake using VS Generator - steps: - - checkout: self - clean: true - fetchTags: false - - task: CMake@1 - displayName: 'CMake (MSVC): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC): Build x64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (MSVC): Config x86' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A Win32 -B out2 -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC): Build x86 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out2 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC): Build x86 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out2 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (MSVC): Config ARM64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A ARM64 -B out3 -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC): Build ARM64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out3 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC): Build ARM64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out3 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (UWP): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out4 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0' - - task: CMake@1 - displayName: 'CMake (UWP): Build x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out4 -v - - task: CMake@1 - displayName: 'CMake (ClangCl): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -T clangcl -B out6 -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK)' - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out6 -v --config Debug - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out6 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out7 -DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Build x64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out7 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out7 -v --config RelWithDebInfo + - job: CMAKE_BUILD + displayName: CMake using VS Generator + steps: + - checkout: self + clean: true + fetchTags: false + - task: CMake@1 + displayName: 'CMake (MSVC): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC): Build x64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (MSVC): Config x86' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A Win32 -B out2 -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC): Build x86 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out2 -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC): Build x86 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out2 -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (MSVC): Config ARM64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A ARM64 -B out3 -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC): Build ARM64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out3 -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC): Build ARM64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out3 -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (UWP): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -B out4 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 + - task: CMake@1 + displayName: 'CMake (UWP): Build x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out4 -v + - task: CMake@1 + displayName: 'CMake (ClangCl): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -T clangcl -B out6 -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) + - task: CMake@1 + displayName: 'CMake (ClangCl): Build x64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out6 -v --config Debug + - task: CMake@1 + displayName: 'CMake (ClangCl): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out6 -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (MSVC Spectre): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -B out7 -DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC Spectre): Build x64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out7 -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC Spectre): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out7 -v --config RelWithDebInfo diff --git a/.azuredevops/pipelines/FX11-GitHub-CMake.yml b/.azuredevops/pipelines/FX11-GitHub-CMake.yml index d4d29ed..c999283 100644 --- a/.azuredevops/pipelines/FX11-GitHub-CMake.yml +++ b/.azuredevops/pipelines/FX11-GitHub-CMake.yml @@ -8,28 +8,28 @@ trigger: branches: include: - - main + - main paths: exclude: - - '*.md' - - LICENSE - - '.github/**' + - '*.md' + - LICENSE + - '.github/**' pr: branches: include: - - main + - main paths: exclude: - - '*.md' - - LICENSE - - '.github/**' + - '*.md' + - LICENSE + - '.github/**' resources: repositories: - - repository: self - type: git - ref: refs/heads/main + - repository: self + type: git + ref: refs/heads/main name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) @@ -42,94 +42,100 @@ pool: vmImage: windows-2019 jobs: -- job: CMAKE_BUILD - displayName: CMake using VS Generator - steps: - - checkout: self - clean: true - fetchTags: false - - task: CMake@1 - displayName: 'CMake (MSVC): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC): Build x64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (MSVC): Config x86' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A Win32 -B out2 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC): Build x86 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out2 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC): Build x86 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out2 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (MSVC): Config ARM64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A ARM64 -B out3 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC): Build ARM64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out3 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC): Build ARM64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out3 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (UWP): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out4 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0' - - task: CMake@1 - displayName: 'CMake (UWP): Build x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out4 -v - - task: CMake@1 - displayName: 'CMake (ClangCl): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -T clangcl -B out6 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)' - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out6 -v --config Debug - - task: CMake@1 - displayName: 'CMake (ClangCl): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out6 -v --config RelWithDebInfo - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out7 -DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)' - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Build x64 Debug' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out7 -v --config Debug - - task: CMake@1 - displayName: 'CMake (MSVC Spectre): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out7 -v --config RelWithDebInfo + - job: CMAKE_BUILD + displayName: CMake using VS Generator + steps: + - checkout: self + clean: true + fetchTags: false + - task: CMake@1 + displayName: 'CMake (MSVC): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC): Build x64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (MSVC): Config x86' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A Win32 -B out2 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC): Build x86 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out2 -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC): Build x86 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out2 -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (MSVC): Config ARM64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A ARM64 -B out3 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC): Build ARM64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out3 -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC): Build ARM64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out3 -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (UWP): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -B out4 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 + - task: CMake@1 + displayName: 'CMake (UWP): Build x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out4 -v + - task: CMake@1 + displayName: 'CMake (ClangCl): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -T clangcl -B out6 -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + - task: CMake@1 + displayName: 'CMake (ClangCl): Build x64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out6 -v --config Debug + - task: CMake@1 + displayName: 'CMake (ClangCl): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out6 -v --config RelWithDebInfo + - task: CMake@1 + displayName: 'CMake (MSVC Spectre): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: > + -G "$(VS_GENERATOR)" -A x64 -B out7 -DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK) + - task: CMake@1 + displayName: 'CMake (MSVC Spectre): Build x64 Debug' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out7 -v --config Debug + - task: CMake@1 + displayName: 'CMake (MSVC Spectre): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out7 -v --config RelWithDebInfo diff --git a/.azuredevops/pipelines/FX11-GitHub-Dev17.yml b/.azuredevops/pipelines/FX11-GitHub-Dev17.yml index 56f8a43..7f5ded8 100644 --- a/.azuredevops/pipelines/FX11-GitHub-Dev17.yml +++ b/.azuredevops/pipelines/FX11-GitHub-Dev17.yml @@ -6,27 +6,27 @@ # Builds the library for Windows Desktop. schedules: -- cron: "10 5 * * *" - displayName: 'Nightly build' - branches: - include: - - main + - cron: "10 5 * * *" + displayName: 'Nightly build' + branches: + include: + - main # GitHub Actions handles MSBuild for CI/PR trigger: none pr: branches: include: - - main + - main paths: include: - - '.azuredevops/pipelines/FX11-GitHub-Dev17.yml' + - '.azuredevops/pipelines/FX11-GitHub-Dev17.yml' resources: repositories: - - repository: self - type: git - ref: refs/heads/main + - repository: self + type: git + ref: refs/heads/main name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) @@ -37,91 +37,91 @@ pool: vmImage: windows-2022 jobs: -- job: DESKTOP_BUILD - displayName: 'Windows Desktop' - timeoutInMinutes: 60 - strategy: - maxParallel: 4 - matrix: - Release_x64: - BuildPlatform: x64 - BuildConfiguration: Release - SpectreMitigation: false - Debug_x64: - BuildPlatform: x64 - BuildConfiguration: Debug - SpectreMitigation: false - Release_x86: - BuildPlatform: Win32 - BuildConfiguration: Release - SpectreMitigation: false - Debug_x86: - BuildPlatform: Win32 - BuildConfiguration: Debug - SpectreMitigation: false - Release_x64_SpectreMitigated: - BuildPlatform: x64 - BuildConfiguration: Release - SpectreMitigation: 'Spectre' - Debug_x64_SpectreMitigated: - BuildPlatform: x64 - BuildConfiguration: Debug - SpectreMitigation: 'Spectre' - Release_x86_SpectreMitigated: - BuildPlatform: Win32 - BuildConfiguration: Release - SpectreMitigation: 'Spectre' - Debug_x86_SpectreMitigated: - BuildPlatform: Win32 - BuildConfiguration: Debug - SpectreMitigation: 'Spectre' - steps: - - checkout: self - clean: true - fetchTags: false - - task: VSBuild@1 - displayName: Build solution Effects11_2022_Win10.sln - inputs: - solution: Effects11_2022_Win10.sln - msbuildArgs: /p:PreferredToolArchitecture=x64 /p:SpectreMitigation=$(SpectreMitigation) - platform: '$(BuildPlatform)' - configuration: '$(BuildConfiguration)' - msbuildArchitecture: x64 + - job: DESKTOP_BUILD + displayName: 'Windows Desktop' + timeoutInMinutes: 60 + strategy: + maxParallel: 4 + matrix: + Release_x64: + BuildPlatform: x64 + BuildConfiguration: Release + SpectreMitigation: false + Debug_x64: + BuildPlatform: x64 + BuildConfiguration: Debug + SpectreMitigation: false + Release_x86: + BuildPlatform: Win32 + BuildConfiguration: Release + SpectreMitigation: false + Debug_x86: + BuildPlatform: Win32 + BuildConfiguration: Debug + SpectreMitigation: false + Release_x64_SpectreMitigated: + BuildPlatform: x64 + BuildConfiguration: Release + SpectreMitigation: 'Spectre' + Debug_x64_SpectreMitigated: + BuildPlatform: x64 + BuildConfiguration: Debug + SpectreMitigation: 'Spectre' + Release_x86_SpectreMitigated: + BuildPlatform: Win32 + BuildConfiguration: Release + SpectreMitigation: 'Spectre' + Debug_x86_SpectreMitigated: + BuildPlatform: Win32 + BuildConfiguration: Debug + SpectreMitigation: 'Spectre' + steps: + - checkout: self + clean: true + fetchTags: false + - task: VSBuild@1 + displayName: Build solution Effects11_2022_Win10.sln + inputs: + solution: Effects11_2022_Win10.sln + msbuildArgs: /p:PreferredToolArchitecture=x64 /p:SpectreMitigation=$(SpectreMitigation) + platform: '$(BuildPlatform)' + configuration: '$(BuildConfiguration)' + msbuildArchitecture: x64 -- job: UWP_BUILD - displayName: 'Universal Windows Platform (UWP)' - timeoutInMinutes: 120 - cancelTimeoutInMinutes: 1 - strategy: - maxParallel: 3 - matrix: - Release_arm64: - BuildPlatform: ARM64 - BuildConfiguration: Release - Debug_arm64: - BuildPlatform: ARM64 - BuildConfiguration: Debug - Release_x64: - BuildPlatform: x64 - BuildConfiguration: Release - Debug_x64: - BuildPlatform: x64 - BuildConfiguration: Debug - Release_x86: - BuildPlatform: x86 - BuildConfiguration: Release - Debug_x86: - BuildPlatform: x86 - BuildConfiguration: Debug - steps: - - checkout: self - clean: true - fetchTags: false - - task: VSBuild@1 - displayName: Build solution Effects11_Windows10.sln - inputs: - solution: Effects11_Windows10.sln - msbuildArgs: /p:PreferredToolArchitecture=x64 - platform: '$(BuildPlatform)' - configuration: '$(BuildConfiguration)' - msbuildArchitecture: x64 + - job: UWP_BUILD + displayName: 'Universal Windows Platform (UWP)' + timeoutInMinutes: 120 + cancelTimeoutInMinutes: 1 + strategy: + maxParallel: 3 + matrix: + Release_arm64: + BuildPlatform: ARM64 + BuildConfiguration: Release + Debug_arm64: + BuildPlatform: ARM64 + BuildConfiguration: Debug + Release_x64: + BuildPlatform: x64 + BuildConfiguration: Release + Debug_x64: + BuildPlatform: x64 + BuildConfiguration: Debug + Release_x86: + BuildPlatform: x86 + BuildConfiguration: Release + Debug_x86: + BuildPlatform: x86 + BuildConfiguration: Debug + steps: + - checkout: self + clean: true + fetchTags: false + - task: VSBuild@1 + displayName: Build solution Effects11_Windows10.sln + inputs: + solution: Effects11_Windows10.sln + msbuildArgs: /p:PreferredToolArchitecture=x64 + platform: '$(BuildPlatform)' + configuration: '$(BuildConfiguration)' + msbuildArchitecture: x64 diff --git a/.azuredevops/pipelines/FX11-GitHub.yml b/.azuredevops/pipelines/FX11-GitHub.yml index ca374a5..602b3f9 100644 --- a/.azuredevops/pipelines/FX11-GitHub.yml +++ b/.azuredevops/pipelines/FX11-GitHub.yml @@ -6,27 +6,27 @@ # Builds the library for Windows Desktop. schedules: -- cron: "15 5 * * *" - displayName: 'Nightly build' - branches: - include: - - main + - cron: "15 5 * * *" + displayName: 'Nightly build' + branches: + include: + - main # GitHub Actions handles MSBuild for CI/PR trigger: none pr: branches: include: - - main + - main paths: include: - - '.azuredevops/pipelines/FX11-GitHub.yml' + - '.azuredevops/pipelines/FX11-GitHub.yml' resources: repositories: - - repository: self - type: git - ref: refs/heads/main + - repository: self + type: git + ref: refs/heads/main name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) @@ -37,52 +37,52 @@ pool: vmImage: windows-2019 jobs: -- job: DESKTOP_BUILD - displayName: 'Windows Desktop' - timeoutInMinutes: 60 - strategy: - maxParallel: 4 - matrix: - Release_x64: - BuildPlatform: x64 - BuildConfiguration: Release - SpectreMitigation: false - Debug_x64: - BuildPlatform: x64 - BuildConfiguration: Debug - SpectreMitigation: false - Release_x86: - BuildPlatform: Win32 - BuildConfiguration: Release - SpectreMitigation: false - Debug_x86: - BuildPlatform: Win32 - BuildConfiguration: Debug - SpectreMitigation: false - Release_x64_SpectreMitigated: - BuildPlatform: x64 - BuildConfiguration: Release - SpectreMitigation: 'Spectre' - Debug_x64_SpectreMitigated: - BuildPlatform: x64 - BuildConfiguration: Debug - SpectreMitigation: 'Spectre' - Release_x86_SpectreMitigated: - BuildPlatform: Win32 - BuildConfiguration: Release - SpectreMitigation: 'Spectre' - Debug_x86_SpectreMitigated: - BuildPlatform: Win32 - BuildConfiguration: Debug - SpectreMitigation: 'Spectre' - steps: - - checkout: self - clean: true - fetchTags: false - - task: VSBuild@1 - displayName: Build solution Effects11_2019_Win10.sln - inputs: - solution: Effects11_2019_Win10.sln - msbuildArgs: /p:PreferredToolArchitecture=x64 /p:SpectreMitigation=$(SpectreMitigation) - platform: '$(BuildPlatform)' - configuration: '$(BuildConfiguration)' + - job: DESKTOP_BUILD + displayName: 'Windows Desktop' + timeoutInMinutes: 60 + strategy: + maxParallel: 4 + matrix: + Release_x64: + BuildPlatform: x64 + BuildConfiguration: Release + SpectreMitigation: false + Debug_x64: + BuildPlatform: x64 + BuildConfiguration: Debug + SpectreMitigation: false + Release_x86: + BuildPlatform: Win32 + BuildConfiguration: Release + SpectreMitigation: false + Debug_x86: + BuildPlatform: Win32 + BuildConfiguration: Debug + SpectreMitigation: false + Release_x64_SpectreMitigated: + BuildPlatform: x64 + BuildConfiguration: Release + SpectreMitigation: 'Spectre' + Debug_x64_SpectreMitigated: + BuildPlatform: x64 + BuildConfiguration: Debug + SpectreMitigation: 'Spectre' + Release_x86_SpectreMitigated: + BuildPlatform: Win32 + BuildConfiguration: Release + SpectreMitigation: 'Spectre' + Debug_x86_SpectreMitigated: + BuildPlatform: Win32 + BuildConfiguration: Debug + SpectreMitigation: 'Spectre' + steps: + - checkout: self + clean: true + fetchTags: false + - task: VSBuild@1 + displayName: Build solution Effects11_2019_Win10.sln + inputs: + solution: Effects11_2019_Win10.sln + msbuildArgs: /p:PreferredToolArchitecture=x64 /p:SpectreMitigation=$(SpectreMitigation) + platform: '$(BuildPlatform)' + configuration: '$(BuildConfiguration)' diff --git a/.azuredevops/pipelines/FX11-SDL.yml b/.azuredevops/pipelines/FX11-SDL.yml index d8a0113..035dbd5 100644 --- a/.azuredevops/pipelines/FX11-SDL.yml +++ b/.azuredevops/pipelines/FX11-SDL.yml @@ -6,28 +6,28 @@ # Runs various SDL recommended tools on the code. schedules: -- cron: "0 3 * * 0,3,5" - displayName: 'Three times a week' - branches: - include: - - main - always: true + - cron: "0 3 * * 0,3,5" + displayName: 'Three times a week' + branches: + include: + - main + always: true # GitHub Actions handles CodeQL and PREFAST for CI/PR trigger: none pr: branches: include: - - main + - main paths: include: - - '.azuredevops/pipelines/FX11-SDL.yml' + - '.azuredevops/pipelines/FX11-SDL.yml' resources: repositories: - - repository: self - type: git - ref: refs/heads/main + - repository: self + type: git + ref: refs/heads/main name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) @@ -41,103 +41,103 @@ pool: vmImage: windows-2022 jobs: -- job: SDL_BUILD - displayName: 'Build using required SDL tools' - workspace: - clean: all - steps: - - checkout: self - clean: true - fetchTags: false - - task: NodeTool@0 - displayName: 'NPM install' - inputs: - versionSpec: 14.x - - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 - displayName: 'Run Credential Scanner' - inputs: - debugMode: false - folderSuppression: false - - task: PoliCheck@2 - displayName: 'Run PoliCheck' - inputs: - result: PoliCheck.xml - - task: Armory@2 - displayName: Run ARMory - - task: CMake@1 - displayName: 'CMake (MSVC): Config x64' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DENABLE_SPECTRE_MITIGATION=ON' - - task: CodeQL3000Init@0 - inputs: - Enabled: true - - task: VSBuild@1 - displayName: 'Build C++ with CodeQL' - inputs: - solution: '$(Build.SourcesDirectory)/out/Effects11.sln' - vsVersion: 17.0 - platform: x64 - configuration: Release - msbuildArchitecture: x64 - - task: CodeQL3000Finalize@0 - condition: always() - - task: CMake@1 - displayName: 'CMake (MSVC): Build x64 Release' - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out -v --config RelWithDebInfo - - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@4 - displayName: 'Run AntiMalware' - inputs: - InputType: 'Basic' - ScanType: 'CustomScan' - FileDirPath: $(Agent.BuildDirectory) - EnableSERVICEs: true - SupportLogOnError: false - TreatSignatureUpdateFailureAs: 'Warning' - SignatureFreshness: 'OneDay' - TreatStaleSignatureAs: 'Error' - condition: always() - - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2 - displayName: 'Post Analysis' - inputs: - GdnBreakAllTools: true - GdnBreakPolicy: 'Microsoft' - GdnBreakPolicyMinSev: 'Error' - - task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection + - job: SDL_BUILD + displayName: 'Build using required SDL tools' + workspace: + clean: all + steps: + - checkout: self + clean: true + fetchTags: false + - task: NodeTool@0 + displayName: 'NPM install' + inputs: + versionSpec: 14.x + - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 + displayName: 'Run Credential Scanner' + inputs: + debugMode: false + folderSuppression: false + - task: PoliCheck@2 + displayName: 'Run PoliCheck' + inputs: + result: PoliCheck.xml + - task: Armory@2 + displayName: Run ARMory + - task: CMake@1 + displayName: 'CMake (MSVC): Config x64' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DENABLE_SPECTRE_MITIGATION=ON' + - task: CodeQL3000Init@0 + inputs: + Enabled: true + - task: VSBuild@1 + displayName: 'Build C++ with CodeQL' + inputs: + solution: '$(Build.SourcesDirectory)/out/Effects11.sln' + vsVersion: 17.0 + platform: x64 + configuration: Release + msbuildArchitecture: x64 + - task: CodeQL3000Finalize@0 + condition: always() + - task: CMake@1 + displayName: 'CMake (MSVC): Build x64 Release' + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out -v --config RelWithDebInfo + - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@4 + displayName: 'Run AntiMalware' + inputs: + InputType: 'Basic' + ScanType: 'CustomScan' + FileDirPath: $(Agent.BuildDirectory) + EnableSERVICEs: true + SupportLogOnError: false + TreatSignatureUpdateFailureAs: 'Warning' + SignatureFreshness: 'OneDay' + TreatStaleSignatureAs: 'Error' + condition: always() + - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@2 + displayName: 'Post Analysis' + inputs: + GdnBreakAllTools: true + GdnBreakPolicy: 'Microsoft' + GdnBreakPolicyMinSev: 'Error' + - task: ComponentGovernanceComponentDetection@0 + 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% + - 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 + - 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 diff --git a/.editorconfig b/.editorconfig index 6a8f10a..fb4e425 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,14 @@ root = true -[*.{cpp,h}] +[*.{yml}] +indent_size = 2 +indent_style = space +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = crlf +charset = latin1 + +[*.{cpp,h,inl}] indent_size = 4 indent_style = space trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes index a103631..6b396a0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,6 +13,7 @@ *.vcxproj eol=crlf *.filters eol=crlf *.sln eol=crlf +*.yml eol=crlf # Explicitly declare resource files as binary *.pdb binary diff --git a/.github/linters/.editorconfig-checker.json b/.github/linters/.editorconfig-checker.json new file mode 100644 index 0000000..713a374 --- /dev/null +++ b/.github/linters/.editorconfig-checker.json @@ -0,0 +1,11 @@ +{ + "Format": "github-actions", + "exclude": [ + ".git", + "LICENSE" + ], + "Disable": { + "Indentation": true, + "IndentSize": true + } +} diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 100644 index 0000000..a4eb3b2 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1,20 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# line-length +MD013: false + +# blanks-around-headings +MD022: false + +# blanks-around-lists +MD032: false + +# no-inline-html +MD033: false + +# no-bare-urls +MD034: false + +# first-line-heading +MD041: false diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 0000000..10cf3c2 --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,17 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +ignore-from-file: .gitignore + +extends: default + +rules: + truthy: + check-keys: false + document-start: disable + line-length: + max: 160 + comments: + min-spaces-from-content: 1 + new-lines: + type: dos diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 40f5297..982eab5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -7,14 +7,14 @@ name: "CodeQL" on: push: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - LICENSE - '.azuredevops/**' - '.nuget/*' pull_request: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - LICENSE @@ -38,29 +38,29 @@ jobs: packages: read steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: 'Install Ninja' - run: choco install ninja + - name: 'Install Ninja' + run: choco install ninja - - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - - name: Initialize CodeQL - uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 - with: - languages: c-cpp - build-mode: manual + - name: Initialize CodeQL + uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 + with: + languages: c-cpp + build-mode: manual - - name: 'Configure CMake' - working-directory: ${{ github.workspace }} - run: cmake --preset=x64-Debug + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=x64-Debug - - name: 'Build' - working-directory: ${{ github.workspace }} - run: cmake --build out\build\x64-Debug + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\x64-Debug - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 - with: - category: "/language:c-cpp" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 + with: + category: "/language:c-cpp" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ff267c4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,45 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=271568 + +name: Lint + +on: + pull_request: + branches: "main" + paths-ignore: + - LICENSE + - build/*.in + +permissions: {} + +jobs: + analyze: + permissions: + contents: read + packages: read + statuses: write + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Lint Code Base + uses: super-linter/super-linter/slim@12150456a73e248bdc94d0794898f94e23127c88 # v7.4.0 + env: + DEFAULT_BRANCH: origin/main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IGNORE_GITIGNORED_FILES: true + VALIDATE_ALL_CODEBASE: true + VALIDATE_CHECKOV: true + VALIDATE_EDITORCONFIG: true + VALIDATE_GITHUB_ACTIONS: true + VALIDATE_JSON: true + VALIDATE_MARKDOWN: true + VALIDATE_GITLEAKS: true + VALIDATE_YAML: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1aba5b4..032d4f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,14 +7,14 @@ name: 'CMake (Windows)' on: push: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - LICENSE - '.azuredevops/**' - '.nuget/*' pull_request: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - LICENSE @@ -80,20 +80,20 @@ jobs: arch: amd64_arm64 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: 'Install Ninja' - run: choco install ninja + - name: 'Install Ninja' + run: choco install ninja - - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - with: - arch: ${{ matrix.arch }} - toolset: ${{ matrix.toolver }} + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: ${{ matrix.arch }} + toolset: ${{ matrix.toolver }} - - name: 'Configure CMake' - working-directory: ${{ github.workspace }} - run: cmake --preset=${{ matrix.build_type }} + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} - - name: 'Build' - working-directory: ${{ github.workspace }} - run: cmake --build out\build\${{ matrix.build_type }} + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 1668227..74a9c73 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -7,14 +7,14 @@ name: MSBuild on: push: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - LICENSE - '.azuredevops/**' - '.nuget/*' pull_request: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - LICENSE @@ -26,7 +26,7 @@ permissions: jobs: build: - runs-on: windows-${{ matrix.vs }} + runs-on: windows-2022 strategy: fail-fast: false @@ -37,21 +37,27 @@ jobs: platformx: [Win32, x64] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0 - - - name: Build - working-directory: ${{ github.workspace }} - run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platformx }} ./Effects11_${{ matrix.vs }}_Win10.sln - - - if: (matrix.vs == '2022' && matrix.platformx != 'Win32') - name: 'Build (UWP) x64' - working-directory: ${{ github.workspace }} - run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platformx }} ./Effects11_Windows10.sln - - - if: (matrix.vs == '2022' && matrix.platformx == 'Win32') - name: 'Build (UWP) x86' - working-directory: ${{ github.workspace }} - run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=x86 ./Effects11_Windows10.sln + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0 + + - name: Build + working-directory: ${{ github.workspace }} + run: > + msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platformx }} + Effects11_${{ matrix.vs }}_Win10.sln + + - if: (matrix.vs == '2022' && matrix.platformx != 'Win32') + name: 'Build (UWP) x64' + working-directory: ${{ github.workspace }} + run: > + msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platformx }} + Effects11_Windows10.sln + + - if: (matrix.vs == '2022' && matrix.platformx == 'Win32') + name: 'Build (UWP) x86' + working-directory: ${{ github.workspace }} + run: > + msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=x86 + Effects11_Windows10.sln diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index c824c3c..d86147a 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -7,14 +7,14 @@ name: Microsoft C++ Code Analysis on: push: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - '.azuredevops/**' - LICENSE - '.nuget/*' pull_request: - branches: [ "main" ] + branches: "main" paths-ignore: - '*.md' - '.azuredevops/**' diff --git a/Binary/EffectBinaryFormat.h b/Binary/EffectBinaryFormat.h index 55ccf60..271c2c0 100644 --- a/Binary/EffectBinaryFormat.h +++ b/Binary/EffectBinaryFormat.h @@ -2,7 +2,7 @@ // File: EffectBinaryFormat.h // // Direct3D11 Effects Binary Format -// This is the binary file interface shared between the Effects +// This is the binary file interface shared between the Effects // compiler and runtime. // // Copyright (c) Microsoft Corporation. @@ -30,7 +30,7 @@ struct EVersionTag }; // versions must be listed in ascending order -static const EVersionTag g_EffectVersions[] = +static const EVersionTag g_EffectVersions[] = { { "fx_4_0", D3DX11_FXL_VERSION(4,0), 0xFEFF1001 }, { "fx_4_1", D3DX11_FXL_VERSION(4,1), 0xFEFF1011 }, @@ -70,7 +70,7 @@ enum ELhsType : int ELHS_GeometryShaderSO, // When setting SO assignments, GeometryShaderSO precedes the actual GeometryShader assn - ELHS_ComputeShaderBlock, + ELHS_ComputeShaderBlock, ELHS_HullShaderBlock, ELHS_DomainShaderBlock, @@ -274,15 +274,15 @@ inline bool IsShaderResourceHelper(EVarType InVarType, EObjectType InObjType) { return (InVarType == EVT_Object) && ((InObjType == EOT_Texture) || - (InObjType == EOT_Texture1D) || + (InObjType == EOT_Texture1D) || (InObjType == EOT_Texture1DArray) || - (InObjType == EOT_Texture2D) || + (InObjType == EOT_Texture2D) || (InObjType == EOT_Texture2DArray) || - (InObjType == EOT_Texture2DMS) || + (InObjType == EOT_Texture2DMS) || (InObjType == EOT_Texture2DMSArray) || - (InObjType == EOT_Texture3D) || + (InObjType == EOT_Texture3D) || (InObjType == EOT_TextureCube) || - (InObjType == EOT_TextureCubeArray) || + (InObjType == EOT_TextureCubeArray) || (InObjType == EOT_Buffer) || (InObjType == EOT_StructuredBuffer) || (InObjType == EOT_ByteAddressBuffer)); @@ -384,7 +384,7 @@ struct SBinaryHeader SVarCounts Effect; SVarCounts Pool; - + uint32_t cTechniques; uint32_t cbUnstructured; @@ -478,11 +478,11 @@ struct SBinaryObjectVariable // Initializer data: // - // The type structure pointed to by oType gives you Elements, + // The type structure pointed to by oType gives you Elements, // VarType (must be EVT_Object), and ObjectType // // For ObjectType == EOT_Blend, EOT_DepthStencil, EOT_Rasterizer, EOT_Sampler - // struct + // struct // { // uint32_t cAssignments; // SBinaryAssignment Assignments[cAssignments]; @@ -522,11 +522,11 @@ struct SBinaryType uint32_t oTypeName; // Offset to friendly type name ("float4", "VS_OUTPUT") EVarType VarType; // Numeric, Object, or Struct uint32_t Elements; // # of array elements (0 for non-arrays) - uint32_t TotalSize; // Size in bytes; not necessarily Stride * Elements for arrays + uint32_t TotalSize; // Size in bytes; not necessarily Stride * Elements for arrays // because of possible gap left in final register uint32_t Stride; // If an array, this is the spacing between elements. // For unpacked arrays, always divisible by 16-bytes (1 register). - // No support for packed arrays + // No support for packed arrays uint32_t PackedSize; // Size, in bytes, of this data typed when fully packed struct SBinaryMember @@ -540,7 +540,7 @@ struct SBinaryType // the data that follows depends on the VarType: // Numeric: SType::SNumericType // Object: EObjectType - // Struct: + // Struct: // struct // { // uint32_t cMembers; @@ -625,7 +625,7 @@ struct SBinaryAssignment }; struct SIndexedObjectExpression - { + { uint32_t oArrayName; uint32_t oCode; }; diff --git a/Binary/EffectStates11.h b/Binary/EffectStates11.h index a5fd1e7..f723562 100644 --- a/Binary/EffectStates11.h +++ b/Binary/EffectStates11.h @@ -185,7 +185,7 @@ const LValue g_lvGeneral[] = { "ScissorEnable", EBT_Rasterizer, D3D_SVT_BOOL, 1, 1, false, g_rvBOOL, ELHS_ScissorEnable, offsetof_fx(SRasterizerBlock, BackingStore.ScissorEnable), 0 }, { "MultisampleEnable", EBT_Rasterizer, D3D_SVT_BOOL, 1, 1, false, g_rvBOOL, ELHS_MultisampleEnable, offsetof_fx(SRasterizerBlock, BackingStore.MultisampleEnable), 0 }, { "AntialiasedLineEnable", EBT_Rasterizer, D3D_SVT_BOOL, 1, 1, false, g_rvBOOL, ELHS_AntialiasedLineEnable, offsetof_fx(SRasterizerBlock, BackingStore.AntialiasedLineEnable), 0 }, - + { "DepthEnable", EBT_DepthStencil, D3D_SVT_BOOL, 1, 1, false, g_rvBOOL, ELHS_DepthEnable, offsetof_fx(SDepthStencilBlock, BackingStore.DepthEnable), 0 }, { "DepthWriteMask", EBT_DepthStencil, D3D_SVT_UINT, 1, 1, false, g_rvDEPTH_WRITE_MASK, ELHS_DepthWriteMask, offsetof_fx(SDepthStencilBlock, BackingStore.DepthWriteMask), 0 }, { "DepthFunc", EBT_DepthStencil, D3D_SVT_UINT, 1, 1, false, g_rvCMP, ELHS_DepthFunc, offsetof_fx(SDepthStencilBlock, BackingStore.DepthFunc), 0 }, @@ -223,7 +223,7 @@ const LValue g_lvGeneral[] = { "MaxLOD", EBT_Sampler, D3D_SVT_FLOAT, 1, 1, false, nullptr, ELHS_MaxLOD, offsetof_fx(SSamplerBlock, BackingStore.SamplerDesc.MaxLOD), 0 }, { "Texture", EBT_Sampler, D3D_SVT_TEXTURE, 1, 1, false, g_rvNULL, ELHS_Texture, offsetof_fx(SSamplerBlock, BackingStore.pTexture), 0 }, - // D3D11 + // D3D11 { "HullShader", EBT_Pass, D3D11_SVT_HULLSHADER, 1, 1, false, g_rvNULL, ELHS_HullShaderBlock, offsetof_fx(SPassBlock, BackingStore.pHullShaderBlock), 0 }, { "DomainShader", EBT_Pass, D3D11_SVT_DOMAINSHADER, 1, 1, false, g_rvNULL, ELHS_DomainShaderBlock, offsetof_fx(SPassBlock, BackingStore.pDomainShaderBlock), 0 }, { "ComputeShader", EBT_Pass, D3D11_SVT_COMPUTESHADER, 1, 1, false, g_rvNULL, ELHS_ComputeShaderBlock, offsetof_fx(SPassBlock, BackingStore.pComputeShaderBlock), 0 }, diff --git a/Binary/SOParser.h b/Binary/SOParser.h index 412ea15..19a4c53 100644 --- a/Binary/SOParser.h +++ b/Binary/SOParser.h @@ -16,7 +16,7 @@ namespace D3DX11Effects { - + ////////////////////////////////////////////////////////////////////////// // CSOParser ////////////////////////////////////////////////////////////////////////// @@ -198,7 +198,7 @@ class CSOParser assert( pSemantic ); - pSemantic = strchr( pSemantic, '.' ); + pSemantic = strchr( pSemantic, '.' ); if( pSemantic == nullptr ) { @@ -245,7 +245,7 @@ class CSOParser _Analysis_assume_( ppSemantic && *ppSemantic ); HRESULT hr = S_OK; - LPSTR pColon = strchr( *ppSemantic, ':' ); + LPSTR pColon = strchr( *ppSemantic, ':' ); if( pColon == nullptr ) return S_OK; @@ -302,7 +302,7 @@ class CSOParser { m_newEntry.SemanticIndex = atoi( pSemantic + uLen ); pSemantic[uLen] = '\0'; - } + } else { m_newEntry.SemanticIndex = 0; diff --git a/CHANGELOG.md b/CHANGELOG.md index 3745fcc..6380a54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,7 +120,7 @@ http://go.microsoft.com/fwlink/?LinkId=271568 ### November 6, 2012 (11.04) * Added ``IUnknown`` as a base class for all Effects 11 interfaces to simplify use in managed interop sceanrios, although the lifetime for these objects is still based on the lifetime of the parent ID3DX11Effect object. Therefore reference counting is ignored for these interfaces. - + ID3DX11EffectType, ID3DX11EffectVariable and derived classes, ID3DX11EffectPass, ID3DX11EffectTechnique, and ID3DX11EffectGroup + * ID3DX11EffectType, ID3DX11EffectVariable and derived classes, ID3DX11EffectPass, ID3DX11EffectTechnique, and ID3DX11EffectGroup ### October 24, 2012 (11.03) * Removed the dependency on the D3DX11 headers, so FX11 no longer requires the legacy DirectX SDK to build. diff --git a/Effect.h b/Effect.h index 003ef2b..be2382c 100644 --- a/Effect.h +++ b/Effect.h @@ -65,11 +65,11 @@ typedef size_t Timer; ////////////////////////////////////////////////////////////////////////// // CEffectMatrix is used internally instead of float arrays -struct CEffectMatrix +struct CEffectMatrix { - union + union { - struct + struct { float _11, _12, _13, _14; float _21, _22, _23, _24; @@ -81,7 +81,7 @@ struct CEffectMatrix }; }; -struct CEffectVector4 +struct CEffectVector4 { float x; float y; @@ -92,7 +92,7 @@ struct CEffectVector4 union UDataPointer { void *pGeneric; - uint8_t *pNumeric; + uint8_t *pNumeric; float *pNumericFloat; uint32_t *pNumericDword; int *pNumericInt; @@ -142,14 +142,14 @@ struct SMemberDataPointer }; struct SType : public ID3DX11EffectType -{ +{ static const UINT_PTR c_InvalidIndex = (uint32_t) -1; static const uint32_t c_ScalarSize = sizeof(uint32_t); // packing rule constants static const uint32_t c_ScalarsPerRegister = 4; - static const uint32_t c_RegisterSize = c_ScalarsPerRegister * c_ScalarSize; // must be a power of 2!! - + static const uint32_t c_RegisterSize = c_ScalarsPerRegister * c_ScalarSize; // must be a power of 2!! + EVarType VarType; // numeric, object, struct uint32_t Elements; // # of array elements (0 for non-arrays) char *pTypeName; // friendly name of the type: "VS_OUTPUT", "float4", etc. @@ -171,12 +171,12 @@ struct SType : public ID3DX11EffectType uint32_t Stride; // Number of bytes to advance between elements. // Typically a multiple of 16 for arrays, vectors, matrices. - // For scalars and small vectors/matrices, this can be 4 or 8. + // For scalars and small vectors/matrices, this can be 4 or 8. uint32_t PackedSize; // Size, in bytes, of this data typed when fully packed union - { + { SBinaryNumericType NumericType; EObjectType ObjectType; // not all values of EObjectType are valid here (e.g. constant buffer) struct @@ -205,7 +205,7 @@ struct SType : public ID3DX11EffectType } bool IsEqual(SType *pOtherType) const; - + bool IsObjectType(EObjectType ObjType) const { return IsObjectTypeHelper(VarType, ObjectType, ObjType); @@ -251,8 +251,8 @@ struct SType : public ID3DX11EffectType return IsDepthStencilViewHelper(VarType, ObjectType); } - uint32_t GetTotalUnpackedSize(_In_ bool IsSingleElement) const; - uint32_t GetTotalPackedSize(_In_ bool IsSingleElement) const; + uint32_t GetTotalUnpackedSize(_In_ bool IsSingleElement) const; + uint32_t GetTotalPackedSize(_In_ bool IsSingleElement) const; HRESULT GetDescHelper(_Out_ D3DX11_EFFECT_TYPE_DESC *pDesc, _In_ bool IsSingleElement) const; STDMETHOD_(bool, IsValid)() override { return true; } @@ -458,7 +458,7 @@ struct SPassBlock : SBaseBlock, public ID3DX11EffectPass STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override; STDMETHOD(Apply)(_In_ uint32_t Flags, _In_ ID3D11DeviceContext* pContext) override; - + STDMETHOD(ComputeStateBlockMask)(_Inout_ D3DX11_STATE_BLOCK_MASK *pStateBlockMask) override; IUNKNOWN_IMP(SPassBlock, ID3DX11EffectPass, IUnknown); @@ -619,7 +619,7 @@ struct SShaderBlock }; bool IsValid; - SD3DShaderVTable *pVT; + SD3DShaderVTable *pVT; // This value is nullptr if the shader is nullptr or was never initialized SReflectionData *pReflectionData; @@ -644,7 +644,7 @@ struct SShaderBlock uint32_t TBufferDepCount; SConstantBuffer **ppTbufDeps; - ID3DBlob *pInputSignatureBlob; // The input signature is separated from the bytecode because it + ID3DBlob *pInputSignatureBlob; // The input signature is separated from the bytecode because it // is always available, even after Optimize() has been called. SShaderBlock(SD3DShaderVTable *pVirtualTable = nullptr) noexcept; @@ -807,7 +807,7 @@ struct SConstantBuffer : public TUncastableVariable SGlobalVariable *pVariables; // array of size [VariableCount], points into effect's contiguous variable list uint32_t ExplicitBindPoint; // Used when a CB has been explicitly bound (register(bXX)). -1 if not - bool IsDirty:1; // Set when any member is updated; cleared on CB apply + bool IsDirty:1; // Set when any member is updated; cleared on CB apply bool IsTBuffer:1; // true iff TBuffer.pShaderResource != nullptr bool IsUserManaged:1; // Set if you don't want effects to update this buffer bool IsEffectOptimized:1;// Set if the effect has been optimized @@ -901,8 +901,8 @@ struct SConstantBuffer : public TUncastableVariable enum ERuntimeAssignmentType { ERAT_Invalid, - // [Destination] refers to the destination location, which is always the backing store of the pass/state block. - // [Source] refers to the current source of data, always coming from either a constant buffer's + // [Destination] refers to the destination location, which is always the backing store of the pass/state block. + // [Source] refers to the current source of data, always coming from either a constant buffer's // backing store (for numeric assignments), an object variable's block array, or an anonymous (unowned) block // Numeric variables: @@ -943,7 +943,7 @@ struct SAssignment // The value of SAssignment.AssignmentType determines how the other fields behave // (DependencyCount, pDependencies, Destination, and Source) - ERuntimeAssignmentType AssignmentType; + ERuntimeAssignmentType AssignmentType; Timer LastRecomputedTime; @@ -999,7 +999,7 @@ struct SPointerMapping uint32_t Hash() { - // hash the pointer itself + // hash the pointer itself // (using the pointer as a hash would be very bad) return ComputeHash((uint8_t*)&pOld, sizeof(pOld)); } @@ -1023,12 +1023,12 @@ class CEffectHeap uint32_t GetSize(); uint8_t* GetDataStart() { return m_pData; } - // AddData and AddString append existing data to the buffer - they change m_dwSize. Users are + // AddData and AddString append existing data to the buffer - they change m_dwSize. Users are // not expected to modify the data pointed to by the return pointer HRESULT AddString(_In_z_ const char *pString, _Outptr_result_z_ char **ppPointer); HRESULT AddData(_In_reads_(dwSize) const void *pData, _In_ uint32_t dwSize, _Outptr_ void **ppPointer); - // Allocate behaves like a standard new - it will allocate memory, move m_dwSize. The caller is + // Allocate behaves like a standard new - it will allocate memory, move m_dwSize. The caller is // expected to use the returned pointer void* Allocate(uint32_t dwSize); @@ -1063,7 +1063,7 @@ class CEffect : public ID3DX11Effect friend struct SConstantBuffer; friend struct TSamplerVariable>; friend struct TSamplerVariable>>; - + protected: uint32_t m_RefCount; @@ -1128,10 +1128,10 @@ class CEffect : public ID3DX11Effect SRenderTargetView *m_pRenderTargetViews; uint32_t m_DepthStencilViewCount; - SDepthStencilView *m_pDepthStencilViews; + SDepthStencilView *m_pDepthStencilViews; Timer m_LocalTimer; - + // temporary index variable for assignment evaluation uint32_t m_FXLIndex; @@ -1143,7 +1143,7 @@ class CEffect : public ID3DX11Effect CEffectVectorOwner m_pTypeInterfaces; CEffectVectorOwner m_pMemberInterfaces; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// // String & Type pooling typedef SType *LPSRUNTIMETYPE; @@ -1169,9 +1169,9 @@ class CEffect : public ID3DX11Effect HRESULT OptimizeTypes(_Inout_ CPointerMappingTable *pMappingTable, _In_ bool Cloning = false); - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// // Runtime (performance critical) - + void ApplyShaderBlock(_In_ SShaderBlock *pBlock); bool ApplyRenderStateBlock(_In_ SBaseBlock *pBlock); bool ApplySamplerBlock(_In_ SSamplerBlock *pBlock); @@ -1179,9 +1179,9 @@ class CEffect : public ID3DX11Effect bool EvaluateAssignment(_Inout_ SAssignment *pAssignment); bool ValidateShaderBlock(_Inout_ SShaderBlock* pBlock ); bool ValidatePassBlock(_Inout_ SPassBlock* pBlock ); - - ////////////////////////////////////////////////////////////////////////// - // Non-runtime functions (not performance critical) + + ////////////////////////////////////////////////////////////////////////// + // Non-runtime functions (not performance critical) SGlobalVariable *FindLocalVariableByName(_In_z_ LPCSTR pVarName); // Looks in the current effect only SGlobalVariable *FindVariableByName(_In_z_ LPCSTR pVarName); @@ -1199,7 +1199,7 @@ class CEffect : public ID3DX11Effect void ValidateIndex(_In_ uint32_t Elements); - void IncrementTimer(); + void IncrementTimer(); void HandleLocalTimerRollover(); friend struct SConstantBuffer; @@ -1216,11 +1216,11 @@ class CEffect : public ID3DX11Effect HRESULT BindToDevice(_In_ ID3D11Device *pDevice, _In_z_ LPCSTR srcName ); Timer GetCurrentTime() const { return m_LocalTimer; } - + bool IsReflectionData(void *pData) const { return m_pReflection->m_Heap.IsInHeap(pData); } bool IsRuntimeData(void *pData) const { return m_Heap.IsInHeap(pData); } - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// // Public interface // IUnknown @@ -1231,7 +1231,7 @@ class CEffect : public ID3DX11Effect // ID3DX11Effect STDMETHOD_(bool, IsValid)() override { return true; } - STDMETHOD(GetDevice)(_Outptr_ ID3D11Device** ppDevice) override; + STDMETHOD(GetDevice)(_Outptr_ ID3D11Device** ppDevice) override; STDMETHOD(GetDesc)(_Out_ D3DX11_EFFECT_DESC *pDesc) override; @@ -1254,7 +1254,7 @@ class CEffect : public ID3DX11Effect STDMETHOD(Optimize)() override; STDMETHOD_(bool, IsOptimized)() override; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// // New reflection helpers ID3DX11EffectType * CreatePooledSingleElementTypeInterface(_In_ SType *pType); diff --git a/EffectLoad.cpp b/EffectLoad.cpp index 95e3509..7b11cb6 100644 --- a/EffectLoad.cpp +++ b/EffectLoad.cpp @@ -97,27 +97,27 @@ D3D_SHADER_VARIABLE_TYPE GetSimpleParameterTypeFromObjectType(EObjectType Object case EOT_String: return D3D_SVT_STRING; case EOT_Blend: - return D3D_SVT_BLEND; + return D3D_SVT_BLEND; case EOT_DepthStencil: - return D3D_SVT_DEPTHSTENCIL; + return D3D_SVT_DEPTHSTENCIL; case EOT_Rasterizer: - return D3D_SVT_RASTERIZER; + return D3D_SVT_RASTERIZER; case EOT_PixelShader: case EOT_PixelShader5: - return D3D_SVT_PIXELSHADER; + return D3D_SVT_PIXELSHADER; case EOT_VertexShader: case EOT_VertexShader5: - return D3D_SVT_VERTEXSHADER; + return D3D_SVT_VERTEXSHADER; case EOT_GeometryShader: case EOT_GeometryShaderSO: case EOT_GeometryShader5: - return D3D_SVT_GEOMETRYSHADER; + return D3D_SVT_GEOMETRYSHADER; case EOT_HullShader5: - return D3D_SVT_HULLSHADER; + return D3D_SVT_HULLSHADER; case EOT_DomainShader5: - return D3D_SVT_DOMAINSHADER; + return D3D_SVT_DOMAINSHADER; case EOT_ComputeShader5: - return D3D_SVT_COMPUTESHADER; + return D3D_SVT_COMPUTESHADER; case EOT_RenderTargetView: return D3D_SVT_RENDERTARGETVIEW; case EOT_DepthStencilView: @@ -134,7 +134,7 @@ D3D_SHADER_VARIABLE_TYPE GetSimpleParameterTypeFromObjectType(EObjectType Object case EOT_TextureCubeArray: return D3D_SVT_TEXTURE; case EOT_Buffer: - return D3D_SVT_BUFFER; + return D3D_SVT_BUFFER; case EOT_Sampler: return D3D_SVT_SAMPLER; case EOT_ByteAddressBuffer: @@ -178,7 +178,7 @@ inline HRESULT VerifyPointer(uint32_t oBase, uint32_t dwSize, uint32_t dwMaxSize } ////////////////////////////////////////////////////////////////////////// -// EffectHeap +// EffectHeap // A simple class which assists in adding data to a block of memory ////////////////////////////////////////////////////////////////////////// @@ -209,7 +209,7 @@ HRESULT CEffectHeap::ReserveMemory(uint32_t dwSize) m_dwBufferSize = dwSize; VN( m_pData = new uint8_t[m_dwBufferSize] ); - + // make sure that we have machine word alignment assert(m_pData == AlignToPowerOf2(m_pData, c_DataAlignment)); @@ -237,7 +237,7 @@ HRESULT CEffectHeap::AddDataInternal(_In_reads_bytes_(dwSize) const void *pData, chkFinalSize += c_DataAlignment; // account for alignment VHD( chkFinalSize.GetValue(&finalSize), "Overflow while adding data to Effect heap." ); - + // align original value finalSize = AlignToPowerOf2(finalSize - c_DataAlignment, c_DataAlignment); VBD( finalSize <= m_dwBufferSize, "Overflow adding data to Effect heap." ); @@ -287,7 +287,7 @@ HRESULT CEffectHeap::MoveString(char **ppString) // Allocates space but does not move data // The general heap is freed as a whole, so we don't worry about leaking the given string pointer. // This data is forcibly aligned, so make sure you account for that in calculating heap size -_Use_decl_annotations_ +_Use_decl_annotations_ HRESULT CEffectHeap::MoveEmptyDataBlock(void **ppData, uint32_t size) { HRESULT hr; @@ -337,7 +337,7 @@ HRESULT CEffectHeap::MoveInterfaceParameters(uint32_t InterfaceCount, SShaderBlo // Moves data from the general heap to the private heap and modifies the pointer to -// point to the new memory block +// point to the new memory block // The general heap is freed as a whole, so we don't worry about leaking the given pointer. // This data is forcibly aligned, so make sure you account for that in calculating heap size _Use_decl_annotations_ @@ -362,7 +362,7 @@ HRESULT CEffectHeap::MoveData(void **ppData, uint32_t size) ////////////////////////////////////////////////////////////////////////// -// Load API +// Load API ////////////////////////////////////////////////////////////////////////// _Use_decl_annotations_ @@ -376,7 +376,7 @@ HRESULT CEffect::LoadEffect(const void *pEffectBuffer, uint32_t cbEffectBuffer) DPF(0, "%s: pEffectBuffer is nullptr.", g_szEffectLoadArea); VH( E_INVALIDARG ); } - + VH( loader.LoadEffect(this, pEffectBuffer, cbEffectBuffer) ); lExit: @@ -448,7 +448,7 @@ HRESULT CEffectLoader::GetStringAndAddToReflection(uint32_t offset, char **ppStr HRESULT hr = S_OK; LPCSTR pName; size_t oldPos; - + if (offset == 0) { *ppString = nullptr; @@ -460,7 +460,7 @@ HRESULT CEffectLoader::GetStringAndAddToReflection(uint32_t offset, char **ppStr VH( m_msUnstructured.ReadAtOffset(offset, &pName) ); m_ReflectionMemory += AlignToPowerOf2( (uint32_t)strlen(pName) + 1, c_DataAlignment); *ppString = const_cast(pName); - + m_msUnstructured.Seek(oldPos); lExit: @@ -472,7 +472,7 @@ HRESULT CEffectLoader::GetStringAndAddToReflection(uint32_t offset, char **ppStr // This function should be used in 1:1 conjunction with CEffectHeap::MoveInterfaceParameters; // that is, any array of parameters added to the reflection heap with this function // must be relocated with MoveInterfaceParameters at some point later on. -_Use_decl_annotations_ +_Use_decl_annotations_ HRESULT CEffectLoader::GetInterfaceParametersAndAddToReflection( uint32_t InterfaceCount, uint32_t offset, SShaderBlock::SInterfaceParameter **ppInterfaces ) { HRESULT hr = S_OK; @@ -514,12 +514,12 @@ HRESULT CEffectLoader::GetInterfaceParametersAndAddToReflection( uint32_t Interf HRESULT CEffectLoader::FixupCBPointer(_Inout_ SConstantBuffer **ppCB) { HRESULT hr = S_OK; - + size_t index = (SConstantBuffer*)*ppCB - m_pOldCBs; assert( index * sizeof(SConstantBuffer) == ((size_t)(SConstantBuffer*)*ppCB - (size_t)m_pOldCBs) ); VBD( index < m_pEffect->m_CBCount, "Internal loading error: invalid constant buffer index." ); *ppCB = (SConstantBuffer*)(m_pEffect->m_pCBs + index); - + lExit: return hr; } @@ -528,7 +528,7 @@ HRESULT CEffectLoader::FixupShaderPointer(_Inout_ SShaderBlock **ppShaderBlock) { HRESULT hr = S_OK; if (*ppShaderBlock != &g_NullVS && *ppShaderBlock != &g_NullGS && *ppShaderBlock != &g_NullPS && - *ppShaderBlock != &g_NullHS && *ppShaderBlock != &g_NullDS && *ppShaderBlock != &g_NullCS && + *ppShaderBlock != &g_NullHS && *ppShaderBlock != &g_NullDS && *ppShaderBlock != &g_NullCS && *ppShaderBlock != nullptr) { size_t index = *ppShaderBlock - m_pOldShaders; @@ -632,7 +632,7 @@ HRESULT CEffectLoader::FixupShaderResourcePointer(_Inout_ SShaderResource **ppRe { size_t index = *ppResource - m_pOldShaderResources; assert( index * sizeof(SShaderResource) == ((size_t)*ppResource - (size_t)m_pOldShaderResources) ); - + // could be a TBuffer or a texture; better check first if (index < m_pEffect->m_ShaderResourceCount) { @@ -648,7 +648,7 @@ HRESULT CEffectLoader::FixupShaderResourcePointer(_Inout_ SShaderResource **ppRe *ppResource = &m_pEffect->m_pCBs[index].TBuffer; } } - + lExit: return hr; } @@ -860,7 +860,7 @@ HRESULT CEffectLoader::LoadEffect(CEffect *pEffect, const void *pEffectBuffer, u VN( m_pEffect->m_pRasterizerBlocks = PRIVATENEW SRasterizerBlock[m_pHeader->cRasterizerStateBlocks] ); VN( m_pEffect->m_pBlendBlocks = PRIVATENEW SBlendBlock[m_pHeader->cBlendStateBlocks] ); VN( m_pEffect->m_pSamplerBlocks = PRIVATENEW SSamplerBlock[m_pHeader->cSamplers] ); - + // we allocate raw bytes for variables because they are polymorphic types that need to be placement new'ed VN( m_pEffect->m_pVariables = (SGlobalVariable *)PRIVATENEW uint8_t[varSize] ); VN( m_pEffect->m_pAnonymousShaders = PRIVATENEW SAnonymousShader[m_pHeader->cInlineShaders] ); @@ -889,7 +889,7 @@ HRESULT CEffectLoader::LoadEffect(CEffect *pEffect, const void *pEffectBuffer, u { VH( BuildShaderBlock(&m_pEffect->m_pShaderBlocks[i]) ); } - + for( size_t iGroup=0; iGroupcGroups; iGroup++ ) { SGroup *pGroup = &m_pEffect->m_pGroups[iGroup]; @@ -915,7 +915,7 @@ HRESULT CEffectLoader::LoadEffect(CEffect *pEffect, const void *pEffectBuffer, u VH( ReallocateEffectData() ); VB( m_pReflection->m_Heap.GetSize() == m_ReflectionMemory ); - + // Verify that all of the various block/variable types were loaded VBD( m_pEffect->m_VariableCount == (m_pHeader->Effect.cObjectVariables + m_pHeader->Effect.cNumericVariables + m_pHeader->cInterfaceVariables), "Internal loading error: mismatched variable count." ); VBD( m_pEffect->m_ShaderBlockCount == m_pHeader->cTotalShaders, "Internal loading error: mismatched shader block count." ); @@ -934,7 +934,7 @@ HRESULT CEffectLoader::LoadEffect(CEffect *pEffect, const void *pEffectBuffer, u // Uncomment if you really need this information // DPF(0, "Effect heap size: %d, reflection heap size: %d, allocations avoided: %d", m_EffectMemory, m_ReflectionMemory, m_BulkHeap.m_cAllocations); - + lExit: return hr; } @@ -994,7 +994,7 @@ HRESULT CEffectLoader::LoadTypeAndAddToPool(SType **ppType, uint32_t dwOffset) uint8_t *pHashBuffer; uint32_t hash; SVariable *pTempMembers = nullptr; - + m_HashBuffer.Empty(); VHD( m_msUnstructured.ReadAtOffset(dwOffset, sizeof(SBinaryType), (void**) &psType), "Invalid pEffectBuffer: cannot read type." ); @@ -1017,30 +1017,30 @@ HRESULT CEffectLoader::LoadTypeAndAddToPool(SType **ppType, uint32_t dwOffset) VHD( m_msUnstructured.Read((void**) &pObjectType, sizeof(uint32_t)), "Invalid pEffectBuffer: cannot read object type." ); temporaryType.ObjectType = *pObjectType; VBD( temporaryType.VarType > EVT_Invalid && temporaryType.VarType < EVT_Count, "Invalid pEffectBuffer: invalid object type." ); - - VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + + + VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + sizeof(temporaryType.pTypeName) + sizeof(temporaryType.ObjectType)) ); - memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); + memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); pHashBuffer += sizeof(temporaryType.VarType); - memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); + memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); pHashBuffer += sizeof(temporaryType.Elements); - memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); + memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); pHashBuffer += sizeof(temporaryType.pTypeName); - memcpy(pHashBuffer, &temporaryType.ObjectType, sizeof(temporaryType.ObjectType)); + memcpy(pHashBuffer, &temporaryType.ObjectType, sizeof(temporaryType.ObjectType)); break; case EVT_Interface: - temporaryType.InterfaceType = nullptr; + temporaryType.InterfaceType = nullptr; - VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + + VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + sizeof(temporaryType.pTypeName) + sizeof(temporaryType.ObjectType)) ); - memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); + memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); pHashBuffer += sizeof(temporaryType.VarType); - memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); + memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); pHashBuffer += sizeof(temporaryType.Elements); - memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); + memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); pHashBuffer += sizeof(temporaryType.pTypeName); - memcpy(pHashBuffer, &temporaryType.ObjectType, sizeof(temporaryType.ObjectType)); + memcpy(pHashBuffer, &temporaryType.ObjectType, sizeof(temporaryType.ObjectType)); break; case EVT_Numeric: @@ -1057,15 +1057,15 @@ HRESULT CEffectLoader::LoadTypeAndAddToPool(SType **ppType, uint32_t dwOffset) VBD( temporaryType.NumericType.IsColumnMajor == false, "Invalid pEffectBuffer: only matricies can be column major." ); } - VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + + VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + sizeof(temporaryType.pTypeName) + sizeof(temporaryType.NumericType)) ); - memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); + memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); pHashBuffer += sizeof(temporaryType.VarType); - memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); + memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); pHashBuffer += sizeof(temporaryType.Elements); - memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); + memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); pHashBuffer += sizeof(temporaryType.pTypeName); - memcpy(pHashBuffer, &temporaryType.NumericType, sizeof(temporaryType.NumericType)); + memcpy(pHashBuffer, &temporaryType.NumericType, sizeof(temporaryType.NumericType)); break; case EVT_Struct: @@ -1075,7 +1075,7 @@ HRESULT CEffectLoader::LoadTypeAndAddToPool(SType **ppType, uint32_t dwOffset) VN( pTempMembers = new SVariable[cMembers] ); temporaryType.StructType.pMembers = pTempMembers; - + // read up all of the member descriptors at once SBinaryType::SBinaryMember *psMember; VHD( m_msUnstructured.Read((void**) &psMember, cMembers * sizeof(*psMember)), "Invalid pEffectBuffer: cannot read struct members." ); @@ -1105,12 +1105,12 @@ HRESULT CEffectLoader::LoadTypeAndAddToPool(SType **ppType, uint32_t dwOffset) uint32_t totalSize; totalSize = 0; for (iMember=0; iMemberpType, psMember[iMember].oType) ); VH( LoadStringAndAddToPool(&pMember->pName, psMember[iMember].oName) ); VH( LoadStringAndAddToPool(&pMember->pSemantic, psMember[iMember].oSemantic) ); - + totalSize = psMember[iMember].Offset + pMember->pType->TotalSize; } VBD( AlignToPowerOf2(totalSize, SType::c_RegisterSize) == temporaryType.Stride, "Internal loading error: invlid type size." ); - VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + + VN( pHashBuffer = m_HashBuffer.AddRange(sizeof(temporaryType.VarType) + sizeof(temporaryType.Elements) + sizeof(temporaryType.pTypeName) + sizeof(temporaryType.StructType.Members) + cMembers * sizeof(SVariable)) ); - memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); + memcpy(pHashBuffer, &temporaryType.VarType, sizeof(temporaryType.VarType)); pHashBuffer += sizeof(temporaryType.VarType); - memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); + memcpy(pHashBuffer, &temporaryType.Elements, sizeof(temporaryType.Elements)); pHashBuffer += sizeof(temporaryType.Elements); - memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); + memcpy(pHashBuffer, &temporaryType.pTypeName, sizeof(temporaryType.pTypeName)); pHashBuffer += sizeof(temporaryType.pTypeName); - memcpy(pHashBuffer, &temporaryType.StructType.Members, sizeof(temporaryType.StructType.Members)); + memcpy(pHashBuffer, &temporaryType.StructType.Members, sizeof(temporaryType.StructType.Members)); pHashBuffer += sizeof(temporaryType.StructType.Members); memcpy(pHashBuffer, temporaryType.StructType.pMembers, cMembers * sizeof(SVariable)); break; @@ -1186,12 +1186,12 @@ uint32_t CEffectLoader::UnpackData(uint8_t *pDestData, uint8_t *pSrcData, uint32 for (size_t j = 0; j < pType->StructType.Members; ++ j) { uint32_t br; - assert(PackedDataSize > bytesRead); + assert(PackedDataSize > bytesRead); - VH( UnpackData(pDestData + pType->StructType.pMembers[j].Data.Offset, - pSrcData + bytesRead, PackedDataSize - bytesRead, + VH( UnpackData(pDestData + pType->StructType.pMembers[j].Data.Offset, + pSrcData + bytesRead, PackedDataSize - bytesRead, pType->StructType.pMembers[j].pType, &br) ); - + bytesRead += br; } pDestData += pType->Stride; @@ -1255,7 +1255,7 @@ uint32_t CEffectLoader::UnpackData(uint8_t *pDestData, uint8_t *pSrcData, uint32 // shouldn't be called on non-struct/numeric types assert(0); VHD(E_FAIL, "Internal loading error: UnpackData should not be called on non-struct, non-numeric types." ); - } + } lExit: *pBytesRead = bytesRead; @@ -1276,10 +1276,10 @@ HRESULT CEffectLoader::LoadNumericVariable(_In_ SConstantBuffer *pParentCB) VBD( m_pEffect->m_VariableCount < (m_pHeader->Effect.cObjectVariables + m_pHeader->Effect.cNumericVariables + m_pHeader->cInterfaceVariables), "Internal loading error: invalid variable counts."); pVar = &m_pEffect->m_pVariables[m_pEffect->m_VariableCount]; - + // Get type VH( LoadTypeAndAddToPool(&pType, psVar->oType) ); - + // Make sure the right polymorphic type is created VH( PlacementNewVariable(pVar, pType, false) ); @@ -1322,7 +1322,7 @@ HRESULT CEffectLoader::LoadNumericVariable(_In_ SConstantBuffer *pParentCB) VH( UnpackData((uint8_t*) pVar->Data.pGeneric, (uint8_t*) pDefaultValue, pType->PackedSize, pType, &bytesUnpacked) ); VBD( bytesUnpacked == pType->PackedSize, "Invalid pEffectBuffer: invalid type packed size."); } - + // We need to use offsets until we fixup pVar->Data.Offset = psVar->Offset; @@ -1357,7 +1357,7 @@ HRESULT CEffectLoader::LoadCBs() pCB->ExplicitBindPoint = psCB->ExplicitBindPoint; VBD( pCB->Size == AlignToPowerOf2(pCB->Size, SType::c_RegisterSize), "Invalid pEffectBuffer: CB size not a power of 2." ); VN( pCB->pBackingStore = PRIVATENEW uint8_t[pCB->Size] ); - + pCB->MemberDataOffsetPlus4 = m_pEffect->m_MemberDataCount * sizeof(SMemberDataPointer) + 4; m_pEffect->m_MemberDataCount += 2; @@ -1459,7 +1459,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs uint32_t i, j; SBinaryAssignment *psAssignments; - uint32_t finalAssignments = 0; // the number of assignments worth keeping + uint32_t finalAssignments = 0; // the number of assignments worth keeping uint32_t renderTargetViewAssns = 0; // Number of render target view assns, used by passes since SetRTV is a vararg call *pFinalAssignments = 0; @@ -1470,7 +1470,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs // allocate enough room to store all of the assignments (even though some may go unused) VN( (*ppAssignments) = PRIVATENEW SAssignment[Assignments] ) - + // // In this loop, we read assignments 1-by-1, keeping some and discarding others. // We write to the "next" assignment which is given by &(*ppAssignments)[finalAssignments]; @@ -1500,7 +1500,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs assert(g_lvGeneral[psAssignments[i].iState].m_Cols == 1); // uint8_t arrays not supported pAssignment->DataSize = sizeof(uint8_t); // Store an offset for destination instead of a pointer so that it's easy to relocate it later - + break; case D3D_SVT_BOOL: @@ -1662,7 +1662,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs if (pAssignment->IsObjectAssignment()) { - VBD( pVar->pType->VarType == EVT_Object && + VBD( pVar->pType->VarType == EVT_Object && GetSimpleParameterTypeFromObjectType(pVar->pType->ObjectType) == g_lvGeneral[psAssignments[i].iState].m_Type, "Loading error: invalid variable type or object type." ); @@ -1700,7 +1700,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs if (pAssignment->IsObjectAssignment()) { VBD( psConstIndex->Index < pVarArray->pType->Elements, "Invalid pEffectBuffer: out of bounds array index." ); - VBD( pVarArray->pType->VarType == EVT_Object && + VBD( pVarArray->pType->VarType == EVT_Object && GetSimpleParameterTypeFromObjectType(pVarArray->pType->ObjectType) == g_lvGeneral[psAssignments[i].iState].m_Type, "Loading error: invalid variable type or object type." ); @@ -1727,8 +1727,8 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs pAssignment->Source.Offset = pVarArray->Data.Offset + psConstIndex->Index * SType::c_ScalarSize; - // _NumericConstIndex is not used here because _NumericVariable - // does the same stuff in a more general fashion with no perf hit. + // _NumericConstIndex is not used here because _NumericVariable + // does the same stuff in a more general fashion with no perf hit. pAssignment->AssignmentType = ERAT_NumericVariable; // Can't get rid of this assignment @@ -1756,12 +1756,12 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs if (pAssignment->IsObjectAssignment()) { - VBD( pVarArray->pType->VarType == EVT_Object && + VBD( pVarArray->pType->VarType == EVT_Object && GetSimpleParameterTypeFromObjectType(pVarArray->pType->ObjectType) == g_lvGeneral[psAssignments[i].iState].m_Type, "Loading error: invalid variable type or object type." ); // MaxElements is only 16-bits wide - VBD( pVarArray->pType->Elements <= 0xFFFF, "Internal error: array size is too large." ); + VBD( pVarArray->pType->Elements <= 0xFFFF, "Internal error: array size is too large." ); pAssignment->MaxElements = pVarArray->pType->Elements; pAssignment->DependencyCount = 1; @@ -1827,7 +1827,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs VHD( m_msUnstructured.ReadAtOffset(psAssignments[i].oInitializer, sizeof(*psInlineShader5), (void**) &psInlineShader5), "Invalid pEffectBuffer: cannot read inline shader." ); } - + VBD( m_pEffect->m_ShaderBlockCount < m_pHeader->cTotalShaders, "Internal loading error: shader count is out incorrect." ); VBD( m_pEffect->m_AnonymousShaderCount < m_pHeader->cInlineShaders, "Internal loading error: anonymous shader count is out incorrect." ); @@ -1866,7 +1866,7 @@ HRESULT CEffectLoader::LoadAssignments( uint32_t Assignments, SAssignment **ppAs pShaderBlock->pVT = &g_vtPS; VBD( psInlineShader->oSODecl == 0, "Internal loading error: pixel shaders cannot have stream out decls." ); break; - + case ELHS_GeometryShaderBlock: pShaderBlock->pVT = &g_vtGS; if( psAssignments[i].AssignmentType == ECAT_InlineShader ) @@ -1973,7 +1973,7 @@ HRESULT CEffectLoader::LoadObjectVariables() VBD( m_pEffect->m_VariableCount < (m_pHeader->Effect.cObjectVariables + m_pHeader->Effect.cNumericVariables + m_pHeader->cInterfaceVariables), "Internal loading error: variable count mismatch." ); pVar = &m_pEffect->m_pVariables[m_pEffect->m_VariableCount]; - + // Get type VH( LoadTypeAndAddToPool(&pType, psBlock->oType) ); @@ -2040,14 +2040,14 @@ HRESULT CEffectLoader::LoadObjectVariables() chkElementsTotal += *currentBlockCount; VHD( chkElementsTotal.GetValue(&elementsTotal), "Overflow: vaiable elements." ); VBD( elementsTotal <= *maxBlockCount, "Internal loading error: element count overflow." ); - + *currentBlockCount += elementsToRead; for (uint32_t iElement = 0; iElement < elementsToRead; ++ iElement) { SBaseBlock *pCurrentBlock; uint32_t cAssignments; - + pCurrentBlock = (SBaseBlock *) GetBlockByIndex(pVar->pType->VarType, pVar->pType->ObjectType, pVar->Data.pGeneric, iElement); VBD( nullptr != pCurrentBlock, "Internal loading error: find state block." ); @@ -2209,7 +2209,7 @@ HRESULT CEffectLoader::LoadObjectVariables() else if (pType->IsObjectType(EOT_String)) { // Strings - + chkElementsTotal += m_pEffect->m_StringCount; VHD( chkElementsTotal.GetValue(&elementsTotal), "Overflow: string object count." ); VBD( elementsTotal <= m_pHeader->cStrings, "Invalid pEffectBuffer: string count mismatch." ); @@ -2230,9 +2230,9 @@ HRESULT CEffectLoader::LoadObjectVariables() } } else if (pType->IsShaderResource()) - { + { // Textures/buffers - + chkElementsTotal += m_pEffect->m_ShaderResourceCount; VHD( chkElementsTotal.GetValue(&elementsTotal), "Overflow: SRV object count." ); VBD( elementsTotal <= m_pHeader->cShaderResources, "Invalid pEffectBuffer: SRV count mismatch." ); @@ -2241,7 +2241,7 @@ HRESULT CEffectLoader::LoadObjectVariables() m_pEffect->m_ShaderResourceCount += elementsToRead; } else if (pType->IsUnorderedAccessView()) - { + { // UnorderedAccessViews chkElementsTotal += m_pEffect->m_UnorderedAccessViewCount; @@ -2252,7 +2252,7 @@ HRESULT CEffectLoader::LoadObjectVariables() m_pEffect->m_UnorderedAccessViewCount += elementsToRead; } else if (pType->IsRenderTargetView()) - { + { // RenderTargets chkElementsTotal += m_pEffect->m_RenderTargetViewCount; @@ -2263,7 +2263,7 @@ HRESULT CEffectLoader::LoadObjectVariables() m_pEffect->m_RenderTargetViewCount += elementsToRead; } else if (pType->IsDepthStencilView()) - { + { // DepthStencilViews chkElementsTotal += m_pEffect->m_DepthStencilViewCount; @@ -2447,7 +2447,7 @@ HRESULT CEffectLoader::LoadTechnique( STechnique* pTech ) // Read pass info VHD( m_msStructured.Read((void**) &psPass, sizeof(SBinaryPass)), "Invalid pEffectBuffer: cannot read pass." ); VHD( GetStringAndAddToReflection(psPass->oName, &pPass->pName), "Invalid pEffectBuffer: cannot read pass name." ); - + // Read annotations VH( LoadAnnotations(&pPass->AnnotationCount, &pPass->pAnnotations) ); @@ -2481,7 +2481,7 @@ HRESULT CEffectLoader::LoadAnnotations(uint32_t *pcAnnotations, SAnnotation **p chkAnnotationsSize = cAnnotations; chkAnnotationsSize *= sizeof(SAnnotation); VHD( chkAnnotationsSize.GetValue(&annotationsSize), "Overflow in annotations." ); - + // we allocate raw bytes for annotations because they are polymorphic types that need to be placement new'ed VN( pAnnotations = (SAnnotation *) PRIVATENEW uint8_t[annotationsSize] ); @@ -2522,7 +2522,7 @@ HRESULT CEffectLoader::LoadAnnotations(uint32_t *pcAnnotations, SAnnotation **p { void *pDefaultValue; uint32_t bytesUnpacked; - + // Read initializer offset VHD( m_msStructured.Read(&oData), "Invalid pEffectBuffer: cannot read annotation." ); @@ -2564,14 +2564,14 @@ HRESULT CEffectLoader::GrabShaderData(SShaderBlock *pShaderBlock) SRange *pRange = nullptr; CEffectVector vTBuffers; - + ////////////////////////////////////////////////////////////////////////// // Step 1: iterate through the resource binding structures and build // an "optimized" list of all of the dependencies D3D11_SHADER_DESC ShaderDesc; hr = pShaderBlock->pReflectionData->pReflection->GetDesc( &ShaderDesc ); - if ( FAILED(hr) ) + if ( FAILED(hr) ) return hr; // Since we have the shader desc, let's find out if this is a nullptr GS @@ -2610,7 +2610,7 @@ HRESULT CEffectLoader::GrabShaderData(SShaderBlock *pShaderBlock) { case D3D_SIT_CBUFFER: eRange = ER_CBuffer; - + pCB = m_pEffect->FindCB(pName); VBD( nullptr != pCB, "Loading error: cannot find cbuffer." ); VBD( size == 1, "Loading error: cbuffer arrays are not supported." ); @@ -2618,7 +2618,7 @@ HRESULT CEffectLoader::GrabShaderData(SShaderBlock *pShaderBlock) case D3D_SIT_TBUFFER: eRange = ER_Texture; - + pCB = m_pEffect->FindCB(pName); VBD( nullptr != pCB, "Loading error: cannot find tbuffer." ); VBD( false != pCB->IsTBuffer, "Loading error: cbuffer found where tbuffer is expected." ); @@ -2626,7 +2626,7 @@ HRESULT CEffectLoader::GrabShaderData(SShaderBlock *pShaderBlock) pShaderResource = &pCB->TBuffer; break; - case D3D_SIT_TEXTURE: + case D3D_SIT_TEXTURE: case D3D_SIT_STRUCTURED: case D3D_SIT_BYTEADDRESS: { @@ -2662,7 +2662,7 @@ HRESULT CEffectLoader::GrabShaderData(SShaderBlock *pShaderBlock) { DPF(0, "%s: Sampler %s[%zu] does not have a texture bound to it, even though the sampler array is used in a DX9-style texture load instruction", g_szEffectLoadArea, pName, j); } - + VH( E_FAIL ); } } @@ -2974,7 +2974,7 @@ HRESULT CEffectLoader::GrabShaderData(SShaderBlock *pShaderBlock) } ////////////////////////////////////////////////////////////////////////// - // Step 3: allocate room in pShaderBlock for all of the dependency + // Step 3: allocate room in pShaderBlock for all of the dependency // pointers and then hook them up pShaderBlock->SampDepCount = vRanges[ ER_Sampler ].GetSize(); @@ -3110,7 +3110,7 @@ HRESULT CEffectLoader::BuildShaderBlock(SShaderBlock *pShaderBlock) // File contains a shader variable without an assigned shader, or this is a null assignment. // Usually, this is called by one of these guys: // SetVertexShader( nullptr ); - // or + // or // vertexshader g_VS = nullptr; return S_OK; } @@ -3126,7 +3126,7 @@ HRESULT CEffectLoader::BuildShaderBlock(SShaderBlock *pShaderBlock) if( EOT_VertexShader == pShaderBlock->GetShaderType() ) { assert( pShaderBlock->pInputSignatureBlob == nullptr ); - VHD( D3DGetBlobPart( pShaderBlock->pReflectionData->pBytecode, pShaderBlock->pReflectionData->BytecodeLength, + VHD( D3DGetBlobPart( pShaderBlock->pReflectionData->pBytecode, pShaderBlock->pReflectionData->BytecodeLength, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &pShaderBlock->pInputSignatureBlob ), "Internal loading error: cannot get input signature." ); @@ -3142,12 +3142,12 @@ HRESULT CEffectLoader::BuildShaderBlock(SShaderBlock *pShaderBlock) ////////////////////////////////////////////////////////////////////////// // Code to relocate data to private heaps (reflection & runtime effect) // -// Important note about alignment: all reasonable chunks of data are -// machine word aligned (that is, any piece of data moved as a whole is +// Important note about alignment: all reasonable chunks of data are +// machine word aligned (that is, any piece of data moved as a whole is // aligned as a whole. This means that when computing m_ReflectionMemory -// or m_EffectMemory, each addition is aligned. This also means +// or m_EffectMemory, each addition is aligned. This also means // that, when later relocating that same memory, you must call MoveData -// or MoveString on the same chunks that were aligned. This is +// or MoveString on the same chunks that were aligned. This is // because: Align(a * b) != a * Align(b). ////////////////////////////////////////////////////////////////////////// @@ -3172,9 +3172,9 @@ HRESULT CEffectLoader::CalculateAnnotationSize(uint32_t cAnnotations, SAnnotati VBD( pAnnotations[i].pType->IsObjectType(EOT_String), "Invalid pEffectBuffer: invalid annotation type." ); uint32_t cElements = std::max(1, pAnnotations[i].pType->Elements); - + m_ReflectionMemory += AlignToPowerOf2(cElements * sizeof(SString), c_DataAlignment); - + } } @@ -3207,7 +3207,7 @@ HRESULT CEffectLoader::ReallocateAnnotationData(uint32_t cAnnotations, SAnnotat else if (pAnnotations[i].pType->IsObjectType(EOT_String)) { uint32_t cElements = std::max(1, pAn->pType->Elements); - + VHD( m_pReflection->m_Heap.MoveData((void**) &pAn->Data.pString, cElements * sizeof(SString)), "Internal loading error: cannot move annotation string." ); for (size_t j = 0; j < cElements; ++ j) { @@ -3320,7 +3320,7 @@ HRESULT CEffectLoader::ReallocateReflectionData( bool Cloning ) { VHD( pHeap->MoveString( &m_pEffect->m_pGroups[i].pTechniques[j].pName ), "Internal loading error: cannot move technique name." ); VH( ReallocateAnnotationData(m_pEffect->m_pGroups[i].pTechniques[j].AnnotationCount, &m_pEffect->m_pGroups[i].pTechniques[j].pAnnotations) ); - + for(size_t k=0; km_pGroups[i].pTechniques[j].PassCount; k++) { VHD( pHeap->MoveString( &m_pEffect->m_pGroups[i].pTechniques[j].pPasses[k].pName ), "Internal loading error: cannot move pass name." ); @@ -3358,7 +3358,7 @@ HRESULT CEffectLoader::ReallocateReflectionData( bool Cloning ) } VH( pHeap->MoveInterfaceParameters(m_pEffect->m_pShaderBlocks[i].pReflectionData->InterfaceParameterCount, &m_pEffect->m_pShaderBlocks[i].pReflectionData->pInterfaceParameters ) ); } - + } lExit: @@ -3373,7 +3373,7 @@ template HRESULT CEffectLoader::ReallocateBlockAssignments(T* &pBlocks, { HRESULT hr = S_OK; CEffectHeap *pHeap = &m_pEffect->m_Heap; - + for(size_t i=0; i HRESULT CEffectLoader::ReallocateBlockAssignments(T* &pBlocks, pAssignment->Destination.pGeneric = (uint8_t*) pBlock + pAssignment->Destination.Offset; // Make sure the data pointer points into the backing store - VBD( pAssignment->Destination.pGeneric >= &pBlock->BackingStore && - pAssignment->Destination.pGeneric < (uint8_t*) &pBlock->BackingStore + sizeof(pBlock->BackingStore), + VBD( pAssignment->Destination.pGeneric >= &pBlock->BackingStore && + pAssignment->Destination.pGeneric < (uint8_t*) &pBlock->BackingStore + sizeof(pBlock->BackingStore), "Internal loading error: assignment destination out of range." ); // Fixup dependencies @@ -3443,7 +3443,7 @@ template HRESULT CEffectLoader::ReallocateBlockAssignments(T* &pBlocks, assert( !pAssignment->IsObjectAssignment() && pAssignment->DependencyCount > 0 ); // Numeric variables must be relocated before this function is called - + switch (pAssignment->AssignmentType) { case ERAT_NumericVariable: @@ -3492,11 +3492,11 @@ template uint32_t CEffectLoader::CalculateBlockAssignmentSize(T* &pBlo { SBaseBlock *pBlock = &pBlocks[i]; dwSize += AlignToPowerOf2(pBlock->AssignmentCount * sizeof(SAssignment), c_DataAlignment); - + for (size_t j=0; jAssignmentCount; j++) { SAssignment *pAssignment = &pBlock->pAssignments[j]; - + dwSize += AlignToPowerOf2(pAssignment->DependencyCount * sizeof(SAssignment::SDependency), c_DataAlignment); } } @@ -3509,7 +3509,7 @@ HRESULT CEffectLoader::ReallocateShaderBlocks() HRESULT hr = S_OK; CEffectHeap *pHeap = &m_pEffect->m_Heap; const char* pError = "Internal loading error: cannot move shader data."; - + for (size_t i=0; im_ShaderBlockCount; i++) { SShaderBlock *pShader = &m_pEffect->m_pShaderBlocks[i]; @@ -3521,7 +3521,7 @@ HRESULT CEffectLoader::ReallocateShaderBlocks() VHD( pHeap->MoveData((void**) &pShader->pResourceDeps, pShader->ResourceDepCount * sizeof(SShaderResourceDependency)), pError ); VHD( pHeap->MoveData((void**) &pShader->pUAVDeps, pShader->UAVDepCount * sizeof(SUnorderedAccessViewDependency)), pError ); VHD( pHeap->MoveData((void**) &pShader->ppTbufDeps, pShader->TBufferDepCount * sizeof(SConstantBuffer*)), pError ); - + for (size_t j=0; jCBDepCount; j++) { SShaderCBDependency *pCBDeps = &pShader->pCBDeps[j]; @@ -3596,7 +3596,7 @@ HRESULT CEffectLoader::ReallocateShaderBlocks() uint32_t CEffectLoader::CalculateShaderBlockSize() { uint32_t dwSize = 0; - + for (size_t i=0; im_ShaderBlockCount; i++) { SShaderBlock *pShader = &m_pEffect->m_pShaderBlocks[i]; @@ -3833,7 +3833,7 @@ HRESULT CEffectLoader::ReallocateEffectData( bool Cloning ) m_pOldDS = m_pEffect->m_pDepthStencilBlocks; VHD( pHeap->MoveData((void**) &m_pEffect->m_pDepthStencilBlocks, cbDS), "Internal loading error: cannot move depth-stencil state blocks." ); VH( ReallocateBlockAssignments(m_pEffect->m_pDepthStencilBlocks, m_pEffect->m_DepthStencilBlockCount, Cloning ? m_pOldDS : nullptr) ); - + m_pOldAB = m_pEffect->m_pBlendBlocks; VHD( pHeap->MoveData((void**) &m_pEffect->m_pBlendBlocks, cbAB), "Internal loading error: cannot move blend state blocks." ); VH( ReallocateBlockAssignments(m_pEffect->m_pBlendBlocks, m_pEffect->m_BlendBlockCount, Cloning ? m_pOldAB : nullptr) ); @@ -3845,7 +3845,7 @@ HRESULT CEffectLoader::ReallocateEffectData( bool Cloning ) m_pOldSamplers = m_pEffect->m_pSamplerBlocks; VHD( pHeap->MoveData((void**) &m_pEffect->m_pSamplerBlocks, cbSamplers), "Internal loading error: cannot move samplers." ); VH( ReallocateBlockAssignments(m_pEffect->m_pSamplerBlocks, m_pEffect->m_SamplerBlockCount, Cloning ? m_pOldSamplers : nullptr) ); - + // Fixup sampler backing stores for (size_t i=0; im_SamplerBlockCount; ++i) { @@ -3926,7 +3926,7 @@ HRESULT CEffectLoader::ReallocateEffectData( bool Cloning ) else if (pVar->pType->IsRenderTargetView()) { VH( FixupRenderTargetViewPointer(&pVar->Data.pRenderTargetView) ); - } + } else if (pVar->pType->IsDepthStencilView()) { VH( FixupDepthStencilViewPointer(&pVar->Data.pDepthStencilView) ); @@ -4015,7 +4015,7 @@ HRESULT CEffectLoader::ReallocateEffectData( bool Cloning ) { VH( FixupRenderTargetViewPointer( &pTech->pPasses[iPass].BackingStore.pRenderTargetViews[iRT] ) ); } - } + } VH( ReallocateBlockAssignments( pTech->pPasses, pTech->PassCount, pOldPasses ) ); } diff --git a/EffectLoad.h b/EffectLoad.h index c125f8c..f5c8449 100644 --- a/EffectLoad.h +++ b/EffectLoad.h @@ -1,7 +1,7 @@ //-------------------------------------------------------------------------------------- // File: EffectLoad.h // -// Direct3D 11 Effects header for the FX file loader +// Direct3D 11 Effects header for the FX file loader // A CEffectLoader is created at load time to facilitate loading // // Copyright (c) Microsoft Corporation. @@ -62,7 +62,7 @@ class CEffectLoader D3DX11Core::CMemoryStream m_msStructured; D3DX11Core::CMemoryStream m_msUnstructured; - + // used to avoid repeated hash buffer allocations in LoadTypeAndAddToPool CEffectVector m_HashBuffer; diff --git a/EffectNonRuntime.cpp b/EffectNonRuntime.cpp index ef088d5..0a1e5a2 100644 --- a/EffectNonRuntime.cpp +++ b/EffectNonRuntime.cpp @@ -3,7 +3,7 @@ // // D3DX11 Effect low-frequency utility functions // These functions are not intended to be called regularly. They -// are typically called when creating, cloning, or optimizing an +// are typically called when creating, cloning, or optimizing an // Effect, or reflecting a variable. // // Copyright (c) Microsoft Corporation. @@ -218,7 +218,7 @@ EObjectType SShaderBlock::GetShaderType() return EOT_DomainShader5; else if (&g_vtCS == pVT) return EOT_ComputeShader5; - + return EOT_Invalid; } @@ -346,7 +346,7 @@ HRESULT SShaderBlock::ComputeStateBlockMask(_Inout_ D3DX11_STATE_BLOCK_MASK *pSt HRESULT SShaderBlock::GetShaderDesc(_Out_ D3DX11_EFFECT_SHADER_DESC *pDesc, _In_ bool IsInline) { HRESULT hr = S_OK; - + ZeroMemory(pDesc, sizeof(*pDesc)); pDesc->pInputSignature = pInputSignatureBlob ? (const uint8_t*)pInputSignatureBlob->GetBufferPointer() : nullptr; @@ -574,11 +574,11 @@ HRESULT SShaderBlock::GetSignatureElementDesc(ESigType SigType, uint32_t Element if( _stricmp(pDesc->SemanticName, "SV_TARGET") == 0 ) { pDesc->SystemValueType = D3D_NAME_TARGET; - } + } else if( _stricmp(pDesc->SemanticName, "SV_DEPTH") == 0 ) { pDesc->SystemValueType = D3D_NAME_DEPTH; - } + } else if( _stricmp(pDesc->SemanticName, "SV_COVERAGE") == 0 ) { pDesc->SystemValueType = D3D_NAME_COVERAGE; @@ -596,7 +596,7 @@ HRESULT SShaderBlock::GetSignatureElementDesc(ESigType SigType, uint32_t Element DPF(0, "%s: Cannot get signatures; shader bytecode is not present", pFuncName); VH( D3DERR_INVALIDCALL ); } - + lExit: return hr; } @@ -660,7 +660,7 @@ void * GetBlockByIndex(EVarType VarType, EObjectType ObjectType, void *pBaseBloc case EOT_RWStructuredBufferAlloc: case EOT_RWStructuredBufferConsume: case EOT_AppendStructuredBuffer: - case EOT_ConsumeStructuredBuffer: + case EOT_ConsumeStructuredBuffer: return (SUnorderedAccessView *)pBaseBlock + Index; default: assert(0); @@ -1145,7 +1145,7 @@ HRESULT CEffect::BindToDevice(ID3D11Device *pDevice, LPCSTR srcName) VH( pDevice->CreateBuffer( &bufDesc, nullptr, &pCB->pD3DObject) ); SetDebugObjectName(pCB->pD3DObject, srcName ); - + D3D11_SHADER_RESOURCE_VIEW_DESC viewDesc; viewDesc.Format = DXGI_FORMAT_R32G32B32A32_UINT; viewDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; @@ -1250,8 +1250,8 @@ HRESULT CEffect::BindToDevice(ID3D11Device *pDevice, LPCSTR srcName) // SetPixelShader( nullptr ); continue; } - - if (pShader->pReflectionData->pStreamOutDecls[0] || pShader->pReflectionData->pStreamOutDecls[1] || + + if (pShader->pReflectionData->pStreamOutDecls[0] || pShader->pReflectionData->pStreamOutDecls[1] || pShader->pReflectionData->pStreamOutDecls[2] || pShader->pReflectionData->pStreamOutDecls[3] ) { // This is a geometry shader, process it's data @@ -1284,7 +1284,7 @@ HRESULT CEffect::BindToDevice(ID3D11Device *pDevice, LPCSTR srcName) // This is a regular shader if( pShader->pReflectionData->RasterizedStream == D3D11_SO_NO_RASTERIZED_STREAM ) pShader->IsValid = false; - else + else { if( FAILED( (m_pDevice->*(pShader->pVT->pCreateShader))( (uint32_t *) pShader->pReflectionData->pBytecode, pShader->pReflectionData->BytecodeLength, neededClassLinkage, &pShader->pD3DObject) ) ) { @@ -1391,7 +1391,7 @@ HRESULT CEffect::BindToDevice(ID3D11Device *pDevice, LPCSTR srcName) { STechnique* pTechnique = &pGroup->pTechniques[iTech]; pTechnique->InitiallyValid = true; - + for( size_t iPass = 0; iPass < pTechnique->PassCount; iPass++ ) { SPassBlock* pPass = &pTechnique->pPasses[iPass]; @@ -1874,7 +1874,7 @@ HRESULT CEffect::CopyTypePool( CEffect* pEffectSource, CPointerMappingTable& map } } } - } + } lExit: return hr; @@ -1942,7 +1942,7 @@ HRESULT CEffect::CopyOptimizedTypePool( CEffect* pEffectSource, CPointerMappingT VH( RemapType((SType**)&pType->StructType.pMembers[i].pType, &mappingTableTypes) ); } } - } + } lExit: return hr; @@ -2054,7 +2054,7 @@ HRESULT CEffect::CloneEffect(_In_ uint32_t Flags, _Outptr_ ID3DX11Effect** ppClo CPointerMappingTable mappingTableStrings; CEffectLoader loader; - CEffect* pNewEffect = nullptr; + CEffect* pNewEffect = nullptr; CDataBlockStore* pTempHeap = nullptr; @@ -2102,7 +2102,7 @@ HRESULT CEffect::CloneEffect(_In_ uint32_t Flags, _Outptr_ ID3DX11Effect** ppClo pNewEffect->m_RenderTargetViewCount = m_RenderTargetViewCount; pNewEffect->m_pRenderTargetViews = m_pRenderTargetViews; pNewEffect->m_DepthStencilViewCount = m_DepthStencilViewCount; - pNewEffect->m_pDepthStencilViews = m_pDepthStencilViews; + pNewEffect->m_pDepthStencilViews = m_pDepthStencilViews; pNewEffect->m_LocalTimer = m_LocalTimer; pNewEffect->m_FXLIndex = m_FXLIndex; pNewEffect->m_pDevice = m_pDevice; @@ -2252,7 +2252,7 @@ HRESULT CEffect::Optimize() { HRESULT hr = S_OK; CEffectHeap *pOptimizedTypeHeap = nullptr; - + if (IsOptimized()) { DPF(0, "ID3DX11Effect::Optimize: Effect has already been Optimize()'ed"); @@ -2260,7 +2260,7 @@ HRESULT CEffect::Optimize() } // Delete annotations, names, semantics, and string data on variables - + for (size_t i = 0; i < m_VariableCount; ++ i) { m_pVariables[i].AnnotationCount = 0; @@ -2343,7 +2343,7 @@ HRESULT CEffect::Optimize() - // get rid of the name/type hash tables and string data, + // get rid of the name/type hash tables and string data, // then reallocate the type data and fix up this effect CPointerMappingTable mappingTable; CTypeHashTable::CIterator typeIter; @@ -2355,7 +2355,7 @@ HRESULT CEffect::Optimize() for (m_pTypePool->GetFirstEntry(&typeIter); !m_pTypePool->PastEnd(&typeIter); m_pTypePool->GetNextEntry(&typeIter)) { SType *pType = typeIter.GetData(); - + chkSpaceNeeded += AlignToPowerOf2(sizeof(SType), c_DataAlignment); // if this is a struct, allocate room for its members @@ -2394,7 +2394,7 @@ HRESULT CEffect::Optimize() VH( mappingTable.AddValueWithHash(ptrMapping, ptrMapping.Hash()) ); } - + // third pass: fixup structure member & name pointers for (mappingTable.GetFirstEntry(&mapIter); !mappingTable.PastEnd(&mapIter); mappingTable.GetNextEntry(&mapIter)) { @@ -2413,7 +2413,7 @@ HRESULT CEffect::Optimize() pType->StructType.pMembers[i].pSemantic = nullptr; } } - } + } // fixup this effect's variable's types VH( OptimizeTypes(&mappingTable) ); @@ -2697,7 +2697,7 @@ SMember * CreateNewMember(_In_ SType *pType, _In_ bool IsAnnotation) DPF( 0, "Internal loading error: invalid scalar type." ); assert(0); break; - } + } break; default: assert(0); @@ -2729,7 +2729,7 @@ HRESULT PlacementNewVariable(_In_ void *pVar, _In_ SType *pType, _In_ bool IsAnn assert(sizeof(SClassInstanceGlobalVariable) == sizeof(SGlobalVariable)); new(pVar) SClassInstanceGlobalVariable; } - else + else { assert(sizeof(SNumericGlobalVariable) == sizeof(SGlobalVariable)); new(pVar) SNumericGlobalVariable; @@ -2753,7 +2753,7 @@ HRESULT PlacementNewVariable(_In_ void *pVar, _In_ SType *pType, _In_ bool IsAnn assert(sizeof(SStringGlobalVariable) == sizeof(SGlobalVariable)); new(pVar) SStringGlobalVariable; } - + break; case EOT_Texture: case EOT_Texture1D: @@ -2853,7 +2853,7 @@ HRESULT PlacementNewVariable(_In_ void *pVar, _In_ SType *pType, _In_ bool IsAnn assert(sizeof(SMatrixGlobalVariable) == sizeof(SGlobalVariable)); assert(sizeof(SMatrix4x4ColumnMajorGlobalVariable) == sizeof(SGlobalVariable)); assert(sizeof(SMatrix4x4RowMajorGlobalVariable) == sizeof(SGlobalVariable)); - + if (pType->NumericType.Rows == 4 && pType->NumericType.Columns == 4) { if (pType->NumericType.IsColumnMajor) @@ -2967,7 +2967,7 @@ HRESULT PlacementNewVariable(_In_ void *pVar, _In_ SType *pType, _In_ bool IsAnn DPF( 0, "Internal loading error: invalid scalar type." ); return E_FAIL; break; - } + } break; default: assert(0); diff --git a/EffectRuntime.cpp b/EffectRuntime.cpp index 90a4194..94c7ec3 100644 --- a/EffectRuntime.cpp +++ b/EffectRuntime.cpp @@ -186,7 +186,7 @@ void CEffect::ApplyShaderBlock(_In_ SShaderBlock *pBlock) } (m_pContext->*(pVT->pSetSamplers))(pSampDep->StartIndex, pSampDep->Count, pSampDep->ppD3DObjects); } - + // Set the UAVs // UAV ranges were combined in EffectLoad. This code remains unchanged, however, so that ranges can be easily split assert( pBlock->UAVDepCount < 2 ); @@ -319,7 +319,7 @@ bool CEffect::ApplyRenderStateBlock(_In_ SBaseBlock *pBlock) pDSBlock->IsValid = false; } break; - + case EBT_Blend: { SBlendBlock *pBBlock = pBlock->AsBlend(); @@ -352,7 +352,7 @@ bool CEffect::ApplyRenderStateBlock(_In_ SBaseBlock *pBlock) pRBlock->IsValid = false; } break; - + default: assert(0); } @@ -375,7 +375,7 @@ bool CEffect::EvaluateAssignment(_Inout_ SAssignment *pAssignment) { bool bNeedUpdate = false; SGlobalVariable *pVarDep0, *pVarDep1; - + switch (pAssignment->AssignmentType) { case ERAT_NumericVariable: @@ -400,7 +400,7 @@ bool CEffect::EvaluateAssignment(_Inout_ SAssignment *pAssignment) // Array index variable is dirty, update the pointer pAssignment->Source.pNumeric = pVarDep1->Data.pNumeric + pVarDep1->pType->Stride * m_FXLIndex; - + // Copy the new data memcpy(pAssignment->Destination.pNumeric, pAssignment->Source.pNumeric, pAssignment->DataSize); bNeedUpdate = true; @@ -437,7 +437,7 @@ bool CEffect::EvaluateAssignment(_Inout_ SAssignment *pAssignment) assert(0); break; } - + // Mark the assignment as not dirty pAssignment->LastRecomputedTime = m_LocalTimer; @@ -504,7 +504,7 @@ bool CEffect::ValidatePassBlock( _Inout_ SPassBlock* pBlock ) { if( !ValidateShaderBlock(pBlock->BackingStore.pPixelShaderBlock) ) return false; - else if( pBlock->BackingStore.pPixelShaderBlock->UAVDepCount > 0 && + else if( pBlock->BackingStore.pPixelShaderBlock->UAVDepCount > 0 && pBlock->BackingStore.RenderTargetViewCount > pBlock->BackingStore.pPixelShaderBlock->pUAVDeps[0].StartIndex ) { return false; @@ -660,7 +660,7 @@ void CEffect::IncrementTimer() void CEffect::HandleLocalTimerRollover() { uint32_t i, j, k; - + // step 1: update variables for (i = 0; i < m_VariableCount; ++ i) { diff --git a/EffectVariable.inl b/EffectVariable.inl index 5d65d9e..d7a898c 100644 --- a/EffectVariable.inl +++ b/EffectVariable.inl @@ -478,7 +478,7 @@ public: // Helper routines ////////////////////////////////////////////////////////////////////////// -// This is an annoying warning that pops up in retail builds because +// This is an annoying warning that pops up in retail builds because // the code that jumps to "lExit" is conditionally not compiled. // The only alternative is more #ifdefs in every function #pragma warning( disable : 4102 ) // 'label' : unreferenced label @@ -515,7 +515,7 @@ ID3DX11EffectVariable * GetAnnotationByNameHelper(_In_z_ const char *pClassName, template _Success_(return) -bool GetVariableByIndexHelper(_In_ uint32_t Index, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables, +bool GetVariableByIndexHelper(_In_ uint32_t Index, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables, _In_opt_ uint8_t *pBaseAddress, _Outptr_ SVarType **ppMember, _Outptr_result_maybenull_ void **ppDataPtr) { static LPCSTR pFuncName = "ID3DX11EffectVariable::GetMemberByIndex"; @@ -533,7 +533,7 @@ bool GetVariableByIndexHelper(_In_ uint32_t Index, _In_ uint32_t VariableCount, template _Success_(return) -bool GetVariableByNameHelper(_In_z_ LPCSTR Name, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables, +bool GetVariableByNameHelper(_In_z_ LPCSTR Name, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables, _In_opt_ uint8_t *pBaseAddress, _Outptr_ SVarType **ppMember, _Outptr_result_maybenull_ void **ppDataPtr, _Out_ uint32_t* pIndex) { static LPCSTR pFuncName = "ID3DX11EffectVariable::GetMemberByName"; @@ -584,7 +584,7 @@ bool GetVariableByNameHelper(_In_z_ LPCSTR Name, _In_ uint32_t VariableCount, _ template _Success_(return) -bool GetVariableBySemanticHelper(_In_z_ LPCSTR Semantic, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables, +bool GetVariableBySemanticHelper(_In_z_ LPCSTR Semantic, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables, _In_opt_ uint8_t *pBaseAddress, _Outptr_ SVarType **ppMember, _Outptr_result_maybenull_ void **ppDataPtr, _Out_ uint32_t* pIndex) { static LPCSTR pFuncName = "ID3DX11EffectVariable::GetMemberBySemantic"; @@ -745,12 +745,12 @@ lExit: #pragma warning( disable : 6103 ) template inline HRESULT SetScalarArray(_In_reads_(Count) const SRC_TYPE *pSrcValues, _Out_writes_(Count) DEST_TYPE *pDestValues, - _In_ uint32_t Offset, _In_ uint32_t Count, + _In_ uint32_t Offset, _In_ uint32_t Count, _In_ const SType *pType, _In_ uint32_t TotalUnpackedSize, _In_z_ const char *pFuncName) { HRESULT hr = S_OK; -#ifdef _DEBUG +#ifdef _DEBUG VERIFYPARAMETER(pSrcValues); #pragma warning( suppress : 6001 ) @@ -780,12 +780,12 @@ lExit: #pragma warning( disable : 6103 ) template inline HRESULT GetScalarArray(_In_reads_(Count) SRC_TYPE *pSrcValues, _Out_writes_(Count) DEST_TYPE *pDestValues, - _In_ uint32_t Offset, _In_ uint32_t Count, + _In_ uint32_t Offset, _In_ uint32_t Count, _In_ const SType *pType, _In_ uint32_t TotalUnpackedSize, _In_z_ const char *pFuncName) { HRESULT hr = S_OK; -#ifdef _DEBUG +#ifdef _DEBUG VERIFYPARAMETER(pDestValues); #pragma warning( suppress : 6001 ) @@ -840,7 +840,7 @@ struct TVariable : public IBaseInterface return &g_InvalidScalarVariable; } - if (!GetVariableByIndexHelper(Index, pType->StructType.Members, pType->StructType.pMembers, + if (!GetVariableByIndexHelper(Index, pType->StructType.Members, pType->StructType.pMembers, Data.pNumeric, &pMember, &dataPtr.pGeneric)) { return &g_InvalidScalarVariable; @@ -868,7 +868,7 @@ struct TVariable : public IBaseInterface return &g_InvalidScalarVariable; } - if (!GetVariableByNameHelper(Name, pType->StructType.Members, pType->StructType.pMembers, + if (!GetVariableByNameHelper(Name, pType->StructType.Members, pType->StructType.pMembers, Data.pNumeric, &pMember, &dataPtr.pGeneric, &index)) { return &g_InvalidScalarVariable; @@ -897,7 +897,7 @@ struct TVariable : public IBaseInterface return &g_InvalidScalarVariable; } - if (!GetVariableBySemanticHelper(Semantic, pType->StructType.Members, pType->StructType.pMembers, + if (!GetVariableBySemanticHelper(Semantic, pType->StructType.Members, pType->StructType.pMembers, Data.pNumeric, &pMember, &dataPtr.pGeneric, &index)) { return &g_InvalidScalarVariable; @@ -952,7 +952,7 @@ struct TVariable : public IBaseInterface { static LPCSTR pFuncName = "ID3DX11EffectVariable::AsScalar"; - if (pType->VarType != EVT_Numeric || + if (pType->VarType != EVT_Numeric || pType->NumericType.NumericLayout != ENL_Scalar) { DPF(0, "%s: Invalid typecast", pFuncName); @@ -966,7 +966,7 @@ struct TVariable : public IBaseInterface { static LPCSTR pFuncName = "ID3DX11EffectVariable::AsVector"; - if (pType->VarType != EVT_Numeric || + if (pType->VarType != EVT_Numeric || pType->NumericType.NumericLayout != ENL_Vector) { DPF(0, "%s: Invalid typecast", pFuncName); @@ -980,7 +980,7 @@ struct TVariable : public IBaseInterface { static LPCSTR pFuncName = "ID3DX11EffectVariable::AsMatrix"; - if (pType->VarType != EVT_Numeric || + if (pType->VarType != EVT_Numeric || pType->NumericType.NumericLayout != ENL_Matrix) { DPF(0, "%s: Invalid typecast", pFuncName); @@ -1277,13 +1277,13 @@ struct TMember : public SVariable, public IBaseInterface // strings are funny; their data is reflection data, so ignore those assert(pTopLevelEntity->pEffect->IsRuntimeData(Data.pGeneric)); } - + pDesc->Annotations = ((TGlobalVariable*)pTopLevelEntity)->AnnotationCount; SConstantBuffer *pCB = ((TGlobalVariable*)pTopLevelEntity)->pCB; if (pType->BelongsInConstantBuffer()) - { + { assert(pCB != 0); _Analysis_assume_(pCB != 0); UINT_PTR offset = Data.pNumeric - pCB->pBackingStore; @@ -1455,11 +1455,11 @@ lExit: } STDMETHOD_(ID3DX11EffectConstantBuffer*, GetParentConstantBuffer)() - { + { if (nullptr != pCB) { assert(pType->BelongsInConstantBuffer()); - return (ID3DX11EffectConstantBuffer*)pCB; + return (ID3DX11EffectConstantBuffer*)pCB; } else { @@ -1483,15 +1483,15 @@ lExit: ////////////////////////////////////////////////////////////////////////// // IMPORTANT NOTE: All of these numeric & object aspect classes MUST NOT -// add data members to the base variable classes. Otherwise type sizes -// will disagree between object & numeric variables and we cannot eaily +// add data members to the base variable classes. Otherwise type sizes +// will disagree between object & numeric variables and we cannot eaily // create arrays of global variables using SGlobalVariable // Requires that IBaseInterface have SVariable's members, GetTotalUnpackedSize() and DirtyVariable() template struct TNumericVariable : public IBaseInterface { - STDMETHOD(SetRawValue)(_In_reads_bytes_(ByteCount) const void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) override + STDMETHOD(SetRawValue)(_In_reads_bytes_(ByteCount) const void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) override { if (IsAnnotation) { @@ -1499,7 +1499,7 @@ struct TNumericVariable : public IBaseInterface } else { - HRESULT hr = S_OK; + HRESULT hr = S_OK; #ifdef _DEBUG static LPCSTR pFuncName = "ID3DX11EffectVariable::SetRawValue"; @@ -1526,7 +1526,7 @@ lExit: STDMETHOD(GetRawValue)(_Out_writes_bytes_(ByteCount) void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) override { - HRESULT hr = S_OK; + HRESULT hr = S_OK; #ifdef _DEBUG static LPCSTR pFuncName = "ID3DX11EffectVariable::GetRawValue"; @@ -1600,7 +1600,7 @@ HRESULT TFloatScalarVariable::SetFloatArray(const static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloatArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericFloat, Offset, Count, + return SetScalarArray(pData, Data.pNumericFloat, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1608,7 +1608,7 @@ template _Use_decl_annotations_ HRESULT TFloatScalarVariable::GetFloatArray(float *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericFloat, pData, Offset, Count, + return GetScalarArray(Data.pNumericFloat, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetFloatArray"); } @@ -1636,7 +1636,7 @@ HRESULT TFloatScalarVariable::SetIntArray(const in static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetIntArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericFloat, Offset, Count, + return SetScalarArray(pData, Data.pNumericFloat, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1644,7 +1644,7 @@ template _Use_decl_annotations_ HRESULT TFloatScalarVariable::GetIntArray(int *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericFloat, pData, Offset, Count, + return GetScalarArray(Data.pNumericFloat, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetIntArray"); } @@ -1672,7 +1672,7 @@ HRESULT TFloatScalarVariable::SetBoolArray(const b static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBoolArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericFloat, Offset, Count, + return SetScalarArray(pData, Data.pNumericFloat, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1680,7 +1680,7 @@ template _Use_decl_annotations_ HRESULT TFloatScalarVariable::GetBoolArray(bool *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericFloat, pData, Offset, Count, + return GetScalarArray(Data.pNumericFloat, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetBoolArray"); } @@ -1734,7 +1734,7 @@ HRESULT TIntScalarVariable::SetFloatArray(const fl static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloatArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericInt, Offset, Count, + return SetScalarArray(pData, Data.pNumericInt, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1742,7 +1742,7 @@ template _Use_decl_annotations_ HRESULT TIntScalarVariable::GetFloatArray(float *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericInt, pData, Offset, Count, + return GetScalarArray(Data.pNumericInt, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetFloatArray"); } @@ -1770,7 +1770,7 @@ HRESULT TIntScalarVariable::SetIntArray(const int static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetIntArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericInt, Offset, Count, + return SetScalarArray(pData, Data.pNumericInt, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1778,7 +1778,7 @@ template _Use_decl_annotations_ HRESULT TIntScalarVariable::GetIntArray(int *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericInt, pData, Offset, Count, + return GetScalarArray(Data.pNumericInt, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetIntArray"); } @@ -1806,7 +1806,7 @@ HRESULT TIntScalarVariable::SetBoolArray(const boo static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBoolArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericInt, Offset, Count, + return SetScalarArray(pData, Data.pNumericInt, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1814,7 +1814,7 @@ template _Use_decl_annotations_ HRESULT TIntScalarVariable::GetBoolArray(bool *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericInt, pData, Offset, Count, + return GetScalarArray(Data.pNumericInt, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetBoolArray"); } @@ -1868,7 +1868,7 @@ HRESULT TBoolScalarVariable::SetFloatArray(const f static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloatArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericBool, Offset, Count, + return SetScalarArray(pData, Data.pNumericBool, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1876,7 +1876,7 @@ template _Use_decl_annotations_ HRESULT TBoolScalarVariable::GetFloatArray(float *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericBool, pData, Offset, Count, + return GetScalarArray(Data.pNumericBool, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetFloatArray"); } @@ -1904,7 +1904,7 @@ HRESULT TBoolScalarVariable::SetIntArray(const int static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetIntArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericBool, Offset, Count, + return SetScalarArray(pData, Data.pNumericBool, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1912,7 +1912,7 @@ template _Use_decl_annotations_ HRESULT TBoolScalarVariable::GetIntArray(int *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericBool, pData, Offset, Count, + return GetScalarArray(Data.pNumericBool, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetIntArray"); } @@ -1940,7 +1940,7 @@ HRESULT TBoolScalarVariable::SetBoolArray(const bo static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBoolArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return SetScalarArray(pData, Data.pNumericBool, Offset, Count, + return SetScalarArray(pData, Data.pNumericBool, Offset, Count, pType, GetTotalUnpackedSize(), pFuncName); } @@ -1948,7 +1948,7 @@ template _Use_decl_annotations_ HRESULT TBoolScalarVariable::GetBoolArray(bool *pData, uint32_t Offset, uint32_t Count) { - return GetScalarArray(Data.pNumericBool, pData, Offset, Count, + return GetScalarArray(Data.pNumericBool, pData, Offset, Count, pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetBoolArray"); } @@ -1959,20 +1959,20 @@ HRESULT TBoolScalarVariable::GetBoolArray(bool *pD template struct TVectorVariable : public TNumericVariable { - STDMETHOD(SetBoolVector) (_In_reads_(4) const bool *pData) override; + STDMETHOD(SetBoolVector) (_In_reads_(4) const bool *pData) override; STDMETHOD(SetIntVector) (_In_reads_(4) const int *pData) override; STDMETHOD(SetFloatVector)(_In_reads_(4) const float *pData) override; - STDMETHOD(GetBoolVector) (_Out_writes_(4) bool *pData) override; + STDMETHOD(GetBoolVector) (_Out_writes_(4) bool *pData) override; STDMETHOD(GetIntVector) (_Out_writes_(4) int *pData) override; STDMETHOD(GetFloatVector)(_Out_writes_(4) float *pData) override; - STDMETHOD(SetBoolVectorArray) (_In_reads_(Count*4) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; + STDMETHOD(SetBoolVectorArray) (_In_reads_(Count*4) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; STDMETHOD(SetIntVectorArray) (_In_reads_(Count*4) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; STDMETHOD(SetFloatVectorArray)(_In_reads_(Count*4) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; - STDMETHOD(GetBoolVectorArray) (_Out_writes_(Count*4) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; + STDMETHOD(GetBoolVectorArray) (_Out_writes_(Count*4) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; STDMETHOD(GetIntVectorArray) (_Out_writes_(Count*4) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; STDMETHOD(GetFloatVectorArray)(_Out_writes_(Count*4) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override; }; @@ -2555,7 +2555,7 @@ HRESULT TVector4Variable::GetFloatVectorArray(float *pData, uint // ensure we don't read past the end of the vector array memcpy(pData, Data.pVector + Offset, - std::min(Count * sizeof(CEffectVector4), pType->TotalSize - (Offset * sizeof(CEffectVector4)))); + std::min(Count * sizeof(CEffectVector4), pType->TotalSize - (Offset * sizeof(CEffectVector4)))); lExit: return hr; @@ -2594,7 +2594,7 @@ template static void SetMatrixTransposeHelper(_In_ const SType *pType, _Out_writes_bytes_(64) uint8_t *pDestData, _In_reads_(16) const float* pMatrix) { uint32_t registers, entries; - + if (Transpose) { // row major @@ -2656,7 +2656,7 @@ HRESULT DoMatrixArrayInternal(_In_ const SType *pType, _In_ uint32_t TotalUnpac _Out_ uint8_t *pEffectData, void *pMatrixData, _In_ uint32_t Offset, _In_ uint32_t Count, _In_z_ LPCSTR pFuncName) -{ +{ HRESULT hr = S_OK; #ifdef _DEBUG @@ -2752,7 +2752,7 @@ HRESULT TMatrixVariable::SetMatrix(const float *pD static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrix"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, const_cast(pData), 0, 1, pFuncName); } @@ -2760,7 +2760,7 @@ template _Use_decl_annotations_ HRESULT TMatrixVariable::GetMatrix(float *pData) { - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, pData, 0, 1, "ID3DX11EffectMatrixVariable::GetMatrix"); } @@ -2771,7 +2771,7 @@ HRESULT TMatrixVariable::SetMatrixArray(const floa static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, const_cast(pData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixArray"); } @@ -2779,7 +2779,7 @@ template _Use_decl_annotations_ HRESULT TMatrixVariable::GetMatrixArray(float *pData, uint32_t Offset, uint32_t Count) { - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, pData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixArray"); } @@ -2790,7 +2790,7 @@ HRESULT TMatrixVariable::SetMatrixPointerArray(con static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixPointerArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, const_cast(ppData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixPointerArray"); } @@ -2798,7 +2798,7 @@ template _Use_decl_annotations_ HRESULT TMatrixVariable::GetMatrixPointerArray(float **ppData, uint32_t Offset, uint32_t Count) { - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, ppData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixPointerArray"); } @@ -2809,7 +2809,7 @@ HRESULT TMatrixVariable::SetMatrixTranspose(const static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixTranspose"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, const_cast(pData), 0, 1, "ID3DX11EffectMatrixVariable::SetMatrixTranspose"); } @@ -2817,7 +2817,7 @@ template _Use_decl_annotations_ HRESULT TMatrixVariable::GetMatrixTranspose(float *pData) { - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, pData, 0, 1, "ID3DX11EffectMatrixVariable::GetMatrixTranspose"); } @@ -2828,7 +2828,7 @@ HRESULT TMatrixVariable::SetMatrixTransposeArray(c static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixTransposeArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, const_cast(pData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixTransposeArray"); } @@ -2836,7 +2836,7 @@ template _Use_decl_annotations_ HRESULT TMatrixVariable::GetMatrixTransposeArray(float *pData, uint32_t Offset, uint32_t Count) { - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, pData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixTransposeArray"); } @@ -2847,7 +2847,7 @@ HRESULT TMatrixVariable::SetMatrixTransposePointer static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixTransposePointerArray"; if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName); DirtyVariable(); - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, const_cast(ppData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixTransposePointerArray"); } @@ -2855,7 +2855,7 @@ template _Use_decl_annotations_ HRESULT TMatrixVariable::GetMatrixTransposePointerArray(float **ppData, uint32_t Offset, uint32_t Count) { - return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), + return DoMatrixArrayInternal(pType, GetTotalUnpackedSize(), Data.pNumeric, ppData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixTransposePointerArray"); } @@ -2965,7 +2965,7 @@ inline HRESULT DoMatrix4x4ArrayInternal(_In_ uint8_t *pEffectData, #endif ) -{ +{ HRESULT hr = S_OK; #ifdef _DEBUG @@ -3025,7 +3025,7 @@ HRESULT TMatrix4x4Variable::SetMatrix(const float { DirtyVariable(); return DoMatrix4x4ArrayInternal(Data.pNumeric, const_cast(pData), 0, 1 -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrix"); #else ); @@ -3037,7 +3037,7 @@ _Use_decl_annotations_ HRESULT TMatrix4x4Variable::GetMatrix(float *pData) { return DoMatrix4x4ArrayInternal(Data.pNumeric, pData, 0, 1 -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrix"); #else ); @@ -3050,7 +3050,7 @@ HRESULT TMatrix4x4Variable::SetMatrixArray(const { DirtyVariable(); return DoMatrix4x4ArrayInternal(Data.pNumeric, const_cast(pData), Offset, Count -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrixArray"); #else ); @@ -3062,7 +3062,7 @@ _Use_decl_annotations_ HRESULT TMatrix4x4Variable::GetMatrixArray(float *pData, uint32_t Offset, uint32_t Count) { return DoMatrix4x4ArrayInternal(Data.pNumeric, pData, Offset, Count -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrixArray"); #else ); @@ -3075,7 +3075,7 @@ HRESULT TMatrix4x4Variable::SetMatrixTranspose(co { DirtyVariable(); return DoMatrix4x4ArrayInternal(Data.pNumeric, const_cast(pData), 0, 1 -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrixTranspose"); #else ); @@ -3087,7 +3087,7 @@ _Use_decl_annotations_ HRESULT TMatrix4x4Variable::GetMatrixTranspose(float *pData) { return DoMatrix4x4ArrayInternal(Data.pNumeric, pData, 0, 1 -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrixTranspose"); #else ); @@ -3100,7 +3100,7 @@ HRESULT TMatrix4x4Variable::SetMatrixTransposeArr { DirtyVariable(); return DoMatrix4x4ArrayInternal(Data.pNumeric, const_cast(pData), Offset, Count -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrixTransposeArray"); #else ); @@ -3112,7 +3112,7 @@ _Use_decl_annotations_ HRESULT TMatrix4x4Variable::GetMatrixTransposeArray(float *pData, uint32_t Offset, uint32_t Count) { return DoMatrix4x4ArrayInternal(Data.pNumeric, pData, Offset, Count -#ifdef _DEBUG +#ifdef _DEBUG , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrixTransposeArray"); #else ); @@ -3511,7 +3511,7 @@ static HRESULT ValidateTextureType(_In_ ID3D11ShaderResourceView *pView, _In_ EO break; case EOT_Texture1D: case EOT_Texture1DArray: - if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1D || + if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1D || desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1DARRAY) return S_OK; break; @@ -3565,7 +3565,7 @@ static HRESULT ValidateTextureType(_In_ ID3D11ShaderResourceView *pView, _In_ EO assert(0); // internal error, should never get here return E_FAIL; } - + DPF(0, "%s: Resource type mismatch; %s expected, %s provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType), GetSRVDimensionNameFromEnum(desc.ViewDimension)); return E_INVALIDARG; @@ -3712,7 +3712,7 @@ static HRESULT ValidateTextureType(_In_ ID3D11UnorderedAccessView *pView, _In_ E break; case EOT_RWTexture1D: case EOT_RWTexture1DArray: - if (desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE1D || + if (desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE1D || desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE1DARRAY) return S_OK; break; @@ -4937,7 +4937,7 @@ struct SFloatVector4GlobalVariableMember : public TVector4Variable { diff --git a/README.md b/README.md index 78fa71a..0a6a9e2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ http://go.microsoft.com/fwlink/?LinkId=271568 Copyright (c) Microsoft Corporation. All rights reserved. -**August 14, 2024** +# August 14, 2024 Effects for Direct3D 11 (FX11) is a management runtime for authoring HLSL shaders, render state, and runtime variables together. @@ -14,7 +14,7 @@ This code is designed to build with Visual Studio 2019 (16.11 or later) or Visua These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see [Where is the DirectX SDK?](https://aka.ms/dxsdk). -*This project is 'archived'. It is still available for use for legacy projects or when using older developer education materials, but use of it for new projects is not recommended.* +_This project is 'archived'. It is still available for use for legacy projects or when using older developer education materials, but use of it for new projects is not recommended._ ## Disclaimer @@ -48,7 +48,7 @@ For a full change history, see [CHANGELOG.md](https://github.com/microsoft/FX11/ ## Support -For questions, consider using [Stack Overflow](https://stackoverflow.com/questions/tagged/d3dx) with the *d3dx* tag. +For questions, consider using [Stack Overflow](https://stackoverflow.com/questions/tagged/d3dx) with the _d3dx_ tag. ## Code of Conduct diff --git a/SECURITY.md b/SECURITY.md index b3c89ef..167c4b4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -14,17 +14,17 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: - * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) - * Full paths of source file(s) related to the manifestation of the issue - * The location of the affected source code (tag/branch/commit or direct URL) - * Any special configuration required to reproduce the issue - * Step-by-step instructions to reproduce the issue - * Proof-of-concept or exploit code (if possible) - * Impact of the issue, including how an attacker might exploit the issue +* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) +* Full paths of source file(s) related to the manifestation of the issue +* The location of the affected source code (tag/branch/commit or direct URL) +* Any special configuration required to reproduce the issue +* Step-by-step instructions to reproduce the issue +* Proof-of-concept or exploit code (if possible) +* Impact of the issue, including how an attacker might exploit the issue This information will help us triage your report more quickly. diff --git a/d3dxGlobal.cpp b/d3dxGlobal.cpp index 6e22e48..8bde0eb 100644 --- a/d3dxGlobal.cpp +++ b/d3dxGlobal.cpp @@ -98,7 +98,7 @@ HRESULT CMemoryStream::Read(LPCSTR *ppString) for(; m_pData[iChar]; iChar++) { if (iChar > m_cbData) - return E_FAIL; + return E_FAIL; } *ppString = (LPCSTR) (m_pData + m_readPtr); @@ -167,7 +167,7 @@ HRESULT CDataBlock::AddData(const void *pvNewData, uint32_t bufferSize, CDataBlo bytesToCopy = std::min(m_maxSize - m_size, bufferSize); memcpy(m_pData + m_size, pNewData, bytesToCopy); pNewData += bytesToCopy; - + if (m_IsAligned) { assert(m_size == AlignToPowerOf2(m_size, c_DataAlignment)); @@ -177,7 +177,7 @@ HRESULT CDataBlock::AddData(const void *pvNewData, uint32_t bufferSize, CDataBlo { m_size += bytesToCopy; } - + bufferSize -= bytesToCopy; *ppBlock = this; @@ -300,7 +300,7 @@ HRESULT CDataBlockStore::AddData(const void *pNewData, uint32_t bufferSize, uint HRESULT hr = S_OK; if (bufferSize == 0) - { + { if (pCurOffset) { *pCurOffset = 0; diff --git a/inc/d3dx11effect.h b/inc/d3dx11effect.h index 4edbcf6..76f3d2b 100644 --- a/inc/d3dx11effect.h +++ b/inc/d3dx11effect.h @@ -48,7 +48,7 @@ struct D3DX11_STATE_BLOCK_MASK uint8_t VSShaderResources[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; uint8_t VSConstantBuffers[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; uint8_t VSInterfaces[D3DX11_BYTES_FROM_BITS(D3D11_SHADER_MAX_INTERFACES)]; - + uint8_t HS; uint8_t HSSamplers[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT)]; uint8_t HSShaderResources[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; @@ -66,14 +66,14 @@ struct D3DX11_STATE_BLOCK_MASK uint8_t GSShaderResources[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; uint8_t GSConstantBuffers[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; uint8_t GSInterfaces[D3DX11_BYTES_FROM_BITS(D3D11_SHADER_MAX_INTERFACES)]; - + uint8_t PS; uint8_t PSSamplers[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT)]; uint8_t PSShaderResources[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; uint8_t PSConstantBuffers[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; uint8_t PSInterfaces[D3DX11_BYTES_FROM_BITS(D3D11_SHADER_MAX_INTERFACES)]; uint8_t PSUnorderedAccessViews; - + uint8_t CS; uint8_t CSSamplers[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT)]; uint8_t CSShaderResources[D3DX11_BYTES_FROM_BITS(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; @@ -85,17 +85,17 @@ struct D3DX11_STATE_BLOCK_MASK uint8_t IAIndexBuffer; uint8_t IAInputLayout; uint8_t IAPrimitiveTopology; - + uint8_t OMRenderTargets; uint8_t OMDepthStencilState; uint8_t OMBlendState; - + uint8_t RSViewports; uint8_t RSScissorRects; uint8_t RSRasterizerState; - + uint8_t SOBuffers; - + uint8_t Predication; }; @@ -112,14 +112,14 @@ struct D3DX11_STATE_BLOCK_MASK // These flags are set by the effect runtime: // // D3DX11_EFFECT_OPTIMIZED -// This effect has been optimized. Reflection functions that rely on +// This effect has been optimized. Reflection functions that rely on // names/semantics/strings should fail. This is set when Optimize() is // called, but CEffect::IsOptimized() should be used to test for this. // // D3DX11_EFFECT_CLONE -// This effect is a clone of another effect. Single CBs will never be +// This effect is a clone of another effect. Single CBs will never be // updated when internal variable values are changed. -// This flag is not set when the D3DX11_EFFECT_CLONE_FORCE_NONSINGLE flag +// This flag is not set when the D3DX11_EFFECT_CLONE_FORCE_NONSINGLE flag // is used in cloning. // //---------------------------------------------------------------------------- @@ -176,21 +176,21 @@ struct D3DX11_STATE_BLOCK_MASK struct D3DX11_EFFECT_TYPE_DESC { - LPCSTR TypeName; // Name of the type + LPCSTR TypeName; // Name of the type // (e.g. "float4" or "MyStruct") D3D_SHADER_VARIABLE_CLASS Class; // (e.g. scalar, vector, object, etc.) D3D_SHADER_VARIABLE_TYPE Type; // (e.g. float, texture, vertexshader, etc.) - + uint32_t Elements; // Number of elements in this type - // (0 if not an array) + // (0 if not an array) uint32_t Members; // Number of members // (0 if not a structure) uint32_t Rows; // Number of rows in this type // (0 if not a numeric primitive) uint32_t Columns; // Number of columns in this type // (0 if not a numeric primitive) - + uint32_t PackedSize; // Number of bytes required to represent // this data type, when tightly packed uint32_t UnpackedSize; // Number of bytes occupied by this data @@ -203,7 +203,7 @@ typedef interface ID3DX11EffectType ID3DX11EffectType; typedef interface ID3DX11EffectType *LPD3D11EFFECTTYPE; // {4250D721-D5E5-491F-B62B-587C43186285} -DEFINE_GUID(IID_ID3DX11EffectType, +DEFINE_GUID(IID_ID3DX11EffectType, 0x4250d721, 0xd5e5, 0x491f, 0xb6, 0x2b, 0x58, 0x7c, 0x43, 0x18, 0x62, 0x85); #undef INTERFACE @@ -235,12 +235,12 @@ DECLARE_INTERFACE_(ID3DX11EffectType, IUnknown) struct D3DX11_EFFECT_VARIABLE_DESC { - LPCSTR Name; // Name of this variable, annotation, + LPCSTR Name; // Name of this variable, annotation, // or structure member LPCSTR Semantic; // Semantic string of this variable - // or structure member (nullptr for + // or structure member (nullptr for // annotations or if not present) - + uint32_t Flags; // D3DX11_EFFECT_VARIABLE_* flags uint32_t Annotations; // Number of annotations on this variable // (always 0 for annotations) @@ -258,7 +258,7 @@ typedef interface ID3DX11EffectVariable ID3DX11EffectVariable; typedef interface ID3DX11EffectVariable *LPD3D11EFFECTVARIABLE; // {036A777D-B56E-4B25-B313-CC3DDAB71873} -DEFINE_GUID(IID_ID3DX11EffectVariable, +DEFINE_GUID(IID_ID3DX11EffectVariable, 0x036a777d, 0xb56e, 0x4b25, 0xb3, 0x13, 0xcc, 0x3d, 0xda, 0xb7, 0x18, 0x73); #undef INTERFACE @@ -290,18 +290,18 @@ DECLARE_INTERFACE_(ID3DX11EffectVariable, IUnknown) STDMETHOD_(bool, IsValid)(THIS) PURE; STDMETHOD_(ID3DX11EffectType*, GetType)(THIS) PURE; STDMETHOD(GetDesc)(THIS_ _Out_ D3DX11_EFFECT_VARIABLE_DESC *pDesc) PURE; - + STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(THIS_ _In_z_ LPCSTR Name) PURE; - + STDMETHOD_(ID3DX11EffectVariable*, GetMemberByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetMemberByName)(THIS_ _In_z_ LPCSTR Name) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetMemberBySemantic)(THIS_ _In_z_ LPCSTR Semantic) PURE; - + STDMETHOD_(ID3DX11EffectVariable*, GetElement)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - + STDMETHOD_(ID3DX11EffectScalarVariable*, AsScalar)(THIS) PURE; STDMETHOD_(ID3DX11EffectVectorVariable*, AsVector)(THIS) PURE; STDMETHOD_(ID3DX11EffectMatrixVariable*, AsMatrix)(THIS) PURE; @@ -318,7 +318,7 @@ DECLARE_INTERFACE_(ID3DX11EffectVariable, IUnknown) STDMETHOD_(ID3DX11EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; STDMETHOD_(ID3DX11EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; STDMETHOD_(ID3DX11EffectSamplerVariable*, AsSampler)(THIS) PURE; - + STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) const void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) PURE; STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) PURE; }; @@ -331,7 +331,7 @@ typedef interface ID3DX11EffectScalarVariable ID3DX11EffectScalarVariable; typedef interface ID3DX11EffectScalarVariable *LPD3D11EFFECTSCALARVARIABLE; // {921EF2E5-A65D-4E92-9FC6-4E9CC09A4ADE} -DEFINE_GUID(IID_ID3DX11EffectScalarVariable, +DEFINE_GUID(IID_ID3DX11EffectScalarVariable, 0x921ef2e5, 0xa65d, 0x4e92, 0x9f, 0xc6, 0x4e, 0x9c, 0xc0, 0x9a, 0x4a, 0xde); #undef INTERFACE @@ -344,20 +344,20 @@ DECLARE_INTERFACE_(ID3DX11EffectScalarVariable, ID3DX11EffectVariable) // ID3DX11EffectScalarVariable STDMETHOD(SetFloat)(THIS_ _In_ float Value) PURE; - STDMETHOD(GetFloat)(THIS_ _Out_ float *pValue) PURE; - + STDMETHOD(GetFloat)(THIS_ _Out_ float *pValue) PURE; + STDMETHOD(SetFloatArray)(THIS_ _In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetFloatArray)(THIS_ _Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; - + STDMETHOD(SetInt)(THIS_ _In_ int Value) PURE; STDMETHOD(GetInt)(THIS_ _Out_ int *pValue) PURE; - + STDMETHOD(SetIntArray)(THIS_ _In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetIntArray)(THIS_ _Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; - + STDMETHOD(SetBool)(THIS_ _In_ bool Value) PURE; STDMETHOD(GetBool)(THIS_ _Out_ bool *pValue) PURE; - + STDMETHOD(SetBoolArray)(THIS_ _In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetBoolArray)(THIS_ _Out_writes_(Count) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; }; @@ -370,7 +370,7 @@ typedef interface ID3DX11EffectVectorVariable ID3DX11EffectVectorVariable; typedef interface ID3DX11EffectVectorVariable *LPD3D11EFFECTVECTORVARIABLE; // {5E785D4A-D87B-48D8-B6E6-0F8CA7E7467A} -DEFINE_GUID(IID_ID3DX11EffectVectorVariable, +DEFINE_GUID(IID_ID3DX11EffectVectorVariable, 0x5e785d4a, 0xd87b, 0x48d8, 0xb6, 0xe6, 0x0f, 0x8c, 0xa7, 0xe7, 0x46, 0x7a); #undef INTERFACE @@ -407,7 +407,7 @@ typedef interface ID3DX11EffectMatrixVariable ID3DX11EffectMatrixVariable; typedef interface ID3DX11EffectMatrixVariable *LPD3D11EFFECTMATRIXVARIABLE; // {E1096CF4-C027-419A-8D86-D29173DC803E} -DEFINE_GUID(IID_ID3DX11EffectMatrixVariable, +DEFINE_GUID(IID_ID3DX11EffectMatrixVariable, 0xe1096cf4, 0xc027, 0x419a, 0x8d, 0x86, 0xd2, 0x91, 0x73, 0xdc, 0x80, 0x3e); #undef INTERFACE @@ -421,16 +421,16 @@ DECLARE_INTERFACE_(ID3DX11EffectMatrixVariable, ID3DX11EffectVariable) // ID3DX11EffectMatrixVariable STDMETHOD(SetMatrix)(THIS_ _In_reads_(16) const float *pData) PURE; STDMETHOD(GetMatrix)(THIS_ _Out_writes_(16) float *pData) PURE; - + STDMETHOD(SetMatrixArray)(THIS_ _In_reads_(Count*16) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetMatrixArray)(THIS_ _Out_writes_(Count*16) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; - + STDMETHOD(SetMatrixPointerArray)(_In_reads_(Count*16) const float **ppData, uint32_t Offset, uint32_t Count) PURE; STDMETHOD(GetMatrixPointerArray)(_Out_writes_(Count*16) float **ppData, uint32_t Offset, uint32_t Count) PURE; STDMETHOD(SetMatrixTranspose)(THIS_ _In_reads_(16) const float *pData) PURE; STDMETHOD(GetMatrixTranspose)(THIS_ _Out_writes_(16) float *pData) PURE; - + STDMETHOD(SetMatrixTransposeArray)(THIS_ _In_reads_(Count*16) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetMatrixTransposeArray)(THIS_ _Out_writes_(Count*16) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; @@ -446,7 +446,7 @@ typedef interface ID3DX11EffectStringVariable ID3DX11EffectStringVariable; typedef interface ID3DX11EffectStringVariable *LPD3D11EFFECTSTRINGVARIABLE; // {F355C818-01BE-4653-A7CC-60FFFEDDC76D} -DEFINE_GUID(IID_ID3DX11EffectStringVariable, +DEFINE_GUID(IID_ID3DX11EffectStringVariable, 0xf355c818, 0x01be, 0x4653, 0xa7, 0xcc, 0x60, 0xff, 0xfe, 0xdd, 0xc7, 0x6d); #undef INTERFACE @@ -470,7 +470,7 @@ typedef interface ID3DX11EffectClassInstanceVariable ID3DX11EffectClassInstanceV typedef interface ID3DX11EffectClassInstanceVariable *LPD3D11EFFECTCLASSINSTANCEVARIABLE; // {926A8053-2A39-4DB4-9BDE-CF649ADEBDC1} -DEFINE_GUID(IID_ID3DX11EffectClassInstanceVariable, +DEFINE_GUID(IID_ID3DX11EffectClassInstanceVariable, 0x926a8053, 0x2a39, 0x4db4, 0x9b, 0xde, 0xcf, 0x64, 0x9a, 0xde, 0xbd, 0xc1); #undef INTERFACE @@ -493,7 +493,7 @@ typedef interface ID3DX11EffectInterfaceVariable ID3DX11EffectInterfaceVariable; typedef interface ID3DX11EffectInterfaceVariable *LPD3D11EFFECTINTERFACEVARIABLE; // {516C8CD8-1C80-40A4-B19B-0688792F11A5} -DEFINE_GUID(IID_ID3DX11EffectInterfaceVariable, +DEFINE_GUID(IID_ID3DX11EffectInterfaceVariable, 0x516c8cd8, 0x1c80, 0x40a4, 0xb1, 0x9b, 0x06, 0x88, 0x79, 0x2f, 0x11, 0xa5); #undef INTERFACE @@ -517,7 +517,7 @@ typedef interface ID3DX11EffectShaderResourceVariable ID3DX11EffectShaderResourc typedef interface ID3DX11EffectShaderResourceVariable *LPD3D11EFFECTSHADERRESOURCEVARIABLE; // {350DB233-BBE0-485C-9BFE-C0026B844F89} -DEFINE_GUID(IID_ID3DX11EffectShaderResourceVariable, +DEFINE_GUID(IID_ID3DX11EffectShaderResourceVariable, 0x350db233, 0xbbe0, 0x485c, 0x9b, 0xfe, 0xc0, 0x02, 0x6b, 0x84, 0x4f, 0x89); #undef INTERFACE @@ -531,7 +531,7 @@ DECLARE_INTERFACE_(ID3DX11EffectShaderResourceVariable, ID3DX11EffectVariable) // ID3DX11EffectShaderResourceVariable STDMETHOD(SetResource)(THIS_ _In_ ID3D11ShaderResourceView *pResource) PURE; STDMETHOD(GetResource)(THIS_ _Outptr_ ID3D11ShaderResourceView **ppResource) PURE; - + STDMETHOD(SetResourceArray)(THIS_ _In_reads_(Count) ID3D11ShaderResourceView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetResourceArray)(THIS_ _Out_writes_(Count) ID3D11ShaderResourceView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; }; @@ -544,7 +544,7 @@ typedef interface ID3DX11EffectUnorderedAccessViewVariable ID3DX11EffectUnordere typedef interface ID3DX11EffectUnorderedAccessViewVariable *LPD3D11EFFECTUNORDEREDACCESSVIEWVARIABLE; // {79B4AC8C-870A-47D2-B05A-8BD5CC3EE6C9} -DEFINE_GUID(IID_ID3DX11EffectUnorderedAccessViewVariable, +DEFINE_GUID(IID_ID3DX11EffectUnorderedAccessViewVariable, 0x79b4ac8c, 0x870a, 0x47d2, 0xb0, 0x5a, 0x8b, 0xd5, 0xcc, 0x3e, 0xe6, 0xc9); #undef INTERFACE @@ -571,7 +571,7 @@ typedef interface ID3DX11EffectRenderTargetViewVariable ID3DX11EffectRenderTarge typedef interface ID3DX11EffectRenderTargetViewVariable *LPD3D11EFFECTRENDERTARGETVIEWVARIABLE; // {D5066909-F40C-43F8-9DB5-057C2A208552} -DEFINE_GUID(IID_ID3DX11EffectRenderTargetViewVariable, +DEFINE_GUID(IID_ID3DX11EffectRenderTargetViewVariable, 0xd5066909, 0xf40c, 0x43f8, 0x9d, 0xb5, 0x05, 0x7c, 0x2a, 0x20, 0x85, 0x52); #undef INTERFACE @@ -585,7 +585,7 @@ DECLARE_INTERFACE_(ID3DX11EffectRenderTargetViewVariable, ID3DX11EffectVariable) // ID3DX11EffectRenderTargetViewVariable STDMETHOD(SetRenderTarget)(THIS_ _In_ ID3D11RenderTargetView *pResource) PURE; STDMETHOD(GetRenderTarget)(THIS_ _Outptr_ ID3D11RenderTargetView **ppResource) PURE; - + STDMETHOD(SetRenderTargetArray)(THIS_ _In_reads_(Count) ID3D11RenderTargetView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetRenderTargetArray)(THIS_ _Out_writes_(Count) ID3D11RenderTargetView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; }; @@ -598,7 +598,7 @@ typedef interface ID3DX11EffectDepthStencilViewVariable ID3DX11EffectDepthStenci typedef interface ID3DX11EffectDepthStencilViewVariable *LPD3D11EFFECTDEPTHSTENCILVIEWVARIABLE; // {33C648AC-2E9E-4A2E-9CD6-DE31ACC5B347} -DEFINE_GUID(IID_ID3DX11EffectDepthStencilViewVariable, +DEFINE_GUID(IID_ID3DX11EffectDepthStencilViewVariable, 0x33c648ac, 0x2e9e, 0x4a2e, 0x9c, 0xd6, 0xde, 0x31, 0xac, 0xc5, 0xb3, 0x47); #undef INTERFACE @@ -612,7 +612,7 @@ DECLARE_INTERFACE_(ID3DX11EffectDepthStencilViewVariable, ID3DX11EffectVariable) // ID3DX11EffectDepthStencilViewVariable STDMETHOD(SetDepthStencil)(THIS_ _In_ ID3D11DepthStencilView *pResource) PURE; STDMETHOD(GetDepthStencil)(THIS_ _Outptr_ ID3D11DepthStencilView **ppResource) PURE; - + STDMETHOD(SetDepthStencilArray)(THIS_ _In_reads_(Count) ID3D11DepthStencilView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; STDMETHOD(GetDepthStencilArray)(THIS_ _Out_writes_(Count) ID3D11DepthStencilView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) PURE; }; @@ -625,7 +625,7 @@ typedef interface ID3DX11EffectConstantBuffer ID3DX11EffectConstantBuffer; typedef interface ID3DX11EffectConstantBuffer *LPD3D11EFFECTCONSTANTBUFFER; // {2CB6C733-82D2-4000-B3DA-6219D9A99BF2} -DEFINE_GUID(IID_ID3DX11EffectConstantBuffer, +DEFINE_GUID(IID_ID3DX11EffectConstantBuffer, 0x2cb6c733, 0x82d2, 0x4000, 0xb3, 0xda, 0x62, 0x19, 0xd9, 0xa9, 0x9b, 0xf2); #undef INTERFACE @@ -640,7 +640,7 @@ DECLARE_INTERFACE_(ID3DX11EffectConstantBuffer, ID3DX11EffectVariable) STDMETHOD(SetConstantBuffer)(THIS_ _In_ ID3D11Buffer *pConstantBuffer) PURE; STDMETHOD(UndoSetConstantBuffer)(THIS) PURE; STDMETHOD(GetConstantBuffer)(THIS_ _Outptr_ ID3D11Buffer **ppConstantBuffer) PURE; - + STDMETHOD(SetTextureBuffer)(THIS_ _In_ ID3D11ShaderResourceView *pTextureBuffer) PURE; STDMETHOD(UndoSetTextureBuffer)(THIS) PURE; STDMETHOD(GetTextureBuffer)(THIS_ _Outptr_ ID3D11ShaderResourceView **ppTextureBuffer) PURE; @@ -660,18 +660,18 @@ struct D3DX11_EFFECT_SHADER_DESC { const uint8_t *pInputSignature; // Passed into CreateInputLayout, // valid on VS and GS only - + bool IsInline; // Is this an anonymous shader variable // resulting from an inline shader assignment? - - + + // -- The following fields are not valid after Optimize() -- const uint8_t *pBytecode; // Shader bytecode uint32_t BytecodeLength; - + LPCSTR SODecls[D3D11_SO_STREAM_COUNT]; // Stream out declaration string (for GS with SO) uint32_t RasterizedStream; - + uint32_t NumInputSignatureEntries; // Number of entries in the input signature uint32_t NumOutputSignatureEntries; // Number of entries in the output signature uint32_t NumPatchConstantSignatureEntries; // Number of entries in the patch constant signature @@ -682,7 +682,7 @@ typedef interface ID3DX11EffectShaderVariable ID3DX11EffectShaderVariable; typedef interface ID3DX11EffectShaderVariable *LPD3D11EFFECTSHADERVARIABLE; // {7508B344-020A-4EC7-9118-62CDD36C88D7} -DEFINE_GUID(IID_ID3DX11EffectShaderVariable, +DEFINE_GUID(IID_ID3DX11EffectShaderVariable, 0x7508b344, 0x020a, 0x4ec7, 0x91, 0x18, 0x62, 0xcd, 0xd3, 0x6c, 0x88, 0xd7); #undef INTERFACE @@ -695,14 +695,14 @@ DECLARE_INTERFACE_(ID3DX11EffectShaderVariable, ID3DX11EffectVariable) // ID3DX11EffectShaderVariable STDMETHOD(GetShaderDesc)(THIS_ _In_ uint32_t ShaderIndex, _Out_ D3DX11_EFFECT_SHADER_DESC *pDesc) PURE; - + STDMETHOD(GetVertexShader)(THIS_ _In_ uint32_t ShaderIndex, _Outptr_ ID3D11VertexShader **ppVS) PURE; STDMETHOD(GetGeometryShader)(THIS_ _In_ uint32_t ShaderIndex, _Outptr_ ID3D11GeometryShader **ppGS) PURE; STDMETHOD(GetPixelShader)(THIS_ _In_ uint32_t ShaderIndex, _Outptr_ ID3D11PixelShader **ppPS) PURE; STDMETHOD(GetHullShader)(THIS_ _In_ uint32_t ShaderIndex, _Outptr_ ID3D11HullShader **ppHS) PURE; STDMETHOD(GetDomainShader)(THIS_ _In_ uint32_t ShaderIndex, _Outptr_ ID3D11DomainShader **ppDS) PURE; STDMETHOD(GetComputeShader)(THIS_ _In_ uint32_t ShaderIndex, _Outptr_ ID3D11ComputeShader **ppCS) PURE; - + STDMETHOD(GetInputSignatureElementDesc)(THIS_ _In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE; STDMETHOD(GetOutputSignatureElementDesc)(THIS_ _In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE; STDMETHOD(GetPatchConstantSignatureElementDesc)(THIS_ _In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE; @@ -716,7 +716,7 @@ typedef interface ID3DX11EffectBlendVariable ID3DX11EffectBlendVariable; typedef interface ID3DX11EffectBlendVariable *LPD3D11EFFECTBLENDVARIABLE; // {D664F4D7-3B81-4805-B277-C1DF58C39F53} -DEFINE_GUID(IID_ID3DX11EffectBlendVariable, +DEFINE_GUID(IID_ID3DX11EffectBlendVariable, 0xd664f4d7, 0x3b81, 0x4805, 0xb2, 0x77, 0xc1, 0xdf, 0x58, 0xc3, 0x9f, 0x53); #undef INTERFACE @@ -730,7 +730,7 @@ DECLARE_INTERFACE_(ID3DX11EffectBlendVariable, ID3DX11EffectVariable) // ID3DX11EffectBlendVariable STDMETHOD(GetBlendState)(THIS_ _In_ uint32_t Index, _Outptr_ ID3D11BlendState **ppState) PURE; STDMETHOD(SetBlendState)(THIS_ _In_ uint32_t Index, _In_ ID3D11BlendState *pState) PURE; - STDMETHOD(UndoSetBlendState)(THIS_ _In_ uint32_t Index) PURE; + STDMETHOD(UndoSetBlendState)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD(GetBackingStore)(THIS_ _In_ uint32_t Index, _Out_ D3D11_BLEND_DESC *pDesc) PURE; }; @@ -742,7 +742,7 @@ typedef interface ID3DX11EffectDepthStencilVariable ID3DX11EffectDepthStencilVar typedef interface ID3DX11EffectDepthStencilVariable *LPD3D11EFFECTDEPTHSTENCILVARIABLE; // {69B5751B-61A5-48E5-BD41-D93988111563} -DEFINE_GUID(IID_ID3DX11EffectDepthStencilVariable, +DEFINE_GUID(IID_ID3DX11EffectDepthStencilVariable, 0x69b5751b, 0x61a5, 0x48e5, 0xbd, 0x41, 0xd9, 0x39, 0x88, 0x11, 0x15, 0x63); #undef INTERFACE @@ -768,7 +768,7 @@ typedef interface ID3DX11EffectRasterizerVariable ID3DX11EffectRasterizerVariabl typedef interface ID3DX11EffectRasterizerVariable *LPD3D11EFFECTRASTERIZERVARIABLE; // {53A262F6-5F74-4151-A132-E3DD19A62C9D} -DEFINE_GUID(IID_ID3DX11EffectRasterizerVariable, +DEFINE_GUID(IID_ID3DX11EffectRasterizerVariable, 0x53a262f6, 0x5f74, 0x4151, 0xa1, 0x32, 0xe3, 0xdd, 0x19, 0xa6, 0x2c, 0x9d); #undef INTERFACE @@ -794,7 +794,7 @@ typedef interface ID3DX11EffectSamplerVariable ID3DX11EffectSamplerVariable; typedef interface ID3DX11EffectSamplerVariable *LPD3D11EFFECTSAMPLERVARIABLE; // {C6402E55-1095-4D95-8931-F92660513DD9} -DEFINE_GUID(IID_ID3DX11EffectSamplerVariable, +DEFINE_GUID(IID_ID3DX11EffectSamplerVariable, 0xc6402e55, 0x1095, 0x4d95, 0x89, 0x31, 0xf9, 0x26, 0x60, 0x51, 0x3d, 0xd9); #undef INTERFACE @@ -824,13 +824,13 @@ DECLARE_INTERFACE_(ID3DX11EffectSamplerVariable, ID3DX11EffectVariable) struct D3DX11_PASS_DESC { - LPCSTR Name; // Name of this pass (nullptr if not anonymous) + LPCSTR Name; // Name of this pass (nullptr if not anonymous) uint32_t Annotations; // Number of annotations on this pass - + uint8_t *pIAInputSignature; // Signature from VS or GS (if there is no VS) // or nullptr if neither exists - size_t IAInputSignatureSize; // Singature size in bytes - + size_t IAInputSignatureSize; // Singature size in bytes + uint32_t StencilRef; // Specified in SetDepthStencilState() uint32_t SampleMask; // Specified in SetBlendState() FLOAT BlendFactor[4]; // Specified in SetBlendState() @@ -846,7 +846,7 @@ struct D3DX11_PASS_SHADER_DESC { ID3DX11EffectShaderVariable *pShaderVariable; // The variable that this shader came from. // If this is an inline shader assignment, - // the returned interface will be an + // the returned interface will be an // anonymous shader variable, which is // not retrievable any other way. It's // name in the variable description will @@ -854,7 +854,7 @@ struct D3DX11_PASS_SHADER_DESC // If there is no assignment of this type in // the pass block, pShaderVariable != nullptr, // but pShaderVariable->IsValid() == false. - + uint32_t ShaderIndex; // The element of pShaderVariable (if an array) // or 0 if not applicable }; @@ -863,7 +863,7 @@ typedef interface ID3DX11EffectPass ID3DX11EffectPass; typedef interface ID3DX11EffectPass *LPD3D11EFFECTPASS; // {3437CEC4-4AC1-4D87-8916-F4BD5A41380C} -DEFINE_GUID(IID_ID3DX11EffectPass, +DEFINE_GUID(IID_ID3DX11EffectPass, 0x3437cec4, 0x4ac1, 0x4d87, 0x89, 0x16, 0xf4, 0xbd, 0x5a, 0x41, 0x38, 0x0c); #undef INTERFACE @@ -876,19 +876,19 @@ DECLARE_INTERFACE_(ID3DX11EffectPass, IUnknown) // ID3DX11EffectPass STDMETHOD_(bool, IsValid)(THIS) PURE; STDMETHOD(GetDesc)(THIS_ _Out_ D3DX11_PASS_DESC *pDesc) PURE; - + STDMETHOD(GetVertexShaderDesc)(THIS_ _Out_ D3DX11_PASS_SHADER_DESC *pDesc) PURE; STDMETHOD(GetGeometryShaderDesc)(THIS_ _Out_ D3DX11_PASS_SHADER_DESC *pDesc) PURE; STDMETHOD(GetPixelShaderDesc)(THIS_ _Out_ D3DX11_PASS_SHADER_DESC *pDesc) PURE; STDMETHOD(GetHullShaderDesc)(THIS_ _Out_ D3DX11_PASS_SHADER_DESC *pDesc) PURE; STDMETHOD(GetDomainShaderDesc)(THIS_ _Out_ D3DX11_PASS_SHADER_DESC *pDesc) PURE; STDMETHOD(GetComputeShaderDesc)(THIS_ _Out_ D3DX11_PASS_SHADER_DESC *pDesc) PURE; - + STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(THIS_ _In_z_ LPCSTR Name) PURE; - + STDMETHOD(Apply)(THIS_ _In_ uint32_t Flags, _In_ ID3D11DeviceContext* pContext) PURE; - + STDMETHOD(ComputeStateBlockMask)(THIS_ _Inout_ D3DX11_STATE_BLOCK_MASK *pStateBlockMask) PURE; }; @@ -913,7 +913,7 @@ typedef interface ID3DX11EffectTechnique ID3DX11EffectTechnique; typedef interface ID3DX11EffectTechnique *LPD3D11EFFECTTECHNIQUE; // {51198831-1F1D-4F47-BD76-41CB0835B1DE} -DEFINE_GUID(IID_ID3DX11EffectTechnique, +DEFINE_GUID(IID_ID3DX11EffectTechnique, 0x51198831, 0x1f1d, 0x4f47, 0xbd, 0x76, 0x41, 0xcb, 0x08, 0x35, 0xb1, 0xde); #undef INTERFACE @@ -926,13 +926,13 @@ DECLARE_INTERFACE_(ID3DX11EffectTechnique, IUnknown) // ID3DX11EffectTechnique STDMETHOD_(bool, IsValid)(THIS) PURE; STDMETHOD(GetDesc)(THIS_ _Out_ D3DX11_TECHNIQUE_DESC *pDesc) PURE; - + STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(THIS_ _In_z_ LPCSTR Name) PURE; - + STDMETHOD_(ID3DX11EffectPass*, GetPassByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectPass*, GetPassByName)(THIS_ _In_z_ LPCSTR Name) PURE; - + STDMETHOD(ComputeStateBlockMask)(THIS_ _Inout_ D3DX11_STATE_BLOCK_MASK *pStateBlockMask) PURE; }; @@ -957,13 +957,13 @@ typedef interface ID3DX11EffectGroup ID3DX11EffectGroup; typedef interface ID3DX11EffectGroup *LPD3D11EFFECTGROUP; // {03074acf-97de-485f-b201-cb775264afd6} -DEFINE_GUID(IID_ID3DX11EffectGroup, +DEFINE_GUID(IID_ID3DX11EffectGroup, 0x03074acf, 0x97de, 0x485f, 0xb2, 0x01, 0xcb, 0x77, 0x52, 0x64, 0xaf, 0xd6); #undef INTERFACE #define INTERFACE ID3DX11EffectGroup -DECLARE_INTERFACE_(ID3DX11EffectGroup, IUnknown) +DECLARE_INTERFACE_(ID3DX11EffectGroup, IUnknown) { // IUnknown @@ -1001,7 +1001,7 @@ typedef interface ID3DX11Effect ID3DX11Effect; typedef interface ID3DX11Effect *LPD3D11EFFECT; // {FA61CA24-E4BA-4262-9DB8-B132E8CAE319} -DEFINE_GUID(IID_ID3DX11Effect, +DEFINE_GUID(IID_ID3DX11Effect, 0xfa61ca24, 0xe4ba, 0x4262, 0x9d, 0xb8, 0xb1, 0x32, 0xe8, 0xca, 0xe3, 0x19); #undef INTERFACE @@ -1015,22 +1015,22 @@ DECLARE_INTERFACE_(ID3DX11Effect, IUnknown) STDMETHOD_(bool, IsValid)(THIS) PURE; STDMETHOD(GetDevice)(THIS_ _Outptr_ ID3D11Device** ppDevice) PURE; - + STDMETHOD(GetDesc)(THIS_ _Out_ D3DX11_EFFECT_DESC *pDesc) PURE; - + STDMETHOD_(ID3DX11EffectConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectConstantBuffer*, GetConstantBufferByName)(THIS_ _In_z_ LPCSTR Name) PURE; - + STDMETHOD_(ID3DX11EffectVariable*, GetVariableByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetVariableByName)(THIS_ _In_z_ LPCSTR Name) PURE; STDMETHOD_(ID3DX11EffectVariable*, GetVariableBySemantic)(THIS_ _In_z_ LPCSTR Semantic) PURE; - + STDMETHOD_(ID3DX11EffectGroup*, GetGroupByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectGroup*, GetGroupByName)(THIS_ _In_z_ LPCSTR Name) PURE; STDMETHOD_(ID3DX11EffectTechnique*, GetTechniqueByIndex)(THIS_ _In_ uint32_t Index) PURE; STDMETHOD_(ID3DX11EffectTechnique*, GetTechniqueByName)(THIS_ _In_z_ LPCSTR Name) PURE; - + STDMETHOD_(ID3D11ClassLinkage*, GetClassLinkage)(THIS) PURE; STDMETHOD(CloneEffect)(THIS_ _In_ uint32_t Flags, _Outptr_ ID3DX11Effect** ppClonedEffect ) PURE; @@ -1142,7 +1142,7 @@ HRESULT WINAPI D3DX11CreateEffectFromFile( _In_z_ LPCWSTR pFileName, //---------------------------------------------------------------------------- HRESULT D3DX11CompileEffectFromMemory( _In_reads_bytes_(DataLength) LPCVOID pData, - _In_ SIZE_T DataLength, + _In_ SIZE_T DataLength, _In_opt_z_ LPCSTR srcName, _In_opt_ const D3D_SHADER_MACRO *pDefines, _In_opt_ ID3DInclude *pInclude, diff --git a/inc/d3dxGlobal.h b/inc/d3dxGlobal.h index 5d2bef2..ee23c9f 100644 --- a/inc/d3dxGlobal.h +++ b/inc/d3dxGlobal.h @@ -50,7 +50,7 @@ using namespace D3DX11Debug; #if FXDEBUG #define __BREAK_ON_FAIL { __debugbreak(); } #else -#define __BREAK_ON_FAIL +#define __BREAK_ON_FAIL #endif #define VA(x, action) { hr = (x); if (FAILED(hr)) { action; __BREAK_ON_FAIL; return hr; } } @@ -228,7 +228,7 @@ template class CEffectVector HRESULT hr = S_OK; Clear(); VN( m_pData = new uint8_t[vOther.m_MaxSize * sizeof(T)] ); - + m_CurSize = vOther.m_CurSize; m_MaxSize = vOther.m_MaxSize; m_hLastError = vOther.m_hLastError; @@ -271,10 +271,10 @@ template class CEffectVector void Empty() { - + // manually invoke destructor on all elements for (size_t i = 0; i < m_CurSize; ++ i) - { + { ((T*)m_pData + i)->~T(); } m_CurSize = 0; @@ -341,7 +341,7 @@ template class CEffectVector HRESULT Insert(_In_ const T& var, _In_ uint32_t index) { assert(index < m_CurSize); - + if (FAILED(Grow())) return m_hLastError; @@ -355,7 +355,7 @@ template class CEffectVector HRESULT InsertRange(_In_reads_(count) const T *pVar, _In_ uint32_t index, _In_ uint32_t count) { assert(index < m_CurSize); - + if (m_CurSize + count < m_CurSize) { m_hLastError = E_OUTOFMEMORY; @@ -409,7 +409,7 @@ template class CEffectVector uint32_t FindIndexOf(_In_ const void *pEntry) const { for (size_t i = 0; i < m_CurSize; ++ i) - { + { if (((T*)m_pData + i) == pEntry) return i; } @@ -674,7 +674,7 @@ static uint32_t ComputeHash(_In_reads_bytes_(cbToHash) const uint8_t *pb, _In_ u c += pdw[2]; HASH_MIX(a,b,c); - pb += 12; + pb += 12; cbLeft -= 12; } @@ -732,7 +732,7 @@ static uint32_t ComputeHashLower(_In_reads_bytes_(cbToHash) const uint8_t *pb, _ c += pdw[2]; HASH_MIX(a,b,c); - pb += 12; + pb += 12; cbLeft -= 12; } @@ -783,7 +783,7 @@ static uint32_t ComputeHash(_In_z_ LPCSTR pString) // 4) each is roughly in between two powers of 2; // (2^n hash table sizes are VERY BAD; they effectively truncate your // precision down to the n least significant bits of the hash) -static const uint32_t c_PrimeSizes[] = +static const uint32_t c_PrimeSizes[] = { 11, 23, @@ -896,7 +896,7 @@ class CEffectHashTable // seize this hash entry, migrate it to the new table SHashEntry *pNewEntry; VN( pNewEntry = new SHashEntry ); - + pNewEntry->pNext = rgpNewHashEntries[index]; pNewEntry->Data = iter.pHashEntry->Data; pNewEntry->Hash = iter.pHashEntry->Hash; @@ -967,7 +967,7 @@ class CEffectHashTable return DesiredSize; } - + // O(n) function // Grows to the next suitable size (based off of the prime number table) // DesiredSize is merely a suggestion @@ -993,10 +993,10 @@ class CEffectHashTable else { OwnProvidedArray = true; - + VN( rgpNewHashEntries = new SHashEntry*[actualSize] ); } - + ZeroMemory(rgpNewHashEntries, sizeof(SHashEntry*) * actualSize); // Expensive operation: rebuild the hash table @@ -1050,7 +1050,7 @@ class CEffectHashTable DPF(0, "Uninitialized hash table!"); return; } - + float variance = 0.0f; float mean = (float)m_NumEntries / (float)m_NumHashSlots; uint32_t unusedSlots = 0; @@ -1065,7 +1065,7 @@ class CEffectHashTable while (nullptr != pCurrentEntry) { SHashEntry *pCurrentEntry2 = m_rgpHashEntries[i]; - + // check other hash entries in this slot for hash collisions or duplications while (pCurrentEntry2 != pCurrentEntry) { @@ -1092,7 +1092,7 @@ class CEffectHashTable { ++ unusedSlots; } - + // mean must be greater than 0 at this point variance += (float)entries * (float)entries / mean; }