diff --git a/Kits/ATGTK/ControllerFont.h b/Kits/ATGTK/ControllerFont.h index 026075f07208fcb5a89b84c7e5f2c6e0ebbd0255..0b560a0e8b5b9247cab774fa9abec9512d702e11 100644 --- a/Kits/ATGTK/ControllerFont.h +++ b/Kits/ATGTK/ControllerFont.h @@ -187,4 +187,219 @@ namespace DX textFont->DrawString(spriteBatch, strBuffer, outPos, color, 0.f, XMFLOAT2(0.f, 0.f), XMFLOAT2(scale, scale)); } } + + inline RECT XM_CALLCONV MeasureControllerDrawBounds(_In_ DirectX::SpriteFont* textFont, _In_ DirectX::SpriteFont* butnFont, + _In_z_ wchar_t const* text, DirectX::XMFLOAT2 const& position, float scale = 1) + { + using namespace DirectX; + + size_t textLen = wcslen(text); + if (textLen >= 4096) + { + throw std::out_of_range("String is too long"); + } + + float buttonHeight = butnFont->GetLineSpacing(); + float buttonScale = (textFont->GetLineSpacing() * scale) / buttonHeight; + float offsetY = buttonScale / 2.f; + + size_t j = 0; + wchar_t strBuffer[4096] = { 0 }; + + bool buttonText = false; + + XMFLOAT2 outPos = position; + + RECT result = { LONG_MAX, LONG_MAX, 0, 0 }; + for (size_t ch = 0; ch < textLen; ++ch) + { + if (buttonText) + { + strBuffer[j++] = text[ch]; + + if (text[ch] == L']') + { + wchar_t button[2] = { 0 }; + + if (_wcsicmp(strBuffer, L"[A]") == 0) + { + *button = static_cast(ControllerFont::AButton); + } + else if (_wcsicmp(strBuffer, L"[B]") == 0) + { + *button = static_cast(ControllerFont::BButton); + } + else if (_wcsicmp(strBuffer, L"[X]") == 0) + { + *button = static_cast(ControllerFont::XButton); + } + else if (_wcsicmp(strBuffer, L"[Y]") == 0) + { + *button = static_cast(ControllerFont::YButton); + } + else if (_wcsicmp(strBuffer, L"[DPad]") == 0) + { + *button = static_cast(ControllerFont::DPad); + } + else if (_wcsicmp(strBuffer, L"[View]") == 0) + { + *button = static_cast(ControllerFont::View); + } + else if (_wcsicmp(strBuffer, L"[Menu]") == 0) + { + *button = static_cast(ControllerFont::Menu); + } + else if (_wcsicmp(strBuffer, L"[Nexus]") == 0) + { + *button = static_cast(ControllerFont::Nexus); + } + else if (_wcsicmp(strBuffer, L"[RThumb]") == 0) + { + *button = static_cast(ControllerFont::RightThumb); + } + else if (_wcsicmp(strBuffer, L"[LThumb]") == 0) + { + *button = static_cast(ControllerFont::LeftThumb); + } + else if (_wcsicmp(strBuffer, L"[RB]") == 0) + { + *button = static_cast(ControllerFont::RightShoulder); + } + else if (_wcsicmp(strBuffer, L"[LB]") == 0) + { + *button = static_cast(ControllerFont::LeftShoulder); + } + else if (_wcsicmp(strBuffer, L"[RT]") == 0) + { + *button = static_cast(ControllerFont::RightTrigger); + } + else if (_wcsicmp(strBuffer, L"[LT]") == 0) + { + *button = static_cast(ControllerFont::LeftTrigger); + } + + if (*button) + { + float bsize = XMVectorGetX(butnFont->MeasureString(button)); + float offsetX = (bsize * buttonScale / 2.f); + + if (outPos.x < result.left) + result.left = long(outPos.x); + + if (outPos.y < result.top) + result.top = long(outPos.y); + + outPos.x += offsetX; + outPos.y -= offsetY; + + if (outPos.x < result.left) + result.left = long(outPos.x); + + if (outPos.y < result.top) + result.top = long(outPos.y); + + outPos.x += bsize * buttonScale; + outPos.y += offsetY; + + if (result.right < outPos.x) + result.right = long(outPos.x); + + if (result.bottom < outPos.y) + result.bottom = long(outPos.y); + } + + memset(strBuffer, 0, sizeof(strBuffer)); + j = 0; + + buttonText = false; + } + } + else + { + switch (text[ch]) + { + case '\r': + break; + + case '[': + if (*strBuffer) + { + if (outPos.x < result.left) + result.left = long(outPos.x); + + if (outPos.y < result.top) + result.top = long(outPos.y); + + outPos.x += XMVectorGetX(textFont->MeasureString(strBuffer)) * scale; + + if (result.right < outPos.x) + result.right = long(outPos.x); + + if (result.bottom < outPos.y) + result.bottom = long(outPos.y); + + memset(strBuffer, 0, sizeof(strBuffer)); + j = 0; + } + buttonText = true; + *strBuffer = L'['; + ++j; + break; + + case '\n': + if (*strBuffer) + { + if (outPos.x < result.left) + result.left = long(outPos.x); + + if (outPos.y < result.top) + result.top = long(outPos.y); + + outPos.x += XMVectorGetX(textFont->MeasureString(strBuffer)) * scale; + + if (result.right < outPos.x) + result.right = long(outPos.x); + + if (result.bottom < outPos.y) + result.bottom = long(outPos.y); + + memset(strBuffer, 0, sizeof(strBuffer)); + j = 0; + } + outPos.x = position.x; + outPos.y += textFont->GetLineSpacing() * scale; + break; + + default: + strBuffer[j++] = text[ch]; + break; + } + } + } + + if (*strBuffer) + { + if (outPos.x < result.left) + result.left = long(outPos.x); + + if (outPos.y < result.top) + result.top = long(outPos.y); + + outPos.x += XMVectorGetX(textFont->MeasureString(strBuffer)) * scale; + + if (result.right < outPos.x) + result.right = long(outPos.x); + + if (result.bottom < outPos.y) + result.bottom = long(outPos.y); + } + + if (result.left == LONG_MAX) + { + result.left = 0; + result.top = 0; + } + + return result; + } } \ No newline at end of file diff --git a/Kits/ATGTK/TextConsole.cpp b/Kits/ATGTK/TextConsole.cpp index a07887c801a99db72657dcdf5e438e6c2457446f..6f4065f14892ae294490074a9420df04879aaa62 100644 --- a/Kits/ATGTK/TextConsole.cpp +++ b/Kits/ATGTK/TextConsole.cpp @@ -160,8 +160,8 @@ void TextConsole::SetWindow(const RECT& layout) float lineSpacing = m_font->GetLineSpacing(); unsigned int rows = std::max(1, static_cast(float(layout.bottom - layout.top) / lineSpacing)); - auto charSize = m_font->MeasureString(L"M"); - unsigned int columns = std::max(1, static_cast(float(layout.right - layout.left) / XMVectorGetX(charSize))); + RECT fontLayout = m_font->MeasureDrawBounds(L"X", XMFLOAT2(0,0)); + unsigned int columns = std::max(1, static_cast(float(layout.right - layout.left) / float(fontLayout.right - fontLayout.left))); std::unique_ptr buffer(new wchar_t[(columns + 1) * rows]); memset(buffer.get(), 0, sizeof(wchar_t) * (columns + 1) * rows); diff --git a/Kits/DirectXTK/DirectXTK_Windows10.vcxproj b/Kits/DirectXTK/DirectXTK_Windows10.vcxproj index 647af28a8766fb85c285c054bf820e7e7fe370e6..c5dce115aa28ff0000ec7c96c1ad82b0d7a2a2ec 100644 --- a/Kits/DirectXTK/DirectXTK_Windows10.vcxproj +++ b/Kits/DirectXTK/DirectXTK_Windows10.vcxproj @@ -55,9 +55,13 @@ + + + + @@ -151,7 +155,6 @@ - @@ -176,6 +179,7 @@ + diff --git a/Kits/DirectXTK/DirectXTK_Windows10.vcxproj.filters b/Kits/DirectXTK/DirectXTK_Windows10.vcxproj.filters index 1c3428d2ba10cb82a1556c90b7b9170f516e27c3..d4f24f293b66b2decf81d7482645ea14ae4150a0 100644 --- a/Kits/DirectXTK/DirectXTK_Windows10.vcxproj.filters +++ b/Kits/DirectXTK/DirectXTK_Windows10.vcxproj.filters @@ -16,6 +16,15 @@ {fe608244-a8ad-4cca-b766-e82f3d32405b} + + {68d47991-3b63-4a17-a705-680374a426f2} + + + {b5728d91-918a-4481-8e6f-8e793da9ee2c} + + + {020af8ad-d3a0-41bc-bc05-b1d0a5d2a85f} + @@ -42,9 +51,6 @@ Inc - - Inc - Inc @@ -57,36 +63,15 @@ Inc - - Src - - - Src - - - Src - Src - - Src - - - Src - Src Src - - Src - - - Src - Audio @@ -99,38 +84,59 @@ Audio - + Inc + + Inc\Shared + - Inc + Inc\Shared - Inc + Inc\Shared - - Inc + + Inc\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared - - Inc - - - Src - - - Src\Shaders - Src\Shaders - - Src\Shaders - - - Src\Shaders - Src\Shaders @@ -419,8 +425,20 @@ Src\Shaders\Compiled + + Inc\Shared + - Src + Src\Shared + + + Src\Shaders\Shared + + + Src\Shaders\Shared + + + Src\Shaders\Shared @@ -430,9 +448,6 @@ Src - - Src - Src @@ -481,9 +496,6 @@ Src - - Src - Src @@ -523,17 +535,26 @@ Audio - + Src + + Src\Shared + + + Src\Shared + - Src + Src\Shared - Src + Src\Shared - - Src + + Src\Shared + + + Src\Shared diff --git a/Kits/DirectXTK/Inc/GamePad.h b/Kits/DirectXTK/Inc/GamePad.h index 87a5fa554924b2cf3c86d4bcae5c86140a3262e4..88d87922d85094a188d2eb9304144f5c011ef965 100644 --- a/Kits/DirectXTK/Inc/GamePad.h +++ b/Kits/DirectXTK/Inc/GamePad.h @@ -66,8 +66,16 @@ namespace DirectX bool rightStick; bool leftShoulder; bool rightShoulder; - bool back; - bool start; + union + { + bool back; + bool view; + }; + union + { + bool start; + bool menu; + }; }; struct DPad @@ -116,9 +124,9 @@ namespace DirectX bool __cdecl IsRightShoulderPressed() const { return buttons.rightShoulder; } bool __cdecl IsBackPressed() const { return buttons.back; } - bool __cdecl IsViewPressed() const { return buttons.back; } + bool __cdecl IsViewPressed() const { return buttons.view; } bool __cdecl IsStartPressed() const { return buttons.start; } - bool __cdecl IsMenuPressed() const { return buttons.start; } + bool __cdecl IsMenuPressed() const { return buttons.menu; } bool __cdecl IsDPadDownPressed() const { return dpad.down; }; bool __cdecl IsDPadUpPressed() const { return dpad.up; }; @@ -202,12 +210,27 @@ namespace DirectX ButtonState dpadLeft; ButtonState dpadRight; + ButtonState leftStickUp; + ButtonState leftStickDown; + ButtonState leftStickLeft; + ButtonState leftStickRight; + + ButtonState rightStickUp; + ButtonState rightStickDown; + ButtonState rightStickLeft; + ButtonState rightStickRight; + + ButtonState leftTrigger; + ButtonState rightTrigger; + ButtonStateTracker() { Reset(); } void __cdecl Update( const State& state ); void __cdecl Reset(); + State __cdecl GetLastState() const { return lastState; } + private: State lastState; }; diff --git a/Kits/DirectXTK/Inc/Keyboard.h b/Kits/DirectXTK/Inc/Keyboard.h index 2975d71a51c69d6bebf680756752c6ab7e20ef9c..d224f67d950b4b82625830000ddab56bdab05fa1 100644 --- a/Kits/DirectXTK/Inc/Keyboard.h +++ b/Kits/DirectXTK/Inc/Keyboard.h @@ -440,6 +440,8 @@ namespace DirectX bool __cdecl IsKeyPressed(Keys key) const { return pressed.IsKeyDown(key); } bool __cdecl IsKeyReleased(Keys key) const { return released.IsKeyDown(key); } + State __cdecl GetLastState() const { return lastState; } + public: State lastState; }; diff --git a/Kits/DirectXTK/Inc/Mouse.h b/Kits/DirectXTK/Inc/Mouse.h index af081db47ee730730a7757cab239c54b5f7cf7a4..6e04e3f56c2bfc546431e3d7c3eb78237d65cccb 100644 --- a/Kits/DirectXTK/Inc/Mouse.h +++ b/Kits/DirectXTK/Inc/Mouse.h @@ -76,6 +76,8 @@ namespace DirectX void __cdecl Reset(); + State __cdecl GetLastState() const { return lastState; } + private: State lastState; }; diff --git a/Kits/DirectXTK/Inc/PrimitiveBatch.h b/Kits/DirectXTK/Inc/PrimitiveBatch.h index 4632aefae6dfbfcb89a35d293d71264562a304d7..17dd451eb7e7de87c691b7351a54e8539bed1656 100644 --- a/Kits/DirectXTK/Inc/PrimitiveBatch.h +++ b/Kits/DirectXTK/Inc/PrimitiveBatch.h @@ -19,8 +19,8 @@ #include #endif -#include #include +#include #include @@ -74,7 +74,7 @@ namespace DirectX : PrimitiveBatchBase(std::move(moveFrom)) { } - PrimitiveBatch& __cdecl operator= (PrimitiveBatch&& moveFrom) + PrimitiveBatch& operator= (PrimitiveBatch&& moveFrom) { PrimitiveBatchBase::operator=(std::move(moveFrom)); return *this; @@ -82,7 +82,7 @@ namespace DirectX // Similar to the D3D9 API DrawPrimitiveUP. - void __cdecl Draw(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) + void Draw(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) { void* mappedVertices; @@ -93,7 +93,7 @@ namespace DirectX // Similar to the D3D9 API DrawIndexedPrimitiveUP. - void __cdecl DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) + void DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) { void* mappedVertices; @@ -103,7 +103,7 @@ namespace DirectX } - void __cdecl DrawLine(TVertex const& v1, TVertex const& v2) + void DrawLine(TVertex const& v1, TVertex const& v2) { TVertex* mappedVertices; @@ -114,7 +114,7 @@ namespace DirectX } - void __cdecl DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3) + void DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3) { TVertex* mappedVertices; @@ -126,7 +126,7 @@ namespace DirectX } - void __cdecl DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4) + void DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4) { static const uint16_t quadIndices[] = { 0, 1, 2, 0, 2, 3 }; diff --git a/Kits/DirectXTK/Inc/ScreenGrab.h b/Kits/DirectXTK/Inc/ScreenGrab.h index d4058e5434efb4bbbfbb5ed604ecdb02fa0a2bd4..d530b9e1833dadca07d0e52fa078f70ff15e0601 100644 --- a/Kits/DirectXTK/Inc/ScreenGrab.h +++ b/Kits/DirectXTK/Inc/ScreenGrab.h @@ -38,13 +38,13 @@ namespace DirectX HRESULT __cdecl SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, - _In_z_ LPCWSTR fileName); + _In_z_ const wchar_t* fileName); HRESULT __cdecl SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, _In_ REFGUID guidContainerFormat, - _In_z_ LPCWSTR fileName, + _In_z_ const wchar_t* fileName, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function setCustomProps = nullptr); } \ No newline at end of file diff --git a/Kits/DirectXTK/Inc/SimpleMath.h b/Kits/DirectXTK/Inc/SimpleMath.h index 73a019dd859e2c9f73138403126b9e7376fbb8d5..55a0e00f36410f3680065c2cc6439c4b85485333 100644 --- a/Kits/DirectXTK/Inc/SimpleMath.h +++ b/Kits/DirectXTK/Inc/SimpleMath.h @@ -13,13 +13,16 @@ #pragma once -#if defined(_XBOX_ONE) && defined(_TITLE) -#include -#else -#include +#if !defined(__d3d11_h__) && !defined(__d3d11_x_h__) && !defined(__d3d12_h__) && !defined(__d3d12_x_h__) +#error include d3d11.h or d3d12.h before including SimpleMath.h +#endif + +#if !defined(_XBOX_ONE) || !defined(_TITLE) +#include #endif #include +#include #include #include @@ -825,14 +828,30 @@ public: width(float(rct.right - rct.left)), height(float(rct.bottom - rct.top)), minDepth(0.f), maxDepth(1.f) {} + +#if defined(__d3d11_h__) || defined(__d3d11_x_h__) + // Direct3D 11 interop explicit Viewport(const D3D11_VIEWPORT& vp) : x(vp.TopLeftX), y(vp.TopLeftY), width(vp.Width), height(vp.Height), minDepth(vp.MinDepth), maxDepth(vp.MaxDepth) {} - // Direct3D 11 interop operator D3D11_VIEWPORT() { return *reinterpret_cast(this); } const D3D11_VIEWPORT* Get11() const { return reinterpret_cast(this); } + Viewport& operator= (const D3D11_VIEWPORT& vp); +#endif + +#if defined(__d3d12_h__) || defined(__d3d12_x_h__) + // Direct3D 12 interop + explicit Viewport(const D3D12_VIEWPORT& vp) : + x(vp.TopLeftX), y(vp.TopLeftY), + width(vp.Width), height(vp.Height), + minDepth(vp.MinDepth), maxDepth(vp.MaxDepth) {} + + operator D3D12_VIEWPORT() { return *reinterpret_cast(this); } + const D3D12_VIEWPORT* Get12() const { return reinterpret_cast(this); } + Viewport& operator= (const D3D12_VIEWPORT& vp); +#endif // Comparison operators bool operator == ( const Viewport& vp ) const; @@ -841,7 +860,6 @@ public: // Assignment operators Viewport& operator= (const Viewport& vp); Viewport& operator= (const RECT& rct); - Viewport& operator= (const D3D11_VIEWPORT& vp); // Viewport operations float AspectRatio() const; diff --git a/Kits/DirectXTK/Inc/SimpleMath.inl b/Kits/DirectXTK/Inc/SimpleMath.inl index f8caace879d3f52a2f758e040e2d875ea6f9fb38..1be0a5fc76c1b727408945b0c7bd4d44925bc602 100644 --- a/Kits/DirectXTK/Inc/SimpleMath.inl +++ b/Kits/DirectXTK/Inc/SimpleMath.inl @@ -3633,6 +3633,7 @@ inline Viewport& Viewport::operator= (const RECT& rct) return *this; } +#if defined(__d3d11_h__) || defined(__d3d11_x_h__) inline Viewport& Viewport::operator= (const D3D11_VIEWPORT& vp) { x = vp.TopLeftX; y = vp.TopLeftY; @@ -3640,6 +3641,17 @@ inline Viewport& Viewport::operator= (const D3D11_VIEWPORT& vp) minDepth = vp.MinDepth; maxDepth = vp.MaxDepth; return *this; } +#endif + +#if defined(__d3d12_h__) || defined(__d3d12_x_h__) +inline Viewport& Viewport::operator= (const D3D12_VIEWPORT& vp) +{ + x = vp.TopLeftX; y = vp.TopLeftY; + width = vp.Width; height = vp.Height; + minDepth = vp.MinDepth; maxDepth = vp.MaxDepth; + return *this; +} +#endif //------------------------------------------------------------------------------ // Viewport operations diff --git a/Kits/DirectXTK/Inc/SpriteFont.h b/Kits/DirectXTK/Inc/SpriteFont.h index a3a0f969cc001d209c1f0ab19b994225ed4eca2b..cdca6e537a617acfef53efbd63b28222852835f8 100644 --- a/Kits/DirectXTK/Inc/SpriteFont.h +++ b/Kits/DirectXTK/Inc/SpriteFont.h @@ -42,6 +42,9 @@ namespace DirectX XMVECTOR XM_CALLCONV MeasureString(_In_z_ wchar_t const* text) const; + RECT __cdecl MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& position) const; + RECT XM_CALLCONV MeasureDrawBounds(_In_z_ wchar_t const* text, FXMVECTOR position) const; + // Spacing properties float __cdecl GetLineSpacing() const; void __cdecl SetLineSpacing(float spacing); @@ -54,7 +57,7 @@ namespace DirectX // Custom layout/rendering Glyph const* __cdecl FindGlyph(wchar_t character) const; - void GetSpriteSheet( ID3D11ShaderResourceView** texture ) const; + void __cdecl GetSpriteSheet( ID3D11ShaderResourceView** texture ) const; // Describes a single character glyph. struct Glyph diff --git a/Kits/DirectXTK/Readme.txt b/Kits/DirectXTK/Readme.txt index bbf8bc2cc6c9a407f2938ce3c023a719dd1cf6c5..9f81dde4d3a8414ab505ae762136e1595eb2961f 100644 --- a/Kits/DirectXTK/Readme.txt +++ b/Kits/DirectXTK/Readme.txt @@ -1,10 +1,10 @@ --------------------------------- -DirectXTK - the DirectX Tool Kit --------------------------------- +----------------------------------------------- +DirectXTK - the DirectX Tool Kit for DirectX 11 +----------------------------------------------- Copyright (c) Microsoft Corporation. All rights reserved. -May 31, 2016 +June 30, 2016 This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 11 C++ code for Universal Windows Platform (UWP) apps for Windows 10, @@ -13,7 +13,7 @@ Windows 8.x Win32 desktop applications, Windows 7 applications, and Windows Vista Direct3D 11.0 applications. This code is designed to build with Visual Studio 2013 or 2015. It is recommended that you -make use of VS 2013 Update 5, VS 2015 Update 2, and Windows 7 Service Pack 1 or later. +make use of VS 2013 Update 5 or VS 2015 Update 3 and Windows 7 Service Pack 1 or later. These components are designed to work without requiring any content from the DirectX SDK. For details, see "Where is the DirectX SDK?" . @@ -69,11 +69,24 @@ Note: Xbox One exclusive apps developers using the Xbox One XDK need to generate FXC compiler from the Xbox One XDK. While they will continue to work if outdated, a mismatch will cause runtime compilation overhead that would otherwise be avoided. +This project has adopted the Microsoft Open Source Code of Conduct. For more information see the +Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. + +https://opensource.microsoft.com/codeofconduct/ + --------------- RELEASE HISTORY --------------- +June 30, 2016 + MesaureDrawString added to SpriteFont; bad fix to MeasureString reverted + GamePad tracker updated to track emulated buttons (i.e. leftStickUp) + EffectFactory SetDirectory now checks current working directory (CWD) as well + *breaking change* must include before including + Code refactor for sharing some files with DirectX 12 version + Minor code cleanup + May 31, 2016 Added VertexPosition and VertexPositionDualTexture to VertexTypes Xbox One platform fix for PrimitiveBatch diff --git a/Kits/DirectXTK/Src/DDSTextureLoader.cpp b/Kits/DirectXTK/Src/DDSTextureLoader.cpp index 9acdd58692066eb70c713292d405dc87150682a0..5e4d003e8c3026dcae53a4df31e6f66e00f7448b 100644 --- a/Kits/DirectXTK/Src/DDSTextureLoader.cpp +++ b/Kits/DirectXTK/Src/DDSTextureLoader.cpp @@ -25,707 +25,18 @@ #include "dds.h" #include "DirectXHelpers.h" #include "PlatformHelpers.h" +#include "LoaderHelpers.h" using namespace DirectX; +static_assert(DDS_DIMENSION_TEXTURE1D == D3D11_RESOURCE_DIMENSION_TEXTURE1D, "dds mismatch"); +static_assert(DDS_DIMENSION_TEXTURE2D == D3D11_RESOURCE_DIMENSION_TEXTURE2D, "dds mismatch"); +static_assert(DDS_DIMENSION_TEXTURE3D == D3D11_RESOURCE_DIMENSION_TEXTURE3D, "dds mismatch"); +static_assert(DDS_RESOURCE_MISC_TEXTURECUBE == D3D11_RESOURCE_MISC_TEXTURECUBE, "dds mismatch"); + namespace { //-------------------------------------------------------------------------------------- - HRESULT LoadTextureDataFromFile(_In_z_ const wchar_t* fileName, - std::unique_ptr& ddsData, - DDS_HEADER** header, - uint8_t** bitData, - size_t* bitSize - ) - { - if (!header || !bitData || !bitSize) - { - return E_POINTER; - } - - // open the file -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - ScopedHandle hFile(safe_handle(CreateFile2(fileName, - GENERIC_READ, - FILE_SHARE_READ, - OPEN_EXISTING, - nullptr))); -#else - ScopedHandle hFile(safe_handle(CreateFileW(fileName, - GENERIC_READ, - FILE_SHARE_READ, - nullptr, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - nullptr))); -#endif - - if (!hFile) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - - // Get the file size - FILE_STANDARD_INFO fileInfo; - if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo))) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - - // File is too big for 32-bit allocation, so reject read - if (fileInfo.EndOfFile.HighPart > 0) - { - return E_FAIL; - } - - // Need at least enough data to fill the header and magic number to be a valid DDS - if (fileInfo.EndOfFile.LowPart < (sizeof(DDS_HEADER) + sizeof(uint32_t))) - { - return E_FAIL; - } - - // create enough space for the file data - ddsData.reset(new (std::nothrow) uint8_t[ fileInfo.EndOfFile.LowPart ]); - if (!ddsData) - { - return E_OUTOFMEMORY; - } - - // read the data in - DWORD BytesRead = 0; - if (!ReadFile(hFile.get(), - ddsData.get(), - fileInfo.EndOfFile.LowPart, - &BytesRead, - nullptr - )) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - - if (BytesRead < fileInfo.EndOfFile.LowPart) - { - return E_FAIL; - } - - // DDS files always start with the same magic number ("DDS ") - uint32_t dwMagicNumber = *(const uint32_t*)(ddsData.get()); - if (dwMagicNumber != DDS_MAGIC) - { - return E_FAIL; - } - - auto hdr = reinterpret_cast(ddsData.get() + sizeof(uint32_t)); - - // Verify header to validate DDS file - if (hdr->size != sizeof(DDS_HEADER) || - hdr->ddspf.size != sizeof(DDS_PIXELFORMAT)) - { - return E_FAIL; - } - - // Check for DX10 extension - bool bDXT10Header = false; - if ((hdr->ddspf.flags & DDS_FOURCC) && - (MAKEFOURCC('D', 'X', '1', '0') == hdr->ddspf.fourCC)) - { - // Must be long enough for both headers and magic value - if (fileInfo.EndOfFile.LowPart < (sizeof(DDS_HEADER) + sizeof(uint32_t) + sizeof(DDS_HEADER_DXT10))) - { - return E_FAIL; - } - - bDXT10Header = true; - } - - // setup the pointers in the process request - *header = hdr; - ptrdiff_t offset = sizeof(uint32_t) + sizeof(DDS_HEADER) - + (bDXT10Header ? sizeof(DDS_HEADER_DXT10) : 0); - *bitData = ddsData.get() + offset; - *bitSize = fileInfo.EndOfFile.LowPart - offset; - - return S_OK; - } - - //-------------------------------------------------------------------------------------- - // Return the BPP for a particular format - //-------------------------------------------------------------------------------------- - size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) - { - switch (fmt) - { - case DXGI_FORMAT_R32G32B32A32_TYPELESS: - case DXGI_FORMAT_R32G32B32A32_FLOAT: - case DXGI_FORMAT_R32G32B32A32_UINT: - case DXGI_FORMAT_R32G32B32A32_SINT: - return 128; - - case DXGI_FORMAT_R32G32B32_TYPELESS: - case DXGI_FORMAT_R32G32B32_FLOAT: - case DXGI_FORMAT_R32G32B32_UINT: - case DXGI_FORMAT_R32G32B32_SINT: - return 96; - - case DXGI_FORMAT_R16G16B16A16_TYPELESS: - case DXGI_FORMAT_R16G16B16A16_FLOAT: - case DXGI_FORMAT_R16G16B16A16_UNORM: - case DXGI_FORMAT_R16G16B16A16_UINT: - case DXGI_FORMAT_R16G16B16A16_SNORM: - case DXGI_FORMAT_R16G16B16A16_SINT: - case DXGI_FORMAT_R32G32_TYPELESS: - case DXGI_FORMAT_R32G32_FLOAT: - case DXGI_FORMAT_R32G32_UINT: - case DXGI_FORMAT_R32G32_SINT: - case DXGI_FORMAT_R32G8X24_TYPELESS: - case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: - case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: - case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: - case DXGI_FORMAT_Y416: - case DXGI_FORMAT_Y210: - case DXGI_FORMAT_Y216: - return 64; - - case DXGI_FORMAT_R10G10B10A2_TYPELESS: - case DXGI_FORMAT_R10G10B10A2_UNORM: - case DXGI_FORMAT_R10G10B10A2_UINT: - case DXGI_FORMAT_R11G11B10_FLOAT: - case DXGI_FORMAT_R8G8B8A8_TYPELESS: - case DXGI_FORMAT_R8G8B8A8_UNORM: - case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: - case DXGI_FORMAT_R8G8B8A8_UINT: - case DXGI_FORMAT_R8G8B8A8_SNORM: - case DXGI_FORMAT_R8G8B8A8_SINT: - case DXGI_FORMAT_R16G16_TYPELESS: - case DXGI_FORMAT_R16G16_FLOAT: - case DXGI_FORMAT_R16G16_UNORM: - case DXGI_FORMAT_R16G16_UINT: - case DXGI_FORMAT_R16G16_SNORM: - case DXGI_FORMAT_R16G16_SINT: - case DXGI_FORMAT_R32_TYPELESS: - case DXGI_FORMAT_D32_FLOAT: - case DXGI_FORMAT_R32_FLOAT: - case DXGI_FORMAT_R32_UINT: - case DXGI_FORMAT_R32_SINT: - case DXGI_FORMAT_R24G8_TYPELESS: - case DXGI_FORMAT_D24_UNORM_S8_UINT: - case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: - case DXGI_FORMAT_X24_TYPELESS_G8_UINT: - case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: - case DXGI_FORMAT_R8G8_B8G8_UNORM: - case DXGI_FORMAT_G8R8_G8B8_UNORM: - case DXGI_FORMAT_B8G8R8A8_UNORM: - case DXGI_FORMAT_B8G8R8X8_UNORM: - case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: - case DXGI_FORMAT_B8G8R8A8_TYPELESS: - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - case DXGI_FORMAT_B8G8R8X8_TYPELESS: - case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: - case DXGI_FORMAT_AYUV: - case DXGI_FORMAT_Y410: - case DXGI_FORMAT_YUY2: - return 32; - - case DXGI_FORMAT_P010: - case DXGI_FORMAT_P016: - return 24; - - case DXGI_FORMAT_R8G8_TYPELESS: - case DXGI_FORMAT_R8G8_UNORM: - case DXGI_FORMAT_R8G8_UINT: - case DXGI_FORMAT_R8G8_SNORM: - case DXGI_FORMAT_R8G8_SINT: - case DXGI_FORMAT_R16_TYPELESS: - case DXGI_FORMAT_R16_FLOAT: - case DXGI_FORMAT_D16_UNORM: - case DXGI_FORMAT_R16_UNORM: - case DXGI_FORMAT_R16_UINT: - case DXGI_FORMAT_R16_SNORM: - case DXGI_FORMAT_R16_SINT: - case DXGI_FORMAT_B5G6R5_UNORM: - case DXGI_FORMAT_B5G5R5A1_UNORM: - case DXGI_FORMAT_A8P8: - case DXGI_FORMAT_B4G4R4A4_UNORM: - return 16; - - case DXGI_FORMAT_NV12: - case DXGI_FORMAT_420_OPAQUE: - case DXGI_FORMAT_NV11: - return 12; - - case DXGI_FORMAT_R8_TYPELESS: - case DXGI_FORMAT_R8_UNORM: - case DXGI_FORMAT_R8_UINT: - case DXGI_FORMAT_R8_SNORM: - case DXGI_FORMAT_R8_SINT: - case DXGI_FORMAT_A8_UNORM: - case DXGI_FORMAT_AI44: - case DXGI_FORMAT_IA44: - case DXGI_FORMAT_P8: - return 8; - - case DXGI_FORMAT_R1_UNORM: - return 1; - - case DXGI_FORMAT_BC1_TYPELESS: - case DXGI_FORMAT_BC1_UNORM: - case DXGI_FORMAT_BC1_UNORM_SRGB: - case DXGI_FORMAT_BC4_TYPELESS: - case DXGI_FORMAT_BC4_UNORM: - case DXGI_FORMAT_BC4_SNORM: - return 4; - - case DXGI_FORMAT_BC2_TYPELESS: - case DXGI_FORMAT_BC2_UNORM: - case DXGI_FORMAT_BC2_UNORM_SRGB: - case DXGI_FORMAT_BC3_TYPELESS: - case DXGI_FORMAT_BC3_UNORM: - case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC5_TYPELESS: - case DXGI_FORMAT_BC5_UNORM: - case DXGI_FORMAT_BC5_SNORM: - case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC6H_UF16: - case DXGI_FORMAT_BC6H_SF16: - case DXGI_FORMAT_BC7_TYPELESS: - case DXGI_FORMAT_BC7_UNORM: - case DXGI_FORMAT_BC7_UNORM_SRGB: - return 8; - -#if defined(_XBOX_ONE) && defined(_TITLE) - - case DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT: - case DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT: - case DXGI_FORMAT_R10G10B10_SNORM_A2_UNORM: - return 32; - - case DXGI_FORMAT_D16_UNORM_S8_UINT: - case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: - case DXGI_FORMAT_X16_TYPELESS_G8_UINT: - return 24; - - case DXGI_FORMAT_R4G4_UNORM: - return 8; - -#endif // _XBOX_ONE && _TITLE - - default: - return 0; - } - } - - //-------------------------------------------------------------------------------------- - // Get surface information for a particular format - //-------------------------------------------------------------------------------------- - void GetSurfaceInfo(_In_ size_t width, - _In_ size_t height, - _In_ DXGI_FORMAT fmt, - _Out_opt_ size_t* outNumBytes, - _Out_opt_ size_t* outRowBytes, - _Out_opt_ size_t* outNumRows) - { - size_t numBytes = 0; - size_t rowBytes = 0; - size_t numRows = 0; - - bool bc = false; - bool packed = false; - bool planar = false; - size_t bpe = 0; - switch (fmt) - { - case DXGI_FORMAT_BC1_TYPELESS: - case DXGI_FORMAT_BC1_UNORM: - case DXGI_FORMAT_BC1_UNORM_SRGB: - case DXGI_FORMAT_BC4_TYPELESS: - case DXGI_FORMAT_BC4_UNORM: - case DXGI_FORMAT_BC4_SNORM: - bc = true; - bpe = 8; - break; - - case DXGI_FORMAT_BC2_TYPELESS: - case DXGI_FORMAT_BC2_UNORM: - case DXGI_FORMAT_BC2_UNORM_SRGB: - case DXGI_FORMAT_BC3_TYPELESS: - case DXGI_FORMAT_BC3_UNORM: - case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC5_TYPELESS: - case DXGI_FORMAT_BC5_UNORM: - case DXGI_FORMAT_BC5_SNORM: - case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC6H_UF16: - case DXGI_FORMAT_BC6H_SF16: - case DXGI_FORMAT_BC7_TYPELESS: - case DXGI_FORMAT_BC7_UNORM: - case DXGI_FORMAT_BC7_UNORM_SRGB: - bc = true; - bpe = 16; - break; - - case DXGI_FORMAT_R8G8_B8G8_UNORM: - case DXGI_FORMAT_G8R8_G8B8_UNORM: - case DXGI_FORMAT_YUY2: - packed = true; - bpe = 4; - break; - - case DXGI_FORMAT_Y210: - case DXGI_FORMAT_Y216: - packed = true; - bpe = 8; - break; - - case DXGI_FORMAT_NV12: - case DXGI_FORMAT_420_OPAQUE: - planar = true; - bpe = 2; - break; - - case DXGI_FORMAT_P010: - case DXGI_FORMAT_P016: - planar = true; - bpe = 4; - break; - -#if defined(_XBOX_ONE) && defined(_TITLE) - - case DXGI_FORMAT_D16_UNORM_S8_UINT: - case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: - case DXGI_FORMAT_X16_TYPELESS_G8_UINT: - planar = true; - bpe = 4; - break; - -#endif - } - - if (bc) - { - size_t numBlocksWide = 0; - if (width > 0) - { - numBlocksWide = std::max(1, (width + 3) / 4); - } - size_t numBlocksHigh = 0; - if (height > 0) - { - numBlocksHigh = std::max(1, (height + 3) / 4); - } - rowBytes = numBlocksWide * bpe; - numRows = numBlocksHigh; - numBytes = rowBytes * numBlocksHigh; - } - else if (packed) - { - rowBytes = ((width + 1) >> 1) * bpe; - numRows = height; - numBytes = rowBytes * height; - } - else if (fmt == DXGI_FORMAT_NV11) - { - rowBytes = ((width + 3) >> 2) * 4; - numRows = height * 2; // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data - numBytes = rowBytes * numRows; - } - else if (planar) - { - rowBytes = ((width + 1) >> 1) * bpe; - numBytes = (rowBytes * height) + ((rowBytes * height + 1) >> 1); - numRows = height + ((height + 1) >> 1); - } - else - { - size_t bpp = BitsPerPixel(fmt); - rowBytes = (width * bpp + 7) / 8; // round up to nearest byte - numRows = height; - numBytes = rowBytes * height; - } - - if (outNumBytes) - { - *outNumBytes = numBytes; - } - if (outRowBytes) - { - *outRowBytes = rowBytes; - } - if (outNumRows) - { - *outNumRows = numRows; - } - } - - //-------------------------------------------------------------------------------------- - #define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a ) - - DXGI_FORMAT GetDXGIFormat(const DDS_PIXELFORMAT& ddpf) - { - if (ddpf.flags & DDS_RGB) - { - // Note that sRGB formats are written using the "DX10" extended header - - switch (ddpf.RGBBitCount) - { - case 32: - if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) - { - return DXGI_FORMAT_R8G8B8A8_UNORM; - } - - if (ISBITMASK(0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000)) - { - return DXGI_FORMAT_B8G8R8A8_UNORM; - } - - if (ISBITMASK(0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000)) - { - return DXGI_FORMAT_B8G8R8X8_UNORM; - } - - // No DXGI format maps to ISBITMASK(0x000000ff,0x0000ff00,0x00ff0000,0x00000000) aka D3DFMT_X8B8G8R8 - - // Note that many common DDS reader/writers (including D3DX) swap the - // the RED/BLUE masks for 10:10:10:2 formats. We assume - // below that the 'backwards' header mask is being used since it is most - // likely written by D3DX. The more robust solution is to use the 'DX10' - // header extension and specify the DXGI_FORMAT_R10G10B10A2_UNORM format directly - - // For 'correct' writers, this should be 0x000003ff,0x000ffc00,0x3ff00000 for RGB data - if (ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000)) - { - return DXGI_FORMAT_R10G10B10A2_UNORM; - } - - // No DXGI format maps to ISBITMASK(0x000003ff,0x000ffc00,0x3ff00000,0xc0000000) aka D3DFMT_A2R10G10B10 - - if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000)) - { - return DXGI_FORMAT_R16G16_UNORM; - } - - if (ISBITMASK(0xffffffff, 0x00000000, 0x00000000, 0x00000000)) - { - // Only 32-bit color channel format in D3D9 was R32F - return DXGI_FORMAT_R32_FLOAT; // D3DX writes this out as a FourCC of 114 - } - break; - - case 24: - // No 24bpp DXGI formats aka D3DFMT_R8G8B8 - break; - - case 16: - if (ISBITMASK(0x7c00, 0x03e0, 0x001f, 0x8000)) - { - return DXGI_FORMAT_B5G5R5A1_UNORM; - } - if (ISBITMASK(0xf800, 0x07e0, 0x001f, 0x0000)) - { - return DXGI_FORMAT_B5G6R5_UNORM; - } - - // No DXGI format maps to ISBITMASK(0x7c00,0x03e0,0x001f,0x0000) aka D3DFMT_X1R5G5B5 - - if (ISBITMASK(0x0f00, 0x00f0, 0x000f, 0xf000)) - { - return DXGI_FORMAT_B4G4R4A4_UNORM; - } - - // No DXGI format maps to ISBITMASK(0x0f00,0x00f0,0x000f,0x0000) aka D3DFMT_X4R4G4B4 - - // No 3:3:2, 3:3:2:8, or paletted DXGI formats aka D3DFMT_A8R3G3B2, D3DFMT_R3G3B2, D3DFMT_P8, D3DFMT_A8P8, etc. - break; - } - } - else if (ddpf.flags & DDS_LUMINANCE) - { - if (8 == ddpf.RGBBitCount) - { - if (ISBITMASK(0x000000ff, 0x00000000, 0x00000000, 0x00000000)) - { - return DXGI_FORMAT_R8_UNORM; // D3DX10/11 writes this out as DX10 extension - } - - // No DXGI format maps to ISBITMASK(0x0f,0x00,0x00,0xf0) aka D3DFMT_A4L4 - } - - if (16 == ddpf.RGBBitCount) - { - if (ISBITMASK(0x0000ffff, 0x00000000, 0x00000000, 0x00000000)) - { - return DXGI_FORMAT_R16_UNORM; // D3DX10/11 writes this out as DX10 extension - } - if (ISBITMASK(0x000000ff, 0x00000000, 0x00000000, 0x0000ff00)) - { - return DXGI_FORMAT_R8G8_UNORM; // D3DX10/11 writes this out as DX10 extension - } - } - } - else if (ddpf.flags & DDS_ALPHA) - { - if (8 == ddpf.RGBBitCount) - { - return DXGI_FORMAT_A8_UNORM; - } - } - else if (ddpf.flags & DDS_BUMPDUDV) - { - if (16 == ddpf.RGBBitCount) - { - if (ISBITMASK(0x00ff, 0xff00, 0x0000, 0x0000)) - { - return DXGI_FORMAT_R8G8_SNORM; // D3DX10/11 writes this out as DX10 extension - } - } - - if (32 == ddpf.RGBBitCount) - { - if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) - { - return DXGI_FORMAT_R8G8B8A8_SNORM; // D3DX10/11 writes this out as DX10 extension - } - if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000)) - { - return DXGI_FORMAT_R16G16_SNORM; // D3DX10/11 writes this out as DX10 extension - } - - // No DXGI format maps to ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000) aka D3DFMT_A2W10V10U10 - } - } - else if (ddpf.flags & DDS_FOURCC) - { - if (MAKEFOURCC('D', 'X', 'T', '1') == ddpf.fourCC) - { - return DXGI_FORMAT_BC1_UNORM; - } - if (MAKEFOURCC('D', 'X', 'T', '3') == ddpf.fourCC) - { - return DXGI_FORMAT_BC2_UNORM; - } - if (MAKEFOURCC('D', 'X', 'T', '5') == ddpf.fourCC) - { - return DXGI_FORMAT_BC3_UNORM; - } - - // While pre-multiplied alpha isn't directly supported by the DXGI formats, - // they are basically the same as these BC formats so they can be mapped - if (MAKEFOURCC('D', 'X', 'T', '2') == ddpf.fourCC) - { - return DXGI_FORMAT_BC2_UNORM; - } - if (MAKEFOURCC('D', 'X', 'T', '4') == ddpf.fourCC) - { - return DXGI_FORMAT_BC3_UNORM; - } - - if (MAKEFOURCC('A', 'T', 'I', '1') == ddpf.fourCC) - { - return DXGI_FORMAT_BC4_UNORM; - } - if (MAKEFOURCC('B', 'C', '4', 'U') == ddpf.fourCC) - { - return DXGI_FORMAT_BC4_UNORM; - } - if (MAKEFOURCC('B', 'C', '4', 'S') == ddpf.fourCC) - { - return DXGI_FORMAT_BC4_SNORM; - } - - if (MAKEFOURCC('A', 'T', 'I', '2') == ddpf.fourCC) - { - return DXGI_FORMAT_BC5_UNORM; - } - if (MAKEFOURCC('B', 'C', '5', 'U') == ddpf.fourCC) - { - return DXGI_FORMAT_BC5_UNORM; - } - if (MAKEFOURCC('B', 'C', '5', 'S') == ddpf.fourCC) - { - return DXGI_FORMAT_BC5_SNORM; - } - - // BC6H and BC7 are written using the "DX10" extended header - - if (MAKEFOURCC('R', 'G', 'B', 'G') == ddpf.fourCC) - { - return DXGI_FORMAT_R8G8_B8G8_UNORM; - } - if (MAKEFOURCC('G', 'R', 'G', 'B') == ddpf.fourCC) - { - return DXGI_FORMAT_G8R8_G8B8_UNORM; - } - - if (MAKEFOURCC('Y', 'U', 'Y', '2') == ddpf.fourCC) - { - return DXGI_FORMAT_YUY2; - } - - // Check for D3DFORMAT enums being set here - switch (ddpf.fourCC) - { - case 36: // D3DFMT_A16B16G16R16 - return DXGI_FORMAT_R16G16B16A16_UNORM; - - case 110: // D3DFMT_Q16W16V16U16 - return DXGI_FORMAT_R16G16B16A16_SNORM; - - case 111: // D3DFMT_R16F - return DXGI_FORMAT_R16_FLOAT; - - case 112: // D3DFMT_G16R16F - return DXGI_FORMAT_R16G16_FLOAT; - - case 113: // D3DFMT_A16B16G16R16F - return DXGI_FORMAT_R16G16B16A16_FLOAT; - - case 114: // D3DFMT_R32F - return DXGI_FORMAT_R32_FLOAT; - - case 115: // D3DFMT_G32R32F - return DXGI_FORMAT_R32G32_FLOAT; - - case 116: // D3DFMT_A32B32G32R32F - return DXGI_FORMAT_R32G32B32A32_FLOAT; - } - } - - return DXGI_FORMAT_UNKNOWN; - } - - //-------------------------------------------------------------------------------------- - DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) - { - switch (format) - { - case DXGI_FORMAT_R8G8B8A8_UNORM: - return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; - - case DXGI_FORMAT_BC1_UNORM: - return DXGI_FORMAT_BC1_UNORM_SRGB; - - case DXGI_FORMAT_BC2_UNORM: - return DXGI_FORMAT_BC2_UNORM_SRGB; - - case DXGI_FORMAT_BC3_UNORM: - return DXGI_FORMAT_BC3_UNORM_SRGB; - - case DXGI_FORMAT_B8G8R8A8_UNORM: - return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; - - case DXGI_FORMAT_B8G8R8X8_UNORM: - return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; - - case DXGI_FORMAT_BC7_UNORM: - return DXGI_FORMAT_BC7_UNORM_SRGB; - - default: - return format; - } - } - - //-------------------------------------------------------------------------------------- - template HRESULT FillInitData(_In_ size_t width, _In_ size_t height, _In_ size_t depth, @@ -739,7 +50,7 @@ namespace _Out_ size_t& theight, _Out_ size_t& tdepth, _Out_ size_t& skipMip, - _Out_writes_(mipCount*arraySize) SubresourceStructType* initData) + _Out_writes_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData) { if (!bitData || !initData) { @@ -1486,34 +797,6 @@ namespace return hr; } - - //-------------------------------------------------------------------------------------- - DDS_ALPHA_MODE GetAlphaMode(_In_ const DDS_HEADER* header) - { - if (header->ddspf.flags & DDS_FOURCC) - { - if (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC) - { - auto d3d10ext = reinterpret_cast((const char*)header + sizeof(DDS_HEADER)); - auto mode = static_cast(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK); - switch (mode) - { - case DDS_ALPHA_MODE_STRAIGHT: - case DDS_ALPHA_MODE_PREMULTIPLIED: - case DDS_ALPHA_MODE_OPAQUE: - case DDS_ALPHA_MODE_CUSTOM: - return mode; - } - } - else if ((MAKEFOURCC('D', 'X', 'T', '2') == header->ddspf.fourCC) - || (MAKEFOURCC('D', 'X', 'T', '4') == header->ddspf.fourCC)) - { - return DDS_ALPHA_MODE_PREMULTIPLIED; - } - } - - return DDS_ALPHA_MODE_UNKNOWN; - } } // anonymous namespace diff --git a/Kits/DirectXTK/Src/DGSLEffectFactory.cpp b/Kits/DirectXTK/Src/DGSLEffectFactory.cpp index 2991b7f97c2e1d8e1071159794fe43dc41c5455d..983b63f1f4d9ca5cede8efbc767dab9883afe9ff 100644 --- a/Kits/DirectXTK/Src/DGSLEffectFactory.cpp +++ b/Kits/DirectXTK/Src/DGSLEffectFactory.cpp @@ -351,6 +351,18 @@ void DGSLEffectFactory::Impl::CreateTexture( const wchar_t* name, ID3D11DeviceCo wcscpy_s( fullName, mPath ); wcscat_s( fullName, name ); + WIN32_FILE_ATTRIBUTE_DATA fileAttr = {}; + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + // Try Current Working Directory (CWD) + wcscpy_s( fullName, name ); + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + DebugTrace( "DGSLEffectFactory could not find texture file '%ls'\n", name ); + throw std::exception( "CreateTexture" ); + } + } + wchar_t ext[_MAX_EXT]; _wsplitpath_s( name, nullptr, 0, nullptr, 0, nullptr, 0, ext, _MAX_EXT ); @@ -414,6 +426,18 @@ void DGSLEffectFactory::Impl::CreatePixelShader( const wchar_t* name, ID3D11Pixe wcscpy_s( fullName, mPath ); wcscat_s( fullName, name ); + WIN32_FILE_ATTRIBUTE_DATA fileAttr = {}; + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + // Try Current Working Directory (CWD) + wcscpy_s( fullName, name ); + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + DebugTrace( "DGSLEffectFactory could not find shader file '%ls'\n", name ); + throw std::exception( "CreatePixelShader" ); + } + } + size_t dataSize = 0; std::unique_ptr data; HRESULT hr = BinaryReader::ReadEntireFile( fullName, data, &dataSize ); diff --git a/Kits/DirectXTK/Src/EffectFactory.cpp b/Kits/DirectXTK/Src/EffectFactory.cpp index 579285adb0de22c19082ede83a8d05f535a875d2..d6da13f9f898d75bfa68b9df94cd99e30ccfb074 100644 --- a/Kits/DirectXTK/Src/EffectFactory.cpp +++ b/Kits/DirectXTK/Src/EffectFactory.cpp @@ -265,6 +265,18 @@ void EffectFactory::Impl::CreateTexture( const wchar_t* name, ID3D11DeviceContex wcscpy_s( fullName, mPath ); wcscat_s( fullName, name ); + WIN32_FILE_ATTRIBUTE_DATA fileAttr = {}; + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + // Try Current Working Directory (CWD) + wcscpy_s( fullName, name ); + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + DebugTrace( "EffectFactory could not find texture file '%ls'\n", name ); + throw std::exception( "CreateTexture" ); + } + } + wchar_t ext[_MAX_EXT]; _wsplitpath_s( name, nullptr, 0, nullptr, 0, nullptr, 0, ext, _MAX_EXT ); diff --git a/Kits/DirectXTK/Src/GamePad.cpp b/Kits/DirectXTK/Src/GamePad.cpp index 75e1caf0b4d20d6821301c44c99623ebacfd0e99..5475f1d26e4724e06650295aa7fc43ad56fc0490 100644 --- a/Kits/DirectXTK/Src/GamePad.cpp +++ b/Kits/DirectXTK/Src/GamePad.cpp @@ -1195,6 +1195,38 @@ void GamePad::ButtonStateTracker::Update( const GamePad::State& state ) assert( ( !state.dpad.up && lastState.dpad.up ) == ( dpadUp == RELEASED ) ); assert( ( state.dpad.up && !lastState.dpad.up ) == ( dpadUp == PRESSED ) ); + // Handle 'threshold' tests which emulate buttons + + bool threshold = state.IsLeftThumbStickUp(); + leftStickUp = static_cast( ( !!threshold) | ( ( !!threshold ^ !!lastState.IsLeftThumbStickUp() ) << 1 ) ); + + threshold = state.IsLeftThumbStickDown(); + leftStickDown = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftThumbStickDown()) << 1)); + + threshold = state.IsLeftThumbStickLeft(); + leftStickLeft = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftThumbStickLeft()) << 1)); + + threshold = state.IsLeftThumbStickRight(); + leftStickRight = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftThumbStickRight()) << 1)); + + threshold = state.IsRightThumbStickUp(); + rightStickUp = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickUp()) << 1)); + + threshold = state.IsRightThumbStickDown(); + rightStickDown = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickDown()) << 1)); + + threshold = state.IsRightThumbStickLeft(); + rightStickLeft = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickLeft()) << 1)); + + threshold = state.IsRightThumbStickRight(); + rightStickRight = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickRight()) << 1)); + + threshold = state.IsLeftTriggerPressed(); + leftTrigger = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftTriggerPressed()) << 1)); + + threshold = state.IsRightTriggerPressed(); + rightTrigger = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightTriggerPressed()) << 1)); + lastState = state; } diff --git a/Kits/DirectXTK/Src/GeometricPrimitive.cpp b/Kits/DirectXTK/Src/GeometricPrimitive.cpp index 0b9a997664f4643e6c49f8df5c599f178f6f8ac8..df30dfe43e4a4cc9c68e0c05d0e8c8b782126a6c 100644 --- a/Kits/DirectXTK/Src/GeometricPrimitive.cpp +++ b/Kits/DirectXTK/Src/GeometricPrimitive.cpp @@ -16,11 +16,8 @@ #include "Effects.h" #include "CommonStates.h" #include "DirectXHelpers.h" -#include "VertexTypes.h" #include "SharedResourcePool.h" -#include "Bezier.h" - -#include +#include "Geometry.h" using namespace DirectX; using Microsoft::WRL::ComPtr; @@ -28,58 +25,6 @@ using Microsoft::WRL::ComPtr; namespace { - static const float SQRT2 = 1.41421356237309504880f; - static const float SQRT3 = 1.73205080756887729352f; - static const float SQRT6 = 2.44948974278317809820f; - - - void CheckIndexOverflow(size_t value) - { - // Use >=, not > comparison, because some D3D level 9_x hardware does not support 0xFFFF index values. - if (value >= USHRT_MAX) - throw std::exception("Index value out of range: cannot tesselate primitive so finely"); - } - - - // Collection types used when generating the geometry. - typedef std::vector VertexCollection; - typedef std::vector IndexCollection; - - inline void index_push_back(IndexCollection& indices, size_t value) - { - CheckIndexOverflow(value); - indices.push_back((uint16_t)value); - } - - - // Helper for flipping winding of geometric primitives for LH vs. RH coords - static void ReverseWinding( IndexCollection& indices, VertexCollection& vertices ) - { - assert( (indices.size() % 3) == 0 ); - for( auto it = indices.begin(); it != indices.end(); it += 3 ) - { - std::swap( *it, *(it+2) ); - } - - for( auto it = vertices.begin(); it != vertices.end(); ++it ) - { - it->textureCoordinate.x = ( 1.f - it->textureCoordinate.x ); - } - } - - - // Helper for inverting normals of geometric primitives for 'inside' vs. 'outside' viewing - static void InvertNormals( VertexCollection& vertices ) - { - for( auto it = vertices.begin(); it != vertices.end(); ++it ) - { - it->normal.x = -it->normal.x; - it->normal.y = -it->normal.y; - it->normal.z = -it->normal.z; - } - } - - // Helper for creating a D3D vertex or index buffer. template static void CreateBuffer(_In_ ID3D11Device* device, T const& data, D3D11_BIND_FLAG bindFlags, _Outptr_ ID3D11Buffer** pBuffer) @@ -107,7 +52,7 @@ namespace // Helper for creating a D3D input layout. - static void CreateInputLayout(_In_ ID3D11Device* device, IEffect* effect, _Outptr_ ID3D11InputLayout** pInputLayout) + void CreateInputLayout(_In_ ID3D11Device* device, IEffect* effect, _Outptr_ ID3D11InputLayout** pInputLayout) { assert( pInputLayout != 0 ); @@ -398,12 +343,21 @@ void GeometricPrimitive::CreateInputLayout(IEffect* effect, ID3D11InputLayout** // Creates a cube primitive. std::unique_ptr GeometricPrimitive::CreateCube(_In_ ID3D11DeviceContext* deviceContext, float size, bool rhcoords) { - return CreateBox(deviceContext, XMFLOAT3(size,size,size), rhcoords); + VertexCollection vertices; + IndexCollection indices; + ComputeBox(vertices, indices, XMFLOAT3(size, size, size), rhcoords, false); + + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + primitive->pImpl->Initialize(deviceContext, vertices, indices); + + return primitive; } void GeometricPrimitive::CreateCube(std::vector& vertices, std::vector& indices, float size, bool rhcoords) { - return CreateBox(vertices, indices, XMFLOAT3(size,size,size), rhcoords); + ComputeBox(vertices, indices, XMFLOAT3(size,size,size), rhcoords, false); } @@ -412,7 +366,7 @@ std::unique_ptr GeometricPrimitive::CreateBox(_In_ ID3D11Dev { VertexCollection vertices; IndexCollection indices; - CreateBox(vertices, indices, size, rhcoords, invertn); + ComputeBox(vertices, indices, size, rhcoords, invertn); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -424,67 +378,7 @@ std::unique_ptr GeometricPrimitive::CreateBox(_In_ ID3D11Dev void GeometricPrimitive::CreateBox(std::vector& vertices, std::vector& indices, const XMFLOAT3& size, bool rhcoords, bool invertn) { - vertices.clear(); - indices.clear(); - - // A box has six faces, each one pointing in a different direction. - const int FaceCount = 6; - - static const XMVECTORF32 faceNormals[FaceCount] = - { - { 0, 0, 1 }, - { 0, 0, -1 }, - { 1, 0, 0 }, - { -1, 0, 0 }, - { 0, 1, 0 }, - { 0, -1, 0 }, - }; - - static const XMVECTORF32 textureCoordinates[4] = - { - { 1, 0 }, - { 1, 1 }, - { 0, 1 }, - { 0, 0 }, - }; - - XMVECTOR tsize = XMLoadFloat3(&size); - tsize = XMVectorDivide(tsize, g_XMTwo); - - // Create each face in turn. - for (int i = 0; i < FaceCount; i++) - { - XMVECTOR normal = faceNormals[i]; - - // Get two vectors perpendicular both to the face normal and to each other. - XMVECTOR basis = (i >= 4) ? g_XMIdentityR2 : g_XMIdentityR1; - - XMVECTOR side1 = XMVector3Cross(normal, basis); - XMVECTOR side2 = XMVector3Cross(normal, side1); - - // Six indices (two triangles) per face. - size_t vbase = vertices.size(); - index_push_back(indices, vbase + 0); - index_push_back(indices, vbase + 1); - index_push_back(indices, vbase + 2); - - index_push_back(indices, vbase + 0); - index_push_back(indices, vbase + 2); - index_push_back(indices, vbase + 3); - - // Four vertices per face. - vertices.push_back(VertexPositionNormalTexture((normal - side1 - side2) * tsize, normal, textureCoordinates[0])); - vertices.push_back(VertexPositionNormalTexture((normal - side1 + side2) * tsize, normal, textureCoordinates[1])); - vertices.push_back(VertexPositionNormalTexture((normal + side1 + side2) * tsize, normal, textureCoordinates[2])); - vertices.push_back(VertexPositionNormalTexture((normal + side1 - side2) * tsize, normal, textureCoordinates[3])); - } - - // Build RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); - - if ( invertn ) - InvertNormals( vertices ); + ComputeBox(vertices, indices, size, rhcoords, invertn); } @@ -497,7 +391,7 @@ std::unique_ptr GeometricPrimitive::CreateSphere(_In_ ID3D11 { VertexCollection vertices; IndexCollection indices; - CreateSphere(vertices, indices, diameter, tessellation, rhcoords, invertn); + ComputeSphere(vertices, indices, diameter, tessellation, rhcoords, invertn); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -509,73 +403,7 @@ std::unique_ptr GeometricPrimitive::CreateSphere(_In_ ID3D11 void GeometricPrimitive::CreateSphere(std::vector& vertices, std::vector& indices, float diameter, size_t tessellation, bool rhcoords, bool invertn) { - vertices.clear(); - indices.clear(); - - if (tessellation < 3) - throw std::out_of_range("tesselation parameter out of range"); - - size_t verticalSegments = tessellation; - size_t horizontalSegments = tessellation * 2; - - float radius = diameter / 2; - - // Create rings of vertices at progressively higher latitudes. - for (size_t i = 0; i <= verticalSegments; i++) - { - float v = 1 - (float)i / verticalSegments; - - float latitude = (i * XM_PI / verticalSegments) - XM_PIDIV2; - float dy, dxz; - - XMScalarSinCos(&dy, &dxz, latitude); - - // Create a single ring of vertices at this latitude. - for (size_t j = 0; j <= horizontalSegments; j++) - { - float u = (float)j / horizontalSegments; - - float longitude = j * XM_2PI / horizontalSegments; - float dx, dz; - - XMScalarSinCos(&dx, &dz, longitude); - - dx *= dxz; - dz *= dxz; - - XMVECTOR normal = XMVectorSet(dx, dy, dz, 0); - XMVECTOR textureCoordinate = XMVectorSet(u, v, 0, 0); - - vertices.push_back(VertexPositionNormalTexture(normal * radius, normal, textureCoordinate)); - } - } - - // Fill the index buffer with triangles joining each pair of latitude rings. - size_t stride = horizontalSegments + 1; - - for (size_t i = 0; i < verticalSegments; i++) - { - for (size_t j = 0; j <= horizontalSegments; j++) - { - size_t nextI = i + 1; - size_t nextJ = (j + 1) % stride; - - index_push_back(indices, i * stride + j); - index_push_back(indices, nextI * stride + j); - index_push_back(indices, i * stride + nextJ); - - index_push_back(indices, i * stride + nextJ); - index_push_back(indices, nextI * stride + j); - index_push_back(indices, nextI * stride + nextJ); - } - } - - // Build RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); - - if ( invertn ) - InvertNormals( vertices ); + ComputeSphere(vertices, indices, diameter, tessellation, rhcoords, invertn); } @@ -588,7 +416,7 @@ std::unique_ptr GeometricPrimitive::CreateGeoSphere(_In_ ID3 { VertexCollection vertices; IndexCollection indices; - CreateGeoSphere(vertices, indices, diameter, tessellation, rhcoords); + ComputeGeoSphere(vertices, indices, diameter, tessellation, rhcoords); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -600,319 +428,7 @@ std::unique_ptr GeometricPrimitive::CreateGeoSphere(_In_ ID3 void GeometricPrimitive::CreateGeoSphere(std::vector& vertices, std::vector& indices, float diameter, size_t tessellation, bool rhcoords) { - vertices.clear(); - indices.clear(); - - // An undirected edge between two vertices, represented by a pair of indexes into a vertex array. - // Becuse this edge is undirected, (a,b) is the same as (b,a). - typedef std::pair UndirectedEdge; - - // Makes an undirected edge. Rather than overloading comparison operators to give us the (a,b)==(b,a) property, - // we'll just ensure that the larger of the two goes first. This'll simplify things greatly. - auto makeUndirectedEdge = [](uint16_t a, uint16_t b) - { - return std::make_pair(std::max(a, b), std::min(a, b)); - }; - - // Key: an edge - // Value: the index of the vertex which lies midway between the two vertices pointed to by the key value - // This map is used to avoid duplicating vertices when subdividing triangles along edges. - typedef std::map EdgeSubdivisionMap; - - - static const XMFLOAT3 OctahedronVertices[] = - { - // when looking down the negative z-axis (into the screen) - XMFLOAT3( 0, 1, 0), // 0 top - XMFLOAT3( 0, 0, -1), // 1 front - XMFLOAT3( 1, 0, 0), // 2 right - XMFLOAT3( 0, 0, 1), // 3 back - XMFLOAT3(-1, 0, 0), // 4 left - XMFLOAT3( 0, -1, 0), // 5 bottom - }; - static const uint16_t OctahedronIndices[] = - { - 0, 1, 2, // top front-right face - 0, 2, 3, // top back-right face - 0, 3, 4, // top back-left face - 0, 4, 1, // top front-left face - 5, 1, 4, // bottom front-left face - 5, 4, 3, // bottom back-left face - 5, 3, 2, // bottom back-right face - 5, 2, 1, // bottom front-right face - }; - - const float radius = diameter / 2.0f; - - // Start with an octahedron; copy the data into the vertex/index collection. - - std::vector vertexPositions(std::begin(OctahedronVertices), std::end(OctahedronVertices)); - - indices.insert(indices.begin(), std::begin(OctahedronIndices), std::end(OctahedronIndices)); - - // We know these values by looking at the above index list for the octahedron. Despite the subdivisions that are - // about to go on, these values aren't ever going to change because the vertices don't move around in the array. - // We'll need these values later on to fix the singularities that show up at the poles. - const uint16_t northPoleIndex = 0; - const uint16_t southPoleIndex = 5; - - for (size_t iSubdivision = 0; iSubdivision < tessellation; ++iSubdivision) - { - assert(indices.size() % 3 == 0); // sanity - - // We use this to keep track of which edges have already been subdivided. - EdgeSubdivisionMap subdividedEdges; - - // The new index collection after subdivision. - IndexCollection newIndices; - - const size_t triangleCount = indices.size() / 3; - for (size_t iTriangle = 0; iTriangle < triangleCount; ++iTriangle) - { - // For each edge on this triangle, create a new vertex in the middle of that edge. - // The winding order of the triangles we output are the same as the winding order of the inputs. - - // Indices of the vertices making up this triangle - uint16_t iv0 = indices[iTriangle*3+0]; - uint16_t iv1 = indices[iTriangle*3+1]; - uint16_t iv2 = indices[iTriangle*3+2]; - - // Get the new vertices - XMFLOAT3 v01; // vertex on the midpoint of v0 and v1 - XMFLOAT3 v12; // ditto v1 and v2 - XMFLOAT3 v20; // ditto v2 and v0 - uint16_t iv01; // index of v01 - uint16_t iv12; // index of v12 - uint16_t iv20; // index of v20 - - // Function that, when given the index of two vertices, creates a new vertex at the midpoint of those vertices. - auto divideEdge = [&](uint16_t i0, uint16_t i1, XMFLOAT3& outVertex, uint16_t& outIndex) - { - const UndirectedEdge edge = makeUndirectedEdge(i0, i1); - - // Check to see if we've already generated this vertex - auto it = subdividedEdges.find(edge); - if (it != subdividedEdges.end()) - { - // We've already generated this vertex before - outIndex = it->second; // the index of this vertex - outVertex = vertexPositions[outIndex]; // and the vertex itself - } - else - { - // Haven't generated this vertex before: so add it now - - // outVertex = (vertices[i0] + vertices[i1]) / 2 - XMStoreFloat3( - &outVertex, - XMVectorScale( - XMVectorAdd(XMLoadFloat3(&vertexPositions[i0]), XMLoadFloat3(&vertexPositions[i1])), - 0.5f - ) - ); - - outIndex = static_cast( vertexPositions.size() ); - CheckIndexOverflow(outIndex); - vertexPositions.push_back(outVertex); - - // Now add it to the map. - subdividedEdges.insert(std::make_pair(edge, outIndex)); - } - }; - - // Add/get new vertices and their indices - divideEdge(iv0, iv1, v01, iv01); - divideEdge(iv1, iv2, v12, iv12); - divideEdge(iv0, iv2, v20, iv20); - - // Add the new indices. We have four new triangles from our original one: - // v0 - // o - // /a\ - // v20 o---o v01 - // /b\c/d\ - // v2 o---o---o v1 - // v12 - const uint16_t indicesToAdd[] = - { - iv0, iv01, iv20, // a - iv20, iv12, iv2, // b - iv20, iv01, iv12, // c - iv01, iv1, iv12, // d - }; - newIndices.insert(newIndices.end(), std::begin(indicesToAdd), std::end(indicesToAdd)); - } - - indices = std::move(newIndices); - } - - // Now that we've completed subdivision, fill in the final vertex collection - vertices.reserve(vertexPositions.size()); - for (auto it = vertexPositions.begin(); it != vertexPositions.end(); ++it) - { - auto vertexValue = *it; - - auto normal = XMVector3Normalize(XMLoadFloat3(&vertexValue)); - auto pos = XMVectorScale(normal, radius); - - XMFLOAT3 normalFloat3; - XMStoreFloat3(&normalFloat3, normal); - - // calculate texture coordinates for this vertex - float longitude = atan2(normalFloat3.x, -normalFloat3.z); - float latitude = acos(normalFloat3.y); - - float u = longitude / XM_2PI + 0.5f; - float v = latitude / XM_PI; - - auto texcoord = XMVectorSet(1.0f - u, v, 0.0f, 0.0f); - vertices.push_back(VertexPositionNormalTexture(pos, normal, texcoord)); - } - - // There are a couple of fixes to do. One is a texture coordinate wraparound fixup. At some point, there will be - // a set of triangles somewhere in the mesh with texture coordinates such that the wraparound across 0.0/1.0 - // occurs across that triangle. Eg. when the left hand side of the triangle has a U coordinate of 0.98 and the - // right hand side has a U coordinate of 0.0. The intent is that such a triangle should render with a U of 0.98 to - // 1.0, not 0.98 to 0.0. If we don't do this fixup, there will be a visible seam across one side of the sphere. - // - // Luckily this is relatively easy to fix. There is a straight edge which runs down the prime meridian of the - // completed sphere. If you imagine the vertices along that edge, they circumscribe a semicircular arc starting at - // y=1 and ending at y=-1, and sweeping across the range of z=0 to z=1. x stays zero. It's along this edge that we - // need to duplicate our vertices - and provide the correct texture coordinates. - size_t preFixupVertexCount = vertices.size(); - for (size_t i = 0; i < preFixupVertexCount; ++i) - { - // This vertex is on the prime meridian if position.x and texcoord.u are both zero (allowing for small epsilon). - bool isOnPrimeMeridian = XMVector2NearEqual( - XMVectorSet(vertices[i].position.x, vertices[i].textureCoordinate.x, 0.0f, 0.0f), - XMVectorZero(), - XMVectorSplatEpsilon()); - - if (isOnPrimeMeridian) - { - size_t newIndex = vertices.size(); // the index of this vertex that we're about to add - CheckIndexOverflow(newIndex); - - // copy this vertex, correct the texture coordinate, and add the vertex - VertexPositionNormalTexture v = vertices[i]; - v.textureCoordinate.x = 1.0f; - vertices.push_back(v); - - // Now find all the triangles which contain this vertex and update them if necessary - for (size_t j = 0; j < indices.size(); j += 3) - { - uint16_t* triIndex0 = &indices[j+0]; - uint16_t* triIndex1 = &indices[j+1]; - uint16_t* triIndex2 = &indices[j+2]; - - if (*triIndex0 == i) - { - // nothing; just keep going - } - else if (*triIndex1 == i) - { - std::swap(triIndex0, triIndex1); // swap the pointers (not the values) - } - else if (*triIndex2 == i) - { - std::swap(triIndex0, triIndex2); // swap the pointers (not the values) - } - else - { - // this triangle doesn't use the vertex we're interested in - continue; - } - - // If we got to this point then triIndex0 is the pointer to the index to the vertex we're looking at - assert(*triIndex0 == i); - assert(*triIndex1 != i && *triIndex2 != i); // assume no degenerate triangles - - const VertexPositionNormalTexture& v0 = vertices[*triIndex0]; - const VertexPositionNormalTexture& v1 = vertices[*triIndex1]; - const VertexPositionNormalTexture& v2 = vertices[*triIndex2]; - - // check the other two vertices to see if we might need to fix this triangle - - if (abs(v0.textureCoordinate.x - v1.textureCoordinate.x) > 0.5f || - abs(v0.textureCoordinate.x - v2.textureCoordinate.x) > 0.5f) - { - // yep; replace the specified index to point to the new, corrected vertex - *triIndex0 = static_cast(newIndex); - } - } - } - } - - // And one last fix we need to do: the poles. A common use-case of a sphere mesh is to map a rectangular texture onto - // it. If that happens, then the poles become singularities which map the entire top and bottom rows of the texture - // onto a single point. In general there's no real way to do that right. But to match the behavior of non-geodesic - // spheres, we need to duplicate the pole vertex for every triangle that uses it. This will introduce seams near the - // poles, but reduce stretching. - auto fixPole = [&](size_t poleIndex) - { - auto poleVertex = vertices[poleIndex]; - bool overwrittenPoleVertex = false; // overwriting the original pole vertex saves us one vertex - - for (size_t i = 0; i < indices.size(); i += 3) - { - // These pointers point to the three indices which make up this triangle. pPoleIndex is the pointer to the - // entry in the index array which represents the pole index, and the other two pointers point to the other - // two indices making up this triangle. - uint16_t* pPoleIndex; - uint16_t* pOtherIndex0; - uint16_t* pOtherIndex1; - if (indices[i + 0] == poleIndex) - { - pPoleIndex = &indices[i + 0]; - pOtherIndex0 = &indices[i + 1]; - pOtherIndex1 = &indices[i + 2]; - } - else if (indices[i + 1] == poleIndex) - { - pPoleIndex = &indices[i + 1]; - pOtherIndex0 = &indices[i + 2]; - pOtherIndex1 = &indices[i + 0]; - } - else if (indices[i + 2] == poleIndex) - { - pPoleIndex = &indices[i + 2]; - pOtherIndex0 = &indices[i + 0]; - pOtherIndex1 = &indices[i + 1]; - } - else - { - continue; - } - - const auto& otherVertex0 = vertices[*pOtherIndex0]; - const auto& otherVertex1 = vertices[*pOtherIndex1]; - - // Calculate the texcoords for the new pole vertex, add it to the vertices and update the index - VertexPositionNormalTexture newPoleVertex = poleVertex; - newPoleVertex.textureCoordinate.x = (otherVertex0.textureCoordinate.x + otherVertex1.textureCoordinate.x) / 2; - newPoleVertex.textureCoordinate.y = poleVertex.textureCoordinate.y; - - if (!overwrittenPoleVertex) - { - vertices[poleIndex] = newPoleVertex; - overwrittenPoleVertex = true; - } - else - { - CheckIndexOverflow(vertices.size()); - - *pPoleIndex = static_cast(vertices.size()); - vertices.push_back(newPoleVertex); - } - } - }; - - fixPole(northPoleIndex); - fixPole(southPoleIndex); - - // Build RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); + ComputeGeoSphere(vertices, indices, diameter, tessellation, rhcoords); } @@ -920,80 +436,12 @@ void GeometricPrimitive::CreateGeoSphere(std::vector(circleVector), textureScale, g_XMOneHalf); - - vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); - } -} - - // Creates a cylinder primitive. std::unique_ptr GeometricPrimitive::CreateCylinder(_In_ ID3D11DeviceContext* deviceContext, float height, float diameter, size_t tessellation, bool rhcoords) { VertexCollection vertices; IndexCollection indices; - CreateCylinder(vertices, indices, height, diameter, tessellation, rhcoords); + ComputeCylinder(vertices, indices, height, diameter, tessellation, rhcoords); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1005,49 +453,7 @@ std::unique_ptr GeometricPrimitive::CreateCylinder(_In_ ID3D void GeometricPrimitive::CreateCylinder(std::vector& vertices, std::vector& indices, float height, float diameter, size_t tessellation, bool rhcoords) { - vertices.clear(); - indices.clear(); - - if (tessellation < 3) - throw std::out_of_range("tesselation parameter out of range"); - - height /= 2; - - XMVECTOR topOffset = g_XMIdentityR1 * height; - - float radius = diameter / 2; - size_t stride = tessellation + 1; - - // Create a ring of triangles around the outside of the cylinder. - for (size_t i = 0; i <= tessellation; i++) - { - XMVECTOR normal = GetCircleVector(i, tessellation); - - XMVECTOR sideOffset = normal * radius; - - float u = (float)i / tessellation; - - XMVECTOR textureCoordinate = XMLoadFloat(&u); - - vertices.push_back(VertexPositionNormalTexture(sideOffset + topOffset, normal, textureCoordinate)); - vertices.push_back(VertexPositionNormalTexture(sideOffset - topOffset, normal, textureCoordinate + g_XMIdentityR1)); - - index_push_back(indices, i * 2); - index_push_back(indices, (i * 2 + 2) % (stride * 2)); - index_push_back(indices, i * 2 + 1); - - index_push_back(indices, i * 2 + 1); - index_push_back(indices, (i * 2 + 2) % (stride * 2)); - index_push_back(indices, (i * 2 + 3) % (stride * 2)); - } - - // Create flat triangle fan caps to seal the top and bottom. - CreateCylinderCap(vertices, indices, tessellation, height, radius, true); - CreateCylinderCap(vertices, indices, tessellation, height, radius, false); - - // Build RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); + ComputeCylinder(vertices, indices, height, diameter, tessellation, rhcoords); } @@ -1056,7 +462,7 @@ std::unique_ptr GeometricPrimitive::CreateCone(_In_ ID3D11De { VertexCollection vertices; IndexCollection indices; - CreateCone(vertices, indices, diameter, height, tessellation, rhcoords); + ComputeCone(vertices, indices, diameter, height, tessellation, rhcoords); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1068,50 +474,7 @@ std::unique_ptr GeometricPrimitive::CreateCone(_In_ ID3D11De void GeometricPrimitive::CreateCone(std::vector& vertices, std::vector& indices, float diameter, float height, size_t tessellation, bool rhcoords) { - vertices.clear(); - indices.clear(); - - if (tessellation < 3) - throw std::out_of_range("tesselation parameter out of range"); - - height /= 2; - - XMVECTOR topOffset = g_XMIdentityR1 * height; - - float radius = diameter / 2; - size_t stride = tessellation + 1; - - // Create a ring of triangles around the outside of the cone. - for (size_t i = 0; i <= tessellation; i++) - { - XMVECTOR circlevec = GetCircleVector(i, tessellation); - - XMVECTOR sideOffset = circlevec * radius; - - float u = (float)i / tessellation; - - XMVECTOR textureCoordinate = XMLoadFloat(&u); - - XMVECTOR pt = sideOffset - topOffset; - - XMVECTOR normal = XMVector3Cross( GetCircleTangent( i, tessellation ), topOffset - pt ); - normal = XMVector3Normalize( normal ); - - // Duplicate the top vertex for distinct normals - vertices.push_back(VertexPositionNormalTexture(topOffset, normal, g_XMZero)); - vertices.push_back(VertexPositionNormalTexture(pt, normal, textureCoordinate + g_XMIdentityR1 )); - - index_push_back(indices, i * 2); - index_push_back(indices, (i * 2 + 3) % (stride * 2)); - index_push_back(indices, (i * 2 + 1) % (stride * 2)); - } - - // Create flat triangle fan caps to seal the bottom. - CreateCylinderCap(vertices, indices, tessellation, height, radius, false); - - // Build RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); + ComputeCone(vertices, indices, diameter, height, tessellation, rhcoords); } @@ -1124,7 +487,7 @@ std::unique_ptr GeometricPrimitive::CreateTorus(_In_ ID3D11D { VertexCollection vertices; IndexCollection indices; - CreateTorus( vertices, indices, diameter, thickness, tessellation, rhcoords ); + ComputeTorus( vertices, indices, diameter, thickness, tessellation, rhcoords ); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1136,62 +499,7 @@ std::unique_ptr GeometricPrimitive::CreateTorus(_In_ ID3D11D void GeometricPrimitive::CreateTorus(std::vector& vertices, std::vector& indices, float diameter, float thickness, size_t tessellation, bool rhcoords) { - vertices.clear(); - indices.clear(); - - if (tessellation < 3) - throw std::out_of_range("tesselation parameter out of range"); - - size_t stride = tessellation + 1; - - // First we loop around the main ring of the torus. - for (size_t i = 0; i <= tessellation; i++) - { - float u = (float)i / tessellation; - - float outerAngle = i * XM_2PI / tessellation - XM_PIDIV2; - - // Create a transform matrix that will align geometry to - // slice perpendicularly though the current ring position. - XMMATRIX transform = XMMatrixTranslation(diameter / 2, 0, 0) * XMMatrixRotationY(outerAngle); - - // Now we loop along the other axis, around the side of the tube. - for (size_t j = 0; j <= tessellation; j++) - { - float v = 1 - (float)j / tessellation; - - float innerAngle = j * XM_2PI / tessellation + XM_PI; - float dx, dy; - - XMScalarSinCos(&dy, &dx, innerAngle); - - // Create a vertex. - XMVECTOR normal = XMVectorSet(dx, dy, 0, 0); - XMVECTOR position = normal * thickness / 2; - XMVECTOR textureCoordinate = XMVectorSet(u, v, 0, 0); - - position = XMVector3Transform(position, transform); - normal = XMVector3TransformNormal(normal, transform); - - vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); - - // And create indices for two triangles. - size_t nextI = (i + 1) % stride; - size_t nextJ = (j + 1) % stride; - - index_push_back(indices, i * stride + j); - index_push_back(indices, i * stride + nextJ); - index_push_back(indices, nextI * stride + j); - - index_push_back(indices, i * stride + nextJ); - index_push_back(indices, nextI * stride + nextJ); - index_push_back(indices, nextI * stride + j); - } - } - - // Build RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); + ComputeTorus(vertices, indices, diameter, thickness, tessellation, rhcoords); } @@ -1203,7 +511,7 @@ std::unique_ptr GeometricPrimitive::CreateTetrahedron(_In_ I { VertexCollection vertices; IndexCollection indices; - CreateTetrahedron(vertices, indices, size, rhcoords); + ComputeTetrahedron(vertices, indices, size, rhcoords); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1215,57 +523,7 @@ std::unique_ptr GeometricPrimitive::CreateTetrahedron(_In_ I void GeometricPrimitive::CreateTetrahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords) { - vertices.clear(); - indices.clear(); - - static const XMVECTORF32 verts[4] = - { - { 0.f, 0.f, 1.f }, - { 2.f*SQRT2/3.f, 0.f, -1.f/3.f }, - { -SQRT2/3.f, SQRT6/3.f, -1.f/3.f }, - { -SQRT2/3.f, -SQRT6/3.f, -1.f/3.f } - }; - - static const uint32_t faces[4*3] = - { - 0, 1, 2, - 0, 2, 3, - 0, 3, 1, - 1, 3, 2, - }; - - for( size_t j = 0; j < _countof(faces); j += 3 ) - { - uint32_t v0 = faces[ j ]; - uint32_t v1 = faces[ j + 1 ]; - uint32_t v2 = faces[ j + 2 ]; - - XMVECTOR normal = XMVector3Cross( verts[ v1 ].v - verts[ v0 ].v, - verts[ v2 ].v - verts[ v0 ].v ); - normal = XMVector3Normalize( normal ); - - size_t base = vertices.size(); - index_push_back(indices, base ); - index_push_back(indices, base + 1 ); - index_push_back(indices, base + 2 ); - - // Duplicate vertices to use face normals - XMVECTOR position = XMVectorScale( verts[ v0 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMZero /* 0, 0 */ ) ); - - position = XMVectorScale( verts[ v1 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMIdentityR0 /* 1, 0 */ ) ); - - position = XMVectorScale( verts[ v2 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMIdentityR1 /* 0, 1 */ ) ); - } - - // Built LH above - if ( rhcoords ) - ReverseWinding( indices, vertices ); - - assert( vertices.size() == 4*3 ); - assert( indices.size() == 4*3 ); + ComputeTetrahedron(vertices, indices, size, rhcoords); } @@ -1276,7 +534,7 @@ std::unique_ptr GeometricPrimitive::CreateOctahedron(_In_ ID { VertexCollection vertices; IndexCollection indices; - CreateOctahedron(vertices, indices, size, rhcoords ); + ComputeOctahedron(vertices, indices, size, rhcoords ); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1288,63 +546,7 @@ std::unique_ptr GeometricPrimitive::CreateOctahedron(_In_ ID void GeometricPrimitive::CreateOctahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords ) { - vertices.clear(); - indices.clear(); - - static const XMVECTORF32 verts[6] = - { - { 1, 0, 0 }, - { -1, 0, 0 }, - { 0, 1, 0 }, - { 0, -1, 0 }, - { 0, 0, 1 }, - { 0, 0, -1 } - }; - - static const uint32_t faces[8*3] = - { - 4, 0, 2, - 4, 2, 1, - 4, 1, 3, - 4, 3, 0, - 5, 2, 0, - 5, 1, 2, - 5, 3, 1, - 5, 0, 3 - }; - - for( size_t j = 0; j < _countof(faces); j += 3 ) - { - uint32_t v0 = faces[ j ]; - uint32_t v1 = faces[ j + 1 ]; - uint32_t v2 = faces[ j + 2 ]; - - XMVECTOR normal = XMVector3Cross( verts[ v1 ].v - verts[ v0 ].v, - verts[ v2 ].v - verts[ v0 ].v ); - normal = XMVector3Normalize( normal ); - - size_t base = vertices.size(); - index_push_back(indices, base ); - index_push_back(indices, base + 1 ); - index_push_back(indices, base + 2 ); - - // Duplicate vertices to use face normals - XMVECTOR position = XMVectorScale( verts[ v0 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMZero /* 0, 0 */ ) ); - - position = XMVectorScale( verts[ v1 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMIdentityR0 /* 1, 0 */ ) ); - - position = XMVectorScale( verts[ v2 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMIdentityR1 /* 0, 1*/ ) ); - } - - // Built LH above - if ( rhcoords ) - ReverseWinding( indices, vertices ); - - assert( vertices.size() == 8*3 ); - assert( indices.size() == 8*3 ); + ComputeOctahedron(vertices, indices, size, rhcoords); } @@ -1356,7 +558,7 @@ std::unique_ptr GeometricPrimitive::CreateDodecahedron(_In_ { VertexCollection vertices; IndexCollection indices; - CreateDodecahedron( vertices, indices, size, rhcoords ); + ComputeDodecahedron( vertices, indices, size, rhcoords ); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1368,128 +570,7 @@ std::unique_ptr GeometricPrimitive::CreateDodecahedron(_In_ void GeometricPrimitive::CreateDodecahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords ) { - vertices.clear(); - indices.clear(); - - static const float a = 1.f/SQRT3; - static const float b = 0.356822089773089931942f; // sqrt( ( 3 - sqrt(5) ) / 6 ) - static const float c = 0.934172358962715696451f; // sqrt( ( 3 + sqrt(5) ) / 6 ); - - static const XMVECTORF32 verts[20] = - { - { a, a, a }, - { a, a, -a }, - { a, -a, a }, - { a, -a, -a }, - { -a, a, a }, - { -a, a, -a }, - { -a, -a, a }, - { -a, -a, -a }, - { b, c, 0 }, - { -b, c, 0 }, - { b, -c, 0 }, - { -b, -c, 0 }, - { c, 0, b }, - { c, 0, -b }, - { -c, 0, b }, - { -c, 0, -b }, - { 0, b, c }, - { 0, -b, c }, - { 0, b, -c }, - { 0, -b, -c } - }; - - static const uint32_t faces[12*5] = - { - 0, 8, 9, 4, 16, - 0, 16, 17, 2, 12, - 12, 2, 10, 3, 13, - 9, 5, 15, 14, 4, - 3, 19, 18, 1, 13, - 7, 11, 6, 14, 15, - 0, 12, 13, 1, 8, - 8, 1, 18, 5, 9, - 16, 4, 14, 6, 17, - 6, 11, 10, 2, 17, - 7, 15, 5, 18, 19, - 7, 19, 3, 10, 11, - }; - - static const XMVECTORF32 textureCoordinates[5] = - { - { 0.654508f, 0.0244717f }, - { 0.0954915f, 0.206107f }, - { 0.0954915f, 0.793893f }, - { 0.654508f, 0.975528f }, - { 1.f, 0.5f } - }; - - static const uint32_t textureIndex[12][5] = - { - { 0, 1, 2, 3, 4 }, - { 2, 3, 4, 0, 1 }, - { 4, 0, 1, 2, 3 }, - { 1, 2, 3, 4, 0 }, - { 2, 3, 4, 0, 1 }, - { 0, 1, 2, 3, 4 }, - { 1, 2, 3, 4, 0 }, - { 4, 0, 1, 2, 3 }, - { 4, 0, 1, 2, 3 }, - { 1, 2, 3, 4, 0 }, - { 0, 1, 2, 3, 4 }, - { 2, 3, 4, 0, 1 }, - }; - - size_t t = 0; - for( size_t j = 0; j < _countof(faces); j += 5, ++t ) - { - uint32_t v0 = faces[ j ]; - uint32_t v1 = faces[ j + 1 ]; - uint32_t v2 = faces[ j + 2 ]; - uint32_t v3 = faces[ j + 3 ]; - uint32_t v4 = faces[ j + 4 ]; - - XMVECTOR normal = XMVector3Cross( verts[ v1 ].v - verts[ v0 ].v, - verts[ v2 ].v - verts[ v0 ].v ); - normal = XMVector3Normalize( normal ); - - size_t base = vertices.size(); - - index_push_back(indices, base ); - index_push_back(indices, base + 1 ); - index_push_back(indices, base + 2 ); - - index_push_back(indices, base ); - index_push_back(indices, base + 2 ); - index_push_back(indices, base + 3 ); - - index_push_back(indices, base ); - index_push_back(indices, base + 3 ); - index_push_back(indices, base + 4 ); - - // Duplicate vertices to use face normals - XMVECTOR position = XMVectorScale( verts[ v0 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, textureCoordinates[ textureIndex[t][0] ] ) ); - - position = XMVectorScale( verts[ v1 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, textureCoordinates[ textureIndex[t][1] ] ) ); - - position = XMVectorScale( verts[ v2 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, textureCoordinates[ textureIndex[t][2] ] ) ); - - position = XMVectorScale( verts[ v3 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, textureCoordinates[ textureIndex[t][3] ] ) ); - - position = XMVectorScale( verts[ v4 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, textureCoordinates[ textureIndex[t][4] ] ) ); - } - - // Built LH above - if ( rhcoords ) - ReverseWinding( indices, vertices ); - - assert( vertices.size() == 12*5 ); - assert( indices.size() == 12*3*3 ); + ComputeDodecahedron(vertices, indices, size, rhcoords); } @@ -1501,7 +582,7 @@ std::unique_ptr GeometricPrimitive::CreateIcosahedron(_In_ I { VertexCollection vertices; IndexCollection indices; - CreateIcosahedron( vertices, indices, size, rhcoords ); + ComputeIcosahedron( vertices, indices, size, rhcoords ); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1513,84 +594,7 @@ std::unique_ptr GeometricPrimitive::CreateIcosahedron(_In_ I void GeometricPrimitive::CreateIcosahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords ) { - vertices.clear(); - indices.clear(); - - static const float t = 1.618033988749894848205f; // (1 + sqrt(5)) / 2 - static const float t2 = 1.519544995837552493271f; // sqrt( 1 + sqr( (1 + sqrt(5)) / 2 ) ) - - static const XMVECTORF32 verts[12] = - { - { t/t2, 1.f/t2, 0 }, - { -t/t2, 1.f/t2, 0 }, - { t/t2, -1.f/t2, 0 }, - { -t/t2, -1.f/t2, 0 }, - { 1.f/t2, 0, t/t2 }, - { 1.f/t2, 0, -t/t2 }, - { -1.f/t2, 0, t/t2 }, - { -1.f/t2, 0, -t/t2 }, - { 0, t/t2, 1.f/t2 }, - { 0, -t/t2, 1.f/t2 }, - { 0, t/t2, -1.f/t2 }, - { 0, -t/t2, -1.f/t2 } - }; - - static const uint32_t faces[20*3] = - { - 0, 8, 4, - 0, 5, 10, - 2, 4, 9, - 2, 11, 5, - 1, 6, 8, - 1, 10, 7, - 3, 9, 6, - 3, 7, 11, - 0, 10, 8, - 1, 8, 10, - 2, 9, 11, - 3, 11, 9, - 4, 2, 0, - 5, 0, 2, - 6, 1, 3, - 7, 3, 1, - 8, 6, 4, - 9, 4, 6, - 10, 5, 7, - 11, 7, 5 - }; - - for( size_t j = 0; j < _countof(faces); j += 3 ) - { - uint32_t v0 = faces[ j ]; - uint32_t v1 = faces[ j + 1 ]; - uint32_t v2 = faces[ j + 2 ]; - - XMVECTOR normal = XMVector3Cross( verts[ v1 ].v - verts[ v0 ].v, - verts[ v2 ].v - verts[ v0 ].v ); - normal = XMVector3Normalize( normal ); - - size_t base = vertices.size(); - index_push_back(indices, base ); - index_push_back(indices, base + 1 ); - index_push_back(indices, base + 2 ); - - // Duplicate vertices to use face normals - XMVECTOR position = XMVectorScale( verts[ v0 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMZero /* 0, 0 */ ) ); - - position = XMVectorScale( verts[ v1 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMIdentityR0 /* 1, 0 */ ) ); - - position = XMVectorScale( verts[ v2 ], size ); - vertices.push_back( VertexPositionNormalTexture( position, normal, g_XMIdentityR1 /* 0, 1 */ ) ); - } - - // Built LH above - if ( rhcoords ) - ReverseWinding( indices, vertices ); - - assert( vertices.size() == 20*3 ); - assert( indices.size() == 20*3 ); + ComputeIcosahedron(vertices, indices, size, rhcoords); } @@ -1598,45 +602,12 @@ void GeometricPrimitive::CreateIcosahedron(std::vector GeometricPrimitive::CreateTeapot(_In_ ID3D11DeviceContext* deviceContext, float size, size_t tessellation, bool rhcoords) { VertexCollection vertices; IndexCollection indices; - CreateTeapot(vertices, indices, size, tessellation, rhcoords); + ComputeTeapot(vertices, indices, size, tessellation, rhcoords); // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); @@ -1648,40 +619,7 @@ std::unique_ptr GeometricPrimitive::CreateTeapot(_In_ ID3D11 void GeometricPrimitive::CreateTeapot(std::vector& vertices, std::vector& indices, float size, size_t tessellation, bool rhcoords) { - vertices.clear(); - indices.clear(); - - if (tessellation < 1) - throw std::out_of_range("tesselation parameter out of range"); - - XMVECTOR scaleVector = XMVectorReplicate(size); - - XMVECTOR scaleNegateX = scaleVector * g_XMNegateX; - XMVECTOR scaleNegateZ = scaleVector * g_XMNegateZ; - XMVECTOR scaleNegateXZ = scaleVector * g_XMNegateX * g_XMNegateZ; - - for (int i = 0; i < sizeof(TeapotPatches) / sizeof(TeapotPatches[0]); i++) - { - TeapotPatch const& patch = TeapotPatches[i]; - - // Because the teapot is symmetrical from left to right, we only store - // data for one side, then tessellate each patch twice, mirroring in X. - TessellatePatch(vertices, indices, patch, tessellation, scaleVector, false); - TessellatePatch(vertices, indices, patch, tessellation, scaleNegateX, true); - - if (patch.mirrorZ) - { - // Some parts of the teapot (the body, lid, and rim, but not the - // handle or spout) are also symmetrical from front to back, so - // we tessellate them four times, mirroring in Z as well as X. - TessellatePatch(vertices, indices, patch, tessellation, scaleNegateZ, true); - TessellatePatch(vertices, indices, patch, tessellation, scaleNegateXZ, false); - } - } - - // Built RH above - if ( !rhcoords ) - ReverseWinding( indices, vertices ); + ComputeTeapot(vertices, indices, size, tessellation, rhcoords); } @@ -1692,19 +630,19 @@ void GeometricPrimitive::CreateTeapot(std::vector& std::unique_ptr GeometricPrimitive::CreateCustom(_In_ ID3D11DeviceContext* deviceContext, const std::vector& vertices, const std::vector& indices) { // Extra validation - if ( vertices.empty() || indices.empty() ) + if (vertices.empty() || indices.empty()) throw std::exception("Requires both vertices and indices"); - if ( indices.size() % 3 ) + if (indices.size() % 3) throw std::exception("Expected triangular faces"); size_t nVerts = vertices.size(); - if ( nVerts >= USHRT_MAX ) + if (nVerts >= USHRT_MAX) throw std::exception("Too many vertices for 16-bit index buffer"); - for( auto it = indices.cbegin(); it != indices.cend(); ++it ) + for (auto it = indices.cbegin(); it != indices.cend(); ++it) { - if ( *it >= nVerts ) + if (*it >= nVerts) { throw std::exception("Index not in vertices list"); } @@ -1712,7 +650,7 @@ std::unique_ptr GeometricPrimitive::CreateCustom(_In_ ID3D11 // Create the primitive object. std::unique_ptr primitive(new GeometricPrimitive()); - + primitive->pImpl->Initialize(deviceContext, vertices, indices); return primitive; diff --git a/Kits/DirectXTK/Src/Geometry.cpp b/Kits/DirectXTK/Src/Geometry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b5c3b80d042284c5928163cf9b7095023238822 --- /dev/null +++ b/Kits/DirectXTK/Src/Geometry.cpp @@ -0,0 +1,1184 @@ +//-------------------------------------------------------------------------------------- +// File: Geometry.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Geometry.h" +#include "Bezier.h" + +using namespace DirectX; + +namespace +{ + const float SQRT2 = 1.41421356237309504880f; + const float SQRT3 = 1.73205080756887729352f; + const float SQRT6 = 2.44948974278317809820f; + + inline void CheckIndexOverflow(size_t value) + { + // Use >=, not > comparison, because some D3D level 9_x hardware does not support 0xFFFF index values. + if (value >= USHRT_MAX) + throw std::exception("Index value out of range: cannot tesselate primitive so finely"); + } + + + // Collection types used when generating the geometry. + inline void index_push_back(IndexCollection& indices, size_t value) + { + CheckIndexOverflow(value); + indices.push_back((uint16_t)value); + } + + + // Helper for flipping winding of geometric primitives for LH vs. RH coords + inline void ReverseWinding(IndexCollection& indices, VertexCollection& vertices) + { + assert((indices.size() % 3) == 0); + for (auto it = indices.begin(); it != indices.end(); it += 3) + { + std::swap(*it, *(it + 2)); + } + + for (auto it = vertices.begin(); it != vertices.end(); ++it) + { + it->textureCoordinate.x = (1.f - it->textureCoordinate.x); + } + } + + + // Helper for inverting normals of geometric primitives for 'inside' vs. 'outside' viewing + inline void InvertNormals(VertexCollection& vertices) + { + for (auto it = vertices.begin(); it != vertices.end(); ++it) + { + it->normal.x = -it->normal.x; + it->normal.y = -it->normal.y; + it->normal.z = -it->normal.z; + } + } +} + + +//-------------------------------------------------------------------------------------- +// Cube (aka a Hexahedron) or Box +//-------------------------------------------------------------------------------------- +void DirectX::ComputeBox(VertexCollection& vertices, IndexCollection& indices, const XMFLOAT3& size, bool rhcoords, bool invertn) +{ + vertices.clear(); + indices.clear(); + + // A box has six faces, each one pointing in a different direction. + const int FaceCount = 6; + + static const XMVECTORF32 faceNormals[FaceCount] = + { + { 0, 0, 1 }, + { 0, 0, -1 }, + { 1, 0, 0 }, + { -1, 0, 0 }, + { 0, 1, 0 }, + { 0, -1, 0 }, + }; + + static const XMVECTORF32 textureCoordinates[4] = + { + { 1, 0 }, + { 1, 1 }, + { 0, 1 }, + { 0, 0 }, + }; + + XMVECTOR tsize = XMLoadFloat3(&size); + tsize = XMVectorDivide(tsize, g_XMTwo); + + // Create each face in turn. + for (int i = 0; i < FaceCount; i++) + { + XMVECTOR normal = faceNormals[i]; + + // Get two vectors perpendicular both to the face normal and to each other. + XMVECTOR basis = (i >= 4) ? g_XMIdentityR2 : g_XMIdentityR1; + + XMVECTOR side1 = XMVector3Cross(normal, basis); + XMVECTOR side2 = XMVector3Cross(normal, side1); + + // Six indices (two triangles) per face. + size_t vbase = vertices.size(); + index_push_back(indices, vbase + 0); + index_push_back(indices, vbase + 1); + index_push_back(indices, vbase + 2); + + index_push_back(indices, vbase + 0); + index_push_back(indices, vbase + 2); + index_push_back(indices, vbase + 3); + + // Four vertices per face. + vertices.push_back(VertexPositionNormalTexture((normal - side1 - side2) * tsize, normal, textureCoordinates[0])); + vertices.push_back(VertexPositionNormalTexture((normal - side1 + side2) * tsize, normal, textureCoordinates[1])); + vertices.push_back(VertexPositionNormalTexture((normal + side1 + side2) * tsize, normal, textureCoordinates[2])); + vertices.push_back(VertexPositionNormalTexture((normal + side1 - side2) * tsize, normal, textureCoordinates[3])); + } + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); + + if (invertn) + InvertNormals(vertices); +} + + +//-------------------------------------------------------------------------------------- +// Sphere +//-------------------------------------------------------------------------------------- +void DirectX::ComputeSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords, bool invertn) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + size_t verticalSegments = tessellation; + size_t horizontalSegments = tessellation * 2; + + float radius = diameter / 2; + + // Create rings of vertices at progressively higher latitudes. + for (size_t i = 0; i <= verticalSegments; i++) + { + float v = 1 - (float)i / verticalSegments; + + float latitude = (i * XM_PI / verticalSegments) - XM_PIDIV2; + float dy, dxz; + + XMScalarSinCos(&dy, &dxz, latitude); + + // Create a single ring of vertices at this latitude. + for (size_t j = 0; j <= horizontalSegments; j++) + { + float u = (float)j / horizontalSegments; + + float longitude = j * XM_2PI / horizontalSegments; + float dx, dz; + + XMScalarSinCos(&dx, &dz, longitude); + + dx *= dxz; + dz *= dxz; + + XMVECTOR normal = XMVectorSet(dx, dy, dz, 0); + XMVECTOR textureCoordinate = XMVectorSet(u, v, 0, 0); + + vertices.push_back(VertexPositionNormalTexture(normal * radius, normal, textureCoordinate)); + } + } + + // Fill the index buffer with triangles joining each pair of latitude rings. + size_t stride = horizontalSegments + 1; + + for (size_t i = 0; i < verticalSegments; i++) + { + for (size_t j = 0; j <= horizontalSegments; j++) + { + size_t nextI = i + 1; + size_t nextJ = (j + 1) % stride; + + index_push_back(indices, i * stride + j); + index_push_back(indices, nextI * stride + j); + index_push_back(indices, i * stride + nextJ); + + index_push_back(indices, i * stride + nextJ); + index_push_back(indices, nextI * stride + j); + index_push_back(indices, nextI * stride + nextJ); + } + } + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); + + if (invertn) + InvertNormals(vertices); +} + + +//-------------------------------------------------------------------------------------- +// Geodesic sphere +//-------------------------------------------------------------------------------------- +void DirectX::ComputeGeoSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + // An undirected edge between two vertices, represented by a pair of indexes into a vertex array. + // Becuse this edge is undirected, (a,b) is the same as (b,a). + typedef std::pair UndirectedEdge; + + // Makes an undirected edge. Rather than overloading comparison operators to give us the (a,b)==(b,a) property, + // we'll just ensure that the larger of the two goes first. This'll simplify things greatly. + auto makeUndirectedEdge = [](uint16_t a, uint16_t b) + { + return std::make_pair(std::max(a, b), std::min(a, b)); + }; + + // Key: an edge + // Value: the index of the vertex which lies midway between the two vertices pointed to by the key value + // This map is used to avoid duplicating vertices when subdividing triangles along edges. + typedef std::map EdgeSubdivisionMap; + + + static const XMFLOAT3 OctahedronVertices[] = + { + // when looking down the negative z-axis (into the screen) + XMFLOAT3(0, 1, 0), // 0 top + XMFLOAT3(0, 0, -1), // 1 front + XMFLOAT3(1, 0, 0), // 2 right + XMFLOAT3(0, 0, 1), // 3 back + XMFLOAT3(-1, 0, 0), // 4 left + XMFLOAT3(0, -1, 0), // 5 bottom + }; + static const uint16_t OctahedronIndices[] = + { + 0, 1, 2, // top front-right face + 0, 2, 3, // top back-right face + 0, 3, 4, // top back-left face + 0, 4, 1, // top front-left face + 5, 1, 4, // bottom front-left face + 5, 4, 3, // bottom back-left face + 5, 3, 2, // bottom back-right face + 5, 2, 1, // bottom front-right face + }; + + const float radius = diameter / 2.0f; + + // Start with an octahedron; copy the data into the vertex/index collection. + + std::vector vertexPositions(std::begin(OctahedronVertices), std::end(OctahedronVertices)); + + indices.insert(indices.begin(), std::begin(OctahedronIndices), std::end(OctahedronIndices)); + + // We know these values by looking at the above index list for the octahedron. Despite the subdivisions that are + // about to go on, these values aren't ever going to change because the vertices don't move around in the array. + // We'll need these values later on to fix the singularities that show up at the poles. + const uint16_t northPoleIndex = 0; + const uint16_t southPoleIndex = 5; + + for (size_t iSubdivision = 0; iSubdivision < tessellation; ++iSubdivision) + { + assert(indices.size() % 3 == 0); // sanity + + // We use this to keep track of which edges have already been subdivided. + EdgeSubdivisionMap subdividedEdges; + + // The new index collection after subdivision. + IndexCollection newIndices; + + const size_t triangleCount = indices.size() / 3; + for (size_t iTriangle = 0; iTriangle < triangleCount; ++iTriangle) + { + // For each edge on this triangle, create a new vertex in the middle of that edge. + // The winding order of the triangles we output are the same as the winding order of the inputs. + + // Indices of the vertices making up this triangle + uint16_t iv0 = indices[iTriangle * 3 + 0]; + uint16_t iv1 = indices[iTriangle * 3 + 1]; + uint16_t iv2 = indices[iTriangle * 3 + 2]; + + // Get the new vertices + XMFLOAT3 v01; // vertex on the midpoint of v0 and v1 + XMFLOAT3 v12; // ditto v1 and v2 + XMFLOAT3 v20; // ditto v2 and v0 + uint16_t iv01; // index of v01 + uint16_t iv12; // index of v12 + uint16_t iv20; // index of v20 + + // Function that, when given the index of two vertices, creates a new vertex at the midpoint of those vertices. + auto divideEdge = [&](uint16_t i0, uint16_t i1, XMFLOAT3& outVertex, uint16_t& outIndex) + { + const UndirectedEdge edge = makeUndirectedEdge(i0, i1); + + // Check to see if we've already generated this vertex + auto it = subdividedEdges.find(edge); + if (it != subdividedEdges.end()) + { + // We've already generated this vertex before + outIndex = it->second; // the index of this vertex + outVertex = vertexPositions[outIndex]; // and the vertex itself + } + else + { + // Haven't generated this vertex before: so add it now + + // outVertex = (vertices[i0] + vertices[i1]) / 2 + XMStoreFloat3( + &outVertex, + XMVectorScale( + XMVectorAdd(XMLoadFloat3(&vertexPositions[i0]), XMLoadFloat3(&vertexPositions[i1])), + 0.5f + ) + ); + + outIndex = static_cast(vertexPositions.size()); + CheckIndexOverflow(outIndex); + vertexPositions.push_back(outVertex); + + // Now add it to the map. + subdividedEdges.insert(std::make_pair(edge, outIndex)); + } + }; + + // Add/get new vertices and their indices + divideEdge(iv0, iv1, v01, iv01); + divideEdge(iv1, iv2, v12, iv12); + divideEdge(iv0, iv2, v20, iv20); + + // Add the new indices. We have four new triangles from our original one: + // v0 + // o + // /a\ + // v20 o---o v01 + // /b\c/d\ + // v2 o---o---o v1 + // v12 + const uint16_t indicesToAdd[] = + { + iv0, iv01, iv20, // a + iv20, iv12, iv2, // b + iv20, iv01, iv12, // c + iv01, iv1, iv12, // d + }; + newIndices.insert(newIndices.end(), std::begin(indicesToAdd), std::end(indicesToAdd)); + } + + indices = std::move(newIndices); + } + + // Now that we've completed subdivision, fill in the final vertex collection + vertices.reserve(vertexPositions.size()); + for (auto it = vertexPositions.begin(); it != vertexPositions.end(); ++it) + { + auto vertexValue = *it; + + auto normal = XMVector3Normalize(XMLoadFloat3(&vertexValue)); + auto pos = XMVectorScale(normal, radius); + + XMFLOAT3 normalFloat3; + XMStoreFloat3(&normalFloat3, normal); + + // calculate texture coordinates for this vertex + float longitude = atan2(normalFloat3.x, -normalFloat3.z); + float latitude = acos(normalFloat3.y); + + float u = longitude / XM_2PI + 0.5f; + float v = latitude / XM_PI; + + auto texcoord = XMVectorSet(1.0f - u, v, 0.0f, 0.0f); + vertices.push_back(VertexPositionNormalTexture(pos, normal, texcoord)); + } + + // There are a couple of fixes to do. One is a texture coordinate wraparound fixup. At some point, there will be + // a set of triangles somewhere in the mesh with texture coordinates such that the wraparound across 0.0/1.0 + // occurs across that triangle. Eg. when the left hand side of the triangle has a U coordinate of 0.98 and the + // right hand side has a U coordinate of 0.0. The intent is that such a triangle should render with a U of 0.98 to + // 1.0, not 0.98 to 0.0. If we don't do this fixup, there will be a visible seam across one side of the sphere. + // + // Luckily this is relatively easy to fix. There is a straight edge which runs down the prime meridian of the + // completed sphere. If you imagine the vertices along that edge, they circumscribe a semicircular arc starting at + // y=1 and ending at y=-1, and sweeping across the range of z=0 to z=1. x stays zero. It's along this edge that we + // need to duplicate our vertices - and provide the correct texture coordinates. + size_t preFixupVertexCount = vertices.size(); + for (size_t i = 0; i < preFixupVertexCount; ++i) + { + // This vertex is on the prime meridian if position.x and texcoord.u are both zero (allowing for small epsilon). + bool isOnPrimeMeridian = XMVector2NearEqual( + XMVectorSet(vertices[i].position.x, vertices[i].textureCoordinate.x, 0.0f, 0.0f), + XMVectorZero(), + XMVectorSplatEpsilon()); + + if (isOnPrimeMeridian) + { + size_t newIndex = vertices.size(); // the index of this vertex that we're about to add + CheckIndexOverflow(newIndex); + + // copy this vertex, correct the texture coordinate, and add the vertex + VertexPositionNormalTexture v = vertices[i]; + v.textureCoordinate.x = 1.0f; + vertices.push_back(v); + + // Now find all the triangles which contain this vertex and update them if necessary + for (size_t j = 0; j < indices.size(); j += 3) + { + uint16_t* triIndex0 = &indices[j + 0]; + uint16_t* triIndex1 = &indices[j + 1]; + uint16_t* triIndex2 = &indices[j + 2]; + + if (*triIndex0 == i) + { + // nothing; just keep going + } + else if (*triIndex1 == i) + { + std::swap(triIndex0, triIndex1); // swap the pointers (not the values) + } + else if (*triIndex2 == i) + { + std::swap(triIndex0, triIndex2); // swap the pointers (not the values) + } + else + { + // this triangle doesn't use the vertex we're interested in + continue; + } + + // If we got to this point then triIndex0 is the pointer to the index to the vertex we're looking at + assert(*triIndex0 == i); + assert(*triIndex1 != i && *triIndex2 != i); // assume no degenerate triangles + + const VertexPositionNormalTexture& v0 = vertices[*triIndex0]; + const VertexPositionNormalTexture& v1 = vertices[*triIndex1]; + const VertexPositionNormalTexture& v2 = vertices[*triIndex2]; + + // check the other two vertices to see if we might need to fix this triangle + + if (abs(v0.textureCoordinate.x - v1.textureCoordinate.x) > 0.5f || + abs(v0.textureCoordinate.x - v2.textureCoordinate.x) > 0.5f) + { + // yep; replace the specified index to point to the new, corrected vertex + *triIndex0 = static_cast(newIndex); + } + } + } + } + + // And one last fix we need to do: the poles. A common use-case of a sphere mesh is to map a rectangular texture onto + // it. If that happens, then the poles become singularities which map the entire top and bottom rows of the texture + // onto a single point. In general there's no real way to do that right. But to match the behavior of non-geodesic + // spheres, we need to duplicate the pole vertex for every triangle that uses it. This will introduce seams near the + // poles, but reduce stretching. + auto fixPole = [&](size_t poleIndex) + { + auto poleVertex = vertices[poleIndex]; + bool overwrittenPoleVertex = false; // overwriting the original pole vertex saves us one vertex + + for (size_t i = 0; i < indices.size(); i += 3) + { + // These pointers point to the three indices which make up this triangle. pPoleIndex is the pointer to the + // entry in the index array which represents the pole index, and the other two pointers point to the other + // two indices making up this triangle. + uint16_t* pPoleIndex; + uint16_t* pOtherIndex0; + uint16_t* pOtherIndex1; + if (indices[i + 0] == poleIndex) + { + pPoleIndex = &indices[i + 0]; + pOtherIndex0 = &indices[i + 1]; + pOtherIndex1 = &indices[i + 2]; + } + else if (indices[i + 1] == poleIndex) + { + pPoleIndex = &indices[i + 1]; + pOtherIndex0 = &indices[i + 2]; + pOtherIndex1 = &indices[i + 0]; + } + else if (indices[i + 2] == poleIndex) + { + pPoleIndex = &indices[i + 2]; + pOtherIndex0 = &indices[i + 0]; + pOtherIndex1 = &indices[i + 1]; + } + else + { + continue; + } + + const auto& otherVertex0 = vertices[*pOtherIndex0]; + const auto& otherVertex1 = vertices[*pOtherIndex1]; + + // Calculate the texcoords for the new pole vertex, add it to the vertices and update the index + VertexPositionNormalTexture newPoleVertex = poleVertex; + newPoleVertex.textureCoordinate.x = (otherVertex0.textureCoordinate.x + otherVertex1.textureCoordinate.x) / 2; + newPoleVertex.textureCoordinate.y = poleVertex.textureCoordinate.y; + + if (!overwrittenPoleVertex) + { + vertices[poleIndex] = newPoleVertex; + overwrittenPoleVertex = true; + } + else + { + CheckIndexOverflow(vertices.size()); + + *pPoleIndex = static_cast(vertices.size()); + vertices.push_back(newPoleVertex); + } + } + }; + + fixPole(northPoleIndex); + fixPole(southPoleIndex); + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +//-------------------------------------------------------------------------------------- +// Cylinder / Cone +//-------------------------------------------------------------------------------------- +namespace +{ + // Helper computes a point on a unit circle, aligned to the x/z plane and centered on the origin. + inline XMVECTOR GetCircleVector(size_t i, size_t tessellation) + { + float angle = i * XM_2PI / tessellation; + float dx, dz; + + XMScalarSinCos(&dx, &dz, angle); + + XMVECTORF32 v = { dx, 0, dz, 0 }; + return v; + } + + inline XMVECTOR GetCircleTangent(size_t i, size_t tessellation) + { + float angle = (i * XM_2PI / tessellation) + XM_PIDIV2; + float dx, dz; + + XMScalarSinCos(&dx, &dz, angle); + + XMVECTORF32 v = { dx, 0, dz, 0 }; + return v; + } + + + // Helper creates a triangle fan to close the end of a cylinder / cone + void CreateCylinderCap(VertexCollection& vertices, IndexCollection& indices, size_t tessellation, float height, float radius, bool isTop) + { + // Create cap indices. + for (size_t i = 0; i < tessellation - 2; i++) + { + size_t i1 = (i + 1) % tessellation; + size_t i2 = (i + 2) % tessellation; + + if (isTop) + { + std::swap(i1, i2); + } + + size_t vbase = vertices.size(); + index_push_back(indices, vbase); + index_push_back(indices, vbase + i1); + index_push_back(indices, vbase + i2); + } + + // Which end of the cylinder is this? + XMVECTOR normal = g_XMIdentityR1; + XMVECTOR textureScale = g_XMNegativeOneHalf; + + if (!isTop) + { + normal = -normal; + textureScale *= g_XMNegateX; + } + + // Create cap vertices. + for (size_t i = 0; i < tessellation; i++) + { + XMVECTOR circleVector = GetCircleVector(i, tessellation); + + XMVECTOR position = (circleVector * radius) + (normal * height); + + XMVECTOR textureCoordinate = XMVectorMultiplyAdd(XMVectorSwizzle<0, 2, 3, 3>(circleVector), textureScale, g_XMOneHalf); + + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); + } + } +} + +void DirectX::ComputeCylinder(VertexCollection& vertices, IndexCollection& indices, float height, float diameter, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + height /= 2; + + XMVECTOR topOffset = g_XMIdentityR1 * height; + + float radius = diameter / 2; + size_t stride = tessellation + 1; + + // Create a ring of triangles around the outside of the cylinder. + for (size_t i = 0; i <= tessellation; i++) + { + XMVECTOR normal = GetCircleVector(i, tessellation); + + XMVECTOR sideOffset = normal * radius; + + float u = (float)i / tessellation; + + XMVECTOR textureCoordinate = XMLoadFloat(&u); + + vertices.push_back(VertexPositionNormalTexture(sideOffset + topOffset, normal, textureCoordinate)); + vertices.push_back(VertexPositionNormalTexture(sideOffset - topOffset, normal, textureCoordinate + g_XMIdentityR1)); + + index_push_back(indices, i * 2); + index_push_back(indices, (i * 2 + 2) % (stride * 2)); + index_push_back(indices, i * 2 + 1); + + index_push_back(indices, i * 2 + 1); + index_push_back(indices, (i * 2 + 2) % (stride * 2)); + index_push_back(indices, (i * 2 + 3) % (stride * 2)); + } + + // Create flat triangle fan caps to seal the top and bottom. + CreateCylinderCap(vertices, indices, tessellation, height, radius, true); + CreateCylinderCap(vertices, indices, tessellation, height, radius, false); + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +// Creates a cone primitive. +void DirectX::ComputeCone(VertexCollection& vertices, IndexCollection& indices, float diameter, float height, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + height /= 2; + + XMVECTOR topOffset = g_XMIdentityR1 * height; + + float radius = diameter / 2; + size_t stride = tessellation + 1; + + // Create a ring of triangles around the outside of the cone. + for (size_t i = 0; i <= tessellation; i++) + { + XMVECTOR circlevec = GetCircleVector(i, tessellation); + + XMVECTOR sideOffset = circlevec * radius; + + float u = (float)i / tessellation; + + XMVECTOR textureCoordinate = XMLoadFloat(&u); + + XMVECTOR pt = sideOffset - topOffset; + + XMVECTOR normal = XMVector3Cross(GetCircleTangent(i, tessellation), topOffset - pt); + normal = XMVector3Normalize(normal); + + // Duplicate the top vertex for distinct normals + vertices.push_back(VertexPositionNormalTexture(topOffset, normal, g_XMZero)); + vertices.push_back(VertexPositionNormalTexture(pt, normal, textureCoordinate + g_XMIdentityR1)); + + index_push_back(indices, i * 2); + index_push_back(indices, (i * 2 + 3) % (stride * 2)); + index_push_back(indices, (i * 2 + 1) % (stride * 2)); + } + + // Create flat triangle fan caps to seal the bottom. + CreateCylinderCap(vertices, indices, tessellation, height, radius, false); + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +//-------------------------------------------------------------------------------------- +// Torus +//-------------------------------------------------------------------------------------- +void DirectX::ComputeTorus(VertexCollection& vertices, IndexCollection& indices, float diameter, float thickness, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + size_t stride = tessellation + 1; + + // First we loop around the main ring of the torus. + for (size_t i = 0; i <= tessellation; i++) + { + float u = (float)i / tessellation; + + float outerAngle = i * XM_2PI / tessellation - XM_PIDIV2; + + // Create a transform matrix that will align geometry to + // slice perpendicularly though the current ring position. + XMMATRIX transform = XMMatrixTranslation(diameter / 2, 0, 0) * XMMatrixRotationY(outerAngle); + + // Now we loop along the other axis, around the side of the tube. + for (size_t j = 0; j <= tessellation; j++) + { + float v = 1 - (float)j / tessellation; + + float innerAngle = j * XM_2PI / tessellation + XM_PI; + float dx, dy; + + XMScalarSinCos(&dy, &dx, innerAngle); + + // Create a vertex. + XMVECTOR normal = XMVectorSet(dx, dy, 0, 0); + XMVECTOR position = normal * thickness / 2; + XMVECTOR textureCoordinate = XMVectorSet(u, v, 0, 0); + + position = XMVector3Transform(position, transform); + normal = XMVector3TransformNormal(normal, transform); + + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); + + // And create indices for two triangles. + size_t nextI = (i + 1) % stride; + size_t nextJ = (j + 1) % stride; + + index_push_back(indices, i * stride + j); + index_push_back(indices, i * stride + nextJ); + index_push_back(indices, nextI * stride + j); + + index_push_back(indices, i * stride + nextJ); + index_push_back(indices, nextI * stride + nextJ); + index_push_back(indices, nextI * stride + j); + } + } + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +//-------------------------------------------------------------------------------------- +// Tetrahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeTetrahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const XMVECTORF32 verts[4] = + { + { 0.f, 0.f, 1.f }, + { 2.f*SQRT2 / 3.f, 0.f, -1.f / 3.f }, + { -SQRT2 / 3.f, SQRT6 / 3.f, -1.f / 3.f }, + { -SQRT2 / 3.f, -SQRT6 / 3.f, -1.f / 3.f } + }; + + static const uint32_t faces[4 * 3] = + { + 0, 1, 2, + 0, 2, 3, + 0, 3, 1, + 1, 3, 2, + }; + + for (size_t j = 0; j < _countof(faces); j += 3) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMZero /* 0, 0 */)); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR0 /* 1, 0 */)); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR1 /* 0, 1 */)); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 4 * 3); + assert(indices.size() == 4 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Octahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeOctahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const XMVECTORF32 verts[6] = + { + { 1, 0, 0 }, + { -1, 0, 0 }, + { 0, 1, 0 }, + { 0, -1, 0 }, + { 0, 0, 1 }, + { 0, 0, -1 } + }; + + static const uint32_t faces[8 * 3] = + { + 4, 0, 2, + 4, 2, 1, + 4, 1, 3, + 4, 3, 0, + 5, 2, 0, + 5, 1, 2, + 5, 3, 1, + 5, 0, 3 + }; + + for (size_t j = 0; j < _countof(faces); j += 3) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMZero /* 0, 0 */)); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR0 /* 1, 0 */)); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR1 /* 0, 1*/)); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 8 * 3); + assert(indices.size() == 8 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Dodecahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeDodecahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const float a = 1.f / SQRT3; + static const float b = 0.356822089773089931942f; // sqrt( ( 3 - sqrt(5) ) / 6 ) + static const float c = 0.934172358962715696451f; // sqrt( ( 3 + sqrt(5) ) / 6 ); + + static const XMVECTORF32 verts[20] = + { + { a, a, a }, + { a, a, -a }, + { a, -a, a }, + { a, -a, -a }, + { -a, a, a }, + { -a, a, -a }, + { -a, -a, a }, + { -a, -a, -a }, + { b, c, 0 }, + { -b, c, 0 }, + { b, -c, 0 }, + { -b, -c, 0 }, + { c, 0, b }, + { c, 0, -b }, + { -c, 0, b }, + { -c, 0, -b }, + { 0, b, c }, + { 0, -b, c }, + { 0, b, -c }, + { 0, -b, -c } + }; + + static const uint32_t faces[12 * 5] = + { + 0, 8, 9, 4, 16, + 0, 16, 17, 2, 12, + 12, 2, 10, 3, 13, + 9, 5, 15, 14, 4, + 3, 19, 18, 1, 13, + 7, 11, 6, 14, 15, + 0, 12, 13, 1, 8, + 8, 1, 18, 5, 9, + 16, 4, 14, 6, 17, + 6, 11, 10, 2, 17, + 7, 15, 5, 18, 19, + 7, 19, 3, 10, 11, + }; + + static const XMVECTORF32 textureCoordinates[5] = + { + { 0.654508f, 0.0244717f }, + { 0.0954915f, 0.206107f }, + { 0.0954915f, 0.793893f }, + { 0.654508f, 0.975528f }, + { 1.f, 0.5f } + }; + + static const uint32_t textureIndex[12][5] = + { + { 0, 1, 2, 3, 4 }, + { 2, 3, 4, 0, 1 }, + { 4, 0, 1, 2, 3 }, + { 1, 2, 3, 4, 0 }, + { 2, 3, 4, 0, 1 }, + { 0, 1, 2, 3, 4 }, + { 1, 2, 3, 4, 0 }, + { 4, 0, 1, 2, 3 }, + { 4, 0, 1, 2, 3 }, + { 1, 2, 3, 4, 0 }, + { 0, 1, 2, 3, 4 }, + { 2, 3, 4, 0, 1 }, + }; + + size_t t = 0; + for (size_t j = 0; j < _countof(faces); j += 5, ++t) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + uint32_t v3 = faces[j + 3]; + uint32_t v4 = faces[j + 4]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + index_push_back(indices, base); + index_push_back(indices, base + 2); + index_push_back(indices, base + 3); + + index_push_back(indices, base); + index_push_back(indices, base + 3); + index_push_back(indices, base + 4); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][0]])); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][1]])); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][2]])); + + position = XMVectorScale(verts[v3], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][3]])); + + position = XMVectorScale(verts[v4], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][4]])); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 12 * 5); + assert(indices.size() == 12 * 3 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Icosahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeIcosahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const float t = 1.618033988749894848205f; // (1 + sqrt(5)) / 2 + static const float t2 = 1.519544995837552493271f; // sqrt( 1 + sqr( (1 + sqrt(5)) / 2 ) ) + + static const XMVECTORF32 verts[12] = + { + { t / t2, 1.f / t2, 0 }, + { -t / t2, 1.f / t2, 0 }, + { t / t2, -1.f / t2, 0 }, + { -t / t2, -1.f / t2, 0 }, + { 1.f / t2, 0, t / t2 }, + { 1.f / t2, 0, -t / t2 }, + { -1.f / t2, 0, t / t2 }, + { -1.f / t2, 0, -t / t2 }, + { 0, t / t2, 1.f / t2 }, + { 0, -t / t2, 1.f / t2 }, + { 0, t / t2, -1.f / t2 }, + { 0, -t / t2, -1.f / t2 } + }; + + static const uint32_t faces[20 * 3] = + { + 0, 8, 4, + 0, 5, 10, + 2, 4, 9, + 2, 11, 5, + 1, 6, 8, + 1, 10, 7, + 3, 9, 6, + 3, 7, 11, + 0, 10, 8, + 1, 8, 10, + 2, 9, 11, + 3, 11, 9, + 4, 2, 0, + 5, 0, 2, + 6, 1, 3, + 7, 3, 1, + 8, 6, 4, + 9, 4, 6, + 10, 5, 7, + 11, 7, 5 + }; + + for (size_t j = 0; j < _countof(faces); j += 3) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMZero /* 0, 0 */)); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR0 /* 1, 0 */)); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR1 /* 0, 1 */)); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 20 * 3); + assert(indices.size() == 20 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Teapot +//-------------------------------------------------------------------------------------- + +// Include the teapot control point data. +namespace +{ +#include "TeapotData.inc" + + // Tessellates the specified bezier patch. + void XM_CALLCONV TessellatePatch(VertexCollection& vertices, IndexCollection& indices, TeapotPatch const& patch, size_t tessellation, FXMVECTOR scale, bool isMirrored) + { + // Look up the 16 control points for this patch. + XMVECTOR controlPoints[16]; + + for (int i = 0; i < 16; i++) + { + controlPoints[i] = TeapotControlPoints[patch.indices[i]] * scale; + } + + // Create the index data. + size_t vbase = vertices.size(); + Bezier::CreatePatchIndices(tessellation, isMirrored, [&](size_t index) + { + index_push_back(indices, vbase + index); + }); + + // Create the vertex data. + Bezier::CreatePatchVertices(controlPoints, tessellation, isMirrored, [&](FXMVECTOR position, FXMVECTOR normal, FXMVECTOR textureCoordinate) + { + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); + }); + } +} + + +// Creates a teapot primitive. +void DirectX::ComputeTeapot(VertexCollection& vertices, IndexCollection& indices, float size, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 1) + throw std::out_of_range("tesselation parameter out of range"); + + XMVECTOR scaleVector = XMVectorReplicate(size); + + XMVECTOR scaleNegateX = scaleVector * g_XMNegateX; + XMVECTOR scaleNegateZ = scaleVector * g_XMNegateZ; + XMVECTOR scaleNegateXZ = scaleVector * g_XMNegateX * g_XMNegateZ; + + for (int i = 0; i < sizeof(TeapotPatches) / sizeof(TeapotPatches[0]); i++) + { + TeapotPatch const& patch = TeapotPatches[i]; + + // Because the teapot is symmetrical from left to right, we only store + // data for one side, then tessellate each patch twice, mirroring in X. + TessellatePatch(vertices, indices, patch, tessellation, scaleVector, false); + TessellatePatch(vertices, indices, patch, tessellation, scaleNegateX, true); + + if (patch.mirrorZ) + { + // Some parts of the teapot (the body, lid, and rim, but not the + // handle or spout) are also symmetrical from front to back, so + // we tessellate them four times, mirroring in Z as well as X. + TessellatePatch(vertices, indices, patch, tessellation, scaleNegateZ, true); + TessellatePatch(vertices, indices, patch, tessellation, scaleNegateXZ, false); + } + } + + // Built RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} \ No newline at end of file diff --git a/Kits/DirectXTK/Src/Geometry.h b/Kits/DirectXTK/Src/Geometry.h new file mode 100644 index 0000000000000000000000000000000000000000..2afc7d0f411cfc4f83e5dd5bdff4392fc793b9e0 --- /dev/null +++ b/Kits/DirectXTK/Src/Geometry.h @@ -0,0 +1,32 @@ +//-------------------------------------------------------------------------------------- +// File: Geometry.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "VertexTypes.h" + +namespace DirectX +{ + typedef std::vector VertexCollection; + typedef std::vector IndexCollection; + + void ComputeBox(VertexCollection& vertices, IndexCollection& indices, const XMFLOAT3& size, bool rhcoords, bool invertn); + void ComputeSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords, bool invertn); + void ComputeGeoSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords); + void ComputeCylinder(VertexCollection& vertices, IndexCollection& indices, float height, float diameter, size_t tessellation, bool rhcoords); + void ComputeCone(VertexCollection& vertices, IndexCollection& indices, float diameter, float height, size_t tessellation, bool rhcoords); + void ComputeTorus(VertexCollection& vertices, IndexCollection& indices, float diameter, float thickness, size_t tessellation, bool rhcoords); + void ComputeTetrahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeOctahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeDodecahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeIcosahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeTeapot(VertexCollection& vertices, IndexCollection& indices, float size, size_t tessellation, bool rhcoords); +} \ No newline at end of file diff --git a/Kits/DirectXTK/Src/LoaderHelpers.h b/Kits/DirectXTK/Src/LoaderHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..c12c0fe71cc37b326491c6f700c2118edf258ed7 --- /dev/null +++ b/Kits/DirectXTK/Src/LoaderHelpers.h @@ -0,0 +1,858 @@ +//-------------------------------------------------------------------------------------- +// File: LoaderHelpers.h +// +// Helper functions for texture loaders and screen grabber +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "DDS.h" +#include "DDSTextureLoader.h" + + +namespace DirectX +{ + //-------------------------------------------------------------------------------------- + // Return the BPP for a particular format + //-------------------------------------------------------------------------------------- + inline size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: + case DXGI_FORMAT_R32G32B32A32_FLOAT: + case DXGI_FORMAT_R32G32B32A32_UINT: + case DXGI_FORMAT_R32G32B32A32_SINT: + return 128; + + case DXGI_FORMAT_R32G32B32_TYPELESS: + case DXGI_FORMAT_R32G32B32_FLOAT: + case DXGI_FORMAT_R32G32B32_UINT: + case DXGI_FORMAT_R32G32B32_SINT: + return 96; + + case DXGI_FORMAT_R16G16B16A16_TYPELESS: + case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_UNORM: + case DXGI_FORMAT_R16G16B16A16_UINT: + case DXGI_FORMAT_R16G16B16A16_SNORM: + case DXGI_FORMAT_R16G16B16A16_SINT: + case DXGI_FORMAT_R32G32_TYPELESS: + case DXGI_FORMAT_R32G32_FLOAT: + case DXGI_FORMAT_R32G32_UINT: + case DXGI_FORMAT_R32G32_SINT: + case DXGI_FORMAT_R32G8X24_TYPELESS: + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: + case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: + case DXGI_FORMAT_Y416: + case DXGI_FORMAT_Y210: + case DXGI_FORMAT_Y216: + return 64; + + case DXGI_FORMAT_R10G10B10A2_TYPELESS: + case DXGI_FORMAT_R10G10B10A2_UNORM: + case DXGI_FORMAT_R10G10B10A2_UINT: + case DXGI_FORMAT_R11G11B10_FLOAT: + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + case DXGI_FORMAT_R8G8B8A8_UINT: + case DXGI_FORMAT_R8G8B8A8_SNORM: + case DXGI_FORMAT_R8G8B8A8_SINT: + case DXGI_FORMAT_R16G16_TYPELESS: + case DXGI_FORMAT_R16G16_FLOAT: + case DXGI_FORMAT_R16G16_UNORM: + case DXGI_FORMAT_R16G16_UINT: + case DXGI_FORMAT_R16G16_SNORM: + case DXGI_FORMAT_R16G16_SINT: + case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_FLOAT: + case DXGI_FORMAT_R32_UINT: + case DXGI_FORMAT_R32_SINT: + case DXGI_FORMAT_R24G8_TYPELESS: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X24_TYPELESS_G8_UINT: + case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8X8_UNORM: + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: + case DXGI_FORMAT_B8G8R8A8_TYPELESS: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + case DXGI_FORMAT_B8G8R8X8_TYPELESS: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: + case DXGI_FORMAT_AYUV: + case DXGI_FORMAT_Y410: + case DXGI_FORMAT_YUY2: + return 32; + + case DXGI_FORMAT_P010: + case DXGI_FORMAT_P016: + return 24; + + case DXGI_FORMAT_R8G8_TYPELESS: + case DXGI_FORMAT_R8G8_UNORM: + case DXGI_FORMAT_R8G8_UINT: + case DXGI_FORMAT_R8G8_SNORM: + case DXGI_FORMAT_R8G8_SINT: + case DXGI_FORMAT_R16_TYPELESS: + case DXGI_FORMAT_R16_FLOAT: + case DXGI_FORMAT_D16_UNORM: + case DXGI_FORMAT_R16_UNORM: + case DXGI_FORMAT_R16_UINT: + case DXGI_FORMAT_R16_SNORM: + case DXGI_FORMAT_R16_SINT: + case DXGI_FORMAT_B5G6R5_UNORM: + case DXGI_FORMAT_B5G5R5A1_UNORM: + case DXGI_FORMAT_A8P8: + case DXGI_FORMAT_B4G4R4A4_UNORM: + return 16; + + case DXGI_FORMAT_NV12: + case DXGI_FORMAT_420_OPAQUE: + case DXGI_FORMAT_NV11: + return 12; + + case DXGI_FORMAT_R8_TYPELESS: + case DXGI_FORMAT_R8_UNORM: + case DXGI_FORMAT_R8_UINT: + case DXGI_FORMAT_R8_SNORM: + case DXGI_FORMAT_R8_SINT: + case DXGI_FORMAT_A8_UNORM: + case DXGI_FORMAT_AI44: + case DXGI_FORMAT_IA44: + case DXGI_FORMAT_P8: + return 8; + + case DXGI_FORMAT_R1_UNORM: + return 1; + + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + return 4; + + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + return 8; + +#if defined(_XBOX_ONE) && defined(_TITLE) + + case DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT: + case DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT: + case DXGI_FORMAT_R10G10B10_SNORM_A2_UNORM: + return 32; + + case DXGI_FORMAT_D16_UNORM_S8_UINT: + case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X16_TYPELESS_G8_UINT: + return 24; + + case DXGI_FORMAT_R4G4_UNORM: + return 8; + +#endif // _XBOX_ONE && _TITLE + + default: + return 0; + } + } + + //-------------------------------------------------------------------------------------- + inline DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) + { + switch (format) + { + case DXGI_FORMAT_R8G8B8A8_UNORM: + return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + + case DXGI_FORMAT_BC1_UNORM: + return DXGI_FORMAT_BC1_UNORM_SRGB; + + case DXGI_FORMAT_BC2_UNORM: + return DXGI_FORMAT_BC2_UNORM_SRGB; + + case DXGI_FORMAT_BC3_UNORM: + return DXGI_FORMAT_BC3_UNORM_SRGB; + + case DXGI_FORMAT_B8G8R8A8_UNORM: + return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; + + case DXGI_FORMAT_B8G8R8X8_UNORM: + return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; + + case DXGI_FORMAT_BC7_UNORM: + return DXGI_FORMAT_BC7_UNORM_SRGB; + + default: + return format; + } + } + + //-------------------------------------------------------------------------------------- + inline bool IsCompressed(_In_ DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + return true; + + default: + return false; + } + } + + //-------------------------------------------------------------------------------------- + inline DXGI_FORMAT EnsureNotTypeless(DXGI_FORMAT fmt) + { + // Assumes UNORM or FLOAT; doesn't use UINT or SINT + switch (fmt) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: return DXGI_FORMAT_R32G32B32A32_FLOAT; + case DXGI_FORMAT_R32G32B32_TYPELESS: return DXGI_FORMAT_R32G32B32_FLOAT; + case DXGI_FORMAT_R16G16B16A16_TYPELESS: return DXGI_FORMAT_R16G16B16A16_UNORM; + case DXGI_FORMAT_R32G32_TYPELESS: return DXGI_FORMAT_R32G32_FLOAT; + case DXGI_FORMAT_R10G10B10A2_TYPELESS: return DXGI_FORMAT_R10G10B10A2_UNORM; + case DXGI_FORMAT_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_R16G16_TYPELESS: return DXGI_FORMAT_R16G16_UNORM; + case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_R32_FLOAT; + case DXGI_FORMAT_R8G8_TYPELESS: return DXGI_FORMAT_R8G8_UNORM; + case DXGI_FORMAT_R16_TYPELESS: return DXGI_FORMAT_R16_UNORM; + case DXGI_FORMAT_R8_TYPELESS: return DXGI_FORMAT_R8_UNORM; + case DXGI_FORMAT_BC1_TYPELESS: return DXGI_FORMAT_BC1_UNORM; + case DXGI_FORMAT_BC2_TYPELESS: return DXGI_FORMAT_BC2_UNORM; + case DXGI_FORMAT_BC3_TYPELESS: return DXGI_FORMAT_BC3_UNORM; + case DXGI_FORMAT_BC4_TYPELESS: return DXGI_FORMAT_BC4_UNORM; + case DXGI_FORMAT_BC5_TYPELESS: return DXGI_FORMAT_BC5_UNORM; + case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_B8G8R8X8_TYPELESS: return DXGI_FORMAT_B8G8R8X8_UNORM; + case DXGI_FORMAT_BC7_TYPELESS: return DXGI_FORMAT_BC7_UNORM; + default: return fmt; + } + } + + //-------------------------------------------------------------------------------------- + inline HRESULT LoadTextureDataFromFile(_In_z_ const wchar_t* fileName, + std::unique_ptr& ddsData, + DDS_HEADER** header, + uint8_t** bitData, + size_t* bitSize + ) + { + if (!header || !bitData || !bitSize) + { + return E_POINTER; + } + + // open the file +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + ScopedHandle hFile(safe_handle(CreateFile2(fileName, + GENERIC_READ, + FILE_SHARE_READ, + OPEN_EXISTING, + nullptr))); +#else + ScopedHandle hFile(safe_handle(CreateFileW(fileName, + GENERIC_READ, + FILE_SHARE_READ, + nullptr, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + nullptr))); +#endif + + if (!hFile) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + // Get the file size + FILE_STANDARD_INFO fileInfo; + if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo))) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + // File is too big for 32-bit allocation, so reject read + if (fileInfo.EndOfFile.HighPart > 0) + { + return E_FAIL; + } + + // Need at least enough data to fill the header and magic number to be a valid DDS + if (fileInfo.EndOfFile.LowPart < (sizeof(DDS_HEADER) + sizeof(uint32_t))) + { + return E_FAIL; + } + + // create enough space for the file data + ddsData.reset(new (std::nothrow) uint8_t[fileInfo.EndOfFile.LowPart]); + if (!ddsData) + { + return E_OUTOFMEMORY; + } + + // read the data in + DWORD BytesRead = 0; + if (!ReadFile(hFile.get(), + ddsData.get(), + fileInfo.EndOfFile.LowPart, + &BytesRead, + nullptr + )) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + if (BytesRead < fileInfo.EndOfFile.LowPart) + { + return E_FAIL; + } + + // DDS files always start with the same magic number ("DDS ") + uint32_t dwMagicNumber = *(const uint32_t*)(ddsData.get()); + if (dwMagicNumber != DDS_MAGIC) + { + return E_FAIL; + } + + auto hdr = reinterpret_cast(ddsData.get() + sizeof(uint32_t)); + + // Verify header to validate DDS file + if (hdr->size != sizeof(DDS_HEADER) || + hdr->ddspf.size != sizeof(DDS_PIXELFORMAT)) + { + return E_FAIL; + } + + // Check for DX10 extension + bool bDXT10Header = false; + if ((hdr->ddspf.flags & DDS_FOURCC) && + (MAKEFOURCC('D', 'X', '1', '0') == hdr->ddspf.fourCC)) + { + // Must be long enough for both headers and magic value + if (fileInfo.EndOfFile.LowPart < (sizeof(DDS_HEADER) + sizeof(uint32_t) + sizeof(DDS_HEADER_DXT10))) + { + return E_FAIL; + } + + bDXT10Header = true; + } + + // setup the pointers in the process request + *header = hdr; + ptrdiff_t offset = sizeof(uint32_t) + sizeof(DDS_HEADER) + + (bDXT10Header ? sizeof(DDS_HEADER_DXT10) : 0); + *bitData = ddsData.get() + offset; + *bitSize = fileInfo.EndOfFile.LowPart - offset; + + return S_OK; + } + + //-------------------------------------------------------------------------------------- + // Get surface information for a particular format + //-------------------------------------------------------------------------------------- + inline void GetSurfaceInfo(_In_ size_t width, + _In_ size_t height, + _In_ DXGI_FORMAT fmt, + _Out_opt_ size_t* outNumBytes, + _Out_opt_ size_t* outRowBytes, + _Out_opt_ size_t* outNumRows) + { + size_t numBytes = 0; + size_t rowBytes = 0; + size_t numRows = 0; + + bool bc = false; + bool packed = false; + bool planar = false; + size_t bpe = 0; + switch (fmt) + { + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + bc = true; + bpe = 8; + break; + + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + bc = true; + bpe = 16; + break; + + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: + case DXGI_FORMAT_YUY2: + packed = true; + bpe = 4; + break; + + case DXGI_FORMAT_Y210: + case DXGI_FORMAT_Y216: + packed = true; + bpe = 8; + break; + + case DXGI_FORMAT_NV12: + case DXGI_FORMAT_420_OPAQUE: + planar = true; + bpe = 2; + break; + + case DXGI_FORMAT_P010: + case DXGI_FORMAT_P016: + planar = true; + bpe = 4; + break; + +#if defined(_XBOX_ONE) && defined(_TITLE) + + case DXGI_FORMAT_D16_UNORM_S8_UINT: + case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X16_TYPELESS_G8_UINT: + planar = true; + bpe = 4; + break; + +#endif + } + + if (bc) + { + size_t numBlocksWide = 0; + if (width > 0) + { + numBlocksWide = std::max(1, (width + 3) / 4); + } + size_t numBlocksHigh = 0; + if (height > 0) + { + numBlocksHigh = std::max(1, (height + 3) / 4); + } + rowBytes = numBlocksWide * bpe; + numRows = numBlocksHigh; + numBytes = rowBytes * numBlocksHigh; + } + else if (packed) + { + rowBytes = ((width + 1) >> 1) * bpe; + numRows = height; + numBytes = rowBytes * height; + } + else if (fmt == DXGI_FORMAT_NV11) + { + rowBytes = ((width + 3) >> 2) * 4; + numRows = height * 2; // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data + numBytes = rowBytes * numRows; + } + else if (planar) + { + rowBytes = ((width + 1) >> 1) * bpe; + numBytes = (rowBytes * height) + ((rowBytes * height + 1) >> 1); + numRows = height + ((height + 1) >> 1); + } + else + { + size_t bpp = BitsPerPixel(fmt); + rowBytes = (width * bpp + 7) / 8; // round up to nearest byte + numRows = height; + numBytes = rowBytes * height; + } + + if (outNumBytes) + { + *outNumBytes = numBytes; + } + if (outRowBytes) + { + *outRowBytes = rowBytes; + } + if (outNumRows) + { + *outNumRows = numRows; + } + } + + //-------------------------------------------------------------------------------------- + #define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a ) + + inline DXGI_FORMAT GetDXGIFormat(const DDS_PIXELFORMAT& ddpf) + { + if (ddpf.flags & DDS_RGB) + { + // Note that sRGB formats are written using the "DX10" extended header + + switch (ddpf.RGBBitCount) + { + case 32: + if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) + { + return DXGI_FORMAT_R8G8B8A8_UNORM; + } + + if (ISBITMASK(0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000)) + { + return DXGI_FORMAT_B8G8R8A8_UNORM; + } + + if (ISBITMASK(0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000)) + { + return DXGI_FORMAT_B8G8R8X8_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x000000ff,0x0000ff00,0x00ff0000,0x00000000) aka D3DFMT_X8B8G8R8 + + // Note that many common DDS reader/writers (including D3DX) swap the + // the RED/BLUE masks for 10:10:10:2 formats. We assume + // below that the 'backwards' header mask is being used since it is most + // likely written by D3DX. The more robust solution is to use the 'DX10' + // header extension and specify the DXGI_FORMAT_R10G10B10A2_UNORM format directly + + // For 'correct' writers, this should be 0x000003ff,0x000ffc00,0x3ff00000 for RGB data + if (ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000)) + { + return DXGI_FORMAT_R10G10B10A2_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x000003ff,0x000ffc00,0x3ff00000,0xc0000000) aka D3DFMT_A2R10G10B10 + + if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R16G16_UNORM; + } + + if (ISBITMASK(0xffffffff, 0x00000000, 0x00000000, 0x00000000)) + { + // Only 32-bit color channel format in D3D9 was R32F + return DXGI_FORMAT_R32_FLOAT; // D3DX writes this out as a FourCC of 114 + } + break; + + case 24: + // No 24bpp DXGI formats aka D3DFMT_R8G8B8 + break; + + case 16: + if (ISBITMASK(0x7c00, 0x03e0, 0x001f, 0x8000)) + { + return DXGI_FORMAT_B5G5R5A1_UNORM; + } + if (ISBITMASK(0xf800, 0x07e0, 0x001f, 0x0000)) + { + return DXGI_FORMAT_B5G6R5_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x7c00,0x03e0,0x001f,0x0000) aka D3DFMT_X1R5G5B5 + + if (ISBITMASK(0x0f00, 0x00f0, 0x000f, 0xf000)) + { + return DXGI_FORMAT_B4G4R4A4_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x0f00,0x00f0,0x000f,0x0000) aka D3DFMT_X4R4G4B4 + + // No 3:3:2, 3:3:2:8, or paletted DXGI formats aka D3DFMT_A8R3G3B2, D3DFMT_R3G3B2, D3DFMT_P8, D3DFMT_A8P8, etc. + break; + } + } + else if (ddpf.flags & DDS_LUMINANCE) + { + if (8 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x000000ff, 0x00000000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R8_UNORM; // D3DX10/11 writes this out as DX10 extension + } + + // No DXGI format maps to ISBITMASK(0x0f,0x00,0x00,0xf0) aka D3DFMT_A4L4 + } + + if (16 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x0000ffff, 0x00000000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R16_UNORM; // D3DX10/11 writes this out as DX10 extension + } + if (ISBITMASK(0x000000ff, 0x00000000, 0x00000000, 0x0000ff00)) + { + return DXGI_FORMAT_R8G8_UNORM; // D3DX10/11 writes this out as DX10 extension + } + } + } + else if (ddpf.flags & DDS_ALPHA) + { + if (8 == ddpf.RGBBitCount) + { + return DXGI_FORMAT_A8_UNORM; + } + } + else if (ddpf.flags & DDS_BUMPDUDV) + { + if (16 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x00ff, 0xff00, 0x0000, 0x0000)) + { + return DXGI_FORMAT_R8G8_SNORM; // D3DX10/11 writes this out as DX10 extension + } + } + + if (32 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) + { + return DXGI_FORMAT_R8G8B8A8_SNORM; // D3DX10/11 writes this out as DX10 extension + } + if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R16G16_SNORM; // D3DX10/11 writes this out as DX10 extension + } + + // No DXGI format maps to ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000) aka D3DFMT_A2W10V10U10 + } + } + else if (ddpf.flags & DDS_FOURCC) + { + if (MAKEFOURCC('D', 'X', 'T', '1') == ddpf.fourCC) + { + return DXGI_FORMAT_BC1_UNORM; + } + if (MAKEFOURCC('D', 'X', 'T', '3') == ddpf.fourCC) + { + return DXGI_FORMAT_BC2_UNORM; + } + if (MAKEFOURCC('D', 'X', 'T', '5') == ddpf.fourCC) + { + return DXGI_FORMAT_BC3_UNORM; + } + + // While pre-multiplied alpha isn't directly supported by the DXGI formats, + // they are basically the same as these BC formats so they can be mapped + if (MAKEFOURCC('D', 'X', 'T', '2') == ddpf.fourCC) + { + return DXGI_FORMAT_BC2_UNORM; + } + if (MAKEFOURCC('D', 'X', 'T', '4') == ddpf.fourCC) + { + return DXGI_FORMAT_BC3_UNORM; + } + + if (MAKEFOURCC('A', 'T', 'I', '1') == ddpf.fourCC) + { + return DXGI_FORMAT_BC4_UNORM; + } + if (MAKEFOURCC('B', 'C', '4', 'U') == ddpf.fourCC) + { + return DXGI_FORMAT_BC4_UNORM; + } + if (MAKEFOURCC('B', 'C', '4', 'S') == ddpf.fourCC) + { + return DXGI_FORMAT_BC4_SNORM; + } + + if (MAKEFOURCC('A', 'T', 'I', '2') == ddpf.fourCC) + { + return DXGI_FORMAT_BC5_UNORM; + } + if (MAKEFOURCC('B', 'C', '5', 'U') == ddpf.fourCC) + { + return DXGI_FORMAT_BC5_UNORM; + } + if (MAKEFOURCC('B', 'C', '5', 'S') == ddpf.fourCC) + { + return DXGI_FORMAT_BC5_SNORM; + } + + // BC6H and BC7 are written using the "DX10" extended header + + if (MAKEFOURCC('R', 'G', 'B', 'G') == ddpf.fourCC) + { + return DXGI_FORMAT_R8G8_B8G8_UNORM; + } + if (MAKEFOURCC('G', 'R', 'G', 'B') == ddpf.fourCC) + { + return DXGI_FORMAT_G8R8_G8B8_UNORM; + } + + if (MAKEFOURCC('Y', 'U', 'Y', '2') == ddpf.fourCC) + { + return DXGI_FORMAT_YUY2; + } + + // Check for D3DFORMAT enums being set here + switch (ddpf.fourCC) + { + case 36: // D3DFMT_A16B16G16R16 + return DXGI_FORMAT_R16G16B16A16_UNORM; + + case 110: // D3DFMT_Q16W16V16U16 + return DXGI_FORMAT_R16G16B16A16_SNORM; + + case 111: // D3DFMT_R16F + return DXGI_FORMAT_R16_FLOAT; + + case 112: // D3DFMT_G16R16F + return DXGI_FORMAT_R16G16_FLOAT; + + case 113: // D3DFMT_A16B16G16R16F + return DXGI_FORMAT_R16G16B16A16_FLOAT; + + case 114: // D3DFMT_R32F + return DXGI_FORMAT_R32_FLOAT; + + case 115: // D3DFMT_G32R32F + return DXGI_FORMAT_R32G32_FLOAT; + + case 116: // D3DFMT_A32B32G32R32F + return DXGI_FORMAT_R32G32B32A32_FLOAT; + } + } + + return DXGI_FORMAT_UNKNOWN; + } + + #undef ISBITMASK + + //-------------------------------------------------------------------------------------- + inline DirectX::DDS_ALPHA_MODE GetAlphaMode(_In_ const DDS_HEADER* header) + { + if (header->ddspf.flags & DDS_FOURCC) + { + if (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC) + { + auto d3d10ext = reinterpret_cast((const char*)header + sizeof(DDS_HEADER)); + auto mode = static_cast(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK); + switch (mode) + { + case DDS_ALPHA_MODE_STRAIGHT: + case DDS_ALPHA_MODE_PREMULTIPLIED: + case DDS_ALPHA_MODE_OPAQUE: + case DDS_ALPHA_MODE_CUSTOM: + return mode; + } + } + else if ((MAKEFOURCC('D', 'X', 'T', '2') == header->ddspf.fourCC) + || (MAKEFOURCC('D', 'X', 'T', '4') == header->ddspf.fourCC)) + { + return DDS_ALPHA_MODE_PREMULTIPLIED; + } + } + + return DDS_ALPHA_MODE_UNKNOWN; + } + + //-------------------------------------------------------------------------------------- + class auto_delete_file + { + public: + auto_delete_file(HANDLE hFile) : m_handle(hFile) {} + + auto_delete_file(const auto_delete_file&) = delete; + auto_delete_file& operator=(const auto_delete_file&) = delete; + + ~auto_delete_file() + { + if (m_handle) + { + FILE_DISPOSITION_INFO info = {}; + info.DeleteFile = TRUE; + (void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); + } + } + + void clear() { m_handle = 0; } + + private: + HANDLE m_handle; + }; + + class auto_delete_file_wic + { + public: + auto_delete_file_wic(Microsoft::WRL::ComPtr& hFile, LPCWSTR szFile) : m_handle(hFile), m_filename(szFile) {} + + auto_delete_file_wic(const auto_delete_file_wic&) = delete; + auto_delete_file_wic& operator=(const auto_delete_file_wic&) = delete; + + ~auto_delete_file_wic() + { + if (m_filename) + { + m_handle.Reset(); + DeleteFileW(m_filename); + } + } + + void clear() { m_filename = 0; } + + private: + LPCWSTR m_filename; + Microsoft::WRL::ComPtr& m_handle; + }; +} \ No newline at end of file diff --git a/Kits/DirectXTK/Src/ModelLoadSDKMESH.cpp b/Kits/DirectXTK/Src/ModelLoadSDKMESH.cpp index 497dc1ed7aea812c21a9aca5ac8a847739c4203e..b0e9e699731e36494dc82a4e9e5cb6f3cbba593e 100644 --- a/Kits/DirectXTK/Src/ModelLoadSDKMESH.cpp +++ b/Kits/DirectXTK/Src/ModelLoadSDKMESH.cpp @@ -21,621 +21,280 @@ #include "PlatformHelpers.h" #include "BinaryReader.h" +#include "SDKMesh.h" + using namespace DirectX; using Microsoft::WRL::ComPtr; -#pragma warning(disable : 4121) - -//-------------------------------------------------------------------------------------- -// SDKMESH format is generated by the legacy DirectX SDK's Content Exporter and -// originally rendered by the DXUT helper class SDKMesh -// -// http://go.microsoft.com/fwlink/?LinkId=226208 -//-------------------------------------------------------------------------------------- -namespace DXUT +namespace { - // .SDKMESH files - - // SDKMESH_HEADER - // SDKMESH_VERTEX_BUFFER_HEADER header->VertexStreamHeadersOffset - // SDKMESH_INDEX_BUFFER_HEADER header->IndexStreamHeadersOffset - // SDKMESH_MESH header->MeshDataOffset - // SDKMESH_SUBSET header->SubsetDataOffset - // SDKMESH_FRAME header->FrameDataOffset - // SDKMESH_MATERIAL header->MaterialDataOffset - // [header->NonBufferDataSize] - // { [ header->NumVertexBuffers] - // VB data - // } - // { [ header->NumIndexBuffers] - // IB data - // } - - - // .SDDKANIM files - - // SDKANIMATION_FILE_HEADER - // BYTE[] - Length of fileheader->AnimationDataSize - - // .SDKMESH uses Direct3D 9 decls, but only a subset of these is ever generated by the legacy DirectX SDK Content Exporter - - // D3DDECLUSAGE_POSITION / D3DDECLTYPE_FLOAT3 - // (D3DDECLUSAGE_BLENDWEIGHT / D3DDECLTYPE_UBYTE4N - // D3DDECLUSAGE_BLENDINDICES / D3DDECLTYPE_UBYTE4)? - // (D3DDECLUSAGE_NORMAL / D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_SHORT4N, D3DDECLTYPE_UBYTE4N, or D3DDECLTYPE_DEC3N [not supported])? - // (D3DDECLUSAGE_COLOR / D3DDECLTYPE_D3DCOLOR)? - // (D3DDECLUSAGE_TEXCOORD / D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT2 or D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT3 or D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT4 or D3DDECLTYPE_FLOAT16_4)* - // (D3DDECLUSAGE_TANGENT / same as D3DDECLUSAGE_NORMAL)? - // (D3DDECLUSAGE_BINORMAL / same as D3DDECLUSAGE_NORMAL)? - - enum D3DDECLUSAGE - { - D3DDECLUSAGE_POSITION = 0, - D3DDECLUSAGE_BLENDWEIGHT =1, - D3DDECLUSAGE_BLENDINDICES =2, - D3DDECLUSAGE_NORMAL =3, - D3DDECLUSAGE_TEXCOORD = 5, - D3DDECLUSAGE_TANGENT = 6, - D3DDECLUSAGE_BINORMAL = 7, - D3DDECLUSAGE_COLOR = 10, - }; - - enum D3DDECLTYPE - { - D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) - D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) - D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) - D3DDECLTYPE_FLOAT4 = 3, // 4D float - D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range - // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) - D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte - D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 - D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) - // Note: There is no equivalent to D3DDECLTYPE_DEC3N (14) as a DXGI_FORMAT - D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) - D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values - - D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. - }; - - #pragma pack(push,4) - - struct D3DVERTEXELEMENT9 + struct MaterialRecordSDKMESH { - WORD Stream; // Stream index - WORD Offset; // Offset in the stream in bytes - BYTE Type; // Data type - BYTE Method; // Processing method - BYTE Usage; // Semantics - BYTE UsageIndex; // Semantic index + std::shared_ptr effect; + bool alpha; }; - #pragma pack(pop) - - //-------------------------------------------------------------------------------------- - // Hard Defines for the various structures - //-------------------------------------------------------------------------------------- - const uint32_t SDKMESH_FILE_VERSION = 101; - const uint32_t MAX_VERTEX_ELEMENTS = 32; - const uint32_t MAX_VERTEX_STREAMS = 16; - const uint32_t MAX_FRAME_NAME = 100; - const uint32_t MAX_MESH_NAME = 100; - const uint32_t MAX_SUBSET_NAME = 100; - const uint32_t MAX_MATERIAL_NAME = 100; - const uint32_t MAX_TEXTURE_NAME = MAX_PATH; - const uint32_t MAX_MATERIAL_PATH = MAX_PATH; - const uint32_t INVALID_FRAME = uint32_t(-1); - const uint32_t INVALID_MESH = uint32_t(-1); - const uint32_t INVALID_MATERIAL = uint32_t(-1); - const uint32_t INVALID_SUBSET = uint32_t(-1); - const uint32_t INVALID_ANIMATION_DATA = uint32_t(-1); - const uint32_t INVALID_SAMPLER_SLOT = uint32_t(-1); - const uint32_t ERROR_RESOURCE_VALUE = 1; - - template bool IsErrorResource( TYPE data ) - { - if( ( TYPE )ERROR_RESOURCE_VALUE == data ) - return true; - return false; - } - - //-------------------------------------------------------------------------------------- - // Enumerated Types. These will have mirrors in both D3D9 and D3D11 - //-------------------------------------------------------------------------------------- - enum SDKMESH_PRIMITIVE_TYPE + void LoadMaterial(_In_ const DXUT::SDKMESH_MATERIAL& mh, + _In_ bool perVertexColor, _In_ bool enableSkinning, _In_ bool enableDualTexture, + _Inout_ IEffectFactory& fxFactory, _Inout_ MaterialRecordSDKMESH& m) { - PT_TRIANGLE_LIST = 0, - PT_TRIANGLE_STRIP, - PT_LINE_LIST, - PT_LINE_STRIP, - PT_POINT_LIST, - PT_TRIANGLE_LIST_ADJ, - PT_TRIANGLE_STRIP_ADJ, - PT_LINE_LIST_ADJ, - PT_LINE_STRIP_ADJ, - PT_QUAD_PATCH_LIST, - PT_TRIANGLE_PATCH_LIST, - }; + wchar_t matName[DXUT::MAX_MATERIAL_NAME]; + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mh.Name, -1, matName, DXUT::MAX_MATERIAL_NAME); - enum SDKMESH_INDEX_TYPE - { - IT_16BIT = 0, - IT_32BIT, - }; + wchar_t txtName[DXUT::MAX_TEXTURE_NAME]; + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mh.DiffuseTexture, -1, txtName, DXUT::MAX_TEXTURE_NAME); - enum FRAME_TRANSFORM_TYPE - { - FTT_RELATIVE = 0, - FTT_ABSOLUTE, //This is not currently used but is here to support absolute transformations in the future - }; + wchar_t txtName2[DXUT::MAX_TEXTURE_NAME]; + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mh.SpecularTexture, -1, txtName2, DXUT::MAX_TEXTURE_NAME); - //-------------------------------------------------------------------------------------- - // Structures. - //-------------------------------------------------------------------------------------- - #pragma pack(push,8) + if (!mh.SpecularTexture[0] && enableDualTexture) + { + DebugTrace("WARNING: Material '%s' has multiple texture coords but not multiple textures\n", mh.Name); + enableDualTexture = false; + } - struct SDKMESH_HEADER - { - //Basic Info and sizes - UINT Version; - BYTE IsBigEndian; - UINT64 HeaderSize; - UINT64 NonBufferDataSize; - UINT64 BufferDataSize; - - //Stats - UINT NumVertexBuffers; - UINT NumIndexBuffers; - UINT NumMeshes; - UINT NumTotalSubsets; - UINT NumFrames; - UINT NumMaterials; - - //Offsets to Data - UINT64 VertexStreamHeadersOffset; - UINT64 IndexStreamHeadersOffset; - UINT64 MeshDataOffset; - UINT64 SubsetDataOffset; - UINT64 FrameDataOffset; - UINT64 MaterialDataOffset; - }; + EffectFactory::EffectInfo info; + info.name = matName; + info.perVertexColor = perVertexColor; + info.enableSkinning = enableSkinning; + info.enableDualTexture = enableDualTexture; + info.ambientColor = XMFLOAT3(mh.Ambient.x, mh.Ambient.y, mh.Ambient.z); + info.diffuseColor = XMFLOAT3(mh.Diffuse.x, mh.Diffuse.y, mh.Diffuse.z); + info.emissiveColor = XMFLOAT3(mh.Emissive.x, mh.Emissive.y, mh.Emissive.z); - struct SDKMESH_VERTEX_BUFFER_HEADER - { - UINT64 NumVertices; - UINT64 SizeBytes; - UINT64 StrideBytes; - D3DVERTEXELEMENT9 Decl[MAX_VERTEX_ELEMENTS]; - union + if (mh.Diffuse.w != 1.f && mh.Diffuse.w != 0.f) { - UINT64 DataOffset; - ID3D11Buffer* pVB11; - }; - }; + info.alpha = mh.Diffuse.w; + } + else + info.alpha = 1.f; - struct SDKMESH_INDEX_BUFFER_HEADER - { - UINT64 NumIndices; - UINT64 SizeBytes; - UINT IndexType; - union + if (mh.Power) { - UINT64 DataOffset; - ID3D11Buffer* pIB11; - }; - }; - - struct SDKMESH_MESH - { - char Name[MAX_MESH_NAME]; - BYTE NumVertexBuffers; - UINT VertexBuffers[MAX_VERTEX_STREAMS]; - UINT IndexBuffer; - UINT NumSubsets; - UINT NumFrameInfluences; //aka bones + info.specularPower = mh.Power; + info.specularColor = XMFLOAT3(mh.Specular.x, mh.Specular.y, mh.Specular.z); + } - DirectX::XMFLOAT3 BoundingBoxCenter; - DirectX::XMFLOAT3 BoundingBoxExtents; + info.texture = txtName; + info.texture2 = txtName2; - union - { - UINT64 SubsetOffset; - INT* pSubsets; - }; - union - { - UINT64 FrameInfluenceOffset; - UINT* pFrameInfluences; - }; - }; + m.effect = fxFactory.CreateEffect(info, nullptr); + m.alpha = (info.alpha < 1.f); + } - struct SDKMESH_SUBSET - { - char Name[MAX_SUBSET_NAME]; - UINT MaterialID; - UINT PrimitiveType; - UINT64 IndexStart; - UINT64 IndexCount; - UINT64 VertexStart; - UINT64 VertexCount; - }; - struct SDKMESH_FRAME - { - char Name[MAX_FRAME_NAME]; - UINT Mesh; - UINT ParentFrame; - UINT ChildFrame; - UINT SiblingFrame; - DirectX::XMFLOAT4X4 Matrix; - UINT AnimationDataIndex; //Used to index which set of keyframes transforms this frame - }; + //-------------------------------------------------------------------------------------- + // Direct3D 9 Vertex Declaration to Direct3D 11 Input Layout mapping - struct SDKMESH_MATERIAL + void GetInputLayoutDesc(_In_reads_(32) const DXUT::D3DVERTEXELEMENT9 decl[], std::vector& inputDesc, + bool &perVertexColor, bool& enableSkinning, bool& dualTexture) { - char Name[MAX_MATERIAL_NAME]; - - // Use MaterialInstancePath - char MaterialInstancePath[MAX_MATERIAL_PATH]; - - // Or fall back to d3d8-type materials - char DiffuseTexture[MAX_TEXTURE_NAME]; - char NormalTexture[MAX_TEXTURE_NAME]; - char SpecularTexture[MAX_TEXTURE_NAME]; - - DirectX::XMFLOAT4 Diffuse; - DirectX::XMFLOAT4 Ambient; - DirectX::XMFLOAT4 Specular; - DirectX::XMFLOAT4 Emissive; - FLOAT Power; - - union + static const D3D11_INPUT_ELEMENT_DESC elements[] = { - UINT64 Force64_1; //Force the union to 64bits - ID3D11Texture2D* pDiffuseTexture11; - }; - union - { - UINT64 Force64_2; //Force the union to 64bits - ID3D11Texture2D* pNormalTexture11; - }; - union - { - UINT64 Force64_3; //Force the union to 64bits - ID3D11Texture2D* pSpecularTexture11; + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BINORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BLENDINDICES",0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BLENDWEIGHT", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; - union - { - UINT64 Force64_4; //Force the union to 64bits - ID3D11ShaderResourceView* pDiffuseRV11; - }; - union - { - UINT64 Force64_5; //Force the union to 64bits - ID3D11ShaderResourceView* pNormalRV11; - }; - union - { - UINT64 Force64_6; //Force the union to 64bits - ID3D11ShaderResourceView* pSpecularRV11; - }; - }; + using namespace DXUT; - struct SDKANIMATION_FILE_HEADER - { - UINT Version; - BYTE IsBigEndian; - UINT FrameTransformType; - UINT NumFrames; - UINT NumAnimationKeys; - UINT AnimationFPS; - UINT64 AnimationDataSize; - UINT64 AnimationDataOffset; - }; + uint32_t offset = 0; + uint32_t texcoords = 0; - struct SDKANIMATION_DATA - { - DirectX::XMFLOAT3 Translation; - DirectX::XMFLOAT4 Orientation; - DirectX::XMFLOAT3 Scaling; - }; + bool posfound = false; - struct SDKANIMATION_FRAME_DATA - { - char FrameName[MAX_FRAME_NAME]; - union + for (uint32_t index = 0; index < DXUT::MAX_VERTEX_ELEMENTS; ++index) { - UINT64 DataOffset; - SDKANIMATION_DATA* pAnimationData; - }; - }; - - #pragma pack(pop) - -}; // namespace - -static_assert( sizeof(DXUT::D3DVERTEXELEMENT9) == 8, "Direct3D9 Decl structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_HEADER)== 104, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_VERTEX_BUFFER_HEADER) == 288, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_INDEX_BUFFER_HEADER) == 32, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_MESH) == 224, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_SUBSET) == 144, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_FRAME) == 184, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKMESH_MATERIAL) == 1256, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKANIMATION_FILE_HEADER) == 40, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKANIMATION_DATA) == 40, "SDK Mesh structure size incorrect" ); -static_assert( sizeof(DXUT::SDKANIMATION_FRAME_DATA) == 112, "SDK Mesh structure size incorrect" ); - - -//-------------------------------------------------------------------------------------- -struct MaterialRecordSDKMESH -{ - std::shared_ptr effect; - bool alpha; -}; - - -static void LoadMaterial( _In_ const DXUT::SDKMESH_MATERIAL& mh, - _In_ bool perVertexColor, _In_ bool enableSkinning, _In_ bool enableDualTexture, - _Inout_ IEffectFactory& fxFactory, _Inout_ MaterialRecordSDKMESH& m ) -{ - wchar_t matName[ DXUT::MAX_MATERIAL_NAME ]; - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, mh.Name, -1, matName, DXUT::MAX_MATERIAL_NAME ); - - wchar_t txtName[ DXUT::MAX_TEXTURE_NAME ]; - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, mh.DiffuseTexture, -1, txtName, DXUT::MAX_TEXTURE_NAME ); - - wchar_t txtName2[ DXUT::MAX_TEXTURE_NAME ]; - MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, mh.SpecularTexture, -1, txtName2, DXUT::MAX_TEXTURE_NAME ); - - if ( !mh.SpecularTexture[0] && enableDualTexture ) - { - DebugTrace("WARNING: Material '%s' has multiple texture coords but not multiple textures\n", mh.Name); - enableDualTexture = false; - } - - EffectFactory::EffectInfo info; - info.name = matName; - info.perVertexColor = perVertexColor; - info.enableSkinning = enableSkinning; - info.enableDualTexture = enableDualTexture; - info.ambientColor = XMFLOAT3( mh.Ambient.x, mh.Ambient.y, mh.Ambient.z ); - info.diffuseColor = XMFLOAT3( mh.Diffuse.x, mh.Diffuse.y, mh.Diffuse.z ); - info.emissiveColor= XMFLOAT3( mh.Emissive.x, mh.Emissive.y, mh.Emissive.z ); - - if ( mh.Diffuse.w != 1.f && mh.Diffuse.w != 0.f ) - { - info.alpha = mh.Diffuse.w; - } - else - info.alpha = 1.f; - - if ( mh.Power ) - { - info.specularPower = mh.Power; - info.specularColor = XMFLOAT3( mh.Specular.x, mh.Specular.y, mh.Specular.z ); - } - - info.texture = txtName; - info.texture2 = txtName2; - - m.effect = fxFactory.CreateEffect( info, nullptr ); - m.alpha = (info.alpha < 1.f); -} - - -//-------------------------------------------------------------------------------------- -// Direct3D 9 Vertex Declaration to DirectInput 11 Input Layout mapping - -static void GetInputLayoutDesc( _In_reads_(32) const DXUT::D3DVERTEXELEMENT9 decl[], std::vector& inputDesc, - bool &perVertexColor, bool& enableSkinning, bool& dualTexture ) -{ - static const D3D11_INPUT_ELEMENT_DESC elements[] = - { - { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "BINORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "BLENDINDICES",0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "BLENDWEIGHT", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - using namespace DXUT; - - uint32_t offset = 0; - uint32_t texcoords = 0; - - bool posfound = false; - - for( uint32_t index = 0; index < DXUT::MAX_VERTEX_ELEMENTS; ++index ) - { - if ( decl[index].Usage == 0xFF ) - break; + if (decl[index].Usage == 0xFF) + break; - if ( decl[index].Type == D3DDECLTYPE_UNUSED ) - break; + if (decl[index].Type == D3DDECLTYPE_UNUSED) + break; - if ( decl[index].Offset != offset ) - break; + if (decl[index].Offset != offset) + break; - if ( decl[index].Usage == D3DDECLUSAGE_POSITION && decl[index].Type == D3DDECLTYPE_FLOAT3 ) - { - inputDesc.push_back( elements[0] ); - offset += 12; - posfound = true; - } - else if ( decl[index].Usage == D3DDECLUSAGE_NORMAL ) - { - if ( decl[index].Type == D3DDECLTYPE_FLOAT3 ) + if (decl[index].Usage == D3DDECLUSAGE_POSITION && decl[index].Type == D3DDECLTYPE_FLOAT3) { - inputDesc.push_back( elements[1] ); + inputDesc.push_back(elements[0]); offset += 12; + posfound = true; } - else if ( decl[index].Type == D3DDECLTYPE_FLOAT16_4 ) - { - D3D11_INPUT_ELEMENT_DESC desc = elements[1]; - desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; - inputDesc.push_back( desc ); - offset += 8; - } - else if ( decl[index].Type == D3DDECLTYPE_SHORT4N ) + else if (decl[index].Usage == D3DDECLUSAGE_NORMAL) { - D3D11_INPUT_ELEMENT_DESC desc = elements[1]; - desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; - inputDesc.push_back( desc ); - offset += 8; + if (decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[1]); + offset += 12; + } + else if (decl[index].Type == D3DDECLTYPE_FLOAT16_4) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[1]; + desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_SHORT4N) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[1]; + desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[1]; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + inputDesc.push_back(desc); + offset += 4; + } + else + break; } - else if ( decl[index].Type == D3DDECLTYPE_UBYTE4N ) + else if (decl[index].Usage == D3DDECLUSAGE_COLOR && decl[index].Type == D3DDECLTYPE_D3DCOLOR) { - D3D11_INPUT_ELEMENT_DESC desc = elements[1]; - desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - inputDesc.push_back( desc ); + inputDesc.push_back(elements[2]); offset += 4; + perVertexColor = true; } - else - break; - } - else if ( decl[index].Usage == D3DDECLUSAGE_COLOR && decl[index].Type == D3DDECLTYPE_D3DCOLOR ) - { - inputDesc.push_back( elements[2] ); - offset += 4; - perVertexColor = true; - } - else if ( decl[index].Usage == D3DDECLUSAGE_TANGENT ) - { - if ( decl[index].Type == D3DDECLTYPE_FLOAT3 ) + else if (decl[index].Usage == D3DDECLUSAGE_TANGENT) { - inputDesc.push_back( elements[3] ); - offset += 12; + if (decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[3]); + offset += 12; + } + else if (decl[index].Type == D3DDECLTYPE_FLOAT16_4) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[3]; + desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_SHORT4N) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[3]; + desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[3]; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + inputDesc.push_back(desc); + offset += 4; + } + else + break; } - else if ( decl[index].Type == D3DDECLTYPE_FLOAT16_4 ) + else if (decl[index].Usage == D3DDECLUSAGE_BINORMAL) { - D3D11_INPUT_ELEMENT_DESC desc = elements[3]; - desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; - inputDesc.push_back( desc ); - offset += 8; + if (decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[4]); + offset += 12; + } + else if (decl[index].Type == D3DDECLTYPE_FLOAT16_4) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[4]; + desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_SHORT4N) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[4]; + desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + D3D11_INPUT_ELEMENT_DESC desc = elements[4]; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + inputDesc.push_back(desc); + offset += 4; + } + else + break; } - else if ( decl[index].Type == D3DDECLTYPE_SHORT4N ) + else if (decl[index].Usage == D3DDECLUSAGE_TEXCOORD) { - D3D11_INPUT_ELEMENT_DESC desc = elements[3]; - desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; - inputDesc.push_back( desc ); - offset += 8; + D3D11_INPUT_ELEMENT_DESC desc = elements[5]; + desc.SemanticIndex = decl[index].UsageIndex; + + bool unk = false; + switch (decl[index].Type) + { + case D3DDECLTYPE_FLOAT2: offset += 8; break; + case D3DDECLTYPE_FLOAT1: desc.Format = DXGI_FORMAT_R32_FLOAT; offset += 4; break; + case D3DDECLTYPE_FLOAT3: desc.Format = DXGI_FORMAT_R32G32B32_FLOAT; offset += 12; break; + case D3DDECLTYPE_FLOAT4: desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; offset += 16; break; + case D3DDECLTYPE_FLOAT16_2: desc.Format = DXGI_FORMAT_R16G16_FLOAT; offset += 4; break; + case D3DDECLTYPE_FLOAT16_4: desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; offset += 8; break; + + default: + unk = true; + break; + } + + if (unk) + break; + + ++texcoords; + + inputDesc.push_back(desc); } - else if ( decl[index].Type == D3DDECLTYPE_UBYTE4N ) + else if (decl[index].Usage == D3DDECLUSAGE_BLENDINDICES && decl[index].Type == D3DDECLTYPE_UBYTE4) { - D3D11_INPUT_ELEMENT_DESC desc = elements[3]; - desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - inputDesc.push_back( desc ); + enableSkinning = true; + inputDesc.push_back(elements[6]); offset += 4; } - else - break; - } - else if ( decl[index].Usage == D3DDECLUSAGE_BINORMAL ) - { - if ( decl[index].Type == D3DDECLTYPE_FLOAT3 ) - { - inputDesc.push_back( elements[4] ); - offset += 12; - } - else if ( decl[index].Type == D3DDECLTYPE_FLOAT16_4 ) + else if (decl[index].Usage == D3DDECLUSAGE_BLENDWEIGHT && decl[index].Type == D3DDECLTYPE_UBYTE4N) { - D3D11_INPUT_ELEMENT_DESC desc = elements[4]; - desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; - inputDesc.push_back( desc ); - offset += 8; - } - else if ( decl[index].Type == D3DDECLTYPE_SHORT4N ) - { - D3D11_INPUT_ELEMENT_DESC desc = elements[4]; - desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; - inputDesc.push_back( desc ); - offset += 8; - } - else if ( decl[index].Type == D3DDECLTYPE_UBYTE4N ) - { - D3D11_INPUT_ELEMENT_DESC desc = elements[4]; - desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - inputDesc.push_back( desc ); + enableSkinning = true; + inputDesc.push_back(elements[7]); offset += 4; } else break; } - else if ( decl[index].Usage == D3DDECLUSAGE_TEXCOORD ) - { - D3D11_INPUT_ELEMENT_DESC desc = elements[5]; - desc.SemanticIndex = decl[index].UsageIndex; - bool unk = false; - switch( decl[index].Type ) - { - case D3DDECLTYPE_FLOAT2: offset += 8; break; - case D3DDECLTYPE_FLOAT1: desc.Format = DXGI_FORMAT_R32_FLOAT; offset += 4; break; - case D3DDECLTYPE_FLOAT3: desc.Format = DXGI_FORMAT_R32G32B32_FLOAT; offset += 12; break; - case D3DDECLTYPE_FLOAT4: desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; offset += 16; break; - case D3DDECLTYPE_FLOAT16_2: desc.Format = DXGI_FORMAT_R16G16_FLOAT; offset += 4; break; - case D3DDECLTYPE_FLOAT16_4: desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; offset += 8; break; - - default: - unk = true; - break; - } + if (!posfound) + throw std::exception("SV_Position is required"); - if ( unk ) - break; - - ++texcoords; - - inputDesc.push_back( desc ); - } - else if ( decl[index].Usage == D3DDECLUSAGE_BLENDINDICES && decl[index].Type == D3DDECLTYPE_UBYTE4 ) + if (texcoords == 2) { - enableSkinning = true; - inputDesc.push_back( elements[6] ); - offset += 4; + dualTexture = true; } - else if ( decl[index].Usage == D3DDECLUSAGE_BLENDWEIGHT && decl[index].Type == D3DDECLTYPE_UBYTE4N ) - { - enableSkinning = true; - inputDesc.push_back( elements[7] ); - offset += 4; - } - else - break; } - if ( !posfound ) - throw std::exception("SV_Position is required"); - - if ( texcoords == 2 ) + // Helper for creating a D3D input layout. + void CreateInputLayout(_In_ ID3D11Device* device, _In_ IEffect* effect, std::vector& inputDesc, _Out_ ID3D11InputLayout** pInputLayout) { - dualTexture = true; - } -} + void const* shaderByteCode; + size_t byteCodeLength; -// Helper for creating a D3D input layout. -static void CreateInputLayout(_In_ ID3D11Device* device, _In_ IEffect* effect, std::vector& inputDesc, _Out_ ID3D11InputLayout** pInputLayout) -{ - void const* shaderByteCode; - size_t byteCodeLength; - - effect->GetVertexShaderBytecode(&shaderByteCode, &byteCodeLength); + effect->GetVertexShaderBytecode(&shaderByteCode, &byteCodeLength); - ThrowIfFailed( - device->CreateInputLayout(inputDesc.data(), - static_cast( inputDesc.size() ), - shaderByteCode, byteCodeLength, - pInputLayout) - ); + ThrowIfFailed( + device->CreateInputLayout(inputDesc.data(), + static_cast(inputDesc.size()), + shaderByteCode, byteCodeLength, + pInputLayout) + ); - _Analysis_assume_(*pInputLayout != 0); + _Analysis_assume_(*pInputLayout != 0); - SetDebugObjectName(*pInputLayout, "ModelSDKMESH"); + SetDebugObjectName(*pInputLayout, "ModelSDKMESH"); + } } diff --git a/Kits/DirectXTK/Src/ModelLoadVBO.cpp b/Kits/DirectXTK/Src/ModelLoadVBO.cpp index c715f76da5c271afe4566c949884bae9a94bd085..64b1b888575c3b4bc49272ea0881929006948de7 100644 --- a/Kits/DirectXTK/Src/ModelLoadVBO.cpp +++ b/Kits/DirectXTK/Src/ModelLoadVBO.cpp @@ -21,51 +21,31 @@ #include "PlatformHelpers.h" #include "BinaryReader.h" +#include "vbo.h" + using namespace DirectX; using Microsoft::WRL::ComPtr; +static_assert(sizeof(VertexPositionNormalTexture) == 32, "VBO vertex size mismatch"); -//-------------------------------------------------------------------------------------- -// The VBO file format was introduced in the Windows 8.0 ResourceLoading sample. It's -// a simple binary file containing a 16-bit index buffer and a fixed-format vertex buffer. -// -// The meshconvert sample tool for DirectXMesh can produce this file type -// http://go.microsoft.com/fwlink/?LinkID=324981 -//-------------------------------------------------------------------------------------- - -namespace VBO +namespace { -#pragma pack(push,1) + //-------------------------------------------------------------------------------------- + // Shared VB input element description + INIT_ONCE g_InitOnce = INIT_ONCE_STATIC_INIT; + std::shared_ptr> g_vbdecl; - struct header_t + BOOL CALLBACK InitializeDecl(PINIT_ONCE initOnce, PVOID Parameter, PVOID *lpContext) { - uint32_t numVertices; - uint32_t numIndices; - }; - -#pragma pack(pop) - -}; // namespace + UNREFERENCED_PARAMETER(initOnce); + UNREFERENCED_PARAMETER(Parameter); + UNREFERENCED_PARAMETER(lpContext); -static_assert(sizeof(VBO::header_t) == 8, "VBO header size mismatch"); -static_assert(sizeof(VertexPositionNormalTexture) == 32, "VBO vertex size mismatch"); - - -//-------------------------------------------------------------------------------------- -// Shared VB input element description -static INIT_ONCE g_InitOnce = INIT_ONCE_STATIC_INIT; -static std::shared_ptr> g_vbdecl; + g_vbdecl = std::make_shared>(VertexPositionNormalTexture::InputElements, + VertexPositionNormalTexture::InputElements + VertexPositionNormalTexture::InputElementCount); -static BOOL CALLBACK InitializeDecl(PINIT_ONCE initOnce, PVOID Parameter, PVOID *lpContext) -{ - UNREFERENCED_PARAMETER(initOnce); - UNREFERENCED_PARAMETER(Parameter); - UNREFERENCED_PARAMETER(lpContext); - - g_vbdecl = std::make_shared>(VertexPositionNormalTexture::InputElements, - VertexPositionNormalTexture::InputElements + VertexPositionNormalTexture::InputElementCount); - - return TRUE; + return TRUE; + } } diff --git a/Kits/DirectXTK/Src/SDKMesh.h b/Kits/DirectXTK/Src/SDKMesh.h new file mode 100644 index 0000000000000000000000000000000000000000..6848d9e5a22fe6e472d6a0939423837dd60af186 --- /dev/null +++ b/Kits/DirectXTK/Src/SDKMesh.h @@ -0,0 +1,340 @@ +//-------------------------------------------------------------------------------------- +// File: SDKMesh.h +// +// SDKMESH format is generated by the legacy DirectX SDK's Content Exporter and +// originally rendered by the DXUT helper class SDKMesh +// +// http://go.microsoft.com/fwlink/?LinkId=226208 +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + + +namespace DXUT +{ + // .SDKMESH files + + // SDKMESH_HEADER + // SDKMESH_VERTEX_BUFFER_HEADER header->VertexStreamHeadersOffset + // SDKMESH_INDEX_BUFFER_HEADER header->IndexStreamHeadersOffset + // SDKMESH_MESH header->MeshDataOffset + // SDKMESH_SUBSET header->SubsetDataOffset + // SDKMESH_FRAME header->FrameDataOffset + // SDKMESH_MATERIAL header->MaterialDataOffset + // [header->NonBufferDataSize] + // { [ header->NumVertexBuffers] + // VB data + // } + // { [ header->NumIndexBuffers] + // IB data + // } + + + // .SDDKANIM files + + // SDKANIMATION_FILE_HEADER + // uint8_t[] - Length of fileheader->AnimationDataSize + + // .SDKMESH uses Direct3D 9 decls, but only a subset of these is ever generated by the legacy DirectX SDK Content Exporter + + // D3DDECLUSAGE_POSITION / D3DDECLTYPE_FLOAT3 + // (D3DDECLUSAGE_BLENDWEIGHT / D3DDECLTYPE_UBYTE4N + // D3DDECLUSAGE_BLENDINDICES / D3DDECLTYPE_UBYTE4)? + // (D3DDECLUSAGE_NORMAL / D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_SHORT4N, D3DDECLTYPE_UBYTE4N, or D3DDECLTYPE_DEC3N [not supported])? + // (D3DDECLUSAGE_COLOR / D3DDECLTYPE_D3DCOLOR)? + // (D3DDECLUSAGE_TEXCOORD / D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT2 or D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT3 or D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT4 or D3DDECLTYPE_FLOAT16_4)* + // (D3DDECLUSAGE_TANGENT / same as D3DDECLUSAGE_NORMAL)? + // (D3DDECLUSAGE_BINORMAL / same as D3DDECLUSAGE_NORMAL)? + + enum D3DDECLUSAGE + { + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT =1, + D3DDECLUSAGE_BLENDINDICES =2, + D3DDECLUSAGE_NORMAL =3, + D3DDECLUSAGE_TEXCOORD = 5, + D3DDECLUSAGE_TANGENT = 6, + D3DDECLUSAGE_BINORMAL = 7, + D3DDECLUSAGE_COLOR = 10, + }; + + enum D3DDECLTYPE + { + D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) + D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) + D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) + D3DDECLTYPE_FLOAT4 = 3, // 4D float + D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) + D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned uint8_t + D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 + D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) + // Note: There is no equivalent to D3DDECLTYPE_DEC3N (14) as a DXGI_FORMAT + D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) + D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values + + D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. + }; + + #pragma pack(push,4) + + struct D3DVERTEXELEMENT9 + { + uint16_t Stream; // Stream index + uint16_t Offset; // Offset in the stream in bytes + uint8_t Type; // Data type + uint8_t Method; // Processing method + uint8_t Usage; // Semantics + uint8_t UsageIndex; // Semantic index + }; + + #pragma pack(pop) + + //-------------------------------------------------------------------------------------- + // Hard Defines for the various structures + //-------------------------------------------------------------------------------------- + const uint32_t SDKMESH_FILE_VERSION = 101; + const uint32_t MAX_VERTEX_ELEMENTS = 32; + const uint32_t MAX_VERTEX_STREAMS = 16; + const uint32_t MAX_FRAME_NAME = 100; + const uint32_t MAX_MESH_NAME = 100; + const uint32_t MAX_SUBSET_NAME = 100; + const uint32_t MAX_MATERIAL_NAME = 100; + const uint32_t MAX_TEXTURE_NAME = MAX_PATH; + const uint32_t MAX_MATERIAL_PATH = MAX_PATH; + const uint32_t INVALID_FRAME = uint32_t(-1); + const uint32_t INVALID_MESH = uint32_t(-1); + const uint32_t INVALID_MATERIAL = uint32_t(-1); + const uint32_t INVALID_SUBSET = uint32_t(-1); + const uint32_t INVALID_ANIMATION_DATA = uint32_t(-1); + const uint32_t INVALID_SAMPLER_SLOT = uint32_t(-1); + const uint32_t ERROR_RESOURCE_VALUE = 1; + + //-------------------------------------------------------------------------------------- + // Enumerated Types. + //-------------------------------------------------------------------------------------- + enum SDKMESH_PRIMITIVE_TYPE + { + PT_TRIANGLE_LIST = 0, + PT_TRIANGLE_STRIP, + PT_LINE_LIST, + PT_LINE_STRIP, + PT_POINT_LIST, + PT_TRIANGLE_LIST_ADJ, + PT_TRIANGLE_STRIP_ADJ, + PT_LINE_LIST_ADJ, + PT_LINE_STRIP_ADJ, + PT_QUAD_PATCH_LIST, + PT_TRIANGLE_PATCH_LIST, + }; + + enum SDKMESH_INDEX_TYPE + { + IT_16BIT = 0, + IT_32BIT, + }; + + enum FRAME_TRANSFORM_TYPE + { + FTT_RELATIVE = 0, + FTT_ABSOLUTE, //This is not currently used but is here to support absolute transformations in the future + }; + + //-------------------------------------------------------------------------------------- + // Structures. + //-------------------------------------------------------------------------------------- + #pragma pack(push,8) + + struct SDKMESH_HEADER + { + //Basic Info and sizes + uint32_t Version; + uint8_t IsBigEndian; + uint64_t HeaderSize; + uint64_t NonBufferDataSize; + uint64_t BufferDataSize; + + //Stats + uint32_t NumVertexBuffers; + uint32_t NumIndexBuffers; + uint32_t NumMeshes; + uint32_t NumTotalSubsets; + uint32_t NumFrames; + uint32_t NumMaterials; + + //Offsets to Data + uint64_t VertexStreamHeadersOffset; + uint64_t IndexStreamHeadersOffset; + uint64_t MeshDataOffset; + uint64_t SubsetDataOffset; + uint64_t FrameDataOffset; + uint64_t MaterialDataOffset; + }; + + struct SDKMESH_VERTEX_BUFFER_HEADER + { + uint64_t NumVertices; + uint64_t SizeBytes; + uint64_t StrideBytes; + D3DVERTEXELEMENT9 Decl[MAX_VERTEX_ELEMENTS]; + union + { + uint64_t DataOffset; + }; + }; + + struct SDKMESH_INDEX_BUFFER_HEADER + { + uint64_t NumIndices; + uint64_t SizeBytes; + uint32_t IndexType; + union + { + uint64_t DataOffset; + }; + }; + + struct SDKMESH_MESH + { + char Name[MAX_MESH_NAME]; + uint8_t NumVertexBuffers; + uint32_t VertexBuffers[MAX_VERTEX_STREAMS]; + uint32_t IndexBuffer; + uint32_t NumSubsets; + uint32_t NumFrameInfluences; //aka bones + + DirectX::XMFLOAT3 BoundingBoxCenter; + DirectX::XMFLOAT3 BoundingBoxExtents; + + union + { + uint64_t SubsetOffset; + INT* pSubsets; + }; + union + { + uint64_t FrameInfluenceOffset; + uint32_t* pFrameInfluences; + }; + }; + + struct SDKMESH_SUBSET + { + char Name[MAX_SUBSET_NAME]; + uint32_t MaterialID; + uint32_t PrimitiveType; + uint64_t IndexStart; + uint64_t IndexCount; + uint64_t VertexStart; + uint64_t VertexCount; + }; + + struct SDKMESH_FRAME + { + char Name[MAX_FRAME_NAME]; + uint32_t Mesh; + uint32_t ParentFrame; + uint32_t ChildFrame; + uint32_t SiblingFrame; + DirectX::XMFLOAT4X4 Matrix; + uint32_t AnimationDataIndex; //Used to index which set of keyframes transforms this frame + }; + + struct SDKMESH_MATERIAL + { + char Name[MAX_MATERIAL_NAME]; + + // Use MaterialInstancePath + char MaterialInstancePath[MAX_MATERIAL_PATH]; + + // Or fall back to d3d8-type materials + char DiffuseTexture[MAX_TEXTURE_NAME]; + char NormalTexture[MAX_TEXTURE_NAME]; + char SpecularTexture[MAX_TEXTURE_NAME]; + + DirectX::XMFLOAT4 Diffuse; + DirectX::XMFLOAT4 Ambient; + DirectX::XMFLOAT4 Specular; + DirectX::XMFLOAT4 Emissive; + float Power; + + union + { + uint64_t Force64_1; //Force the union to 64bits + }; + union + { + uint64_t Force64_2; //Force the union to 64bits + }; + union + { + uint64_t Force64_3; //Force the union to 64bits + }; + + union + { + uint64_t Force64_4; //Force the union to 64bits + }; + union + { + uint64_t Force64_5; //Force the union to 64bits + }; + union + { + uint64_t Force64_6; //Force the union to 64bits + }; + }; + + struct SDKANIMATION_FILE_HEADER + { + uint32_t Version; + uint8_t IsBigEndian; + uint32_t FrameTransformType; + uint32_t NumFrames; + uint32_t NumAnimationKeys; + uint32_t AnimationFPS; + uint64_t AnimationDataSize; + uint64_t AnimationDataOffset; + }; + + struct SDKANIMATION_DATA + { + DirectX::XMFLOAT3 Translation; + DirectX::XMFLOAT4 Orientation; + DirectX::XMFLOAT3 Scaling; + }; + + struct SDKANIMATION_FRAME_DATA + { + char FrameName[MAX_FRAME_NAME]; + union + { + uint64_t DataOffset; + SDKANIMATION_DATA* pAnimationData; + }; + }; + + #pragma pack(pop) + +} // namespace + +static_assert( sizeof(DXUT::D3DVERTEXELEMENT9) == 8, "Direct3D9 Decl structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_HEADER)== 104, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_VERTEX_BUFFER_HEADER) == 288, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_INDEX_BUFFER_HEADER) == 32, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_MESH) == 224, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_SUBSET) == 144, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_FRAME) == 184, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_MATERIAL) == 1256, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKANIMATION_FILE_HEADER) == 40, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKANIMATION_DATA) == 40, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKANIMATION_FRAME_DATA) == 112, "SDK Mesh structure size incorrect" ); diff --git a/Kits/DirectXTK/Src/ScreenGrab.cpp b/Kits/DirectXTK/Src/ScreenGrab.cpp index 6fd542e5adcbf609e35b7b85601192e2a21520d3..5a59f60d55e6364d3c46f16a1312edbcea8ba517 100644 --- a/Kits/DirectXTK/Src/ScreenGrab.cpp +++ b/Kits/DirectXTK/Src/ScreenGrab.cpp @@ -27,439 +27,18 @@ #include "pch.h" -#include - #include "ScreenGrab.h" #include "DirectXHelpers.h" #include "dds.h" #include "PlatformHelpers.h" +#include "LoaderHelpers.h" using Microsoft::WRL::ComPtr; using namespace DirectX; namespace { - class auto_delete_file - { - public: - auto_delete_file(HANDLE hFile) : m_handle(hFile) {} - - auto_delete_file(const auto_delete_file&) = delete; - auto_delete_file& operator=(const auto_delete_file&) = delete; - - ~auto_delete_file() - { - if (m_handle) - { - FILE_DISPOSITION_INFO info = {}; - info.DeleteFile = TRUE; - (void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); - } - } - - void clear() { m_handle = 0; } - - private: - HANDLE m_handle; - }; - - class auto_delete_file_wic - { - public: - auto_delete_file_wic(ComPtr& hFile, LPCWSTR szFile) : m_handle(hFile), m_filename(szFile) {} - - auto_delete_file_wic(const auto_delete_file_wic&) = delete; - auto_delete_file_wic& operator=(const auto_delete_file_wic&) = delete; - - ~auto_delete_file_wic() - { - if (m_filename) - { - m_handle.Reset(); - DeleteFileW(m_filename); - } - } - - void clear() { m_filename = 0; } - - private: - LPCWSTR m_filename; - ComPtr& m_handle; - }; - - //-------------------------------------------------------------------------------------- - // Return the BPP for a particular format - //-------------------------------------------------------------------------------------- - size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) - { - switch (fmt) - { - case DXGI_FORMAT_R32G32B32A32_TYPELESS: - case DXGI_FORMAT_R32G32B32A32_FLOAT: - case DXGI_FORMAT_R32G32B32A32_UINT: - case DXGI_FORMAT_R32G32B32A32_SINT: - return 128; - - case DXGI_FORMAT_R32G32B32_TYPELESS: - case DXGI_FORMAT_R32G32B32_FLOAT: - case DXGI_FORMAT_R32G32B32_UINT: - case DXGI_FORMAT_R32G32B32_SINT: - return 96; - - case DXGI_FORMAT_R16G16B16A16_TYPELESS: - case DXGI_FORMAT_R16G16B16A16_FLOAT: - case DXGI_FORMAT_R16G16B16A16_UNORM: - case DXGI_FORMAT_R16G16B16A16_UINT: - case DXGI_FORMAT_R16G16B16A16_SNORM: - case DXGI_FORMAT_R16G16B16A16_SINT: - case DXGI_FORMAT_R32G32_TYPELESS: - case DXGI_FORMAT_R32G32_FLOAT: - case DXGI_FORMAT_R32G32_UINT: - case DXGI_FORMAT_R32G32_SINT: - case DXGI_FORMAT_R32G8X24_TYPELESS: - case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: - case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: - case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: - case DXGI_FORMAT_Y416: - case DXGI_FORMAT_Y210: - case DXGI_FORMAT_Y216: - return 64; - - case DXGI_FORMAT_R10G10B10A2_TYPELESS: - case DXGI_FORMAT_R10G10B10A2_UNORM: - case DXGI_FORMAT_R10G10B10A2_UINT: - case DXGI_FORMAT_R11G11B10_FLOAT: - case DXGI_FORMAT_R8G8B8A8_TYPELESS: - case DXGI_FORMAT_R8G8B8A8_UNORM: - case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: - case DXGI_FORMAT_R8G8B8A8_UINT: - case DXGI_FORMAT_R8G8B8A8_SNORM: - case DXGI_FORMAT_R8G8B8A8_SINT: - case DXGI_FORMAT_R16G16_TYPELESS: - case DXGI_FORMAT_R16G16_FLOAT: - case DXGI_FORMAT_R16G16_UNORM: - case DXGI_FORMAT_R16G16_UINT: - case DXGI_FORMAT_R16G16_SNORM: - case DXGI_FORMAT_R16G16_SINT: - case DXGI_FORMAT_R32_TYPELESS: - case DXGI_FORMAT_D32_FLOAT: - case DXGI_FORMAT_R32_FLOAT: - case DXGI_FORMAT_R32_UINT: - case DXGI_FORMAT_R32_SINT: - case DXGI_FORMAT_R24G8_TYPELESS: - case DXGI_FORMAT_D24_UNORM_S8_UINT: - case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: - case DXGI_FORMAT_X24_TYPELESS_G8_UINT: - case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: - case DXGI_FORMAT_R8G8_B8G8_UNORM: - case DXGI_FORMAT_G8R8_G8B8_UNORM: - case DXGI_FORMAT_B8G8R8A8_UNORM: - case DXGI_FORMAT_B8G8R8X8_UNORM: - case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: - case DXGI_FORMAT_B8G8R8A8_TYPELESS: - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - case DXGI_FORMAT_B8G8R8X8_TYPELESS: - case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: - case DXGI_FORMAT_AYUV: - case DXGI_FORMAT_Y410: - case DXGI_FORMAT_YUY2: - return 32; - - case DXGI_FORMAT_P010: - case DXGI_FORMAT_P016: - return 24; - - case DXGI_FORMAT_R8G8_TYPELESS: - case DXGI_FORMAT_R8G8_UNORM: - case DXGI_FORMAT_R8G8_UINT: - case DXGI_FORMAT_R8G8_SNORM: - case DXGI_FORMAT_R8G8_SINT: - case DXGI_FORMAT_R16_TYPELESS: - case DXGI_FORMAT_R16_FLOAT: - case DXGI_FORMAT_D16_UNORM: - case DXGI_FORMAT_R16_UNORM: - case DXGI_FORMAT_R16_UINT: - case DXGI_FORMAT_R16_SNORM: - case DXGI_FORMAT_R16_SINT: - case DXGI_FORMAT_B5G6R5_UNORM: - case DXGI_FORMAT_B5G5R5A1_UNORM: - case DXGI_FORMAT_A8P8: - case DXGI_FORMAT_B4G4R4A4_UNORM: - return 16; - - case DXGI_FORMAT_NV12: - case DXGI_FORMAT_420_OPAQUE: - case DXGI_FORMAT_NV11: - return 12; - - case DXGI_FORMAT_R8_TYPELESS: - case DXGI_FORMAT_R8_UNORM: - case DXGI_FORMAT_R8_UINT: - case DXGI_FORMAT_R8_SNORM: - case DXGI_FORMAT_R8_SINT: - case DXGI_FORMAT_A8_UNORM: - case DXGI_FORMAT_AI44: - case DXGI_FORMAT_IA44: - case DXGI_FORMAT_P8: - return 8; - - case DXGI_FORMAT_R1_UNORM: - return 1; - - case DXGI_FORMAT_BC1_TYPELESS: - case DXGI_FORMAT_BC1_UNORM: - case DXGI_FORMAT_BC1_UNORM_SRGB: - case DXGI_FORMAT_BC4_TYPELESS: - case DXGI_FORMAT_BC4_UNORM: - case DXGI_FORMAT_BC4_SNORM: - return 4; - - case DXGI_FORMAT_BC2_TYPELESS: - case DXGI_FORMAT_BC2_UNORM: - case DXGI_FORMAT_BC2_UNORM_SRGB: - case DXGI_FORMAT_BC3_TYPELESS: - case DXGI_FORMAT_BC3_UNORM: - case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC5_TYPELESS: - case DXGI_FORMAT_BC5_UNORM: - case DXGI_FORMAT_BC5_SNORM: - case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC6H_UF16: - case DXGI_FORMAT_BC6H_SF16: - case DXGI_FORMAT_BC7_TYPELESS: - case DXGI_FORMAT_BC7_UNORM: - case DXGI_FORMAT_BC7_UNORM_SRGB: - return 8; - -#if defined(_XBOX_ONE) && defined(_TITLE) - - case DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT: - case DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT: - case DXGI_FORMAT_R10G10B10_SNORM_A2_UNORM: - return 32; - - case DXGI_FORMAT_D16_UNORM_S8_UINT: - case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: - case DXGI_FORMAT_X16_TYPELESS_G8_UINT: - return 24; - - case DXGI_FORMAT_R4G4_UNORM: - return 8; - -#endif // _XBOX_ONE && _TITLE - - default: - return 0; - } - } - - //-------------------------------------------------------------------------------------- - // Determines if the format is block compressed - //-------------------------------------------------------------------------------------- - bool IsCompressed(_In_ DXGI_FORMAT fmt) - { - switch (fmt) - { - case DXGI_FORMAT_BC1_TYPELESS: - case DXGI_FORMAT_BC1_UNORM: - case DXGI_FORMAT_BC1_UNORM_SRGB: - case DXGI_FORMAT_BC2_TYPELESS: - case DXGI_FORMAT_BC2_UNORM: - case DXGI_FORMAT_BC2_UNORM_SRGB: - case DXGI_FORMAT_BC3_TYPELESS: - case DXGI_FORMAT_BC3_UNORM: - case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC4_TYPELESS: - case DXGI_FORMAT_BC4_UNORM: - case DXGI_FORMAT_BC4_SNORM: - case DXGI_FORMAT_BC5_TYPELESS: - case DXGI_FORMAT_BC5_UNORM: - case DXGI_FORMAT_BC5_SNORM: - case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC6H_UF16: - case DXGI_FORMAT_BC6H_SF16: - case DXGI_FORMAT_BC7_TYPELESS: - case DXGI_FORMAT_BC7_UNORM: - case DXGI_FORMAT_BC7_UNORM_SRGB: - return true; - - default: - return false; - } - } - - //-------------------------------------------------------------------------------------- - // Get surface information for a particular format - //-------------------------------------------------------------------------------------- - void GetSurfaceInfo(_In_ size_t width, - _In_ size_t height, - _In_ DXGI_FORMAT fmt, - _Out_opt_ size_t* outNumBytes, - _Out_opt_ size_t* outRowBytes, - _Out_opt_ size_t* outNumRows) - { - size_t numBytes = 0; - size_t rowBytes = 0; - size_t numRows = 0; - - bool bc = false; - bool packed = false; - bool planar = false; - size_t bpe = 0; - switch (fmt) - { - case DXGI_FORMAT_BC1_TYPELESS: - case DXGI_FORMAT_BC1_UNORM: - case DXGI_FORMAT_BC1_UNORM_SRGB: - case DXGI_FORMAT_BC4_TYPELESS: - case DXGI_FORMAT_BC4_UNORM: - case DXGI_FORMAT_BC4_SNORM: - bc = true; - bpe = 8; - break; - - case DXGI_FORMAT_BC2_TYPELESS: - case DXGI_FORMAT_BC2_UNORM: - case DXGI_FORMAT_BC2_UNORM_SRGB: - case DXGI_FORMAT_BC3_TYPELESS: - case DXGI_FORMAT_BC3_UNORM: - case DXGI_FORMAT_BC3_UNORM_SRGB: - case DXGI_FORMAT_BC5_TYPELESS: - case DXGI_FORMAT_BC5_UNORM: - case DXGI_FORMAT_BC5_SNORM: - case DXGI_FORMAT_BC6H_TYPELESS: - case DXGI_FORMAT_BC6H_UF16: - case DXGI_FORMAT_BC6H_SF16: - case DXGI_FORMAT_BC7_TYPELESS: - case DXGI_FORMAT_BC7_UNORM: - case DXGI_FORMAT_BC7_UNORM_SRGB: - bc = true; - bpe = 16; - break; - - case DXGI_FORMAT_R8G8_B8G8_UNORM: - case DXGI_FORMAT_G8R8_G8B8_UNORM: - case DXGI_FORMAT_YUY2: - packed = true; - bpe = 4; - break; - - case DXGI_FORMAT_Y210: - case DXGI_FORMAT_Y216: - packed = true; - bpe = 8; - break; - - case DXGI_FORMAT_NV12: - case DXGI_FORMAT_420_OPAQUE: - planar = true; - bpe = 2; - break; - - case DXGI_FORMAT_P010: - case DXGI_FORMAT_P016: - planar = true; - bpe = 4; - break; - -#if defined(_XBOX_ONE) && defined(_TITLE) - - case DXGI_FORMAT_D16_UNORM_S8_UINT: - case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: - case DXGI_FORMAT_X16_TYPELESS_G8_UINT: - planar = true; - bpe = 4; - break; - -#endif - } - - if (bc) - { - size_t numBlocksWide = 0; - if (width > 0) - { - numBlocksWide = std::max(1, (width + 3) / 4); - } - size_t numBlocksHigh = 0; - if (height > 0) - { - numBlocksHigh = std::max(1, (height + 3) / 4); - } - rowBytes = numBlocksWide * bpe; - numRows = numBlocksHigh; - numBytes = rowBytes * numBlocksHigh; - } - else if (packed) - { - rowBytes = ((width + 1) >> 1) * bpe; - numRows = height; - numBytes = rowBytes * height; - } - else if (fmt == DXGI_FORMAT_NV11) - { - rowBytes = ((width + 3) >> 2) * 4; - numRows = height * 2; // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data - numBytes = rowBytes * numRows; - } - else if (planar) - { - rowBytes = ((width + 1) >> 1) * bpe; - numBytes = (rowBytes * height) + ((rowBytes * height + 1) >> 1); - numRows = height + ((height + 1) >> 1); - } - else - { - size_t bpp = BitsPerPixel(fmt); - rowBytes = (width * bpp + 7) / 8; // round up to nearest byte - numRows = height; - numBytes = rowBytes * height; - } - - if (outNumBytes) - { - *outNumBytes = numBytes; - } - if (outRowBytes) - { - *outRowBytes = rowBytes; - } - if (outNumRows) - { - *outNumRows = numRows; - } - } - - //-------------------------------------------------------------------------------------- - DXGI_FORMAT EnsureNotTypeless(DXGI_FORMAT fmt) - { - // Assumes UNORM or FLOAT; doesn't use UINT or SINT - switch (fmt) - { - case DXGI_FORMAT_R32G32B32A32_TYPELESS: return DXGI_FORMAT_R32G32B32A32_FLOAT; - case DXGI_FORMAT_R32G32B32_TYPELESS: return DXGI_FORMAT_R32G32B32_FLOAT; - case DXGI_FORMAT_R16G16B16A16_TYPELESS: return DXGI_FORMAT_R16G16B16A16_UNORM; - case DXGI_FORMAT_R32G32_TYPELESS: return DXGI_FORMAT_R32G32_FLOAT; - case DXGI_FORMAT_R10G10B10A2_TYPELESS: return DXGI_FORMAT_R10G10B10A2_UNORM; - case DXGI_FORMAT_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_UNORM; - case DXGI_FORMAT_R16G16_TYPELESS: return DXGI_FORMAT_R16G16_UNORM; - case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_R32_FLOAT; - case DXGI_FORMAT_R8G8_TYPELESS: return DXGI_FORMAT_R8G8_UNORM; - case DXGI_FORMAT_R16_TYPELESS: return DXGI_FORMAT_R16_UNORM; - case DXGI_FORMAT_R8_TYPELESS: return DXGI_FORMAT_R8_UNORM; - case DXGI_FORMAT_BC1_TYPELESS: return DXGI_FORMAT_BC1_UNORM; - case DXGI_FORMAT_BC2_TYPELESS: return DXGI_FORMAT_BC2_UNORM; - case DXGI_FORMAT_BC3_TYPELESS: return DXGI_FORMAT_BC3_UNORM; - case DXGI_FORMAT_BC4_TYPELESS: return DXGI_FORMAT_BC4_UNORM; - case DXGI_FORMAT_BC5_TYPELESS: return DXGI_FORMAT_BC5_UNORM; - case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM; - case DXGI_FORMAT_B8G8R8X8_TYPELESS: return DXGI_FORMAT_B8G8R8X8_UNORM; - case DXGI_FORMAT_BC7_TYPELESS: return DXGI_FORMAT_BC7_UNORM; - default: return fmt; - } - } - //-------------------------------------------------------------------------------------- HRESULT CaptureTexture(_In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, @@ -584,9 +163,10 @@ namespace //-------------------------------------------------------------------------------------- -HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, - _In_ ID3D11Resource* pSource, - _In_z_ LPCWSTR fileName ) +_Use_decl_annotations_ +HRESULT DirectX::SaveDDSTextureToFile( ID3D11DeviceContext* pContext, + ID3D11Resource* pSource, + const wchar_t* fileName ) { if ( !fileName ) return E_INVALIDARG; @@ -750,12 +330,13 @@ extern bool _IsWIC2(); extern IWICImagingFactory* _GetWIC(); } -HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, - _In_ ID3D11Resource* pSource, - _In_ REFGUID guidContainerFormat, - _In_z_ LPCWSTR fileName, - _In_opt_ const GUID* targetFormat, - _In_opt_ std::function setCustomProps ) +_Use_decl_annotations_ +HRESULT DirectX::SaveWICTextureToFile( ID3D11DeviceContext* pContext, + ID3D11Resource* pSource, + REFGUID guidContainerFormat, + const wchar_t* fileName, + const GUID* targetFormat, + std::function setCustomProps ) { if ( !fileName ) return E_INVALIDARG; diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc index e4e49e9b073592a4b714dd14fc56ad10d9933ddd..52665d85e5535f4a016aa19bdf7ed586e04c639a 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc @@ -41,7 +41,7 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 115 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 115 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" texld r0, t2, s0 mad r1.w, r0.w, t0.w, -c0.x mul r0, r0, t0 // ::color<0,1,2,3> @@ -50,7 +50,7 @@ cmp r1, r1.x, c0.w, c0.z texkill r1 -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, c1, r0.w, -r0 mad r0.xyz, t1.w, r1, r0 // ApplyFog::color<0,1,2> mov oC0, r0 // ::PSAlphaTestEqNe<0,1,2,3> @@ -81,17 +81,17 @@ ret const BYTE AlphaTestEffect_PSAlphaTestEqNe[] = { - 68, 88, 66, 67, 208, 75, - 162, 32, 33, 200, 11, 204, - 50, 168, 64, 242, 244, 89, - 11, 137, 1, 0, 0, 0, - 56, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 213, 22, + 225, 159, 196, 224, 154, 245, + 216, 172, 86, 60, 68, 240, + 161, 5, 1, 0, 0, 0, + 68, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 220, 3, 0, 0, 156, 5, - 0, 0, 4, 6, 0, 0, - 65, 111, 110, 57, 164, 3, - 0, 0, 164, 3, 0, 0, - 0, 2, 255, 255, 112, 3, + 232, 3, 0, 0, 168, 5, + 0, 0, 16, 6, 0, 0, + 65, 111, 110, 57, 176, 3, + 0, 0, 176, 3, 0, 0, + 0, 2, 255, 255, 124, 3, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -100,14 +100,14 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNe[] = 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 165, 0, 68, 66, 85, 71, + 168, 0, 68, 66, 85, 71, 40, 0, 0, 0, 104, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 14, 0, 0, 0, 200, 0, 0, 0, 4, 0, 0, 0, 24, 2, 0, 0, - 56, 1, 0, 0, 67, 58, + 56, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -120,7 +120,7 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNe[] = 101, 114, 115, 92, 65, 108, 112, 104, 97, 84, 101, 115, 116, 69, 102, 102, 101, 99, - 116, 46, 102, 120, 0, 67, + 116, 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -135,24 +135,24 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNe[] = 102, 120, 104, 0, 171, 171, 40, 0, 0, 0, 119, 0, 0, 0, 0, 0, 255, 255, - 156, 2, 0, 0, 0, 0, - 255, 255, 168, 2, 0, 0, - 0, 0, 255, 255, 180, 2, + 168, 2, 0, 0, 0, 0, + 255, 255, 180, 2, 0, 0, + 0, 0, 255, 255, 192, 2, 0, 0, 0, 0, 255, 255, - 192, 2, 0, 0, 115, 0, - 0, 0, 204, 2, 0, 0, - 117, 0, 0, 0, 220, 2, + 204, 2, 0, 0, 115, 0, + 0, 0, 216, 2, 0, 0, + 117, 0, 0, 0, 232, 2, 0, 0, 115, 0, 0, 0, - 240, 2, 0, 0, 117, 0, - 0, 0, 0, 3, 0, 0, - 117, 0, 0, 0, 12, 3, + 252, 2, 0, 0, 117, 0, + 0, 0, 12, 3, 0, 0, + 117, 0, 0, 0, 24, 3, 0, 0, 117, 0, 0, 0, - 28, 3, 0, 0, 117, 0, - 0, 0, 48, 3, 0, 0, - 20, 0, 1, 0, 56, 3, + 40, 3, 0, 0, 117, 0, + 0, 0, 60, 3, 0, 0, + 20, 0, 1, 0, 68, 3, 0, 0, 20, 0, 1, 0, - 76, 3, 0, 0, 20, 0, - 1, 0, 96, 3, 0, 0, + 88, 3, 0, 0, 20, 0, + 1, 0, 108, 3, 0, 0, 80, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 69, 113, 78, 101, 0, 1, 0, @@ -210,7 +210,9 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNe[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc index df910cd7cc3b85d7943d5ad6dc09467ee380dd59..cbe52baf8e12f4c953197789c1061b9f089fc248 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc @@ -39,7 +39,7 @@ dcl t1.xy // pin<4,5> dcl_2d s0 -#line 128 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 128 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" texld r0, t1, s0 mad r1.w, r0.w, t0.w, -c0.x mul r0, r0, t0 // ::color<0,1,2,3> @@ -72,17 +72,17 @@ ret const BYTE AlphaTestEffect_PSAlphaTestEqNeNoFog[] = { - 68, 88, 66, 67, 207, 117, - 57, 224, 226, 104, 212, 180, - 83, 188, 48, 87, 162, 23, - 138, 157, 1, 0, 0, 0, - 240, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 157, 210, + 136, 20, 124, 194, 207, 200, + 252, 104, 169, 73, 17, 89, + 40, 125, 1, 0, 0, 0, + 252, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 8, 3, 0, 0, 108, 4, - 0, 0, 188, 4, 0, 0, - 65, 111, 110, 57, 208, 2, - 0, 0, 208, 2, 0, 0, - 0, 2, 255, 255, 156, 2, + 20, 3, 0, 0, 120, 4, + 0, 0, 200, 4, 0, 0, + 65, 111, 110, 57, 220, 2, + 0, 0, 220, 2, 0, 0, + 0, 2, 255, 255, 168, 2, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -91,14 +91,14 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNeNoFog[] = 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 125, 0, 68, 66, 85, 71, + 128, 0, 68, 66, 85, 71, 40, 0, 0, 0, 200, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0, 0, 11, 0, 0, 0, 124, 0, 0, 0, 3, 0, 0, 0, 140, 1, 0, 0, - 212, 0, 0, 0, 67, 58, + 212, 0, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -113,20 +113,20 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNeNoFog[] = 116, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 252, 1, 0, 0, - 0, 0, 255, 255, 8, 2, + 255, 255, 8, 2, 0, 0, + 0, 0, 255, 255, 20, 2, 0, 0, 0, 0, 255, 255, - 20, 2, 0, 0, 128, 0, - 0, 0, 32, 2, 0, 0, - 130, 0, 0, 0, 48, 2, + 32, 2, 0, 0, 128, 0, + 0, 0, 44, 2, 0, 0, + 130, 0, 0, 0, 60, 2, 0, 0, 128, 0, 0, 0, - 68, 2, 0, 0, 128, 0, - 0, 0, 84, 2, 0, 0, - 130, 0, 0, 0, 96, 2, + 80, 2, 0, 0, 128, 0, + 0, 0, 96, 2, 0, 0, + 130, 0, 0, 0, 108, 2, 0, 0, 130, 0, 0, 0, - 108, 2, 0, 0, 130, 0, - 0, 0, 124, 2, 0, 0, - 130, 0, 0, 0, 144, 2, + 120, 2, 0, 0, 130, 0, + 0, 0, 136, 2, 0, 0, + 130, 0, 0, 0, 156, 2, 0, 0, 80, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 69, 113, 78, 101, 78, @@ -174,7 +174,9 @@ const BYTE AlphaTestEffect_PSAlphaTestEqNeNoFog[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc index 4791ffff1cddff5dec5742c74330b44019a959a7..b78c7141033cb2f5346a0e67ddfc9593bb20260d 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc @@ -41,14 +41,14 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 91 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 91 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" texld r0, t2, s0 mad r1.w, r0.w, t0.w, -c0.x mul r0, r0, t0 // ::color<0,1,2,3> cmp r1, r1.w, c0.w, c0.z texkill r1 -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, c1, r0.w, -r0 mad r0.xyz, t1.w, r1, r0 // ApplyFog::color<0,1,2> mov oC0, r0 // ::PSAlphaTestLtGt<0,1,2,3> @@ -78,17 +78,17 @@ ret const BYTE AlphaTestEffect_PSAlphaTestLtGt[] = { - 68, 88, 66, 67, 241, 64, - 251, 39, 121, 132, 229, 238, - 105, 177, 37, 183, 88, 131, - 121, 143, 1, 0, 0, 0, - 220, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 7, 91, + 41, 243, 41, 36, 62, 189, + 3, 122, 247, 148, 151, 220, + 247, 123, 1, 0, 0, 0, + 232, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 176, 3, 0, 0, 64, 5, - 0, 0, 168, 5, 0, 0, - 65, 111, 110, 57, 120, 3, - 0, 0, 120, 3, 0, 0, - 0, 2, 255, 255, 68, 3, + 188, 3, 0, 0, 76, 5, + 0, 0, 180, 5, 0, 0, + 65, 111, 110, 57, 132, 3, + 0, 0, 132, 3, 0, 0, + 0, 2, 255, 255, 80, 3, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -97,14 +97,14 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGt[] = 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 161, 0, 68, 66, 85, 71, + 164, 0, 68, 66, 85, 71, 40, 0, 0, 0, 88, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 12, 0, 0, 0, 200, 0, 0, 0, 4, 0, 0, 0, 8, 2, 0, 0, - 40, 1, 0, 0, 67, 58, + 40, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -117,7 +117,7 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGt[] = 101, 114, 115, 92, 65, 108, 112, 104, 97, 84, 101, 115, 116, 69, 102, 102, 101, 99, - 116, 46, 102, 120, 0, 67, + 116, 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -132,21 +132,21 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGt[] = 102, 120, 104, 0, 171, 171, 40, 0, 0, 0, 119, 0, 0, 0, 0, 0, 255, 255, - 140, 2, 0, 0, 0, 0, - 255, 255, 152, 2, 0, 0, - 0, 0, 255, 255, 164, 2, + 152, 2, 0, 0, 0, 0, + 255, 255, 164, 2, 0, 0, + 0, 0, 255, 255, 176, 2, 0, 0, 0, 0, 255, 255, - 176, 2, 0, 0, 91, 0, - 0, 0, 188, 2, 0, 0, - 93, 0, 0, 0, 204, 2, + 188, 2, 0, 0, 91, 0, + 0, 0, 200, 2, 0, 0, + 93, 0, 0, 0, 216, 2, 0, 0, 91, 0, 0, 0, - 224, 2, 0, 0, 93, 0, - 0, 0, 240, 2, 0, 0, - 93, 0, 0, 0, 4, 3, + 236, 2, 0, 0, 93, 0, + 0, 0, 252, 2, 0, 0, + 93, 0, 0, 0, 16, 3, 0, 0, 20, 0, 1, 0, - 12, 3, 0, 0, 20, 0, - 1, 0, 32, 3, 0, 0, - 20, 0, 1, 0, 52, 3, + 24, 3, 0, 0, 20, 0, + 1, 0, 44, 3, 0, 0, + 20, 0, 1, 0, 64, 3, 0, 0, 80, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 76, 116, 71, 116, 0, @@ -204,7 +204,9 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGt[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc index 3163737059122b9ea46efb7a247382d73cc04958..9c4e780e6ce7924fee0f5dfcfa15033438c074ac 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc @@ -39,7 +39,7 @@ dcl t1.xy // pin<4,5> dcl_2d s0 -#line 104 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 104 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" texld r0, t1, s0 mad r1.w, r0.w, t0.w, -c0.x mul r0, r0, t0 // ::color<0,1,2,3> @@ -69,17 +69,17 @@ ret const BYTE AlphaTestEffect_PSAlphaTestLtGtNoFog[] = { - 68, 88, 66, 67, 156, 146, - 229, 145, 172, 111, 60, 108, - 100, 90, 170, 220, 44, 19, - 147, 95, 1, 0, 0, 0, - 148, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 200, 27, + 254, 82, 190, 48, 231, 23, + 72, 151, 74, 62, 109, 178, + 190, 75, 1, 0, 0, 0, + 160, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 220, 2, 0, 0, 16, 4, - 0, 0, 96, 4, 0, 0, - 65, 111, 110, 57, 164, 2, - 0, 0, 164, 2, 0, 0, - 0, 2, 255, 255, 112, 2, + 232, 2, 0, 0, 28, 4, + 0, 0, 108, 4, 0, 0, + 65, 111, 110, 57, 176, 2, + 0, 0, 176, 2, 0, 0, + 0, 2, 255, 255, 124, 2, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -88,14 +88,14 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGtNoFog[] = 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 121, 0, 68, 66, 85, 71, + 124, 0, 68, 66, 85, 71, 40, 0, 0, 0, 184, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0, 0, 9, 0, 0, 0, 124, 0, 0, 0, 3, 0, 0, 0, 124, 1, 0, 0, - 196, 0, 0, 0, 67, 58, + 196, 0, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -110,18 +110,18 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGtNoFog[] = 116, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 236, 1, 0, 0, - 0, 0, 255, 255, 248, 1, + 255, 255, 248, 1, 0, 0, + 0, 0, 255, 255, 4, 2, 0, 0, 0, 0, 255, 255, - 4, 2, 0, 0, 104, 0, - 0, 0, 16, 2, 0, 0, - 106, 0, 0, 0, 32, 2, + 16, 2, 0, 0, 104, 0, + 0, 0, 28, 2, 0, 0, + 106, 0, 0, 0, 44, 2, 0, 0, 104, 0, 0, 0, - 52, 2, 0, 0, 104, 0, - 0, 0, 68, 2, 0, 0, - 106, 0, 0, 0, 80, 2, + 64, 2, 0, 0, 104, 0, + 0, 0, 80, 2, 0, 0, + 106, 0, 0, 0, 92, 2, 0, 0, 106, 0, 0, 0, - 100, 2, 0, 0, 80, 83, + 112, 2, 0, 0, 80, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 76, 116, 71, 116, 78, 111, 70, 111, 103, @@ -168,7 +168,9 @@ const BYTE AlphaTestEffect_PSAlphaTestLtGtNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc index bb81399d797cb92bcc77e04bf488f6b00a1e537a..51e8b96d4b0e096ba0928a295a8c4ba07dd2fbaf 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc @@ -43,7 +43,7 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSAlphaTest<12> #line 14 @@ -56,15 +56,15 @@ dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 31 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 31 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSAlphaTest<10,11> mov oPos.w, r0.z // ::VSAlphaTest<13> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSAlphaTest<0,1,2,3> mov oT1.xyz, c7.x // ::VSAlphaTest<4,5,6> -#line 38 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 38 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mov oT2.xy, v1 // ::VSAlphaTest<8,9> // approximately 12 instruction slots used @@ -90,17 +90,17 @@ ret const BYTE AlphaTestEffect_VSAlphaTest[] = { - 68, 88, 66, 67, 140, 250, - 248, 103, 246, 98, 11, 172, - 23, 163, 14, 30, 10, 157, - 29, 143, 1, 0, 0, 0, - 252, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 215, 191, + 220, 167, 117, 124, 197, 150, + 220, 90, 78, 96, 232, 251, + 248, 211, 1, 0, 0, 0, + 8, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 188, 4, 0, 0, 24, 6, - 0, 0, 112, 6, 0, 0, - 65, 111, 110, 57, 132, 4, - 0, 0, 132, 4, 0, 0, - 0, 2, 254, 255, 68, 4, + 200, 4, 0, 0, 36, 6, + 0, 0, 124, 6, 0, 0, + 65, 111, 110, 57, 144, 4, + 0, 0, 144, 4, 0, 0, + 0, 2, 254, 255, 80, 4, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -111,14 +111,14 @@ const BYTE AlphaTestEffect_VSAlphaTest[] = 5, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 213, 0, 68, 66, 85, 71, + 216, 0, 68, 66, 85, 71, 40, 0, 0, 0, 40, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 236, 2, 0, 0, - 64, 1, 0, 0, 67, 58, + 64, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -130,7 +130,7 @@ const BYTE AlphaTestEffect_VSAlphaTest[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -146,25 +146,25 @@ const BYTE AlphaTestEffect_VSAlphaTest[] = 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 92, 3, 0, 0, 0, 0, - 255, 255, 116, 3, 0, 0, - 0, 0, 255, 255, 128, 3, + 104, 3, 0, 0, 0, 0, + 255, 255, 128, 3, 0, 0, + 0, 0, 255, 255, 140, 3, 0, 0, 43, 0, 0, 0, - 140, 3, 0, 0, 14, 0, - 0, 0, 156, 3, 0, 0, - 14, 0, 0, 0, 172, 3, + 152, 3, 0, 0, 14, 0, + 0, 0, 168, 3, 0, 0, + 14, 0, 0, 0, 184, 3, 0, 0, 14, 0, 0, 0, - 188, 3, 0, 0, 43, 0, - 0, 0, 204, 3, 0, 0, - 43, 0, 0, 0, 220, 3, + 200, 3, 0, 0, 43, 0, + 0, 0, 216, 3, 0, 0, + 43, 0, 0, 0, 232, 3, 0, 0, 43, 0, 0, 0, - 236, 3, 0, 0, 31, 0, - 1, 0, 252, 3, 0, 0, - 31, 0, 1, 0, 16, 4, + 248, 3, 0, 0, 31, 0, + 1, 0, 8, 4, 0, 0, + 31, 0, 1, 0, 28, 4, 0, 0, 44, 0, 0, 0, - 28, 4, 0, 0, 45, 0, - 0, 0, 40, 4, 0, 0, - 38, 0, 1, 0, 52, 4, + 40, 4, 0, 0, 45, 0, + 0, 0, 52, 4, 0, 0, + 38, 0, 1, 0, 64, 4, 0, 0, 86, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 0, 68, 105, 102, 102, @@ -253,7 +253,9 @@ const BYTE AlphaTestEffect_VSAlphaTest[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc index 7687d1345acf59d7e52046fa9557fa7fb1e43205..751786f1f39c99d1b99984cab094af8c8780678c 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc @@ -41,20 +41,20 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSAlphaTestNoFog<8> dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 45 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 45 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSAlphaTestNoFog<6,7> mov oPos.w, r0.z // ::VSAlphaTestNoFog<9> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSAlphaTestNoFog<0,1,2,3> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mov oT1.xy, v1 // ::VSAlphaTestNoFog<4,5> // approximately 8 instruction slots used @@ -77,17 +77,17 @@ ret const BYTE AlphaTestEffect_VSAlphaTestNoFog[] = { - 68, 88, 66, 67, 248, 2, - 209, 10, 206, 132, 220, 115, - 131, 91, 104, 83, 66, 167, - 100, 45, 1, 0, 0, 0, - 8, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 11, 181, + 82, 81, 226, 16, 97, 224, + 184, 138, 56, 134, 96, 133, + 166, 216, 1, 0, 0, 0, + 20, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 44, 4, 0, 0, 60, 5, - 0, 0, 148, 5, 0, 0, - 65, 111, 110, 57, 244, 3, - 0, 0, 244, 3, 0, 0, - 0, 2, 254, 255, 180, 3, + 56, 4, 0, 0, 72, 5, + 0, 0, 160, 5, 0, 0, + 65, 111, 110, 57, 0, 4, + 0, 0, 0, 4, 0, 0, + 0, 2, 254, 255, 192, 3, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -98,14 +98,14 @@ const BYTE AlphaTestEffect_VSAlphaTestNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 198, 0, 68, 66, 85, 71, + 201, 0, 68, 66, 85, 71, 40, 0, 0, 0, 236, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 10, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 176, 2, 0, 0, - 24, 1, 0, 0, 67, 58, + 24, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -117,7 +117,7 @@ const BYTE AlphaTestEffect_VSAlphaTestNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -133,19 +133,19 @@ const BYTE AlphaTestEffect_VSAlphaTestNoFog[] = 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 32, 3, 0, 0, 0, 0, - 255, 255, 44, 3, 0, 0, - 43, 0, 0, 0, 56, 3, + 44, 3, 0, 0, 0, 0, + 255, 255, 56, 3, 0, 0, + 43, 0, 0, 0, 68, 3, 0, 0, 43, 0, 0, 0, - 72, 3, 0, 0, 43, 0, - 0, 0, 88, 3, 0, 0, - 43, 0, 0, 0, 104, 3, + 84, 3, 0, 0, 43, 0, + 0, 0, 100, 3, 0, 0, + 43, 0, 0, 0, 116, 3, 0, 0, 45, 0, 1, 0, - 120, 3, 0, 0, 45, 0, - 1, 0, 140, 3, 0, 0, - 44, 0, 0, 0, 152, 3, + 132, 3, 0, 0, 45, 0, + 1, 0, 152, 3, 0, 0, + 44, 0, 0, 0, 164, 3, 0, 0, 52, 0, 1, 0, - 164, 3, 0, 0, 86, 83, + 176, 3, 0, 0, 86, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 78, 111, 70, 111, 103, 0, 68, 105, 102, @@ -230,7 +230,9 @@ const BYTE AlphaTestEffect_VSAlphaTestNoFog[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc index ad33aa9c8f41fdce48663f29ba6e3c34d01cd136..0c709a7c1d1eb30d53e192ac78e93d2394782a21 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc @@ -45,7 +45,7 @@ dcl_texcoord1 v1 // vin<4,5> dcl_texcoord2 v2 // vin<6,7,8,9> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSAlphaTestVc<12> #line 14 @@ -53,22 +53,22 @@ max r0.x, r0.x, c7.x min oT1.w, r0.x, c7.y // ::VSAlphaTestVc<7> -#line 67 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 67 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mul oT0, v2, c1 // ::VSAlphaTestVc<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c3 // ::vout<0> dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSAlphaTestVc<10,11> mov oPos.w, r0.z // ::VSAlphaTestVc<13> -#line 45 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 45 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT1.xyz, c7.x // ::VSAlphaTestVc<4,5,6> -#line 66 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 66 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mov oT2.xy, v1 // ::VSAlphaTestVc<8,9> // approximately 12 instruction slots used @@ -95,17 +95,17 @@ ret const BYTE AlphaTestEffect_VSAlphaTestVc[] = { - 68, 88, 66, 67, 84, 82, - 52, 236, 254, 37, 130, 12, - 230, 48, 204, 9, 82, 225, - 210, 117, 1, 0, 0, 0, - 96, 7, 0, 0, 4, 0, + 68, 88, 66, 67, 216, 33, + 230, 173, 148, 214, 70, 100, + 18, 157, 32, 82, 49, 118, + 112, 169, 1, 0, 0, 0, + 108, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 240, 4, 0, 0, 96, 6, - 0, 0, 212, 6, 0, 0, - 65, 111, 110, 57, 184, 4, - 0, 0, 184, 4, 0, 0, - 0, 2, 254, 255, 120, 4, + 252, 4, 0, 0, 108, 6, + 0, 0, 224, 6, 0, 0, + 65, 111, 110, 57, 196, 4, + 0, 0, 196, 4, 0, 0, + 0, 2, 254, 255, 132, 4, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -116,14 +116,14 @@ const BYTE AlphaTestEffect_VSAlphaTestVc[] = 5, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 222, 0, 68, 66, 85, 71, + 225, 0, 68, 66, 85, 71, 40, 0, 0, 0, 76, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 16, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 16, 3, 0, 0, - 72, 1, 0, 0, 67, 58, + 72, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -135,7 +135,7 @@ const BYTE AlphaTestEffect_VSAlphaTestVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -151,27 +151,27 @@ const BYTE AlphaTestEffect_VSAlphaTestVc[] = 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 128, 3, 0, 0, 0, 0, - 255, 255, 152, 3, 0, 0, - 0, 0, 255, 255, 164, 3, + 140, 3, 0, 0, 0, 0, + 255, 255, 164, 3, 0, 0, + 0, 0, 255, 255, 176, 3, 0, 0, 0, 0, 255, 255, - 176, 3, 0, 0, 43, 0, - 0, 0, 188, 3, 0, 0, - 14, 0, 0, 0, 204, 3, + 188, 3, 0, 0, 43, 0, + 0, 0, 200, 3, 0, 0, + 14, 0, 0, 0, 216, 3, 0, 0, 14, 0, 0, 0, - 220, 3, 0, 0, 14, 0, - 0, 0, 236, 3, 0, 0, - 67, 0, 1, 0, 252, 3, + 232, 3, 0, 0, 14, 0, + 0, 0, 248, 3, 0, 0, + 67, 0, 1, 0, 8, 4, 0, 0, 43, 0, 0, 0, - 12, 4, 0, 0, 43, 0, - 0, 0, 28, 4, 0, 0, - 43, 0, 0, 0, 44, 4, + 24, 4, 0, 0, 43, 0, + 0, 0, 40, 4, 0, 0, + 43, 0, 0, 0, 56, 4, 0, 0, 59, 0, 1, 0, - 60, 4, 0, 0, 59, 0, - 1, 0, 80, 4, 0, 0, - 45, 0, 0, 0, 92, 4, + 72, 4, 0, 0, 59, 0, + 1, 0, 92, 4, 0, 0, + 45, 0, 0, 0, 104, 4, 0, 0, 66, 0, 1, 0, - 104, 4, 0, 0, 86, 83, + 116, 4, 0, 0, 86, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 86, 99, 0, 68, 105, 102, 102, 117, 115, @@ -264,7 +264,9 @@ const BYTE AlphaTestEffect_VSAlphaTestVc[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc index ac487f1ca95bffce2fec3a41e983710bdbc041b5..4a02ab83aa2292b88b7b00234fe586a7c41039ee 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc @@ -43,18 +43,18 @@ dcl_texcoord1 v1 // vin<4,5> dcl_texcoord2 v2 // vin<6,7,8,9> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSAlphaTestVcNoFog<8> -#line 82 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 82 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mul oT0, v2, c1 // ::VSAlphaTestVcNoFog<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 74 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" +#line 74 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\AlphaTestEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSAlphaTestVcNoFog<6,7> mov oPos.w, r0.z // ::VSAlphaTestVcNoFog<9> @@ -82,17 +82,17 @@ ret const BYTE AlphaTestEffect_VSAlphaTestVcNoFog[] = { - 68, 88, 66, 67, 74, 170, - 254, 68, 17, 213, 142, 220, - 24, 197, 43, 129, 118, 164, - 64, 53, 1, 0, 0, 0, - 104, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 177, 99, + 97, 235, 29, 185, 115, 88, + 142, 120, 132, 193, 103, 232, + 223, 216, 1, 0, 0, 0, + 116, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 92, 4, 0, 0, 128, 5, - 0, 0, 244, 5, 0, 0, - 65, 111, 110, 57, 36, 4, - 0, 0, 36, 4, 0, 0, - 0, 2, 254, 255, 228, 3, + 104, 4, 0, 0, 140, 5, + 0, 0, 0, 6, 0, 0, + 65, 111, 110, 57, 48, 4, + 0, 0, 48, 4, 0, 0, + 0, 2, 254, 255, 240, 3, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -103,14 +103,14 @@ const BYTE AlphaTestEffect_VSAlphaTestVcNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 206, 0, 68, 66, 85, 71, + 209, 0, 68, 66, 85, 71, 40, 0, 0, 0, 12, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 11, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 208, 2, 0, 0, - 32, 1, 0, 0, 67, 58, + 32, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -122,7 +122,7 @@ const BYTE AlphaTestEffect_VSAlphaTestVcNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -138,20 +138,20 @@ const BYTE AlphaTestEffect_VSAlphaTestVcNoFog[] = 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 64, 3, 0, 0, 0, 0, - 255, 255, 76, 3, 0, 0, - 0, 0, 255, 255, 88, 3, + 76, 3, 0, 0, 0, 0, + 255, 255, 88, 3, 0, 0, + 0, 0, 255, 255, 100, 3, 0, 0, 43, 0, 0, 0, - 100, 3, 0, 0, 82, 0, - 1, 0, 116, 3, 0, 0, - 43, 0, 0, 0, 132, 3, + 112, 3, 0, 0, 82, 0, + 1, 0, 128, 3, 0, 0, + 43, 0, 0, 0, 144, 3, 0, 0, 43, 0, 0, 0, - 148, 3, 0, 0, 43, 0, - 0, 0, 164, 3, 0, 0, - 74, 0, 1, 0, 180, 3, + 160, 3, 0, 0, 43, 0, + 0, 0, 176, 3, 0, 0, + 74, 0, 1, 0, 192, 3, 0, 0, 74, 0, 1, 0, - 200, 3, 0, 0, 81, 0, - 1, 0, 212, 3, 0, 0, + 212, 3, 0, 0, 81, 0, + 1, 0, 224, 3, 0, 0, 86, 83, 65, 108, 112, 104, 97, 84, 101, 115, 116, 86, 99, 78, 111, 70, 111, 103, @@ -240,7 +240,9 @@ const BYTE AlphaTestEffect_VSAlphaTestVcNoFog[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasic.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasic.inc index 9fbb00ea0e27fe7b7a565608e7fed4256843e07b..a6b9612a2c4b323db10918dbf7370fc65c2cac9d 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasic.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasic.inc @@ -31,7 +31,7 @@ dcl t0 // pin<0,1,2,3> dcl t1 // pin<4,5,6,7> -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r0.xyz, c0, t0.w, -t0 mov r1.xyz, t0 // pin<0,1,2> mad r0.xyz, t1.w, r0, r1 // ApplyFog::color<0,1,2> @@ -54,17 +54,17 @@ ret const BYTE BasicEffect_PSBasic[] = { - 68, 88, 66, 67, 114, 189, - 168, 120, 224, 136, 133, 44, - 131, 14, 127, 119, 149, 15, - 203, 133, 1, 0, 0, 0, - 200, 3, 0, 0, 4, 0, + 68, 88, 66, 67, 144, 213, + 146, 10, 42, 151, 153, 148, + 98, 38, 10, 116, 201, 247, + 238, 241, 1, 0, 0, 0, + 212, 3, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 152, 2, 0, 0, 76, 3, - 0, 0, 148, 3, 0, 0, - 65, 111, 110, 57, 96, 2, - 0, 0, 96, 2, 0, 0, - 0, 2, 255, 255, 48, 2, + 164, 2, 0, 0, 88, 3, + 0, 0, 160, 3, 0, 0, + 65, 111, 110, 57, 108, 2, + 0, 0, 108, 2, 0, 0, + 0, 2, 255, 255, 60, 2, 0, 0, 48, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -72,7 +72,7 @@ const BYTE BasicEffect_PSBasic[] = 48, 0, 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 112, 0, 68, 66, + 254, 255, 115, 0, 68, 66, 85, 71, 40, 0, 0, 0, 148, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -80,7 +80,7 @@ const BYTE BasicEffect_PSBasic[] = 0, 0, 116, 0, 0, 0, 3, 0, 0, 0, 88, 1, 0, 0, 172, 0, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -93,15 +93,15 @@ const BYTE BasicEffect_PSBasic[] = 67, 111, 109, 109, 111, 110, 46, 102, 120, 104, 0, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 200, 1, 0, 0, - 0, 0, 255, 255, 212, 1, + 255, 255, 212, 1, 0, 0, + 0, 0, 255, 255, 224, 1, 0, 0, 20, 0, 0, 0, - 224, 1, 0, 0, 20, 0, - 0, 0, 244, 1, 0, 0, - 20, 0, 0, 0, 0, 2, + 236, 1, 0, 0, 20, 0, + 0, 0, 0, 2, 0, 0, + 20, 0, 0, 0, 12, 2, 0, 0, 20, 0, 0, 0, - 20, 2, 0, 0, 20, 0, - 0, 0, 32, 2, 0, 0, + 32, 2, 0, 0, 20, 0, + 0, 0, 44, 2, 0, 0, 80, 83, 66, 97, 115, 105, 99, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0, @@ -147,7 +147,9 @@ const BYTE BasicEffect_PSBasic[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc index 04d4c4197a910d376f805810f1a5483424dcd3c9..ea10994ad16025d90b214a039874d413d05eaded 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc @@ -22,7 +22,7 @@ ps_2_0 dcl t0 // pin<0,1,2,3> -#line 337 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 337 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mov oC0, t0 // ::PSBasicNoFog<0,1,2,3> // approximately 1 instruction slot used @@ -36,23 +36,23 @@ ret const BYTE BasicEffect_PSBasicNoFog[] = { - 68, 88, 66, 67, 39, 255, - 148, 232, 240, 134, 106, 55, - 30, 193, 83, 236, 196, 128, - 65, 237, 1, 0, 0, 0, - 108, 2, 0, 0, 4, 0, + 68, 88, 66, 67, 71, 62, + 194, 137, 38, 29, 1, 76, + 235, 155, 245, 79, 249, 175, + 85, 193, 1, 0, 0, 0, + 120, 2, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 200, 1, 0, 0, 8, 2, - 0, 0, 56, 2, 0, 0, - 65, 111, 110, 57, 144, 1, - 0, 0, 144, 1, 0, 0, - 0, 2, 255, 255, 108, 1, + 212, 1, 0, 0, 20, 2, + 0, 0, 68, 2, 0, 0, + 65, 111, 110, 57, 156, 1, + 0, 0, 156, 1, 0, 0, + 0, 2, 255, 255, 120, 1, 0, 0, 36, 0, 0, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 2, 255, 255, - 254, 255, 82, 0, 68, 66, + 254, 255, 85, 0, 68, 66, 85, 71, 40, 0, 0, 0, 28, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -60,7 +60,7 @@ const BYTE BasicEffect_PSBasicNoFog[] = 0, 0, 120, 0, 0, 0, 2, 0, 0, 0, 244, 0, 0, 0, 136, 0, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -74,8 +74,8 @@ const BYTE BasicEffect_PSBasicNoFog[] = 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 40, 0, 0, 0, 0, 0, 255, 255, - 80, 1, 0, 0, 81, 1, - 0, 0, 92, 1, 0, 0, + 92, 1, 0, 0, 81, 1, + 0, 0, 104, 1, 0, 0, 80, 83, 66, 97, 115, 105, 99, 78, 111, 70, 111, 103, 0, 171, 171, 171, 1, 0, @@ -107,7 +107,9 @@ const BYTE BasicEffect_PSBasicNoFog[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc index aaae3cbd9831670338b2ed1f64dc5bd6428c3c07..39bec39c5abb11627bc3c6e5d46c4d9a7adb9cd9 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc @@ -34,10 +34,10 @@ dcl t1.xyz // pin<4,5,6> dcl t2 // pin<7,8,9,10> -#line 411 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 411 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" nrm r0.xyz, t1 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r1.x, -c3, r0 // ::dotL<0> dp3 r1.y, -c4, r0 // ::dotL<1> dp3 r1.z, -c5, r0 // ::dotL<2> @@ -46,12 +46,12 @@ cmp r2.xyz, r1, c14.x, c14.y // ::zeroL<0,1,2> mul r1.xyz, r1, r2 // ::diffuse<0,1,2> -#line 410 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 410 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" add r3.xyz, -t0, c12 dp3 r0.w, r3, r3 rsq r0.w, r0.w -#line 33 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 33 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mad r4.xyz, r3, r0.w, -c3 nrm r5.xyz, r4 // ::halfVectors<0,1,2> @@ -93,17 +93,17 @@ mad r0.xyz, r2.w, c11, r0 mul r0.xyz, r0, c2 // ::result<3,4,5> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mul r0.xyz, r0, t2.w -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mul r2.xyz, r1.y, c7 mad r2.xyz, r1.x, c6, r2 mad r1.xyz, r1.z, c8, r2 mov r2.xyz, c0 // Parameters::DiffuseColor<0,1,2> mad r1.xyz, r1, r2, c1 // ::result<0,1,2> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r0.xyz, t2, r1, r0 // AddSpecular::color<0,1,2> #line 20 @@ -171,17 +171,17 @@ ret const BYTE BasicEffect_PSBasicPixelLighting[] = { - 68, 88, 66, 67, 227, 187, - 214, 151, 65, 25, 169, 106, - 56, 182, 107, 171, 138, 197, - 93, 49, 1, 0, 0, 0, - 252, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 1, 55, + 141, 141, 238, 139, 39, 81, + 2, 236, 197, 87, 198, 157, + 8, 158, 1, 0, 0, 0, + 8, 16, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 116, 9, 0, 0, 96, 15, - 0, 0, 200, 15, 0, 0, - 65, 111, 110, 57, 60, 9, - 0, 0, 60, 9, 0, 0, - 0, 2, 255, 255, 12, 9, + 128, 9, 0, 0, 108, 15, + 0, 0, 212, 15, 0, 0, + 65, 111, 110, 57, 72, 9, + 0, 0, 72, 9, 0, 0, + 0, 2, 255, 255, 24, 9, 0, 0, 48, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -189,7 +189,7 @@ const BYTE BasicEffect_PSBasicPixelLighting[] = 48, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 138, 1, 68, 66, + 254, 255, 141, 1, 68, 66, 85, 71, 40, 0, 0, 0, 252, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, @@ -197,7 +197,7 @@ const BYTE BasicEffect_PSBasicPixelLighting[] = 0, 0, 16, 1, 0, 0, 13, 0, 0, 0, 248, 4, 0, 0, 180, 2, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -209,7 +209,7 @@ const BYTE BasicEffect_PSBasicPixelLighting[] = 97, 100, 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -221,7 +221,7 @@ const BYTE BasicEffect_PSBasicPixelLighting[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -236,67 +236,67 @@ const BYTE BasicEffect_PSBasicPixelLighting[] = 120, 104, 0, 171, 40, 0, 0, 0, 115, 0, 0, 0, 188, 0, 0, 0, 0, 0, - 255, 255, 48, 6, 0, 0, - 0, 0, 255, 255, 72, 6, + 255, 255, 60, 6, 0, 0, + 0, 0, 255, 255, 84, 6, 0, 0, 0, 0, 255, 255, - 84, 6, 0, 0, 0, 0, - 255, 255, 96, 6, 0, 0, - 155, 1, 0, 0, 108, 6, + 96, 6, 0, 0, 0, 0, + 255, 255, 108, 6, 0, 0, + 155, 1, 0, 0, 120, 6, 0, 0, 36, 0, 1, 0, - 120, 6, 0, 0, 36, 0, - 1, 0, 136, 6, 0, 0, - 36, 0, 1, 0, 152, 6, + 132, 6, 0, 0, 36, 0, + 1, 0, 148, 6, 0, 0, + 36, 0, 1, 0, 164, 6, 0, 0, 39, 0, 1, 0, - 168, 6, 0, 0, 41, 0, - 1, 0, 188, 6, 0, 0, - 154, 1, 0, 0, 204, 6, + 180, 6, 0, 0, 41, 0, + 1, 0, 200, 6, 0, 0, + 154, 1, 0, 0, 216, 6, 0, 0, 154, 1, 0, 0, - 220, 6, 0, 0, 154, 1, - 0, 0, 236, 6, 0, 0, - 33, 0, 1, 0, 248, 6, + 232, 6, 0, 0, 154, 1, + 0, 0, 248, 6, 0, 0, + 33, 0, 1, 0, 4, 7, 0, 0, 33, 0, 1, 0, - 12, 7, 0, 0, 37, 0, - 1, 0, 24, 7, 0, 0, - 33, 0, 1, 0, 40, 7, + 24, 7, 0, 0, 37, 0, + 1, 0, 36, 7, 0, 0, + 33, 0, 1, 0, 52, 7, 0, 0, 33, 0, 1, 0, - 60, 7, 0, 0, 33, 0, - 1, 0, 80, 7, 0, 0, - 37, 0, 1, 0, 92, 7, + 72, 7, 0, 0, 33, 0, + 1, 0, 92, 7, 0, 0, + 37, 0, 1, 0, 104, 7, 0, 0, 33, 0, 1, 0, - 108, 7, 0, 0, 37, 0, - 1, 0, 120, 7, 0, 0, - 42, 0, 1, 0, 136, 7, + 120, 7, 0, 0, 37, 0, + 1, 0, 132, 7, 0, 0, + 42, 0, 1, 0, 148, 7, 0, 0, 42, 0, 1, 0, - 152, 7, 0, 0, 42, 0, - 1, 0, 172, 7, 0, 0, - 42, 0, 1, 0, 184, 7, + 164, 7, 0, 0, 42, 0, + 1, 0, 184, 7, 0, 0, + 42, 0, 1, 0, 196, 7, 0, 0, 42, 0, 1, 0, - 196, 7, 0, 0, 42, 0, - 1, 0, 208, 7, 0, 0, - 42, 0, 1, 0, 224, 7, + 208, 7, 0, 0, 42, 0, + 1, 0, 220, 7, 0, 0, + 42, 0, 1, 0, 236, 7, 0, 0, 47, 0, 1, 0, - 236, 7, 0, 0, 42, 0, - 1, 0, 252, 7, 0, 0, - 42, 0, 1, 0, 8, 8, + 248, 7, 0, 0, 42, 0, + 1, 0, 8, 8, 0, 0, + 42, 0, 1, 0, 20, 8, 0, 0, 47, 0, 1, 0, - 20, 8, 0, 0, 47, 0, - 1, 0, 40, 8, 0, 0, - 47, 0, 1, 0, 60, 8, + 32, 8, 0, 0, 47, 0, + 1, 0, 52, 8, 0, 0, + 47, 0, 1, 0, 72, 8, 0, 0, 26, 0, 2, 0, - 76, 8, 0, 0, 46, 0, - 1, 0, 92, 8, 0, 0, - 46, 0, 1, 0, 108, 8, + 88, 8, 0, 0, 46, 0, + 1, 0, 104, 8, 0, 0, + 46, 0, 1, 0, 120, 8, 0, 0, 46, 0, 1, 0, - 128, 8, 0, 0, 46, 0, - 1, 0, 148, 8, 0, 0, - 46, 0, 1, 0, 160, 8, + 140, 8, 0, 0, 46, 0, + 1, 0, 160, 8, 0, 0, + 46, 0, 1, 0, 172, 8, 0, 0, 26, 0, 2, 0, - 180, 8, 0, 0, 20, 0, - 2, 0, 200, 8, 0, 0, - 20, 0, 2, 0, 220, 8, + 192, 8, 0, 0, 20, 0, + 2, 0, 212, 8, 0, 0, + 20, 0, 2, 0, 232, 8, 0, 0, 20, 0, 2, 0, - 240, 8, 0, 0, 20, 0, - 2, 0, 252, 8, 0, 0, + 252, 8, 0, 0, 20, 0, + 2, 0, 8, 9, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, @@ -452,7 +452,9 @@ const BYTE BasicEffect_PSBasicPixelLighting[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 14, 0, 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc index 45a342c8aa5f632280d7fc6c09405023821a8cc9..6065ed1a1cedd7182ba9541c4dd4fc186aa88d6f 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc @@ -44,13 +44,13 @@ dcl t3 // pin<9,10,11,12> dcl_2d s0 -#line 427 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 427 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" texld r0, t0, s0 #line 430 nrm r1.xyz, t2 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, -c3, r1 // ::dotL<0> dp3 r2.y, -c4, r1 // ::dotL<1> dp3 r2.z, -c5, r1 // ::dotL<2> @@ -59,12 +59,12 @@ cmp r3.xyz, r2, c14.x, c14.y // ::zeroL<0,1,2> mul r2.xyz, r2, r3 // ::diffuse<0,1,2> -#line 429 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 429 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" add r4.xyz, -t1, c12 dp3 r1.w, r4, r4 rsq r1.w, r1.w -#line 33 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 33 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mad r5.xyz, r4, r1.w, -c3 nrm r6.xyz, r5 // ::halfVectors<0,1,2> @@ -106,20 +106,20 @@ mad r1.xyz, r3.w, c11, r1 mul r1.xyz, r1, c2 // ::result<3,4,5> -#line 427 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 427 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul r0, r0, t3 // ::color<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mul r1.xyz, r0.w, r1 -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mul r3.xyz, r2.y, c7 mad r3.xyz, r2.x, c6, r3 mad r2.xyz, r2.z, c8, r3 mov r3.xyz, c0 // Parameters::DiffuseColor<0,1,2> mad r2.xyz, r2, r3, c1 // ::result<0,1,2> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, r0, r2, r1 // AddSpecular::color<0,1,2> #line 20 @@ -191,17 +191,17 @@ ret const BYTE BasicEffect_PSBasicPixelLightingTx[] = { - 68, 88, 66, 67, 161, 21, - 26, 188, 147, 113, 169, 193, - 213, 164, 203, 139, 151, 130, - 20, 162, 1, 0, 0, 0, - 20, 17, 0, 0, 4, 0, + 68, 88, 66, 67, 225, 233, + 212, 21, 229, 103, 1, 60, + 236, 208, 251, 255, 120, 10, + 74, 19, 1, 0, 0, 0, + 32, 17, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 12, 10, 0, 0, 96, 16, - 0, 0, 224, 16, 0, 0, - 65, 111, 110, 57, 212, 9, - 0, 0, 212, 9, 0, 0, - 0, 2, 255, 255, 160, 9, + 24, 10, 0, 0, 108, 16, + 0, 0, 236, 16, 0, 0, + 65, 111, 110, 57, 224, 9, + 0, 0, 224, 9, 0, 0, + 0, 2, 255, 255, 172, 9, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -210,14 +210,14 @@ const BYTE BasicEffect_PSBasicPixelLightingTx[] = 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 164, 1, 68, 66, 85, 71, + 167, 1, 68, 66, 85, 71, 40, 0, 0, 0, 100, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 49, 0, 0, 0, 16, 1, 0, 0, 14, 0, 0, 0, 76, 5, 0, 0, - 204, 2, 0, 0, 67, 58, + 204, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -230,7 +230,7 @@ const BYTE BasicEffect_PSBasicPixelLightingTx[] = 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, 120, - 0, 67, 58, 92, 65, 84, + 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, @@ -242,7 +242,7 @@ const BYTE BasicEffect_PSBasicPixelLightingTx[] = 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, 102, 120, - 104, 0, 67, 58, 92, 65, + 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -257,71 +257,71 @@ const BYTE BasicEffect_PSBasicPixelLightingTx[] = 0, 171, 40, 0, 0, 0, 115, 0, 0, 0, 188, 0, 0, 0, 0, 0, 255, 255, - 152, 6, 0, 0, 0, 0, - 255, 255, 176, 6, 0, 0, - 0, 0, 255, 255, 188, 6, + 164, 6, 0, 0, 0, 0, + 255, 255, 188, 6, 0, 0, + 0, 0, 255, 255, 200, 6, 0, 0, 0, 0, 255, 255, - 200, 6, 0, 0, 0, 0, - 255, 255, 212, 6, 0, 0, - 0, 0, 255, 255, 224, 6, + 212, 6, 0, 0, 0, 0, + 255, 255, 224, 6, 0, 0, + 0, 0, 255, 255, 236, 6, 0, 0, 171, 1, 0, 0, - 236, 6, 0, 0, 174, 1, - 0, 0, 252, 6, 0, 0, - 36, 0, 1, 0, 8, 7, + 248, 6, 0, 0, 174, 1, + 0, 0, 8, 7, 0, 0, + 36, 0, 1, 0, 20, 7, 0, 0, 36, 0, 1, 0, - 24, 7, 0, 0, 36, 0, - 1, 0, 40, 7, 0, 0, - 39, 0, 1, 0, 56, 7, + 36, 7, 0, 0, 36, 0, + 1, 0, 52, 7, 0, 0, + 39, 0, 1, 0, 68, 7, 0, 0, 41, 0, 1, 0, - 76, 7, 0, 0, 173, 1, - 0, 0, 92, 7, 0, 0, - 173, 1, 0, 0, 108, 7, + 88, 7, 0, 0, 173, 1, + 0, 0, 104, 7, 0, 0, + 173, 1, 0, 0, 120, 7, 0, 0, 173, 1, 0, 0, - 124, 7, 0, 0, 33, 0, - 1, 0, 136, 7, 0, 0, - 33, 0, 1, 0, 156, 7, + 136, 7, 0, 0, 33, 0, + 1, 0, 148, 7, 0, 0, + 33, 0, 1, 0, 168, 7, 0, 0, 37, 0, 1, 0, - 168, 7, 0, 0, 33, 0, - 1, 0, 184, 7, 0, 0, - 33, 0, 1, 0, 204, 7, + 180, 7, 0, 0, 33, 0, + 1, 0, 196, 7, 0, 0, + 33, 0, 1, 0, 216, 7, 0, 0, 33, 0, 1, 0, - 224, 7, 0, 0, 37, 0, - 1, 0, 236, 7, 0, 0, - 33, 0, 1, 0, 252, 7, + 236, 7, 0, 0, 37, 0, + 1, 0, 248, 7, 0, 0, + 33, 0, 1, 0, 8, 8, 0, 0, 37, 0, 1, 0, - 8, 8, 0, 0, 42, 0, - 1, 0, 24, 8, 0, 0, - 42, 0, 1, 0, 40, 8, + 20, 8, 0, 0, 42, 0, + 1, 0, 36, 8, 0, 0, + 42, 0, 1, 0, 52, 8, 0, 0, 42, 0, 1, 0, - 60, 8, 0, 0, 42, 0, - 1, 0, 72, 8, 0, 0, - 42, 0, 1, 0, 84, 8, + 72, 8, 0, 0, 42, 0, + 1, 0, 84, 8, 0, 0, + 42, 0, 1, 0, 96, 8, 0, 0, 42, 0, 1, 0, - 96, 8, 0, 0, 42, 0, - 1, 0, 112, 8, 0, 0, - 47, 0, 1, 0, 124, 8, + 108, 8, 0, 0, 42, 0, + 1, 0, 124, 8, 0, 0, + 47, 0, 1, 0, 136, 8, 0, 0, 42, 0, 1, 0, - 140, 8, 0, 0, 42, 0, - 1, 0, 152, 8, 0, 0, - 47, 0, 1, 0, 164, 8, + 152, 8, 0, 0, 42, 0, + 1, 0, 164, 8, 0, 0, + 47, 0, 1, 0, 176, 8, 0, 0, 47, 0, 1, 0, - 184, 8, 0, 0, 47, 0, - 1, 0, 204, 8, 0, 0, - 171, 1, 0, 0, 220, 8, + 196, 8, 0, 0, 47, 0, + 1, 0, 216, 8, 0, 0, + 171, 1, 0, 0, 232, 8, 0, 0, 26, 0, 2, 0, - 236, 8, 0, 0, 46, 0, - 1, 0, 252, 8, 0, 0, - 46, 0, 1, 0, 12, 9, + 248, 8, 0, 0, 46, 0, + 1, 0, 8, 9, 0, 0, + 46, 0, 1, 0, 24, 9, 0, 0, 46, 0, 1, 0, - 32, 9, 0, 0, 46, 0, - 1, 0, 52, 9, 0, 0, - 46, 0, 1, 0, 64, 9, + 44, 9, 0, 0, 46, 0, + 1, 0, 64, 9, 0, 0, + 46, 0, 1, 0, 76, 9, 0, 0, 26, 0, 2, 0, - 84, 9, 0, 0, 20, 0, - 2, 0, 104, 9, 0, 0, - 20, 0, 2, 0, 124, 9, + 96, 9, 0, 0, 20, 0, + 2, 0, 116, 9, 0, 0, + 20, 0, 2, 0, 136, 9, 0, 0, 20, 0, 2, 0, - 144, 9, 0, 0, 80, 97, + 156, 9, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, 67, 111, @@ -490,7 +490,9 @@ const BYTE BasicEffect_PSBasicPixelLightingTx[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 14, 0, 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc index 8a6433a67ecdeecdc3f7ad91600a5d5ae77a1cce..af95054c275fec21967eab2e73cf7ad94db3a730 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc @@ -41,11 +41,11 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 344 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 344 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" texld r0, t2, s0 mul r0, r0, t0 // ::color<0,1,2,3> -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, c0, r0.w, -r0 mad r0.xyz, t1.w, r1, r0 // ApplyFog::color<0,1,2> mov oC0, r0 // ::PSBasicTx<0,1,2,3> @@ -71,17 +71,17 @@ ret const BYTE BasicEffect_PSBasicTx[] = { - 68, 88, 66, 67, 188, 186, - 68, 183, 113, 27, 163, 65, - 177, 98, 193, 7, 58, 127, - 141, 151, 1, 0, 0, 0, - 24, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 12, 246, + 6, 35, 46, 21, 42, 46, + 181, 41, 112, 166, 143, 179, + 170, 18, 1, 0, 0, 0, + 36, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 96, 3, 0, 0, 124, 4, - 0, 0, 228, 4, 0, 0, - 65, 111, 110, 57, 40, 3, - 0, 0, 40, 3, 0, 0, - 0, 2, 255, 255, 244, 2, + 108, 3, 0, 0, 136, 4, + 0, 0, 240, 4, 0, 0, + 65, 111, 110, 57, 52, 3, + 0, 0, 52, 3, 0, 0, + 0, 2, 255, 255, 0, 3, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -90,14 +90,14 @@ const BYTE BasicEffect_PSBasicTx[] = 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 153, 0, 68, 66, 85, 71, + 156, 0, 68, 66, 85, 71, 40, 0, 0, 0, 56, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 9, 0, 0, 0, 196, 0, 0, 0, 4, 0, 0, 0, 232, 1, 0, 0, - 12, 1, 0, 0, 67, 58, + 12, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -110,7 +110,7 @@ const BYTE BasicEffect_PSBasicTx[] = 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, 120, - 0, 67, 58, 92, 65, 84, + 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, @@ -124,18 +124,18 @@ const BYTE BasicEffect_PSBasicTx[] = 110, 46, 102, 120, 104, 0, 171, 171, 40, 0, 0, 0, 115, 0, 0, 0, 0, 0, - 255, 255, 108, 2, 0, 0, - 0, 0, 255, 255, 120, 2, + 255, 255, 120, 2, 0, 0, + 0, 0, 255, 255, 132, 2, 0, 0, 0, 0, 255, 255, - 132, 2, 0, 0, 0, 0, - 255, 255, 144, 2, 0, 0, - 88, 1, 0, 0, 156, 2, + 144, 2, 0, 0, 0, 0, + 255, 255, 156, 2, 0, 0, + 88, 1, 0, 0, 168, 2, 0, 0, 88, 1, 0, 0, - 172, 2, 0, 0, 20, 0, - 1, 0, 188, 2, 0, 0, - 20, 0, 1, 0, 208, 2, + 184, 2, 0, 0, 20, 0, + 1, 0, 200, 2, 0, 0, + 20, 0, 1, 0, 220, 2, 0, 0, 20, 0, 1, 0, - 228, 2, 0, 0, 80, 83, + 240, 2, 0, 0, 80, 83, 66, 97, 115, 105, 99, 84, 120, 0, 171, 171, 1, 0, 3, 0, 1, 0, 4, 0, @@ -192,7 +192,9 @@ const BYTE BasicEffect_PSBasicTx[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc index 995d40a13fbce413ab72db1f2793d13da5bead3f..203ff9f4752a6b98af53ba26617b477578545b11 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc @@ -32,7 +32,7 @@ dcl t1.xy // pin<4,5> dcl_2d s0 -#line 355 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 355 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" texld r0, t1, s0 mul r0, r0, t0 // ::PSBasicTxNoFog<0,1,2,3> mov oC0, r0 // ::PSBasicTxNoFog<0,1,2,3> @@ -53,31 +53,31 @@ ret const BYTE BasicEffect_PSBasicTxNoFog[] = { - 68, 88, 66, 67, 202, 62, - 43, 24, 24, 167, 50, 82, - 241, 156, 231, 82, 42, 172, - 68, 12, 1, 0, 0, 0, - 128, 3, 0, 0, 4, 0, + 68, 88, 66, 67, 154, 40, + 86, 105, 130, 38, 173, 144, + 185, 17, 127, 166, 55, 147, + 104, 63, 1, 0, 0, 0, + 140, 3, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 96, 2, 0, 0, 252, 2, - 0, 0, 76, 3, 0, 0, - 65, 111, 110, 57, 40, 2, - 0, 0, 40, 2, 0, 0, - 0, 2, 255, 255, 0, 2, + 108, 2, 0, 0, 8, 3, + 0, 0, 88, 3, 0, 0, + 65, 111, 110, 57, 52, 2, + 0, 0, 52, 2, 0, 0, + 0, 2, 255, 255, 12, 2, 0, 0, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 105, 0, 68, 66, 85, 71, + 108, 0, 68, 66, 85, 71, 40, 0, 0, 0, 120, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 6, 0, 0, 0, 120, 0, 0, 0, 2, 0, 0, 0, 80, 1, 0, 0, - 168, 0, 0, 0, 67, 58, + 168, 0, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -91,14 +91,14 @@ const BYTE BasicEffect_PSBasicTxNoFog[] = 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 172, 1, + 0, 0, 255, 255, 184, 1, 0, 0, 0, 0, 255, 255, - 184, 1, 0, 0, 0, 0, - 255, 255, 196, 1, 0, 0, - 99, 1, 0, 0, 208, 1, + 196, 1, 0, 0, 0, 0, + 255, 255, 208, 1, 0, 0, + 99, 1, 0, 0, 220, 1, 0, 0, 99, 1, 0, 0, - 224, 1, 0, 0, 99, 1, - 0, 0, 240, 1, 0, 0, + 236, 1, 0, 0, 99, 1, + 0, 0, 252, 1, 0, 0, 80, 83, 66, 97, 115, 105, 99, 84, 120, 78, 111, 70, 111, 103, 0, 171, 1, 0, @@ -140,7 +140,9 @@ const BYTE BasicEffect_PSBasicTxNoFog[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc index 0ce1f0bb0d69041c476501643726a24e250ea0eb..a73646cc90a76f3dad4736930285c1d636cc73b3 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc @@ -31,7 +31,7 @@ dcl t0 // pin<0,1,2,3> dcl t1 // pin<4,5,6,7> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov r0, t0 // pin<0,1,2,3> mad r0.xyz, t1, r0.w, r0 // AddSpecular::color<0,1,2> @@ -58,17 +58,17 @@ ret const BYTE BasicEffect_PSBasicVertexLighting[] = { - 68, 88, 66, 67, 18, 102, - 41, 118, 121, 177, 81, 62, - 18, 101, 73, 36, 154, 122, - 83, 100, 1, 0, 0, 0, - 68, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 85, 84, + 21, 236, 108, 84, 43, 246, + 195, 173, 160, 136, 202, 82, + 26, 132, 1, 0, 0, 0, + 80, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 240, 2, 0, 0, 200, 3, - 0, 0, 16, 4, 0, 0, - 65, 111, 110, 57, 184, 2, - 0, 0, 184, 2, 0, 0, - 0, 2, 255, 255, 136, 2, + 252, 2, 0, 0, 212, 3, + 0, 0, 28, 4, 0, 0, + 65, 111, 110, 57, 196, 2, + 0, 0, 196, 2, 0, 0, + 0, 2, 255, 255, 148, 2, 0, 0, 48, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -76,7 +76,7 @@ const BYTE BasicEffect_PSBasicVertexLighting[] = 48, 0, 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 129, 0, 68, 66, + 254, 255, 132, 0, 68, 66, 85, 71, 40, 0, 0, 0, 216, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -84,7 +84,7 @@ const BYTE BasicEffect_PSBasicVertexLighting[] = 0, 0, 116, 0, 0, 0, 4, 0, 0, 0, 136, 1, 0, 0, 180, 0, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -97,16 +97,16 @@ const BYTE BasicEffect_PSBasicVertexLighting[] = 67, 111, 109, 109, 111, 110, 46, 102, 120, 104, 0, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 12, 2, 0, 0, - 0, 0, 255, 255, 24, 2, + 255, 255, 24, 2, 0, 0, + 0, 0, 255, 255, 36, 2, 0, 0, 26, 0, 0, 0, - 36, 2, 0, 0, 26, 0, - 0, 0, 48, 2, 0, 0, - 20, 0, 0, 0, 68, 2, + 48, 2, 0, 0, 26, 0, + 0, 0, 60, 2, 0, 0, + 20, 0, 0, 0, 80, 2, 0, 0, 20, 0, 0, 0, - 88, 2, 0, 0, 20, 0, - 0, 0, 108, 2, 0, 0, - 20, 0, 0, 0, 120, 2, + 100, 2, 0, 0, 20, 0, + 0, 0, 120, 2, 0, 0, + 20, 0, 0, 0, 132, 2, 0, 0, 80, 83, 66, 97, 115, 105, 99, 86, 101, 114, 116, 101, 120, 76, 105, 103, @@ -162,7 +162,9 @@ const BYTE BasicEffect_PSBasicVertexLighting[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc index c15941084c20583a35354cadf980558326a1aaef..42f265310e725d704d9f8be48aad272bca5f6f0b 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc @@ -24,7 +24,7 @@ dcl t0 // pin<0,1,2,3> dcl t1 // pin<4,5,6,7> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov r0, t0 // pin<0,1,2,3> mad r0.xyz, t1, r0.w, r0 // AddSpecular::color<0,1,2> mov r0.w, t0.w @@ -43,23 +43,23 @@ ret const BYTE BasicEffect_PSBasicVertexLightingNoFog[] = { - 68, 88, 66, 67, 222, 218, - 17, 223, 30, 109, 53, 74, - 83, 79, 76, 240, 237, 58, - 25, 229, 1, 0, 0, 0, - 116, 3, 0, 0, 4, 0, + 68, 88, 66, 67, 233, 121, + 8, 241, 32, 247, 137, 149, + 161, 109, 168, 156, 18, 7, + 245, 50, 1, 0, 0, 0, + 128, 3, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 136, 2, 0, 0, 248, 2, - 0, 0, 64, 3, 0, 0, - 65, 111, 110, 57, 80, 2, - 0, 0, 80, 2, 0, 0, - 0, 2, 255, 255, 44, 2, + 148, 2, 0, 0, 4, 3, + 0, 0, 76, 3, 0, 0, + 65, 111, 110, 57, 92, 2, + 0, 0, 92, 2, 0, 0, + 0, 2, 255, 255, 56, 2, 0, 0, 36, 0, 0, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 2, 255, 255, - 254, 255, 116, 0, 68, 66, + 254, 255, 119, 0, 68, 66, 85, 71, 40, 0, 0, 0, 164, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -67,7 +67,7 @@ const BYTE BasicEffect_PSBasicVertexLightingNoFog[] = 0, 0, 116, 0, 0, 0, 3, 0, 0, 0, 104, 1, 0, 0, 164, 0, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -80,14 +80,14 @@ const BYTE BasicEffect_PSBasicVertexLightingNoFog[] = 67, 111, 109, 109, 111, 110, 46, 102, 120, 104, 0, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 216, 1, 0, 0, - 0, 0, 255, 255, 228, 1, + 255, 255, 228, 1, 0, 0, + 0, 0, 255, 255, 240, 1, 0, 0, 26, 0, 0, 0, - 240, 1, 0, 0, 26, 0, - 0, 0, 252, 1, 0, 0, - 26, 0, 0, 0, 16, 2, + 252, 1, 0, 0, 26, 0, + 0, 0, 8, 2, 0, 0, + 26, 0, 0, 0, 28, 2, 0, 0, 26, 0, 0, 0, - 28, 2, 0, 0, 80, 83, + 40, 2, 0, 0, 80, 83, 66, 97, 115, 105, 99, 86, 101, 114, 116, 101, 120, 76, 105, 103, 104, 116, 105, 110, @@ -136,7 +136,9 @@ const BYTE BasicEffect_PSBasicVertexLightingNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc index 8ac3fc123a1018a84e04dfea60fbe5a27a86ca57..c7164cf67eb7133c8b8007bc9fc02437ac1ffb26 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc @@ -41,11 +41,11 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 385 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 385 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" texld r0, t2, s0 mul r0, r0, t0 // ::color<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, t1, r0.w, r0 // AddSpecular::color<0,1,2> #line 20 @@ -75,17 +75,17 @@ ret const BYTE BasicEffect_PSBasicVertexLightingTx[] = { - 68, 88, 66, 67, 12, 45, - 32, 233, 77, 105, 178, 222, - 233, 127, 45, 216, 102, 162, - 107, 125, 1, 0, 0, 0, - 144, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 74, 168, + 233, 44, 228, 142, 191, 94, + 132, 217, 50, 67, 252, 133, + 87, 7, 1, 0, 0, 0, + 156, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 180, 3, 0, 0, 244, 4, - 0, 0, 92, 5, 0, 0, - 65, 111, 110, 57, 124, 3, - 0, 0, 124, 3, 0, 0, - 0, 2, 255, 255, 72, 3, + 192, 3, 0, 0, 0, 5, + 0, 0, 104, 5, 0, 0, + 65, 111, 110, 57, 136, 3, + 0, 0, 136, 3, 0, 0, + 0, 2, 255, 255, 84, 3, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -94,14 +94,14 @@ const BYTE BasicEffect_PSBasicVertexLightingTx[] = 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 169, 0, 68, 66, 85, 71, + 172, 0, 68, 66, 85, 71, 40, 0, 0, 0, 120, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 10, 0, 0, 0, 196, 0, 0, 0, 5, 0, 0, 0, 20, 2, 0, 0, - 20, 1, 0, 0, 67, 58, + 20, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -114,7 +114,7 @@ const BYTE BasicEffect_PSBasicVertexLightingTx[] = 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, 120, - 0, 67, 58, 92, 65, 84, + 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, @@ -128,19 +128,19 @@ const BYTE BasicEffect_PSBasicVertexLightingTx[] = 110, 46, 102, 120, 104, 0, 171, 171, 40, 0, 0, 0, 115, 0, 0, 0, 0, 0, - 255, 255, 172, 2, 0, 0, - 0, 0, 255, 255, 184, 2, + 255, 255, 184, 2, 0, 0, + 0, 0, 255, 255, 196, 2, 0, 0, 0, 0, 255, 255, - 196, 2, 0, 0, 0, 0, - 255, 255, 208, 2, 0, 0, - 129, 1, 0, 0, 220, 2, + 208, 2, 0, 0, 0, 0, + 255, 255, 220, 2, 0, 0, + 129, 1, 0, 0, 232, 2, 0, 0, 129, 1, 0, 0, - 236, 2, 0, 0, 26, 0, - 1, 0, 252, 2, 0, 0, - 20, 0, 1, 0, 16, 3, + 248, 2, 0, 0, 26, 0, + 1, 0, 8, 3, 0, 0, + 20, 0, 1, 0, 28, 3, 0, 0, 20, 0, 1, 0, - 36, 3, 0, 0, 20, 0, - 1, 0, 56, 3, 0, 0, + 48, 3, 0, 0, 20, 0, + 1, 0, 68, 3, 0, 0, 80, 83, 66, 97, 115, 105, 99, 86, 101, 114, 116, 101, 120, 76, 105, 103, 104, 116, @@ -206,7 +206,9 @@ const BYTE BasicEffect_PSBasicVertexLightingTx[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc index 04752bd2f12c06170b77570c6c74e446e8c00cfd..528843300454454bf75813ce70a6f8ddf66d181f 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc @@ -34,11 +34,11 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 397 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 397 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" texld r0, t2, s0 mul r0, r0, t0 // ::color<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r0.xyz, t1, r0.w, r0 // AddSpecular::color<0,1,2> mov oC0, r0 // ::PSBasicVertexLightingTxNoFog<0,1,2,3> @@ -61,31 +61,31 @@ ret const BYTE BasicEffect_PSBasicVertexLightingTxNoFog[] = { - 68, 88, 66, 67, 102, 167, - 231, 71, 98, 80, 177, 139, - 206, 229, 55, 104, 245, 36, - 234, 197, 1, 0, 0, 0, - 204, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 85, 43, + 164, 222, 187, 49, 164, 113, + 33, 93, 63, 223, 12, 135, + 134, 162, 1, 0, 0, 0, + 216, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 80, 3, 0, 0, 48, 4, - 0, 0, 152, 4, 0, 0, - 65, 111, 110, 57, 24, 3, - 0, 0, 24, 3, 0, 0, - 0, 2, 255, 255, 240, 2, + 92, 3, 0, 0, 60, 4, + 0, 0, 164, 4, 0, 0, + 65, 111, 110, 57, 36, 3, + 0, 0, 36, 3, 0, 0, + 0, 2, 255, 255, 252, 2, 0, 0, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 157, 0, 68, 66, 85, 71, + 160, 0, 68, 66, 85, 71, 40, 0, 0, 0, 72, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 8, 0, 0, 0, 196, 0, 0, 0, 4, 0, 0, 0, 248, 1, 0, 0, - 4, 1, 0, 0, 67, 58, + 4, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -98,7 +98,7 @@ const BYTE BasicEffect_PSBasicVertexLightingTxNoFog[] = 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, 120, - 0, 67, 58, 92, 65, 84, + 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, @@ -112,16 +112,16 @@ const BYTE BasicEffect_PSBasicVertexLightingTxNoFog[] = 110, 46, 102, 120, 104, 0, 171, 171, 40, 0, 0, 0, 115, 0, 0, 0, 0, 0, - 255, 255, 124, 2, 0, 0, - 0, 0, 255, 255, 136, 2, + 255, 255, 136, 2, 0, 0, + 0, 0, 255, 255, 148, 2, 0, 0, 0, 0, 255, 255, - 148, 2, 0, 0, 0, 0, - 255, 255, 160, 2, 0, 0, - 141, 1, 0, 0, 172, 2, + 160, 2, 0, 0, 0, 0, + 255, 255, 172, 2, 0, 0, + 141, 1, 0, 0, 184, 2, 0, 0, 141, 1, 0, 0, - 188, 2, 0, 0, 26, 0, - 1, 0, 204, 2, 0, 0, - 26, 0, 1, 0, 224, 2, + 200, 2, 0, 0, 26, 0, + 1, 0, 216, 2, 0, 0, + 26, 0, 1, 0, 236, 2, 0, 0, 80, 83, 66, 97, 115, 105, 99, 86, 101, 114, 116, 101, 120, 76, 105, 103, @@ -182,7 +182,9 @@ const BYTE BasicEffect_PSBasicVertexLightingTxNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasic.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasic.inc index 3167d5dab88eebad25d31834b2e188eed31a1c33..048bb750cb83d3361c70689ef8fa323865dc7c5e 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasic.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasic.inc @@ -41,7 +41,7 @@ def c7, 0, 1, 0, 0 dcl_texcoord v0 // vin<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSBasic<10> #line 14 @@ -54,11 +54,11 @@ dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasic<8,9> mov oPos.w, r0.z // ::VSBasic<11> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSBasic<0,1,2,3> mov oT1.xyz, c7.x // ::VSBasic<4,5,6> @@ -82,17 +82,17 @@ ret const BYTE BasicEffect_VSBasic[] = { - 68, 88, 66, 67, 167, 3, - 36, 114, 168, 80, 114, 14, - 30, 56, 143, 162, 14, 97, - 122, 15, 1, 0, 0, 0, - 36, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 100, 48, + 155, 211, 252, 56, 204, 202, + 68, 23, 233, 41, 111, 177, + 218, 85, 1, 0, 0, 0, + 48, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 84, 4, 0, 0, 132, 5, - 0, 0, 184, 5, 0, 0, - 65, 111, 110, 57, 28, 4, - 0, 0, 28, 4, 0, 0, - 0, 2, 254, 255, 208, 3, + 96, 4, 0, 0, 144, 5, + 0, 0, 196, 5, 0, 0, + 65, 111, 110, 57, 40, 4, + 0, 0, 40, 4, 0, 0, + 0, 2, 254, 255, 220, 3, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -105,14 +105,14 @@ const BYTE BasicEffect_VSBasic[] = 4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 190, 0, 68, 66, 85, 71, + 193, 0, 68, 66, 85, 71, 40, 0, 0, 0, 204, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 13, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 144, 2, 0, 0, - 44, 1, 0, 0, 67, 58, + 44, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -124,7 +124,7 @@ const BYTE BasicEffect_VSBasic[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -139,23 +139,23 @@ const BYTE BasicEffect_VSBasic[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 0, 3, 0, 0, - 0, 0, 255, 255, 24, 3, + 255, 255, 12, 3, 0, 0, + 0, 0, 255, 255, 36, 3, 0, 0, 43, 0, 0, 0, - 36, 3, 0, 0, 14, 0, - 0, 0, 52, 3, 0, 0, - 14, 0, 0, 0, 68, 3, + 48, 3, 0, 0, 14, 0, + 0, 0, 64, 3, 0, 0, + 14, 0, 0, 0, 80, 3, 0, 0, 14, 0, 0, 0, - 84, 3, 0, 0, 43, 0, - 0, 0, 100, 3, 0, 0, - 43, 0, 0, 0, 116, 3, + 96, 3, 0, 0, 43, 0, + 0, 0, 112, 3, 0, 0, + 43, 0, 0, 0, 128, 3, 0, 0, 43, 0, 0, 0, - 132, 3, 0, 0, 44, 0, - 1, 0, 148, 3, 0, 0, - 44, 0, 1, 0, 168, 3, + 144, 3, 0, 0, 44, 0, + 1, 0, 160, 3, 0, 0, + 44, 0, 1, 0, 180, 3, 0, 0, 44, 0, 0, 0, - 180, 3, 0, 0, 45, 0, - 0, 0, 192, 3, 0, 0, + 192, 3, 0, 0, 45, 0, + 0, 0, 204, 3, 0, 0, 86, 83, 66, 97, 115, 105, 99, 0, 68, 105, 102, 102, 117, 115, 101, 0, 1, 0, @@ -231,7 +231,9 @@ const BYTE BasicEffect_VSBasic[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc index 61f31576cab8dee32d7acbcdb478219bacb7d79e..582a22ad5ca561a1141deb9b2e0f3fa0f69e54fa 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc @@ -38,17 +38,17 @@ vs_2_0 dcl_texcoord v0 // vin<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSBasicNoFog<6> dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 56 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 56 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicNoFog<4,5> mov oPos.w, r0.z // ::VSBasicNoFog<7> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSBasicNoFog<0,1,2,3> // approximately 7 instruction slots used @@ -68,17 +68,17 @@ ret const BYTE BasicEffect_VSBasicNoFog[] = { - 68, 88, 66, 67, 73, 95, - 170, 11, 2, 152, 180, 140, - 155, 123, 152, 92, 110, 224, - 155, 128, 1, 0, 0, 0, - 36, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 18, 161, + 118, 62, 174, 20, 46, 175, + 213, 87, 11, 225, 105, 52, + 240, 195, 1, 0, 0, 0, + 48, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 184, 3, 0, 0, 156, 4, - 0, 0, 208, 4, 0, 0, - 65, 111, 110, 57, 128, 3, - 0, 0, 128, 3, 0, 0, - 0, 2, 254, 255, 64, 3, + 196, 3, 0, 0, 168, 4, + 0, 0, 220, 4, 0, 0, + 65, 111, 110, 57, 140, 3, + 0, 0, 140, 3, 0, 0, + 0, 2, 254, 255, 76, 3, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -89,14 +89,14 @@ const BYTE BasicEffect_VSBasicNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 175, 0, 68, 66, 85, 71, + 178, 0, 68, 66, 85, 71, 40, 0, 0, 0, 144, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 8, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 84, 2, 0, 0, - 4, 1, 0, 0, 67, 58, + 4, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -108,7 +108,7 @@ const BYTE BasicEffect_VSBasicNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -123,16 +123,16 @@ const BYTE BasicEffect_VSBasicNoFog[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 196, 2, 0, 0, - 43, 0, 0, 0, 208, 2, + 255, 255, 208, 2, 0, 0, + 43, 0, 0, 0, 220, 2, 0, 0, 43, 0, 0, 0, - 224, 2, 0, 0, 43, 0, - 0, 0, 240, 2, 0, 0, - 43, 0, 0, 0, 0, 3, + 236, 2, 0, 0, 43, 0, + 0, 0, 252, 2, 0, 0, + 43, 0, 0, 0, 12, 3, 0, 0, 56, 0, 1, 0, - 16, 3, 0, 0, 56, 0, - 1, 0, 36, 3, 0, 0, - 44, 0, 0, 0, 48, 3, + 28, 3, 0, 0, 56, 0, + 1, 0, 48, 3, 0, 0, + 44, 0, 0, 0, 60, 3, 0, 0, 86, 83, 66, 97, 115, 105, 99, 78, 111, 70, 111, 103, 0, 68, 105, 102, @@ -205,7 +205,9 @@ const BYTE BasicEffect_VSBasicNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 9, 0, 0, 3, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc index 2296ab469473f942ab4a230c4ad9100ddcf56313..391cf479aa0077afc0e7479b2c550e19f0ae2711 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc @@ -46,7 +46,7 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5,6> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, v1, c12 dp3 r0.y, v1, c13 dp3 r0.z, v1, c14 @@ -90,21 +90,21 @@ #line 63 dp4 oPos.z, v0, c17 // ::VSBasicOneLight<10> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c8 max r0.x, r0.x, c19.x min oT1.w, r0.x, c19.y // ::VSBasicOneLight<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c15 // ::vout<0> dp4 r0.y, v0, c16 // ::vout<1> dp4 r0.z, v0, c18 // ::vout<3> -#line 209 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 209 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicOneLight<8,9> mov oPos.w, r0.z // ::VSBasicOneLight<11> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c1.w // ::VSBasicOneLight<3> // approximately 41 instruction slots used @@ -158,17 +158,17 @@ ret const BYTE BasicEffect_VSBasicOneLight[] = { - 68, 88, 66, 67, 126, 201, - 141, 129, 108, 101, 79, 192, - 42, 19, 6, 176, 114, 68, - 39, 18, 1, 0, 0, 0, - 80, 14, 0, 0, 4, 0, + 68, 88, 66, 67, 30, 10, + 24, 11, 90, 191, 233, 204, + 206, 104, 111, 148, 225, 132, + 204, 3, 1, 0, 0, 0, + 92, 14, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 244, 8, 0, 0, 144, 13, - 0, 0, 228, 13, 0, 0, - 65, 111, 110, 57, 188, 8, - 0, 0, 188, 8, 0, 0, - 0, 2, 254, 255, 76, 8, + 0, 9, 0, 0, 156, 13, + 0, 0, 240, 13, 0, 0, + 65, 111, 110, 57, 200, 8, + 0, 0, 200, 8, 0, 0, + 0, 2, 254, 255, 88, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -187,14 +187,14 @@ const BYTE BasicEffect_VSBasicOneLight[] = 7, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 132, 1, 68, 66, 85, 71, + 135, 1, 68, 66, 85, 71, 40, 0, 0, 0, 228, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 36, 0, 0, 0, 16, 1, 0, 0, 13, 0, 0, 0, 224, 4, 0, 0, - 100, 2, 0, 0, 67, 58, + 100, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -206,7 +206,7 @@ const BYTE BasicEffect_VSBasicOneLight[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -218,7 +218,7 @@ const BYTE BasicEffect_VSBasicOneLight[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -234,53 +234,53 @@ const BYTE BasicEffect_VSBasicOneLight[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 24, 6, 0, 0, 0, 0, - 255, 255, 48, 6, 0, 0, - 0, 0, 255, 255, 60, 6, + 36, 6, 0, 0, 0, 0, + 255, 255, 60, 6, 0, 0, + 0, 0, 255, 255, 72, 6, 0, 0, 59, 0, 0, 0, - 72, 6, 0, 0, 59, 0, - 0, 0, 88, 6, 0, 0, - 59, 0, 0, 0, 104, 6, + 84, 6, 0, 0, 59, 0, + 0, 0, 100, 6, 0, 0, + 59, 0, 0, 0, 116, 6, 0, 0, 59, 0, 0, 0, - 120, 6, 0, 0, 36, 0, - 0, 0, 132, 6, 0, 0, - 39, 0, 0, 0, 148, 6, + 132, 6, 0, 0, 36, 0, + 0, 0, 144, 6, 0, 0, + 39, 0, 0, 0, 160, 6, 0, 0, 41, 0, 0, 0, - 164, 6, 0, 0, 46, 0, - 0, 0, 180, 6, 0, 0, - 46, 0, 0, 0, 196, 6, + 176, 6, 0, 0, 46, 0, + 0, 0, 192, 6, 0, 0, + 46, 0, 0, 0, 208, 6, 0, 0, 46, 0, 0, 0, - 208, 6, 0, 0, 57, 0, - 0, 0, 228, 6, 0, 0, - 57, 0, 0, 0, 244, 6, + 220, 6, 0, 0, 57, 0, + 0, 0, 240, 6, 0, 0, + 57, 0, 0, 0, 0, 7, 0, 0, 57, 0, 0, 0, - 4, 7, 0, 0, 58, 0, - 0, 0, 20, 7, 0, 0, - 58, 0, 0, 0, 36, 7, + 16, 7, 0, 0, 58, 0, + 0, 0, 32, 7, 0, 0, + 58, 0, 0, 0, 48, 7, 0, 0, 33, 0, 0, 0, - 48, 7, 0, 0, 33, 0, - 0, 0, 64, 7, 0, 0, - 37, 0, 0, 0, 76, 7, + 60, 7, 0, 0, 33, 0, + 0, 0, 76, 7, 0, 0, + 37, 0, 0, 0, 88, 7, 0, 0, 42, 0, 0, 0, - 92, 7, 0, 0, 42, 0, - 0, 0, 108, 7, 0, 0, - 42, 0, 0, 0, 124, 7, + 104, 7, 0, 0, 42, 0, + 0, 0, 120, 7, 0, 0, + 42, 0, 0, 0, 136, 7, 0, 0, 47, 0, 0, 0, - 140, 7, 0, 0, 47, 0, - 0, 0, 156, 7, 0, 0, - 63, 0, 0, 0, 172, 7, + 152, 7, 0, 0, 47, 0, + 0, 0, 168, 7, 0, 0, + 63, 0, 0, 0, 184, 7, 0, 0, 14, 0, 1, 0, - 188, 7, 0, 0, 14, 0, - 1, 0, 204, 7, 0, 0, - 14, 0, 1, 0, 220, 7, + 200, 7, 0, 0, 14, 0, + 1, 0, 216, 7, 0, 0, + 14, 0, 1, 0, 232, 7, 0, 0, 63, 0, 0, 0, - 236, 7, 0, 0, 63, 0, - 0, 0, 252, 7, 0, 0, - 63, 0, 0, 0, 12, 8, + 248, 7, 0, 0, 63, 0, + 0, 0, 8, 8, 0, 0, + 63, 0, 0, 0, 24, 8, 0, 0, 209, 0, 2, 0, - 28, 8, 0, 0, 209, 0, - 2, 0, 48, 8, 0, 0, - 46, 0, 0, 0, 60, 8, + 40, 8, 0, 0, 209, 0, + 2, 0, 60, 8, 0, 0, + 46, 0, 0, 0, 72, 8, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -445,7 +445,9 @@ const BYTE BasicEffect_VSBasicOneLight[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 19, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc index 64741abf81ce6783c8162222d4389d32805dc540..2a0bf6e4104f5f9ac1fce862ecb87d0b32840679 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc @@ -49,7 +49,7 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, v1, c12 dp3 r0.y, v1, c13 dp3 r0.z, v1, c14 @@ -93,24 +93,24 @@ #line 63 dp4 oPos.z, v0, c17 // ::VSBasicOneLightTx<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c8 max r0.x, r0.x, c19.x min oT1.w, r0.x, c19.y // ::VSBasicOneLightTx<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c15 // ::vout<0> dp4 r0.y, v0, c16 // ::vout<1> dp4 r0.z, v0, c18 // ::vout<3> -#line 235 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 235 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicOneLightTx<10,11> mov oPos.w, r0.z // ::VSBasicOneLightTx<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c1.w // ::VSBasicOneLightTx<3> -#line 242 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 242 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mov oT2.xy, v2 // ::VSBasicOneLightTx<8,9> // approximately 42 instruction slots used @@ -167,17 +167,17 @@ ret const BYTE BasicEffect_VSBasicOneLightTx[] = { - 68, 88, 66, 67, 134, 215, - 145, 17, 37, 56, 176, 20, - 208, 22, 88, 246, 152, 83, - 101, 85, 1, 0, 0, 0, - 44, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 64, 206, + 14, 129, 76, 126, 142, 143, + 192, 221, 233, 93, 60, 182, + 203, 201, 1, 0, 0, 0, + 56, 15, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 100, 9, 0, 0, 44, 14, - 0, 0, 160, 14, 0, 0, - 65, 111, 110, 57, 44, 9, - 0, 0, 44, 9, 0, 0, - 0, 2, 254, 255, 188, 8, + 112, 9, 0, 0, 56, 14, + 0, 0, 172, 14, 0, 0, + 65, 111, 110, 57, 56, 9, + 0, 0, 56, 9, 0, 0, + 0, 2, 254, 255, 200, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -196,14 +196,14 @@ const BYTE BasicEffect_VSBasicOneLightTx[] = 7, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 154, 1, 68, 66, 85, 71, + 157, 1, 68, 66, 85, 71, 40, 0, 0, 0, 60, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 38, 0, 0, 0, 16, 1, 0, 0, 13, 0, 0, 0, 56, 5, 0, 0, - 116, 2, 0, 0, 67, 58, + 116, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -215,7 +215,7 @@ const BYTE BasicEffect_VSBasicOneLightTx[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -227,7 +227,7 @@ const BYTE BasicEffect_VSBasicOneLightTx[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -243,56 +243,56 @@ const BYTE BasicEffect_VSBasicOneLightTx[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 112, 6, 0, 0, 0, 0, - 255, 255, 136, 6, 0, 0, - 0, 0, 255, 255, 148, 6, + 124, 6, 0, 0, 0, 0, + 255, 255, 148, 6, 0, 0, + 0, 0, 255, 255, 160, 6, 0, 0, 0, 0, 255, 255, - 160, 6, 0, 0, 59, 0, - 0, 0, 172, 6, 0, 0, - 59, 0, 0, 0, 188, 6, + 172, 6, 0, 0, 59, 0, + 0, 0, 184, 6, 0, 0, + 59, 0, 0, 0, 200, 6, 0, 0, 59, 0, 0, 0, - 204, 6, 0, 0, 59, 0, - 0, 0, 220, 6, 0, 0, - 36, 0, 0, 0, 232, 6, + 216, 6, 0, 0, 59, 0, + 0, 0, 232, 6, 0, 0, + 36, 0, 0, 0, 244, 6, 0, 0, 39, 0, 0, 0, - 248, 6, 0, 0, 41, 0, - 0, 0, 8, 7, 0, 0, - 46, 0, 0, 0, 24, 7, + 4, 7, 0, 0, 41, 0, + 0, 0, 20, 7, 0, 0, + 46, 0, 0, 0, 36, 7, 0, 0, 46, 0, 0, 0, - 40, 7, 0, 0, 46, 0, - 0, 0, 52, 7, 0, 0, - 57, 0, 0, 0, 72, 7, + 52, 7, 0, 0, 46, 0, + 0, 0, 64, 7, 0, 0, + 57, 0, 0, 0, 84, 7, 0, 0, 57, 0, 0, 0, - 88, 7, 0, 0, 57, 0, - 0, 0, 104, 7, 0, 0, - 58, 0, 0, 0, 120, 7, + 100, 7, 0, 0, 57, 0, + 0, 0, 116, 7, 0, 0, + 58, 0, 0, 0, 132, 7, 0, 0, 58, 0, 0, 0, - 136, 7, 0, 0, 33, 0, - 0, 0, 148, 7, 0, 0, - 33, 0, 0, 0, 164, 7, + 148, 7, 0, 0, 33, 0, + 0, 0, 160, 7, 0, 0, + 33, 0, 0, 0, 176, 7, 0, 0, 37, 0, 0, 0, - 176, 7, 0, 0, 42, 0, - 0, 0, 192, 7, 0, 0, - 42, 0, 0, 0, 208, 7, + 188, 7, 0, 0, 42, 0, + 0, 0, 204, 7, 0, 0, + 42, 0, 0, 0, 220, 7, 0, 0, 42, 0, 0, 0, - 224, 7, 0, 0, 47, 0, - 0, 0, 240, 7, 0, 0, - 47, 0, 0, 0, 0, 8, + 236, 7, 0, 0, 47, 0, + 0, 0, 252, 7, 0, 0, + 47, 0, 0, 0, 12, 8, 0, 0, 63, 0, 0, 0, - 16, 8, 0, 0, 14, 0, - 1, 0, 32, 8, 0, 0, - 14, 0, 1, 0, 48, 8, + 28, 8, 0, 0, 14, 0, + 1, 0, 44, 8, 0, 0, + 14, 0, 1, 0, 60, 8, 0, 0, 14, 0, 1, 0, - 64, 8, 0, 0, 63, 0, - 0, 0, 80, 8, 0, 0, - 63, 0, 0, 0, 96, 8, + 76, 8, 0, 0, 63, 0, + 0, 0, 92, 8, 0, 0, + 63, 0, 0, 0, 108, 8, 0, 0, 63, 0, 0, 0, - 112, 8, 0, 0, 235, 0, - 2, 0, 128, 8, 0, 0, - 235, 0, 2, 0, 148, 8, + 124, 8, 0, 0, 235, 0, + 2, 0, 140, 8, 0, 0, + 235, 0, 2, 0, 160, 8, 0, 0, 46, 0, 0, 0, - 160, 8, 0, 0, 242, 0, - 2, 0, 172, 8, 0, 0, + 172, 8, 0, 0, 242, 0, + 2, 0, 184, 8, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, @@ -469,7 +469,9 @@ const BYTE BasicEffect_VSBasicOneLightTx[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 19, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc index 97cacbfacc5c5b3c515ba3a48f01e1e7617fcccb..3cb9328d055325524eb6b8461f30404928a6257f 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc @@ -51,7 +51,7 @@ dcl_texcoord2 v2 // vin<7,8> dcl_texcoord3 v3 // vin<9,10,11,12> -#line 57 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 57 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c9 // ::pos_ws<0> dp4 r0.y, v0, c10 // ::pos_ws<1> dp4 r0.z, v0, c11 // ::pos_ws<2> @@ -87,26 +87,26 @@ mov r1.xyz, c1 // Parameters::DiffuseColor<0,1,2> mad r0.xyz, r0, r1, c2 // ::result<0,1,2> -#line 257 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 257 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0.xyz, r0, v3 // ::VSBasicOneLightTxVc<0,1,2> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 oPos.z, v0, c17 // ::VSBasicOneLightTxVc<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c8 max r0.x, r0.x, c19.x min oT1.w, r0.x, c19.y // ::VSBasicOneLightTxVc<7> -#line 257 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 257 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0.w, v3.w, c1.w // ::VSBasicOneLightTxVc<3> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c15 // ::vout<0> dp4 r0.y, v0, c16 // ::vout<1> dp4 r0.z, v0, c18 // ::vout<3> -#line 249 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 249 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicOneLightTxVc<10,11> mov oPos.w, r0.z // ::VSBasicOneLightTxVc<13> @@ -169,17 +169,17 @@ ret const BYTE BasicEffect_VSBasicOneLightTxVc[] = { - 68, 88, 66, 67, 151, 80, - 197, 35, 22, 212, 204, 240, - 24, 227, 137, 220, 42, 70, - 119, 97, 1, 0, 0, 0, - 248, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 145, 67, + 128, 118, 193, 195, 146, 208, + 43, 93, 115, 43, 72, 134, + 83, 3, 1, 0, 0, 0, + 4, 16, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 224, 9, 0, 0, 216, 14, - 0, 0, 108, 15, 0, 0, - 65, 111, 110, 57, 168, 9, - 0, 0, 168, 9, 0, 0, - 0, 2, 254, 255, 56, 9, + 236, 9, 0, 0, 228, 14, + 0, 0, 120, 15, 0, 0, + 65, 111, 110, 57, 180, 9, + 0, 0, 180, 9, 0, 0, + 0, 2, 254, 255, 68, 9, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -198,14 +198,14 @@ const BYTE BasicEffect_VSBasicOneLightTxVc[] = 7, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 181, 1, 68, 66, 85, 71, + 184, 1, 68, 66, 85, 71, 40, 0, 0, 0, 168, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 39, 0, 0, 0, 16, 1, 0, 0, 14, 0, 0, 0, 144, 5, 0, 0, - 124, 2, 0, 0, 67, 58, + 124, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -217,7 +217,7 @@ const BYTE BasicEffect_VSBasicOneLightTxVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -230,7 +230,7 @@ const BYTE BasicEffect_VSBasicOneLightTxVc[] = 100, 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, - 120, 0, 67, 58, 92, 65, + 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -245,57 +245,57 @@ const BYTE BasicEffect_VSBasicOneLightTxVc[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 188, 0, 0, 0, 0, 0, 255, 255, - 220, 6, 0, 0, 0, 0, - 255, 255, 244, 6, 0, 0, - 0, 0, 255, 255, 0, 7, + 232, 6, 0, 0, 0, 0, + 255, 255, 0, 7, 0, 0, + 0, 0, 255, 255, 12, 7, 0, 0, 0, 0, 255, 255, - 12, 7, 0, 0, 0, 0, - 255, 255, 24, 7, 0, 0, - 57, 0, 0, 0, 36, 7, + 24, 7, 0, 0, 0, 0, + 255, 255, 36, 7, 0, 0, + 57, 0, 0, 0, 48, 7, 0, 0, 57, 0, 0, 0, - 52, 7, 0, 0, 57, 0, - 0, 0, 68, 7, 0, 0, - 58, 0, 0, 0, 84, 7, + 64, 7, 0, 0, 57, 0, + 0, 0, 80, 7, 0, 0, + 58, 0, 0, 0, 96, 7, 0, 0, 58, 0, 0, 0, - 100, 7, 0, 0, 33, 0, - 0, 0, 112, 7, 0, 0, - 33, 0, 0, 0, 128, 7, + 112, 7, 0, 0, 33, 0, + 0, 0, 124, 7, 0, 0, + 33, 0, 0, 0, 140, 7, 0, 0, 59, 0, 0, 0, - 140, 7, 0, 0, 59, 0, - 0, 0, 156, 7, 0, 0, - 59, 0, 0, 0, 172, 7, + 152, 7, 0, 0, 59, 0, + 0, 0, 168, 7, 0, 0, + 59, 0, 0, 0, 184, 7, 0, 0, 59, 0, 0, 0, - 188, 7, 0, 0, 37, 0, - 0, 0, 200, 7, 0, 0, - 36, 0, 0, 0, 216, 7, + 200, 7, 0, 0, 37, 0, + 0, 0, 212, 7, 0, 0, + 36, 0, 0, 0, 228, 7, 0, 0, 42, 0, 0, 0, - 232, 7, 0, 0, 39, 0, - 0, 0, 248, 7, 0, 0, - 41, 0, 0, 0, 8, 8, + 244, 7, 0, 0, 39, 0, + 0, 0, 4, 8, 0, 0, + 41, 0, 0, 0, 20, 8, 0, 0, 42, 0, 0, 0, - 24, 8, 0, 0, 47, 0, - 0, 0, 40, 8, 0, 0, - 47, 0, 0, 0, 56, 8, + 36, 8, 0, 0, 47, 0, + 0, 0, 52, 8, 0, 0, + 47, 0, 0, 0, 68, 8, 0, 0, 46, 0, 0, 0, - 72, 8, 0, 0, 46, 0, - 0, 0, 88, 8, 0, 0, - 46, 0, 0, 0, 100, 8, + 84, 8, 0, 0, 46, 0, + 0, 0, 100, 8, 0, 0, + 46, 0, 0, 0, 112, 8, 0, 0, 1, 1, 1, 0, - 120, 8, 0, 0, 63, 0, - 0, 0, 136, 8, 0, 0, - 14, 0, 2, 0, 152, 8, + 132, 8, 0, 0, 63, 0, + 0, 0, 148, 8, 0, 0, + 14, 0, 2, 0, 164, 8, 0, 0, 14, 0, 2, 0, - 168, 8, 0, 0, 14, 0, - 2, 0, 184, 8, 0, 0, - 1, 1, 1, 0, 200, 8, + 180, 8, 0, 0, 14, 0, + 2, 0, 196, 8, 0, 0, + 1, 1, 1, 0, 212, 8, 0, 0, 63, 0, 0, 0, - 216, 8, 0, 0, 63, 0, - 0, 0, 232, 8, 0, 0, - 63, 0, 0, 0, 248, 8, + 228, 8, 0, 0, 63, 0, + 0, 0, 244, 8, 0, 0, + 63, 0, 0, 0, 4, 9, 0, 0, 249, 0, 1, 0, - 8, 9, 0, 0, 249, 0, - 1, 0, 28, 9, 0, 0, - 0, 1, 1, 0, 40, 9, + 20, 9, 0, 0, 249, 0, + 1, 0, 40, 9, 0, 0, + 0, 1, 1, 0, 52, 9, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -489,7 +489,9 @@ const BYTE BasicEffect_VSBasicOneLightTxVc[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 19, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc index 43a6cc9bde246d468fb0285dc125b24d6601f3a4..a24b96c9efaac3de272cc9505faa13c71bb9dadb 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc @@ -48,7 +48,7 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8,9,10> -#line 57 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 57 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c9 // ::pos_ws<0> dp4 r0.y, v0, c10 // ::pos_ws<1> dp4 r0.z, v0, c11 // ::pos_ws<2> @@ -84,26 +84,26 @@ mov r1.xyz, c1 // Parameters::DiffuseColor<0,1,2> mad r0.xyz, r0, r1, c2 // ::result<0,1,2> -#line 228 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 228 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0.xyz, r0, v2 // ::VSBasicOneLightVc<0,1,2> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 oPos.z, v0, c17 // ::VSBasicOneLightVc<10> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c8 max r0.x, r0.x, c19.x min oT1.w, r0.x, c19.y // ::VSBasicOneLightVc<7> -#line 228 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 228 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0.w, v2.w, c1.w // ::VSBasicOneLightVc<3> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c15 // ::vout<0> dp4 r0.y, v0, c16 // ::vout<1> dp4 r0.z, v0, c18 // ::vout<3> -#line 221 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 221 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicOneLightVc<8,9> mov oPos.w, r0.z // ::VSBasicOneLightVc<11> @@ -160,17 +160,17 @@ ret const BYTE BasicEffect_VSBasicOneLightVc[] = { - 68, 88, 66, 67, 7, 204, - 182, 223, 154, 182, 35, 146, - 95, 111, 61, 221, 117, 48, - 242, 64, 1, 0, 0, 0, - 32, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 239, 38, + 243, 179, 54, 55, 7, 157, + 234, 80, 242, 217, 245, 120, + 226, 232, 1, 0, 0, 0, + 44, 15, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 116, 9, 0, 0, 64, 14, - 0, 0, 180, 14, 0, 0, - 65, 111, 110, 57, 60, 9, - 0, 0, 60, 9, 0, 0, - 0, 2, 254, 255, 204, 8, + 128, 9, 0, 0, 76, 14, + 0, 0, 192, 14, 0, 0, + 65, 111, 110, 57, 72, 9, + 0, 0, 72, 9, 0, 0, + 0, 2, 254, 255, 216, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -189,14 +189,14 @@ const BYTE BasicEffect_VSBasicOneLightVc[] = 7, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 160, 1, 68, 66, 85, 71, + 163, 1, 68, 66, 85, 71, 40, 0, 0, 0, 84, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 37, 0, 0, 0, 16, 1, 0, 0, 14, 0, 0, 0, 60, 5, 0, 0, - 108, 2, 0, 0, 67, 58, + 108, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -208,7 +208,7 @@ const BYTE BasicEffect_VSBasicOneLightVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -221,7 +221,7 @@ const BYTE BasicEffect_VSBasicOneLightVc[] = 100, 101, 114, 115, 92, 66, 97, 115, 105, 99, 69, 102, 102, 101, 99, 116, 46, 102, - 120, 0, 67, 58, 92, 65, + 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -236,55 +236,55 @@ const BYTE BasicEffect_VSBasicOneLightVc[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 188, 0, 0, 0, 0, 0, 255, 255, - 136, 6, 0, 0, 0, 0, - 255, 255, 160, 6, 0, 0, - 0, 0, 255, 255, 172, 6, + 148, 6, 0, 0, 0, 0, + 255, 255, 172, 6, 0, 0, + 0, 0, 255, 255, 184, 6, 0, 0, 0, 0, 255, 255, - 184, 6, 0, 0, 57, 0, - 0, 0, 196, 6, 0, 0, - 57, 0, 0, 0, 212, 6, + 196, 6, 0, 0, 57, 0, + 0, 0, 208, 6, 0, 0, + 57, 0, 0, 0, 224, 6, 0, 0, 57, 0, 0, 0, - 228, 6, 0, 0, 58, 0, - 0, 0, 244, 6, 0, 0, - 58, 0, 0, 0, 4, 7, + 240, 6, 0, 0, 58, 0, + 0, 0, 0, 7, 0, 0, + 58, 0, 0, 0, 16, 7, 0, 0, 33, 0, 0, 0, - 16, 7, 0, 0, 33, 0, - 0, 0, 32, 7, 0, 0, - 59, 0, 0, 0, 44, 7, + 28, 7, 0, 0, 33, 0, + 0, 0, 44, 7, 0, 0, + 59, 0, 0, 0, 56, 7, 0, 0, 59, 0, 0, 0, - 60, 7, 0, 0, 59, 0, - 0, 0, 76, 7, 0, 0, - 59, 0, 0, 0, 92, 7, + 72, 7, 0, 0, 59, 0, + 0, 0, 88, 7, 0, 0, + 59, 0, 0, 0, 104, 7, 0, 0, 37, 0, 0, 0, - 104, 7, 0, 0, 36, 0, - 0, 0, 120, 7, 0, 0, - 42, 0, 0, 0, 136, 7, + 116, 7, 0, 0, 36, 0, + 0, 0, 132, 7, 0, 0, + 42, 0, 0, 0, 148, 7, 0, 0, 39, 0, 0, 0, - 152, 7, 0, 0, 41, 0, - 0, 0, 168, 7, 0, 0, - 42, 0, 0, 0, 184, 7, + 164, 7, 0, 0, 41, 0, + 0, 0, 180, 7, 0, 0, + 42, 0, 0, 0, 196, 7, 0, 0, 47, 0, 0, 0, - 200, 7, 0, 0, 47, 0, - 0, 0, 216, 7, 0, 0, - 46, 0, 0, 0, 232, 7, + 212, 7, 0, 0, 47, 0, + 0, 0, 228, 7, 0, 0, + 46, 0, 0, 0, 244, 7, 0, 0, 46, 0, 0, 0, - 248, 7, 0, 0, 46, 0, - 0, 0, 4, 8, 0, 0, - 228, 0, 1, 0, 24, 8, + 4, 8, 0, 0, 46, 0, + 0, 0, 16, 8, 0, 0, + 228, 0, 1, 0, 36, 8, 0, 0, 63, 0, 0, 0, - 40, 8, 0, 0, 14, 0, - 2, 0, 56, 8, 0, 0, - 14, 0, 2, 0, 72, 8, + 52, 8, 0, 0, 14, 0, + 2, 0, 68, 8, 0, 0, + 14, 0, 2, 0, 84, 8, 0, 0, 14, 0, 2, 0, - 88, 8, 0, 0, 228, 0, - 1, 0, 104, 8, 0, 0, - 63, 0, 0, 0, 120, 8, + 100, 8, 0, 0, 228, 0, + 1, 0, 116, 8, 0, 0, + 63, 0, 0, 0, 132, 8, 0, 0, 63, 0, 0, 0, - 136, 8, 0, 0, 63, 0, - 0, 0, 152, 8, 0, 0, - 221, 0, 1, 0, 168, 8, + 148, 8, 0, 0, 63, 0, + 0, 0, 164, 8, 0, 0, + 221, 0, 1, 0, 180, 8, 0, 0, 221, 0, 1, 0, - 188, 8, 0, 0, 80, 97, + 200, 8, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, 67, 111, @@ -466,7 +466,9 @@ const BYTE BasicEffect_VSBasicOneLightVc[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 19, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc index 247876ef060b1bfa39aa84b286629e8c564dcdb7..88353bb0470aba65da49a6e00f32bd8b6b2bb762 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc @@ -44,7 +44,7 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5,6> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 oPos.z, v0, c11 // ::VSBasicPixelLighting<13> dp4 oT0.x, v0, c3 // ::VSBasicPixelLighting<0> dp4 oT0.y, v0, c4 // ::VSBasicPixelLighting<1> @@ -56,17 +56,17 @@ rsq r0.w, r0.w mul oT1.xyz, r0.w, r0 // ::VSBasicPixelLighting<4,5,6> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 max r0.x, r0.x, c13.x min oT0.w, r0.x, c13.y // ::VSBasicPixelLighting<3> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c9 // ::vout<0> dp4 r0.y, v0, c10 // ::vout<1> dp4 r0.z, v0, c12 // ::vout<3> -#line 264 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 264 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicPixelLighting<11,12> mov oPos.w, r0.z // ::VSBasicPixelLighting<14> @@ -106,17 +106,17 @@ ret const BYTE BasicEffect_VSBasicPixelLighting[] = { - 68, 88, 66, 67, 39, 177, - 182, 232, 221, 182, 217, 45, - 115, 127, 129, 125, 2, 196, - 138, 212, 1, 0, 0, 0, - 60, 9, 0, 0, 4, 0, + 68, 88, 66, 67, 203, 88, + 189, 107, 107, 234, 179, 42, + 210, 80, 132, 223, 14, 46, + 11, 35, 1, 0, 0, 0, + 72, 9, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 0, 6, 0, 0, 92, 8, - 0, 0, 176, 8, 0, 0, - 65, 111, 110, 57, 200, 5, - 0, 0, 200, 5, 0, 0, - 0, 2, 254, 255, 124, 5, + 12, 6, 0, 0, 104, 8, + 0, 0, 188, 8, 0, 0, + 65, 111, 110, 57, 212, 5, + 0, 0, 212, 5, 0, 0, + 0, 2, 254, 255, 136, 5, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -129,14 +129,14 @@ const BYTE BasicEffect_VSBasicPixelLighting[] = 7, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 1, 1, 68, 66, 85, 71, + 4, 1, 68, 66, 85, 71, 40, 0, 0, 0, 216, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 23, 0, 0, 0, 16, 1, 0, 0, 3, 0, 0, 0, 156, 3, 0, 0, - 200, 1, 0, 0, 67, 58, + 200, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -148,7 +148,7 @@ const BYTE BasicEffect_VSBasicPixelLighting[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -160,7 +160,7 @@ const BYTE BasicEffect_VSBasicPixelLighting[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -176,36 +176,36 @@ const BYTE BasicEffect_VSBasicPixelLighting[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 12, 4, 0, 0, 0, 0, - 255, 255, 36, 4, 0, 0, - 0, 0, 255, 255, 48, 4, + 24, 4, 0, 0, 0, 0, + 255, 255, 48, 4, 0, 0, + 0, 0, 255, 255, 60, 4, 0, 0, 85, 0, 0, 0, - 60, 4, 0, 0, 86, 0, - 0, 0, 76, 4, 0, 0, - 86, 0, 0, 0, 92, 4, + 72, 4, 0, 0, 86, 0, + 0, 0, 88, 4, 0, 0, + 86, 0, 0, 0, 104, 4, 0, 0, 86, 0, 0, 0, - 108, 4, 0, 0, 87, 0, - 0, 0, 124, 4, 0, 0, - 87, 0, 0, 0, 140, 4, + 120, 4, 0, 0, 87, 0, + 0, 0, 136, 4, 0, 0, + 87, 0, 0, 0, 152, 4, 0, 0, 87, 0, 0, 0, - 156, 4, 0, 0, 87, 0, - 0, 0, 172, 4, 0, 0, - 87, 0, 0, 0, 188, 4, + 168, 4, 0, 0, 87, 0, + 0, 0, 184, 4, 0, 0, + 87, 0, 0, 0, 200, 4, 0, 0, 87, 0, 0, 0, - 200, 4, 0, 0, 14, 0, - 1, 0, 216, 4, 0, 0, - 14, 0, 1, 0, 232, 4, + 212, 4, 0, 0, 14, 0, + 1, 0, 228, 4, 0, 0, + 14, 0, 1, 0, 244, 4, 0, 0, 14, 0, 1, 0, - 248, 4, 0, 0, 85, 0, - 0, 0, 8, 5, 0, 0, - 85, 0, 0, 0, 24, 5, + 4, 5, 0, 0, 85, 0, + 0, 0, 20, 5, 0, 0, + 85, 0, 0, 0, 36, 5, 0, 0, 85, 0, 0, 0, - 40, 5, 0, 0, 8, 1, - 2, 0, 56, 5, 0, 0, - 8, 1, 2, 0, 76, 5, + 52, 5, 0, 0, 8, 1, + 2, 0, 68, 5, 0, 0, + 8, 1, 2, 0, 88, 5, 0, 0, 15, 1, 2, 0, - 88, 5, 0, 0, 15, 1, - 2, 0, 100, 5, 0, 0, + 100, 5, 0, 0, 15, 1, + 2, 0, 112, 5, 0, 0, 86, 83, 66, 97, 115, 105, 99, 80, 105, 120, 101, 108, 76, 105, 103, 104, 116, 105, @@ -300,7 +300,9 @@ const BYTE BasicEffect_VSBasicPixelLighting[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc index deb37ea8be43d88bd4bc071ee4571ff3ee0e770a..6c3e7194685bd4b116f3e628d391478dfae933ee 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc @@ -47,7 +47,7 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 oPos.z, v0, c11 // ::VSBasicPixelLightingTx<15> dp4 oT1.x, v0, c3 // ::VSBasicPixelLightingTx<2> dp4 oT1.y, v0, c4 // ::VSBasicPixelLightingTx<3> @@ -59,17 +59,17 @@ rsq r0.w, r0.w mul oT2.xyz, r0.w, r0 // ::VSBasicPixelLightingTx<6,7,8> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 max r0.x, r0.x, c13.x min oT1.w, r0.x, c13.y // ::VSBasicPixelLightingTx<5> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c9 // ::vout<0> dp4 r0.y, v0, c10 // ::vout<1> dp4 r0.z, v0, c12 // ::vout<3> -#line 293 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 293 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicPixelLightingTx<13,14> mov oPos.w, r0.z // ::VSBasicPixelLightingTx<16> @@ -113,17 +113,17 @@ ret const BYTE BasicEffect_VSBasicPixelLightingTx[] = { - 68, 88, 66, 67, 9, 43, - 114, 249, 73, 170, 16, 32, - 157, 118, 165, 108, 81, 48, - 40, 188, 1, 0, 0, 0, - 12, 10, 0, 0, 4, 0, + 68, 88, 66, 67, 17, 174, + 140, 206, 160, 28, 99, 124, + 19, 161, 39, 207, 57, 40, + 172, 107, 1, 0, 0, 0, + 24, 10, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 108, 6, 0, 0, 244, 8, - 0, 0, 104, 9, 0, 0, - 65, 111, 110, 57, 52, 6, - 0, 0, 52, 6, 0, 0, - 0, 2, 254, 255, 232, 5, + 120, 6, 0, 0, 0, 9, + 0, 0, 116, 9, 0, 0, + 65, 111, 110, 57, 64, 6, + 0, 0, 64, 6, 0, 0, + 0, 2, 254, 255, 244, 5, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -136,14 +136,14 @@ const BYTE BasicEffect_VSBasicPixelLightingTx[] = 7, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 22, 1, 68, 66, 85, 71, + 25, 1, 68, 66, 85, 71, 40, 0, 0, 0, 44, 4, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 25, 0, 0, 0, 16, 1, 0, 0, 3, 0, 0, 0, 240, 3, 0, 0, - 216, 1, 0, 0, 67, 58, + 216, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -155,7 +155,7 @@ const BYTE BasicEffect_VSBasicPixelLightingTx[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -167,7 +167,7 @@ const BYTE BasicEffect_VSBasicPixelLightingTx[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -183,39 +183,39 @@ const BYTE BasicEffect_VSBasicPixelLightingTx[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 96, 4, 0, 0, 0, 0, - 255, 255, 120, 4, 0, 0, - 0, 0, 255, 255, 132, 4, + 108, 4, 0, 0, 0, 0, + 255, 255, 132, 4, 0, 0, + 0, 0, 255, 255, 144, 4, 0, 0, 0, 0, 255, 255, - 144, 4, 0, 0, 85, 0, - 0, 0, 156, 4, 0, 0, - 86, 0, 0, 0, 172, 4, + 156, 4, 0, 0, 85, 0, + 0, 0, 168, 4, 0, 0, + 86, 0, 0, 0, 184, 4, 0, 0, 86, 0, 0, 0, - 188, 4, 0, 0, 86, 0, - 0, 0, 204, 4, 0, 0, - 87, 0, 0, 0, 220, 4, + 200, 4, 0, 0, 86, 0, + 0, 0, 216, 4, 0, 0, + 87, 0, 0, 0, 232, 4, 0, 0, 87, 0, 0, 0, - 236, 4, 0, 0, 87, 0, - 0, 0, 252, 4, 0, 0, - 87, 0, 0, 0, 12, 5, + 248, 4, 0, 0, 87, 0, + 0, 0, 8, 5, 0, 0, + 87, 0, 0, 0, 24, 5, 0, 0, 87, 0, 0, 0, - 28, 5, 0, 0, 87, 0, - 0, 0, 40, 5, 0, 0, - 14, 0, 1, 0, 56, 5, + 40, 5, 0, 0, 87, 0, + 0, 0, 52, 5, 0, 0, + 14, 0, 1, 0, 68, 5, 0, 0, 14, 0, 1, 0, - 72, 5, 0, 0, 14, 0, - 1, 0, 88, 5, 0, 0, - 85, 0, 0, 0, 104, 5, + 84, 5, 0, 0, 14, 0, + 1, 0, 100, 5, 0, 0, + 85, 0, 0, 0, 116, 5, 0, 0, 85, 0, 0, 0, - 120, 5, 0, 0, 85, 0, - 0, 0, 136, 5, 0, 0, - 37, 1, 2, 0, 152, 5, + 132, 5, 0, 0, 85, 0, + 0, 0, 148, 5, 0, 0, + 37, 1, 2, 0, 164, 5, 0, 0, 37, 1, 2, 0, - 172, 5, 0, 0, 45, 1, - 2, 0, 184, 5, 0, 0, - 44, 1, 2, 0, 196, 5, + 184, 5, 0, 0, 45, 1, + 2, 0, 196, 5, 0, 0, + 44, 1, 2, 0, 208, 5, 0, 0, 44, 1, 2, 0, - 208, 5, 0, 0, 86, 83, + 220, 5, 0, 0, 86, 83, 66, 97, 115, 105, 99, 80, 105, 120, 101, 108, 76, 105, 103, 104, 116, 105, 110, 103, @@ -321,7 +321,9 @@ const BYTE BasicEffect_VSBasicPixelLightingTx[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc index 8209f47c5cdd1b88707f504971f9ab1ffc65fd49..c39876ba12dc6ad46ce1d6f42d6215ae5ab58527 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc @@ -49,7 +49,7 @@ dcl_texcoord2 v2 // vin<7,8> dcl_texcoord3 v3 // vin<9,10,11,12> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 oPos.z, v0, c11 // ::VSBasicPixelLightingTxVc<15> dp4 oT1.x, v0, c3 // ::VSBasicPixelLightingTxVc<2> dp4 oT1.y, v0, c4 // ::VSBasicPixelLightingTxVc<3> @@ -61,20 +61,20 @@ rsq r0.w, r0.w mul oT2.xyz, r0.w, r0 // ::VSBasicPixelLightingTxVc<6,7,8> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 max r0.x, r0.x, c13.x min oT1.w, r0.x, c13.y // ::VSBasicPixelLightingTxVc<5> -#line 316 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 316 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT3.w, v3.w, c1.w // ::VSBasicPixelLightingTxVc<12> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c9 // ::vout<0> dp4 r0.y, v0, c10 // ::vout<1> dp4 r0.z, v0, c12 // ::vout<3> -#line 308 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 308 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicPixelLightingTxVc<13,14> mov oPos.w, r0.z // ::VSBasicPixelLightingTxVc<16> @@ -118,17 +118,17 @@ ret const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = { - 68, 88, 66, 67, 222, 13, - 104, 235, 159, 170, 215, 223, - 249, 129, 108, 227, 207, 189, - 48, 89, 1, 0, 0, 0, - 112, 10, 0, 0, 4, 0, + 68, 88, 66, 67, 134, 70, + 8, 48, 165, 212, 235, 215, + 112, 251, 246, 221, 214, 110, + 207, 192, 1, 0, 0, 0, + 124, 10, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 168, 6, 0, 0, 56, 9, - 0, 0, 204, 9, 0, 0, - 65, 111, 110, 57, 112, 6, - 0, 0, 112, 6, 0, 0, - 0, 2, 254, 255, 36, 6, + 180, 6, 0, 0, 68, 9, + 0, 0, 216, 9, 0, 0, + 65, 111, 110, 57, 124, 6, + 0, 0, 124, 6, 0, 0, + 0, 2, 254, 255, 48, 6, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -141,14 +141,14 @@ const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = 7, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 35, 1, 68, 66, 85, 71, + 38, 1, 68, 66, 85, 71, 40, 0, 0, 0, 96, 4, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 26, 0, 0, 0, 16, 1, 0, 0, 3, 0, 0, 0, 36, 4, 0, 0, - 224, 1, 0, 0, 67, 58, + 224, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -160,7 +160,7 @@ const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -172,7 +172,7 @@ const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -188,40 +188,40 @@ const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 148, 4, 0, 0, 0, 0, - 255, 255, 172, 4, 0, 0, - 0, 0, 255, 255, 184, 4, + 160, 4, 0, 0, 0, 0, + 255, 255, 184, 4, 0, 0, + 0, 0, 255, 255, 196, 4, 0, 0, 0, 0, 255, 255, - 196, 4, 0, 0, 0, 0, - 255, 255, 208, 4, 0, 0, - 85, 0, 0, 0, 220, 4, + 208, 4, 0, 0, 0, 0, + 255, 255, 220, 4, 0, 0, + 85, 0, 0, 0, 232, 4, 0, 0, 86, 0, 0, 0, - 236, 4, 0, 0, 86, 0, - 0, 0, 252, 4, 0, 0, - 86, 0, 0, 0, 12, 5, + 248, 4, 0, 0, 86, 0, + 0, 0, 8, 5, 0, 0, + 86, 0, 0, 0, 24, 5, 0, 0, 87, 0, 0, 0, - 28, 5, 0, 0, 87, 0, - 0, 0, 44, 5, 0, 0, - 87, 0, 0, 0, 60, 5, + 40, 5, 0, 0, 87, 0, + 0, 0, 56, 5, 0, 0, + 87, 0, 0, 0, 72, 5, 0, 0, 87, 0, 0, 0, - 76, 5, 0, 0, 87, 0, - 0, 0, 92, 5, 0, 0, - 87, 0, 0, 0, 104, 5, + 88, 5, 0, 0, 87, 0, + 0, 0, 104, 5, 0, 0, + 87, 0, 0, 0, 116, 5, 0, 0, 14, 0, 1, 0, - 120, 5, 0, 0, 14, 0, - 1, 0, 136, 5, 0, 0, - 14, 0, 1, 0, 152, 5, + 132, 5, 0, 0, 14, 0, + 1, 0, 148, 5, 0, 0, + 14, 0, 1, 0, 164, 5, 0, 0, 60, 1, 2, 0, - 168, 5, 0, 0, 85, 0, - 0, 0, 184, 5, 0, 0, - 85, 0, 0, 0, 200, 5, + 180, 5, 0, 0, 85, 0, + 0, 0, 196, 5, 0, 0, + 85, 0, 0, 0, 212, 5, 0, 0, 85, 0, 0, 0, - 216, 5, 0, 0, 52, 1, - 2, 0, 232, 5, 0, 0, - 52, 1, 2, 0, 252, 5, + 228, 5, 0, 0, 52, 1, + 2, 0, 244, 5, 0, 0, + 52, 1, 2, 0, 8, 6, 0, 0, 61, 1, 2, 0, - 8, 6, 0, 0, 59, 1, - 2, 0, 20, 6, 0, 0, + 20, 6, 0, 0, 59, 1, + 2, 0, 32, 6, 0, 0, 86, 83, 66, 97, 115, 105, 99, 80, 105, 120, 101, 108, 76, 105, 103, 104, 116, 105, @@ -335,7 +335,9 @@ const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc index b0af53ecd4f3c3313e308c50c93ea3e05a80fde1..8cb24e55ff3dc58c6021c7659fd736dfb043980b 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc @@ -46,7 +46,7 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8,9,10> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 oPos.z, v0, c11 // ::VSBasicPixelLightingVc<13> dp4 oT0.x, v0, c3 // ::VSBasicPixelLightingVc<0> dp4 oT0.y, v0, c4 // ::VSBasicPixelLightingVc<1> @@ -58,20 +58,20 @@ rsq r0.w, r0.w mul oT1.xyz, r0.w, r0 // ::VSBasicPixelLightingVc<4,5,6> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 max r0.x, r0.x, c13.x min oT0.w, r0.x, c13.y // ::VSBasicPixelLightingVc<3> -#line 286 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 286 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT2.w, v2.w, c1.w // ::VSBasicPixelLightingVc<10> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c9 // ::vout<0> dp4 r0.y, v0, c10 // ::vout<1> dp4 r0.z, v0, c12 // ::vout<3> -#line 278 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 278 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicPixelLightingVc<11,12> mov oPos.w, r0.z // ::VSBasicPixelLightingVc<14> @@ -111,17 +111,17 @@ ret const BYTE BasicEffect_VSBasicPixelLightingVc[] = { - 68, 88, 66, 67, 21, 241, - 126, 7, 199, 62, 72, 9, - 249, 225, 57, 230, 105, 223, - 248, 207, 1, 0, 0, 0, - 160, 9, 0, 0, 4, 0, + 68, 88, 66, 67, 110, 63, + 70, 140, 228, 89, 128, 23, + 231, 246, 8, 127, 254, 119, + 199, 191, 1, 0, 0, 0, + 172, 9, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 60, 6, 0, 0, 160, 8, - 0, 0, 20, 9, 0, 0, - 65, 111, 110, 57, 4, 6, - 0, 0, 4, 6, 0, 0, - 0, 2, 254, 255, 184, 5, + 72, 6, 0, 0, 172, 8, + 0, 0, 32, 9, 0, 0, + 65, 111, 110, 57, 16, 6, + 0, 0, 16, 6, 0, 0, + 0, 2, 254, 255, 196, 5, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -134,14 +134,14 @@ const BYTE BasicEffect_VSBasicPixelLightingVc[] = 7, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 14, 1, 68, 66, 85, 71, + 17, 1, 68, 66, 85, 71, 40, 0, 0, 0, 12, 4, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 24, 0, 0, 0, 16, 1, 0, 0, 3, 0, 0, 0, 208, 3, 0, 0, - 208, 1, 0, 0, 67, 58, + 208, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -153,7 +153,7 @@ const BYTE BasicEffect_VSBasicPixelLightingVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -165,7 +165,7 @@ const BYTE BasicEffect_VSBasicPixelLightingVc[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -181,37 +181,37 @@ const BYTE BasicEffect_VSBasicPixelLightingVc[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 64, 4, 0, 0, 0, 0, - 255, 255, 88, 4, 0, 0, - 0, 0, 255, 255, 100, 4, + 76, 4, 0, 0, 0, 0, + 255, 255, 100, 4, 0, 0, + 0, 0, 255, 255, 112, 4, 0, 0, 0, 0, 255, 255, - 112, 4, 0, 0, 85, 0, - 0, 0, 124, 4, 0, 0, - 86, 0, 0, 0, 140, 4, + 124, 4, 0, 0, 85, 0, + 0, 0, 136, 4, 0, 0, + 86, 0, 0, 0, 152, 4, 0, 0, 86, 0, 0, 0, - 156, 4, 0, 0, 86, 0, - 0, 0, 172, 4, 0, 0, - 87, 0, 0, 0, 188, 4, + 168, 4, 0, 0, 86, 0, + 0, 0, 184, 4, 0, 0, + 87, 0, 0, 0, 200, 4, 0, 0, 87, 0, 0, 0, - 204, 4, 0, 0, 87, 0, - 0, 0, 220, 4, 0, 0, - 87, 0, 0, 0, 236, 4, + 216, 4, 0, 0, 87, 0, + 0, 0, 232, 4, 0, 0, + 87, 0, 0, 0, 248, 4, 0, 0, 87, 0, 0, 0, - 252, 4, 0, 0, 87, 0, - 0, 0, 8, 5, 0, 0, - 14, 0, 1, 0, 24, 5, + 8, 5, 0, 0, 87, 0, + 0, 0, 20, 5, 0, 0, + 14, 0, 1, 0, 36, 5, 0, 0, 14, 0, 1, 0, - 40, 5, 0, 0, 14, 0, - 1, 0, 56, 5, 0, 0, - 30, 1, 2, 0, 72, 5, + 52, 5, 0, 0, 14, 0, + 1, 0, 68, 5, 0, 0, + 30, 1, 2, 0, 84, 5, 0, 0, 85, 0, 0, 0, - 88, 5, 0, 0, 85, 0, - 0, 0, 104, 5, 0, 0, - 85, 0, 0, 0, 120, 5, + 100, 5, 0, 0, 85, 0, + 0, 0, 116, 5, 0, 0, + 85, 0, 0, 0, 132, 5, 0, 0, 22, 1, 2, 0, - 136, 5, 0, 0, 22, 1, - 2, 0, 156, 5, 0, 0, - 29, 1, 2, 0, 168, 5, + 148, 5, 0, 0, 22, 1, + 2, 0, 168, 5, 0, 0, + 29, 1, 2, 0, 180, 5, 0, 0, 86, 83, 66, 97, 115, 105, 99, 80, 105, 120, 101, 108, 76, 105, 103, 104, @@ -314,7 +314,9 @@ const BYTE BasicEffect_VSBasicPixelLightingVc[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc index 4b9833d782bd5448e24b64b99ca58b5d1f32f36c..55fb7315f4fc657ec275c8bcde7cf5bef85afa1c 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc @@ -44,7 +44,7 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSBasicTx<12> #line 14 @@ -57,15 +57,15 @@ dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 96 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 96 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicTx<10,11> mov oPos.w, r0.z // ::VSBasicTx<13> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSBasicTx<0,1,2,3> mov oT1.xyz, c7.x // ::VSBasicTx<4,5,6> -#line 103 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 103 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mov oT2.xy, v1 // ::VSBasicTx<8,9> // approximately 12 instruction slots used @@ -91,17 +91,17 @@ ret const BYTE BasicEffect_VSBasicTx[] = { - 68, 88, 66, 67, 228, 129, - 100, 178, 242, 10, 146, 13, - 176, 148, 149, 179, 151, 217, - 176, 132, 1, 0, 0, 0, - 4, 7, 0, 0, 4, 0, + 68, 88, 66, 67, 183, 10, + 102, 233, 28, 106, 76, 203, + 90, 87, 21, 213, 19, 22, + 213, 3, 1, 0, 0, 0, + 16, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 196, 4, 0, 0, 32, 6, - 0, 0, 120, 6, 0, 0, - 65, 111, 110, 57, 140, 4, - 0, 0, 140, 4, 0, 0, - 0, 2, 254, 255, 64, 4, + 208, 4, 0, 0, 44, 6, + 0, 0, 132, 6, 0, 0, + 65, 111, 110, 57, 152, 4, + 0, 0, 152, 4, 0, 0, + 0, 2, 254, 255, 76, 4, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -114,14 +114,14 @@ const BYTE BasicEffect_VSBasicTx[] = 4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 212, 0, 68, 66, 85, 71, + 215, 0, 68, 66, 85, 71, 40, 0, 0, 0, 36, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 15, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 232, 2, 0, 0, - 60, 1, 0, 0, 67, 58, + 60, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -133,7 +133,7 @@ const BYTE BasicEffect_VSBasicTx[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -148,26 +148,26 @@ const BYTE BasicEffect_VSBasicTx[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 88, 3, 0, 0, - 0, 0, 255, 255, 112, 3, + 255, 255, 100, 3, 0, 0, + 0, 0, 255, 255, 124, 3, 0, 0, 0, 0, 255, 255, - 124, 3, 0, 0, 43, 0, - 0, 0, 136, 3, 0, 0, - 14, 0, 0, 0, 152, 3, + 136, 3, 0, 0, 43, 0, + 0, 0, 148, 3, 0, 0, + 14, 0, 0, 0, 164, 3, 0, 0, 14, 0, 0, 0, - 168, 3, 0, 0, 14, 0, - 0, 0, 184, 3, 0, 0, - 43, 0, 0, 0, 200, 3, + 180, 3, 0, 0, 14, 0, + 0, 0, 196, 3, 0, 0, + 43, 0, 0, 0, 212, 3, 0, 0, 43, 0, 0, 0, - 216, 3, 0, 0, 43, 0, - 0, 0, 232, 3, 0, 0, - 96, 0, 1, 0, 248, 3, + 228, 3, 0, 0, 43, 0, + 0, 0, 244, 3, 0, 0, + 96, 0, 1, 0, 4, 4, 0, 0, 96, 0, 1, 0, - 12, 4, 0, 0, 44, 0, - 0, 0, 24, 4, 0, 0, - 45, 0, 0, 0, 36, 4, + 24, 4, 0, 0, 44, 0, + 0, 0, 36, 4, 0, 0, + 45, 0, 0, 0, 48, 4, 0, 0, 103, 0, 1, 0, - 48, 4, 0, 0, 86, 83, + 60, 4, 0, 0, 86, 83, 66, 97, 115, 105, 99, 84, 120, 0, 68, 105, 102, 102, 117, 115, 101, 0, 171, 171, @@ -255,7 +255,9 @@ const BYTE BasicEffect_VSBasicTx[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc index f26596b81ce39554d99fd95dac3ac96629b20683..f0c26d0cd32e7cfd676d00b85752084a03e8cc6f 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc @@ -41,20 +41,20 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSBasicTxNoFog<8> dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 110 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 110 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicTxNoFog<6,7> mov oPos.w, r0.z // ::VSBasicTxNoFog<9> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSBasicTxNoFog<0,1,2,3> -#line 117 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 117 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mov oT1.xy, v1 // ::VSBasicTxNoFog<4,5> // approximately 8 instruction slots used @@ -77,17 +77,17 @@ ret const BYTE BasicEffect_VSBasicTxNoFog[] = { - 68, 88, 66, 67, 148, 90, - 127, 101, 25, 225, 99, 199, - 163, 239, 33, 209, 36, 12, - 134, 83, 1, 0, 0, 0, - 0, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 255, 12, + 188, 102, 163, 51, 169, 182, + 7, 71, 195, 242, 239, 240, + 76, 213, 1, 0, 0, 0, + 12, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 36, 4, 0, 0, 52, 5, - 0, 0, 140, 5, 0, 0, - 65, 111, 110, 57, 236, 3, - 0, 0, 236, 3, 0, 0, - 0, 2, 254, 255, 172, 3, + 48, 4, 0, 0, 64, 5, + 0, 0, 152, 5, 0, 0, + 65, 111, 110, 57, 248, 3, + 0, 0, 248, 3, 0, 0, + 0, 2, 254, 255, 184, 3, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -98,14 +98,14 @@ const BYTE BasicEffect_VSBasicTxNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 196, 0, 68, 66, 85, 71, + 199, 0, 68, 66, 85, 71, 40, 0, 0, 0, 228, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 10, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 168, 2, 0, 0, - 20, 1, 0, 0, 67, 58, + 20, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -117,7 +117,7 @@ const BYTE BasicEffect_VSBasicTxNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -132,19 +132,19 @@ const BYTE BasicEffect_VSBasicTxNoFog[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 24, 3, 0, 0, - 0, 0, 255, 255, 36, 3, + 255, 255, 36, 3, 0, 0, + 0, 0, 255, 255, 48, 3, 0, 0, 43, 0, 0, 0, - 48, 3, 0, 0, 43, 0, - 0, 0, 64, 3, 0, 0, - 43, 0, 0, 0, 80, 3, + 60, 3, 0, 0, 43, 0, + 0, 0, 76, 3, 0, 0, + 43, 0, 0, 0, 92, 3, 0, 0, 43, 0, 0, 0, - 96, 3, 0, 0, 110, 0, - 1, 0, 112, 3, 0, 0, - 110, 0, 1, 0, 132, 3, + 108, 3, 0, 0, 110, 0, + 1, 0, 124, 3, 0, 0, + 110, 0, 1, 0, 144, 3, 0, 0, 44, 0, 0, 0, - 144, 3, 0, 0, 117, 0, - 1, 0, 156, 3, 0, 0, + 156, 3, 0, 0, 117, 0, + 1, 0, 168, 3, 0, 0, 86, 83, 66, 97, 115, 105, 99, 84, 120, 78, 111, 70, 111, 103, 0, 68, 105, 102, @@ -228,7 +228,9 @@ const BYTE BasicEffect_VSBasicTxNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc index 3bd014fe28892fc2768906b84440f15b97b39dae..1c1db7a4eccc943d1c4d45525bbf509a2de8166e 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc @@ -46,7 +46,7 @@ dcl_texcoord1 v1 // vin<4,5> dcl_texcoord2 v2 // vin<6,7,8,9> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSBasicTxVc<12> #line 14 @@ -54,22 +54,22 @@ max r0.x, r0.x, c7.x min oT1.w, r0.x, c7.y // ::VSBasicTxVc<7> -#line 132 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 132 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0, v2, c1 // ::VSBasicTxVc<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c3 // ::vout<0> dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 124 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 124 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicTxVc<10,11> mov oPos.w, r0.z // ::VSBasicTxVc<13> -#line 45 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 45 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT1.xyz, c7.x // ::VSBasicTxVc<4,5,6> -#line 131 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 131 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mov oT2.xy, v1 // ::VSBasicTxVc<8,9> // approximately 12 instruction slots used @@ -96,17 +96,17 @@ ret const BYTE BasicEffect_VSBasicTxVc[] = { - 68, 88, 66, 67, 109, 189, - 219, 132, 177, 108, 140, 212, - 39, 208, 246, 167, 198, 130, - 87, 85, 1, 0, 0, 0, - 100, 7, 0, 0, 4, 0, + 68, 88, 66, 67, 68, 133, + 197, 228, 74, 239, 57, 21, + 82, 214, 247, 187, 233, 150, + 192, 162, 1, 0, 0, 0, + 112, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 244, 4, 0, 0, 100, 6, - 0, 0, 216, 6, 0, 0, - 65, 111, 110, 57, 188, 4, - 0, 0, 188, 4, 0, 0, - 0, 2, 254, 255, 112, 4, + 0, 5, 0, 0, 112, 6, + 0, 0, 228, 6, 0, 0, + 65, 111, 110, 57, 200, 4, + 0, 0, 200, 4, 0, 0, + 0, 2, 254, 255, 124, 4, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -119,14 +119,14 @@ const BYTE BasicEffect_VSBasicTxVc[] = 4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 220, 0, 68, 66, 85, 71, + 223, 0, 68, 66, 85, 71, 40, 0, 0, 0, 68, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 16, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 8, 3, 0, 0, - 68, 1, 0, 0, 67, 58, + 68, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -138,7 +138,7 @@ const BYTE BasicEffect_VSBasicTxVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -153,27 +153,27 @@ const BYTE BasicEffect_VSBasicTxVc[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 120, 3, 0, 0, - 0, 0, 255, 255, 144, 3, + 255, 255, 132, 3, 0, 0, + 0, 0, 255, 255, 156, 3, 0, 0, 0, 0, 255, 255, - 156, 3, 0, 0, 0, 0, - 255, 255, 168, 3, 0, 0, - 43, 0, 0, 0, 180, 3, + 168, 3, 0, 0, 0, 0, + 255, 255, 180, 3, 0, 0, + 43, 0, 0, 0, 192, 3, 0, 0, 14, 0, 0, 0, - 196, 3, 0, 0, 14, 0, - 0, 0, 212, 3, 0, 0, - 14, 0, 0, 0, 228, 3, + 208, 3, 0, 0, 14, 0, + 0, 0, 224, 3, 0, 0, + 14, 0, 0, 0, 240, 3, 0, 0, 132, 0, 1, 0, - 244, 3, 0, 0, 43, 0, - 0, 0, 4, 4, 0, 0, - 43, 0, 0, 0, 20, 4, + 0, 4, 0, 0, 43, 0, + 0, 0, 16, 4, 0, 0, + 43, 0, 0, 0, 32, 4, 0, 0, 43, 0, 0, 0, - 36, 4, 0, 0, 124, 0, - 1, 0, 52, 4, 0, 0, - 124, 0, 1, 0, 72, 4, + 48, 4, 0, 0, 124, 0, + 1, 0, 64, 4, 0, 0, + 124, 0, 1, 0, 84, 4, 0, 0, 45, 0, 0, 0, - 84, 4, 0, 0, 131, 0, - 1, 0, 96, 4, 0, 0, + 96, 4, 0, 0, 131, 0, + 1, 0, 108, 4, 0, 0, 86, 83, 66, 97, 115, 105, 99, 84, 120, 86, 99, 0, 68, 105, 102, 102, 117, 115, @@ -265,7 +265,9 @@ const BYTE BasicEffect_VSBasicTxVc[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc index dba8cae340064540c988614b742a3909f3726380..88f81644cfc27da548e466f378ca58edbab44087 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc @@ -43,18 +43,18 @@ dcl_texcoord1 v1 // vin<4,5> dcl_texcoord2 v2 // vin<6,7,8,9> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSBasicTxVcNoFog<8> -#line 147 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 147 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0, v2, c1 // ::VSBasicTxVcNoFog<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 139 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 139 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicTxVcNoFog<6,7> mov oPos.w, r0.z // ::VSBasicTxVcNoFog<9> @@ -82,17 +82,17 @@ ret const BYTE BasicEffect_VSBasicTxVcNoFog[] = { - 68, 88, 66, 67, 112, 14, - 119, 224, 77, 52, 152, 85, - 165, 175, 51, 107, 77, 138, - 61, 103, 1, 0, 0, 0, - 100, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 65, 63, + 168, 221, 255, 201, 37, 12, + 19, 194, 4, 98, 60, 73, + 38, 168, 1, 0, 0, 0, + 112, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 88, 4, 0, 0, 124, 5, - 0, 0, 240, 5, 0, 0, - 65, 111, 110, 57, 32, 4, - 0, 0, 32, 4, 0, 0, - 0, 2, 254, 255, 224, 3, + 100, 4, 0, 0, 136, 5, + 0, 0, 252, 5, 0, 0, + 65, 111, 110, 57, 44, 4, + 0, 0, 44, 4, 0, 0, + 0, 2, 254, 255, 236, 3, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -103,14 +103,14 @@ const BYTE BasicEffect_VSBasicTxVcNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 205, 0, 68, 66, 85, 71, + 208, 0, 68, 66, 85, 71, 40, 0, 0, 0, 8, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 11, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 204, 2, 0, 0, - 28, 1, 0, 0, 67, 58, + 28, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -122,7 +122,7 @@ const BYTE BasicEffect_VSBasicTxVcNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -137,20 +137,20 @@ const BYTE BasicEffect_VSBasicTxVcNoFog[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 60, 3, 0, 0, - 0, 0, 255, 255, 72, 3, + 255, 255, 72, 3, 0, 0, + 0, 0, 255, 255, 84, 3, 0, 0, 0, 0, 255, 255, - 84, 3, 0, 0, 43, 0, - 0, 0, 96, 3, 0, 0, - 147, 0, 1, 0, 112, 3, + 96, 3, 0, 0, 43, 0, + 0, 0, 108, 3, 0, 0, + 147, 0, 1, 0, 124, 3, 0, 0, 43, 0, 0, 0, - 128, 3, 0, 0, 43, 0, - 0, 0, 144, 3, 0, 0, - 43, 0, 0, 0, 160, 3, + 140, 3, 0, 0, 43, 0, + 0, 0, 156, 3, 0, 0, + 43, 0, 0, 0, 172, 3, 0, 0, 139, 0, 1, 0, - 176, 3, 0, 0, 139, 0, - 1, 0, 196, 3, 0, 0, - 146, 0, 1, 0, 208, 3, + 188, 3, 0, 0, 139, 0, + 1, 0, 208, 3, 0, 0, + 146, 0, 1, 0, 220, 3, 0, 0, 86, 83, 66, 97, 115, 105, 99, 84, 120, 86, 99, 78, 111, 70, 111, 103, @@ -239,7 +239,9 @@ const BYTE BasicEffect_VSBasicTxVcNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc index f0802d448d46d6ab5e09cd43a65c1c420535b591..d1f096816b969b15ab5ee1c4ebb5ddb772f5ed70 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc @@ -43,7 +43,7 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5,6,7> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSBasicVc<10> #line 14 @@ -51,19 +51,19 @@ max r0.x, r0.x, c7.x min oT1.w, r0.x, c7.y // ::VSBasicVc<7> -#line 75 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 75 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0, v1, c1 // ::VSBasicVc<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c3 // ::vout<0> dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 68 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 68 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicVc<8,9> mov oPos.w, r0.z // ::VSBasicVc<11> -#line 45 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 45 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT1.xyz, c7.x // ::VSBasicVc<4,5,6> // approximately 11 instruction slots used @@ -87,17 +87,17 @@ ret const BYTE BasicEffect_VSBasicVc[] = { - 68, 88, 66, 67, 158, 216, - 189, 127, 247, 201, 236, 51, - 146, 197, 0, 108, 49, 8, - 231, 40, 1, 0, 0, 0, - 140, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 205, 162, + 192, 131, 229, 144, 147, 105, + 81, 163, 119, 72, 22, 122, + 2, 66, 1, 0, 0, 0, + 152, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 136, 4, 0, 0, 204, 5, - 0, 0, 32, 6, 0, 0, - 65, 111, 110, 57, 80, 4, - 0, 0, 80, 4, 0, 0, - 0, 2, 254, 255, 4, 4, + 148, 4, 0, 0, 216, 5, + 0, 0, 44, 6, 0, 0, + 65, 111, 110, 57, 92, 4, + 0, 0, 92, 4, 0, 0, + 0, 2, 254, 255, 16, 4, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -110,14 +110,14 @@ const BYTE BasicEffect_VSBasicVc[] = 4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 199, 0, 68, 66, 85, 71, + 202, 0, 68, 66, 85, 71, 40, 0, 0, 0, 240, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 14, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 180, 2, 0, 0, - 52, 1, 0, 0, 67, 58, + 52, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -129,7 +129,7 @@ const BYTE BasicEffect_VSBasicVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -144,24 +144,24 @@ const BYTE BasicEffect_VSBasicVc[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 36, 3, 0, 0, - 0, 0, 255, 255, 60, 3, + 255, 255, 48, 3, 0, 0, + 0, 0, 255, 255, 72, 3, 0, 0, 0, 0, 255, 255, - 72, 3, 0, 0, 43, 0, - 0, 0, 84, 3, 0, 0, - 14, 0, 0, 0, 100, 3, + 84, 3, 0, 0, 43, 0, + 0, 0, 96, 3, 0, 0, + 14, 0, 0, 0, 112, 3, 0, 0, 14, 0, 0, 0, - 116, 3, 0, 0, 14, 0, - 0, 0, 132, 3, 0, 0, - 75, 0, 1, 0, 148, 3, + 128, 3, 0, 0, 14, 0, + 0, 0, 144, 3, 0, 0, + 75, 0, 1, 0, 160, 3, 0, 0, 43, 0, 0, 0, - 164, 3, 0, 0, 43, 0, - 0, 0, 180, 3, 0, 0, - 43, 0, 0, 0, 196, 3, + 176, 3, 0, 0, 43, 0, + 0, 0, 192, 3, 0, 0, + 43, 0, 0, 0, 208, 3, 0, 0, 68, 0, 1, 0, - 212, 3, 0, 0, 68, 0, - 1, 0, 232, 3, 0, 0, - 45, 0, 0, 0, 244, 3, + 224, 3, 0, 0, 68, 0, + 1, 0, 244, 3, 0, 0, + 45, 0, 0, 0, 0, 4, 0, 0, 86, 83, 66, 97, 115, 105, 99, 86, 99, 0, 68, 105, 102, 102, 117, 115, @@ -242,7 +242,9 @@ const BYTE BasicEffect_VSBasicVc[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc index dfe64c9b925438a50a9939639d16125d99006c9d..8aecebee47d70563bbb8add359f86c2314030132 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc @@ -40,18 +40,18 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5,6,7> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSBasicVcNoFog<6> -#line 89 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 89 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0, v1, c1 // ::VSBasicVcNoFog<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 82 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 82 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicVcNoFog<4,5> mov oPos.w, r0.z // ::VSBasicVcNoFog<7> @@ -73,17 +73,17 @@ ret const BYTE BasicEffect_VSBasicVcNoFog[] = { - 68, 88, 66, 67, 114, 65, - 2, 27, 167, 13, 188, 197, - 210, 128, 13, 198, 110, 181, - 26, 207, 1, 0, 0, 0, - 136, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 118, 186, + 204, 183, 153, 192, 108, 157, + 160, 150, 243, 26, 75, 106, + 171, 221, 1, 0, 0, 0, + 148, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 232, 3, 0, 0, 224, 4, - 0, 0, 52, 5, 0, 0, - 65, 111, 110, 57, 176, 3, - 0, 0, 176, 3, 0, 0, - 0, 2, 254, 255, 112, 3, + 244, 3, 0, 0, 236, 4, + 0, 0, 64, 5, 0, 0, + 65, 111, 110, 57, 188, 3, + 0, 0, 188, 3, 0, 0, + 0, 2, 254, 255, 124, 3, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -94,14 +94,14 @@ const BYTE BasicEffect_VSBasicVcNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 183, 0, 68, 66, 85, 71, + 186, 0, 68, 66, 85, 71, 40, 0, 0, 0, 176, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 9, 0, 0, 0, 196, 0, 0, 0, 3, 0, 0, 0, 116, 2, 0, 0, - 12, 1, 0, 0, 67, 58, + 12, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -113,7 +113,7 @@ const BYTE BasicEffect_VSBasicVcNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -128,18 +128,18 @@ const BYTE BasicEffect_VSBasicVcNoFog[] = 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, - 255, 255, 228, 2, 0, 0, - 0, 0, 255, 255, 240, 2, + 255, 255, 240, 2, 0, 0, + 0, 0, 255, 255, 252, 2, 0, 0, 43, 0, 0, 0, - 252, 2, 0, 0, 89, 0, - 1, 0, 12, 3, 0, 0, - 43, 0, 0, 0, 28, 3, + 8, 3, 0, 0, 89, 0, + 1, 0, 24, 3, 0, 0, + 43, 0, 0, 0, 40, 3, 0, 0, 43, 0, 0, 0, - 44, 3, 0, 0, 43, 0, - 0, 0, 60, 3, 0, 0, - 82, 0, 1, 0, 76, 3, + 56, 3, 0, 0, 43, 0, + 0, 0, 72, 3, 0, 0, + 82, 0, 1, 0, 88, 3, 0, 0, 82, 0, 1, 0, - 96, 3, 0, 0, 86, 83, + 108, 3, 0, 0, 86, 83, 66, 97, 115, 105, 99, 86, 99, 78, 111, 70, 111, 103, 0, 68, 105, 102, 102, 117, @@ -216,7 +216,9 @@ const BYTE BasicEffect_VSBasicVcNoFog[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc index 084bf7f6c04b50dd3c2ff402e60917c626e8bcd1..f5bea02eb6c6e4449566813e8c8c1c56f44f0c1e 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc @@ -43,7 +43,7 @@ dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5,6> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, v1, c18 dp3 r0.y, v1, c19 dp3 r0.z, v1, c20 @@ -113,21 +113,21 @@ #line 63 dp4 oPos.z, v0, c23 // ::VSBasicVertexLighting<10> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c14 max r0.x, r0.x, c25.x min oT1.w, r0.x, c25.y // ::VSBasicVertexLighting<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c21 // ::vout<0> dp4 r0.y, v0, c22 // ::vout<1> dp4 r0.z, v0, c24 // ::vout<3> -#line 154 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 154 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicVertexLighting<8,9> mov oPos.w, r0.z // ::VSBasicVertexLighting<11> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c1.w // ::VSBasicVertexLighting<3> // approximately 61 instruction slots used @@ -197,17 +197,17 @@ ret const BYTE BasicEffect_VSBasicVertexLighting[] = { - 68, 88, 66, 67, 11, 169, - 156, 99, 25, 253, 36, 15, - 116, 176, 152, 41, 101, 109, - 158, 51, 1, 0, 0, 0, - 104, 18, 0, 0, 4, 0, + 68, 88, 66, 67, 10, 186, + 222, 200, 42, 197, 147, 26, + 191, 48, 1, 228, 38, 201, + 218, 35, 1, 0, 0, 0, + 116, 18, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 216, 10, 0, 0, 168, 17, - 0, 0, 252, 17, 0, 0, - 65, 111, 110, 57, 160, 10, - 0, 0, 160, 10, 0, 0, - 0, 2, 254, 255, 84, 10, + 228, 10, 0, 0, 180, 17, + 0, 0, 8, 18, 0, 0, + 65, 111, 110, 57, 172, 10, + 0, 0, 172, 10, 0, 0, + 0, 2, 254, 255, 96, 10, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -220,14 +220,14 @@ const BYTE BasicEffect_VSBasicVertexLighting[] = 7, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 194, 1, 68, 66, 85, 71, + 197, 1, 68, 66, 85, 71, 40, 0, 0, 0, 220, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 54, 0, 0, 0, 16, 1, 0, 0, 13, 0, 0, 0, 216, 5, 0, 0, - 244, 2, 0, 0, 67, 58, + 244, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -239,7 +239,7 @@ const BYTE BasicEffect_VSBasicVertexLighting[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -251,7 +251,7 @@ const BYTE BasicEffect_VSBasicVertexLighting[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -267,77 +267,77 @@ const BYTE BasicEffect_VSBasicVertexLighting[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 16, 7, 0, 0, 0, 0, - 255, 255, 40, 7, 0, 0, - 0, 0, 255, 255, 52, 7, + 28, 7, 0, 0, 0, 0, + 255, 255, 52, 7, 0, 0, + 0, 0, 255, 255, 64, 7, 0, 0, 59, 0, 0, 0, - 64, 7, 0, 0, 59, 0, - 0, 0, 80, 7, 0, 0, - 59, 0, 0, 0, 96, 7, + 76, 7, 0, 0, 59, 0, + 0, 0, 92, 7, 0, 0, + 59, 0, 0, 0, 108, 7, 0, 0, 59, 0, 0, 0, - 112, 7, 0, 0, 36, 0, - 0, 0, 124, 7, 0, 0, - 36, 0, 0, 0, 140, 7, + 124, 7, 0, 0, 36, 0, + 0, 0, 136, 7, 0, 0, + 36, 0, 0, 0, 152, 7, 0, 0, 36, 0, 0, 0, - 156, 7, 0, 0, 39, 0, - 0, 0, 172, 7, 0, 0, - 41, 0, 0, 0, 188, 7, + 168, 7, 0, 0, 39, 0, + 0, 0, 184, 7, 0, 0, + 41, 0, 0, 0, 200, 7, 0, 0, 46, 0, 0, 0, - 204, 7, 0, 0, 46, 0, - 0, 0, 220, 7, 0, 0, - 46, 0, 0, 0, 240, 7, + 216, 7, 0, 0, 46, 0, + 0, 0, 232, 7, 0, 0, + 46, 0, 0, 0, 252, 7, 0, 0, 46, 0, 0, 0, - 4, 8, 0, 0, 46, 0, - 0, 0, 16, 8, 0, 0, - 57, 0, 0, 0, 36, 8, + 16, 8, 0, 0, 46, 0, + 0, 0, 28, 8, 0, 0, + 57, 0, 0, 0, 48, 8, 0, 0, 57, 0, 0, 0, - 52, 8, 0, 0, 57, 0, - 0, 0, 68, 8, 0, 0, - 58, 0, 0, 0, 84, 8, + 64, 8, 0, 0, 57, 0, + 0, 0, 80, 8, 0, 0, + 58, 0, 0, 0, 96, 8, 0, 0, 58, 0, 0, 0, - 100, 8, 0, 0, 33, 0, - 0, 0, 112, 8, 0, 0, - 33, 0, 0, 0, 128, 8, + 112, 8, 0, 0, 33, 0, + 0, 0, 124, 8, 0, 0, + 33, 0, 0, 0, 140, 8, 0, 0, 37, 0, 0, 0, - 140, 8, 0, 0, 33, 0, - 0, 0, 156, 8, 0, 0, - 33, 0, 0, 0, 172, 8, + 152, 8, 0, 0, 33, 0, + 0, 0, 168, 8, 0, 0, + 33, 0, 0, 0, 184, 8, 0, 0, 33, 0, 0, 0, - 188, 8, 0, 0, 37, 0, - 0, 0, 200, 8, 0, 0, - 33, 0, 0, 0, 216, 8, + 200, 8, 0, 0, 37, 0, + 0, 0, 212, 8, 0, 0, + 33, 0, 0, 0, 228, 8, 0, 0, 37, 0, 0, 0, - 228, 8, 0, 0, 42, 0, - 0, 0, 244, 8, 0, 0, - 42, 0, 0, 0, 4, 9, + 240, 8, 0, 0, 42, 0, + 0, 0, 0, 9, 0, 0, + 42, 0, 0, 0, 16, 9, 0, 0, 42, 0, 0, 0, - 20, 9, 0, 0, 42, 0, - 0, 0, 32, 9, 0, 0, - 42, 0, 0, 0, 44, 9, + 32, 9, 0, 0, 42, 0, + 0, 0, 44, 9, 0, 0, + 42, 0, 0, 0, 56, 9, 0, 0, 42, 0, 0, 0, - 56, 9, 0, 0, 42, 0, - 0, 0, 72, 9, 0, 0, - 42, 0, 0, 0, 84, 9, + 68, 9, 0, 0, 42, 0, + 0, 0, 84, 9, 0, 0, + 42, 0, 0, 0, 96, 9, 0, 0, 42, 0, 0, 0, - 96, 9, 0, 0, 47, 0, - 0, 0, 108, 9, 0, 0, - 47, 0, 0, 0, 124, 9, + 108, 9, 0, 0, 47, 0, + 0, 0, 120, 9, 0, 0, + 47, 0, 0, 0, 136, 9, 0, 0, 47, 0, 0, 0, - 144, 9, 0, 0, 47, 0, - 0, 0, 164, 9, 0, 0, - 63, 0, 0, 0, 180, 9, + 156, 9, 0, 0, 47, 0, + 0, 0, 176, 9, 0, 0, + 63, 0, 0, 0, 192, 9, 0, 0, 14, 0, 1, 0, - 196, 9, 0, 0, 14, 0, - 1, 0, 212, 9, 0, 0, - 14, 0, 1, 0, 228, 9, + 208, 9, 0, 0, 14, 0, + 1, 0, 224, 9, 0, 0, + 14, 0, 1, 0, 240, 9, 0, 0, 63, 0, 0, 0, - 244, 9, 0, 0, 63, 0, - 0, 0, 4, 10, 0, 0, - 63, 0, 0, 0, 20, 10, + 0, 10, 0, 0, 63, 0, + 0, 0, 16, 10, 0, 0, + 63, 0, 0, 0, 32, 10, 0, 0, 154, 0, 2, 0, - 36, 10, 0, 0, 154, 0, - 2, 0, 56, 10, 0, 0, - 46, 0, 0, 0, 68, 10, + 48, 10, 0, 0, 154, 0, + 2, 0, 68, 10, 0, 0, + 46, 0, 0, 0, 80, 10, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -520,7 +520,9 @@ const BYTE BasicEffect_VSBasicVertexLighting[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 25, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc index 512faba1c5a70ce27059622ae99a34c7853a3f33..5648ff2c587c5637e2356d203bd9800023eb3480 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc @@ -46,7 +46,7 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, v1, c18 dp3 r0.y, v1, c19 dp3 r0.z, v1, c20 @@ -116,24 +116,24 @@ #line 63 dp4 oPos.z, v0, c23 // ::VSBasicVertexLightingTx<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c14 max r0.x, r0.x, c25.x min oT1.w, r0.x, c25.y // ::VSBasicVertexLightingTx<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c21 // ::vout<0> dp4 r0.y, v0, c22 // ::vout<1> dp4 r0.z, v0, c24 // ::vout<3> -#line 180 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 180 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicVertexLightingTx<10,11> mov oPos.w, r0.z // ::VSBasicVertexLightingTx<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c1.w // ::VSBasicVertexLightingTx<3> -#line 187 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 187 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mov oT2.xy, v2 // ::VSBasicVertexLightingTx<8,9> // approximately 62 instruction slots used @@ -206,17 +206,17 @@ ret const BYTE BasicEffect_VSBasicVertexLightingTx[] = { - 68, 88, 66, 67, 128, 152, - 53, 198, 172, 158, 146, 237, - 44, 232, 207, 138, 186, 159, - 64, 219, 1, 0, 0, 0, - 64, 19, 0, 0, 4, 0, + 68, 88, 66, 67, 219, 61, + 22, 200, 14, 147, 141, 147, + 12, 93, 201, 38, 94, 222, + 36, 141, 1, 0, 0, 0, + 76, 19, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 68, 11, 0, 0, 64, 18, - 0, 0, 180, 18, 0, 0, - 65, 111, 110, 57, 12, 11, - 0, 0, 12, 11, 0, 0, - 0, 2, 254, 255, 192, 10, + 80, 11, 0, 0, 76, 18, + 0, 0, 192, 18, 0, 0, + 65, 111, 110, 57, 24, 11, + 0, 0, 24, 11, 0, 0, + 0, 2, 254, 255, 204, 10, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -229,14 +229,14 @@ const BYTE BasicEffect_VSBasicVertexLightingTx[] = 7, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 215, 1, 68, 66, 85, 71, + 218, 1, 68, 66, 85, 71, 40, 0, 0, 0, 48, 7, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 56, 0, 0, 0, 16, 1, 0, 0, 13, 0, 0, 0, 44, 6, 0, 0, - 4, 3, 0, 0, 67, 58, + 4, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -248,7 +248,7 @@ const BYTE BasicEffect_VSBasicVertexLightingTx[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -260,7 +260,7 @@ const BYTE BasicEffect_VSBasicVertexLightingTx[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -276,80 +276,80 @@ const BYTE BasicEffect_VSBasicVertexLightingTx[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 100, 7, 0, 0, 0, 0, - 255, 255, 124, 7, 0, 0, - 0, 0, 255, 255, 136, 7, + 112, 7, 0, 0, 0, 0, + 255, 255, 136, 7, 0, 0, + 0, 0, 255, 255, 148, 7, 0, 0, 0, 0, 255, 255, - 148, 7, 0, 0, 59, 0, - 0, 0, 160, 7, 0, 0, - 59, 0, 0, 0, 176, 7, + 160, 7, 0, 0, 59, 0, + 0, 0, 172, 7, 0, 0, + 59, 0, 0, 0, 188, 7, 0, 0, 59, 0, 0, 0, - 192, 7, 0, 0, 59, 0, - 0, 0, 208, 7, 0, 0, - 36, 0, 0, 0, 220, 7, + 204, 7, 0, 0, 59, 0, + 0, 0, 220, 7, 0, 0, + 36, 0, 0, 0, 232, 7, 0, 0, 36, 0, 0, 0, - 236, 7, 0, 0, 36, 0, - 0, 0, 252, 7, 0, 0, - 39, 0, 0, 0, 12, 8, + 248, 7, 0, 0, 36, 0, + 0, 0, 8, 8, 0, 0, + 39, 0, 0, 0, 24, 8, 0, 0, 41, 0, 0, 0, - 28, 8, 0, 0, 46, 0, - 0, 0, 44, 8, 0, 0, - 46, 0, 0, 0, 60, 8, + 40, 8, 0, 0, 46, 0, + 0, 0, 56, 8, 0, 0, + 46, 0, 0, 0, 72, 8, 0, 0, 46, 0, 0, 0, - 80, 8, 0, 0, 46, 0, - 0, 0, 100, 8, 0, 0, - 46, 0, 0, 0, 112, 8, + 92, 8, 0, 0, 46, 0, + 0, 0, 112, 8, 0, 0, + 46, 0, 0, 0, 124, 8, 0, 0, 57, 0, 0, 0, - 132, 8, 0, 0, 57, 0, - 0, 0, 148, 8, 0, 0, - 57, 0, 0, 0, 164, 8, + 144, 8, 0, 0, 57, 0, + 0, 0, 160, 8, 0, 0, + 57, 0, 0, 0, 176, 8, 0, 0, 58, 0, 0, 0, - 180, 8, 0, 0, 58, 0, - 0, 0, 196, 8, 0, 0, - 33, 0, 0, 0, 208, 8, + 192, 8, 0, 0, 58, 0, + 0, 0, 208, 8, 0, 0, + 33, 0, 0, 0, 220, 8, 0, 0, 33, 0, 0, 0, - 224, 8, 0, 0, 37, 0, - 0, 0, 236, 8, 0, 0, - 33, 0, 0, 0, 252, 8, + 236, 8, 0, 0, 37, 0, + 0, 0, 248, 8, 0, 0, + 33, 0, 0, 0, 8, 9, 0, 0, 33, 0, 0, 0, - 12, 9, 0, 0, 33, 0, - 0, 0, 28, 9, 0, 0, - 37, 0, 0, 0, 40, 9, + 24, 9, 0, 0, 33, 0, + 0, 0, 40, 9, 0, 0, + 37, 0, 0, 0, 52, 9, 0, 0, 33, 0, 0, 0, - 56, 9, 0, 0, 37, 0, - 0, 0, 68, 9, 0, 0, - 42, 0, 0, 0, 84, 9, + 68, 9, 0, 0, 37, 0, + 0, 0, 80, 9, 0, 0, + 42, 0, 0, 0, 96, 9, 0, 0, 42, 0, 0, 0, - 100, 9, 0, 0, 42, 0, - 0, 0, 116, 9, 0, 0, - 42, 0, 0, 0, 128, 9, + 112, 9, 0, 0, 42, 0, + 0, 0, 128, 9, 0, 0, + 42, 0, 0, 0, 140, 9, 0, 0, 42, 0, 0, 0, - 140, 9, 0, 0, 42, 0, - 0, 0, 152, 9, 0, 0, - 42, 0, 0, 0, 168, 9, + 152, 9, 0, 0, 42, 0, + 0, 0, 164, 9, 0, 0, + 42, 0, 0, 0, 180, 9, 0, 0, 42, 0, 0, 0, - 180, 9, 0, 0, 42, 0, - 0, 0, 192, 9, 0, 0, - 47, 0, 0, 0, 204, 9, + 192, 9, 0, 0, 42, 0, + 0, 0, 204, 9, 0, 0, + 47, 0, 0, 0, 216, 9, 0, 0, 47, 0, 0, 0, - 220, 9, 0, 0, 47, 0, - 0, 0, 240, 9, 0, 0, - 47, 0, 0, 0, 4, 10, + 232, 9, 0, 0, 47, 0, + 0, 0, 252, 9, 0, 0, + 47, 0, 0, 0, 16, 10, 0, 0, 63, 0, 0, 0, - 20, 10, 0, 0, 14, 0, - 1, 0, 36, 10, 0, 0, - 14, 0, 1, 0, 52, 10, + 32, 10, 0, 0, 14, 0, + 1, 0, 48, 10, 0, 0, + 14, 0, 1, 0, 64, 10, 0, 0, 14, 0, 1, 0, - 68, 10, 0, 0, 63, 0, - 0, 0, 84, 10, 0, 0, - 63, 0, 0, 0, 100, 10, + 80, 10, 0, 0, 63, 0, + 0, 0, 96, 10, 0, 0, + 63, 0, 0, 0, 112, 10, 0, 0, 63, 0, 0, 0, - 116, 10, 0, 0, 180, 0, - 2, 0, 132, 10, 0, 0, - 180, 0, 2, 0, 152, 10, + 128, 10, 0, 0, 180, 0, + 2, 0, 144, 10, 0, 0, + 180, 0, 2, 0, 164, 10, 0, 0, 46, 0, 0, 0, - 164, 10, 0, 0, 187, 0, - 2, 0, 176, 10, 0, 0, + 176, 10, 0, 0, 187, 0, + 2, 0, 188, 10, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, @@ -543,7 +543,9 @@ const BYTE BasicEffect_VSBasicVertexLightingTx[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 25, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc index 183879a20aab104909a75ec78ec40cfa421d191d..f38eb6f95604a471662011a0a3f6b568c988b53c 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc @@ -48,7 +48,7 @@ dcl_texcoord2 v2 // vin<7,8> dcl_texcoord3 v3 // vin<9,10,11,12> -#line 57 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 57 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c15 // ::pos_ws<0> dp4 r0.y, v0, c16 // ::pos_ws<1> dp4 r0.z, v0, c17 // ::pos_ws<2> @@ -115,28 +115,28 @@ #line 63 dp4 oPos.z, v0, c23 // ::VSBasicVertexLightingTxVc<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c14 max r0.x, r0.x, c25.x min oT1.w, r0.x, c25.y // ::VSBasicVertexLightingTxVc<7> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mul r0.xyz, r1.y, c8 mad r0.xyz, r1.x, c7, r0 mad r0.xyz, r1.z, c9, r0 mov r1.xyz, c1 // Parameters::DiffuseColor<0,1,2> mad r0.xyz, r0, r1, c2 // ::result<0,1,2> -#line 202 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 202 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0.xyz, r0, v3 // ::VSBasicVertexLightingTxVc<0,1,2> mul oT0.w, v3.w, c1.w // ::VSBasicVertexLightingTxVc<3> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c21 // ::vout<0> dp4 r0.y, v0, c22 // ::vout<1> dp4 r0.z, v0, c24 // ::vout<3> -#line 194 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 194 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicVertexLightingTxVc<10,11> mov oPos.w, r0.z // ::VSBasicVertexLightingTxVc<13> @@ -215,17 +215,17 @@ ret const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = { - 68, 88, 66, 67, 210, 196, - 69, 235, 174, 230, 252, 142, - 74, 169, 9, 49, 0, 169, - 138, 236, 1, 0, 0, 0, - 40, 20, 0, 0, 4, 0, + 68, 88, 66, 67, 75, 168, + 173, 205, 115, 230, 212, 135, + 251, 144, 45, 145, 83, 86, + 65, 26, 1, 0, 0, 0, + 52, 20, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 220, 11, 0, 0, 8, 19, - 0, 0, 156, 19, 0, 0, - 65, 111, 110, 57, 164, 11, - 0, 0, 164, 11, 0, 0, - 0, 2, 254, 255, 88, 11, + 232, 11, 0, 0, 20, 19, + 0, 0, 168, 19, 0, 0, + 65, 111, 110, 57, 176, 11, + 0, 0, 176, 11, 0, 0, + 0, 2, 254, 255, 100, 11, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -238,14 +238,14 @@ const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = 7, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 245, 1, 68, 66, 85, 71, + 248, 1, 68, 66, 85, 71, 40, 0, 0, 0, 168, 7, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 58, 0, 0, 0, 16, 1, 0, 0, 14, 0, 0, 0, 144, 6, 0, 0, - 20, 3, 0, 0, 67, 58, + 20, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -257,7 +257,7 @@ const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -269,7 +269,7 @@ const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -285,83 +285,83 @@ const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 220, 7, 0, 0, 0, 0, - 255, 255, 244, 7, 0, 0, - 0, 0, 255, 255, 0, 8, + 232, 7, 0, 0, 0, 0, + 255, 255, 0, 8, 0, 0, + 0, 0, 255, 255, 12, 8, 0, 0, 0, 0, 255, 255, - 12, 8, 0, 0, 0, 0, - 255, 255, 24, 8, 0, 0, - 57, 0, 0, 0, 36, 8, + 24, 8, 0, 0, 0, 0, + 255, 255, 36, 8, 0, 0, + 57, 0, 0, 0, 48, 8, 0, 0, 57, 0, 0, 0, - 52, 8, 0, 0, 57, 0, - 0, 0, 68, 8, 0, 0, - 58, 0, 0, 0, 84, 8, + 64, 8, 0, 0, 57, 0, + 0, 0, 80, 8, 0, 0, + 58, 0, 0, 0, 96, 8, 0, 0, 58, 0, 0, 0, - 100, 8, 0, 0, 33, 0, - 0, 0, 112, 8, 0, 0, - 33, 0, 0, 0, 128, 8, + 112, 8, 0, 0, 33, 0, + 0, 0, 124, 8, 0, 0, + 33, 0, 0, 0, 140, 8, 0, 0, 59, 0, 0, 0, - 140, 8, 0, 0, 59, 0, - 0, 0, 156, 8, 0, 0, - 59, 0, 0, 0, 172, 8, + 152, 8, 0, 0, 59, 0, + 0, 0, 168, 8, 0, 0, + 59, 0, 0, 0, 184, 8, 0, 0, 59, 0, 0, 0, - 188, 8, 0, 0, 37, 0, - 0, 0, 200, 8, 0, 0, - 33, 0, 0, 0, 216, 8, + 200, 8, 0, 0, 37, 0, + 0, 0, 212, 8, 0, 0, + 33, 0, 0, 0, 228, 8, 0, 0, 33, 0, 0, 0, - 232, 8, 0, 0, 33, 0, - 0, 0, 248, 8, 0, 0, - 37, 0, 0, 0, 4, 9, + 244, 8, 0, 0, 33, 0, + 0, 0, 4, 9, 0, 0, + 37, 0, 0, 0, 16, 9, 0, 0, 33, 0, 0, 0, - 20, 9, 0, 0, 37, 0, - 0, 0, 32, 9, 0, 0, - 42, 0, 0, 0, 48, 9, + 32, 9, 0, 0, 37, 0, + 0, 0, 44, 9, 0, 0, + 42, 0, 0, 0, 60, 9, 0, 0, 36, 0, 0, 0, - 64, 9, 0, 0, 36, 0, - 0, 0, 80, 9, 0, 0, - 36, 0, 0, 0, 96, 9, + 76, 9, 0, 0, 36, 0, + 0, 0, 92, 9, 0, 0, + 36, 0, 0, 0, 108, 9, 0, 0, 39, 0, 0, 0, - 112, 9, 0, 0, 41, 0, - 0, 0, 128, 9, 0, 0, - 42, 0, 0, 0, 144, 9, + 124, 9, 0, 0, 41, 0, + 0, 0, 140, 9, 0, 0, + 42, 0, 0, 0, 156, 9, 0, 0, 42, 0, 0, 0, - 160, 9, 0, 0, 42, 0, - 0, 0, 172, 9, 0, 0, - 42, 0, 0, 0, 184, 9, + 172, 9, 0, 0, 42, 0, + 0, 0, 184, 9, 0, 0, + 42, 0, 0, 0, 196, 9, 0, 0, 42, 0, 0, 0, - 196, 9, 0, 0, 42, 0, - 0, 0, 212, 9, 0, 0, - 47, 0, 0, 0, 224, 9, + 208, 9, 0, 0, 42, 0, + 0, 0, 224, 9, 0, 0, + 47, 0, 0, 0, 236, 9, 0, 0, 42, 0, 0, 0, - 240, 9, 0, 0, 42, 0, - 0, 0, 252, 9, 0, 0, - 47, 0, 0, 0, 8, 10, + 252, 9, 0, 0, 42, 0, + 0, 0, 8, 10, 0, 0, + 47, 0, 0, 0, 20, 10, 0, 0, 47, 0, 0, 0, - 28, 10, 0, 0, 47, 0, - 0, 0, 48, 10, 0, 0, - 63, 0, 0, 0, 64, 10, + 40, 10, 0, 0, 47, 0, + 0, 0, 60, 10, 0, 0, + 63, 0, 0, 0, 76, 10, 0, 0, 14, 0, 1, 0, - 80, 10, 0, 0, 14, 0, - 1, 0, 96, 10, 0, 0, - 14, 0, 1, 0, 112, 10, + 92, 10, 0, 0, 14, 0, + 1, 0, 108, 10, 0, 0, + 14, 0, 1, 0, 124, 10, 0, 0, 46, 0, 0, 0, - 128, 10, 0, 0, 46, 0, - 0, 0, 144, 10, 0, 0, - 46, 0, 0, 0, 164, 10, + 140, 10, 0, 0, 46, 0, + 0, 0, 156, 10, 0, 0, + 46, 0, 0, 0, 176, 10, 0, 0, 46, 0, 0, 0, - 184, 10, 0, 0, 46, 0, - 0, 0, 196, 10, 0, 0, - 202, 0, 2, 0, 216, 10, + 196, 10, 0, 0, 46, 0, + 0, 0, 208, 10, 0, 0, + 202, 0, 2, 0, 228, 10, 0, 0, 202, 0, 2, 0, - 232, 10, 0, 0, 63, 0, - 0, 0, 248, 10, 0, 0, - 63, 0, 0, 0, 8, 11, + 244, 10, 0, 0, 63, 0, + 0, 0, 4, 11, 0, 0, + 63, 0, 0, 0, 20, 11, 0, 0, 63, 0, 0, 0, - 24, 11, 0, 0, 194, 0, - 2, 0, 40, 11, 0, 0, - 194, 0, 2, 0, 60, 11, + 36, 11, 0, 0, 194, 0, + 2, 0, 52, 11, 0, 0, + 194, 0, 2, 0, 72, 11, 0, 0, 201, 0, 2, 0, - 72, 11, 0, 0, 80, 97, + 84, 11, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, 67, 111, @@ -572,7 +572,9 @@ const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 25, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc index f8590887f74641b14c7c4507585a3b048b498673..7baa43b15cbc99908c27bc7e55c33290ba254cc7 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc @@ -45,7 +45,7 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8,9,10> -#line 57 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 57 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c15 // ::pos_ws<0> dp4 r0.y, v0, c16 // ::pos_ws<1> dp4 r0.z, v0, c17 // ::pos_ws<2> @@ -112,28 +112,28 @@ #line 63 dp4 oPos.z, v0, c23 // ::VSBasicVertexLightingVc<10> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c14 max r0.x, r0.x, c25.x min oT1.w, r0.x, c25.y // ::VSBasicVertexLightingVc<7> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mul r0.xyz, r1.y, c8 mad r0.xyz, r1.x, c7, r0 mad r0.xyz, r1.z, c9, r0 mov r1.xyz, c1 // Parameters::DiffuseColor<0,1,2> mad r0.xyz, r0, r1, c2 // ::result<0,1,2> -#line 173 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 173 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mul oT0.xyz, r0, v2 // ::VSBasicVertexLightingVc<0,1,2> mul oT0.w, v2.w, c1.w // ::VSBasicVertexLightingVc<3> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, v0, c21 // ::vout<0> dp4 r0.y, v0, c22 // ::vout<1> dp4 r0.z, v0, c24 // ::vout<3> -#line 166 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" +#line 166 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\BasicEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSBasicVertexLightingVc<8,9> mov oPos.w, r0.z // ::VSBasicVertexLightingVc<11> @@ -206,17 +206,17 @@ ret const BYTE BasicEffect_VSBasicVertexLightingVc[] = { - 68, 88, 66, 67, 226, 181, - 114, 107, 244, 208, 151, 98, - 45, 197, 123, 238, 12, 60, - 225, 221, 1, 0, 0, 0, - 76, 19, 0, 0, 4, 0, + 68, 88, 66, 67, 78, 15, + 26, 9, 203, 147, 125, 21, + 227, 123, 102, 242, 107, 110, + 178, 93, 1, 0, 0, 0, + 88, 19, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 108, 11, 0, 0, 108, 18, - 0, 0, 224, 18, 0, 0, - 65, 111, 110, 57, 52, 11, - 0, 0, 52, 11, 0, 0, - 0, 2, 254, 255, 232, 10, + 120, 11, 0, 0, 120, 18, + 0, 0, 236, 18, 0, 0, + 65, 111, 110, 57, 64, 11, + 0, 0, 64, 11, 0, 0, + 0, 2, 254, 255, 244, 10, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -229,14 +229,14 @@ const BYTE BasicEffect_VSBasicVertexLightingVc[] = 7, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 223, 1, 68, 66, 85, 71, + 226, 1, 68, 66, 85, 71, 40, 0, 0, 0, 80, 7, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 1, 0, 0, 56, 0, 0, 0, 16, 1, 0, 0, 14, 0, 0, 0, 56, 6, 0, 0, - 4, 3, 0, 0, 67, 58, + 4, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -248,7 +248,7 @@ const BYTE BasicEffect_VSBasicVertexLightingVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -260,7 +260,7 @@ const BYTE BasicEffect_VSBasicVertexLightingVc[] = 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -276,80 +276,80 @@ const BYTE BasicEffect_VSBasicVertexLightingVc[] = 0, 171, 40, 0, 0, 0, 113, 0, 0, 0, 184, 0, 0, 0, 0, 0, 255, 255, - 132, 7, 0, 0, 0, 0, - 255, 255, 156, 7, 0, 0, - 0, 0, 255, 255, 168, 7, + 144, 7, 0, 0, 0, 0, + 255, 255, 168, 7, 0, 0, + 0, 0, 255, 255, 180, 7, 0, 0, 0, 0, 255, 255, - 180, 7, 0, 0, 57, 0, - 0, 0, 192, 7, 0, 0, - 57, 0, 0, 0, 208, 7, + 192, 7, 0, 0, 57, 0, + 0, 0, 204, 7, 0, 0, + 57, 0, 0, 0, 220, 7, 0, 0, 57, 0, 0, 0, - 224, 7, 0, 0, 58, 0, - 0, 0, 240, 7, 0, 0, - 58, 0, 0, 0, 0, 8, + 236, 7, 0, 0, 58, 0, + 0, 0, 252, 7, 0, 0, + 58, 0, 0, 0, 12, 8, 0, 0, 33, 0, 0, 0, - 12, 8, 0, 0, 33, 0, - 0, 0, 28, 8, 0, 0, - 59, 0, 0, 0, 40, 8, + 24, 8, 0, 0, 33, 0, + 0, 0, 40, 8, 0, 0, + 59, 0, 0, 0, 52, 8, 0, 0, 59, 0, 0, 0, - 56, 8, 0, 0, 59, 0, - 0, 0, 72, 8, 0, 0, - 59, 0, 0, 0, 88, 8, + 68, 8, 0, 0, 59, 0, + 0, 0, 84, 8, 0, 0, + 59, 0, 0, 0, 100, 8, 0, 0, 37, 0, 0, 0, - 100, 8, 0, 0, 33, 0, - 0, 0, 116, 8, 0, 0, - 33, 0, 0, 0, 132, 8, + 112, 8, 0, 0, 33, 0, + 0, 0, 128, 8, 0, 0, + 33, 0, 0, 0, 144, 8, 0, 0, 33, 0, 0, 0, - 148, 8, 0, 0, 37, 0, - 0, 0, 160, 8, 0, 0, - 33, 0, 0, 0, 176, 8, + 160, 8, 0, 0, 37, 0, + 0, 0, 172, 8, 0, 0, + 33, 0, 0, 0, 188, 8, 0, 0, 37, 0, 0, 0, - 188, 8, 0, 0, 42, 0, - 0, 0, 204, 8, 0, 0, - 36, 0, 0, 0, 220, 8, + 200, 8, 0, 0, 42, 0, + 0, 0, 216, 8, 0, 0, + 36, 0, 0, 0, 232, 8, 0, 0, 36, 0, 0, 0, - 236, 8, 0, 0, 36, 0, - 0, 0, 252, 8, 0, 0, - 39, 0, 0, 0, 12, 9, + 248, 8, 0, 0, 36, 0, + 0, 0, 8, 9, 0, 0, + 39, 0, 0, 0, 24, 9, 0, 0, 41, 0, 0, 0, - 28, 9, 0, 0, 42, 0, - 0, 0, 44, 9, 0, 0, - 42, 0, 0, 0, 60, 9, + 40, 9, 0, 0, 42, 0, + 0, 0, 56, 9, 0, 0, + 42, 0, 0, 0, 72, 9, 0, 0, 42, 0, 0, 0, - 72, 9, 0, 0, 42, 0, - 0, 0, 84, 9, 0, 0, - 42, 0, 0, 0, 96, 9, + 84, 9, 0, 0, 42, 0, + 0, 0, 96, 9, 0, 0, + 42, 0, 0, 0, 108, 9, 0, 0, 42, 0, 0, 0, - 112, 9, 0, 0, 47, 0, - 0, 0, 124, 9, 0, 0, - 42, 0, 0, 0, 140, 9, + 124, 9, 0, 0, 47, 0, + 0, 0, 136, 9, 0, 0, + 42, 0, 0, 0, 152, 9, 0, 0, 42, 0, 0, 0, - 152, 9, 0, 0, 47, 0, - 0, 0, 164, 9, 0, 0, - 47, 0, 0, 0, 184, 9, + 164, 9, 0, 0, 47, 0, + 0, 0, 176, 9, 0, 0, + 47, 0, 0, 0, 196, 9, 0, 0, 47, 0, 0, 0, - 204, 9, 0, 0, 63, 0, - 0, 0, 220, 9, 0, 0, - 14, 0, 1, 0, 236, 9, + 216, 9, 0, 0, 63, 0, + 0, 0, 232, 9, 0, 0, + 14, 0, 1, 0, 248, 9, 0, 0, 14, 0, 1, 0, - 252, 9, 0, 0, 14, 0, - 1, 0, 12, 10, 0, 0, - 46, 0, 0, 0, 28, 10, + 8, 10, 0, 0, 14, 0, + 1, 0, 24, 10, 0, 0, + 46, 0, 0, 0, 40, 10, 0, 0, 46, 0, 0, 0, - 44, 10, 0, 0, 46, 0, - 0, 0, 64, 10, 0, 0, - 46, 0, 0, 0, 84, 10, + 56, 10, 0, 0, 46, 0, + 0, 0, 76, 10, 0, 0, + 46, 0, 0, 0, 96, 10, 0, 0, 46, 0, 0, 0, - 96, 10, 0, 0, 173, 0, - 2, 0, 116, 10, 0, 0, - 173, 0, 2, 0, 132, 10, + 108, 10, 0, 0, 173, 0, + 2, 0, 128, 10, 0, 0, + 173, 0, 2, 0, 144, 10, 0, 0, 63, 0, 0, 0, - 148, 10, 0, 0, 63, 0, - 0, 0, 164, 10, 0, 0, - 63, 0, 0, 0, 180, 10, + 160, 10, 0, 0, 63, 0, + 0, 0, 176, 10, 0, 0, + 63, 0, 0, 0, 192, 10, 0, 0, 166, 0, 2, 0, - 196, 10, 0, 0, 166, 0, - 2, 0, 216, 10, 0, 0, + 208, 10, 0, 0, 166, 0, + 2, 0, 228, 10, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, @@ -548,7 +548,9 @@ const BYTE BasicEffect_VSBasicVertexLightingVc[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 25, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main.inc index 23ec2d87a49f8b65426beb99227506fa8aabb806..3e489f37639f006cfa7ba2de760c6bfe5784660a 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main.inc @@ -54,7 +54,7 @@ dcl_texcoord2 v2 // vertex<7,8,9,10> dcl_texcoord3 v3 // vertex<11,12> -#line 129 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 129 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" dp4 oPos.z, v0, c7 // ::main<2> mad r0.xyz, v3.xyxw, c12.xxyw, c12.yyxw dp3 oT1.x, r0, c9.xyww // ::main<8> @@ -132,17 +132,17 @@ ret const BYTE DGSLEffect_main[] = { - 68, 88, 66, 67, 182, 249, - 107, 54, 68, 156, 189, 16, - 219, 123, 26, 176, 4, 68, - 179, 66, 1, 0, 0, 0, - 124, 10, 0, 0, 4, 0, + 68, 88, 66, 67, 1, 240, + 120, 128, 204, 184, 59, 192, + 91, 170, 100, 150, 249, 210, + 55, 71, 1, 0, 0, 0, + 136, 10, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 12, 6, 0, 0, 252, 8, - 0, 0, 144, 9, 0, 0, - 65, 111, 110, 57, 212, 5, - 0, 0, 212, 5, 0, 0, - 0, 2, 254, 255, 112, 5, + 24, 6, 0, 0, 8, 9, + 0, 0, 156, 9, 0, 0, + 65, 111, 110, 57, 224, 5, + 0, 0, 224, 5, 0, 0, + 0, 2, 254, 255, 124, 5, 0, 0, 100, 0, 0, 0, 5, 0, 36, 0, 0, 0, 96, 0, 0, 0, 96, 0, @@ -159,14 +159,14 @@ const BYTE DGSLEffect_main[] = 1, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 250, 0, 68, 66, 85, 71, + 253, 0, 68, 66, 85, 71, 40, 0, 0, 0, 188, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 25, 0, 0, 0, 120, 0, 0, 0, 4, 0, 0, 0, 108, 3, 0, 0, - 64, 1, 0, 0, 67, 58, + 64, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -180,39 +180,39 @@ const BYTE DGSLEffect_main[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 240, 3, + 0, 0, 255, 255, 252, 3, 0, 0, 0, 0, 255, 255, - 8, 4, 0, 0, 0, 0, - 255, 255, 20, 4, 0, 0, - 0, 0, 255, 255, 32, 4, + 20, 4, 0, 0, 0, 0, + 255, 255, 32, 4, 0, 0, + 0, 0, 255, 255, 44, 4, 0, 0, 0, 0, 255, 255, - 44, 4, 0, 0, 129, 0, - 0, 0, 56, 4, 0, 0, - 131, 0, 0, 0, 72, 4, + 56, 4, 0, 0, 129, 0, + 0, 0, 68, 4, 0, 0, + 131, 0, 0, 0, 84, 4, 0, 0, 131, 0, 0, 0, - 92, 4, 0, 0, 131, 0, - 0, 0, 108, 4, 0, 0, - 132, 0, 0, 0, 124, 4, + 104, 4, 0, 0, 131, 0, + 0, 0, 120, 4, 0, 0, + 132, 0, 0, 0, 136, 4, 0, 0, 132, 0, 0, 0, - 140, 4, 0, 0, 132, 0, - 0, 0, 156, 4, 0, 0, - 126, 0, 0, 0, 172, 4, + 152, 4, 0, 0, 132, 0, + 0, 0, 168, 4, 0, 0, + 126, 0, 0, 0, 184, 4, 0, 0, 126, 0, 0, 0, - 188, 4, 0, 0, 126, 0, - 0, 0, 204, 4, 0, 0, - 134, 0, 0, 0, 220, 4, + 200, 4, 0, 0, 126, 0, + 0, 0, 216, 4, 0, 0, + 134, 0, 0, 0, 232, 4, 0, 0, 126, 0, 0, 0, - 236, 4, 0, 0, 129, 0, - 0, 0, 248, 4, 0, 0, - 129, 0, 0, 0, 8, 5, + 248, 4, 0, 0, 129, 0, + 0, 0, 4, 5, 0, 0, + 129, 0, 0, 0, 20, 5, 0, 0, 129, 0, 0, 0, - 24, 5, 0, 0, 122, 0, - 0, 0, 40, 5, 0, 0, - 122, 0, 0, 0, 60, 5, + 36, 5, 0, 0, 122, 0, + 0, 0, 52, 5, 0, 0, + 122, 0, 0, 0, 72, 5, 0, 0, 130, 0, 0, 0, - 72, 5, 0, 0, 135, 0, - 0, 0, 84, 5, 0, 0, - 136, 0, 0, 0, 96, 5, + 84, 5, 0, 0, 135, 0, + 0, 0, 96, 5, 0, 0, + 136, 0, 0, 0, 108, 5, 0, 0, 109, 97, 105, 110, 0, 112, 111, 115, 0, 171, 171, 171, 1, 0, 3, 0, @@ -325,7 +325,9 @@ const BYTE DGSLEffect_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 12, 0, 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1Bones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1Bones.inc index 9ba5a332b33e72d1fa8c1f8ec831d5e7a01f05a5..70143438d36fa007ecb21d51f6f5469eea01b47e 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1Bones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1Bones.inc @@ -59,7 +59,7 @@ dcl_texcoord4 v4 // vertex<13,14,15,16> dcl_texcoord5 v5 // vertex<17,18,19,20> -#line 97 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 97 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" mul r0.x, v4.x, c228.x mova a0.x, r0.x mul r0, v5.x, c0[a0.x] // ::skinning<0,3,6,9> @@ -181,17 +181,17 @@ ret const BYTE DGSLEffect_main1Bones[] = { - 68, 88, 66, 67, 33, 52, - 28, 59, 16, 79, 211, 114, - 159, 203, 173, 27, 152, 183, - 209, 184, 1, 0, 0, 0, - 100, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 10, 250, + 228, 168, 240, 222, 35, 154, + 123, 90, 154, 177, 210, 27, + 24, 133, 1, 0, 0, 0, + 112, 15, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 220, 8, 0, 0, 152, 13, - 0, 0, 120, 14, 0, 0, - 65, 111, 110, 57, 164, 8, - 0, 0, 164, 8, 0, 0, - 0, 2, 254, 255, 52, 8, + 232, 8, 0, 0, 164, 13, + 0, 0, 132, 14, 0, 0, + 65, 111, 110, 57, 176, 8, + 0, 0, 176, 8, 0, 0, + 0, 2, 254, 255, 64, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -210,14 +210,14 @@ const BYTE DGSLEffect_main1Bones[] = 1, 0, 227, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 2, 254, 255, 254, 255, - 104, 1, 68, 66, 85, 71, + 107, 1, 68, 66, 85, 71, 40, 0, 0, 0, 116, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 42, 0, 0, 0, 120, 0, 0, 0, 6, 0, 0, 0, 252, 4, 0, 0, - 200, 1, 0, 0, 67, 58, + 200, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -231,62 +231,62 @@ const BYTE DGSLEffect_main1Bones[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 168, 5, + 0, 0, 255, 255, 180, 5, 0, 0, 0, 0, 255, 255, - 192, 5, 0, 0, 0, 0, - 255, 255, 204, 5, 0, 0, - 0, 0, 255, 255, 216, 5, + 204, 5, 0, 0, 0, 0, + 255, 255, 216, 5, 0, 0, + 0, 0, 255, 255, 228, 5, 0, 0, 0, 0, 255, 255, - 228, 5, 0, 0, 0, 0, - 255, 255, 240, 5, 0, 0, - 0, 0, 255, 255, 252, 5, + 240, 5, 0, 0, 0, 0, + 255, 255, 252, 5, 0, 0, + 0, 0, 255, 255, 8, 6, 0, 0, 97, 0, 0, 0, - 8, 6, 0, 0, 97, 0, - 0, 0, 24, 6, 0, 0, - 97, 0, 0, 0, 36, 6, + 20, 6, 0, 0, 97, 0, + 0, 0, 36, 6, 0, 0, + 97, 0, 0, 0, 48, 6, 0, 0, 102, 0, 0, 0, - 56, 6, 0, 0, 97, 0, - 0, 0, 72, 6, 0, 0, - 97, 0, 0, 0, 92, 6, + 68, 6, 0, 0, 97, 0, + 0, 0, 84, 6, 0, 0, + 97, 0, 0, 0, 104, 6, 0, 0, 102, 0, 0, 0, - 112, 6, 0, 0, 102, 0, - 0, 0, 128, 6, 0, 0, - 100, 0, 0, 0, 144, 6, + 124, 6, 0, 0, 102, 0, + 0, 0, 140, 6, 0, 0, + 100, 0, 0, 0, 156, 6, 0, 0, 101, 0, 0, 0, - 160, 6, 0, 0, 100, 0, - 0, 0, 176, 6, 0, 0, - 101, 0, 0, 0, 192, 6, + 172, 6, 0, 0, 100, 0, + 0, 0, 188, 6, 0, 0, + 101, 0, 0, 0, 204, 6, 0, 0, 100, 0, 0, 0, - 208, 6, 0, 0, 101, 0, - 0, 0, 224, 6, 0, 0, - 170, 0, 0, 0, 240, 6, + 220, 6, 0, 0, 101, 0, + 0, 0, 236, 6, 0, 0, + 170, 0, 0, 0, 252, 6, 0, 0, 173, 0, 0, 0, - 252, 6, 0, 0, 175, 0, - 0, 0, 12, 7, 0, 0, - 175, 0, 0, 0, 32, 7, + 8, 7, 0, 0, 175, 0, + 0, 0, 24, 7, 0, 0, + 175, 0, 0, 0, 44, 7, 0, 0, 175, 0, 0, 0, - 48, 7, 0, 0, 176, 0, - 0, 0, 64, 7, 0, 0, - 176, 0, 0, 0, 80, 7, + 60, 7, 0, 0, 176, 0, + 0, 0, 76, 7, 0, 0, + 176, 0, 0, 0, 92, 7, 0, 0, 176, 0, 0, 0, - 96, 7, 0, 0, 101, 0, - 0, 0, 112, 7, 0, 0, - 170, 0, 0, 0, 124, 7, + 108, 7, 0, 0, 101, 0, + 0, 0, 124, 7, 0, 0, + 170, 0, 0, 0, 136, 7, 0, 0, 170, 0, 0, 0, - 140, 7, 0, 0, 170, 0, - 0, 0, 156, 7, 0, 0, - 178, 0, 0, 0, 172, 7, + 152, 7, 0, 0, 170, 0, + 0, 0, 168, 7, 0, 0, + 178, 0, 0, 0, 184, 7, 0, 0, 170, 0, 0, 0, - 188, 7, 0, 0, 173, 0, - 0, 0, 200, 7, 0, 0, - 173, 0, 0, 0, 216, 7, + 200, 7, 0, 0, 173, 0, + 0, 0, 212, 7, 0, 0, + 173, 0, 0, 0, 228, 7, 0, 0, 173, 0, 0, 0, - 232, 7, 0, 0, 164, 0, - 0, 0, 248, 7, 0, 0, - 164, 0, 0, 0, 12, 8, + 244, 7, 0, 0, 164, 0, + 0, 0, 4, 8, 0, 0, + 164, 0, 0, 0, 24, 8, 0, 0, 174, 0, 0, 0, - 24, 8, 0, 0, 102, 0, - 0, 0, 36, 8, 0, 0, + 36, 8, 0, 0, 102, 0, + 0, 0, 48, 8, 0, 0, 109, 97, 105, 110, 49, 66, 111, 110, 101, 115, 0, 112, 111, 115, 0, 171, 1, 0, @@ -450,7 +450,9 @@ const BYTE DGSLEffect_main1Bones[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 228, 0, 15, 160, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1BonesVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1BonesVc.inc index d2a4e2b06a27d3ca7d6abc2e476ee9fe1467c99b..f61ee961f9ae1d80dbcdfa83fa6acbcb87060a4d 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1BonesVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main1BonesVc.inc @@ -61,7 +61,7 @@ dcl_texcoord5 v5 // vertex<17,18,19,20> dcl_texcoord6 v6 // vertex<21,22,23,24> -#line 112 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 112 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" mul r0.x, v5.x, c228.x mova a0.x, r0.x mul r0, v6.x, c0[a0.x] // ::skinning<0,3,6,9> @@ -182,17 +182,17 @@ ret const BYTE DGSLEffect_main1BonesVc[] = { - 68, 88, 66, 67, 128, 178, - 178, 97, 125, 167, 70, 197, - 27, 237, 13, 172, 173, 144, - 242, 53, 1, 0, 0, 0, - 204, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 141, 159, + 240, 217, 243, 98, 5, 22, + 173, 30, 24, 5, 224, 54, + 7, 203, 1, 0, 0, 0, + 216, 15, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 20, 9, 0, 0, 228, 13, - 0, 0, 224, 14, 0, 0, - 65, 111, 110, 57, 220, 8, - 0, 0, 220, 8, 0, 0, - 0, 2, 254, 255, 108, 8, + 32, 9, 0, 0, 240, 13, + 0, 0, 236, 14, 0, 0, + 65, 111, 110, 57, 232, 8, + 0, 0, 232, 8, 0, 0, + 0, 2, 254, 255, 120, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -211,14 +211,14 @@ const BYTE DGSLEffect_main1BonesVc[] = 1, 0, 227, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 2, 254, 255, 254, 255, - 114, 1, 68, 66, 85, 71, + 117, 1, 68, 66, 85, 71, 40, 0, 0, 0, 156, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 43, 0, 0, 0, 120, 0, 0, 0, 6, 0, 0, 0, 36, 5, 0, 0, - 208, 1, 0, 0, 67, 58, + 208, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -232,63 +232,63 @@ const BYTE DGSLEffect_main1BonesVc[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 208, 5, + 0, 0, 255, 255, 220, 5, 0, 0, 0, 0, 255, 255, - 232, 5, 0, 0, 0, 0, - 255, 255, 244, 5, 0, 0, - 0, 0, 255, 255, 0, 6, + 244, 5, 0, 0, 0, 0, + 255, 255, 0, 6, 0, 0, + 0, 0, 255, 255, 12, 6, 0, 0, 0, 0, 255, 255, - 12, 6, 0, 0, 0, 0, - 255, 255, 24, 6, 0, 0, - 0, 0, 255, 255, 36, 6, + 24, 6, 0, 0, 0, 0, + 255, 255, 36, 6, 0, 0, + 0, 0, 255, 255, 48, 6, 0, 0, 0, 0, 255, 255, - 48, 6, 0, 0, 112, 0, - 0, 0, 60, 6, 0, 0, - 112, 0, 0, 0, 76, 6, + 60, 6, 0, 0, 112, 0, + 0, 0, 72, 6, 0, 0, + 112, 0, 0, 0, 88, 6, 0, 0, 112, 0, 0, 0, - 88, 6, 0, 0, 117, 0, - 0, 0, 108, 6, 0, 0, - 112, 0, 0, 0, 124, 6, + 100, 6, 0, 0, 117, 0, + 0, 0, 120, 6, 0, 0, + 112, 0, 0, 0, 136, 6, 0, 0, 112, 0, 0, 0, - 144, 6, 0, 0, 117, 0, - 0, 0, 164, 6, 0, 0, - 117, 0, 0, 0, 180, 6, + 156, 6, 0, 0, 117, 0, + 0, 0, 176, 6, 0, 0, + 117, 0, 0, 0, 192, 6, 0, 0, 115, 0, 0, 0, - 196, 6, 0, 0, 116, 0, - 0, 0, 212, 6, 0, 0, - 115, 0, 0, 0, 228, 6, + 208, 6, 0, 0, 116, 0, + 0, 0, 224, 6, 0, 0, + 115, 0, 0, 0, 240, 6, 0, 0, 116, 0, 0, 0, - 244, 6, 0, 0, 115, 0, - 0, 0, 4, 7, 0, 0, - 116, 0, 0, 0, 20, 7, + 0, 7, 0, 0, 115, 0, + 0, 0, 16, 7, 0, 0, + 116, 0, 0, 0, 32, 7, 0, 0, 237, 0, 0, 0, - 36, 7, 0, 0, 240, 0, - 0, 0, 48, 7, 0, 0, - 241, 0, 0, 0, 64, 7, + 48, 7, 0, 0, 240, 0, + 0, 0, 60, 7, 0, 0, + 241, 0, 0, 0, 76, 7, 0, 0, 242, 0, 0, 0, - 80, 7, 0, 0, 242, 0, - 0, 0, 100, 7, 0, 0, - 242, 0, 0, 0, 116, 7, + 92, 7, 0, 0, 242, 0, + 0, 0, 112, 7, 0, 0, + 242, 0, 0, 0, 128, 7, 0, 0, 243, 0, 0, 0, - 132, 7, 0, 0, 243, 0, - 0, 0, 148, 7, 0, 0, - 243, 0, 0, 0, 164, 7, + 144, 7, 0, 0, 243, 0, + 0, 0, 160, 7, 0, 0, + 243, 0, 0, 0, 176, 7, 0, 0, 116, 0, 0, 0, - 180, 7, 0, 0, 237, 0, - 0, 0, 192, 7, 0, 0, - 237, 0, 0, 0, 208, 7, + 192, 7, 0, 0, 237, 0, + 0, 0, 204, 7, 0, 0, + 237, 0, 0, 0, 220, 7, 0, 0, 237, 0, 0, 0, - 224, 7, 0, 0, 245, 0, - 0, 0, 240, 7, 0, 0, - 237, 0, 0, 0, 0, 8, + 236, 7, 0, 0, 245, 0, + 0, 0, 252, 7, 0, 0, + 237, 0, 0, 0, 12, 8, 0, 0, 240, 0, 0, 0, - 12, 8, 0, 0, 240, 0, - 0, 0, 28, 8, 0, 0, - 240, 0, 0, 0, 44, 8, + 24, 8, 0, 0, 240, 0, + 0, 0, 40, 8, 0, 0, + 240, 0, 0, 0, 56, 8, 0, 0, 231, 0, 0, 0, - 60, 8, 0, 0, 231, 0, - 0, 0, 80, 8, 0, 0, - 117, 0, 0, 0, 92, 8, + 72, 8, 0, 0, 231, 0, + 0, 0, 92, 8, 0, 0, + 117, 0, 0, 0, 104, 8, 0, 0, 109, 97, 105, 110, 49, 66, 111, 110, 101, 115, 86, 99, 0, 112, 111, 115, @@ -457,7 +457,9 @@ const BYTE DGSLEffect_main1BonesVc[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 228, 0, 15, 160, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2Bones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2Bones.inc index 5f4e67ef777182572c9b50589a8f801f99ebe058..6b627953cc3af64837f9e08b927ce965774eb945 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2Bones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2Bones.inc @@ -59,7 +59,7 @@ dcl_texcoord4 v4 // vertex<13,14,15,16> dcl_texcoord5 v5 // vertex<17,18,19,20> -#line 97 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 97 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" mul r0.xy, v4, c228.x mova a0.xy, r0.yxzw mul r0, v5.y, c0[a0.x] @@ -187,17 +187,17 @@ ret const BYTE DGSLEffect_main2Bones[] = { - 68, 88, 66, 67, 139, 240, - 154, 192, 91, 144, 240, 213, - 181, 251, 99, 29, 57, 102, - 52, 224, 1, 0, 0, 0, - 92, 16, 0, 0, 4, 0, + 68, 88, 66, 67, 72, 37, + 145, 182, 220, 28, 92, 2, + 19, 74, 174, 145, 89, 96, + 115, 87, 1, 0, 0, 0, + 104, 16, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 60, 9, 0, 0, 144, 14, - 0, 0, 112, 15, 0, 0, - 65, 111, 110, 57, 4, 9, - 0, 0, 4, 9, 0, 0, - 0, 2, 254, 255, 148, 8, + 72, 9, 0, 0, 156, 14, + 0, 0, 124, 15, 0, 0, + 65, 111, 110, 57, 16, 9, + 0, 0, 16, 9, 0, 0, + 0, 2, 254, 255, 160, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -216,14 +216,14 @@ const BYTE DGSLEffect_main2Bones[] = 1, 0, 227, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 2, 254, 255, 254, 255, - 110, 1, 68, 66, 85, 71, + 113, 1, 68, 66, 85, 71, 40, 0, 0, 0, 140, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 45, 0, 0, 0, 120, 0, 0, 0, 6, 0, 0, 0, 20, 5, 0, 0, - 224, 1, 0, 0, 67, 58, + 224, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -237,66 +237,66 @@ const BYTE DGSLEffect_main2Bones[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 192, 5, + 0, 0, 255, 255, 204, 5, 0, 0, 0, 0, 255, 255, - 216, 5, 0, 0, 0, 0, - 255, 255, 228, 5, 0, 0, - 0, 0, 255, 255, 240, 5, + 228, 5, 0, 0, 0, 0, + 255, 255, 240, 5, 0, 0, + 0, 0, 255, 255, 252, 5, 0, 0, 0, 0, 255, 255, - 252, 5, 0, 0, 0, 0, - 255, 255, 8, 6, 0, 0, - 0, 0, 255, 255, 20, 6, + 8, 6, 0, 0, 0, 0, + 255, 255, 20, 6, 0, 0, + 0, 0, 255, 255, 32, 6, 0, 0, 97, 0, 0, 0, - 32, 6, 0, 0, 97, 0, - 0, 0, 48, 6, 0, 0, - 97, 0, 0, 0, 60, 6, + 44, 6, 0, 0, 97, 0, + 0, 0, 60, 6, 0, 0, + 97, 0, 0, 0, 72, 6, 0, 0, 97, 0, 0, 0, - 80, 6, 0, 0, 102, 0, - 0, 0, 104, 6, 0, 0, - 97, 0, 0, 0, 120, 6, + 92, 6, 0, 0, 102, 0, + 0, 0, 116, 6, 0, 0, + 97, 0, 0, 0, 132, 6, 0, 0, 97, 0, 0, 0, - 140, 6, 0, 0, 97, 0, - 0, 0, 160, 6, 0, 0, - 97, 0, 0, 0, 184, 6, + 152, 6, 0, 0, 97, 0, + 0, 0, 172, 6, 0, 0, + 97, 0, 0, 0, 196, 6, 0, 0, 102, 0, 0, 0, - 208, 6, 0, 0, 102, 0, - 0, 0, 224, 6, 0, 0, - 100, 0, 0, 0, 240, 6, + 220, 6, 0, 0, 102, 0, + 0, 0, 236, 6, 0, 0, + 100, 0, 0, 0, 252, 6, 0, 0, 101, 0, 0, 0, - 0, 7, 0, 0, 100, 0, - 0, 0, 16, 7, 0, 0, - 101, 0, 0, 0, 32, 7, + 12, 7, 0, 0, 100, 0, + 0, 0, 28, 7, 0, 0, + 101, 0, 0, 0, 44, 7, 0, 0, 100, 0, 0, 0, - 48, 7, 0, 0, 101, 0, - 0, 0, 64, 7, 0, 0, - 192, 0, 0, 0, 80, 7, + 60, 7, 0, 0, 101, 0, + 0, 0, 76, 7, 0, 0, + 192, 0, 0, 0, 92, 7, 0, 0, 195, 0, 0, 0, - 92, 7, 0, 0, 197, 0, - 0, 0, 108, 7, 0, 0, - 197, 0, 0, 0, 128, 7, + 104, 7, 0, 0, 197, 0, + 0, 0, 120, 7, 0, 0, + 197, 0, 0, 0, 140, 7, 0, 0, 197, 0, 0, 0, - 144, 7, 0, 0, 198, 0, - 0, 0, 160, 7, 0, 0, - 198, 0, 0, 0, 176, 7, + 156, 7, 0, 0, 198, 0, + 0, 0, 172, 7, 0, 0, + 198, 0, 0, 0, 188, 7, 0, 0, 198, 0, 0, 0, - 192, 7, 0, 0, 101, 0, - 0, 0, 208, 7, 0, 0, - 192, 0, 0, 0, 220, 7, + 204, 7, 0, 0, 101, 0, + 0, 0, 220, 7, 0, 0, + 192, 0, 0, 0, 232, 7, 0, 0, 192, 0, 0, 0, - 236, 7, 0, 0, 192, 0, - 0, 0, 252, 7, 0, 0, - 200, 0, 0, 0, 12, 8, + 248, 7, 0, 0, 192, 0, + 0, 0, 8, 8, 0, 0, + 200, 0, 0, 0, 24, 8, 0, 0, 192, 0, 0, 0, - 28, 8, 0, 0, 195, 0, - 0, 0, 40, 8, 0, 0, - 195, 0, 0, 0, 56, 8, + 40, 8, 0, 0, 195, 0, + 0, 0, 52, 8, 0, 0, + 195, 0, 0, 0, 68, 8, 0, 0, 195, 0, 0, 0, - 72, 8, 0, 0, 186, 0, - 0, 0, 88, 8, 0, 0, - 186, 0, 0, 0, 108, 8, + 84, 8, 0, 0, 186, 0, + 0, 0, 100, 8, 0, 0, + 186, 0, 0, 0, 120, 8, 0, 0, 196, 0, 0, 0, - 120, 8, 0, 0, 102, 0, - 0, 0, 132, 8, 0, 0, + 132, 8, 0, 0, 102, 0, + 0, 0, 144, 8, 0, 0, 109, 97, 105, 110, 50, 66, 111, 110, 101, 115, 0, 112, 111, 115, 0, 171, 1, 0, @@ -460,7 +460,9 @@ const BYTE DGSLEffect_main2Bones[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 228, 0, 15, 160, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2BonesVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2BonesVc.inc index 48e32b000d3d89d6542e0bb710576c2d339395f0..f32408f233dfc9c2a606d2c15c0c4efc6e9af035 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2BonesVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main2BonesVc.inc @@ -61,7 +61,7 @@ dcl_texcoord5 v5 // vertex<17,18,19,20> dcl_texcoord6 v6 // vertex<21,22,23,24> -#line 112 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 112 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" mul r0.xy, v5, c228.x mova a0.xy, r0.yxzw mul r0, v6.y, c0[a0.x] @@ -188,17 +188,17 @@ ret const BYTE DGSLEffect_main2BonesVc[] = { - 68, 88, 66, 67, 123, 121, - 55, 167, 3, 144, 97, 7, - 118, 119, 195, 195, 188, 134, - 242, 194, 1, 0, 0, 0, - 196, 16, 0, 0, 4, 0, + 68, 88, 66, 67, 104, 53, + 27, 45, 154, 36, 224, 246, + 235, 73, 156, 185, 196, 186, + 78, 74, 1, 0, 0, 0, + 208, 16, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 116, 9, 0, 0, 220, 14, - 0, 0, 216, 15, 0, 0, - 65, 111, 110, 57, 60, 9, - 0, 0, 60, 9, 0, 0, - 0, 2, 254, 255, 204, 8, + 128, 9, 0, 0, 232, 14, + 0, 0, 228, 15, 0, 0, + 65, 111, 110, 57, 72, 9, + 0, 0, 72, 9, 0, 0, + 0, 2, 254, 255, 216, 8, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -217,14 +217,14 @@ const BYTE DGSLEffect_main2BonesVc[] = 1, 0, 227, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 2, 254, 255, 254, 255, - 120, 1, 68, 66, 85, 71, + 123, 1, 68, 66, 85, 71, 40, 0, 0, 0, 180, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 46, 0, 0, 0, 120, 0, 0, 0, 6, 0, 0, 0, 60, 5, 0, 0, - 232, 1, 0, 0, 67, 58, + 232, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -238,67 +238,67 @@ const BYTE DGSLEffect_main2BonesVc[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 232, 5, + 0, 0, 255, 255, 244, 5, 0, 0, 0, 0, 255, 255, - 0, 6, 0, 0, 0, 0, - 255, 255, 12, 6, 0, 0, - 0, 0, 255, 255, 24, 6, + 12, 6, 0, 0, 0, 0, + 255, 255, 24, 6, 0, 0, + 0, 0, 255, 255, 36, 6, 0, 0, 0, 0, 255, 255, - 36, 6, 0, 0, 0, 0, - 255, 255, 48, 6, 0, 0, - 0, 0, 255, 255, 60, 6, + 48, 6, 0, 0, 0, 0, + 255, 255, 60, 6, 0, 0, + 0, 0, 255, 255, 72, 6, 0, 0, 0, 0, 255, 255, - 72, 6, 0, 0, 112, 0, - 0, 0, 84, 6, 0, 0, - 112, 0, 0, 0, 100, 6, + 84, 6, 0, 0, 112, 0, + 0, 0, 96, 6, 0, 0, + 112, 0, 0, 0, 112, 6, 0, 0, 112, 0, 0, 0, - 112, 6, 0, 0, 112, 0, - 0, 0, 132, 6, 0, 0, - 117, 0, 0, 0, 156, 6, + 124, 6, 0, 0, 112, 0, + 0, 0, 144, 6, 0, 0, + 117, 0, 0, 0, 168, 6, 0, 0, 112, 0, 0, 0, - 172, 6, 0, 0, 112, 0, - 0, 0, 192, 6, 0, 0, - 112, 0, 0, 0, 212, 6, + 184, 6, 0, 0, 112, 0, + 0, 0, 204, 6, 0, 0, + 112, 0, 0, 0, 224, 6, 0, 0, 112, 0, 0, 0, - 236, 6, 0, 0, 117, 0, - 0, 0, 4, 7, 0, 0, - 117, 0, 0, 0, 20, 7, + 248, 6, 0, 0, 117, 0, + 0, 0, 16, 7, 0, 0, + 117, 0, 0, 0, 32, 7, 0, 0, 115, 0, 0, 0, - 36, 7, 0, 0, 116, 0, - 0, 0, 52, 7, 0, 0, - 115, 0, 0, 0, 68, 7, + 48, 7, 0, 0, 116, 0, + 0, 0, 64, 7, 0, 0, + 115, 0, 0, 0, 80, 7, 0, 0, 116, 0, 0, 0, - 84, 7, 0, 0, 115, 0, - 0, 0, 100, 7, 0, 0, - 116, 0, 0, 0, 116, 7, + 96, 7, 0, 0, 115, 0, + 0, 0, 112, 7, 0, 0, + 116, 0, 0, 0, 128, 7, 0, 0, 3, 1, 0, 0, - 132, 7, 0, 0, 6, 1, - 0, 0, 144, 7, 0, 0, - 7, 1, 0, 0, 160, 7, + 144, 7, 0, 0, 6, 1, + 0, 0, 156, 7, 0, 0, + 7, 1, 0, 0, 172, 7, 0, 0, 8, 1, 0, 0, - 176, 7, 0, 0, 8, 1, - 0, 0, 196, 7, 0, 0, - 8, 1, 0, 0, 212, 7, + 188, 7, 0, 0, 8, 1, + 0, 0, 208, 7, 0, 0, + 8, 1, 0, 0, 224, 7, 0, 0, 9, 1, 0, 0, - 228, 7, 0, 0, 9, 1, - 0, 0, 244, 7, 0, 0, - 9, 1, 0, 0, 4, 8, + 240, 7, 0, 0, 9, 1, + 0, 0, 0, 8, 0, 0, + 9, 1, 0, 0, 16, 8, 0, 0, 116, 0, 0, 0, - 20, 8, 0, 0, 3, 1, - 0, 0, 32, 8, 0, 0, - 3, 1, 0, 0, 48, 8, + 32, 8, 0, 0, 3, 1, + 0, 0, 44, 8, 0, 0, + 3, 1, 0, 0, 60, 8, 0, 0, 3, 1, 0, 0, - 64, 8, 0, 0, 11, 1, - 0, 0, 80, 8, 0, 0, - 3, 1, 0, 0, 96, 8, + 76, 8, 0, 0, 11, 1, + 0, 0, 92, 8, 0, 0, + 3, 1, 0, 0, 108, 8, 0, 0, 6, 1, 0, 0, - 108, 8, 0, 0, 6, 1, - 0, 0, 124, 8, 0, 0, - 6, 1, 0, 0, 140, 8, + 120, 8, 0, 0, 6, 1, + 0, 0, 136, 8, 0, 0, + 6, 1, 0, 0, 152, 8, 0, 0, 253, 0, 0, 0, - 156, 8, 0, 0, 253, 0, - 0, 0, 176, 8, 0, 0, - 117, 0, 0, 0, 188, 8, + 168, 8, 0, 0, 253, 0, + 0, 0, 188, 8, 0, 0, + 117, 0, 0, 0, 200, 8, 0, 0, 109, 97, 105, 110, 50, 66, 111, 110, 101, 115, 86, 99, 0, 112, 111, 115, @@ -467,7 +467,9 @@ const BYTE DGSLEffect_main2BonesVc[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 228, 0, 15, 160, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4Bones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4Bones.inc index eeb8a888cede3602bc93a993e5c82e76a344e19d..f3ddf494bc8afa75308b501d856486e585ee4ba4 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4Bones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4Bones.inc @@ -59,7 +59,7 @@ dcl_texcoord4 v4 // vertex<13,14,15,16> dcl_texcoord5 v5 // vertex<17,18,19,20> -#line 97 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 97 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" mul r0, v4, c228.x mova a0, r0.yxzw mul r1, v5.y, c0[a0.x] @@ -199,17 +199,17 @@ ret const BYTE DGSLEffect_main4Bones[] = { - 68, 88, 66, 67, 45, 137, - 208, 23, 220, 71, 47, 74, - 63, 1, 119, 83, 15, 78, - 96, 247, 1, 0, 0, 0, - 124, 18, 0, 0, 4, 0, + 68, 88, 66, 67, 234, 113, + 27, 144, 43, 126, 67, 181, + 199, 109, 119, 34, 125, 74, + 133, 160, 1, 0, 0, 0, + 136, 18, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 68, 10, 0, 0, 176, 16, - 0, 0, 144, 17, 0, 0, - 65, 111, 110, 57, 12, 10, - 0, 0, 12, 10, 0, 0, - 0, 2, 254, 255, 156, 9, + 80, 10, 0, 0, 188, 16, + 0, 0, 156, 17, 0, 0, + 65, 111, 110, 57, 24, 10, + 0, 0, 24, 10, 0, 0, + 0, 2, 254, 255, 168, 9, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -228,14 +228,14 @@ const BYTE DGSLEffect_main4Bones[] = 1, 0, 227, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 2, 254, 255, 254, 255, - 140, 1, 68, 66, 85, 71, + 143, 1, 68, 66, 85, 71, 40, 0, 0, 0, 4, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 51, 0, 0, 0, 120, 0, 0, 0, 6, 0, 0, 0, 140, 5, 0, 0, - 16, 2, 0, 0, 67, 58, + 16, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -249,74 +249,74 @@ const BYTE DGSLEffect_main4Bones[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 56, 6, + 0, 0, 255, 255, 68, 6, 0, 0, 0, 0, 255, 255, - 80, 6, 0, 0, 0, 0, - 255, 255, 92, 6, 0, 0, - 0, 0, 255, 255, 104, 6, + 92, 6, 0, 0, 0, 0, + 255, 255, 104, 6, 0, 0, + 0, 0, 255, 255, 116, 6, 0, 0, 0, 0, 255, 255, - 116, 6, 0, 0, 0, 0, - 255, 255, 128, 6, 0, 0, - 0, 0, 255, 255, 140, 6, + 128, 6, 0, 0, 0, 0, + 255, 255, 140, 6, 0, 0, + 0, 0, 255, 255, 152, 6, 0, 0, 97, 0, 0, 0, - 152, 6, 0, 0, 97, 0, - 0, 0, 168, 6, 0, 0, - 97, 0, 0, 0, 180, 6, + 164, 6, 0, 0, 97, 0, + 0, 0, 180, 6, 0, 0, + 97, 0, 0, 0, 192, 6, 0, 0, 97, 0, 0, 0, - 200, 6, 0, 0, 97, 0, - 0, 0, 224, 6, 0, 0, - 97, 0, 0, 0, 248, 6, + 212, 6, 0, 0, 97, 0, + 0, 0, 236, 6, 0, 0, + 97, 0, 0, 0, 4, 7, 0, 0, 102, 0, 0, 0, - 16, 7, 0, 0, 97, 0, - 0, 0, 32, 7, 0, 0, - 97, 0, 0, 0, 52, 7, + 28, 7, 0, 0, 97, 0, + 0, 0, 44, 7, 0, 0, + 97, 0, 0, 0, 64, 7, 0, 0, 97, 0, 0, 0, - 72, 7, 0, 0, 97, 0, - 0, 0, 96, 7, 0, 0, - 97, 0, 0, 0, 120, 7, + 84, 7, 0, 0, 97, 0, + 0, 0, 108, 7, 0, 0, + 97, 0, 0, 0, 132, 7, 0, 0, 97, 0, 0, 0, - 144, 7, 0, 0, 97, 0, - 0, 0, 168, 7, 0, 0, - 97, 0, 0, 0, 192, 7, + 156, 7, 0, 0, 97, 0, + 0, 0, 180, 7, 0, 0, + 97, 0, 0, 0, 204, 7, 0, 0, 102, 0, 0, 0, - 216, 7, 0, 0, 102, 0, - 0, 0, 232, 7, 0, 0, - 100, 0, 0, 0, 248, 7, + 228, 7, 0, 0, 102, 0, + 0, 0, 244, 7, 0, 0, + 100, 0, 0, 0, 4, 8, 0, 0, 101, 0, 0, 0, - 8, 8, 0, 0, 100, 0, - 0, 0, 24, 8, 0, 0, - 101, 0, 0, 0, 40, 8, + 20, 8, 0, 0, 100, 0, + 0, 0, 36, 8, 0, 0, + 101, 0, 0, 0, 52, 8, 0, 0, 100, 0, 0, 0, - 56, 8, 0, 0, 101, 0, - 0, 0, 72, 8, 0, 0, - 214, 0, 0, 0, 88, 8, + 68, 8, 0, 0, 101, 0, + 0, 0, 84, 8, 0, 0, + 214, 0, 0, 0, 100, 8, 0, 0, 217, 0, 0, 0, - 100, 8, 0, 0, 219, 0, - 0, 0, 116, 8, 0, 0, - 219, 0, 0, 0, 136, 8, + 112, 8, 0, 0, 219, 0, + 0, 0, 128, 8, 0, 0, + 219, 0, 0, 0, 148, 8, 0, 0, 219, 0, 0, 0, - 152, 8, 0, 0, 220, 0, - 0, 0, 168, 8, 0, 0, - 220, 0, 0, 0, 184, 8, + 164, 8, 0, 0, 220, 0, + 0, 0, 180, 8, 0, 0, + 220, 0, 0, 0, 196, 8, 0, 0, 220, 0, 0, 0, - 200, 8, 0, 0, 101, 0, - 0, 0, 216, 8, 0, 0, - 214, 0, 0, 0, 228, 8, + 212, 8, 0, 0, 101, 0, + 0, 0, 228, 8, 0, 0, + 214, 0, 0, 0, 240, 8, 0, 0, 214, 0, 0, 0, - 244, 8, 0, 0, 214, 0, - 0, 0, 4, 9, 0, 0, - 222, 0, 0, 0, 20, 9, + 0, 9, 0, 0, 214, 0, + 0, 0, 16, 9, 0, 0, + 222, 0, 0, 0, 32, 9, 0, 0, 214, 0, 0, 0, - 36, 9, 0, 0, 217, 0, - 0, 0, 48, 9, 0, 0, - 217, 0, 0, 0, 64, 9, + 48, 9, 0, 0, 217, 0, + 0, 0, 60, 9, 0, 0, + 217, 0, 0, 0, 76, 9, 0, 0, 217, 0, 0, 0, - 80, 9, 0, 0, 208, 0, - 0, 0, 96, 9, 0, 0, - 208, 0, 0, 0, 116, 9, + 92, 9, 0, 0, 208, 0, + 0, 0, 108, 9, 0, 0, + 208, 0, 0, 0, 128, 9, 0, 0, 218, 0, 0, 0, - 128, 9, 0, 0, 102, 0, - 0, 0, 140, 9, 0, 0, + 140, 9, 0, 0, 102, 0, + 0, 0, 152, 9, 0, 0, 109, 97, 105, 110, 52, 66, 111, 110, 101, 115, 0, 112, 111, 115, 0, 171, 1, 0, @@ -492,7 +492,9 @@ const BYTE DGSLEffect_main4Bones[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 228, 0, 15, 160, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4BonesVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4BonesVc.inc index 0535026233af25606125e76af4a4ea1ee1a93eb6..74b997f705572ca16faa89c0875dc88c9b704fe2 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4BonesVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_main4BonesVc.inc @@ -61,7 +61,7 @@ dcl_texcoord5 v5 // vertex<17,18,19,20> dcl_texcoord6 v6 // vertex<21,22,23,24> -#line 112 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 112 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" mul r0, v5, c228.x mova a0, r0.yxzw mul r1, v6.y, c0[a0.x] @@ -200,17 +200,17 @@ ret const BYTE DGSLEffect_main4BonesVc[] = { - 68, 88, 66, 67, 178, 12, - 145, 116, 251, 101, 57, 238, - 157, 61, 44, 74, 40, 241, - 240, 56, 1, 0, 0, 0, - 228, 18, 0, 0, 4, 0, + 68, 88, 66, 67, 13, 121, + 181, 229, 128, 1, 144, 68, + 23, 22, 103, 175, 254, 219, + 139, 119, 1, 0, 0, 0, + 240, 18, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 124, 10, 0, 0, 252, 16, - 0, 0, 248, 17, 0, 0, - 65, 111, 110, 57, 68, 10, - 0, 0, 68, 10, 0, 0, - 0, 2, 254, 255, 212, 9, + 136, 10, 0, 0, 8, 17, + 0, 0, 4, 18, 0, 0, + 65, 111, 110, 57, 80, 10, + 0, 0, 80, 10, 0, 0, + 0, 2, 254, 255, 224, 9, 0, 0, 112, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -229,14 +229,14 @@ const BYTE DGSLEffect_main4BonesVc[] = 1, 0, 227, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 2, 254, 255, 254, 255, - 150, 1, 68, 66, 85, 71, + 153, 1, 68, 66, 85, 71, 40, 0, 0, 0, 44, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 52, 0, 0, 0, 120, 0, 0, 0, 6, 0, 0, 0, 180, 5, 0, 0, - 24, 2, 0, 0, 67, 58, + 24, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -250,75 +250,75 @@ const BYTE DGSLEffect_main4BonesVc[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 96, 6, + 0, 0, 255, 255, 108, 6, 0, 0, 0, 0, 255, 255, - 120, 6, 0, 0, 0, 0, - 255, 255, 132, 6, 0, 0, - 0, 0, 255, 255, 144, 6, + 132, 6, 0, 0, 0, 0, + 255, 255, 144, 6, 0, 0, + 0, 0, 255, 255, 156, 6, 0, 0, 0, 0, 255, 255, - 156, 6, 0, 0, 0, 0, - 255, 255, 168, 6, 0, 0, - 0, 0, 255, 255, 180, 6, + 168, 6, 0, 0, 0, 0, + 255, 255, 180, 6, 0, 0, + 0, 0, 255, 255, 192, 6, 0, 0, 0, 0, 255, 255, - 192, 6, 0, 0, 112, 0, - 0, 0, 204, 6, 0, 0, - 112, 0, 0, 0, 220, 6, + 204, 6, 0, 0, 112, 0, + 0, 0, 216, 6, 0, 0, + 112, 0, 0, 0, 232, 6, 0, 0, 112, 0, 0, 0, - 232, 6, 0, 0, 112, 0, - 0, 0, 252, 6, 0, 0, - 112, 0, 0, 0, 20, 7, + 244, 6, 0, 0, 112, 0, + 0, 0, 8, 7, 0, 0, + 112, 0, 0, 0, 32, 7, 0, 0, 112, 0, 0, 0, - 44, 7, 0, 0, 117, 0, - 0, 0, 68, 7, 0, 0, - 112, 0, 0, 0, 84, 7, + 56, 7, 0, 0, 117, 0, + 0, 0, 80, 7, 0, 0, + 112, 0, 0, 0, 96, 7, 0, 0, 112, 0, 0, 0, - 104, 7, 0, 0, 112, 0, - 0, 0, 124, 7, 0, 0, - 112, 0, 0, 0, 148, 7, + 116, 7, 0, 0, 112, 0, + 0, 0, 136, 7, 0, 0, + 112, 0, 0, 0, 160, 7, 0, 0, 112, 0, 0, 0, - 172, 7, 0, 0, 112, 0, - 0, 0, 196, 7, 0, 0, - 112, 0, 0, 0, 220, 7, + 184, 7, 0, 0, 112, 0, + 0, 0, 208, 7, 0, 0, + 112, 0, 0, 0, 232, 7, 0, 0, 112, 0, 0, 0, - 244, 7, 0, 0, 117, 0, - 0, 0, 12, 8, 0, 0, - 117, 0, 0, 0, 28, 8, + 0, 8, 0, 0, 117, 0, + 0, 0, 24, 8, 0, 0, + 117, 0, 0, 0, 40, 8, 0, 0, 115, 0, 0, 0, - 44, 8, 0, 0, 116, 0, - 0, 0, 60, 8, 0, 0, - 115, 0, 0, 0, 76, 8, + 56, 8, 0, 0, 116, 0, + 0, 0, 72, 8, 0, 0, + 115, 0, 0, 0, 88, 8, 0, 0, 116, 0, 0, 0, - 92, 8, 0, 0, 115, 0, - 0, 0, 108, 8, 0, 0, - 116, 0, 0, 0, 124, 8, + 104, 8, 0, 0, 115, 0, + 0, 0, 120, 8, 0, 0, + 116, 0, 0, 0, 136, 8, 0, 0, 25, 1, 0, 0, - 140, 8, 0, 0, 28, 1, - 0, 0, 152, 8, 0, 0, - 29, 1, 0, 0, 168, 8, + 152, 8, 0, 0, 28, 1, + 0, 0, 164, 8, 0, 0, + 29, 1, 0, 0, 180, 8, 0, 0, 30, 1, 0, 0, - 184, 8, 0, 0, 30, 1, - 0, 0, 204, 8, 0, 0, - 30, 1, 0, 0, 220, 8, + 196, 8, 0, 0, 30, 1, + 0, 0, 216, 8, 0, 0, + 30, 1, 0, 0, 232, 8, 0, 0, 31, 1, 0, 0, - 236, 8, 0, 0, 31, 1, - 0, 0, 252, 8, 0, 0, - 31, 1, 0, 0, 12, 9, + 248, 8, 0, 0, 31, 1, + 0, 0, 8, 9, 0, 0, + 31, 1, 0, 0, 24, 9, 0, 0, 116, 0, 0, 0, - 28, 9, 0, 0, 25, 1, - 0, 0, 40, 9, 0, 0, - 25, 1, 0, 0, 56, 9, + 40, 9, 0, 0, 25, 1, + 0, 0, 52, 9, 0, 0, + 25, 1, 0, 0, 68, 9, 0, 0, 25, 1, 0, 0, - 72, 9, 0, 0, 33, 1, - 0, 0, 88, 9, 0, 0, - 25, 1, 0, 0, 104, 9, + 84, 9, 0, 0, 33, 1, + 0, 0, 100, 9, 0, 0, + 25, 1, 0, 0, 116, 9, 0, 0, 28, 1, 0, 0, - 116, 9, 0, 0, 28, 1, - 0, 0, 132, 9, 0, 0, - 28, 1, 0, 0, 148, 9, + 128, 9, 0, 0, 28, 1, + 0, 0, 144, 9, 0, 0, + 28, 1, 0, 0, 160, 9, 0, 0, 19, 1, 0, 0, - 164, 9, 0, 0, 19, 1, - 0, 0, 184, 9, 0, 0, - 117, 0, 0, 0, 196, 9, + 176, 9, 0, 0, 19, 1, + 0, 0, 196, 9, 0, 0, + 117, 0, 0, 0, 208, 9, 0, 0, 109, 97, 105, 110, 52, 66, 111, 110, 101, 115, 86, 99, 0, 112, 111, 115, @@ -499,7 +499,9 @@ const BYTE DGSLEffect_main4BonesVc[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 228, 0, 15, 160, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_mainVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_mainVc.inc index 1a21adfffcfe0c46507232303299c15a44ab87c2..9b088f7939258fea99e302d8b29abd9762c9737e 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_mainVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLEffect_mainVc.inc @@ -56,7 +56,7 @@ dcl_texcoord3 v3 // vertex<11,12,13,14> dcl_texcoord4 v4 // vertex<15,16> -#line 150 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" +#line 150 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLEffect.fx" dp4 oPos.z, v0, c7 // ::mainVc<2> mul oT0, v3, c1 // ::mainVc<4,5,6,7> mad r0.xyz, v4.xyxw, c12.xxyw, c12.yyxw @@ -133,17 +133,17 @@ ret const BYTE DGSLEffect_mainVc[] = { - 68, 88, 66, 67, 72, 67, - 248, 97, 31, 192, 50, 24, - 77, 242, 183, 202, 121, 19, - 101, 76, 1, 0, 0, 0, - 228, 10, 0, 0, 4, 0, + 68, 88, 66, 67, 120, 140, + 189, 222, 124, 120, 113, 219, + 87, 175, 95, 199, 3, 41, + 251, 116, 1, 0, 0, 0, + 240, 10, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 64, 6, 0, 0, 68, 9, - 0, 0, 248, 9, 0, 0, - 65, 111, 110, 57, 8, 6, - 0, 0, 8, 6, 0, 0, - 0, 2, 254, 255, 164, 5, + 76, 6, 0, 0, 80, 9, + 0, 0, 4, 10, 0, 0, + 65, 111, 110, 57, 20, 6, + 0, 0, 20, 6, 0, 0, + 0, 2, 254, 255, 176, 5, 0, 0, 100, 0, 0, 0, 5, 0, 36, 0, 0, 0, 96, 0, 0, 0, 96, 0, @@ -160,14 +160,14 @@ const BYTE DGSLEffect_mainVc[] = 1, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 3, 1, 68, 66, 85, 71, + 6, 1, 68, 66, 85, 71, 40, 0, 0, 0, 224, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 26, 0, 0, 0, 120, 0, 0, 0, 4, 0, 0, 0, 144, 3, 0, 0, - 72, 1, 0, 0, 67, 58, + 72, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -181,41 +181,41 @@ const BYTE DGSLEffect_mainVc[] = 83, 76, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 20, 4, + 0, 0, 255, 255, 32, 4, 0, 0, 0, 0, 255, 255, - 44, 4, 0, 0, 0, 0, - 255, 255, 56, 4, 0, 0, - 0, 0, 255, 255, 68, 4, + 56, 4, 0, 0, 0, 0, + 255, 255, 68, 4, 0, 0, + 0, 0, 255, 255, 80, 4, 0, 0, 0, 0, 255, 255, - 80, 4, 0, 0, 0, 0, - 255, 255, 92, 4, 0, 0, - 150, 0, 0, 0, 104, 4, + 92, 4, 0, 0, 0, 0, + 255, 255, 104, 4, 0, 0, + 150, 0, 0, 0, 116, 4, 0, 0, 151, 0, 0, 0, - 120, 4, 0, 0, 152, 0, - 0, 0, 136, 4, 0, 0, - 152, 0, 0, 0, 156, 4, + 132, 4, 0, 0, 152, 0, + 0, 0, 148, 4, 0, 0, + 152, 0, 0, 0, 168, 4, 0, 0, 152, 0, 0, 0, - 172, 4, 0, 0, 153, 0, - 0, 0, 188, 4, 0, 0, - 153, 0, 0, 0, 204, 4, + 184, 4, 0, 0, 153, 0, + 0, 0, 200, 4, 0, 0, + 153, 0, 0, 0, 216, 4, 0, 0, 153, 0, 0, 0, - 220, 4, 0, 0, 147, 0, - 0, 0, 236, 4, 0, 0, - 147, 0, 0, 0, 252, 4, + 232, 4, 0, 0, 147, 0, + 0, 0, 248, 4, 0, 0, + 147, 0, 0, 0, 8, 5, 0, 0, 147, 0, 0, 0, - 12, 5, 0, 0, 155, 0, - 0, 0, 28, 5, 0, 0, - 147, 0, 0, 0, 44, 5, + 24, 5, 0, 0, 155, 0, + 0, 0, 40, 5, 0, 0, + 147, 0, 0, 0, 56, 5, 0, 0, 150, 0, 0, 0, - 56, 5, 0, 0, 150, 0, - 0, 0, 72, 5, 0, 0, - 150, 0, 0, 0, 88, 5, + 68, 5, 0, 0, 150, 0, + 0, 0, 84, 5, 0, 0, + 150, 0, 0, 0, 100, 5, 0, 0, 143, 0, 0, 0, - 104, 5, 0, 0, 143, 0, - 0, 0, 124, 5, 0, 0, - 156, 0, 0, 0, 136, 5, + 116, 5, 0, 0, 143, 0, + 0, 0, 136, 5, 0, 0, + 156, 0, 0, 0, 148, 5, 0, 0, 157, 0, 0, 0, - 148, 5, 0, 0, 109, 97, + 160, 5, 0, 0, 109, 97, 105, 110, 86, 99, 0, 112, 111, 115, 0, 171, 1, 0, 3, 0, 1, 0, 4, 0, @@ -332,7 +332,9 @@ const BYTE DGSLEffect_mainVc[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 12, 0, 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_main.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_main.inc index e58b919df749ee8fa353e8ccea1c39d98ae4ca40..ea5c78540c6a93fa125510c6dcf9e7d25938990a 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_main.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_main.inc @@ -39,7 +39,7 @@ dcl t0 // pixel<4,5,6,7> dcl t2.xyz // pixel<10,11,12> -#line 99 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" +#line 99 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" nrm r0.xyz, t2 // ::worldNormal<0,1,2> #line 82 @@ -103,17 +103,17 @@ ret const BYTE DGSLLambert_main[] = { - 68, 88, 66, 67, 217, 104, - 24, 135, 161, 120, 240, 98, - 49, 130, 137, 15, 118, 241, - 187, 148, 1, 0, 0, 0, - 8, 9, 0, 0, 4, 0, + 68, 88, 66, 67, 37, 195, + 100, 143, 92, 130, 141, 2, + 35, 106, 227, 226, 67, 105, + 139, 53, 1, 0, 0, 0, + 20, 9, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 116, 5, 0, 0, 232, 7, - 0, 0, 212, 8, 0, 0, - 65, 111, 110, 57, 60, 5, - 0, 0, 60, 5, 0, 0, - 0, 2, 255, 255, 244, 4, + 128, 5, 0, 0, 244, 7, + 0, 0, 224, 8, 0, 0, + 65, 111, 110, 57, 72, 5, + 0, 0, 72, 5, 0, 0, + 0, 2, 255, 255, 0, 5, 0, 0, 72, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -125,7 +125,7 @@ const BYTE DGSLLambert_main[] = 0, 0, 1, 0, 9, 0, 4, 0, 6, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 240, 0, 68, 66, + 254, 255, 243, 0, 68, 66, 85, 71, 40, 0, 0, 0, 148, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -133,7 +133,7 @@ const BYTE DGSLLambert_main[] = 0, 0, 124, 0, 0, 0, 7, 0, 0, 0, 8, 3, 0, 0, 252, 1, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -147,31 +147,31 @@ const BYTE DGSLLambert_main[] = 109, 98, 101, 114, 116, 46, 104, 108, 115, 108, 0, 171, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 200, 3, + 0, 0, 255, 255, 212, 3, 0, 0, 0, 0, 255, 255, - 212, 3, 0, 0, 99, 0, - 0, 0, 224, 3, 0, 0, - 82, 0, 0, 0, 236, 3, + 224, 3, 0, 0, 99, 0, + 0, 0, 236, 3, 0, 0, + 82, 0, 0, 0, 248, 3, 0, 0, 83, 0, 0, 0, - 252, 3, 0, 0, 83, 0, - 0, 0, 12, 4, 0, 0, - 105, 0, 0, 0, 28, 4, + 8, 4, 0, 0, 83, 0, + 0, 0, 24, 4, 0, 0, + 105, 0, 0, 0, 40, 4, 0, 0, 105, 0, 0, 0, - 40, 4, 0, 0, 82, 0, - 0, 0, 60, 4, 0, 0, - 83, 0, 0, 0, 76, 4, + 52, 4, 0, 0, 82, 0, + 0, 0, 72, 4, 0, 0, + 83, 0, 0, 0, 88, 4, 0, 0, 105, 0, 0, 0, - 92, 4, 0, 0, 82, 0, - 0, 0, 112, 4, 0, 0, - 82, 0, 0, 0, 128, 4, + 104, 4, 0, 0, 82, 0, + 0, 0, 124, 4, 0, 0, + 82, 0, 0, 0, 140, 4, 0, 0, 83, 0, 0, 0, - 144, 4, 0, 0, 83, 0, - 0, 0, 160, 4, 0, 0, - 105, 0, 0, 0, 176, 4, + 156, 4, 0, 0, 83, 0, + 0, 0, 172, 4, 0, 0, + 105, 0, 0, 0, 188, 4, 0, 0, 105, 0, 0, 0, - 196, 4, 0, 0, 108, 0, - 0, 0, 216, 4, 0, 0, - 108, 0, 0, 0, 228, 4, + 208, 4, 0, 0, 108, 0, + 0, 0, 228, 4, 0, 0, + 108, 0, 0, 0, 240, 4, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, @@ -285,7 +285,9 @@ const BYTE DGSLLambert_main[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTk.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTk.inc index 0600eb94b51ad5e5f6c0e57eedbbb000227372cb..b95522ff4e2fd5bead8aca6267d9076b1c80f25a 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTk.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTk.inc @@ -40,7 +40,7 @@ dcl t0 // pixel<4,5,6,7> dcl t2.xyz // pixel<10,11,12> -#line 130 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" +#line 130 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" mul r0.w, t0.w, t0.w cmp r0, -r0.w, c10.x, c10.y texkill r0 @@ -115,17 +115,17 @@ ret const BYTE DGSLLambert_mainTk[] = { - 68, 88, 66, 67, 49, 185, - 15, 251, 73, 181, 30, 50, - 96, 92, 73, 219, 218, 231, - 168, 206, 1, 0, 0, 0, - 148, 9, 0, 0, 4, 0, + 68, 88, 66, 67, 134, 210, + 1, 93, 103, 30, 65, 51, + 37, 231, 17, 162, 11, 219, + 81, 130, 1, 0, 0, 0, + 160, 9, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 216, 5, 0, 0, 116, 8, - 0, 0, 96, 9, 0, 0, - 65, 111, 110, 57, 160, 5, - 0, 0, 160, 5, 0, 0, - 0, 2, 255, 255, 88, 5, + 228, 5, 0, 0, 128, 8, + 0, 0, 108, 9, 0, 0, + 65, 111, 110, 57, 172, 5, + 0, 0, 172, 5, 0, 0, + 0, 2, 255, 255, 100, 5, 0, 0, 72, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -137,7 +137,7 @@ const BYTE DGSLLambert_mainTk[] = 0, 0, 1, 0, 9, 0, 4, 0, 6, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 248, 0, 68, 66, + 254, 255, 251, 0, 68, 66, 85, 71, 40, 0, 0, 0, 180, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -145,7 +145,7 @@ const BYTE DGSLLambert_mainTk[] = 0, 0, 124, 0, 0, 0, 7, 0, 0, 0, 40, 3, 0, 0, 28, 2, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -159,37 +159,37 @@ const BYTE DGSLLambert_mainTk[] = 109, 98, 101, 114, 116, 46, 104, 108, 115, 108, 0, 171, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 232, 3, + 0, 0, 255, 255, 244, 3, 0, 0, 0, 0, 255, 255, - 0, 4, 0, 0, 0, 0, - 255, 255, 12, 4, 0, 0, - 130, 0, 0, 0, 24, 4, + 12, 4, 0, 0, 0, 0, + 255, 255, 24, 4, 0, 0, + 130, 0, 0, 0, 36, 4, 0, 0, 130, 0, 0, 0, - 40, 4, 0, 0, 130, 0, - 0, 0, 60, 4, 0, 0, - 118, 0, 0, 0, 68, 4, + 52, 4, 0, 0, 130, 0, + 0, 0, 72, 4, 0, 0, + 118, 0, 0, 0, 80, 4, 0, 0, 82, 0, 0, 0, - 80, 4, 0, 0, 83, 0, - 0, 0, 96, 4, 0, 0, - 83, 0, 0, 0, 112, 4, + 92, 4, 0, 0, 83, 0, + 0, 0, 108, 4, 0, 0, + 83, 0, 0, 0, 124, 4, 0, 0, 124, 0, 0, 0, - 128, 4, 0, 0, 124, 0, - 0, 0, 140, 4, 0, 0, - 82, 0, 0, 0, 160, 4, + 140, 4, 0, 0, 124, 0, + 0, 0, 152, 4, 0, 0, + 82, 0, 0, 0, 172, 4, 0, 0, 83, 0, 0, 0, - 176, 4, 0, 0, 124, 0, - 0, 0, 192, 4, 0, 0, - 82, 0, 0, 0, 212, 4, + 188, 4, 0, 0, 124, 0, + 0, 0, 204, 4, 0, 0, + 82, 0, 0, 0, 224, 4, 0, 0, 83, 0, 0, 0, - 228, 4, 0, 0, 124, 0, - 0, 0, 244, 4, 0, 0, - 82, 0, 0, 0, 8, 5, + 240, 4, 0, 0, 124, 0, + 0, 0, 0, 5, 0, 0, + 82, 0, 0, 0, 20, 5, 0, 0, 83, 0, 0, 0, - 24, 5, 0, 0, 124, 0, - 0, 0, 40, 5, 0, 0, - 132, 0, 0, 0, 60, 5, + 36, 5, 0, 0, 124, 0, + 0, 0, 52, 5, 0, 0, + 132, 0, 0, 0, 72, 5, 0, 0, 132, 0, 0, 0, - 72, 5, 0, 0, 77, 97, + 84, 5, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, 101, 114, 105, 97, @@ -302,7 +302,9 @@ const BYTE DGSLLambert_mainTk[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 10, 0, 15, 160, 0, 0, 128, 191, 0, 0, 0, 128, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTx.inc index 34ef87c6ebed370104cc6e2437b9ec5d3050c0f9..9ca6579624ed28ce04825153c7af86292b1c094b 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTx.inc @@ -48,7 +48,7 @@ dcl t2.xyz // pixel<10,11,12> dcl_2d s0 -#line 149 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" +#line 149 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" texld r0, t1, s0 #line 139 @@ -121,17 +121,17 @@ ret const BYTE DGSLLambert_mainTx[] = { - 68, 88, 66, 67, 2, 83, - 250, 55, 168, 31, 166, 40, - 181, 24, 99, 4, 43, 67, - 37, 218, 1, 0, 0, 0, - 52, 10, 0, 0, 4, 0, + 68, 88, 66, 67, 220, 108, + 222, 37, 85, 168, 128, 185, + 161, 109, 49, 214, 180, 70, + 18, 191, 1, 0, 0, 0, + 64, 10, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 48, 6, 0, 0, 20, 9, - 0, 0, 0, 10, 0, 0, - 65, 111, 110, 57, 248, 5, - 0, 0, 248, 5, 0, 0, - 0, 2, 255, 255, 172, 5, + 60, 6, 0, 0, 32, 9, + 0, 0, 12, 10, 0, 0, + 65, 111, 110, 57, 4, 6, + 0, 0, 4, 6, 0, 0, + 0, 2, 255, 255, 184, 5, 0, 0, 76, 0, 0, 0, 3, 0, 40, 0, 0, 0, 76, 0, 0, 0, 76, 0, @@ -144,14 +144,14 @@ const BYTE DGSLLambert_mainTx[] = 1, 0, 9, 0, 4, 0, 6, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 15, 1, 68, 66, 85, 71, + 18, 1, 68, 66, 85, 71, 40, 0, 0, 0, 16, 4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0, 0, 23, 0, 0, 0, 124, 0, 0, 0, 9, 0, 0, 0, 92, 3, 0, 0, - 68, 2, 0, 0, 67, 58, + 68, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -166,36 +166,36 @@ const BYTE DGSLLambert_mainTx[] = 101, 114, 116, 46, 104, 108, 115, 108, 0, 171, 171, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 68, 4, 0, 0, - 0, 0, 255, 255, 80, 4, + 255, 255, 80, 4, 0, 0, + 0, 0, 255, 255, 92, 4, 0, 0, 0, 0, 255, 255, - 92, 4, 0, 0, 0, 0, - 255, 255, 104, 4, 0, 0, - 149, 0, 0, 0, 116, 4, + 104, 4, 0, 0, 0, 0, + 255, 255, 116, 4, 0, 0, + 149, 0, 0, 0, 128, 4, 0, 0, 139, 0, 0, 0, - 132, 4, 0, 0, 82, 0, - 0, 0, 144, 4, 0, 0, - 83, 0, 0, 0, 160, 4, + 144, 4, 0, 0, 82, 0, + 0, 0, 156, 4, 0, 0, + 83, 0, 0, 0, 172, 4, 0, 0, 83, 0, 0, 0, - 176, 4, 0, 0, 145, 0, - 0, 0, 192, 4, 0, 0, - 145, 0, 0, 0, 204, 4, + 188, 4, 0, 0, 145, 0, + 0, 0, 204, 4, 0, 0, + 145, 0, 0, 0, 216, 4, 0, 0, 82, 0, 0, 0, - 224, 4, 0, 0, 83, 0, - 0, 0, 240, 4, 0, 0, - 145, 0, 0, 0, 0, 5, + 236, 4, 0, 0, 83, 0, + 0, 0, 252, 4, 0, 0, + 145, 0, 0, 0, 12, 5, 0, 0, 82, 0, 0, 0, - 20, 5, 0, 0, 82, 0, - 0, 0, 36, 5, 0, 0, - 83, 0, 0, 0, 52, 5, + 32, 5, 0, 0, 82, 0, + 0, 0, 48, 5, 0, 0, + 83, 0, 0, 0, 64, 5, 0, 0, 83, 0, 0, 0, - 68, 5, 0, 0, 145, 0, - 0, 0, 84, 5, 0, 0, - 145, 0, 0, 0, 104, 5, + 80, 5, 0, 0, 145, 0, + 0, 0, 96, 5, 0, 0, + 145, 0, 0, 0, 116, 5, 0, 0, 149, 0, 0, 0, - 124, 5, 0, 0, 150, 0, - 0, 0, 140, 5, 0, 0, - 149, 0, 0, 0, 156, 5, + 136, 5, 0, 0, 150, 0, + 0, 0, 152, 5, 0, 0, + 149, 0, 0, 0, 168, 5, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, @@ -324,7 +324,9 @@ const BYTE DGSLLambert_mainTx[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTxTk.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTxTk.inc index ed82216ea42de3af6f51ec6f409ef1c8e9de9a84..be5548440eb25b7667dc50fc963251b0a19c82c5 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTxTk.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLLambert_mainTxTk.inc @@ -49,7 +49,7 @@ dcl t2.xyz // pixel<10,11,12> dcl_2d s0 -#line 170 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" +#line 170 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLLambert.hlsl" texld r0, t1, s0 mul r1.w, r0.w, t0.w // ::local5<0> @@ -136,17 +136,17 @@ ret const BYTE DGSLLambert_mainTxTk[] = { - 68, 88, 66, 67, 128, 125, - 248, 122, 94, 37, 149, 31, - 121, 205, 195, 201, 166, 72, - 161, 102, 1, 0, 0, 0, - 216, 10, 0, 0, 4, 0, + 68, 88, 66, 67, 176, 76, + 120, 115, 250, 116, 224, 21, + 189, 0, 217, 169, 115, 235, + 53, 1, 1, 0, 0, 0, + 228, 10, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 152, 6, 0, 0, 184, 9, - 0, 0, 164, 10, 0, 0, - 65, 111, 110, 57, 96, 6, - 0, 0, 96, 6, 0, 0, - 0, 2, 255, 255, 20, 6, + 164, 6, 0, 0, 196, 9, + 0, 0, 176, 10, 0, 0, + 65, 111, 110, 57, 108, 6, + 0, 0, 108, 6, 0, 0, + 0, 2, 255, 255, 32, 6, 0, 0, 76, 0, 0, 0, 3, 0, 40, 0, 0, 0, 76, 0, 0, 0, 76, 0, @@ -159,14 +159,14 @@ const BYTE DGSLLambert_mainTxTk[] = 1, 0, 9, 0, 4, 0, 6, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 24, 1, 68, 66, 85, 71, + 27, 1, 68, 66, 85, 71, 40, 0, 0, 0, 52, 4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0, 0, 27, 0, 0, 0, 124, 0, 0, 0, 9, 0, 0, 0, 128, 3, 0, 0, - 100, 2, 0, 0, 67, 58, + 100, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -181,42 +181,42 @@ const BYTE DGSLLambert_mainTxTk[] = 101, 114, 116, 46, 104, 108, 115, 108, 0, 171, 171, 171, 40, 0, 0, 0, 0, 0, - 255, 255, 104, 4, 0, 0, - 0, 0, 255, 255, 128, 4, + 255, 255, 116, 4, 0, 0, + 0, 0, 255, 255, 140, 4, 0, 0, 0, 0, 255, 255, - 140, 4, 0, 0, 0, 0, - 255, 255, 152, 4, 0, 0, - 0, 0, 255, 255, 164, 4, + 152, 4, 0, 0, 0, 0, + 255, 255, 164, 4, 0, 0, + 0, 0, 255, 255, 176, 4, 0, 0, 170, 0, 0, 0, - 176, 4, 0, 0, 171, 0, - 0, 0, 192, 4, 0, 0, - 174, 0, 0, 0, 208, 4, + 188, 4, 0, 0, 171, 0, + 0, 0, 204, 4, 0, 0, + 174, 0, 0, 0, 220, 4, 0, 0, 174, 0, 0, 0, - 224, 4, 0, 0, 174, 0, - 0, 0, 244, 4, 0, 0, - 160, 0, 0, 0, 252, 4, + 236, 4, 0, 0, 174, 0, + 0, 0, 0, 5, 0, 0, + 160, 0, 0, 0, 8, 5, 0, 0, 82, 0, 0, 0, - 8, 5, 0, 0, 83, 0, - 0, 0, 24, 5, 0, 0, - 83, 0, 0, 0, 40, 5, + 20, 5, 0, 0, 83, 0, + 0, 0, 36, 5, 0, 0, + 83, 0, 0, 0, 52, 5, 0, 0, 166, 0, 0, 0, - 56, 5, 0, 0, 166, 0, - 0, 0, 68, 5, 0, 0, - 82, 0, 0, 0, 88, 5, + 68, 5, 0, 0, 166, 0, + 0, 0, 80, 5, 0, 0, + 82, 0, 0, 0, 100, 5, 0, 0, 83, 0, 0, 0, - 104, 5, 0, 0, 166, 0, - 0, 0, 120, 5, 0, 0, - 82, 0, 0, 0, 140, 5, + 116, 5, 0, 0, 166, 0, + 0, 0, 132, 5, 0, 0, + 82, 0, 0, 0, 152, 5, 0, 0, 83, 0, 0, 0, - 156, 5, 0, 0, 166, 0, - 0, 0, 172, 5, 0, 0, - 82, 0, 0, 0, 192, 5, + 168, 5, 0, 0, 166, 0, + 0, 0, 184, 5, 0, 0, + 82, 0, 0, 0, 204, 5, 0, 0, 83, 0, 0, 0, - 208, 5, 0, 0, 166, 0, - 0, 0, 224, 5, 0, 0, - 170, 0, 0, 0, 244, 5, + 220, 5, 0, 0, 166, 0, + 0, 0, 236, 5, 0, 0, + 170, 0, 0, 0, 0, 6, 0, 0, 176, 0, 0, 0, - 4, 6, 0, 0, 77, 97, + 16, 6, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, 101, 114, 105, 97, @@ -345,7 +345,9 @@ const BYTE DGSLLambert_mainTxTk[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 10, 0, 15, 160, 0, 0, 128, 191, 0, 0, 0, 128, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_main.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_main.inc index 72ede18b3f52c139c014d5d83af0c95dbd55d3c2..f09a17b3bf6b231506d512b721ac293d5cfbe886 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_main.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_main.inc @@ -44,7 +44,7 @@ dcl t2.xyz // pixel<10,11,12> dcl t4.xyz // pixel<16,17,18> -#line 104 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" +#line 104 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" mov r0.xyz, c1 // MaterialVars::MaterialSpecular<0,1,2> mul r1.xyz, r0, c4 mul r2.xyz, r0, c5 @@ -179,17 +179,17 @@ ret const BYTE DGSLPhong_main[] = { - 68, 88, 66, 67, 17, 77, - 112, 60, 162, 43, 70, 93, - 242, 209, 41, 52, 161, 117, - 224, 183, 1, 0, 0, 0, - 8, 17, 0, 0, 4, 0, + 68, 88, 66, 67, 145, 34, + 57, 62, 135, 230, 35, 7, + 22, 11, 189, 127, 214, 251, + 196, 212, 1, 0, 0, 0, + 20, 17, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 180, 9, 0, 0, 232, 15, - 0, 0, 212, 16, 0, 0, - 65, 111, 110, 57, 124, 9, - 0, 0, 124, 9, 0, 0, - 0, 2, 255, 255, 16, 9, + 192, 9, 0, 0, 244, 15, + 0, 0, 224, 16, 0, 0, + 65, 111, 110, 57, 136, 9, + 0, 0, 136, 9, 0, 0, + 0, 2, 255, 255, 28, 9, 0, 0, 108, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -207,7 +207,7 @@ const BYTE DGSLPhong_main[] = 0, 0, 1, 0, 13, 0, 3, 0, 10, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 144, 1, 68, 66, + 254, 255, 147, 1, 68, 66, 85, 71, 40, 0, 0, 0, 20, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -215,7 +215,7 @@ const BYTE DGSLPhong_main[] = 0, 0, 120, 0, 0, 0, 14, 0, 0, 0, 252, 4, 0, 0, 36, 3, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -229,65 +229,65 @@ const BYTE DGSLPhong_main[] = 111, 110, 103, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, 0, 0, 255, 255, - 72, 6, 0, 0, 0, 0, - 255, 255, 96, 6, 0, 0, - 0, 0, 255, 255, 108, 6, + 84, 6, 0, 0, 0, 0, + 255, 255, 108, 6, 0, 0, + 0, 0, 255, 255, 120, 6, 0, 0, 0, 0, 255, 255, - 120, 6, 0, 0, 104, 0, - 0, 0, 132, 6, 0, 0, - 104, 0, 0, 0, 144, 6, + 132, 6, 0, 0, 104, 0, + 0, 0, 144, 6, 0, 0, + 104, 0, 0, 0, 156, 6, 0, 0, 104, 0, 0, 0, - 160, 6, 0, 0, 122, 0, - 0, 0, 176, 6, 0, 0, - 122, 0, 0, 0, 192, 6, + 172, 6, 0, 0, 122, 0, + 0, 0, 188, 6, 0, 0, + 122, 0, 0, 0, 204, 6, 0, 0, 101, 0, 0, 0, - 204, 6, 0, 0, 101, 0, - 0, 0, 224, 6, 0, 0, - 121, 0, 0, 0, 236, 6, + 216, 6, 0, 0, 101, 0, + 0, 0, 236, 6, 0, 0, + 121, 0, 0, 0, 248, 6, 0, 0, 102, 0, 0, 0, - 248, 6, 0, 0, 103, 0, - 0, 0, 8, 7, 0, 0, - 103, 0, 0, 0, 20, 7, + 4, 7, 0, 0, 103, 0, + 0, 0, 20, 7, 0, 0, + 103, 0, 0, 0, 32, 7, 0, 0, 103, 0, 0, 0, - 36, 7, 0, 0, 103, 0, - 0, 0, 52, 7, 0, 0, - 104, 0, 0, 0, 68, 7, + 48, 7, 0, 0, 103, 0, + 0, 0, 64, 7, 0, 0, + 104, 0, 0, 0, 80, 7, 0, 0, 101, 0, 0, 0, - 84, 7, 0, 0, 101, 0, - 0, 0, 104, 7, 0, 0, - 101, 0, 0, 0, 124, 7, + 96, 7, 0, 0, 101, 0, + 0, 0, 116, 7, 0, 0, + 101, 0, 0, 0, 136, 7, 0, 0, 102, 0, 0, 0, - 136, 7, 0, 0, 103, 0, - 0, 0, 152, 7, 0, 0, - 103, 0, 0, 0, 168, 7, + 148, 7, 0, 0, 103, 0, + 0, 0, 164, 7, 0, 0, + 103, 0, 0, 0, 180, 7, 0, 0, 101, 0, 0, 0, - 184, 7, 0, 0, 102, 0, - 0, 0, 196, 7, 0, 0, - 103, 0, 0, 0, 212, 7, + 196, 7, 0, 0, 102, 0, + 0, 0, 208, 7, 0, 0, + 103, 0, 0, 0, 224, 7, 0, 0, 103, 0, 0, 0, - 228, 7, 0, 0, 130, 0, - 0, 0, 244, 7, 0, 0, - 104, 0, 0, 0, 8, 8, + 240, 7, 0, 0, 130, 0, + 0, 0, 0, 8, 0, 0, + 104, 0, 0, 0, 20, 8, 0, 0, 130, 0, 0, 0, - 24, 8, 0, 0, 82, 0, - 0, 0, 44, 8, 0, 0, - 83, 0, 0, 0, 60, 8, + 36, 8, 0, 0, 82, 0, + 0, 0, 56, 8, 0, 0, + 83, 0, 0, 0, 72, 8, 0, 0, 83, 0, 0, 0, - 76, 8, 0, 0, 129, 0, - 0, 0, 92, 8, 0, 0, - 129, 0, 0, 0, 104, 8, + 88, 8, 0, 0, 129, 0, + 0, 0, 104, 8, 0, 0, + 129, 0, 0, 0, 116, 8, 0, 0, 82, 0, 0, 0, - 124, 8, 0, 0, 82, 0, - 0, 0, 140, 8, 0, 0, - 83, 0, 0, 0, 156, 8, + 136, 8, 0, 0, 82, 0, + 0, 0, 152, 8, 0, 0, + 83, 0, 0, 0, 168, 8, 0, 0, 83, 0, 0, 0, - 172, 8, 0, 0, 129, 0, - 0, 0, 188, 8, 0, 0, - 129, 0, 0, 0, 208, 8, + 184, 8, 0, 0, 129, 0, + 0, 0, 200, 8, 0, 0, + 129, 0, 0, 0, 220, 8, 0, 0, 134, 0, 0, 0, - 228, 8, 0, 0, 134, 0, - 0, 0, 244, 8, 0, 0, - 134, 0, 0, 0, 0, 9, + 240, 8, 0, 0, 134, 0, + 0, 0, 0, 9, 0, 0, + 134, 0, 0, 0, 12, 9, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, @@ -474,7 +474,9 @@ const BYTE DGSLPhong_main[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 23, 183, 209, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTk.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTk.inc index c37e2340353e2ca7cb6c1a3972a38f3cddd091ac..aa9148baba4c9c150ee7eded80ecce81087f6fab 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTk.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTk.inc @@ -44,7 +44,7 @@ dcl t2.xyz // pixel<10,11,12> dcl t4.xyz // pixel<16,17,18> -#line 158 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" +#line 158 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" mul r0.w, t0.w, t0.w cmp r0, -r0.w, c13.x, c13.y texkill r0 @@ -192,17 +192,17 @@ ret const BYTE DGSLPhong_mainTk[] = { - 68, 88, 66, 67, 51, 165, - 242, 85, 14, 19, 213, 109, - 6, 209, 238, 155, 101, 203, - 99, 253, 1, 0, 0, 0, - 44, 17, 0, 0, 4, 0, + 68, 88, 66, 67, 244, 206, + 153, 139, 237, 11, 126, 5, + 194, 150, 126, 42, 156, 90, + 218, 1, 1, 0, 0, 0, + 56, 17, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 176, 9, 0, 0, 12, 16, - 0, 0, 248, 16, 0, 0, - 65, 111, 110, 57, 120, 9, - 0, 0, 120, 9, 0, 0, - 0, 2, 255, 255, 12, 9, + 188, 9, 0, 0, 24, 16, + 0, 0, 4, 17, 0, 0, + 65, 111, 110, 57, 132, 9, + 0, 0, 132, 9, 0, 0, + 0, 2, 255, 255, 24, 9, 0, 0, 108, 0, 0, 0, 6, 0, 36, 0, 0, 0, 108, 0, 0, 0, 108, 0, @@ -220,7 +220,7 @@ const BYTE DGSLPhong_mainTk[] = 0, 0, 1, 0, 13, 0, 3, 0, 10, 0, 0, 0, 0, 0, 0, 2, 255, 255, - 254, 255, 132, 1, 68, 66, + 254, 255, 135, 1, 68, 66, 85, 71, 40, 0, 0, 0, 228, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -228,7 +228,7 @@ const BYTE DGSLPhong_mainTk[] = 0, 0, 120, 0, 0, 0, 13, 0, 0, 0, 224, 4, 0, 0, 8, 3, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -242,69 +242,69 @@ const BYTE DGSLPhong_mainTk[] = 111, 110, 103, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, 0, 0, 255, 255, - 24, 6, 0, 0, 0, 0, - 255, 255, 48, 6, 0, 0, - 0, 0, 255, 255, 60, 6, + 36, 6, 0, 0, 0, 0, + 255, 255, 60, 6, 0, 0, + 0, 0, 255, 255, 72, 6, 0, 0, 0, 0, 255, 255, - 72, 6, 0, 0, 158, 0, - 0, 0, 84, 6, 0, 0, - 158, 0, 0, 0, 100, 6, + 84, 6, 0, 0, 158, 0, + 0, 0, 96, 6, 0, 0, + 158, 0, 0, 0, 112, 6, 0, 0, 158, 0, 0, 0, - 120, 6, 0, 0, 144, 0, - 0, 0, 128, 6, 0, 0, - 144, 0, 0, 0, 144, 6, + 132, 6, 0, 0, 144, 0, + 0, 0, 140, 6, 0, 0, + 144, 0, 0, 0, 156, 6, 0, 0, 101, 0, 0, 0, - 156, 6, 0, 0, 101, 0, - 0, 0, 176, 6, 0, 0, - 143, 0, 0, 0, 188, 6, + 168, 6, 0, 0, 101, 0, + 0, 0, 188, 6, 0, 0, + 143, 0, 0, 0, 200, 6, 0, 0, 102, 0, 0, 0, - 200, 6, 0, 0, 82, 0, - 0, 0, 216, 6, 0, 0, - 83, 0, 0, 0, 232, 6, + 212, 6, 0, 0, 82, 0, + 0, 0, 228, 6, 0, 0, + 83, 0, 0, 0, 244, 6, 0, 0, 83, 0, 0, 0, - 248, 6, 0, 0, 151, 0, - 0, 0, 8, 7, 0, 0, - 151, 0, 0, 0, 20, 7, + 4, 7, 0, 0, 151, 0, + 0, 0, 20, 7, 0, 0, + 151, 0, 0, 0, 32, 7, 0, 0, 103, 0, 0, 0, - 40, 7, 0, 0, 103, 0, - 0, 0, 52, 7, 0, 0, - 82, 0, 0, 0, 68, 7, + 52, 7, 0, 0, 103, 0, + 0, 0, 64, 7, 0, 0, + 82, 0, 0, 0, 80, 7, 0, 0, 83, 0, 0, 0, - 84, 7, 0, 0, 151, 0, - 0, 0, 100, 7, 0, 0, - 82, 0, 0, 0, 120, 7, + 96, 7, 0, 0, 151, 0, + 0, 0, 112, 7, 0, 0, + 82, 0, 0, 0, 132, 7, 0, 0, 83, 0, 0, 0, - 136, 7, 0, 0, 151, 0, - 0, 0, 152, 7, 0, 0, - 103, 0, 0, 0, 172, 7, + 148, 7, 0, 0, 151, 0, + 0, 0, 164, 7, 0, 0, + 103, 0, 0, 0, 184, 7, 0, 0, 103, 0, 0, 0, - 188, 7, 0, 0, 101, 0, - 0, 0, 204, 7, 0, 0, - 101, 0, 0, 0, 224, 7, + 200, 7, 0, 0, 101, 0, + 0, 0, 216, 7, 0, 0, + 101, 0, 0, 0, 236, 7, 0, 0, 102, 0, 0, 0, - 236, 7, 0, 0, 103, 0, - 0, 0, 252, 7, 0, 0, - 103, 0, 0, 0, 12, 8, + 248, 7, 0, 0, 103, 0, + 0, 0, 8, 8, 0, 0, + 103, 0, 0, 0, 24, 8, 0, 0, 101, 0, 0, 0, - 28, 8, 0, 0, 101, 0, - 0, 0, 48, 8, 0, 0, - 102, 0, 0, 0, 60, 8, + 40, 8, 0, 0, 101, 0, + 0, 0, 60, 8, 0, 0, + 102, 0, 0, 0, 72, 8, 0, 0, 103, 0, 0, 0, - 76, 8, 0, 0, 103, 0, - 0, 0, 92, 8, 0, 0, - 104, 0, 0, 0, 108, 8, + 88, 8, 0, 0, 103, 0, + 0, 0, 104, 8, 0, 0, + 104, 0, 0, 0, 120, 8, 0, 0, 104, 0, 0, 0, - 120, 8, 0, 0, 104, 0, - 0, 0, 136, 8, 0, 0, - 104, 0, 0, 0, 152, 8, + 132, 8, 0, 0, 104, 0, + 0, 0, 148, 8, 0, 0, + 104, 0, 0, 0, 164, 8, 0, 0, 152, 0, 0, 0, - 168, 8, 0, 0, 104, 0, - 0, 0, 188, 8, 0, 0, - 152, 0, 0, 0, 204, 8, + 180, 8, 0, 0, 104, 0, + 0, 0, 200, 8, 0, 0, + 152, 0, 0, 0, 216, 8, 0, 0, 156, 0, 0, 0, - 224, 8, 0, 0, 160, 0, - 0, 0, 240, 8, 0, 0, - 160, 0, 0, 0, 252, 8, + 236, 8, 0, 0, 160, 0, + 0, 0, 252, 8, 0, 0, + 160, 0, 0, 0, 8, 9, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, @@ -479,7 +479,9 @@ const BYTE DGSLPhong_mainTk[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 0, 0, 128, 191, 0, 0, 0, 128, 23, 183, 209, 56, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTx.inc index 170dfd669e3e135de0dd6914e25b54a9e9923468..22809b0ff9a3fc49cdf2ab50d02a383f1d8c4bbc 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTx.inc @@ -53,7 +53,7 @@ dcl t4.xyz // pixel<16,17,18> dcl_2d s0 -#line 180 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" +#line 180 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" texld r0, t1, s0 #line 104 @@ -195,17 +195,17 @@ ret const BYTE DGSLPhong_mainTx[] = { - 68, 88, 66, 67, 245, 121, - 96, 181, 252, 90, 214, 151, - 2, 228, 95, 163, 213, 199, - 33, 130, 1, 0, 0, 0, - 212, 17, 0, 0, 4, 0, + 68, 88, 66, 67, 203, 248, + 171, 255, 80, 127, 38, 210, + 88, 59, 105, 224, 187, 69, + 13, 245, 1, 0, 0, 0, + 224, 17, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 36, 10, 0, 0, 180, 16, - 0, 0, 160, 17, 0, 0, - 65, 111, 110, 57, 236, 9, - 0, 0, 236, 9, 0, 0, - 0, 2, 255, 255, 124, 9, + 48, 10, 0, 0, 192, 16, + 0, 0, 172, 17, 0, 0, + 65, 111, 110, 57, 248, 9, + 0, 0, 248, 9, 0, 0, + 0, 2, 255, 255, 136, 9, 0, 0, 112, 0, 0, 0, 6, 0, 40, 0, 0, 0, 112, 0, 0, 0, 112, 0, @@ -224,14 +224,14 @@ const BYTE DGSLPhong_mainTx[] = 1, 0, 13, 0, 3, 0, 10, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 159, 1, 68, 66, 85, 71, + 162, 1, 68, 66, 85, 71, 40, 0, 0, 0, 80, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 48, 0, 0, 0, 120, 0, 0, 0, 15, 0, 0, 0, 36, 5, 0, 0, - 100, 3, 0, 0, 67, 58, + 100, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -245,70 +245,70 @@ const BYTE DGSLPhong_mainTx[] = 83, 76, 80, 104, 111, 110, 103, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 132, 6, + 0, 0, 255, 255, 144, 6, 0, 0, 0, 0, 255, 255, - 156, 6, 0, 0, 0, 0, - 255, 255, 168, 6, 0, 0, - 0, 0, 255, 255, 180, 6, + 168, 6, 0, 0, 0, 0, + 255, 255, 180, 6, 0, 0, + 0, 0, 255, 255, 192, 6, 0, 0, 0, 0, 255, 255, - 192, 6, 0, 0, 0, 0, - 255, 255, 204, 6, 0, 0, - 180, 0, 0, 0, 216, 6, + 204, 6, 0, 0, 0, 0, + 255, 255, 216, 6, 0, 0, + 180, 0, 0, 0, 228, 6, 0, 0, 104, 0, 0, 0, - 232, 6, 0, 0, 104, 0, - 0, 0, 244, 6, 0, 0, - 104, 0, 0, 0, 4, 7, + 244, 6, 0, 0, 104, 0, + 0, 0, 0, 7, 0, 0, + 104, 0, 0, 0, 16, 7, 0, 0, 168, 0, 0, 0, - 20, 7, 0, 0, 168, 0, - 0, 0, 36, 7, 0, 0, - 101, 0, 0, 0, 48, 7, + 32, 7, 0, 0, 168, 0, + 0, 0, 48, 7, 0, 0, + 101, 0, 0, 0, 60, 7, 0, 0, 101, 0, 0, 0, - 68, 7, 0, 0, 167, 0, - 0, 0, 80, 7, 0, 0, - 102, 0, 0, 0, 92, 7, + 80, 7, 0, 0, 167, 0, + 0, 0, 92, 7, 0, 0, + 102, 0, 0, 0, 104, 7, 0, 0, 103, 0, 0, 0, - 108, 7, 0, 0, 103, 0, - 0, 0, 120, 7, 0, 0, - 103, 0, 0, 0, 136, 7, + 120, 7, 0, 0, 103, 0, + 0, 0, 132, 7, 0, 0, + 103, 0, 0, 0, 148, 7, 0, 0, 103, 0, 0, 0, - 152, 7, 0, 0, 104, 0, - 0, 0, 168, 7, 0, 0, - 101, 0, 0, 0, 184, 7, + 164, 7, 0, 0, 104, 0, + 0, 0, 180, 7, 0, 0, + 101, 0, 0, 0, 196, 7, 0, 0, 101, 0, 0, 0, - 204, 7, 0, 0, 101, 0, - 0, 0, 224, 7, 0, 0, - 102, 0, 0, 0, 236, 7, + 216, 7, 0, 0, 101, 0, + 0, 0, 236, 7, 0, 0, + 102, 0, 0, 0, 248, 7, 0, 0, 103, 0, 0, 0, - 252, 7, 0, 0, 103, 0, - 0, 0, 12, 8, 0, 0, - 101, 0, 0, 0, 28, 8, + 8, 8, 0, 0, 103, 0, + 0, 0, 24, 8, 0, 0, + 101, 0, 0, 0, 40, 8, 0, 0, 102, 0, 0, 0, - 40, 8, 0, 0, 103, 0, - 0, 0, 56, 8, 0, 0, - 103, 0, 0, 0, 72, 8, + 52, 8, 0, 0, 103, 0, + 0, 0, 68, 8, 0, 0, + 103, 0, 0, 0, 84, 8, 0, 0, 176, 0, 0, 0, - 88, 8, 0, 0, 104, 0, - 0, 0, 108, 8, 0, 0, - 176, 0, 0, 0, 124, 8, + 100, 8, 0, 0, 104, 0, + 0, 0, 120, 8, 0, 0, + 176, 0, 0, 0, 136, 8, 0, 0, 82, 0, 0, 0, - 144, 8, 0, 0, 83, 0, - 0, 0, 160, 8, 0, 0, - 83, 0, 0, 0, 176, 8, + 156, 8, 0, 0, 83, 0, + 0, 0, 172, 8, 0, 0, + 83, 0, 0, 0, 188, 8, 0, 0, 175, 0, 0, 0, - 192, 8, 0, 0, 175, 0, - 0, 0, 204, 8, 0, 0, - 82, 0, 0, 0, 224, 8, + 204, 8, 0, 0, 175, 0, + 0, 0, 216, 8, 0, 0, + 82, 0, 0, 0, 236, 8, 0, 0, 82, 0, 0, 0, - 240, 8, 0, 0, 83, 0, - 0, 0, 0, 9, 0, 0, - 83, 0, 0, 0, 16, 9, + 252, 8, 0, 0, 83, 0, + 0, 0, 12, 9, 0, 0, + 83, 0, 0, 0, 28, 9, 0, 0, 175, 0, 0, 0, - 32, 9, 0, 0, 175, 0, - 0, 0, 52, 9, 0, 0, - 180, 0, 0, 0, 72, 9, + 44, 9, 0, 0, 175, 0, + 0, 0, 64, 9, 0, 0, + 180, 0, 0, 0, 84, 9, 0, 0, 181, 0, 0, 0, - 92, 9, 0, 0, 180, 0, - 0, 0, 108, 9, 0, 0, + 104, 9, 0, 0, 180, 0, + 0, 0, 120, 9, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, 101, 114, @@ -500,7 +500,9 @@ const BYTE DGSLPhong_mainTx[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 23, 183, 209, 56, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTxTk.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTxTk.inc index 7cc9830140ae56914f73ad159a3afec882e878de..dc863c0e32a6a2e60df46b18cc7c42120e4a398d 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTxTk.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLPhong_mainTxTk.inc @@ -53,7 +53,7 @@ dcl t4.xyz // pixel<16,17,18> dcl_2d s0 -#line 204 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" +#line 204 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLPhong.hlsl" texld r0, t1, s0 mul r1.w, r0.w, t0.w // ::local6<0> @@ -209,17 +209,17 @@ ret const BYTE DGSLPhong_mainTxTk[] = { - 68, 88, 66, 67, 235, 167, - 128, 244, 246, 144, 158, 216, - 206, 36, 154, 226, 67, 2, - 231, 43, 1, 0, 0, 0, - 16, 18, 0, 0, 4, 0, + 68, 88, 66, 67, 217, 242, + 51, 158, 205, 76, 37, 171, + 125, 107, 245, 41, 148, 83, + 112, 124, 1, 0, 0, 0, + 28, 18, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 36, 10, 0, 0, 240, 16, - 0, 0, 220, 17, 0, 0, - 65, 111, 110, 57, 236, 9, - 0, 0, 236, 9, 0, 0, - 0, 2, 255, 255, 124, 9, + 48, 10, 0, 0, 252, 16, + 0, 0, 232, 17, 0, 0, + 65, 111, 110, 57, 248, 9, + 0, 0, 248, 9, 0, 0, + 0, 2, 255, 255, 136, 9, 0, 0, 112, 0, 0, 0, 6, 0, 40, 0, 0, 0, 112, 0, 0, 0, 112, 0, @@ -238,14 +238,14 @@ const BYTE DGSLPhong_mainTxTk[] = 1, 0, 13, 0, 3, 0, 10, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 148, 1, 68, 66, 85, 71, + 151, 1, 68, 66, 85, 71, 40, 0, 0, 0, 36, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 51, 0, 0, 0, 120, 0, 0, 0, 14, 0, 0, 0, 12, 5, 0, 0, - 72, 3, 0, 0, 67, 58, + 72, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -259,74 +259,74 @@ const BYTE DGSLPhong_mainTxTk[] = 83, 76, 80, 104, 111, 110, 103, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 88, 6, + 0, 0, 255, 255, 100, 6, 0, 0, 0, 0, 255, 255, - 112, 6, 0, 0, 0, 0, - 255, 255, 124, 6, 0, 0, - 0, 0, 255, 255, 136, 6, + 124, 6, 0, 0, 0, 0, + 255, 255, 136, 6, 0, 0, + 0, 0, 255, 255, 148, 6, 0, 0, 0, 0, 255, 255, - 148, 6, 0, 0, 0, 0, - 255, 255, 160, 6, 0, 0, - 204, 0, 0, 0, 172, 6, + 160, 6, 0, 0, 0, 0, + 255, 255, 172, 6, 0, 0, + 204, 0, 0, 0, 184, 6, 0, 0, 205, 0, 0, 0, - 188, 6, 0, 0, 208, 0, - 0, 0, 204, 6, 0, 0, - 208, 0, 0, 0, 220, 6, + 200, 6, 0, 0, 208, 0, + 0, 0, 216, 6, 0, 0, + 208, 0, 0, 0, 232, 6, 0, 0, 208, 0, 0, 0, - 240, 6, 0, 0, 192, 0, - 0, 0, 248, 6, 0, 0, - 192, 0, 0, 0, 8, 7, + 252, 6, 0, 0, 192, 0, + 0, 0, 4, 7, 0, 0, + 192, 0, 0, 0, 20, 7, 0, 0, 101, 0, 0, 0, - 20, 7, 0, 0, 101, 0, - 0, 0, 40, 7, 0, 0, - 191, 0, 0, 0, 52, 7, + 32, 7, 0, 0, 101, 0, + 0, 0, 52, 7, 0, 0, + 191, 0, 0, 0, 64, 7, 0, 0, 102, 0, 0, 0, - 64, 7, 0, 0, 82, 0, - 0, 0, 80, 7, 0, 0, - 83, 0, 0, 0, 96, 7, + 76, 7, 0, 0, 82, 0, + 0, 0, 92, 7, 0, 0, + 83, 0, 0, 0, 108, 7, 0, 0, 83, 0, 0, 0, - 112, 7, 0, 0, 199, 0, - 0, 0, 128, 7, 0, 0, - 199, 0, 0, 0, 140, 7, + 124, 7, 0, 0, 199, 0, + 0, 0, 140, 7, 0, 0, + 199, 0, 0, 0, 152, 7, 0, 0, 103, 0, 0, 0, - 160, 7, 0, 0, 103, 0, - 0, 0, 172, 7, 0, 0, - 82, 0, 0, 0, 188, 7, + 172, 7, 0, 0, 103, 0, + 0, 0, 184, 7, 0, 0, + 82, 0, 0, 0, 200, 7, 0, 0, 83, 0, 0, 0, - 204, 7, 0, 0, 199, 0, - 0, 0, 220, 7, 0, 0, - 82, 0, 0, 0, 240, 7, + 216, 7, 0, 0, 199, 0, + 0, 0, 232, 7, 0, 0, + 82, 0, 0, 0, 252, 7, 0, 0, 83, 0, 0, 0, - 0, 8, 0, 0, 199, 0, - 0, 0, 16, 8, 0, 0, - 103, 0, 0, 0, 36, 8, + 12, 8, 0, 0, 199, 0, + 0, 0, 28, 8, 0, 0, + 103, 0, 0, 0, 48, 8, 0, 0, 103, 0, 0, 0, - 52, 8, 0, 0, 101, 0, - 0, 0, 68, 8, 0, 0, - 101, 0, 0, 0, 88, 8, + 64, 8, 0, 0, 101, 0, + 0, 0, 80, 8, 0, 0, + 101, 0, 0, 0, 100, 8, 0, 0, 102, 0, 0, 0, - 100, 8, 0, 0, 103, 0, - 0, 0, 116, 8, 0, 0, - 103, 0, 0, 0, 132, 8, + 112, 8, 0, 0, 103, 0, + 0, 0, 128, 8, 0, 0, + 103, 0, 0, 0, 144, 8, 0, 0, 101, 0, 0, 0, - 148, 8, 0, 0, 101, 0, - 0, 0, 168, 8, 0, 0, - 102, 0, 0, 0, 180, 8, + 160, 8, 0, 0, 101, 0, + 0, 0, 180, 8, 0, 0, + 102, 0, 0, 0, 192, 8, 0, 0, 103, 0, 0, 0, - 196, 8, 0, 0, 103, 0, - 0, 0, 212, 8, 0, 0, - 104, 0, 0, 0, 228, 8, + 208, 8, 0, 0, 103, 0, + 0, 0, 224, 8, 0, 0, + 104, 0, 0, 0, 240, 8, 0, 0, 104, 0, 0, 0, - 240, 8, 0, 0, 104, 0, - 0, 0, 0, 9, 0, 0, - 104, 0, 0, 0, 16, 9, + 252, 8, 0, 0, 104, 0, + 0, 0, 12, 9, 0, 0, + 104, 0, 0, 0, 28, 9, 0, 0, 200, 0, 0, 0, - 32, 9, 0, 0, 104, 0, - 0, 0, 52, 9, 0, 0, - 200, 0, 0, 0, 68, 9, + 44, 9, 0, 0, 104, 0, + 0, 0, 64, 9, 0, 0, + 200, 0, 0, 0, 80, 9, 0, 0, 204, 0, 0, 0, - 88, 9, 0, 0, 210, 0, - 0, 0, 108, 9, 0, 0, + 100, 9, 0, 0, 210, 0, + 0, 0, 120, 9, 0, 0, 77, 97, 116, 101, 114, 105, 97, 108, 86, 97, 114, 115, 0, 77, 97, 116, 101, 114, @@ -507,7 +507,9 @@ const BYTE DGSLPhong_mainTxTk[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 13, 0, 15, 160, 0, 0, 128, 191, 0, 0, 0, 128, 23, 183, 209, 56, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_main.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_main.inc index 9e207110864940db7c0024e8f2db082fad56436b..1eff50c8f8d7375378df4286e0eaac7d3902ed04 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_main.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_main.inc @@ -29,7 +29,7 @@ ps_2_0 dcl t0 // pixel<4,5,6,7> -#line 83 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" +#line 83 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" mov oC0, t0 // ::main<0,1,2,3> // approximately 1 instruction slot used @@ -43,23 +43,23 @@ ret const BYTE DGSLUnlit_main[] = { - 68, 88, 66, 67, 131, 172, - 120, 173, 112, 184, 143, 42, - 142, 197, 113, 141, 74, 250, - 229, 255, 1, 0, 0, 0, - 192, 3, 0, 0, 4, 0, + 68, 88, 66, 67, 61, 3, + 245, 70, 251, 216, 73, 233, + 53, 70, 10, 126, 162, 157, + 69, 231, 1, 0, 0, 0, + 204, 3, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 96, 2, 0, 0, 160, 2, - 0, 0, 140, 3, 0, 0, - 65, 111, 110, 57, 40, 2, - 0, 0, 40, 2, 0, 0, - 0, 2, 255, 255, 4, 2, + 108, 2, 0, 0, 172, 2, + 0, 0, 152, 3, 0, 0, + 65, 111, 110, 57, 52, 2, + 0, 0, 52, 2, 0, 0, + 0, 2, 255, 255, 16, 2, 0, 0, 36, 0, 0, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 2, 255, 255, - 254, 255, 120, 0, 68, 66, + 254, 255, 123, 0, 68, 66, 85, 71, 40, 0, 0, 0, 180, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -67,7 +67,7 @@ const BYTE DGSLUnlit_main[] = 0, 0, 120, 0, 0, 0, 2, 0, 0, 0, 140, 1, 0, 0, 136, 0, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -81,8 +81,8 @@ const BYTE DGSLUnlit_main[] = 108, 105, 116, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, 0, 0, 255, 255, - 232, 1, 0, 0, 83, 0, - 0, 0, 244, 1, 0, 0, + 244, 1, 0, 0, 83, 0, + 0, 0, 0, 2, 0, 0, 109, 97, 105, 110, 0, 102, 114, 97, 103, 109, 101, 110, 116, 0, 171, 171, 1, 0, @@ -139,7 +139,9 @@ const BYTE DGSLUnlit_main[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 1, 0, 0, 2, 0, 8, 15, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTk.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTk.inc index fdcc6471cdb984a007c11b800aa0170cd7f2ea4e..577d3710188a1a4679dbb6a196b4983fd21aa6e7 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTk.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTk.inc @@ -30,7 +30,7 @@ def c0, -1, -0, 0, 0 dcl t0 // pixel<4,5,6,7> -#line 93 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" +#line 93 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" mul r0.w, t0.w, t0.w cmp r0, -r0.w, c0.x, c0.y texkill r0 @@ -51,23 +51,23 @@ ret const BYTE DGSLUnlit_mainTk[] = { - 68, 88, 66, 67, 245, 73, - 98, 112, 30, 115, 101, 94, - 153, 195, 39, 160, 72, 88, - 83, 207, 1, 0, 0, 0, - 116, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 22, 42, + 40, 87, 164, 245, 6, 218, + 239, 194, 64, 18, 252, 233, + 81, 172, 1, 0, 0, 0, + 128, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 228, 2, 0, 0, 84, 3, - 0, 0, 64, 4, 0, 0, - 65, 111, 110, 57, 172, 2, - 0, 0, 172, 2, 0, 0, - 0, 2, 255, 255, 136, 2, + 240, 2, 0, 0, 96, 3, + 0, 0, 76, 4, 0, 0, + 65, 111, 110, 57, 184, 2, + 0, 0, 184, 2, 0, 0, + 0, 2, 255, 255, 148, 2, 0, 0, 36, 0, 0, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 2, 255, 255, - 254, 255, 133, 0, 68, 66, + 254, 255, 136, 0, 68, 66, 85, 71, 40, 0, 0, 0, 232, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -75,7 +75,7 @@ const BYTE DGSLUnlit_mainTk[] = 0, 0, 120, 0, 0, 0, 2, 0, 0, 0, 192, 1, 0, 0, 176, 0, 0, 0, - 67, 58, 92, 65, 84, 71, + 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, 101, 110, @@ -89,15 +89,15 @@ const BYTE DGSLUnlit_mainTk[] = 108, 105, 116, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, 0, 0, 255, 255, - 28, 2, 0, 0, 0, 0, - 255, 255, 52, 2, 0, 0, - 93, 0, 0, 0, 64, 2, + 40, 2, 0, 0, 0, 0, + 255, 255, 64, 2, 0, 0, + 93, 0, 0, 0, 76, 2, 0, 0, 93, 0, 0, 0, - 80, 2, 0, 0, 93, 0, - 0, 0, 100, 2, 0, 0, - 95, 0, 0, 0, 108, 2, + 92, 2, 0, 0, 93, 0, + 0, 0, 112, 2, 0, 0, + 95, 0, 0, 0, 120, 2, 0, 0, 95, 0, 0, 0, - 120, 2, 0, 0, 109, 97, + 132, 2, 0, 0, 109, 97, 105, 110, 84, 107, 0, 102, 114, 97, 103, 109, 101, 110, 116, 0, 1, 0, 3, 0, @@ -156,7 +156,9 @@ const BYTE DGSLUnlit_mainTk[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 0, 0, 15, 160, 0, 0, 128, 191, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTx.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTx.inc index 11b180b3e925ad45b02f40cee36226dbeaf82b51..68e05ad13df06a3821c78579a1c4b4553c9176d7 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTx.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTx.inc @@ -38,7 +38,7 @@ dcl t1.xy // pixel<8,9> dcl_2d s0 -#line 117 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" +#line 117 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" texld r0, t1, s0 mul r1, r0, t0 // ::local3<0,1,2>, ::local4<0> mov oC0, r1 // ::mainTx<0,1,2,3> @@ -59,31 +59,31 @@ ret const BYTE DGSLUnlit_mainTx[] = { - 68, 88, 66, 67, 14, 132, - 199, 88, 131, 122, 131, 137, - 21, 243, 17, 86, 184, 232, - 27, 220, 1, 0, 0, 0, - 224, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 26, 91, + 239, 86, 147, 193, 19, 119, + 249, 89, 119, 177, 190, 203, + 224, 151, 1, 0, 0, 0, + 236, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 36, 3, 0, 0, 192, 3, - 0, 0, 172, 4, 0, 0, - 65, 111, 110, 57, 236, 2, - 0, 0, 236, 2, 0, 0, - 0, 2, 255, 255, 196, 2, + 48, 3, 0, 0, 204, 3, + 0, 0, 184, 4, 0, 0, + 65, 111, 110, 57, 248, 2, + 0, 0, 248, 2, 0, 0, + 0, 2, 255, 255, 208, 2, 0, 0, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 154, 0, 68, 66, 85, 71, + 157, 0, 68, 66, 85, 71, 40, 0, 0, 0, 60, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 6, 0, 0, 0, 120, 0, 0, 0, 4, 0, 0, 0, 236, 1, 0, 0, - 240, 0, 0, 0, 67, 58, + 240, 0, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -97,14 +97,14 @@ const BYTE DGSLUnlit_mainTx[] = 83, 76, 85, 110, 108, 105, 116, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 112, 2, + 0, 0, 255, 255, 124, 2, 0, 0, 0, 0, 255, 255, - 124, 2, 0, 0, 0, 0, - 255, 255, 136, 2, 0, 0, - 117, 0, 0, 0, 148, 2, + 136, 2, 0, 0, 0, 0, + 255, 255, 148, 2, 0, 0, + 117, 0, 0, 0, 160, 2, 0, 0, 117, 0, 0, 0, - 164, 2, 0, 0, 117, 0, - 0, 0, 180, 2, 0, 0, + 176, 2, 0, 0, 117, 0, + 0, 0, 192, 2, 0, 0, 108, 111, 99, 97, 108, 51, 0, 171, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, @@ -178,7 +178,9 @@ const BYTE DGSLUnlit_mainTx[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTxTk.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTxTk.inc index f33ab3260ba6f814b4c2d0267081c89ccf06328c..6fd687c0ded1ecd6d8bab1dbfb4ccc5cef7afd56 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTxTk.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DGSLUnlit_mainTxTk.inc @@ -39,7 +39,7 @@ dcl t1.xy // pixel<8,9> dcl_2d s0 -#line 144 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" +#line 144 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DGSLUnlit.hlsl" texld r0, t1, s0 mul r1.w, r0.w, t0.w // ::local4<0> @@ -74,31 +74,31 @@ ret const BYTE DGSLUnlit_mainTxTk[] = { - 68, 88, 66, 67, 163, 187, - 53, 119, 142, 182, 238, 196, - 183, 110, 204, 63, 193, 239, - 206, 55, 1, 0, 0, 0, - 184, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 214, 117, + 150, 240, 231, 235, 88, 117, + 64, 188, 40, 16, 6, 205, + 57, 246, 1, 0, 0, 0, + 196, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 164, 3, 0, 0, 152, 4, - 0, 0, 132, 5, 0, 0, - 65, 111, 110, 57, 108, 3, - 0, 0, 108, 3, 0, 0, - 0, 2, 255, 255, 68, 3, + 176, 3, 0, 0, 164, 4, + 0, 0, 144, 5, 0, 0, + 65, 111, 110, 57, 120, 3, + 0, 0, 120, 3, 0, 0, + 0, 2, 255, 255, 80, 3, 0, 0, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 165, 0, 68, 66, 85, 71, + 168, 0, 68, 66, 85, 71, 40, 0, 0, 0, 104, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 11, 0, 0, 0, 120, 0, 0, 0, 4, 0, 0, 0, 24, 2, 0, 0, - 24, 1, 0, 0, 67, 58, + 24, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -112,21 +112,21 @@ const BYTE DGSLUnlit_mainTxTk[] = 83, 76, 85, 110, 108, 105, 116, 46, 104, 108, 115, 108, 0, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 156, 2, + 0, 0, 255, 255, 168, 2, 0, 0, 0, 0, 255, 255, - 180, 2, 0, 0, 0, 0, - 255, 255, 192, 2, 0, 0, - 0, 0, 255, 255, 204, 2, + 192, 2, 0, 0, 0, 0, + 255, 255, 204, 2, 0, 0, + 0, 0, 255, 255, 216, 2, 0, 0, 144, 0, 0, 0, - 216, 2, 0, 0, 145, 0, - 0, 0, 232, 2, 0, 0, - 149, 0, 0, 0, 248, 2, + 228, 2, 0, 0, 145, 0, + 0, 0, 244, 2, 0, 0, + 149, 0, 0, 0, 4, 3, 0, 0, 149, 0, 0, 0, - 8, 3, 0, 0, 149, 0, - 0, 0, 28, 3, 0, 0, - 144, 0, 0, 0, 36, 3, + 20, 3, 0, 0, 149, 0, + 0, 0, 40, 3, 0, 0, + 144, 0, 0, 0, 48, 3, 0, 0, 151, 0, 0, 0, - 52, 3, 0, 0, 108, 111, + 64, 3, 0, 0, 108, 111, 99, 97, 108, 51, 0, 171, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 0, 0, @@ -201,7 +201,9 @@ const BYTE DGSLUnlit_mainTxTk[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 0, 0, 15, 160, 0, 0, 128, 191, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc index 6442d1ee84c7e360dda5e43a8e0d193586f864e9..e994fde3a00f339a2a632507471cbff8ecffcd6a 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc @@ -45,7 +45,7 @@ dcl_2d s0 dcl_2d s1 -#line 98 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 98 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mov r0.xy, t2.wzyx texld r0, r0, s1 // ::overlay<0,1,2,3> texld r1, t2, s0 // ::color<0,1,2,3> @@ -55,7 +55,7 @@ mul r1, r1, c1 mul r0, r0, r1 // ::color<0,1,2,3> -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, c0, r0.w, -r0 mad r0.xyz, t1.w, r1, r0 // ApplyFog::color<0,1,2> mov oC0, r0 // ::PSDualTexture<0,1,2,3> @@ -87,17 +87,17 @@ ret const BYTE DualTextureEffect_PSDualTexture[] = { - 68, 88, 66, 67, 90, 48, - 60, 15, 10, 243, 234, 83, - 37, 109, 33, 173, 19, 116, - 245, 45, 1, 0, 0, 0, - 164, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 95, 47, + 113, 252, 51, 145, 165, 51, + 46, 143, 216, 187, 118, 48, + 155, 49, 1, 0, 0, 0, + 176, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 68, 4, 0, 0, 240, 5, - 0, 0, 112, 6, 0, 0, - 65, 111, 110, 57, 12, 4, - 0, 0, 12, 4, 0, 0, - 0, 2, 255, 255, 212, 3, + 80, 4, 0, 0, 252, 5, + 0, 0, 124, 6, 0, 0, + 65, 111, 110, 57, 24, 4, + 0, 0, 24, 4, 0, 0, + 0, 2, 255, 255, 224, 3, 0, 0, 56, 0, 0, 0, 1, 0, 44, 0, 0, 0, 56, 0, 0, 0, 56, 0, @@ -106,7 +106,7 @@ const BYTE DualTextureEffect_PSDualTexture[] = 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 255, 255, 254, 255, 185, 0, + 255, 255, 254, 255, 188, 0, 68, 66, 85, 71, 40, 0, 0, 0, 184, 2, 0, 0, 0, 0, 0, 0, 2, 0, @@ -114,7 +114,7 @@ const BYTE DualTextureEffect_PSDualTexture[] = 15, 0, 0, 0, 200, 0, 0, 0, 5, 0, 0, 0, 84, 2, 0, 0, 64, 1, - 0, 0, 67, 58, 92, 65, + 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -127,7 +127,7 @@ const BYTE DualTextureEffect_PSDualTexture[] = 115, 92, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 69, 102, 102, 101, 99, - 116, 46, 102, 120, 0, 67, + 116, 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -141,26 +141,26 @@ const BYTE DualTextureEffect_PSDualTexture[] = 111, 109, 109, 111, 110, 46, 102, 120, 104, 0, 40, 0, 0, 0, 121, 0, 0, 0, - 0, 0, 255, 255, 236, 2, + 0, 0, 255, 255, 248, 2, 0, 0, 0, 0, 255, 255, - 4, 3, 0, 0, 0, 0, - 255, 255, 16, 3, 0, 0, - 0, 0, 255, 255, 28, 3, + 16, 3, 0, 0, 0, 0, + 255, 255, 28, 3, 0, 0, + 0, 0, 255, 255, 40, 3, 0, 0, 0, 0, 255, 255, - 40, 3, 0, 0, 0, 0, - 255, 255, 52, 3, 0, 0, - 98, 0, 0, 0, 64, 3, + 52, 3, 0, 0, 0, 0, + 255, 255, 64, 3, 0, 0, + 98, 0, 0, 0, 76, 3, 0, 0, 98, 0, 0, 0, - 76, 3, 0, 0, 97, 0, - 0, 0, 92, 3, 0, 0, - 101, 0, 0, 0, 108, 3, + 88, 3, 0, 0, 97, 0, + 0, 0, 104, 3, 0, 0, + 101, 0, 0, 0, 120, 3, 0, 0, 101, 0, 0, 0, - 124, 3, 0, 0, 101, 0, - 0, 0, 140, 3, 0, 0, - 20, 0, 1, 0, 156, 3, + 136, 3, 0, 0, 101, 0, + 0, 0, 152, 3, 0, 0, + 20, 0, 1, 0, 168, 3, 0, 0, 20, 0, 1, 0, - 176, 3, 0, 0, 20, 0, - 1, 0, 196, 3, 0, 0, + 188, 3, 0, 0, 20, 0, + 1, 0, 208, 3, 0, 0, 80, 83, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 0, 171, 171, 1, 0, @@ -230,7 +230,9 @@ const BYTE DualTextureEffect_PSDualTexture[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 1, 0, 15, 160, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc index 59cac1cfdf1575a92b25413b4a0b3cc5d563523a..6141e032556e4e0ca4839f614b72e9e2b9300257 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc @@ -36,7 +36,7 @@ dcl_2d s0 dcl_2d s1 -#line 113 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 113 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mov r0.xy, t1.wzyx texld r0, r0, s1 // ::overlay<0,1,2,3> texld r1, t1, s0 // ::color<0,1,2,3> @@ -69,24 +69,24 @@ ret const BYTE DualTextureEffect_PSDualTextureNoFog[] = { - 68, 88, 66, 67, 247, 98, - 86, 46, 82, 158, 118, 62, - 77, 41, 130, 108, 229, 62, - 221, 37, 1, 0, 0, 0, - 44, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 250, 151, + 31, 166, 221, 116, 168, 146, + 90, 189, 173, 72, 39, 216, + 90, 165, 1, 0, 0, 0, + 56, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 100, 3, 0, 0, 144, 4, - 0, 0, 248, 4, 0, 0, - 65, 111, 110, 57, 44, 3, - 0, 0, 44, 3, 0, 0, - 0, 2, 255, 255, 0, 3, + 112, 3, 0, 0, 156, 4, + 0, 0, 4, 5, 0, 0, + 65, 111, 110, 57, 56, 3, + 0, 0, 56, 3, 0, 0, + 0, 2, 255, 255, 12, 3, 0, 0, 44, 0, 0, 0, 0, 0, 44, 0, 0, 0, 44, 0, 0, 0, 44, 0, 2, 0, 36, 0, 0, 0, 44, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, - 255, 255, 254, 255, 145, 0, + 255, 255, 254, 255, 148, 0, 68, 66, 85, 71, 40, 0, 0, 0, 24, 2, 0, 0, 0, 0, 0, 0, 1, 0, @@ -94,7 +94,7 @@ const BYTE DualTextureEffect_PSDualTextureNoFog[] = 12, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 200, 1, 0, 0, 224, 0, - 0, 0, 67, 58, 92, 65, + 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -109,22 +109,22 @@ const BYTE DualTextureEffect_PSDualTextureNoFog[] = 101, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 171, 171, 171, 40, 0, 0, 0, - 0, 0, 255, 255, 76, 2, + 0, 0, 255, 255, 88, 2, 0, 0, 0, 0, 255, 255, - 100, 2, 0, 0, 0, 0, - 255, 255, 112, 2, 0, 0, - 0, 0, 255, 255, 124, 2, + 112, 2, 0, 0, 0, 0, + 255, 255, 124, 2, 0, 0, + 0, 0, 255, 255, 136, 2, 0, 0, 0, 0, 255, 255, - 136, 2, 0, 0, 113, 0, - 0, 0, 148, 2, 0, 0, - 113, 0, 0, 0, 160, 2, + 148, 2, 0, 0, 113, 0, + 0, 0, 160, 2, 0, 0, + 113, 0, 0, 0, 172, 2, 0, 0, 112, 0, 0, 0, - 176, 2, 0, 0, 116, 0, - 0, 0, 192, 2, 0, 0, - 116, 0, 0, 0, 208, 2, + 188, 2, 0, 0, 116, 0, + 0, 0, 204, 2, 0, 0, + 116, 0, 0, 0, 220, 2, 0, 0, 116, 0, 0, 0, - 224, 2, 0, 0, 116, 0, - 0, 0, 240, 2, 0, 0, + 236, 2, 0, 0, 116, 0, + 0, 0, 252, 2, 0, 0, 80, 83, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 78, 111, 70, 111, 103, @@ -183,7 +183,9 @@ const BYTE DualTextureEffect_PSDualTextureNoFog[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 0, 0, 15, 160, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 64, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc index 9c93e422eb3c1a593e1898bd10da01c03aa21e1f..31eaed44ac1557aec7a4b9852f4af54eb011b817 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc @@ -46,7 +46,7 @@ dcl_texcoord1 v1 // vin<4,5> dcl_texcoord2 v2 // vin<6,7> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSDualTexture<14> #line 14 @@ -59,15 +59,15 @@ dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 33 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 33 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSDualTexture<12,13> mov oPos.w, r0.z // ::VSDualTexture<15> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSDualTexture<0,1,2,3> mov oT1.xyz, c7.x // ::VSDualTexture<4,5,6> -#line 40 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 40 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mov oT2.xy, v1 // ::VSDualTexture<8,9> mov oT2.zw, v2.xyyx // ::VSDualTexture<11,10> @@ -97,17 +97,17 @@ ret const BYTE DualTextureEffect_VSDualTexture[] = { - 68, 88, 66, 67, 77, 60, - 45, 61, 77, 38, 39, 90, - 195, 111, 157, 76, 71, 113, - 130, 199, 1, 0, 0, 0, - 184, 7, 0, 0, 4, 0, + 68, 88, 66, 67, 168, 231, + 169, 97, 141, 233, 232, 127, + 145, 47, 47, 139, 242, 178, + 139, 219, 1, 0, 0, 0, + 196, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 28, 5, 0, 0, 164, 6, - 0, 0, 20, 7, 0, 0, - 65, 111, 110, 57, 228, 4, - 0, 0, 228, 4, 0, 0, - 0, 2, 254, 255, 164, 4, + 40, 5, 0, 0, 176, 6, + 0, 0, 32, 7, 0, 0, + 65, 111, 110, 57, 240, 4, + 0, 0, 240, 4, 0, 0, + 0, 2, 254, 255, 176, 4, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -118,14 +118,14 @@ const BYTE DualTextureEffect_VSDualTexture[] = 5, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 231, 0, 68, 66, 85, 71, + 234, 0, 68, 66, 85, 71, 40, 0, 0, 0, 112, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 17, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 52, 3, 0, 0, - 80, 1, 0, 0, 67, 58, + 80, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -137,7 +137,7 @@ const BYTE DualTextureEffect_VSDualTexture[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -153,28 +153,28 @@ const BYTE DualTextureEffect_VSDualTexture[] = 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 164, 3, 0, 0, 0, 0, - 255, 255, 188, 3, 0, 0, - 0, 0, 255, 255, 200, 3, + 176, 3, 0, 0, 0, 0, + 255, 255, 200, 3, 0, 0, + 0, 0, 255, 255, 212, 3, 0, 0, 0, 0, 255, 255, - 212, 3, 0, 0, 43, 0, - 0, 0, 224, 3, 0, 0, - 14, 0, 0, 0, 240, 3, + 224, 3, 0, 0, 43, 0, + 0, 0, 236, 3, 0, 0, + 14, 0, 0, 0, 252, 3, 0, 0, 14, 0, 0, 0, - 0, 4, 0, 0, 14, 0, - 0, 0, 16, 4, 0, 0, - 43, 0, 0, 0, 32, 4, + 12, 4, 0, 0, 14, 0, + 0, 0, 28, 4, 0, 0, + 43, 0, 0, 0, 44, 4, 0, 0, 43, 0, 0, 0, - 48, 4, 0, 0, 43, 0, - 0, 0, 64, 4, 0, 0, - 33, 0, 1, 0, 80, 4, + 60, 4, 0, 0, 43, 0, + 0, 0, 76, 4, 0, 0, + 33, 0, 1, 0, 92, 4, 0, 0, 33, 0, 1, 0, - 100, 4, 0, 0, 44, 0, - 0, 0, 112, 4, 0, 0, - 45, 0, 0, 0, 124, 4, + 112, 4, 0, 0, 44, 0, + 0, 0, 124, 4, 0, 0, + 45, 0, 0, 0, 136, 4, 0, 0, 40, 0, 1, 0, - 136, 4, 0, 0, 40, 0, - 1, 0, 148, 4, 0, 0, + 148, 4, 0, 0, 40, 0, + 1, 0, 160, 4, 0, 0, 86, 83, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 0, 68, 105, 102, 102, @@ -272,7 +272,9 @@ const BYTE DualTextureEffect_VSDualTexture[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc index 0e7dc755f1374dfde3b690399e667089147dfaf9..7c3e40af9baa782f6b7503e4b59b4c2256a152ca 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc @@ -44,20 +44,20 @@ dcl_texcoord1 v1 // vin<4,5> dcl_texcoord2 v2 // vin<6,7> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSDualTextureNoFog<10> dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 48 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 48 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSDualTextureNoFog<8,9> mov oPos.w, r0.z // ::VSDualTextureNoFog<11> -#line 44 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 44 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT0, c1 // ::VSDualTextureNoFog<0,1,2,3> -#line 55 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 55 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mov oT1.xy, v1 // ::VSDualTextureNoFog<4,5> mov oT1.zw, v2.xyyx // ::VSDualTextureNoFog<7,6> @@ -84,17 +84,17 @@ ret const BYTE DualTextureEffect_VSDualTextureNoFog[] = { - 68, 88, 66, 67, 226, 38, - 56, 142, 173, 71, 126, 81, - 49, 0, 70, 146, 32, 177, - 75, 62, 1, 0, 0, 0, - 192, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 166, 141, + 11, 90, 163, 166, 184, 17, + 39, 78, 75, 205, 118, 225, + 189, 206, 1, 0, 0, 0, + 204, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 136, 4, 0, 0, 196, 5, - 0, 0, 52, 6, 0, 0, - 65, 111, 110, 57, 80, 4, - 0, 0, 80, 4, 0, 0, - 0, 2, 254, 255, 16, 4, + 148, 4, 0, 0, 208, 5, + 0, 0, 64, 6, 0, 0, + 65, 111, 110, 57, 92, 4, + 0, 0, 92, 4, 0, 0, + 0, 2, 254, 255, 28, 4, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -105,14 +105,14 @@ const BYTE DualTextureEffect_VSDualTextureNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 215, 0, 68, 66, 85, 71, + 218, 0, 68, 66, 85, 71, 40, 0, 0, 0, 48, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 12, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 244, 2, 0, 0, - 40, 1, 0, 0, 67, 58, + 40, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -124,7 +124,7 @@ const BYTE DualTextureEffect_VSDualTextureNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -140,21 +140,21 @@ const BYTE DualTextureEffect_VSDualTextureNoFog[] = 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 100, 3, 0, 0, 0, 0, - 255, 255, 112, 3, 0, 0, - 0, 0, 255, 255, 124, 3, + 112, 3, 0, 0, 0, 0, + 255, 255, 124, 3, 0, 0, + 0, 0, 255, 255, 136, 3, 0, 0, 43, 0, 0, 0, - 136, 3, 0, 0, 43, 0, - 0, 0, 152, 3, 0, 0, - 43, 0, 0, 0, 168, 3, + 148, 3, 0, 0, 43, 0, + 0, 0, 164, 3, 0, 0, + 43, 0, 0, 0, 180, 3, 0, 0, 43, 0, 0, 0, - 184, 3, 0, 0, 48, 0, - 1, 0, 200, 3, 0, 0, - 48, 0, 1, 0, 220, 3, + 196, 3, 0, 0, 48, 0, + 1, 0, 212, 3, 0, 0, + 48, 0, 1, 0, 232, 3, 0, 0, 44, 0, 0, 0, - 232, 3, 0, 0, 55, 0, - 1, 0, 244, 3, 0, 0, - 55, 0, 1, 0, 0, 4, + 244, 3, 0, 0, 55, 0, + 1, 0, 0, 4, 0, 0, + 55, 0, 1, 0, 12, 4, 0, 0, 86, 83, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 78, 111, 70, @@ -248,7 +248,9 @@ const BYTE DualTextureEffect_VSDualTextureNoFog[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc index e325c8e5b2720eb176b727b2dd9007bb8bb1a027..81866a7c7fda1b15abb3986b576ecd025fa2b7b4 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc @@ -48,7 +48,7 @@ dcl_texcoord2 v2 // vin<6,7> dcl_texcoord3 v3 // vin<8,9,10,11> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c5 // ::VSDualTextureVc<14> #line 14 @@ -56,22 +56,22 @@ max r0.x, r0.x, c7.x min oT1.w, r0.x, c7.y // ::VSDualTextureVc<7> -#line 72 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 72 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mul oT0, v3, c1 // ::VSDualTextureVc<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c3 // ::vout<0> dp4 r0.y, v0, c4 // ::vout<1> dp4 r0.z, v0, c6 // ::vout<3> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSDualTextureVc<12,13> mov oPos.w, r0.z // ::VSDualTextureVc<15> -#line 45 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 45 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mov oT1.xyz, c7.x // ::VSDualTextureVc<4,5,6> -#line 70 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 70 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mov oT2.xy, v1 // ::VSDualTextureVc<8,9> mov oT2.zw, v2.xyyx // ::VSDualTextureVc<11,10> @@ -102,17 +102,17 @@ ret const BYTE DualTextureEffect_VSDualTextureVc[] = { - 68, 88, 66, 67, 23, 20, - 57, 133, 81, 250, 177, 30, - 147, 64, 150, 199, 71, 109, - 18, 136, 1, 0, 0, 0, - 24, 8, 0, 0, 4, 0, + 68, 88, 66, 67, 106, 148, + 169, 17, 179, 79, 235, 146, + 88, 5, 112, 244, 5, 163, + 192, 80, 1, 0, 0, 0, + 36, 8, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 76, 5, 0, 0, 232, 6, - 0, 0, 116, 7, 0, 0, - 65, 111, 110, 57, 20, 5, - 0, 0, 20, 5, 0, 0, - 0, 2, 254, 255, 212, 4, + 88, 5, 0, 0, 244, 6, + 0, 0, 128, 7, 0, 0, + 65, 111, 110, 57, 32, 5, + 0, 0, 32, 5, 0, 0, + 0, 2, 254, 255, 224, 4, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -123,14 +123,14 @@ const BYTE DualTextureEffect_VSDualTextureVc[] = 5, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 239, 0, 68, 66, 85, 71, + 242, 0, 68, 66, 85, 71, 40, 0, 0, 0, 144, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 18, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 84, 3, 0, 0, - 88, 1, 0, 0, 67, 58, + 88, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -142,7 +142,7 @@ const BYTE DualTextureEffect_VSDualTextureVc[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -158,29 +158,29 @@ const BYTE DualTextureEffect_VSDualTextureVc[] = 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 196, 3, 0, 0, 0, 0, - 255, 255, 220, 3, 0, 0, - 0, 0, 255, 255, 232, 3, + 208, 3, 0, 0, 0, 0, + 255, 255, 232, 3, 0, 0, + 0, 0, 255, 255, 244, 3, 0, 0, 0, 0, 255, 255, - 244, 3, 0, 0, 0, 0, - 255, 255, 0, 4, 0, 0, - 43, 0, 0, 0, 12, 4, + 0, 4, 0, 0, 0, 0, + 255, 255, 12, 4, 0, 0, + 43, 0, 0, 0, 24, 4, 0, 0, 14, 0, 0, 0, - 28, 4, 0, 0, 14, 0, - 0, 0, 44, 4, 0, 0, - 14, 0, 0, 0, 60, 4, + 40, 4, 0, 0, 14, 0, + 0, 0, 56, 4, 0, 0, + 14, 0, 0, 0, 72, 4, 0, 0, 72, 0, 1, 0, - 76, 4, 0, 0, 43, 0, - 0, 0, 92, 4, 0, 0, - 43, 0, 0, 0, 108, 4, + 88, 4, 0, 0, 43, 0, + 0, 0, 104, 4, 0, 0, + 43, 0, 0, 0, 120, 4, 0, 0, 43, 0, 0, 0, - 124, 4, 0, 0, 63, 0, - 1, 0, 140, 4, 0, 0, - 63, 0, 1, 0, 160, 4, + 136, 4, 0, 0, 63, 0, + 1, 0, 152, 4, 0, 0, + 63, 0, 1, 0, 172, 4, 0, 0, 45, 0, 0, 0, - 172, 4, 0, 0, 70, 0, - 1, 0, 184, 4, 0, 0, - 70, 0, 1, 0, 196, 4, + 184, 4, 0, 0, 70, 0, + 1, 0, 196, 4, 0, 0, + 70, 0, 1, 0, 208, 4, 0, 0, 86, 83, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 86, 99, 0, @@ -282,7 +282,9 @@ const BYTE DualTextureEffect_VSDualTextureVc[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 7, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc index a9ee839962b6023a63d4c18619973bd26570afd3..04774e94fd3dc04c534a5cdb18d08e6221394bed 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc @@ -46,18 +46,18 @@ dcl_texcoord2 v2 // vin<6,7> dcl_texcoord3 v3 // vin<8,9,10,11> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 oPos.z, v0, c4 // ::VSDualTextureVcNoFog<10> -#line 88 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 88 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mul oT0, v3, c1 // ::VSDualTextureVcNoFog<0,1,2,3> -#line 43 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 43 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c2 // ::vout<0> dp4 r0.y, v0, c3 // ::vout<1> dp4 r0.z, v0, c5 // ::vout<3> -#line 79 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" +#line 79 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\DualTextureEffect.fx" mad oPos.xy, r0.z, c0, r0 // ::VSDualTextureVcNoFog<8,9> mov oPos.w, r0.z // ::VSDualTextureVcNoFog<11> @@ -89,17 +89,17 @@ ret const BYTE DualTextureEffect_VSDualTextureVcNoFog[] = { - 68, 88, 66, 67, 48, 59, - 151, 148, 181, 214, 129, 185, - 85, 40, 102, 178, 177, 247, - 49, 227, 1, 0, 0, 0, - 36, 7, 0, 0, 4, 0, + 68, 88, 66, 67, 83, 34, + 138, 82, 24, 200, 234, 134, + 143, 249, 9, 117, 84, 240, + 49, 183, 1, 0, 0, 0, + 48, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 188, 4, 0, 0, 12, 6, - 0, 0, 152, 6, 0, 0, - 65, 111, 110, 57, 132, 4, - 0, 0, 132, 4, 0, 0, - 0, 2, 254, 255, 68, 4, + 200, 4, 0, 0, 24, 6, + 0, 0, 164, 6, 0, 0, + 65, 111, 110, 57, 144, 4, + 0, 0, 144, 4, 0, 0, + 0, 2, 254, 255, 80, 4, 0, 0, 64, 0, 0, 0, 2, 0, 36, 0, 0, 0, 60, 0, 0, 0, 60, 0, @@ -110,14 +110,14 @@ const BYTE DualTextureEffect_VSDualTextureVcNoFog[] = 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 224, 0, 68, 66, 85, 71, + 227, 0, 68, 66, 85, 71, 40, 0, 0, 0, 84, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 13, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0, 0, 24, 3, 0, 0, - 48, 1, 0, 0, 67, 58, + 48, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -129,7 +129,7 @@ const BYTE DualTextureEffect_VSDualTextureVcNoFog[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, - 120, 104, 0, 67, 58, 92, + 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -145,23 +145,23 @@ const BYTE DualTextureEffect_VSDualTextureVcNoFog[] = 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, 111, 0, 0, 0, 0, 0, 255, 255, - 136, 3, 0, 0, 0, 0, - 255, 255, 148, 3, 0, 0, - 0, 0, 255, 255, 160, 3, + 148, 3, 0, 0, 0, 0, + 255, 255, 160, 3, 0, 0, + 0, 0, 255, 255, 172, 3, 0, 0, 0, 0, 255, 255, - 172, 3, 0, 0, 43, 0, - 0, 0, 184, 3, 0, 0, - 88, 0, 1, 0, 200, 3, + 184, 3, 0, 0, 43, 0, + 0, 0, 196, 3, 0, 0, + 88, 0, 1, 0, 212, 3, 0, 0, 43, 0, 0, 0, - 216, 3, 0, 0, 43, 0, - 0, 0, 232, 3, 0, 0, - 43, 0, 0, 0, 248, 3, + 228, 3, 0, 0, 43, 0, + 0, 0, 244, 3, 0, 0, + 43, 0, 0, 0, 4, 4, 0, 0, 79, 0, 1, 0, - 8, 4, 0, 0, 79, 0, - 1, 0, 28, 4, 0, 0, - 86, 0, 1, 0, 40, 4, + 20, 4, 0, 0, 79, 0, + 1, 0, 40, 4, 0, 0, + 86, 0, 1, 0, 52, 4, 0, 0, 86, 0, 1, 0, - 52, 4, 0, 0, 86, 83, + 64, 4, 0, 0, 86, 83, 68, 117, 97, 108, 84, 101, 120, 116, 117, 114, 101, 86, 99, 78, 111, 70, 111, 103, @@ -259,7 +259,9 @@ const BYTE DualTextureEffect_VSDualTextureVcNoFog[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc index 5ae2b1daf2333b79d391177cdb3740f8c8b4d3a4..58f0fa0903e7dd2ef1ff99aac1dad12a26bff3db 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc @@ -45,7 +45,7 @@ dcl_2d s0 dcl_cube s1 -#line 119 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 119 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" texld r0, t3, s1 texld r1, t2, s0 mul r1, r1, t0 // ::color<0,1,2,3> @@ -54,7 +54,7 @@ mad r0.xyz, r0, r1.w, -r1 mad r0.xyz, t1, r0, r1 // ::color<0,1,2> -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r2.xyz, c0, r1.w, -r0 mad r1.xyz, t1.w, r2, r0 // ApplyFog::color<0,1,2> mov oC0, r1 // ::PSEnvMap<0,1,2,3> @@ -86,17 +86,17 @@ ret const BYTE EnvironmentMapEffect_PSEnvMap[] = { - 68, 88, 66, 67, 249, 64, - 205, 226, 17, 105, 132, 168, - 201, 219, 42, 31, 200, 38, - 157, 247, 1, 0, 0, 0, - 136, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 177, 158, + 75, 63, 79, 76, 68, 211, + 60, 87, 84, 236, 162, 23, + 139, 200, 1, 0, 0, 0, + 148, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 32, 4, 0, 0, 212, 5, - 0, 0, 84, 6, 0, 0, - 65, 111, 110, 57, 232, 3, - 0, 0, 232, 3, 0, 0, - 0, 2, 255, 255, 176, 3, + 44, 4, 0, 0, 224, 5, + 0, 0, 96, 6, 0, 0, + 65, 111, 110, 57, 244, 3, + 0, 0, 244, 3, 0, 0, + 0, 2, 255, 255, 188, 3, 0, 0, 56, 0, 0, 0, 1, 0, 44, 0, 0, 0, 56, 0, 0, 0, 56, 0, @@ -105,7 +105,7 @@ const BYTE EnvironmentMapEffect_PSEnvMap[] = 1, 1, 1, 0, 0, 0, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 255, 255, 254, 255, 180, 0, + 255, 255, 254, 255, 183, 0, 68, 66, 85, 71, 40, 0, 0, 0, 164, 2, 0, 0, 0, 0, 0, 0, 2, 0, @@ -113,7 +113,7 @@ const BYTE EnvironmentMapEffect_PSEnvMap[] = 14, 0, 0, 0, 204, 0, 0, 0, 4, 0, 0, 0, 84, 2, 0, 0, 60, 1, - 0, 0, 67, 58, 92, 65, + 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -127,7 +127,7 @@ const BYTE EnvironmentMapEffect_PSEnvMap[] = 114, 111, 110, 109, 101, 110, 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, 46, 102, - 120, 0, 67, 58, 92, 65, + 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -141,24 +141,24 @@ const BYTE EnvironmentMapEffect_PSEnvMap[] = 111, 110, 46, 102, 120, 104, 0, 171, 40, 0, 0, 0, 124, 0, 0, 0, 0, 0, - 255, 255, 216, 2, 0, 0, - 0, 0, 255, 255, 228, 2, + 255, 255, 228, 2, 0, 0, + 0, 0, 255, 255, 240, 2, 0, 0, 0, 0, 255, 255, - 240, 2, 0, 0, 0, 0, - 255, 255, 252, 2, 0, 0, - 0, 0, 255, 255, 8, 3, + 252, 2, 0, 0, 0, 0, + 255, 255, 8, 3, 0, 0, + 0, 0, 255, 255, 20, 3, 0, 0, 0, 0, 255, 255, - 20, 3, 0, 0, 119, 0, - 0, 0, 32, 3, 0, 0, - 118, 0, 0, 0, 48, 3, + 32, 3, 0, 0, 119, 0, + 0, 0, 44, 3, 0, 0, + 118, 0, 0, 0, 60, 3, 0, 0, 118, 0, 0, 0, - 64, 3, 0, 0, 121, 0, - 0, 0, 80, 3, 0, 0, - 121, 0, 0, 0, 100, 3, + 76, 3, 0, 0, 121, 0, + 0, 0, 92, 3, 0, 0, + 121, 0, 0, 0, 112, 3, 0, 0, 20, 0, 1, 0, - 120, 3, 0, 0, 20, 0, - 1, 0, 140, 3, 0, 0, - 20, 0, 1, 0, 160, 3, + 132, 3, 0, 0, 20, 0, + 1, 0, 152, 3, 0, 0, + 20, 0, 1, 0, 172, 3, 0, 0, 80, 83, 69, 110, 118, 77, 97, 112, 0, 171, 171, 171, 1, 0, 3, 0, @@ -225,7 +225,9 @@ const BYTE EnvironmentMapEffect_PSEnvMap[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc index eb694541e4d3794815980412b792a99bc3078e43..10125849930660921a2d49147ef22bb11dc31aab 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc @@ -38,7 +38,7 @@ dcl_2d s0 dcl_cube s1 -#line 133 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 133 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" texld r0, t3, s1 texld r1, t2, s0 mul r1, r1, t0 // ::color<0,1,2,3> @@ -72,24 +72,24 @@ ret const BYTE EnvironmentMapEffect_PSEnvMapNoFog[] = { - 68, 88, 66, 67, 78, 221, - 166, 19, 205, 36, 156, 195, - 209, 43, 31, 5, 92, 24, - 27, 50, 1, 0, 0, 0, - 116, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 58, 42, + 65, 245, 188, 132, 226, 215, + 14, 184, 178, 36, 242, 162, + 41, 157, 1, 0, 0, 0, + 128, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 108, 3, 0, 0, 192, 4, - 0, 0, 64, 5, 0, 0, - 65, 111, 110, 57, 52, 3, - 0, 0, 52, 3, 0, 0, - 0, 2, 255, 255, 8, 3, + 120, 3, 0, 0, 204, 4, + 0, 0, 76, 5, 0, 0, + 65, 111, 110, 57, 64, 3, + 0, 0, 64, 3, 0, 0, + 0, 2, 255, 255, 20, 3, 0, 0, 44, 0, 0, 0, 0, 0, 44, 0, 0, 0, 44, 0, 0, 0, 44, 0, 2, 0, 36, 0, 0, 0, 44, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, - 255, 255, 254, 255, 148, 0, + 255, 255, 254, 255, 151, 0, 68, 66, 85, 71, 40, 0, 0, 0, 36, 2, 0, 0, 0, 0, 0, 0, 1, 0, @@ -97,7 +97,7 @@ const BYTE EnvironmentMapEffect_PSEnvMapNoFog[] = 12, 0, 0, 0, 128, 0, 0, 0, 3, 0, 0, 0, 232, 1, 0, 0, 224, 0, - 0, 0, 67, 58, 92, 65, + 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -112,22 +112,22 @@ const BYTE EnvironmentMapEffect_PSEnvMapNoFog[] = 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, - 0, 0, 255, 255, 88, 2, + 0, 0, 255, 255, 100, 2, 0, 0, 0, 0, 255, 255, - 100, 2, 0, 0, 0, 0, - 255, 255, 112, 2, 0, 0, - 0, 0, 255, 255, 124, 2, + 112, 2, 0, 0, 0, 0, + 255, 255, 124, 2, 0, 0, + 0, 0, 255, 255, 136, 2, 0, 0, 0, 0, 255, 255, - 136, 2, 0, 0, 0, 0, - 255, 255, 148, 2, 0, 0, - 133, 0, 0, 0, 160, 2, + 148, 2, 0, 0, 0, 0, + 255, 255, 160, 2, 0, 0, + 133, 0, 0, 0, 172, 2, 0, 0, 132, 0, 0, 0, - 176, 2, 0, 0, 132, 0, - 0, 0, 192, 2, 0, 0, - 135, 0, 0, 0, 208, 2, + 188, 2, 0, 0, 132, 0, + 0, 0, 204, 2, 0, 0, + 135, 0, 0, 0, 220, 2, 0, 0, 135, 0, 0, 0, - 228, 2, 0, 0, 135, 0, - 0, 0, 248, 2, 0, 0, + 240, 2, 0, 0, 135, 0, + 0, 0, 4, 3, 0, 0, 80, 83, 69, 110, 118, 77, 97, 112, 78, 111, 70, 111, 103, 0, 171, 171, 1, 0, @@ -188,7 +188,9 @@ const BYTE EnvironmentMapEffect_PSEnvMapNoFog[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc index 3403f7a2f010af56fbb610fc77d4ca8bb9810217..10a67838dabf885851815a45822074b09c73e826 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc @@ -46,7 +46,7 @@ dcl_2d s0 dcl_cube s1 -#line 145 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 145 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" texld r0, t3, s1 texld r1, t2, s0 mul r1, r1, t0 // ::color<0,1,2,3> @@ -57,7 +57,7 @@ mad r0.xyz, t1, r0, r1 // ::color<0,1,2> mad r0.xyz, c0, r0.w, r0 // ::color<0,1,2> -#line 20 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 20 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r2.xyz, c1, r1.w, -r0 mad r1.xyz, t1.w, r2, r0 // ApplyFog::color<0,1,2> mov oC0, r1 // ::PSEnvMapSpecular<0,1,2,3> @@ -91,17 +91,17 @@ ret const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = { - 68, 88, 66, 67, 42, 23, - 166, 79, 167, 173, 59, 45, - 21, 59, 137, 29, 86, 104, - 179, 112, 1, 0, 0, 0, - 72, 7, 0, 0, 4, 0, + 68, 88, 66, 67, 153, 70, + 64, 29, 2, 230, 217, 33, + 179, 118, 80, 7, 144, 187, + 164, 92, 1, 0, 0, 0, + 84, 7, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 156, 4, 0, 0, 148, 6, - 0, 0, 20, 7, 0, 0, - 65, 111, 110, 57, 100, 4, - 0, 0, 100, 4, 0, 0, - 0, 2, 255, 255, 32, 4, + 168, 4, 0, 0, 160, 6, + 0, 0, 32, 7, 0, 0, + 65, 111, 110, 57, 112, 4, + 0, 0, 112, 4, 0, 0, + 0, 2, 255, 255, 44, 4, 0, 0, 68, 0, 0, 0, 2, 0, 44, 0, 0, 0, 68, 0, 0, 0, 68, 0, @@ -112,7 +112,7 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = 0, 0, 0, 0, 0, 0, 11, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 2, - 255, 255, 254, 255, 199, 0, + 255, 255, 254, 255, 202, 0, 68, 66, 85, 71, 40, 0, 0, 0, 240, 2, 0, 0, 0, 0, 0, 0, 2, 0, @@ -120,7 +120,7 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = 16, 0, 0, 0, 204, 0, 0, 0, 5, 0, 0, 0, 140, 2, 0, 0, 76, 1, - 0, 0, 67, 58, 92, 65, + 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -134,7 +134,7 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = 114, 111, 110, 109, 101, 110, 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, 46, 102, - 120, 0, 67, 58, 92, 65, + 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -148,27 +148,27 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = 111, 110, 46, 102, 120, 104, 0, 171, 40, 0, 0, 0, 124, 0, 0, 0, 0, 0, - 255, 255, 36, 3, 0, 0, - 0, 0, 255, 255, 48, 3, + 255, 255, 48, 3, 0, 0, + 0, 0, 255, 255, 60, 3, 0, 0, 0, 0, 255, 255, - 60, 3, 0, 0, 0, 0, - 255, 255, 72, 3, 0, 0, - 0, 0, 255, 255, 84, 3, + 72, 3, 0, 0, 0, 0, + 255, 255, 84, 3, 0, 0, + 0, 0, 255, 255, 96, 3, 0, 0, 0, 0, 255, 255, - 96, 3, 0, 0, 145, 0, - 0, 0, 108, 3, 0, 0, - 144, 0, 0, 0, 124, 3, + 108, 3, 0, 0, 145, 0, + 0, 0, 120, 3, 0, 0, + 144, 0, 0, 0, 136, 3, 0, 0, 144, 0, 0, 0, - 140, 3, 0, 0, 147, 0, - 0, 0, 156, 3, 0, 0, - 145, 0, 0, 0, 176, 3, + 152, 3, 0, 0, 147, 0, + 0, 0, 168, 3, 0, 0, + 145, 0, 0, 0, 188, 3, 0, 0, 147, 0, 0, 0, - 192, 3, 0, 0, 148, 0, - 0, 0, 212, 3, 0, 0, - 20, 0, 1, 0, 232, 3, + 204, 3, 0, 0, 148, 0, + 0, 0, 224, 3, 0, 0, + 20, 0, 1, 0, 244, 3, 0, 0, 20, 0, 1, 0, - 252, 3, 0, 0, 20, 0, - 1, 0, 16, 4, 0, 0, + 8, 4, 0, 0, 20, 0, + 1, 0, 28, 4, 0, 0, 80, 83, 69, 110, 118, 77, 97, 112, 83, 112, 101, 99, 117, 108, 97, 114, 0, 171, @@ -245,7 +245,9 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 31, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc index 3fe78386988be2a0a024dc13463b00998511e505..b4b0e425328b75db879c74a4e78a22721bb27276 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc @@ -45,7 +45,7 @@ dcl_2d s0 dcl_cube s1 -#line 160 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 160 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" texld r0, t3, s1 texld r1, t2, s0 mul r1, r1, t0 // ::color<0,1,2,3> @@ -84,17 +84,17 @@ ret const BYTE EnvironmentMapEffect_PSEnvMapSpecularNoFog[] = { - 68, 88, 66, 67, 200, 148, - 20, 147, 120, 122, 183, 154, - 225, 8, 208, 18, 28, 171, - 65, 163, 1, 0, 0, 0, - 68, 6, 0, 0, 4, 0, + 68, 88, 66, 67, 139, 134, + 181, 113, 33, 141, 211, 99, + 191, 226, 235, 126, 77, 74, + 49, 187, 1, 0, 0, 0, + 80, 6, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 232, 3, 0, 0, 144, 5, - 0, 0, 16, 6, 0, 0, - 65, 111, 110, 57, 176, 3, - 0, 0, 176, 3, 0, 0, - 0, 2, 255, 255, 120, 3, + 244, 3, 0, 0, 156, 5, + 0, 0, 28, 6, 0, 0, + 65, 111, 110, 57, 188, 3, + 0, 0, 188, 3, 0, 0, + 0, 2, 255, 255, 132, 3, 0, 0, 56, 0, 0, 0, 1, 0, 44, 0, 0, 0, 56, 0, 0, 0, 56, 0, @@ -103,7 +103,7 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecularNoFog[] = 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 255, 255, 254, 255, 167, 0, + 255, 255, 254, 255, 170, 0, 68, 66, 85, 71, 40, 0, 0, 0, 112, 2, 0, 0, 0, 0, 0, 0, 1, 0, @@ -111,7 +111,7 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecularNoFog[] = 14, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 32, 2, 0, 0, 240, 0, - 0, 0, 67, 58, 92, 65, + 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, 109, @@ -126,25 +126,25 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecularNoFog[] = 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, - 0, 0, 255, 255, 164, 2, + 0, 0, 255, 255, 176, 2, 0, 0, 0, 0, 255, 255, - 176, 2, 0, 0, 0, 0, - 255, 255, 188, 2, 0, 0, - 0, 0, 255, 255, 200, 2, + 188, 2, 0, 0, 0, 0, + 255, 255, 200, 2, 0, 0, + 0, 0, 255, 255, 212, 2, 0, 0, 0, 0, 255, 255, - 212, 2, 0, 0, 0, 0, - 255, 255, 224, 2, 0, 0, - 160, 0, 0, 0, 236, 2, + 224, 2, 0, 0, 0, 0, + 255, 255, 236, 2, 0, 0, + 160, 0, 0, 0, 248, 2, 0, 0, 159, 0, 0, 0, - 252, 2, 0, 0, 159, 0, - 0, 0, 12, 3, 0, 0, - 162, 0, 0, 0, 28, 3, + 8, 3, 0, 0, 159, 0, + 0, 0, 24, 3, 0, 0, + 162, 0, 0, 0, 40, 3, 0, 0, 160, 0, 0, 0, - 48, 3, 0, 0, 162, 0, - 0, 0, 64, 3, 0, 0, - 163, 0, 0, 0, 84, 3, + 60, 3, 0, 0, 162, 0, + 0, 0, 76, 3, 0, 0, + 163, 0, 0, 0, 96, 3, 0, 0, 163, 0, 0, 0, - 104, 3, 0, 0, 80, 83, + 116, 3, 0, 0, 80, 83, 69, 110, 118, 77, 97, 112, 83, 112, 101, 99, 117, 108, 97, 114, 78, 111, 70, 111, @@ -215,7 +215,9 @@ const BYTE EnvironmentMapEffect_PSEnvMapSpecularNoFog[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc index 09c6b0348b3fcd73f62fa65a92ef0e956e36cf12..4e62d0adf1c392cca091b28431c41fb1bf4cb41f 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc @@ -47,13 +47,13 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 67 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 67 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp3 r0.x, v1, c15 dp3 r0.y, v1, c16 dp3 r0.z, v1, c17 nrm r1.xyz, r0 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, -c4, r1 // ::dotL<0> dp3 r0.y, -c5, r1 // ::dotL<1> dp3 r0.z, -c6, r1 // ::dotL<2> @@ -69,15 +69,15 @@ mov r2.xyz, c2 // Parameters::DiffuseColor<0,1,2> mad oT0.xyz, r0, r2, c3 // ::VSEnvMap<0,1,2> -#line 71 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 71 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp4 oPos.z, v0, c20 // ::VSEnvMap<15> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c11 max r0.x, r0.x, c22.x min oT1.w, r0.x, c22.y // ::VSEnvMap<7> -#line 65 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 65 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp4 r0.x, v0, c12 // ::pos_ws<0> dp4 r0.y, v0, c13 // ::pos_ws<1> dp4 r0.z, v0, c14 // ::pos_ws<2> @@ -98,10 +98,10 @@ mad oPos.xy, r0.z, c0, r0 // ::VSEnvMap<13,14> mov oPos.w, r0.z // ::VSEnvMap<16> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c2.w // ::VSEnvMap<3> -#line 77 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 77 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" mov oT1.xyz, c1.x // ::VSEnvMap<4,5,6> #line 90 @@ -159,17 +159,17 @@ ret const BYTE EnvironmentMapEffect_VSEnvMap[] = { - 68, 88, 66, 67, 101, 124, - 44, 126, 5, 169, 99, 18, - 224, 136, 152, 151, 55, 62, - 154, 235, 1, 0, 0, 0, - 152, 14, 0, 0, 4, 0, + 68, 88, 66, 67, 19, 121, + 10, 102, 94, 99, 77, 158, + 27, 223, 218, 240, 76, 135, + 126, 227, 1, 0, 0, 0, + 164, 14, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 180, 8, 0, 0, 128, 13, - 0, 0, 244, 13, 0, 0, - 65, 111, 110, 57, 124, 8, - 0, 0, 124, 8, 0, 0, - 0, 2, 254, 255, 48, 8, + 192, 8, 0, 0, 140, 13, + 0, 0, 0, 14, 0, 0, + 65, 111, 110, 57, 136, 8, + 0, 0, 136, 8, 0, 0, + 0, 2, 254, 255, 60, 8, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -182,14 +182,14 @@ const BYTE EnvironmentMapEffect_VSEnvMap[] = 7, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 116, 1, 68, 66, 85, 71, + 119, 1, 68, 66, 85, 71, 40, 0, 0, 0, 164, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 12, 1, 0, 0, 38, 0, 0, 0, 24, 1, 0, 0, 10, 0, 0, 0, 220, 4, 0, 0, - 124, 2, 0, 0, 67, 58, + 124, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -203,7 +203,7 @@ const BYTE EnvironmentMapEffect_VSEnvMap[] = 118, 105, 114, 111, 110, 109, 101, 110, 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, - 46, 102, 120, 0, 67, 58, + 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -215,7 +215,7 @@ const BYTE EnvironmentMapEffect_VSEnvMap[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -230,56 +230,56 @@ const BYTE EnvironmentMapEffect_VSEnvMap[] = 102, 120, 104, 0, 40, 0, 0, 0, 124, 0, 0, 0, 197, 0, 0, 0, 0, 0, - 255, 255, 216, 5, 0, 0, - 0, 0, 255, 255, 240, 5, + 255, 255, 228, 5, 0, 0, + 0, 0, 255, 255, 252, 5, 0, 0, 0, 0, 255, 255, - 252, 5, 0, 0, 0, 0, - 255, 255, 8, 6, 0, 0, - 67, 0, 0, 0, 20, 6, + 8, 6, 0, 0, 0, 0, + 255, 255, 20, 6, 0, 0, + 67, 0, 0, 0, 32, 6, 0, 0, 67, 0, 0, 0, - 36, 6, 0, 0, 67, 0, - 0, 0, 52, 6, 0, 0, - 67, 0, 0, 0, 68, 6, + 48, 6, 0, 0, 67, 0, + 0, 0, 64, 6, 0, 0, + 67, 0, 0, 0, 80, 6, 0, 0, 36, 0, 1, 0, - 80, 6, 0, 0, 36, 0, - 1, 0, 96, 6, 0, 0, - 36, 0, 1, 0, 112, 6, + 92, 6, 0, 0, 36, 0, + 1, 0, 108, 6, 0, 0, + 36, 0, 1, 0, 124, 6, 0, 0, 39, 0, 1, 0, - 128, 6, 0, 0, 41, 0, - 1, 0, 144, 6, 0, 0, - 46, 0, 1, 0, 160, 6, + 140, 6, 0, 0, 41, 0, + 1, 0, 156, 6, 0, 0, + 46, 0, 1, 0, 172, 6, 0, 0, 46, 0, 1, 0, - 176, 6, 0, 0, 46, 0, - 1, 0, 196, 6, 0, 0, - 46, 0, 1, 0, 216, 6, + 188, 6, 0, 0, 46, 0, + 1, 0, 208, 6, 0, 0, + 46, 0, 1, 0, 228, 6, 0, 0, 46, 0, 1, 0, - 228, 6, 0, 0, 71, 0, - 0, 0, 248, 6, 0, 0, - 14, 0, 2, 0, 8, 7, + 240, 6, 0, 0, 71, 0, + 0, 0, 4, 7, 0, 0, + 14, 0, 2, 0, 20, 7, 0, 0, 14, 0, 2, 0, - 24, 7, 0, 0, 14, 0, - 2, 0, 40, 7, 0, 0, - 65, 0, 0, 0, 56, 7, + 36, 7, 0, 0, 14, 0, + 2, 0, 52, 7, 0, 0, + 65, 0, 0, 0, 68, 7, 0, 0, 65, 0, 0, 0, - 72, 7, 0, 0, 65, 0, - 0, 0, 88, 7, 0, 0, - 66, 0, 0, 0, 104, 7, + 84, 7, 0, 0, 65, 0, + 0, 0, 100, 7, 0, 0, + 66, 0, 0, 0, 116, 7, 0, 0, 66, 0, 0, 0, - 120, 7, 0, 0, 81, 0, - 0, 0, 132, 7, 0, 0, - 81, 0, 0, 0, 148, 7, + 132, 7, 0, 0, 81, 0, + 0, 0, 144, 7, 0, 0, + 81, 0, 0, 0, 160, 7, 0, 0, 81, 0, 0, 0, - 164, 7, 0, 0, 71, 0, - 0, 0, 184, 7, 0, 0, - 71, 0, 0, 0, 200, 7, + 176, 7, 0, 0, 71, 0, + 0, 0, 196, 7, 0, 0, + 71, 0, 0, 0, 212, 7, 0, 0, 71, 0, 0, 0, - 216, 7, 0, 0, 88, 0, - 0, 0, 232, 7, 0, 0, - 88, 0, 0, 0, 252, 7, + 228, 7, 0, 0, 88, 0, + 0, 0, 244, 7, 0, 0, + 88, 0, 0, 0, 8, 8, 0, 0, 46, 0, 1, 0, - 8, 8, 0, 0, 77, 0, - 0, 0, 20, 8, 0, 0, - 90, 0, 0, 0, 32, 8, + 20, 8, 0, 0, 77, 0, + 0, 0, 32, 8, 0, 0, + 90, 0, 0, 0, 44, 8, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -430,7 +430,9 @@ const BYTE EnvironmentMapEffect_VSEnvMap[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 22, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc index 9aeb1aa3f4915dad78fc6a4f33039afdba7999e8..3a098c4772765dd79f174b0c254e3265c2de10d8 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc @@ -47,13 +47,13 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 67 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 67 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp3 r0.x, v1, c15 dp3 r0.y, v1, c16 dp3 r0.z, v1, c17 nrm r1.xyz, r0 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, -c4, r1 // ::dotL<0> dp3 r0.y, -c5, r1 // ::dotL<1> dp3 r0.z, -c6, r1 // ::dotL<2> @@ -69,7 +69,7 @@ mov r2.xyz, c2 // Parameters::DiffuseColor<0,1,2> mad oT0.xyz, r0, r2, c3 // ::VSEnvMapFresnel<0,1,2> -#line 71 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 71 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp4 oPos.z, v0, c20 // ::VSEnvMapFresnel<15> #line 65 @@ -87,12 +87,12 @@ pow r1.w, r0.x, c1.y mul oT1.xyz, r1.w, c1.x // ::VSEnvMapFresnel<4,5,6> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c11 max r0.x, r0.x, c22.x min oT1.w, r0.x, c22.y // ::VSEnvMapFresnel<7> -#line 81 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 81 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp3 r0.x, -r2, r1 add r0.x, r0.x, r0.x mad oT3.xyz, r1, -r0.x, -r2 // ::VSEnvMapFresnel<10,11,12> @@ -106,10 +106,10 @@ mad oPos.xy, r0.z, c0, r0 // ::VSEnvMapFresnel<13,14> mov oPos.w, r0.z // ::VSEnvMapFresnel<16> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c2.w // ::VSEnvMapFresnel<3> -#line 97 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 97 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" mov oT2.xy, v2 // ::VSEnvMapFresnel<8,9> // approximately 45 instruction slots used @@ -170,17 +170,17 @@ ret const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = { - 68, 88, 66, 67, 43, 68, - 199, 144, 184, 216, 16, 13, - 30, 112, 195, 220, 61, 145, - 135, 163, 1, 0, 0, 0, - 248, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 253, 9, + 198, 68, 184, 146, 237, 51, + 12, 158, 144, 224, 197, 229, + 123, 5, 1, 0, 0, 0, + 4, 16, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 108, 9, 0, 0, 224, 14, - 0, 0, 84, 15, 0, 0, - 65, 111, 110, 57, 52, 9, - 0, 0, 52, 9, 0, 0, - 0, 2, 254, 255, 232, 8, + 120, 9, 0, 0, 236, 14, + 0, 0, 96, 15, 0, 0, + 65, 111, 110, 57, 64, 9, + 0, 0, 64, 9, 0, 0, + 0, 2, 254, 255, 244, 8, 0, 0, 76, 0, 0, 0, 3, 0, 36, 0, 0, 0, 72, 0, 0, 0, 72, 0, @@ -193,14 +193,14 @@ const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = 7, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 142, 1, 68, 66, 85, 71, + 145, 1, 68, 66, 85, 71, 40, 0, 0, 0, 12, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 12, 1, 0, 0, 43, 0, 0, 0, 24, 1, 0, 0, 11, 0, 0, 0, 48, 5, 0, 0, - 164, 2, 0, 0, 67, 58, + 164, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -214,7 +214,7 @@ const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = 118, 105, 114, 111, 110, 109, 101, 110, 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, - 46, 102, 120, 0, 67, 58, + 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -226,7 +226,7 @@ const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -241,63 +241,63 @@ const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = 102, 120, 104, 0, 40, 0, 0, 0, 124, 0, 0, 0, 197, 0, 0, 0, 0, 0, - 255, 255, 64, 6, 0, 0, - 0, 0, 255, 255, 88, 6, + 255, 255, 76, 6, 0, 0, + 0, 0, 255, 255, 100, 6, 0, 0, 0, 0, 255, 255, - 100, 6, 0, 0, 0, 0, - 255, 255, 112, 6, 0, 0, - 67, 0, 0, 0, 124, 6, + 112, 6, 0, 0, 0, 0, + 255, 255, 124, 6, 0, 0, + 67, 0, 0, 0, 136, 6, 0, 0, 67, 0, 0, 0, - 140, 6, 0, 0, 67, 0, - 0, 0, 156, 6, 0, 0, - 67, 0, 0, 0, 172, 6, + 152, 6, 0, 0, 67, 0, + 0, 0, 168, 6, 0, 0, + 67, 0, 0, 0, 184, 6, 0, 0, 36, 0, 1, 0, - 184, 6, 0, 0, 36, 0, - 1, 0, 200, 6, 0, 0, - 36, 0, 1, 0, 216, 6, + 196, 6, 0, 0, 36, 0, + 1, 0, 212, 6, 0, 0, + 36, 0, 1, 0, 228, 6, 0, 0, 39, 0, 1, 0, - 232, 6, 0, 0, 41, 0, - 1, 0, 248, 6, 0, 0, - 46, 0, 1, 0, 8, 7, + 244, 6, 0, 0, 41, 0, + 1, 0, 4, 7, 0, 0, + 46, 0, 1, 0, 20, 7, 0, 0, 46, 0, 1, 0, - 24, 7, 0, 0, 46, 0, - 1, 0, 44, 7, 0, 0, - 46, 0, 1, 0, 64, 7, + 36, 7, 0, 0, 46, 0, + 1, 0, 56, 7, 0, 0, + 46, 0, 1, 0, 76, 7, 0, 0, 46, 0, 1, 0, - 76, 7, 0, 0, 71, 0, - 0, 0, 96, 7, 0, 0, - 65, 0, 0, 0, 112, 7, + 88, 7, 0, 0, 71, 0, + 0, 0, 108, 7, 0, 0, + 65, 0, 0, 0, 124, 7, 0, 0, 65, 0, 0, 0, - 128, 7, 0, 0, 65, 0, - 0, 0, 144, 7, 0, 0, - 66, 0, 0, 0, 160, 7, + 140, 7, 0, 0, 65, 0, + 0, 0, 156, 7, 0, 0, + 66, 0, 0, 0, 172, 7, 0, 0, 66, 0, 0, 0, - 176, 7, 0, 0, 55, 0, - 0, 0, 188, 7, 0, 0, - 57, 0, 0, 0, 204, 7, + 188, 7, 0, 0, 55, 0, + 0, 0, 200, 7, 0, 0, + 57, 0, 0, 0, 216, 7, 0, 0, 57, 0, 0, 0, - 216, 7, 0, 0, 57, 0, - 0, 0, 232, 7, 0, 0, - 57, 0, 0, 0, 248, 7, + 228, 7, 0, 0, 57, 0, + 0, 0, 244, 7, 0, 0, + 57, 0, 0, 0, 4, 8, 0, 0, 57, 0, 0, 0, - 8, 8, 0, 0, 14, 0, - 2, 0, 24, 8, 0, 0, - 14, 0, 2, 0, 40, 8, + 20, 8, 0, 0, 14, 0, + 2, 0, 36, 8, 0, 0, + 14, 0, 2, 0, 52, 8, 0, 0, 14, 0, 2, 0, - 56, 8, 0, 0, 81, 0, - 0, 0, 72, 8, 0, 0, - 81, 0, 0, 0, 88, 8, + 68, 8, 0, 0, 81, 0, + 0, 0, 84, 8, 0, 0, + 81, 0, 0, 0, 100, 8, 0, 0, 81, 0, 0, 0, - 104, 8, 0, 0, 71, 0, - 0, 0, 124, 8, 0, 0, - 71, 0, 0, 0, 140, 8, + 116, 8, 0, 0, 71, 0, + 0, 0, 136, 8, 0, 0, + 71, 0, 0, 0, 152, 8, 0, 0, 71, 0, 0, 0, - 156, 8, 0, 0, 95, 0, - 0, 0, 172, 8, 0, 0, - 95, 0, 0, 0, 192, 8, + 168, 8, 0, 0, 95, 0, + 0, 0, 184, 8, 0, 0, + 95, 0, 0, 0, 204, 8, 0, 0, 46, 0, 1, 0, - 204, 8, 0, 0, 97, 0, - 0, 0, 216, 8, 0, 0, + 216, 8, 0, 0, 97, 0, + 0, 0, 228, 8, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, @@ -458,7 +458,9 @@ const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 22, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc index c151c32c916a7518e0956c9d437b1932ca37634f..4f7192006bf75267d77aada44d34adfdbd1f41c7 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc @@ -49,13 +49,13 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 67 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 67 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp3 r0.x, v1, c11 dp3 r0.y, v1, c12 dp3 r0.z, v1, c13 nrm r1.xyz, r0 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, -c4, r1 // ::dotL<0> #line 39 @@ -67,15 +67,15 @@ mov r2.xyz, c2 // Parameters::DiffuseColor<0,1,2> mad oT0.xyz, r0, r2, c3 // ::VSEnvMapOneLight<0,1,2> -#line 71 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 71 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp4 oPos.z, v0, c16 // ::VSEnvMapOneLight<15> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c7 max r0.x, r0.x, c18.x min oT1.w, r0.x, c18.y // ::VSEnvMapOneLight<7> -#line 65 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 65 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp4 r0.x, v0, c8 // ::pos_ws<0> dp4 r0.y, v0, c9 // ::pos_ws<1> dp4 r0.z, v0, c10 // ::pos_ws<2> @@ -96,10 +96,10 @@ mad oPos.xy, r0.z, c0, r0 // ::VSEnvMapOneLight<13,14> mov oPos.w, r0.z // ::VSEnvMapOneLight<16> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c2.w // ::VSEnvMapOneLight<3> -#line 77 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 77 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" mov oT1.xyz, c1.x // ::VSEnvMapOneLight<4,5,6> #line 104 @@ -153,17 +153,17 @@ ret const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = { - 68, 88, 66, 67, 47, 235, - 109, 205, 132, 61, 37, 148, - 58, 201, 166, 220, 219, 218, - 33, 237, 1, 0, 0, 0, - 136, 13, 0, 0, 4, 0, + 68, 88, 66, 67, 239, 158, + 103, 125, 117, 198, 247, 206, + 224, 147, 46, 147, 50, 147, + 61, 168, 1, 0, 0, 0, + 148, 13, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 84, 8, 0, 0, 112, 12, - 0, 0, 228, 12, 0, 0, - 65, 111, 110, 57, 28, 8, - 0, 0, 28, 8, 0, 0, - 0, 2, 254, 255, 184, 7, + 96, 8, 0, 0, 124, 12, + 0, 0, 240, 12, 0, 0, + 65, 111, 110, 57, 40, 8, + 0, 0, 40, 8, 0, 0, + 0, 2, 254, 255, 196, 7, 0, 0, 100, 0, 0, 0, 5, 0, 36, 0, 0, 0, 96, 0, 0, 0, 96, 0, @@ -180,14 +180,14 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = 7, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 104, 1, 68, 66, 85, 71, + 107, 1, 68, 66, 85, 71, 40, 0, 0, 0, 116, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 12, 1, 0, 0, 34, 0, 0, 0, 24, 1, 0, 0, 10, 0, 0, 0, 172, 4, 0, 0, - 92, 2, 0, 0, 67, 58, + 92, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -201,7 +201,7 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = 118, 105, 114, 111, 110, 109, 101, 110, 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, - 46, 102, 120, 0, 67, 58, + 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -213,7 +213,7 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -228,51 +228,51 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = 102, 120, 104, 0, 40, 0, 0, 0, 124, 0, 0, 0, 197, 0, 0, 0, 0, 0, - 255, 255, 168, 5, 0, 0, - 0, 0, 255, 255, 192, 5, + 255, 255, 180, 5, 0, 0, + 0, 0, 255, 255, 204, 5, 0, 0, 0, 0, 255, 255, - 204, 5, 0, 0, 0, 0, - 255, 255, 216, 5, 0, 0, - 67, 0, 0, 0, 228, 5, + 216, 5, 0, 0, 0, 0, + 255, 255, 228, 5, 0, 0, + 67, 0, 0, 0, 240, 5, 0, 0, 67, 0, 0, 0, - 244, 5, 0, 0, 67, 0, - 0, 0, 4, 6, 0, 0, - 67, 0, 0, 0, 20, 6, + 0, 6, 0, 0, 67, 0, + 0, 0, 16, 6, 0, 0, + 67, 0, 0, 0, 32, 6, 0, 0, 36, 0, 1, 0, - 32, 6, 0, 0, 39, 0, - 1, 0, 48, 6, 0, 0, - 41, 0, 1, 0, 64, 6, + 44, 6, 0, 0, 39, 0, + 1, 0, 60, 6, 0, 0, + 41, 0, 1, 0, 76, 6, 0, 0, 46, 0, 1, 0, - 80, 6, 0, 0, 46, 0, - 1, 0, 96, 6, 0, 0, - 46, 0, 1, 0, 108, 6, + 92, 6, 0, 0, 46, 0, + 1, 0, 108, 6, 0, 0, + 46, 0, 1, 0, 120, 6, 0, 0, 71, 0, 0, 0, - 128, 6, 0, 0, 14, 0, - 2, 0, 144, 6, 0, 0, - 14, 0, 2, 0, 160, 6, + 140, 6, 0, 0, 14, 0, + 2, 0, 156, 6, 0, 0, + 14, 0, 2, 0, 172, 6, 0, 0, 14, 0, 2, 0, - 176, 6, 0, 0, 65, 0, - 0, 0, 192, 6, 0, 0, - 65, 0, 0, 0, 208, 6, + 188, 6, 0, 0, 65, 0, + 0, 0, 204, 6, 0, 0, + 65, 0, 0, 0, 220, 6, 0, 0, 65, 0, 0, 0, - 224, 6, 0, 0, 66, 0, - 0, 0, 240, 6, 0, 0, - 66, 0, 0, 0, 0, 7, + 236, 6, 0, 0, 66, 0, + 0, 0, 252, 6, 0, 0, + 66, 0, 0, 0, 12, 7, 0, 0, 81, 0, 0, 0, - 12, 7, 0, 0, 81, 0, - 0, 0, 28, 7, 0, 0, - 81, 0, 0, 0, 44, 7, + 24, 7, 0, 0, 81, 0, + 0, 0, 40, 7, 0, 0, + 81, 0, 0, 0, 56, 7, 0, 0, 71, 0, 0, 0, - 64, 7, 0, 0, 71, 0, - 0, 0, 80, 7, 0, 0, - 71, 0, 0, 0, 96, 7, + 76, 7, 0, 0, 71, 0, + 0, 0, 92, 7, 0, 0, + 71, 0, 0, 0, 108, 7, 0, 0, 102, 0, 0, 0, - 112, 7, 0, 0, 102, 0, - 0, 0, 132, 7, 0, 0, - 46, 0, 1, 0, 144, 7, + 124, 7, 0, 0, 102, 0, + 0, 0, 144, 7, 0, 0, + 46, 0, 1, 0, 156, 7, 0, 0, 77, 0, 0, 0, - 156, 7, 0, 0, 104, 0, - 0, 0, 168, 7, 0, 0, + 168, 7, 0, 0, 104, 0, + 0, 0, 180, 7, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, @@ -420,7 +420,9 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 18, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc index f2353110c3920892ec5c5ad5356374a0fabb2c17..6ca1b74250db2d5c99559f1d8e295349076653d3 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc @@ -49,13 +49,13 @@ dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> -#line 67 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 67 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp3 r0.x, v1, c11 dp3 r0.y, v1, c12 dp3 r0.z, v1, c13 nrm r1.xyz, r0 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r0.x, -c4, r1 // ::dotL<0> #line 39 @@ -67,7 +67,7 @@ mov r2.xyz, c2 // Parameters::DiffuseColor<0,1,2> mad oT0.xyz, r0, r2, c3 // ::VSEnvMapOneLightFresnel<0,1,2> -#line 71 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 71 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp4 oPos.z, v0, c16 // ::VSEnvMapOneLightFresnel<15> #line 65 @@ -85,12 +85,12 @@ pow r1.w, r0.x, c1.y mul oT1.xyz, r1.w, c1.x // ::VSEnvMapOneLightFresnel<4,5,6> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, v0, c7 max r0.x, r0.x, c18.x min oT1.w, r0.x, c18.y // ::VSEnvMapOneLightFresnel<7> -#line 81 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 81 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" dp3 r0.x, -r2, r1 add r0.x, r0.x, r0.x mad oT3.xyz, r1, -r0.x, -r2 // ::VSEnvMapOneLightFresnel<10,11,12> @@ -104,10 +104,10 @@ mad oPos.xy, r0.z, c0, r0 // ::VSEnvMapOneLightFresnel<13,14> mov oPos.w, r0.z // ::VSEnvMapOneLightFresnel<16> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c2.w // ::VSEnvMapOneLightFresnel<3> -#line 111 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" +#line 111 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\EnvironmentMapEffect.fx" mov oT2.xy, v2 // ::VSEnvMapOneLightFresnel<8,9> // approximately 41 instruction slots used @@ -164,17 +164,17 @@ ret const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = { - 68, 88, 66, 67, 60, 1, - 73, 10, 62, 42, 102, 216, - 224, 107, 79, 152, 202, 62, - 59, 32, 1, 0, 0, 0, - 232, 14, 0, 0, 4, 0, + 68, 88, 66, 67, 18, 68, + 191, 149, 221, 33, 70, 57, + 87, 75, 188, 69, 243, 226, + 132, 104, 1, 0, 0, 0, + 244, 14, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 12, 9, 0, 0, 208, 13, - 0, 0, 68, 14, 0, 0, - 65, 111, 110, 57, 212, 8, - 0, 0, 212, 8, 0, 0, - 0, 2, 254, 255, 112, 8, + 24, 9, 0, 0, 220, 13, + 0, 0, 80, 14, 0, 0, + 65, 111, 110, 57, 224, 8, + 0, 0, 224, 8, 0, 0, + 0, 2, 254, 255, 124, 8, 0, 0, 100, 0, 0, 0, 5, 0, 36, 0, 0, 0, 96, 0, 0, 0, 96, 0, @@ -191,14 +191,14 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = 7, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 130, 1, 68, 66, 85, 71, + 133, 1, 68, 66, 85, 71, 40, 0, 0, 0, 220, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 12, 1, 0, 0, 39, 0, 0, 0, 24, 1, 0, 0, 11, 0, 0, 0, 0, 5, 0, 0, - 132, 2, 0, 0, 67, 58, + 132, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -212,7 +212,7 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = 118, 105, 114, 111, 110, 109, 101, 110, 116, 77, 97, 112, 69, 102, 102, 101, 99, 116, - 46, 102, 120, 0, 67, 58, + 46, 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -224,7 +224,7 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, - 46, 102, 120, 104, 0, 67, + 46, 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, @@ -239,58 +239,58 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = 102, 120, 104, 0, 40, 0, 0, 0, 124, 0, 0, 0, 197, 0, 0, 0, 0, 0, - 255, 255, 16, 6, 0, 0, - 0, 0, 255, 255, 40, 6, + 255, 255, 28, 6, 0, 0, + 0, 0, 255, 255, 52, 6, 0, 0, 0, 0, 255, 255, - 52, 6, 0, 0, 0, 0, - 255, 255, 64, 6, 0, 0, - 67, 0, 0, 0, 76, 6, + 64, 6, 0, 0, 0, 0, + 255, 255, 76, 6, 0, 0, + 67, 0, 0, 0, 88, 6, 0, 0, 67, 0, 0, 0, - 92, 6, 0, 0, 67, 0, - 0, 0, 108, 6, 0, 0, - 67, 0, 0, 0, 124, 6, + 104, 6, 0, 0, 67, 0, + 0, 0, 120, 6, 0, 0, + 67, 0, 0, 0, 136, 6, 0, 0, 36, 0, 1, 0, - 136, 6, 0, 0, 39, 0, - 1, 0, 152, 6, 0, 0, - 41, 0, 1, 0, 168, 6, + 148, 6, 0, 0, 39, 0, + 1, 0, 164, 6, 0, 0, + 41, 0, 1, 0, 180, 6, 0, 0, 46, 0, 1, 0, - 184, 6, 0, 0, 46, 0, - 1, 0, 200, 6, 0, 0, - 46, 0, 1, 0, 212, 6, + 196, 6, 0, 0, 46, 0, + 1, 0, 212, 6, 0, 0, + 46, 0, 1, 0, 224, 6, 0, 0, 71, 0, 0, 0, - 232, 6, 0, 0, 65, 0, - 0, 0, 248, 6, 0, 0, - 65, 0, 0, 0, 8, 7, + 244, 6, 0, 0, 65, 0, + 0, 0, 4, 7, 0, 0, + 65, 0, 0, 0, 20, 7, 0, 0, 65, 0, 0, 0, - 24, 7, 0, 0, 66, 0, - 0, 0, 40, 7, 0, 0, - 66, 0, 0, 0, 56, 7, + 36, 7, 0, 0, 66, 0, + 0, 0, 52, 7, 0, 0, + 66, 0, 0, 0, 68, 7, 0, 0, 55, 0, 0, 0, - 68, 7, 0, 0, 57, 0, - 0, 0, 84, 7, 0, 0, - 57, 0, 0, 0, 96, 7, + 80, 7, 0, 0, 57, 0, + 0, 0, 96, 7, 0, 0, + 57, 0, 0, 0, 108, 7, 0, 0, 57, 0, 0, 0, - 112, 7, 0, 0, 57, 0, - 0, 0, 128, 7, 0, 0, - 57, 0, 0, 0, 144, 7, + 124, 7, 0, 0, 57, 0, + 0, 0, 140, 7, 0, 0, + 57, 0, 0, 0, 156, 7, 0, 0, 14, 0, 2, 0, - 160, 7, 0, 0, 14, 0, - 2, 0, 176, 7, 0, 0, - 14, 0, 2, 0, 192, 7, + 172, 7, 0, 0, 14, 0, + 2, 0, 188, 7, 0, 0, + 14, 0, 2, 0, 204, 7, 0, 0, 81, 0, 0, 0, - 208, 7, 0, 0, 81, 0, - 0, 0, 224, 7, 0, 0, - 81, 0, 0, 0, 240, 7, + 220, 7, 0, 0, 81, 0, + 0, 0, 236, 7, 0, 0, + 81, 0, 0, 0, 252, 7, 0, 0, 71, 0, 0, 0, - 4, 8, 0, 0, 71, 0, - 0, 0, 20, 8, 0, 0, - 71, 0, 0, 0, 36, 8, + 16, 8, 0, 0, 71, 0, + 0, 0, 32, 8, 0, 0, + 71, 0, 0, 0, 48, 8, 0, 0, 109, 0, 0, 0, - 52, 8, 0, 0, 109, 0, - 0, 0, 72, 8, 0, 0, - 46, 0, 1, 0, 84, 8, + 64, 8, 0, 0, 109, 0, + 0, 0, 84, 8, 0, 0, + 46, 0, 1, 0, 96, 8, 0, 0, 111, 0, 0, 0, - 96, 8, 0, 0, 80, 97, + 108, 8, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, 67, 111, @@ -448,7 +448,9 @@ const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 18, 0, 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc index b881d6b536f2e3fb0449981a3f0f79b452a097a6..b3dc3b027e515b81e66fd70623fbd57df9bc90bc 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc @@ -44,13 +44,13 @@ dcl t3 // pin<9,10,11,12> dcl_2d s0 -#line 233 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 233 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" texld r0, t0, s0 #line 236 nrm r1.xyz, t2 // ::worldNormal<0,1,2> -#line 36 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 36 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, -c3, r1 // ::dotL<0> dp3 r2.y, -c4, r1 // ::dotL<1> dp3 r2.z, -c5, r1 // ::dotL<2> @@ -59,12 +59,12 @@ cmp r3.xyz, r2, c14.x, c14.y // ::zeroL<0,1,2> mul r2.xyz, r2, r3 // ::diffuse<0,1,2> -#line 235 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 235 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" add r4.xyz, -t1, c12 dp3 r1.w, r4, r4 rsq r1.w, r1.w -#line 33 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 33 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mad r5.xyz, r4, r1.w, -c3 nrm r6.xyz, r5 // ::halfVectors<0,1,2> @@ -106,20 +106,20 @@ mad r1.xyz, r3.w, c11, r1 mul r1.xyz, r1, c2 // ::result<3,4,5> -#line 233 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 233 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0, r0, t3 // ::color<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mul r1.xyz, r0.w, r1 -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mul r3.xyz, r2.y, c7 mad r3.xyz, r2.x, c6, r3 mad r2.xyz, r2.z, c8, r3 mov r3.xyz, c0 // Parameters::DiffuseColor<0,1,2> mad r2.xyz, r2, r3, c1 // ::result<0,1,2> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, r0, r2, r1 // AddSpecular::color<0,1,2> #line 20 @@ -191,17 +191,17 @@ ret const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = { - 68, 88, 66, 67, 167, 255, - 138, 170, 18, 129, 91, 123, - 243, 168, 145, 228, 204, 13, - 248, 166, 1, 0, 0, 0, - 24, 17, 0, 0, 4, 0, + 68, 88, 66, 67, 105, 97, + 0, 135, 240, 202, 102, 138, + 57, 48, 28, 167, 230, 153, + 11, 141, 1, 0, 0, 0, + 36, 17, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 16, 10, 0, 0, 100, 16, - 0, 0, 228, 16, 0, 0, - 65, 111, 110, 57, 216, 9, - 0, 0, 216, 9, 0, 0, - 0, 2, 255, 255, 164, 9, + 28, 10, 0, 0, 112, 16, + 0, 0, 240, 16, 0, 0, + 65, 111, 110, 57, 228, 9, + 0, 0, 228, 9, 0, 0, + 0, 2, 255, 255, 176, 9, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -210,14 +210,14 @@ const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 165, 1, 68, 66, 85, 71, + 168, 1, 68, 66, 85, 71, 40, 0, 0, 0, 104, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 49, 0, 0, 0, 20, 1, 0, 0, 14, 0, 0, 0, 80, 5, 0, 0, - 208, 2, 0, 0, 67, 58, + 208, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -230,7 +230,7 @@ const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -242,7 +242,7 @@ const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -257,71 +257,71 @@ const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 156, 6, + 0, 0, 255, 255, 168, 6, 0, 0, 0, 0, 255, 255, - 180, 6, 0, 0, 0, 0, - 255, 255, 192, 6, 0, 0, - 0, 0, 255, 255, 204, 6, + 192, 6, 0, 0, 0, 0, + 255, 255, 204, 6, 0, 0, + 0, 0, 255, 255, 216, 6, 0, 0, 0, 0, 255, 255, - 216, 6, 0, 0, 0, 0, - 255, 255, 228, 6, 0, 0, - 233, 0, 0, 0, 240, 6, + 228, 6, 0, 0, 0, 0, + 255, 255, 240, 6, 0, 0, + 233, 0, 0, 0, 252, 6, 0, 0, 236, 0, 0, 0, - 0, 7, 0, 0, 36, 0, - 1, 0, 12, 7, 0, 0, - 36, 0, 1, 0, 28, 7, + 12, 7, 0, 0, 36, 0, + 1, 0, 24, 7, 0, 0, + 36, 0, 1, 0, 40, 7, 0, 0, 36, 0, 1, 0, - 44, 7, 0, 0, 39, 0, - 1, 0, 60, 7, 0, 0, - 41, 0, 1, 0, 80, 7, + 56, 7, 0, 0, 39, 0, + 1, 0, 72, 7, 0, 0, + 41, 0, 1, 0, 92, 7, 0, 0, 235, 0, 0, 0, - 96, 7, 0, 0, 235, 0, - 0, 0, 112, 7, 0, 0, - 235, 0, 0, 0, 128, 7, + 108, 7, 0, 0, 235, 0, + 0, 0, 124, 7, 0, 0, + 235, 0, 0, 0, 140, 7, 0, 0, 33, 0, 1, 0, - 140, 7, 0, 0, 33, 0, - 1, 0, 160, 7, 0, 0, - 37, 0, 1, 0, 172, 7, + 152, 7, 0, 0, 33, 0, + 1, 0, 172, 7, 0, 0, + 37, 0, 1, 0, 184, 7, 0, 0, 33, 0, 1, 0, - 188, 7, 0, 0, 33, 0, - 1, 0, 208, 7, 0, 0, - 33, 0, 1, 0, 228, 7, + 200, 7, 0, 0, 33, 0, + 1, 0, 220, 7, 0, 0, + 33, 0, 1, 0, 240, 7, 0, 0, 37, 0, 1, 0, - 240, 7, 0, 0, 33, 0, - 1, 0, 0, 8, 0, 0, - 37, 0, 1, 0, 12, 8, + 252, 7, 0, 0, 33, 0, + 1, 0, 12, 8, 0, 0, + 37, 0, 1, 0, 24, 8, 0, 0, 42, 0, 1, 0, - 28, 8, 0, 0, 42, 0, - 1, 0, 44, 8, 0, 0, - 42, 0, 1, 0, 64, 8, + 40, 8, 0, 0, 42, 0, + 1, 0, 56, 8, 0, 0, + 42, 0, 1, 0, 76, 8, 0, 0, 42, 0, 1, 0, - 76, 8, 0, 0, 42, 0, - 1, 0, 88, 8, 0, 0, - 42, 0, 1, 0, 100, 8, + 88, 8, 0, 0, 42, 0, + 1, 0, 100, 8, 0, 0, + 42, 0, 1, 0, 112, 8, 0, 0, 42, 0, 1, 0, - 116, 8, 0, 0, 47, 0, - 1, 0, 128, 8, 0, 0, - 42, 0, 1, 0, 144, 8, + 128, 8, 0, 0, 47, 0, + 1, 0, 140, 8, 0, 0, + 42, 0, 1, 0, 156, 8, 0, 0, 42, 0, 1, 0, - 156, 8, 0, 0, 47, 0, - 1, 0, 168, 8, 0, 0, - 47, 0, 1, 0, 188, 8, + 168, 8, 0, 0, 47, 0, + 1, 0, 180, 8, 0, 0, + 47, 0, 1, 0, 200, 8, 0, 0, 47, 0, 1, 0, - 208, 8, 0, 0, 233, 0, - 0, 0, 224, 8, 0, 0, - 26, 0, 2, 0, 240, 8, + 220, 8, 0, 0, 233, 0, + 0, 0, 236, 8, 0, 0, + 26, 0, 2, 0, 252, 8, 0, 0, 46, 0, 1, 0, - 0, 9, 0, 0, 46, 0, - 1, 0, 16, 9, 0, 0, - 46, 0, 1, 0, 36, 9, + 12, 9, 0, 0, 46, 0, + 1, 0, 28, 9, 0, 0, + 46, 0, 1, 0, 48, 9, 0, 0, 46, 0, 1, 0, - 56, 9, 0, 0, 46, 0, - 1, 0, 68, 9, 0, 0, - 26, 0, 2, 0, 88, 9, + 68, 9, 0, 0, 46, 0, + 1, 0, 80, 9, 0, 0, + 26, 0, 2, 0, 100, 9, 0, 0, 20, 0, 2, 0, - 108, 9, 0, 0, 20, 0, - 2, 0, 128, 9, 0, 0, - 20, 0, 2, 0, 148, 9, + 120, 9, 0, 0, 20, 0, + 2, 0, 140, 9, 0, 0, + 20, 0, 2, 0, 160, 9, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -490,7 +490,9 @@ const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 14, 0, 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc index 36006399ec3d9dd5db43b7e72245703849c30dc2..dea072441e02a4a53bec378529044ae44efbb4a3 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc @@ -41,11 +41,11 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 210 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 210 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" texld r0, t2, s0 mul r0, r0, t0 // ::color<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r1.xyz, t1, r0.w, r0 // AddSpecular::color<0,1,2> #line 20 @@ -75,17 +75,17 @@ ret const BYTE SkinnedEffect_PSSkinnedVertexLighting[] = { - 68, 88, 66, 67, 136, 182, - 245, 134, 252, 10, 70, 248, - 112, 36, 89, 190, 185, 222, - 52, 160, 1, 0, 0, 0, - 144, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 113, 147, + 72, 239, 18, 199, 152, 77, + 78, 131, 248, 237, 51, 196, + 57, 113, 1, 0, 0, 0, + 156, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 180, 3, 0, 0, 244, 4, - 0, 0, 92, 5, 0, 0, - 65, 111, 110, 57, 124, 3, - 0, 0, 124, 3, 0, 0, - 0, 2, 255, 255, 72, 3, + 192, 3, 0, 0, 0, 5, + 0, 0, 104, 5, 0, 0, + 65, 111, 110, 57, 136, 3, + 0, 0, 136, 3, 0, 0, + 0, 2, 255, 255, 84, 3, 0, 0, 52, 0, 0, 0, 1, 0, 40, 0, 0, 0, 52, 0, 0, 0, 52, 0, @@ -94,14 +94,14 @@ const BYTE SkinnedEffect_PSSkinnedVertexLighting[] = 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 169, 0, 68, 66, 85, 71, + 172, 0, 68, 66, 85, 71, 40, 0, 0, 0, 120, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 10, 0, 0, 0, 196, 0, 0, 0, 5, 0, 0, 0, 20, 2, 0, 0, - 20, 1, 0, 0, 67, 58, + 20, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -114,7 +114,7 @@ const BYTE SkinnedEffect_PSSkinnedVertexLighting[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -128,19 +128,19 @@ const BYTE SkinnedEffect_PSSkinnedVertexLighting[] = 109, 111, 110, 46, 102, 120, 104, 0, 40, 0, 0, 0, 117, 0, 0, 0, 0, 0, - 255, 255, 172, 2, 0, 0, - 0, 0, 255, 255, 184, 2, + 255, 255, 184, 2, 0, 0, + 0, 0, 255, 255, 196, 2, 0, 0, 0, 0, 255, 255, - 196, 2, 0, 0, 0, 0, - 255, 255, 208, 2, 0, 0, - 210, 0, 0, 0, 220, 2, + 208, 2, 0, 0, 0, 0, + 255, 255, 220, 2, 0, 0, + 210, 0, 0, 0, 232, 2, 0, 0, 210, 0, 0, 0, - 236, 2, 0, 0, 26, 0, - 1, 0, 252, 2, 0, 0, - 20, 0, 1, 0, 16, 3, + 248, 2, 0, 0, 26, 0, + 1, 0, 8, 3, 0, 0, + 20, 0, 1, 0, 28, 3, 0, 0, 20, 0, 1, 0, - 36, 3, 0, 0, 20, 0, - 1, 0, 56, 3, 0, 0, + 48, 3, 0, 0, 20, 0, + 1, 0, 68, 3, 0, 0, 80, 83, 83, 107, 105, 110, 110, 101, 100, 86, 101, 114, 116, 101, 120, 76, 105, 103, @@ -206,7 +206,9 @@ const BYTE SkinnedEffect_PSSkinnedVertexLighting[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc index 568a23043021391b9e69d4b552e6ec18324dac86..5bf1fccbc22c21b378b63586943151d228bf7df8 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc @@ -34,11 +34,11 @@ dcl t2.xy // pin<8,9> dcl_2d s0 -#line 222 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 222 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" texld r0, t2, s0 mul r0, r0, t0 // ::color<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" mad r0.xyz, t1, r0.w, r0 // AddSpecular::color<0,1,2> mov oC0, r0 // ::PSSkinnedVertexLightingNoFog<0,1,2,3> @@ -61,31 +61,31 @@ ret const BYTE SkinnedEffect_PSSkinnedVertexLightingNoFog[] = { - 68, 88, 66, 67, 106, 186, - 183, 34, 48, 16, 115, 237, - 74, 230, 89, 81, 140, 120, - 101, 85, 1, 0, 0, 0, - 204, 4, 0, 0, 4, 0, + 68, 88, 66, 67, 98, 30, + 247, 36, 254, 70, 12, 1, + 88, 124, 67, 4, 132, 79, + 102, 111, 1, 0, 0, 0, + 216, 4, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 80, 3, 0, 0, 48, 4, - 0, 0, 152, 4, 0, 0, - 65, 111, 110, 57, 24, 3, - 0, 0, 24, 3, 0, 0, - 0, 2, 255, 255, 240, 2, + 92, 3, 0, 0, 60, 4, + 0, 0, 164, 4, 0, 0, + 65, 111, 110, 57, 36, 3, + 0, 0, 36, 3, 0, 0, + 0, 2, 255, 255, 252, 2, 0, 0, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 157, 0, 68, 66, 85, 71, + 160, 0, 68, 66, 85, 71, 40, 0, 0, 0, 72, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0, 8, 0, 0, 0, 196, 0, 0, 0, 4, 0, 0, 0, 248, 1, 0, 0, - 4, 1, 0, 0, 67, 58, + 4, 1, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -98,7 +98,7 @@ const BYTE SkinnedEffect_PSSkinnedVertexLightingNoFog[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -112,16 +112,16 @@ const BYTE SkinnedEffect_PSSkinnedVertexLightingNoFog[] = 109, 111, 110, 46, 102, 120, 104, 0, 40, 0, 0, 0, 117, 0, 0, 0, 0, 0, - 255, 255, 124, 2, 0, 0, - 0, 0, 255, 255, 136, 2, + 255, 255, 136, 2, 0, 0, + 0, 0, 255, 255, 148, 2, 0, 0, 0, 0, 255, 255, - 148, 2, 0, 0, 0, 0, - 255, 255, 160, 2, 0, 0, - 222, 0, 0, 0, 172, 2, + 160, 2, 0, 0, 0, 0, + 255, 255, 172, 2, 0, 0, + 222, 0, 0, 0, 184, 2, 0, 0, 222, 0, 0, 0, - 188, 2, 0, 0, 26, 0, - 1, 0, 204, 2, 0, 0, - 26, 0, 1, 0, 224, 2, + 200, 2, 0, 0, 26, 0, + 1, 0, 216, 2, 0, 0, + 26, 0, 1, 0, 236, 2, 0, 0, 80, 83, 83, 107, 105, 110, 110, 101, 100, 86, 101, 114, 116, 101, 120, 76, @@ -182,7 +182,9 @@ const BYTE SkinnedEffect_PSSkinnedVertexLightingNoFog[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc index fa07bdf3bea846928c29f675eab94a4ff008eb4c..bd9ee13cca8c47d2d315ca897e4e22a8eca07dae 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc @@ -48,7 +48,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0, v3, c243.x mova a0, r0.yxzw mul r1, v4.y, c26[a0.x] @@ -76,7 +76,7 @@ dp3 r1.z, v1, r3 // Skin::vin<6> dp4 r0.z, v0, r3 // Skin::vin<2> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 @@ -121,24 +121,24 @@ #line 63 dp4 oPos.z, r0, c24 // ::VSSkinnedOneLightFourBones<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedOneLightFourBones<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> -#line 141 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 141 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedOneLightFourBones<10,11> mov oPos.w, r0.x // ::VSSkinnedOneLightFourBones<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedOneLightFourBones<3> -#line 145 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 145 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedOneLightFourBones<8,9> // approximately 63 instruction slots used @@ -217,17 +217,17 @@ ret const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = { - 68, 88, 66, 67, 203, 46, - 72, 203, 82, 54, 50, 161, - 103, 172, 86, 28, 64, 194, - 240, 31, 1, 0, 0, 0, - 36, 22, 0, 0, 4, 0, + 68, 88, 66, 67, 240, 37, + 220, 253, 15, 164, 196, 10, + 27, 205, 118, 81, 151, 201, + 210, 229, 1, 0, 0, 0, + 48, 22, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 232, 12, 0, 0, 216, 20, - 0, 0, 152, 21, 0, 0, - 65, 111, 110, 57, 176, 12, - 0, 0, 176, 12, 0, 0, - 0, 2, 254, 255, 124, 12, + 244, 12, 0, 0, 228, 20, + 0, 0, 164, 21, 0, 0, + 65, 111, 110, 57, 188, 12, + 0, 0, 188, 12, 0, 0, + 0, 2, 254, 255, 136, 12, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -236,14 +236,14 @@ const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 29, 2, 68, 66, 85, 71, + 32, 2, 68, 66, 85, 71, 40, 0, 0, 0, 72, 8, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 61, 0, 0, 0, 20, 1, 0, 0, 15, 0, 0, 0, 28, 7, 0, 0, - 48, 3, 0, 0, 67, 58, + 48, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -256,7 +256,7 @@ const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -268,7 +268,7 @@ const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -283,87 +283,87 @@ const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 124, 8, + 0, 0, 255, 255, 136, 8, 0, 0, 0, 0, 255, 255, - 148, 8, 0, 0, 0, 0, - 255, 255, 160, 8, 0, 0, - 0, 0, 255, 255, 172, 8, + 160, 8, 0, 0, 0, 0, + 255, 255, 172, 8, 0, 0, + 0, 0, 255, 255, 184, 8, 0, 0, 0, 0, 255, 255, - 184, 8, 0, 0, 0, 0, - 255, 255, 196, 8, 0, 0, - 52, 0, 0, 0, 208, 8, + 196, 8, 0, 0, 0, 0, + 255, 255, 208, 8, 0, 0, + 52, 0, 0, 0, 220, 8, 0, 0, 52, 0, 0, 0, - 224, 8, 0, 0, 52, 0, - 0, 0, 236, 8, 0, 0, - 52, 0, 0, 0, 0, 9, + 236, 8, 0, 0, 52, 0, + 0, 0, 248, 8, 0, 0, + 52, 0, 0, 0, 12, 9, 0, 0, 52, 0, 0, 0, - 24, 9, 0, 0, 52, 0, - 0, 0, 48, 9, 0, 0, - 56, 0, 0, 0, 72, 9, + 36, 9, 0, 0, 52, 0, + 0, 0, 60, 9, 0, 0, + 56, 0, 0, 0, 84, 9, 0, 0, 55, 0, 0, 0, - 88, 9, 0, 0, 52, 0, - 0, 0, 104, 9, 0, 0, - 52, 0, 0, 0, 124, 9, + 100, 9, 0, 0, 52, 0, + 0, 0, 116, 9, 0, 0, + 52, 0, 0, 0, 136, 9, 0, 0, 52, 0, 0, 0, - 144, 9, 0, 0, 52, 0, - 0, 0, 168, 9, 0, 0, - 52, 0, 0, 0, 192, 9, + 156, 9, 0, 0, 52, 0, + 0, 0, 180, 9, 0, 0, + 52, 0, 0, 0, 204, 9, 0, 0, 52, 0, 0, 0, - 216, 9, 0, 0, 52, 0, - 0, 0, 240, 9, 0, 0, - 52, 0, 0, 0, 8, 10, + 228, 9, 0, 0, 52, 0, + 0, 0, 252, 9, 0, 0, + 52, 0, 0, 0, 20, 10, 0, 0, 56, 0, 0, 0, - 32, 10, 0, 0, 55, 0, - 0, 0, 48, 10, 0, 0, - 56, 0, 0, 0, 64, 10, + 44, 10, 0, 0, 55, 0, + 0, 0, 60, 10, 0, 0, + 56, 0, 0, 0, 76, 10, 0, 0, 55, 0, 0, 0, - 80, 10, 0, 0, 59, 0, - 1, 0, 96, 10, 0, 0, - 59, 0, 1, 0, 112, 10, + 92, 10, 0, 0, 59, 0, + 1, 0, 108, 10, 0, 0, + 59, 0, 1, 0, 124, 10, 0, 0, 59, 0, 1, 0, - 128, 10, 0, 0, 59, 0, - 1, 0, 144, 10, 0, 0, - 36, 0, 1, 0, 156, 10, + 140, 10, 0, 0, 59, 0, + 1, 0, 156, 10, 0, 0, + 36, 0, 1, 0, 168, 10, 0, 0, 39, 0, 1, 0, - 172, 10, 0, 0, 41, 0, - 1, 0, 188, 10, 0, 0, - 46, 0, 1, 0, 204, 10, + 184, 10, 0, 0, 41, 0, + 1, 0, 200, 10, 0, 0, + 46, 0, 1, 0, 216, 10, 0, 0, 46, 0, 1, 0, - 220, 10, 0, 0, 46, 0, - 1, 0, 232, 10, 0, 0, - 57, 0, 1, 0, 252, 10, + 232, 10, 0, 0, 46, 0, + 1, 0, 244, 10, 0, 0, + 57, 0, 1, 0, 8, 11, 0, 0, 57, 0, 1, 0, - 8, 11, 0, 0, 57, 0, - 1, 0, 24, 11, 0, 0, - 57, 0, 1, 0, 40, 11, + 20, 11, 0, 0, 57, 0, + 1, 0, 36, 11, 0, 0, + 57, 0, 1, 0, 52, 11, 0, 0, 58, 0, 1, 0, - 56, 11, 0, 0, 58, 0, - 1, 0, 72, 11, 0, 0, - 33, 0, 1, 0, 84, 11, + 68, 11, 0, 0, 58, 0, + 1, 0, 84, 11, 0, 0, + 33, 0, 1, 0, 96, 11, 0, 0, 33, 0, 1, 0, - 100, 11, 0, 0, 37, 0, - 1, 0, 112, 11, 0, 0, - 42, 0, 1, 0, 128, 11, + 112, 11, 0, 0, 37, 0, + 1, 0, 124, 11, 0, 0, + 42, 0, 1, 0, 140, 11, 0, 0, 42, 0, 1, 0, - 144, 11, 0, 0, 42, 0, - 1, 0, 160, 11, 0, 0, - 47, 0, 1, 0, 176, 11, + 156, 11, 0, 0, 42, 0, + 1, 0, 172, 11, 0, 0, + 47, 0, 1, 0, 188, 11, 0, 0, 47, 0, 1, 0, - 192, 11, 0, 0, 63, 0, - 1, 0, 208, 11, 0, 0, - 14, 0, 2, 0, 224, 11, + 204, 11, 0, 0, 63, 0, + 1, 0, 220, 11, 0, 0, + 14, 0, 2, 0, 236, 11, 0, 0, 14, 0, 2, 0, - 240, 11, 0, 0, 14, 0, - 2, 0, 0, 12, 0, 0, - 63, 0, 1, 0, 16, 12, + 252, 11, 0, 0, 14, 0, + 2, 0, 12, 12, 0, 0, + 63, 0, 1, 0, 28, 12, 0, 0, 63, 0, 1, 0, - 32, 12, 0, 0, 63, 0, - 1, 0, 48, 12, 0, 0, - 141, 0, 0, 0, 64, 12, + 44, 12, 0, 0, 63, 0, + 1, 0, 60, 12, 0, 0, + 141, 0, 0, 0, 76, 12, 0, 0, 141, 0, 0, 0, - 84, 12, 0, 0, 46, 0, - 1, 0, 96, 12, 0, 0, - 145, 0, 0, 0, 108, 12, + 96, 12, 0, 0, 46, 0, + 1, 0, 108, 12, 0, 0, + 145, 0, 0, 0, 120, 12, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -596,7 +596,9 @@ const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc index 9a87e6d2e0f01431c8ac0e0b5af7838a23be98dd..ee828c9524e971f9720612e0ef370501d6d6f6a4 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc @@ -48,7 +48,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.x, v3.x, c243.x mova a0.x, r0.x mul r0, v4.x, c26[a0.x] // ::skinning<0,3,6,9> @@ -67,7 +67,7 @@ dp3 r1.z, v1, r3 // Skin::vin<6> dp4 r0.z, v0, r3 // Skin::vin<2> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 @@ -112,24 +112,24 @@ #line 63 dp4 oPos.z, r0, c24 // ::VSSkinnedOneLightOneBone<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedOneLightOneBone<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> -#line 109 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 109 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedOneLightOneBone<10,11> mov oPos.w, r0.x // ::VSSkinnedOneLightOneBone<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedOneLightOneBone<3> -#line 113 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 113 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedOneLightOneBone<8,9> // approximately 54 instruction slots used @@ -199,17 +199,17 @@ ret const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = { - 68, 88, 66, 67, 120, 170, - 51, 155, 98, 149, 240, 251, - 11, 114, 75, 24, 138, 47, - 241, 16, 1, 0, 0, 0, - 0, 19, 0, 0, 4, 0, + 68, 88, 66, 67, 25, 255, + 35, 167, 193, 235, 165, 157, + 195, 174, 52, 60, 201, 68, + 164, 115, 1, 0, 0, 0, + 12, 19, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 128, 11, 0, 0, 180, 17, - 0, 0, 116, 18, 0, 0, - 65, 111, 110, 57, 72, 11, - 0, 0, 72, 11, 0, 0, - 0, 2, 254, 255, 20, 11, + 140, 11, 0, 0, 192, 17, + 0, 0, 128, 18, 0, 0, + 65, 111, 110, 57, 84, 11, + 0, 0, 84, 11, 0, 0, + 0, 2, 254, 255, 32, 11, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -218,14 +218,14 @@ const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 249, 1, 68, 66, 85, 71, + 252, 1, 68, 66, 85, 71, 40, 0, 0, 0, 184, 7, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 52, 0, 0, 0, 20, 1, 0, 0, 15, 0, 0, 0, 140, 6, 0, 0, - 232, 2, 0, 0, 67, 58, + 232, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -238,7 +238,7 @@ const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -250,7 +250,7 @@ const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -265,75 +265,75 @@ const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 236, 7, + 0, 0, 255, 255, 248, 7, 0, 0, 0, 0, 255, 255, - 4, 8, 0, 0, 0, 0, - 255, 255, 16, 8, 0, 0, - 0, 0, 255, 255, 28, 8, + 16, 8, 0, 0, 0, 0, + 255, 255, 28, 8, 0, 0, + 0, 0, 255, 255, 40, 8, 0, 0, 0, 0, 255, 255, - 40, 8, 0, 0, 0, 0, - 255, 255, 52, 8, 0, 0, - 52, 0, 0, 0, 64, 8, + 52, 8, 0, 0, 0, 0, + 255, 255, 64, 8, 0, 0, + 52, 0, 0, 0, 76, 8, 0, 0, 52, 0, 0, 0, - 80, 8, 0, 0, 52, 0, - 0, 0, 92, 8, 0, 0, - 56, 0, 0, 0, 112, 8, + 92, 8, 0, 0, 52, 0, + 0, 0, 104, 8, 0, 0, + 56, 0, 0, 0, 124, 8, 0, 0, 55, 0, 0, 0, - 128, 8, 0, 0, 52, 0, - 0, 0, 144, 8, 0, 0, - 52, 0, 0, 0, 164, 8, + 140, 8, 0, 0, 52, 0, + 0, 0, 156, 8, 0, 0, + 52, 0, 0, 0, 176, 8, 0, 0, 56, 0, 0, 0, - 184, 8, 0, 0, 55, 0, - 0, 0, 200, 8, 0, 0, - 56, 0, 0, 0, 216, 8, + 196, 8, 0, 0, 55, 0, + 0, 0, 212, 8, 0, 0, + 56, 0, 0, 0, 228, 8, 0, 0, 55, 0, 0, 0, - 232, 8, 0, 0, 59, 0, - 1, 0, 248, 8, 0, 0, - 59, 0, 1, 0, 8, 9, + 244, 8, 0, 0, 59, 0, + 1, 0, 4, 9, 0, 0, + 59, 0, 1, 0, 20, 9, 0, 0, 59, 0, 1, 0, - 24, 9, 0, 0, 59, 0, - 1, 0, 40, 9, 0, 0, - 36, 0, 1, 0, 52, 9, + 36, 9, 0, 0, 59, 0, + 1, 0, 52, 9, 0, 0, + 36, 0, 1, 0, 64, 9, 0, 0, 39, 0, 1, 0, - 68, 9, 0, 0, 41, 0, - 1, 0, 84, 9, 0, 0, - 46, 0, 1, 0, 100, 9, + 80, 9, 0, 0, 41, 0, + 1, 0, 96, 9, 0, 0, + 46, 0, 1, 0, 112, 9, 0, 0, 46, 0, 1, 0, - 116, 9, 0, 0, 46, 0, - 1, 0, 128, 9, 0, 0, - 57, 0, 1, 0, 148, 9, + 128, 9, 0, 0, 46, 0, + 1, 0, 140, 9, 0, 0, + 57, 0, 1, 0, 160, 9, 0, 0, 57, 0, 1, 0, - 160, 9, 0, 0, 57, 0, - 1, 0, 176, 9, 0, 0, - 57, 0, 1, 0, 192, 9, + 172, 9, 0, 0, 57, 0, + 1, 0, 188, 9, 0, 0, + 57, 0, 1, 0, 204, 9, 0, 0, 58, 0, 1, 0, - 208, 9, 0, 0, 58, 0, - 1, 0, 224, 9, 0, 0, - 33, 0, 1, 0, 236, 9, + 220, 9, 0, 0, 58, 0, + 1, 0, 236, 9, 0, 0, + 33, 0, 1, 0, 248, 9, 0, 0, 33, 0, 1, 0, - 252, 9, 0, 0, 37, 0, - 1, 0, 8, 10, 0, 0, - 42, 0, 1, 0, 24, 10, + 8, 10, 0, 0, 37, 0, + 1, 0, 20, 10, 0, 0, + 42, 0, 1, 0, 36, 10, 0, 0, 42, 0, 1, 0, - 40, 10, 0, 0, 42, 0, - 1, 0, 56, 10, 0, 0, - 47, 0, 1, 0, 72, 10, + 52, 10, 0, 0, 42, 0, + 1, 0, 68, 10, 0, 0, + 47, 0, 1, 0, 84, 10, 0, 0, 47, 0, 1, 0, - 88, 10, 0, 0, 63, 0, - 1, 0, 104, 10, 0, 0, - 14, 0, 2, 0, 120, 10, + 100, 10, 0, 0, 63, 0, + 1, 0, 116, 10, 0, 0, + 14, 0, 2, 0, 132, 10, 0, 0, 14, 0, 2, 0, - 136, 10, 0, 0, 14, 0, - 2, 0, 152, 10, 0, 0, - 63, 0, 1, 0, 168, 10, + 148, 10, 0, 0, 14, 0, + 2, 0, 164, 10, 0, 0, + 63, 0, 1, 0, 180, 10, 0, 0, 63, 0, 1, 0, - 184, 10, 0, 0, 63, 0, - 1, 0, 200, 10, 0, 0, - 109, 0, 0, 0, 216, 10, + 196, 10, 0, 0, 63, 0, + 1, 0, 212, 10, 0, 0, + 109, 0, 0, 0, 228, 10, 0, 0, 109, 0, 0, 0, - 236, 10, 0, 0, 46, 0, - 1, 0, 248, 10, 0, 0, - 113, 0, 0, 0, 4, 11, + 248, 10, 0, 0, 46, 0, + 1, 0, 4, 11, 0, 0, + 113, 0, 0, 0, 16, 11, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -554,7 +554,9 @@ const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc index 7486b02a568b7ef03ed459acbb8ccfd947b3e2f4..ec2ee99a530f41827379a5eb877e1d35d0749f09 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc @@ -48,7 +48,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.xy, v3, c243.x mova a0.xy, r0.yxzw mul r0, v4.y, c26[a0.x] @@ -70,7 +70,7 @@ dp3 r1.z, v1, r3 // Skin::vin<6> dp4 r0.z, v0, r3 // Skin::vin<2> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 @@ -115,24 +115,24 @@ #line 63 dp4 oPos.z, r0, c24 // ::VSSkinnedOneLightTwoBones<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedOneLightTwoBones<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> -#line 125 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 125 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedOneLightTwoBones<10,11> mov oPos.w, r0.x // ::VSSkinnedOneLightTwoBones<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedOneLightTwoBones<3> -#line 129 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 129 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedOneLightTwoBones<8,9> // approximately 57 instruction slots used @@ -205,17 +205,17 @@ ret const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = { - 68, 88, 66, 67, 128, 106, - 85, 102, 37, 42, 216, 89, - 27, 53, 239, 87, 8, 117, - 194, 235, 1, 0, 0, 0, - 252, 19, 0, 0, 4, 0, + 68, 88, 66, 67, 106, 161, + 186, 232, 4, 34, 224, 53, + 143, 224, 192, 138, 69, 159, + 15, 38, 1, 0, 0, 0, + 8, 20, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 224, 11, 0, 0, 176, 18, - 0, 0, 112, 19, 0, 0, - 65, 111, 110, 57, 168, 11, - 0, 0, 168, 11, 0, 0, - 0, 2, 254, 255, 116, 11, + 236, 11, 0, 0, 188, 18, + 0, 0, 124, 19, 0, 0, + 65, 111, 110, 57, 180, 11, + 0, 0, 180, 11, 0, 0, + 0, 2, 254, 255, 128, 11, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -224,14 +224,14 @@ const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 255, 1, 68, 66, 85, 71, + 2, 2, 68, 66, 85, 71, 40, 0, 0, 0, 208, 7, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 55, 0, 0, 0, 20, 1, 0, 0, 15, 0, 0, 0, 164, 6, 0, 0, - 0, 3, 0, 0, 67, 58, + 0, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -244,7 +244,7 @@ const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -256,7 +256,7 @@ const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -271,79 +271,79 @@ const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 4, 8, + 0, 0, 255, 255, 16, 8, 0, 0, 0, 0, 255, 255, - 28, 8, 0, 0, 0, 0, - 255, 255, 40, 8, 0, 0, - 0, 0, 255, 255, 52, 8, + 40, 8, 0, 0, 0, 0, + 255, 255, 52, 8, 0, 0, + 0, 0, 255, 255, 64, 8, 0, 0, 0, 0, 255, 255, - 64, 8, 0, 0, 0, 0, - 255, 255, 76, 8, 0, 0, - 52, 0, 0, 0, 88, 8, + 76, 8, 0, 0, 0, 0, + 255, 255, 88, 8, 0, 0, + 52, 0, 0, 0, 100, 8, 0, 0, 52, 0, 0, 0, - 104, 8, 0, 0, 52, 0, - 0, 0, 116, 8, 0, 0, - 52, 0, 0, 0, 136, 8, + 116, 8, 0, 0, 52, 0, + 0, 0, 128, 8, 0, 0, + 52, 0, 0, 0, 148, 8, 0, 0, 56, 0, 0, 0, - 160, 8, 0, 0, 55, 0, - 0, 0, 176, 8, 0, 0, - 52, 0, 0, 0, 192, 8, + 172, 8, 0, 0, 55, 0, + 0, 0, 188, 8, 0, 0, + 52, 0, 0, 0, 204, 8, 0, 0, 52, 0, 0, 0, - 212, 8, 0, 0, 52, 0, - 0, 0, 232, 8, 0, 0, - 52, 0, 0, 0, 0, 9, + 224, 8, 0, 0, 52, 0, + 0, 0, 244, 8, 0, 0, + 52, 0, 0, 0, 12, 9, 0, 0, 56, 0, 0, 0, - 24, 9, 0, 0, 55, 0, - 0, 0, 40, 9, 0, 0, - 56, 0, 0, 0, 56, 9, + 36, 9, 0, 0, 55, 0, + 0, 0, 52, 9, 0, 0, + 56, 0, 0, 0, 68, 9, 0, 0, 55, 0, 0, 0, - 72, 9, 0, 0, 59, 0, - 1, 0, 88, 9, 0, 0, - 59, 0, 1, 0, 104, 9, + 84, 9, 0, 0, 59, 0, + 1, 0, 100, 9, 0, 0, + 59, 0, 1, 0, 116, 9, 0, 0, 59, 0, 1, 0, - 120, 9, 0, 0, 59, 0, - 1, 0, 136, 9, 0, 0, - 36, 0, 1, 0, 148, 9, + 132, 9, 0, 0, 59, 0, + 1, 0, 148, 9, 0, 0, + 36, 0, 1, 0, 160, 9, 0, 0, 39, 0, 1, 0, - 164, 9, 0, 0, 41, 0, - 1, 0, 180, 9, 0, 0, - 46, 0, 1, 0, 196, 9, + 176, 9, 0, 0, 41, 0, + 1, 0, 192, 9, 0, 0, + 46, 0, 1, 0, 208, 9, 0, 0, 46, 0, 1, 0, - 212, 9, 0, 0, 46, 0, - 1, 0, 224, 9, 0, 0, - 57, 0, 1, 0, 244, 9, + 224, 9, 0, 0, 46, 0, + 1, 0, 236, 9, 0, 0, + 57, 0, 1, 0, 0, 10, 0, 0, 57, 0, 1, 0, - 0, 10, 0, 0, 57, 0, - 1, 0, 16, 10, 0, 0, - 57, 0, 1, 0, 32, 10, + 12, 10, 0, 0, 57, 0, + 1, 0, 28, 10, 0, 0, + 57, 0, 1, 0, 44, 10, 0, 0, 58, 0, 1, 0, - 48, 10, 0, 0, 58, 0, - 1, 0, 64, 10, 0, 0, - 33, 0, 1, 0, 76, 10, + 60, 10, 0, 0, 58, 0, + 1, 0, 76, 10, 0, 0, + 33, 0, 1, 0, 88, 10, 0, 0, 33, 0, 1, 0, - 92, 10, 0, 0, 37, 0, - 1, 0, 104, 10, 0, 0, - 42, 0, 1, 0, 120, 10, + 104, 10, 0, 0, 37, 0, + 1, 0, 116, 10, 0, 0, + 42, 0, 1, 0, 132, 10, 0, 0, 42, 0, 1, 0, - 136, 10, 0, 0, 42, 0, - 1, 0, 152, 10, 0, 0, - 47, 0, 1, 0, 168, 10, + 148, 10, 0, 0, 42, 0, + 1, 0, 164, 10, 0, 0, + 47, 0, 1, 0, 180, 10, 0, 0, 47, 0, 1, 0, - 184, 10, 0, 0, 63, 0, - 1, 0, 200, 10, 0, 0, - 14, 0, 2, 0, 216, 10, + 196, 10, 0, 0, 63, 0, + 1, 0, 212, 10, 0, 0, + 14, 0, 2, 0, 228, 10, 0, 0, 14, 0, 2, 0, - 232, 10, 0, 0, 14, 0, - 2, 0, 248, 10, 0, 0, - 63, 0, 1, 0, 8, 11, + 244, 10, 0, 0, 14, 0, + 2, 0, 4, 11, 0, 0, + 63, 0, 1, 0, 20, 11, 0, 0, 63, 0, 1, 0, - 24, 11, 0, 0, 63, 0, - 1, 0, 40, 11, 0, 0, - 125, 0, 0, 0, 56, 11, + 36, 11, 0, 0, 63, 0, + 1, 0, 52, 11, 0, 0, + 125, 0, 0, 0, 68, 11, 0, 0, 125, 0, 0, 0, - 76, 11, 0, 0, 46, 0, - 1, 0, 88, 11, 0, 0, - 129, 0, 0, 0, 100, 11, + 88, 11, 0, 0, 46, 0, + 1, 0, 100, 11, 0, 0, + 129, 0, 0, 0, 112, 11, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -564,7 +564,9 @@ const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc index 36a12f390127bddfec2cb785e4ae891f109904c6..c3466b475b36c09c824e4c6b6c62b0e93b060ab3 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc @@ -49,7 +49,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0, v3, c243.x mova a0, r0.yxzw mul r1, v4.y, c26[a0.x] @@ -77,7 +77,7 @@ dp4 r1.z, v0, r3 // Skin::vin<2> dp3 r0.z, v1, r3 // Skin::vin<6> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov r1.w, v0.w dp4 oPos.z, r1, c24 // ::VSSkinnedPixelLightingFourBones<15> dp4 oT1.x, r1, c15 // ::VSSkinnedPixelLightingFourBones<2> @@ -90,17 +90,17 @@ rsq r0.x, r0.x mul oT2.xyz, r0.x, r2 // ::VSSkinnedPixelLightingFourBones<6,7,8> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, r1, c14 max r0.x, r0.x, c243.y min oT1.w, r0.x, c243.z // ::VSSkinnedPixelLightingFourBones<5> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, r1, c22 // ::vout<0> dp4 r0.y, r1, c23 // ::vout<1> dp4 r0.z, r1, c25 // ::vout<3> -#line 191 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 191 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.z, c242, r0 // ::VSSkinnedPixelLightingFourBones<13,14> mov oPos.w, r0.z // ::VSSkinnedPixelLightingFourBones<16> @@ -168,17 +168,17 @@ ret const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = { - 68, 88, 66, 67, 96, 157, - 87, 196, 38, 94, 105, 173, - 51, 47, 110, 253, 0, 184, - 79, 144, 1, 0, 0, 0, - 44, 17, 0, 0, 4, 0, + 68, 88, 66, 67, 163, 175, + 48, 182, 230, 199, 155, 73, + 171, 120, 144, 202, 126, 166, + 78, 168, 1, 0, 0, 0, + 56, 17, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 24, 10, 0, 0, 200, 15, - 0, 0, 136, 16, 0, 0, - 65, 111, 110, 57, 224, 9, - 0, 0, 224, 9, 0, 0, - 0, 2, 254, 255, 172, 9, + 36, 10, 0, 0, 212, 15, + 0, 0, 148, 16, 0, 0, + 65, 111, 110, 57, 236, 9, + 0, 0, 236, 9, 0, 0, + 0, 2, 254, 255, 184, 9, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -187,14 +187,14 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 154, 1, 68, 66, 85, 71, + 157, 1, 68, 66, 85, 71, 40, 0, 0, 0, 60, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 48, 0, 0, 0, 20, 1, 0, 0, 5, 0, 0, 0, 216, 5, 0, 0, - 148, 2, 0, 0, 67, 58, + 148, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -207,7 +207,7 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -219,7 +219,7 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -234,70 +234,70 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 112, 6, + 0, 0, 255, 255, 124, 6, 0, 0, 0, 0, 255, 255, - 136, 6, 0, 0, 0, 0, - 255, 255, 148, 6, 0, 0, - 0, 0, 255, 255, 160, 6, + 148, 6, 0, 0, 0, 0, + 255, 255, 160, 6, 0, 0, + 0, 0, 255, 255, 172, 6, 0, 0, 0, 0, 255, 255, - 172, 6, 0, 0, 0, 0, - 255, 255, 184, 6, 0, 0, - 52, 0, 0, 0, 196, 6, + 184, 6, 0, 0, 0, 0, + 255, 255, 196, 6, 0, 0, + 52, 0, 0, 0, 208, 6, 0, 0, 52, 0, 0, 0, - 212, 6, 0, 0, 52, 0, - 0, 0, 224, 6, 0, 0, - 52, 0, 0, 0, 244, 6, + 224, 6, 0, 0, 52, 0, + 0, 0, 236, 6, 0, 0, + 52, 0, 0, 0, 0, 7, 0, 0, 52, 0, 0, 0, - 12, 7, 0, 0, 52, 0, - 0, 0, 36, 7, 0, 0, - 55, 0, 0, 0, 60, 7, + 24, 7, 0, 0, 52, 0, + 0, 0, 48, 7, 0, 0, + 55, 0, 0, 0, 72, 7, 0, 0, 56, 0, 0, 0, - 76, 7, 0, 0, 52, 0, - 0, 0, 92, 7, 0, 0, - 52, 0, 0, 0, 112, 7, + 88, 7, 0, 0, 52, 0, + 0, 0, 104, 7, 0, 0, + 52, 0, 0, 0, 124, 7, 0, 0, 52, 0, 0, 0, - 132, 7, 0, 0, 52, 0, - 0, 0, 156, 7, 0, 0, - 52, 0, 0, 0, 180, 7, + 144, 7, 0, 0, 52, 0, + 0, 0, 168, 7, 0, 0, + 52, 0, 0, 0, 192, 7, 0, 0, 52, 0, 0, 0, - 204, 7, 0, 0, 52, 0, - 0, 0, 228, 7, 0, 0, - 52, 0, 0, 0, 252, 7, + 216, 7, 0, 0, 52, 0, + 0, 0, 240, 7, 0, 0, + 52, 0, 0, 0, 8, 8, 0, 0, 55, 0, 0, 0, - 20, 8, 0, 0, 56, 0, - 0, 0, 36, 8, 0, 0, - 55, 0, 0, 0, 52, 8, + 32, 8, 0, 0, 56, 0, + 0, 0, 48, 8, 0, 0, + 55, 0, 0, 0, 64, 8, 0, 0, 56, 0, 0, 0, - 68, 8, 0, 0, 85, 0, - 1, 0, 84, 8, 0, 0, - 85, 0, 1, 0, 96, 8, + 80, 8, 0, 0, 85, 0, + 1, 0, 96, 8, 0, 0, + 85, 0, 1, 0, 108, 8, 0, 0, 86, 0, 1, 0, - 112, 8, 0, 0, 86, 0, - 1, 0, 128, 8, 0, 0, - 86, 0, 1, 0, 144, 8, + 124, 8, 0, 0, 86, 0, + 1, 0, 140, 8, 0, 0, + 86, 0, 1, 0, 156, 8, 0, 0, 87, 0, 1, 0, - 160, 8, 0, 0, 87, 0, - 1, 0, 176, 8, 0, 0, - 87, 0, 1, 0, 192, 8, + 172, 8, 0, 0, 87, 0, + 1, 0, 188, 8, 0, 0, + 87, 0, 1, 0, 204, 8, 0, 0, 87, 0, 1, 0, - 208, 8, 0, 0, 87, 0, - 1, 0, 224, 8, 0, 0, - 87, 0, 1, 0, 236, 8, + 220, 8, 0, 0, 87, 0, + 1, 0, 236, 8, 0, 0, + 87, 0, 1, 0, 248, 8, 0, 0, 14, 0, 2, 0, - 252, 8, 0, 0, 14, 0, - 2, 0, 12, 9, 0, 0, - 14, 0, 2, 0, 28, 9, + 8, 9, 0, 0, 14, 0, + 2, 0, 24, 9, 0, 0, + 14, 0, 2, 0, 40, 9, 0, 0, 85, 0, 1, 0, - 44, 9, 0, 0, 85, 0, - 1, 0, 60, 9, 0, 0, - 85, 0, 1, 0, 76, 9, + 56, 9, 0, 0, 85, 0, + 1, 0, 72, 9, 0, 0, + 85, 0, 1, 0, 88, 9, 0, 0, 191, 0, 0, 0, - 92, 9, 0, 0, 191, 0, - 0, 0, 112, 9, 0, 0, - 195, 0, 0, 0, 124, 9, + 104, 9, 0, 0, 191, 0, + 0, 0, 124, 9, 0, 0, + 195, 0, 0, 0, 136, 9, 0, 0, 200, 0, 0, 0, - 136, 9, 0, 0, 200, 0, - 0, 0, 148, 9, 0, 0, + 148, 9, 0, 0, 200, 0, + 0, 0, 160, 9, 0, 0, 86, 83, 83, 107, 105, 110, 110, 101, 100, 80, 105, 120, 101, 108, 76, 105, 103, 104, @@ -460,7 +460,9 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 128, 63, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc index a142a541fc8bb355a0f1c5a929c3f52b9a73cdbc..a0847e4e1a802d862645d85fca0a058261b5c162 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc @@ -49,7 +49,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.x, v3.x, c243.x mova a0.x, r0.x mul r0, v4.x, c26[a0.x] // ::skinning<0,3,6,9> @@ -68,7 +68,7 @@ dp4 r1.z, v0, r3 // Skin::vin<2> dp3 r0.z, v1, r3 // Skin::vin<6> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov r1.w, v0.w dp4 oPos.z, r1, c24 // ::VSSkinnedPixelLightingOneBone<15> dp4 oT1.x, r1, c15 // ::VSSkinnedPixelLightingOneBone<2> @@ -81,17 +81,17 @@ rsq r0.x, r0.x mul oT2.xyz, r0.x, r2 // ::VSSkinnedPixelLightingOneBone<6,7,8> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, r1, c14 max r0.x, r0.x, c243.y min oT1.w, r0.x, c243.z // ::VSSkinnedPixelLightingOneBone<5> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, r1, c22 // ::vout<0> dp4 r0.y, r1, c23 // ::vout<1> dp4 r0.z, r1, c25 // ::vout<3> -#line 157 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 157 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.z, c242, r0 // ::VSSkinnedPixelLightingOneBone<13,14> mov oPos.w, r0.z // ::VSSkinnedPixelLightingOneBone<16> @@ -150,17 +150,17 @@ ret const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = { - 68, 88, 66, 67, 106, 73, - 236, 75, 243, 219, 238, 14, - 117, 141, 149, 254, 34, 55, - 148, 241, 1, 0, 0, 0, - 4, 14, 0, 0, 4, 0, + 68, 88, 66, 67, 109, 107, + 236, 52, 104, 194, 127, 222, + 48, 53, 77, 19, 64, 83, + 52, 124, 1, 0, 0, 0, + 16, 14, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 172, 8, 0, 0, 160, 12, - 0, 0, 96, 13, 0, 0, - 65, 111, 110, 57, 116, 8, - 0, 0, 116, 8, 0, 0, - 0, 2, 254, 255, 64, 8, + 184, 8, 0, 0, 172, 12, + 0, 0, 108, 13, 0, 0, + 65, 111, 110, 57, 128, 8, + 0, 0, 128, 8, 0, 0, + 0, 2, 254, 255, 76, 8, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -169,14 +169,14 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 117, 1, 68, 66, 85, 71, + 120, 1, 68, 66, 85, 71, 40, 0, 0, 0, 168, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 39, 0, 0, 0, 20, 1, 0, 0, 5, 0, 0, 0, 68, 5, 0, 0, - 76, 2, 0, 0, 67, 58, + 76, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -189,7 +189,7 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -201,7 +201,7 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -216,58 +216,58 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 220, 5, + 0, 0, 255, 255, 232, 5, 0, 0, 0, 0, 255, 255, - 244, 5, 0, 0, 0, 0, - 255, 255, 0, 6, 0, 0, - 0, 0, 255, 255, 12, 6, + 0, 6, 0, 0, 0, 0, + 255, 255, 12, 6, 0, 0, + 0, 0, 255, 255, 24, 6, 0, 0, 0, 0, 255, 255, - 24, 6, 0, 0, 0, 0, - 255, 255, 36, 6, 0, 0, - 52, 0, 0, 0, 48, 6, + 36, 6, 0, 0, 0, 0, + 255, 255, 48, 6, 0, 0, + 52, 0, 0, 0, 60, 6, 0, 0, 52, 0, 0, 0, - 64, 6, 0, 0, 52, 0, - 0, 0, 76, 6, 0, 0, - 55, 0, 0, 0, 96, 6, + 76, 6, 0, 0, 52, 0, + 0, 0, 88, 6, 0, 0, + 55, 0, 0, 0, 108, 6, 0, 0, 56, 0, 0, 0, - 112, 6, 0, 0, 52, 0, - 0, 0, 128, 6, 0, 0, - 52, 0, 0, 0, 148, 6, + 124, 6, 0, 0, 52, 0, + 0, 0, 140, 6, 0, 0, + 52, 0, 0, 0, 160, 6, 0, 0, 55, 0, 0, 0, - 168, 6, 0, 0, 56, 0, - 0, 0, 184, 6, 0, 0, - 55, 0, 0, 0, 200, 6, + 180, 6, 0, 0, 56, 0, + 0, 0, 196, 6, 0, 0, + 55, 0, 0, 0, 212, 6, 0, 0, 56, 0, 0, 0, - 216, 6, 0, 0, 85, 0, - 1, 0, 232, 6, 0, 0, - 85, 0, 1, 0, 244, 6, + 228, 6, 0, 0, 85, 0, + 1, 0, 244, 6, 0, 0, + 85, 0, 1, 0, 0, 7, 0, 0, 86, 0, 1, 0, - 4, 7, 0, 0, 86, 0, - 1, 0, 20, 7, 0, 0, - 86, 0, 1, 0, 36, 7, + 16, 7, 0, 0, 86, 0, + 1, 0, 32, 7, 0, 0, + 86, 0, 1, 0, 48, 7, 0, 0, 87, 0, 1, 0, - 52, 7, 0, 0, 87, 0, - 1, 0, 68, 7, 0, 0, - 87, 0, 1, 0, 84, 7, + 64, 7, 0, 0, 87, 0, + 1, 0, 80, 7, 0, 0, + 87, 0, 1, 0, 96, 7, 0, 0, 87, 0, 1, 0, - 100, 7, 0, 0, 87, 0, - 1, 0, 116, 7, 0, 0, - 87, 0, 1, 0, 128, 7, + 112, 7, 0, 0, 87, 0, + 1, 0, 128, 7, 0, 0, + 87, 0, 1, 0, 140, 7, 0, 0, 14, 0, 2, 0, - 144, 7, 0, 0, 14, 0, - 2, 0, 160, 7, 0, 0, - 14, 0, 2, 0, 176, 7, + 156, 7, 0, 0, 14, 0, + 2, 0, 172, 7, 0, 0, + 14, 0, 2, 0, 188, 7, 0, 0, 85, 0, 1, 0, - 192, 7, 0, 0, 85, 0, - 1, 0, 208, 7, 0, 0, - 85, 0, 1, 0, 224, 7, + 204, 7, 0, 0, 85, 0, + 1, 0, 220, 7, 0, 0, + 85, 0, 1, 0, 236, 7, 0, 0, 157, 0, 0, 0, - 240, 7, 0, 0, 157, 0, - 0, 0, 4, 8, 0, 0, - 161, 0, 0, 0, 16, 8, + 252, 7, 0, 0, 157, 0, + 0, 0, 16, 8, 0, 0, + 161, 0, 0, 0, 28, 8, 0, 0, 166, 0, 0, 0, - 28, 8, 0, 0, 166, 0, - 0, 0, 40, 8, 0, 0, + 40, 8, 0, 0, 166, 0, + 0, 0, 52, 8, 0, 0, 86, 83, 83, 107, 105, 110, 110, 101, 100, 80, 105, 120, 101, 108, 76, 105, 103, 104, @@ -417,7 +417,9 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc index 326e288302b777a01c281219b562f39dac6219fe..3319b8adca7fd5e108d502022abe90e7e069d770 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc @@ -49,7 +49,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.xy, v3, c243.x mova a0.xy, r0.yxzw mul r0, v4.y, c26[a0.x] @@ -71,7 +71,7 @@ dp4 r1.z, v0, r3 // Skin::vin<2> dp3 r0.z, v1, r3 // Skin::vin<6> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov r1.w, v0.w dp4 oPos.z, r1, c24 // ::VSSkinnedPixelLightingTwoBones<15> dp4 oT1.x, r1, c15 // ::VSSkinnedPixelLightingTwoBones<2> @@ -84,17 +84,17 @@ rsq r0.x, r0.x mul oT2.xyz, r0.x, r2 // ::VSSkinnedPixelLightingTwoBones<6,7,8> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r0.x, r1, c14 max r0.x, r0.x, c243.y min oT1.w, r0.x, c243.z // ::VSSkinnedPixelLightingTwoBones<5> -#line 85 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 85 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r0.x, r1, c22 // ::vout<0> dp4 r0.y, r1, c23 // ::vout<1> dp4 r0.z, r1, c25 // ::vout<3> -#line 174 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 174 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.z, c242, r0 // ::VSSkinnedPixelLightingTwoBones<13,14> mov oPos.w, r0.z // ::VSSkinnedPixelLightingTwoBones<16> @@ -156,17 +156,17 @@ ret const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = { - 68, 88, 66, 67, 146, 0, - 191, 242, 86, 70, 57, 128, - 104, 67, 87, 60, 45, 136, - 149, 16, 1, 0, 0, 0, - 12, 15, 0, 0, 4, 0, + 68, 88, 66, 67, 194, 20, + 236, 114, 26, 232, 90, 103, + 7, 57, 158, 88, 236, 200, + 233, 23, 1, 0, 0, 0, + 24, 15, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 24, 9, 0, 0, 168, 13, - 0, 0, 104, 14, 0, 0, - 65, 111, 110, 57, 224, 8, - 0, 0, 224, 8, 0, 0, - 0, 2, 254, 255, 172, 8, + 36, 9, 0, 0, 180, 13, + 0, 0, 116, 14, 0, 0, + 65, 111, 110, 57, 236, 8, + 0, 0, 236, 8, 0, 0, + 0, 2, 254, 255, 184, 8, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -175,14 +175,14 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 126, 1, 68, 66, 85, 71, + 129, 1, 68, 66, 85, 71, 40, 0, 0, 0, 204, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 42, 0, 0, 0, 20, 1, 0, 0, 5, 0, 0, 0, 104, 5, 0, 0, - 100, 2, 0, 0, 67, 58, + 100, 2, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -195,7 +195,7 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -207,7 +207,7 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -222,62 +222,62 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 0, 6, + 0, 0, 255, 255, 12, 6, 0, 0, 0, 0, 255, 255, - 24, 6, 0, 0, 0, 0, - 255, 255, 36, 6, 0, 0, - 0, 0, 255, 255, 48, 6, + 36, 6, 0, 0, 0, 0, + 255, 255, 48, 6, 0, 0, + 0, 0, 255, 255, 60, 6, 0, 0, 0, 0, 255, 255, - 60, 6, 0, 0, 0, 0, - 255, 255, 72, 6, 0, 0, - 52, 0, 0, 0, 84, 6, + 72, 6, 0, 0, 0, 0, + 255, 255, 84, 6, 0, 0, + 52, 0, 0, 0, 96, 6, 0, 0, 52, 0, 0, 0, - 100, 6, 0, 0, 52, 0, - 0, 0, 112, 6, 0, 0, - 52, 0, 0, 0, 132, 6, + 112, 6, 0, 0, 52, 0, + 0, 0, 124, 6, 0, 0, + 52, 0, 0, 0, 144, 6, 0, 0, 55, 0, 0, 0, - 156, 6, 0, 0, 56, 0, - 0, 0, 172, 6, 0, 0, - 52, 0, 0, 0, 188, 6, + 168, 6, 0, 0, 56, 0, + 0, 0, 184, 6, 0, 0, + 52, 0, 0, 0, 200, 6, 0, 0, 52, 0, 0, 0, - 208, 6, 0, 0, 52, 0, - 0, 0, 228, 6, 0, 0, - 52, 0, 0, 0, 252, 6, + 220, 6, 0, 0, 52, 0, + 0, 0, 240, 6, 0, 0, + 52, 0, 0, 0, 8, 7, 0, 0, 55, 0, 0, 0, - 20, 7, 0, 0, 56, 0, - 0, 0, 36, 7, 0, 0, - 55, 0, 0, 0, 52, 7, + 32, 7, 0, 0, 56, 0, + 0, 0, 48, 7, 0, 0, + 55, 0, 0, 0, 64, 7, 0, 0, 56, 0, 0, 0, - 68, 7, 0, 0, 85, 0, - 1, 0, 84, 7, 0, 0, - 85, 0, 1, 0, 96, 7, + 80, 7, 0, 0, 85, 0, + 1, 0, 96, 7, 0, 0, + 85, 0, 1, 0, 108, 7, 0, 0, 86, 0, 1, 0, - 112, 7, 0, 0, 86, 0, - 1, 0, 128, 7, 0, 0, - 86, 0, 1, 0, 144, 7, + 124, 7, 0, 0, 86, 0, + 1, 0, 140, 7, 0, 0, + 86, 0, 1, 0, 156, 7, 0, 0, 87, 0, 1, 0, - 160, 7, 0, 0, 87, 0, - 1, 0, 176, 7, 0, 0, - 87, 0, 1, 0, 192, 7, + 172, 7, 0, 0, 87, 0, + 1, 0, 188, 7, 0, 0, + 87, 0, 1, 0, 204, 7, 0, 0, 87, 0, 1, 0, - 208, 7, 0, 0, 87, 0, - 1, 0, 224, 7, 0, 0, - 87, 0, 1, 0, 236, 7, + 220, 7, 0, 0, 87, 0, + 1, 0, 236, 7, 0, 0, + 87, 0, 1, 0, 248, 7, 0, 0, 14, 0, 2, 0, - 252, 7, 0, 0, 14, 0, - 2, 0, 12, 8, 0, 0, - 14, 0, 2, 0, 28, 8, + 8, 8, 0, 0, 14, 0, + 2, 0, 24, 8, 0, 0, + 14, 0, 2, 0, 40, 8, 0, 0, 85, 0, 1, 0, - 44, 8, 0, 0, 85, 0, - 1, 0, 60, 8, 0, 0, - 85, 0, 1, 0, 76, 8, + 56, 8, 0, 0, 85, 0, + 1, 0, 72, 8, 0, 0, + 85, 0, 1, 0, 88, 8, 0, 0, 174, 0, 0, 0, - 92, 8, 0, 0, 174, 0, - 0, 0, 112, 8, 0, 0, - 178, 0, 0, 0, 124, 8, + 104, 8, 0, 0, 174, 0, + 0, 0, 124, 8, 0, 0, + 178, 0, 0, 0, 136, 8, 0, 0, 183, 0, 0, 0, - 136, 8, 0, 0, 183, 0, - 0, 0, 148, 8, 0, 0, + 148, 8, 0, 0, 183, 0, + 0, 0, 160, 8, 0, 0, 86, 83, 83, 107, 105, 110, 110, 101, 100, 80, 105, 120, 101, 108, 76, 105, 103, 104, @@ -429,7 +429,9 @@ const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, + 32, 49, 48, 46, 48, 46, + 49, 48, 48, 49, 49, 46, + 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc index 047d5980217d4988f0e059abe1370399b5d4944a..b813e67be9e1cf90922616b2467a40e6b9107f90 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc @@ -48,7 +48,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0, v3, c243.x mova a0, r0.yxzw mul r1, v4.y, c26[a0.x] @@ -76,7 +76,7 @@ dp3 r1.z, v1, r3 // Skin::vin<6> dp4 r0.z, v0, r3 // Skin::vin<2> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 @@ -151,24 +151,24 @@ #line 63 dp4 oPos.z, r0, c24 // ::VSSkinnedVertexLightingFourBones<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedVertexLightingFourBones<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> -#line 93 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 93 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedVertexLightingFourBones<10,11> mov oPos.w, r0.x // ::VSSkinnedVertexLightingFourBones<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedVertexLightingFourBones<3> -#line 97 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 97 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedVertexLightingFourBones<8,9> // approximately 83 instruction slots used @@ -263,17 +263,17 @@ ret const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = { - 68, 88, 66, 67, 51, 115, - 67, 123, 215, 206, 157, 189, - 141, 71, 169, 45, 88, 67, - 184, 117, 1, 0, 0, 0, - 96, 26, 0, 0, 4, 0, + 68, 88, 66, 67, 36, 157, + 87, 113, 150, 21, 250, 23, + 26, 109, 79, 97, 4, 88, + 28, 186, 1, 0, 0, 0, + 108, 26, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 240, 14, 0, 0, 20, 25, - 0, 0, 212, 25, 0, 0, - 65, 111, 110, 57, 184, 14, - 0, 0, 184, 14, 0, 0, - 0, 2, 254, 255, 132, 14, + 252, 14, 0, 0, 32, 25, + 0, 0, 224, 25, 0, 0, + 65, 111, 110, 57, 196, 14, + 0, 0, 196, 14, 0, 0, + 0, 2, 254, 255, 144, 14, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -282,14 +282,14 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 91, 2, 68, 66, 85, 71, + 94, 2, 68, 66, 85, 71, 40, 0, 0, 0, 64, 9, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 79, 0, 0, 0, 20, 1, 0, 0, 15, 0, 0, 0, 20, 8, 0, 0, - 192, 3, 0, 0, 67, 58, + 192, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -302,7 +302,7 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -314,7 +314,7 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -329,111 +329,111 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 116, 9, + 0, 0, 255, 255, 128, 9, 0, 0, 0, 0, 255, 255, - 140, 9, 0, 0, 0, 0, - 255, 255, 152, 9, 0, 0, - 0, 0, 255, 255, 164, 9, + 152, 9, 0, 0, 0, 0, + 255, 255, 164, 9, 0, 0, + 0, 0, 255, 255, 176, 9, 0, 0, 0, 0, 255, 255, - 176, 9, 0, 0, 0, 0, - 255, 255, 188, 9, 0, 0, - 52, 0, 0, 0, 200, 9, + 188, 9, 0, 0, 0, 0, + 255, 255, 200, 9, 0, 0, + 52, 0, 0, 0, 212, 9, 0, 0, 52, 0, 0, 0, - 216, 9, 0, 0, 52, 0, - 0, 0, 228, 9, 0, 0, - 52, 0, 0, 0, 248, 9, + 228, 9, 0, 0, 52, 0, + 0, 0, 240, 9, 0, 0, + 52, 0, 0, 0, 4, 10, 0, 0, 52, 0, 0, 0, - 16, 10, 0, 0, 52, 0, - 0, 0, 40, 10, 0, 0, - 56, 0, 0, 0, 64, 10, + 28, 10, 0, 0, 52, 0, + 0, 0, 52, 10, 0, 0, + 56, 0, 0, 0, 76, 10, 0, 0, 55, 0, 0, 0, - 80, 10, 0, 0, 52, 0, - 0, 0, 96, 10, 0, 0, - 52, 0, 0, 0, 116, 10, + 92, 10, 0, 0, 52, 0, + 0, 0, 108, 10, 0, 0, + 52, 0, 0, 0, 128, 10, 0, 0, 52, 0, 0, 0, - 136, 10, 0, 0, 52, 0, - 0, 0, 160, 10, 0, 0, - 52, 0, 0, 0, 184, 10, + 148, 10, 0, 0, 52, 0, + 0, 0, 172, 10, 0, 0, + 52, 0, 0, 0, 196, 10, 0, 0, 52, 0, 0, 0, - 208, 10, 0, 0, 52, 0, - 0, 0, 232, 10, 0, 0, - 52, 0, 0, 0, 0, 11, + 220, 10, 0, 0, 52, 0, + 0, 0, 244, 10, 0, 0, + 52, 0, 0, 0, 12, 11, 0, 0, 56, 0, 0, 0, - 24, 11, 0, 0, 55, 0, - 0, 0, 40, 11, 0, 0, - 56, 0, 0, 0, 56, 11, + 36, 11, 0, 0, 55, 0, + 0, 0, 52, 11, 0, 0, + 56, 0, 0, 0, 68, 11, 0, 0, 55, 0, 0, 0, - 72, 11, 0, 0, 59, 0, - 1, 0, 88, 11, 0, 0, - 59, 0, 1, 0, 104, 11, + 84, 11, 0, 0, 59, 0, + 1, 0, 100, 11, 0, 0, + 59, 0, 1, 0, 116, 11, 0, 0, 59, 0, 1, 0, - 120, 11, 0, 0, 59, 0, - 1, 0, 136, 11, 0, 0, - 36, 0, 1, 0, 148, 11, + 132, 11, 0, 0, 59, 0, + 1, 0, 148, 11, 0, 0, + 36, 0, 1, 0, 160, 11, 0, 0, 36, 0, 1, 0, - 164, 11, 0, 0, 36, 0, - 1, 0, 180, 11, 0, 0, - 39, 0, 1, 0, 196, 11, + 176, 11, 0, 0, 36, 0, + 1, 0, 192, 11, 0, 0, + 39, 0, 1, 0, 208, 11, 0, 0, 41, 0, 1, 0, - 212, 11, 0, 0, 46, 0, - 1, 0, 228, 11, 0, 0, - 46, 0, 1, 0, 244, 11, + 224, 11, 0, 0, 46, 0, + 1, 0, 240, 11, 0, 0, + 46, 0, 1, 0, 0, 12, 0, 0, 46, 0, 1, 0, - 8, 12, 0, 0, 46, 0, - 1, 0, 28, 12, 0, 0, - 46, 0, 1, 0, 40, 12, + 20, 12, 0, 0, 46, 0, + 1, 0, 40, 12, 0, 0, + 46, 0, 1, 0, 52, 12, 0, 0, 57, 0, 1, 0, - 60, 12, 0, 0, 57, 0, - 1, 0, 72, 12, 0, 0, - 57, 0, 1, 0, 88, 12, + 72, 12, 0, 0, 57, 0, + 1, 0, 84, 12, 0, 0, + 57, 0, 1, 0, 100, 12, 0, 0, 57, 0, 1, 0, - 104, 12, 0, 0, 58, 0, - 1, 0, 120, 12, 0, 0, - 58, 0, 1, 0, 136, 12, + 116, 12, 0, 0, 58, 0, + 1, 0, 132, 12, 0, 0, + 58, 0, 1, 0, 148, 12, 0, 0, 33, 0, 1, 0, - 148, 12, 0, 0, 33, 0, - 1, 0, 164, 12, 0, 0, - 37, 0, 1, 0, 176, 12, + 160, 12, 0, 0, 33, 0, + 1, 0, 176, 12, 0, 0, + 37, 0, 1, 0, 188, 12, 0, 0, 33, 0, 1, 0, - 192, 12, 0, 0, 33, 0, - 1, 0, 208, 12, 0, 0, - 33, 0, 1, 0, 224, 12, + 204, 12, 0, 0, 33, 0, + 1, 0, 220, 12, 0, 0, + 33, 0, 1, 0, 236, 12, 0, 0, 37, 0, 1, 0, - 236, 12, 0, 0, 33, 0, - 1, 0, 252, 12, 0, 0, - 37, 0, 1, 0, 8, 13, + 248, 12, 0, 0, 33, 0, + 1, 0, 8, 13, 0, 0, + 37, 0, 1, 0, 20, 13, 0, 0, 42, 0, 1, 0, - 24, 13, 0, 0, 42, 0, - 1, 0, 40, 13, 0, 0, - 42, 0, 1, 0, 56, 13, + 36, 13, 0, 0, 42, 0, + 1, 0, 52, 13, 0, 0, + 42, 0, 1, 0, 68, 13, 0, 0, 42, 0, 1, 0, - 68, 13, 0, 0, 42, 0, - 1, 0, 80, 13, 0, 0, - 42, 0, 1, 0, 92, 13, + 80, 13, 0, 0, 42, 0, + 1, 0, 92, 13, 0, 0, + 42, 0, 1, 0, 104, 13, 0, 0, 42, 0, 1, 0, - 108, 13, 0, 0, 47, 0, - 1, 0, 120, 13, 0, 0, - 42, 0, 1, 0, 136, 13, + 120, 13, 0, 0, 47, 0, + 1, 0, 132, 13, 0, 0, + 42, 0, 1, 0, 148, 13, 0, 0, 42, 0, 1, 0, - 148, 13, 0, 0, 47, 0, - 1, 0, 160, 13, 0, 0, - 47, 0, 1, 0, 180, 13, + 160, 13, 0, 0, 47, 0, + 1, 0, 172, 13, 0, 0, + 47, 0, 1, 0, 192, 13, 0, 0, 47, 0, 1, 0, - 200, 13, 0, 0, 63, 0, - 1, 0, 216, 13, 0, 0, - 14, 0, 2, 0, 232, 13, + 212, 13, 0, 0, 63, 0, + 1, 0, 228, 13, 0, 0, + 14, 0, 2, 0, 244, 13, 0, 0, 14, 0, 2, 0, - 248, 13, 0, 0, 14, 0, - 2, 0, 8, 14, 0, 0, - 63, 0, 1, 0, 24, 14, + 4, 14, 0, 0, 14, 0, + 2, 0, 20, 14, 0, 0, + 63, 0, 1, 0, 36, 14, 0, 0, 63, 0, 1, 0, - 40, 14, 0, 0, 63, 0, - 1, 0, 56, 14, 0, 0, - 93, 0, 0, 0, 72, 14, + 52, 14, 0, 0, 63, 0, + 1, 0, 68, 14, 0, 0, + 93, 0, 0, 0, 84, 14, 0, 0, 93, 0, 0, 0, - 92, 14, 0, 0, 46, 0, - 1, 0, 104, 14, 0, 0, - 97, 0, 0, 0, 116, 14, + 104, 14, 0, 0, 46, 0, + 1, 0, 116, 14, 0, 0, + 97, 0, 0, 0, 128, 14, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -684,7 +684,9 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 81, 0, 0, 5, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc index 146f175ab9dba15411e156be84e37ab325a9c7ed..09850bf50a5535111e048a89886a69884f928877 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc @@ -48,7 +48,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.x, v3.x, c243.x mova a0.x, r0.x mul r0, v4.x, c26[a0.x] // ::skinning<0,3,6,9> @@ -67,7 +67,7 @@ dp3 r1.z, v1, r3 // Skin::vin<6> dp4 r0.z, v0, r3 // Skin::vin<2> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 @@ -142,24 +142,24 @@ #line 63 dp4 oPos.z, r0, c24 // ::VSSkinnedVertexLightingOneBone<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedVertexLightingOneBone<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> -#line 61 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 61 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedVertexLightingOneBone<10,11> mov oPos.w, r0.x // ::VSSkinnedVertexLightingOneBone<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedVertexLightingOneBone<3> -#line 65 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 65 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedVertexLightingOneBone<8,9> // approximately 74 instruction slots used @@ -245,17 +245,17 @@ ret const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = { - 68, 88, 66, 67, 138, 131, - 143, 200, 165, 140, 158, 241, - 96, 249, 47, 18, 4, 71, - 218, 185, 1, 0, 0, 0, - 56, 23, 0, 0, 4, 0, + 68, 88, 66, 67, 121, 255, + 0, 202, 130, 28, 228, 143, + 40, 196, 216, 143, 88, 87, + 129, 23, 1, 0, 0, 0, + 68, 23, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 132, 13, 0, 0, 236, 21, - 0, 0, 172, 22, 0, 0, - 65, 111, 110, 57, 76, 13, - 0, 0, 76, 13, 0, 0, - 0, 2, 254, 255, 24, 13, + 144, 13, 0, 0, 248, 21, + 0, 0, 184, 22, 0, 0, + 65, 111, 110, 57, 88, 13, + 0, 0, 88, 13, 0, 0, + 0, 2, 254, 255, 36, 13, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -264,14 +264,14 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 54, 2, 68, 66, 85, 71, + 57, 2, 68, 66, 85, 71, 40, 0, 0, 0, 172, 8, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 70, 0, 0, 0, 20, 1, 0, 0, 15, 0, 0, 0, 128, 7, 0, 0, - 120, 3, 0, 0, 67, 58, + 120, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -284,7 +284,7 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -296,7 +296,7 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -311,99 +311,99 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 224, 8, + 0, 0, 255, 255, 236, 8, 0, 0, 0, 0, 255, 255, - 248, 8, 0, 0, 0, 0, - 255, 255, 4, 9, 0, 0, - 0, 0, 255, 255, 16, 9, + 4, 9, 0, 0, 0, 0, + 255, 255, 16, 9, 0, 0, + 0, 0, 255, 255, 28, 9, 0, 0, 0, 0, 255, 255, - 28, 9, 0, 0, 0, 0, - 255, 255, 40, 9, 0, 0, - 52, 0, 0, 0, 52, 9, + 40, 9, 0, 0, 0, 0, + 255, 255, 52, 9, 0, 0, + 52, 0, 0, 0, 64, 9, 0, 0, 52, 0, 0, 0, - 68, 9, 0, 0, 52, 0, - 0, 0, 80, 9, 0, 0, - 56, 0, 0, 0, 100, 9, + 80, 9, 0, 0, 52, 0, + 0, 0, 92, 9, 0, 0, + 56, 0, 0, 0, 112, 9, 0, 0, 55, 0, 0, 0, - 116, 9, 0, 0, 52, 0, - 0, 0, 132, 9, 0, 0, - 52, 0, 0, 0, 152, 9, + 128, 9, 0, 0, 52, 0, + 0, 0, 144, 9, 0, 0, + 52, 0, 0, 0, 164, 9, 0, 0, 56, 0, 0, 0, - 172, 9, 0, 0, 55, 0, - 0, 0, 188, 9, 0, 0, - 56, 0, 0, 0, 204, 9, + 184, 9, 0, 0, 55, 0, + 0, 0, 200, 9, 0, 0, + 56, 0, 0, 0, 216, 9, 0, 0, 55, 0, 0, 0, - 220, 9, 0, 0, 59, 0, - 1, 0, 236, 9, 0, 0, - 59, 0, 1, 0, 252, 9, + 232, 9, 0, 0, 59, 0, + 1, 0, 248, 9, 0, 0, + 59, 0, 1, 0, 8, 10, 0, 0, 59, 0, 1, 0, - 12, 10, 0, 0, 59, 0, - 1, 0, 28, 10, 0, 0, - 36, 0, 1, 0, 40, 10, + 24, 10, 0, 0, 59, 0, + 1, 0, 40, 10, 0, 0, + 36, 0, 1, 0, 52, 10, 0, 0, 36, 0, 1, 0, - 56, 10, 0, 0, 36, 0, - 1, 0, 72, 10, 0, 0, - 39, 0, 1, 0, 88, 10, + 68, 10, 0, 0, 36, 0, + 1, 0, 84, 10, 0, 0, + 39, 0, 1, 0, 100, 10, 0, 0, 41, 0, 1, 0, - 104, 10, 0, 0, 46, 0, - 1, 0, 120, 10, 0, 0, - 46, 0, 1, 0, 136, 10, + 116, 10, 0, 0, 46, 0, + 1, 0, 132, 10, 0, 0, + 46, 0, 1, 0, 148, 10, 0, 0, 46, 0, 1, 0, - 156, 10, 0, 0, 46, 0, - 1, 0, 176, 10, 0, 0, - 46, 0, 1, 0, 188, 10, + 168, 10, 0, 0, 46, 0, + 1, 0, 188, 10, 0, 0, + 46, 0, 1, 0, 200, 10, 0, 0, 57, 0, 1, 0, - 208, 10, 0, 0, 57, 0, - 1, 0, 220, 10, 0, 0, - 57, 0, 1, 0, 236, 10, + 220, 10, 0, 0, 57, 0, + 1, 0, 232, 10, 0, 0, + 57, 0, 1, 0, 248, 10, 0, 0, 57, 0, 1, 0, - 252, 10, 0, 0, 58, 0, - 1, 0, 12, 11, 0, 0, - 58, 0, 1, 0, 28, 11, + 8, 11, 0, 0, 58, 0, + 1, 0, 24, 11, 0, 0, + 58, 0, 1, 0, 40, 11, 0, 0, 33, 0, 1, 0, - 40, 11, 0, 0, 33, 0, - 1, 0, 56, 11, 0, 0, - 37, 0, 1, 0, 68, 11, + 52, 11, 0, 0, 33, 0, + 1, 0, 68, 11, 0, 0, + 37, 0, 1, 0, 80, 11, 0, 0, 33, 0, 1, 0, - 84, 11, 0, 0, 33, 0, - 1, 0, 100, 11, 0, 0, - 33, 0, 1, 0, 116, 11, + 96, 11, 0, 0, 33, 0, + 1, 0, 112, 11, 0, 0, + 33, 0, 1, 0, 128, 11, 0, 0, 37, 0, 1, 0, - 128, 11, 0, 0, 33, 0, - 1, 0, 144, 11, 0, 0, - 37, 0, 1, 0, 156, 11, + 140, 11, 0, 0, 33, 0, + 1, 0, 156, 11, 0, 0, + 37, 0, 1, 0, 168, 11, 0, 0, 42, 0, 1, 0, - 172, 11, 0, 0, 42, 0, - 1, 0, 188, 11, 0, 0, - 42, 0, 1, 0, 204, 11, + 184, 11, 0, 0, 42, 0, + 1, 0, 200, 11, 0, 0, + 42, 0, 1, 0, 216, 11, 0, 0, 42, 0, 1, 0, - 216, 11, 0, 0, 42, 0, - 1, 0, 228, 11, 0, 0, - 42, 0, 1, 0, 240, 11, + 228, 11, 0, 0, 42, 0, + 1, 0, 240, 11, 0, 0, + 42, 0, 1, 0, 252, 11, 0, 0, 42, 0, 1, 0, - 0, 12, 0, 0, 47, 0, - 1, 0, 12, 12, 0, 0, - 42, 0, 1, 0, 28, 12, + 12, 12, 0, 0, 47, 0, + 1, 0, 24, 12, 0, 0, + 42, 0, 1, 0, 40, 12, 0, 0, 42, 0, 1, 0, - 40, 12, 0, 0, 47, 0, - 1, 0, 52, 12, 0, 0, - 47, 0, 1, 0, 72, 12, + 52, 12, 0, 0, 47, 0, + 1, 0, 64, 12, 0, 0, + 47, 0, 1, 0, 84, 12, 0, 0, 47, 0, 1, 0, - 92, 12, 0, 0, 63, 0, - 1, 0, 108, 12, 0, 0, - 14, 0, 2, 0, 124, 12, + 104, 12, 0, 0, 63, 0, + 1, 0, 120, 12, 0, 0, + 14, 0, 2, 0, 136, 12, 0, 0, 14, 0, 2, 0, - 140, 12, 0, 0, 14, 0, - 2, 0, 156, 12, 0, 0, - 63, 0, 1, 0, 172, 12, + 152, 12, 0, 0, 14, 0, + 2, 0, 168, 12, 0, 0, + 63, 0, 1, 0, 184, 12, 0, 0, 63, 0, 1, 0, - 188, 12, 0, 0, 63, 0, - 1, 0, 204, 12, 0, 0, - 61, 0, 0, 0, 220, 12, + 200, 12, 0, 0, 63, 0, + 1, 0, 216, 12, 0, 0, + 61, 0, 0, 0, 232, 12, 0, 0, 61, 0, 0, 0, - 240, 12, 0, 0, 46, 0, - 1, 0, 252, 12, 0, 0, - 65, 0, 0, 0, 8, 13, + 252, 12, 0, 0, 46, 0, + 1, 0, 8, 13, 0, 0, + 65, 0, 0, 0, 20, 13, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -641,7 +641,9 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 128, 63, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc index 6006b6ea4530ef67606a5821e4aca39cd3a62a48..9c4dd2b484eba42c1f8342127fc72c6877b1f547 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc @@ -48,7 +48,7 @@ dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> -#line 52 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 52 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.xy, v3, c243.x mova a0.xy, r0.yxzw mul r0, v4.y, c26[a0.x] @@ -70,7 +70,7 @@ dp3 r1.z, v1, r3 // Skin::vin<6> dp4 r0.z, v0, r3 // Skin::vin<2> -#line 59 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 59 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 @@ -145,24 +145,24 @@ #line 63 dp4 oPos.z, r0, c24 // ::VSSkinnedVertexLightingTwoBones<12> -#line 14 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" +#line 14 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedVertexLightingTwoBones<7> -#line 63 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 63 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> -#line 77 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 77 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedVertexLightingTwoBones<10,11> mov oPos.w, r0.x // ::VSSkinnedVertexLightingTwoBones<13> -#line 46 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" +#line 46 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedVertexLightingTwoBones<3> -#line 81 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" +#line 81 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedVertexLightingTwoBones<8,9> // approximately 77 instruction slots used @@ -251,17 +251,17 @@ ret const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = { - 68, 88, 66, 67, 212, 21, - 13, 85, 47, 58, 239, 39, - 103, 86, 186, 79, 72, 239, - 197, 76, 1, 0, 0, 0, - 52, 24, 0, 0, 4, 0, + 68, 88, 66, 67, 121, 215, + 18, 71, 171, 4, 63, 79, + 115, 157, 2, 131, 233, 40, + 137, 247, 1, 0, 0, 0, + 64, 24, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 228, 13, 0, 0, 232, 22, - 0, 0, 168, 23, 0, 0, - 65, 111, 110, 57, 172, 13, - 0, 0, 172, 13, 0, 0, - 0, 2, 254, 255, 120, 13, + 240, 13, 0, 0, 244, 22, + 0, 0, 180, 23, 0, 0, + 65, 111, 110, 57, 184, 13, + 0, 0, 184, 13, 0, 0, + 0, 2, 254, 255, 132, 13, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -270,14 +270,14 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, - 60, 2, 68, 66, 85, 71, + 63, 2, 68, 66, 85, 71, 40, 0, 0, 0, 196, 8, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 1, 0, 0, 73, 0, 0, 0, 20, 1, 0, 0, 15, 0, 0, 0, 152, 7, 0, 0, - 144, 3, 0, 0, 67, 58, + 144, 3, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -290,7 +290,7 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, - 102, 120, 0, 67, 58, 92, + 102, 120, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, 112, @@ -302,7 +302,7 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, - 102, 120, 104, 0, 67, 58, + 102, 120, 104, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -317,103 +317,103 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = 120, 104, 0, 171, 171, 171, 40, 0, 0, 0, 117, 0, 0, 0, 190, 0, 0, 0, - 0, 0, 255, 255, 248, 8, + 0, 0, 255, 255, 4, 9, 0, 0, 0, 0, 255, 255, - 16, 9, 0, 0, 0, 0, - 255, 255, 28, 9, 0, 0, - 0, 0, 255, 255, 40, 9, + 28, 9, 0, 0, 0, 0, + 255, 255, 40, 9, 0, 0, + 0, 0, 255, 255, 52, 9, 0, 0, 0, 0, 255, 255, - 52, 9, 0, 0, 0, 0, - 255, 255, 64, 9, 0, 0, - 52, 0, 0, 0, 76, 9, + 64, 9, 0, 0, 0, 0, + 255, 255, 76, 9, 0, 0, + 52, 0, 0, 0, 88, 9, 0, 0, 52, 0, 0, 0, - 92, 9, 0, 0, 52, 0, - 0, 0, 104, 9, 0, 0, - 52, 0, 0, 0, 124, 9, + 104, 9, 0, 0, 52, 0, + 0, 0, 116, 9, 0, 0, + 52, 0, 0, 0, 136, 9, 0, 0, 56, 0, 0, 0, - 148, 9, 0, 0, 55, 0, - 0, 0, 164, 9, 0, 0, - 52, 0, 0, 0, 180, 9, + 160, 9, 0, 0, 55, 0, + 0, 0, 176, 9, 0, 0, + 52, 0, 0, 0, 192, 9, 0, 0, 52, 0, 0, 0, - 200, 9, 0, 0, 52, 0, - 0, 0, 220, 9, 0, 0, - 52, 0, 0, 0, 244, 9, + 212, 9, 0, 0, 52, 0, + 0, 0, 232, 9, 0, 0, + 52, 0, 0, 0, 0, 10, 0, 0, 56, 0, 0, 0, - 12, 10, 0, 0, 55, 0, - 0, 0, 28, 10, 0, 0, - 56, 0, 0, 0, 44, 10, + 24, 10, 0, 0, 55, 0, + 0, 0, 40, 10, 0, 0, + 56, 0, 0, 0, 56, 10, 0, 0, 55, 0, 0, 0, - 60, 10, 0, 0, 59, 0, - 1, 0, 76, 10, 0, 0, - 59, 0, 1, 0, 92, 10, + 72, 10, 0, 0, 59, 0, + 1, 0, 88, 10, 0, 0, + 59, 0, 1, 0, 104, 10, 0, 0, 59, 0, 1, 0, - 108, 10, 0, 0, 59, 0, - 1, 0, 124, 10, 0, 0, - 36, 0, 1, 0, 136, 10, + 120, 10, 0, 0, 59, 0, + 1, 0, 136, 10, 0, 0, + 36, 0, 1, 0, 148, 10, 0, 0, 36, 0, 1, 0, - 152, 10, 0, 0, 36, 0, - 1, 0, 168, 10, 0, 0, - 39, 0, 1, 0, 184, 10, + 164, 10, 0, 0, 36, 0, + 1, 0, 180, 10, 0, 0, + 39, 0, 1, 0, 196, 10, 0, 0, 41, 0, 1, 0, - 200, 10, 0, 0, 46, 0, - 1, 0, 216, 10, 0, 0, - 46, 0, 1, 0, 232, 10, + 212, 10, 0, 0, 46, 0, + 1, 0, 228, 10, 0, 0, + 46, 0, 1, 0, 244, 10, 0, 0, 46, 0, 1, 0, - 252, 10, 0, 0, 46, 0, - 1, 0, 16, 11, 0, 0, - 46, 0, 1, 0, 28, 11, + 8, 11, 0, 0, 46, 0, + 1, 0, 28, 11, 0, 0, + 46, 0, 1, 0, 40, 11, 0, 0, 57, 0, 1, 0, - 48, 11, 0, 0, 57, 0, - 1, 0, 60, 11, 0, 0, - 57, 0, 1, 0, 76, 11, + 60, 11, 0, 0, 57, 0, + 1, 0, 72, 11, 0, 0, + 57, 0, 1, 0, 88, 11, 0, 0, 57, 0, 1, 0, - 92, 11, 0, 0, 58, 0, - 1, 0, 108, 11, 0, 0, - 58, 0, 1, 0, 124, 11, + 104, 11, 0, 0, 58, 0, + 1, 0, 120, 11, 0, 0, + 58, 0, 1, 0, 136, 11, 0, 0, 33, 0, 1, 0, - 136, 11, 0, 0, 33, 0, - 1, 0, 152, 11, 0, 0, - 37, 0, 1, 0, 164, 11, + 148, 11, 0, 0, 33, 0, + 1, 0, 164, 11, 0, 0, + 37, 0, 1, 0, 176, 11, 0, 0, 33, 0, 1, 0, - 180, 11, 0, 0, 33, 0, - 1, 0, 196, 11, 0, 0, - 33, 0, 1, 0, 212, 11, + 192, 11, 0, 0, 33, 0, + 1, 0, 208, 11, 0, 0, + 33, 0, 1, 0, 224, 11, 0, 0, 37, 0, 1, 0, - 224, 11, 0, 0, 33, 0, - 1, 0, 240, 11, 0, 0, - 37, 0, 1, 0, 252, 11, + 236, 11, 0, 0, 33, 0, + 1, 0, 252, 11, 0, 0, + 37, 0, 1, 0, 8, 12, 0, 0, 42, 0, 1, 0, - 12, 12, 0, 0, 42, 0, - 1, 0, 28, 12, 0, 0, - 42, 0, 1, 0, 44, 12, + 24, 12, 0, 0, 42, 0, + 1, 0, 40, 12, 0, 0, + 42, 0, 1, 0, 56, 12, 0, 0, 42, 0, 1, 0, - 56, 12, 0, 0, 42, 0, - 1, 0, 68, 12, 0, 0, - 42, 0, 1, 0, 80, 12, + 68, 12, 0, 0, 42, 0, + 1, 0, 80, 12, 0, 0, + 42, 0, 1, 0, 92, 12, 0, 0, 42, 0, 1, 0, - 96, 12, 0, 0, 47, 0, - 1, 0, 108, 12, 0, 0, - 42, 0, 1, 0, 124, 12, + 108, 12, 0, 0, 47, 0, + 1, 0, 120, 12, 0, 0, + 42, 0, 1, 0, 136, 12, 0, 0, 42, 0, 1, 0, - 136, 12, 0, 0, 47, 0, - 1, 0, 148, 12, 0, 0, - 47, 0, 1, 0, 168, 12, + 148, 12, 0, 0, 47, 0, + 1, 0, 160, 12, 0, 0, + 47, 0, 1, 0, 180, 12, 0, 0, 47, 0, 1, 0, - 188, 12, 0, 0, 63, 0, - 1, 0, 204, 12, 0, 0, - 14, 0, 2, 0, 220, 12, + 200, 12, 0, 0, 63, 0, + 1, 0, 216, 12, 0, 0, + 14, 0, 2, 0, 232, 12, 0, 0, 14, 0, 2, 0, - 236, 12, 0, 0, 14, 0, - 2, 0, 252, 12, 0, 0, - 63, 0, 1, 0, 12, 13, + 248, 12, 0, 0, 14, 0, + 2, 0, 8, 13, 0, 0, + 63, 0, 1, 0, 24, 13, 0, 0, 63, 0, 1, 0, - 28, 13, 0, 0, 63, 0, - 1, 0, 44, 13, 0, 0, - 77, 0, 0, 0, 60, 13, + 40, 13, 0, 0, 63, 0, + 1, 0, 56, 13, 0, 0, + 77, 0, 0, 0, 72, 13, 0, 0, 77, 0, 0, 0, - 80, 13, 0, 0, 46, 0, - 1, 0, 92, 13, 0, 0, - 81, 0, 0, 0, 104, 13, + 92, 13, 0, 0, 46, 0, + 1, 0, 104, 13, 0, 0, + 81, 0, 0, 0, 116, 13, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, @@ -651,7 +651,9 @@ const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 81, 0, + 48, 46, 48, 46, 49, 48, + 48, 49, 49, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 128, 63, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc index 6446b5eb148d8aef335be71b20787dc502ad501b..8fbbd43904bcb18348ebf83b174a176219233541 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc @@ -32,7 +32,7 @@ dcl t1.xy // texCoord<0,1> dcl_2d s0 -#line 33 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SpriteEffect.fx" +#line 33 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SpriteEffect.fx" texld r0, t1, s0 mul r0, r0, t0 // ::SpritePixelShader<0,1,2,3> mov oC0, r0 // ::SpritePixelShader<0,1,2,3> @@ -53,31 +53,31 @@ ret const BYTE SpriteEffect_SpritePixelShader[] = { - 68, 88, 66, 67, 210, 231, - 76, 180, 17, 3, 192, 38, - 93, 177, 187, 117, 222, 165, - 188, 182, 1, 0, 0, 0, - 116, 3, 0, 0, 4, 0, + 68, 88, 66, 67, 83, 197, + 238, 212, 200, 62, 8, 111, + 190, 68, 117, 84, 180, 95, + 104, 220, 1, 0, 0, 0, + 128, 3, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 84, 2, 0, 0, 240, 2, - 0, 0, 64, 3, 0, 0, - 65, 111, 110, 57, 28, 2, - 0, 0, 28, 2, 0, 0, - 0, 2, 255, 255, 244, 1, + 96, 2, 0, 0, 252, 2, + 0, 0, 76, 3, 0, 0, + 65, 111, 110, 57, 40, 2, + 0, 0, 40, 2, 0, 0, + 0, 2, 255, 255, 0, 2, 0, 0, 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 2, 255, 255, 254, 255, - 102, 0, 68, 66, 85, 71, + 105, 0, 68, 66, 85, 71, 40, 0, 0, 0, 108, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 6, 0, 0, 0, 120, 0, 0, 0, 3, 0, 0, 0, 48, 1, 0, 0, - 168, 0, 0, 0, 67, 58, + 168, 0, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -91,14 +91,14 @@ const BYTE SpriteEffect_SpritePixelShader[] = 114, 105, 116, 101, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, - 0, 0, 255, 255, 160, 1, + 0, 0, 255, 255, 172, 1, 0, 0, 0, 0, 255, 255, - 172, 1, 0, 0, 0, 0, - 255, 255, 184, 1, 0, 0, - 33, 0, 0, 0, 196, 1, + 184, 1, 0, 0, 0, 0, + 255, 255, 196, 1, 0, 0, + 33, 0, 0, 0, 208, 1, 0, 0, 33, 0, 0, 0, - 212, 1, 0, 0, 33, 0, - 0, 0, 228, 1, 0, 0, + 224, 1, 0, 0, 33, 0, + 0, 0, 240, 1, 0, 0, 83, 112, 114, 105, 116, 101, 80, 105, 120, 101, 108, 83, 104, 97, 100, 101, 114, 0, @@ -138,7 +138,9 @@ const BYTE SpriteEffect_SpritePixelShader[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, 0, 0, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc b/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc index fa065c57e754da5fe2f9c1c4fb9e043eba20d64d..db013a891ed6ae462fc8c96e478fe6d5a7bf9e56 100644 --- a/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc +++ b/Kits/DirectXTK/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc @@ -42,7 +42,7 @@ dcl_texcoord1 v1 // texCoord<0,1> dcl_texcoord2 v2 // position<0,1,2,3> -#line 26 "C:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SpriteEffect.fx" +#line 26 "D:\ATG Sample Development\st_dev\Kits\DirectXTK\Src\Shaders\SpriteEffect.fx" mul r0, v2.y, c2 mad r0, v2.x, c1, r0 mad r0, v2.z, c3, r0 @@ -74,17 +74,17 @@ ret const BYTE SpriteEffect_SpriteVertexShader[] = { - 68, 88, 66, 67, 5, 73, - 202, 97, 204, 3, 14, 85, - 16, 11, 241, 197, 25, 93, - 20, 215, 1, 0, 0, 0, - 44, 5, 0, 0, 4, 0, + 68, 88, 66, 67, 105, 23, + 88, 21, 79, 231, 83, 120, + 151, 30, 36, 113, 187, 154, + 204, 234, 1, 0, 0, 0, + 56, 5, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, - 12, 3, 0, 0, 68, 4, - 0, 0, 184, 4, 0, 0, - 65, 111, 110, 57, 212, 2, - 0, 0, 212, 2, 0, 0, - 0, 2, 254, 255, 160, 2, + 24, 3, 0, 0, 80, 4, + 0, 0, 196, 4, 0, 0, + 65, 111, 110, 57, 224, 2, + 0, 0, 224, 2, 0, 0, + 0, 2, 254, 255, 172, 2, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, @@ -93,14 +93,14 @@ const BYTE SpriteEffect_SpriteVertexShader[] = 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 254, 255, 254, 255, - 123, 0, 68, 66, 85, 71, + 126, 0, 68, 66, 85, 71, 40, 0, 0, 0, 192, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 0, 0, 0, 11, 0, 0, 0, 120, 0, 0, 0, 3, 0, 0, 0, 132, 1, 0, 0, - 208, 0, 0, 0, 67, 58, + 208, 0, 0, 0, 68, 58, 92, 65, 84, 71, 32, 83, 97, 109, 112, 108, 101, 32, 68, 101, 118, 101, 108, 111, @@ -114,21 +114,21 @@ const BYTE SpriteEffect_SpriteVertexShader[] = 114, 105, 116, 101, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 40, 0, 0, 0, - 0, 0, 255, 255, 244, 1, + 0, 0, 255, 255, 0, 2, 0, 0, 0, 0, 255, 255, - 0, 2, 0, 0, 0, 0, - 255, 255, 12, 2, 0, 0, - 26, 0, 0, 0, 24, 2, + 12, 2, 0, 0, 0, 0, + 255, 255, 24, 2, 0, 0, + 26, 0, 0, 0, 36, 2, 0, 0, 26, 0, 0, 0, - 40, 2, 0, 0, 26, 0, - 0, 0, 60, 2, 0, 0, - 26, 0, 0, 0, 80, 2, + 52, 2, 0, 0, 26, 0, + 0, 0, 72, 2, 0, 0, + 26, 0, 0, 0, 92, 2, 0, 0, 24, 0, 0, 0, - 100, 2, 0, 0, 24, 0, - 0, 0, 120, 2, 0, 0, - 22, 0, 0, 0, 132, 2, + 112, 2, 0, 0, 24, 0, + 0, 0, 132, 2, 0, 0, + 22, 0, 0, 0, 144, 2, 0, 0, 23, 0, 0, 0, - 144, 2, 0, 0, 83, 112, + 156, 2, 0, 0, 83, 112, 114, 105, 116, 101, 86, 101, 114, 116, 101, 120, 83, 104, 97, 100, 101, 114, 0, 99, @@ -175,7 +175,9 @@ const BYTE SpriteEffect_SpriteVertexShader[] = 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, - 49, 0, 31, 0, 0, 2, + 48, 46, 49, 48, 48, 49, + 49, 46, 49, 54, 51, 56, + 52, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, 1, 0, diff --git a/Kits/DirectXTK/Src/SharedResourcePool.h b/Kits/DirectXTK/Src/SharedResourcePool.h index 1b060c5742e287cd75a8e2b006e8b651c3801547..459e35ca6fdce1f6a62e39875c352ecc11b99b80 100644 --- a/Kits/DirectXTK/Src/SharedResourcePool.h +++ b/Kits/DirectXTK/Src/SharedResourcePool.h @@ -25,7 +25,7 @@ namespace DirectX // This is used to avoid duplicate resource creation, so that for instance a caller can // create any number of SpriteBatch instances, but these can internally share shaders and // vertex buffer if more than one SpriteBatch uses the same underlying D3D device. - template + template class SharedResourcePool { public: @@ -37,7 +37,7 @@ namespace DirectX SharedResourcePool& operator= (SharedResourcePool const&) = delete; // Allocates or looks up the shared TData instance for the specified key. - std::shared_ptr DemandCreate(TKey key) + std::shared_ptr DemandCreate(TKey key, TConstructorArgs... args) { std::lock_guard lock(mResourceMap->mutex); @@ -55,7 +55,7 @@ namespace DirectX } // Allocate a new instance. - auto newValue = std::make_shared(key, mResourceMap); + auto newValue = std::make_shared(key, mResourceMap, args...); mResourceMap->insert(std::make_pair(key, newValue)); @@ -77,10 +77,10 @@ namespace DirectX // to remove instances from our pool before they are freed. struct WrappedData : public TData { - WrappedData(TKey key, std::shared_ptr const& resourceMap) + WrappedData(TKey key, std::shared_ptr const& resourceMap, TConstructorArgs... args) : mKey(key), mResourceMap(resourceMap), - TData(key) + TData(key, args...) { } ~WrappedData() diff --git a/Kits/DirectXTK/Src/SimpleMath.cpp b/Kits/DirectXTK/Src/SimpleMath.cpp index 523415914187abbe3923045bd936fd3adf95350c..6fee593021d1e4b41ea4364768c74a2e93029190 100644 --- a/Kits/DirectXTK/Src/SimpleMath.cpp +++ b/Kits/DirectXTK/Src/SimpleMath.cpp @@ -97,6 +97,7 @@ namespace DirectX * ****************************************************************************/ +#if defined(__d3d11_h__) || defined(__d3d11_x_h__) static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D11_VIEWPORT), "Size mismatch"); static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, x) == FIELD_OFFSET(D3D11_VIEWPORT, TopLeftX), "Layout mismatch"); static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, y) == FIELD_OFFSET(D3D11_VIEWPORT, TopLeftY), "Layout mismatch"); @@ -104,6 +105,17 @@ static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, width) == FIELD_OFFSET static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, height) == FIELD_OFFSET(D3D11_VIEWPORT, Height), "Layout mismatch"); static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, minDepth) == FIELD_OFFSET(D3D11_VIEWPORT, MinDepth), "Layout mismatch"); static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, maxDepth) == FIELD_OFFSET(D3D11_VIEWPORT, MaxDepth), "Layout mismatch"); +#endif + +#if defined(__d3d12_h__) || defined(__d3d12_x_h__) +static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D12_VIEWPORT), "Size mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, x) == FIELD_OFFSET(D3D12_VIEWPORT, TopLeftX), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, y) == FIELD_OFFSET(D3D12_VIEWPORT, TopLeftY), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, width) == FIELD_OFFSET(D3D12_VIEWPORT, Width), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, height) == FIELD_OFFSET(D3D12_VIEWPORT, Height), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, minDepth) == FIELD_OFFSET(D3D12_VIEWPORT, MinDepth), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, maxDepth) == FIELD_OFFSET(D3D12_VIEWPORT, MaxDepth), "Layout mismatch"); +#endif RECT DirectX::SimpleMath::Viewport::ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight) { diff --git a/Kits/DirectXTK/Src/SpriteFont.cpp b/Kits/DirectXTK/Src/SpriteFont.cpp index c938cd48f5670ed8ca108565dfc7507822e3140f..7aee72591061401ca8a7f89cd48e54c452431d51 100644 --- a/Kits/DirectXTK/Src/SpriteFont.cpp +++ b/Kits/DirectXTK/Src/SpriteFont.cpp @@ -203,14 +203,16 @@ void SpriteFont::Impl::ForEachGlyph(_In_z_ wchar_t const* text, TAction action) if (x < 0) x = 0; + float advance = glyph->Subrect.right - glyph->Subrect.left + glyph->XAdvance; + if ( !iswspace(character) || ( ( glyph->Subrect.right - glyph->Subrect.left ) > 1 ) || ( ( glyph->Subrect.bottom - glyph->Subrect.top ) > 1 ) ) { - action(glyph, x, y); + action(glyph, x, y, advance); } - x += glyph->Subrect.right - glyph->Subrect.left + glyph->XAdvance; + x += advance; break; } } @@ -315,8 +317,10 @@ void XM_CALLCONV SpriteFont::DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wc } // Draw each character in turn. - pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y) + pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance) { + UNREFERENCED_PARAMETER(advance); + XMVECTOR offset = XMVectorMultiplyAdd(XMVectorSet(x, y + glyph->YOffset, 0, 0), axisDirectionTable[effects & 3], baseOffset); if (effects) @@ -339,9 +343,11 @@ XMVECTOR XM_CALLCONV SpriteFont::MeasureString(_In_z_ wchar_t const* text) const { XMVECTOR result = XMVectorZero(); - pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y) + pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance) { - float w = (float)(glyph->Subrect.right - glyph->Subrect.left) + glyph->XAdvance; + UNREFERENCED_PARAMETER(advance); + + float w = (float)(glyph->Subrect.right - glyph->Subrect.left); float h = (float)(glyph->Subrect.bottom - glyph->Subrect.top) + glyph->YOffset; h = std::max(h, pImpl->lineSpacing); @@ -353,6 +359,53 @@ XMVECTOR XM_CALLCONV SpriteFont::MeasureString(_In_z_ wchar_t const* text) const } +RECT SpriteFont::MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& position) const +{ + RECT result = { LONG_MAX, LONG_MAX, 0, 0 }; + + pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance) + { + float w = (float)(glyph->Subrect.right - glyph->Subrect.left); + float h = (float)(glyph->Subrect.bottom - glyph->Subrect.top); + + float minX = position.x + x; + float minY = position.y + y + glyph->YOffset; + + float maxX = std::max(minX + advance, minX + w); + float maxY = minY + h; + + if (minX < result.left) + result.left = long(minX); + + if (minY < result.top) + result.top = long(minY); + + if (result.right < maxX) + result.right = long(maxX); + + if (result.bottom < maxY) + result.bottom = long(maxY); + }); + + if (result.left == LONG_MAX) + { + result.left = 0; + result.top = 0; + } + + return result; +} + + +RECT XM_CALLCONV SpriteFont::MeasureDrawBounds(_In_z_ wchar_t const* text, FXMVECTOR position) const +{ + XMFLOAT2 pos; + XMStoreFloat2(&pos, position); + + return MeasureDrawBounds(text, pos); +} + + // Spacing properties float SpriteFont::GetLineSpacing() const { diff --git a/Kits/DirectXTK/Src/WICTextureLoader.cpp b/Kits/DirectXTK/Src/WICTextureLoader.cpp index 5a954522049ad9aeffd155acf08d4742250d4c4c..be4d778375a2bfab2a954c1d3651da28174faf77 100644 --- a/Kits/DirectXTK/Src/WICTextureLoader.cpp +++ b/Kits/DirectXTK/Src/WICTextureLoader.cpp @@ -30,12 +30,11 @@ #include "pch.h" -#include - #include "WICTextureLoader.h" #include "DirectXHelpers.h" #include "PlatformHelpers.h" +#include "LoaderHelpers.h" using namespace DirectX; using Microsoft::WRL::ComPtr; @@ -265,37 +264,6 @@ namespace return bpp; } - //-------------------------------------------------------------------------------------- - DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) - { - switch (format) - { - case DXGI_FORMAT_R8G8B8A8_UNORM: - return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; - - case DXGI_FORMAT_BC1_UNORM: - return DXGI_FORMAT_BC1_UNORM_SRGB; - - case DXGI_FORMAT_BC2_UNORM: - return DXGI_FORMAT_BC2_UNORM_SRGB; - - case DXGI_FORMAT_BC3_UNORM: - return DXGI_FORMAT_BC3_UNORM_SRGB; - - case DXGI_FORMAT_B8G8R8A8_UNORM: - return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; - - case DXGI_FORMAT_B8G8R8X8_UNORM: - return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; - - case DXGI_FORMAT_BC7_UNORM: - return DXGI_FORMAT_BC7_UNORM_SRGB; - - default: - return format; - } - } - //--------------------------------------------------------------------------------- HRESULT CreateTextureFromWIC(_In_ ID3D11Device* d3dDevice, _In_opt_ ID3D11DeviceContext* d3dContext, diff --git a/Kits/DirectXTK/Src/dds.h b/Kits/DirectXTK/Src/dds.h index 282a802ebd01d4ca4bce9848afa263a8bad9c6a1..3bd63cd97156c8d453f01f3d06e68a9e3481abbf 100644 --- a/Kits/DirectXTK/Src/dds.h +++ b/Kits/DirectXTK/Src/dds.h @@ -21,14 +21,6 @@ #pragma once -#if defined(_XBOX_ONE) && defined(_TITLE) -#include -#else -#include -#endif - -#include - namespace DirectX { @@ -233,4 +225,4 @@ struct DDS_HEADER_DXT10 static_assert( sizeof(DDS_HEADER) == 124, "DDS Header size mismatch" ); static_assert( sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch"); -}; // namespace +} // namespace diff --git a/Kits/DirectXTK/Src/pch.h b/Kits/DirectXTK/Src/pch.h index 3f2646120c568ca6ee6d8adb6d73231ed510f10d..08b2575bdea7c6a70ddf5b0ff2e6571ae01b5850 100644 --- a/Kits/DirectXTK/Src/pch.h +++ b/Kits/DirectXTK/Src/pch.h @@ -59,8 +59,11 @@ #include #include #include +#include #include #include #include + +#include diff --git a/Kits/DirectXTK/Src/vbo.h b/Kits/DirectXTK/Src/vbo.h new file mode 100644 index 0000000000000000000000000000000000000000..5087ed1c3c288529e9d88e652d0f219cdd45f3ba --- /dev/null +++ b/Kits/DirectXTK/Src/vbo.h @@ -0,0 +1,38 @@ +//-------------------------------------------------------------------------------------- +// File: vbo.h +// +// The VBO file format was introduced in the Windows 8.0 ResourceLoading sample. It's +// a simple binary file containing a 16-bit index buffer and a fixed-format vertex buffer. +// +// The meshconvert sample tool for DirectXMesh can produce this file type +// http://go.microsoft.com/fwlink/?LinkID=324981 +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + + +namespace VBO +{ +#pragma pack(push,1) + + struct header_t + { + uint32_t numVertices; + uint32_t numIndices; + }; + +#pragma pack(pop) + +}; // namespace + +static_assert(sizeof(VBO::header_t) == 8, "VBO header size mismatch"); + diff --git a/Kits/DirectXTK12/Audio/AudioEngine.cpp b/Kits/DirectXTK12/Audio/AudioEngine.cpp new file mode 100644 index 0000000000000000000000000000000000000000..80980b22b7dd544779daf1ad75e697cbc6bfb536 --- /dev/null +++ b/Kits/DirectXTK12/Audio/AudioEngine.cpp @@ -0,0 +1,1724 @@ +//-------------------------------------------------------------------------------------- +// File: AudioEngine.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Audio.h" +#include "SoundCommon.h" + +#include +#include + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +//#define VERBOSE_TRACE + + +namespace +{ + struct EngineCallback : public IXAudio2EngineCallback + { + EngineCallback() + { + mCriticalError.reset( CreateEventEx( nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE ) ); + if ( !mCriticalError ) + { + throw std::exception( "CreateEvent" ); + } + }; + + virtual ~EngineCallback() + { + } + + STDMETHOD_(void, OnProcessingPassStart) () override {} + STDMETHOD_(void, OnProcessingPassEnd)() override {} + + STDMETHOD_(void, OnCriticalError) (THIS_ HRESULT error) + { +#ifndef _DEBUG + UNREFERENCED_PARAMETER(error); +#endif + DebugTrace( "ERROR: AudioEngine encountered critical error (%08X)\n", error ); + SetEvent( mCriticalError.get() ); + } + + ScopedHandle mCriticalError; + }; + + struct VoiceCallback : public IXAudio2VoiceCallback + { + VoiceCallback() + { + mBufferEnd.reset( CreateEventEx( nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE ) ); + if ( !mBufferEnd ) + { + throw std::exception( "CreateEvent" ); + } + } + + virtual ~VoiceCallback() + { + } + + STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) override {} + STDMETHOD_(void, OnVoiceProcessingPassEnd)() override {} + STDMETHOD_(void, OnStreamEnd)() override {} + STDMETHOD_(void, OnBufferStart)( void* ) override {} + + STDMETHOD_(void, OnBufferEnd)( void* context ) override + { + if ( context ) + { + auto inotify = reinterpret_cast( context ); + inotify->OnBufferEnd(); + SetEvent( mBufferEnd.get() ); + } + } + + STDMETHOD_(void, OnLoopEnd)( void* ) override {} + STDMETHOD_(void, OnVoiceError)( void*, HRESULT ) override {} + + ScopedHandle mBufferEnd; + }; + + static const XAUDIO2FX_REVERB_I3DL2_PARAMETERS gReverbPresets[] = + { + XAUDIO2FX_I3DL2_PRESET_DEFAULT, // Reverb_Off + XAUDIO2FX_I3DL2_PRESET_DEFAULT, // Reverb_Default + XAUDIO2FX_I3DL2_PRESET_GENERIC, // Reverb_Generic + XAUDIO2FX_I3DL2_PRESET_FOREST, // Reverb_Forest + XAUDIO2FX_I3DL2_PRESET_PADDEDCELL, // Reverb_PaddedCell + XAUDIO2FX_I3DL2_PRESET_ROOM, // Reverb_Room + XAUDIO2FX_I3DL2_PRESET_BATHROOM, // Reverb_Bathroom + XAUDIO2FX_I3DL2_PRESET_LIVINGROOM, // Reverb_LivingRoom + XAUDIO2FX_I3DL2_PRESET_STONEROOM, // Reverb_StoneRoom + XAUDIO2FX_I3DL2_PRESET_AUDITORIUM, // Reverb_Auditorium + XAUDIO2FX_I3DL2_PRESET_CONCERTHALL, // Reverb_ConcertHall + XAUDIO2FX_I3DL2_PRESET_CAVE, // Reverb_Cave + XAUDIO2FX_I3DL2_PRESET_ARENA, // Reverb_Arena + XAUDIO2FX_I3DL2_PRESET_HANGAR, // Reverb_Hangar + XAUDIO2FX_I3DL2_PRESET_CARPETEDHALLWAY, // Reverb_CarpetedHallway + XAUDIO2FX_I3DL2_PRESET_HALLWAY, // Reverb_Hallway + XAUDIO2FX_I3DL2_PRESET_STONECORRIDOR, // Reverb_StoneCorridor + XAUDIO2FX_I3DL2_PRESET_ALLEY, // Reverb_Alley + XAUDIO2FX_I3DL2_PRESET_CITY, // Reverb_City + XAUDIO2FX_I3DL2_PRESET_MOUNTAINS, // Reverb_Mountains + XAUDIO2FX_I3DL2_PRESET_QUARRY, // Reverb_Quarry + XAUDIO2FX_I3DL2_PRESET_PLAIN, // Reverb_Plain + XAUDIO2FX_I3DL2_PRESET_PARKINGLOT, // Reverb_ParkingLot + XAUDIO2FX_I3DL2_PRESET_SEWERPIPE, // Reverb_SewerPipe + XAUDIO2FX_I3DL2_PRESET_UNDERWATER, // Reverb_Underwater + XAUDIO2FX_I3DL2_PRESET_SMALLROOM, // Reverb_SmallRoom + XAUDIO2FX_I3DL2_PRESET_MEDIUMROOM, // Reverb_MediumRoom + XAUDIO2FX_I3DL2_PRESET_LARGEROOM, // Reverb_LargeRoom + XAUDIO2FX_I3DL2_PRESET_MEDIUMHALL, // Reverb_MediumHall + XAUDIO2FX_I3DL2_PRESET_LARGEHALL, // Reverb_LargeHall + XAUDIO2FX_I3DL2_PRESET_PLATE, // Reverb_Plate + }; + + inline unsigned int makeVoiceKey( _In_ const WAVEFORMATEX* wfx ) + { + assert( IsValid(wfx) ); + + if ( wfx->nChannels > 0x7F ) + return 0; + + union KeyGen + { + struct + { + unsigned int tag : 9; + unsigned int channels : 7; + unsigned int bitsPerSample : 8; + } pcm; + + struct + { + unsigned int tag : 9; + unsigned int channels : 7; + unsigned int samplesPerBlock : 16; + } adpcm; + +#if defined(_XBOX_ONE) && defined(_TITLE) + struct + { + unsigned int tag : 9; + unsigned int channels : 7; + unsigned int encoderVersion : 8; + } xma; +#endif + + unsigned int key; + } result; + + static_assert( sizeof(KeyGen) == sizeof(unsigned int), "KeyGen is invalid" ); + + result.key = 0; + + if ( wfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE ) + { + // We reuse EXTENSIBLE only if it is equivalent to the standard form + auto wfex = reinterpret_cast( wfx ); + if ( wfex->Samples.wValidBitsPerSample != 0 && wfex->Samples.wValidBitsPerSample != wfx->wBitsPerSample ) + return 0; + + if ( wfex->dwChannelMask != 0 && wfex->dwChannelMask != GetDefaultChannelMask( wfx->nChannels ) ) + return 0; + } + + uint32_t tag = GetFormatTag( wfx ); + switch( tag ) + { + case WAVE_FORMAT_PCM: + static_assert( WAVE_FORMAT_PCM < 0x1ff, "KeyGen tag is too small" ); + result.pcm.tag = WAVE_FORMAT_PCM; + result.pcm.channels = wfx->nChannels; + result.pcm.bitsPerSample = wfx->wBitsPerSample; + break; + + case WAVE_FORMAT_IEEE_FLOAT: + static_assert( WAVE_FORMAT_IEEE_FLOAT < 0x1ff, "KeyGen tag is too small" ); + + if ( wfx->wBitsPerSample != 32 ) + return 0; + + result.pcm.tag = WAVE_FORMAT_IEEE_FLOAT; + result.pcm.channels = wfx->nChannels; + result.pcm.bitsPerSample = 32; + break; + + case WAVE_FORMAT_ADPCM: + static_assert( WAVE_FORMAT_ADPCM < 0x1ff, "KeyGen tag is too small" ); + result.adpcm.tag = WAVE_FORMAT_ADPCM; + result.adpcm.channels = wfx->nChannels; + + { + auto wfadpcm = reinterpret_cast( wfx ); + result.adpcm.samplesPerBlock = wfadpcm->wSamplesPerBlock; + } + break; + +#if defined(_XBOX_ONE) && defined(_TITLE) + case WAVE_FORMAT_XMA2: + static_assert( WAVE_FORMAT_XMA2 < 0x1ff, "KeyGen tag is too small" ); + result.xma.tag = WAVE_FORMAT_XMA2; + result.xma.channels = wfx->nChannels; + + { + auto xmaFmt = reinterpret_cast( wfx ); + + if ( ( xmaFmt->LoopBegin > 0 ) + || ( xmaFmt->PlayBegin > 0 ) ) + return 0; + + result.xma.encoderVersion = xmaFmt->EncoderVersion; + } + break; +#endif + + default: + return 0; + } + + return result.key; + } +} + +static_assert( _countof(gReverbPresets) == Reverb_MAX, "AUDIO_ENGINE_REVERB enum mismatch" ); + + +//====================================================================================== +// AudioEngine +//====================================================================================== + +#define SAFE_DESTROY_VOICE(voice) if ( voice ) { voice->DestroyVoice(); voice = nullptr; } + +// Internal object implementation class. +class AudioEngine::Impl +{ +public: + Impl() : + mMasterVoice( nullptr ), + mReverbVoice( nullptr ), + masterChannelMask( 0 ), + masterChannels( 0 ), + masterRate( 0 ), + defaultRate( 44100 ), + maxVoiceOneshots( SIZE_MAX ), + maxVoiceInstances( SIZE_MAX ), + mMasterVolume( 1.f ), + mCriticalError( false ), + mReverbEnabled( false ), + mEngineFlags( AudioEngine_Default ), + mCategory( AudioCategory_GameEffects ), + mVoiceInstances( 0 ) +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + ,mDLL(nullptr) +#endif + { + memset( &mX3DAudio, 0, X3DAUDIO_HANDLE_BYTESIZE ); + }; + +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + ~Impl() + { + if (mDLL) + { + FreeLibrary(mDLL); + mDLL = nullptr; + } + } +#endif + + HRESULT Initialize( AUDIO_ENGINE_FLAGS flags, _In_opt_ const WAVEFORMATEX* wfx, _In_opt_z_ const wchar_t* deviceId, AUDIO_STREAM_CATEGORY category ); + + HRESULT Reset( _In_opt_ const WAVEFORMATEX* wfx, _In_opt_z_ const wchar_t* deviceId ); + + void SetSilentMode(); + + void Shutdown(); + + bool Update(); + + void SetReverb( _In_opt_ const XAUDIO2FX_REVERB_PARAMETERS* native ); + + void SetMasteringLimit( int release, int loudness ); + + AudioStatistics GetStatistics() const; + + void TrimVoicePool(); + + void AllocateVoice( _In_ const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, _Outptr_result_maybenull_ IXAudio2SourceVoice** voice ); + void DestroyVoice( _In_ IXAudio2SourceVoice* voice ); + + void RegisterNotify( _In_ IVoiceNotify* notify, bool usesUpdate ); + void UnregisterNotify( _In_ IVoiceNotify* notify, bool oneshots, bool usesUpdate ); + + ComPtr xaudio2; + IXAudio2MasteringVoice* mMasterVoice; + IXAudio2SubmixVoice* mReverbVoice; + + uint32_t masterChannelMask; + uint32_t masterChannels; + uint32_t masterRate; + + int defaultRate; + size_t maxVoiceOneshots; + size_t maxVoiceInstances; + float mMasterVolume; + + X3DAUDIO_HANDLE mX3DAudio; + + bool mCriticalError; + bool mReverbEnabled; + + AUDIO_ENGINE_FLAGS mEngineFlags; + +private: + typedef std::set notifylist_t; + typedef std::list> oneshotlist_t; + typedef std::unordered_multimap voicepool_t; + + AUDIO_STREAM_CATEGORY mCategory; + ComPtr mReverbEffect; + ComPtr mVolumeLimiter; + oneshotlist_t mOneShots; + voicepool_t mVoicePool; + notifylist_t mNotifyObjects; + notifylist_t mNotifyUpdates; + size_t mVoiceInstances; + VoiceCallback mVoiceCallback; + EngineCallback mEngineCallback; + +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + HMODULE mDLL; +#endif +}; + + +_Use_decl_annotations_ +HRESULT AudioEngine::Impl::Initialize( AUDIO_ENGINE_FLAGS flags, const WAVEFORMATEX* wfx, const wchar_t* deviceId, AUDIO_STREAM_CATEGORY category ) +{ + mEngineFlags = flags; + mCategory = category; + + return Reset( wfx, deviceId ); +} + + +_Use_decl_annotations_ +HRESULT AudioEngine::Impl::Reset( const WAVEFORMATEX* wfx, const wchar_t* deviceId ) +{ + if ( wfx ) + { + if ( wfx->wFormatTag != WAVE_FORMAT_PCM ) + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + + if ( !wfx->nChannels || wfx->nChannels > XAUDIO2_MAX_AUDIO_CHANNELS ) + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + + if ( wfx->nSamplesPerSec < XAUDIO2_MIN_SAMPLE_RATE || wfx->nSamplesPerSec > XAUDIO2_MAX_SAMPLE_RATE ) + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + + // We don't use other data members of WAVEFORMATEX here to describe the device format, so no need to fully validate + } + + assert( !xaudio2 ); + assert( !mMasterVoice ); + assert( !mReverbVoice ); + + masterChannelMask = masterChannels = masterRate = 0; + + memset( &mX3DAudio, 0, X3DAUDIO_HANDLE_BYTESIZE ); + + mCriticalError = false; + mReverbEnabled = false; + + // + // Create XAudio2 engine + // + UINT32 eflags = 0; +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + if ( mEngineFlags & AudioEngine_Debug ) + { + if ( !mDLL ) + { + mDLL = LoadLibraryEx( L"XAudioD2_7.DLL", nullptr, 0x00000800 /* LOAD_LIBRARY_SEARCH_SYSTEM32 */ ); + if ( !mDLL ) + { + DebugTrace( "ERROR: XAudio 2.7 debug version not installed on system (install the DirectX SDK Developer Runtime)\n" ); + return HRESULT_FROM_WIN32( ERROR_NOT_FOUND ); + } + } + + eflags |= XAUDIO2_DEBUG_ENGINE; + } + else if ( !mDLL ) + { + mDLL = LoadLibraryEx( L"XAudio2_7.DLL", nullptr, 0x00000800 /* LOAD_LIBRARY_SEARCH_SYSTEM32 */ ); + if ( !mDLL ) + { + DebugTrace( "ERROR: XAudio 2.7 not installed on system (install the DirectX End-user Runtimes (June 2010))\n" ); + return HRESULT_FROM_WIN32( ERROR_NOT_FOUND ); + } + } +#endif + + HRESULT hr = XAudio2Create( xaudio2.ReleaseAndGetAddressOf(), eflags ); + if( FAILED( hr ) ) + { +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + DebugTrace( "ERROR: XAudio 2.7 not found (have you called CoInitialize?)\n" ); +#endif + return hr; + } + + if ( mEngineFlags & AudioEngine_Debug ) + { + XAUDIO2_DEBUG_CONFIGURATION debug = {}; + debug.TraceMask = XAUDIO2_LOG_ERRORS | XAUDIO2_LOG_WARNINGS; + debug.BreakMask = XAUDIO2_LOG_ERRORS; + xaudio2->SetDebugConfiguration( &debug, nullptr ); +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10) || defined(_XBOX_ONE) + DebugTrace("INFO: XAudio 2.9 debugging enabled\n"); +#elif (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + // To see the trace output, you need to view ETW logs for this application: + // Go to Control Panel, Administrative Tools, Event Viewer. + // View->Show Analytic and Debug Logs. + // Applications and Services Logs / Microsoft / Windows / XAudio2. + // Right click on Microsoft Windows XAudio2 debug logging, Properties, then Enable Logging, and hit OK + DebugTrace( "INFO: XAudio 2.8 debugging enabled\n" ); +#else + // To see the trace output, see the debug output channel window + DebugTrace( "INFO: XAudio 2.7 debugging enabled\n" ); +#endif + } + + if ( mEngineFlags & AudioEngine_DisableVoiceReuse ) + { + DebugTrace( "INFO: Voice reuse is disabled\n" ); + } + + hr = xaudio2->RegisterForCallbacks( &mEngineCallback ); + if ( FAILED(hr) ) + { + xaudio2.Reset(); + return hr; + } + + // + // Create mastering voice for device + // + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + + hr = xaudio2->CreateMasteringVoice( &mMasterVoice, + (wfx) ? wfx->nChannels : XAUDIO2_DEFAULT_CHANNELS, + (wfx) ? wfx->nSamplesPerSec : XAUDIO2_DEFAULT_SAMPLERATE, + 0, deviceId, nullptr, mCategory ); + if ( FAILED(hr) ) + { + xaudio2.Reset(); + return hr; + } + + DWORD dwChannelMask; + hr = mMasterVoice->GetChannelMask( &dwChannelMask ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + xaudio2.Reset(); + return hr; + } + + XAUDIO2_VOICE_DETAILS details; + mMasterVoice->GetVoiceDetails( &details ); + + masterChannelMask = dwChannelMask; + masterChannels = details.InputChannels; + masterRate = details.InputSampleRate; + +#else + + UINT32 count = 0; + hr = xaudio2->GetDeviceCount( &count ); + if ( FAILED(hr) ) + { + xaudio2.Reset(); + return hr; + } + + if ( !count ) + { + xaudio2.Reset(); + return HRESULT_FROM_WIN32( ERROR_NOT_FOUND ); + } + + UINT32 devIndex = 0; + if ( deviceId ) + { + // Translate device ID back into device index + devIndex = UINT32(-1); + for( UINT32 j = 0; j < count; ++j ) + { + XAUDIO2_DEVICE_DETAILS details; + hr = xaudio2->GetDeviceDetails( j, &details ); + if ( SUCCEEDED(hr) ) + { + if ( wcsncmp( deviceId, details.DeviceID, 256 ) == 0 ) + { + devIndex = j; + masterChannelMask = details.OutputFormat.dwChannelMask; + break; + } + } + } + + if ( devIndex == UINT32(-1) ) + { + xaudio2.Reset(); + return HRESULT_FROM_WIN32( ERROR_NOT_FOUND ); + } + } + else + { + // No search needed + XAUDIO2_DEVICE_DETAILS details; + hr = xaudio2->GetDeviceDetails( 0, &details ); + if ( FAILED(hr) ) + { + xaudio2.Reset(); + return hr; + } + + masterChannelMask = details.OutputFormat.dwChannelMask; + } + + hr = xaudio2->CreateMasteringVoice( &mMasterVoice, + (wfx) ? wfx->nChannels : XAUDIO2_DEFAULT_CHANNELS, + (wfx) ? wfx->nSamplesPerSec : XAUDIO2_DEFAULT_SAMPLERATE, + 0, devIndex, nullptr ); + if ( FAILED(hr) ) + { + xaudio2.Reset(); + return hr; + } + + XAUDIO2_VOICE_DETAILS details; + mMasterVoice->GetVoiceDetails( &details ); + + masterChannels = details.InputChannels; + masterRate = details.InputSampleRate; + +#endif + + DebugTrace( "INFO: mastering voice has %u channels, %u sample rate, %08X channel mask\n", masterChannels, masterRate, masterChannelMask ); + + if ( mMasterVolume != 1.f ) + { + hr = mMasterVoice->SetVolume( mMasterVolume ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + xaudio2.Reset(); + return hr; + } + } + + // + // Setup mastering volume limiter (optional) + // + if ( mEngineFlags & AudioEngine_UseMasteringLimiter ) + { + FXMASTERINGLIMITER_PARAMETERS params = {}; + params.Release = FXMASTERINGLIMITER_DEFAULT_RELEASE; + params.Loudness = FXMASTERINGLIMITER_DEFAULT_LOUDNESS; + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + hr = CreateFX( __uuidof(FXMasteringLimiter), mVolumeLimiter.ReleaseAndGetAddressOf(), ¶ms, sizeof(params) ); +#else + hr = CreateFX( __uuidof(FXMasteringLimiter), mVolumeLimiter.ReleaseAndGetAddressOf() ); +#endif + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + xaudio2.Reset(); + return hr; + } + + XAUDIO2_EFFECT_DESCRIPTOR desc = {}; + desc.InitialState = TRUE; + desc.OutputChannels = masterChannels; + desc.pEffect = mVolumeLimiter.Get(); + + XAUDIO2_EFFECT_CHAIN chain = { 1, &desc }; + hr = mMasterVoice->SetEffectChain( &chain ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + return hr; + } + +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + hr = mMasterVoice->SetEffectParameters( 0, ¶ms, sizeof(params) ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + return hr; + } +#endif + + DebugTrace( "INFO: Mastering volume limiter enabled\n" ); + } + + // + // Setup environmental reverb for 3D audio (optional) + // + if ( mEngineFlags & AudioEngine_EnvironmentalReverb ) + { + UINT32 rflags = 0; +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + if ( mEngineFlags & AudioEngine_Debug ) + { + rflags |= XAUDIO2FX_DEBUG; + } +#endif + hr = XAudio2CreateReverb( mReverbEffect.ReleaseAndGetAddressOf(), rflags ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + return hr; + } + + XAUDIO2_EFFECT_DESCRIPTOR effects[] = { { mReverbEffect.Get(), TRUE, 1 } }; + XAUDIO2_EFFECT_CHAIN effectChain = { 1, effects }; + + mReverbEnabled = true; + + hr = xaudio2->CreateSubmixVoice( &mReverbVoice, 1, masterRate, + (mEngineFlags & AudioEngine_ReverbUseFilters ) ? XAUDIO2_VOICE_USEFILTER : 0, 0, + nullptr, &effectChain ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mMasterVoice ); + mReverbEffect.Reset(); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + return hr; + } + + XAUDIO2FX_REVERB_PARAMETERS native; + ReverbConvertI3DL2ToNative( &gReverbPresets[ Reverb_Default ], &native ); + hr = mReverbVoice->SetEffectParameters( 0, &native, sizeof( XAUDIO2FX_REVERB_PARAMETERS ) ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mReverbVoice ); + SAFE_DESTROY_VOICE( mMasterVoice ); + mReverbEffect.Reset(); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + return hr; + } + + DebugTrace( "INFO: I3DL2 reverb effect enabled for 3D positional audio\n" ); + } + + // + // Setup 3D audio + // + const float SPEEDOFSOUND = X3DAUDIO_SPEED_OF_SOUND; + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + hr = X3DAudioInitialize( masterChannelMask, SPEEDOFSOUND, mX3DAudio ); + if ( FAILED(hr) ) + { + SAFE_DESTROY_VOICE( mReverbVoice ); + SAFE_DESTROY_VOICE( mMasterVoice ); + mReverbEffect.Reset(); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + return hr; + } +#else + X3DAudioInitialize( masterChannelMask, SPEEDOFSOUND, mX3DAudio ); +#endif + + // + // Inform any notify objects we are ready to go again + // + for( auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnReset(); + } + + return S_OK; +} + + +void AudioEngine::Impl::SetSilentMode() +{ + for( auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnCriticalError(); + } + + for( auto it = mOneShots.begin(); it != mOneShots.end(); ++it ) + { + assert( it->second != 0 ); + it->second->DestroyVoice(); + } + mOneShots.clear(); + + for( auto it = mVoicePool.begin(); it != mVoicePool.end(); ++it ) + { + assert( it->second != 0 ); + it->second->DestroyVoice(); + } + mVoicePool.clear(); + + mVoiceInstances = 0; + + SAFE_DESTROY_VOICE( mReverbVoice ); + SAFE_DESTROY_VOICE( mMasterVoice ); + + mReverbEffect.Reset(); + mVolumeLimiter.Reset(); + xaudio2.Reset(); +} + + +void AudioEngine::Impl::Shutdown() +{ + for( auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnDestroyEngine(); + } + + if ( xaudio2 ) + { + xaudio2->UnregisterForCallbacks( &mEngineCallback ); + + xaudio2->StopEngine(); + + for( auto it = mOneShots.begin(); it != mOneShots.end(); ++it ) + { + assert( it->second != 0 ); + it->second->DestroyVoice(); + } + mOneShots.clear(); + + for( auto it = mVoicePool.begin(); it != mVoicePool.end(); ++it ) + { + assert( it->second != 0 ); + it->second->DestroyVoice(); + } + mVoicePool.clear(); + + mVoiceInstances = 0; + + SAFE_DESTROY_VOICE( mReverbVoice ); + SAFE_DESTROY_VOICE( mMasterVoice ); + + mReverbEffect.Reset(); + mVolumeLimiter.Reset(); + xaudio2.Reset(); + + masterChannelMask = masterChannels = masterRate = 0; + + mCriticalError = false; + mReverbEnabled = false; + + memset( &mX3DAudio, 0, X3DAUDIO_HANDLE_BYTESIZE ); + } +} + + +bool AudioEngine::Impl::Update() +{ + if ( !xaudio2 ) + return false; + + HANDLE events[2] = { mEngineCallback.mCriticalError.get(), mVoiceCallback.mBufferEnd.get() }; + DWORD result = WaitForMultipleObjectsEx( 2, events, FALSE, 0, FALSE ); + switch( result ) + { + case WAIT_TIMEOUT: + break; + + case WAIT_OBJECT_0: // OnCritialError + mCriticalError = true; + + SetSilentMode(); + return false; + + case WAIT_OBJECT_0 + 1: // OnBufferEnd + // Scan for completed one-shot voices + for( auto it = mOneShots.begin(); it != mOneShots.end(); ) + { + assert( it->second != 0 ); + + XAUDIO2_VOICE_STATE xstate; +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + it->second->GetState( &xstate, XAUDIO2_VOICE_NOSAMPLESPLAYED ); +#else + it->second->GetState( &xstate ); +#endif + + if ( !xstate.BuffersQueued ) + { + it->second->Stop( 0 ); + if ( it->first ) + { + // Put voice back into voice pool for reuse since it has a non-zero voiceKey +#ifdef VERBOSE_TRACE + DebugTrace( "INFO: One-shot voice being saved for reuse (%08X)\n", it->first ); +#endif + voicepool_t::value_type v( it->first, it->second ); + mVoicePool.emplace( v ); + } + else + { + // Voice is to be destroyed rather than reused +#ifdef VERBOSE_TRACE + DebugTrace( "INFO: Destroying one-shot voice\n" ); +#endif + it->second->DestroyVoice(); + } + it = mOneShots.erase( it ); + } + else + ++it; + } + break; + + case WAIT_FAILED: + throw std::exception( "WaitForMultipleObjects" ); + } + + // + // Inform any notify objects of updates + // + for( auto it = mNotifyUpdates.begin(); it != mNotifyUpdates.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnUpdate(); + } + + return true; +} + + +_Use_decl_annotations_ +void AudioEngine::Impl::SetReverb( const XAUDIO2FX_REVERB_PARAMETERS* native ) +{ + if ( !mReverbVoice ) + return; + + if ( native ) + { + if ( !mReverbEnabled ) + { + mReverbEnabled = true; + mReverbVoice->EnableEffect( 0 ); + } + + mReverbVoice->SetEffectParameters( 0, native, sizeof( XAUDIO2FX_REVERB_PARAMETERS ) ); + } + else if ( mReverbEnabled ) + { + mReverbEnabled = false; + mReverbVoice->DisableEffect( 0 ); + } +} + + +void AudioEngine::Impl::SetMasteringLimit( int release, int loudness ) +{ + if ( !mVolumeLimiter || !mMasterVoice ) + return; + + if ( ( release < FXMASTERINGLIMITER_MIN_RELEASE ) || ( release > FXMASTERINGLIMITER_MAX_RELEASE ) ) + throw std::out_of_range( "AudioEngine::SetMasteringLimit" ); + + if ( ( loudness < FXMASTERINGLIMITER_MIN_LOUDNESS ) || ( loudness > FXMASTERINGLIMITER_MAX_LOUDNESS ) ) + throw std::out_of_range( "AudioEngine::SetMasteringLimit" ); + + FXMASTERINGLIMITER_PARAMETERS params = {}; + params.Release = static_cast( release ); + params.Loudness = static_cast( loudness ); + + HRESULT hr = mMasterVoice->SetEffectParameters( 0, ¶ms, sizeof(params) ); + ThrowIfFailed( hr ); +} + + +AudioStatistics AudioEngine::Impl::GetStatistics() const +{ + AudioStatistics stats = {}; + + stats.allocatedVoices = stats.allocatedVoicesOneShot = mOneShots.size() + mVoicePool.size(); + stats.allocatedVoicesIdle = mVoicePool.size(); + + for( auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it ) + { + assert( *it != 0 ); + (*it)->GatherStatistics( stats ); + } + + assert( stats.allocatedVoices == ( mOneShots.size() + mVoicePool.size() + mVoiceInstances ) ); + + return stats; +} + + +void AudioEngine::Impl::TrimVoicePool() +{ + for( auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnTrim(); + } + + for( auto it = mVoicePool.begin(); it != mVoicePool.end(); ++it ) + { + assert( it->second != 0 ); + it->second->DestroyVoice(); + } + mVoicePool.clear(); +} + + +_Use_decl_annotations_ +void AudioEngine::Impl::AllocateVoice( const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, IXAudio2SourceVoice** voice ) +{ + if ( !wfx ) + throw std::exception( "Wave format is required\n" ); + + // No need to call IsValid on wfx because CreateSourceVoice will do that + + if ( !voice ) + throw std::exception("Voice pointer must be non-null"); + + *voice = nullptr; + + if ( !xaudio2 || mCriticalError ) + return; + +#ifndef NDEBUG + float maxFrequencyRatio = XAudio2SemitonesToFrequencyRatio(12); + assert( maxFrequencyRatio <= XAUDIO2_DEFAULT_FREQ_RATIO ); +#endif + + unsigned int voiceKey = 0; + if ( oneshot ) + { + if ( flags & ( SoundEffectInstance_Use3D | SoundEffectInstance_ReverbUseFilters | SoundEffectInstance_NoSetPitch ) ) + { + DebugTrace( ( flags & SoundEffectInstance_NoSetPitch ) + ? "ERROR: One-shot voices must support pitch-shifting for voice reuse\n" + : "ERROR: One-use voices cannot use 3D positional audio\n" ); + throw std::exception( "Invalid flags for one-shot voice" ); + } + +#ifdef VERBOSE_TRACE + if ( wfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE ) + { + DebugTrace( "INFO: Requesting one-shot: Format Tag EXTENSIBLE %u, %u channels, %u-bit, %u blkalign, %u Hz\n", GetFormatTag( wfx ), + wfx->nChannels, wfx->wBitsPerSample, wfx->nBlockAlign, wfx->nSamplesPerSec ); + } + else + { + DebugTrace( "INFO: Requesting one-shot: Format Tag %u, %u channels, %u-bit, %u blkalign, %u Hz\n", wfx->wFormatTag, + wfx->nChannels, wfx->wBitsPerSample, wfx->nBlockAlign, wfx->nSamplesPerSec ); + } +#endif + + if ( !( mEngineFlags & AudioEngine_DisableVoiceReuse ) ) + { + voiceKey = makeVoiceKey( wfx ); + if ( voiceKey != 0 ) + { + auto it = mVoicePool.find( voiceKey ); + if ( it != mVoicePool.end() ) + { + // Found a matching (stopped) voice to reuse + assert( it->second != 0 ); + *voice = it->second; + mVoicePool.erase( it ); + + // Reset any volume/pitch-shifting + HRESULT hr = (*voice)->SetVolume(1.f); + ThrowIfFailed( hr ); + + hr = (*voice)->SetFrequencyRatio(1.f); + ThrowIfFailed( hr ); + + if (wfx->nChannels == 1 || wfx->nChannels == 2) + { + // Reset any panning + float matrix[16] = {}; + ComputePan( 0.f, wfx->nChannels, matrix ); + + hr = (*voice)->SetOutputMatrix(nullptr, wfx->nChannels, masterChannels, matrix); + ThrowIfFailed( hr ); + } + } + else if ( ( mVoicePool.size() + mOneShots.size() + 1 ) >= maxVoiceOneshots ) + { + DebugTrace( "WARNING: Too many one-shot voices in use (%Iu + %Iu >= %Iu); one-shot not played\n", + mVoicePool.size(), mOneShots.size() + 1, maxVoiceOneshots ); + return; + } + else + { + // makeVoiceKey already constrained the supported wfx formats to those supported for reuse + + char buff[64] = {}; + auto wfmt = reinterpret_cast( buff ); + + uint32_t tag = GetFormatTag( wfx ); + switch( tag ) + { + case WAVE_FORMAT_PCM: + CreateIntegerPCM( wfmt, defaultRate, wfx->nChannels, wfx->wBitsPerSample ); + break; + + case WAVE_FORMAT_IEEE_FLOAT: + CreateFloatPCM( wfmt, defaultRate, wfx->nChannels ); + break; + + case WAVE_FORMAT_ADPCM: + { + auto wfadpcm = reinterpret_cast( wfx ); + CreateADPCM( wfmt, 64, defaultRate, wfx->nChannels, wfadpcm->wSamplesPerBlock ); + } + break; + +#if defined(_XBOX_ONE) && defined(_TITLE) + case WAVE_FORMAT_XMA2: + CreateXMA2( wfmt, 64, defaultRate, wfx->nChannels, 65536, 2, 0 ); + break; +#endif + } + +#ifdef VERBOSE_TRACE + DebugTrace( "INFO: Allocate reuse voice: Format Tag %u, %u channels, %u-bit, %u blkalign, %u Hz\n", wfmt->wFormatTag, + wfmt->nChannels, wfmt->wBitsPerSample, wfmt->nBlockAlign, wfmt->nSamplesPerSec ); +#endif + + assert( voiceKey == makeVoiceKey( wfmt ) ); + + HRESULT hr = xaudio2->CreateSourceVoice( voice, wfmt, 0, XAUDIO2_DEFAULT_FREQ_RATIO, &mVoiceCallback, nullptr, nullptr ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: CreateSourceVoice (reuse) failed with error %08X\n", hr ); + throw std::exception( "CreateSourceVoice" ); + } + } + + assert( *voice != 0 ); + HRESULT hr = (*voice)->SetSourceSampleRate( wfx->nSamplesPerSec ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SetSourceSampleRate failed with error %08X\n", hr ); + throw std::exception( "SetSourceSampleRate" ); + } + } + } + } + + if ( !*voice ) + { + if ( oneshot ) + { + if ( ( mVoicePool.size() + mOneShots.size() + 1 ) >= maxVoiceOneshots ) + { + DebugTrace( "WARNING: Too many one-shot voices in use (%Iu + %Iu >= %Iu); one-shot not played; see TrimVoicePool\n", + mVoicePool.size(), mOneShots.size() + 1, maxVoiceOneshots ); + return; + } + } + else if ( ( mVoiceInstances + 1 ) >= maxVoiceInstances ) + { + DebugTrace( "ERROR: Too many instance voices (%Iu >= %Iu); see TrimVoicePool\n", mVoiceInstances + 1, maxVoiceInstances ); + throw std::exception( "Too many instance voices" ); + } + + UINT32 vflags = ( flags & SoundEffectInstance_NoSetPitch ) ? XAUDIO2_VOICE_NOPITCH : 0; + + HRESULT hr; + if ( flags & SoundEffectInstance_Use3D ) + { + XAUDIO2_SEND_DESCRIPTOR sendDescriptors[2]; + sendDescriptors[0].Flags = sendDescriptors[1].Flags = (flags & SoundEffectInstance_ReverbUseFilters) ? XAUDIO2_SEND_USEFILTER : 0; + sendDescriptors[0].pOutputVoice = mMasterVoice; + sendDescriptors[1].pOutputVoice = mReverbVoice; + const XAUDIO2_VOICE_SENDS sendList = { mReverbVoice ? 2U : 1U, sendDescriptors }; + +#ifdef VERBOSE_TRACE + DebugTrace( "INFO: Allocate voice 3D: Format Tag %u, %u channels, %u-bit, %u blkalign, %u Hz\n", wfx->wFormatTag, + wfx->nChannels, wfx->wBitsPerSample, wfx->nBlockAlign, wfx->nSamplesPerSec ); +#endif + + hr = xaudio2->CreateSourceVoice( voice, wfx, vflags, XAUDIO2_DEFAULT_FREQ_RATIO, &mVoiceCallback, &sendList, nullptr ); + } + else + { +#ifdef VERBOSE_TRACE + DebugTrace( "INFO: Allocate voice: Format Tag %u, %u channels, %u-bit, %u blkalign, %u Hz\n", wfx->wFormatTag, + wfx->nChannels, wfx->wBitsPerSample, wfx->nBlockAlign, wfx->nSamplesPerSec ); +#endif + + hr = xaudio2->CreateSourceVoice( voice, wfx, vflags, XAUDIO2_DEFAULT_FREQ_RATIO, &mVoiceCallback, nullptr, nullptr ); + } + + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: CreateSourceVoice failed with error %08X\n", hr ); + throw std::exception( "CreateSourceVoice" ); + } + else if ( !oneshot ) + { + ++mVoiceInstances; + } + } + + if ( oneshot ) + { + assert( *voice != 0 ); + mOneShots.emplace_back( std::make_pair( voiceKey, *voice ) ); + } +} + + +void AudioEngine::Impl::DestroyVoice( _In_ IXAudio2SourceVoice* voice ) +{ + if ( !voice ) + return; + +#ifndef NDEBUG + for( auto it = mOneShots.cbegin(); it != mOneShots.cend(); ++it ) + { + if ( it->second == voice ) + { + DebugTrace( "ERROR: DestroyVoice should not be called for a one-shot voice\n" ); + throw std::exception( "DestroyVoice" ); + } + } + + for( auto it = mVoicePool.cbegin(); it != mVoicePool.cend(); ++it ) + { + if ( it->second == voice ) + { + DebugTrace( "ERROR: DestroyVoice should not be called for a one-shot voice; see TrimVoicePool\n" ); + throw std::exception( "DestroyVoice" ); + } + } +#endif + + assert( mVoiceInstances > 0 ); + --mVoiceInstances; + voice->DestroyVoice(); +} + + +void AudioEngine::Impl::RegisterNotify( _In_ IVoiceNotify* notify, bool usesUpdate ) +{ + assert( notify != 0 ); + mNotifyObjects.insert( notify ); + + if ( usesUpdate ) + { + mNotifyUpdates.insert( notify ); + } +} + + +void AudioEngine::Impl::UnregisterNotify( _In_ IVoiceNotify* notify, bool usesOneShots, bool usesUpdate ) +{ + assert( notify != 0 ); + mNotifyObjects.erase( notify ); + + // Check for any pending one-shots for this notification object + if ( usesOneShots ) + { + bool setevent = false; + + for( auto it = mOneShots.begin(); it != mOneShots.end(); ++it ) + { + assert( it->second != 0 ); + + XAUDIO2_VOICE_STATE state; +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + it->second->GetState(&state, XAUDIO2_VOICE_NOSAMPLESPLAYED ); +#else + it->second->GetState(&state); +#endif + + if ( state.pCurrentBufferContext == notify ) + { + it->second->Stop( 0 ); + it->second->FlushSourceBuffers(); + setevent = true; + } + } + + if (setevent) + { + // Trigger scan on next call to Update... + SetEvent( mVoiceCallback.mBufferEnd.get() ); + } + } + + if ( usesUpdate ) + { + mNotifyUpdates.erase( notify ); + } +} + + +//-------------------------------------------------------------------------------------- +// AudioEngine +//-------------------------------------------------------------------------------------- + +// Public constructor. +_Use_decl_annotations_ +AudioEngine::AudioEngine( AUDIO_ENGINE_FLAGS flags, const WAVEFORMATEX* wfx, const wchar_t* deviceId, AUDIO_STREAM_CATEGORY category ) + : pImpl(new Impl() ) +{ + HRESULT hr = pImpl->Initialize( flags, wfx, deviceId, category ); + if ( FAILED(hr) ) + { + if ( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ) ) + { + if ( flags & AudioEngine_ThrowOnNoAudioHW ) + { + DebugTrace( "ERROR: AudioEngine found no default audio device\n" ); + throw std::exception( "AudioEngineNoAudioHW" ); + } + else + { + DebugTrace( "WARNING: AudioEngine found no default audio device; running in 'silent mode'\n" ); + } + } + else + { + DebugTrace( "ERROR: AudioEngine failed (%08X) to initialize using device [%ls]\n", hr, ( deviceId ) ? deviceId : L"default" ); + throw std::exception( "AudioEngine" ); + } + } +} + + +// Move constructor. +AudioEngine::AudioEngine(AudioEngine&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +AudioEngine& AudioEngine::operator= (AudioEngine&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +AudioEngine::~AudioEngine() +{ + if ( pImpl ) + { + pImpl->Shutdown(); + } +} + + +// Public methods. +bool AudioEngine::Update() +{ + return pImpl->Update(); +} + + +_Use_decl_annotations_ +bool AudioEngine::Reset( const WAVEFORMATEX* wfx, const wchar_t* deviceId ) +{ + if ( pImpl->xaudio2 ) + { + DebugTrace( "WARNING: Called Reset for active audio graph; going silent in preparation for migration\n" ); + pImpl->SetSilentMode(); + } + + HRESULT hr = pImpl->Reset( wfx, deviceId ); + if ( FAILED(hr) ) + { + if ( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ) ) + { + if ( pImpl->mEngineFlags & AudioEngine_ThrowOnNoAudioHW ) + { + DebugTrace( "ERROR: AudioEngine found no default audio device on Reset\n" ); + throw std::exception( "AudioEngineNoAudioHW" ); + } + else + { + DebugTrace( "WARNING: AudioEngine found no default audio device on Reset; running in 'silent mode'\n" ); + return false; + } + } + else + { + DebugTrace( "ERROR: AudioEngine failed (%08X) to Reset using device [%ls]\n", hr, ( deviceId ) ? deviceId : L"default" ); + throw std::exception( "AudioEngine::Reset" ); + } + } + + DebugTrace( "INFO: AudioEngine Reset using device [%ls]\n", ( deviceId ) ? deviceId : L"default" ); + + return true; +} + + +void AudioEngine::Suspend() +{ + if ( !pImpl->xaudio2 ) + return; + + pImpl->xaudio2->StopEngine(); +} + + +void AudioEngine::Resume() +{ + if ( !pImpl->xaudio2 ) + return; + + HRESULT hr = pImpl->xaudio2->StartEngine(); + ThrowIfFailed( hr ); +} + + +float AudioEngine::GetMasterVolume() const +{ + return pImpl->mMasterVolume; +} + + +void AudioEngine::SetMasterVolume( float volume ) +{ + assert( volume >= -XAUDIO2_MAX_VOLUME_LEVEL && volume <= XAUDIO2_MAX_VOLUME_LEVEL ); + + pImpl->mMasterVolume = volume; + + if ( pImpl->mMasterVoice ) + { + HRESULT hr = pImpl->mMasterVoice->SetVolume( volume ); + ThrowIfFailed( hr ); + } +} + + +void AudioEngine::SetReverb( AUDIO_ENGINE_REVERB reverb ) +{ + if ( reverb < 0 || reverb >= Reverb_MAX ) + throw std::out_of_range( "AudioEngine::SetReverb" ); + + if ( reverb == Reverb_Off ) + { + pImpl->SetReverb( nullptr ); + } + else + { + XAUDIO2FX_REVERB_PARAMETERS native; + ReverbConvertI3DL2ToNative( &gReverbPresets[ reverb ], &native ); + pImpl->SetReverb( &native ); + } +} + + +_Use_decl_annotations_ +void AudioEngine::SetReverb( const XAUDIO2FX_REVERB_PARAMETERS* native ) +{ + pImpl->SetReverb( native ); +} + + +void AudioEngine::SetMasteringLimit( int release, int loudness ) +{ + pImpl->SetMasteringLimit( release, loudness ); +} + + +// Public accessors. +AudioStatistics AudioEngine::GetStatistics() const +{ + return pImpl->GetStatistics(); +} + + +WAVEFORMATEXTENSIBLE AudioEngine::GetOutputFormat() const +{ + WAVEFORMATEXTENSIBLE wfx = {}; + + if ( !pImpl->xaudio2 ) + return wfx; + + wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfx.Format.wBitsPerSample = wfx.Samples.wValidBitsPerSample = 16; // This is a guess + wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); + + wfx.Format.nChannels = static_cast( pImpl->masterChannels ); + wfx.Format.nSamplesPerSec = pImpl->masterRate; + wfx.dwChannelMask = pImpl->masterChannelMask; + + wfx.Format.nBlockAlign = WORD( wfx.Format.nChannels * wfx.Format.wBitsPerSample / 8 ); + wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; + + static const GUID s_pcm = { WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 }; + memcpy( &wfx.SubFormat, &s_pcm, sizeof(GUID) ); + + return wfx; +} + + +uint32_t AudioEngine::GetChannelMask() const +{ + return pImpl->masterChannelMask; +} + + +int AudioEngine::GetOutputChannels() const +{ + return pImpl->masterChannels; +} + + +bool AudioEngine::IsAudioDevicePresent() const +{ + return ( pImpl->xaudio2.Get() != 0 ) && !pImpl->mCriticalError; +} + + +bool AudioEngine::IsCriticalError() const +{ + return pImpl->mCriticalError; +} + + +// Voice management. +void AudioEngine::SetDefaultSampleRate( int sampleRate ) +{ + if ( ( sampleRate < XAUDIO2_MIN_SAMPLE_RATE ) || ( sampleRate > XAUDIO2_MAX_SAMPLE_RATE ) ) + throw std::exception( "Default sample rate is out of range" ); + + pImpl->defaultRate = sampleRate; +} + + +void AudioEngine::SetMaxVoicePool( size_t maxOneShots, size_t maxInstances ) +{ + if ( maxOneShots > 0 ) + pImpl->maxVoiceOneshots = maxOneShots; + + if ( maxInstances > 0 ) + pImpl->maxVoiceInstances = maxInstances; +} + + +void AudioEngine::TrimVoicePool() +{ + pImpl->TrimVoicePool(); +} + + +_Use_decl_annotations_ +void AudioEngine::AllocateVoice( const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, IXAudio2SourceVoice** voice ) +{ + pImpl->AllocateVoice( wfx, flags, oneshot, voice ); +} + + +void AudioEngine::DestroyVoice( _In_ IXAudio2SourceVoice* voice ) +{ + pImpl->DestroyVoice( voice ); +} + + +void AudioEngine::RegisterNotify( _In_ IVoiceNotify* notify, bool usesUpdate ) +{ + pImpl->RegisterNotify( notify, usesUpdate ); +} + + +void AudioEngine::UnregisterNotify( _In_ IVoiceNotify* notify, bool oneshots, bool usesUpdate ) +{ + pImpl->UnregisterNotify( notify, oneshots, usesUpdate ); +} + + +IXAudio2* AudioEngine::GetInterface() const +{ + return pImpl->xaudio2.Get(); +} + + +IXAudio2MasteringVoice* AudioEngine::GetMasterVoice() const +{ + return pImpl->mMasterVoice; +} + + +IXAudio2SubmixVoice* AudioEngine::GetReverbVoice() const +{ + return pImpl->mReverbVoice; +} + + +X3DAUDIO_HANDLE& AudioEngine::Get3DHandle() const +{ + return pImpl->mX3DAudio; +} + + +// Static methods. +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#include +#elif defined(_XBOX_ONE) +#include +#include +#elif (_WIN32_WINNT >= _WIN32_WINNT_WIN8) +#pragma comment(lib,"runtimeobject.lib") +#include +#include +#endif + +std::vector AudioEngine::GetRendererDetails() +{ + std::vector list; + +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + + LPCWSTR id = GetDefaultAudioRenderId( Default ); + if ( !id ) + return list; + + RendererDetail device; + device.deviceId = id; + device.description = L"Default"; + + CoTaskMemFree( (LPVOID)id ); + +#elif defined(_XBOX_ONE) + + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::Foundation; + using namespace ABI::Windows::Media::Devices; + + ComPtr mdStatics; + HRESULT hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_Media_Devices_MediaDevice).Get(), &mdStatics ); + ThrowIfFailed( hr ); + + HString id; + hr = mdStatics->GetDefaultAudioRenderId( AudioDeviceRole_Default, id.GetAddressOf() ); + ThrowIfFailed( hr ); + + RendererDetail device; + device.deviceId = id.GetRawBuffer( nullptr ); + device.description = L"Default"; + list.emplace_back( device ); + +#elif (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + +#if defined(__cplusplus_winrt) + + // Enumerating with WinRT using C++/CX (Windows Store apps) + using Windows::Devices::Enumeration::DeviceClass; + using Windows::Devices::Enumeration::DeviceInformation; + using Windows::Devices::Enumeration::DeviceInformationCollection; + + auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); + while (operation->Status != Windows::Foundation::AsyncStatus::Completed) + ; + + DeviceInformationCollection^ devices = operation->GetResults(); + + for (unsigned i = 0; i < devices->Size; ++i) + { + using Windows::Devices::Enumeration::DeviceInformation; + + DeviceInformation^ d = devices->GetAt(i); + + RendererDetail device; + device.deviceId = d->Id->Data(); + device.description = d->Name->Data(); + list.emplace_back(device); + } +#else + + // Enumerating with WinRT using WRL (Win32 desktop app for Windows 8.x) + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::Foundation; + using namespace ABI::Windows::Foundation::Collections; + using namespace ABI::Windows::Devices::Enumeration; + + RoInitializeWrapper initialize(RO_INIT_MULTITHREADED); + HRESULT hr = initialize; + ThrowIfFailed( hr ); + + ComPtr diFactory; + hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_Devices_Enumeration_DeviceInformation).Get(), &diFactory ); + ThrowIfFailed( hr ); + + Event findCompleted( CreateEventEx( nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, WRITE_OWNER | EVENT_ALL_ACCESS ) ); + if ( !findCompleted.IsValid() ) + throw std::exception( "CreateEventEx" ); + + auto callback = Callback>( + [&findCompleted,list]( IAsyncOperation* aDevices, AsyncStatus status ) -> HRESULT + { + UNREFERENCED_PARAMETER(aDevices); + UNREFERENCED_PARAMETER(status); + SetEvent( findCompleted.Get() ); + return S_OK; + }); + + ComPtr> operation; + hr = diFactory->FindAllAsyncDeviceClass( DeviceClass_AudioRender, operation.GetAddressOf() ); + ThrowIfFailed( hr ); + + operation->put_Completed( callback.Get() ); + + (void)WaitForSingleObjectEx( findCompleted.Get(), INFINITE, FALSE ); + + ComPtr> devices; + operation->GetResults( devices.GetAddressOf() ); + + unsigned int count = 0; + hr = devices->get_Size( &count ); + ThrowIfFailed( hr ); + + if ( !count ) + return list; + + for( unsigned int j = 0; j < count; ++j ) + { + ComPtr deviceInfo; + hr = devices->GetAt( j, deviceInfo.GetAddressOf() ); + if ( SUCCEEDED(hr) ) + { + HString id; + deviceInfo->get_Id( id.GetAddressOf() ); + + HString name; + deviceInfo->get_Name( name.GetAddressOf() ); + + RendererDetail device; + device.deviceId = id.GetRawBuffer( nullptr ); + device.description = name.GetRawBuffer( nullptr ); + list.emplace_back( device ); + } + } + +#endif + +#else // _WIN32_WINNT < _WIN32_WINNT_WIN8 + + // Enumerating with XAudio 2.7 + ComPtr pXAudio2; + + HRESULT hr = XAudio2Create( pXAudio2.GetAddressOf() ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: XAudio 2.7 not found (have you called CoInitialize?)\n"); + throw std::exception( "XAudio2Create" ); + } + + UINT32 count = 0; + hr = pXAudio2->GetDeviceCount( &count ); + ThrowIfFailed(hr); + + if ( !count ) + return list; + + list.reserve( count ); + + for( UINT32 j = 0; j < count; ++j ) + { + XAUDIO2_DEVICE_DETAILS details; + hr = pXAudio2->GetDeviceDetails( j, &details ); + if ( SUCCEEDED(hr) ) + { + RendererDetail device; + device.deviceId = details.DeviceID; + device.description = details.DisplayName; + list.emplace_back( device ); + } + } + +#endif + + return list; +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Audio/DynamicSoundEffectInstance.cpp b/Kits/DirectXTK12/Audio/DynamicSoundEffectInstance.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f497fc1babeadb112b43ebd0db2d06b3c30634ec --- /dev/null +++ b/Kits/DirectXTK12/Audio/DynamicSoundEffectInstance.cpp @@ -0,0 +1,376 @@ +//-------------------------------------------------------------------------------------- +// File: DynamicSoundEffectInstance.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SoundCommon.h" + +using namespace DirectX; + + +//====================================================================================== +// DynamicSoundEffectInstance +//====================================================================================== + +// Internal object implementation class. +class DynamicSoundEffectInstance::Impl : public IVoiceNotify +{ +public: + Impl( _In_ AudioEngine* engine, + _In_ DynamicSoundEffectInstance* object, _In_opt_ std::function bufferNeeded, + int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags ) : + mBase(), + mBufferNeeded( nullptr ), + mObject( object ) + { + if ( ( sampleRate < XAUDIO2_MIN_SAMPLE_RATE ) + || ( sampleRate > XAUDIO2_MAX_SAMPLE_RATE ) ) + { + DebugTrace( "DynamicSoundEffectInstance sampleRate must be in range %u...%u\n", XAUDIO2_MIN_SAMPLE_RATE, XAUDIO2_MAX_SAMPLE_RATE ); + throw std::invalid_argument( "DynamicSoundEffectInstance" ); + } + + if ( !channels || ( channels > 8 ) ) + { + DebugTrace( "DynamicSoundEffectInstance channels must be in range 1...8\n" ); + throw std::invalid_argument( "DynamicSoundEffectInstance" ); + } + + switch ( sampleBits ) + { + case 8: + case 16: + break; + + default: + DebugTrace( "DynamicSoundEffectInstance sampleBits must be 8-bit or 16-bit\n" ); + throw std::invalid_argument( "DynamicSoundEffectInstance" ); + } + + mBufferEvent.reset( CreateEventEx( nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE ) ); + if ( !mBufferEvent ) + { + throw std::exception( "CreateEvent" ); + } + + CreateIntegerPCM( &mWaveFormat, sampleRate, channels, sampleBits ); + + assert( engine != 0 ); + engine->RegisterNotify( this, true ); + + mBase.Initialize( engine, &mWaveFormat, flags ); + + mBufferNeeded = bufferNeeded; + } + + virtual ~Impl() + { + mBase.DestroyVoice(); + + if ( mBase.engine ) + { + mBase.engine->UnregisterNotify( this, false, true ); + mBase.engine = nullptr; + } + } + + void Play(); + + void Resume(); + + void SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, uint32_t offset, size_t audioBytes ); + + const WAVEFORMATEX* GetFormat() const { return &mWaveFormat; } ; + + // IVoiceNotify + virtual void __cdecl OnBufferEnd() override + { + SetEvent( mBufferEvent.get() ); + } + + virtual void __cdecl OnCriticalError() override + { + mBase.OnCriticalError(); + } + + virtual void __cdecl OnReset() override + { + mBase.OnReset(); + } + + virtual void __cdecl OnUpdate() override; + + virtual void __cdecl OnDestroyEngine() override + { + mBase.OnDestroy(); + } + + virtual void __cdecl OnTrim() override + { + mBase.OnTrim(); + } + + virtual void __cdecl GatherStatistics( AudioStatistics& stats ) const override + { + mBase.GatherStatistics(stats); + } + + SoundEffectInstanceBase mBase; + +private: + ScopedHandle mBufferEvent; + std::function mBufferNeeded; + DynamicSoundEffectInstance* mObject; + WAVEFORMATEX mWaveFormat; +}; + + +void DynamicSoundEffectInstance::Impl::Play() +{ + if ( !mBase.voice ) + { + mBase.AllocateVoice( &mWaveFormat ); + } + + (void)mBase.Play(); + + if ( mBase.voice && ( mBase.state == PLAYING ) && ( mBase.GetPendingBufferCount() <= 2 ) ) + { + SetEvent( mBufferEvent.get() ); + } +} + + +void DynamicSoundEffectInstance::Impl::Resume() +{ + if ( mBase.voice && ( mBase.state == PAUSED ) ) + { + mBase.Resume(); + + if ( ( mBase.state == PLAYING ) && ( mBase.GetPendingBufferCount() <= 2 ) ) + { + SetEvent( mBufferEvent.get() ); + } + } +} + + +_Use_decl_annotations_ +void DynamicSoundEffectInstance::Impl::SubmitBuffer( const uint8_t* pAudioData, uint32_t offset, size_t audioBytes ) +{ + if ( !pAudioData || !audioBytes ) + throw std::exception( "Invalid audio data buffer" ); + +#ifdef _M_X64 + if ( audioBytes > 0xFFFFFFFF ) + throw std::out_of_range( "SubmitBuffer" ); +#endif + + XAUDIO2_BUFFER buffer = {}; + buffer.AudioBytes = static_cast( audioBytes ); + buffer.pAudioData = pAudioData; + + if( offset ) + { + assert( mWaveFormat.wFormatTag == WAVE_FORMAT_PCM ); + buffer.PlayBegin = offset / mWaveFormat.nBlockAlign; + buffer.PlayLength = static_cast( ( audioBytes - offset ) / mWaveFormat.nBlockAlign ); + } + + buffer.pContext = this; + + HRESULT hr = mBase.voice->SubmitSourceBuffer( &buffer, nullptr ); + if ( FAILED(hr) ) + { +#ifdef _DEBUG + DebugTrace( "ERROR: DynamicSoundEffectInstance failed (%08X) when submitting buffer:\n", hr ); + + DebugTrace( "\tFormat Tag %u, %u channels, %u-bit, %u Hz, %Iu bytes [%u offset)\n", mWaveFormat.wFormatTag, + mWaveFormat.nChannels, mWaveFormat.wBitsPerSample, mWaveFormat.nSamplesPerSec, audioBytes, offset ); +#endif + throw std::exception( "SubmitSourceBuffer" ); + } +} + + +void DynamicSoundEffectInstance::Impl::OnUpdate() +{ + DWORD result = WaitForSingleObjectEx( mBufferEvent.get(), 0, FALSE ); + switch( result ) + { + case WAIT_TIMEOUT: + break; + + case WAIT_OBJECT_0: + if( mBufferNeeded ) + { + // This callback happens on the same thread that called AudioEngine::Update() + mBufferNeeded( mObject ); + } + break; + + case WAIT_FAILED: + throw std::exception( "WaitForSingleObjectEx" ); + } +} + + + +//-------------------------------------------------------------------------------------- +// DynamicSoundEffectInstance +//-------------------------------------------------------------------------------------- + +#pragma warning( disable : 4355 ) + +// Public constructors +_Use_decl_annotations_ +DynamicSoundEffectInstance::DynamicSoundEffectInstance( AudioEngine* engine, + std::function bufferNeeded, + int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags ) : + pImpl( new Impl( engine, this, bufferNeeded, sampleRate, channels, sampleBits, flags ) ) +{ +} + + +// Move constructor. +DynamicSoundEffectInstance::DynamicSoundEffectInstance(DynamicSoundEffectInstance&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +DynamicSoundEffectInstance& DynamicSoundEffectInstance::operator= (DynamicSoundEffectInstance&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +DynamicSoundEffectInstance::~DynamicSoundEffectInstance() +{ +} + + +// Public methods. +void DynamicSoundEffectInstance::Play() +{ + pImpl->Play(); +} + + +void DynamicSoundEffectInstance::Stop( bool immediate ) +{ + bool looped = false; + pImpl->mBase.Stop( immediate, looped ); +} + + +void DynamicSoundEffectInstance::Pause() +{ + pImpl->mBase.Pause(); +} + + +void DynamicSoundEffectInstance::Resume() +{ + pImpl->Resume(); +} + + +void DynamicSoundEffectInstance::SetVolume( float volume ) +{ + pImpl->mBase.SetVolume( volume ); +} + + +void DynamicSoundEffectInstance::SetPitch( float pitch ) +{ + pImpl->mBase.SetPitch( pitch ); +} + + +void DynamicSoundEffectInstance::SetPan( float pan ) +{ + pImpl->mBase.SetPan( pan ); +} + + +void DynamicSoundEffectInstance::Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords ) +{ + pImpl->mBase.Apply3D( listener, emitter, rhcoords ); +} + + +_Use_decl_annotations_ +void DynamicSoundEffectInstance::SubmitBuffer( const uint8_t* pAudioData, size_t audioBytes ) +{ + pImpl->SubmitBuffer( pAudioData, 0, audioBytes ); +} + + +_Use_decl_annotations_ +void DynamicSoundEffectInstance::SubmitBuffer( const uint8_t* pAudioData, uint32_t offset, size_t audioBytes ) +{ + pImpl->SubmitBuffer( pAudioData, offset, audioBytes ); +} + + +// Public accessors. +SoundState DynamicSoundEffectInstance::GetState() +{ + return pImpl->mBase.GetState( false ); +} + + +size_t DynamicSoundEffectInstance::GetSampleDuration( size_t bytes ) const +{ + auto wfx = pImpl->GetFormat(); + if ( !wfx || !wfx->wBitsPerSample || !wfx->nChannels ) + return 0; + + return static_cast( ( uint64_t( bytes ) * 8 ) + / uint64_t( wfx->wBitsPerSample * wfx->nChannels ) ); +} + + +size_t DynamicSoundEffectInstance::GetSampleDurationMS( size_t bytes ) const +{ + auto wfx = pImpl->GetFormat(); + if ( !wfx || !wfx->nAvgBytesPerSec ) + return 0; + + return static_cast( ( uint64_t(bytes) * 1000 ) / wfx->nAvgBytesPerSec ); +} + + +size_t DynamicSoundEffectInstance::GetSampleSizeInBytes( uint64_t duration ) const +{ + auto wfx = pImpl->GetFormat(); + if ( !wfx || !wfx->nSamplesPerSec ) + return 0; + + return static_cast( ( ( duration * wfx->nSamplesPerSec ) / 1000 ) * wfx->nBlockAlign ); +} + + +int DynamicSoundEffectInstance::GetPendingBufferCount() const +{ + return pImpl->mBase.GetPendingBufferCount(); +} + + +const WAVEFORMATEX* DynamicSoundEffectInstance::GetFormat() const +{ + return pImpl->GetFormat(); +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Audio/SoundCommon.cpp b/Kits/DirectXTK12/Audio/SoundCommon.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3b32d648e2dcc394bdb465ee86d2b5ad9cc5af1d --- /dev/null +++ b/Kits/DirectXTK12/Audio/SoundCommon.cpp @@ -0,0 +1,787 @@ +//-------------------------------------------------------------------------------------- +// File: SoundCommon.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "pch.h" +#include "SoundCommon.h" + +using namespace DirectX; + + +namespace +{ + template WORD ChannelsSpecifiedInMask(T x) + { + WORD bitCount = 0; + while (x) {++bitCount; x &= (x-1);} + return bitCount; + } +} + + +//====================================================================================== +// Wave format utilities +//====================================================================================== + +bool DirectX::IsValid( _In_ const WAVEFORMATEX* wfx ) +{ + if ( !wfx ) + return false; + + if ( !wfx->nChannels ) + { + DebugTrace( "ERROR: Wave format must have at least 1 channel\n" ); + return false; + } + + if ( wfx->nChannels > XAUDIO2_MAX_AUDIO_CHANNELS ) + { + DebugTrace( "ERROR: Wave format must have less than %u channels (%u)\n", XAUDIO2_MAX_AUDIO_CHANNELS, wfx->nChannels ); + return false; + } + + if ( !wfx->nSamplesPerSec ) + { + DebugTrace( "ERROR: Wave format cannot have a sample rate of 0\n" ); + return false; + } + + if ( ( wfx->nSamplesPerSec < XAUDIO2_MIN_SAMPLE_RATE ) + || ( wfx->nSamplesPerSec > XAUDIO2_MAX_SAMPLE_RATE ) ) + { + DebugTrace( "ERROR: Wave format channel count must be in range %u..%u (%u)\n", XAUDIO2_MIN_SAMPLE_RATE, XAUDIO2_MAX_SAMPLE_RATE, wfx->nSamplesPerSec ); + return false; + } + + switch ( wfx->wFormatTag ) + { + case WAVE_FORMAT_PCM: + + switch( wfx->wBitsPerSample ) + { + case 8: + case 16: + case 24: + case 32: + break; + + default: + DebugTrace( "ERROR: Wave format integer PCM must have 8, 16, 24, or 32 bits per sample (%u)\n", wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nBlockAlign != ( wfx->nChannels * wfx->wBitsPerSample / 8 ) ) + { + DebugTrace( "ERROR: Wave format integer PCM - nBlockAlign (%u) != nChannels (%u) * wBitsPerSample (%u) / 8\n", + wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nAvgBytesPerSec != ( wfx->nSamplesPerSec * wfx->nBlockAlign ) ) + { + DebugTrace( "ERROR: Wave format integer PCM - nAvgBytesPerSec (%lu) != nSamplesPerSec (%lu) * nBlockAlign (%u)\n", + wfx->nAvgBytesPerSec, wfx->nSamplesPerSec, wfx->nBlockAlign ); + return false; + } + + return true; + + case WAVE_FORMAT_IEEE_FLOAT: + + if ( wfx->wBitsPerSample != 32 ) + { + DebugTrace( "ERROR: Wave format float PCM must have 32-bits per sample (%u)\n", wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nBlockAlign != ( wfx->nChannels * wfx->wBitsPerSample / 8 ) ) + { + DebugTrace( "ERROR: Wave format float PCM - nBlockAlign (%u) != nChannels (%u) * wBitsPerSample (%u) / 8\n", + wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nAvgBytesPerSec != ( wfx->nSamplesPerSec * wfx->nBlockAlign ) ) + { + DebugTrace( "ERROR: Wave format float PCM - nAvgBytesPerSec (%lu) != nSamplesPerSec (%lu) * nBlockAlign (%u)\n", + wfx->nAvgBytesPerSec, wfx->nSamplesPerSec, wfx->nBlockAlign ); + return false; + } + + return true; + + case WAVE_FORMAT_ADPCM: + + if ( ( wfx->nChannels != 1 ) && ( wfx->nChannels != 2 ) ) + { + DebugTrace( "ERROR: Wave format ADPCM must have 1 or 2 channels (%u)\n", wfx->nChannels ); + return false; + } + + if ( wfx->wBitsPerSample != 4 /*MSADPCM_BITS_PER_SAMPLE*/ ) + { + DebugTrace( "ERROR: Wave format ADPCM must have 4 bits per sample (%u)\n", wfx->wBitsPerSample ); + return false; + } + + if ( wfx->cbSize != 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/ ) + { + DebugTrace( "ERROR: Wave format ADPCM must have cbSize = 32 (%u)\n", wfx->cbSize ); + return false; + } + else + { + auto wfadpcm = reinterpret_cast( wfx ); + + if ( wfadpcm->wNumCoef != 7 /*MSADPCM_NUM_COEFFICIENTS*/ ) + { + DebugTrace( "ERROR: Wave format ADPCM must have 7 coefficients (%u)\n", wfadpcm->wNumCoef ); + return false; + } + + bool valid = true; + for ( int j = 0; j < 7 /*MSADPCM_NUM_COEFFICIENTS*/; ++j ) + { + // Microsoft ADPCM standard encoding coefficients + static const short g_pAdpcmCoefficients1[] = {256, 512, 0, 192, 240, 460, 392}; + static const short g_pAdpcmCoefficients2[] = { 0, -256, 0, 64, 0, -208, -232}; + + if ( wfadpcm->aCoef[j].iCoef1 != g_pAdpcmCoefficients1[j] + || wfadpcm->aCoef[j].iCoef2 != g_pAdpcmCoefficients2[j] ) + { + valid = false; + } + } + + if ( !valid ) + { + DebugTrace( "ERROR: Wave formt ADPCM found non-standard coefficients\n" ); + return false; + } + + if ( ( wfadpcm->wSamplesPerBlock < 4 /*MSADPCM_MIN_SAMPLES_PER_BLOCK*/ ) + || ( wfadpcm->wSamplesPerBlock > 64000 /*MSADPCM_MAX_SAMPLES_PER_BLOCK*/ ) ) + { + DebugTrace( "ERROR: Wave format ADPCM wSamplesPerBlock must be 4..64000 (%u)\n", wfadpcm->wSamplesPerBlock ); + return false; + } + + if ( wfadpcm->wfx.nChannels == 1 && ( wfadpcm->wSamplesPerBlock % 2 ) ) + { + DebugTrace( "ERROR: Wave format ADPCM mono files must have even wSamplesPerBlock\n" ); + return false; + } + + int nHeaderBytes = 7 /*MSADPCM_HEADER_LENGTH*/ * wfx->nChannels; + int nBitsPerFrame = 4 /*MSADPCM_BITS_PER_SAMPLE*/ * wfx->nChannels; + int nPcmFramesPerBlock = (wfx->nBlockAlign - nHeaderBytes) * 8 / nBitsPerFrame + 2; + + if ( wfadpcm->wSamplesPerBlock != nPcmFramesPerBlock ) + { + DebugTrace( "ERROR: Wave format ADPCM %u-channel with nBlockAlign = %u must have wSamplesPerBlock = %u (%u)\n", + wfx->nChannels, wfx->nBlockAlign, nPcmFramesPerBlock, wfadpcm->wSamplesPerBlock ); + return false; + } + } + return true; + + case WAVE_FORMAT_WMAUDIO2: + case WAVE_FORMAT_WMAUDIO3: + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + if ( wfx->wBitsPerSample != 16 ) + { + DebugTrace( "ERROR: Wave format xWMA only supports 16-bit data\n" ); + return false; + } + + if ( !wfx->nBlockAlign ) + { + DebugTrace( "ERROR: Wave format xWMA must have a non-zero nBlockAlign\n" ); + return false; + } + + if ( !wfx->nAvgBytesPerSec ) + { + DebugTrace( "ERROR: Wave format xWMA must have a non-zero nAvgBytesPerSec\n" ); + return false; + } + + return true; + +#else + DebugTrace( "ERROR: Wave format xWMA not supported by this version of DirectXTK for Audio\n" ); + return false; +#endif + + case 0x166 /* WAVE_FORMAT_XMA2 */: + +#if defined(_XBOX_ONE) && defined(_TITLE) + + if ( wfx->nBlockAlign != wfx->nChannels * XMA_OUTPUT_SAMPLE_BYTES) + { + DebugTrace( "ERROR: Wave format XMA2 - nBlockAlign (%u) != nChannels(%u) * %u\n", wfx->nBlockAlign, wfx->nChannels, XMA_OUTPUT_SAMPLE_BYTES ); + return false; + } + + if ( wfx->wBitsPerSample != XMA_OUTPUT_SAMPLE_BITS ) + { + DebugTrace( "ERROR: Wave format XMA2 wBitsPerSample (%u) should be %u\n", wfx->wBitsPerSample, XMA_OUTPUT_SAMPLE_BITS ); + return false; + } + + if ( wfx->cbSize != ( sizeof(XMA2WAVEFORMATEX) - sizeof(WAVEFORMATEX) ) ) + { + DebugTrace( "ERROR: Wave format XMA2 - cbSize must be %Iu (%u)\n", ( sizeof(XMA2WAVEFORMATEX) - sizeof(WAVEFORMATEX) ), wfx->cbSize ); + return false; + } + else + { + auto xmaFmt = reinterpret_cast( wfx ); + + if ( xmaFmt->EncoderVersion < 3 ) + { + DebugTrace( "ERROR: Wave format XMA2 encoder version (%u) - 3 or higher is required\n", xmaFmt->EncoderVersion ); + return false; + } + + if ( !xmaFmt->BlockCount ) + { + DebugTrace( "ERROR: Wave format XMA2 BlockCount must be non-zero\n" ); + return false; + } + + if ( !xmaFmt->BytesPerBlock || ( xmaFmt->BytesPerBlock > XMA_READBUFFER_MAX_BYTES ) ) + { + DebugTrace( "ERROR: Wave format XMA2 BytesPerBlock (%u) is invalid\n", xmaFmt->BytesPerBlock ); + return false; + } + + if ( xmaFmt->ChannelMask ) + { + auto channelBits = ChannelsSpecifiedInMask( xmaFmt->ChannelMask ); + if ( channelBits != wfx->nChannels ) + { + DebugTrace( "ERROR: Wave format XMA2 - nChannels=%u but ChannelMask (%08X) has %u bits set\n", + xmaFmt->ChannelMask, wfx->nChannels, channelBits ); + return false; + } + } + + if ( xmaFmt->NumStreams != ( ( wfx->nChannels + 1) / 2 ) ) + { + DebugTrace( "ERROR: Wave format XMA2 - NumStreams (%u) != ( nChannels(%u) + 1 ) / 2\n", xmaFmt->NumStreams, wfx->nChannels ); + return false; + } + + if ( ( xmaFmt->PlayBegin + xmaFmt->PlayLength ) > xmaFmt->SamplesEncoded ) + { + DebugTrace( "ERROR: Wave format XMA2 play region too large (%u + %u > %u)\n", xmaFmt->PlayBegin, xmaFmt->PlayLength, xmaFmt->SamplesEncoded ); + return false; + } + + if ( ( xmaFmt->LoopBegin + xmaFmt->LoopLength ) > xmaFmt->SamplesEncoded ) + { + DebugTrace( "ERROR: Wave format XMA2 loop region too large (%u + %u > %u)\n", xmaFmt->LoopBegin, xmaFmt->LoopLength, xmaFmt->SamplesEncoded ); + return false; + } + } + return true; + +#else + DebugTrace( "ERROR: Wave format XMA2 not supported by this version of DirectXTK for Audio\n" ); + return false; +#endif + + case WAVE_FORMAT_EXTENSIBLE: + if ( wfx->cbSize < ( sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) ) ) + { + DebugTrace( "ERROR: Wave format WAVE_FORMAT_EXTENSIBLE - cbSize must be %Iu (%u)\n", ( sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) ), wfx->cbSize ); + return false; + } + else + { + static const GUID s_wfexBase = {0x00000000, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}; + + auto wfex = reinterpret_cast( wfx ); + + if ( memcmp( reinterpret_cast(&wfex->SubFormat) + sizeof(DWORD), + reinterpret_cast(&s_wfexBase) + sizeof(DWORD), sizeof(GUID) - sizeof(DWORD) ) != 0 ) + { + DebugTrace( "ERROR: Wave format WAVEFORMATEXTENSIBLE encountered with unknown GUID ({%8.8lX-%4.4X-%4.4X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X})\n", + wfex->SubFormat.Data1, wfex->SubFormat.Data2, wfex->SubFormat.Data3, + wfex->SubFormat.Data4[0], wfex->SubFormat.Data4[1], wfex->SubFormat.Data4[2], wfex->SubFormat.Data4[3], + wfex->SubFormat.Data4[4], wfex->SubFormat.Data4[5], wfex->SubFormat.Data4[6], wfex->SubFormat.Data4[7] ); + return false; + } + + switch( wfex->SubFormat.Data1 ) + { + case WAVE_FORMAT_PCM: + + switch( wfx->wBitsPerSample ) + { + case 8: + case 16: + case 24: + case 32: + break; + + default: + DebugTrace( "ERROR: Wave format integer PCM must have 8, 16, 24, or 32 bits per sample (%u)\n", wfx->wBitsPerSample ); + return false; + } + + switch( wfex->Samples.wValidBitsPerSample ) + { + case 0: + case 8: + case 16: + case 20: + case 24: + case 32: + break; + + default: + DebugTrace( "ERROR: Wave format integer PCM must have 8, 16, 20, 24, or 32 valid bits per sample (%u)\n", wfex->Samples.wValidBitsPerSample ); + return false; + } + + if ( wfex->Samples.wValidBitsPerSample + && ( wfex->Samples.wValidBitsPerSample > wfx->wBitsPerSample ) ) + { + DebugTrace( "ERROR: Wave format ingter PCM wValidBitsPerSample (%u) is greater than wBitsPerSample (%u)\n", wfex->Samples.wValidBitsPerSample, wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nBlockAlign != ( wfx->nChannels * wfx->wBitsPerSample / 8 ) ) + { + DebugTrace( "ERROR: Wave format integer PCM - nBlockAlign (%u) != nChannels (%u) * wBitsPerSample (%u) / 8\n", + wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nAvgBytesPerSec != ( wfx->nSamplesPerSec * wfx->nBlockAlign ) ) + { + DebugTrace( "ERROR: Wave format integer PCM - nAvgBytesPerSec (%lu) != nSamplesPerSec (%lu) * nBlockAlign (%u)\n", + wfx->nAvgBytesPerSec, wfx->nSamplesPerSec, wfx->nBlockAlign ); + return false; + } + + break; + + case WAVE_FORMAT_IEEE_FLOAT: + + if ( wfx->wBitsPerSample != 32 ) + { + DebugTrace( "ERROR: Wave format float PCM must have 32-bits per sample (%u)\n", wfx->wBitsPerSample ); + return false; + } + + switch( wfex->Samples.wValidBitsPerSample ) + { + case 0: + case 32: + break; + + default: + DebugTrace( "ERROR: Wave format float PCM must have 32 valid bits per sample (%u)\n", wfex->Samples.wValidBitsPerSample ); + return false; + } + + if ( wfx->nBlockAlign != ( wfx->nChannels * wfx->wBitsPerSample / 8 ) ) + { + DebugTrace( "ERROR: Wave format float PCM - nBlockAlign (%u) != nChannels (%u) * wBitsPerSample (%u) / 8\n", + wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample ); + return false; + } + + if ( wfx->nAvgBytesPerSec != ( wfx->nSamplesPerSec * wfx->nBlockAlign ) ) + { + DebugTrace( "ERROR: Wave format float PCM - nAvgBytesPerSec (%lu) != nSamplesPerSec (%lu) * nBlockAlign (%u)\n", + wfx->nAvgBytesPerSec, wfx->nSamplesPerSec, wfx->nBlockAlign ); + return false; + } + + break; + + case WAVE_FORMAT_ADPCM: + DebugTrace( "ERROR: Wave format ADPCM is not supported as a WAVEFORMATEXTENSIBLE\n" ); + return false; + + case WAVE_FORMAT_WMAUDIO2: + case WAVE_FORMAT_WMAUDIO3: + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + if ( wfx->wBitsPerSample != 16 ) + { + DebugTrace( "ERROR: Wave format xWMA only supports 16-bit data\n" ); + return false; + } + + if ( !wfx->nBlockAlign ) + { + DebugTrace( "ERROR: Wave format xWMA must have a non-zero nBlockAlign\n" ); + return false; + } + + if ( !wfx->nAvgBytesPerSec ) + { + DebugTrace( "ERROR: Wave format xWMA must have a non-zero nAvgBytesPerSec\n" ); + return false; + } + + break; + +#else + DebugTrace( "ERROR: Wave format xWMA not supported by this version of DirectXTK for Audio\n" ); + return false; +#endif + + case 0x166 /* WAVE_FORMAT_XMA2 */: + DebugTrace( "ERROR: Wave format XMA2 is not supported as a WAVEFORMATEXTENSIBLE\n" ); + return false; + + default: + DebugTrace( "ERROR: Unknown WAVEFORMATEXTENSIBLE format tag (%u)\n", wfex->SubFormat.Data1 ); + return false; + } + + if ( wfex->dwChannelMask ) + { + auto channelBits = ChannelsSpecifiedInMask( wfex->dwChannelMask ); + if ( channelBits != wfx->nChannels ) + { + DebugTrace( "ERROR: WAVEFORMATEXTENSIBLE: nChannels=%u but ChannelMask has %u bits set\n", + wfx->nChannels, channelBits ); + return false; + } + } + + return true; + } + + default: + DebugTrace( "ERROR: Unknown WAVEFORMATEX format tag (%u)\n", wfx->wFormatTag ); + return false; + } +} + + +uint32_t DirectX::GetDefaultChannelMask( int channels ) +{ + switch( channels ) + { + case 1: return SPEAKER_MONO; + case 2: return SPEAKER_STEREO; + case 3: return SPEAKER_2POINT1; + case 4: return SPEAKER_QUAD; + case 5: return SPEAKER_4POINT1; + case 6: return SPEAKER_5POINT1; + case 7: return SPEAKER_5POINT1 | SPEAKER_BACK_CENTER; + case 8: return SPEAKER_7POINT1; + default: return 0; + } +} + + +_Use_decl_annotations_ +void DirectX::CreateIntegerPCM( WAVEFORMATEX* wfx, int sampleRate, int channels, int sampleBits ) +{ + int blockAlign = channels * sampleBits / 8; + + wfx->wFormatTag = WAVE_FORMAT_PCM; + wfx->nChannels = static_cast( channels ); + wfx->nSamplesPerSec = static_cast( sampleRate ); + wfx->nAvgBytesPerSec = static_cast( blockAlign * sampleRate ); + wfx->nBlockAlign = static_cast( blockAlign ); + wfx->wBitsPerSample = static_cast( sampleBits ); + wfx->cbSize = 0; + + assert( IsValid( wfx ) ); +} + + +_Use_decl_annotations_ +void DirectX::CreateFloatPCM( WAVEFORMATEX* wfx, int sampleRate, int channels ) +{ + int blockAlign = channels * 4; + + wfx->wFormatTag = WAVE_FORMAT_IEEE_FLOAT; + wfx->nChannels = static_cast( channels ); + wfx->nSamplesPerSec = static_cast( sampleRate ); + wfx->nAvgBytesPerSec = static_cast( blockAlign * sampleRate ); + wfx->nBlockAlign = static_cast( blockAlign ); + wfx->wBitsPerSample = 32; + wfx->cbSize = 0; + + assert( IsValid( wfx ) ); +} + + +_Use_decl_annotations_ +void DirectX::CreateADPCM( WAVEFORMATEX* wfx, size_t wfxSize, int sampleRate, int channels, int samplesPerBlock ) +{ + if ( wfxSize < ( sizeof(WAVEFORMATEX) + 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/ ) ) + { + DebugTrace( "CreateADPCM needs at least %Iu bytes for the result\n", ( sizeof(WAVEFORMATEX) + 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/ ) ); + throw std::invalid_argument( "ADPCMWAVEFORMAT" ); + } + + if ( !samplesPerBlock ) + { + DebugTrace( "CreateADPCM needs a non-zero samples per block count\n" ); + throw std::invalid_argument( "ADPCMWAVEFORMAT" ); + } + + int blockAlign = (7 /*MSADPCM_HEADER_LENGTH*/) * channels + + (samplesPerBlock - 2) * (4 /* MSADPCM_BITS_PER_SAMPLE */) * channels / 8; + + wfx->wFormatTag = WAVE_FORMAT_ADPCM; + wfx->nChannels = static_cast( channels ); + wfx->nSamplesPerSec = static_cast( sampleRate ); + wfx->nAvgBytesPerSec = static_cast( blockAlign * sampleRate / samplesPerBlock ); + wfx->nBlockAlign = static_cast( blockAlign ); + wfx->wBitsPerSample = 4 /* MSADPCM_BITS_PER_SAMPLE */; + wfx->cbSize = 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/; + + auto adpcm = reinterpret_cast( wfx ); + adpcm->wSamplesPerBlock = static_cast( samplesPerBlock ); + adpcm->wNumCoef = 7 /* MSADPCM_NUM_COEFFICIENTS */; + + static ADPCMCOEFSET aCoef[7] = { { 256, 0}, {512, -256}, {0,0}, {192,64}, {240,0}, {460, -208}, {392,-232} }; + memcpy( &adpcm->aCoef, aCoef, sizeof(aCoef) ); + + assert( IsValid( wfx ) ); +} + + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) +_Use_decl_annotations_ +void DirectX::CreateXWMA( WAVEFORMATEX* wfx, int sampleRate, int channels, int blockAlign, int avgBytes, bool wma3 ) +{ + wfx->wFormatTag = (wma3) ? WAVE_FORMAT_WMAUDIO3 : WAVE_FORMAT_WMAUDIO2; + wfx->nChannels = static_cast( channels ); + wfx->nSamplesPerSec = static_cast( sampleRate ); + wfx->nAvgBytesPerSec = static_cast( avgBytes ); + wfx->nBlockAlign = static_cast( blockAlign ); + wfx->wBitsPerSample = 16; + wfx->cbSize = 0; + + assert( IsValid( wfx ) ); +} +#endif + + +#if defined(_XBOX_ONE) && defined(_TITLE) +_Use_decl_annotations_ +void DirectX::CreateXMA2( WAVEFORMATEX* wfx, size_t wfxSize, int sampleRate, int channels, int bytesPerBlock, int blockCount, int samplesEncoded ) +{ + if ( wfxSize < sizeof(XMA2WAVEFORMATEX) ) + { + DebugTrace( "XMA2 needs at least %Iu bytes for the result\n", sizeof(XMA2WAVEFORMATEX) ); + throw std::invalid_argument( "XMA2WAVEFORMATEX" ); + } + + if ( !bytesPerBlock || ( bytesPerBlock > XMA_READBUFFER_MAX_BYTES ) ) + { + DebugTrace( "XMA2 needs a valid bytes per block\n" ); + throw std::invalid_argument( "XMA2WAVEFORMATEX" ); + } + + int blockAlign = (channels * ( 16 /*XMA_OUTPUT_SAMPLE_BITS*/ ) / 8); + + wfx->wFormatTag = WAVE_FORMAT_XMA2; + wfx->nChannels = static_cast( channels ); + wfx->nSamplesPerSec = static_cast( sampleRate ); + wfx->nAvgBytesPerSec = static_cast( blockAlign * sampleRate ); + wfx->nBlockAlign = static_cast( blockAlign ); + wfx->wBitsPerSample = 16 /* XMA_OUTPUT_SAMPLE_BITS */; + wfx->cbSize = sizeof(XMA2WAVEFORMATEX) - sizeof(WAVEFORMATEX); + + auto xmaFmt = reinterpret_cast(wfx); + + xmaFmt->NumStreams = static_cast( (channels + 1) / 2 ); + + xmaFmt->ChannelMask = GetDefaultChannelMask( channels ); + + xmaFmt->SamplesEncoded = static_cast( samplesEncoded ); + xmaFmt->BytesPerBlock = bytesPerBlock; + xmaFmt->PlayBegin = xmaFmt->PlayLength = + xmaFmt->LoopBegin = xmaFmt->LoopLength = xmaFmt->LoopCount = 0; + xmaFmt->EncoderVersion = 4 /* XMAENCODER_VERSION_XMA2 */; + xmaFmt->BlockCount = static_cast( blockCount ); + + assert( IsValid( wfx ) ); +} +#endif // _XBOX_ONE && _TITLE + + +_Use_decl_annotations_ +bool DirectX::ComputePan( float pan, int channels, float* matrix ) +{ + memset( matrix, 0, sizeof(float) * 16 ); + + if (channels == 1) + { + // Mono panning + float left = ( pan >= 0 ) ? ( 1.f - pan ) : 1.f; + left = std::min( 1.f, left ); + left = std::max( -1.f, left ); + + float right = ( pan <= 0 ) ? ( - pan - 1.f ) : 1.f; + right = std::min( 1.f, right ); + right = std::max( -1.f, right ); + + matrix[0] = left; + matrix[1] = right; + } + else if (channels == 2) + { + // Stereo panning + if ( -1.f <= pan && pan <= 0.f ) + { + matrix[0] = .5f * pan + 1.f; // .5 when pan is -1, 1 when pan is 0 + matrix[1] = .5f * -pan; // .5 when pan is -1, 0 when pan is 0 + matrix[2] = 0.f; // 0 when pan is -1, 0 when pan is 0 + matrix[3] = pan + 1.f; // 0 when pan is -1, 1 when pan is 0 + } + else + { + matrix[0] = -pan + 1.f; // 1 when pan is 0, 0 when pan is 1 + matrix[1] = 0.f; // 0 when pan is 0, 0 when pan is 1 + matrix[2] = .5f * pan; // 0 when pan is 0, .5f when pan is 1 + matrix[3] = .5f * -pan + 1.f; // 1 when pan is 0. .5f when pan is 1 + } + } + else + { + if ( pan != 0.f ) + { + DebugTrace( "WARNING: Only supports panning on mono or stereo source data, ignored\n" ); + } + return false; + } + + return true; +} + + +//====================================================================================== +// SoundEffectInstanceBase +//====================================================================================== + +void SoundEffectInstanceBase::SetPan( float pan ) +{ + assert( pan >= -1.f && pan <= 1.f ); + + mPan = pan; + + if ( !voice ) + return; + + float matrix[16]; + if ( ComputePan( pan, mDSPSettings.SrcChannelCount, matrix ) ) + { + HRESULT hr = voice->SetOutputMatrix( nullptr, mDSPSettings.SrcChannelCount, mDSPSettings.DstChannelCount, matrix ); + ThrowIfFailed( hr ); + } +} + + +void SoundEffectInstanceBase::Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords ) +{ + if ( !voice ) + return; + + if ( !( mFlags & SoundEffectInstance_Use3D ) ) + { + DebugTrace( "ERROR: Apply3D called for an instance created without SoundEffectInstance_Use3D set\n" ); + throw std::exception( "Apply3D" ); + } + + DWORD dwCalcFlags = X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER | X3DAUDIO_CALCULATE_LPF_DIRECT; + + if ( mFlags & SoundEffectInstance_UseRedirectLFE ) + { + // On devices with an LFE channel, allow the mono source data to be routed to the LFE destination channel. + dwCalcFlags |= X3DAUDIO_CALCULATE_REDIRECT_TO_LFE; + } + + auto reverb = mReverbVoice; + if ( reverb ) + { + dwCalcFlags |= X3DAUDIO_CALCULATE_LPF_REVERB | X3DAUDIO_CALCULATE_REVERB; + } + + float matrix[ XAUDIO2_MAX_AUDIO_CHANNELS * 8 ]; + assert( mDSPSettings.SrcChannelCount <= XAUDIO2_MAX_AUDIO_CHANNELS ); + assert( mDSPSettings.DstChannelCount <= 8 ); + mDSPSettings.pMatrixCoefficients = matrix; + + assert( engine != 0 ); + if (rhcoords) + { + X3DAUDIO_EMITTER lhEmitter; + memcpy(&lhEmitter, &emitter, sizeof(X3DAUDIO_EMITTER)); + lhEmitter.OrientFront.z = -emitter.OrientFront.z; + lhEmitter.OrientTop.z = -emitter.OrientTop.z; + lhEmitter.Position.z = -emitter.Position.z; + lhEmitter.Velocity.z = -emitter.Velocity.z; + + X3DAUDIO_LISTENER lhListener; + memcpy(&lhListener, &listener, sizeof(X3DAUDIO_LISTENER)); + lhListener.OrientFront.z = -listener.OrientFront.z; + lhListener.OrientTop.z = -listener.OrientTop.z; + lhListener.Position.z = -listener.Position.z; + lhListener.Velocity.z = -listener.Velocity.z; + + X3DAudioCalculate( engine->Get3DHandle(), &lhListener, &lhEmitter, dwCalcFlags, &mDSPSettings ); + } + else + { + X3DAudioCalculate( engine->Get3DHandle(), &listener, &emitter, dwCalcFlags, &mDSPSettings ); + } + + mDSPSettings.pMatrixCoefficients = nullptr; + + voice->SetFrequencyRatio( mFreqRatio * mDSPSettings.DopplerFactor ); + + auto direct = mDirectVoice; + assert( direct != 0 ); + voice->SetOutputMatrix( direct, mDSPSettings.SrcChannelCount, mDSPSettings.DstChannelCount, matrix ); + + if ( reverb ) + { + voice->SetOutputMatrix( reverb, 1, 1, &mDSPSettings.ReverbLevel ); + } + + if ( mFlags & SoundEffectInstance_ReverbUseFilters ) + { + XAUDIO2_FILTER_PARAMETERS filterDirect = { LowPassFilter, 2.0f * sinf(X3DAUDIO_PI/6.0f * mDSPSettings.LPFDirectCoefficient), 1.0f }; + // see XAudio2CutoffFrequencyToRadians() in XAudio2.h for more information on the formula used here + voice->SetOutputFilterParameters( direct, &filterDirect ); + + if ( reverb ) + { + XAUDIO2_FILTER_PARAMETERS filterReverb = { LowPassFilter, 2.0f * sinf(X3DAUDIO_PI/6.0f * mDSPSettings.LPFReverbCoefficient), 1.0f }; + // see XAudio2CutoffFrequencyToRadians() in XAudio2.h for more information on the formula used here + voice->SetOutputFilterParameters( reverb, &filterReverb ); + } + } +} + + diff --git a/Kits/DirectXTK12/Audio/SoundCommon.h b/Kits/DirectXTK12/Audio/SoundCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..c8f3b7d1b5347989f1597b55b479f6b9a4a59153 --- /dev/null +++ b/Kits/DirectXTK12/Audio/SoundCommon.h @@ -0,0 +1,369 @@ +//-------------------------------------------------------------------------------------- +// File: SoundCommon.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "Audio.h" +#include "PlatformHelpers.h" + + +namespace DirectX +{ + // Helper for getting a format tag from a WAVEFORMATEX + inline uint32_t GetFormatTag( const WAVEFORMATEX* wfx ) + { + if ( wfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE ) + { + if ( wfx->cbSize < ( sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) ) ) + return 0; + + static const GUID s_wfexBase = {0x00000000, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}; + + auto wfex = reinterpret_cast( wfx ); + + if ( memcmp( reinterpret_cast(&wfex->SubFormat) + sizeof(DWORD), + reinterpret_cast(&s_wfexBase) + sizeof(DWORD), sizeof(GUID) - sizeof(DWORD) ) != 0 ) + { + return 0; + } + + return wfex->SubFormat.Data1; + } + else + { + return wfx->wFormatTag; + } + } + + + // Helper for validating wave format structure + bool IsValid( _In_ const WAVEFORMATEX* wfx ); + + + // Helper for getting a default channel mask from channels + uint32_t GetDefaultChannelMask( int channels ); + + + // Helpers for creating various wave format structures + void CreateIntegerPCM( _Out_ WAVEFORMATEX* wfx, int sampleRate, int channels, int sampleBits ); + void CreateFloatPCM( _Out_ WAVEFORMATEX* wfx, int sampleRate, int channels ); + void CreateADPCM( _Out_writes_bytes_(wfxSize) WAVEFORMATEX* wfx, size_t wfxSize, int sampleRate, int channels, int samplesPerBlock ); +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + void CreateXWMA( _Out_ WAVEFORMATEX* wfx, int sampleRate, int channels, int blockAlign, int avgBytes, bool wma3 ); +#endif +#if defined(_XBOX_ONE) && defined(_TITLE) + void CreateXMA2( _Out_writes_bytes_(wfxSize) WAVEFORMATEX* wfx, size_t wfxSize, int sampleRate, int channels, int bytesPerBlock, int blockCount, int samplesEncoded ); +#endif + + // Helper for computing pan volume matrix + bool ComputePan( float pan, int channels, _Out_writes_(16) float* matrix ); + + // Helper class for implementing SoundEffectInstance + class SoundEffectInstanceBase + { + public: + SoundEffectInstanceBase() : + voice( nullptr ), + state( STOPPED ), + engine( nullptr ), + mVolume( 1.f ), + mPitch( 0.f ), + mFreqRatio( 1.f ), + mPan( 0.f ), + mFlags( SoundEffectInstance_Default ), + mDirectVoice( nullptr ), + mReverbVoice( nullptr ) + { + } + + ~SoundEffectInstanceBase() + { + assert( !voice ); + } + + void Initialize( _In_ AudioEngine* eng, _In_ const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags ) + { + assert( eng != 0 ); + engine = eng; + mDirectVoice = eng->GetMasterVoice(); + mReverbVoice = eng->GetReverbVoice(); + + if ( eng->GetChannelMask() & SPEAKER_LOW_FREQUENCY ) + mFlags = flags | SoundEffectInstance_UseRedirectLFE; + else + mFlags = static_cast( static_cast(flags) & ~SoundEffectInstance_UseRedirectLFE ); + + memset( &mDSPSettings, 0, sizeof(X3DAUDIO_DSP_SETTINGS) ); + assert( wfx != 0 ); + mDSPSettings.SrcChannelCount = wfx->nChannels; + mDSPSettings.DstChannelCount = eng->GetOutputChannels(); + } + + void AllocateVoice( _In_ const WAVEFORMATEX* wfx ) + { + if ( voice ) + return; + + assert( engine != 0 ); + engine->AllocateVoice( wfx, mFlags, false, &voice ); + } + + void DestroyVoice() + { + if ( voice ) + { + assert( engine != 0 ); + engine->DestroyVoice( voice ); + voice = nullptr; + } + } + + bool Play() // Returns true if STOPPED -> PLAYING + { + if ( voice ) + { + if ( state == PAUSED ) + { + HRESULT hr = voice->Start( 0 ); + ThrowIfFailed( hr ); + state = PLAYING; + } + else if ( state != PLAYING ) + { + if ( mVolume != 1.f ) + { + HRESULT hr = voice->SetVolume( mVolume ); + ThrowIfFailed( hr ); + } + + if ( mPitch != 0.f ) + { + mFreqRatio = XAudio2SemitonesToFrequencyRatio( mPitch * 12.f ); + + HRESULT hr = voice->SetFrequencyRatio( mFreqRatio ); + ThrowIfFailed( hr ); + } + + if ( mPan != 0.f ) + { + SetPan( mPan ); + } + + HRESULT hr = voice->Start( 0 ); + ThrowIfFailed( hr ); + state = PLAYING; + return true; + } + } + return false; + } + + void Stop( bool immediate, bool& looped ) + { + if ( !voice ) + { + state = STOPPED; + return; + } + + if ( immediate ) + { + state = STOPPED; + voice->Stop( 0 ); + voice->FlushSourceBuffers(); + } + else if ( looped ) + { + looped = false; + voice->ExitLoop(); + } + else + { + voice->Stop( XAUDIO2_PLAY_TAILS ); + } + } + + void Pause() + { + if ( voice && state == PLAYING ) + { + state = PAUSED; + + voice->Stop( 0 ); + } + } + + void Resume() + { + if ( voice && state == PAUSED ) + { + HRESULT hr = voice->Start( 0 ); + ThrowIfFailed( hr ); + state = PLAYING; + } + } + + void SetVolume( float volume ) + { + assert( volume >= -XAUDIO2_MAX_VOLUME_LEVEL && volume <= XAUDIO2_MAX_VOLUME_LEVEL ); + + mVolume = volume; + + if ( voice ) + { + HRESULT hr = voice->SetVolume( volume ); + ThrowIfFailed( hr ); + } + } + + void SetPitch( float pitch ) + { + assert( pitch >= -1.f && pitch <= 1.f ); + + if ( ( mFlags & SoundEffectInstance_NoSetPitch ) && pitch != 0.f ) + { + DebugTrace( "ERROR: Sound effect instance was created with the NoSetPitch flag\n" ); + throw std::exception( "SetPitch" ); + } + + mPitch = pitch; + + if ( voice ) + { + mFreqRatio = XAudio2SemitonesToFrequencyRatio( mPitch * 12.f ); + + HRESULT hr = voice->SetFrequencyRatio( mFreqRatio ); + ThrowIfFailed( hr ); + } + } + + void SetPan( float pan ); + + void Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords ); + + SoundState GetState( bool autostop ) + { + if ( autostop && voice && ( state == PLAYING ) ) + { + XAUDIO2_VOICE_STATE xstate; +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + voice->GetState( &xstate, XAUDIO2_VOICE_NOSAMPLESPLAYED ); +#else + voice->GetState( &xstate ); +#endif + + if ( !xstate.BuffersQueued ) + { + // Automatic stop if the buffer has finished playing + voice->Stop(); + state = STOPPED; + } + } + + return state; + } + + int GetPendingBufferCount() const + { + if ( !voice ) + return 0; + + XAUDIO2_VOICE_STATE xstate; +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + voice->GetState( &xstate, XAUDIO2_VOICE_NOSAMPLESPLAYED ); +#else + voice->GetState( &xstate ); +#endif + return static_cast( xstate.BuffersQueued ); + } + + void OnCriticalError() + { + if ( voice ) + { + voice->DestroyVoice(); + voice = nullptr; + } + state = STOPPED; + mDirectVoice = nullptr; + mReverbVoice = nullptr; + } + + void OnReset() + { + assert( engine != 0 ); + mDirectVoice = engine->GetMasterVoice(); + mReverbVoice = engine->GetReverbVoice(); + + if ( engine->GetChannelMask() & SPEAKER_LOW_FREQUENCY ) + mFlags = mFlags | SoundEffectInstance_UseRedirectLFE; + else + mFlags = static_cast( static_cast(mFlags) & ~SoundEffectInstance_UseRedirectLFE ); + + mDSPSettings.DstChannelCount = engine->GetOutputChannels(); + } + + void OnDestroy() + { + if ( voice ) + { + voice->Stop( 0 ); + voice->FlushSourceBuffers(); + voice->DestroyVoice(); + voice = nullptr; + } + state = STOPPED; + engine = nullptr; + mDirectVoice = nullptr; + mReverbVoice = nullptr; + } + + void OnTrim() + { + if ( voice && ( state == STOPPED ) ) + { + engine->DestroyVoice( voice ); + voice = nullptr; + } + } + + void GatherStatistics( AudioStatistics& stats ) const + { + ++stats.allocatedInstances; + if ( voice ) + { + ++stats.allocatedVoices; + + if ( mFlags & SoundEffectInstance_Use3D ) + ++stats.allocatedVoices3d; + + if ( state == PLAYING ) + ++stats.playingInstances; + } + } + + IXAudio2SourceVoice* voice; + SoundState state; + AudioEngine* engine; + + private: + float mVolume; + float mPitch; + float mFreqRatio; + float mPan; + SOUND_EFFECT_INSTANCE_FLAGS mFlags; + IXAudio2Voice* mDirectVoice; + IXAudio2Voice* mReverbVoice; + X3DAUDIO_DSP_SETTINGS mDSPSettings; + }; +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Audio/SoundEffect.cpp b/Kits/DirectXTK12/Audio/SoundEffect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7cfdb8cea01dbdc225cf4ce20be4cb12398206aa --- /dev/null +++ b/Kits/DirectXTK12/Audio/SoundEffect.cpp @@ -0,0 +1,617 @@ +//-------------------------------------------------------------------------------------- +// File: SoundEffect.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "WAVFileReader.h" +#include "SoundCommon.h" + +#include + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#endif + +using namespace DirectX; + + +//====================================================================================== +// SoundEffect +//====================================================================================== + +// Internal object implementation class. +class SoundEffect::Impl : public IVoiceNotify +{ +public: + explicit Impl( _In_ AudioEngine* engine ) : + mWaveFormat( nullptr ), + mStartAudio( nullptr ), + mAudioBytes( 0 ), + mLoopStart( 0 ), + mLoopLength( 0 ), + mEngine( engine ), + mOneShots( 0 ) +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + , mSeekCount( 0 ) + , mSeekTable( nullptr ) +#endif +#if defined(_XBOX_ONE) && defined(_TITLE) + , mXMAMemory( nullptr ) +#endif + { + assert( mEngine != 0 ); + mEngine->RegisterNotify( this, false ); + } + + virtual ~Impl() + { + if ( !mInstances.empty() ) + { + DebugTrace( "WARNING: Destroying SoundEffect with %Iu outstanding SoundEffectInstances\n", mInstances.size() ); + + for( auto it = mInstances.begin(); it != mInstances.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnDestroyParent(); + } + + mInstances.clear(); + } + + if ( mOneShots > 0 ) + { + DebugTrace( "WARNING: Destroying SoundEffect with %u outstanding one shot effects\n", mOneShots ); + } + + if ( mEngine ) + { + mEngine->UnregisterNotify( this, true, false ); + mEngine = nullptr; + } + +#if defined(_XBOX_ONE) && defined(_TITLE) + if ( mXMAMemory ) + { + ApuFree( mXMAMemory ); + mXMAMemory = nullptr; + } +#endif + } + + HRESULT Initialize( _In_ AudioEngine* engine, _Inout_ std::unique_ptr& wavData, + _In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes, +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + _In_reads_opt_(seekCount) const uint32_t* seekTable, size_t seekCount, +#endif + uint32_t loopStart, uint32_t loopLength ); + + void Play( float volume, float pitch, float pan ); + + // IVoiceNotify + virtual void __cdecl OnBufferEnd() override + { + InterlockedDecrement( &mOneShots ); + } + + virtual void __cdecl OnCriticalError() override + { + mOneShots = 0; + } + + virtual void __cdecl OnReset() override + { + // No action required + } + + virtual void __cdecl OnUpdate() override + { + // We do not register for update notification + assert(false); + } + + virtual void __cdecl OnDestroyEngine() override + { + mEngine = nullptr; + mOneShots = 0; + } + + virtual void __cdecl OnTrim() override + { + // No action required + } + + virtual void __cdecl GatherStatistics( AudioStatistics& stats ) const override + { + stats.playingOneShots += mOneShots; + stats.audioBytes += mAudioBytes; + +#if defined(_XBOX_ONE) && defined(_TITLE) + if ( mXMAMemory ) + stats.xmaAudioBytes += mAudioBytes; +#endif + } + + const WAVEFORMATEX* mWaveFormat; + const uint8_t* mStartAudio; + uint32_t mAudioBytes; + uint32_t mLoopStart; + uint32_t mLoopLength; + AudioEngine* mEngine; + std::list mInstances; + uint32_t mOneShots; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + uint32_t mSeekCount; + const uint32_t* mSeekTable; +#endif + +private: + std::unique_ptr mWavData; + +#if defined(_XBOX_ONE) && defined(_TITLE) + void* mXMAMemory; +#endif +}; + + +_Use_decl_annotations_ +HRESULT SoundEffect::Impl::Initialize( AudioEngine* engine, std::unique_ptr& wavData, + const WAVEFORMATEX* wfx, const uint8_t* startAudio, size_t audioBytes, +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + const uint32_t* seekTable, size_t seekCount, +#endif + uint32_t loopStart, uint32_t loopLength ) +{ + if ( !engine || !IsValid( wfx ) || !startAudio || !audioBytes || !wavData ) + return E_INVALIDARG; + +#ifdef _M_X64 + if ( audioBytes > 0xFFFFFFFF ) + return E_INVALIDARG; +#endif + + switch( GetFormatTag( wfx ) ) + { + case WAVE_FORMAT_PCM: + case WAVE_FORMAT_IEEE_FLOAT: + case WAVE_FORMAT_ADPCM: + // Take ownership of the buffer + mWavData.reset( wavData.release() ); + + // WARNING: We assume the wfx and startAudio parameters are pointers into the wavData memory buffer + mWaveFormat = wfx; + mStartAudio = startAudio; + break; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + case WAVE_FORMAT_WMAUDIO2: + case WAVE_FORMAT_WMAUDIO3: + if ( !seekCount || !seekTable ) + { + DebugTrace( "ERROR: SoundEffect format xWMA requires seek table\n" ); + return E_FAIL; + } + +#ifdef _M_X64 + if ( seekCount > 0xFFFFFFFF ) + return E_INVALIDARG; +#endif + + // Take ownership of the buffer + mWavData.reset( wavData.release() ); + + // WARNING: We assume the wfx, startAudio, and mSeekTable parameters are pointers into the wavData memory buffer + mWaveFormat = wfx; + mStartAudio = startAudio; + mSeekCount = static_cast( seekCount ); + mSeekTable = seekTable; + break; + +#endif // _XBOX_ONE || _WIN32_WINNT < _WIN32_WINNT_WIN8 || _WIN32_WINNT >= _WIN32_WINNT_WIN10 + +#if defined(_XBOX_ONE) && defined(_TITLE) + + case WAVE_FORMAT_XMA2: + if ( !seekCount || !seekTable ) + { + DebugTrace( "ERROR: SoundEffect format XMA2 requires seek table\n" ); + return E_FAIL; + } + +#ifdef _M_X64 + if ( seekCount > 0xFFFFFFFF ) + return E_INVALIDARG; +#endif + + { + HRESULT hr = ApuAlloc( &mXMAMemory, nullptr, + static_cast( audioBytes ), SHAPE_XMA_INPUT_BUFFER_ALIGNMENT ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: ApuAlloc failed. Did you allocate a large enough heap with ApuCreateHeap for all your XMA wave data?\n" ); + return hr; + } + } + + memcpy( mXMAMemory, startAudio, audioBytes ); + mStartAudio = reinterpret_cast( mXMAMemory ); + + mWavData.reset( new uint8_t[ sizeof(XMA2WAVEFORMATEX) + ( seekCount * sizeof(uint32_t) ) ] ); + + memcpy( mWavData.get(), wfx, sizeof(XMA2WAVEFORMATEX) ); + mWaveFormat = reinterpret_cast( mWavData.get() ); + + // XMA seek table is Big-Endian + { + auto dest = reinterpret_cast( mWavData.get() + sizeof(XMA2WAVEFORMATEX) ); + for( size_t k = 0; k < seekCount; ++k ) + { + dest[ k ] = _byteswap_ulong( seekTable[ k ]) ; + } + } + + mSeekCount = static_cast( seekCount ); + mSeekTable = reinterpret_cast( mWavData.get() + sizeof(XMA2WAVEFORMATEX) ); + + wavData.reset(); + break; + +#endif // _XBOX_ONE && _TITLE + + default: + { + DebugTrace( "ERROR: SoundEffect encountered an unsupported format tag (%u)\n", wfx->wFormatTag ); + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + } + } + + mAudioBytes = static_cast( audioBytes ); + mLoopStart = loopStart; + mLoopLength = loopLength; + + return S_OK; +} + + +void SoundEffect::Impl::Play( float volume, float pitch, float pan ) +{ + assert( volume >= -XAUDIO2_MAX_VOLUME_LEVEL && volume <= XAUDIO2_MAX_VOLUME_LEVEL ); + assert( pitch >= -1.f && pitch <= 1.f ); + assert( pan >= -1.f && pan <= 1.f ); + + IXAudio2SourceVoice* voice = nullptr; + mEngine->AllocateVoice( mWaveFormat, SoundEffectInstance_Default, true, &voice ); + + if ( !voice ) + return; + + if ( volume != 1.f ) + { + HRESULT hr = voice->SetVolume( volume ); + ThrowIfFailed( hr ); + } + + if ( pitch != 0.f ) + { + float fr = XAudio2SemitonesToFrequencyRatio( pitch * 12.f ); + + HRESULT hr = voice->SetFrequencyRatio( fr ); + ThrowIfFailed( hr ); + } + + if ( pan != 0.f ) + { + float matrix[16]; + if (ComputePan(pan, mWaveFormat->nChannels, matrix)) + { + HRESULT hr = voice->SetOutputMatrix(nullptr, mWaveFormat->nChannels, mEngine->GetOutputChannels(), matrix); + ThrowIfFailed( hr ); + } + } + + HRESULT hr = voice->Start( 0 ); + ThrowIfFailed( hr ); + + XAUDIO2_BUFFER buffer = {}; + buffer.AudioBytes = mAudioBytes; + buffer.pAudioData = mStartAudio; + buffer.Flags = XAUDIO2_END_OF_STREAM; + buffer.pContext = this; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + uint32_t tag = GetFormatTag( mWaveFormat ); + if ( tag == WAVE_FORMAT_WMAUDIO2 || tag == WAVE_FORMAT_WMAUDIO3 ) + { + XAUDIO2_BUFFER_WMA wmaBuffer = {}; + wmaBuffer.PacketCount = mSeekCount; + wmaBuffer.pDecodedPacketCumulativeBytes = mSeekTable; + + hr = voice->SubmitSourceBuffer( &buffer, &wmaBuffer ); + } + else +#endif + { + hr = voice->SubmitSourceBuffer( &buffer, nullptr ); + } + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SoundEffect failed (%08X) when submitting buffer:\n", hr ); + DebugTrace( "\tFormat Tag %u, %u channels, %u-bit, %u Hz, %u bytes\n", mWaveFormat->wFormatTag, + mWaveFormat->nChannels, mWaveFormat->wBitsPerSample, mWaveFormat->nSamplesPerSec, mAudioBytes ); + throw std::exception( "SubmitSourceBuffer" ); + } + + InterlockedIncrement( &mOneShots ); +} + + +//-------------------------------------------------------------------------------------- +// SoundEffect +//-------------------------------------------------------------------------------------- + +// Public constructors. +_Use_decl_annotations_ +SoundEffect::SoundEffect( AudioEngine* engine, const wchar_t* waveFileName ) + : pImpl(new Impl(engine) ) +{ + WAVData wavInfo; + std::unique_ptr wavData; + HRESULT hr = LoadWAVAudioFromFileEx( waveFileName, wavData, wavInfo ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SoundEffect failed (%08X) to load from .wav file \"%ls\"\n", hr, waveFileName ); + throw std::exception( "SoundEffect" ); + } + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + hr = pImpl->Initialize( engine, wavData, wavInfo.wfx, wavInfo.startAudio, wavInfo.audioBytes, + wavInfo.seek, wavInfo.seekCount, + wavInfo.loopStart, wavInfo.loopLength ); +#else + hr = pImpl->Initialize( engine, wavData, wavInfo.wfx, wavInfo.startAudio, wavInfo.audioBytes, + wavInfo.loopStart, wavInfo.loopLength ); +#endif + + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SoundEffect failed (%08X) to intialize from .wav file \"%ls\"\n", hr, waveFileName ); + throw std::exception( "SoundEffect" ); + } +} + + +_Use_decl_annotations_ +SoundEffect::SoundEffect( AudioEngine* engine, std::unique_ptr& wavData, + const WAVEFORMATEX* wfx, const uint8_t* startAudio, size_t audioBytes ) + : pImpl(new Impl(engine) ) +{ +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + HRESULT hr = pImpl->Initialize( engine, wavData, wfx, startAudio, audioBytes, nullptr, 0, 0, 0 ); +#else + HRESULT hr = pImpl->Initialize( engine, wavData, wfx, startAudio, audioBytes, 0, 0 ); +#endif + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SoundEffect failed (%08X) to intialize\n", hr ); + throw std::exception( "SoundEffect" ); + } +} + + +_Use_decl_annotations_ +SoundEffect::SoundEffect( AudioEngine* engine, std::unique_ptr& wavData, + const WAVEFORMATEX* wfx, const uint8_t* startAudio, size_t audioBytes, + uint32_t loopStart, uint32_t loopLength ) + : pImpl(new Impl(engine) ) +{ +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + HRESULT hr = pImpl->Initialize( engine, wavData, wfx, startAudio, audioBytes, nullptr, 0, loopStart, loopLength ); +#else + HRESULT hr = pImpl->Initialize( engine, wavData, wfx, startAudio, audioBytes, loopStart, loopLength ); +#endif + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SoundEffect failed (%08X) to intialize\n", hr ); + throw std::exception( "SoundEffect" ); + } +} + + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + +_Use_decl_annotations_ +SoundEffect::SoundEffect( AudioEngine* engine, std::unique_ptr& wavData, + const WAVEFORMATEX* wfx, const uint8_t* startAudio, size_t audioBytes, + const uint32_t* seekTable, size_t seekCount ) +{ + HRESULT hr = pImpl->Initialize( engine, wavData, wfx, startAudio, audioBytes, seekTable, seekCount, 0, 0 ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: SoundEffect failed (%08X) to intialize\n", hr ); + throw std::exception( "SoundEffect" ); + } +} + +#endif + + +// Move constructor. +SoundEffect::SoundEffect(SoundEffect&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +SoundEffect& SoundEffect::operator= (SoundEffect&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +SoundEffect::~SoundEffect() +{ +} + + +// Public methods. +void SoundEffect::Play() +{ + pImpl->Play( 1.f, 0.f, 0.f ); +} + + +void SoundEffect::Play( float volume, float pitch, float pan ) +{ + pImpl->Play( volume, pitch, pan ); +} + + +std::unique_ptr SoundEffect::CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS flags ) +{ + auto effect = new SoundEffectInstance( pImpl->mEngine, this, flags ); + assert( effect != 0 ); + pImpl->mInstances.emplace_back( effect ); + return std::unique_ptr( effect ); +} + + +void SoundEffect::UnregisterInstance( _In_ SoundEffectInstance* instance ) +{ + auto it = std::find( pImpl->mInstances.begin(), pImpl->mInstances.end(), instance ); + if ( it == pImpl->mInstances.end() ) + return; + + pImpl->mInstances.erase( it ); +} + + +// Public accessors. +bool SoundEffect::IsInUse() const +{ + return ( pImpl->mOneShots > 0 ) || !pImpl->mInstances.empty(); +} + + +size_t SoundEffect::GetSampleSizeInBytes() const +{ + return pImpl->mAudioBytes; +} + + +size_t SoundEffect::GetSampleDuration() const +{ + if ( !pImpl->mWaveFormat || !pImpl->mWaveFormat->nChannels ) + return 0; + + switch( GetFormatTag( pImpl->mWaveFormat ) ) + { + case WAVE_FORMAT_ADPCM: + { + auto adpcmFmt = reinterpret_cast( pImpl->mWaveFormat ); + + uint64_t duration = uint64_t( pImpl->mAudioBytes / adpcmFmt->wfx.nBlockAlign ) * adpcmFmt->wSamplesPerBlock; + int partial = pImpl->mAudioBytes % adpcmFmt->wfx.nBlockAlign; + if ( partial ) + { + if ( partial >= ( 7 * adpcmFmt->wfx.nChannels ) ) + duration += ( partial * 2 / adpcmFmt->wfx.nChannels - 12 ); + } + return static_cast( duration ); + } + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + case WAVE_FORMAT_WMAUDIO2: + case WAVE_FORMAT_WMAUDIO3: + if ( pImpl->mSeekTable && pImpl->mSeekCount > 0 ) + { + return pImpl->mSeekTable[ pImpl->mSeekCount - 1 ] / uint32_t( 2 * pImpl->mWaveFormat->nChannels ); + } + break; + +#endif + +#if defined(_XBOX_ONE) && defined(_TITLE) + + case WAVE_FORMAT_XMA2: + return reinterpret_cast( pImpl->mWaveFormat )->SamplesEncoded; + +#endif + + default: + if ( pImpl->mWaveFormat->wBitsPerSample > 0 ) + { + return static_cast( ( uint64_t( pImpl->mAudioBytes ) * 8 ) + / uint64_t( pImpl->mWaveFormat->wBitsPerSample * pImpl->mWaveFormat->nChannels ) ); + } + } + + return 0; +} + + +size_t SoundEffect::GetSampleDurationMS() const +{ + if ( !pImpl->mWaveFormat || !pImpl->mWaveFormat->nSamplesPerSec ) + return 0; + + uint64_t samples = GetSampleDuration(); + return static_cast( ( samples * 1000 ) / pImpl->mWaveFormat->nSamplesPerSec ); +} + + +const WAVEFORMATEX* SoundEffect::GetFormat() const +{ + return pImpl->mWaveFormat; +} + + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + +bool SoundEffect::FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const +{ + memset( &buffer, 0, sizeof(buffer) ); + memset( &wmaBuffer, 0, sizeof(wmaBuffer) ); + + buffer.AudioBytes = pImpl->mAudioBytes; + buffer.pAudioData = pImpl->mStartAudio; + buffer.LoopBegin = pImpl->mLoopStart; + buffer.LoopLength = pImpl->mLoopLength; + + uint32_t tag = GetFormatTag( pImpl->mWaveFormat ); + if ( tag == WAVE_FORMAT_WMAUDIO2 || tag == WAVE_FORMAT_WMAUDIO3 ) + { + wmaBuffer.PacketCount = pImpl->mSeekCount; + wmaBuffer.pDecodedPacketCumulativeBytes = pImpl->mSeekTable; + return true; + } + + return false; +} + +#else + +void SoundEffect::FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer ) const +{ + memset( &buffer, 0, sizeof(buffer) ); + buffer.AudioBytes = pImpl->mAudioBytes; + buffer.pAudioData = pImpl->mStartAudio; + buffer.LoopBegin = pImpl->mLoopStart; + buffer.LoopLength = pImpl->mLoopLength; +} + +#endif diff --git a/Kits/DirectXTK12/Audio/SoundEffectInstance.cpp b/Kits/DirectXTK12/Audio/SoundEffectInstance.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d1add351e388177b77dd9b8299aef7417d789d9e --- /dev/null +++ b/Kits/DirectXTK12/Audio/SoundEffectInstance.cpp @@ -0,0 +1,334 @@ +//-------------------------------------------------------------------------------------- +// File: SoundEffectInstance.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SoundCommon.h" + +using namespace DirectX; + + +//====================================================================================== +// SoundEffectInstance +//====================================================================================== + +// Internal object implementation class. +class SoundEffectInstance::Impl : public IVoiceNotify +{ +public: + Impl( _In_ AudioEngine* engine, _In_ SoundEffect* effect, SOUND_EFFECT_INSTANCE_FLAGS flags ) : + mBase(), + mEffect( effect ), + mWaveBank( nullptr ), + mIndex( 0 ), + mLooped( false ) + { + assert( engine != 0 ); + engine->RegisterNotify( this, false ); + + assert( mEffect != 0 ); + mBase.Initialize( engine, effect->GetFormat(), flags ); + } + + Impl( _In_ AudioEngine* engine, _In_ WaveBank* waveBank, uint32_t index, SOUND_EFFECT_INSTANCE_FLAGS flags ) : + mBase(), + mEffect( nullptr ), + mWaveBank( waveBank ), + mIndex( index ), + mLooped( false ) + { + assert( engine != 0 ); + engine->RegisterNotify( this, false ); + + char buff[64]; + auto wfx = reinterpret_cast( buff ); + assert( mWaveBank != 0 ); + mBase.Initialize( engine, mWaveBank->GetFormat( index, wfx, 64 ), flags ); + } + + virtual ~Impl() + { + mBase.DestroyVoice(); + + if ( mBase.engine ) + { + mBase.engine->UnregisterNotify( this, false, false ); + mBase.engine = nullptr; + } + } + + void Play( bool loop ); + + // IVoiceNotify + virtual void __cdecl OnBufferEnd() override + { + // We don't register for this notification for SoundEffectInstances, so this should not be invoked + assert( false ); + } + + virtual void __cdecl OnCriticalError() override + { + mBase.OnCriticalError(); + } + + virtual void __cdecl OnReset() override + { + mBase.OnReset(); + } + + virtual void __cdecl OnUpdate() override + { + // We do not register for update notification + assert(false); + } + + virtual void __cdecl OnDestroyEngine() override + { + mBase.OnDestroy(); + } + + virtual void __cdecl OnTrim() override + { + mBase.OnTrim(); + } + + virtual void __cdecl GatherStatistics( AudioStatistics& stats ) const override + { + mBase.GatherStatistics(stats); + } + + SoundEffectInstanceBase mBase; + SoundEffect* mEffect; + WaveBank* mWaveBank; + uint32_t mIndex; + bool mLooped; +}; + + +void SoundEffectInstance::Impl::Play( bool loop ) +{ + if ( !mBase.voice ) + { + if ( mWaveBank ) + { + char buff[64]; + auto wfx = reinterpret_cast( buff ); + mBase.AllocateVoice( mWaveBank->GetFormat( mIndex, wfx, 64) ); + } + else + { + assert( mEffect != 0 ); + mBase.AllocateVoice( mEffect->GetFormat() ); + } + } + + if ( !mBase.Play() ) + return; + + // Submit audio data for STOPPED -> PLAYING state transition + XAUDIO2_BUFFER buffer; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + bool iswma = false; + XAUDIO2_BUFFER_WMA wmaBuffer; + if ( mWaveBank ) + { + iswma = mWaveBank->FillSubmitBuffer( mIndex, buffer, wmaBuffer ); + } + else + { + assert( mEffect != 0 ); + iswma = mEffect->FillSubmitBuffer( buffer, wmaBuffer ); + } + +#else + + if ( mWaveBank ) + { + mWaveBank->FillSubmitBuffer( mIndex, buffer ); + } + else + { + assert( mEffect != 0 ); + mEffect->FillSubmitBuffer( buffer ); + } + +#endif + + buffer.Flags = XAUDIO2_END_OF_STREAM; + if ( loop ) + { + mLooped = true; + buffer.LoopCount = XAUDIO2_LOOP_INFINITE; + } + else + { + mLooped = false; + buffer.LoopCount = buffer.LoopBegin = buffer.LoopLength = 0; + } + buffer.pContext = nullptr; + + HRESULT hr; +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + if ( iswma ) + { + hr = mBase.voice->SubmitSourceBuffer( &buffer, &wmaBuffer ); + } + else +#endif + { + hr = mBase.voice->SubmitSourceBuffer( &buffer, nullptr ); + } + + if ( FAILED(hr) ) + { +#ifdef _DEBUG + DebugTrace( "ERROR: SoundEffectInstance failed (%08X) when submitting buffer:\n", hr ); + + char buff[64]; + auto wfx = ( mWaveBank ) ? mWaveBank->GetFormat( mIndex, reinterpret_cast( buff ), 64 ) + : mEffect->GetFormat(); + + size_t length = ( mWaveBank ) ? mWaveBank->GetSampleSizeInBytes( mIndex ) : mEffect->GetSampleSizeInBytes(); + + DebugTrace( "\tFormat Tag %u, %u channels, %u-bit, %u Hz, %Iu bytes\n", wfx->wFormatTag, + wfx->nChannels, wfx->wBitsPerSample, wfx->nSamplesPerSec, length ); +#endif + mBase.Stop( true, mLooped ); + throw std::exception( "SubmitSourceBuffer" ); + } +} + + +//-------------------------------------------------------------------------------------- +// SoundEffectInstance +//-------------------------------------------------------------------------------------- + +// Private constructors +_Use_decl_annotations_ +SoundEffectInstance::SoundEffectInstance( AudioEngine* engine, SoundEffect* effect, SOUND_EFFECT_INSTANCE_FLAGS flags ) : + pImpl( new Impl( engine, effect, flags ) ) +{ +} + +_Use_decl_annotations_ +SoundEffectInstance::SoundEffectInstance( AudioEngine* engine, WaveBank* waveBank, int index, SOUND_EFFECT_INSTANCE_FLAGS flags ) : + pImpl( new Impl( engine, waveBank, index, flags ) ) +{ +} + + +// Move constructor. +SoundEffectInstance::SoundEffectInstance(SoundEffectInstance&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +SoundEffectInstance& SoundEffectInstance::operator= (SoundEffectInstance&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +SoundEffectInstance::~SoundEffectInstance() +{ + if( pImpl ) + { + if ( pImpl->mWaveBank ) + { + pImpl->mWaveBank->UnregisterInstance( this ); + pImpl->mWaveBank = nullptr; + } + + if ( pImpl->mEffect ) + { + pImpl->mEffect->UnregisterInstance( this ); + pImpl->mEffect = nullptr; + } + } +} + + +// Public methods. +void SoundEffectInstance::Play( bool loop ) +{ + pImpl->Play( loop ); +} + + +void SoundEffectInstance::Stop( bool immediate ) +{ + pImpl->mBase.Stop( immediate, pImpl->mLooped ); +} + + +void SoundEffectInstance::Pause() +{ + pImpl->mBase.Pause(); +} + + +void SoundEffectInstance::Resume() +{ + pImpl->mBase.Resume(); +} + + +void SoundEffectInstance::SetVolume( float volume ) +{ + pImpl->mBase.SetVolume( volume ); +} + + +void SoundEffectInstance::SetPitch( float pitch ) +{ + pImpl->mBase.SetPitch( pitch ); +} + + +void SoundEffectInstance::SetPan( float pan ) +{ + pImpl->mBase.SetPan( pan ); +} + + +void SoundEffectInstance::Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords ) +{ + pImpl->mBase.Apply3D( listener, emitter, rhcoords ); +} + + +// Public accessors. +bool SoundEffectInstance::IsLooped() const +{ + return pImpl->mLooped; +} + + +SoundState SoundEffectInstance::GetState() +{ + return pImpl->mBase.GetState( true ); +} + + +// Notifications. +void SoundEffectInstance::OnDestroyParent() +{ + pImpl->mBase.OnDestroy(); + pImpl->mWaveBank = nullptr; + pImpl->mEffect = nullptr; +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Audio/WAVFileReader.cpp b/Kits/DirectXTK12/Audio/WAVFileReader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4ecff8e2727b9699fb250f57629fa9fff0e71b01 --- /dev/null +++ b/Kits/DirectXTK12/Audio/WAVFileReader.cpp @@ -0,0 +1,681 @@ +//-------------------------------------------------------------------------------------- +// File: WAVFileReader.cpp +// +// Functions for loading WAV audio files +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PlatformHelpers.h" +#include "WAVFileReader.h" + +using namespace DirectX; + + +namespace +{ + +//-------------------------------------------------------------------------------------- +// .WAV files +//-------------------------------------------------------------------------------------- +const uint32_t FOURCC_RIFF_TAG = 'FFIR'; +const uint32_t FOURCC_FORMAT_TAG = ' tmf'; +const uint32_t FOURCC_DATA_TAG = 'atad'; +const uint32_t FOURCC_WAVE_FILE_TAG = 'EVAW'; +const uint32_t FOURCC_XWMA_FILE_TAG = 'AMWX'; +const uint32_t FOURCC_DLS_SAMPLE = 'pmsw'; +const uint32_t FOURCC_MIDI_SAMPLE = 'lpms'; +const uint32_t FOURCC_XWMA_DPDS = 'sdpd'; +const uint32_t FOURCC_XMA_SEEK = 'kees'; + +#pragma pack(push,1) +struct RIFFChunk +{ + uint32_t tag; + uint32_t size; +}; + +struct RIFFChunkHeader +{ + uint32_t tag; + uint32_t size; + uint32_t riff; +}; + +struct DLSLoop +{ + static const uint32_t LOOP_TYPE_FORWARD = 0x00000000; + static const uint32_t LOOP_TYPE_RELEASE = 0x00000001; + + uint32_t size; + uint32_t loopType; + uint32_t loopStart; + uint32_t loopLength; +}; + +struct RIFFDLSSample +{ + static const uint32_t OPTIONS_NOTRUNCATION = 0x00000001; + static const uint32_t OPTIONS_NOCOMPRESSION = 0x00000002; + + uint32_t size; + uint16_t unityNote; + int16_t fineTune; + int32_t gain; + uint32_t options; + uint32_t loopCount; +}; + +struct MIDILoop +{ + static const uint32_t LOOP_TYPE_FORWARD = 0x00000000; + static const uint32_t LOOP_TYPE_ALTERNATING = 0x00000001; + static const uint32_t LOOP_TYPE_BACKWARD = 0x00000002; + + uint32_t cuePointId; + uint32_t type; + uint32_t start; + uint32_t end; + uint32_t fraction; + uint32_t playCount; +}; + +struct RIFFMIDISample +{ + uint32_t manufacturerId; + uint32_t productId; + uint32_t samplePeriod; + uint32_t unityNode; + uint32_t pitchFraction; + uint32_t SMPTEFormat; + uint32_t SMPTEOffset; + uint32_t loopCount; + uint32_t samplerData; +}; +#pragma pack(pop) + +static_assert( sizeof(RIFFChunk) == 8, "structure size mismatch"); +static_assert( sizeof(RIFFChunkHeader) == 12, "structure size mismatch"); +static_assert( sizeof(DLSLoop) == 16, "structure size mismatch"); +static_assert( sizeof(RIFFDLSSample) == 20, "structure size mismatch"); +static_assert( sizeof(MIDILoop) == 24, "structure size mismatch"); +static_assert( sizeof(RIFFMIDISample) == 36, "structure size mismatch"); + +}; + + +//-------------------------------------------------------------------------------------- +static const RIFFChunk* FindChunk( _In_reads_bytes_(sizeBytes) const uint8_t* data, _In_ size_t sizeBytes, _In_ uint32_t tag ) +{ + if ( !data ) + return nullptr; + + const uint8_t* ptr = data; + const uint8_t* end = data + sizeBytes; + + while ( end > ( ptr + sizeof(RIFFChunk) ) ) + { + auto header = reinterpret_cast( ptr ); + if ( header->tag == tag ) + return header; + + ptrdiff_t offset = header->size + sizeof(RIFFChunk); + ptr += offset; + } + + return nullptr; +} + + +//-------------------------------------------------------------------------------------- +static HRESULT WaveFindFormatAndData( _In_reads_bytes_(wavDataSize) const uint8_t* wavData, _In_ size_t wavDataSize, + _Outptr_ const WAVEFORMATEX** pwfx, _Outptr_ const uint8_t** pdata, _Out_ uint32_t* dataSize, + _Out_ bool& dpds, _Out_ bool& seek ) +{ + if ( !wavData || !pwfx ) + return E_POINTER; + + dpds = seek = false; + + if (wavDataSize < (sizeof(RIFFChunk)*2 + sizeof(uint32_t) + sizeof(WAVEFORMAT) ) ) + { + return E_FAIL; + } + + const uint8_t* wavEnd = wavData + wavDataSize; + + // Locate RIFF 'WAVE' + auto riffChunk = FindChunk( wavData, wavDataSize, FOURCC_RIFF_TAG ); + if ( !riffChunk || riffChunk->size < 4 ) + { + return E_FAIL; + } + + auto riffHeader = reinterpret_cast( riffChunk ); + if ( riffHeader->riff != FOURCC_WAVE_FILE_TAG && riffHeader->riff != FOURCC_XWMA_FILE_TAG ) + { + return E_FAIL; + } + + // Locate 'fmt ' + auto ptr = reinterpret_cast( riffHeader ) + sizeof(RIFFChunkHeader); + if ( ( ptr + sizeof(RIFFChunk) ) > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + auto fmtChunk = FindChunk( ptr, riffHeader->size, FOURCC_FORMAT_TAG ); + if ( !fmtChunk || fmtChunk->size < sizeof(PCMWAVEFORMAT) ) + { + return E_FAIL; + } + + ptr = reinterpret_cast( fmtChunk ) + sizeof( RIFFChunk ); + if ( ptr + fmtChunk->size > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + auto wf = reinterpret_cast( ptr ); + + // Validate WAVEFORMAT (focused on chunk size and format tag, not other data that XAUDIO2 will validate) + switch( wf->wFormatTag ) + { + case WAVE_FORMAT_PCM: + case WAVE_FORMAT_IEEE_FLOAT: + // Can be a PCMWAVEFORMAT (8 bytes) or WAVEFORMATEX (10 bytes) + // We validiated chunk as at least sizeof(PCMWAVEFORMAT) above + break; + + default: + { + if ( fmtChunk->size < sizeof(WAVEFORMATEX) ) + { + return E_FAIL; + } + + auto wfx = reinterpret_cast( ptr ); + + if ( fmtChunk->size < ( sizeof(WAVEFORMATEX) + wfx->cbSize ) ) + { + return E_FAIL; + } + + switch( wfx->wFormatTag ) + { + case WAVE_FORMAT_WMAUDIO2: + case WAVE_FORMAT_WMAUDIO3: + dpds = true; + break; + + case 0x166 /*WAVE_FORMAT_XMA2*/: // XMA2 is supported by Xbox One + if ( ( fmtChunk->size < 52 /*sizeof(XMA2WAVEFORMATEX)*/ ) || ( wfx->cbSize < 34 /*( sizeof(XMA2WAVEFORMATEX) - sizeof(WAVEFORMATEX) )*/ ) ) + { + return E_FAIL; + } + seek = true; + break; + + case WAVE_FORMAT_ADPCM: + if ( ( fmtChunk->size < ( sizeof(WAVEFORMATEX) + 32 ) ) || ( wfx->cbSize < 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/ ) ) + { + return E_FAIL; + } + break; + + case WAVE_FORMAT_EXTENSIBLE: + if ( ( fmtChunk->size < sizeof(WAVEFORMATEXTENSIBLE) ) || ( wfx->cbSize < ( sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) ) ) ) + { + return E_FAIL; + } + else + { + static const GUID s_wfexBase = {0x00000000, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}; + + auto wfex = reinterpret_cast( ptr ); + + if ( memcmp( reinterpret_cast(&wfex->SubFormat) + sizeof(DWORD), + reinterpret_cast(&s_wfexBase) + sizeof(DWORD), sizeof(GUID) - sizeof(DWORD) ) != 0 ) + { + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + } + + switch( wfex->SubFormat.Data1 ) + { + case WAVE_FORMAT_PCM: + case WAVE_FORMAT_IEEE_FLOAT: + break; + + // MS-ADPCM and XMA2 are not supported as WAVEFORMATEXTENSIBLE + + case WAVE_FORMAT_WMAUDIO2: + case WAVE_FORMAT_WMAUDIO3: + dpds = true; + break; + + default: + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + } + + } + break; + + default: + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + } + } + } + + // Locate 'data' + ptr = reinterpret_cast( riffHeader ) + sizeof(RIFFChunkHeader); + if ( ( ptr + sizeof(RIFFChunk) ) > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + auto dataChunk = FindChunk( ptr, riffChunk->size, FOURCC_DATA_TAG ); + if ( !dataChunk || !dataChunk->size ) + { + return HRESULT_FROM_WIN32( ERROR_INVALID_DATA ); + } + + ptr = reinterpret_cast( dataChunk ) + sizeof( RIFFChunk ); + if ( ptr + dataChunk->size > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + *pwfx = reinterpret_cast( wf ); + *pdata = ptr; + *dataSize = dataChunk->size; + return S_OK; +} + + +//-------------------------------------------------------------------------------------- +static HRESULT WaveFindLoopInfo( _In_reads_bytes_(wavDataSize) const uint8_t* wavData, _In_ size_t wavDataSize, + _Out_ uint32_t* pLoopStart, _Out_ uint32_t* pLoopLength ) +{ + if ( !wavData || !pLoopStart || !pLoopLength ) + return E_POINTER; + + if (wavDataSize < ( sizeof(RIFFChunk) + sizeof(uint32_t) ) ) + { + return E_FAIL; + } + + *pLoopStart = 0; + *pLoopLength = 0; + + const uint8_t* wavEnd = wavData + wavDataSize; + + // Locate RIFF 'WAVE' + auto riffChunk = FindChunk( wavData, wavDataSize, FOURCC_RIFF_TAG ); + if ( !riffChunk || riffChunk->size < 4 ) + { + return E_FAIL; + } + + auto riffHeader = reinterpret_cast( riffChunk ); + if ( riffHeader->riff == FOURCC_XWMA_FILE_TAG ) + { + // xWMA files do not contain loop information + return S_OK; + } + + if ( riffHeader->riff != FOURCC_WAVE_FILE_TAG ) + { + return E_FAIL; + } + + // Locate 'wsmp' (DLS Chunk) + auto ptr = reinterpret_cast( riffHeader ) + sizeof(RIFFChunkHeader); + if ( ( ptr + sizeof(RIFFChunk) ) > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + auto dlsChunk = FindChunk( ptr, riffChunk->size, FOURCC_DLS_SAMPLE ); + if ( dlsChunk ) + { + ptr = reinterpret_cast( dlsChunk ) + sizeof( RIFFChunk ); + if ( ptr + dlsChunk->size > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + if ( dlsChunk->size >= sizeof(RIFFDLSSample) ) + { + auto dlsSample = reinterpret_cast( ptr ); + + if ( dlsChunk->size >= ( dlsSample->size + dlsSample->loopCount * sizeof(DLSLoop) ) ) + { + auto loops = reinterpret_cast( ptr + dlsSample->size ); + for( uint32_t j = 0; j < dlsSample->loopCount; ++j ) + { + if ( ( loops[j].loopType == DLSLoop::LOOP_TYPE_FORWARD || loops[j].loopType == DLSLoop::LOOP_TYPE_RELEASE ) ) + { + // Return 'forward' loop + *pLoopStart = loops[j].loopStart; + *pLoopLength = loops[j].loopLength; + return S_OK; + } + } + } + } + } + + // Locate 'smpl' (Sample Chunk) + auto midiChunk = FindChunk( ptr, riffChunk->size, FOURCC_MIDI_SAMPLE ); + if ( midiChunk ) + { + ptr = reinterpret_cast( midiChunk ) + sizeof( RIFFChunk ); + if ( ptr + midiChunk->size > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + if ( midiChunk->size >= sizeof(RIFFMIDISample) ) + { + auto midiSample = reinterpret_cast( ptr ); + + if ( midiChunk->size >= ( sizeof(RIFFMIDISample) + midiSample->loopCount * sizeof(MIDILoop) ) ) + { + auto loops = reinterpret_cast( ptr + sizeof(RIFFMIDISample) ); + for( uint32_t j = 0; j < midiSample->loopCount; ++j ) + { + if ( loops[j].type == MIDILoop::LOOP_TYPE_FORWARD ) + { + // Return 'forward' loop + *pLoopStart = loops[j].start; + *pLoopLength = loops[j].end + loops[j].start + 1; + return S_OK; + } + } + } + } + } + + return S_OK; +} + + +//-------------------------------------------------------------------------------------- +static HRESULT WaveFindTable( _In_reads_bytes_(wavDataSize) const uint8_t* wavData, _In_ size_t wavDataSize, _In_ uint32_t tag, + _Outptr_result_maybenull_ const uint32_t** pData, _Out_ uint32_t* dataCount ) +{ + if ( !wavData || !pData || !dataCount ) + return E_POINTER; + + if (wavDataSize < ( sizeof(RIFFChunk) + sizeof(uint32_t) ) ) + { + return E_FAIL; + } + + *pData = nullptr; + *dataCount = 0; + + const uint8_t* wavEnd = wavData + wavDataSize; + + // Locate RIFF 'WAVE' + auto riffChunk = FindChunk( wavData, wavDataSize, FOURCC_RIFF_TAG ); + if ( !riffChunk || riffChunk->size < 4 ) + { + return E_FAIL; + } + + auto riffHeader = reinterpret_cast( riffChunk ); + if ( riffHeader->riff != FOURCC_WAVE_FILE_TAG && riffHeader->riff != FOURCC_XWMA_FILE_TAG ) + { + return E_FAIL; + } + + // Locate tag + auto ptr = reinterpret_cast( riffHeader ) + sizeof(RIFFChunkHeader); + if ( ( ptr + sizeof(RIFFChunk) ) > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + auto tableChunk = FindChunk( ptr, riffChunk->size, tag ); + if ( tableChunk ) + { + ptr = reinterpret_cast( tableChunk ) + sizeof( RIFFChunk ); + if ( ptr + tableChunk->size > wavEnd ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + if ( ( tableChunk->size % sizeof(uint32_t) ) != 0 ) + { + return E_FAIL; + } + + *pData = reinterpret_cast( ptr ); + *dataCount = tableChunk->size / 4; + } + + return S_OK; +} + + +//-------------------------------------------------------------------------------------- +static HRESULT LoadAudioFromFile( _In_z_ const wchar_t* szFileName, _Inout_ std::unique_ptr& wavData, _Out_ DWORD* bytesRead ) +{ + if ( !szFileName ) + return E_INVALIDARG; + + // open the file +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + ScopedHandle hFile( safe_handle( CreateFile2( szFileName, + GENERIC_READ, + FILE_SHARE_READ, + OPEN_EXISTING, + nullptr ) ) ); +#else + ScopedHandle hFile( safe_handle( CreateFileW( szFileName, + GENERIC_READ, + FILE_SHARE_READ, + nullptr, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + nullptr ) ) ); +#endif + + if ( !hFile ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + // Get the file size + FILE_STANDARD_INFO fileInfo; + if ( !GetFileInformationByHandleEx( hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo) ) ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + // File is too big for 32-bit allocation, so reject read + if (fileInfo.EndOfFile.HighPart > 0) + { + return E_FAIL; + } + + // Need at least enough data to have a valid minimal WAV file + if (fileInfo.EndOfFile.LowPart < ( sizeof(RIFFChunk)*2 + sizeof(DWORD) + sizeof(WAVEFORMAT) ) ) + { + return E_FAIL; + } + + // create enough space for the file data + wavData.reset( new (std::nothrow) uint8_t[ fileInfo.EndOfFile.LowPart ] ); + if (!wavData) + { + return E_OUTOFMEMORY; + } + + // read the data in + if (!ReadFile( hFile.get(), + wavData.get(), + fileInfo.EndOfFile.LowPart, + bytesRead, + nullptr + )) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + return (*bytesRead < fileInfo.EndOfFile.LowPart) ? E_FAIL : S_OK; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::LoadWAVAudioInMemory( const uint8_t* wavData, + size_t wavDataSize, + const WAVEFORMATEX** wfx, + const uint8_t** startAudio, + uint32_t* audioBytes ) +{ + if ( !wavData || !wfx || !startAudio || !audioBytes ) + return E_INVALIDARG; + + *wfx = nullptr; + *startAudio = nullptr; + *audioBytes = 0; + + // Need at least enough data to have a valid minimal WAV file + if (wavDataSize < (sizeof(RIFFChunk)*2 + sizeof(DWORD) + sizeof(WAVEFORMAT) ) ) + { + return E_FAIL; + } + + bool dpds, seek; + HRESULT hr = WaveFindFormatAndData( wavData, wavDataSize, wfx, startAudio, audioBytes, dpds, seek ); + if ( FAILED(hr) ) + return hr; + + return (dpds || seek) ? E_FAIL : S_OK; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::LoadWAVAudioFromFile( const wchar_t* szFileName, + std::unique_ptr& wavData, + const WAVEFORMATEX** wfx, + const uint8_t** startAudio, + uint32_t* audioBytes ) +{ + if ( !szFileName || !wfx || !startAudio || !audioBytes ) + return E_INVALIDARG; + + *wfx = nullptr; + *startAudio = nullptr; + *audioBytes = 0; + + DWORD bytesRead = 0; + HRESULT hr = LoadAudioFromFile( szFileName, wavData, &bytesRead ); + if ( FAILED(hr) ) + { + return hr; + } + + bool dpds, seek; + hr = WaveFindFormatAndData( wavData.get(), bytesRead, wfx, startAudio, audioBytes, dpds, seek ); + if ( FAILED(hr) ) + return hr; + + return (dpds || seek) ? E_FAIL : S_OK; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::LoadWAVAudioInMemoryEx( const uint8_t* wavData, size_t wavDataSize, DirectX::WAVData& result ) +{ + if ( !wavData ) + return E_INVALIDARG; + + memset( &result, 0, sizeof(result) ); + + // Need at least enough data to have a valid minimal WAV file + if (wavDataSize < (sizeof(RIFFChunk)*2 + sizeof(DWORD) + sizeof(WAVEFORMAT) ) ) + { + return E_FAIL; + } + + bool dpds, seek; + HRESULT hr = WaveFindFormatAndData( wavData, wavDataSize, &result.wfx, &result.startAudio, &result.audioBytes, dpds, seek ); + if ( FAILED(hr) ) + return hr; + + hr = WaveFindLoopInfo( wavData, wavDataSize, &result.loopStart, &result.loopLength ); + if ( FAILED(hr) ) + return hr; + + if ( dpds ) + { + hr = WaveFindTable( wavData, wavDataSize, FOURCC_XWMA_DPDS, &result.seek, &result.seekCount ); + if ( FAILED(hr) ) + return hr; + } + else if ( seek ) + { + hr = WaveFindTable( wavData, wavDataSize, FOURCC_XMA_SEEK, &result.seek, &result.seekCount ); + if ( FAILED(hr) ) + return hr; + } + + return S_OK; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::LoadWAVAudioFromFileEx( const wchar_t* szFileName, std::unique_ptr& wavData, DirectX::WAVData& result ) +{ + if ( !szFileName ) + return E_INVALIDARG; + + memset( &result, 0, sizeof(result) ); + + DWORD bytesRead = 0; + HRESULT hr = LoadAudioFromFile( szFileName, wavData, &bytesRead ); + if ( FAILED(hr) ) + { + return hr; + } + + bool dpds, seek; + hr = WaveFindFormatAndData( wavData.get(), bytesRead, &result.wfx, &result.startAudio, &result.audioBytes, dpds, seek ); + if ( FAILED(hr) ) + return hr; + + hr = WaveFindLoopInfo( wavData.get(), bytesRead, &result.loopStart, &result.loopLength ); + if ( FAILED(hr) ) + return hr; + + if ( dpds ) + { + hr = WaveFindTable( wavData.get(), bytesRead, FOURCC_XWMA_DPDS, &result.seek, &result.seekCount ); + if ( FAILED(hr) ) + return hr; + } + else if ( seek ) + { + hr = WaveFindTable( wavData.get(), bytesRead, FOURCC_XMA_SEEK, &result.seek, &result.seekCount ); + if ( FAILED(hr) ) + return hr; + } + + return S_OK; +} + diff --git a/Kits/DirectXTK12/Audio/WAVFileReader.h b/Kits/DirectXTK12/Audio/WAVFileReader.h new file mode 100644 index 0000000000000000000000000000000000000000..1043ce50cde0e58f5f09148838ff7cfcb90be49e --- /dev/null +++ b/Kits/DirectXTK12/Audio/WAVFileReader.h @@ -0,0 +1,55 @@ +//-------------------------------------------------------------------------------------- +// File: WAVFileReader.h +// +// Functions for loading WAV audio files +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#pragma once + +#include +#include +#include +#include + + +namespace DirectX +{ + HRESULT LoadWAVAudioInMemory( _In_reads_bytes_(wavDataSize) const uint8_t* wavData, + _In_ size_t wavDataSize, + _Outptr_ const WAVEFORMATEX** wfx, + _Outptr_ const uint8_t** startAudio, + _Out_ uint32_t* audioBytes ); + + HRESULT LoadWAVAudioFromFile( _In_z_ const wchar_t* szFileName, + _Inout_ std::unique_ptr& wavData, + _Outptr_ const WAVEFORMATEX** wfx, + _Outptr_ const uint8_t** startAudio, + _Out_ uint32_t* audioBytes ); + + struct WAVData + { + const WAVEFORMATEX* wfx; + const uint8_t* startAudio; + uint32_t audioBytes; + uint32_t loopStart; + uint32_t loopLength; + const uint32_t* seek; // Note: XMA Seek data is Big-Endian + uint32_t seekCount; + }; + + HRESULT LoadWAVAudioInMemoryEx( _In_reads_bytes_(wavDataSize) const uint8_t* wavData, + _In_ size_t wavDataSize, _Out_ WAVData& result ); + + HRESULT LoadWAVAudioFromFileEx( _In_z_ const wchar_t* szFileName, + _Inout_ std::unique_ptr& wavData, + _Out_ WAVData& result ); +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Audio/WaveBank.cpp b/Kits/DirectXTK12/Audio/WaveBank.cpp new file mode 100644 index 0000000000000000000000000000000000000000..644177012052ed147a58389a9a012d382137a9f8 --- /dev/null +++ b/Kits/DirectXTK12/Audio/WaveBank.cpp @@ -0,0 +1,511 @@ +//-------------------------------------------------------------------------------------- +// File: WaveBank.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Audio.h" +#include "WaveBankReader.h" +#include "SoundCommon.h" +#include "PlatformHelpers.h" + +#include + +using namespace DirectX; + + +//====================================================================================== +// WaveBank +//====================================================================================== + +// Internal object implementation class. +class WaveBank::Impl : public IVoiceNotify +{ +public: + explicit Impl( _In_ AudioEngine* engine ) : + mEngine( engine ), + mOneShots( 0 ), + mPrepared( false ), + mStreaming( false ) + { + assert( mEngine != 0 ); + mEngine->RegisterNotify( this, false ); + } + + virtual ~Impl() + { + if ( !mInstances.empty() ) + { + DebugTrace( "WARNING: Destroying WaveBank \"%hs\" with %Iu outstanding SoundEffectInstances\n", mReader.BankName(), mInstances.size() ); + + for( auto it = mInstances.begin(); it != mInstances.end(); ++it ) + { + assert( *it != 0 ); + (*it)->OnDestroyParent(); + } + + mInstances.clear(); + } + + if ( mOneShots > 0 ) + { + DebugTrace( "WARNING: Destroying WaveBank \"%hs\" with %u outstanding one shot effects\n", mReader.BankName(), mOneShots ); + } + + if ( mEngine ) + { + mEngine->UnregisterNotify( this, true, false ); + mEngine = nullptr; + } + } + + HRESULT Initialize( _In_ AudioEngine* engine, _In_z_ const wchar_t* wbFileName ); + + void Play( int index, float volume, float pitch, float pan ); + + // IVoiceNotify + virtual void __cdecl OnBufferEnd() override + { + InterlockedDecrement( &mOneShots ); + } + + virtual void __cdecl OnCriticalError() override + { + mOneShots = 0; + } + + virtual void __cdecl OnReset() override + { + // No action required + } + + virtual void __cdecl OnUpdate() override + { + // We do not register for update notification + assert(false); + } + + virtual void __cdecl OnDestroyEngine() override + { + mEngine = nullptr; + mOneShots = 0; + } + + virtual void __cdecl OnTrim() override + { + // No action required + } + + virtual void __cdecl GatherStatistics( AudioStatistics& stats ) const override + { + stats.playingOneShots += mOneShots; + + if ( !mStreaming ) + { + stats.audioBytes += mReader.BankAudioSize(); + +#if defined(_XBOX_ONE) && defined(_TITLE) + if ( mReader.HasXMA() ) + stats.xmaAudioBytes += mReader.BankAudioSize(); +#endif + } + } + + AudioEngine* mEngine; + std::list mInstances; + WaveBankReader mReader; + uint32_t mOneShots; + bool mPrepared; + bool mStreaming; +}; + + +_Use_decl_annotations_ +HRESULT WaveBank::Impl::Initialize( AudioEngine* engine, const wchar_t* wbFileName ) +{ + if ( !engine || !wbFileName ) + return E_INVALIDARG; + + HRESULT hr = mReader.Open( wbFileName ); + if ( FAILED(hr) ) + return hr; + + mStreaming = mReader.IsStreamingBank(); + + return S_OK; +} + + +void WaveBank::Impl::Play( int index, float volume, float pitch, float pan ) +{ + assert( volume >= -XAUDIO2_MAX_VOLUME_LEVEL && volume <= XAUDIO2_MAX_VOLUME_LEVEL ); + assert( pitch >= -1.f && pitch <= 1.f ); + assert( pan >= -1.f && pan <= 1.f ); + + if ( mStreaming ) + { + DebugTrace( "ERROR: One-shots can only be created from an in-memory wave bank\n"); + throw std::exception( "WaveBank::Play" ); + } + + if ( index < 0 || uint32_t(index) >= mReader.Count() ) + { + DebugTrace( "WARNING: Index %d not found in wave bank with only %u entries, one-shot not triggered\n", index, mReader.Count() ); + return; + } + + if ( !mPrepared ) + { + mReader.WaitOnPrepare(); + mPrepared = true; + } + + char wfxbuff[64]; + auto wfx = reinterpret_cast( wfxbuff ); + HRESULT hr = mReader.GetFormat( index, wfx, 64 ); + ThrowIfFailed( hr ); + + IXAudio2SourceVoice* voice = nullptr; + mEngine->AllocateVoice( wfx, SoundEffectInstance_Default, true, &voice ); + + if ( !voice ) + return; + + if ( volume != 1.f ) + { + hr = voice->SetVolume( volume ); + ThrowIfFailed( hr ); + } + + if ( pitch != 0.f ) + { + float fr = XAudio2SemitonesToFrequencyRatio( pitch * 12.f ); + + hr = voice->SetFrequencyRatio( fr ); + ThrowIfFailed( hr ); + } + + if ( pan != 0.f ) + { + float matrix[16]; + if ( ComputePan( pan, wfx->nChannels, matrix ) ) + { + hr = voice->SetOutputMatrix( nullptr, wfx->nChannels, mEngine->GetOutputChannels(), matrix ); + ThrowIfFailed( hr ); + } + } + + hr = voice->Start( 0 ); + ThrowIfFailed( hr ); + + XAUDIO2_BUFFER buffer = {}; + hr = mReader.GetWaveData( index, &buffer.pAudioData, buffer.AudioBytes ); + ThrowIfFailed( hr ); + + WaveBankReader::Metadata metadata; + hr = mReader.GetMetadata( index, metadata ); + ThrowIfFailed( hr ); + + buffer.Flags = XAUDIO2_END_OF_STREAM; + buffer.pContext = this; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + + XAUDIO2_BUFFER_WMA wmaBuffer = {}; + + uint32_t tag; + hr = mReader.GetSeekTable( index, &wmaBuffer.pDecodedPacketCumulativeBytes, wmaBuffer.PacketCount, tag ); + ThrowIfFailed( hr ); + + if ( tag == WAVE_FORMAT_WMAUDIO2 || tag == WAVE_FORMAT_WMAUDIO3 ) + { + hr = voice->SubmitSourceBuffer( &buffer, &wmaBuffer ); + } + else +#endif + { + hr = voice->SubmitSourceBuffer( &buffer, nullptr ); + } + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: WaveBank failed (%08X) when submitting buffer:\n", hr ); + DebugTrace( "\tFormat Tag %u, %u channels, %u-bit, %u Hz, %u bytes\n", wfx->wFormatTag, + wfx->nChannels, wfx->wBitsPerSample, wfx->nSamplesPerSec, metadata.lengthBytes ); + throw std::exception( "SubmitSourceBuffer" ); + } + + InterlockedIncrement( &mOneShots ); +} + + +//-------------------------------------------------------------------------------------- +// WaveBank +//-------------------------------------------------------------------------------------- + +// Public constructors. +_Use_decl_annotations_ +WaveBank::WaveBank( AudioEngine* engine, const wchar_t* wbFileName ) + : pImpl(new Impl(engine) ) +{ + HRESULT hr = pImpl->Initialize( engine, wbFileName ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: WaveBank failed (%08X) to intialize from .xwb file \"%ls\"\n", hr, wbFileName ); + throw std::exception( "WaveBank" ); + } + + DebugTrace( "INFO: WaveBank \"%hs\" with %u entries loaded from .xwb file \"%ls\"\n", + pImpl->mReader.BankName(), pImpl->mReader.Count(), wbFileName ); +} + + +// Move constructor. +WaveBank::WaveBank(WaveBank&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +WaveBank& WaveBank::operator= (WaveBank&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +WaveBank::~WaveBank() +{ +} + + +// Public methods. +void WaveBank::Play( int index ) +{ + pImpl->Play( index, 1.f, 0.f, 0.f ); +} + + +void WaveBank::Play( int index, float volume, float pitch, float pan ) +{ + pImpl->Play( index, volume, pitch, pan ); +} + + +void WaveBank::Play( _In_z_ const char* name ) +{ + int index = static_cast( pImpl->mReader.Find( name ) ); + if ( index == -1 ) + { + DebugTrace( "WARNING: Name '%hs' not found in wave bank, one-shot not triggered\n", name ); + return; + } + + pImpl->Play( index, 1.f, 0.f, 0.f ); +} + + +void WaveBank::Play( _In_z_ const char* name, float volume, float pitch, float pan ) +{ + int index = static_cast( pImpl->mReader.Find( name ) ); + if ( index == -1 ) + { + DebugTrace( "WARNING: Name '%hs' not found in wave bank, one-shot not triggered\n", name ); + return; + } + + pImpl->Play( index, volume, pitch, pan ); +} + + +std::unique_ptr WaveBank::CreateInstance( int index, SOUND_EFFECT_INSTANCE_FLAGS flags ) +{ + auto& wb = pImpl->mReader; + + if ( pImpl->mStreaming ) + { + DebugTrace( "ERROR: SoundEffectInstances can only be created from an in-memory wave bank\n"); + throw std::exception( "WaveBank::CreateInstance" ); + } + + if ( index < 0 || uint32_t(index) >= wb.Count() ) + { + // We don't throw an exception here as titles often simply ignore missing assets rather than fail + return std::unique_ptr(); + } + + if ( !pImpl->mPrepared ) + { + wb.WaitOnPrepare(); + pImpl->mPrepared = true; + } + + auto effect = new SoundEffectInstance( pImpl->mEngine, this, index, flags ); + assert( effect != 0 ); + pImpl->mInstances.emplace_back( effect ); + return std::unique_ptr( effect ); +} + + +std::unique_ptr WaveBank::CreateInstance( _In_z_ const char* name, SOUND_EFFECT_INSTANCE_FLAGS flags ) +{ + int index = static_cast( pImpl->mReader.Find( name ) ); + if ( index == -1 ) + { + // We don't throw an exception here as titles often simply ignore missing assets rather than fail + return std::unique_ptr(); + } + + return CreateInstance( index, flags ); +} + + +void WaveBank::UnregisterInstance( _In_ SoundEffectInstance* instance ) +{ + auto it = std::find( pImpl->mInstances.begin(), pImpl->mInstances.end(), instance ); + if ( it == pImpl->mInstances.end() ) + return; + + pImpl->mInstances.erase( it ); +} + + +// Public accessors. +bool WaveBank::IsPrepared() const +{ + if ( pImpl->mPrepared ) + return true; + + if ( !pImpl->mReader.IsPrepared() ) + return false; + + pImpl->mPrepared = true; + return true; +} + + +bool WaveBank::IsInUse() const +{ + return ( pImpl->mOneShots > 0 ) || !pImpl->mInstances.empty(); +} + + +bool WaveBank::IsStreamingBank() const +{ + return pImpl->mReader.IsStreamingBank(); +} + + +size_t WaveBank::GetSampleSizeInBytes( int index ) const +{ + if ( index < 0 || uint32_t(index) >= pImpl->mReader.Count() ) + return 0; + + WaveBankReader::Metadata metadata; + HRESULT hr = pImpl->mReader.GetMetadata( index, metadata ); + ThrowIfFailed( hr ); + return metadata.lengthBytes; +} + + +size_t WaveBank::GetSampleDuration( int index ) const +{ + if ( index < 0 || uint32_t(index) >= pImpl->mReader.Count() ) + return 0; + + WaveBankReader::Metadata metadata; + HRESULT hr = pImpl->mReader.GetMetadata( index, metadata ); + ThrowIfFailed( hr ); + return metadata.duration; +} + + +size_t WaveBank::GetSampleDurationMS( int index ) const +{ + if ( index < 0 || uint32_t(index) >= pImpl->mReader.Count() ) + return 0; + + char buff[64]; + auto wfx = reinterpret_cast( buff ); + HRESULT hr = pImpl->mReader.GetFormat( index, wfx, 64 ); + ThrowIfFailed( hr ); + + WaveBankReader::Metadata metadata; + hr = pImpl->mReader.GetMetadata( index, metadata ); + ThrowIfFailed( hr ); + return static_cast( ( uint64_t(metadata.duration) * 1000 ) / wfx->nSamplesPerSec ); +} + + +_Use_decl_annotations_ +const WAVEFORMATEX* WaveBank::GetFormat( int index, WAVEFORMATEX* wfx, size_t maxsize ) const +{ + if ( index < 0 || uint32_t(index) >= pImpl->mReader.Count() ) + return nullptr; + + HRESULT hr = pImpl->mReader.GetFormat( index, wfx, maxsize ); + ThrowIfFailed( hr ); + return wfx; +} + + +_Use_decl_annotations_ +int WaveBank::Find( const char* name ) const +{ + return static_cast( pImpl->mReader.Find( name ) ); +} + + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + +_Use_decl_annotations_ +bool WaveBank::FillSubmitBuffer( int index, XAUDIO2_BUFFER& buffer, XAUDIO2_BUFFER_WMA& wmaBuffer ) const +{ + memset( &buffer, 0, sizeof(buffer) ); + memset( &wmaBuffer, 0, sizeof(wmaBuffer) ); + + HRESULT hr = pImpl->mReader.GetWaveData( index, &buffer.pAudioData, buffer.AudioBytes ); + ThrowIfFailed( hr ); + + WaveBankReader::Metadata metadata; + hr = pImpl->mReader.GetMetadata( index, metadata ); + ThrowIfFailed( hr ); + + buffer.LoopBegin = metadata.loopStart; + buffer.LoopLength = metadata.loopLength; + + uint32_t tag; + hr = pImpl->mReader.GetSeekTable( index, &wmaBuffer.pDecodedPacketCumulativeBytes, wmaBuffer.PacketCount, tag ); + ThrowIfFailed( hr ); + + return ( tag == WAVE_FORMAT_WMAUDIO2 || tag == WAVE_FORMAT_WMAUDIO3 ); +} + +#else + +_Use_decl_annotations_ +void WaveBank::FillSubmitBuffer( int index, XAUDIO2_BUFFER& buffer ) const +{ + memset( &buffer, 0, sizeof(buffer) ); + + HRESULT hr = pImpl->mReader.GetWaveData( index, &buffer.pAudioData, buffer.AudioBytes ); + ThrowIfFailed( hr ); + + WaveBankReader::Metadata metadata; + hr = pImpl->mReader.GetMetadata( index, metadata ); + ThrowIfFailed( hr ); + + buffer.LoopBegin = metadata.loopStart; + buffer.LoopLength = metadata.loopLength; +} + +#endif diff --git a/Kits/DirectXTK12/Audio/WaveBankReader.cpp b/Kits/DirectXTK12/Audio/WaveBankReader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..924325c746f342a5dbf1e63e0938f3d5b22daea4 --- /dev/null +++ b/Kits/DirectXTK12/Audio/WaveBankReader.cpp @@ -0,0 +1,1376 @@ +//-------------------------------------------------------------------------------------- +// File: WaveBankReader.cpp +// +// Functions for loading audio data from Wave Banks +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#include "pch.h" +#include "WaveBankReader.h" +#include "Audio.h" +#include "PlatformHelpers.h" + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#endif + + +namespace +{ + +//-------------------------------------------------------------------------------------- +#pragma pack(push, 1) + +static const size_t DVD_SECTOR_SIZE = 2048; +static const size_t DVD_BLOCK_SIZE = DVD_SECTOR_SIZE * 16; + +static const size_t ALIGNMENT_MIN = 4; +static const size_t ALIGNMENT_DVD = DVD_SECTOR_SIZE; + +static const size_t MAX_DATA_SEGMENT_SIZE = 0xFFFFFFFF; +static const size_t MAX_COMPACT_DATA_SEGMENT_SIZE = 0x001FFFFF; + +struct REGION +{ + uint32_t dwOffset; // Region offset, in bytes. + uint32_t dwLength; // Region length, in bytes. + + void BigEndian() + { + dwOffset = _byteswap_ulong( dwOffset ); + dwLength = _byteswap_ulong( dwLength ); + } +}; + +struct SAMPLEREGION +{ + uint32_t dwStartSample; // Start sample for the region. + uint32_t dwTotalSamples; // Region length in samples. + + void BigEndian() + { + dwStartSample = _byteswap_ulong( dwStartSample ); + dwTotalSamples = _byteswap_ulong( dwTotalSamples ); + } +}; + +struct HEADER +{ + static const uint32_t SIGNATURE = 'DNBW'; + static const uint32_t BE_SIGNATURE = 'WBND'; + static const uint32_t VERSION = 44; + + enum SEGIDX + { + SEGIDX_BANKDATA = 0, // Bank data + SEGIDX_ENTRYMETADATA, // Entry meta-data + SEGIDX_SEEKTABLES, // Storage for seek tables for the encoded waves. + SEGIDX_ENTRYNAMES, // Entry friendly names + SEGIDX_ENTRYWAVEDATA, // Entry wave data + SEGIDX_COUNT + }; + + uint32_t dwSignature; // File signature + uint32_t dwVersion; // Version of the tool that created the file + uint32_t dwHeaderVersion; // Version of the file format + REGION Segments[SEGIDX_COUNT]; // Segment lookup table + + void BigEndian() + { + // Leave dwSignature alone as indicator of BE vs. LE + + dwVersion = _byteswap_ulong( dwVersion ); + dwHeaderVersion =_byteswap_ulong( dwHeaderVersion ); + for( size_t j = 0; j < SEGIDX_COUNT; ++j ) + { + Segments[j].BigEndian(); + } + } +}; + +#pragma warning( disable : 4201 4203 ) + +union MINIWAVEFORMAT +{ + static const uint32_t TAG_PCM = 0x0; + static const uint32_t TAG_XMA = 0x1; + static const uint32_t TAG_ADPCM = 0x2; + static const uint32_t TAG_WMA = 0x3; + + static const uint32_t BITDEPTH_8 = 0x0; // PCM only + static const uint32_t BITDEPTH_16 = 0x1; // PCM only + + static const size_t ADPCM_BLOCKALIGN_CONVERSION_OFFSET = 22; + + struct + { + uint32_t wFormatTag : 2; // Format tag + uint32_t nChannels : 3; // Channel count (1 - 6) + uint32_t nSamplesPerSec : 18; // Sampling rate + uint32_t wBlockAlign : 8; // Block alignment. For WMA, lower 6 bits block alignment index, upper 2 bits bytes-per-second index. + uint32_t wBitsPerSample : 1; // Bits per sample (8 vs. 16, PCM only); WMAudio2/WMAudio3 (for WMA) + }; + + uint32_t dwValue; + + void BigEndian() + { + dwValue = _byteswap_ulong( dwValue ); + } + + WORD BitsPerSample() const + { + if (wFormatTag == TAG_XMA) + return 16; // XMA_OUTPUT_SAMPLE_BITS == 16 + if (wFormatTag == TAG_WMA) + return 16; + if (wFormatTag == TAG_ADPCM) + return 4; // MSADPCM_BITS_PER_SAMPLE == 4 + + // wFormatTag must be TAG_PCM (2 bits can only represent 4 different values) + return (wBitsPerSample == BITDEPTH_16) ? 16 : 8; + } + + DWORD BlockAlign() const + { + switch (wFormatTag) + { + case TAG_PCM: + return wBlockAlign; + + case TAG_XMA: + return (nChannels * 16 / 8); // XMA_OUTPUT_SAMPLE_BITS = 16 + + case TAG_ADPCM: + return (wBlockAlign + ADPCM_BLOCKALIGN_CONVERSION_OFFSET) * nChannels; + + case TAG_WMA: + { + static const uint32_t aWMABlockAlign[] = + { + 929, + 1487, + 1280, + 2230, + 8917, + 8192, + 4459, + 5945, + 2304, + 1536, + 1485, + 1008, + 2731, + 4096, + 6827, + 5462, + 1280 + }; + + uint32_t dwBlockAlignIndex = wBlockAlign & 0x1F; + if ( dwBlockAlignIndex < _countof(aWMABlockAlign) ) + return aWMABlockAlign[dwBlockAlignIndex]; + } + break; + } + + return 0; + } + + DWORD AvgBytesPerSec() const + { + switch (wFormatTag) + { + case TAG_PCM: + return nSamplesPerSec * wBlockAlign; + + case TAG_XMA: + return nSamplesPerSec * BlockAlign(); + + case TAG_ADPCM: + { + uint32_t blockAlign = BlockAlign(); + uint32_t samplesPerAdpcmBlock = AdpcmSamplesPerBlock(); + return blockAlign * nSamplesPerSec / samplesPerAdpcmBlock; + } + break; + + case TAG_WMA: + { + static const uint32_t aWMAAvgBytesPerSec[] = + { + 12000, + 24000, + 4000, + 6000, + 8000, + 20000, + 2500 + }; + // bitrate = entry * 8 + + uint32_t dwBytesPerSecIndex = wBlockAlign >> 5; + if ( dwBytesPerSecIndex < _countof(aWMAAvgBytesPerSec) ) + return aWMAAvgBytesPerSec[dwBytesPerSecIndex]; + } + break; + } + + return 0; + } + + DWORD AdpcmSamplesPerBlock() const + { + uint32_t nBlockAlign = (wBlockAlign + ADPCM_BLOCKALIGN_CONVERSION_OFFSET) * nChannels; + return nBlockAlign * 2 / (uint32_t)nChannels - 12; + } + + void AdpcmFillCoefficientTable(ADPCMWAVEFORMAT *fmt) const + { + // These are fixed since we are always using MS ADPCM + fmt->wNumCoef = 7 /* MSADPCM_NUM_COEFFICIENTS */; + + static ADPCMCOEFSET aCoef[7] = { { 256, 0}, {512, -256}, {0,0}, {192,64}, {240,0}, {460, -208}, {392,-232} }; + memcpy( &fmt->aCoef, aCoef, sizeof(aCoef) ); + } +}; + +struct BANKDATA +{ + static const size_t BANKNAME_LENGTH = 64; + + static const uint32_t TYPE_BUFFER = 0x00000000; + static const uint32_t TYPE_STREAMING = 0x00000001; + static const uint32_t TYPE_MASK = 0x00000001; + + static const uint32_t FLAGS_ENTRYNAMES = 0x00010000; + static const uint32_t FLAGS_COMPACT = 0x00020000; + static const uint32_t FLAGS_SYNC_DISABLED = 0x00040000; + static const uint32_t FLAGS_SEEKTABLES = 0x00080000; + static const uint32_t FLAGS_MASK = 0x000F0000; + + uint32_t dwFlags; // Bank flags + uint32_t dwEntryCount; // Number of entries in the bank + char szBankName[BANKNAME_LENGTH]; // Bank friendly name + uint32_t dwEntryMetaDataElementSize; // Size of each entry meta-data element, in bytes + uint32_t dwEntryNameElementSize; // Size of each entry name element, in bytes + uint32_t dwAlignment; // Entry alignment, in bytes + MINIWAVEFORMAT CompactFormat; // Format data for compact bank + FILETIME BuildTime; // Build timestamp + + void BigEndian() + { + dwFlags = _byteswap_ulong( dwFlags ); + dwEntryCount = _byteswap_ulong( dwEntryCount ); + dwEntryMetaDataElementSize = _byteswap_ulong( dwEntryMetaDataElementSize ); + dwEntryNameElementSize = _byteswap_ulong( dwEntryNameElementSize ); + dwAlignment = _byteswap_ulong( dwAlignment ); + CompactFormat.BigEndian(); + BuildTime.dwLowDateTime = _byteswap_ulong( BuildTime.dwLowDateTime ); + BuildTime.dwHighDateTime = _byteswap_ulong( BuildTime.dwHighDateTime ); + } +}; + +struct ENTRY +{ + static const uint32_t FLAGS_READAHEAD = 0x00000001; // Enable stream read-ahead + static const uint32_t FLAGS_LOOPCACHE = 0x00000002; // One or more looping sounds use this wave + static const uint32_t FLAGS_REMOVELOOPTAIL = 0x00000004;// Remove data after the end of the loop region + static const uint32_t FLAGS_IGNORELOOP = 0x00000008; // Used internally when the loop region can't be used + static const uint32_t FLAGS_MASK = 0x00000008; + + union + { + struct + { + // Entry flags + uint32_t dwFlags : 4; + + // Duration of the wave, in units of one sample. + // For instance, a ten second long wave sampled + // at 48KHz would have a duration of 480,000. + // This value is not affected by the number of + // channels, the number of bits per sample, or the + // compression format of the wave. + uint32_t Duration : 28; + }; + uint32_t dwFlagsAndDuration; + }; + + MINIWAVEFORMAT Format; // Entry format. + REGION PlayRegion; // Region within the wave data segment that contains this entry. + SAMPLEREGION LoopRegion; // Region within the wave data (in samples) that should loop. + + void BigEndian() + { + dwFlagsAndDuration = _byteswap_ulong( dwFlagsAndDuration ); + Format.BigEndian(); + PlayRegion.BigEndian(); + LoopRegion.BigEndian(); + } +}; + +struct ENTRYCOMPACT +{ + uint32_t dwOffset : 21; // Data offset, in multiplies of the bank alignment + uint32_t dwLengthDeviation : 11; // Data length deviation, in bytes + + void BigEndian() + { + *reinterpret_cast( this ) = _byteswap_ulong( *reinterpret_cast( this ) ); + } + + void ComputeLocations( DWORD& offset, DWORD& length, uint32_t index, const HEADER& header, const BANKDATA& data, const ENTRYCOMPACT* entries ) const + { + offset = dwOffset * data.dwAlignment; + + if ( index < ( data.dwEntryCount - 1 ) ) + { + length = ( entries[index + 1].dwOffset * data.dwAlignment ) - offset - dwLengthDeviation; + } + else + { + length = header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwLength - offset - dwLengthDeviation; + } + } + + static uint32_t GetDuration( DWORD length, const BANKDATA& data, const uint32_t* seekTable ) + { + switch( data.CompactFormat.wFormatTag ) + { + case MINIWAVEFORMAT::TAG_ADPCM: + { + uint32_t duration = ( length / data.CompactFormat.BlockAlign() ) * data.CompactFormat.AdpcmSamplesPerBlock(); + uint32_t partial = length % data.CompactFormat.BlockAlign(); + if ( partial ) + { + if ( partial >= ( 7 * data.CompactFormat.nChannels ) ) + duration += ( partial * 2 / data.CompactFormat.nChannels - 12 ); + } + return duration; + } + + case MINIWAVEFORMAT::TAG_WMA: + if ( seekTable ) + { + uint32_t seekCount = *seekTable; + if ( seekCount > 0 ) + { + return seekTable[ seekCount ] / uint32_t( 2 * data.CompactFormat.nChannels ); + } + } + return 0; + + case MINIWAVEFORMAT::TAG_XMA: + if ( seekTable ) + { + uint32_t seekCount = *seekTable; + if ( seekCount > 0 ) + { + return seekTable[ seekCount ]; + } + } + return 0; + + default: + return uint32_t( ( uint64_t( length ) * 8 ) + / uint64_t( data.CompactFormat.BitsPerSample() * data.CompactFormat.nChannels ) ); + } + } +}; + +#pragma pack(pop) + +inline const uint32_t* FindSeekTable( uint32_t index, const uint8_t* seekTable, const HEADER& header, const BANKDATA& data ) +{ + if ( !seekTable || index >= data.dwEntryCount ) + return nullptr; + + uint32_t seekSize = header.Segments[HEADER::SEGIDX_SEEKTABLES].dwLength; + + if ( ( index * sizeof(uint32_t) ) > seekSize ) + return nullptr; + + auto table = reinterpret_cast( seekTable ); + uint32_t offset = table[ index ]; + if ( offset == uint32_t(-1) ) + return nullptr; + + offset += sizeof(uint32_t) * data.dwEntryCount; + + if ( offset > seekSize ) + return nullptr; + + return reinterpret_cast( seekTable + offset ); +} + +}; + +static_assert( sizeof(REGION)==8, "Mismatch with xact3wb.h" ); +static_assert( sizeof(SAMPLEREGION)==8, "Mismatch with xact3wb.h" ); +static_assert( sizeof(HEADER)==52, "Mismatch with xact3wb.h" ); +static_assert( sizeof(ENTRY)==24, "Mismatch with xact3wb.h" ); +static_assert( sizeof(MINIWAVEFORMAT)==4, "Mismatch with xact3wb.h" ); +static_assert( sizeof(ENTRY)==24, "Mismatch with xact3wb.h" ); +static_assert( sizeof(ENTRYCOMPACT)==4, "Mismatch with xact3wb.h" ); +static_assert( sizeof(BANKDATA)==96, "Mismatch with xact3wb.h" ); + +using namespace DirectX; + +//-------------------------------------------------------------------------------------- +class WaveBankReader::Impl +{ +public: + Impl() : + m_async( INVALID_HANDLE_VALUE ), + m_prepared(false) +#if defined(_XBOX_ONE) && defined(_TITLE) + , m_xmaMemory(nullptr) +#endif + { + memset( &m_header, 0, sizeof(HEADER) ); + memset( &m_data, 0, sizeof(BANKDATA) ); + memset( &m_request, 0, sizeof(OVERLAPPED) ); + } + + ~Impl() { Close(); } + + HRESULT Open( _In_z_ const wchar_t* szFileName ); + void Close(); + + HRESULT GetFormat( _In_ uint32_t index, _Out_writes_bytes_(maxsize) WAVEFORMATEX* pFormat, _In_ size_t maxsize ) const; + + HRESULT GetWaveData( _In_ uint32_t index, _Outptr_ const uint8_t** pData, _Out_ uint32_t& dataSize ) const; + + HRESULT GetSeekTable( _In_ uint32_t index, _Out_ const uint32_t** pData, _Out_ uint32_t& dataCount, _Out_ uint32_t& tag ) const; + + HRESULT GetMetadata( _In_ uint32_t index, _Out_ Metadata& metadata ) const; + + bool UpdatePrepared(); + + void Clear() + { + memset( &m_header, 0, sizeof(HEADER) ); + memset( &m_data, 0, sizeof(BANKDATA ) ); + + m_names.clear(); + m_entries.reset(); + m_seekData.reset(); + m_waveData.reset(); + +#if defined(_XBOX_ONE) && defined(_TITLE) + if ( m_xmaMemory ) + { + ApuFree( m_xmaMemory ); + m_xmaMemory = nullptr; + } +#endif + } + + HANDLE m_async; + ScopedHandle m_event; + OVERLAPPED m_request; + bool m_prepared; + + HEADER m_header; + BANKDATA m_data; + std::map m_names; + +private: + std::unique_ptr m_entries; + std::unique_ptr m_seekData; + std::unique_ptr m_waveData; + +#if defined(_XBOX_ONE) && defined(_TITLE) +public: + void* m_xmaMemory; +#endif +}; + + +_Use_decl_annotations_ +HRESULT WaveBankReader::Impl::Open( const wchar_t* szFileName ) +{ + Close(); + Clear(); + + m_prepared = false; + + m_event.reset( CreateEventEx( nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_MODIFY_STATE | SYNCHRONIZE ) ); + if ( !m_event ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + CREATEFILE2_EXTENDED_PARAMETERS params = { sizeof(CREATEFILE2_EXTENDED_PARAMETERS), 0 }; + params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; + params.dwFileFlags = FILE_FLAG_OVERLAPPED | FILE_FLAG_SEQUENTIAL_SCAN; + ScopedHandle hFile( safe_handle( CreateFile2( szFileName, + GENERIC_READ, + FILE_SHARE_READ, + OPEN_EXISTING, + ¶ms ) ) ); +#else + ScopedHandle hFile( safe_handle( CreateFileW( szFileName, + GENERIC_READ, + FILE_SHARE_READ, + nullptr, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED | FILE_FLAG_SEQUENTIAL_SCAN, + nullptr ) ) ); +#endif + + if ( !hFile ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + // Read and verify header + OVERLAPPED request = {}; + request.hEvent = m_event.get(); + + bool wait = false; + if( !ReadFile( hFile.get(), &m_header, sizeof( m_header ), nullptr, &request ) ) + { + DWORD error = GetLastError(); + if ( error != ERROR_IO_PENDING ) + return HRESULT_FROM_WIN32( error ); + wait = true; + } + + DWORD bytes; +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + BOOL result = GetOverlappedResultEx( hFile.get(), &request, &bytes, INFINITE, FALSE ); +#else + if ( wait ) + (void)WaitForSingleObject( m_event.get(), INFINITE ); + + BOOL result = GetOverlappedResult( hFile.get(), &request, &bytes, FALSE ); +#endif + + if ( !result || ( bytes != sizeof( m_header ) ) ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + if ( m_header.dwSignature != HEADER::SIGNATURE && m_header.dwSignature != HEADER::BE_SIGNATURE ) + { + return E_FAIL; + } + + bool be = ( m_header.dwSignature == HEADER::BE_SIGNATURE ); + if ( be ) + { + DebugTrace( "INFO: \"%ls\" is a big-endian (Xbox 360) wave bank\n", szFileName ); + m_header.BigEndian(); + } + + if ( m_header.dwHeaderVersion != HEADER::VERSION ) + { + return E_FAIL; + } + + // Load bank data + memset( &request, 0, sizeof(request) ); + request.Offset = m_header.Segments[HEADER::SEGIDX_BANKDATA].dwOffset; + request.hEvent = m_event.get(); + + wait = false; + if( !ReadFile( hFile.get(), &m_data, sizeof( m_data ), nullptr, &request ) ) + { + DWORD error = GetLastError(); + if ( error != ERROR_IO_PENDING ) + return HRESULT_FROM_WIN32( error ); + wait = true; + } + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + result = GetOverlappedResultEx( hFile.get(), &request, &bytes, INFINITE, FALSE ); +#else + if ( wait ) + (void)WaitForSingleObject( m_event.get(), INFINITE ); + + result = GetOverlappedResult( hFile.get(), &request, &bytes, FALSE ); +#endif + + if ( !result || ( bytes != sizeof( m_data ) ) ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + if ( be ) + m_data.BigEndian(); + + if ( !m_data.dwEntryCount ) + { + return HRESULT_FROM_WIN32( ERROR_NO_DATA ); + } + + if ( m_data.dwFlags & BANKDATA::TYPE_STREAMING ) + { + if ( m_data.dwAlignment < ALIGNMENT_DVD ) + return E_FAIL; + if ( m_data.dwAlignment % DVD_SECTOR_SIZE ) + return E_FAIL; + } + else if ( m_data.dwAlignment < ALIGNMENT_MIN ) + { + return E_FAIL; + } + + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + if ( m_data.dwEntryMetaDataElementSize != sizeof(ENTRYCOMPACT) ) + { + return E_FAIL; + } + + if ( m_header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwLength > ( MAX_COMPACT_DATA_SEGMENT_SIZE * m_data.dwAlignment ) ) + { + // Data segment is too large to be valid compact wavebank + return E_FAIL; + } + } + else + { + if ( m_data.dwEntryMetaDataElementSize != sizeof(ENTRY) ) + { + return E_FAIL; + } + } + + DWORD metadataBytes = m_header.Segments[HEADER::SEGIDX_ENTRYMETADATA].dwLength; + if ( metadataBytes != ( m_data.dwEntryCount * m_data.dwEntryMetaDataElementSize ) ) + { + return E_FAIL; + } + + // Load names + DWORD namesBytes = m_header.Segments[HEADER::SEGIDX_ENTRYNAMES].dwLength; + if ( namesBytes > 0 ) + { + if ( namesBytes >= ( m_data.dwEntryNameElementSize * m_data.dwEntryCount ) ) + { + std::unique_ptr temp( new (std::nothrow) char[ namesBytes ] ); + if ( !temp ) + return E_OUTOFMEMORY; + + memset( &request, 0, sizeof(request) ); + request.Offset = m_header.Segments[HEADER::SEGIDX_ENTRYNAMES].dwOffset; + request.hEvent = m_event.get(); + + wait = false; + if ( !ReadFile( hFile.get(), temp.get(), namesBytes, nullptr, &request ) ) + { + DWORD error = GetLastError(); + if ( error != ERROR_IO_PENDING ) + return HRESULT_FROM_WIN32( error ); + wait = true; + } + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + result = GetOverlappedResultEx( hFile.get(), &request, &bytes, INFINITE, FALSE ); +#else + if ( wait ) + (void)WaitForSingleObject( m_event.get(), INFINITE ); + + result = GetOverlappedResult( hFile.get(), &request, &bytes, FALSE ); +#endif + + if ( !result || ( namesBytes != bytes ) ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + for( uint32_t j = 0; j < m_data.dwEntryCount; ++j ) + { + DWORD n = m_data.dwEntryNameElementSize * j; + + char name[ 64 ] = {}; + strncpy_s( name, &temp[ n ], 64 ); + + m_names[ name ] = j; + } + } + } + + // Load entries + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + m_entries.reset( reinterpret_cast( new (std::nothrow) ENTRYCOMPACT[ m_data.dwEntryCount ] ) ); + } + else + { + m_entries.reset( reinterpret_cast( new (std::nothrow) ENTRY[ m_data.dwEntryCount ] ) ); + } + if ( !m_entries ) + return E_OUTOFMEMORY; + + memset( &request, 0, sizeof(request) ); + request.Offset = m_header.Segments[HEADER::SEGIDX_ENTRYMETADATA].dwOffset; + request.hEvent = m_event.get(); + + wait = false; + if ( !ReadFile( hFile.get(), m_entries.get(), metadataBytes, nullptr, &request ) ) + { + DWORD error = GetLastError(); + if ( error != ERROR_IO_PENDING ) + return HRESULT_FROM_WIN32( error ); + wait = true; + } + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + result = GetOverlappedResultEx( hFile.get(), &request, &bytes, INFINITE, FALSE ); +#else + if ( wait ) + (void)WaitForSingleObject( m_event.get(), INFINITE ); + + result = GetOverlappedResult( hFile.get(), &request, &bytes, FALSE ); +#endif + + if ( !result || ( metadataBytes != bytes ) ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + if ( be ) + { + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + auto ptr = reinterpret_cast( m_entries.get() ); + for( size_t j = 0; j < m_data.dwEntryCount; ++j, ++ptr ) + ptr->BigEndian(); + } + else + { + auto ptr = reinterpret_cast( m_entries.get() ); + for( size_t j = 0; j < m_data.dwEntryCount; ++j, ++ptr ) + ptr->BigEndian(); + } + } + + // Load seek tables (XMA2 / xWMA) + DWORD seekLen = m_header.Segments[HEADER::SEGIDX_SEEKTABLES].dwLength; + if ( seekLen > 0 ) + { + m_seekData.reset( new (std::nothrow) uint8_t[ seekLen ] ); + if ( !m_seekData ) + return E_OUTOFMEMORY; + + memset( &request, 0, sizeof(OVERLAPPED) ); + request.Offset = m_header.Segments[HEADER::SEGIDX_SEEKTABLES].dwOffset; + request.hEvent = m_event.get(); + + wait = false; + if ( !ReadFile( hFile.get(), m_seekData.get(), seekLen, nullptr, &request ) ) + { + DWORD error = GetLastError(); + if ( error != ERROR_IO_PENDING ) + return HRESULT_FROM_WIN32( error ); + wait = true; + } + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + result = GetOverlappedResultEx( hFile.get(), &request, &bytes, INFINITE, FALSE ); +#else + if ( wait ) + (void)WaitForSingleObject( m_event.get(), INFINITE ); + + result = GetOverlappedResult( hFile.get(), &request, &bytes, FALSE ); +#endif + + if ( !result || ( seekLen != bytes ) ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + if ( be ) + { + auto ptr = reinterpret_cast( m_seekData.get() ); + for( size_t j = 0; j < seekLen; j += 4, ++ptr ) + { + *ptr = _byteswap_ulong( *ptr ); + } + } + } + + DWORD waveLen = m_header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwLength; + if ( !waveLen ) + { + return HRESULT_FROM_WIN32( ERROR_NO_DATA ); + } + + if ( m_data.dwFlags & BANKDATA::TYPE_STREAMING ) + { + // If streaming, reopen without buffering + hFile.reset(); + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + CREATEFILE2_EXTENDED_PARAMETERS params2 = { sizeof(CREATEFILE2_EXTENDED_PARAMETERS), 0 }; + params2.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; + params2.dwFileFlags = FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING; + m_async = CreateFile2( szFileName, + GENERIC_READ, + FILE_SHARE_READ, + OPEN_EXISTING, + ¶ms2 ); +#else + m_async = CreateFileW( szFileName, + GENERIC_READ, + FILE_SHARE_READ, + nullptr, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, + nullptr ); +#endif + + if ( m_async == INVALID_HANDLE_VALUE ) + { + return HRESULT_FROM_WIN32( GetLastError() ); + } + + m_prepared = true; + } + else + { + // If in-memory, kick off read of wave data + void *dest; + +#if defined(_XBOX_ONE) && defined(_TITLE) + bool xma = false; + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + if ( m_data.CompactFormat.wFormatTag == MINIWAVEFORMAT::TAG_XMA ) + xma = true; + } + else + { + for( uint32_t j = 0; j < m_data.dwEntryCount; ++j ) + { + auto& entry = reinterpret_cast( m_entries.get() )[ j ]; + if ( entry.Format.wFormatTag == MINIWAVEFORMAT::TAG_XMA ) + { + xma = true; + break; + } + } + } + + if ( xma ) + { + HRESULT hr = ApuAlloc( &m_xmaMemory, nullptr, waveLen, SHAPE_XMA_INPUT_BUFFER_ALIGNMENT ); + if ( FAILED(hr) ) + { + DebugTrace( "ERROR: ApuAlloc failed. Did you allocate a large enough heap with ApuCreateHeap for all your XMA wave data?\n" ); + return hr; + } + + dest = m_xmaMemory; + } + else +#endif // _XBOX_ONE && _TITLE + { + m_waveData.reset( new (std::nothrow) uint8_t[ waveLen ] ); + if ( !m_waveData ) + return E_OUTOFMEMORY; + + dest = m_waveData.get(); + } + + memset( &m_request, 0, sizeof(OVERLAPPED) ); + m_request.Offset = m_header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwOffset; + m_request.hEvent = m_event.get(); + + if ( !ReadFile( hFile.get(), dest, waveLen, nullptr, &m_request ) ) + { + DWORD error = GetLastError(); + if ( error != ERROR_IO_PENDING ) + return HRESULT_FROM_WIN32( error ); + } + else + { + m_prepared = true; + memset( &m_request, 0, sizeof(OVERLAPPED) ); + } + + m_async = hFile.release(); + } + + return S_OK; +} + + +void WaveBankReader::Impl::Close() +{ + if ( m_async != INVALID_HANDLE_VALUE ) + { + if ( m_request.hEvent != 0 ) + { + DWORD bytes; +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + (void)GetOverlappedResultEx( m_async, &m_request, &bytes, INFINITE, FALSE ); +#else + (void)WaitForSingleObject( m_request.hEvent, INFINITE ); + + (void)GetOverlappedResult( m_async, &m_request, &bytes, FALSE ); +#endif + } + + CloseHandle( m_async ); + m_async = INVALID_HANDLE_VALUE; + } + m_event.reset(); + +#if defined(_XBOX_ONE) && defined(_TITLE) + if ( m_xmaMemory ) + { + ApuFree( m_xmaMemory ); + m_xmaMemory = nullptr; + } +#endif +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::Impl::GetFormat( uint32_t index, WAVEFORMATEX* pFormat, size_t maxsize ) const +{ + if ( !pFormat || !maxsize ) + return E_INVALIDARG; + + if ( index >= m_data.dwEntryCount || !m_entries ) + { + return E_FAIL; + } + + auto& miniFmt = ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) ? m_data.CompactFormat : ( reinterpret_cast( m_entries.get() )[ index ].Format ); + + switch( miniFmt.wFormatTag ) + { + case MINIWAVEFORMAT::TAG_PCM: + if ( maxsize < sizeof(PCMWAVEFORMAT) ) + return HRESULT_FROM_WIN32( ERROR_MORE_DATA ); + + pFormat->wFormatTag = WAVE_FORMAT_PCM; + + if ( maxsize >= sizeof(WAVEFORMATEX) ) + { + pFormat->cbSize = 0; + } + break; + + case MINIWAVEFORMAT::TAG_ADPCM: + if ( maxsize < ( sizeof(WAVEFORMATEX) + 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/ ) ) + return HRESULT_FROM_WIN32( ERROR_MORE_DATA ); + + pFormat->wFormatTag = WAVE_FORMAT_ADPCM; + pFormat->cbSize = 32 /*MSADPCM_FORMAT_EXTRA_BYTES*/; + { + auto adpcmFmt = reinterpret_cast(pFormat); + adpcmFmt->wSamplesPerBlock = (WORD) miniFmt.AdpcmSamplesPerBlock(); + miniFmt.AdpcmFillCoefficientTable( adpcmFmt ); + } + break; + + case MINIWAVEFORMAT::TAG_WMA: + if ( maxsize < sizeof(WAVEFORMATEX) ) + return HRESULT_FROM_WIN32( ERROR_MORE_DATA ); + + pFormat->wFormatTag = (miniFmt.wBitsPerSample & 0x1) ? WAVE_FORMAT_WMAUDIO3 : WAVE_FORMAT_WMAUDIO2; + pFormat->cbSize = 0; + break; + + case MINIWAVEFORMAT::TAG_XMA: // XMA2 is supported by Xbox One +#if defined(_XBOX_ONE) && defined(_TITLE) + if ( maxsize < sizeof(XMA2WAVEFORMATEX) ) + return HRESULT_FROM_WIN32( ERROR_MORE_DATA ); + + pFormat->wFormatTag = WAVE_FORMAT_XMA2; + pFormat->cbSize = sizeof(XMA2WAVEFORMATEX) - sizeof(WAVEFORMATEX); + { + auto xmaFmt = reinterpret_cast(pFormat); + + xmaFmt->NumStreams = static_cast( (miniFmt.nChannels + 1) / 2 ); + xmaFmt->BytesPerBlock = 65536 /* XACT_FIXED_XMA_BLOCK_SIZE */; + xmaFmt->EncoderVersion = 4 /* XMAENCODER_VERSION_XMA2 */; + + auto seekTable = FindSeekTable( index, m_seekData.get(), m_header, m_data ); + if ( seekTable ) + { + xmaFmt->BlockCount = static_cast( *seekTable ); + } + else + { + xmaFmt->BlockCount = 0; + } + + switch( miniFmt.nChannels ) + { + case 1: xmaFmt->ChannelMask = SPEAKER_MONO; break; + case 2: xmaFmt->ChannelMask = SPEAKER_STEREO; break; + case 3: xmaFmt->ChannelMask = SPEAKER_2POINT1; break; + case 4: xmaFmt->ChannelMask = SPEAKER_QUAD; break; + case 5: xmaFmt->ChannelMask = SPEAKER_4POINT1; break; + case 6: xmaFmt->ChannelMask = SPEAKER_5POINT1; break; + case 7: xmaFmt->ChannelMask = SPEAKER_5POINT1 | SPEAKER_BACK_CENTER; break; + case 8: xmaFmt->ChannelMask = SPEAKER_7POINT1; break; + default: xmaFmt->ChannelMask = DWORD(-1); break; + } + + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + auto& entry = reinterpret_cast( m_entries.get() )[ index ]; + + DWORD dwOffset, dwLength; + entry.ComputeLocations( dwOffset, dwLength, index, m_header, m_data, reinterpret_cast( m_entries.get() ) ); + + xmaFmt->SamplesEncoded = entry.GetDuration( dwLength, m_data, seekTable ); + + xmaFmt->PlayBegin = xmaFmt->PlayLength = + xmaFmt->LoopBegin = xmaFmt->LoopLength = xmaFmt->LoopCount = 0; + } + else + { + auto& entry = reinterpret_cast( m_entries.get() )[ index ]; + + xmaFmt->SamplesEncoded = entry.Duration; + xmaFmt->PlayBegin = 0; + xmaFmt->PlayLength = entry.PlayRegion.dwLength; + + if ( entry.LoopRegion.dwTotalSamples > 0 ) + { + xmaFmt->LoopBegin = entry.LoopRegion.dwStartSample; + xmaFmt->LoopLength = entry.LoopRegion.dwTotalSamples; + xmaFmt->LoopCount = 0xff /* XACTLOOPCOUNT_INFINITE */; + } + else + { + xmaFmt->LoopBegin = xmaFmt->LoopLength = xmaFmt->LoopCount = 0; + } + } + } + break; +#else + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); +#endif + + default: + return E_FAIL; + } + + pFormat->nChannels = miniFmt.nChannels; + pFormat->wBitsPerSample = miniFmt.BitsPerSample(); + pFormat->nBlockAlign = (WORD) miniFmt.BlockAlign(); + pFormat->nSamplesPerSec = miniFmt.nSamplesPerSec; + pFormat->nAvgBytesPerSec = miniFmt.AvgBytesPerSec(); + + return S_OK; +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::Impl::GetWaveData( uint32_t index, const uint8_t** pData, uint32_t& dataSize ) const +{ + if ( !pData ) + return E_INVALIDARG; + + if ( index >= m_data.dwEntryCount || !m_entries ) + { + return E_FAIL; + } + +#if defined(_XBOX_ONE) && defined(_TITLE) + const uint8_t* waveData = ( m_xmaMemory ) ? reinterpret_cast( m_xmaMemory ) : m_waveData.get(); +#else + const uint8_t* waveData = m_waveData.get(); +#endif + + if ( !waveData ) + return E_FAIL; + + if ( m_data.dwFlags & BANKDATA::TYPE_STREAMING ) + { + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + } + + if ( !m_prepared ) + { + return HRESULT_FROM_WIN32( ERROR_IO_INCOMPLETE ); + } + + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + auto& entry = reinterpret_cast( m_entries.get() )[ index ]; + + DWORD dwOffset, dwLength; + entry.ComputeLocations( dwOffset, dwLength, index, m_header, m_data, reinterpret_cast( m_entries.get() ) ); + + if ( ( dwOffset + dwLength ) > m_header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwLength ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + *pData = &waveData[ dwOffset ]; + dataSize = dwLength; + } + else + { + auto& entry = reinterpret_cast( m_entries.get() )[ index ]; + + if ( ( entry.PlayRegion.dwOffset + entry.PlayRegion.dwLength ) > m_header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwLength ) + { + return HRESULT_FROM_WIN32( ERROR_HANDLE_EOF ); + } + + *pData = &waveData[ entry.PlayRegion.dwOffset ]; + dataSize = entry.PlayRegion.dwLength; + } + + return S_OK; +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::Impl::GetSeekTable( uint32_t index, const uint32_t** pData, uint32_t& dataCount, uint32_t& tag ) const +{ + if ( !pData ) + return E_INVALIDARG; + + *pData = nullptr; + dataCount = 0; + tag = 0; + + if ( index >= m_data.dwEntryCount || !m_entries ) + { + return E_FAIL; + } + + if ( !m_seekData ) + return S_OK; + + auto& miniFmt = ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) ? m_data.CompactFormat : ( reinterpret_cast( m_entries.get() )[ index ].Format ); + + switch( miniFmt.wFormatTag ) + { + case MINIWAVEFORMAT::TAG_WMA: + tag = (miniFmt.wBitsPerSample & 0x1) ? WAVE_FORMAT_WMAUDIO3 : WAVE_FORMAT_WMAUDIO2; + break; + + case MINIWAVEFORMAT::TAG_XMA: + tag = 0x166 /* WAVE_FORMAT_XMA2 */; + break; + + default: + return S_OK; + } + + auto seekTable = FindSeekTable( index, m_seekData.get(), m_header, m_data ); + if ( !seekTable ) + return S_OK; + + dataCount = *seekTable; + *pData = seekTable + 1; + + return S_OK; +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::Impl::GetMetadata( uint32_t index, Metadata& metadata ) const +{ + if ( index >= m_data.dwEntryCount || !m_entries ) + { + return E_FAIL; + } + + if ( m_data.dwFlags & BANKDATA::FLAGS_COMPACT ) + { + auto& entry = reinterpret_cast( m_entries.get() )[ index ]; + + DWORD dwOffset, dwLength; + entry.ComputeLocations( dwOffset, dwLength, index, m_header, m_data, reinterpret_cast( m_entries.get() ) ); + + auto seekTable = FindSeekTable( index, m_seekData.get(), m_header, m_data ); + metadata.duration = entry.GetDuration( dwLength, m_data, seekTable ); + metadata.loopStart = metadata.loopLength = 0; + metadata.offsetBytes = dwOffset; + metadata.lengthBytes = dwLength; + } + else + { + auto& entry = reinterpret_cast( m_entries.get() )[ index ]; + + metadata.duration = entry.Duration; + metadata.loopStart = entry.LoopRegion.dwStartSample; + metadata.loopLength = entry.LoopRegion.dwTotalSamples; + metadata.offsetBytes = entry.PlayRegion.dwOffset; + metadata.lengthBytes = entry.PlayRegion.dwLength; + } + + return S_OK; +} + + +bool WaveBankReader::Impl::UpdatePrepared() +{ + if ( m_prepared ) + return true; + + if ( m_async == INVALID_HANDLE_VALUE ) + return false; + + if ( m_request.hEvent != 0 ) + { + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + DWORD bytes; + BOOL result = GetOverlappedResultEx( m_async, &m_request, &bytes, 0, FALSE ); +#else + bool result = HasOverlappedIoCompleted( &m_request ); +#endif + if ( result ) + { + m_prepared = true; + + memset( &m_request, 0, sizeof(OVERLAPPED) ); + } + } + + return m_prepared; +} + + + +//-------------------------------------------------------------------------------------- +WaveBankReader::WaveBankReader() : + pImpl( new Impl ) +{ +} + + +WaveBankReader::~WaveBankReader() +{ +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::Open( const wchar_t* szFileName ) +{ + return pImpl->Open( szFileName ); +} + + +_Use_decl_annotations_ +uint32_t WaveBankReader::Find( const char* name ) const +{ + auto it = pImpl->m_names.find( name ); + if ( it != pImpl->m_names.cend() ) + { + return it->second; + } + + return uint32_t(-1); +} + + +bool WaveBankReader::IsPrepared() +{ + if ( pImpl->m_prepared ) + return true; + + return pImpl->UpdatePrepared(); +} + + +void WaveBankReader::WaitOnPrepare() +{ + if ( pImpl->m_prepared ) + return; + + if ( pImpl->m_request.hEvent != 0 ) + { + WaitForSingleObjectEx( pImpl->m_request.hEvent, INFINITE, FALSE ); + + pImpl->UpdatePrepared(); + } +} + + +bool WaveBankReader::HasNames() const +{ + return !pImpl->m_names.empty(); +} + + +bool WaveBankReader::IsStreamingBank() const +{ + return (pImpl->m_data.dwFlags & BANKDATA::TYPE_STREAMING) != 0; +} + + +#if defined(_XBOX_ONE) && defined(_TITLE) +bool WaveBankReader::HasXMA() const +{ + return (pImpl->m_xmaMemory != 0); +} +#endif + + +const char* WaveBankReader::BankName() const +{ + return pImpl->m_data.szBankName; +} + + +uint32_t WaveBankReader::Count() const +{ + return pImpl->m_data.dwEntryCount; +} + + +uint32_t WaveBankReader::BankAudioSize() const +{ + return pImpl->m_header.Segments[HEADER::SEGIDX_ENTRYWAVEDATA].dwLength; +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::GetFormat( uint32_t index, WAVEFORMATEX* pFormat, size_t maxsize ) const +{ + return pImpl->GetFormat( index, pFormat, maxsize ); +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::GetWaveData( uint32_t index, const uint8_t** pData, uint32_t& dataSize ) const +{ + return pImpl->GetWaveData( index, pData, dataSize ); +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::GetSeekTable( uint32_t index, const uint32_t** pData, uint32_t& dataCount, uint32_t& tag ) const +{ + return pImpl->GetSeekTable( index, pData, dataCount, tag ); +} + + +_Use_decl_annotations_ +HRESULT WaveBankReader::GetMetadata( uint32_t index, Metadata& metadata ) const +{ + return pImpl->GetMetadata( index, metadata ); +} + + +HANDLE WaveBankReader::GetAsyncHandle() const +{ + return ( pImpl->m_data.dwFlags & BANKDATA::TYPE_STREAMING ) ? pImpl->m_async : INVALID_HANDLE_VALUE; +} diff --git a/Kits/DirectXTK12/Audio/WaveBankReader.h b/Kits/DirectXTK12/Audio/WaveBankReader.h new file mode 100644 index 0000000000000000000000000000000000000000..3b743e3179c07f0e828ee3c6ab3b472615f372a3 --- /dev/null +++ b/Kits/DirectXTK12/Audio/WaveBankReader.h @@ -0,0 +1,80 @@ +//-------------------------------------------------------------------------------------- +// File: WaveBankReader.h +// +// Functions for loading audio data from Wave Banks +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#pragma once + +#include +#include +#include +#include + + +namespace DirectX +{ + class WaveBankReader + { + public: + WaveBankReader(); + + WaveBankReader(WaveBankReader const&) = delete; + WaveBankReader& operator= (WaveBankReader const&) = delete; + + ~WaveBankReader(); + + HRESULT Open( _In_z_ const wchar_t* szFileName ); + + uint32_t Find( _In_z_ const char* name ) const; + + bool IsPrepared(); + void WaitOnPrepare(); + + bool HasNames() const; + bool IsStreamingBank() const; + +#if defined(_XBOX_ONE) && defined(_TITLE) + bool HasXMA() const; +#endif + + const char* BankName() const; + + uint32_t Count() const; + + uint32_t BankAudioSize() const; + + HRESULT GetFormat( _In_ uint32_t index, _Out_writes_bytes_(maxsize) WAVEFORMATEX* pFormat, _In_ size_t maxsize ) const; + + HRESULT GetWaveData( _In_ uint32_t index, _Outptr_ const uint8_t** pData, _Out_ uint32_t& dataSize ) const; + + HRESULT GetSeekTable( _In_ uint32_t index, _Out_ const uint32_t** pData, _Out_ uint32_t& dataCount, _Out_ uint32_t& tag ) const; + + HANDLE GetAsyncHandle() const; + + struct Metadata + { + uint32_t duration; + uint32_t loopStart; + uint32_t loopLength; + uint32_t offsetBytes; + uint32_t lengthBytes; + }; + HRESULT GetMetadata( _In_ uint32_t index, _Out_ Metadata& metadata ) const; + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/DirectXTK_Windows10.vcxproj b/Kits/DirectXTK12/DirectXTK_Windows10.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..a8ec8b0a74e698e4e8ec69586df8f9c22daa9740 --- /dev/null +++ b/Kits/DirectXTK12/DirectXTK_Windows10.vcxproj @@ -0,0 +1,454 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + Document + + + Document + + + Document + + + Document + + + Document + + + Document + + + + + Document + + + + + + + {945B8F0E-AE5F-447C-933A-9D069532D3E4} + StaticLibrary + DirectXTK12 + DirectXTK12 + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + StaticLibrary + true + v140 + + + StaticLibrary + true + v140 + + + StaticLibrary + true + v140 + + + StaticLibrary + false + v140 + + + StaticLibrary + false + v140 + + + StaticLibrary + false + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bin\Windows10\$(Platform)\$(Configuration)\ + Bin\Windows10\$(Platform)\$(Configuration)\ + DirectXTK12 + false + + + Bin\Windows10\$(Platform)\$(Configuration)\ + Bin\Windows10\$(Platform)\$(Configuration)\ + DirectXTK12 + false + + + Bin\Windows10\$(Platform)\$(Configuration)\ + Bin\Windows10\$(Platform)\$(Configuration)\ + DirectXTK12 + false + + + Bin\Windows10\$(Platform)\$(Configuration)\ + Bin\Windows10\$(Platform)\$(Configuration)\ + DirectXTK12 + false + + + Bin\Windows10\$(Platform)\$(Configuration)\ + Bin\Windows10\$(Platform)\$(Configuration)\ + DirectXTK12 + false + + + Bin\Windows10\$(Platform)\$(Configuration)\ + Bin\Windows10\$(Platform)\$(Configuration)\ + DirectXTK12 + false + + + + Use + true + true + $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories) + Fast + StreamingSIMDExtensions2 + $(IntDir)$(TargetName).pdb + Level4 + _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + Use + true + true + $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories) + Fast + StreamingSIMDExtensions2 + $(IntDir)$(TargetName).pdb + Level4 + _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + Use + true + true + $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories) + Fast + $(IntDir)$(TargetName).pdb + Level4 + _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + Use + true + true + $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories) + Fast + $(IntDir)$(TargetName).pdb + Level4 + _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + Use + true + true + $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories) + Fast + $(IntDir)$(TargetName).pdb + Level4 + _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + Use + true + true + $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories) + Fast + $(IntDir)$(TargetName).pdb + Level4 + _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + + \ No newline at end of file diff --git a/Kits/DirectXTK12/DirectXTK_Windows10.vcxproj.filters b/Kits/DirectXTK12/DirectXTK_Windows10.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..b03f0f12ddc99038d7bc1e241a73bc62678cc2f1 --- /dev/null +++ b/Kits/DirectXTK12/DirectXTK_Windows10.vcxproj.filters @@ -0,0 +1,521 @@ + + + + + {a77af43b-f2ab-4dcc-b84e-70909b198d8a} + + + {4a81ebd8-dd1a-46fb-ad14-8b57d8e92774} + + + {a872f54e-e97f-4e14-a946-da034ce61f99} + + + {e536bb5b-5908-4d5a-b629-6a73cf2fc9ca} + + + {fe608244-a8ad-4cca-b766-e82f3d32405b} + + + {cdc2c333-afc0-4a50-af16-b00d55d5eae9} + + + {6a91517d-6346-497f-a53c-72b517d1555b} + + + {748d343b-b201-4335-958e-d5457382f87b} + + + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Inc + + + Src + + + Src + + + Audio + + + Audio + + + Audio + + + Audio + + + Inc + + + Inc + + + Inc + + + Src + + + Src + + + Src + + + Inc\Shared + + + Inc\Shared + + + Inc\Shared + + + Inc\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Inc + + + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders + + + Inc\Shared + + + Src\Shared + + + Src\Shaders + + + Src\Shaders\Shared + + + Src\Shaders\Shared + + + Src\Shaders\Shared + + + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src + + + Audio + + + Audio + + + Audio + + + Audio + + + Audio + + + Audio + + + Audio + + + Audio + + + Src + + + Src + + + Src + + + Src + + + Src + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src\Shared + + + Src + + + + + + \ No newline at end of file diff --git a/Kits/DirectXTK12/Inc/Audio.h b/Kits/DirectXTK12/Inc/Audio.h new file mode 100644 index 0000000000000000000000000000000000000000..ce0179e7b846b025544b6f48c4bdb690b143167e --- /dev/null +++ b/Kits/DirectXTK12/Inc/Audio.h @@ -0,0 +1,682 @@ +//-------------------------------------------------------------------------------------- +// File: Audio.h +// +// DirectXTK for Audio header +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include +#include +#include + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#pragma comment(lib,"acphal.lib") +#endif + +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#pragma comment(lib,"PhoneAudioSes.lib") +#endif + +#ifndef XAUDIO2_HELPER_FUNCTIONS +#define XAUDIO2_HELPER_FUNCTIONS +#endif + +#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) +#if defined(_MSC_VER) && (_MSC_VER < 1700) +#error DirectX Tool Kit for Audio does not support VS 2010 without the DirectX SDK +#endif +#include +#include +#include +#include +#pragma comment(lib,"xaudio2.lib") +#else +// Using XAudio 2.7 requires the DirectX SDK +#include +#include +#include +#include +#pragma warning(push) +#pragma warning( disable : 4005 ) +#include +#pragma warning(pop) +#pragma comment(lib,"x3daudio.lib") +#pragma comment(lib,"xapofx.lib") +#endif + +#include + +#include +#include +#include +#include +#include + +namespace DirectX +{ + class SoundEffectInstance; + + //---------------------------------------------------------------------------------- + struct AudioStatistics + { + size_t playingOneShots; // Number of one-shot sounds currently playing + size_t playingInstances; // Number of sound effect instances currently playing + size_t allocatedInstances; // Number of SoundEffectInstance allocated + size_t allocatedVoices; // Number of XAudio2 voices allocated (standard, 3D, one-shots, and idle one-shots) + size_t allocatedVoices3d; // Number of XAudio2 voices allocated for 3D + size_t allocatedVoicesOneShot; // Number of XAudio2 voices allocated for one-shot sounds + size_t allocatedVoicesIdle; // Number of XAudio2 voices allocated for one-shot sounds but not currently in use + size_t audioBytes; // Total wave data (in bytes) in SoundEffects and in-memory WaveBanks +#if defined(_XBOX_ONE) && defined(_TITLE) + size_t xmaAudioBytes; // Total wave data (in bytes) in SoundEffects and in-memory WaveBanks allocated with ApuAlloc +#endif + }; + + + //---------------------------------------------------------------------------------- + class IVoiceNotify + { + public: + virtual void __cdecl OnBufferEnd() = 0; + // Notfication that a voice buffer has finished + // Note this is called from XAudio2's worker thread, so it should perform very minimal and thread-safe operations + + virtual void __cdecl OnCriticalError() = 0; + // Notification that the audio engine encountered a critical error + + virtual void __cdecl OnReset() = 0; + // Notification of an audio engine reset + + virtual void __cdecl OnUpdate() = 0; + // Notification of an audio engine per-frame update (opt-in) + + virtual void __cdecl OnDestroyEngine() = 0; + // Notification that the audio engine is being destroyed + + virtual void __cdecl OnTrim() = 0; + // Notification of a request to trim the voice pool + + virtual void __cdecl GatherStatistics( AudioStatistics& stats ) const = 0; + // Contribute to statistics request + }; + + //---------------------------------------------------------------------------------- + enum AUDIO_ENGINE_FLAGS + { + AudioEngine_Default = 0x0, + + AudioEngine_EnvironmentalReverb = 0x1, + AudioEngine_ReverbUseFilters = 0x2, + AudioEngine_UseMasteringLimiter = 0x4, + + AudioEngine_Debug = 0x10000, + AudioEngine_ThrowOnNoAudioHW = 0x20000, + AudioEngine_DisableVoiceReuse = 0x40000, + }; + + inline AUDIO_ENGINE_FLAGS operator|(AUDIO_ENGINE_FLAGS a, AUDIO_ENGINE_FLAGS b) { return static_cast( static_cast(a) | static_cast(b) ); } + + enum SOUND_EFFECT_INSTANCE_FLAGS + { + SoundEffectInstance_Default = 0x0, + + SoundEffectInstance_Use3D = 0x1, + SoundEffectInstance_ReverbUseFilters = 0x2, + SoundEffectInstance_NoSetPitch = 0x4, + + SoundEffectInstance_UseRedirectLFE = 0x10000, + }; + + inline SOUND_EFFECT_INSTANCE_FLAGS operator|(SOUND_EFFECT_INSTANCE_FLAGS a, SOUND_EFFECT_INSTANCE_FLAGS b) { return static_cast( static_cast(a) | static_cast(b) ); } + + enum AUDIO_ENGINE_REVERB + { + Reverb_Off, + Reverb_Default, + Reverb_Generic, + Reverb_Forest, + Reverb_PaddedCell, + Reverb_Room, + Reverb_Bathroom, + Reverb_LivingRoom, + Reverb_StoneRoom, + Reverb_Auditorium, + Reverb_ConcertHall, + Reverb_Cave, + Reverb_Arena, + Reverb_Hangar, + Reverb_CarpetedHallway, + Reverb_Hallway, + Reverb_StoneCorridor, + Reverb_Alley, + Reverb_City, + Reverb_Mountains, + Reverb_Quarry, + Reverb_Plain, + Reverb_ParkingLot, + Reverb_SewerPipe, + Reverb_Underwater, + Reverb_SmallRoom, + Reverb_MediumRoom, + Reverb_LargeRoom, + Reverb_MediumHall, + Reverb_LargeHall, + Reverb_Plate, + Reverb_MAX + }; + + enum SoundState + { + STOPPED = 0, + PLAYING, + PAUSED + }; + + + //---------------------------------------------------------------------------------- + class AudioEngine + { + public: + explicit AudioEngine( AUDIO_ENGINE_FLAGS flags = AudioEngine_Default, _In_opt_ const WAVEFORMATEX* wfx = nullptr, _In_opt_z_ const wchar_t* deviceId = nullptr, + AUDIO_STREAM_CATEGORY category = AudioCategory_GameEffects ); + + AudioEngine(AudioEngine&& moveFrom); + AudioEngine& operator= (AudioEngine&& moveFrom); + + AudioEngine(AudioEngine const&) = delete; + AudioEngine& operator= (AudioEngine const&) = delete; + + virtual ~AudioEngine(); + + bool __cdecl Update(); + // Performs per-frame processing for the audio engine, returns false if in 'silent mode' + + bool __cdecl Reset( _In_opt_ const WAVEFORMATEX* wfx = nullptr, _In_opt_z_ const wchar_t* deviceId = nullptr ); + // Reset audio engine from critical error/silent mode using a new device; can also 'migrate' the graph + // Returns true if succesfully reset, false if in 'silent mode' due to no default device + // Note: One shots are lost, all SoundEffectInstances are in the STOPPED state after successful reset + + void __cdecl Suspend(); + void __cdecl Resume(); + // Suspend/resumes audio processing (i.e. global pause/resume) + + float __cdecl GetMasterVolume() const; + void __cdecl SetMasterVolume( float volume ); + // Master volume property for all sounds + + void __cdecl SetReverb( AUDIO_ENGINE_REVERB reverb ); + void __cdecl SetReverb( _In_opt_ const XAUDIO2FX_REVERB_PARAMETERS* native ); + // Sets environmental reverb for 3D positional audio (if active) + + void __cdecl SetMasteringLimit( int release, int loudness ); + // Sets the mastering volume limiter properties (if active) + + AudioStatistics __cdecl GetStatistics() const; + // Gathers audio engine statistics + + WAVEFORMATEXTENSIBLE __cdecl GetOutputFormat() const; + // Returns the format consumed by the mastering voice (which is the same as the device output if defaults are used) + + uint32_t __cdecl GetChannelMask() const; + // Returns the output channel mask + + int __cdecl GetOutputChannels() const; + // Returns the number of output channels + + bool __cdecl IsAudioDevicePresent() const; + // Returns true if the audio graph is operating normally, false if in 'silent mode' + + bool __cdecl IsCriticalError() const; + // Returns true if the audio graph is halted due to a critical error (which also places the engine into 'silent mode') + + // Voice pool management. + void __cdecl SetDefaultSampleRate( int sampleRate ); + // Sample rate for voices in the reuse pool (defaults to 44100) + + void __cdecl SetMaxVoicePool( size_t maxOneShots, size_t maxInstances ); + // Maximum number of voices to allocate for one-shots and instances + // Note: one-shots over this limit are ignored; too many instance voices throws an exception + + void __cdecl TrimVoicePool(); + // Releases any currently unused voices + + // Internal-use functions + void __cdecl AllocateVoice( _In_ const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, _Outptr_result_maybenull_ IXAudio2SourceVoice** voice ); + + void __cdecl DestroyVoice( _In_ IXAudio2SourceVoice* voice ); + // Should only be called for instance voices, not one-shots + + void __cdecl RegisterNotify( _In_ IVoiceNotify* notify, bool usesUpdate ); + void __cdecl UnregisterNotify( _In_ IVoiceNotify* notify, bool usesOneShots, bool usesUpdate ); + + // XAudio2 interface access + IXAudio2* __cdecl GetInterface() const; + IXAudio2MasteringVoice* __cdecl GetMasterVoice() const; + IXAudio2SubmixVoice* __cdecl GetReverbVoice() const; + X3DAUDIO_HANDLE& __cdecl Get3DHandle() const; + + // Static functions + struct RendererDetail + { + std::wstring deviceId; + std::wstring description; + }; + + static std::vector __cdecl GetRendererDetails(); + // Returns a list of valid audio endpoint devices + + private: + // Private implementation. + class Impl; + std::unique_ptr pImpl; + }; + + + //---------------------------------------------------------------------------------- + class WaveBank + { + public: + WaveBank( _In_ AudioEngine* engine, _In_z_ const wchar_t* wbFileName ); + + WaveBank(WaveBank&& moveFrom); + WaveBank& operator= (WaveBank&& moveFrom); + + WaveBank(WaveBank const&) = delete; + WaveBank& operator= (WaveBank const&) = delete; + + virtual ~WaveBank(); + + void __cdecl Play( int index ); + void __cdecl Play( int index, float volume, float pitch, float pan ); + + void __cdecl Play( _In_z_ const char* name ); + void __cdecl Play( _In_z_ const char* name, float volume, float pitch, float pan ); + + std::unique_ptr __cdecl CreateInstance( int index, SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default ); + std::unique_ptr __cdecl CreateInstance( _In_z_ const char* name, SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default ); + + bool __cdecl IsPrepared() const; + bool __cdecl IsInUse() const; + bool __cdecl IsStreamingBank() const; + + size_t __cdecl GetSampleSizeInBytes( int index ) const; + // Returns size of wave audio data + + size_t __cdecl GetSampleDuration( int index ) const; + // Returns the duration in samples + + size_t __cdecl GetSampleDurationMS( int index ) const; + // Returns the duration in milliseconds + + const WAVEFORMATEX* __cdecl GetFormat( int index, _Out_writes_bytes_(maxsize) WAVEFORMATEX* wfx, size_t maxsize ) const; + + int __cdecl Find( _In_z_ const char* name ) const; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) + bool __cdecl FillSubmitBuffer( int index, _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const; +#else + void __cdecl FillSubmitBuffer( int index, _Out_ XAUDIO2_BUFFER& buffer ) const; +#endif + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + + // Private interface + void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance ); + + friend class SoundEffectInstance; + }; + + + //---------------------------------------------------------------------------------- + class SoundEffect + { + public: + SoundEffect( _In_ AudioEngine* engine, _In_z_ const wchar_t* waveFileName ); + + SoundEffect( _In_ AudioEngine* engine, _Inout_ std::unique_ptr& wavData, + _In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes ); + + SoundEffect( _In_ AudioEngine* engine, _Inout_ std::unique_ptr& wavData, + _In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes, + uint32_t loopStart, uint32_t loopLength ); + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) + + SoundEffect( _In_ AudioEngine* engine, _Inout_ std::unique_ptr& wavData, + _In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes, + _In_reads_(seekCount) const uint32_t* seekTable, size_t seekCount ); + +#endif + + SoundEffect(SoundEffect&& moveFrom); + SoundEffect& operator= (SoundEffect&& moveFrom); + + SoundEffect(SoundEffect const&) = delete; + SoundEffect& operator= (SoundEffect const&) = delete; + + virtual ~SoundEffect(); + + void __cdecl Play(); + void __cdecl Play(float volume, float pitch, float pan); + + std::unique_ptr __cdecl CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default ); + + bool __cdecl IsInUse() const; + + size_t __cdecl GetSampleSizeInBytes() const; + // Returns size of wave audio data + + size_t __cdecl GetSampleDuration() const; + // Returns the duration in samples + + size_t __cdecl GetSampleDurationMS() const; + // Returns the duration in milliseconds + + const WAVEFORMATEX* __cdecl GetFormat() const; + +#if defined(_XBOX_ONE) || (_WIN32_WINNT < _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) + bool __cdecl FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer ) const; +#else + void __cdecl FillSubmitBuffer( _Out_ XAUDIO2_BUFFER& buffer ) const; +#endif + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + + // Private interface + void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance ); + + friend class SoundEffectInstance; + }; + + + //---------------------------------------------------------------------------------- + struct AudioListener : public X3DAUDIO_LISTENER + { + AudioListener() + { + memset( this, 0, sizeof(X3DAUDIO_LISTENER) ); + + OrientFront.z = -1.f; + + OrientTop.y = 1.f; + } + + void XM_CALLCONV SetPosition( FXMVECTOR v ) + { + XMStoreFloat3( reinterpret_cast( &Position ), v ); + } + void __cdecl SetPosition( const XMFLOAT3& pos ) + { + Position.x = pos.x; + Position.y = pos.y; + Position.z = pos.z; + } + + void XM_CALLCONV SetVelocity( FXMVECTOR v ) + { + XMStoreFloat3( reinterpret_cast( &Velocity ), v ); + } + void __cdecl SetVelocity( const XMFLOAT3& vel ) + { + Velocity.x = vel.x; + Velocity.y = vel.y; + Velocity.z = vel.z; + } + + void XM_CALLCONV SetOrientation( FXMVECTOR forward, FXMVECTOR up ) + { + XMStoreFloat3( reinterpret_cast( &OrientFront ), forward ); + XMStoreFloat3( reinterpret_cast( &OrientTop ), up ); + } + void __cdecl SetOrientation( const XMFLOAT3& forward, const XMFLOAT3& up ) + { + OrientFront.x = forward.x; OrientTop.x = up.x; + OrientFront.y = forward.y; OrientTop.y = up.y; + OrientFront.z = forward.z; OrientTop.z = up.z; + } + + void XM_CALLCONV SetOrientationFromQuaternion( FXMVECTOR quat ) + { + XMVECTOR forward = XMVector3Rotate( g_XMIdentityR2, quat ); + XMStoreFloat3( reinterpret_cast( &OrientFront ), forward ); + + XMVECTOR up = XMVector3Rotate( g_XMIdentityR1, quat ); + XMStoreFloat3( reinterpret_cast( &OrientTop ), up ); + } + + void XM_CALLCONV Update( FXMVECTOR newPos, XMVECTOR upDir, float dt ) + // Updates velocity and orientation by tracking changes in position over time... + { + if ( dt > 0.f ) + { + XMVECTOR lastPos = XMLoadFloat3( reinterpret_cast( &Position ) ); + + XMVECTOR vDelta = ( newPos - lastPos ); + XMVECTOR v = vDelta / dt; + XMStoreFloat3( reinterpret_cast( &Velocity ), v ); + + vDelta = XMVector3Normalize( vDelta ); + XMStoreFloat3( reinterpret_cast( &OrientFront ), vDelta ); + + v = XMVector3Cross( upDir, vDelta ); + v = XMVector3Normalize( v ); + + v = XMVector3Cross( vDelta, v ); + v = XMVector3Normalize( v ); + XMStoreFloat3( reinterpret_cast( &OrientTop ), v ); + + XMStoreFloat3( reinterpret_cast( &Position ), newPos ); + } + } + }; + + + //---------------------------------------------------------------------------------- + struct AudioEmitter : public X3DAUDIO_EMITTER + { + float EmitterAzimuths[XAUDIO2_MAX_AUDIO_CHANNELS]; + + AudioEmitter() + { + memset( this, 0, sizeof(X3DAUDIO_EMITTER) ); + memset( EmitterAzimuths, 0, sizeof(EmitterAzimuths) ); + + OrientFront.z = -1.f; + + OrientTop.y = + ChannelRadius = + CurveDistanceScaler = + DopplerScaler = 1.f; + + ChannelCount = 1; + pChannelAzimuths = EmitterAzimuths; + + InnerRadiusAngle = X3DAUDIO_PI / 4.0f; + } + + void XM_CALLCONV SetPosition( FXMVECTOR v ) + { + XMStoreFloat3( reinterpret_cast( &Position ), v ); + } + void __cdecl SetPosition( const XMFLOAT3& pos ) + { + Position.x = pos.x; + Position.y = pos.y; + Position.z = pos.z; + } + + void XM_CALLCONV SetVelocity( FXMVECTOR v ) + { + XMStoreFloat3( reinterpret_cast( &Velocity ), v ); + } + void __cdecl SetVelocity( const XMFLOAT3& vel ) + { + Velocity.x = vel.x; + Velocity.y = vel.y; + Velocity.z = vel.z; + } + + void XM_CALLCONV SetOrientation( FXMVECTOR forward, FXMVECTOR up ) + { + XMStoreFloat3( reinterpret_cast( &OrientFront ), forward ); + XMStoreFloat3( reinterpret_cast( &OrientTop ), up ); + } + void __cdecl SetOrientation( const XMFLOAT3& forward, const XMFLOAT3& up ) + { + OrientFront.x = forward.x; OrientTop.x = up.x; + OrientFront.y = forward.y; OrientTop.y = up.y; + OrientFront.z = forward.z; OrientTop.z = up.z; + } + + void XM_CALLCONV SetOrientationFromQuaternion( FXMVECTOR quat ) + { + XMVECTOR forward = XMVector3Rotate( g_XMIdentityR2, quat ); + XMStoreFloat3( reinterpret_cast( &OrientFront ), forward ); + + XMVECTOR up = XMVector3Rotate( g_XMIdentityR1, quat ); + XMStoreFloat3( reinterpret_cast( &OrientTop ), up ); + } + + void XM_CALLCONV Update( FXMVECTOR newPos, XMVECTOR upDir, float dt ) + // Updates velocity and orientation by tracking changes in position over time... + { + if ( dt > 0.f ) + { + XMVECTOR lastPos = XMLoadFloat3( reinterpret_cast( &Position ) ); + + XMVECTOR vDelta = ( newPos - lastPos ); + XMVECTOR v = vDelta / dt; + XMStoreFloat3( reinterpret_cast( &Velocity ), v ); + + vDelta = XMVector3Normalize( vDelta ); + XMStoreFloat3( reinterpret_cast( &OrientFront ), vDelta ); + + v = XMVector3Cross( upDir, vDelta ); + v = XMVector3Normalize( v ); + + v = XMVector3Cross( vDelta, v ); + v = XMVector3Normalize( v ); + XMStoreFloat3( reinterpret_cast( &OrientTop ), v ); + + XMStoreFloat3( reinterpret_cast( &Position ), newPos ); + } + } + }; + + + //---------------------------------------------------------------------------------- + class SoundEffectInstance + { + public: + SoundEffectInstance(SoundEffectInstance&& moveFrom); + SoundEffectInstance& operator= (SoundEffectInstance&& moveFrom); + + SoundEffectInstance(SoundEffectInstance const&) = delete; + SoundEffectInstance& operator= (SoundEffectInstance const&) = delete; + + virtual ~SoundEffectInstance(); + + void __cdecl Play( bool loop = false ); + void __cdecl Stop( bool immediate = true ); + void __cdecl Pause(); + void __cdecl Resume(); + + void __cdecl SetVolume( float volume ); + void __cdecl SetPitch( float pitch ); + void __cdecl SetPan( float pan ); + + void __cdecl Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords = true ); + + bool __cdecl IsLooped() const; + + SoundState __cdecl GetState(); + + // Notifications. + void __cdecl OnDestroyParent(); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + + // Private constructors + SoundEffectInstance( _In_ AudioEngine* engine, _In_ SoundEffect* effect, SOUND_EFFECT_INSTANCE_FLAGS flags ); + SoundEffectInstance( _In_ AudioEngine* engine, _In_ WaveBank* effect, int index, SOUND_EFFECT_INSTANCE_FLAGS flags ); + + friend std::unique_ptr __cdecl SoundEffect::CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS ); + friend std::unique_ptr __cdecl WaveBank::CreateInstance( int, SOUND_EFFECT_INSTANCE_FLAGS ); + }; + + + //---------------------------------------------------------------------------------- + class DynamicSoundEffectInstance + { + public: + DynamicSoundEffectInstance( _In_ AudioEngine* engine, + _In_opt_ std::function bufferNeeded, + int sampleRate, int channels, int sampleBits = 16, + SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default ); + DynamicSoundEffectInstance(DynamicSoundEffectInstance&& moveFrom); + DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance&& moveFrom); + + DynamicSoundEffectInstance(DynamicSoundEffectInstance const&) = delete; + DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance const&) = delete; + + virtual ~DynamicSoundEffectInstance(); + + void __cdecl Play(); + void __cdecl Stop( bool immediate = true ); + void __cdecl Pause(); + void __cdecl Resume(); + + void __cdecl SetVolume( float volume ); + void __cdecl SetPitch( float pitch ); + void __cdecl SetPan( float pan ); + + void __cdecl Apply3D( const AudioListener& listener, const AudioEmitter& emitter, bool rhcoords = true ); + + void __cdecl SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, size_t audioBytes ); + void __cdecl SubmitBuffer( _In_reads_bytes_(audioBytes) const uint8_t* pAudioData, uint32_t offset, size_t audioBytes ); + + SoundState __cdecl GetState(); + + size_t __cdecl GetSampleDuration( size_t bytes ) const; + // Returns duration in samples of a buffer of a given size + + size_t __cdecl GetSampleDurationMS( size_t bytes ) const; + // Returns duration in milliseconds of a buffer of a given size + + size_t __cdecl GetSampleSizeInBytes( uint64_t duration ) const; + // Returns size of a buffer for a duration given in milliseconds + + int __cdecl GetPendingBufferCount() const; + + const WAVEFORMATEX* __cdecl GetFormat() const; + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/Inc/CommonStates.h b/Kits/DirectXTK12/Inc/CommonStates.h new file mode 100644 index 0000000000000000000000000000000000000000..9197c9c8d3bcfa8eaa0fd720a9a0d041249d26d4 --- /dev/null +++ b/Kits/DirectXTK12/Inc/CommonStates.h @@ -0,0 +1,55 @@ +//-------------------------------------------------------------------------------------- +// File: CommonStates.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + + +namespace DirectX +{ + class CommonStates + { + public: + CommonStates() = delete; + + // Blend states. + static const D3D12_BLEND_DESC Opaque; + static const D3D12_BLEND_DESC AlphaBlend; + static const D3D12_BLEND_DESC Additive; + static const D3D12_BLEND_DESC NonPremultiplied; + + // Depth stencil states. + static const D3D12_DEPTH_STENCIL_DESC DepthNone; + static const D3D12_DEPTH_STENCIL_DESC DepthDefault; + static const D3D12_DEPTH_STENCIL_DESC DepthRead; + + // Rasterizer states. + static const D3D12_RASTERIZER_DESC CullNone; + static const D3D12_RASTERIZER_DESC CullClockwise; + static const D3D12_RASTERIZER_DESC CullCounterClockwise; + static const D3D12_RASTERIZER_DESC Wireframe; + + // Sampler states. + static const D3D12_SAMPLER_DESC PointWrap; + static const D3D12_SAMPLER_DESC PointClamp; + static const D3D12_SAMPLER_DESC LinearWrap; + static const D3D12_SAMPLER_DESC LinearClamp; + static const D3D12_SAMPLER_DESC AnisotropicWrap; + static const D3D12_SAMPLER_DESC AnisotropicClamp; + }; +} diff --git a/Kits/DirectXTK12/Inc/DDSTextureLoader.h b/Kits/DirectXTK12/Inc/DDSTextureLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..86b7fa685ad64a99b4e1ddbaa421a15b856ece38 --- /dev/null +++ b/Kits/DirectXTK12/Inc/DDSTextureLoader.h @@ -0,0 +1,139 @@ +//-------------------------------------------------------------------------------------- +// File: DDSTextureLoader.h +// +// Functions for loading a DDS texture and creating a Direct3D runtime resource for it +// +// Note these functions are useful as a light-weight runtime loader for DDS files. For +// a full-featured DDS file reader, writer, and texture processing pipeline see +// the 'Texconv' sample and the 'DirectXTex' library. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include + + +namespace DirectX +{ + class ResourceUploadBatch; + + enum DDS_ALPHA_MODE + { + DDS_ALPHA_MODE_UNKNOWN = 0, + DDS_ALPHA_MODE_STRAIGHT = 1, + DDS_ALPHA_MODE_PREMULTIPLIED = 2, + DDS_ALPHA_MODE_OPAQUE = 3, + DDS_ALPHA_MODE_CUSTOM = 4, + }; + + // Standard version + HRESULT __cdecl LoadDDSTextureFromMemory( + _In_ ID3D12Device* d3dDevice, + _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, + _In_ size_t ddsDataSize, + _Outptr_ ID3D12Resource** texture, + _Inout_ std::vector& subresources, + _In_ size_t maxsize = 0, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + HRESULT __cdecl LoadDDSTextureFromFile( + _In_ ID3D12Device* d3dDevice, + _In_z_ const wchar_t* szFileName, + _Outptr_ ID3D12Resource** texture, + _Inout_ std::unique_ptr& ddsData, + _Inout_ std::vector& subresources, + _In_ size_t maxsize = 0, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + HRESULT __cdecl CreateDDSTextureFromMemory( + _In_ ID3D12Device* device, + _In_ ResourceUploadBatch& resourceUpload, + _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, + _In_ size_t ddsDataSize, + _Outptr_ ID3D12Resource** texture, + _In_ bool generateMipsIfMissing = false, + _In_ size_t maxsize = 0, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + HRESULT __cdecl CreateDDSTextureFromFile( + _In_ ID3D12Device* device, + _In_ ResourceUploadBatch& resourceUpload, + _In_z_ const wchar_t* szFileName, + _Outptr_ ID3D12Resource** texture, + _In_ bool generateMipsIfMissing = false, + _In_ size_t maxsize = 0, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + // Extended version + HRESULT __cdecl LoadDDSTextureFromMemoryEx( + _In_ ID3D12Device* d3dDevice, + _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, + _In_ size_t ddsDataSize, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool reserveFullMipChain, + _Outptr_ ID3D12Resource** texture, + _Inout_ std::vector& subresources, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + HRESULT __cdecl LoadDDSTextureFromFileEx( + _In_ ID3D12Device* d3dDevice, + _In_z_ const wchar_t* szFileName, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool reserveFullMipChain, + _Outptr_ ID3D12Resource** texture, + _Inout_ std::unique_ptr& ddsData, + _Inout_ std::vector& subresources, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + HRESULT __cdecl CreateDDSTextureFromMemoryEx( + _In_ ID3D12Device* device, + _In_ ResourceUploadBatch& resourceUpload, + _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, + _In_ size_t ddsDataSize, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool generateMipsIfMissing, + _Outptr_ ID3D12Resource** texture, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); + + HRESULT __cdecl CreateDDSTextureFromFileEx( + _In_ ID3D12Device* device, + _In_ ResourceUploadBatch& resourceUpload, + _In_z_ const wchar_t* szFileName, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool generateMipsIfMissing, + _Outptr_ ID3D12Resource** texture, + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, + _Out_opt_ bool* isCubeMap = nullptr); +} diff --git a/Kits/DirectXTK12/Inc/DescriptorHeap.h b/Kits/DirectXTK12/Inc/DescriptorHeap.h new file mode 100644 index 0000000000000000000000000000000000000000..ec3bc880920d74be26201c8496e0aa0c5388a2a8 --- /dev/null +++ b/Kits/DirectXTK12/Inc/DescriptorHeap.h @@ -0,0 +1,126 @@ +//-------------------------------------------------------------------------------------- +// File: DescriptorHeap.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include + +#include + + +namespace DirectX +{ + // A contiguous linear random-access descriptor heap + class DescriptorHeap + { + public: + DescriptorHeap( + _In_ ID3D12DescriptorHeap* pExistingHeap); + DescriptorHeap( + _In_ ID3D12Device* device, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC* pDesc); + DescriptorHeap( + _In_ ID3D12Device* device, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE type, + _In_ D3D12_DESCRIPTOR_HEAP_FLAGS flags, + _In_ size_t count); + + DescriptorHeap(DescriptorHeap&&) = default; + DescriptorHeap& operator=(DescriptorHeap&&) = default; + + DescriptorHeap(const DescriptorHeap&) = delete; + DescriptorHeap& operator=(const DescriptorHeap&) = delete; + + D3D12_GPU_DESCRIPTOR_HANDLE __cdecl WriteDescriptors( + _In_ ID3D12Device* device, + _In_ uint32_t offsetIntoHeap, + _In_ uint32_t totalDescriptorCount, + _In_reads_(descriptorRangeCount) const D3D12_CPU_DESCRIPTOR_HANDLE* pDescriptorRangeStarts, + _In_reads_(descriptorRangeCount) const uint32_t* pDescriptorRangeSizes, + _In_ uint32_t descriptorRangeCount); + + D3D12_GPU_DESCRIPTOR_HANDLE __cdecl WriteDescriptors( + _In_ ID3D12Device* device, + _In_ uint32_t offsetIntoHeap, + _In_reads_(descriptorRangeCount) const D3D12_CPU_DESCRIPTOR_HANDLE* pDescriptorRangeStarts, + _In_reads_(descriptorRangeCount) const uint32_t* pDescriptorRangeSizes, + _In_ uint32_t descriptorRangeCount); + + D3D12_GPU_DESCRIPTOR_HANDLE __cdecl WriteDescriptors( + _In_ ID3D12Device* device, + _In_ uint32_t offsetIntoHeap, + _In_reads_(descriptorCount) const D3D12_CPU_DESCRIPTOR_HANDLE* pDescriptors, + _In_ uint32_t descriptorCount); + + D3D12_GPU_DESCRIPTOR_HANDLE GetFirstGpuHandle() const + { + assert(m_desc.Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE); + assert(m_pHeap != 0); + return m_hGPU; + } + + D3D12_CPU_DESCRIPTOR_HANDLE GetFirstCpuHandle() const + { + assert(m_pHeap != 0); + return m_hCPU; + } + + D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle(_In_ size_t index) const + { + assert(m_pHeap != 0); + if (index >= m_desc.NumDescriptors) + { + throw std::out_of_range("CD3DX12_CPU_DESCRIPTOR_HANDLE"); + } + assert(m_desc.Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE); + return CD3DX12_GPU_DESCRIPTOR_HANDLE(m_hGPU, static_cast(index), m_increment); + } + + D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle(_In_ size_t index) const + { + assert(m_pHeap != 0); + if (index >= m_desc.NumDescriptors) + { + throw std::out_of_range("CD3DX12_CPU_DESCRIPTOR_HANDLE"); + } + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_hCPU, static_cast(index), m_increment); + } + + size_t Count() const { return m_desc.NumDescriptors; } + unsigned int Flags() const { return m_desc.Flags; } + D3D12_DESCRIPTOR_HEAP_TYPE Type() const { return m_desc.Type; } + size_t Increment() const { return m_increment; } + ID3D12DescriptorHeap* Heap() const { return m_pHeap.Get(); } + + static void __cdecl DefaultDesc( + _In_ D3D12_DESCRIPTOR_HEAP_TYPE type, + _Out_ D3D12_DESCRIPTOR_HEAP_DESC* pDesc); + + private: + void __cdecl Create(_In_ ID3D12Device* pDevice, _In_ const D3D12_DESCRIPTOR_HEAP_DESC* pDesc); + + Microsoft::WRL::ComPtr m_pHeap; + D3D12_DESCRIPTOR_HEAP_DESC m_desc; + CD3DX12_CPU_DESCRIPTOR_HANDLE m_hCPU; + CD3DX12_GPU_DESCRIPTOR_HANDLE m_hGPU; + uint32_t m_increment; + }; +} diff --git a/Kits/DirectXTK12/Inc/DirectXHelpers.h b/Kits/DirectXTK12/Inc/DirectXHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..b8ec75269feee146110afed1111246c811a3522d --- /dev/null +++ b/Kits/DirectXTK12/Inc/DirectXHelpers.h @@ -0,0 +1,176 @@ +//-------------------------------------------------------------------------------------- +// File: DirectXHelpers.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include + +#ifndef IID_GRAPHICS_PPV_ARGS +#define IID_GRAPHICS_PPV_ARGS(x) IID_PPV_ARGS(x) +#endif + +// +// The d3dx12.h header includes the following helper C++ classes and functions +// CD3DX12_RECT +// CD3DX12_BOX +// CD3DX12_DEPTH_STENCIL_DESC +// CD3DX12_BLEND_DESC +// CD3DX12_RASTERIZER_DESC +// CD3DX12_RESOURCE_ALLOCATION_INFO +// CD3DX12_HEAP_PROPERTIES +// CD3DX12_HEAP_DESC +// CD3DX12_CLEAR_VALUE +// CD3DX12_RANGE +// CD3DX12_SHADER_BYTECODE +// CD3DX12_TILED_RESOURCE_COORDINATE +// CD3DX12_TILE_REGION_SIZE +// CD3DX12_SUBRESOURCE_TILING +// CD3DX12_TILE_SHAPE +// CD3DX12_RESOURCE_BARRIER +// CD3DX12_PACKED_MIP_INFO +// CD3DX12_SUBRESOURCE_FOOTPRINT +// CD3DX12_TEXTURE_COPY_LOCATION +// CD3DX12_DESCRIPTOR_RANGE +// CD3DX12_ROOT_DESCRIPTOR_TABLE +// CD3DX12_ROOT_CONSTANTS +// CD3DX12_ROOT_DESCRIPTOR +// CD3DX12_ROOT_PARAMETER +// CD3DX12_STATIC_SAMPLER_DESC +// CD3DX12_ROOT_SIGNATURE_DESC +// CD3DX12_CPU_DESCRIPTOR_HANDLE +// CD3DX12_GPU_DESCRIPTOR_HANDLE +// CD3DX12_RESOURCE_DESC +// D3D12CalcSubresource +// D3D12DecomposeSubresource +// D3D12GetFormatPlaneCount +// MemcpySubresource +// GetRequiredIntermediateSize +// UpdateSubresources +// D3D12IsLayoutOpaque +// CommandListCast +// + + +namespace DirectX +{ + constexpr D3D12_CPU_DESCRIPTOR_HANDLE D3D12_CPU_DESCRIPTOR_HANDLE_ZERO = {}; + + // Creates a shader resource view from an arbitrary resource + void __cdecl CreateShaderResourceView( + _In_ ID3D12Device* d3dDevice, + _In_ ID3D12Resource* tex, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE srvDescriptor, + _In_ bool isCubeMap = false); + + // Shorthand for creating a root signature + inline HRESULT CreateRootSignature( + _In_ ID3D12Device* device, + _In_ const D3D12_ROOT_SIGNATURE_DESC* rootSignatureDesc, + _Out_ ID3D12RootSignature** rootSignature) + { + Microsoft::WRL::ComPtr pSignature; + Microsoft::WRL::ComPtr pError; + HRESULT hr = D3D12SerializeRootSignature(rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, pSignature.GetAddressOf(), pError.GetAddressOf()); + if (SUCCEEDED(hr)) + { + hr = device->CreateRootSignature(0, pSignature->GetBufferPointer(), pSignature->GetBufferSize(), + IID_GRAPHICS_PPV_ARGS(rootSignature) + ); + } + return hr; + } + + // Helper for obtaining texture size + inline XMUINT2 GetTextureSize(_In_ ID3D12Resource* tex) + { + auto desc = tex->GetDesc(); + return XMUINT2(static_cast(desc.Width), static_cast(desc.Height)); + } + + // Scoped PIX event. + class ScopedPixEvent + { + public: + ScopedPixEvent(_In_ ID3D12GraphicsCommandList* pCommandList, UINT64 /*metadata*/, PCWSTR pFormat) + : mCommandList(pCommandList) + { + PIXBeginEvent(pCommandList, 0, pFormat); + } + ~ScopedPixEvent() + { + PIXEndEvent(mCommandList); + } + + private: + ID3D12GraphicsCommandList* mCommandList; + }; + + // Helper sets a D3D resource name string (used by PIX and debug layer leak reporting). + template + inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const char(&name)[TNameLength]) + { + #if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) + wchar_t wname[MAX_PATH]; + int result = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, TNameLength, wname, MAX_PATH); + if (result > 0) + { + resource->SetName(wname); + } + #else + UNREFERENCED_PARAMETER(resource); + UNREFERENCED_PARAMETER(name); + #endif + } + + template + inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength]) + { + #if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) + resource->SetName(name); + #else + UNREFERENCED_PARAMETER(resource); + UNREFERENCED_PARAMETER(name); + #endif + } + + // Helper for resource barrier. + inline void TransitionResource( + _In_ ID3D12GraphicsCommandList* commandList, + _In_ ID3D12Resource* resource, + _In_ D3D12_RESOURCE_STATES stateBefore, + _In_ D3D12_RESOURCE_STATES stateAfter) + { + assert(commandList != 0); + assert(resource != 0); + + if (stateBefore == stateAfter) + return; + + D3D12_RESOURCE_BARRIER desc = {}; + desc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + desc.Transition.pResource = resource; + desc.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; + desc.Transition.StateBefore = stateBefore; + desc.Transition.StateAfter = stateAfter; + + commandList->ResourceBarrier(1, &desc); + } +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Inc/Effects.h b/Kits/DirectXTK12/Inc/Effects.h new file mode 100644 index 0000000000000000000000000000000000000000..72e31ffea35f1cb80c04bfd6564efa9a9592bdd2 --- /dev/null +++ b/Kits/DirectXTK12/Inc/Effects.h @@ -0,0 +1,545 @@ +//-------------------------------------------------------------------------------------- +// File: Effects.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include +#include + +#include "RenderTargetState.h" + +namespace DirectX +{ + class DescriptorHeap; + class ResourceUploadBatch; + + //---------------------------------------------------------------------------------- + // Abstract interface representing any effect which can be applied onto a D3D device context. + class IEffect + { + public: + virtual ~IEffect() { } + + virtual void __cdecl Apply( _In_ ID3D12GraphicsCommandList* deviceContext ) = 0; + }; + + + // Abstract interface for effects with world, view, and projection matrices. + class IEffectMatrices + { + public: + virtual ~IEffectMatrices() { } + + virtual void XM_CALLCONV SetWorld(FXMMATRIX value) = 0; + virtual void XM_CALLCONV SetView(FXMMATRIX value) = 0; + virtual void XM_CALLCONV SetProjection(FXMMATRIX value) = 0; + }; + + + // Abstract interface for effects which support directional lighting. + class IEffectLights + { + public: + virtual ~IEffectLights() { } + + virtual void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) = 0; + + virtual void __cdecl SetLightEnabled(int whichLight, bool value) = 0; + virtual void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) = 0; + virtual void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) = 0; + virtual void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) = 0; + + virtual void __cdecl EnableDefaultLighting() = 0; + + static const int MaxDirectionalLights = 3; + }; + + + // Abstract interface for effects which support fog. + class IEffectFog + { + public: + virtual ~IEffectFog() { } + + virtual void __cdecl SetFogStart(float value) = 0; + virtual void __cdecl SetFogEnd(float value) = 0; + virtual void XM_CALLCONV SetFogColor(FXMVECTOR value) = 0; + }; + + + // Abstract interface for effects which support skinning + class IEffectSkinning + { + public: + virtual ~IEffectSkinning() { } + + virtual void __cdecl SetWeightsPerVertex(int value) = 0; + virtual void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) = 0; + virtual void __cdecl ResetBoneTransforms() = 0; + + static const int MaxBones = 72; + }; + + struct EffectPipelineStateDescription + { + EffectPipelineStateDescription( + _In_ const D3D12_INPUT_LAYOUT_DESC* inputLayout, + _In_ const D3D12_BLEND_DESC* blend, + _In_ const D3D12_DEPTH_STENCIL_DESC* depthStencil, + _In_ const D3D12_RASTERIZER_DESC* rasterizer, + _In_ const RenderTargetState* renderTarget, + _In_opt_ D3D12_PRIMITIVE_TOPOLOGY_TYPE primitiveTopology = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, + _In_opt_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE stripCutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED) + : + inputLayout(inputLayout), + blendDesc(blend), + depthStencilDesc(depthStencil), + rasterizerDesc(rasterizer), + renderTargetState(renderTarget), + primitiveTopology(primitiveTopology), + stripCutValue(stripCutValue) + { + // constructor + } + + const D3D12_INPUT_LAYOUT_DESC* inputLayout; + const D3D12_BLEND_DESC* blendDesc; + const D3D12_DEPTH_STENCIL_DESC* depthStencilDesc; + const D3D12_RASTERIZER_DESC* rasterizerDesc; + const RenderTargetState* renderTargetState; + const D3D12_PRIMITIVE_TOPOLOGY_TYPE primitiveTopology; + const D3D12_INDEX_BUFFER_STRIP_CUT_VALUE stripCutValue; + }; + + namespace EffectFlags + { + const int None = 0x00; + const int Fog = 0x01; + const int Lighting = 0x02; + const int PerPixelLighting = 0x04 | Lighting; // per pixel lighting implies lighting enabled + const int VertexColor = 0x08; + const int Texture = 0x10; + } + + //---------------------------------------------------------------------------------- + // Built-in shader supports optional texture mapping, vertex coloring, directional lighting, and fog. + class BasicEffect : public IEffect, public IEffectMatrices, public IEffectLights, public IEffectFog + { + public: + BasicEffect( _In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription ); + BasicEffect(BasicEffect&& moveFrom); + BasicEffect& operator= (BasicEffect&& moveFrom); + + BasicEffect(BasicEffect const&) = delete; + BasicEffect& operator= (BasicEffect const&) = delete; + + virtual ~BasicEffect(); + + // IEffect methods. + void __cdecl Apply(_In_ ID3D12GraphicsCommandList* cmdList) override; + + // Camera settings. + void XM_CALLCONV SetWorld(FXMMATRIX value) override; + void XM_CALLCONV SetView(FXMMATRIX value) override; + void XM_CALLCONV SetProjection(FXMMATRIX value) override; + + // Material settings. + void XM_CALLCONV SetDiffuseColor(FXMVECTOR value); + void XM_CALLCONV SetEmissiveColor(FXMVECTOR value); + void XM_CALLCONV SetSpecularColor(FXMVECTOR value); + void __cdecl SetSpecularPower(float value); + void __cdecl DisableSpecular(); + void __cdecl SetAlpha(float value); + + // Light settings. + void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override; + + void __cdecl SetLightEnabled(int whichLight, bool value) override; + void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override; + void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override; + void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override; + + void __cdecl EnableDefaultLighting() override; + + // Fog settings. + void __cdecl SetFogStart(float value) override; + void __cdecl SetFogEnd(float value) override; + void XM_CALLCONV SetFogColor(FXMVECTOR value) override; + + // Texture setting. + void __cdecl SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + + // Built-in shader supports per-pixel alpha testing. + class AlphaTestEffect : public IEffect, public IEffectMatrices, public IEffectFog + { + public: + AlphaTestEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription, + D3D12_COMPARISON_FUNC alphaFunction = D3D12_COMPARISON_FUNC_GREATER); + AlphaTestEffect(AlphaTestEffect&& moveFrom); + AlphaTestEffect& operator= (AlphaTestEffect&& moveFrom); + + AlphaTestEffect(AlphaTestEffect const&) = delete; + AlphaTestEffect& operator= (AlphaTestEffect const&) = delete; + + virtual ~AlphaTestEffect(); + + // IEffect methods. + void __cdecl Apply(_In_ ID3D12GraphicsCommandList* cmdList) override; + + // Camera settings. + void XM_CALLCONV SetWorld(FXMMATRIX value) override; + void XM_CALLCONV SetView(FXMMATRIX value) override; + void XM_CALLCONV SetProjection(FXMMATRIX value) override; + + // Material settings. + void XM_CALLCONV SetDiffuseColor(FXMVECTOR value); + void __cdecl SetAlpha(float value); + + // Fog settings. + void __cdecl SetFogStart(float value) override; + void __cdecl SetFogEnd(float value) override; + void XM_CALLCONV SetFogColor(FXMVECTOR value) override; + + // Texture setting. + void __cdecl SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor); + + // Alpha test settings. + void __cdecl SetReferenceAlpha(int value); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + + // Built-in shader supports two layer multitexturing (eg. for lightmaps or detail textures). + class DualTextureEffect : public IEffect, public IEffectMatrices, public IEffectFog + { + public: + DualTextureEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription); + DualTextureEffect(DualTextureEffect&& moveFrom); + DualTextureEffect& operator= (DualTextureEffect&& moveFrom); + + DualTextureEffect(DualTextureEffect const&) = delete; + DualTextureEffect& operator= (DualTextureEffect const&) = delete; + + ~DualTextureEffect(); + + // IEffect methods. + void __cdecl Apply(_In_ ID3D12GraphicsCommandList* cmdList) override; + + // Camera settings. + void XM_CALLCONV SetWorld(FXMMATRIX value) override; + void XM_CALLCONV SetView(FXMMATRIX value) override; + void XM_CALLCONV SetProjection(FXMMATRIX value) override; + + // Material settings. + void XM_CALLCONV SetDiffuseColor(FXMVECTOR value); + void __cdecl SetAlpha(float value); + + // Fog settings. + void __cdecl SetFogStart(float value) override; + void __cdecl SetFogEnd(float value) override; + void XM_CALLCONV SetFogColor(FXMVECTOR value) override; + + // Vertex color setting. + //void __cdecl SetVertexColorEnabled(bool value); + + // Texture settings. + void __cdecl SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor); + void __cdecl SetTexture2(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + + + // Built-in shader supports cubic environment mapping. + class EnvironmentMapEffect : public IEffect, public IEffectMatrices, public IEffectLights, public IEffectFog + { + public: + EnvironmentMapEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription, bool fresnelEnabled, bool specularEnabled); + EnvironmentMapEffect(EnvironmentMapEffect&& moveFrom); + EnvironmentMapEffect& operator= (EnvironmentMapEffect&& moveFrom); + + EnvironmentMapEffect(EnvironmentMapEffect const&) = delete; + EnvironmentMapEffect& operator= (EnvironmentMapEffect const&) = delete; + + virtual ~EnvironmentMapEffect(); + + // IEffect methods. + void __cdecl Apply(_In_ ID3D12GraphicsCommandList* cmdList) override; + + // Camera settings. + void XM_CALLCONV SetWorld(FXMMATRIX value) override; + void XM_CALLCONV SetView(FXMMATRIX value) override; + void XM_CALLCONV SetProjection(FXMMATRIX value) override; + + // Material settings. + void XM_CALLCONV SetDiffuseColor(FXMVECTOR value); + void XM_CALLCONV SetEmissiveColor(FXMVECTOR value); + void __cdecl SetAlpha(float value); + + // Light settings. + void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override; + + void __cdecl SetLightEnabled(int whichLight, bool value) override; + void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override; + void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override; + + void __cdecl EnableDefaultLighting() override; + + // Fog settings. + void __cdecl SetFogStart(float value) override; + void __cdecl SetFogEnd(float value) override; + void XM_CALLCONV SetFogColor(FXMVECTOR value) override; + + // Texture setting. + void __cdecl SetTexture(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value); + + // Environment map settings. + void __cdecl SetEnvironmentMap(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value); + void __cdecl SetEnvironmentMapAmount(float value); + void XM_CALLCONV SetEnvironmentMapSpecular(FXMVECTOR value); + void __cdecl SetFresnelFactor(float value); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + + // Unsupported interface methods. + void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override; + }; + + + // Built-in shader supports skinned animation. + class SkinnedEffect : public IEffect, public IEffectMatrices, public IEffectLights, public IEffectFog, public IEffectSkinning + { + public: + SkinnedEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription); + SkinnedEffect(SkinnedEffect&& moveFrom); + SkinnedEffect& operator= (SkinnedEffect&& moveFrom); + + SkinnedEffect(SkinnedEffect const&) = delete; + SkinnedEffect& operator= (SkinnedEffect const&) = delete; + + virtual ~SkinnedEffect(); + + // IEffect methods. + void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; + + // Camera settings. + void XM_CALLCONV SetWorld(FXMMATRIX value) override; + void XM_CALLCONV SetView(FXMMATRIX value) override; + void XM_CALLCONV SetProjection(FXMMATRIX value) override; + + // Material settings. + void XM_CALLCONV SetDiffuseColor(FXMVECTOR value); + void XM_CALLCONV SetEmissiveColor(FXMVECTOR value); + void XM_CALLCONV SetSpecularColor(FXMVECTOR value); + void __cdecl SetSpecularPower(float value); + void __cdecl DisableSpecular(); + void __cdecl SetAlpha(float value); + + // Light settings. + void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override; + + void __cdecl SetLightEnabled(int whichLight, bool value) override; + void XM_CALLCONV SetLightDirection(int whichLight, FXMVECTOR value) override; + void XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value) override; + void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override; + + void __cdecl EnableDefaultLighting() override; + + // Fog settings. + void __cdecl SetFogStart(float value) override; + void __cdecl SetFogEnd(float value) override; + void XM_CALLCONV SetFogColor(FXMVECTOR value) override; + + // Texture setting. + void __cdecl SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor); + + // Animation settings. + void __cdecl SetWeightsPerVertex(int value) override; + void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override; + void __cdecl ResetBoneTransforms() override; + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + + + //---------------------------------------------------------------------------------- + // Abstract interface to factory texture resources + class IEffectTextureFactory + { + public: + virtual ~IEffectTextureFactory() {} + + virtual void __cdecl CreateTexture(_In_z_ const wchar_t* name, int descriptorIndex) = 0; + }; + + class EffectTextureFactory : public IEffectTextureFactory + { + public: + EffectTextureFactory( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_ ID3D12DescriptorHeap* descriptorHeap); + + EffectTextureFactory( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_ size_t numDescriptors, + _In_ D3D12_DESCRIPTOR_HEAP_FLAGS descriptorHeapFlags); + + EffectTextureFactory(EffectTextureFactory&& moveFrom); + EffectTextureFactory& operator= (EffectTextureFactory&& moveFrom); + + EffectTextureFactory(EffectTextureFactory const&) = delete; + EffectTextureFactory& operator= (EffectTextureFactory const&) = delete; + + virtual ~EffectTextureFactory(); + + virtual void __cdecl CreateTexture(_In_z_ const wchar_t* name, int descriptorIndex) override; + + ID3D12DescriptorHeap* __cdecl DescriptorHeap() const; + + // Shorthand accessors for the descriptor heap + D3D12_CPU_DESCRIPTOR_HANDLE __cdecl GetCpuDescriptorHandle(size_t index) const; + D3D12_GPU_DESCRIPTOR_HANDLE __cdecl GetGpuDescriptorHandle(size_t index) const; + + // How many textures are there in this factory? + size_t __cdecl ResourceCount() const; + + // Get a resource in a specific slot + void __cdecl GetResource(size_t slot, _Out_ ID3D12Resource** resource, _Out_ bool* isCubeMap); + + // Settings. + void __cdecl ReleaseCache(); + + void __cdecl SetSharing( bool enabled ); + + void __cdecl SetDirectory(_In_opt_z_ const wchar_t* path); + + private: + // Private implementation + class Impl; + + std::unique_ptr pImpl; + }; + + //---------------------------------------------------------------------------------- + // Abstract interface to factory for sharing effects and texture resources + class IEffectFactory + { + public: + virtual ~IEffectFactory() {} + + struct EffectInfo + { + std::wstring name; + bool perVertexColor; + bool enableSkinning; + bool enableDualTexture; + bool isPremultipliedAlpha; + float specularPower; + float alphaValue; + DirectX::XMFLOAT3 ambientColor; + DirectX::XMFLOAT3 diffuseColor; + DirectX::XMFLOAT3 specularColor; + DirectX::XMFLOAT3 emissiveColor; + int textureIndex; + int textureIndex2; + + EffectInfo() + : perVertexColor(false) + , enableSkinning(false) + , enableDualTexture(false) + , isPremultipliedAlpha(false) + , specularPower(0) + , alphaValue(0) + , ambientColor(0, 0, 0) + , diffuseColor(0, 0, 0) + , specularColor(0, 0, 0) + , emissiveColor(0, 0, 0) + , textureIndex(-1) + , textureIndex2(-1) + { + } + }; + + virtual std::shared_ptr __cdecl CreateEffect( _In_ const EffectInfo& info, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_ const D3D12_INPUT_LAYOUT_DESC& inputLayout, + _In_opt_ int descriptorOffset = 0) = 0; + }; + + // Factory for sharing effects + class EffectFactory : public IEffectFactory + { + public: + EffectFactory(_In_ ID3D12Device* device); + EffectFactory(_In_ ID3D12DescriptorHeap* textureDescriptors); + + EffectFactory(EffectFactory&& moveFrom); + EffectFactory& operator= (EffectFactory&& moveFrom); + + EffectFactory(EffectFactory const&) = delete; + EffectFactory& operator= (EffectFactory const&) = delete; + + virtual ~EffectFactory(); + + // IEffectFactory methods. + virtual std::shared_ptr __cdecl CreateEffect( + _In_ const EffectInfo& info, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_ const D3D12_INPUT_LAYOUT_DESC& inputLayout, + _In_opt_ int descriptorOffset = 0) override; + + // Settings. + void __cdecl ReleaseCache(); + + void __cdecl SetSharing( bool enabled ); + + private: + // Private implementation. + class Impl; + + std::shared_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/Inc/GamePad.h b/Kits/DirectXTK12/Inc/GamePad.h new file mode 100644 index 0000000000000000000000000000000000000000..88d87922d85094a188d2eb9304144f5c011ef965 --- /dev/null +++ b/Kits/DirectXTK12/Inc/GamePad.h @@ -0,0 +1,260 @@ +//-------------------------------------------------------------------------------------- +// File: GamePad.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if (_WIN32_WINNT < 0x0A00 /*_WIN32_WINNT_WIN10*/) +#ifndef _XBOX_ONE +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/ ) +#pragma comment(lib,"xinput.lib") +#else +#pragma comment(lib,"xinput9_1_0.lib") +#endif +#endif +#endif +#endif + +#include +#include + + +namespace DirectX +{ + class GamePad + { + public: + GamePad(); + GamePad(GamePad&& moveFrom); + GamePad& operator= (GamePad&& moveFrom); + + GamePad(GamePad const&) = delete; + GamePad& operator=(GamePad const&) = delete; + + virtual ~GamePad(); + +#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) || defined(_XBOX_ONE) + static const int MAX_PLAYER_COUNT = 8; +#else + static const int MAX_PLAYER_COUNT = 4; +#endif + + enum DeadZone + { + DEAD_ZONE_INDEPENDENT_AXES = 0, + DEAD_ZONE_CIRCULAR, + DEAD_ZONE_NONE, + }; + + struct Buttons + { + bool a; + bool b; + bool x; + bool y; + bool leftStick; + bool rightStick; + bool leftShoulder; + bool rightShoulder; + union + { + bool back; + bool view; + }; + union + { + bool start; + bool menu; + }; + }; + + struct DPad + { + bool up; + bool down; + bool right; + bool left; + }; + + struct ThumbSticks + { + float leftX; + float leftY; + float rightX; + float rightY; + }; + + struct Triggers + { + float left; + float right; + }; + + struct State + { + bool connected; + uint64_t packet; + Buttons buttons; + DPad dpad; + ThumbSticks thumbSticks; + Triggers triggers; + + bool __cdecl IsConnected() const { return connected; } + + // Is the button pressed currently? + bool __cdecl IsAPressed() const { return buttons.a; } + bool __cdecl IsBPressed() const { return buttons.b; } + bool __cdecl IsXPressed() const { return buttons.x; } + bool __cdecl IsYPressed() const { return buttons.y; } + + bool __cdecl IsLeftStickPressed() const { return buttons.leftStick; } + bool __cdecl IsRightStickPressed() const { return buttons.rightStick; } + + bool __cdecl IsLeftShoulderPressed() const { return buttons.leftShoulder; } + bool __cdecl IsRightShoulderPressed() const { return buttons.rightShoulder; } + + bool __cdecl IsBackPressed() const { return buttons.back; } + bool __cdecl IsViewPressed() const { return buttons.view; } + bool __cdecl IsStartPressed() const { return buttons.start; } + bool __cdecl IsMenuPressed() const { return buttons.menu; } + + bool __cdecl IsDPadDownPressed() const { return dpad.down; }; + bool __cdecl IsDPadUpPressed() const { return dpad.up; }; + bool __cdecl IsDPadLeftPressed() const { return dpad.left; }; + bool __cdecl IsDPadRightPressed() const { return dpad.right; }; + + bool __cdecl IsLeftThumbStickUp() const { return (thumbSticks.leftY > 0.5f) != 0; } + bool __cdecl IsLeftThumbStickDown() const { return (thumbSticks.leftY < -0.5f) != 0; } + bool __cdecl IsLeftThumbStickLeft() const { return (thumbSticks.leftX < -0.5f) != 0; } + bool __cdecl IsLeftThumbStickRight() const { return (thumbSticks.leftX > 0.5f) != 0; } + + bool __cdecl IsRightThumbStickUp() const { return (thumbSticks.rightY > 0.5f ) != 0; } + bool __cdecl IsRightThumbStickDown() const { return (thumbSticks.rightY < -0.5f) != 0; } + bool __cdecl IsRightThumbStickLeft() const { return (thumbSticks.rightX < -0.5f) != 0; } + bool __cdecl IsRightThumbStickRight() const { return (thumbSticks.rightX > 0.5f) != 0; } + + bool __cdecl IsLeftTriggerPressed() const { return (triggers.left > 0.5f) != 0; } + bool __cdecl IsRightTriggerPressed() const { return (triggers.right > 0.5f) != 0; } + }; + + struct Capabilities + { + enum Type + { + UNKNOWN = 0, + GAMEPAD, + WHEEL, + ARCADE_STICK, + FLIGHT_STICK, + DANCE_PAD, + GUITAR, + GUITAR_ALTERNATE, + DRUM_KIT, + GUITAR_BASS = 11, + ARCADE_PAD = 19, + }; + + bool connected; + Type gamepadType; + uint64_t id; + + bool __cdecl IsConnected() const { return connected; } + }; + + class ButtonStateTracker + { + public: + enum ButtonState + { + UP = 0, // Button is up + HELD = 1, // Button is held down + RELEASED = 2, // Button was just released + PRESSED = 3, // Buton was just pressed + }; + + ButtonState a; + ButtonState b; + ButtonState x; + ButtonState y; + + ButtonState leftStick; + ButtonState rightStick; + + ButtonState leftShoulder; + ButtonState rightShoulder; + + union + { + ButtonState back; + ButtonState view; + }; + + union + { + ButtonState start; + ButtonState menu; + }; + + ButtonState dpadUp; + ButtonState dpadDown; + ButtonState dpadLeft; + ButtonState dpadRight; + + ButtonState leftStickUp; + ButtonState leftStickDown; + ButtonState leftStickLeft; + ButtonState leftStickRight; + + ButtonState rightStickUp; + ButtonState rightStickDown; + ButtonState rightStickLeft; + ButtonState rightStickRight; + + ButtonState leftTrigger; + ButtonState rightTrigger; + + ButtonStateTracker() { Reset(); } + + void __cdecl Update( const State& state ); + + void __cdecl Reset(); + + State __cdecl GetLastState() const { return lastState; } + + private: + State lastState; + }; + + // Retrieve the current state of the gamepad of the associated player index + State __cdecl GetState(int player, DeadZone deadZoneMode = DEAD_ZONE_INDEPENDENT_AXES); + + // Retrieve the current capabilities of the gamepad of the associated player index + Capabilities __cdecl GetCapabilities(int player); + + // Set the vibration motor speeds of the gamepad + bool __cdecl SetVibration( int player, float leftMotor, float rightMotor, float leftTrigger = 0.f, float rightTrigger = 0.f ); + + // Handle suspending/resuming + void __cdecl Suspend(); + void __cdecl Resume(); + + // Singleton + static GamePad& __cdecl Get(); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/Inc/GeometricPrimitive.h b/Kits/DirectXTK12/Inc/GeometricPrimitive.h new file mode 100644 index 0000000000000000000000000000000000000000..8f89f9b544b32570ac2734b2b63c72aa7f79558c --- /dev/null +++ b/Kits/DirectXTK12/Inc/GeometricPrimitive.h @@ -0,0 +1,75 @@ +//-------------------------------------------------------------------------------------- +// File: GeometricPrimitive.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "VertexTypes.h" + +#include +#include + + +namespace DirectX +{ + class IEffect; + + class GeometricPrimitive + { + public: + GeometricPrimitive(GeometricPrimitive const&) = delete; + GeometricPrimitive& operator= (GeometricPrimitive const&) = delete; + + virtual ~GeometricPrimitive(); + + using VertexType = VertexPositionNormalTexture; + + // Factory methods. + static std::unique_ptr __cdecl CreateCube(float size = 1, bool rhcoords = true); + static std::unique_ptr __cdecl CreateBox(const XMFLOAT3& size, bool rhcoords = true, bool invertn = false); + static std::unique_ptr __cdecl CreateSphere(float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false); + static std::unique_ptr __cdecl CreateGeoSphere(float diameter = 1, size_t tessellation = 3, bool rhcoords = true); + static std::unique_ptr __cdecl CreateCylinder(float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true); + static std::unique_ptr __cdecl CreateCone(float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true); + static std::unique_ptr __cdecl CreateTorus(float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true); + static std::unique_ptr __cdecl CreateTetrahedron(float size = 1, bool rhcoords = true); + static std::unique_ptr __cdecl CreateOctahedron(float size = 1, bool rhcoords = true); + static std::unique_ptr __cdecl CreateDodecahedron(float size = 1, bool rhcoords = true); + static std::unique_ptr __cdecl CreateIcosahedron(float size = 1, bool rhcoords = true); + static std::unique_ptr __cdecl CreateTeapot(float size = 1, size_t tessellation = 8, bool rhcoords = true); + static std::unique_ptr __cdecl CreateCustom(const std::vector& vertices, const std::vector& indices); + + static void __cdecl CreateCube(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); + static void __cdecl CreateBox(std::vector& vertices, std::vector& indices, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false); + static void __cdecl CreateSphere(std::vector& vertices, std::vector& indices, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false); + static void __cdecl CreateGeoSphere(std::vector& vertices, std::vector& indices, float diameter = 1, size_t tessellation = 3, bool rhcoords = true); + static void __cdecl CreateCylinder(std::vector& vertices, std::vector& indices, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true); + static void __cdecl CreateCone(std::vector& vertices, std::vector& indices, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true); + static void __cdecl CreateTorus(std::vector& vertices, std::vector& indices, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true); + static void __cdecl CreateTetrahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); + static void __cdecl CreateOctahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); + static void __cdecl CreateDodecahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); + static void __cdecl CreateIcosahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); + static void __cdecl CreateTeapot(std::vector& vertices, std::vector& indices, float size = 1, size_t tessellation = 8, bool rhcoords = true); + + // Draw the primitive. + void __cdecl Draw(_In_ ID3D12GraphicsCommandList* commandList); + + private: + GeometricPrimitive(); + + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/Inc/GraphicsMemory.h b/Kits/DirectXTK12/Inc/GraphicsMemory.h new file mode 100644 index 0000000000000000000000000000000000000000..862e77f7dd37294445bf0f0d685b84898902778e --- /dev/null +++ b/Kits/DirectXTK12/Inc/GraphicsMemory.h @@ -0,0 +1,122 @@ +//-------------------------------------------------------------------------------------- +// File: GraphicsMemory.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include + + +namespace DirectX +{ + class LinearAllocatorPage; + + // Works a little like a smart pointer. The memory will only be fenced by the GPU once the pointer + // has been invalidated or the user explicitly marks it for fencing. + class GraphicsResource + { + public: + GraphicsResource(); + GraphicsResource( + _In_ LinearAllocatorPage* page, + _In_ D3D12_GPU_VIRTUAL_ADDRESS gpuAddress, + _In_ ID3D12Resource* resource, + _In_ void* memory, + _In_ size_t offset, + _In_ size_t size); + + GraphicsResource(GraphicsResource&& other); + GraphicsResource&& operator= (GraphicsResource&&); + + GraphicsResource(const GraphicsResource&) = delete; + GraphicsResource& operator= (const GraphicsResource&) = delete; + + ~GraphicsResource(); + + D3D12_GPU_VIRTUAL_ADDRESS GpuAddress() const { return mGpuAddress; } + ID3D12Resource* Resource() const { return mResource; } + void* Memory() const { return mMemory; } + size_t ResourceOffset() const { return mBufferOffset; } + size_t Size() const { return mSize; } + + // Clear the pointer. Using operator -> will produce bad results. + void __cdecl Reset(); + void __cdecl Reset(GraphicsResource&&); + + private: + LinearAllocatorPage* mPage; + D3D12_GPU_VIRTUAL_ADDRESS mGpuAddress; + ID3D12Resource* mResource; + void* mMemory; + size_t mBufferOffset; + size_t mSize; + }; + + class GraphicsMemory + { + public: + explicit GraphicsMemory(_In_ ID3D12Device* device); + + GraphicsMemory(GraphicsMemory&& moveFrom); + GraphicsMemory& operator= (GraphicsMemory&& moveFrom); + + GraphicsMemory(GraphicsMemory const&) = delete; + GraphicsMemory& operator=(GraphicsMemory const&) = delete; + + virtual ~GraphicsMemory(); + + // Make sure to keep the GraphicsResource handle alive as long as you need to access + // the memory on the CPU. For example, do not simply cache GpuAddress() and discard + // the GraphicsResource object, or your memory may be overwritten later. + GraphicsResource __cdecl Allocate(size_t size, size_t alignment = 0); + + // Special overload of Allocate that aligns to D3D12 constant buffer alignment requirements + template GraphicsResource AllocateConstant() + { + const size_t alignment = D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT; + const size_t alignedSize = (sizeof(T) + alignment - 1) & ~(alignment - 1); + return std::move(Allocate(alignedSize, alignment)); + } + template GraphicsResource AllocateConstant(const T& setData) + { + GraphicsResource alloc = AllocateConstant(); + memcpy(alloc.Memory(), &setData, sizeof(T)); + return std::move(alloc); + } + + // Submits all the pending one-shot memory to the GPU. + // The memory will be recycled once the GPU is done with it. + void __cdecl Commit(_In_ ID3D12CommandQueue* commandQueue); + + // This frees up any unused memory. + // If you want to make sure all memory is reclaimed, idle the GPU before calling this. + // It is not recommended that you call this unless absolutely necessary (e.g. your + // memory budget changes at run-time, or perhaps you're changing levels in your game.) + void __cdecl GarbageCollect(); + + // Singleton + static GraphicsMemory& __cdecl Get(); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} + diff --git a/Kits/DirectXTK12/Inc/Keyboard.h b/Kits/DirectXTK12/Inc/Keyboard.h new file mode 100644 index 0000000000000000000000000000000000000000..d224f67d950b4b82625830000ddab56bdab05fa1 --- /dev/null +++ b/Kits/DirectXTK12/Inc/Keyboard.h @@ -0,0 +1,479 @@ +//-------------------------------------------------------------------------------------- +// File: Keyboard.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include +#include + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } } +#endif + + +namespace DirectX +{ + class Keyboard + { + public: + Keyboard(); + Keyboard(Keyboard&& moveFrom); + Keyboard& operator= (Keyboard&& moveFrom); + + Keyboard(Keyboard const&) = delete; + Keyboard& operator=(Keyboard const&) = delete; + + virtual ~Keyboard(); + + enum Keys + { + None = 0, + + Back = 0x8, + Tab = 0x9, + + Enter = 0xd, + + Pause = 0x13, + CapsLock = 0x14, + Kana = 0x15, + + Kanji = 0x19, + + Escape = 0x1b, + ImeConvert = 0x1c, + ImeNoConvert = 0x1d, + + Space = 0x20, + PageUp = 0x21, + PageDown = 0x22, + End = 0x23, + Home = 0x24, + Left = 0x25, + Up = 0x26, + Right = 0x27, + Down = 0x28, + Select = 0x29, + Print = 0x2a, + Execute = 0x2b, + PrintScreen = 0x2c, + Insert = 0x2d, + Delete = 0x2e, + Help = 0x2f, + D0 = 0x30, + D1 = 0x31, + D2 = 0x32, + D3 = 0x33, + D4 = 0x34, + D5 = 0x35, + D6 = 0x36, + D7 = 0x37, + D8 = 0x38, + D9 = 0x39, + + A = 0x41, + B = 0x42, + C = 0x43, + D = 0x44, + E = 0x45, + F = 0x46, + G = 0x47, + H = 0x48, + I = 0x49, + J = 0x4a, + K = 0x4b, + L = 0x4c, + M = 0x4d, + N = 0x4e, + O = 0x4f, + P = 0x50, + Q = 0x51, + R = 0x52, + S = 0x53, + T = 0x54, + U = 0x55, + V = 0x56, + W = 0x57, + X = 0x58, + Y = 0x59, + Z = 0x5a, + LeftWindows = 0x5b, + RightWindows = 0x5c, + Apps = 0x5d, + + Sleep = 0x5f, + NumPad0 = 0x60, + NumPad1 = 0x61, + NumPad2 = 0x62, + NumPad3 = 0x63, + NumPad4 = 0x64, + NumPad5 = 0x65, + NumPad6 = 0x66, + NumPad7 = 0x67, + NumPad8 = 0x68, + NumPad9 = 0x69, + Multiply = 0x6a, + Add = 0x6b, + Separator = 0x6c, + Subtract = 0x6d, + + Decimal = 0x6e, + Divide = 0x6f, + F1 = 0x70, + F2 = 0x71, + F3 = 0x72, + F4 = 0x73, + F5 = 0x74, + F6 = 0x75, + F7 = 0x76, + F8 = 0x77, + F9 = 0x78, + F10 = 0x79, + F11 = 0x7a, + F12 = 0x7b, + F13 = 0x7c, + F14 = 0x7d, + F15 = 0x7e, + F16 = 0x7f, + F17 = 0x80, + F18 = 0x81, + F19 = 0x82, + F20 = 0x83, + F21 = 0x84, + F22 = 0x85, + F23 = 0x86, + F24 = 0x87, + + NumLock = 0x90, + Scroll = 0x91, + + LeftShift = 0xa0, + RightShift = 0xa1, + LeftControl = 0xa2, + RightControl = 0xa3, + LeftAlt = 0xa4, + RightAlt = 0xa5, + BrowserBack = 0xa6, + BrowserForward = 0xa7, + BrowserRefresh = 0xa8, + BrowserStop = 0xa9, + BrowserSearch = 0xaa, + BrowserFavorites = 0xab, + BrowserHome = 0xac, + VolumeMute = 0xad, + VolumeDown = 0xae, + VolumeUp = 0xaf, + MediaNextTrack = 0xb0, + MediaPreviousTrack = 0xb1, + MediaStop = 0xb2, + MediaPlayPause = 0xb3, + LaunchMail = 0xb4, + SelectMedia = 0xb5, + LaunchApplication1 = 0xb6, + LaunchApplication2 = 0xb7, + + OemSemicolon = 0xba, + OemPlus = 0xbb, + OemComma = 0xbc, + OemMinus = 0xbd, + OemPeriod = 0xbe, + OemQuestion = 0xbf, + OemTilde = 0xc0, + + OemOpenBrackets = 0xdb, + OemPipe = 0xdc, + OemCloseBrackets = 0xdd, + OemQuotes = 0xde, + Oem8 = 0xdf, + + OemBackslash = 0xe2, + + ProcessKey = 0xe5, + + OemCopy = 0xf2, + OemAuto = 0xf3, + OemEnlW = 0xf4, + + Attn = 0xf6, + Crsel = 0xf7, + Exsel = 0xf8, + EraseEof = 0xf9, + Play = 0xfa, + Zoom = 0xfb, + + Pa1 = 0xfd, + OemClear = 0xfe, + }; + + struct State + { + bool Reserved0 : 8; + bool Back : 1; // VK_BACK, 0x8 + bool Tab : 1; // VK_TAB, 0x9 + bool Reserved1 : 3; + bool Enter : 1; // VK_RETURN, 0xD + bool Reserved2 : 2; + bool Reserved3 : 3; + bool Pause : 1; // VK_PAUSE, 0x13 + bool CapsLock : 1; // VK_CAPITAL, 0x14 + bool Kana : 1; // VK_KANA, 0x15 + bool Reserved4 : 2; + bool Reserved5 : 1; + bool Kanji : 1; // VK_KANJI, 0x19 + bool Reserved6 : 1; + bool Escape : 1; // VK_ESCAPE, 0x1B + bool ImeConvert : 1; // VK_CONVERT, 0x1C + bool ImeNoConvert : 1; // VK_NONCONVERT, 0x1D + bool Reserved7 : 2; + bool Space : 1; // VK_SPACE, 0x20 + bool PageUp : 1; // VK_PRIOR, 0x21 + bool PageDown : 1; // VK_NEXT, 0x22 + bool End : 1; // VK_END, 0x23 + bool Home : 1; // VK_HOME, 0x24 + bool Left : 1; // VK_LEFT, 0x25 + bool Up : 1; // VK_UP, 0x26 + bool Right : 1; // VK_RIGHT, 0x27 + bool Down : 1; // VK_DOWN, 0x28 + bool Select : 1; // VK_SELECT, 0x29 + bool Print : 1; // VK_PRINT, 0x2A + bool Execute : 1; // VK_EXECUTE, 0x2B + bool PrintScreen : 1; // VK_SNAPSHOT, 0x2C + bool Insert : 1; // VK_INSERT, 0x2D + bool Delete : 1; // VK_DELETE, 0x2E + bool Help : 1; // VK_HELP, 0x2F + bool D0 : 1; // 0x30 + bool D1 : 1; // 0x31 + bool D2 : 1; // 0x32 + bool D3 : 1; // 0x33 + bool D4 : 1; // 0x34 + bool D5 : 1; // 0x35 + bool D6 : 1; // 0x36 + bool D7 : 1; // 0x37 + bool D8 : 1; // 0x38 + bool D9 : 1; // 0x39 + bool Reserved8 : 6; + bool Reserved9 : 1; + bool A : 1; // 0x41 + bool B : 1; // 0x42 + bool C : 1; // 0x43 + bool D : 1; // 0x44 + bool E : 1; // 0x45 + bool F : 1; // 0x46 + bool G : 1; // 0x47 + bool H : 1; // 0x48 + bool I : 1; // 0x49 + bool J : 1; // 0x4A + bool K : 1; // 0x4B + bool L : 1; // 0x4C + bool M : 1; // 0x4D + bool N : 1; // 0x4E + bool O : 1; // 0x4F + bool P : 1; // 0x50 + bool Q : 1; // 0x51 + bool R : 1; // 0x52 + bool S : 1; // 0x53 + bool T : 1; // 0x54 + bool U : 1; // 0x55 + bool V : 1; // 0x56 + bool W : 1; // 0x57 + bool X : 1; // 0x58 + bool Y : 1; // 0x59 + bool Z : 1; // 0x5A + bool LeftWindows : 1; // VK_LWIN, 0x5B + bool RightWindows : 1; // VK_RWIN, 0x5C + bool Apps : 1; // VK_APPS, 0x5D + bool Reserved10 : 1; + bool Sleep : 1; // VK_SLEEP, 0x5F + bool NumPad0 : 1; // VK_NUMPAD0, 0x60 + bool NumPad1 : 1; // VK_NUMPAD1, 0x61 + bool NumPad2 : 1; // VK_NUMPAD2, 0x62 + bool NumPad3 : 1; // VK_NUMPAD3, 0x63 + bool NumPad4 : 1; // VK_NUMPAD4, 0x64 + bool NumPad5 : 1; // VK_NUMPAD5, 0x65 + bool NumPad6 : 1; // VK_NUMPAD6, 0x66 + bool NumPad7 : 1; // VK_NUMPAD7, 0x67 + bool NumPad8 : 1; // VK_NUMPAD8, 0x68 + bool NumPad9 : 1; // VK_NUMPAD9, 0x69 + bool Multiply : 1; // VK_MULTIPLY, 0x6A + bool Add : 1; // VK_ADD, 0x6B + bool Separator : 1; // VK_SEPARATOR, 0x6C + bool Subtract : 1; // VK_SUBTRACT, 0x6D + bool Decimal : 1; // VK_DECIMANL, 0x6E + bool Divide : 1; // VK_DIVIDE, 0x6F + bool F1 : 1; // VK_F1, 0x70 + bool F2 : 1; // VK_F2, 0x71 + bool F3 : 1; // VK_F3, 0x72 + bool F4 : 1; // VK_F4, 0x73 + bool F5 : 1; // VK_F5, 0x74 + bool F6 : 1; // VK_F6, 0x75 + bool F7 : 1; // VK_F7, 0x76 + bool F8 : 1; // VK_F8, 0x77 + bool F9 : 1; // VK_F9, 0x78 + bool F10 : 1; // VK_F10, 0x79 + bool F11 : 1; // VK_F11, 0x7A + bool F12 : 1; // VK_F12, 0x7B + bool F13 : 1; // VK_F13, 0x7C + bool F14 : 1; // VK_F14, 0x7D + bool F15 : 1; // VK_F15, 0x7E + bool F16 : 1; // VK_F16, 0x7F + bool F17 : 1; // VK_F17, 0x80 + bool F18 : 1; // VK_F18, 0x81 + bool F19 : 1; // VK_F19, 0x82 + bool F20 : 1; // VK_F20, 0x83 + bool F21 : 1; // VK_F21, 0x84 + bool F22 : 1; // VK_F22, 0x85 + bool F23 : 1; // VK_F23, 0x86 + bool F24 : 1; // VK_F24, 0x87 + bool Reserved11 : 8; + bool NumLock : 1; // VK_NUMLOCK, 0x90 + bool Scroll : 1; // VK_SCROLL, 0x91 + bool Reserved12 : 6; + bool Reserved13 : 8; + bool LeftShift : 1; // VK_LSHIFT, 0xA0 + bool RightShift : 1; // VK_RSHIFT, 0xA1 + bool LeftControl : 1; // VK_LCONTROL, 0xA2 + bool RightControl : 1; // VK_RCONTROL, 0xA3 + bool LeftAlt : 1; // VK_LMENU, 0xA4 + bool RightAlt : 1; // VK_RMENU, 0xA5 + bool BrowserBack : 1; // VK_BROWSER_BACK, 0xA6 + bool BrowserForward : 1; // VK_BROWSER_FORWARD, 0xA7 + bool BrowserRefresh : 1; // VK_BROWSER_REFRESH, 0xA8 + bool BrowserStop : 1; // VK_BROWSER_STOP, 0xA9 + bool BrowserSearch : 1; // VK_BROWSER_SEARCH, 0xAA + bool BrowserFavorites : 1; // VK_BROWSER_FAVORITES, 0xAB + bool BrowserHome : 1; // VK_BROWSER_HOME, 0xAC + bool VolumeMute : 1; // VK_VOLUME_MUTE, 0xAD + bool VolumeDown : 1; // VK_VOLUME_DOWN, 0xAE + bool VolumeUp : 1; // VK_VOLUME_UP, 0xAF + bool MediaNextTrack : 1; // VK_MEDIA_NEXT_TRACK, 0xB0 + bool MediaPreviousTrack : 1;// VK_MEDIA_PREV_TRACK, 0xB1 + bool MediaStop : 1; // VK_MEDIA_STOP, 0xB2 + bool MediaPlayPause : 1; // VK_MEDIA_PLAY_PAUSE, 0xB3 + bool LaunchMail : 1; // VK_LAUNCH_MAIL, 0xB4 + bool SelectMedia : 1; // VK_LAUNCH_MEDIA_SELECT, 0xB5 + bool LaunchApplication1 : 1;// VK_LAUNCH_APP1, 0xB6 + bool LaunchApplication2 : 1;// VK_LAUNCH_APP2, 0xB7 + bool Reserved14 : 2; + bool OemSemicolon : 1; // VK_OEM_1, 0xBA + bool OemPlus : 1; // VK_OEM_PLUS, 0xBB + bool OemComma : 1; // VK_OEM_COMMA, 0xBC + bool OemMinus : 1; // VK_OEM_MINUS, 0xBD + bool OemPeriod : 1; // VK_OEM_PERIOD, 0xBE + bool OemQuestion : 1; // VK_OEM_2, 0xBF + bool OemTilde : 1; // VK_OEM_3, 0xC0 + bool Reserved15 : 7; + bool Reserved16 : 8; + bool Reserved17 : 8; + bool Reserved18 : 3; + bool OemOpenBrackets : 1; // VK_OEM_4, 0xDB + bool OemPipe : 1; // VK_OEM_5, 0xDC + bool OemCloseBrackets : 1; // VK_OEM_6, 0xDD + bool OemQuotes : 1; // VK_OEM_7, 0xDE + bool Oem8 : 1; // VK_OEM_8, 0xDF + bool Reserved19 : 2; + bool OemBackslash : 1; // VK_OEM_102, 0xE2 + bool Reserved20 : 2; + bool ProcessKey : 1; // VK_PROCESSKEY, 0xE5 + bool Reserved21 : 2; + bool Reserved22 : 8; + bool Reserved23 : 2; + bool OemCopy : 1; // 0XF2 + bool OemAuto : 1; // 0xF3 + bool OemEnlW : 1; // 0xF4 + bool Reserved24 : 1; + bool Attn : 1; // VK_ATTN, 0xF6 + bool Crsel : 1; // VK_CRSEL, 0xF7 + bool Exsel : 1; // VK_EXSEL, 0xF8 + bool EraseEof : 1; // VK_EREOF, 0xF9 + bool Play : 1; // VK_PLAY, 0xFA + bool Zoom : 1; // VK_ZOOM, 0xFB + bool Reserved25 : 1; + bool Pa1 : 1; // VK_PA1, 0xFD + bool OemClear : 1; // VK_OEM_CLEAR, 0xFE + bool Reserved26: 1; + + bool __cdecl IsKeyDown(Keys key) const + { + if (key >= 0 && key <= 0xff) + { + auto ptr = reinterpret_cast(this); + unsigned int bf = 1u << (key & 0x1f); + return (ptr[(key >> 5)] & bf) != 0; + } + return false; + } + + bool __cdecl IsKeyUp(Keys key) const + { + if (key >= 0 && key <= 0xfe) + { + auto ptr = reinterpret_cast(this); + unsigned int bf = 1u << (key & 0x1f); + return (ptr[(key >> 5)] & bf) == 0; + } + return false; + } + }; + + class KeyboardStateTracker + { + public: + State released; + State pressed; + + KeyboardStateTracker() { Reset(); } + + void __cdecl Update(const State& state); + + void __cdecl Reset(); + + bool __cdecl IsKeyPressed(Keys key) const { return pressed.IsKeyDown(key); } + bool __cdecl IsKeyReleased(Keys key) const { return released.IsKeyDown(key); } + + State __cdecl GetLastState() const { return lastState; } + + public: + State lastState; + }; + + // Retrieve the current state of the keyboard + State __cdecl GetState() const; + + // Reset the keyboard state + void __cdecl Reset(); + +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) && defined(WM_USER) + static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam); +#endif + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) + void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window); +#ifdef __cplusplus_winrt + void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window) + { + // See https://msdn.microsoft.com/en-us/library/hh755802.aspx + SetWindow(reinterpret_cast(window)); + } +#endif +#endif + + // Singleton + static Keyboard& __cdecl Get(); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/Inc/Model.h b/Kits/DirectXTK12/Inc/Model.h new file mode 100644 index 0000000000000000000000000000000000000000..d003abfe28188682bd11850bc0e8ecc4454bb4d3 --- /dev/null +++ b/Kits/DirectXTK12/Inc/Model.h @@ -0,0 +1,287 @@ +//-------------------------------------------------------------------------------------- +// File: Model.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GraphicsMemory.h" +#include "Effects.h" + + +namespace DirectX +{ + class IEffect; + class IEffectFactory; + class CommonStates; + class ModelMesh; + + //---------------------------------------------------------------------------------- + // Each mesh part is a submesh with a single effect + class ModelMeshPart + { + public: + ModelMeshPart(); + virtual ~ModelMeshPart(); + + uint32_t materialIndex; + uint32_t indexCount; + uint32_t startIndex; + uint32_t vertexOffset; + uint32_t vertexStride; + D3D_PRIMITIVE_TOPOLOGY primitiveType; + DXGI_FORMAT indexFormat; + GraphicsResource indexBuffer; + GraphicsResource vertexBuffer; + std::shared_ptr> vbDecl; + bool isAlpha; + + using Collection = std::vector>; + using DrawCallback = std::function; + + // Draw mesh part + void __cdecl Draw(_In_ ID3D12GraphicsCommandList* commandList) const; + + // + // Utilities for drawing multiple mesh parts + // + + // Draw the mesh + static void __cdecl DrawMeshParts(_In_ ID3D12GraphicsCommandList* commandList, _In_ const ModelMeshPart::Collection& meshParts); + + // Draw the mesh with an effect + static void __cdecl DrawMeshParts(_In_ ID3D12GraphicsCommandList* commandList, _In_ const ModelMeshPart::Collection& meshParts, _In_ IEffect* effect); + + // Draw the mesh with a callback for each mesh part + static void __cdecl DrawMeshParts(_In_ ID3D12GraphicsCommandList* commandList, _In_ const ModelMeshPart::Collection& meshParts, DrawCallback callback); + + // Draw the mesh with a range of effects that mesh parts will index into. + // Effects can be any IEffect pointer type (including smart pointer). Value or reference types will not compile. + // The iterator passed to this method should have random access capabilities for best performance. + template + static void DrawMeshParts( + _In_ ID3D12GraphicsCommandList* commandList, + _In_ const ModelMeshPart::Collection& meshParts, + TEffectIterator effects) + { + // This assert is here to prevent accidental use of containers that would cause undesirable performance penalties. + static_assert( + std::is_base_of::value, + "Providing an iterator without random access capabilities -- such as from std::list -- is not supported."); + + for ( auto it = std::begin(meshParts); it != std::end(meshParts); ++it ) + { + auto part = it->get(); + assert(part != nullptr); + + // Get the effect at the location specified by the part's material + TEffectIterator effect_iterator = effects; + std::advance(effect_iterator, part->materialIndex); + + // Apply the effect and draw + (*effect_iterator)->Apply(commandList); + part->Draw(commandList); + } + } + }; + + + //---------------------------------------------------------------------------------- + // A mesh consists of one or more model mesh parts + class ModelMesh + { + public: + ModelMesh(); + virtual ~ModelMesh(); + + BoundingSphere boundingSphere; + BoundingBox boundingBox; + ModelMeshPart::Collection opaqueMeshParts; + ModelMeshPart::Collection alphaMeshParts; + std::wstring name; + bool ccw; + bool pmalpha; + + using Collection = std::vector>; + + // Draw the mesh + void __cdecl DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList) const; + void __cdecl DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList) const; + + // Draw the mesh with an effect + void __cdecl DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, _In_ IEffect* effect) const; + void __cdecl DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, _In_ IEffect* effect) const; + + // Draw the mesh with a callback for each mesh part + void __cdecl DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, ModelMeshPart::DrawCallback callback) const; + void __cdecl DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, ModelMeshPart::DrawCallback callback) const; + + // Draw the mesh with a range of effects that mesh parts will index into. + // TEffectPtr can be any IEffect pointer type (including smart pointer). Value or reference types will not compile. + template + void DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, TEffectIterator effects) const + { + ModelMeshPart::DrawMeshParts(commandList, opaqueMeshParts, effects); + } + template + void DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, TEffectIterator effects) const + { + ModelMeshPart::DrawMeshParts(commandList, alphaMeshParts, effects); + } + }; + + + //---------------------------------------------------------------------------------- + // A model consists of one or more meshes + class Model + { + public: + Model(); + virtual ~Model(); + + using ModelMaterialInfo = IEffectFactory::EffectInfo; + using ModelMaterialInfoCollection = std::vector; + using TextureCollection = std::vector; + + // + // NOTE + // + // The Model::Draw functions use variadic templates and perfect-forwarding in order to support future overloads to the ModelMesh::Draw + // family of functions. This means that a new ModelMesh::Draw overload can be added, removed or altered, but the Model::Draw* routines + // will still remain compatible. The correct ModelMesh::Draw overload will be selected by the compiler depending on the arguments you + // provide to Model::Draw*. + // + + // Draw all the opaque meshes in the model + template void DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, _In_opt_ TForwardArgs&&... args) const + { + // Draw opaque parts + for ( auto it = std::begin(meshes); it != std::end(meshes); ++it ) + { + auto mesh = it->get(); + assert( mesh != nullptr ); + + mesh->DrawOpaque(commandList, std::forward(args)...); + } + } + + // Draw all the alpha meshes in the model + template void DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, _In_opt_ TForwardArgs&&... args) const + { + // Draw opaque parts + for ( auto it = std::begin(meshes); it != std::end(meshes); ++it ) + { + auto mesh = it->get(); + assert( mesh != nullptr ); + + mesh->DrawAlpha(commandList, std::forward(args)...); + } + } + + // Draw all the meshes in the model + template void Draw(_In_ ID3D12GraphicsCommandList* commandList, _In_opt_ TForwardArgs&&... args) const + { + DrawOpaque(commandList, std::forward(args)...); + DrawAlpha(commandList, std::forward(args)...); + } + + // Load texture resources into an existing Effect Texture Factory + void __cdecl LoadTextures(_In_ IEffectTextureFactory& texFactory, _In_opt_ int destinationDescriptorOffset = 0); + + // Load texture resources into a new Effect Texture Factory + std::unique_ptr __cdecl LoadTextures( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_opt_z_ const wchar_t* texturesPath = nullptr, + _In_opt_ D3D12_DESCRIPTOR_HEAP_FLAGS flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE); + + // Create effects using the default effect factory + std::vector> __cdecl CreateEffects( + _In_ const EffectPipelineStateDescription& pipelineState, + _In_ ID3D12DescriptorHeap* gpuVisibleTextureDescriptorHeap, + _In_opt_ int baseDescriptorOffset = 0); + + // Create effects using a custom effect factory + std::vector> __cdecl CreateEffects( + _In_ IEffectFactory& fxFactory, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_opt_ int baseDescriptorOffset = 0); + + // Loads a model from a DirectX SDK .SDKMESH file + static std::unique_ptr __cdecl CreateFromSDKMESH( _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize, + bool ccw = false, bool pmalpha = false ); + static std::unique_ptr __cdecl CreateFromSDKMESH( _In_z_ const wchar_t* szFileName, + bool ccw = false, bool pmalpha = false ); + + // Loads a model from a .VBO file + static std::unique_ptr __cdecl CreateFromVBO( _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize, + bool ccw = false, bool pmalpha = false ); + static std::unique_ptr __cdecl CreateFromVBO( _In_z_ const wchar_t* szFileName, + bool ccw = false, bool pmalpha = false ); + + // Utility function for getting a GPU descriptor for a mesh part/material index. If there is no texture the + // descriptor will be zero. + D3D12_GPU_DESCRIPTOR_HANDLE GetGpuTextureHandleForMaterialIndex(uint32_t materialIndex, _In_ ID3D12DescriptorHeap* heap, _In_ size_t descriptorSize, _In_ size_t descriptorOffset) const + { + D3D12_GPU_DESCRIPTOR_HANDLE handle = {}; + + if (materialIndex >= materials.size()) + return handle; + + int textureIndex = materials[materialIndex].textureIndex; + if (textureIndex == -1) + return handle; + + handle = heap->GetGPUDescriptorHandleForHeapStart(); + handle.ptr += descriptorSize * ((size_t) textureIndex + descriptorOffset); + + return handle; + } + + // Utility function for updating the matrices in a list of effects. This will SetWorld, SetView and SetProjection + // on any effect in the list that derives from IEffectMatrices. + static void XM_CALLCONV UpdateEffectMatrices( + _In_ std::vector>& effectList, + DirectX::FXMMATRIX world, + DirectX::CXMMATRIX view, + DirectX::CXMMATRIX proj); + + ModelMesh::Collection meshes; + ModelMaterialInfoCollection materials; + TextureCollection textureNames; + std::wstring name; + + private: + std::shared_ptr __cdecl CreateEffectForMeshPart( + _In_ IEffectFactory& fxFactory, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_opt_ int descriptorOffset, + _In_ const ModelMeshPart* part) const; + }; + } diff --git a/Kits/DirectXTK12/Inc/Mouse.h b/Kits/DirectXTK12/Inc/Mouse.h new file mode 100644 index 0000000000000000000000000000000000000000..6e04e3f56c2bfc546431e3d7c3eb78237d65cccb --- /dev/null +++ b/Kits/DirectXTK12/Inc/Mouse.h @@ -0,0 +1,120 @@ +//-------------------------------------------------------------------------------------- +// File: Mouse.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } } +#endif + + +namespace DirectX +{ + class Mouse + { + public: + Mouse(); + Mouse(Mouse&& moveFrom); + Mouse& operator= (Mouse&& moveFrom); + + Mouse(Mouse const&) = delete; + Mouse& operator=(Mouse const&) = delete; + + virtual ~Mouse(); + + enum Mode + { + MODE_ABSOLUTE = 0, + MODE_RELATIVE, + }; + + struct State + { + bool leftButton; + bool middleButton; + bool rightButton; + bool xButton1; + bool xButton2; + int x; + int y; + int scrollWheelValue; + Mode positionMode; + }; + + class ButtonStateTracker + { + public: + enum ButtonState + { + UP = 0, // Button is up + HELD = 1, // Button is held down + RELEASED = 2, // Button was just released + PRESSED = 3, // Buton was just pressed + }; + + ButtonState leftButton; + ButtonState middleButton; + ButtonState rightButton; + ButtonState xButton1; + ButtonState xButton2; + + ButtonStateTracker() { Reset(); } + + void __cdecl Update( const State& state ); + + void __cdecl Reset(); + + State __cdecl GetLastState() const { return lastState; } + + private: + State lastState; + }; + + // Retrieve the current state of the mouse + State __cdecl GetState() const; + + // Resets the accumulated scroll wheel value + void __cdecl ResetScrollWheelValue(); + + // Sets mouse mode (defaults to absolute) + void __cdecl SetMode(Mode mode); + +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) && defined(WM_USER) + void __cdecl SetWindow(HWND window); + static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam); +#endif + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) + void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window); +#ifdef __cplusplus_winrt + void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window) + { + // See https://msdn.microsoft.com/en-us/library/hh755802.aspx + SetWindow(reinterpret_cast(window)); + } +#endif + static void __cdecl SetDpi(float dpi); +#endif + + // Singleton + static Mouse& __cdecl Get(); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/Kits/DirectXTK12/Inc/PrimitiveBatch.h b/Kits/DirectXTK12/Inc/PrimitiveBatch.h new file mode 100644 index 0000000000000000000000000000000000000000..f068e1464b18a25b740973f483292865123e3034 --- /dev/null +++ b/Kits/DirectXTK12/Inc/PrimitiveBatch.h @@ -0,0 +1,144 @@ +//-------------------------------------------------------------------------------------- +// File: PrimitiveBatch.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include + + +namespace DirectX +{ + namespace Internal + { + // Base class, not to be used directly: clients should access this via the derived PrimitiveBatch. + class PrimitiveBatchBase + { + protected: + PrimitiveBatchBase(_In_ ID3D12Device* device, size_t maxIndices, size_t maxVertices, size_t vertexSize); + + PrimitiveBatchBase(PrimitiveBatchBase&& moveFrom); + PrimitiveBatchBase& operator= (PrimitiveBatchBase&& moveFrom); + + PrimitiveBatchBase(PrimitiveBatchBase const&) = delete; + PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) = delete; + + virtual ~PrimitiveBatchBase(); + + public: + // Begin/End a batch of primitive drawing operations. + void __cdecl Begin( _In_ ID3D12GraphicsCommandList* cmdList ); + void __cdecl End(); + + protected: + // Internal, untyped drawing method. + void __cdecl Draw(D3D_PRIMITIVE_TOPOLOGY topology, bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, size_t indexCount, size_t vertexCount, _Outptr_ void** pMappedVertices); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + } + + + // Template makes the API typesafe, eg. PrimitiveBatch. + template + class PrimitiveBatch : public Internal::PrimitiveBatchBase + { + static const size_t DefaultBatchSize = 4096; + + public: + explicit PrimitiveBatch(_In_ ID3D12Device* device, size_t maxIndices = DefaultBatchSize * 3, size_t maxVertices = DefaultBatchSize) + : PrimitiveBatchBase(device, maxIndices, maxVertices, sizeof(TVertex)) + { } + + PrimitiveBatch(PrimitiveBatch&& moveFrom) + : PrimitiveBatchBase(std::move(moveFrom)) + { } + + PrimitiveBatch& operator= (PrimitiveBatch&& moveFrom) + { + PrimitiveBatchBase::operator=(std::move(moveFrom)); + return *this; + } + + + // Similar to the D3D9 API DrawPrimitiveUP. + void Draw(D3D_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) + { + void* mappedVertices; + + PrimitiveBatchBase::Draw(topology, false, nullptr, 0, vertexCount, &mappedVertices); + + memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex)); + } + + + // Similar to the D3D9 API DrawIndexedPrimitiveUP. + void DrawIndexed(D3D_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) + { + void* mappedVertices; + + PrimitiveBatchBase::Draw(topology, true, indices, indexCount, vertexCount, &mappedVertices); + + memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex)); + } + + + void DrawLine(TVertex const& v1, TVertex const& v2) + { + TVertex* mappedVertices; + + PrimitiveBatchBase::Draw(D3D_PRIMITIVE_TOPOLOGY_LINELIST, false, nullptr, 0, 2, reinterpret_cast(&mappedVertices)); + + mappedVertices[0] = v1; + mappedVertices[1] = v2; + } + + + void DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3) + { + TVertex* mappedVertices; + + PrimitiveBatchBase::Draw(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, false, nullptr, 0, 3, reinterpret_cast(&mappedVertices)); + + mappedVertices[0] = v1; + mappedVertices[1] = v2; + mappedVertices[2] = v3; + } + + + void DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4) + { + static const uint16_t quadIndices[] = { 0, 1, 2, 0, 2, 3 }; + + TVertex* mappedVertices; + + PrimitiveBatchBase::Draw(D3D_PRIMITIVE_TOPOLOGY_QUADLIST, true, quadIndices, 6, 4, reinterpret_cast(&mappedVertices)); + + mappedVertices[0] = v1; + mappedVertices[1] = v2; + mappedVertices[2] = v3; + mappedVertices[3] = v4; + } + }; +} diff --git a/Kits/DirectXTK12/Inc/RenderTargetState.h b/Kits/DirectXTK12/Inc/RenderTargetState.h new file mode 100644 index 0000000000000000000000000000000000000000..0e6880496cf49cacdce346e9085f93826c25a4c7 --- /dev/null +++ b/Kits/DirectXTK12/Inc/RenderTargetState.h @@ -0,0 +1,77 @@ +//-------------------------------------------------------------------------------------- +// File: RenderTargetState.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +namespace DirectX +{ + // Encapsulates all render target state when creating pipeline state objects + class RenderTargetState + { + public: + RenderTargetState::RenderTargetState() + : sampleDesc{} + , rtvFormats{} + , sampleMask(~0U) + , numRenderTargets(0) + , dsvFormat(DXGI_FORMAT_UNKNOWN) + , nodeMask(0) + { + } + + RenderTargetState::RenderTargetState(const RenderTargetState& o) = default; + + // Single render target convenience constructor + RenderTargetState::RenderTargetState( + _In_ DXGI_FORMAT rtFormat, + _In_ DXGI_FORMAT dsFormat) + : sampleMask(UINT_MAX) + , sampleDesc{} + , rtvFormats{} + , numRenderTargets(1) + , dsvFormat(dsFormat) + , nodeMask(0) + { + sampleDesc.Count = 1; + rtvFormats[0] = rtFormat; + } + + // Convenience constructor converting from DXGI_SWAPCHAIN_DESC + RenderTargetState::RenderTargetState( + _In_ const DXGI_SWAP_CHAIN_DESC* desc, + _In_ DXGI_FORMAT dsFormat) + : sampleMask(UINT_MAX) + , sampleDesc{} + , rtvFormats{} + , numRenderTargets(1) + , dsvFormat(dsFormat) + , nodeMask(0) + { + rtvFormats[0] = desc->BufferDesc.Format; + sampleDesc = desc->SampleDesc; + } + + uint32_t sampleMask; + uint32_t numRenderTargets; + DXGI_FORMAT rtvFormats[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT]; + DXGI_FORMAT dsvFormat; + DXGI_SAMPLE_DESC sampleDesc; + uint32_t nodeMask; + }; +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Inc/ResourceUploadBatch.h b/Kits/DirectXTK12/Inc/ResourceUploadBatch.h new file mode 100644 index 0000000000000000000000000000000000000000..2f4948f601e8f561b4af6813cfee5e47c11ab175 --- /dev/null +++ b/Kits/DirectXTK12/Inc/ResourceUploadBatch.h @@ -0,0 +1,73 @@ +//-------------------------------------------------------------------------------------- +// File: ResourceUploadBatch.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include + + +namespace DirectX +{ + // Has a command list of it's own so it can upload at any time. + class ResourceUploadBatch + { + public: + explicit ResourceUploadBatch(_In_ ID3D12Device* device); + ResourceUploadBatch(ResourceUploadBatch&& moveFrom); + ResourceUploadBatch& operator= (ResourceUploadBatch&& moveFrom); + + ResourceUploadBatch(ResourceUploadBatch const&) = delete; + ResourceUploadBatch& operator= (ResourceUploadBatch const&) = delete; + + virtual ~ResourceUploadBatch(); + + // Call this before your multiple calls to Upload. + void __cdecl Begin(); + + // Asynchronously uploads a resource. The memory in subRes is copied. + // The resource must be in the COPY_DEST state. + void __cdecl Upload( + _In_ ID3D12Resource* resource, + _In_ uint32_t subresourceIndexStart, + _In_reads_( numSubresources ) D3D12_SUBRESOURCE_DATA* subRes, + _In_ uint32_t numSubresources); + + // Asynchronously generate mips from a resource. + // Resource must be in the PIXEL_SHADER_RESOURCE state + void __cdecl GenerateMips(_In_ ID3D12Resource* resource); + + // Transition a resource once you're done with it + void __cdecl Transition( + _In_ ID3D12Resource* resource, + _In_ D3D12_RESOURCE_STATES stateBefore, + _In_ D3D12_RESOURCE_STATES stateAfter); + + // Submits all the uploads to the driver. + // No more uploads can happen after this call until Begin is called again. + // This returns a handle to an event that can be waited on. + std::future __cdecl End( + _In_ ID3D12CommandQueue* commandQueue ); + + private: + class Impl; + std::unique_ptr pImpl; + }; +} + diff --git a/Kits/DirectXTK12/Inc/ScreenGrab.h b/Kits/DirectXTK12/Inc/ScreenGrab.h new file mode 100644 index 0000000000000000000000000000000000000000..260ae54078e78c45afb84dff8a79f83a9a496573 --- /dev/null +++ b/Kits/DirectXTK12/Inc/ScreenGrab.h @@ -0,0 +1,52 @@ +//-------------------------------------------------------------------------------------- +// File: ScreenGrab.h +// +// Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' +// when used on a Direct3D Render Target). +// +// Note these functions are useful as a light-weight runtime screen grabber. For +// full-featured texture capture, DDS writer, and texture processing pipeline, +// see the 'Texconv' sample and the 'DirectXTex' library. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include + + +namespace DirectX +{ + // + // pSource must be in the COPY_SOURCE state before calling + // + + HRESULT __cdecl SaveDDSTextureToFile( + _In_ ID3D12CommandQueue* pCommandQueue, + _In_ ID3D12Resource* pSource, + _In_z_ const wchar_t* fileName); + + HRESULT __cdecl SaveWICTextureToFile( + _In_ ID3D12CommandQueue* pCommandQ, + _In_ ID3D12Resource* pSource, + _In_ REFGUID guidContainerFormat, + _In_z_ const wchar_t* fileName, + _In_opt_ const GUID* targetFormat = nullptr, + _In_opt_ std::function setCustomProps = nullptr); +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Inc/SimpleMath.h b/Kits/DirectXTK12/Inc/SimpleMath.h new file mode 100644 index 0000000000000000000000000000000000000000..55a0e00f36410f3680065c2cc6439c4b85485333 --- /dev/null +++ b/Kits/DirectXTK12/Inc/SimpleMath.h @@ -0,0 +1,1020 @@ +//------------------------------------------------------------------------------------- +// SimpleMath.h -- Simplified C++ Math wrapper for DirectXMath +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#pragma once + +#if !defined(__d3d11_h__) && !defined(__d3d11_x_h__) && !defined(__d3d12_h__) && !defined(__d3d12_x_h__) +#error include d3d11.h or d3d12.h before including SimpleMath.h +#endif + +#if !defined(_XBOX_ONE) || !defined(_TITLE) +#include +#endif + +#include +#include +#include + +#include +#include +#include + +#if (defined(_XBOX_ONE) && defined(_TITLE)) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) +#include +#endif + +namespace DirectX +{ + +namespace SimpleMath +{ + +struct Vector2; +struct Vector4; +struct Matrix; +struct Quaternion; +struct Plane; + +//------------------------------------------------------------------------------ +// 2D rectangle +struct Rectangle +{ + long x; + long y; + long width; + long height; + + // Creators + Rectangle() : x(0), y(0), width(0), height(0) {} + Rectangle(long ix, long iy, long iw, long ih) : x(ix), y(iy), width(iw), height(ih) {} + explicit Rectangle(const RECT& rct) : x(rct.left), y(rct.top), width(rct.right - rct.left), height(rct.bottom - rct.top) {} + + operator RECT() { RECT rct; rct.left = x; rct.top = y; rct.right = (x + width); rct.bottom = (y + height); return rct; } +#if (defined(_XBOX_ONE) && defined(_TITLE)) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) + operator ABI::Windows::Foundation::Rect() { ABI::Windows::Foundation::Rect r; r.X = float(x); r.Y = float(y); r.Width = float(width); r.Height = float(height); return r; } +#ifdef __cplusplus_winrt + operator Windows::Foundation::Rect() { return Windows::Foundation::Rect(float(x), float(y), float(width), float(height)); } +#endif +#endif + + // Comparison operators + bool operator == (const Rectangle& r) const { return (x == r.x) && (y == r.y) && (width == r.width) && (height == r.height); } + bool operator == (const RECT& rct) const { return (x == rct.left) && (y == rct.top) && (width == (rct.right - rct.left)) && (height == (rct.bottom - rct.top)); } + + bool operator != (const Rectangle& r) const { return (x != r.x) || (y != r.y) || (width != r.width) || (height != r.height); } + bool operator != (const RECT& rct) const { return (x != rct.left) || (y != rct.top) || (width != (rct.right - rct.left)) || (height != (rct.bottom - rct.top)); } + + // Assignment operators + Rectangle& operator=(_In_ const Rectangle& r) { x = r.x; y = r.y; width = r.width; height = r.height; return *this; } + Rectangle& operator=(_In_ const RECT& rct) { x = rct.left; y = rct.top; width = (rct.right - rct.left); height = (rct.bottom - rct.top); return *this; } + + // Rectangle operations + Vector2 Location() const; + Vector2 Center() const; + + bool IsEmpty() const { return (width == 0 && height == 0 && x == 0 && y == 0); } + + bool Contains(long ix, long iy) const { return (x <= ix) && (ix < (x + width)) && (y <= iy) && (iy < (y + height)); } + bool Contains(const Vector2& point) const; + bool Contains(const Rectangle& r) const { return (x <= r.x) && ((r.x + r.width) <= (x + width)) && (y <= r.y) && ((r.y + r.height) <= (y + height)); } + bool Contains(const RECT& rct) const { return (x <= rct.left) && (rct.right <= (x + width)) && (y <= rct.top) && (rct.bottom <= (y + height)); } + + void Inflate(long horizAmount, long vertAmount); + + bool Intersects(const Rectangle& r) const { return (r.x < (x + width)) && (x < (r.x + r.width)) && (r.y < (y + height)) && (y < (r.y + r.height)); } + bool Intersects(const RECT& rct) const { return (rct.left < (x + width)) && (x < rct.right) && (rct.top < (y + height)) && (y < rct.bottom); } + + void Offset(long ox, long oy) { x += ox; y += oy; } + + // Static functions + static Rectangle Intersect(const Rectangle& ra, const Rectangle& rb); + static RECT Intersect(const RECT& rcta, const RECT& rctb); + + static Rectangle Union(const Rectangle& ra, const Rectangle& rb); + static RECT Union(const RECT& rcta, const RECT& rctb); +}; + +//------------------------------------------------------------------------------ +// 2D vector +struct Vector2 : public XMFLOAT2 +{ + Vector2() : XMFLOAT2(0.f, 0.f) {} + explicit Vector2(float x) : XMFLOAT2( x, x ) {} + Vector2(float _x, float _y) : XMFLOAT2(_x, _y) {} + explicit Vector2(_In_reads_(2) const float *pArray) : XMFLOAT2(pArray) {} + Vector2(FXMVECTOR V) { XMStoreFloat2( this, V ); } + Vector2(const XMFLOAT2& V) { this->x = V.x; this->y = V.y; } + + operator XMVECTOR() const { return XMLoadFloat2( this ); } + + // Comparison operators + bool operator == ( const Vector2& V ) const; + bool operator != ( const Vector2& V ) const; + + // Assignment operators + Vector2& operator= (const Vector2& V) { x = V.x; y = V.y; return *this; } + Vector2& operator= (const XMFLOAT2& V) { x = V.x; y = V.y; return *this; } + Vector2& operator+= (const Vector2& V); + Vector2& operator-= (const Vector2& V); + Vector2& operator*= (const Vector2& V); + Vector2& operator*= (float S); + Vector2& operator/= (float S); + + // Unary operators + Vector2 operator+ () const { return *this; } + Vector2 operator- () const { return Vector2(-x, -y); } + + // Vector operations + bool InBounds( const Vector2& Bounds ) const; + + float Length() const; + float LengthSquared() const; + + float Dot( const Vector2& V ) const; + void Cross( const Vector2& V, Vector2& result ) const; + Vector2 Cross( const Vector2& V ) const; + + void Normalize(); + void Normalize( Vector2& result ) const; + + void Clamp( const Vector2& vmin, const Vector2& vmax ); + void Clamp( const Vector2& vmin, const Vector2& vmax, Vector2& result ) const; + + // Static functions + static float Distance( const Vector2& v1, const Vector2& v2 ); + static float DistanceSquared( const Vector2& v1, const Vector2& v2 ); + + static void Min( const Vector2& v1, const Vector2& v2, Vector2& result ); + static Vector2 Min( const Vector2& v1, const Vector2& v2 ); + + static void Max( const Vector2& v1, const Vector2& v2, Vector2& result ); + static Vector2 Max( const Vector2& v1, const Vector2& v2 ); + + static void Lerp( const Vector2& v1, const Vector2& v2, float t, Vector2& result ); + static Vector2 Lerp( const Vector2& v1, const Vector2& v2, float t ); + + static void SmoothStep( const Vector2& v1, const Vector2& v2, float t, Vector2& result ); + static Vector2 SmoothStep( const Vector2& v1, const Vector2& v2, float t ); + + static void Barycentric( const Vector2& v1, const Vector2& v2, const Vector2& v3, float f, float g, Vector2& result ); + static Vector2 Barycentric( const Vector2& v1, const Vector2& v2, const Vector2& v3, float f, float g ); + + static void CatmullRom( const Vector2& v1, const Vector2& v2, const Vector2& v3, const Vector2& v4, float t, Vector2& result ); + static Vector2 CatmullRom( const Vector2& v1, const Vector2& v2, const Vector2& v3, const Vector2& v4, float t ); + + static void Hermite( const Vector2& v1, const Vector2& t1, const Vector2& v2, const Vector2& t2, float t, Vector2& result ); + static Vector2 Hermite( const Vector2& v1, const Vector2& t1, const Vector2& v2, const Vector2& t2, float t ); + + static void Reflect( const Vector2& ivec, const Vector2& nvec, Vector2& result ); + static Vector2 Reflect( const Vector2& ivec, const Vector2& nvec ); + + static void Refract( const Vector2& ivec, const Vector2& nvec, float refractionIndex, Vector2& result ); + static Vector2 Refract( const Vector2& ivec, const Vector2& nvec, float refractionIndex ); + + static void Transform( const Vector2& v, const Quaternion& quat, Vector2& result ); + static Vector2 Transform( const Vector2& v, const Quaternion& quat ); + + static void Transform( const Vector2& v, const Matrix& m, Vector2& result ); + static Vector2 Transform( const Vector2& v, const Matrix& m ); + static void Transform( _In_reads_(count) const Vector2* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector2* resultArray ); + + static void Transform( const Vector2& v, const Matrix& m, Vector4& result ); + static void Transform( _In_reads_(count) const Vector2* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector4* resultArray ); + + static void TransformNormal( const Vector2& v, const Matrix& m, Vector2& result ); + static Vector2 TransformNormal( const Vector2& v, const Matrix& m ); + static void TransformNormal( _In_reads_(count) const Vector2* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector2* resultArray ); + + // Constants + static const Vector2 Zero; + static const Vector2 One; + static const Vector2 UnitX; + static const Vector2 UnitY; +}; + +// Binary operators +Vector2 operator+ (const Vector2& V1, const Vector2& V2); +Vector2 operator- (const Vector2& V1, const Vector2& V2); +Vector2 operator* (const Vector2& V1, const Vector2& V2); +Vector2 operator* (const Vector2& V, float S); +Vector2 operator/ (const Vector2& V1, const Vector2& V2); +Vector2 operator* (float S, const Vector2& V); + +//------------------------------------------------------------------------------ +// 3D vector +struct Vector3 : public XMFLOAT3 +{ + Vector3() : XMFLOAT3(0.f, 0.f, 0.f) {} + explicit Vector3(float x) : XMFLOAT3( x, x, x ) {} + Vector3(float _x, float _y, float _z) : XMFLOAT3(_x, _y, _z) {} + explicit Vector3(_In_reads_(3) const float *pArray) : XMFLOAT3(pArray) {} + Vector3(FXMVECTOR V) { XMStoreFloat3( this, V ); } + Vector3(const XMFLOAT3& V) { this->x = V.x; this->y = V.y; this->z = V.z; } + + operator XMVECTOR() const { return XMLoadFloat3( this ); } + + // Comparison operators + bool operator == ( const Vector3& V ) const; + bool operator != ( const Vector3& V ) const; + + // Assignment operators + Vector3& operator= (const Vector3& V) { x = V.x; y = V.y; z = V.z; return *this; } + Vector3& operator= (const XMFLOAT3& V) { x = V.x; y = V.y; z = V.z; return *this; } + Vector3& operator+= (const Vector3& V); + Vector3& operator-= (const Vector3& V); + Vector3& operator*= (const Vector3& V); + Vector3& operator*= (float S); + Vector3& operator/= (float S); + + // Unary operators + Vector3 operator+ () const { return *this; } + Vector3 operator- () const; + + // Vector operations + bool InBounds( const Vector3& Bounds ) const; + + float Length() const; + float LengthSquared() const; + + float Dot( const Vector3& V ) const; + void Cross( const Vector3& V, Vector3& result ) const; + Vector3 Cross( const Vector3& V ) const; + + void Normalize(); + void Normalize( Vector3& result ) const; + + void Clamp( const Vector3& vmin, const Vector3& vmax ); + void Clamp( const Vector3& vmin, const Vector3& vmax, Vector3& result ) const; + + // Static functions + static float Distance( const Vector3& v1, const Vector3& v2 ); + static float DistanceSquared( const Vector3& v1, const Vector3& v2 ); + + static void Min( const Vector3& v1, const Vector3& v2, Vector3& result ); + static Vector3 Min( const Vector3& v1, const Vector3& v2 ); + + static void Max( const Vector3& v1, const Vector3& v2, Vector3& result ); + static Vector3 Max( const Vector3& v1, const Vector3& v2 ); + + static void Lerp( const Vector3& v1, const Vector3& v2, float t, Vector3& result ); + static Vector3 Lerp( const Vector3& v1, const Vector3& v2, float t ); + + static void SmoothStep( const Vector3& v1, const Vector3& v2, float t, Vector3& result ); + static Vector3 SmoothStep( const Vector3& v1, const Vector3& v2, float t ); + + static void Barycentric( const Vector3& v1, const Vector3& v2, const Vector3& v3, float f, float g, Vector3& result ); + static Vector3 Barycentric( const Vector3& v1, const Vector3& v2, const Vector3& v3, float f, float g ); + + static void CatmullRom( const Vector3& v1, const Vector3& v2, const Vector3& v3, const Vector3& v4, float t, Vector3& result ); + static Vector3 CatmullRom( const Vector3& v1, const Vector3& v2, const Vector3& v3, const Vector3& v4, float t ); + + static void Hermite( const Vector3& v1, const Vector3& t1, const Vector3& v2, const Vector3& t2, float t, Vector3& result ); + static Vector3 Hermite( const Vector3& v1, const Vector3& t1, const Vector3& v2, const Vector3& t2, float t ); + + static void Reflect( const Vector3& ivec, const Vector3& nvec, Vector3& result ); + static Vector3 Reflect( const Vector3& ivec, const Vector3& nvec ); + + static void Refract( const Vector3& ivec, const Vector3& nvec, float refractionIndex, Vector3& result ); + static Vector3 Refract( const Vector3& ivec, const Vector3& nvec, float refractionIndex ); + + static void Transform( const Vector3& v, const Quaternion& quat, Vector3& result ); + static Vector3 Transform( const Vector3& v, const Quaternion& quat ); + + static void Transform( const Vector3& v, const Matrix& m, Vector3& result ); + static Vector3 Transform( const Vector3& v, const Matrix& m ); + static void Transform( _In_reads_(count) const Vector3* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector3* resultArray ); + + static void Transform( const Vector3& v, const Matrix& m, Vector4& result ); + static void Transform( _In_reads_(count) const Vector3* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector4* resultArray ); + + static void TransformNormal( const Vector3& v, const Matrix& m, Vector3& result ); + static Vector3 TransformNormal( const Vector3& v, const Matrix& m ); + static void TransformNormal( _In_reads_(count) const Vector3* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector3* resultArray ); + + // Constants + static const Vector3 Zero; + static const Vector3 One; + static const Vector3 UnitX; + static const Vector3 UnitY; + static const Vector3 UnitZ; + static const Vector3 Up; + static const Vector3 Down; + static const Vector3 Right; + static const Vector3 Left; + static const Vector3 Forward; + static const Vector3 Backward; +}; + +// Binary operators +Vector3 operator+ (const Vector3& V1, const Vector3& V2); +Vector3 operator- (const Vector3& V1, const Vector3& V2); +Vector3 operator* (const Vector3& V1, const Vector3& V2); +Vector3 operator* (const Vector3& V, float S); +Vector3 operator/ (const Vector3& V1, const Vector3& V2); +Vector3 operator* (float S, const Vector3& V); + +//------------------------------------------------------------------------------ +// 4D vector +struct Vector4 : public XMFLOAT4 +{ + Vector4() : XMFLOAT4(0.f, 0.f, 0.f, 0.f) {} + explicit Vector4(float x) : XMFLOAT4( x, x, x, x ) {} + Vector4(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {} + explicit Vector4(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {} + Vector4(FXMVECTOR V) { XMStoreFloat4( this, V ); } + Vector4(const XMFLOAT4& V) { this->x = V.x; this->y = V.y; this->z = V.z; this->w = V.w; } + + operator XMVECTOR() const { return XMLoadFloat4( this ); } + + // Comparison operators + bool operator == ( const Vector4& V ) const; + bool operator != ( const Vector4& V ) const; + + // Assignment operators + Vector4& operator= (const Vector4& V) { x = V.x; y = V.y; z = V.z; w = V.w; return *this; } + Vector4& operator= (const XMFLOAT4& V) { x = V.x; y = V.y; z = V.z; w = V.w; return *this; } + Vector4& operator+= (const Vector4& V); + Vector4& operator-= (const Vector4& V); + Vector4& operator*= (const Vector4& V); + Vector4& operator*= (float S); + Vector4& operator/= (float S); + + // Unary operators + Vector4 operator+ () const { return *this; } + Vector4 operator- () const; + + // Vector operations + bool InBounds( const Vector4& Bounds ) const; + + float Length() const; + float LengthSquared() const; + + float Dot( const Vector4& V ) const; + void Cross( const Vector4& v1, const Vector4& v2, Vector4& result ) const; + Vector4 Cross( const Vector4& v1, const Vector4& v2 ) const; + + void Normalize(); + void Normalize( Vector4& result ) const; + + void Clamp( const Vector4& vmin, const Vector4& vmax ); + void Clamp( const Vector4& vmin, const Vector4& vmax, Vector4& result ) const; + + // Static functions + static float Distance( const Vector4& v1, const Vector4& v2 ); + static float DistanceSquared( const Vector4& v1, const Vector4& v2 ); + + static void Min( const Vector4& v1, const Vector4& v2, Vector4& result ); + static Vector4 Min( const Vector4& v1, const Vector4& v2 ); + + static void Max( const Vector4& v1, const Vector4& v2, Vector4& result ); + static Vector4 Max( const Vector4& v1, const Vector4& v2 ); + + static void Lerp( const Vector4& v1, const Vector4& v2, float t, Vector4& result ); + static Vector4 Lerp( const Vector4& v1, const Vector4& v2, float t ); + + static void SmoothStep( const Vector4& v1, const Vector4& v2, float t, Vector4& result ); + static Vector4 SmoothStep( const Vector4& v1, const Vector4& v2, float t ); + + static void Barycentric( const Vector4& v1, const Vector4& v2, const Vector4& v3, float f, float g, Vector4& result ); + static Vector4 Barycentric( const Vector4& v1, const Vector4& v2, const Vector4& v3, float f, float g ); + + static void CatmullRom( const Vector4& v1, const Vector4& v2, const Vector4& v3, const Vector4& v4, float t, Vector4& result ); + static Vector4 CatmullRom( const Vector4& v1, const Vector4& v2, const Vector4& v3, const Vector4& v4, float t ); + + static void Hermite( const Vector4& v1, const Vector4& t1, const Vector4& v2, const Vector4& t2, float t, Vector4& result ); + static Vector4 Hermite( const Vector4& v1, const Vector4& t1, const Vector4& v2, const Vector4& t2, float t ); + + static void Reflect( const Vector4& ivec, const Vector4& nvec, Vector4& result ); + static Vector4 Reflect( const Vector4& ivec, const Vector4& nvec ); + + static void Refract( const Vector4& ivec, const Vector4& nvec, float refractionIndex, Vector4& result ); + static Vector4 Refract( const Vector4& ivec, const Vector4& nvec, float refractionIndex ); + + static void Transform( const Vector2& v, const Quaternion& quat, Vector4& result ); + static Vector4 Transform( const Vector2& v, const Quaternion& quat ); + + static void Transform( const Vector3& v, const Quaternion& quat, Vector4& result ); + static Vector4 Transform( const Vector3& v, const Quaternion& quat ); + + static void Transform( const Vector4& v, const Quaternion& quat, Vector4& result ); + static Vector4 Transform( const Vector4& v, const Quaternion& quat ); + + static void Transform( const Vector4& v, const Matrix& m, Vector4& result ); + static Vector4 Transform( const Vector4& v, const Matrix& m ); + static void Transform( _In_reads_(count) const Vector4* varray, size_t count, const Matrix& m, _Out_writes_(count) Vector4* resultArray ); + + // Constants + static const Vector4 Zero; + static const Vector4 One; + static const Vector4 UnitX; + static const Vector4 UnitY; + static const Vector4 UnitZ; + static const Vector4 UnitW; +}; + +// Binary operators +Vector4 operator+ (const Vector4& V1, const Vector4& V2); +Vector4 operator- (const Vector4& V1, const Vector4& V2); +Vector4 operator* (const Vector4& V1, const Vector4& V2); +Vector4 operator* (const Vector4& V, float S); +Vector4 operator/ (const Vector4& V1, const Vector4& V2); +Vector4 operator* (float S, const Vector4& V); + +//------------------------------------------------------------------------------ +// 4x4 Matrix (assumes right-handed cooordinates) +struct Matrix : public XMFLOAT4X4 +{ + Matrix() : XMFLOAT4X4( 1.f, 0, 0, 0, + 0, 1.f, 0, 0, + 0, 0, 1.f, 0, + 0, 0, 0, 1.f ) {} + Matrix(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) : XMFLOAT4X4(m00, m01, m02, m03, + m10, m11, m12, m13, + m20, m21, m22, m23, + m30, m31, m32, m33) {} + explicit Matrix( const Vector3& r0, const Vector3& r1, const Vector3& r2 ) : XMFLOAT4X4( r0.x, r0.y, r0.z, 0, + r1.x, r1.y, r1.z, 0, + r2.x, r2.y, r2.z, 0, + 0, 0, 0, 1.f ) {} + explicit Matrix( const Vector4& r0, const Vector4& r1, const Vector4& r2, const Vector4& r3 ) : XMFLOAT4X4( r0.x, r0.y, r0.z, r0.w, + r1.x, r1.y, r1.z, r1.w, + r2.x, r2.y, r2.z, r2.w, + r3.x, r3.y, r3.z, r3.w ) {} + Matrix(const XMFLOAT4X4& M) { memcpy_s(this, sizeof(float)*16, &M, sizeof(XMFLOAT4X4)); } + Matrix(const XMFLOAT3X3& M); + Matrix(const XMFLOAT4X3& M); + + explicit Matrix(_In_reads_(16) const float *pArray) : XMFLOAT4X4(pArray) {} + Matrix( CXMMATRIX M ) { XMStoreFloat4x4( this, M ); } + + operator XMMATRIX() const { return XMLoadFloat4x4( this ); } + + // Comparison operators + bool operator == ( const Matrix& M ) const; + bool operator != ( const Matrix& M ) const; + + // Assignment operators + Matrix& operator= (const Matrix& M) { memcpy_s( this, sizeof(float)*16, &M, sizeof(float)*16 ); return *this; } + Matrix& operator= (const XMFLOAT4X4& M) { memcpy_s( this, sizeof(float)*16, &M, sizeof(XMFLOAT4X4) ); return *this; } + Matrix& operator= (const XMFLOAT3X3& M); + Matrix& operator= (const XMFLOAT4X3& M); + Matrix& operator+= (const Matrix& M); + Matrix& operator-= (const Matrix& M); + Matrix& operator*= (const Matrix& M); + Matrix& operator*= (float S); + Matrix& operator/= (float S); + + Matrix& operator/= (const Matrix& M); + // Element-wise divide + + // Unary operators + Matrix operator+ () const { return *this; } + Matrix operator- () const; + + // Properties + Vector3 Up() const { return Vector3( _21, _22, _23); } + void Up( const Vector3& v ) { _21 = v.x; _22 = v.y; _23 = v.z; } + + Vector3 Down() const { return Vector3( -_21, -_22, -_23); } + void Down( const Vector3& v ) { _21 = -v.x; _22 = -v.y; _23 = -v.z; } + + Vector3 Right() const { return Vector3( _11, _12, _13 ); } + void Right( const Vector3& v ) { _11 = v.x; _12 = v.y; _13 = v.z; } + + Vector3 Left() const { return Vector3( -_11, -_12, -_13 ); } + void Left( const Vector3& v ) { _11 = -v.x; _12 = -v.y; _13 = -v.z; } + + Vector3 Forward() const { return Vector3( -_31, -_32, -_33 ); } + void Forward( const Vector3& v ) { _31 = -v.x; _32 = -v.y; _33 = -v.z; } + + Vector3 Backward() const { return Vector3( _31, _32, _33 ); } + void Backward( const Vector3& v ) { _31 = v.x; _32 = v.y; _33 = v.z; } + + Vector3 Translation() const { return Vector3( _41, _42, _43 ); } + void Translation( const Vector3& v ) { _41 = v.x; _42 = v.y; _43 = v.z; } + + // Matrix operations + bool Decompose( Vector3& scale, Quaternion& rotation, Vector3& translation ); + + Matrix Transpose() const; + void Transpose( Matrix& result ) const; + + Matrix Invert() const; + void Invert( Matrix& result ) const; + + float Determinant() const; + + // Static functions + static Matrix CreateBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& cameraUp, _In_opt_ const Vector3* cameraForward = nullptr ); + + static Matrix CreateConstrainedBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& rotateAxis, + _In_opt_ const Vector3* cameraForward = nullptr, _In_opt_ const Vector3* objectForward = nullptr); + + static Matrix CreateTranslation( const Vector3& position ); + static Matrix CreateTranslation( float x, float y, float z ); + + static Matrix CreateScale( const Vector3& scales ); + static Matrix CreateScale( float xs, float ys, float zs ); + static Matrix CreateScale( float scale ); + + static Matrix CreateRotationX( float radians ); + static Matrix CreateRotationY( float radians ); + static Matrix CreateRotationZ( float radians ); + + static Matrix CreateFromAxisAngle( const Vector3& axis, float angle ); + + static Matrix CreatePerspectiveFieldOfView( float fov, float aspectRatio, float nearPlane, float farPlane ); + static Matrix CreatePerspective( float width, float height, float nearPlane, float farPlane ); + static Matrix CreatePerspectiveOffCenter( float left, float right, float bottom, float top, float nearPlane, float farPlane ); + static Matrix CreateOrthographic( float width, float height, float zNearPlane, float zFarPlane ); + static Matrix CreateOrthographicOffCenter( float left, float right, float bottom, float top, float zNearPlane, float zFarPlane ); + + static Matrix CreateLookAt( const Vector3& position, const Vector3& target, const Vector3& up ); + static Matrix CreateWorld( const Vector3& position, const Vector3& forward, const Vector3& up ); + + static Matrix CreateFromQuaternion( const Quaternion& quat ); + + static Matrix CreateFromYawPitchRoll( float yaw, float pitch, float roll ); + + static Matrix CreateShadow( const Vector3& lightDir, const Plane& plane ); + + static Matrix CreateReflection( const Plane& plane ); + + static void Lerp( const Matrix& M1, const Matrix& M2, float t, Matrix& result ); + static Matrix Lerp( const Matrix& M1, const Matrix& M2, float t ); + + static void Transform( const Matrix& M, const Quaternion& rotation, Matrix& result ); + static Matrix Transform( const Matrix& M, const Quaternion& rotation ); + + // Constants + static const Matrix Identity; +}; + +// Binary operators +Matrix operator+ (const Matrix& M1, const Matrix& M2); +Matrix operator- (const Matrix& M1, const Matrix& M2); +Matrix operator* (const Matrix& M1, const Matrix& M2); +Matrix operator* (const Matrix& M, float S); +Matrix operator/ (const Matrix& M, float S); +Matrix operator/ (const Matrix& M1, const Matrix& M2); + // Element-wise divide +Matrix operator* (float S, const Matrix& M); + + +//----------------------------------------------------------------------------- +// Plane +struct Plane : public XMFLOAT4 +{ + Plane() : XMFLOAT4(0.f, 1.f, 0.f, 0.f) {} + Plane(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {} + Plane(const Vector3& normal, float d) : XMFLOAT4(normal.x, normal.y, normal.z, d) {} + Plane(const Vector3& point1, const Vector3& point2, const Vector3& point3 ); + Plane(const Vector3& point, const Vector3& normal); + explicit Plane(const Vector4& v) : XMFLOAT4(v.x, v.y, v.z, v.w) {} + explicit Plane(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {} + Plane(FXMVECTOR V) { XMStoreFloat4( this, V ); } + Plane(const XMFLOAT4& p) { this->x = p.x; this->y = p.y; this->z = p.z; this->w = p.w; } + + operator XMVECTOR() const { return XMLoadFloat4( this ); } + + // Comparison operators + bool operator == ( const Plane& p ) const; + bool operator != ( const Plane& p ) const; + + // Assignment operators + Plane& operator= (const Plane& p) { x = p.x; y = p.y; z = p.z; w = p.w; return *this; } + Plane& operator= (const XMFLOAT4& p) { x = p.x; y = p.y; z = p.z; w = p.w; return *this; } + + // Properties + Vector3 Normal() const { return Vector3( x, y, z ); } + void Normal( const Vector3& normal ) { x = normal.x; y = normal.y; z = normal.z; } + + float D() const { return w; } + void D(float d) { w = d; } + + // Plane operations + void Normalize(); + void Normalize( Plane& result ) const; + + float Dot( const Vector4& v ) const; + float DotCoordinate( const Vector3& position ) const; + float DotNormal( const Vector3& normal ) const; + + // Static functions + static void Transform( const Plane& plane, const Matrix& M, Plane& result ); + static Plane Transform( const Plane& plane, const Matrix& M ); + + static void Transform( const Plane& plane, const Quaternion& rotation, Plane& result ); + static Plane Transform( const Plane& plane, const Quaternion& rotation ); + // Input quaternion must be the inverse transpose of the transformation +}; + +//------------------------------------------------------------------------------ +// Quaternion +struct Quaternion : public XMFLOAT4 +{ + Quaternion() : XMFLOAT4(0, 0, 0, 1.f) {} + Quaternion( float _x, float _y, float _z, float _w ) : XMFLOAT4(_x, _y, _z, _w) {} + Quaternion( const Vector3& v, float scalar ) : XMFLOAT4( v.x, v.y, v.z, scalar ) {} + explicit Quaternion( const Vector4& v ) : XMFLOAT4( v.x, v.y, v.z, v.w ) {} + explicit Quaternion(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {} + Quaternion(FXMVECTOR V) { XMStoreFloat4( this, V ); } + Quaternion(const XMFLOAT4& q) { this->x = q.x; this->y = q.y; this->z = q.z; this->w = q.w; } + + operator XMVECTOR() const { return XMLoadFloat4( this ); } + + // Comparison operators + bool operator == ( const Quaternion& q ) const; + bool operator != ( const Quaternion& q ) const; + + // Assignment operators + Quaternion& operator= (const Quaternion& q) { x = q.x; y = q.y; z = q.z; w = q.w; return *this; } + Quaternion& operator= (const XMFLOAT4& q) { x = q.x; y = q.y; z = q.z; w = q.w; return *this; } + Quaternion& operator+= (const Quaternion& q); + Quaternion& operator-= (const Quaternion& q); + Quaternion& operator*= (const Quaternion& q); + Quaternion& operator*= (float S); + Quaternion& operator/= (const Quaternion& q); + + // Unary operators + Quaternion operator+ () const { return *this; } + Quaternion operator- () const; + + // Quaternion operations + float Length() const; + float LengthSquared() const; + + void Normalize(); + void Normalize( Quaternion& result ) const; + + void Conjugate(); + void Conjugate( Quaternion& result ) const; + + void Inverse( Quaternion& result ) const; + + float Dot( const Quaternion& Q ) const; + + // Static functions + static Quaternion CreateFromAxisAngle( const Vector3& axis, float angle ); + static Quaternion CreateFromYawPitchRoll( float yaw, float pitch, float roll ); + static Quaternion CreateFromRotationMatrix( const Matrix& M ); + + static void Lerp( const Quaternion& q1, const Quaternion& q2, float t, Quaternion& result ); + static Quaternion Lerp( const Quaternion& q1, const Quaternion& q2, float t ); + + static void Slerp( const Quaternion& q1, const Quaternion& q2, float t, Quaternion& result ); + static Quaternion Slerp( const Quaternion& q1, const Quaternion& q2, float t ); + + static void Concatenate( const Quaternion& q1, const Quaternion& q2, Quaternion& result ); + static Quaternion Concatenate( const Quaternion& q1, const Quaternion& q2 ); + + // Constants + static const Quaternion Identity; +}; + +// Binary operators +Quaternion operator+ (const Quaternion& Q1, const Quaternion& Q2); +Quaternion operator- (const Quaternion& Q1, const Quaternion& Q2); +Quaternion operator* (const Quaternion& Q1, const Quaternion& Q2); +Quaternion operator* (const Quaternion& Q, float S); +Quaternion operator/ (const Quaternion& Q1, const Quaternion& Q2); +Quaternion operator* (float S, const Quaternion& Q); + +//------------------------------------------------------------------------------ +// Color +struct Color : public XMFLOAT4 +{ + Color() : XMFLOAT4(0, 0, 0, 1.f) {} + Color( float _r, float _g, float _b ) : XMFLOAT4(_r, _g, _b, 1.f) {} + Color( float _r, float _g, float _b, float _a ) : XMFLOAT4(_r, _g, _b, _a) {} + explicit Color( const Vector3& clr ) : XMFLOAT4( clr.x, clr.y, clr.z, 1.f ) {} + explicit Color( const Vector4& clr ) : XMFLOAT4( clr.x, clr.y, clr.z, clr.w ) {} + explicit Color(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {} + Color(FXMVECTOR V) { XMStoreFloat4( this, V ); } + Color(const XMFLOAT4& c) { this->x = c.x; this->y = c.y; this->z = c.z; this->w = c.w; } + + explicit Color( const DirectX::PackedVector::XMCOLOR& Packed ); + // BGRA Direct3D 9 D3DCOLOR packed color + + explicit Color( const DirectX::PackedVector::XMUBYTEN4& Packed ); + // RGBA XNA Game Studio packed color + + operator XMVECTOR() const { return XMLoadFloat4( this ); } + operator const float*() const { return reinterpret_cast(this); } + + // Comparison operators + bool operator == ( const Color& c ) const; + bool operator != ( const Color& c ) const; + + // Assignment operators + Color& operator= (const Color& c) { x = c.x; y = c.y; z = c.z; w = c.w; return *this; } + Color& operator= (const XMFLOAT4& c) { x = c.x; y = c.y; z = c.z; w = c.w; return *this; } + Color& operator= (const DirectX::PackedVector::XMCOLOR& Packed); + Color& operator= (const DirectX::PackedVector::XMUBYTEN4& Packed); + Color& operator+= (const Color& c); + Color& operator-= (const Color& c); + Color& operator*= (const Color& c); + Color& operator*= (float S); + Color& operator/= (const Color& c); + + // Unary operators + Color operator+ () const { return *this; } + Color operator- () const; + + // Properties + float R() const { return x; } + void R(float r) { x = r; } + + float G() const { return y; } + void G(float g) { y = g; } + + float B() const { return z; } + void B(float b) { z = b; } + + float A() const { return w; } + void A(float a) { w = a; } + + // Color operations + DirectX::PackedVector::XMCOLOR BGRA() const; + DirectX::PackedVector::XMUBYTEN4 RGBA() const; + + Vector3 ToVector3() const; + Vector4 ToVector4() const; + + void Negate(); + void Negate( Color& result ) const; + + void Saturate(); + void Saturate( Color& result ) const; + + void Premultiply(); + void Premultiply( Color& result ) const; + + void AdjustSaturation( float sat ); + void AdjustSaturation( float sat, Color& result ) const; + + void AdjustContrast( float contrast ); + void AdjustContrast( float contrast, Color& result ) const; + + // Static functions + static void Modulate( const Color& c1, const Color& c2, Color& result ); + static Color Modulate( const Color& c1, const Color& c2 ); + + static void Lerp( const Color& c1, const Color& c2, float t, Color& result ); + static Color Lerp( const Color& c1, const Color& c2, float t ); +}; + +// Binary operators +Color operator+ (const Color& C1, const Color& C2); +Color operator- (const Color& C1, const Color& C2); +Color operator* (const Color& C1, const Color& C2); +Color operator* (const Color& C, float S); +Color operator/ (const Color& C1, const Color& C2); +Color operator* (float S, const Color& C); + +//------------------------------------------------------------------------------ +// Ray +class Ray +{ +public: + Vector3 position; + Vector3 direction; + + Ray() : position(0,0,0), direction(0,0,1) {} + Ray( const Vector3& pos, const Vector3& dir ) : position(pos), direction(dir) {} + + // Comparison operators + bool operator == ( const Ray& r ) const; + bool operator != ( const Ray& r ) const; + + // Ray operations + bool Intersects( const BoundingSphere& sphere, _Out_ float& Dist ) const; + bool Intersects( const BoundingBox& box, _Out_ float& Dist ) const; + bool Intersects( const Vector3& tri0, const Vector3& tri1, const Vector3& tri2, _Out_ float& Dist ) const; + bool Intersects( const Plane& plane, _Out_ float& Dist ) const; +}; + +//------------------------------------------------------------------------------ +// Viewport +class Viewport +{ +public: + float x; + float y; + float width; + float height; + float minDepth; + float maxDepth; + + Viewport() : + x(0.f), y(0.f), width(0.f), height(0.f), minDepth(0.f), maxDepth(1.f) {} + Viewport( float ix, float iy, float iw, float ih, float iminz = 0.f, float imaxz = 1.f ) : + x(ix), y(iy), width(iw), height(ih), minDepth(iminz), maxDepth(imaxz) {} + explicit Viewport(const RECT& rct) : + x(float(rct.left)), y(float(rct.top)), + width(float(rct.right - rct.left)), + height(float(rct.bottom - rct.top)), + minDepth(0.f), maxDepth(1.f) {} + +#if defined(__d3d11_h__) || defined(__d3d11_x_h__) + // Direct3D 11 interop + explicit Viewport(const D3D11_VIEWPORT& vp) : + x(vp.TopLeftX), y(vp.TopLeftY), + width(vp.Width), height(vp.Height), + minDepth(vp.MinDepth), maxDepth(vp.MaxDepth) {} + + operator D3D11_VIEWPORT() { return *reinterpret_cast(this); } + const D3D11_VIEWPORT* Get11() const { return reinterpret_cast(this); } + Viewport& operator= (const D3D11_VIEWPORT& vp); +#endif + +#if defined(__d3d12_h__) || defined(__d3d12_x_h__) + // Direct3D 12 interop + explicit Viewport(const D3D12_VIEWPORT& vp) : + x(vp.TopLeftX), y(vp.TopLeftY), + width(vp.Width), height(vp.Height), + minDepth(vp.MinDepth), maxDepth(vp.MaxDepth) {} + + operator D3D12_VIEWPORT() { return *reinterpret_cast(this); } + const D3D12_VIEWPORT* Get12() const { return reinterpret_cast(this); } + Viewport& operator= (const D3D12_VIEWPORT& vp); +#endif + + // Comparison operators + bool operator == ( const Viewport& vp ) const; + bool operator != ( const Viewport& vp ) const; + + // Assignment operators + Viewport& operator= (const Viewport& vp); + Viewport& operator= (const RECT& rct); + + // Viewport operations + float AspectRatio() const; + + Vector3 Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world ) const; + void Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result ) const; + + Vector3 Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world ) const; + void Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result ) const; + + // Static methods + static RECT __cdecl ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight); + static RECT __cdecl ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight); +}; + +#include "SimpleMath.inl" + +}; // namespace SimpleMath + +}; // namespace DirectX + +//------------------------------------------------------------------------------ +// Support for SimpleMath and Standard C++ Library containers +namespace std +{ + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Rectangle& r1, const DirectX::SimpleMath::Rectangle& r2) const + { + return ((r1.x < r2.x) + || ((r1.x == r2.x) && (r1.y < r2.y)) + || ((r1.x == r2.x) && (r1.y == r2.y) && (r1.width < r2.width)) + || ((r1.x == r2.x) && (r1.y == r2.y) && (r1.width == r2.width) && (r1.height < r2.height))); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Vector2& V1, const DirectX::SimpleMath::Vector2& V2) const + { + return ( (V1.x < V2.x) || ((V1.x == V2.x) && (V1.y < V2.y)) ); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Vector3& V1, const DirectX::SimpleMath::Vector3& V2) const + { + return ( (V1.x < V2.x) + || ((V1.x == V2.x) && (V1.y < V2.y)) + || ((V1.x == V2.x) && (V1.y == V2.y) && (V1.z < V2.z)) ); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Vector4& V1, const DirectX::SimpleMath::Vector4& V2) const + { + return ( (V1.x < V2.x) + || ((V1.x == V2.x) && (V1.y < V2.y)) + || ((V1.x == V2.x) && (V1.y == V2.y) && (V1.z < V2.z)) + || ((V1.x == V2.x) && (V1.y == V2.y) && (V1.z == V2.z) && (V1.w < V2.w)) ); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Matrix& M1, const DirectX::SimpleMath::Matrix& M2) const + { + if (M1._11 != M2._11) return M1._11 < M2._11; + if (M1._12 != M2._12) return M1._12 < M2._12; + if (M1._13 != M2._13) return M1._13 < M2._13; + if (M1._14 != M2._14) return M1._14 < M2._14; + if (M1._21 != M2._21) return M1._21 < M2._21; + if (M1._22 != M2._22) return M1._22 < M2._22; + if (M1._23 != M2._23) return M1._23 < M2._23; + if (M1._24 != M2._24) return M1._24 < M2._24; + if (M1._31 != M2._31) return M1._31 < M2._31; + if (M1._32 != M2._32) return M1._32 < M2._32; + if (M1._33 != M2._33) return M1._33 < M2._33; + if (M1._34 != M2._34) return M1._34 < M2._34; + if (M1._41 != M2._41) return M1._41 < M2._41; + if (M1._42 != M2._42) return M1._42 < M2._42; + if (M1._43 != M2._43) return M1._43 < M2._43; + if (M1._44 != M2._44) return M1._44 < M2._44; + + return false; + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Plane& P1, const DirectX::SimpleMath::Plane& P2) const + { + return ( (P1.x < P2.x) + || ((P1.x == P2.x) && (P1.y < P2.y)) + || ((P1.x == P2.x) && (P1.y == P2.y) && (P1.z < P2.z)) + || ((P1.x == P2.x) && (P1.y == P2.y) && (P1.z == P2.z) && (P1.w < P2.w)) ); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Quaternion& Q1, const DirectX::SimpleMath::Quaternion& Q2) const + { + return ( (Q1.x < Q2.x) + || ((Q1.x == Q2.x) && (Q1.y < Q2.y)) + || ((Q1.x == Q2.x) && (Q1.y == Q2.y) && (Q1.z < Q2.z)) + || ((Q1.x == Q2.x) && (Q1.y == Q2.y) && (Q1.z == Q2.z) && (Q1.w < Q2.w)) ); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Color& C1, const DirectX::SimpleMath::Color& C2) const + { + return ( (C1.x < C2.x) + || ((C1.x == C2.x) && (C1.y < C2.y)) + || ((C1.x == C2.x) && (C1.y == C2.y) && (C1.z < C2.z)) + || ((C1.x == C2.x) && (C1.y == C2.y) && (C1.z == C2.z) && (C1.w < C2.w)) ); + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Ray& R1, const DirectX::SimpleMath::Ray& R2) const + { + if (R1.position.x != R2.position.x) return R1.position.x < R2.position.x; + if (R1.position.y != R2.position.y) return R1.position.y < R2.position.y; + if (R1.position.z != R2.position.z) return R1.position.z < R2.position.z; + + if (R1.direction.x != R2.direction.x) return R1.direction.x < R2.direction.x; + if (R1.direction.y != R2.direction.y) return R1.direction.y < R2.direction.y; + if (R1.direction.z != R2.direction.z) return R1.direction.z < R2.direction.z; + + return false; + } + }; + + template<> struct less + { + bool operator()(const DirectX::SimpleMath::Viewport& vp1, const DirectX::SimpleMath::Viewport& vp2) const + { + if (vp1.x != vp2.x) return (vp1.x < vp2.x); + if (vp1.y != vp2.y) return (vp1.y < vp2.y); + + if (vp1.width != vp2.width) return (vp1.width < vp2.width); + if (vp1.height != vp2.height) return (vp1.height < vp2.height); + + if (vp1.minDepth != vp2.minDepth) return (vp1.minDepth < vp2.minDepth); + if (vp1.maxDepth != vp2.maxDepth) return (vp1.maxDepth < vp2.maxDepth); + + return false; + } + }; + +} // namespace std diff --git a/Kits/DirectXTK12/Inc/SimpleMath.inl b/Kits/DirectXTK12/Inc/SimpleMath.inl new file mode 100644 index 0000000000000000000000000000000000000000..1be0a5fc76c1b727408945b0c7bd4d44925bc602 --- /dev/null +++ b/Kits/DirectXTK12/Inc/SimpleMath.inl @@ -0,0 +1,3706 @@ +//------------------------------------------------------------------------------------- +// SimpleMath.inl -- Simplified C++ Math wrapper for DirectXMath +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#pragma once + +/**************************************************************************** +* +* Rectangle +* +****************************************************************************/ + +//------------------------------------------------------------------------------ +// Rectangle operations +//------------------------------------------------------------------------------ +inline Vector2 Rectangle::Location() const +{ + return Vector2(float(x), float(y)); +} + +inline Vector2 Rectangle::Center() const +{ + return Vector2(float(x) + float(width / 2.f), float(y) + float(height / 2.f)); +} + +inline bool Rectangle::Contains(const Vector2& point) const +{ + return (float(x) <= point.x) && (point.x < float(x + width)) && (float(y) <= point.y) && (point.y < float(y + height)); +} + +inline void Rectangle::Inflate(long horizAmount, long vertAmount) +{ + x -= horizAmount; + y -= vertAmount; + width += horizAmount; + height += vertAmount; +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline Rectangle Rectangle::Intersect(const Rectangle& ra, const Rectangle& rb) +{ + long righta = ra.x + ra.width; + long rightb = rb.x + rb.width; + + long bottoma = ra.y + ra.height; + long bottomb = rb.y + rb.height; + + long maxX = ra.x > rb.x ? ra.x : rb.x; + long maxY = ra.y > rb.y ? ra.y : rb.y; + + long minRight = righta < rightb ? righta : rightb; + long minBottom = bottoma < bottomb ? bottoma : bottomb; + + Rectangle result; + + if ((minRight > maxX) && (minBottom > maxY)) + { + result.x = maxX; + result.y = maxY; + result.width = minRight - maxX; + result.height = minBottom - maxY; + } + else + { + result.x = 0; + result.y = 0; + result.width = 0; + result.height = 0; + } + + return result; +} + +inline RECT Rectangle::Intersect(const RECT& rcta, const RECT& rctb) +{ + long maxX = rcta.left > rctb.left ? rcta.left : rctb.left; + long maxY = rcta.top > rctb.top ? rcta.top : rctb.top; + + long minRight = rcta.right < rctb.right ? rcta.right : rctb.right; + long minBottom = rcta.bottom < rctb.bottom ? rcta.bottom : rctb.bottom; + + RECT result; + + if ((minRight > maxX) && (minBottom > maxY)) + { + result.left = maxX; + result.top = maxY; + result.right = minRight; + result.bottom = minBottom; + } + else + { + result.left = 0; + result.top = 0; + result.right = 0; + result.bottom = 0; + } + + return result; +} + +inline Rectangle Rectangle::Union(const Rectangle& ra, const Rectangle& rb) +{ + long righta = ra.x + ra.width; + long rightb = rb.x + rb.width; + + long bottoma = ra.y + ra.height; + long bottomb = rb.y + rb.height; + + int minX = ra.x < rb.x ? ra.x : rb.x; + int minY = ra.y < rb.y ? ra.y : rb.y; + + int maxRight = righta > rightb ? righta : rightb; + int maxBottom = bottoma > bottomb ? bottoma : bottomb; + + Rectangle result; + result.x = minX; + result.y = minY; + result.width = maxRight - minX; + result.height = maxBottom - minY; + return result; +} + +inline RECT Rectangle::Union(const RECT& rcta, const RECT& rctb) +{ + RECT result; + result.left = rcta.left < rctb.left ? rcta.left : rctb.left; + result.top = rcta.top < rctb.top ? rcta.top : rctb.top; + result.right = rcta.right > rctb.right ? rcta.right : rctb.right; + result.bottom = rcta.bottom > rctb.bottom ? rcta.bottom : rctb.bottom; + return result; +} + + +/**************************************************************************** + * + * Vector2 + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Vector2::operator == ( const Vector2& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + return XMVector2Equal( v1, v2 ); +} + +inline bool Vector2::operator != ( const Vector2& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + return XMVector2NotEqual( v1, v2 ); +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Vector2& Vector2::operator+= (const Vector2& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + XMVECTOR X = XMVectorAdd(v1,v2); + XMStoreFloat2( this, X ); + return *this; +} + +inline Vector2& Vector2::operator-= (const Vector2& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + XMVECTOR X = XMVectorSubtract(v1,v2); + XMStoreFloat2( this, X ); + return *this; +} + +inline Vector2& Vector2::operator*= (const Vector2& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + XMVECTOR X = XMVectorMultiply(v1,v2); + XMStoreFloat2( this, X ); + return *this; +} + +inline Vector2& Vector2::operator*= (float S) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR X = XMVectorScale(v1,S); + XMStoreFloat2( this, X ); + return *this; +} + +inline Vector2& Vector2::operator/= (float S) +{ + using namespace DirectX; + assert( S != 0.0f ); + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR X = XMVectorScale(v1, 1.f/S); + XMStoreFloat2( this, X ); + return *this; +} + +//------------------------------------------------------------------------------ +// Binary operators +//------------------------------------------------------------------------------ + +inline Vector2 operator+ (const Vector2& V1, const Vector2& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &V1 ); + XMVECTOR v2 = XMLoadFloat2( &V2 ); + XMVECTOR X = XMVectorAdd(v1,v2); + Vector2 R; + XMStoreFloat2( &R, X ); + return R; +} + +inline Vector2 operator- (const Vector2& V1, const Vector2& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &V1 ); + XMVECTOR v2 = XMLoadFloat2( &V2 ); + XMVECTOR X = XMVectorSubtract(v1,v2); + Vector2 R; + XMStoreFloat2( &R, X ); + return R; +} + +inline Vector2 operator* (const Vector2& V1, const Vector2& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &V1 ); + XMVECTOR v2 = XMLoadFloat2( &V2 ); + XMVECTOR X = XMVectorMultiply(v1,v2); + Vector2 R; + XMStoreFloat2( &R, X ); + return R; +} + +inline Vector2 operator* (const Vector2& V, float S) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &V ); + XMVECTOR X = XMVectorScale(v1,S); + Vector2 R; + XMStoreFloat2( &R, X ); + return R; +} + +inline Vector2 operator/ (const Vector2& V1, const Vector2& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &V1 ); + XMVECTOR v2 = XMLoadFloat2( &V2 ); + XMVECTOR X = XMVectorDivide(v1,v2); + Vector2 R; + XMStoreFloat2( &R, X ); + return R; +} + +inline Vector2 operator* (float S, const Vector2& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &V ); + XMVECTOR X = XMVectorScale(v1,S); + Vector2 R; + XMStoreFloat2( &R, X ); + return R; +} + +//------------------------------------------------------------------------------ +// Vector operations +//------------------------------------------------------------------------------ + +inline bool Vector2::InBounds( const Vector2& Bounds ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &Bounds ); + return XMVector2InBounds( v1, v2 ); +} + +inline float Vector2::Length() const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR X = XMVector2Length( v1 ); + return XMVectorGetX( X ); +} + +inline float Vector2::LengthSquared() const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR X = XMVector2LengthSq( v1 ); + return XMVectorGetX( X ); +} + +inline float Vector2::Dot( const Vector2& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + XMVECTOR X = XMVector2Dot( v1, v2 ); + return XMVectorGetX( X ); +} + +inline void Vector2::Cross( const Vector2& V, Vector2& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + XMVECTOR R = XMVector2Cross( v1, v2 ); + XMStoreFloat2( &result, R ); +} + +inline Vector2 Vector2::Cross( const Vector2& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &V ); + XMVECTOR R = XMVector2Cross( v1, v2 ); + + Vector2 result; + XMStoreFloat2( &result, R ); + return result; +} + +inline void Vector2::Normalize() +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR X = XMVector2Normalize( v1 ); + XMStoreFloat2( this, X ); +} + +inline void Vector2::Normalize( Vector2& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR X = XMVector2Normalize( v1 ); + XMStoreFloat2( &result, X ); +} + +inline void Vector2::Clamp( const Vector2& vmin, const Vector2& vmax ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &vmin ); + XMVECTOR v3 = XMLoadFloat2( &vmax ); + XMVECTOR X = XMVectorClamp( v1, v2, v3 ); + XMStoreFloat2( this, X ); +} + +inline void Vector2::Clamp( const Vector2& vmin, const Vector2& vmax, Vector2& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( this ); + XMVECTOR v2 = XMLoadFloat2( &vmin ); + XMVECTOR v3 = XMLoadFloat2( &vmax ); + XMVECTOR X = XMVectorClamp( v1, v2, v3 ); + XMStoreFloat2( &result, X ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline float Vector2::Distance( const Vector2& v1, const Vector2& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR V = XMVectorSubtract( x2, x1 ); + XMVECTOR X = XMVector2Length( V ); + return XMVectorGetX( X ); +} + +inline float Vector2::DistanceSquared( const Vector2& v1, const Vector2& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR V = XMVectorSubtract( x2, x1 ); + XMVECTOR X = XMVector2LengthSq( V ); + return XMVectorGetX( X ); +} + +inline void Vector2::Min( const Vector2& v1, const Vector2& v2, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorMin( x1, x2 ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Min( const Vector2& v1, const Vector2& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorMin( x1, x2 ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Max( const Vector2& v1, const Vector2& v2, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorMax( x1, x2 ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Max( const Vector2& v1, const Vector2& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorMax( x1, x2 ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Lerp( const Vector2& v1, const Vector2& v2, float t, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Lerp( const Vector2& v1, const Vector2& v2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::SmoothStep( const Vector2& v1, const Vector2& v2, float t, Vector2& result ) +{ + using namespace DirectX; + t = (t > 1.0f) ? 1.0f : ((t < 0.0f) ? 0.0f : t); // Clamp value to 0 to 1 + t = t*t*(3.f - 2.f*t); + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::SmoothStep( const Vector2& v1, const Vector2& v2, float t ) +{ + using namespace DirectX; + t = (t > 1.0f) ? 1.0f : ((t < 0.0f) ? 0.0f : t); // Clamp value to 0 to 1 + t = t*t*(3.f - 2.f*t); + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Barycentric( const Vector2& v1, const Vector2& v2, const Vector2& v3, float f, float g, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR x3 = XMLoadFloat2( &v3 ); + XMVECTOR X = XMVectorBaryCentric( x1, x2, x3, f, g ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Barycentric( const Vector2& v1, const Vector2& v2, const Vector2& v3, float f, float g ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR x3 = XMLoadFloat2( &v3 ); + XMVECTOR X = XMVectorBaryCentric( x1, x2, x3, f, g ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::CatmullRom( const Vector2& v1, const Vector2& v2, const Vector2& v3, const Vector2& v4, float t, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR x3 = XMLoadFloat2( &v3 ); + XMVECTOR x4 = XMLoadFloat2( &v4 ); + XMVECTOR X = XMVectorCatmullRom( x1, x2, x3, x4, t ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::CatmullRom( const Vector2& v1, const Vector2& v2, const Vector2& v3, const Vector2& v4, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &v2 ); + XMVECTOR x3 = XMLoadFloat2( &v3 ); + XMVECTOR x4 = XMLoadFloat2( &v4 ); + XMVECTOR X = XMVectorCatmullRom( x1, x2, x3, x4, t ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Hermite( const Vector2& v1, const Vector2& t1, const Vector2& v2, const Vector2& t2, float t, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &t1 ); + XMVECTOR x3 = XMLoadFloat2( &v2 ); + XMVECTOR x4 = XMLoadFloat2( &t2 ); + XMVECTOR X = XMVectorHermite( x1, x2, x3, x4, t ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Hermite( const Vector2& v1, const Vector2& t1, const Vector2& v2, const Vector2& t2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat2( &v1 ); + XMVECTOR x2 = XMLoadFloat2( &t1 ); + XMVECTOR x3 = XMLoadFloat2( &v2 ); + XMVECTOR x4 = XMLoadFloat2( &t2 ); + XMVECTOR X = XMVectorHermite( x1, x2, x3, x4, t ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Reflect( const Vector2& ivec, const Vector2& nvec, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat2( &ivec ); + XMVECTOR n = XMLoadFloat2( &nvec ); + XMVECTOR X = XMVector2Reflect( i, n ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Reflect( const Vector2& ivec, const Vector2& nvec ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat2( &ivec ); + XMVECTOR n = XMLoadFloat2( &nvec ); + XMVECTOR X = XMVector2Reflect( i, n ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Refract( const Vector2& ivec, const Vector2& nvec, float refractionIndex, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat2( &ivec ); + XMVECTOR n = XMLoadFloat2( &nvec ); + XMVECTOR X = XMVector2Refract( i, n, refractionIndex ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Refract( const Vector2& ivec, const Vector2& nvec, float refractionIndex ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat2( &ivec ); + XMVECTOR n = XMLoadFloat2( &nvec ); + XMVECTOR X = XMVector2Refract( i, n, refractionIndex ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Transform( const Vector2& v, const Quaternion& quat, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Transform( const Vector2& v, const Quaternion& quat ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +inline void Vector2::Transform( const Vector2& v, const Matrix& m, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector2TransformCoord( v1, M ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::Transform( const Vector2& v, const Matrix& m ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector2TransformCoord( v1, M ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +_Use_decl_annotations_ +inline void Vector2::Transform( const Vector2* varray, size_t count, const Matrix& m, Vector2* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector2TransformCoordStream( resultArray, sizeof(XMFLOAT2), varray, sizeof(XMFLOAT2), count, M ); +} + +inline void Vector2::Transform( const Vector2& v, const Matrix& m, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector2Transform( v1, M ); + XMStoreFloat4( &result, X ); +} + +_Use_decl_annotations_ +inline void Vector2::Transform( const Vector2* varray, size_t count, const Matrix& m, Vector4* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector2TransformStream( resultArray, sizeof(XMFLOAT4), varray, sizeof(XMFLOAT2), count, M ); +} + +inline void Vector2::TransformNormal( const Vector2& v, const Matrix& m, Vector2& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector2TransformNormal( v1, M ); + XMStoreFloat2( &result, X ); +} + +inline Vector2 Vector2::TransformNormal( const Vector2& v, const Matrix& m ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector2TransformNormal( v1, M ); + + Vector2 result; + XMStoreFloat2( &result, X ); + return result; +} + +_Use_decl_annotations_ +inline void Vector2::TransformNormal( const Vector2* varray, size_t count, const Matrix& m, Vector2* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector2TransformNormalStream( resultArray, sizeof(XMFLOAT2), varray, sizeof(XMFLOAT2), count, M ); +} + + +/**************************************************************************** + * + * Vector3 + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Vector3::operator == ( const Vector3& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + return XMVector3Equal( v1, v2 ); +} + +inline bool Vector3::operator != ( const Vector3& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + return XMVector3NotEqual( v1, v2 ); +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Vector3& Vector3::operator+= (const Vector3& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + XMVECTOR X = XMVectorAdd(v1,v2); + XMStoreFloat3( this, X ); + return *this; +} + +inline Vector3& Vector3::operator-= (const Vector3& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + XMVECTOR X = XMVectorSubtract(v1,v2); + XMStoreFloat3( this, X ); + return *this; +} + +inline Vector3& Vector3::operator*= (const Vector3& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + XMVECTOR X = XMVectorMultiply(v1,v2); + XMStoreFloat3( this, X ); + return *this; +} + +inline Vector3& Vector3::operator*= (float S) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVectorScale(v1,S); + XMStoreFloat3( this, X ); + return *this; +} + +inline Vector3& Vector3::operator/= (float S) +{ + using namespace DirectX; + assert( S != 0.0f ); + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVectorScale(v1, 1.f/S); + XMStoreFloat3( this, X ); + return *this; +} + +//------------------------------------------------------------------------------ +// Urnary operators +//------------------------------------------------------------------------------ + +inline Vector3 Vector3::operator- () const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVectorNegate( v1 ); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +//------------------------------------------------------------------------------ +// Binary operators +//------------------------------------------------------------------------------ + +inline Vector3 operator+ (const Vector3& V1, const Vector3& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &V1 ); + XMVECTOR v2 = XMLoadFloat3( &V2 ); + XMVECTOR X = XMVectorAdd(v1,v2); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +inline Vector3 operator- (const Vector3& V1, const Vector3& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &V1 ); + XMVECTOR v2 = XMLoadFloat3( &V2 ); + XMVECTOR X = XMVectorSubtract(v1,v2); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +inline Vector3 operator* (const Vector3& V1, const Vector3& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &V1 ); + XMVECTOR v2 = XMLoadFloat3( &V2 ); + XMVECTOR X = XMVectorMultiply(v1,v2); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +inline Vector3 operator* (const Vector3& V, float S) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &V ); + XMVECTOR X = XMVectorScale(v1,S); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +inline Vector3 operator/ (const Vector3& V1, const Vector3& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &V1 ); + XMVECTOR v2 = XMLoadFloat3( &V2 ); + XMVECTOR X = XMVectorDivide(v1,v2); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +inline Vector3 operator* (float S, const Vector3& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &V ); + XMVECTOR X = XMVectorScale(v1,S); + Vector3 R; + XMStoreFloat3( &R, X ); + return R; +} + +//------------------------------------------------------------------------------ +// Vector operations +//------------------------------------------------------------------------------ + +inline bool Vector3::InBounds( const Vector3& Bounds ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &Bounds ); + return XMVector3InBounds( v1, v2 ); +} + +inline float Vector3::Length() const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVector3Length( v1 ); + return XMVectorGetX( X ); +} + +inline float Vector3::LengthSquared() const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVector3LengthSq( v1 ); + return XMVectorGetX( X ); +} + +inline float Vector3::Dot( const Vector3& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + XMVECTOR X = XMVector3Dot( v1, v2 ); + return XMVectorGetX( X ); +} + +inline void Vector3::Cross( const Vector3& V, Vector3& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + XMVECTOR R = XMVector3Cross( v1, v2 ); + XMStoreFloat3( &result, R ); +} + +inline Vector3 Vector3::Cross( const Vector3& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &V ); + XMVECTOR R = XMVector3Cross( v1, v2 ); + + Vector3 result; + XMStoreFloat3( &result, R ); + return result; +} + +inline void Vector3::Normalize() +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVector3Normalize( v1 ); + XMStoreFloat3( this, X ); +} + +inline void Vector3::Normalize( Vector3& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR X = XMVector3Normalize( v1 ); + XMStoreFloat3( &result, X ); +} + +inline void Vector3::Clamp( const Vector3& vmin, const Vector3& vmax ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &vmin ); + XMVECTOR v3 = XMLoadFloat3( &vmax ); + XMVECTOR X = XMVectorClamp( v1, v2, v3 ); + XMStoreFloat3( this, X ); +} + +inline void Vector3::Clamp( const Vector3& vmin, const Vector3& vmax, Vector3& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( this ); + XMVECTOR v2 = XMLoadFloat3( &vmin ); + XMVECTOR v3 = XMLoadFloat3( &vmax ); + XMVECTOR X = XMVectorClamp( v1, v2, v3 ); + XMStoreFloat3( &result, X ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline float Vector3::Distance( const Vector3& v1, const Vector3& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR V = XMVectorSubtract( x2, x1 ); + XMVECTOR X = XMVector3Length( V ); + return XMVectorGetX( X ); +} + +inline float Vector3::DistanceSquared( const Vector3& v1, const Vector3& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR V = XMVectorSubtract( x2, x1 ); + XMVECTOR X = XMVector3LengthSq( V ); + return XMVectorGetX( X ); +} + +inline void Vector3::Min( const Vector3& v1, const Vector3& v2, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorMin( x1, x2 ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Min( const Vector3& v1, const Vector3& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorMin( x1, x2 ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Max( const Vector3& v1, const Vector3& v2, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorMax( x1, x2 ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Max( const Vector3& v1, const Vector3& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorMax( x1, x2 ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Lerp( const Vector3& v1, const Vector3& v2, float t, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Lerp( const Vector3& v1, const Vector3& v2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::SmoothStep( const Vector3& v1, const Vector3& v2, float t, Vector3& result ) +{ + using namespace DirectX; + t = (t > 1.0f) ? 1.0f : ((t < 0.0f) ? 0.0f : t); // Clamp value to 0 to 1 + t = t*t*(3.f - 2.f*t); + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::SmoothStep( const Vector3& v1, const Vector3& v2, float t ) +{ + using namespace DirectX; + t = (t > 1.0f) ? 1.0f : ((t < 0.0f) ? 0.0f : t); // Clamp value to 0 to 1 + t = t*t*(3.f - 2.f*t); + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Barycentric( const Vector3& v1, const Vector3& v2, const Vector3& v3, float f, float g, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR x3 = XMLoadFloat3( &v3 ); + XMVECTOR X = XMVectorBaryCentric( x1, x2, x3, f, g ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Barycentric( const Vector3& v1, const Vector3& v2, const Vector3& v3, float f, float g ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR x3 = XMLoadFloat3( &v3 ); + XMVECTOR X = XMVectorBaryCentric( x1, x2, x3, f, g ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::CatmullRom( const Vector3& v1, const Vector3& v2, const Vector3& v3, const Vector3& v4, float t, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR x3 = XMLoadFloat3( &v3 ); + XMVECTOR x4 = XMLoadFloat3( &v4 ); + XMVECTOR X = XMVectorCatmullRom( x1, x2, x3, x4, t ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::CatmullRom( const Vector3& v1, const Vector3& v2, const Vector3& v3, const Vector3& v4, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &v2 ); + XMVECTOR x3 = XMLoadFloat3( &v3 ); + XMVECTOR x4 = XMLoadFloat3( &v4 ); + XMVECTOR X = XMVectorCatmullRom( x1, x2, x3, x4, t ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Hermite( const Vector3& v1, const Vector3& t1, const Vector3& v2, const Vector3& t2, float t, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &t1 ); + XMVECTOR x3 = XMLoadFloat3( &v2 ); + XMVECTOR x4 = XMLoadFloat3( &t2 ); + XMVECTOR X = XMVectorHermite( x1, x2, x3, x4, t ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Hermite( const Vector3& v1, const Vector3& t1, const Vector3& v2, const Vector3& t2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat3( &v1 ); + XMVECTOR x2 = XMLoadFloat3( &t1 ); + XMVECTOR x3 = XMLoadFloat3( &v2 ); + XMVECTOR x4 = XMLoadFloat3( &t2 ); + XMVECTOR X = XMVectorHermite( x1, x2, x3, x4, t ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Reflect( const Vector3& ivec, const Vector3& nvec, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat3( &ivec ); + XMVECTOR n = XMLoadFloat3( &nvec ); + XMVECTOR X = XMVector3Reflect( i, n ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Reflect( const Vector3& ivec, const Vector3& nvec ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat3( &ivec ); + XMVECTOR n = XMLoadFloat3( &nvec ); + XMVECTOR X = XMVector3Reflect( i, n ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Refract( const Vector3& ivec, const Vector3& nvec, float refractionIndex, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat3( &ivec ); + XMVECTOR n = XMLoadFloat3( &nvec ); + XMVECTOR X = XMVector3Refract( i, n, refractionIndex ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Refract( const Vector3& ivec, const Vector3& nvec, float refractionIndex ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat3( &ivec ); + XMVECTOR n = XMLoadFloat3( &nvec ); + XMVECTOR X = XMVector3Refract( i, n, refractionIndex ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Transform( const Vector3& v, const Quaternion& quat, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Transform( const Vector3& v, const Quaternion& quat ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +inline void Vector3::Transform( const Vector3& v, const Matrix& m, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector3TransformCoord( v1, M ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::Transform( const Vector3& v, const Matrix& m ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector3TransformCoord( v1, M ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +_Use_decl_annotations_ +inline void Vector3::Transform( const Vector3* varray, size_t count, const Matrix& m, Vector3* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector3TransformCoordStream( resultArray, sizeof(XMFLOAT3), varray, sizeof(XMFLOAT3), count, M ); +} + +inline void Vector3::Transform( const Vector3& v, const Matrix& m, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector3Transform( v1, M ); + XMStoreFloat4( &result, X ); +} + +_Use_decl_annotations_ +inline void Vector3::Transform( const Vector3* varray, size_t count, const Matrix& m, Vector4* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector3TransformStream( resultArray, sizeof(XMFLOAT4), varray, sizeof(XMFLOAT3), count, M ); +} + +inline void Vector3::TransformNormal( const Vector3& v, const Matrix& m, Vector3& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector3TransformNormal( v1, M ); + XMStoreFloat3( &result, X ); +} + +inline Vector3 Vector3::TransformNormal( const Vector3& v, const Matrix& m ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector3TransformNormal( v1, M ); + + Vector3 result; + XMStoreFloat3( &result, X ); + return result; +} + +_Use_decl_annotations_ +inline void Vector3::TransformNormal( const Vector3* varray, size_t count, const Matrix& m, Vector3* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector3TransformNormalStream( resultArray, sizeof(XMFLOAT3), varray, sizeof(XMFLOAT3), count, M ); +} + + +/**************************************************************************** + * + * Vector4 + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Vector4::operator == ( const Vector4& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &V ); + return XMVector4Equal( v1, v2 ); +} + +inline bool Vector4::operator != ( const Vector4& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &V ); + return XMVector4NotEqual( v1, v2 ); +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Vector4& Vector4::operator+= (const Vector4& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &V ); + XMVECTOR X = XMVectorAdd(v1,v2); + XMStoreFloat4( this, X ); + return *this; +} + +inline Vector4& Vector4::operator-= (const Vector4& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &V ); + XMVECTOR X = XMVectorSubtract(v1,v2); + XMStoreFloat4( this, X ); + return *this; +} + +inline Vector4& Vector4::operator*= (const Vector4& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &V ); + XMVECTOR X = XMVectorMultiply(v1,v2); + XMStoreFloat4( this, X ); + return *this; +} + +inline Vector4& Vector4::operator*= (float S) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVectorScale(v1,S); + XMStoreFloat4( this, X ); + return *this; +} + +inline Vector4& Vector4::operator/= (float S) +{ + using namespace DirectX; + assert( S != 0.0f ); + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVectorScale(v1, 1.f/S); + XMStoreFloat4( this, X ); + return *this; +} + +//------------------------------------------------------------------------------ +// Urnary operators +//------------------------------------------------------------------------------ + +inline Vector4 Vector4::operator- () const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVectorNegate( v1 ); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +//------------------------------------------------------------------------------ +// Binary operators +//------------------------------------------------------------------------------ + +inline Vector4 operator+ (const Vector4& V1, const Vector4& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &V1 ); + XMVECTOR v2 = XMLoadFloat4( &V2 ); + XMVECTOR X = XMVectorAdd(v1,v2); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +inline Vector4 operator- (const Vector4& V1, const Vector4& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &V1 ); + XMVECTOR v2 = XMLoadFloat4( &V2 ); + XMVECTOR X = XMVectorSubtract(v1,v2); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +inline Vector4 operator* (const Vector4& V1, const Vector4& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &V1 ); + XMVECTOR v2 = XMLoadFloat4( &V2 ); + XMVECTOR X = XMVectorMultiply(v1,v2); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +inline Vector4 operator* (const Vector4& V, float S) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &V ); + XMVECTOR X = XMVectorScale(v1,S); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +inline Vector4 operator/ (const Vector4& V1, const Vector4& V2) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &V1 ); + XMVECTOR v2 = XMLoadFloat4( &V2 ); + XMVECTOR X = XMVectorDivide(v1,v2); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +inline Vector4 operator* (float S, const Vector4& V) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &V ); + XMVECTOR X = XMVectorScale(v1,S); + Vector4 R; + XMStoreFloat4( &R, X ); + return R; +} + +//------------------------------------------------------------------------------ +// Vector operations +//------------------------------------------------------------------------------ + +inline bool Vector4::InBounds( const Vector4& Bounds ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &Bounds ); + return XMVector4InBounds( v1, v2 ); +} + +inline float Vector4::Length() const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVector4Length( v1 ); + return XMVectorGetX( X ); +} + +inline float Vector4::LengthSquared() const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVector4LengthSq( v1 ); + return XMVectorGetX( X ); +} + +inline float Vector4::Dot( const Vector4& V ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &V ); + XMVECTOR X = XMVector4Dot( v1, v2 ); + return XMVectorGetX( X ); +} + +inline void Vector4::Cross( const Vector4& v1, const Vector4& v2, Vector4& result ) const +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( this ); + XMVECTOR x2 = XMLoadFloat4( &v1 ); + XMVECTOR x3 = XMLoadFloat4( &v2 ); + XMVECTOR R = XMVector4Cross( x1, x2, x3 ); + XMStoreFloat4( &result, R ); +} + +inline Vector4 Vector4::Cross( const Vector4& v1, const Vector4& v2 ) const +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( this ); + XMVECTOR x2 = XMLoadFloat4( &v1 ); + XMVECTOR x3 = XMLoadFloat4( &v2 ); + XMVECTOR R = XMVector4Cross( x1, x2, x3 ); + + Vector4 result; + XMStoreFloat4( &result, R ); + return result; +} + +inline void Vector4::Normalize() +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVector4Normalize( v1 ); + XMStoreFloat4( this, X ); +} + +inline void Vector4::Normalize( Vector4& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR X = XMVector4Normalize( v1 ); + XMStoreFloat4( &result, X ); +} + +inline void Vector4::Clamp( const Vector4& vmin, const Vector4& vmax ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &vmin ); + XMVECTOR v3 = XMLoadFloat4( &vmax ); + XMVECTOR X = XMVectorClamp( v1, v2, v3 ); + XMStoreFloat4( this, X ); +} + +inline void Vector4::Clamp( const Vector4& vmin, const Vector4& vmax, Vector4& result ) const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( this ); + XMVECTOR v2 = XMLoadFloat4( &vmin ); + XMVECTOR v3 = XMLoadFloat4( &vmax ); + XMVECTOR X = XMVectorClamp( v1, v2, v3 ); + XMStoreFloat4( &result, X ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline float Vector4::Distance( const Vector4& v1, const Vector4& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR V = XMVectorSubtract( x2, x1 ); + XMVECTOR X = XMVector4Length( V ); + return XMVectorGetX( X ); +} + +inline float Vector4::DistanceSquared( const Vector4& v1, const Vector4& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR V = XMVectorSubtract( x2, x1 ); + XMVECTOR X = XMVector4LengthSq( V ); + return XMVectorGetX( X ); +} + +inline void Vector4::Min( const Vector4& v1, const Vector4& v2, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorMin( x1, x2 ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Min( const Vector4& v1, const Vector4& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorMin( x1, x2 ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Max( const Vector4& v1, const Vector4& v2, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorMax( x1, x2 ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Max( const Vector4& v1, const Vector4& v2 ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorMax( x1, x2 ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Lerp( const Vector4& v1, const Vector4& v2, float t, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Lerp( const Vector4& v1, const Vector4& v2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::SmoothStep( const Vector4& v1, const Vector4& v2, float t, Vector4& result ) +{ + using namespace DirectX; + t = (t > 1.0f) ? 1.0f : ((t < 0.0f) ? 0.0f : t); // Clamp value to 0 to 1 + t = t*t*(3.f - 2.f*t); + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::SmoothStep( const Vector4& v1, const Vector4& v2, float t ) +{ + using namespace DirectX; + t = (t > 1.0f) ? 1.0f : ((t < 0.0f) ? 0.0f : t); // Clamp value to 0 to 1 + t = t*t*(3.f - 2.f*t); + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR X = XMVectorLerp( x1, x2, t ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Barycentric( const Vector4& v1, const Vector4& v2, const Vector4& v3, float f, float g, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR x3 = XMLoadFloat4( &v3 ); + XMVECTOR X = XMVectorBaryCentric( x1, x2, x3, f, g ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Barycentric( const Vector4& v1, const Vector4& v2, const Vector4& v3, float f, float g ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR x3 = XMLoadFloat4( &v3 ); + XMVECTOR X = XMVectorBaryCentric( x1, x2, x3, f, g ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::CatmullRom( const Vector4& v1, const Vector4& v2, const Vector4& v3, const Vector4& v4, float t, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR x3 = XMLoadFloat4( &v3 ); + XMVECTOR x4 = XMLoadFloat4( &v4 ); + XMVECTOR X = XMVectorCatmullRom( x1, x2, x3, x4, t ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::CatmullRom( const Vector4& v1, const Vector4& v2, const Vector4& v3, const Vector4& v4, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &v2 ); + XMVECTOR x3 = XMLoadFloat4( &v3 ); + XMVECTOR x4 = XMLoadFloat4( &v4 ); + XMVECTOR X = XMVectorCatmullRom( x1, x2, x3, x4, t ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Hermite( const Vector4& v1, const Vector4& t1, const Vector4& v2, const Vector4& t2, float t, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &t1 ); + XMVECTOR x3 = XMLoadFloat4( &v2 ); + XMVECTOR x4 = XMLoadFloat4( &t2 ); + XMVECTOR X = XMVectorHermite( x1, x2, x3, x4, t ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Hermite( const Vector4& v1, const Vector4& t1, const Vector4& v2, const Vector4& t2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( &v1 ); + XMVECTOR x2 = XMLoadFloat4( &t1 ); + XMVECTOR x3 = XMLoadFloat4( &v2 ); + XMVECTOR x4 = XMLoadFloat4( &t2 ); + XMVECTOR X = XMVectorHermite( x1, x2, x3, x4, t ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Reflect( const Vector4& ivec, const Vector4& nvec, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat4( &ivec ); + XMVECTOR n = XMLoadFloat4( &nvec ); + XMVECTOR X = XMVector4Reflect( i, n ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Reflect( const Vector4& ivec, const Vector4& nvec ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat4( &ivec ); + XMVECTOR n = XMLoadFloat4( &nvec ); + XMVECTOR X = XMVector4Reflect( i, n ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Refract( const Vector4& ivec, const Vector4& nvec, float refractionIndex, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat4( &ivec ); + XMVECTOR n = XMLoadFloat4( &nvec ); + XMVECTOR X = XMVector4Refract( i, n, refractionIndex ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Refract( const Vector4& ivec, const Vector4& nvec, float refractionIndex ) +{ + using namespace DirectX; + XMVECTOR i = XMLoadFloat4( &ivec ); + XMVECTOR n = XMLoadFloat4( &nvec ); + XMVECTOR X = XMVector4Refract( i, n, refractionIndex ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Transform( const Vector2& v, const Quaternion& quat, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + X = XMVectorSelect( g_XMIdentityR3, X, g_XMSelect1110 ); // result.w = 1.f + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Transform( const Vector2& v, const Quaternion& quat ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat2( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + X = XMVectorSelect( g_XMIdentityR3, X, g_XMSelect1110 ); // result.w = 1.f + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Transform( const Vector3& v, const Quaternion& quat, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + X = XMVectorSelect( g_XMIdentityR3, X, g_XMSelect1110 ); // result.w = 1.f + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Transform( const Vector3& v, const Quaternion& quat ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat3( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + X = XMVectorSelect( g_XMIdentityR3, X, g_XMSelect1110 ); // result.w = 1.f + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Transform( const Vector4& v, const Quaternion& quat, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + X = XMVectorSelect( v1, X, g_XMSelect1110 ); // result.w = v.w + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Transform( const Vector4& v, const Quaternion& quat ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &v ); + XMVECTOR q = XMLoadFloat4( &quat ); + XMVECTOR X = XMVector3Rotate( v1, q ); + X = XMVectorSelect( v1, X, g_XMSelect1110 ); // result.w = v.w + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +inline void Vector4::Transform( const Vector4& v, const Matrix& m, Vector4& result ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector4Transform( v1, M ); + XMStoreFloat4( &result, X ); +} + +inline Vector4 Vector4::Transform( const Vector4& v, const Matrix& m ) +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( &v ); + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVECTOR X = XMVector4Transform( v1, M ); + + Vector4 result; + XMStoreFloat4( &result, X ); + return result; +} + +_Use_decl_annotations_ +inline void Vector4::Transform( const Vector4* varray, size_t count, const Matrix& m, Vector4* resultArray ) +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( &m ); + XMVector4TransformStream( resultArray, sizeof(XMFLOAT4), varray, sizeof(XMFLOAT4), count, M ); +} + + +/**************************************************************************** + * + * Matrix + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Matrix::operator == ( const Matrix& M ) const +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + return ( XMVector4Equal( x1, y1 ) + && XMVector4Equal( x2, y2 ) + && XMVector4Equal( x3, y3 ) + && XMVector4Equal( x4, y4 ) ) != 0; +} + +inline bool Matrix::operator != ( const Matrix& M ) const +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + return ( XMVector4NotEqual( x1, y1 ) + || XMVector4NotEqual( x2, y2 ) + || XMVector4NotEqual( x3, y3 ) + || XMVector4NotEqual( x4, y4 ) ) != 0; +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Matrix::Matrix(const XMFLOAT3X3& M) +{ + _11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f; + _21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f; + _31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f; + _41 = 0.f; _42 = 0.f; _43 = 0.f; _44 = 1.f; +} + +inline Matrix::Matrix(const XMFLOAT4X3& M) +{ + _11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f; + _21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f; + _31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f; + _41 = M._41; _42 = M._42; _43 = M._43; _44 = 1.f; +} + +inline Matrix& Matrix::operator= (const XMFLOAT3X3& M) +{ + _11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f; + _21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f; + _31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f; + _41 = 0.f; _42 = 0.f; _43 = 0.f; _44 = 1.f; + return *this; +} + +inline Matrix& Matrix::operator= (const XMFLOAT4X3& M) +{ + _11 = M._11; _12 = M._12; _13 = M._13; _14 = 0.f; + _21 = M._21; _22 = M._22; _23 = M._23; _24 = 0.f; + _31 = M._31; _32 = M._32; _33 = M._33; _34 = 0.f; + _41 = M._41; _42 = M._42; _43 = M._43; _44 = 1.f; + return *this; +} + +inline Matrix& Matrix::operator+= (const Matrix& M) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + x1 = XMVectorAdd( x1, y1 ); + x2 = XMVectorAdd( x2, y2 ); + x3 = XMVectorAdd( x3, y3 ); + x4 = XMVectorAdd( x4, y4 ); + + XMStoreFloat4( reinterpret_cast(&_11), x1 ); + XMStoreFloat4( reinterpret_cast(&_21), x2 ); + XMStoreFloat4( reinterpret_cast(&_31), x3 ); + XMStoreFloat4( reinterpret_cast(&_41), x4 ); + return *this; +} + +inline Matrix& Matrix::operator-= (const Matrix& M) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + x1 = XMVectorSubtract( x1, y1 ); + x2 = XMVectorSubtract( x2, y2 ); + x3 = XMVectorSubtract( x3, y3 ); + x4 = XMVectorSubtract( x4, y4 ); + + XMStoreFloat4( reinterpret_cast(&_11), x1 ); + XMStoreFloat4( reinterpret_cast(&_21), x2 ); + XMStoreFloat4( reinterpret_cast(&_31), x3 ); + XMStoreFloat4( reinterpret_cast(&_41), x4 ); + return *this; +} + +inline Matrix& Matrix::operator*= (const Matrix& M) +{ + using namespace DirectX; + XMMATRIX M1 = XMLoadFloat4x4( this ); + XMMATRIX M2 = XMLoadFloat4x4( &M ); + XMMATRIX X = XMMatrixMultiply( M1, M2 ); + XMStoreFloat4x4( this, X ); + return *this; +} + +inline Matrix& Matrix::operator*= (float S) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + x1 = XMVectorScale( x1, S ); + x2 = XMVectorScale( x2, S ); + x3 = XMVectorScale( x3, S ); + x4 = XMVectorScale( x4, S ); + + XMStoreFloat4( reinterpret_cast(&_11), x1 ); + XMStoreFloat4( reinterpret_cast(&_21), x2 ); + XMStoreFloat4( reinterpret_cast(&_31), x3 ); + XMStoreFloat4( reinterpret_cast(&_41), x4 ); + return *this; +} + +inline Matrix& Matrix::operator/= (float S) +{ + using namespace DirectX; + assert( S != 0.f ); + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + float rs = 1.f / S; + + x1 = XMVectorScale( x1, rs ); + x2 = XMVectorScale( x2, rs ); + x3 = XMVectorScale( x3, rs ); + x4 = XMVectorScale( x4, rs ); + + XMStoreFloat4( reinterpret_cast(&_11), x1 ); + XMStoreFloat4( reinterpret_cast(&_21), x2 ); + XMStoreFloat4( reinterpret_cast(&_31), x3 ); + XMStoreFloat4( reinterpret_cast(&_41), x4 ); + return *this; +} + +inline Matrix& Matrix::operator/= (const Matrix& M) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + x1 = XMVectorDivide( x1, y1 ); + x2 = XMVectorDivide( x2, y2 ); + x3 = XMVectorDivide( x3, y3 ); + x4 = XMVectorDivide( x4, y4 ); + + XMStoreFloat4( reinterpret_cast(&_11), x1 ); + XMStoreFloat4( reinterpret_cast(&_21), x2 ); + XMStoreFloat4( reinterpret_cast(&_31), x3 ); + XMStoreFloat4( reinterpret_cast(&_41), x4 ); + return *this; +} + +//------------------------------------------------------------------------------ +// Urnary operators +//------------------------------------------------------------------------------ + +inline Matrix Matrix::operator- () const +{ + using namespace DirectX; + XMVECTOR v1 = XMLoadFloat4( reinterpret_cast(&_11) ); + XMVECTOR v2 = XMLoadFloat4( reinterpret_cast(&_21) ); + XMVECTOR v3 = XMLoadFloat4( reinterpret_cast(&_31) ); + XMVECTOR v4 = XMLoadFloat4( reinterpret_cast(&_41) ); + + v1 = XMVectorNegate( v1 ); + v2 = XMVectorNegate( v2 ); + v3 = XMVectorNegate( v3 ); + v4 = XMVectorNegate( v4 ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), v1 ); + XMStoreFloat4( reinterpret_cast(&R._21), v2 ); + XMStoreFloat4( reinterpret_cast(&R._31), v3 ); + XMStoreFloat4( reinterpret_cast(&R._41), v4 ); + return R; +} + +//------------------------------------------------------------------------------ +// Binary operators +//------------------------------------------------------------------------------ + +inline Matrix operator+ (const Matrix& M1, const Matrix& M2) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M1._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M1._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M1._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M1._41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M2._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M2._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M2._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M2._41) ); + + x1 = XMVectorAdd( x1, y1 ); + x2 = XMVectorAdd( x2, y2 ); + x3 = XMVectorAdd( x3, y3 ); + x4 = XMVectorAdd( x4, y4 ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), x1 ); + XMStoreFloat4( reinterpret_cast(&R._21), x2 ); + XMStoreFloat4( reinterpret_cast(&R._31), x3 ); + XMStoreFloat4( reinterpret_cast(&R._41), x4 ); + return R; +} + +inline Matrix operator- (const Matrix& M1, const Matrix& M2) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M1._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M1._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M1._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M1._41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M2._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M2._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M2._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M2._41) ); + + x1 = XMVectorSubtract( x1, y1 ); + x2 = XMVectorSubtract( x2, y2 ); + x3 = XMVectorSubtract( x3, y3 ); + x4 = XMVectorSubtract( x4, y4 ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), x1 ); + XMStoreFloat4( reinterpret_cast(&R._21), x2 ); + XMStoreFloat4( reinterpret_cast(&R._31), x3 ); + XMStoreFloat4( reinterpret_cast(&R._41), x4 ); + return R; +} + +inline Matrix operator* (const Matrix& M1, const Matrix& M2) +{ + using namespace DirectX; + XMMATRIX m1 = XMLoadFloat4x4( &M1 ); + XMMATRIX m2 = XMLoadFloat4x4( &M2 ); + XMMATRIX X = XMMatrixMultiply( m1, m2 ); + + Matrix R; + XMStoreFloat4x4( &R, X ); + return R; +} + +inline Matrix operator* (const Matrix& M, float S) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + x1 = XMVectorScale( x1, S ); + x2 = XMVectorScale( x2, S ); + x3 = XMVectorScale( x3, S ); + x4 = XMVectorScale( x4, S ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), x1 ); + XMStoreFloat4( reinterpret_cast(&R._21), x2 ); + XMStoreFloat4( reinterpret_cast(&R._31), x3 ); + XMStoreFloat4( reinterpret_cast(&R._41), x4 ); + return R; +} + +inline Matrix operator/ (const Matrix& M, float S) +{ + using namespace DirectX; + assert( S != 0.f ); + + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + float rs = 1.f / S; + + x1 = XMVectorScale( x1, rs ); + x2 = XMVectorScale( x2, rs ); + x3 = XMVectorScale( x3, rs ); + x4 = XMVectorScale( x4, rs ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), x1 ); + XMStoreFloat4( reinterpret_cast(&R._21), x2 ); + XMStoreFloat4( reinterpret_cast(&R._31), x3 ); + XMStoreFloat4( reinterpret_cast(&R._41), x4 ); + return R; +} + +inline Matrix operator/ (const Matrix& M1, const Matrix& M2) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M1._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M1._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M1._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M1._41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M2._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M2._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M2._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M2._41) ); + + x1 = XMVectorDivide( x1, y1 ); + x2 = XMVectorDivide( x2, y2 ); + x3 = XMVectorDivide( x3, y3 ); + x4 = XMVectorDivide( x4, y4 ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), x1 ); + XMStoreFloat4( reinterpret_cast(&R._21), x2 ); + XMStoreFloat4( reinterpret_cast(&R._31), x3 ); + XMStoreFloat4( reinterpret_cast(&R._41), x4 ); + return R; +} + +inline Matrix operator* (float S, const Matrix& M) +{ + using namespace DirectX; + + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M._41) ); + + x1 = XMVectorScale( x1, S ); + x2 = XMVectorScale( x2, S ); + x3 = XMVectorScale( x3, S ); + x4 = XMVectorScale( x4, S ); + + Matrix R; + XMStoreFloat4( reinterpret_cast(&R._11), x1 ); + XMStoreFloat4( reinterpret_cast(&R._21), x2 ); + XMStoreFloat4( reinterpret_cast(&R._31), x3 ); + XMStoreFloat4( reinterpret_cast(&R._41), x4 ); + return R; +} + +//------------------------------------------------------------------------------ +// Matrix operations +//------------------------------------------------------------------------------ + +inline bool Matrix::Decompose( Vector3& scale, Quaternion& rotation, Vector3& translation ) +{ + using namespace DirectX; + + XMVECTOR s, r, t; + + if ( !XMMatrixDecompose( &s, &r, &t, *this ) ) + return false; + + XMStoreFloat3( &scale, s ); + XMStoreFloat4( &rotation, r ); + XMStoreFloat3( &translation, t ); + + return true; +} + +inline Matrix Matrix::Transpose() const +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( this ); + Matrix R; + XMStoreFloat4x4( &R, XMMatrixTranspose( M ) ); + return R; +} + +inline void Matrix::Transpose( Matrix& result ) const +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( this ); + XMStoreFloat4x4( &result, XMMatrixTranspose( M ) ); +} + +inline Matrix Matrix::Invert() const +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( this ); + Matrix R; + XMVECTOR det; + XMStoreFloat4x4( &R, XMMatrixInverse( &det, M ) ); + return R; +} + +inline void Matrix::Invert( Matrix& result ) const +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( this ); + XMVECTOR det; + XMStoreFloat4x4( &result, XMMatrixInverse( &det, M ) ); +} + +inline float Matrix::Determinant() const +{ + using namespace DirectX; + XMMATRIX M = XMLoadFloat4x4( this ); + return XMVectorGetX( XMMatrixDeterminant( M ) ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +_Use_decl_annotations_ +inline Matrix Matrix::CreateBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& cameraUp, const Vector3* cameraForward ) +{ + using namespace DirectX; + XMVECTOR O = XMLoadFloat3( &object ); + XMVECTOR C = XMLoadFloat3( &cameraPosition ); + XMVECTOR Z = XMVectorSubtract( O, C ); + + XMVECTOR N = XMVector3LengthSq( Z ); + if ( XMVector3Less( N, g_XMEpsilon ) ) + { + if ( cameraForward ) + { + XMVECTOR F = XMLoadFloat3( cameraForward ); + Z = XMVectorNegate( F ); + } + else + Z = g_XMNegIdentityR2; + } + else + { + Z = XMVector3Normalize( Z ); + } + + XMVECTOR up = XMLoadFloat3( &cameraUp ); + XMVECTOR X = XMVector3Cross( up, Z ); + X = XMVector3Normalize( X ); + + XMVECTOR Y = XMVector3Cross( Z, X ); + + XMMATRIX M; + M.r[0] = X; + M.r[1] = Y; + M.r[2] = Z; + M.r[3] = XMVectorSetW( O, 1.f ); + + Matrix R; + XMStoreFloat4x4( &R, M ); + return R; +} + +_Use_decl_annotations_ +inline Matrix Matrix::CreateConstrainedBillboard( const Vector3& object, const Vector3& cameraPosition, const Vector3& rotateAxis, + const Vector3* cameraForward, const Vector3* objectForward ) +{ + using namespace DirectX; + + static const XMVECTORF32 s_minAngle = { 0.99825467075f, 0.99825467075f, 0.99825467075f, 0.99825467075f }; // 1.0 - XMConvertToRadians( 0.1f ); + + XMVECTOR O = XMLoadFloat3( &object ); + XMVECTOR C = XMLoadFloat3( &cameraPosition ); + XMVECTOR faceDir = XMVectorSubtract( O, C ); + + XMVECTOR N = XMVector3LengthSq( faceDir ); + if (XMVector3Less(N, g_XMEpsilon)) + { + if (cameraForward) + { + XMVECTOR F = XMLoadFloat3( cameraForward ); + faceDir = XMVectorNegate( F ); + } + else + faceDir = g_XMNegIdentityR2; + } + else + { + faceDir = XMVector3Normalize( faceDir ); + } + + XMVECTOR Y = XMLoadFloat3( &rotateAxis ); + XMVECTOR X, Z; + + XMVECTOR dot = XMVectorAbs( XMVector3Dot( Y, faceDir ) ); + if ( XMVector3Greater( dot, s_minAngle ) ) + { + if ( objectForward ) + { + Z = XMLoadFloat3( objectForward ); + dot = XMVectorAbs( XMVector3Dot( Y, Z ) ); + if ( XMVector3Greater( dot, s_minAngle ) ) + { + dot = XMVectorAbs( XMVector3Dot( Y, g_XMNegIdentityR2 ) ); + Z = ( XMVector3Greater( dot, s_minAngle ) ) ? g_XMIdentityR0 : g_XMNegIdentityR2; + } + } + else + { + dot = XMVectorAbs( XMVector3Dot( Y, g_XMNegIdentityR2 ) ); + Z = ( XMVector3Greater( dot, s_minAngle ) ) ? g_XMIdentityR0 : g_XMNegIdentityR2; + } + + X = XMVector3Cross( Y, Z ); + X = XMVector3Normalize( X ); + + Z = XMVector3Cross( X, Y ); + Z = XMVector3Normalize( Z ); + } + else + { + X = XMVector3Cross( Y, faceDir ); + X = XMVector3Normalize( X ); + + Z = XMVector3Cross( X, Y ); + Z = XMVector3Normalize( Z ); + } + + XMMATRIX M; + M.r[0] = X; + M.r[1] = Y; + M.r[2] = Z; + M.r[3] = XMVectorSetW( O, 1.f ); + + Matrix R; + XMStoreFloat4x4( &R, M ); + return R; +} + +inline Matrix Matrix::CreateTranslation( const Vector3& position ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixTranslation( position.x, position.y, position.z ) ); + return R; +} + +inline Matrix Matrix::CreateTranslation( float x, float y, float z ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixTranslation( x, y, z ) ); + return R; +} + +inline Matrix Matrix::CreateScale( const Vector3& scales ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixScaling( scales.x, scales.y, scales.z ) ); + return R; +} + +inline Matrix Matrix::CreateScale( float xs, float ys, float zs ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixScaling( xs, ys, zs ) ); + return R; +} + +inline Matrix Matrix::CreateScale( float scale ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixScaling( scale, scale, scale ) ); + return R; +} + +inline Matrix Matrix::CreateRotationX( float radians ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixRotationX( radians ) ); + return R; +} + +inline Matrix Matrix::CreateRotationY( float radians ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixRotationY( radians ) ); + return R; +} + +inline Matrix Matrix::CreateRotationZ( float radians ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixRotationZ( radians ) ); + return R; +} + +inline Matrix Matrix::CreateFromAxisAngle( const Vector3& axis, float angle ) +{ + using namespace DirectX; + Matrix R; + XMVECTOR a = XMLoadFloat3( &axis ); + XMStoreFloat4x4( &R, XMMatrixRotationAxis( a, angle ) ); + return R; +} + +inline Matrix Matrix::CreatePerspectiveFieldOfView( float fov, float aspectRatio, float nearPlane, float farPlane ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixPerspectiveFovRH( fov, aspectRatio, nearPlane, farPlane ) ); + return R; +} + +inline Matrix Matrix::CreatePerspective( float width, float height, float nearPlane, float farPlane ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixPerspectiveRH( width, height, nearPlane, farPlane ) ); + return R; +} + +inline Matrix Matrix::CreatePerspectiveOffCenter( float left, float right, float bottom, float top, float nearPlane, float farPlane ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixPerspectiveOffCenterRH( left, right, bottom, top, nearPlane, farPlane ) ); + return R; +} + +inline Matrix Matrix::CreateOrthographic( float width, float height, float zNearPlane, float zFarPlane ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixOrthographicRH( width, height, zNearPlane, zFarPlane ) ); + return R; +} + +inline Matrix Matrix::CreateOrthographicOffCenter( float left, float right, float bottom, float top, float zNearPlane, float zFarPlane ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixOrthographicOffCenterRH( left, right, bottom, top, zNearPlane, zFarPlane ) ); + return R; +} + +inline Matrix Matrix::CreateLookAt( const Vector3& eye, const Vector3& target, const Vector3& up ) +{ + using namespace DirectX; + Matrix R; + XMVECTOR eyev = XMLoadFloat3( &eye ); + XMVECTOR targetv = XMLoadFloat3( &target ); + XMVECTOR upv = XMLoadFloat3( &up ); + XMStoreFloat4x4( &R, XMMatrixLookAtRH( eyev, targetv, upv ) ); + return R; +} + +inline Matrix Matrix::CreateWorld( const Vector3& position, const Vector3& forward, const Vector3& up ) +{ + using namespace DirectX; + XMVECTOR zaxis = XMVector3Normalize( XMVectorNegate( XMLoadFloat3( &forward ) ) ); + XMVECTOR yaxis = XMLoadFloat3( &up ); + XMVECTOR xaxis = XMVector3Normalize( XMVector3Cross( yaxis, zaxis ) ); + yaxis = XMVector3Cross( zaxis, xaxis ); + + Matrix R; + XMStoreFloat3( reinterpret_cast( &R._11 ), xaxis ); + XMStoreFloat3( reinterpret_cast( &R._21 ), yaxis ); + XMStoreFloat3( reinterpret_cast( &R._31 ), zaxis ); + R._14 = R._24 = R._34 = 0.f; + R._41 = position.x; R._42 = position.y; R._43 = position.z; + R._44 = 1.f; + return R; +} + +inline Matrix Matrix::CreateFromQuaternion( const Quaternion& rotation ) +{ + using namespace DirectX; + Matrix R; + XMVECTOR quatv = XMLoadFloat4( &rotation ); + XMStoreFloat4x4( &R, XMMatrixRotationQuaternion( quatv ) ); + return R; +} + +inline Matrix Matrix::CreateFromYawPitchRoll( float yaw, float pitch, float roll ) +{ + using namespace DirectX; + Matrix R; + XMStoreFloat4x4( &R, XMMatrixRotationRollPitchYaw( pitch, yaw, roll ) ); + return R; +} + +inline Matrix Matrix::CreateShadow( const Vector3& lightDir, const Plane& plane ) +{ + using namespace DirectX; + Matrix R; + XMVECTOR light = XMLoadFloat3( &lightDir ); + XMVECTOR planev = XMLoadFloat4( &plane ); + XMStoreFloat4x4( &R, XMMatrixShadow( planev, light ) ); + return R; +} + +inline Matrix Matrix::CreateReflection( const Plane& plane ) +{ + using namespace DirectX; + Matrix R; + XMVECTOR planev = XMLoadFloat4( &plane ); + XMStoreFloat4x4( &R, XMMatrixReflect( planev ) ); + return R; +} + +inline void Matrix::Lerp( const Matrix& M1, const Matrix& M2, float t, Matrix& result ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M1._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M1._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M1._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M1._41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M2._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M2._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M2._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M2._41) ); + + x1 = XMVectorLerp( x1, y1, t ); + x2 = XMVectorLerp( x2, y2, t ); + x3 = XMVectorLerp( x3, y3, t ); + x4 = XMVectorLerp( x4, y4, t ); + + XMStoreFloat4( reinterpret_cast(&result._11), x1 ); + XMStoreFloat4( reinterpret_cast(&result._21), x2 ); + XMStoreFloat4( reinterpret_cast(&result._31), x3 ); + XMStoreFloat4( reinterpret_cast(&result._41), x4 ); +} + +inline Matrix Matrix::Lerp( const Matrix& M1, const Matrix& M2, float t ) +{ + using namespace DirectX; + XMVECTOR x1 = XMLoadFloat4( reinterpret_cast(&M1._11) ); + XMVECTOR x2 = XMLoadFloat4( reinterpret_cast(&M1._21) ); + XMVECTOR x3 = XMLoadFloat4( reinterpret_cast(&M1._31) ); + XMVECTOR x4 = XMLoadFloat4( reinterpret_cast(&M1._41) ); + + XMVECTOR y1 = XMLoadFloat4( reinterpret_cast(&M2._11) ); + XMVECTOR y2 = XMLoadFloat4( reinterpret_cast(&M2._21) ); + XMVECTOR y3 = XMLoadFloat4( reinterpret_cast(&M2._31) ); + XMVECTOR y4 = XMLoadFloat4( reinterpret_cast(&M2._41) ); + + x1 = XMVectorLerp( x1, y1, t ); + x2 = XMVectorLerp( x2, y2, t ); + x3 = XMVectorLerp( x3, y3, t ); + x4 = XMVectorLerp( x4, y4, t ); + + Matrix result; + XMStoreFloat4( reinterpret_cast(&result._11), x1 ); + XMStoreFloat4( reinterpret_cast(&result._21), x2 ); + XMStoreFloat4( reinterpret_cast(&result._31), x3 ); + XMStoreFloat4( reinterpret_cast(&result._41), x4 ); + return result; +} + +inline void Matrix::Transform( const Matrix& M, const Quaternion& rotation, Matrix& result ) +{ + using namespace DirectX; + XMVECTOR quatv = XMLoadFloat4( &rotation ); + + XMMATRIX M0 = XMLoadFloat4x4( &M ); + XMMATRIX M1 = XMMatrixRotationQuaternion( quatv ); + + XMStoreFloat4x4( &result, XMMatrixMultiply( M0, M1 ) ); +} + +inline Matrix Matrix::Transform( const Matrix& M, const Quaternion& rotation ) +{ + using namespace DirectX; + XMVECTOR quatv = XMLoadFloat4( &rotation ); + + XMMATRIX M0 = XMLoadFloat4x4( &M ); + XMMATRIX M1 = XMMatrixRotationQuaternion( quatv ); + + Matrix result; + XMStoreFloat4x4( &result, XMMatrixMultiply( M0, M1 ) ); + return result; +} + + +/**************************************************************************** + * + * Plane + * + ****************************************************************************/ + +inline Plane::Plane(const Vector3& point1, const Vector3& point2, const Vector3& point3 ) +{ + using namespace DirectX; + XMVECTOR P0 = XMLoadFloat3( &point1 ); + XMVECTOR P1 = XMLoadFloat3( &point2 ); + XMVECTOR P2 = XMLoadFloat3( &point3 ); + XMStoreFloat4( this, XMPlaneFromPoints( P0, P1, P2 ) ); +} + +inline Plane::Plane(const Vector3& point, const Vector3& normal) +{ + using namespace DirectX; + XMVECTOR P = XMLoadFloat3( &point ); + XMVECTOR N = XMLoadFloat3( &normal ); + XMStoreFloat4( this, XMPlaneFromPointNormal( P, N ) ); +} + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Plane::operator == ( const Plane& p ) const +{ + using namespace DirectX; + XMVECTOR p1 = XMLoadFloat4( this ); + XMVECTOR p2 = XMLoadFloat4( &p ); + return XMPlaneEqual( p1, p2 ); +} + +inline bool Plane::operator != ( const Plane& p ) const +{ + using namespace DirectX; + XMVECTOR p1 = XMLoadFloat4( this ); + XMVECTOR p2 = XMLoadFloat4( &p ); + return XMPlaneNotEqual( p1, p2 ); +} + +//------------------------------------------------------------------------------ +// Plane operations +//------------------------------------------------------------------------------ + +inline void Plane::Normalize() +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( this ); + XMStoreFloat4( this, XMPlaneNormalize( p ) ); +} + +inline void Plane::Normalize( Plane& result ) const +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMPlaneNormalize( p ) ); +} + +inline float Plane::Dot( const Vector4& v ) const +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( this ); + XMVECTOR v0 = XMLoadFloat4( &v ); + return XMVectorGetX( XMPlaneDot( p, v0 ) ); +} + +inline float Plane::DotCoordinate( const Vector3& position ) const +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( this ); + XMVECTOR v0 = XMLoadFloat3( &position ); + return XMVectorGetX( XMPlaneDotCoord( p, v0 ) ); +} + +inline float Plane::DotNormal( const Vector3& normal ) const +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( this ); + XMVECTOR n0 = XMLoadFloat3( &normal ); + return XMVectorGetX( XMPlaneDotNormal( p, n0 ) ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline void Plane::Transform( const Plane& plane, const Matrix& M, Plane& result ) +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( &plane ); + XMMATRIX m0 = XMLoadFloat4x4( &M ); + XMStoreFloat4( &result, XMPlaneTransform( p, m0 ) ); +} + +inline Plane Plane::Transform( const Plane& plane, const Matrix& M ) +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( &plane ); + XMMATRIX m0 = XMLoadFloat4x4( &M ); + + Plane result; + XMStoreFloat4( &result, XMPlaneTransform( p, m0 ) ); + return result; +} + +inline void Plane::Transform( const Plane& plane, const Quaternion& rotation, Plane& result ) +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( &plane ); + XMVECTOR q = XMLoadFloat4( &rotation ); + XMVECTOR X = XMVector3Rotate( p, q ); + X = XMVectorSelect( p, X, g_XMSelect1110 ); // result.d = plane.d + XMStoreFloat4( &result, X ); +} + +inline Plane Plane::Transform( const Plane& plane, const Quaternion& rotation ) +{ + using namespace DirectX; + XMVECTOR p = XMLoadFloat4( &plane ); + XMVECTOR q = XMLoadFloat4( &rotation ); + XMVECTOR X = XMVector3Rotate( p, q ); + X = XMVectorSelect( p, X, g_XMSelect1110 ); // result.d = plane.d + + Plane result; + XMStoreFloat4( &result, X ); + return result; +} + + +/**************************************************************************** + * + * Quaternion + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Quaternion::operator == ( const Quaternion& q ) const +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + return XMQuaternionEqual( q1, q2 ); +} + +inline bool Quaternion::operator != ( const Quaternion& q ) const +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + return XMQuaternionNotEqual( q1, q2 ); +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Quaternion& Quaternion::operator+= (const Quaternion& q) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + XMStoreFloat4( this, XMVectorAdd( q1, q2 ) ); + return *this; +} + +inline Quaternion& Quaternion::operator-= (const Quaternion& q) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + XMStoreFloat4( this, XMVectorSubtract( q1, q2 ) ); + return *this; +} + +inline Quaternion& Quaternion::operator*= (const Quaternion& q) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + XMStoreFloat4( this, XMQuaternionMultiply( q1, q2 ) ); + return *this; +} + +inline Quaternion& Quaternion::operator*= (float S) +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + XMStoreFloat4( this, XMVectorScale( q, S ) ); + return *this; +} + +inline Quaternion& Quaternion::operator/= (const Quaternion& q) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + q2 = XMQuaternionInverse( q2 ); + XMStoreFloat4( this, XMQuaternionMultiply( q1, q2 ) ); + return *this; +} + +//------------------------------------------------------------------------------ +// Urnary operators +//------------------------------------------------------------------------------ + +inline Quaternion Quaternion::operator- () const +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + + Quaternion R; + XMStoreFloat4( &R, XMVectorNegate( q ) ); + return R; +} + +//------------------------------------------------------------------------------ +// Binary operators +//------------------------------------------------------------------------------ + +inline Quaternion operator+ (const Quaternion& Q1, const Quaternion& Q2) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( &Q1 ); + XMVECTOR q2 = XMLoadFloat4( &Q2 ); + + Quaternion R; + XMStoreFloat4( &R, XMVectorAdd( q1, q2 ) ); + return R; +} + +inline Quaternion operator- (const Quaternion& Q1, const Quaternion& Q2) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( &Q1 ); + XMVECTOR q2 = XMLoadFloat4( &Q2 ); + + Quaternion R; + XMStoreFloat4( &R, XMVectorSubtract( q1, q2 ) ); + return R; +} + +inline Quaternion operator* (const Quaternion& Q1, const Quaternion& Q2) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( &Q1 ); + XMVECTOR q2 = XMLoadFloat4( &Q2 ); + + Quaternion R; + XMStoreFloat4( &R, XMQuaternionMultiply( q1, q2 ) ); + return R; +} + +inline Quaternion operator* (const Quaternion& Q, float S) +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( &Q ); + + Quaternion R; + XMStoreFloat4( &R, XMVectorScale( q, S ) ); + return R; +} + +inline Quaternion operator/ (const Quaternion& Q1, const Quaternion& Q2) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( &Q1 ); + XMVECTOR q2 = XMLoadFloat4( &Q2 ); + q2 = XMQuaternionInverse( q2 ); + + Quaternion R; + XMStoreFloat4( &R, XMQuaternionMultiply( q1, q2 ) ); + return R; +} + +inline Quaternion operator* (float S, const Quaternion& Q) +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( &Q ); + + Quaternion R; + XMStoreFloat4( &R, XMVectorScale( q1, S ) ); + return R; +} + +//------------------------------------------------------------------------------ +// Quaternion operations +//------------------------------------------------------------------------------ + +inline float Quaternion::Length() const +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + return XMVectorGetX( XMQuaternionLength( q ) ); +} + +inline float Quaternion::LengthSquared() const +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + return XMVectorGetX( XMQuaternionLengthSq( q ) ); +} + +inline void Quaternion::Normalize() +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + XMStoreFloat4( this, XMQuaternionNormalize( q ) ); +} + +inline void Quaternion::Normalize( Quaternion& result ) const +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMQuaternionNormalize( q ) ); +} + +inline void Quaternion::Conjugate() +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + XMStoreFloat4( this, XMQuaternionConjugate( q ) ); +} + +inline void Quaternion::Conjugate( Quaternion& result ) const +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMQuaternionConjugate( q ) ); +} + +inline void Quaternion::Inverse( Quaternion& result ) const +{ + using namespace DirectX; + XMVECTOR q = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMQuaternionInverse( q ) ); +} + +inline float Quaternion::Dot( const Quaternion& q ) const +{ + using namespace DirectX; + XMVECTOR q1 = XMLoadFloat4( this ); + XMVECTOR q2 = XMLoadFloat4( &q ); + return XMVectorGetX( XMQuaternionDot( q1, q2 ) ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline Quaternion Quaternion::CreateFromAxisAngle( const Vector3& axis, float angle ) +{ + using namespace DirectX; + XMVECTOR a = XMLoadFloat3( &axis ); + + Quaternion R; + XMStoreFloat4( &R, XMQuaternionRotationAxis( a, angle ) ); + return R; +} + +inline Quaternion Quaternion::CreateFromYawPitchRoll( float yaw, float pitch, float roll ) +{ + using namespace DirectX; + Quaternion R; + XMStoreFloat4( &R, XMQuaternionRotationRollPitchYaw( pitch, yaw, roll ) ); + return R; +} + +inline Quaternion Quaternion::CreateFromRotationMatrix( const Matrix& M ) +{ + using namespace DirectX; + XMMATRIX M0 = XMLoadFloat4x4( &M ); + + Quaternion R; + XMStoreFloat4( &R, XMQuaternionRotationMatrix( M0 ) ); + return R; +} + +inline void Quaternion::Lerp( const Quaternion& q1, const Quaternion& q2, float t, Quaternion& result ) +{ + using namespace DirectX; + XMVECTOR Q0 = XMLoadFloat4( &q1 ); + XMVECTOR Q1 = XMLoadFloat4( &q2 ); + + XMVECTOR dot = XMVector4Dot( Q0, Q1 ); + + XMVECTOR R; + if ( XMVector4GreaterOrEqual( dot, XMVectorZero() ) ) + { + R = XMVectorLerp( Q0, Q1, t ); + } + else + { + XMVECTOR tv = XMVectorReplicate( t ); + XMVECTOR t1v = XMVectorReplicate( 1.f - t ); + XMVECTOR X0 = XMVectorMultiply( Q0, t1v ); + XMVECTOR X1 = XMVectorMultiply( Q1, tv ); + R = XMVectorSubtract( X0, X1 ); + } + + XMStoreFloat4( &result, XMQuaternionNormalize( R ) ); +} + +inline Quaternion Quaternion::Lerp( const Quaternion& q1, const Quaternion& q2, float t ) +{ + using namespace DirectX; + XMVECTOR Q0 = XMLoadFloat4( &q1 ); + XMVECTOR Q1 = XMLoadFloat4( &q2 ); + + XMVECTOR dot = XMVector4Dot( Q0, Q1 ); + + XMVECTOR R; + if ( XMVector4GreaterOrEqual( dot, XMVectorZero() ) ) + { + R = XMVectorLerp( Q0, Q1, t ); + } + else + { + XMVECTOR tv = XMVectorReplicate( t ); + XMVECTOR t1v = XMVectorReplicate( 1.f - t ); + XMVECTOR X0 = XMVectorMultiply( Q0, t1v ); + XMVECTOR X1 = XMVectorMultiply( Q1, tv ); + R = XMVectorSubtract( X0, X1 ); + } + + Quaternion result; + XMStoreFloat4( &result, XMQuaternionNormalize( R ) ); + return result; +} + +inline void Quaternion::Slerp( const Quaternion& q1, const Quaternion& q2, float t, Quaternion& result ) +{ + using namespace DirectX; + XMVECTOR Q0 = XMLoadFloat4( &q1 ); + XMVECTOR Q1 = XMLoadFloat4( &q2 ); + XMStoreFloat4( &result, XMQuaternionSlerp( Q0, Q1, t ) ); +} + +inline Quaternion Quaternion::Slerp( const Quaternion& q1, const Quaternion& q2, float t ) +{ + using namespace DirectX; + XMVECTOR Q0 = XMLoadFloat4( &q1 ); + XMVECTOR Q1 = XMLoadFloat4( &q2 ); + + Quaternion result; + XMStoreFloat4( &result, XMQuaternionSlerp( Q0, Q1, t ) ); + return result; +} + +inline void Quaternion::Concatenate( const Quaternion& q1, const Quaternion& q2, Quaternion& result ) +{ + using namespace DirectX; + XMVECTOR Q0 = XMLoadFloat4( &q1 ); + XMVECTOR Q1 = XMLoadFloat4( &q2 ); + XMStoreFloat4( &result, XMQuaternionMultiply( Q1, Q0 ) ); +} + +inline Quaternion Quaternion::Concatenate( const Quaternion& q1, const Quaternion& q2 ) +{ + using namespace DirectX; + XMVECTOR Q0 = XMLoadFloat4( &q1 ); + XMVECTOR Q1 = XMLoadFloat4( &q2 ); + + Quaternion result; + XMStoreFloat4( &result, XMQuaternionMultiply( Q1, Q0 ) ); + return result; +} + + +/**************************************************************************** + * + * Color + * + ****************************************************************************/ + +inline Color::Color( const DirectX::PackedVector::XMCOLOR& Packed ) +{ + using namespace DirectX; + XMStoreFloat4( this, PackedVector::XMLoadColor( &Packed ) ); +} + +inline Color::Color( const DirectX::PackedVector::XMUBYTEN4& Packed ) +{ + using namespace DirectX; + XMStoreFloat4( this, PackedVector::XMLoadUByteN4( &Packed ) ); +} + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ +inline bool Color::operator == ( const Color& c ) const +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( this ); + XMVECTOR c2 = XMLoadFloat4( &c ); + return XMColorEqual( c1, c2 ); +} + +inline bool Color::operator != ( const Color& c ) const +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( this ); + XMVECTOR c2 = XMLoadFloat4( &c ); + return XMColorNotEqual( c1, c2 ); +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Color& Color::operator= (const DirectX::PackedVector::XMCOLOR& Packed) +{ + using namespace DirectX; + XMStoreFloat4( this, PackedVector::XMLoadColor( &Packed ) ); + return *this; +} + +inline Color& Color::operator= (const DirectX::PackedVector::XMUBYTEN4& Packed) +{ + using namespace DirectX; + XMStoreFloat4( this, PackedVector::XMLoadUByteN4( &Packed ) ); + return *this; +} + +inline Color& Color::operator+= (const Color& c) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( this ); + XMVECTOR c2 = XMLoadFloat4( &c ); + XMStoreFloat4( this, XMVectorAdd( c1, c2 ) ); + return *this; +} + +inline Color& Color::operator-= (const Color& c) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( this ); + XMVECTOR c2 = XMLoadFloat4( &c ); + XMStoreFloat4( this, XMVectorSubtract( c1, c2 ) ); + return *this; +} + +inline Color& Color::operator*= (const Color& c) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( this ); + XMVECTOR c2 = XMLoadFloat4( &c ); + XMStoreFloat4( this, XMVectorMultiply( c1, c2 ) ); + return *this; +} + +inline Color& Color::operator*= (float S) +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( this, XMVectorScale( c, S ) ); + return *this; +} + +inline Color& Color::operator/= (const Color& c) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( this ); + XMVECTOR c2 = XMLoadFloat4( &c ); + XMStoreFloat4( this, XMVectorDivide( c1, c2 ) ); + return *this; +} + +//------------------------------------------------------------------------------ +// Urnary operators +//------------------------------------------------------------------------------ + +inline Color Color::operator- () const +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + Color R; + XMStoreFloat4( &R, XMVectorNegate( c ) ); + return R; +} + +//------------------------------------------------------------------------------ +// Binary operators +//------------------------------------------------------------------------------ + +inline Color operator+ (const Color& C1, const Color& C2) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( &C1 ); + XMVECTOR c2 = XMLoadFloat4( &C2 ); + Color R; + XMStoreFloat4( &R, XMVectorAdd( c1, c2 ) ); + return R; +} + +inline Color operator- (const Color& C1, const Color& C2) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( &C1 ); + XMVECTOR c2 = XMLoadFloat4( &C2 ); + Color R; + XMStoreFloat4( &R, XMVectorSubtract( c1, c2 ) ); + return R; +} + +inline Color operator* (const Color& C1, const Color& C2) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( &C1 ); + XMVECTOR c2 = XMLoadFloat4( &C2 ); + Color R; + XMStoreFloat4( &R, XMVectorMultiply( c1, c2 ) ); + return R; +} + +inline Color operator* (const Color& C, float S) +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( &C ); + Color R; + XMStoreFloat4( &R, XMVectorScale( c, S ) ); + return R; +} + +inline Color operator/ (const Color& C1, const Color& C2) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( &C1 ); + XMVECTOR c2 = XMLoadFloat4( &C2 ); + Color R; + XMStoreFloat4( &R, XMVectorDivide( c1, c2 ) ); + return R; +} + +inline Color operator* (float S, const Color& C) +{ + using namespace DirectX; + XMVECTOR c1 = XMLoadFloat4( &C ); + Color R; + XMStoreFloat4( &R, XMVectorScale( c1, S ) ); + return R; +} + +//------------------------------------------------------------------------------ +// Color operations +//------------------------------------------------------------------------------ + +inline DirectX::PackedVector::XMCOLOR Color::BGRA() const +{ + using namespace DirectX; + XMVECTOR clr = XMLoadFloat4( this ); + PackedVector::XMCOLOR Packed; + PackedVector::XMStoreColor( &Packed, clr ); + return Packed; +} + +inline DirectX::PackedVector::XMUBYTEN4 Color::RGBA() const +{ + using namespace DirectX; + XMVECTOR clr = XMLoadFloat4( this ); + PackedVector::XMUBYTEN4 Packed; + PackedVector::XMStoreUByteN4( &Packed, clr ); + return Packed; +} + +inline Vector3 Color::ToVector3() const +{ + return Vector3( x, y, z ); +} + +inline Vector4 Color::ToVector4() const +{ + return Vector4( x, y, z, w ); +} + +inline void Color::Negate() +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( this, XMColorNegative( c) ); +} + +inline void Color::Negate( Color& result ) const +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMColorNegative( c ) ); +} + +inline void Color::Saturate() +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( this, XMVectorSaturate( c ) ); +} + +inline void Color::Saturate( Color& result ) const +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMVectorSaturate( c ) ); +} + +inline void Color::Premultiply() +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMVECTOR a = XMVectorSplatW( c ); + a = XMVectorSelect( g_XMIdentityR3, a, g_XMSelect1110 ); + XMStoreFloat4( this, XMVectorMultiply( c, a ) ); +} + +inline void Color::Premultiply( Color& result ) const +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMVECTOR a = XMVectorSplatW( c ); + a = XMVectorSelect( g_XMIdentityR3, a, g_XMSelect1110 ); + XMStoreFloat4( &result, XMVectorMultiply( c, a ) ); +} + +inline void Color::AdjustSaturation( float sat ) +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( this, XMColorAdjustSaturation( c, sat ) ); +} + +inline void Color::AdjustSaturation( float sat, Color& result ) const +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMColorAdjustSaturation( c, sat ) ); +} + +inline void Color::AdjustContrast( float contrast ) +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( this, XMColorAdjustContrast( c, contrast ) ); +} + +inline void Color::AdjustContrast( float contrast, Color& result ) const +{ + using namespace DirectX; + XMVECTOR c = XMLoadFloat4( this ); + XMStoreFloat4( &result, XMColorAdjustContrast( c, contrast ) ); +} + +//------------------------------------------------------------------------------ +// Static functions +//------------------------------------------------------------------------------ + +inline void Color::Modulate( const Color& c1, const Color& c2, Color& result ) +{ + using namespace DirectX; + XMVECTOR C0 = XMLoadFloat4( &c1 ); + XMVECTOR C1 = XMLoadFloat4( &c2 ); + XMStoreFloat4( &result, XMColorModulate( C0, C1 ) ); +} + +inline Color Color::Modulate( const Color& c1, const Color& c2 ) +{ + using namespace DirectX; + XMVECTOR C0 = XMLoadFloat4( &c1 ); + XMVECTOR C1 = XMLoadFloat4( &c2 ); + + Color result; + XMStoreFloat4( &result, XMColorModulate( C0, C1 ) ); + return result; +} + +inline void Color::Lerp( const Color& c1, const Color& c2, float t, Color& result ) +{ + using namespace DirectX; + XMVECTOR C0 = XMLoadFloat4( &c1 ); + XMVECTOR C1 = XMLoadFloat4( &c2 ); + XMStoreFloat4( &result, XMVectorLerp( C0, C1, t ) ); +} + +inline Color Color::Lerp( const Color& c1, const Color& c2, float t ) +{ + using namespace DirectX; + XMVECTOR C0 = XMLoadFloat4( &c1 ); + XMVECTOR C1 = XMLoadFloat4( &c2 ); + + Color result; + XMStoreFloat4( &result, XMVectorLerp( C0, C1, t ) ); + return result; +} + + +/**************************************************************************** + * + * Ray + * + ****************************************************************************/ + +//----------------------------------------------------------------------------- +// Comparision operators +//------------------------------------------------------------------------------ +inline bool Ray::operator == ( const Ray& r ) const +{ + using namespace DirectX; + XMVECTOR r1p = XMLoadFloat3( &position ); + XMVECTOR r2p = XMLoadFloat3( &r.position ); + XMVECTOR r1d = XMLoadFloat3( &direction ); + XMVECTOR r2d = XMLoadFloat3( &r.direction ); + return XMVector3Equal( r1p, r2p ) && XMVector3Equal( r1d, r2d ); +} + +inline bool Ray::operator != ( const Ray& r ) const +{ + using namespace DirectX; + XMVECTOR r1p = XMLoadFloat3( &position ); + XMVECTOR r2p = XMLoadFloat3( &r.position ); + XMVECTOR r1d = XMLoadFloat3( &direction ); + XMVECTOR r2d = XMLoadFloat3( &r.direction ); + return XMVector3NotEqual( r1p, r2p ) && XMVector3NotEqual( r1d, r2d ); +} + +//----------------------------------------------------------------------------- +// Ray operators +//------------------------------------------------------------------------------ + +inline bool Ray::Intersects( const BoundingSphere& sphere, _Out_ float& Dist ) const +{ + return sphere.Intersects( position, direction, Dist ); +} + +inline bool Ray::Intersects( const BoundingBox& box, _Out_ float& Dist ) const +{ + return box.Intersects( position, direction, Dist ); +} + +inline bool Ray::Intersects( const Vector3& tri0, const Vector3& tri1, const Vector3& tri2, _Out_ float& Dist ) const +{ + return DirectX::TriangleTests::Intersects( position, direction, tri0, tri1, tri2, Dist ); +} + +inline bool Ray::Intersects( const Plane& plane, _Out_ float& Dist ) const +{ + using namespace DirectX; + + XMVECTOR p = XMLoadFloat4( &plane ); + XMVECTOR dir = XMLoadFloat3( &direction ); + + XMVECTOR nd = XMPlaneDotNormal( p, dir ); + + if ( XMVector3LessOrEqual( XMVectorAbs( nd ), g_RayEpsilon ) ) + { + Dist = 0.f; + return false; + } + else + { + // t = -(dot(n,origin) + D) / dot(n,dir) + XMVECTOR pos = XMLoadFloat3( &position ); + XMVECTOR v = XMPlaneDotNormal( p, pos ); + v = XMVectorAdd( v, XMVectorSplatW(p) ); + v = XMVectorDivide( v, nd ); + float dist = - XMVectorGetX( v ); + if (dist < 0) + { + Dist = 0.f; + return false; + } + else + { + Dist = dist; + return true; + } + } +} + + +/**************************************************************************** + * + * Viewport + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparision operators +//------------------------------------------------------------------------------ + +inline bool Viewport::operator == ( const Viewport& vp ) const +{ + return (x == vp.x && y == vp.y + && width == vp.width && height == vp.height + && minDepth == vp.minDepth && maxDepth == vp.maxDepth); +} + +inline bool Viewport::operator != ( const Viewport& vp ) const +{ + return (x != vp.x || y != vp.y + || width != vp.width || height != vp.height + || minDepth != vp.minDepth || maxDepth != vp.maxDepth); +} + +//------------------------------------------------------------------------------ +// Assignment operators +//------------------------------------------------------------------------------ + +inline Viewport& Viewport::operator= (const Viewport& vp) +{ + x = vp.x; y = vp.y; + width = vp.width; height = vp.height; + minDepth = vp.minDepth; maxDepth = vp.maxDepth; + return *this; +} + +inline Viewport& Viewport::operator= (const RECT& rct) +{ + x = float(rct.left); y = float(rct.top); + width = float(rct.right - rct.left); + height = float(rct.bottom - rct.top); + minDepth = 0.f; maxDepth = 1.f; + return *this; +} + +#if defined(__d3d11_h__) || defined(__d3d11_x_h__) +inline Viewport& Viewport::operator= (const D3D11_VIEWPORT& vp) +{ + x = vp.TopLeftX; y = vp.TopLeftY; + width = vp.Width; height = vp.Height; + minDepth = vp.MinDepth; maxDepth = vp.MaxDepth; + return *this; +} +#endif + +#if defined(__d3d12_h__) || defined(__d3d12_x_h__) +inline Viewport& Viewport::operator= (const D3D12_VIEWPORT& vp) +{ + x = vp.TopLeftX; y = vp.TopLeftY; + width = vp.Width; height = vp.Height; + minDepth = vp.MinDepth; maxDepth = vp.MaxDepth; + return *this; +} +#endif + +//------------------------------------------------------------------------------ +// Viewport operations +//------------------------------------------------------------------------------ + +inline float Viewport::AspectRatio() const +{ + if (width == 0.f || height == 0.f) + return 0.f; + + return (width / height); +} + +inline Vector3 Viewport::Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world) const +{ + using namespace DirectX; + XMVECTOR v = XMLoadFloat3(&p); + XMMATRIX projection = XMLoadFloat4x4(&proj); + v = XMVector3Project(v, x, y, width, height, minDepth, maxDepth, projection, view, world); + Vector3 result; + XMStoreFloat3(&result, v); + return result; +} + +inline void Viewport::Project(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result) const +{ + using namespace DirectX; + XMVECTOR v = XMLoadFloat3(&p); + XMMATRIX projection = XMLoadFloat4x4(&proj); + v = XMVector3Project(v, x, y, width, height, minDepth, maxDepth, projection, view, world); + XMStoreFloat3(&result, v); +} + +inline Vector3 Viewport::Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world) const +{ + using namespace DirectX; + XMVECTOR v = XMLoadFloat3(&p); + XMMATRIX projection = XMLoadFloat4x4(&proj); + v = XMVector3Unproject(v, x, y, width, height, minDepth, maxDepth, projection, view, world); + Vector3 result; + XMStoreFloat3(&result, v); + return result; +} + +inline void Viewport::Unproject(const Vector3& p, const Matrix& proj, const Matrix& view, const Matrix& world, Vector3& result) const +{ + using namespace DirectX; + XMVECTOR v = XMLoadFloat3(&p); + XMMATRIX projection = XMLoadFloat4x4(&proj); + v = XMVector3Unproject(v, x, y, width, height, minDepth, maxDepth, projection, view, world); + XMStoreFloat3(&result, v); +} diff --git a/Kits/DirectXTK12/Inc/SpriteBatch.h b/Kits/DirectXTK12/Inc/SpriteBatch.h new file mode 100644 index 0000000000000000000000000000000000000000..15e5b4d63a6c6347cc68c3c1adbe694641c73d3a --- /dev/null +++ b/Kits/DirectXTK12/Inc/SpriteBatch.h @@ -0,0 +1,143 @@ +//-------------------------------------------------------------------------------------- +// File: SpriteBatch.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include +#include + +#include "RenderTargetState.h" + +namespace DirectX +{ + class ResourceUploadBatch; + + enum SpriteSortMode + { + SpriteSortMode_Deferred, + SpriteSortMode_Immediate, + SpriteSortMode_Texture, + SpriteSortMode_BackToFront, + SpriteSortMode_FrontToBack, + }; + + enum SpriteEffects + { + SpriteEffects_None = 0, + SpriteEffects_FlipHorizontally = 1, + SpriteEffects_FlipVertically = 2, + SpriteEffects_FlipBoth = SpriteEffects_FlipHorizontally | SpriteEffects_FlipVertically, + }; + + class SpriteBatchShaderDescription + { + public: + SpriteBatchShaderDescription( + _In_ ID3D12RootSignature* rootSignature, + _In_ const D3D12_SHADER_BYTECODE* vertexShader, + _In_ const D3D12_SHADER_BYTECODE* pixelShader) + : rootSignature(rootSignature), + vertexShaderByteCode(vertexShader), + pixelShaderByteCode(pixelShader) + { + } + + ID3D12RootSignature* rootSignature; + const D3D12_SHADER_BYTECODE* vertexShaderByteCode; + const D3D12_SHADER_BYTECODE* pixelShaderByteCode; + }; + + class SpriteBatchPipelineStateDescription + { + public: + explicit SpriteBatchPipelineStateDescription( + _In_ const RenderTargetState* renderTarget, + _In_opt_ const D3D12_BLEND_DESC* blend = nullptr, + _In_opt_ const D3D12_DEPTH_STENCIL_DESC* depthStencil = nullptr, + _In_opt_ const D3D12_RASTERIZER_DESC* rasterizer = nullptr, + _In_opt_ const SpriteBatchShaderDescription* shaders = nullptr) + : + blendDesc(blend), + depthStencilDesc(depthStencil), + rasterizerDesc(rasterizer), + renderTargetState(renderTarget), + shaders(shaders) + { + // constructor + } + + const D3D12_BLEND_DESC* blendDesc; + const D3D12_DEPTH_STENCIL_DESC* depthStencilDesc; + const D3D12_RASTERIZER_DESC* rasterizerDesc; + const RenderTargetState* renderTargetState; + const SpriteBatchShaderDescription* shaders; + }; + + class SpriteBatch + { + public: + SpriteBatch(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload, _In_ const SpriteBatchPipelineStateDescription* psoDesc, _In_opt_ const D3D12_VIEWPORT* viewport = nullptr); + SpriteBatch(SpriteBatch&& moveFrom); + SpriteBatch& operator= (SpriteBatch&& moveFrom); + + SpriteBatch(SpriteBatch const&) = delete; + SpriteBatch& operator= (SpriteBatch const&) = delete; + + virtual ~SpriteBatch(); + + // Begin/End a batch of sprite drawing operations. + void XM_CALLCONV Begin( + _In_ ID3D12GraphicsCommandList* commandList, + _In_opt_ SpriteSortMode sortMode = SpriteSortMode_Deferred, + _In_opt_ FXMMATRIX transformMatrix = MatrixIdentity); + void __cdecl End(); + + // Draw overloads specifying position, origin and scale as XMFLOAT2. + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, XMFLOAT2 const& position, FXMVECTOR color = Colors::White); + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); + + // Draw overloads specifying position, origin and scale via the first two components of an XMVECTOR. + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, FXMVECTOR position, FXMVECTOR color = Colors::White); + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); + + // Draw overloads specifying position as a RECT. + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, RECT const& destinationRectangle, FXMVECTOR color = Colors::White); + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); + + // Rotation mode to be applied to the sprite transformation + void __cdecl SetRotation( DXGI_MODE_ROTATION mode ); + DXGI_MODE_ROTATION __cdecl GetRotation() const; + + // Set viewport for sprite transformation + void __cdecl SetViewport( const D3D12_VIEWPORT& viewPort ); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + + static const XMMATRIX MatrixIdentity; + static const XMFLOAT2 Float2Zero; + }; +} diff --git a/Kits/DirectXTK12/Inc/SpriteFont.h b/Kits/DirectXTK12/Inc/SpriteFont.h new file mode 100644 index 0000000000000000000000000000000000000000..b9ff434fee1f49886b9c78ec102588df4c511f91 --- /dev/null +++ b/Kits/DirectXTK12/Inc/SpriteFont.h @@ -0,0 +1,81 @@ +//-------------------------------------------------------------------------------------- +// File: SpriteFont.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "SpriteBatch.h" + + +namespace DirectX +{ + class SpriteFont + { + public: + struct Glyph; + + SpriteFont(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload, _In_z_ wchar_t const* fileName, _In_ D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, _In_ D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptor); + SpriteFont(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload, _In_reads_bytes_(dataSize) uint8_t const* dataBlob, _In_ size_t dataSize, _In_ D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, _In_ D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptor); + SpriteFont(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, _In_ XMUINT2 textureSize, _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, _In_ float lineSpacing); + + SpriteFont(SpriteFont&& moveFrom); + SpriteFont& operator= (SpriteFont&& moveFrom); + + SpriteFont(SpriteFont const&) = delete; + SpriteFont& operator= (SpriteFont const&) = delete; + + virtual ~SpriteFont(); + + void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; + void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; + void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; + void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; + + XMVECTOR XM_CALLCONV MeasureString(_In_z_ wchar_t const* text) const; + + RECT __cdecl MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& position) const; + RECT XM_CALLCONV MeasureDrawBounds(_In_z_ wchar_t const* text, FXMVECTOR position) const; + + // Spacing properties + float __cdecl GetLineSpacing() const; + void __cdecl SetLineSpacing(float spacing); + + // Font properties + wchar_t __cdecl GetDefaultCharacter() const; + void __cdecl SetDefaultCharacter(wchar_t character); + + bool __cdecl ContainsCharacter(wchar_t character) const; + + // Custom layout/rendering + Glyph const* __cdecl FindGlyph(wchar_t character) const; + D3D12_GPU_DESCRIPTOR_HANDLE __cdecl GetSpriteSheet() const; + XMUINT2 __cdecl GetSpriteSheetSize() const; + + // Describes a single character glyph. + struct Glyph + { + uint32_t Character; + RECT Subrect; + float XOffset; + float YOffset; + float XAdvance; + }; + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + + static const XMFLOAT2 Float2Zero; + }; +} diff --git a/Kits/DirectXTK12/Inc/VertexTypes.h b/Kits/DirectXTK12/Inc/VertexTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..a618fa3c8942c74d706c290549842f806d560a77 --- /dev/null +++ b/Kits/DirectXTK12/Inc/VertexTypes.h @@ -0,0 +1,285 @@ +//-------------------------------------------------------------------------------------- +// File: VertexTypes.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include + + +namespace DirectX +{ + // Vertex struct holding position information. + struct VertexPosition + { + VertexPosition() = default; + + VertexPosition(XMFLOAT3 const& position) + : position(position) + { } + + VertexPosition(FXMVECTOR position) + { + XMStoreFloat3(&this->position, position); + } + + XMFLOAT3 position; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 1; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position and color information. + struct VertexPositionColor + { + VertexPositionColor() = default; + + VertexPositionColor(XMFLOAT3 const& position, XMFLOAT4 const& color) + : position(position), + color(color) + { } + + VertexPositionColor(FXMVECTOR position, FXMVECTOR color) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat4(&this->color, color); + } + + XMFLOAT3 position; + XMFLOAT4 color; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 2; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position and texture mapping information. + struct VertexPositionTexture + { + VertexPositionTexture() = default; + + VertexPositionTexture(XMFLOAT3 const& position, XMFLOAT2 const& textureCoordinate) + : position(position), + textureCoordinate(textureCoordinate) + { } + + VertexPositionTexture(FXMVECTOR position, FXMVECTOR textureCoordinate) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat2(&this->textureCoordinate, textureCoordinate); + } + + XMFLOAT3 position; + XMFLOAT2 textureCoordinate; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 2; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position and dual texture mapping information. + struct VertexPositionDualTexture + { + VertexPositionDualTexture() = default; + + VertexPositionDualTexture(XMFLOAT3 const& position, XMFLOAT2 const& textureCoordinate0, XMFLOAT2 const& textureCoordinate1) + : position(position), + textureCoordinate0(textureCoordinate0), + textureCoordinate1(textureCoordinate1) + { } + + VertexPositionDualTexture(FXMVECTOR position, + FXMVECTOR textureCoordinate0, + FXMVECTOR textureCoordinate1) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat2(&this->textureCoordinate0, textureCoordinate0); + XMStoreFloat2(&this->textureCoordinate1, textureCoordinate1); + } + + XMFLOAT3 position; + XMFLOAT2 textureCoordinate0; + XMFLOAT2 textureCoordinate1; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 3; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position and normal vector. + struct VertexPositionNormal + { + VertexPositionNormal() = default; + + VertexPositionNormal(XMFLOAT3 const& position, XMFLOAT3 const& normal) + : position(position), + normal(normal) + { } + + VertexPositionNormal(FXMVECTOR position, FXMVECTOR normal) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat3(&this->normal, normal); + } + + XMFLOAT3 position; + XMFLOAT3 normal; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 2; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position, color, and texture mapping information. + struct VertexPositionColorTexture + { + VertexPositionColorTexture() = default; + + VertexPositionColorTexture(XMFLOAT3 const& position, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate) + : position(position), + color(color), + textureCoordinate(textureCoordinate) + { } + + VertexPositionColorTexture(FXMVECTOR position, FXMVECTOR color, FXMVECTOR textureCoordinate) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat4(&this->color, color); + XMStoreFloat2(&this->textureCoordinate, textureCoordinate); + } + + XMFLOAT3 position; + XMFLOAT4 color; + XMFLOAT2 textureCoordinate; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 3; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position, normal vector, and color information. + struct VertexPositionNormalColor + { + VertexPositionNormalColor() = default; + + VertexPositionNormalColor(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color) + : position(position), + normal(normal), + color(color) + { } + + VertexPositionNormalColor(FXMVECTOR position, FXMVECTOR normal, FXMVECTOR color) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat3(&this->normal, normal); + XMStoreFloat4(&this->color, color); + } + + XMFLOAT3 position; + XMFLOAT3 normal; + XMFLOAT4 color; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 3; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position, normal vector, and texture mapping information. + struct VertexPositionNormalTexture + { + VertexPositionNormalTexture() = default; + + VertexPositionNormalTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT2 const& textureCoordinate) + : position(position), + normal(normal), + textureCoordinate(textureCoordinate) + { } + + VertexPositionNormalTexture(FXMVECTOR position, FXMVECTOR normal, FXMVECTOR textureCoordinate) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat3(&this->normal, normal); + XMStoreFloat2(&this->textureCoordinate, textureCoordinate); + } + + XMFLOAT3 position; + XMFLOAT3 normal; + XMFLOAT2 textureCoordinate; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 3; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; + + + // Vertex struct holding position, normal vector, color, and texture mapping information. + struct VertexPositionNormalColorTexture + { + VertexPositionNormalColorTexture() = default; + + VertexPositionNormalColorTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate) + : position(position), + normal(normal), + color(color), + textureCoordinate(textureCoordinate) + { } + + VertexPositionNormalColorTexture(FXMVECTOR position, FXMVECTOR normal, FXMVECTOR color, CXMVECTOR textureCoordinate) + { + XMStoreFloat3(&this->position, position); + XMStoreFloat3(&this->normal, normal); + XMStoreFloat4(&this->color, color); + XMStoreFloat2(&this->textureCoordinate, textureCoordinate); + } + + XMFLOAT3 position; + XMFLOAT3 normal; + XMFLOAT4 color; + XMFLOAT2 textureCoordinate; + + static const D3D12_INPUT_LAYOUT_DESC InputLayout; + + private: + static const int InputElementCount = 4; + static const D3D12_INPUT_ELEMENT_DESC InputElements[InputElementCount]; + }; +} diff --git a/Kits/DirectXTK12/Inc/WICTextureLoader.h b/Kits/DirectXTK12/Inc/WICTextureLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..241949bec642fdc5c4615ffdc0be0a9ce3bfd162 --- /dev/null +++ b/Kits/DirectXTK12/Inc/WICTextureLoader.h @@ -0,0 +1,78 @@ +//-------------------------------------------------------------------------------------- +// File: WICTextureLoader.h +// +// Function for loading a WIC image and creating a Direct3D runtime texture for it +// (auto-generating mipmaps if possible) +// +// Note: Assumes application has already called CoInitializeEx +// +// Note these functions are useful for images created as simple 2D textures. For +// more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. +// For a full-featured DDS file reader, writer, and texture processing pipeline see +// the 'Texconv' sample and the 'DirectXTex' library. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include + + +namespace DirectX +{ + class ResourceUploadBatch; + + // Standard version + HRESULT __cdecl CreateWICTextureFromMemory( + _In_ ID3D12Device* d3dDevice, + _In_ ResourceUploadBatch& resourceUpload, + _In_reads_bytes_(wicDataSize) const uint8_t* wicData, + _In_ size_t wicDataSize, + _Outptr_ ID3D12Resource** texture, + _In_ bool generateMips = true, + _In_ size_t maxsize = 0); + + HRESULT __cdecl CreateWICTextureFromFile( + _In_ ID3D12Device* d3dDevice, + _In_ ResourceUploadBatch& resourceUpload, + _In_z_ const wchar_t* szFileName, + _Outptr_ ID3D12Resource** texture, + _In_ bool generateMips = true, + _In_ size_t maxsize = 0); + + // Extended version + HRESULT __cdecl CreateWICTextureFromMemoryEx( + _In_ ID3D12Device* d3dDevice, + _In_ ResourceUploadBatch& resourceUpload, + _In_reads_bytes_(wicDataSize) const uint8_t* wicData, + _In_ size_t wicDataSize, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool generateMips, + _Outptr_ ID3D12Resource** texture); + + HRESULT __cdecl CreateWICTextureFromFileEx( + _In_ ID3D12Device* d3dDevice, + _In_ ResourceUploadBatch& resourceUpload, + _In_z_ const wchar_t* szFileName, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool generateMips, + _Outptr_ ID3D12Resource** texture); +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Readme.txt b/Kits/DirectXTK12/Readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..6232e95a5b902c19ff2a4fe8b2dded1555ad1e1b --- /dev/null +++ b/Kits/DirectXTK12/Readme.txt @@ -0,0 +1,97 @@ +----------------------------------------------- +DirectXTK - the DirectX Tool Kit for DirectX 12 +----------------------------------------------- + +Copyright (c) Microsoft Corporation. All rights reserved. + +June 30, 2016 + +This package contains the "DirectX Tool Kit", a collection of helper classes for +writing Direct3D 12 C++ code for Universal Windows Platform (UWP) apps, Win32 desktop +applications for Windows 10, and Xbox One exclusive apps. + +This code is designed to build with Visual Studio 2015. It is recommended that you +make use of VS 2015 Update 3 and Windows 10 (November 2015) or later. + +Inc\ + Public Header Files (in the DirectX C++ namespace): + + Audio.h - low-level audio API using XAudio2 (DirectXTK for Audio public header) + CommonStates.h - common D3D state combinations + DDSTextureLoader.h - light-weight DDS file texture loader + DescriptorHeap.h - helper for managing DX12 descriptor heaps + DirectXHelpers.h - misc C++ helpers for D3D programming + Effects.h - set of built-in shaders for common rendering tasks + GamePad.h - gamepad controller helper using XInput + GeometricPrimitive.h - draws basic shapes such as cubes and spheres + GraphicsMemory.h - helper for managing dynamic graphics memory allocation + Keyboard.h - keyboard state tracking helper + Model.h - draws meshes loaded from .SDKMESH or .VBO files + Mouse.h - mouse helper + PrimitiveBatch.h - simple and efficient way to draw user primitives + RenderTargetState.h - helper for communicating render target requirements when creating PSOs + ResourceUploadBatch.h - helper for managing texture resource upload to the GPU + ScreenGrab.h - light-weight screen shot saver + SimpleMath.h - simplified C++ wrapper for DirectXMath + SpriteBatch.h - simple & efficient 2D sprite rendering + SpriteFont.h - bitmap based text rendering + VertexTypes.h - structures for commonly used vertex data formats + WICTextureLoader.h - WIC-based image file texture loader + XboxDDSTextureLoader.h - Xbox One exclusive apps variant of DDSTextureLoader + +Src\ + DirectXTK source files and internal implementation headers + +Audio\ + DirectXTK for Audio source files and internal implementation headers + +NOTE: MakeSpriteFont and XWBTool can be found in the DirectX Tool Kit for DirectX 11 package. + +All content and source code for this package are subject to the terms of the MIT License. +. + +Documentation is available at . + +For the latest version of DirectX Tool Kit, bug reports, etc. please visit the project site. + +http://go.microsoft.com/fwlink/?LinkID=615561 + +Note: Xbox One exclusive apps developers using the Xbox One XDK need to generate the + Src\Shaders\Compiled\XboxOne*.inc files to build the library as they are not + included in the distribution package. They are built by running the script + in Src\Shaders - "CompileShaders xbox", and should be generated with the matching + FXC compiler from the Xbox One XDK. While they will continue to work if outdated, + a mismatch will cause runtime compilation overhead that would otherwise be avoided. + +This project has adopted the Microsoft Open Source Code of Conduct. For more information see the +Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. + +https://opensource.microsoft.com/codeofconduct/ + + +--------------------------------- +COMPARISONS TO DIRECTX 11 VERSION +--------------------------------- + +* No support for loading .CMO models or DGSL effect shaders (i.e. DGSLEffect) + +* VertexTypes does not include VertexPositionNormalTangentColorTexture or + VertexPositionNormalTangentColorTextureSkinning + +* DirectX Tool Kit for DirectX 11 supports Feature Level 9.3, while DirectX 12 requires + Direct3D Feature Level 11.0. There are no expected DirectX 12 drivers for + any lower feature level devices. + +* The library assumes it is building for Windows 10 (aka _WIN32_WINNT=0x0A00) so it makes + use of XAudio 2.9 and WIC2 as well as DirectX 12. + +* DirectX Tool Kit for Audio, GamePad, Keyboard, Mouse, and SimpleMath are identical + to the DirectX 11 version + + +--------------- +RELEASE HISTORY +--------------- + +June 30, 2016 + Original release diff --git a/Kits/DirectXTK12/Src/AlignedNew.h b/Kits/DirectXTK12/Src/AlignedNew.h new file mode 100644 index 0000000000000000000000000000000000000000..49c761f0b0f25d5b90bad1dfbe97a5d75372a7b9 --- /dev/null +++ b/Kits/DirectXTK12/Src/AlignedNew.h @@ -0,0 +1,67 @@ +//-------------------------------------------------------------------------------------- +// File: AlignedNew.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include +#include + + +namespace DirectX +{ + // Derive from this to customize operator new and delete for + // types that have special heap alignment requirements. + // + // Example usage: + // + // __declspec(align(16)) struct MyAlignedType : public AlignedNew + + template + struct AlignedNew + { + // Allocate aligned memory. + static void* operator new (size_t size) + { + const size_t alignment = __alignof(TDerived); + + static_assert(alignment > 8, "AlignedNew is only useful for types with > 8 byte alignment. Did you forget a __declspec(align) on TDerived?"); + + void* ptr = _aligned_malloc(size, alignment); + + if (!ptr) + throw std::bad_alloc(); + + return ptr; + } + + + // Free aligned memory. + static void operator delete (void* ptr) + { + _aligned_free(ptr); + } + + + // Array overloads. + static void* operator new[] (size_t size) + { + return operator new(size); + } + + + static void operator delete[] (void* ptr) + { + operator delete(ptr); + } + }; +} diff --git a/Kits/DirectXTK12/Src/AlphaTestEffect.cpp b/Kits/DirectXTK12/Src/AlphaTestEffect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c0869ccc22a3d95a4035ba3ff1c55b0527a87e5 --- /dev/null +++ b/Kits/DirectXTK12/Src/AlphaTestEffect.cpp @@ -0,0 +1,443 @@ +//-------------------------------------------------------------------------------------- +// File: AlphaTestEffect.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "EffectCommon.h" + +using namespace DirectX; + + +// Constant buffer layout. Must match the shader! +struct AlphaTestEffectConstants +{ + XMVECTOR diffuseColor; + XMVECTOR alphaTest; + XMVECTOR fogColor; + XMVECTOR fogVector; + XMMATRIX worldViewProj; +}; + +static_assert( ( sizeof(AlphaTestEffectConstants) % 16 ) == 0, "CB size not padded correctly" ); + + +// Traits type describes our characteristics to the EffectBase template. +struct AlphaTestEffectTraits +{ + typedef AlphaTestEffectConstants ConstantBufferType; + + static const int VertexShaderCount = 4; + static const int PixelShaderCount = 4; + static const int ShaderPermutationCount = 8; +}; + + +// Internal AlphaTestEffect implementation class. +class AlphaTestEffect::Impl : public EffectBase +{ +public: + Impl(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription, D3D12_COMPARISON_FUNC alphaFunction); + + enum DescriptorIndex + { + Texture, + DescriptorCount + }; + + enum RootParameterIndex + { + TextureSRV, + ConstantBuffer, + RootParameterCount + }; + + D3D12_COMPARISON_FUNC mAlphaFunction; + int referenceAlpha; + + bool vertexColorEnabled; + EffectColor color; + + D3D12_GPU_DESCRIPTOR_HANDLE texture; + + int GetCurrentPipelineStatePermutation() const; + + void Apply(_In_ ID3D12GraphicsCommandList* commandList); +}; + + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTest.inc" + #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTestNoFog.inc" + #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTestVc.inc" + #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTestVcNoFog.inc" + + #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestLtGt.inc" + #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestLtGtNoFog.inc" + #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestEqNe.inc" + #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestEqNeNoFog.inc" +#else + #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc" + #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc" + #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc" + #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc" + + #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc" + #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc" + #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc" + #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc" +#endif +} + + +const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytecode[] = +{ + { AlphaTestEffect_VSAlphaTest, sizeof(AlphaTestEffect_VSAlphaTest) }, + { AlphaTestEffect_VSAlphaTestNoFog, sizeof(AlphaTestEffect_VSAlphaTestNoFog) }, + { AlphaTestEffect_VSAlphaTestVc, sizeof(AlphaTestEffect_VSAlphaTestVc) }, + { AlphaTestEffect_VSAlphaTestVcNoFog, sizeof(AlphaTestEffect_VSAlphaTestVcNoFog) }, +}; + + +const int EffectBase::VertexShaderIndices[] = +{ + 0, // lt/gt + 1, // lt/gt, no fog + 2, // lt/gt, vertex color + 3, // lt/gt, vertex color, no fog + + 0, // eq/ne + 1, // eq/ne, no fog + 2, // eq/ne, vertex color + 3, // eq/ne, vertex color, no fog +}; + + +const D3D12_SHADER_BYTECODE EffectBase::PixelShaderBytecode[] = +{ + { AlphaTestEffect_PSAlphaTestLtGt, sizeof(AlphaTestEffect_PSAlphaTestLtGt) }, + { AlphaTestEffect_PSAlphaTestLtGtNoFog, sizeof(AlphaTestEffect_PSAlphaTestLtGtNoFog) }, + { AlphaTestEffect_PSAlphaTestEqNe, sizeof(AlphaTestEffect_PSAlphaTestEqNe) }, + { AlphaTestEffect_PSAlphaTestEqNeNoFog, sizeof(AlphaTestEffect_PSAlphaTestEqNeNoFog) }, +}; + + +const int EffectBase::PixelShaderIndices[] = +{ + 0, // lt/gt + 1, // lt/gt, no fog + 0, // lt/gt, vertex color + 1, // lt/gt, vertex color, no fog + + 2, // eq/ne + 3, // eq/ne, no fog + 2, // eq/ne, vertex color + 3, // eq/ne, vertex color, no fog +}; + + +// Global pool of per-device AlphaTestEffect resources. +SharedResourcePool::DeviceResources> EffectBase::deviceResourcesPool; + +// Constructor. +AlphaTestEffect::Impl::Impl(_In_ ID3D12Device* device, + int flags, const EffectPipelineStateDescription& pipelineDescription, D3D12_COMPARISON_FUNC alphaFunction) + : EffectBase(device), + mAlphaFunction(alphaFunction), + referenceAlpha(0), + vertexColorEnabled(false) +{ + static_assert( _countof(EffectBase::VertexShaderIndices) == AlphaTestEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::VertexShaderBytecode) == AlphaTestEffectTraits::VertexShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderBytecode) == AlphaTestEffectTraits::PixelShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderIndices) == AlphaTestEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer. + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC sampler(0); + CD3DX12_DESCRIPTOR_RANGE descriptorRanges[DescriptorIndex::DescriptorCount]; + descriptorRanges[DescriptorIndex::Texture].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::TextureSRV].InitAsDescriptorTable( + _countof(descriptorRanges), + descriptorRanges); + rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL); + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, 1, &sampler, rootSignatureFlags); + + ThrowIfFailed(CreateRootSignature(device, &rsigDesc, mRootSignature.ReleaseAndGetAddressOf())); + + fog.enabled = (flags & EffectFlags::Fog) != 0; + vertexColorEnabled = (flags & EffectFlags::VertexColor) != 0; + + // overridden alpha test state + D3D12_DEPTH_STENCIL_DESC override = *pipelineDescription.depthStencilDesc; + override.BackFace.StencilFunc = alphaFunction; + override.FrontFace.StencilFunc = alphaFunction; + + int sp = GetCurrentPipelineStatePermutation(); + int vi = EffectBase::VertexShaderIndices[sp]; + int pi = EffectBase::PixelShaderIndices[sp]; + + EffectBase::CreatePipelineState( + mRootSignature.Get(), + pipelineDescription.inputLayout, + &EffectBase::VertexShaderBytecode[vi], + &EffectBase::PixelShaderBytecode[pi], + pipelineDescription.blendDesc, + &override, + pipelineDescription.rasterizerDesc, + pipelineDescription.renderTargetState, + pipelineDescription.primitiveTopology, + pipelineDescription.stripCutValue); +} + + +int AlphaTestEffect::Impl::GetCurrentPipelineStatePermutation() const +{ + int permutation = 0; + + // Use optimized shaders if fog is disabled. + if (!fog.enabled) + { + permutation += 1; + } + + // Support vertex coloring? + if (vertexColorEnabled) + { + permutation += 2; + } + + // Which alpha compare mode? + if (mAlphaFunction == D3D12_COMPARISON_FUNC_EQUAL || + mAlphaFunction == D3D12_COMPARISON_FUNC_NOT_EQUAL) + { + permutation += 4; + } + + return permutation; +} + + +// Sets our state onto the D3D device. +void AlphaTestEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + // Compute derived parameter values. + matrices.SetConstants(dirtyFlags, constants.worldViewProj); + fog.SetConstants(dirtyFlags, matrices.worldView, constants.fogVector); + color.SetConstants(dirtyFlags, constants.diffuseColor); + + UpdateConstants(); + + // Recompute the alpha test settings? + if (dirtyFlags & EffectDirtyFlags::AlphaTest) + { + // Convert reference alpha from 8 bit integer to 0-1 float format. + float reference = (float)referenceAlpha / 255.0f; + + // Comparison tolerance of half the 8 bit integer precision. + const float threshold = 0.5f / 255.0f; + + // What to do if the alpha comparison passes or fails. Positive accepts the pixel, negative clips it. + static const XMVECTORF32 selectIfTrue = { 1, -1 }; + static const XMVECTORF32 selectIfFalse = { -1, 1 }; + static const XMVECTORF32 selectNever = { -1, -1 }; + static const XMVECTORF32 selectAlways = { 1, 1 }; + + float compareTo; + XMVECTOR resultSelector; + + switch (mAlphaFunction) + { + case D3D12_COMPARISON_FUNC_LESS: + // Shader will evaluate: clip((a < x) ? z : w) + compareTo = reference - threshold; + resultSelector = selectIfTrue; + break; + + case D3D12_COMPARISON_FUNC_LESS_EQUAL: + // Shader will evaluate: clip((a < x) ? z : w) + compareTo = reference + threshold; + resultSelector = selectIfTrue; + break; + + case D3D12_COMPARISON_FUNC_GREATER_EQUAL: + // Shader will evaluate: clip((a < x) ? z : w) + compareTo = reference - threshold; + resultSelector = selectIfFalse; + break; + + case D3D12_COMPARISON_FUNC_GREATER: + // Shader will evaluate: clip((a < x) ? z : w) + compareTo = reference + threshold; + resultSelector = selectIfFalse; + break; + + case D3D12_COMPARISON_FUNC_EQUAL: + // Shader will evaluate: clip((abs(a - x) < y) ? z : w) + compareTo = reference; + resultSelector = selectIfTrue; + break; + + case D3D12_COMPARISON_FUNC_NOT_EQUAL: + // Shader will evaluate: clip((abs(a - x) < y) ? z : w) + compareTo = reference; + resultSelector = selectIfFalse; + break; + + case D3D12_COMPARISON_FUNC_NEVER: + // Shader will evaluate: clip((a < x) ? z : w) + compareTo = 0; + resultSelector = selectNever; + break; + + case D3D12_COMPARISON_FUNC_ALWAYS: + // Shader will evaluate: clip((a < x) ? z : w) + compareTo = 0; + resultSelector = selectAlways; + break; + + default: + throw std::exception("Unknown alpha test function"); + } + + // x = compareTo, y = threshold, zw = resultSelector. + constants.alphaTest = XMVectorPermute<0, 1, 4, 5>(XMVectorSet(compareTo, threshold, 0, 0), resultSelector); + + dirtyFlags &= ~EffectDirtyFlags::AlphaTest; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } + + // Set the root signature + commandList->SetGraphicsRootSignature(mRootSignature.Get()); + + // Set the texture. + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture); + commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, GetConstantBufferGpuAddress()); + + // Set the pipeline state + commandList->SetPipelineState(EffectBase::mPipelineState.Get()); +} + +// Public constructor. +AlphaTestEffect::AlphaTestEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription, D3D12_COMPARISON_FUNC alphaFunction) + : pImpl(new Impl(device, effectFlags, pipelineDescription, alphaFunction)) +{ +} + + +// Move constructor. +AlphaTestEffect::AlphaTestEffect(AlphaTestEffect&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +AlphaTestEffect& AlphaTestEffect::operator= (AlphaTestEffect&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +AlphaTestEffect::~AlphaTestEffect() +{ +} + + +void AlphaTestEffect::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + pImpl->Apply(commandList); +} + +void XM_CALLCONV AlphaTestEffect::SetWorld(FXMMATRIX value) +{ + pImpl->matrices.world = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::WorldInverseTranspose | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV AlphaTestEffect::SetView(FXMMATRIX value) +{ + pImpl->matrices.view = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::EyePosition | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV AlphaTestEffect::SetProjection(FXMMATRIX value) +{ + pImpl->matrices.projection = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj; +} + + +void XM_CALLCONV AlphaTestEffect::SetDiffuseColor(FXMVECTOR value) +{ + pImpl->color.diffuseColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void AlphaTestEffect::SetAlpha(float value) +{ + pImpl->color.alpha = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + +void AlphaTestEffect::SetFogStart(float value) +{ + pImpl->fog.start = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void AlphaTestEffect::SetFogEnd(float value) +{ + pImpl->fog.end = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV AlphaTestEffect::SetFogColor(FXMVECTOR value) +{ + pImpl->constants.fogColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + +void AlphaTestEffect::SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor) +{ + pImpl->texture = srvDescriptor; +} + +void AlphaTestEffect::SetReferenceAlpha(int value) +{ + pImpl->referenceAlpha = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::AlphaTest; +} diff --git a/Kits/DirectXTK12/Src/BasicEffect.cpp b/Kits/DirectXTK12/Src/BasicEffect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e826f398ea55848da979d6f0a040fed74d86857 --- /dev/null +++ b/Kits/DirectXTK12/Src/BasicEffect.cpp @@ -0,0 +1,601 @@ +//-------------------------------------------------------------------------------------- +// File: BasicEffect.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "EffectCommon.h" +#include "VertexTypes.h" + +using namespace DirectX; + + +// Constant buffer layout. Must match the shader! +struct BasicEffectConstants +{ + XMVECTOR diffuseColor; + XMVECTOR emissiveColor; + XMVECTOR specularColorAndPower; + + XMVECTOR lightDirection[IEffectLights::MaxDirectionalLights]; + XMVECTOR lightDiffuseColor[IEffectLights::MaxDirectionalLights]; + XMVECTOR lightSpecularColor[IEffectLights::MaxDirectionalLights]; + + XMVECTOR eyePosition; + + XMVECTOR fogColor; + XMVECTOR fogVector; + + XMMATRIX world; + XMVECTOR worldInverseTranspose[3]; + XMMATRIX worldViewProj; +}; + +static_assert( ( sizeof(BasicEffectConstants) % 16 ) == 0, "CB size not padded correctly" ); + + +// Traits type describes our characteristics to the EffectBase template. +struct BasicEffectTraits +{ + typedef BasicEffectConstants ConstantBufferType; + + static const int VertexShaderCount = 20; + static const int PixelShaderCount = 10; + static const int ShaderPermutationCount = 32; +}; + + +// Internal BasicEffect implementation class. +class BasicEffect::Impl : public EffectBase +{ +public: + Impl(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription); + + enum DescriptorIndex + { + Texture, + DescriptorCount + }; + + enum RootParameterIndex + { + TextureSRV, + ConstantBuffer, + RootParameterCount + }; + + bool lightingEnabled; + bool preferPerPixelLighting; + bool vertexColorEnabled; + bool textureEnabled; + + D3D12_GPU_DESCRIPTOR_HANDLE texture; + + EffectLights lights; + + int GetCurrentPipelineStatePermutation() const; + + void Apply(_In_ ID3D12GraphicsCommandList* commandList); +}; + + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasic.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicNoFog.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVc.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVcNoFog.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTx.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTxNoFog.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTxVc.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTxVcNoFog.inc" + + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLighting.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingVc.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingTx.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingTxVc.inc" + + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicOneLight.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicOneLightVc.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicOneLightTx.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicOneLightTxVc.inc" + + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLighting.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingVc.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingTx.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingTxVc.inc" + + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasic.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicNoFog.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicTx.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicTxNoFog.inc" + + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLighting.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLightingNoFog.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLightingTx.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLightingTxNoFog.inc" + + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicPixelLighting.inc" + #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicPixelLightingTx.inc" +#else + #include "Shaders/Compiled/BasicEffect_VSBasic.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicNoFog.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicVc.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicTx.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicTxVc.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc" + + #include "Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc" + + #include "Shaders/Compiled/BasicEffect_VSBasicOneLight.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc" + + #include "Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc" + #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc" + + #include "Shaders/Compiled/BasicEffect_PSBasic.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicNoFog.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicTx.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc" + + #include "Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc" + + #include "Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc" + #include "Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc" +#endif +} + + +const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytecode[] = +{ + { BasicEffect_VSBasic, sizeof(BasicEffect_VSBasic) }, + { BasicEffect_VSBasicNoFog, sizeof(BasicEffect_VSBasicNoFog) }, + { BasicEffect_VSBasicVc, sizeof(BasicEffect_VSBasicVc) }, + { BasicEffect_VSBasicVcNoFog, sizeof(BasicEffect_VSBasicVcNoFog) }, + { BasicEffect_VSBasicTx, sizeof(BasicEffect_VSBasicTx) }, + { BasicEffect_VSBasicTxNoFog, sizeof(BasicEffect_VSBasicTxNoFog) }, + { BasicEffect_VSBasicTxVc, sizeof(BasicEffect_VSBasicTxVc) }, + { BasicEffect_VSBasicTxVcNoFog, sizeof(BasicEffect_VSBasicTxVcNoFog) }, + + { BasicEffect_VSBasicVertexLighting, sizeof(BasicEffect_VSBasicVertexLighting) }, + { BasicEffect_VSBasicVertexLightingVc, sizeof(BasicEffect_VSBasicVertexLightingVc) }, + { BasicEffect_VSBasicVertexLightingTx, sizeof(BasicEffect_VSBasicVertexLightingTx) }, + { BasicEffect_VSBasicVertexLightingTxVc, sizeof(BasicEffect_VSBasicVertexLightingTxVc) }, + + { BasicEffect_VSBasicOneLight, sizeof(BasicEffect_VSBasicOneLight) }, + { BasicEffect_VSBasicOneLightVc, sizeof(BasicEffect_VSBasicOneLightVc) }, + { BasicEffect_VSBasicOneLightTx, sizeof(BasicEffect_VSBasicOneLightTx) }, + { BasicEffect_VSBasicOneLightTxVc, sizeof(BasicEffect_VSBasicOneLightTxVc) }, + + { BasicEffect_VSBasicPixelLighting, sizeof(BasicEffect_VSBasicPixelLighting) }, + { BasicEffect_VSBasicPixelLightingVc, sizeof(BasicEffect_VSBasicPixelLightingVc) }, + { BasicEffect_VSBasicPixelLightingTx, sizeof(BasicEffect_VSBasicPixelLightingTx) }, + { BasicEffect_VSBasicPixelLightingTxVc, sizeof(BasicEffect_VSBasicPixelLightingTxVc) }, +}; + + +const int EffectBase::VertexShaderIndices[] = +{ + 0, // basic + 1, // no fog + 2, // vertex color + 3, // vertex color, no fog + 4, // texture + 5, // texture, no fog + 6, // texture + vertex color + 7, // texture + vertex color, no fog + + 8, // vertex lighting + 8, // vertex lighting, no fog + 9, // vertex lighting + vertex color + 9, // vertex lighting + vertex color, no fog + 10, // vertex lighting + texture + 10, // vertex lighting + texture, no fog + 11, // vertex lighting + texture + vertex color + 11, // vertex lighting + texture + vertex color, no fog + + 12, // one light + 12, // one light, no fog + 13, // one light + vertex color + 13, // one light + vertex color, no fog + 14, // one light + texture + 14, // one light + texture, no fog + 15, // one light + texture + vertex color + 15, // one light + texture + vertex color, no fog + + 16, // pixel lighting + 16, // pixel lighting, no fog + 17, // pixel lighting + vertex color + 17, // pixel lighting + vertex color, no fog + 18, // pixel lighting + texture + 18, // pixel lighting + texture, no fog + 19, // pixel lighting + texture + vertex color + 19, // pixel lighting + texture + vertex color, no fog +}; + +const D3D12_SHADER_BYTECODE EffectBase::PixelShaderBytecode[] = +{ + { BasicEffect_PSBasic, sizeof(BasicEffect_PSBasic) }, + { BasicEffect_PSBasicNoFog, sizeof(BasicEffect_PSBasicNoFog) }, + { BasicEffect_PSBasicTx, sizeof(BasicEffect_PSBasicTx) }, + { BasicEffect_PSBasicTxNoFog, sizeof(BasicEffect_PSBasicTxNoFog) }, + + { BasicEffect_PSBasicVertexLighting, sizeof(BasicEffect_PSBasicVertexLighting) }, + { BasicEffect_PSBasicVertexLightingNoFog, sizeof(BasicEffect_PSBasicVertexLightingNoFog) }, + { BasicEffect_PSBasicVertexLightingTx, sizeof(BasicEffect_PSBasicVertexLightingTx) }, + { BasicEffect_PSBasicVertexLightingTxNoFog, sizeof(BasicEffect_PSBasicVertexLightingTxNoFog) }, + + { BasicEffect_PSBasicPixelLighting, sizeof(BasicEffect_PSBasicPixelLighting) }, + { BasicEffect_PSBasicPixelLightingTx, sizeof(BasicEffect_PSBasicPixelLightingTx) }, +}; + + +const int EffectBase::PixelShaderIndices[] = +{ + 0, // basic + 1, // no fog + 0, // vertex color + 1, // vertex color, no fog + 2, // texture + 3, // texture, no fog + 2, // texture + vertex color + 3, // texture + vertex color, no fog + + 4, // vertex lighting + 5, // vertex lighting, no fog + 4, // vertex lighting + vertex color + 5, // vertex lighting + vertex color, no fog + 6, // vertex lighting + texture + 7, // vertex lighting + texture, no fog + 6, // vertex lighting + texture + vertex color + 7, // vertex lighting + texture + vertex color, no fog + + 4, // one light + 5, // one light, no fog + 4, // one light + vertex color + 5, // one light + vertex color, no fog + 6, // one light + texture + 7, // one light + texture, no fog + 6, // one light + texture + vertex color + 7, // one light + texture + vertex color, no fog + + 8, // pixel lighting + 8, // pixel lighting, no fog + 8, // pixel lighting + vertex color + 8, // pixel lighting + vertex color, no fog + 9, // pixel lighting + texture + 9, // pixel lighting + texture, no fog + 9, // pixel lighting + texture + vertex color + 9, // pixel lighting + texture + vertex color, no fog +}; + +// Global pool of per-device BasicEffect resources. +SharedResourcePool::DeviceResources> EffectBase::deviceResourcesPool; + + +// Constructor. +BasicEffect::Impl::Impl(_In_ ID3D12Device* device, int flags, const EffectPipelineStateDescription& pipelineDescription) + : EffectBase(device) +{ + static_assert( _countof(EffectBase::VertexShaderIndices) == BasicEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::VertexShaderBytecode) == BasicEffectTraits::VertexShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderBytecode) == BasicEffectTraits::PixelShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderIndices) == BasicEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + + lights.InitializeConstants(constants.specularColorAndPower, constants.lightDirection, constants.lightDiffuseColor, constants.lightSpecularColor); + + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer. + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC sampler(0); + CD3DX12_DESCRIPTOR_RANGE descriptorRanges[DescriptorIndex::DescriptorCount]; + descriptorRanges[DescriptorIndex::Texture].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::TextureSRV].InitAsDescriptorTable( + _countof(descriptorRanges), + descriptorRanges); + rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL); + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, 1, &sampler, rootSignatureFlags); + + ThrowIfFailed(CreateRootSignature(device, &rsigDesc, mRootSignature.ReleaseAndGetAddressOf())); + + fog.enabled = (flags & EffectFlags::Fog) != 0; + lightingEnabled = (flags & EffectFlags::Lighting) != 0; + preferPerPixelLighting = (flags & EffectFlags::PerPixelLighting) != 0; + vertexColorEnabled = (flags & EffectFlags::VertexColor) != 0; + textureEnabled = (flags & EffectFlags::Texture) != 0; + + int sp = GetCurrentPipelineStatePermutation(); + int vi = EffectBase::VertexShaderIndices[sp]; + int pi = EffectBase::PixelShaderIndices[sp]; + + EffectBase::CreatePipelineState( + mRootSignature.Get(), + pipelineDescription.inputLayout, + &EffectBase::VertexShaderBytecode[vi], + &EffectBase::PixelShaderBytecode[pi], + pipelineDescription.blendDesc, + pipelineDescription.depthStencilDesc, + pipelineDescription.rasterizerDesc, + pipelineDescription.renderTargetState, + pipelineDescription.primitiveTopology, + pipelineDescription.stripCutValue); +} + + +int BasicEffect::Impl::GetCurrentPipelineStatePermutation() const +{ + int permutation = 0; + + // Use optimized shaders if fog is disabled. + if (!fog.enabled) + { + permutation += 1; + } + + // Support vertex coloring? + if (vertexColorEnabled) + { + permutation += 2; + } + + // Support texturing? + if (textureEnabled) + { + permutation += 4; + } + + if (lightingEnabled) + { + if (preferPerPixelLighting) + { + // Do lighting in the pixel shader. + permutation += 24; + } + else if (!lights.lightEnabled[1] && !lights.lightEnabled[2]) + { + // Use the only-bother-with-the-first-light shader optimization. + permutation += 16; + } + else + { + // Compute all three lights in the vertex shader. + permutation += 8; + } + } + + return permutation; +} + + +// Sets our state onto the D3D device. +void BasicEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + // Compute derived parameter values. + matrices.SetConstants(dirtyFlags, constants.worldViewProj); + fog.SetConstants(dirtyFlags, matrices.worldView, constants.fogVector); + lights.SetConstants(dirtyFlags, matrices, constants.world, constants.worldInverseTranspose, constants.eyePosition, constants.diffuseColor, constants.emissiveColor, lightingEnabled); + + UpdateConstants(); + + // Set the root signature + commandList->SetGraphicsRootSignature(mRootSignature.Get()); + + // Set the texture descriptors. + // **NOTE** If D3D asserts or crashes here, you probably need to call commandList->SetDescriptorHeaps() with the texture descriptor heap. + if (textureEnabled) + { + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture); + } + + // Set constants + commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, GetConstantBufferGpuAddress()); + + // Set the pipeline state + commandList->SetPipelineState(EffectBase::mPipelineState.Get()); +} + + +// Public constructor. +BasicEffect::BasicEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription) + : pImpl(new Impl(device, effectFlags, pipelineDescription)) +{ +} + + +// Move constructor. +BasicEffect::BasicEffect(BasicEffect&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +BasicEffect& BasicEffect::operator= (BasicEffect&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +BasicEffect::~BasicEffect() +{ +} + + +void BasicEffect::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + pImpl->Apply(commandList); +} + +void XM_CALLCONV BasicEffect::SetWorld(FXMMATRIX value) +{ + pImpl->matrices.world = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::WorldInverseTranspose | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV BasicEffect::SetView(FXMMATRIX value) +{ + pImpl->matrices.view = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::EyePosition | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV BasicEffect::SetProjection(FXMMATRIX value) +{ + pImpl->matrices.projection = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj; +} + + +void XM_CALLCONV BasicEffect::SetDiffuseColor(FXMVECTOR value) +{ + pImpl->lights.diffuseColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void XM_CALLCONV BasicEffect::SetEmissiveColor(FXMVECTOR value) +{ + pImpl->lights.emissiveColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void XM_CALLCONV BasicEffect::SetSpecularColor(FXMVECTOR value) +{ + // Set xyz to new value, but preserve existing w (specular power). + pImpl->constants.specularColorAndPower = XMVectorSelect(pImpl->constants.specularColorAndPower, value, g_XMSelect1110); + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void BasicEffect::SetSpecularPower(float value) +{ + // Set w to new value, but preserve existing xyz (specular color). + pImpl->constants.specularColorAndPower = XMVectorSetW(pImpl->constants.specularColorAndPower, value); + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + +void BasicEffect::DisableSpecular() +{ + // Set specular color to black, power to 1 + // Note: Don't use a power of 0 or the shader will generate strange highlights on non-specular materials + + pImpl->constants.specularColorAndPower = g_XMIdentityR3; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + +void BasicEffect::SetAlpha(float value) +{ + pImpl->lights.alpha = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + +void XM_CALLCONV BasicEffect::SetAmbientLightColor(FXMVECTOR value) +{ + pImpl->lights.ambientLightColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void BasicEffect::SetLightEnabled(int whichLight, bool value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightEnabled(whichLight, value, pImpl->constants.lightDiffuseColor, pImpl->constants.lightSpecularColor); +} + + +void XM_CALLCONV BasicEffect::SetLightDirection(int whichLight, FXMVECTOR value) +{ + EffectLights::ValidateLightIndex(whichLight); + + pImpl->constants.lightDirection[whichLight] = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void XM_CALLCONV BasicEffect::SetLightDiffuseColor(int whichLight, FXMVECTOR value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightDiffuseColor(whichLight, value, pImpl->constants.lightDiffuseColor); +} + + +void XM_CALLCONV BasicEffect::SetLightSpecularColor(int whichLight, FXMVECTOR value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightSpecularColor(whichLight, value, pImpl->constants.lightSpecularColor); +} + + +void BasicEffect::EnableDefaultLighting() +{ + EffectLights::EnableDefaultLighting(this); +} + +void BasicEffect::SetFogStart(float value) +{ + pImpl->fog.start = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void BasicEffect::SetFogEnd(float value) +{ + pImpl->fog.end = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV BasicEffect::SetFogColor(FXMVECTOR value) +{ + pImpl->constants.fogColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + +void BasicEffect::SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor) +{ + pImpl->texture = srvDescriptor; +} + + diff --git a/Kits/DirectXTK12/Src/Bezier.h b/Kits/DirectXTK12/Src/Bezier.h new file mode 100644 index 0000000000000000000000000000000000000000..613210a65e0b4a5178ae73b23fb36b2555de9bb9 --- /dev/null +++ b/Kits/DirectXTK12/Src/Bezier.h @@ -0,0 +1,169 @@ +//-------------------------------------------------------------------------------------- +// File: Bezier.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include +#include +#include + + +namespace Bezier +{ + // Performs a cubic bezier interpolation between four control points, + // returning the value at the specified time (t ranges 0 to 1). + // This template implementation can be used to interpolate XMVECTOR, + // float, or any other types that define suitable * and + operators. + template + T CubicInterpolate(T const& p1, T const& p2, T const& p3, T const& p4, float t) + { + using DirectX::operator*; + using DirectX::operator+; + + return p1 * (1 - t) * (1 - t) * (1 - t) + + p2 * 3 * t * (1 - t) * (1 - t) + + p3 * 3 * t * t * (1 - t) + + p4 * t * t * t; + } + + + // Computes the tangent of a cubic bezier curve at the specified time. + // Template supports XMVECTOR, float, or any other types with * and + operators. + template + T CubicTangent(T const& p1, T const& p2, T const& p3, T const& p4, float t) + { + using DirectX::operator*; + using DirectX::operator+; + + return p1 * (-1 + 2 * t - t * t) + + p2 * (1 - 4 * t + 3 * t * t) + + p3 * (2 * t - 3 * t * t) + + p4 * (t * t); + } + + + // Creates vertices for a patch that is tessellated at the specified level. + // Calls the specified outputVertex function for each generated vertex, + // passing the position, normal, and texture coordinate as parameters. + template + void CreatePatchVertices(_In_reads_(16) DirectX::XMVECTOR patch[16], size_t tessellation, bool isMirrored, TOutputFunc outputVertex) + { + using namespace DirectX; + + for (size_t i = 0; i <= tessellation; i++) + { + float u = (float)i / tessellation; + + for (size_t j = 0; j <= tessellation; j++) + { + float v = (float)j / tessellation; + + // Perform four horizontal bezier interpolations + // between the control points of this patch. + XMVECTOR p1 = CubicInterpolate(patch[0], patch[1], patch[2], patch[3], u); + XMVECTOR p2 = CubicInterpolate(patch[4], patch[5], patch[6], patch[7], u); + XMVECTOR p3 = CubicInterpolate(patch[8], patch[9], patch[10], patch[11], u); + XMVECTOR p4 = CubicInterpolate(patch[12], patch[13], patch[14], patch[15], u); + + // Perform a vertical interpolation between the results of the + // previous horizontal interpolations, to compute the position. + XMVECTOR position = CubicInterpolate(p1, p2, p3, p4, v); + + // Perform another four bezier interpolations between the control + // points, but this time vertically rather than horizontally. + XMVECTOR q1 = CubicInterpolate(patch[0], patch[4], patch[8], patch[12], v); + XMVECTOR q2 = CubicInterpolate(patch[1], patch[5], patch[9], patch[13], v); + XMVECTOR q3 = CubicInterpolate(patch[2], patch[6], patch[10], patch[14], v); + XMVECTOR q4 = CubicInterpolate(patch[3], patch[7], patch[11], patch[15], v); + + // Compute vertical and horizontal tangent vectors. + XMVECTOR tangent1 = CubicTangent(p1, p2, p3, p4, v); + XMVECTOR tangent2 = CubicTangent(q1, q2, q3, q4, u); + + // Cross the two tangent vectors to compute the normal. + XMVECTOR normal = XMVector3Cross(tangent1, tangent2); + + if (!XMVector3NearEqual(normal, XMVectorZero(), g_XMEpsilon)) + { + normal = XMVector3Normalize(normal); + + // If this patch is mirrored, we must invert the normal. + if (isMirrored) + { + normal = -normal; + } + } + else + { + // In a tidy and well constructed bezier patch, the preceding + // normal computation will always work. But the classic teapot + // model is not tidy or well constructed! At the top and bottom + // of the teapot, it contains degenerate geometry where a patch + // has several control points in the same place, which causes + // the tangent computation to fail and produce a zero normal. + // We 'fix' these cases by just hard-coding a normal that points + // either straight up or straight down, depending on whether we + // are on the top or bottom of the teapot. This is not a robust + // solution for all possible degenerate bezier patches, but hey, + // it's good enough to make the teapot work correctly! + + normal = XMVectorSelect(g_XMIdentityR1, g_XMNegIdentityR1, XMVectorLess(position, XMVectorZero())); + } + + // Compute the texture coordinate. + float mirroredU = isMirrored ? 1 - u : u; + + XMVECTOR textureCoordinate = XMVectorSet(mirroredU, v, 0, 0); + + // Output this vertex. + outputVertex(position, normal, textureCoordinate); + } + } + } + + + // Creates indices for a patch that is tessellated at the specified level. + // Calls the specified outputIndex function for each generated index value. + template + void CreatePatchIndices(size_t tessellation, bool isMirrored, TOutputFunc outputIndex) + { + size_t stride = tessellation + 1; + + for (size_t i = 0; i < tessellation; i++) + { + for (size_t j = 0; j < tessellation; j++) + { + // Make a list of six index values (two triangles). + std::array indices = + { + i * stride + j, + (i + 1) * stride + j, + (i + 1) * stride + j + 1, + + i * stride + j, + (i + 1) * stride + j + 1, + i * stride + j + 1, + }; + + // If this patch is mirrored, reverse indices to fix the winding order. + if (isMirrored) + { + std::reverse(indices.begin(), indices.end()); + } + + // Output these index values. + std::for_each(indices.begin(), indices.end(), outputIndex); + } + } + } +} diff --git a/Kits/DirectXTK12/Src/BinaryReader.cpp b/Kits/DirectXTK12/Src/BinaryReader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c84e1a42eebef1f2976ce9c5eb62d3c5d2d79fb8 --- /dev/null +++ b/Kits/DirectXTK12/Src/BinaryReader.cpp @@ -0,0 +1,90 @@ +//-------------------------------------------------------------------------------------- +// File: BinaryReader.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" + +#include "BinaryReader.h" + +using namespace DirectX; + + +// Constructor reads from the filesystem. +BinaryReader::BinaryReader(_In_z_ wchar_t const* fileName) +{ + size_t dataSize; + + HRESULT hr = ReadEntireFile(fileName, mOwnedData, &dataSize); + if ( FAILED(hr) ) + { + DebugTrace( "BinaryReader failed (%08X) to load '%ls'\n", hr, fileName ); + throw std::exception( "BinaryReader" ); + } + + mPos = mOwnedData.get(); + mEnd = mOwnedData.get() + dataSize; +} + + +// Constructor reads from an existing memory buffer. +BinaryReader::BinaryReader(_In_reads_bytes_(dataSize) uint8_t const* dataBlob, size_t dataSize) +{ + mPos = dataBlob; + mEnd = dataBlob + dataSize; +} + + +// Reads from the filesystem into memory. +HRESULT BinaryReader::ReadEntireFile(_In_z_ wchar_t const* fileName, _Inout_ std::unique_ptr& data, _Out_ size_t* dataSize) +{ + // Open the file. +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + ScopedHandle hFile(safe_handle(CreateFile2(fileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr))); +#else + ScopedHandle hFile(safe_handle(CreateFileW(fileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr))); +#endif + + if (!hFile) + return HRESULT_FROM_WIN32(GetLastError()); + + // Get the file size. + FILE_STANDARD_INFO fileInfo; + if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo))) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + // File is too big for 32-bit allocation, so reject read. + if (fileInfo.EndOfFile.HighPart > 0) + return E_FAIL; + + // Create enough space for the file data. + data.reset(new uint8_t[fileInfo.EndOfFile.LowPart]); + + if (!data) + return E_OUTOFMEMORY; + + // Read the data in. + DWORD bytesRead = 0; + + if (!ReadFile(hFile.get(), data.get(), fileInfo.EndOfFile.LowPart, &bytesRead, nullptr)) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + if (bytesRead < fileInfo.EndOfFile.LowPart) + return E_FAIL; + + *dataSize = bytesRead; + + return S_OK; +} diff --git a/Kits/DirectXTK12/Src/BinaryReader.h b/Kits/DirectXTK12/Src/BinaryReader.h new file mode 100644 index 0000000000000000000000000000000000000000..2e42cb75b99bcc4aacbc9aa36b49e7e1142ec048 --- /dev/null +++ b/Kits/DirectXTK12/Src/BinaryReader.h @@ -0,0 +1,75 @@ +//-------------------------------------------------------------------------------------- +// File: BinaryReader.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include +#include +#include +#include + +#include "PlatformHelpers.h" + + +namespace DirectX +{ + // Helper for reading binary data, either from the filesystem a memory buffer. + class BinaryReader + { + public: + explicit BinaryReader(_In_z_ wchar_t const* fileName); + BinaryReader(_In_reads_bytes_(dataSize) uint8_t const* dataBlob, size_t dataSize); + + BinaryReader(BinaryReader const&) = delete; + BinaryReader& operator= (BinaryReader const&) = delete; + + // Reads a single value. + template T const& Read() + { + return *ReadArray(1); + } + + + // Reads an array of values. + template T const* ReadArray(size_t elementCount) + { + static_assert(std::is_pod::value, "Can only read plain-old-data types"); + + uint8_t const* newPos = mPos + sizeof(T) * elementCount; + + if (newPos < mPos) + throw std::overflow_error("ReadArray"); + + if (newPos > mEnd) + throw std::exception("End of file"); + + auto result = reinterpret_cast(mPos); + + mPos = newPos; + + return result; + } + + + // Lower level helper reads directly from the filesystem into memory. + static HRESULT ReadEntireFile(_In_z_ wchar_t const* fileName, _Inout_ std::unique_ptr& data, _Out_ size_t* dataSize); + + + private: + // The data currently being read. + uint8_t const* mPos; + uint8_t const* mEnd; + + std::unique_ptr mOwnedData; + }; +} diff --git a/Kits/DirectXTK12/Src/CommonStates.cpp b/Kits/DirectXTK12/Src/CommonStates.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b7e3d42e4b0599fc1b14f515cf499eaaf55518ef --- /dev/null +++ b/Kits/DirectXTK12/Src/CommonStates.cpp @@ -0,0 +1,320 @@ +//-------------------------------------------------------------------------------------- +// File: CommonStates.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "CommonStates.h" +#include "DirectXHelpers.h" + +using namespace DirectX; + +// -------------------------------------------------------------------------- +// Blend States +// -------------------------------------------------------------------------- + +const D3D12_BLEND_DESC CommonStates::Opaque = +{ + FALSE, // AlphaToCoverageEnable + FALSE, // IndependentBlendEnable + { + FALSE, // BlendEnable + FALSE, // LogicOpEnable + D3D12_BLEND_ONE, // SrcBlend + D3D12_BLEND_ZERO, // DestBlend + D3D12_BLEND_OP_ADD, // BlendOp + D3D12_BLEND_ONE, // SrcBlendAlpha + D3D12_BLEND_ZERO, // DestBlendAlpha + D3D12_BLEND_OP_ADD, // BlendOpAlpha + D3D12_LOGIC_OP_CLEAR, // LogicOp + D3D12_COLOR_WRITE_ENABLE_ALL // RenderTargetWriteMask + } +}; + +const D3D12_BLEND_DESC CommonStates::AlphaBlend = +{ + FALSE, // AlphaToCoverageEnable + FALSE, // IndependentBlendEnable + { + TRUE, // BlendEnable + FALSE, // LogicOpEnable + D3D12_BLEND_ONE, // SrcBlend + D3D12_BLEND_INV_SRC_ALPHA, // DestBlend + D3D12_BLEND_OP_ADD, // BlendOp + D3D12_BLEND_ONE, // SrcBlendAlpha + D3D12_BLEND_INV_SRC_ALPHA, // DestBlendAlpha + D3D12_BLEND_OP_ADD, // BlendOpAlpha + D3D12_LOGIC_OP_CLEAR, // LogicOp + D3D12_COLOR_WRITE_ENABLE_ALL // RenderTargetWriteMask + } +}; + +const D3D12_BLEND_DESC CommonStates::Additive = +{ + FALSE, // AlphaToCoverageEnable + FALSE, // IndependentBlendEnable + { + TRUE, // BlendEnable + FALSE, // LogicOpEnable + D3D12_BLEND_ONE, // SrcBlend + D3D12_BLEND_ONE, // DestBlend + D3D12_BLEND_OP_ADD, // BlendOp + D3D12_BLEND_ONE, // SrcBlendAlpha + D3D12_BLEND_ONE, // DestBlendAlpha + D3D12_BLEND_OP_ADD, // BlendOpAlpha + D3D12_LOGIC_OP_CLEAR, // LogicOp + D3D12_COLOR_WRITE_ENABLE_ALL // RenderTargetWriteMask + } +}; + +const D3D12_BLEND_DESC CommonStates::NonPremultiplied = +{ + FALSE, // AlphaToCoverageEnable + FALSE, // IndependentBlendEnable + { + TRUE, // BlendEnable + FALSE, // LogicOpEnable + D3D12_BLEND_SRC_ALPHA, // SrcBlend + D3D12_BLEND_INV_SRC_ALPHA, // DestBlend + D3D12_BLEND_OP_ADD, // BlendOp + D3D12_BLEND_SRC_ALPHA, // SrcBlendAlpha + D3D12_BLEND_INV_SRC_ALPHA, // DestBlendAlpha + D3D12_BLEND_OP_ADD, // BlendOpAlpha + D3D12_LOGIC_OP_CLEAR, // LogicOp + D3D12_COLOR_WRITE_ENABLE_ALL // RenderTargetWriteMask + } +}; + + +// -------------------------------------------------------------------------- +// Depth-Stencil States +// -------------------------------------------------------------------------- + +const D3D12_DEPTH_STENCIL_DESC CommonStates::DepthNone = +{ + FALSE, // DepthEnable + D3D12_DEPTH_WRITE_MASK_ZERO, // DepthWriteMask + D3D12_COMPARISON_FUNC_ALWAYS, // DepthFunc + FALSE, // StencilEnable + D3D12_DEFAULT_STENCIL_READ_MASK, // StencilReadMask + D3D12_DEFAULT_STENCIL_READ_MASK, // StencilWriteMask + { + D3D12_STENCIL_OP_KEEP, // StencilFailOp + D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp + D3D12_STENCIL_OP_KEEP, // StencilPassOp + D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc + }, // FrontFace, + { + D3D12_STENCIL_OP_KEEP, // StencilFailOp + D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp + D3D12_STENCIL_OP_KEEP, // StencilPassOp + D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc + } // BackFace +}; + +const D3D12_DEPTH_STENCIL_DESC CommonStates::DepthDefault = +{ + TRUE, // DepthEnable + D3D12_DEPTH_WRITE_MASK_ALL, // DepthWriteMask + D3D12_COMPARISON_FUNC_LESS_EQUAL, // DepthFunc + FALSE, // StencilEnable + D3D12_DEFAULT_STENCIL_READ_MASK, // StencilReadMask + D3D12_DEFAULT_STENCIL_READ_MASK, // StencilWriteMask + { + D3D12_STENCIL_OP_KEEP, // StencilFailOp + D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp + D3D12_STENCIL_OP_KEEP, // StencilPassOp + D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc + }, // FrontFace, + { + D3D12_STENCIL_OP_KEEP, // StencilFailOp + D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp + D3D12_STENCIL_OP_KEEP, // StencilPassOp + D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc + } // BackFace +}; + +const D3D12_DEPTH_STENCIL_DESC CommonStates::DepthRead = +{ + TRUE, // DepthEnable + D3D12_DEPTH_WRITE_MASK_ZERO, // DepthWriteMask + D3D12_COMPARISON_FUNC_LESS_EQUAL, // DepthFunc + FALSE, // StencilEnable + D3D12_DEFAULT_STENCIL_READ_MASK, // StencilReadMask + D3D12_DEFAULT_STENCIL_READ_MASK, // StencilWriteMask + { + D3D12_STENCIL_OP_KEEP, // StencilFailOp + D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp + D3D12_STENCIL_OP_KEEP, // StencilPassOp + D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc + }, // FrontFace, + { + D3D12_STENCIL_OP_KEEP, // StencilFailOp + D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp + D3D12_STENCIL_OP_KEEP, // StencilPassOp + D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc + } // BackFace +}; + + +// -------------------------------------------------------------------------- +// Rasterizer States +// -------------------------------------------------------------------------- + +const D3D12_RASTERIZER_DESC CommonStates::CullNone = +{ + D3D12_FILL_MODE_SOLID, // FillMode + D3D12_CULL_MODE_NONE, // CullMode + FALSE, // FrontCounterClockwise + 0, // DepthBias + 0, // DepthBiasClamp + 0, // SlopeScaledDepthBias + TRUE, // DepthClipEnable + TRUE, // MultisampleEnable + FALSE, // AntialiasedLineEnable + 0, // ForcedSampleCount + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF // ConservativeRaster +}; + +const D3D12_RASTERIZER_DESC CommonStates::CullClockwise = +{ + D3D12_FILL_MODE_SOLID, // FillMode + D3D12_CULL_MODE_FRONT, // CullMode + FALSE, // FrontCounterClockwise + 0, // DepthBias + 0, // DepthBiasClamp + 0, // SlopeScaledDepthBias + TRUE, // DepthClipEnable + TRUE, // MultisampleEnable + FALSE, // AntialiasedLineEnable + 0, // ForcedSampleCount + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF // ConservativeRaster +}; + +const D3D12_RASTERIZER_DESC CommonStates::CullCounterClockwise = +{ + D3D12_FILL_MODE_SOLID, // FillMode + D3D12_CULL_MODE_BACK, // CullMode + FALSE, // FrontCounterClockwise + 0, // DepthBias + 0, // DepthBiasClamp + 0, // SlopeScaledDepthBias + TRUE, // DepthClipEnable + TRUE, // MultisampleEnable + FALSE, // AntialiasedLineEnable + 0, // ForcedSampleCount + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF // ConservativeRaster +}; + +const D3D12_RASTERIZER_DESC CommonStates::Wireframe = +{ + D3D12_FILL_MODE_WIREFRAME, // FillMode + D3D12_CULL_MODE_BACK, // CullMode + FALSE, // FrontCounterClockwise + 0, // DepthBias + 0, // DepthBiasClamp + 0, // SlopeScaledDepthBias + TRUE, // DepthClipEnable + TRUE, // MultisampleEnable + FALSE, // AntialiasedLineEnable + 0, // ForcedSampleCount + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF // ConservativeRaster +}; + + +// -------------------------------------------------------------------------- +// Sampler States +// -------------------------------------------------------------------------- + +const D3D12_SAMPLER_DESC CommonStates::PointWrap = +{ + D3D12_FILTER_MIN_MAG_MIP_POINT, // Filter + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressU + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressV + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressW + 0, // MipLODBias + D3D12_MAX_MAXANISOTROPY, // MaxAnisotropy + D3D12_COMPARISON_FUNC_NEVER, // ComparisonFunc + { 0, 0, 0, 0 }, // BorderColor + 0, // MinLOD + FLT_MAX // MaxLOD +}; + +const D3D12_SAMPLER_DESC CommonStates::PointClamp = +{ + D3D12_FILTER_MIN_MAG_MIP_POINT, // Filter + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressU + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressV + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressW + 0, // MipLODBias + D3D12_MAX_MAXANISOTROPY, // MaxAnisotropy + D3D12_COMPARISON_FUNC_NEVER, // ComparisonFunc + { 0, 0, 0, 0 }, // BorderColor + 0, // MinLOD + FLT_MAX // MaxLOD +}; + +const D3D12_SAMPLER_DESC CommonStates::LinearWrap = +{ + D3D12_FILTER_MIN_MAG_MIP_LINEAR, // Filter + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressU + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressV + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressW + 0, // MipLODBias + D3D12_MAX_MAXANISOTROPY, // MaxAnisotropy + D3D12_COMPARISON_FUNC_NEVER, // ComparisonFunc + { 0, 0, 0, 0 }, // BorderColor + 0, // MinLOD + FLT_MAX // MaxLOD +}; + +const D3D12_SAMPLER_DESC CommonStates::LinearClamp = +{ + D3D12_FILTER_MIN_MAG_MIP_LINEAR, // Filter + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressU + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressV + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressW + 0, // MipLODBias + D3D12_MAX_MAXANISOTROPY, // MaxAnisotropy + D3D12_COMPARISON_FUNC_NEVER, // ComparisonFunc + { 0, 0, 0, 0 }, // BorderColor + 0, // MinLOD + FLT_MAX // MaxLOD +}; + +const D3D12_SAMPLER_DESC CommonStates::AnisotropicWrap = +{ + D3D12_FILTER_MIN_MAG_MIP_LINEAR, // Filter + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressU + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressV + D3D12_TEXTURE_ADDRESS_MODE_WRAP, // AddressW + 0, // MipLODBias + D3D12_MAX_MAXANISOTROPY, // MaxAnisotropy + D3D12_COMPARISON_FUNC_NEVER, // ComparisonFunc + { 0, 0, 0, 0 }, // BorderColor + 0, // MinLOD + FLT_MAX // MaxLOD +}; + +const D3D12_SAMPLER_DESC CommonStates::AnisotropicClamp = +{ + D3D12_FILTER_ANISOTROPIC, // Filter + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressU + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressV + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, // AddressW + 0, // MipLODBias + D3D12_MAX_MAXANISOTROPY, // MaxAnisotropy + D3D12_COMPARISON_FUNC_NEVER, // ComparisonFunc + { 0, 0, 0, 0 }, // BorderColor + 0, // MinLOD + FLT_MAX // MaxLOD +}; + diff --git a/Kits/DirectXTK12/Src/DDSTextureLoader.cpp b/Kits/DirectXTK12/Src/DDSTextureLoader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..97a27de33f7f34840efc1c291b51f40c09bc158e --- /dev/null +++ b/Kits/DirectXTK12/Src/DDSTextureLoader.cpp @@ -0,0 +1,827 @@ +//-------------------------------------------------------------------------------------- +// File: DDSTextureLoader.cpp +// +// Functions for loading a DDS texture and creating a Direct3D runtime resource for it +// +// Note these functions are useful as a light-weight runtime loader for DDS files. For +// a full-featured DDS file reader, writer, and texture processing pipeline see +// the 'Texconv' sample and the 'DirectXTex' library. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" + +#include "DDSTextureLoader.h" + +#include "dds.h" +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "LoaderHelpers.h" +#include "ResourceUploadBatch.h" + +namespace DirectX +{ + uint32_t CountMips(uint32_t width, uint32_t height); +} + +using namespace DirectX; + +static_assert(DDS_DIMENSION_TEXTURE1D == D3D12_RESOURCE_DIMENSION_TEXTURE1D, "dds mismatch"); +static_assert(DDS_DIMENSION_TEXTURE2D == D3D12_RESOURCE_DIMENSION_TEXTURE2D, "dds mismatch"); +static_assert(DDS_DIMENSION_TEXTURE3D == D3D12_RESOURCE_DIMENSION_TEXTURE3D, "dds mismatch"); + +namespace +{ + + //-------------------------------------------------------------------------------------- + HRESULT FillInitData(_In_ size_t width, + _In_ size_t height, + _In_ size_t depth, + _In_ size_t mipCount, + _In_ size_t arraySize, + _In_ DXGI_FORMAT format, + _In_ size_t maxsize, + _In_ size_t bitSize, + _In_reads_bytes_(bitSize) const uint8_t* bitData, + _Out_ size_t& twidth, + _Out_ size_t& theight, + _Out_ size_t& tdepth, + _Out_ size_t& skipMip, + _Out_writes_(mipCount*arraySize) D3D12_SUBRESOURCE_DATA* initData) + { + if (!bitData || !initData) + { + return E_POINTER; + } + + skipMip = 0; + twidth = 0; + theight = 0; + tdepth = 0; + + size_t NumBytes = 0; + size_t RowBytes = 0; + const uint8_t* pSrcBits = bitData; + const uint8_t* pEndBits = bitData + bitSize; + + size_t index = 0; + for (size_t j = 0; j < arraySize; j++) + { + size_t w = width; + size_t h = height; + size_t d = depth; + for (size_t i = 0; i < mipCount; i++) + { + GetSurfaceInfo(w, + h, + format, + &NumBytes, + &RowBytes, + nullptr + ); + + if ((mipCount <= 1) || !maxsize || (w <= maxsize && h <= maxsize && d <= maxsize)) + { + if (!twidth) + { + twidth = w; + theight = h; + tdepth = d; + } + + assert(index < mipCount * arraySize); + _Analysis_assume_(index < mipCount * arraySize); + initData[index].pData = reinterpret_cast(pSrcBits); + initData[index].RowPitch = RowBytes; + initData[index].SlicePitch = NumBytes; + ++index; + } + else if (!j) + { + // Count number of skipped mipmaps (first item only) + ++skipMip; + } + + if (pSrcBits + (NumBytes*d) > pEndBits) + { + return HRESULT_FROM_WIN32(ERROR_HANDLE_EOF); + } + + pSrcBits += NumBytes * d; + + w = w >> 1; + h = h >> 1; + d = d >> 1; + if (w == 0) + { + w = 1; + } + if (h == 0) + { + h = 1; + } + if (d == 0) + { + d = 1; + } + } + } + + return (index > 0) ? S_OK : E_FAIL; + } + + //-------------------------------------------------------------------------------------- + HRESULT CreateTextureResource( + _In_ ID3D12Device* d3dDevice, + _In_ D3D12_RESOURCE_DIMENSION resDim, + _In_ size_t width, + _In_ size_t height, + _In_ size_t depth, + _In_ size_t mipCount, + _In_ size_t arraySize, + _In_ DXGI_FORMAT format, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _Outptr_ ID3D12Resource** texture) + { + if (!d3dDevice) + return E_POINTER; + + HRESULT hr = E_FAIL; + + if (forceSRGB) + { + format = MakeSRGB(format); + } + + D3D12_RESOURCE_DESC desc = {}; + desc.Width = static_cast(width); + desc.Height = static_cast(height); + desc.MipLevels = static_cast(mipCount); + desc.DepthOrArraySize = (resDim == D3D12_RESOURCE_DIMENSION_TEXTURE3D) ? static_cast(depth) : static_cast(arraySize); + desc.Format = format; + desc.Flags = flags; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Dimension = resDim; + + CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + hr = d3dDevice->CreateCommittedResource( + &defaultHeapProperties, + D3D12_HEAP_FLAG_NONE, + &desc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(texture)); + if (SUCCEEDED(hr)) + { + _Analysis_assume_(*texture != 0); + + SetDebugObjectName(*texture, L"DDSTextureLoader"); + } + + return hr; + } + + //-------------------------------------------------------------------------------------- + HRESULT CreateTextureFromDDS(_In_ ID3D12Device* d3dDevice, + _In_ const DDS_HEADER* header, + _In_reads_bytes_(bitSize) const uint8_t* bitData, + _In_ size_t bitSize, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool reserveFullMipChain, + _Outptr_ ID3D12Resource** texture, + _Out_ std::vector& subresources, + _Out_opt_ bool* outIsCubeMap) + { + HRESULT hr = S_OK; + + UINT width = header->width; + UINT height = header->height; + UINT depth = header->depth; + + D3D12_RESOURCE_DIMENSION resDim = D3D12_RESOURCE_DIMENSION_UNKNOWN; + UINT arraySize = 1; + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN; + bool isCubeMap = false; + + size_t mipCount = header->mipMapCount; + if (0 == mipCount) + { + mipCount = 1; + } + + if ((header->ddspf.flags & DDS_FOURCC) && + (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC)) + { + auto d3d10ext = reinterpret_cast((const char*)header + sizeof(DDS_HEADER)); + + arraySize = d3d10ext->arraySize; + if (arraySize == 0) + { + return HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + } + + switch (d3d10ext->dxgiFormat) + { + case DXGI_FORMAT_AI44: + case DXGI_FORMAT_IA44: + case DXGI_FORMAT_P8: + case DXGI_FORMAT_A8P8: + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + + default: + if (BitsPerPixel(d3d10ext->dxgiFormat) == 0) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + } + + format = d3d10ext->dxgiFormat; + + switch (d3d10ext->resourceDimension) + { + case D3D12_RESOURCE_DIMENSION_TEXTURE1D: + // D3DX writes 1D textures with a fixed Height of 1 + if ((header->flags & DDS_HEIGHT) && height != 1) + { + return HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + } + height = depth = 1; + break; + + case D3D12_RESOURCE_DIMENSION_TEXTURE2D: + if (d3d10ext->miscFlag & 0x4 /* RESOURCE_MISC_TEXTURECUBE */) + { + arraySize *= 6; + isCubeMap = true; + } + depth = 1; + break; + + case D3D12_RESOURCE_DIMENSION_TEXTURE3D: + if (!(header->flags & DDS_HEADER_FLAGS_VOLUME)) + { + return HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + } + + if (arraySize > 1) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + break; + + default: + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + + resDim = static_cast(d3d10ext->resourceDimension); + } + else + { + format = GetDXGIFormat(header->ddspf); + + if (format == DXGI_FORMAT_UNKNOWN) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + + if (header->flags & DDS_HEADER_FLAGS_VOLUME) + { + resDim = D3D12_RESOURCE_DIMENSION_TEXTURE3D; + } + else + { + if (header->caps2 & DDS_CUBEMAP) + { + // We require all six faces to be defined + if ((header->caps2 & DDS_CUBEMAP_ALLFACES) != DDS_CUBEMAP_ALLFACES) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + + arraySize = 6; + isCubeMap = true; + } + + depth = 1; + resDim = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + + // Note there's no way for a legacy Direct3D 9 DDS to express a '1D' texture + } + + assert(BitsPerPixel(format) != 0); + } + + // Bound sizes (for security purposes we don't trust DDS file metadata larger than the Direct3D hardware requirements) + if (mipCount > D3D12_REQ_MIP_LEVELS) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + + switch (resDim) + { + case D3D12_RESOURCE_DIMENSION_TEXTURE1D: + if ((arraySize > D3D12_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION) || + (width > D3D12_REQ_TEXTURE1D_U_DIMENSION)) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + break; + + case D3D12_RESOURCE_DIMENSION_TEXTURE2D: + if (isCubeMap) + { + // This is the right bound because we set arraySize to (NumCubes*6) above + if ((arraySize > D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION) || + (width > D3D12_REQ_TEXTURECUBE_DIMENSION) || + (height > D3D12_REQ_TEXTURECUBE_DIMENSION)) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + } + else if ((arraySize > D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION) || + (width > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION) || + (height > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION)) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + break; + + case D3D12_RESOURCE_DIMENSION_TEXTURE3D: + if ((arraySize > 1) || + (width > D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) || + (height > D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION) || + (depth > D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION)) + { + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + break; + + default: + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + + if (outIsCubeMap != nullptr) + { + *outIsCubeMap = isCubeMap; + } + + // Create the texture + std::vector initData; + initData.resize(mipCount * arraySize); + + size_t skipMip = 0; + size_t twidth = 0; + size_t theight = 0; + size_t tdepth = 0; + hr = FillInitData(width, height, depth, mipCount, arraySize, format, maxsize, bitSize, bitData, + twidth, theight, tdepth, skipMip, &initData[0]); + + if (SUCCEEDED(hr)) + { + size_t reservedMips = mipCount; + if (reserveFullMipChain) + { + reservedMips = std::min(D3D12_REQ_MIP_LEVELS, CountMips(width, height)); + } + + hr = CreateTextureResource(d3dDevice, resDim, twidth, theight, tdepth, reservedMips - skipMip, arraySize, + format, flags, forceSRGB, texture); + + if (FAILED(hr) && !maxsize && (mipCount > 1)) + { + maxsize = (resDim == D3D12_RESOURCE_DIMENSION_TEXTURE3D) + ? D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION + : D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION; + + hr = FillInitData(width, height, depth, mipCount, arraySize, format, maxsize, bitSize, bitData, + twidth, theight, tdepth, skipMip, &initData[0]); + if (SUCCEEDED(hr)) + { + hr = CreateTextureResource(d3dDevice, resDim, twidth, theight, tdepth, mipCount - skipMip, arraySize, + format, flags, forceSRGB, texture); + } + } + } + + if (SUCCEEDED(hr)) + { + subresources.insert(subresources.end(), initData.begin(), initData.end()); + } + + return hr; + } +} // anonymous namespace + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::LoadDDSTextureFromMemory( + ID3D12Device* d3dDevice, + const uint8_t* ddsData, + size_t ddsDataSize, + ID3D12Resource** texture, + std::vector& subresources, + size_t maxsize, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap) +{ + return LoadDDSTextureFromMemoryEx( + d3dDevice, + ddsData, + ddsDataSize, + maxsize, + D3D12_RESOURCE_FLAG_NONE, + false, + false, + texture, + subresources, + alphaMode, + isCubeMap); +} + + +_Use_decl_annotations_ +HRESULT DirectX::LoadDDSTextureFromMemoryEx( + ID3D12Device* d3dDevice, + const uint8_t* ddsData, + size_t ddsDataSize, + size_t maxsize, + D3D12_RESOURCE_FLAGS flags, + bool forceSRGB, + bool reserveFullMipChain, + ID3D12Resource** texture, + std::vector& subresources, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap ) +{ + if ( texture ) + { + *texture = nullptr; + } + if ( alphaMode ) + { + *alphaMode = DDS_ALPHA_MODE_UNKNOWN; + } + if ( isCubeMap ) + { + *isCubeMap = false; + } + + if (!d3dDevice || !ddsData || !texture) + { + return E_INVALIDARG; + } + + // Validate DDS file in memory + if (ddsDataSize < (sizeof(uint32_t) + sizeof(DDS_HEADER))) + { + return E_FAIL; + } + + uint32_t dwMagicNumber = *( const uint32_t* )( ddsData ); + if (dwMagicNumber != DDS_MAGIC) + { + return E_FAIL; + } + + auto header = reinterpret_cast( ddsData + sizeof( uint32_t ) ); + + // Verify header to validate DDS file + if (header->size != sizeof(DDS_HEADER) || + header->ddspf.size != sizeof(DDS_PIXELFORMAT)) + { + return E_FAIL; + } + + // Check for DX10 extension + bool bDXT10Header = false; + if ((header->ddspf.flags & DDS_FOURCC) && + (MAKEFOURCC( 'D', 'X', '1', '0' ) == header->ddspf.fourCC) ) + { + // Must be long enough for both headers and magic value + if (ddsDataSize < (sizeof(DDS_HEADER) + sizeof(uint32_t) + sizeof(DDS_HEADER_DXT10))) + { + return E_FAIL; + } + + bDXT10Header = true; + } + + ptrdiff_t offset = sizeof( uint32_t ) + + sizeof( DDS_HEADER ) + + (bDXT10Header ? sizeof( DDS_HEADER_DXT10 ) : 0); + + HRESULT hr = CreateTextureFromDDS( d3dDevice, + header, ddsData + offset, ddsDataSize - offset, maxsize, + flags, forceSRGB, reserveFullMipChain, + texture, subresources, isCubeMap ); + if ( SUCCEEDED(hr) ) + { + if (texture != 0 && *texture != 0) + { + SetDebugObjectName(*texture, L"DDSTextureLoader"); + } + + if ( alphaMode ) + *alphaMode = GetAlphaMode( header ); + } + + return hr; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::LoadDDSTextureFromFile( + ID3D12Device* d3dDevice, + const wchar_t* fileName, + ID3D12Resource** texture, + std::unique_ptr& ddsData, + std::vector& subresources, + size_t maxsize, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap ) +{ + return LoadDDSTextureFromFileEx( + d3dDevice, + fileName, + maxsize, + D3D12_RESOURCE_FLAG_NONE, + false, + false, + texture, + ddsData, + subresources, + alphaMode, + isCubeMap ); +} + +_Use_decl_annotations_ +HRESULT DirectX::LoadDDSTextureFromFileEx( + ID3D12Device* d3dDevice, + const wchar_t* fileName, + size_t maxsize, + D3D12_RESOURCE_FLAGS flags, + bool forceSRGB, + bool reserveFullMipChain, + ID3D12Resource** texture, + std::unique_ptr& ddsData, + std::vector& subresources, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap ) +{ + if ( texture ) + { + *texture = nullptr; + } + if ( alphaMode ) + { + *alphaMode = DDS_ALPHA_MODE_UNKNOWN; + } + if ( isCubeMap ) + { + *isCubeMap = false; + } + + if (!d3dDevice || !fileName || !texture) + { + return E_INVALIDARG; + } + + DDS_HEADER* header = nullptr; + uint8_t* bitData = nullptr; + size_t bitSize = 0; + + HRESULT hr = LoadTextureDataFromFile( fileName, + ddsData, + &header, + &bitData, + &bitSize + ); + if (FAILED(hr)) + { + return hr; + } + + hr = CreateTextureFromDDS( d3dDevice, + header, bitData, bitSize, maxsize, + flags, forceSRGB, reserveFullMipChain, + texture, subresources, isCubeMap ); + + if ( SUCCEEDED(hr) ) + { +#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) + #if defined(_XBOX_ONE) && defined(_TITLE) + if (texture != 0 && *texture != 0) + { + (*texture)->SetName( fileName ); + } + #else + if (texture != 0) + { + CHAR strFileA[MAX_PATH]; + int result = WideCharToMultiByte( CP_ACP, + WC_NO_BEST_FIT_CHARS, + fileName, + -1, + strFileA, + MAX_PATH, + nullptr, + FALSE + ); + if ( result > 0 ) + { + const wchar_t* pstrName = wcsrchr(fileName, '\\'); + if (!pstrName) + { + pstrName = fileName; + } + else + { + pstrName++; + } + + if (texture != 0 && *texture != 0) + { + (*texture)->SetName(pstrName); + } + } + } + #endif +#endif + + if ( alphaMode ) + *alphaMode = GetAlphaMode( header ); + } + + return hr; +} + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::CreateDDSTextureFromMemory( + ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const uint8_t* ddsData, + size_t ddsDataSize, + ID3D12Resource** texture, + bool generateMipsIfMissing, + size_t maxsize, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap) +{ + return CreateDDSTextureFromMemoryEx( + d3dDevice, + resourceUpload, + ddsData, + ddsDataSize, + maxsize, + D3D12_RESOURCE_FLAG_NONE, + false, + generateMipsIfMissing, + texture, + alphaMode, + isCubeMap); +} + + +_Use_decl_annotations_ +HRESULT DirectX::CreateDDSTextureFromMemoryEx( + ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const uint8_t* ddsData, + size_t ddsDataSize, + size_t maxsize, + D3D12_RESOURCE_FLAGS flags, + bool forceSRGB, + bool generateMipsIfMissing, + ID3D12Resource** texture, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap) +{ + std::vector subresources; + HRESULT hr = LoadDDSTextureFromMemoryEx( + d3dDevice, + ddsData, + ddsDataSize, + maxsize, + flags, + forceSRGB, + generateMipsIfMissing, + texture, + subresources, + alphaMode, + isCubeMap); + + if (SUCCEEDED(hr)) + { + resourceUpload.Upload( + *texture, + 0, + &subresources[0], + (UINT)subresources.size()); + + resourceUpload.Transition( + *texture, + D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + + // If it's missing mips, let's generate them + if (generateMipsIfMissing && subresources.size() != (*texture)->GetDesc().MipLevels) + { + resourceUpload.GenerateMips(*texture); + } + } + + return hr; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::CreateDDSTextureFromFile( + ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const wchar_t* fileName, + ID3D12Resource** texture, + bool generateMipsIfMissing, + size_t maxsize, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap) +{ + return CreateDDSTextureFromFileEx( + d3dDevice, + resourceUpload, + fileName, + maxsize, + D3D12_RESOURCE_FLAG_NONE, + false, + generateMipsIfMissing, + texture, + alphaMode, + isCubeMap); +} + +_Use_decl_annotations_ +HRESULT DirectX::CreateDDSTextureFromFileEx( + ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const wchar_t* fileName, + size_t maxsize, + D3D12_RESOURCE_FLAGS flags, + bool forceSRGB, + bool generateMipsIfMissing, + ID3D12Resource** texture, + DDS_ALPHA_MODE* alphaMode, + bool* isCubeMap) +{ + std::unique_ptr ddsData; + std::vector subresources; + HRESULT hr = LoadDDSTextureFromFileEx( + d3dDevice, + fileName, + maxsize, + flags, + forceSRGB, + generateMipsIfMissing, + texture, + ddsData, + subresources, + alphaMode, + isCubeMap); + + if (SUCCEEDED(hr)) + { + resourceUpload.Upload( + *texture, + 0, + &subresources[0], + (UINT)subresources.size()); + + resourceUpload.Transition( + *texture, + D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + + // If it's missing mips, let's generate them + if (generateMipsIfMissing && subresources.size() != (*texture)->GetDesc().MipLevels) + { + resourceUpload.GenerateMips(*texture); + } + } + + return hr; +} diff --git a/Kits/DirectXTK12/Src/DemandCreate.h b/Kits/DirectXTK12/Src/DemandCreate.h new file mode 100644 index 0000000000000000000000000000000000000000..9caf052a1d06a9e6bbdc0e5f9d7e19d59fd00e5a --- /dev/null +++ b/Kits/DirectXTK12/Src/DemandCreate.h @@ -0,0 +1,51 @@ +//-------------------------------------------------------------------------------------- +// File: DemandCreate.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "PlatformHelpers.h" + + +namespace DirectX +{ + // Helper for lazily creating a D3D resource. + template + static T* DemandCreate(Microsoft::WRL::ComPtr& comPtr, std::mutex& mutex, TCreateFunc createFunc) + { + T* result = comPtr.Get(); + + // Double-checked lock pattern. + MemoryBarrier(); + + if (!result) + { + std::lock_guard lock(mutex); + + result = comPtr.Get(); + + if (!result) + { + // Create the new object. + ThrowIfFailed( + createFunc(&result) + ); + + MemoryBarrier(); + + comPtr.Attach(result); + } + } + + return result; + } +} diff --git a/Kits/DirectXTK12/Src/DescriptorHeap.cpp b/Kits/DirectXTK12/Src/DescriptorHeap.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c25102ee0388c1d33e88631edc0d37f7780d1222 --- /dev/null +++ b/Kits/DirectXTK12/Src/DescriptorHeap.cpp @@ -0,0 +1,179 @@ +//-------------------------------------------------------------------------------------- +// File: DescriptorHeap.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PlatformHelpers.h" +#include "DirectXHelpers.h" +#include "DescriptorHeap.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +namespace +{ + struct DescriptorHeapDesc + { + D3D12_DESCRIPTOR_HEAP_TYPE Type; + D3D12_DESCRIPTOR_HEAP_FLAGS Flags; + }; + + static const DescriptorHeapDesc c_DescriptorHeapDescs[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES] = + { + { D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE }, + { D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE }, + { D3D12_DESCRIPTOR_HEAP_TYPE_RTV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE }, + { D3D12_DESCRIPTOR_HEAP_TYPE_DSV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE } + }; +} + +_Use_decl_annotations_ +DescriptorHeap::DescriptorHeap( + ID3D12DescriptorHeap* pExistingHeap) + : m_pHeap(pExistingHeap) +{ + m_hCPU = pExistingHeap->GetCPUDescriptorHandleForHeapStart(); + m_hGPU = pExistingHeap->GetGPUDescriptorHandleForHeapStart(); + m_desc = pExistingHeap->GetDesc(); + + ComPtr device; + pExistingHeap->GetDevice(IID_GRAPHICS_PPV_ARGS(device.GetAddressOf())); + + m_increment = device->GetDescriptorHandleIncrementSize(m_desc.Type); +} + +_Use_decl_annotations_ +DescriptorHeap::DescriptorHeap( + ID3D12Device* device, + const D3D12_DESCRIPTOR_HEAP_DESC* pDesc) +{ + Create(device, pDesc); +} + +_Use_decl_annotations_ +DescriptorHeap::DescriptorHeap( + ID3D12Device* device, + D3D12_DESCRIPTOR_HEAP_TYPE type, + D3D12_DESCRIPTOR_HEAP_FLAGS flags, + size_t count) +{ + D3D12_DESCRIPTOR_HEAP_DESC desc = {}; + desc.Flags = flags; + desc.NumDescriptors = static_cast(count); + desc.Type = type; + Create(device, &desc); +} + +_Use_decl_annotations_ +D3D12_GPU_DESCRIPTOR_HANDLE DescriptorHeap::WriteDescriptors( + ID3D12Device* device, + uint32_t offsetIntoHeap, + uint32_t totalDescriptorCount, + const D3D12_CPU_DESCRIPTOR_HANDLE* pDescriptorRangeStarts, + const uint32_t* pDescriptorRangeSizes, + uint32_t descriptorRangeCount) +{ + assert(size_t(offsetIntoHeap + totalDescriptorCount) <= size_t(m_desc.NumDescriptors)); + + D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle = GetCpuHandle(offsetIntoHeap); + + device->CopyDescriptors( + 1, + &cpuHandle, + &totalDescriptorCount, + descriptorRangeCount, + pDescriptorRangeStarts, + pDescriptorRangeSizes, + m_desc.Type); + + auto gpuHandle = GetGpuHandle(offsetIntoHeap); + + return gpuHandle; +} + +_Use_decl_annotations_ +D3D12_GPU_DESCRIPTOR_HANDLE DescriptorHeap::WriteDescriptors( + ID3D12Device* device, + uint32_t offsetIntoHeap, + const D3D12_CPU_DESCRIPTOR_HANDLE* pDescriptorRangeStarts, + const uint32_t* pDescriptorRangeSizes, + uint32_t descriptorRangeCount) +{ + uint32_t totalDescriptorCount = 0; + for (uint32_t i = 0; i < descriptorRangeCount; ++i) + totalDescriptorCount += pDescriptorRangeSizes[i]; + + return WriteDescriptors( + device, + offsetIntoHeap, + totalDescriptorCount, + pDescriptorRangeStarts, + pDescriptorRangeSizes, + descriptorRangeCount); +} + +_Use_decl_annotations_ +D3D12_GPU_DESCRIPTOR_HANDLE DescriptorHeap::WriteDescriptors( + ID3D12Device* device, + uint32_t offsetIntoHeap, + const D3D12_CPU_DESCRIPTOR_HANDLE* pDescriptors, + uint32_t descriptorCount) +{ + return WriteDescriptors( + device, + offsetIntoHeap, + descriptorCount, + pDescriptors, + &descriptorCount, + 1); +} + +_Use_decl_annotations_ +void DescriptorHeap::Create( + ID3D12Device* pDevice, + const D3D12_DESCRIPTOR_HEAP_DESC* pDesc ) +{ + assert( pDesc != 0 ); + + m_desc = *pDesc; + m_increment = pDevice->GetDescriptorHandleIncrementSize( pDesc->Type ); + + if (pDesc->NumDescriptors == 0) + { + m_pHeap.Reset(); + m_hCPU = CD3DX12_CPU_DESCRIPTOR_HANDLE(D3D12_DEFAULT); + m_hGPU = CD3DX12_GPU_DESCRIPTOR_HANDLE(D3D12_DEFAULT); + } + else + { + ThrowIfFailed( pDevice->CreateDescriptorHeap( + pDesc, + IID_GRAPHICS_PPV_ARGS( m_pHeap.ReleaseAndGetAddressOf() ) ) ); + + m_hCPU = m_pHeap->GetCPUDescriptorHandleForHeapStart(); + + if ( pDesc->Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE ) + m_hGPU = m_pHeap->GetGPUDescriptorHandleForHeapStart(); + + } +} + +_Use_decl_annotations_ +void DescriptorHeap::DefaultDesc( + D3D12_DESCRIPTOR_HEAP_TYPE type, + D3D12_DESCRIPTOR_HEAP_DESC* pDesc) +{ + assert(c_DescriptorHeapDescs[type].Type == type); + pDesc->Flags = c_DescriptorHeapDescs[type].Flags; + pDesc->NumDescriptors = 0; + pDesc->Type = type; +} diff --git a/Kits/DirectXTK12/Src/DirectXHelpers.cpp b/Kits/DirectXTK12/Src/DirectXHelpers.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ab857b970bb254db23dde820eb8a27c95246f3f2 --- /dev/null +++ b/Kits/DirectXTK12/Src/DirectXHelpers.cpp @@ -0,0 +1,99 @@ +//-------------------------------------------------------------------------------------- +// File: DirectXHelpers.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "DirectXHelpers.h" +#include "GraphicsMemory.h" + +using namespace DirectX; + +_Use_decl_annotations_ +void DirectX::CreateShaderResourceView( + ID3D12Device* d3dDevice, + ID3D12Resource* tex, + D3D12_CPU_DESCRIPTOR_HANDLE srvDescriptor, + bool isCubeMap) +{ + D3D12_RESOURCE_DESC desc = tex->GetDesc(); + D3D12_SHADER_RESOURCE_VIEW_DESC SRVDesc = {}; + SRVDesc.Format = desc.Format; + SRVDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + + switch (desc.Dimension) + { + case D3D12_RESOURCE_DIMENSION_TEXTURE1D: + { + if (desc.DepthOrArraySize > 1) + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE1DARRAY; + SRVDesc.Texture1DArray.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + SRVDesc.Texture1DArray.ArraySize = static_cast(desc.DepthOrArraySize); + } + else + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE1D; + SRVDesc.Texture1D.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + } + } + break; + + case D3D12_RESOURCE_DIMENSION_TEXTURE2D: + { + if (isCubeMap) + { + if (desc.DepthOrArraySize > 6) + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBEARRAY; + SRVDesc.TextureCubeArray.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + + // Earlier we set arraySize to (NumCubes * 6) + SRVDesc.TextureCubeArray.NumCubes = static_cast(desc.DepthOrArraySize / 6); + } + else + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE; + SRVDesc.TextureCube.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + } + } + else if (desc.DepthOrArraySize > 1) + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY; + SRVDesc.Texture2DArray.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + SRVDesc.Texture2DArray.ArraySize = static_cast(desc.DepthOrArraySize); + } + else + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + SRVDesc.Texture2D.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + } + } + break; + + case D3D12_RESOURCE_DIMENSION_TEXTURE3D: + { + SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE3D; + SRVDesc.Texture3D.MipLevels = (!desc.MipLevels) ? -1 : desc.MipLevels; + } + break; + + case D3D12_RESOURCE_DIMENSION_BUFFER: + throw std::exception("CreateShaderResourceView cannot be used with DIMENSION_BUFFER."); + + default: + throw std::exception("CreateShaderResourceView cannot be used with DIMENSION_UNKNOWN."); + } + + d3dDevice->CreateShaderResourceView(tex, &SRVDesc, srvDescriptor); +} + + diff --git a/Kits/DirectXTK12/Src/DualTextureEffect.cpp b/Kits/DirectXTK12/Src/DualTextureEffect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..afd87ce4ff292e5997347abffee33e0142b23321 --- /dev/null +++ b/Kits/DirectXTK12/Src/DualTextureEffect.cpp @@ -0,0 +1,344 @@ +//-------------------------------------------------------------------------------------- +// File: DualTextureEffect.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "EffectCommon.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + + +// Constant buffer layout. Must match the shader! +struct DualTextureEffectConstants +{ + XMVECTOR diffuseColor; + XMVECTOR fogColor; + XMVECTOR fogVector; + XMMATRIX worldViewProj; +}; + +static_assert( ( sizeof(DualTextureEffectConstants) % 16 ) == 0, "CB size not padded correctly" ); + + +// Traits type describes our characteristics to the EffectBase template. +struct DualTextureEffectTraits +{ + typedef DualTextureEffectConstants ConstantBufferType; + + static const int VertexShaderCount = 4; + static const int PixelShaderCount = 2; + static const int ShaderPermutationCount = 4; +}; + + +// Internal DualTextureEffect implementation class. +class DualTextureEffect::Impl : public EffectBase +{ +public: + Impl(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription); + + enum RootParameterIndex + { + Texture1SRV, + Texture2SRV, + ConstantBuffer, + RootParameterCount + }; + + bool vertexColorEnabled; + EffectColor color; + + D3D12_GPU_DESCRIPTOR_HANDLE texture1; + D3D12_GPU_DESCRIPTOR_HANDLE texture2; + + int GetCurrentPipelineStatePermutation() const; + + void Apply(_In_ ID3D12GraphicsCommandList* commandList); +}; + + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTexture.inc" + #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTextureNoFog.inc" + #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTextureVc.inc" + #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTextureVcNoFog.inc" + + #include "Shaders/Compiled/XboxOneDualTextureEffect_PSDualTexture.inc" + #include "Shaders/Compiled/XboxOneDualTextureEffect_PSDualTextureNoFog.inc" +#else + #include "Shaders/Compiled/DualTextureEffect_VSDualTexture.inc" + #include "Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc" + #include "Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc" + #include "Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc" + + #include "Shaders/Compiled/DualTextureEffect_PSDualTexture.inc" + #include "Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc" +#endif +} + + +const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytecode[] = +{ + { DualTextureEffect_VSDualTexture, sizeof(DualTextureEffect_VSDualTexture) }, + { DualTextureEffect_VSDualTextureNoFog, sizeof(DualTextureEffect_VSDualTextureNoFog) }, + { DualTextureEffect_VSDualTextureVc, sizeof(DualTextureEffect_VSDualTextureVc) }, + { DualTextureEffect_VSDualTextureVcNoFog, sizeof(DualTextureEffect_VSDualTextureVcNoFog) }, + +}; + + +const int EffectBase::VertexShaderIndices[] = +{ + 0, // basic + 1, // no fog + 2, // vertex color + 3, // vertex color, no fog +}; + + +const D3D12_SHADER_BYTECODE EffectBase::PixelShaderBytecode[] = +{ + { DualTextureEffect_PSDualTexture, sizeof(DualTextureEffect_PSDualTexture) }, + { DualTextureEffect_PSDualTextureNoFog, sizeof(DualTextureEffect_PSDualTextureNoFog) }, + +}; + + +const int EffectBase::PixelShaderIndices[] = +{ + 0, // basic + 1, // no fog + 0, // vertex color + 1, // vertex color, no fog +}; + + +// Global pool of per-device DualTextureEffect resources. +SharedResourcePool::DeviceResources> EffectBase::deviceResourcesPool; + + +// Constructor. +DualTextureEffect::Impl::Impl(_In_ ID3D12Device* device, int flags, const EffectPipelineStateDescription& pipelineDescription) + : EffectBase(device) +{ + static_assert(_countof(EffectBase::VertexShaderIndices) == DualTextureEffectTraits::ShaderPermutationCount, "array/max mismatch"); + static_assert(_countof(EffectBase::VertexShaderBytecode) == DualTextureEffectTraits::VertexShaderCount, "array/max mismatch"); + static_assert(_countof(EffectBase::PixelShaderBytecode) == DualTextureEffectTraits::PixelShaderCount, "array/max mismatch"); + static_assert(_countof(EffectBase::PixelShaderIndices) == DualTextureEffectTraits::ShaderPermutationCount, "array/max mismatch"); + + { // Create Root signature + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer. + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC samplers[2]; + samplers[0] = CD3DX12_STATIC_SAMPLER_DESC(0); + samplers[1] = CD3DX12_STATIC_SAMPLER_DESC(1); + + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL); + + // Texture 1 + CD3DX12_DESCRIPTOR_RANGE descriptorRange1; + descriptorRange1.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + rootParameters[RootParameterIndex::Texture1SRV].InitAsDescriptorTable(1, &descriptorRange1); + + // Texture 2 + CD3DX12_DESCRIPTOR_RANGE descriptorRange2; + descriptorRange2.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 1); + rootParameters[RootParameterIndex::Texture2SRV].InitAsDescriptorTable(1, &descriptorRange2); + + // Create the root signature + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, _countof(samplers), samplers, rootSignatureFlags); + + ThrowIfFailed(CreateRootSignature(device, &rsigDesc, mRootSignature.ReleaseAndGetAddressOf())); + } + + // Validate flags & state + fog.enabled = (flags & EffectFlags::Fog) != 0; + vertexColorEnabled = (flags & EffectFlags::VertexColor) != 0; + + { // Create pipeline state + int sp = GetCurrentPipelineStatePermutation(); + int vi = EffectBase::VertexShaderIndices[sp]; + int pi = EffectBase::PixelShaderIndices[sp]; + + EffectBase::CreatePipelineState( + mRootSignature.Get(), + pipelineDescription.inputLayout, + &EffectBase::VertexShaderBytecode[vi], + &EffectBase::PixelShaderBytecode[pi], + pipelineDescription.blendDesc, + pipelineDescription.depthStencilDesc, + pipelineDescription.rasterizerDesc, + pipelineDescription.renderTargetState, + pipelineDescription.primitiveTopology, + pipelineDescription.stripCutValue); + } +} + + +int DualTextureEffect::Impl::GetCurrentPipelineStatePermutation() const +{ + int permutation = 0; + + // Use optimized shaders if fog is disabled. + if (!fog.enabled) + { + permutation += 1; + } + + // Support vertex coloring? + if (vertexColorEnabled) + { + permutation += 2; + } + + return permutation; +} + + +// Sets our state onto the D3D device. +void DualTextureEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + // Compute derived parameter values. + matrices.SetConstants(dirtyFlags, constants.worldViewProj); + + fog.SetConstants(dirtyFlags, matrices.worldView, constants.fogVector); + + color.SetConstants(dirtyFlags, constants.diffuseColor); + + UpdateConstants(); + + // Set the root signature + commandList->SetGraphicsRootSignature(mRootSignature.Get()); + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::Texture1SRV, texture1); + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::Texture2SRV, texture2); + commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, GetConstantBufferGpuAddress()); + + // Set the pipeline state + commandList->SetPipelineState(EffectBase::mPipelineState.Get()); +} + + +// Public constructor. +DualTextureEffect::DualTextureEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription) + : pImpl(new Impl(device, effectFlags, pipelineDescription)) +{ +} + + +// Move constructor. +DualTextureEffect::DualTextureEffect(DualTextureEffect&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +DualTextureEffect& DualTextureEffect::operator= (DualTextureEffect&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +DualTextureEffect::~DualTextureEffect() +{ +} + + +void DualTextureEffect::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + pImpl->Apply(commandList); +} + +void XM_CALLCONV DualTextureEffect::SetWorld(FXMMATRIX value) +{ + pImpl->matrices.world = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::WorldInverseTranspose | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV DualTextureEffect::SetView(FXMMATRIX value) +{ + pImpl->matrices.view = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::EyePosition | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV DualTextureEffect::SetProjection(FXMMATRIX value) +{ + pImpl->matrices.projection = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj; +} + + +void XM_CALLCONV DualTextureEffect::SetDiffuseColor(FXMVECTOR value) +{ + pImpl->color.diffuseColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void DualTextureEffect::SetAlpha(float value) +{ + pImpl->color.alpha = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + +void DualTextureEffect::SetFogStart(float value) +{ + pImpl->fog.start = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void DualTextureEffect::SetFogEnd(float value) +{ + pImpl->fog.end = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV DualTextureEffect::SetFogColor(FXMVECTOR value) +{ + pImpl->constants.fogColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void DualTextureEffect::SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor) +{ + pImpl->texture1 = srvDescriptor; +} + +void DualTextureEffect::SetTexture2(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor) +{ + pImpl->texture2 = srvDescriptor; +} diff --git a/Kits/DirectXTK12/Src/EffectCommon.cpp b/Kits/DirectXTK12/Src/EffectCommon.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4be8ffaaa3835e87aae1035a10d100c9d08f747 --- /dev/null +++ b/Kits/DirectXTK12/Src/EffectCommon.cpp @@ -0,0 +1,365 @@ +//-------------------------------------------------------------------------------------- +// File: EffectCommon.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "EffectCommon.h" +#include "DemandCreate.h" +#include "ResourceUploadBatch.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +// Constructor initializes default matrix values. +EffectMatrices::EffectMatrices() +{ + world = XMMatrixIdentity(); + view = XMMatrixIdentity(); + projection = XMMatrixIdentity(); + worldView = XMMatrixIdentity(); +} + + +// Lazily recomputes the combined world+view+projection matrix. +_Use_decl_annotations_ void EffectMatrices::SetConstants(int& dirtyFlags, XMMATRIX& worldViewProjConstant) +{ + if (dirtyFlags & EffectDirtyFlags::WorldViewProj) + { + worldView = XMMatrixMultiply(world, view); + + worldViewProjConstant = XMMatrixTranspose(XMMatrixMultiply(worldView, projection)); + + dirtyFlags &= ~EffectDirtyFlags::WorldViewProj; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } +} + + +// Constructor initializes default fog settings. +EffectFog::EffectFog() +{ + enabled = false; + start = 0; + end = 1; +} + + +// Lazily recomputes the derived vector used by shader fog calculations. +_Use_decl_annotations_ +void XM_CALLCONV EffectFog::SetConstants(int& dirtyFlags, FXMMATRIX worldView, XMVECTOR& fogVectorConstant) +{ + if (enabled) + { + if (dirtyFlags & (EffectDirtyFlags::FogVector | EffectDirtyFlags::FogEnable)) + { + if (start == end) + { + // Degenerate case: force everything to 100% fogged if start and end are the same. + static const XMVECTORF32 fullyFogged = { 0, 0, 0, 1 }; + + fogVectorConstant = fullyFogged; + } + else + { + // We want to transform vertex positions into view space, take the resulting + // Z value, then scale and offset according to the fog start/end distances. + // Because we only care about the Z component, the shader can do all this + // with a single dot product, using only the Z row of the world+view matrix. + + // _13, _23, _33, _43 + XMVECTOR worldViewZ = XMVectorMergeXY(XMVectorMergeZW(worldView.r[0], worldView.r[2]), + XMVectorMergeZW(worldView.r[1], worldView.r[3])); + + // 0, 0, 0, fogStart + XMVECTOR wOffset = XMVectorSwizzle<1, 2, 3, 0>(XMLoadFloat(&start)); + + fogVectorConstant = (worldViewZ + wOffset) / (start - end); + } + + dirtyFlags &= ~(EffectDirtyFlags::FogVector | EffectDirtyFlags::FogEnable); + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } + } + else + { + // When fog is disabled, make sure the fog vector is reset to zero. + if (dirtyFlags & EffectDirtyFlags::FogEnable) + { + fogVectorConstant = g_XMZero; + + dirtyFlags &= ~EffectDirtyFlags::FogEnable; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } + } +} + + +// Constructor initializes default material color settings. +EffectColor::EffectColor() +{ + diffuseColor = g_XMOne; + alpha = 1; +} + + +// Lazily recomputes the material color parameter for shaders that do not support realtime lighting. +void EffectColor::SetConstants(_Inout_ int& dirtyFlags, _Inout_ XMVECTOR& diffuseColorConstant) +{ + if (dirtyFlags & EffectDirtyFlags::MaterialColor) + { + XMVECTOR alphaVector = XMVectorReplicate(alpha); + + // xyz = diffuse * alpha, w = alpha. + diffuseColorConstant = XMVectorSelect(alphaVector, diffuseColor * alphaVector, g_XMSelect1110); + + dirtyFlags &= ~EffectDirtyFlags::MaterialColor; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } +} + + +// Constructor initializes default light settings. +EffectLights::EffectLights() +{ + emissiveColor = g_XMZero; + ambientLightColor = g_XMZero; + + for (int i = 0; i < MaxDirectionalLights; i++) + { + lightEnabled[i] = (i == 0); + lightDiffuseColor[i] = g_XMOne; + lightSpecularColor[i] = g_XMZero; + } +} + + +#pragma prefast(push) +#pragma prefast(disable:22103, "PREFAST doesn't understand buffer is bounded by a static const value even with SAL" ) + +// Initializes constant buffer fields to match the current lighting state. +_Use_decl_annotations_ void EffectLights::InitializeConstants(XMVECTOR& specularColorAndPowerConstant, XMVECTOR* lightDirectionConstant, XMVECTOR* lightDiffuseConstant, XMVECTOR* lightSpecularConstant) +{ + static const XMVECTORF32 defaultSpecular = { 1, 1, 1, 16 }; + static const XMVECTORF32 defaultLightDirection = { 0, -1, 0, 0 }; + + specularColorAndPowerConstant = defaultSpecular; + + for (int i = 0; i < MaxDirectionalLights; i++) + { + lightDirectionConstant[i] = defaultLightDirection; + + lightDiffuseConstant[i] = lightEnabled[i] ? lightDiffuseColor[i] : g_XMZero; + lightSpecularConstant[i] = lightEnabled[i] ? lightSpecularColor[i] : g_XMZero; + } +} + +#pragma prefast(pop) + + +// Lazily recomputes derived parameter values used by shader lighting calculations. +_Use_decl_annotations_ void EffectLights::SetConstants(int& dirtyFlags, EffectMatrices const& matrices, XMMATRIX& worldConstant, XMVECTOR worldInverseTransposeConstant[3], XMVECTOR& eyePositionConstant, XMVECTOR& diffuseColorConstant, XMVECTOR& emissiveColorConstant, bool lightingEnabled) +{ + if (lightingEnabled) + { + // World inverse transpose matrix. + if (dirtyFlags & EffectDirtyFlags::WorldInverseTranspose) + { + worldConstant = XMMatrixTranspose(matrices.world); + + XMMATRIX worldInverse = XMMatrixInverse(nullptr, matrices.world); + + worldInverseTransposeConstant[0] = worldInverse.r[0]; + worldInverseTransposeConstant[1] = worldInverse.r[1]; + worldInverseTransposeConstant[2] = worldInverse.r[2]; + + dirtyFlags &= ~EffectDirtyFlags::WorldInverseTranspose; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } + + // Eye position vector. + if (dirtyFlags & EffectDirtyFlags::EyePosition) + { + XMMATRIX viewInverse = XMMatrixInverse(nullptr, matrices.view); + + eyePositionConstant = viewInverse.r[3]; + + dirtyFlags &= ~EffectDirtyFlags::EyePosition; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } + } + + // Material color parameters. The desired lighting model is: + // + // ((ambientLightColor + sum(diffuse directional light)) * diffuseColor) + emissiveColor + // + // When lighting is disabled, ambient and directional lights are ignored, leaving: + // + // diffuseColor + emissiveColor + // + // For the lighting disabled case, we can save one shader instruction by precomputing + // diffuse+emissive on the CPU, after which the shader can use diffuseColor directly, + // ignoring its emissive parameter. + // + // When lighting is enabled, we can merge the ambient and emissive settings. If we + // set our emissive parameter to emissive+(ambient*diffuse), the shader no longer + // needs to bother adding the ambient contribution, simplifying its computation to: + // + // (sum(diffuse directional light) * diffuseColor) + emissiveColor + // + // For futher optimization goodness, we merge material alpha with the diffuse + // color parameter, and premultiply all color values by this alpha. + + if (dirtyFlags & EffectDirtyFlags::MaterialColor) + { + XMVECTOR diffuse = diffuseColor; + XMVECTOR alphaVector = XMVectorReplicate(alpha); + + if (lightingEnabled) + { + // Merge emissive and ambient light contributions. + emissiveColorConstant = (emissiveColor + ambientLightColor * diffuse) * alphaVector; + } + else + { + // Merge diffuse and emissive light contributions. + diffuse += emissiveColor; + } + + // xyz = diffuse * alpha, w = alpha. + diffuseColorConstant = XMVectorSelect(alphaVector, diffuse * alphaVector, g_XMSelect1110); + + dirtyFlags &= ~EffectDirtyFlags::MaterialColor; + dirtyFlags |= EffectDirtyFlags::ConstantBuffer; + } +} + + +#pragma prefast(push) +#pragma prefast(disable:26015, "PREFAST doesn't understand that ValidateLightIndex bounds whichLight" ) + +// Helper for turning one of the directional lights on or off. +_Use_decl_annotations_ int EffectLights::SetLightEnabled(int whichLight, bool value, XMVECTOR* lightDiffuseConstant, XMVECTOR* lightSpecularConstant) +{ + ValidateLightIndex(whichLight); + + if (lightEnabled[whichLight] == value) + return 0; + + lightEnabled[whichLight] = value; + + if (value) + { + // If this light is now on, store its color in the constant buffer. + lightDiffuseConstant[whichLight] = lightDiffuseColor[whichLight]; + lightSpecularConstant[whichLight] = lightSpecularColor[whichLight]; + } + else + { + // If the light is off, reset constant buffer colors to zero. + lightDiffuseConstant[whichLight] = g_XMZero; + lightSpecularConstant[whichLight] = g_XMZero; + } + + return EffectDirtyFlags::ConstantBuffer; +} + + +// Helper for setting diffuse color of one of the directional lights. +_Use_decl_annotations_ +int XM_CALLCONV EffectLights::SetLightDiffuseColor(int whichLight, FXMVECTOR value, XMVECTOR* lightDiffuseConstant) +{ + ValidateLightIndex(whichLight); + + // Locally store the new color. + lightDiffuseColor[whichLight] = value; + + // If this light is currently on, also update the constant buffer. + if (lightEnabled[whichLight]) + { + lightDiffuseConstant[whichLight] = value; + + return EffectDirtyFlags::ConstantBuffer; + } + + return 0; +} + + +// Helper for setting specular color of one of the directional lights. +_Use_decl_annotations_ +int XM_CALLCONV EffectLights::SetLightSpecularColor(int whichLight, FXMVECTOR value, XMVECTOR* lightSpecularConstant) +{ + ValidateLightIndex(whichLight); + + // Locally store the new color. + lightSpecularColor[whichLight] = value; + + // If this light is currently on, also update the constant buffer. + if (lightEnabled[whichLight]) + { + lightSpecularConstant[whichLight] = value; + + return EffectDirtyFlags::ConstantBuffer; + } + + return 0; +} + +#pragma prefast(pop) + + +// Parameter validation helper. +void EffectLights::ValidateLightIndex(int whichLight) +{ + if (whichLight < 0 || whichLight >= MaxDirectionalLights) + { + throw std::out_of_range("whichLight parameter out of range"); + } +} + + +// Activates the default lighting rig (key, fill, and back lights). +void EffectLights::EnableDefaultLighting(_In_ IEffectLights* effect) +{ + static const XMVECTORF32 defaultDirections[MaxDirectionalLights] = + { + { -0.5265408f, -0.5735765f, -0.6275069f }, + { 0.7198464f, 0.3420201f, 0.6040227f }, + { 0.4545195f, -0.7660444f, 0.4545195f }, + }; + + static const XMVECTORF32 defaultDiffuse[MaxDirectionalLights] = + { + { 1.0000000f, 0.9607844f, 0.8078432f }, + { 0.9647059f, 0.7607844f, 0.4078432f }, + { 0.3231373f, 0.3607844f, 0.3937255f }, + }; + + static const XMVECTORF32 defaultSpecular[MaxDirectionalLights] = + { + { 1.0000000f, 0.9607844f, 0.8078432f }, + { 0.0000000f, 0.0000000f, 0.0000000f }, + { 0.3231373f, 0.3607844f, 0.3937255f }, + }; + + static const XMVECTORF32 defaultAmbient = { 0.05333332f, 0.09882354f, 0.1819608f }; + + effect->SetAmbientLightColor(defaultAmbient); + + for (int i = 0; i < MaxDirectionalLights; i++) + { + effect->SetLightEnabled(i, true); + effect->SetLightDirection(i, defaultDirections[i]); + effect->SetLightDiffuseColor(i, defaultDiffuse[i]); + effect->SetLightSpecularColor(i, defaultSpecular[i]); + } +} diff --git a/Kits/DirectXTK12/Src/EffectCommon.h b/Kits/DirectXTK12/Src/EffectCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..d4185d8d403b6026c6fabc57f4a312c7a19cb15b --- /dev/null +++ b/Kits/DirectXTK12/Src/EffectCommon.h @@ -0,0 +1,255 @@ +//-------------------------------------------------------------------------------------- +// File: EffectCommon.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include + +#include "Effects.h" +#include "PlatformHelpers.h" +#include "SharedResourcePool.h" +#include "AlignedNew.h" +#include "DescriptorHeap.h" +#include "GraphicsMemory.h" +#include "DirectXHelpers.h" +#include "RenderTargetState.h" + +// BasicEffect, SkinnedEffect, et al, have many things in common, but also significant +// differences (for instance, not all the effects support lighting). This header breaks +// out common functionality into a set of helpers which can be assembled in different +// combinations to build up whatever subset is needed by each effect. + + +namespace DirectX +{ + // Bitfield tracks which derived parameter values need to be recomputed. + namespace EffectDirtyFlags + { + const int ConstantBuffer = 0x01; + const int WorldViewProj = 0x02; + const int WorldInverseTranspose = 0x04; + const int EyePosition = 0x08; + const int MaterialColor = 0x10; + const int FogVector = 0x20; + const int FogEnable = 0x40; + const int AlphaTest = 0x80; + } + + // Helper stores matrix parameter values, and computes derived matrices. + struct EffectMatrices + { + EffectMatrices(); + + XMMATRIX world; + XMMATRIX view; + XMMATRIX projection; + XMMATRIX worldView; + + void SetConstants(_Inout_ int& dirtyFlags, _Inout_ XMMATRIX& worldViewProjConstant); + }; + + + // Helper stores the current fog settings, and computes derived shader parameters. + struct EffectFog + { + EffectFog(); + + bool enabled; + float start; + float end; + + void XM_CALLCONV SetConstants(_Inout_ int& dirtyFlags, _In_ FXMMATRIX worldView, _Inout_ XMVECTOR& fogVectorConstant); + }; + + + // Helper stores material color settings, and computes derived parameters for shaders that do not support realtime lighting. + struct EffectColor + { + EffectColor(); + + XMVECTOR diffuseColor; + float alpha; + + void SetConstants(_Inout_ int& dirtyFlags, _Inout_ XMVECTOR& diffuseColorConstant); + }; + + + // Helper stores the current light settings, and computes derived shader parameters. + struct EffectLights : public EffectColor + { + EffectLights(); + + static const int MaxDirectionalLights = IEffectLights::MaxDirectionalLights; + + + // Fields. + XMVECTOR emissiveColor; + XMVECTOR ambientLightColor; + + bool lightEnabled[MaxDirectionalLights]; + XMVECTOR lightDiffuseColor[MaxDirectionalLights]; + XMVECTOR lightSpecularColor[MaxDirectionalLights]; + + + // Methods. + void InitializeConstants(_Out_ XMVECTOR& specularColorAndPowerConstant, _Out_writes_all_(MaxDirectionalLights) XMVECTOR* lightDirectionConstant, _Out_writes_all_(MaxDirectionalLights) XMVECTOR* lightDiffuseConstant, _Out_writes_all_(MaxDirectionalLights) XMVECTOR* lightSpecularConstant); + void SetConstants(_Inout_ int& dirtyFlags, _In_ EffectMatrices const& matrices, _Inout_ XMMATRIX& worldConstant, _Inout_updates_(3) XMVECTOR worldInverseTransposeConstant[3], _Inout_ XMVECTOR& eyePositionConstant, _Inout_ XMVECTOR& diffuseColorConstant, _Inout_ XMVECTOR& emissiveColorConstant, bool lightingEnabled); + + int SetLightEnabled(int whichLight, bool value, _Inout_updates_(MaxDirectionalLights) XMVECTOR* lightDiffuseConstant, _Inout_updates_(MaxDirectionalLights) XMVECTOR* lightSpecularConstant); + int XM_CALLCONV SetLightDiffuseColor(int whichLight, FXMVECTOR value, _Inout_updates_(MaxDirectionalLights) XMVECTOR* lightDiffuseConstant); + int XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value, _Inout_updates_(MaxDirectionalLights) XMVECTOR* lightSpecularConstant); + + static void ValidateLightIndex(int whichLight); + static void EnableDefaultLighting(_In_ IEffectLights* effect); + }; + + // Factory for lazily instantiating shaders. BasicEffect supports many different + // shader permutations, so we only bother creating the ones that are actually used. + class EffectDeviceResources + { + public: + EffectDeviceResources(_In_ ID3D12Device* device) + : mDevice(device) + { } + + inline ID3D12Device* GetDevice() { return mDevice.Get(); } + + protected: + Microsoft::WRL::ComPtr mDevice; + Microsoft::WRL::ComPtr mDefaultTexture; + + std::mutex mMutex; + }; + + // Templated base class provides functionality common to all the built-in effects. + template + class EffectBase : public AlignedNew + { + public: + typename Traits::ConstantBufferType constants; + + // Constructor. + EffectBase(_In_ ID3D12Device* device) + : dirtyFlags(INT_MAX), + mDeviceResources(deviceResourcesPool.DemandCreate(device)), + constants{} + { + // Initialize the constant buffer data + mConstantBuffer = GraphicsMemory::Get().AllocateConstant(constants); + } + + // Commits constants to the constant buffer memory + void UpdateConstants() + { + // Make sure the constant buffer is up to date. + if (dirtyFlags & EffectDirtyFlags::ConstantBuffer) + { + mConstantBuffer = GraphicsMemory::Get().AllocateConstant(constants); + + dirtyFlags &= ~EffectDirtyFlags::ConstantBuffer; + } + } + + D3D12_GPU_VIRTUAL_ADDRESS GetConstantBufferGpuAddress() + { + return mConstantBuffer.GpuAddress(); + } + + void CreatePipelineState( + _In_ ID3D12RootSignature* rootSignature, + _In_ const D3D12_INPUT_LAYOUT_DESC* inputLayout, + _In_ const D3D12_SHADER_BYTECODE* vertexShaderByteCode, + _In_ const D3D12_SHADER_BYTECODE* pixelShaderByteCode, + _In_ const D3D12_BLEND_DESC* blend, + _In_ const D3D12_DEPTH_STENCIL_DESC* depthStencil, + _In_ const D3D12_RASTERIZER_DESC* rasterizer, + _In_ const RenderTargetState* renderTarget, + _In_ D3D12_PRIMITIVE_TOPOLOGY_TYPE primitiveTopology, + _In_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE stripCutValue) + { + ID3D12Device* device = mDeviceResources->GetDevice(); + + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + psoDesc.pRootSignature = rootSignature; + psoDesc.BlendState = *blend; + psoDesc.DepthStencilState = *depthStencil; + psoDesc.RasterizerState = *rasterizer; + psoDesc.DSVFormat = renderTarget->dsvFormat; + psoDesc.NodeMask = renderTarget->nodeMask; + psoDesc.NumRenderTargets = renderTarget->numRenderTargets; + memcpy(psoDesc.RTVFormats, renderTarget->rtvFormats, sizeof(psoDesc.RTVFormats)); + psoDesc.SampleDesc = renderTarget->sampleDesc; + psoDesc.SampleMask = renderTarget->sampleMask; + psoDesc.InputLayout = *inputLayout; + psoDesc.IBStripCutValue = stripCutValue; + psoDesc.PrimitiveTopologyType = primitiveTopology; + psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE; + + psoDesc.VS = *vertexShaderByteCode; + psoDesc.PS = *pixelShaderByteCode; + + HRESULT hr = device->CreateGraphicsPipelineState( + &psoDesc, + IID_GRAPHICS_PPV_ARGS(mPipelineState.ReleaseAndGetAddressOf())); + + + if (FAILED(hr)) + { + throw std::exception( + "CreatePipelineState failed to create a PSO. " + "Enable the Direct3D Debug Layer for more information."); + } + } + + ID3D12Device* GetDevice() { return mDeviceResources->GetDevice(); } + + // Fields. + EffectMatrices matrices; + EffectFog fog; + int dirtyFlags; + + protected: + // Static arrays hold all the precompiled shader permutations. + static const D3D12_SHADER_BYTECODE VertexShaderBytecode[Traits::VertexShaderCount]; + static const D3D12_SHADER_BYTECODE PixelShaderBytecode[Traits::PixelShaderCount]; + // .. and shader entry points + static const int VertexShaderIndices[Traits::ShaderPermutationCount]; + static const int PixelShaderIndices[Traits::ShaderPermutationCount]; + // ... and vertex layout tables + static const D3D12_INPUT_LAYOUT_DESC VertexShaderInputLayouts[Traits::ShaderPermutationCount]; + + // Per instance cache of PSOs, populated with variants for each shader & layout + Microsoft::WRL::ComPtr mPipelineState; + + // Per instance root signature (this could possibly be per effect type) + Microsoft::WRL::ComPtr mRootSignature; + + private: + // D3D constant buffer holds a copy of the same data as the public 'constants' field. + GraphicsResource mConstantBuffer; + + // Only one of these helpers is allocated per D3D device, even if there are multiple effect instances. + class DeviceResources : public EffectDeviceResources + { + public: + DeviceResources(_In_ ID3D12Device* device) + : EffectDeviceResources(device) + { } + }; + + // Per-device resources. + std::shared_ptr mDeviceResources; + + static SharedResourcePool deviceResourcesPool; + }; +} diff --git a/Kits/DirectXTK12/Src/EffectFactory.cpp b/Kits/DirectXTK12/Src/EffectFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..df28d998bec0e733d1a886a152ec2b7c76d05cb9 --- /dev/null +++ b/Kits/DirectXTK12/Src/EffectFactory.cpp @@ -0,0 +1,389 @@ +//-------------------------------------------------------------------------------------- +// File: EffectFactory.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Effects.h" +#include "CommonStates.h" +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" + +#include + + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +// Internal EffectFactory implementation class. Only one of these helpers is allocated +// per D3D device, even if there are multiple public facing EffectFactory instances. +class EffectFactory::Impl +{ +public: + Impl(_In_ ID3D12Device* device, _In_ ID3D12DescriptorHeap* heap) + : device(device) + , mDescriptors(heap) + , mSharing(true) + { + } + + std::shared_ptr CreateEffect( + _In_ const EffectInfo& info, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_ const D3D12_INPUT_LAYOUT_DESC& inputLayout, + _In_opt_ int baseDescriptorOffset); + + void ReleaseCache(); + void SetSharing( bool enabled ) { mSharing = enabled; } + + ComPtr mDescriptors; + +private: + ID3D12Device* device; + + typedef std::map< std::wstring, std::shared_ptr > EffectCache; + + EffectCache mEffectCache; + EffectCache mEffectCacheSkinning; + EffectCache mEffectCacheDualTexture; + + bool mSharing; + + std::mutex mutex; +}; + + +_Use_decl_annotations_ +std::shared_ptr EffectFactory::Impl::CreateEffect( + const EffectInfo& info, + const EffectPipelineStateDescription& pipelineState, + const D3D12_INPUT_LAYOUT_DESC& inputLayoutDesc, + int baseDescriptorOffset) +{ + D3D12_DESCRIPTOR_HEAP_DESC descriptorHeapDesc = {}; + CD3DX12_GPU_DESCRIPTOR_HANDLE textureDescriptorHeapGpuHandle = {}; + CD3DX12_GPU_DESCRIPTOR_HANDLE endDescriptor = {}; + int textureDescriptorHeapIncrement = 0; + + // If we have descriptors, get some information about that + if (mDescriptors != nullptr) + { + descriptorHeapDesc = mDescriptors->GetDesc(); + + // Get the texture offsets and descriptor handles + textureDescriptorHeapIncrement = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + textureDescriptorHeapGpuHandle = CD3DX12_GPU_DESCRIPTOR_HANDLE( + mDescriptors->GetGPUDescriptorHandleForHeapStart(), + baseDescriptorOffset, + textureDescriptorHeapIncrement); + + // For validation, get the last descriptor + endDescriptor = CD3DX12_GPU_DESCRIPTOR_HANDLE( + mDescriptors->GetGPUDescriptorHandleForHeapStart(), + descriptorHeapDesc.NumDescriptors, + textureDescriptorHeapIncrement); + } + + auto checkDescriptor = [endDescriptor] (D3D12_GPU_DESCRIPTOR_HANDLE handle) + { + if (handle.ptr >= endDescriptor.ptr) + { + throw std::exception("Out of descriptor heap space."); + } + }; + + // Modify base pipeline state + EffectPipelineStateDescription derivedPSD = pipelineState; + + // Input layout + derivedPSD.inputLayout = &inputLayoutDesc; + + // Alpha state modification + if ( info.alphaValue < 1.0f ) + { + derivedPSD.depthStencilDesc = &CommonStates::DepthRead; + + if ( info.isPremultipliedAlpha ) + { + derivedPSD.blendDesc = &CommonStates::AlphaBlend; + } + else + { + derivedPSD.blendDesc = &CommonStates::NonPremultiplied; + } + } + + if ( info.enableSkinning ) + { + // SkinnedEffect + if ( mSharing && !info.name.empty() ) + { + auto it = mEffectCacheSkinning.find( info.name ); + if ( mSharing && it != mEffectCacheSkinning.end() ) + { + return it->second; + } + } + + std::shared_ptr effect = std::make_shared( device, EffectFlags::None, derivedPSD ); + + effect->EnableDefaultLighting(); + + effect->SetAlpha( info.alphaValue ); + + // Skinned Effect does not have an ambient material color, or per-vertex color support + + XMVECTOR color = XMLoadFloat3( &info.diffuseColor ); + effect->SetDiffuseColor( color ); + + if ( info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0 ) + { + color = XMLoadFloat3( &info.specularColor ); + effect->SetSpecularColor( color ); + effect->SetSpecularPower( info.specularPower ); + } + else + { + effect->DisableSpecular(); + } + + if ( info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0 ) + { + color = XMLoadFloat3( &info.emissiveColor ); + effect->SetEmissiveColor( color ); + } + + if ( mDescriptors != nullptr && info.textureIndex != -1 ) + { + CD3DX12_GPU_DESCRIPTOR_HANDLE handle( + textureDescriptorHeapGpuHandle, + textureDescriptorHeapIncrement * info.textureIndex); + + checkDescriptor(handle); + effect->SetTexture(handle); + } + + if ( mSharing && !info.name.empty() ) + { + std::lock_guard lock(mutex); + mEffectCacheSkinning.insert( EffectCache::value_type( info.name, effect ) ); + } + + return effect; + } + else if ( info.enableDualTexture ) + { + // DualTextureEffect + if ( mSharing && !info.name.empty() ) + { + auto it = mEffectCacheDualTexture.find( info.name ); + if ( mSharing && it != mEffectCacheDualTexture.end() ) + { + return it->second; + } + } + + // set effect flags for creation + int flags = EffectFlags::Lighting; + + if (info.perVertexColor) + { + flags |= EffectFlags::VertexColor; + } + + std::shared_ptr effect = std::make_shared(device, flags, derivedPSD ); + + // Dual texture effect doesn't support lighting (usually it's lightmaps) + effect->SetAlpha( info.alphaValue ); + + XMVECTOR color = XMLoadFloat3( &info.diffuseColor ); + effect->SetDiffuseColor( color ); + + if ( mDescriptors != nullptr && info.textureIndex != -1 ) + { + CD3DX12_GPU_DESCRIPTOR_HANDLE handle( + textureDescriptorHeapGpuHandle, + textureDescriptorHeapIncrement * info.textureIndex); + + checkDescriptor(handle); + effect->SetTexture(handle); + } + + if ( mDescriptors != nullptr && info.textureIndex2 != -1 ) + { + CD3DX12_GPU_DESCRIPTOR_HANDLE handle( + textureDescriptorHeapGpuHandle, + textureDescriptorHeapIncrement * info.textureIndex2); + + checkDescriptor(handle); + effect->SetTexture2(handle); + } + + if ( mSharing && !info.name.empty() ) + { + std::lock_guard lock(mutex); + mEffectCacheDualTexture.insert( EffectCache::value_type( info.name, effect ) ); + } + + return effect; + } + else + { + // BasicEffect + if ( mSharing && !info.name.empty() ) + { + auto it = mEffectCache.find( info.name ); + if ( mSharing && it != mEffectCache.end() ) + { + return it->second; + } + } + + // set effect flags for creation + int flags = EffectFlags::Lighting; + + if (info.perVertexColor) + { + flags |= EffectFlags::VertexColor; + } + + if (info.textureIndex != -1) + { + flags |= EffectFlags::Texture; + } + + std::shared_ptr effect = std::make_shared( device, flags, derivedPSD ); + + effect->EnableDefaultLighting(); + + effect->SetAlpha( info.alphaValue ); + + // Basic Effect does not have an ambient material color + XMVECTOR color = XMLoadFloat3( &info.diffuseColor ); + effect->SetDiffuseColor( color ); + + if ( info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0 ) + { + color = XMLoadFloat3( &info.specularColor ); + effect->SetSpecularColor( color ); + effect->SetSpecularPower( info.specularPower ); + } + else + { + effect->DisableSpecular(); + } + + if ( info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0 ) + { + color = XMLoadFloat3( &info.emissiveColor ); + effect->SetEmissiveColor( color ); + } + + if ( mDescriptors != nullptr && info.textureIndex != -1 ) + { + CD3DX12_GPU_DESCRIPTOR_HANDLE handle( + textureDescriptorHeapGpuHandle, + textureDescriptorHeapIncrement * info.textureIndex); + + checkDescriptor(handle); + effect->SetTexture(handle); + } + + if ( mSharing && !info.name.empty() ) + { + std::lock_guard lock(mutex); + mEffectCache.insert( EffectCache::value_type( info.name, effect ) ); + } + + return effect; + } +} + +void EffectFactory::Impl::ReleaseCache() +{ + std::lock_guard lock(mutex); + mEffectCache.clear(); + mEffectCacheSkinning.clear(); + mEffectCacheDualTexture.clear(); +} + + + +//-------------------------------------------------------------------------------------- +// EffectFactory +//-------------------------------------------------------------------------------------- + +EffectFactory::EffectFactory(_In_ ID3D12Device* device) +{ + pImpl = std::make_shared(device, nullptr); +} + +EffectFactory::EffectFactory(_In_ ID3D12DescriptorHeap* descriptors) +{ + if (descriptors == nullptr) + { + throw std::exception("Descriptor heap cannot be null of no device is provided. Use the alternative EffectFactory constructor instead."); + } + + if (descriptors->GetDesc().Type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV) + { + throw std::exception("EffectFactory::CreateEffect requires a CBV_SRV_UAV descriptor heap as input."); + } + + ComPtr device; +#if defined(_XBOX_ONE) && defined(_TITLE) + descriptors->GetDevice(IID_GRAPHICS_PPV_ARGS(device.GetAddressOf())); +#else + HRESULT hresult = descriptors->GetDevice(IID_GRAPHICS_PPV_ARGS(device.GetAddressOf())); + if (FAILED(hresult)) + { + throw com_exception(hresult); + } +#endif + + pImpl = std::make_shared(device.Get(), descriptors); +} + +EffectFactory::~EffectFactory() +{ +} + + +EffectFactory::EffectFactory(EffectFactory&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + +EffectFactory& EffectFactory::operator= (EffectFactory&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + +_Use_decl_annotations_ +std::shared_ptr EffectFactory::CreateEffect( + _In_ const EffectInfo& info, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_ const D3D12_INPUT_LAYOUT_DESC& inputLayout, + _In_opt_ int descriptorOffset) +{ + return pImpl->CreateEffect(info, pipelineState, inputLayout, descriptorOffset); +} + +void EffectFactory::ReleaseCache() +{ + pImpl->ReleaseCache(); +} + +void EffectFactory::SetSharing( bool enabled ) +{ + pImpl->SetSharing( enabled ); +} diff --git a/Kits/DirectXTK12/Src/EffectTextureFactory.cpp b/Kits/DirectXTK12/Src/EffectTextureFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e0d584111c488685c9a903c380774a5e131a396 --- /dev/null +++ b/Kits/DirectXTK12/Src/EffectTextureFactory.cpp @@ -0,0 +1,282 @@ +//-------------------------------------------------------------------------------------- +// File: EffectTextureFactory.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Effects.h" +#include "DirectXHelpers.h" +#include "DDSTextureLoader.h" +#include "DescriptorHeap.h" +#include "ResourceUploadBatch.h" +#include "WICTextureLoader.h" +#include "PlatformHelpers.h" + +#include + + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + + +class EffectTextureFactory::Impl +{ +public: + struct TextureCacheEntry + { + ComPtr mResource; + bool mIsCubeMap; + }; + + typedef std::map< std::wstring, TextureCacheEntry > TextureCache; + + Impl( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_ ID3D12DescriptorHeap* descriptorHeap) + : device(device) + , mTextureDescriptorHeap(descriptorHeap) + , mResourceUploadBatch(resourceUploadBatch) + , mSharing(true) + { + *mPath = 0; + } + + Impl( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_ size_t numDescriptors, + _In_ D3D12_DESCRIPTOR_HEAP_FLAGS descriptorHeapFlags) + : device(device) + , mTextureDescriptorHeap(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, descriptorHeapFlags, numDescriptors) + , mResourceUploadBatch(resourceUploadBatch) + , mSharing(true) + { + *mPath = 0; + } + + void CreateTexture(_In_z_ const wchar_t* name, int descriptorSlot); + + void ReleaseCache(); + void SetSharing( bool enabled ) { mSharing = enabled; } + + wchar_t mPath[MAX_PATH]; + + ::DescriptorHeap mTextureDescriptorHeap; + std::vector mResources; // flat list of unique resources so we can index into it + +private: + ID3D12Device* device; + ResourceUploadBatch& mResourceUploadBatch; + + TextureCache mTextureCache; + bool mSharing; + + std::mutex mutex; +}; + + +_Use_decl_annotations_ +void EffectTextureFactory::Impl::CreateTexture(_In_z_ const wchar_t* name, int descriptorSlot) +{ + if ( !name ) + throw std::exception("invalid arguments"); + + auto it = mTextureCache.find( name ); + + TextureCacheEntry textureEntry = {}; + + if ( mSharing && it != mTextureCache.end() ) + { + textureEntry = it->second; + } + else + { + wchar_t fullName[MAX_PATH] = {}; + wcscpy_s( fullName, mPath ); + wcscat_s( fullName, name ); + + WIN32_FILE_ATTRIBUTE_DATA fileAttr = {}; + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + // Try Current Working Directory (CWD) + wcscpy_s( fullName, name ); + if ( !GetFileAttributesExW(fullName, GetFileExInfoStandard, &fileAttr) ) + { + DebugTrace( "EffectTextureFactory could not find texture file '%ls'\n", name ); + throw std::exception( "CreateTexture" ); + } + } + + wchar_t ext[_MAX_EXT]; + _wsplitpath_s( name, nullptr, 0, nullptr, 0, nullptr, 0, ext, _MAX_EXT ); + + if ( _wcsicmp( ext, L".dds" ) == 0 ) + { + // load resource + HRESULT hr = CreateDDSTextureFromFile( + device, + mResourceUploadBatch, + fullName, + textureEntry.mResource.ReleaseAndGetAddressOf(), + false, + 0u, + nullptr, + &textureEntry.mIsCubeMap); + if ( FAILED(hr) ) + { + DebugTrace( "CreateDDSTextureFromFile failed (%08X) for '%ls'\n", hr, fullName ); + throw std::exception( "CreateDDSTextureFromFile" ); + } + } + else + { + std::lock_guard lock(mutex); + HRESULT hr = CreateWICTextureFromFile( + device, + mResourceUploadBatch, + fullName, + textureEntry.mResource.ReleaseAndGetAddressOf() ); + if ( FAILED(hr) ) + { + DebugTrace( "CreateWICTextureFromFile failed (%08X) for '%ls'\n", hr, fullName ); + throw std::exception( "CreateWICTextureFromFile" ); + } + } + + std::lock_guard lock(mutex); + if (mSharing) + { + mTextureCache.insert( TextureCache::value_type( name, textureEntry ) ); + } + mResources.push_back(textureEntry); + } + + assert(textureEntry.mResource != nullptr); + + // bind a new descriptor in slot + auto textureDescriptor = mTextureDescriptorHeap.GetCpuHandle(descriptorSlot); + DirectX::CreateShaderResourceView(device, textureEntry.mResource.Get(), textureDescriptor, textureEntry.mIsCubeMap); +} + +void EffectTextureFactory::Impl::ReleaseCache() +{ + std::lock_guard lock(mutex); + mTextureCache.clear(); +} + + + +//-------------------------------------------------------------------------------------- +// EffectTextureFactory +//-------------------------------------------------------------------------------------- + +EffectTextureFactory::EffectTextureFactory( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_ ID3D12DescriptorHeap* descriptorHeap) +{ + pImpl = std::make_unique(device, resourceUploadBatch, descriptorHeap); +} + +EffectTextureFactory::EffectTextureFactory( + _In_ ID3D12Device* device, + _Inout_ ResourceUploadBatch& resourceUploadBatch, + _In_ size_t numDescriptors, + _In_ D3D12_DESCRIPTOR_HEAP_FLAGS descriptorHeapFlags) +{ + pImpl = std::make_unique(device, resourceUploadBatch, numDescriptors, descriptorHeapFlags); +} + +EffectTextureFactory::~EffectTextureFactory() +{ +} + + +EffectTextureFactory::EffectTextureFactory(EffectTextureFactory&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + +EffectTextureFactory& EffectTextureFactory::operator= (EffectTextureFactory&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + +_Use_decl_annotations_ +void EffectTextureFactory::CreateTexture(_In_z_ const wchar_t* name, int descriptorIndex) +{ + pImpl->CreateTexture(name, descriptorIndex); +} + +void EffectTextureFactory::ReleaseCache() +{ + pImpl->ReleaseCache(); +} + +void EffectTextureFactory::SetSharing( bool enabled ) +{ + pImpl->SetSharing( enabled ); +} + +void EffectTextureFactory::SetDirectory( _In_opt_z_ const wchar_t* path ) +{ + if ( path && *path != 0 ) + { + wcscpy_s( pImpl->mPath, path ); + size_t len = wcsnlen( pImpl->mPath, MAX_PATH ); + if ( len > 0 && len < (MAX_PATH-1) ) + { + // Ensure it has a trailing slash + if ( pImpl->mPath[len-1] != L'\\' ) + { + pImpl->mPath[len] = L'\\'; + pImpl->mPath[len+1] = 0; + } + } + } + else + *pImpl->mPath = 0; +} + +ID3D12DescriptorHeap* EffectTextureFactory::DescriptorHeap() const +{ + return pImpl->mTextureDescriptorHeap.Heap(); +} + +// Shorthand accessors for the descriptor heap +D3D12_CPU_DESCRIPTOR_HANDLE EffectTextureFactory::GetCpuDescriptorHandle(size_t index) const +{ + return pImpl->mTextureDescriptorHeap.GetCpuHandle(index); +} + +D3D12_GPU_DESCRIPTOR_HANDLE EffectTextureFactory::GetGpuDescriptorHandle(size_t index) const +{ + return pImpl->mTextureDescriptorHeap.GetGpuHandle(index); +} + +size_t EffectTextureFactory::ResourceCount() const +{ + return pImpl->mResources.size(); +} + +_Use_decl_annotations_ +void EffectTextureFactory::GetResource(size_t slot, ID3D12Resource** resource, bool* isCubeMap) +{ + if (slot >= pImpl->mResources.size()) + throw std::exception("Accessing resource out of range."); + + const auto& textureEntry = pImpl->mResources[slot]; + + textureEntry.mResource.CopyTo(resource); + *isCubeMap = textureEntry.mIsCubeMap; +} diff --git a/Kits/DirectXTK12/Src/EnvironmentMapEffect.cpp b/Kits/DirectXTK12/Src/EnvironmentMapEffect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ffd6cb84ca5a9235819014bf00988e8525833e2 --- /dev/null +++ b/Kits/DirectXTK12/Src/EnvironmentMapEffect.cpp @@ -0,0 +1,498 @@ +//-------------------------------------------------------------------------------------- +// File: EnvironmentMapEffect.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "EffectCommon.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + + +// Constant buffer layout. Must match the shader! +struct EnvironmentMapEffectConstants +{ + XMVECTOR environmentMapSpecular; + float environmentMapAmount; + float fresnelFactor; + float pad[2]; + + XMVECTOR diffuseColor; + XMVECTOR emissiveColor; + + XMVECTOR lightDirection[IEffectLights::MaxDirectionalLights]; + XMVECTOR lightDiffuseColor[IEffectLights::MaxDirectionalLights]; + + XMVECTOR eyePosition; + + XMVECTOR fogColor; + XMVECTOR fogVector; + + XMMATRIX world; + XMVECTOR worldInverseTranspose[3]; + XMMATRIX worldViewProj; +}; + +static_assert( ( sizeof(EnvironmentMapEffectConstants) % 16 ) == 0, "CB size not padded correctly" ); + + +// Traits type describes our characteristics to the EffectBase template. +struct EnvironmentMapEffectTraits +{ + typedef EnvironmentMapEffectConstants ConstantBufferType; + + static const int VertexShaderCount = 4; + static const int PixelShaderCount = 4; + static const int ShaderPermutationCount = 16; +}; + + +// Internal EnvironmentMapEffect implementation class. +class EnvironmentMapEffect::Impl : public EffectBase +{ +public: + Impl(_In_ ID3D12Device* device, + int effectFlags, + const EffectPipelineStateDescription& pipelineDescription, + bool fresnelEnabled, + bool specularEnabled); + + enum RootParameterIndex + { + TextureSRV, + CubemapSRV, + ConstantBuffer, + RootParameterCount + }; + + EffectLights lights; + + D3D12_GPU_DESCRIPTOR_HANDLE texture; + D3D12_GPU_DESCRIPTOR_HANDLE environmentMap; + + int GetCurrentShaderPermutation(bool fresnelEnabled, bool specularEnabled) const; + + void Apply(_In_ ID3D12GraphicsCommandList* commandList); +}; + + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMap.inc" + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapFresnel.inc" + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapOneLight.inc" + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapOneLightFresnel.inc" + + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMap.inc" + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapNoFog.inc" + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpecular.inc" + #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc" +#else + #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc" + #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc" + #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc" + #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc" + + #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc" + #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc" + #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc" + #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc" +#endif +} + + +const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytecode[] = +{ + { EnvironmentMapEffect_VSEnvMap, sizeof(EnvironmentMapEffect_VSEnvMap) }, + { EnvironmentMapEffect_VSEnvMapFresnel, sizeof(EnvironmentMapEffect_VSEnvMapFresnel) }, + { EnvironmentMapEffect_VSEnvMapOneLight, sizeof(EnvironmentMapEffect_VSEnvMapOneLight) }, + { EnvironmentMapEffect_VSEnvMapOneLightFresnel, sizeof(EnvironmentMapEffect_VSEnvMapOneLightFresnel) }, +}; + + +const int EffectBase::VertexShaderIndices[] = +{ + 0, // basic + 0, // basic, no fog + 1, // fresnel + 1, // fresnel, no fog + 0, // specular + 0, // specular, no fog + 1, // fresnel + specular + 1, // fresnel + specular, no fog + + 2, // one light + 2, // one light, no fog + 3, // one light, fresnel + 3, // one light, fresnel, no fog + 2, // one light, specular + 2, // one light, specular, no fog + 3, // one light, fresnel + specular + 3, // one light, fresnel + specular, no fog + +}; + + +const D3D12_SHADER_BYTECODE EffectBase::PixelShaderBytecode[] = +{ + { EnvironmentMapEffect_PSEnvMap, sizeof(EnvironmentMapEffect_PSEnvMap) }, + { EnvironmentMapEffect_PSEnvMapNoFog, sizeof(EnvironmentMapEffect_PSEnvMapNoFog) }, + { EnvironmentMapEffect_PSEnvMapSpecular, sizeof(EnvironmentMapEffect_PSEnvMapSpecular) }, + { EnvironmentMapEffect_PSEnvMapSpecularNoFog, sizeof(EnvironmentMapEffect_PSEnvMapSpecularNoFog) }, +}; + + +const int EffectBase::PixelShaderIndices[] = +{ + 0, // basic + 1, // basic, no fog + 0, // fresnel + 1, // fresnel, no fog + 2, // specular + 3, // specular, no fog + 2, // fresnel + specular + 3, // fresnel + specular, no fog + + 0, // one light + 1, // one light, no fog + 0, // one light, fresnel + 1, // one light, fresnel, no fog + 2, // one light, specular + 3, // one light, specular, no fog + 2, // one light, fresnel + specular + 3, // one light, fresnel + specular, no fog +}; + + +// Global pool of per-device EnvironmentMapEffect resources. +SharedResourcePool::DeviceResources> EffectBase::deviceResourcesPool; + + +// Constructor. +EnvironmentMapEffect::Impl::Impl( + _In_ ID3D12Device* device, + int effectFlags, + const EffectPipelineStateDescription& pipelineDescription, + bool fresnelEnabled, + bool specularEnabled) + : EffectBase(device) +{ + static_assert( _countof(EffectBase::VertexShaderIndices) == EnvironmentMapEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::VertexShaderBytecode) == EnvironmentMapEffectTraits::VertexShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderBytecode) == EnvironmentMapEffectTraits::PixelShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderIndices) == EnvironmentMapEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + + // Create root signature + { + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer. + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC samplers[2]; + samplers[0] = CD3DX12_STATIC_SAMPLER_DESC(0); + samplers[1] = CD3DX12_STATIC_SAMPLER_DESC(1); + + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL); + + // Texture 1 + CD3DX12_DESCRIPTOR_RANGE descriptorRange1; + descriptorRange1.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + rootParameters[RootParameterIndex::TextureSRV].InitAsDescriptorTable(1, &descriptorRange1); + + // Texture 2 + CD3DX12_DESCRIPTOR_RANGE descriptorRange2; + descriptorRange2.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 1); + rootParameters[RootParameterIndex::CubemapSRV].InitAsDescriptorTable(1, &descriptorRange2); + + // Create the root signature + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, _countof(samplers), samplers, rootSignatureFlags); + + ThrowIfFailed(CreateRootSignature(device, &rsigDesc, mRootSignature.ReleaseAndGetAddressOf())); + } + + fog.enabled = (effectFlags & EffectFlags::Fog) != 0; + + constants.environmentMapAmount = 1; + constants.fresnelFactor = 1; + + XMVECTOR unwantedOutput[MaxDirectionalLights]; + + lights.InitializeConstants(unwantedOutput[0], constants.lightDirection, constants.lightDiffuseColor, unwantedOutput); + + { // Create pipeline state + int sp = GetCurrentShaderPermutation(fresnelEnabled, specularEnabled); + int vi = EffectBase::VertexShaderIndices[sp]; + int pi = EffectBase::PixelShaderIndices[sp]; + + EffectBase::CreatePipelineState( + mRootSignature.Get(), + pipelineDescription.inputLayout, + &EffectBase::VertexShaderBytecode[vi], + &EffectBase::PixelShaderBytecode[pi], + pipelineDescription.blendDesc, + pipelineDescription.depthStencilDesc, + pipelineDescription.rasterizerDesc, + pipelineDescription.renderTargetState, + pipelineDescription.primitiveTopology, + pipelineDescription.stripCutValue); + } +} + + +int EnvironmentMapEffect::Impl::GetCurrentShaderPermutation(bool fresnelEnabled, bool specularEnabled) const +{ + int permutation = 0; + + // Use optimized shaders if fog is disabled. + if (!fog.enabled) + { + permutation += 1; + } + + // Support fresnel or specular? + if (fresnelEnabled) + { + permutation += 2; + } + + if (specularEnabled) + { + permutation += 4; + } + + // Use the only-bother-with-the-first-light shader optimization? + if (!lights.lightEnabled[1] && !lights.lightEnabled[2]) + { + permutation += 8; + } + + return permutation; +} + + +// Sets our state onto the D3D device. +void EnvironmentMapEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + // Compute derived parameter values. + matrices.SetConstants(dirtyFlags, constants.worldViewProj); + + fog.SetConstants(dirtyFlags, matrices.worldView, constants.fogVector); + + lights.SetConstants(dirtyFlags, matrices, constants.world, constants.worldInverseTranspose, constants.eyePosition, constants.diffuseColor, constants.emissiveColor, true); + + UpdateConstants(); + + // Set the resources and state + commandList->SetGraphicsRootSignature(mRootSignature.Get()); + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture); + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::CubemapSRV, environmentMap); + commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, GetConstantBufferGpuAddress()); + commandList->SetPipelineState(EffectBase::mPipelineState.Get()); +} + + +// Public constructor. +EnvironmentMapEffect::EnvironmentMapEffect( + _In_ ID3D12Device* device, + int effectFlags, + const EffectPipelineStateDescription& pipelineDescription, + bool fresnelEnabled, + bool specularEnabled) + : pImpl(new Impl(device, effectFlags, pipelineDescription, fresnelEnabled, specularEnabled)) +{ +} + + +// Move constructor. +EnvironmentMapEffect::EnvironmentMapEffect(EnvironmentMapEffect&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +EnvironmentMapEffect& EnvironmentMapEffect::operator= (EnvironmentMapEffect&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +EnvironmentMapEffect::~EnvironmentMapEffect() +{ +} + + +void EnvironmentMapEffect::Apply( + _In_ ID3D12GraphicsCommandList* cmdList) +{ + pImpl->Apply(cmdList); +} + + +void XM_CALLCONV EnvironmentMapEffect::SetWorld(FXMMATRIX value) +{ + pImpl->matrices.world = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::WorldInverseTranspose | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetView(FXMMATRIX value) +{ + pImpl->matrices.view = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::EyePosition | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetProjection(FXMMATRIX value) +{ + pImpl->matrices.projection = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetDiffuseColor(FXMVECTOR value) +{ + pImpl->lights.diffuseColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetEmissiveColor(FXMVECTOR value) +{ + pImpl->lights.emissiveColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void EnvironmentMapEffect::SetAlpha(float value) +{ + pImpl->lights.alpha = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetAmbientLightColor(FXMVECTOR value) +{ + pImpl->lights.ambientLightColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void EnvironmentMapEffect::SetLightEnabled(int whichLight, bool value) +{ + XMVECTOR unwantedOutput[MaxDirectionalLights] = {}; + + pImpl->dirtyFlags |= pImpl->lights.SetLightEnabled(whichLight, value, pImpl->constants.lightDiffuseColor, unwantedOutput); +} + + +void XM_CALLCONV EnvironmentMapEffect::SetLightDirection(int whichLight, FXMVECTOR value) +{ + EffectLights::ValidateLightIndex(whichLight); + + pImpl->constants.lightDirection[whichLight] = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetLightDiffuseColor(int whichLight, FXMVECTOR value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightDiffuseColor(whichLight, value, pImpl->constants.lightDiffuseColor); +} + + +void XM_CALLCONV EnvironmentMapEffect::SetLightSpecularColor(int, FXMVECTOR) +{ + // Unsupported interface method. +} + + +void EnvironmentMapEffect::EnableDefaultLighting() +{ + EffectLights::EnableDefaultLighting(this); +} + + +void EnvironmentMapEffect::SetFogStart(float value) +{ + pImpl->fog.start = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void EnvironmentMapEffect::SetFogEnd(float value) +{ + pImpl->fog.end = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetFogColor(FXMVECTOR value) +{ + pImpl->constants.fogColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void EnvironmentMapEffect::SetTexture(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value) +{ + pImpl->texture = value; +} + + +void EnvironmentMapEffect::SetEnvironmentMap(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value) +{ + pImpl->environmentMap = value; +} + + +void EnvironmentMapEffect::SetEnvironmentMapAmount(float value) +{ + pImpl->constants.environmentMapAmount = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void XM_CALLCONV EnvironmentMapEffect::SetEnvironmentMapSpecular(FXMVECTOR value) +{ + pImpl->constants.environmentMapSpecular = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void EnvironmentMapEffect::SetFresnelFactor(float value) +{ + pImpl->constants.fresnelFactor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} diff --git a/Kits/DirectXTK12/Src/GamePad.cpp b/Kits/DirectXTK12/Src/GamePad.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5475f1d26e4724e06650295aa7fc43ad56fc0490 --- /dev/null +++ b/Kits/DirectXTK12/Src/GamePad.cpp @@ -0,0 +1,1239 @@ +//-------------------------------------------------------------------------------------- +// File: GamePad.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" + +#include "GamePad.h" +#include "PlatformHelpers.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + + +namespace +{ + float ApplyLinearDeadZone( float value, float maxValue, float deadZoneSize ) + { + if ( value < -deadZoneSize ) + { + // Increase negative values to remove the deadzone discontinuity. + value += deadZoneSize; + } + else if ( value > deadZoneSize ) + { + // Decrease positive values to remove the deadzone discontinuity. + value -= deadZoneSize; + } + else + { + // Values inside the deadzone come out zero. + return 0; + } + + // Scale into 0-1 range. + float scaledValue = value / (maxValue - deadZoneSize); + return std::max( -1.f, std::min( scaledValue, 1.f ) ); + } + + void ApplyStickDeadZone( float x, float y, GamePad::DeadZone deadZoneMode, float maxValue, float deadZoneSize, + _Out_ float& resultX, _Out_ float& resultY) + { + switch( deadZoneMode ) + { + case GamePad::DEAD_ZONE_INDEPENDENT_AXES: + resultX = ApplyLinearDeadZone( x, maxValue, deadZoneSize ); + resultY = ApplyLinearDeadZone( y, maxValue, deadZoneSize ); + break; + + case GamePad::DEAD_ZONE_CIRCULAR: + { + float dist = sqrtf( x*x + y*y ); + float wanted = ApplyLinearDeadZone( dist, maxValue, deadZoneSize ); + + float scale = (wanted > 0.f) ? ( wanted / dist ) : 0.f; + + resultX = std::max( -1.f, std::min( x * scale, 1.f ) ); + resultY = std::max( -1.f, std::min( y * scale, 1.f ) ); + } + break; + + default: // GamePad::DEAD_ZONE_NONE + resultX = ApplyLinearDeadZone( x, maxValue, 0 ); + resultY = ApplyLinearDeadZone( y, maxValue, 0 ); + break; + } + } +} + + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + +//====================================================================================== +// Windows::Gaming::Input (Windows 10) +//====================================================================================== + +#include + +class GamePad::Impl +{ +public: + Impl(GamePad* owner) : + mOwner(owner) + { + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::Foundation; + + mAddedToken.value = 0; + mRemovedToken.value = 0; + + if ( s_gamePad ) + { + throw std::exception( "GamePad is a singleton" ); + } + + s_gamePad = this; + + mChanged.reset( CreateEventEx( nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE ) ); + if ( !mChanged ) + { + throw std::exception( "CreateEventEx" ); + } + + HRESULT hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_Gaming_Input_Gamepad).Get(), mStatics.GetAddressOf() ); + ThrowIfFailed( hr ); + + typedef __FIEventHandler_1_Windows__CGaming__CInput__CGamepad AddedHandler; + hr = mStatics->add_GamepadAdded(Callback(GamepadAdded).Get(), &mAddedToken ); + ThrowIfFailed( hr ); + + typedef __FIEventHandler_1_Windows__CGaming__CInput__CGamepad RemovedHandler; + hr = mStatics->add_GamepadRemoved(Callback(GamepadRemoved).Get(), &mRemovedToken ); + ThrowIfFailed( hr ); + + ScanGamePads(); + } + + ~Impl() + { + if ( mStatics ) + { + mStatics->remove_GamepadAdded( mAddedToken ); + mStatics->remove_GamepadRemoved( mRemovedToken ); + + mStatics.Reset(); + } + + s_gamePad = nullptr; + } + + void GetState( int player, _Out_ State& state, DeadZone deadZoneMode ) + { + using namespace Microsoft::WRL; + using namespace ABI::Windows::Gaming::Input; + + if ( WaitForSingleObjectEx( mChanged.get(), 0, FALSE ) == WAIT_OBJECT_0 ) + { + ScanGamePads(); + } + + if ( ( player >= 0 ) && ( player < MAX_PLAYER_COUNT ) ) + { + if ( mGamePad[ player ] ) + { + GamepadReading reading; + HRESULT hr = mGamePad[ player ]->GetCurrentReading( &reading ); + if ( SUCCEEDED(hr) ) + { + state.connected = true; + state.packet = reading.Timestamp; + + state.buttons.a = (reading.Buttons & GamepadButtons::GamepadButtons_A) != 0; + state.buttons.b = (reading.Buttons & GamepadButtons::GamepadButtons_B) != 0; + state.buttons.x = (reading.Buttons & GamepadButtons::GamepadButtons_X) != 0; + state.buttons.y = (reading.Buttons & GamepadButtons::GamepadButtons_Y) != 0; + + state.buttons.leftStick = (reading.Buttons & GamepadButtons::GamepadButtons_LeftThumbstick) != 0; + state.buttons.rightStick = (reading.Buttons & GamepadButtons::GamepadButtons_RightThumbstick) != 0; + + state.buttons.leftShoulder = (reading.Buttons & GamepadButtons::GamepadButtons_LeftShoulder) != 0; + state.buttons.rightShoulder = (reading.Buttons & GamepadButtons::GamepadButtons_RightShoulder) != 0; + + state.buttons.back = (reading.Buttons & GamepadButtons::GamepadButtons_View) != 0; + state.buttons.start = (reading.Buttons & GamepadButtons::GamepadButtons_Menu) != 0; + + state.dpad.up = (reading.Buttons & GamepadButtons::GamepadButtons_DPadUp) != 0; + state.dpad.down = (reading.Buttons & GamepadButtons::GamepadButtons_DPadDown) != 0; + state.dpad.right = (reading.Buttons & GamepadButtons::GamepadButtons_DPadRight) != 0; + state.dpad.left = (reading.Buttons & GamepadButtons::GamepadButtons_DPadLeft) != 0; + + ApplyStickDeadZone( static_cast(reading.LeftThumbstickX), static_cast(reading.LeftThumbstickY), + deadZoneMode, 1.f, .24f /* Recommended Xbox One deadzone */, + static_cast(state.thumbSticks.leftX), static_cast(state.thumbSticks.leftY) ); + + ApplyStickDeadZone( static_cast(reading.RightThumbstickX), static_cast(reading.RightThumbstickY), + deadZoneMode, 1.f, .24f /* Recommended Xbox One deadzone */, + static_cast(state.thumbSticks.rightX), static_cast(state.thumbSticks.rightY) ); + + state.triggers.left = static_cast(reading.LeftTrigger); + state.triggers.right = static_cast(reading.RightTrigger); + + return; + } + } + } + + memset( &state, 0, sizeof(State) ); + } + + void GetCapabilities( int player, _Out_ Capabilities& caps ) + { + if ( WaitForSingleObjectEx( mChanged.get(), 0, FALSE ) == WAIT_OBJECT_0 ) + { + ScanGamePads(); + } + + if ( ( player >= 0 ) && ( player < MAX_PLAYER_COUNT ) ) + { + if ( mGamePad[ player ] ) + { + caps.connected = true; + caps.gamepadType = Capabilities::GAMEPAD; + caps.id = 0; + return; + } + } + + memset( &caps, 0, sizeof(Capabilities) ); + } + + bool SetVibration( int player, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger ) + { + using namespace ABI::Windows::Gaming::Input; + + if ( ( player >= 0 ) && ( player < MAX_PLAYER_COUNT ) ) + { + if ( mGamePad[ player ] ) + { + GamepadVibration vib; + vib.LeftMotor = leftMotor; + vib.RightMotor = rightMotor; + vib.LeftTrigger = leftTrigger; + vib.RightTrigger = rightTrigger; + HRESULT hr = mGamePad[ player ]->put_Vibration(vib); + + if ( SUCCEEDED(hr) ) + return true; + } + } + + return false; + } + + void Suspend() + { + for( size_t j = 0; j < MAX_PLAYER_COUNT; ++j ) + { + mGamePad[ j ].Reset(); + } + } + + void Resume() + { + // Make sure we rescan gamepads + SetEvent( mChanged.get() ); + } + + GamePad* mOwner; + + static GamePad::Impl* s_gamePad; + +private: + void ScanGamePads() + { + using namespace ABI::Windows::Foundation::Collections; + using namespace ABI::Windows::Gaming::Input; + + ComPtr> pads; + HRESULT hr = mStatics->get_Gamepads( pads.GetAddressOf() ); + ThrowIfFailed( hr ); + + unsigned int count = 0; + hr = pads->get_Size( &count ); + ThrowIfFailed( hr ); + + // Check for removed gamepads + for( size_t j = 0; j < MAX_PLAYER_COUNT; ++j ) + { + if ( mGamePad[ j ] ) + { + unsigned int k = 0; + for( ; k < count; ++k ) + { + ComPtr pad; + hr = pads->GetAt( k, pad.GetAddressOf() ); + if ( SUCCEEDED(hr) && ( pad == mGamePad[ j ] ) ) + { + break; + } + } + + if ( k >= count ) + { + mGamePad[ j ].Reset(); + } + } + } + + // Check for added gamepads + for( unsigned int j = 0; j < count; ++j ) + { + ComPtr pad; + hr = pads->GetAt( j, pad.GetAddressOf() ); + if ( SUCCEEDED(hr) ) + { + size_t empty = MAX_PLAYER_COUNT; + size_t k = 0; + for( ; k < MAX_PLAYER_COUNT; ++k ) + { + if ( mGamePad[ k ] == pad ) + { + break; + } + else if ( !mGamePad[ k ] ) + { + if ( empty >= MAX_PLAYER_COUNT ) + empty = k; + } + } + + if ( k >= MAX_PLAYER_COUNT ) + { + // Silently ignore "extra" gamepads as there's no hard limit + if ( empty < MAX_PLAYER_COUNT ) + { + mGamePad[ empty ] = pad; + } + } + } + } + } + + ComPtr mStatics; + ComPtr mGamePad[ MAX_PLAYER_COUNT ]; + + EventRegistrationToken mAddedToken; + EventRegistrationToken mRemovedToken; + + ScopedHandle mChanged; + + static HRESULT GamepadAdded( IInspectable *, ABI::Windows::Gaming::Input::IGamepad* ) + { + if ( s_gamePad ) + { + SetEvent( s_gamePad->mChanged.get() ); + } + return S_OK; + } + + static HRESULT GamepadRemoved( IInspectable *, ABI::Windows::Gaming::Input::IGamepad* ) + { + if ( s_gamePad ) + { + SetEvent( s_gamePad->mChanged.get() ); + } + return S_OK; + } +}; + +GamePad::Impl* GamePad::Impl::s_gamePad = nullptr; + +#elif defined(_XBOX_ONE) + +//====================================================================================== +// Windows::Xbox::Input (Xbox One) +//====================================================================================== + +#include + +#ifdef _TITLE +#include + +namespace +{ + +class GamepadAddedListener : public Microsoft::WRL::RuntimeClass, + ABI::Windows::Foundation::IEventHandler, + Microsoft::WRL::FtmBase> +{ +public: + GamepadAddedListener(HANDLE event) : mEvent(event) {} + + STDMETHOD(Invoke)(_In_ IInspectable *, _In_ ABI::Windows::Xbox::Input::IGamepadAddedEventArgs * ) override + { + SetEvent( mEvent ); + return S_OK; + } + +private: + HANDLE mEvent; +}; + +class GamepadRemovedListener : public Microsoft::WRL::RuntimeClass, + ABI::Windows::Foundation::IEventHandler, + Microsoft::WRL::FtmBase> +{ +public: + GamepadRemovedListener(HANDLE event) : mEvent(event) {} + + STDMETHOD(Invoke)(_In_ IInspectable *, _In_ ABI::Windows::Xbox::Input::IGamepadRemovedEventArgs * ) override + { + SetEvent( mEvent ); + return S_OK; + } + +private: + HANDLE mEvent; +}; + +} +#endif + +class GamePad::Impl +{ +public: + Impl(GamePad *owner) : + mOwner(owner) + { + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::Foundation; + + mAddedToken.value = 0; + mRemovedToken.value = 0; + + if ( s_gamePad ) + { + throw std::exception( "GamePad is a singleton" ); + } + + s_gamePad = this; + + mChanged.reset( CreateEventEx( nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE ) ); + if ( !mChanged ) + { + throw std::exception( "CreateEventEx" ); + } + + HRESULT hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_Xbox_Input_Gamepad).Get(), mStatics.GetAddressOf() ); + ThrowIfFailed( hr ); + +#ifdef _TITLE + // This is a workaround for some registration issues in the GameOS + + hr = mStatics->add_GamepadAdded(Make(mChanged.get()).Get(), &mAddedToken ); + ThrowIfFailed( hr ); + + hr = mStatics->add_GamepadRemoved(Make(mChanged.get()).Get(), &mRemovedToken ); + ThrowIfFailed( hr ); +#else + typedef __FIEventHandler_1_Windows__CXbox__CInput__CGamepadAddedEventArgs AddedHandler; + hr = mStatics->add_GamepadAdded(Callback(GamepadAdded).Get(), &mAddedToken ); + ThrowIfFailed( hr ); + + typedef __FIEventHandler_1_Windows__CXbox__CInput__CGamepadRemovedEventArgs RemovedHandler; + hr = mStatics->add_GamepadRemoved(Callback(GamepadRemoved).Get(), &mRemovedToken ); + ThrowIfFailed( hr ); +#endif + + ScanGamePads(); + } + + ~Impl() + { + if ( mStatics ) + { + mStatics->remove_GamepadAdded( mAddedToken ); + mStatics->remove_GamepadRemoved( mRemovedToken ); + + mStatics.Reset(); + } + + s_gamePad = nullptr; + } + + void GetState( int player, _Out_ State& state, DeadZone deadZoneMode ) + { + using namespace Microsoft::WRL; + using namespace ABI::Windows::Xbox::Input; + + if ( WaitForSingleObjectEx( mChanged.get(), 0, FALSE ) == WAIT_OBJECT_0 ) + { + ScanGamePads(); + } + + if ( ( player >= 0 ) && ( player < MAX_PLAYER_COUNT ) ) + { + if ( mGamePad[ player ] ) + { + RawGamepadReading reading; + HRESULT hr = mGamePad[ player ]->GetRawCurrentReading( &reading ); + if ( SUCCEEDED(hr) ) + { + state.connected = true; + state.packet = reading.Timestamp; + + state.buttons.a = (reading.Buttons & GamepadButtons::GamepadButtons_A) != 0; + state.buttons.b = (reading.Buttons & GamepadButtons::GamepadButtons_B) != 0; + state.buttons.x = (reading.Buttons & GamepadButtons::GamepadButtons_X) != 0; + state.buttons.y = (reading.Buttons & GamepadButtons::GamepadButtons_Y) != 0; + + state.buttons.leftStick = (reading.Buttons & GamepadButtons::GamepadButtons_LeftThumbstick) != 0; + state.buttons.rightStick = (reading.Buttons & GamepadButtons::GamepadButtons_RightThumbstick) != 0; + + state.buttons.leftShoulder = (reading.Buttons & GamepadButtons::GamepadButtons_LeftShoulder) != 0; + state.buttons.rightShoulder = (reading.Buttons & GamepadButtons::GamepadButtons_RightShoulder) != 0; + + state.buttons.back = (reading.Buttons & GamepadButtons::GamepadButtons_View) != 0; + state.buttons.start = (reading.Buttons & GamepadButtons::GamepadButtons_Menu) != 0; + + state.dpad.up = (reading.Buttons & GamepadButtons::GamepadButtons_DPadUp) != 0; + state.dpad.down = (reading.Buttons & GamepadButtons::GamepadButtons_DPadDown) != 0; + state.dpad.right = (reading.Buttons & GamepadButtons::GamepadButtons_DPadRight) != 0; + state.dpad.left = (reading.Buttons & GamepadButtons::GamepadButtons_DPadLeft) != 0; + + ApplyStickDeadZone( reading.LeftThumbstickX, reading.LeftThumbstickY, + deadZoneMode, 1.f, .24f /* Recommended Xbox One deadzone */, + state.thumbSticks.leftX, state.thumbSticks.leftY ); + + ApplyStickDeadZone( reading.RightThumbstickX, reading.RightThumbstickY, + deadZoneMode, 1.f, .24f /* Recommended Xbox One deadzone */, + state.thumbSticks.rightX, state.thumbSticks.rightY ); + + state.triggers.left = reading.LeftTrigger; + state.triggers.right = reading.RightTrigger; + + return; + } + } + } + + memset( &state, 0, sizeof(State) ); + } + + void GetCapabilities( int player, _Out_ Capabilities& caps ) + { + using namespace ABI::Windows::Xbox::Input; + + if ( WaitForSingleObjectEx( mChanged.get(), 0, FALSE ) == WAIT_OBJECT_0 ) + { + ScanGamePads(); + } + + if ( ( player >= 0 ) && ( player < MAX_PLAYER_COUNT ) ) + { + if ( mGamePad[ player ] ) + { + caps.connected = true; + caps.gamepadType = Capabilities::GAMEPAD; + + ComPtr ctrl; + HRESULT hr = mGamePad[ player ].As( &ctrl ); + if ( SUCCEEDED(hr) && ctrl ) + { + hr = ctrl->get_Id( &caps.id ); + if ( FAILED(hr) ) + caps.id = 0; + } + else + caps.id = 0; + + return; + } + } + + memset( &caps, 0, sizeof(Capabilities) ); + } + + bool SetVibration( int player, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger ) + { + using namespace ABI::Windows::Xbox::Input; + + if ( ( player >= 0 ) && ( player < MAX_PLAYER_COUNT ) ) + { + if ( mGamePad[ player ] ) + { + HRESULT hr; + try + { + GamepadVibration vib; + vib.LeftMotorLevel = leftMotor; + vib.RightMotorLevel = rightMotor; + vib.LeftTriggerLevel = leftTrigger; + vib.RightTriggerLevel = rightTrigger; + hr = mGamePad[ player ]->SetVibration(vib); + } + catch( ... ) + { + // Handle case where gamepad might be invalid + hr = E_FAIL; + } + + if ( SUCCEEDED(hr) ) + return true; + } + } + + return false; + } + + void Suspend() + { + for( size_t j = 0; j < MAX_PLAYER_COUNT; ++j ) + { + mGamePad[ j ].Reset(); + } + } + + void Resume() + { + // Make sure we rescan gamepads + SetEvent( mChanged.get() ); + } + + GamePad* mOwner; + + static GamePad::Impl* s_gamePad; + +private: + void ScanGamePads() + { + using namespace ABI::Windows::Foundation::Collections; + using namespace ABI::Windows::Xbox::Input; + + ComPtr> pads; + HRESULT hr = mStatics->get_Gamepads( pads.GetAddressOf() ); + ThrowIfFailed( hr ); + + unsigned int count = 0; + hr = pads->get_Size( &count ); + ThrowIfFailed( hr ); + + // Check for removed gamepads + for( size_t j = 0; j < MAX_PLAYER_COUNT; ++j ) + { + if ( mGamePad[ j ] ) + { + unsigned int k = 0; + for( ; k < count; ++k ) + { + ComPtr pad; + hr = pads->GetAt( k, pad.GetAddressOf() ); + if ( SUCCEEDED(hr) && ( pad == mGamePad[ j ] ) ) + { + break; + } + } + + if ( k >= count ) + { + mGamePad[ j ].Reset(); + } + } + } + + // Check for added gamepads + for( unsigned int j = 0; j < count; ++j ) + { + ComPtr pad; + hr = pads->GetAt( j, pad.GetAddressOf() ); + if ( SUCCEEDED(hr) ) + { + size_t empty = MAX_PLAYER_COUNT; + size_t k = 0; + for( ; k < MAX_PLAYER_COUNT; ++k ) + { + if ( mGamePad[ k ] == pad ) + { + break; + } + else if ( !mGamePad[ k ] ) + { + if ( empty >= MAX_PLAYER_COUNT ) + empty = k; + } + } + + if ( k >= MAX_PLAYER_COUNT ) + { + if ( empty >= MAX_PLAYER_COUNT ) + { + throw std::exception( "Too many gamepads found" ); + } + + mGamePad[ empty ] = pad; + } + } + } + } + + ComPtr mStatics; + ComPtr mGamePad[ MAX_PLAYER_COUNT ]; + + EventRegistrationToken mAddedToken; + EventRegistrationToken mRemovedToken; + + ScopedHandle mChanged; + +#ifndef _TITLE + static HRESULT GamepadAdded( IInspectable *, ABI::Windows::Xbox::Input::IGamepadAddedEventArgs * ) + { + if ( s_gamePad ) + { + SetEvent( s_gamePad->mChanged.get() ); + } + return S_OK; + } + + static HRESULT GamepadRemoved( IInspectable *, ABI::Windows::Xbox::Input::IGamepadRemovedEventArgs* ) + { + if ( s_gamePad ) + { + SetEvent( s_gamePad->mChanged.get() ); + } + return S_OK; + } +#endif +}; + +GamePad::Impl* GamePad::Impl::s_gamePad = nullptr; + + +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + +//====================================================================================== +// Null device for Windows Phone +//====================================================================================== + +class GamePad::Impl +{ +public: + Impl(GamePad* owner) : + mOwner(owner) + { + if ( s_gamePad ) + { + throw std::exception( "GamePad is a singleton" ); + } + + s_gamePad = this; + } + + ~Impl() + { + s_gamePad = nullptr; + } + + void GetState(int player, _Out_ State& state, DeadZone) + { + UNREFERENCED_PARAMETER(player); + + memset( &state, 0, sizeof(State) ); + } + + void GetCapabilities(int player, _Out_ Capabilities& caps) + { + UNREFERENCED_PARAMETER(player); + + memset( &caps, 0, sizeof(Capabilities) ); + } + + bool SetVibration(int player, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger) + { + UNREFERENCED_PARAMETER(player); + UNREFERENCED_PARAMETER(leftMotor); + UNREFERENCED_PARAMETER(rightMotor); + UNREFERENCED_PARAMETER(leftTrigger); + UNREFERENCED_PARAMETER(rightTrigger); + + return false; + } + + void Suspend() + { + } + + void Resume() + { + } + + GamePad* mOwner; + + static GamePad::Impl* s_gamePad; +}; + +GamePad::Impl* GamePad::Impl::s_gamePad = nullptr; + + +#else + +//====================================================================================== +// XInput +//====================================================================================== + +#include + +static_assert( GamePad::MAX_PLAYER_COUNT == XUSER_MAX_COUNT, "xinput.h mismatch" ); + +class GamePad::Impl +{ +public: + Impl(GamePad* owner) : + mOwner(owner) + { + for( int j = 0; j < XUSER_MAX_COUNT; ++j ) + { + ClearSlot( j, 0 ); + } + +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + mSuspended = false; +#endif + + if ( s_gamePad ) + { + throw std::exception( "GamePad is a singleton" ); + } + + s_gamePad = this; + } + + ~Impl() + { + s_gamePad = nullptr; + } + + void GetState( int player, _Out_ State& state, DeadZone deadZoneMode ) + { + if ( !ThrottleRetry(player) ) + { +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + if ( mSuspended ) + { + memset( &state, 0, sizeof(State) ); + state.connected = mConnected[ player ]; + return; + } +#endif + + XINPUT_STATE xstate; + DWORD result = XInputGetState( DWORD(player), &xstate ); + if ( result == ERROR_DEVICE_NOT_CONNECTED ) + { + ClearSlot( player, GetTickCount64() ); + } + else + { + mConnected[ player ] = true; + + state.connected = true; + state.packet = xstate.dwPacketNumber; + + WORD xbuttons = xstate.Gamepad.wButtons; + state.buttons.a = (xbuttons & XINPUT_GAMEPAD_A) != 0; + state.buttons.b = (xbuttons & XINPUT_GAMEPAD_B) != 0; + state.buttons.x = (xbuttons & XINPUT_GAMEPAD_X) != 0; + state.buttons.y = (xbuttons & XINPUT_GAMEPAD_Y) != 0; + state.buttons.leftStick = (xbuttons & XINPUT_GAMEPAD_LEFT_THUMB) != 0; + state.buttons.rightStick = (xbuttons & XINPUT_GAMEPAD_RIGHT_THUMB) != 0; + state.buttons.leftShoulder = (xbuttons & XINPUT_GAMEPAD_LEFT_SHOULDER) != 0; + state.buttons.rightShoulder = (xbuttons & XINPUT_GAMEPAD_RIGHT_SHOULDER) != 0; + state.buttons.back = (xbuttons & XINPUT_GAMEPAD_BACK) != 0; + state.buttons.start = (xbuttons & XINPUT_GAMEPAD_START) != 0; + + state.dpad.up = (xbuttons & XINPUT_GAMEPAD_DPAD_UP) != 0; + state.dpad.down = (xbuttons & XINPUT_GAMEPAD_DPAD_DOWN) != 0; + state.dpad.right = (xbuttons & XINPUT_GAMEPAD_DPAD_RIGHT) != 0; + state.dpad.left = (xbuttons & XINPUT_GAMEPAD_DPAD_LEFT) != 0; + + if ( deadZoneMode == DEAD_ZONE_NONE ) + { + state.triggers.left = ApplyLinearDeadZone( float(xstate.Gamepad.bLeftTrigger), 255.f, 0.f ); + state.triggers.right = ApplyLinearDeadZone( float(xstate.Gamepad.bRightTrigger), 255.f, 0.f ); + } + else + { + state.triggers.left = ApplyLinearDeadZone( float(xstate.Gamepad.bLeftTrigger), 255.f, float(XINPUT_GAMEPAD_TRIGGER_THRESHOLD) ); + state.triggers.right = ApplyLinearDeadZone( float(xstate.Gamepad.bRightTrigger), 255.f, float(XINPUT_GAMEPAD_TRIGGER_THRESHOLD) ); + } + + ApplyStickDeadZone( float(xstate.Gamepad.sThumbLX), float(xstate.Gamepad.sThumbLY), + deadZoneMode, 32767.f, float(XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE), + state.thumbSticks.leftX, state.thumbSticks.leftY ); + + ApplyStickDeadZone( float(xstate.Gamepad.sThumbRX), float(xstate.Gamepad.sThumbRY), + deadZoneMode, 32767.f, float(XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE), + state.thumbSticks.rightX, state.thumbSticks.rightY ); + + return; + } + } + + memset( &state, 0, sizeof(State) ); + } + + void GetCapabilities( int player, _Out_ Capabilities& caps ) + { + if ( !ThrottleRetry(player) ) + { + XINPUT_CAPABILITIES xcaps; + DWORD result = XInputGetCapabilities( DWORD(player), 0, &xcaps ); + if ( result == ERROR_DEVICE_NOT_CONNECTED ) + { + ClearSlot( player, GetTickCount64() ); + } + else + { + mConnected[ player ] = true; + + caps.connected = true; + caps.id = uint64_t( player ); + if ( xcaps.Type == XINPUT_DEVTYPE_GAMEPAD ) + { + static_assert(Capabilities::GAMEPAD == XINPUT_DEVSUBTYPE_GAMEPAD, "xinput.h mismatch"); +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + static_assert( XINPUT_DEVSUBTYPE_WHEEL == Capabilities::WHEEL, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_ARCADE_STICK == Capabilities::ARCADE_STICK, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_FLIGHT_STICK == Capabilities::FLIGHT_STICK, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_DANCE_PAD == Capabilities::DANCE_PAD, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_GUITAR == Capabilities::GUITAR, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE == Capabilities::GUITAR_ALTERNATE, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_DRUM_KIT == Capabilities::DRUM_KIT, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_GUITAR_BASS == Capabilities::GUITAR_BASS, "xinput.h mismatch"); + static_assert( XINPUT_DEVSUBTYPE_ARCADE_PAD == Capabilities::ARCADE_PAD, "xinput.h mismatch"); +#endif + + caps.gamepadType = Capabilities::Type(xcaps.SubType); + } + + return; + } + } + + memset( &caps, 0, sizeof(Capabilities) ); + } + + bool SetVibration( int player, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger ) + { + if ( ThrottleRetry(player) ) + { + return false; + } + + // XInput does not provide a way to set the left/right trigger impulse motors on the Xbox One Controller, + // and these motors are not present on the Xbox 360 Common Controller + UNREFERENCED_PARAMETER(leftTrigger); + UNREFERENCED_PARAMETER(rightTrigger); + +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + mLeftMotor[ player ] = leftMotor; + mRightMotor[ player ] = rightMotor; + + if ( mSuspended ) + return mConnected[ player ]; +#endif + + XINPUT_VIBRATION xvibration; + xvibration.wLeftMotorSpeed = WORD( leftMotor * 0xFFFF ); + xvibration.wRightMotorSpeed = WORD( rightMotor * 0xFFFF ); + DWORD result = XInputSetState( DWORD(player), &xvibration ); + if ( result == ERROR_DEVICE_NOT_CONNECTED ) + { + ClearSlot( player, GetTickCount64() ); + return false; + } + else + { + mConnected[ player ] = true; + return (result == ERROR_SUCCESS); + } + } + + void Suspend() + { +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + XInputEnable( FALSE ); +#else + // For XInput 9.1.0, we have to emulate the behavior of XInputEnable( FALSE ) + if ( !mSuspended ) + { + for( size_t j = 0; j < XUSER_MAX_COUNT; ++j ) + { + if ( mConnected[ j ] ) + { + XINPUT_VIBRATION xvibration; + xvibration.wLeftMotorSpeed = xvibration.wRightMotorSpeed = 0; + (void)XInputSetState( DWORD(j), &xvibration ); + } + } + + mSuspended = true; + } +#endif + } + + void Resume() + { +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + XInputEnable( TRUE ); +#else + // For XInput 9.1.0, we have to emulate the behavior of XInputEnable( TRUE ) + if ( mSuspended ) + { + for( int j = 0; j < XUSER_MAX_COUNT; ++j ) + { + if ( mConnected[ j ] ) + { + XINPUT_VIBRATION xvibration; + xvibration.wLeftMotorSpeed = WORD( mLeftMotor[ j ] * 0xFFFF ); + xvibration.wRightMotorSpeed = WORD( mRightMotor[ j ] * 0xFFFF ); + DWORD result = XInputSetState( DWORD(j), &xvibration ); + if ( result == ERROR_DEVICE_NOT_CONNECTED ) + { + ClearSlot( j, GetTickCount64() ); + } + } + } + + mSuspended = false; + } +#endif + } + + GamePad* mOwner; + + static GamePad::Impl* s_gamePad; + +private: + bool mConnected[ XUSER_MAX_COUNT ]; + ULONGLONG mLastReadTime[ XUSER_MAX_COUNT ]; + +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + // Variables for emulating XInputEnable on XInput 9.1.0 + float mLeftMotor[ XUSER_MAX_COUNT ]; + float mRightMotor[ XUSER_MAX_COUNT ]; + bool mSuspended; +#endif + + bool ThrottleRetry( int player ) + { + // This function minimizes a potential performance issue with XInput on Windows when + // checking a disconnected controller slot which requires device enumeration. + // This throttling keeps checks for newly connected gamepads to about once a second + + if ( ( player < 0 ) || ( player >= XUSER_MAX_COUNT ) ) + return true; + + if ( mConnected[ player ] ) + return false; + + ULONGLONG time = GetTickCount64(); + + for( size_t j = 0; j < XUSER_MAX_COUNT; ++j ) + { + if ( !mConnected[j] ) + { + LONGLONG delta = time - mLastReadTime[j]; + + LONGLONG interval = 1000; + if ( (int)j != player ) + interval /= 4; + + if ( (delta >= 0) && (delta < interval) ) + return true; + } + } + + return false; + } + + void ClearSlot( int player, ULONGLONG time ) + { + mConnected[ player ] = false; + mLastReadTime[ player ] = time; +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + mLeftMotor[ player ] = mRightMotor[ player ] = 0.f; +#endif + } +}; + +GamePad::Impl* GamePad::Impl::s_gamePad = nullptr; + +#endif + +#pragma warning( disable : 4355 ) + +// Public constructor. +GamePad::GamePad() + : pImpl( new Impl(this) ) +{ +} + + +// Move constructor. +GamePad::GamePad(GamePad&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ + pImpl->mOwner = this; +} + + +// Move assignment. +GamePad& GamePad::operator= (GamePad&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + pImpl->mOwner = this; + return *this; +} + + +// Public destructor. +GamePad::~GamePad() +{ +} + + +GamePad::State GamePad::GetState(int player, DeadZone deadZoneMode) +{ + State state; + pImpl->GetState(player, state, deadZoneMode); + return state; +} + + +GamePad::Capabilities GamePad::GetCapabilities(int player) +{ + Capabilities caps; + pImpl->GetCapabilities(player, caps); + return caps; +} + + +bool GamePad::SetVibration( int player, float leftMotor, float rightMotor, float leftTrigger, float rightTrigger ) +{ + return pImpl->SetVibration( player, leftMotor, rightMotor, leftTrigger, rightTrigger ); +} + + +void GamePad::Suspend() +{ + pImpl->Suspend(); +} + + +void GamePad::Resume() +{ + pImpl->Resume(); +} + + +GamePad& GamePad::Get() +{ + if ( !Impl::s_gamePad || !Impl::s_gamePad->mOwner ) + throw std::exception( "GamePad is a singleton" ); + + return *Impl::s_gamePad->mOwner; +} + + + +//====================================================================================== +// ButtonStateTracker +//====================================================================================== + +#define UPDATE_BUTTON_STATE(field) field = static_cast( ( !!state.buttons.field ) | ( ( !!state.buttons.field ^ !!lastState.buttons.field ) << 1 ) ); + +void GamePad::ButtonStateTracker::Update( const GamePad::State& state ) +{ + UPDATE_BUTTON_STATE(a); + + assert( ( !state.buttons.a && !lastState.buttons.a ) == ( a == UP ) ); + assert( ( state.buttons.a && lastState.buttons.a ) == ( a == HELD ) ); + assert( ( !state.buttons.a && lastState.buttons.a ) == ( a == RELEASED ) ); + assert( ( state.buttons.a && !lastState.buttons.a ) == ( a == PRESSED ) ); + + UPDATE_BUTTON_STATE(b); + UPDATE_BUTTON_STATE(x); + UPDATE_BUTTON_STATE(y); + + UPDATE_BUTTON_STATE(leftStick); + UPDATE_BUTTON_STATE(rightStick); + + UPDATE_BUTTON_STATE(leftShoulder); + UPDATE_BUTTON_STATE(rightShoulder); + + UPDATE_BUTTON_STATE(back); + UPDATE_BUTTON_STATE(start); + + dpadUp = static_cast( ( !!state.dpad.up ) | ( ( !!state.dpad.up ^ !!lastState.dpad.up ) << 1 ) ); + dpadDown = static_cast( ( !!state.dpad.down ) | ( ( !!state.dpad.down ^ !!lastState.dpad.down ) << 1 ) ); + dpadLeft = static_cast( ( !!state.dpad.left ) | ( ( !!state.dpad.left ^ !!lastState.dpad.left ) << 1 ) ); + dpadRight = static_cast( ( !!state.dpad.right ) | ( ( !!state.dpad.right ^ !!lastState.dpad.right ) << 1 ) ); + + assert( ( !state.dpad.up && !lastState.dpad.up ) == ( dpadUp == UP ) ); + assert( ( state.dpad.up && lastState.dpad.up ) == ( dpadUp == HELD ) ); + assert( ( !state.dpad.up && lastState.dpad.up ) == ( dpadUp == RELEASED ) ); + assert( ( state.dpad.up && !lastState.dpad.up ) == ( dpadUp == PRESSED ) ); + + // Handle 'threshold' tests which emulate buttons + + bool threshold = state.IsLeftThumbStickUp(); + leftStickUp = static_cast( ( !!threshold) | ( ( !!threshold ^ !!lastState.IsLeftThumbStickUp() ) << 1 ) ); + + threshold = state.IsLeftThumbStickDown(); + leftStickDown = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftThumbStickDown()) << 1)); + + threshold = state.IsLeftThumbStickLeft(); + leftStickLeft = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftThumbStickLeft()) << 1)); + + threshold = state.IsLeftThumbStickRight(); + leftStickRight = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftThumbStickRight()) << 1)); + + threshold = state.IsRightThumbStickUp(); + rightStickUp = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickUp()) << 1)); + + threshold = state.IsRightThumbStickDown(); + rightStickDown = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickDown()) << 1)); + + threshold = state.IsRightThumbStickLeft(); + rightStickLeft = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickLeft()) << 1)); + + threshold = state.IsRightThumbStickRight(); + rightStickRight = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightThumbStickRight()) << 1)); + + threshold = state.IsLeftTriggerPressed(); + leftTrigger = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsLeftTriggerPressed()) << 1)); + + threshold = state.IsRightTriggerPressed(); + rightTrigger = static_cast((!!threshold) | ((!!threshold ^ !!lastState.IsRightTriggerPressed()) << 1)); + + lastState = state; +} + +#undef UPDATE_BUTTON_STATE + + +void GamePad::ButtonStateTracker::Reset() +{ + memset( this, 0, sizeof(ButtonStateTracker) ); +} diff --git a/Kits/DirectXTK12/Src/GenericMultiBuffer.h b/Kits/DirectXTK12/Src/GenericMultiBuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..1dbea5cc993050c45f8ee226a79a017966297826 --- /dev/null +++ b/Kits/DirectXTK12/Src/GenericMultiBuffer.h @@ -0,0 +1,71 @@ +//-------------------------------------------------------------------------------------- +// File: GenericMultiBuffer.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" + + +namespace DirectX +{ + class GenericMultiBuffer + { + public: + GenericMultiBuffer(_In_ ID3D12Device* device, size_t numBytesPerFrame, size_t maxFrames) + : mDataStride(numBytesPerFrame) + , mNumFrames(maxFrames) + { + CD3DX12_HEAP_PROPERTIES heapProps(D3D12_HEAP_TYPE_UPLOAD); + CD3DX12_RESOURCE_DESC bufferDesc = CD3DX12_RESOURCE_DESC::Buffer(numBytesPerFrame * maxFrames); + + // Create the constant buffer. + ThrowIfFailed(device->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &bufferDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, + IID_PPV_ARGS(mResource.GetAddressOf()))); + + ThrowIfFailed(mResource->Map(0, nullptr, reinterpret_cast( &mMappedData ))); + memset(mMappedData, 0, mDataStride * maxFrames); + } + + // Get the CPU address for a given frame + void* GetPointer(_In_ size_t frameIndex) const + { + assert(frameIndex < mNumFrames); + assert(mMappedData != nullptr); + return mMappedData + ( frameIndex * mDataStride ); + } + + // Get the GPU address for a given frame + D3D12_GPU_VIRTUAL_ADDRESS GetGpuAddress(_In_ size_t frameIndex) const + { + assert(frameIndex < mNumFrames); + D3D12_GPU_VIRTUAL_ADDRESS cbvGpuAddress = mResource->GetGPUVirtualAddress(); + cbvGpuAddress += mDataStride * frameIndex; + return cbvGpuAddress; + } + + // Returns the resource pointer + ID3D12Resource* Resource() const { return mResource.Get(); } + + private: + Microsoft::WRL::ComPtr mResource; + uint8_t* mMappedData; + size_t mNumFrames; + size_t mDataStride; + }; +} diff --git a/Kits/DirectXTK12/Src/GeometricPrimitive.cpp b/Kits/DirectXTK12/Src/GeometricPrimitive.cpp new file mode 100644 index 0000000000000000000000000000000000000000..104ed44f4d7e92018786fa5716f102f3d3b3ef04 --- /dev/null +++ b/Kits/DirectXTK12/Src/GeometricPrimitive.cpp @@ -0,0 +1,434 @@ +//-------------------------------------------------------------------------------------- +// File: GeometricPrimitive.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "GeometricPrimitive.h" +#include "Effects.h" +#include "CommonStates.h" +#include "DirectXHelpers.h" +#include "SharedResourcePool.h" +#include "Geometry.h" +#include "PrimitiveBatch.h" +#include "GraphicsMemory.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +// Internal GeometricPrimitive implementation class. +class GeometricPrimitive::Impl +{ +public: + void Initialize(const VertexCollection& vertices, const IndexCollection& indices); + + void Draw(_In_ ID3D12GraphicsCommandList* commandList); + + UINT mIndexCount; + GraphicsResource mIndexBuffer; + GraphicsResource mVertexBuffer; + + D3D12_VERTEX_BUFFER_VIEW mVertexBufferView; + D3D12_INDEX_BUFFER_VIEW mIndexBufferView; +}; + + +// Initializes a geometric primitive instance that will draw the specified vertex and index data. +void GeometricPrimitive::Impl::Initialize(const VertexCollection& vertices, const IndexCollection& indices) +{ + if (vertices.size() >= USHRT_MAX) + throw std::exception("Too many vertices for 16-bit index buffer"); + + // Vertex data + auto verts = reinterpret_cast(vertices.data()); + size_t vertSizeBytes = vertices.size() * sizeof(vertices[0]); + + mVertexBuffer = GraphicsMemory::Get().Allocate(vertSizeBytes); + memcpy(mVertexBuffer.Memory(), verts, vertSizeBytes); + + // Index data + auto ind = reinterpret_cast(indices.data()); + size_t indSizeBytes = indices.size() * sizeof(indices[0]); + + mIndexBuffer = GraphicsMemory::Get().Allocate(indSizeBytes); + memcpy(mIndexBuffer.Memory(), ind, indSizeBytes); + + // Record index count for draw + mIndexCount = static_cast(indices.size()); + + // Create views + mVertexBufferView.BufferLocation = mVertexBuffer.GpuAddress(); + mVertexBufferView.StrideInBytes = static_cast(sizeof(VertexCollection::value_type)); + mVertexBufferView.SizeInBytes = (UINT)mVertexBuffer.Size(); + + mIndexBufferView.BufferLocation = mIndexBuffer.GpuAddress(); + mIndexBufferView.SizeInBytes = (UINT)mIndexBuffer.Size(); + mIndexBufferView.Format = DXGI_FORMAT_R16_UINT; +} + + +// Draws the primitive. +_Use_decl_annotations_ +void GeometricPrimitive::Impl::Draw(ID3D12GraphicsCommandList* commandList) +{ + commandList->IASetVertexBuffers(0, 1, &mVertexBufferView); + commandList->IASetIndexBuffer(&mIndexBufferView); + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + + commandList->DrawIndexedInstanced(mIndexCount, 1, 0, 0, 0); +} + +//-------------------------------------------------------------------------------------- +// GeometricPrimitive +//-------------------------------------------------------------------------------------- + +// Constructor. +GeometricPrimitive::GeometricPrimitive() + : pImpl(new Impl()) +{ +} + + +// Destructor. +GeometricPrimitive::~GeometricPrimitive() +{ +} + + +// Public entrypoints. +_Use_decl_annotations_ +void GeometricPrimitive::Draw(ID3D12GraphicsCommandList* commandList) +{ + pImpl->Draw(commandList); +} + + +//-------------------------------------------------------------------------------------- +// Cube (aka a Hexahedron) or Box +//-------------------------------------------------------------------------------------- + +// Creates a cube primitive. +std::unique_ptr GeometricPrimitive::CreateCube(float size, bool rhcoords) +{ + VertexCollection vertices; + IndexCollection indices; + ComputeBox(vertices, indices, XMFLOAT3(size, size, size), rhcoords, false); + + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateCube(std::vector& vertices, std::vector& indices, float size, bool rhcoords) +{ + ComputeBox(vertices, indices, XMFLOAT3(size, size, size), rhcoords, false); +} + + +// Creates a box primitive. +std::unique_ptr GeometricPrimitive::CreateBox(const XMFLOAT3& size, bool rhcoords, bool invertn) +{ + VertexCollection vertices; + IndexCollection indices; + ComputeBox(vertices, indices, size, rhcoords, invertn); + + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateBox(std::vector& vertices, std::vector& indices, const XMFLOAT3& size, bool rhcoords, bool invertn) +{ + ComputeBox(vertices, indices, size, rhcoords, invertn); +} + + +//-------------------------------------------------------------------------------------- +// Sphere +//-------------------------------------------------------------------------------------- + +// Creates a sphere primitive. +std::unique_ptr GeometricPrimitive::CreateSphere(float diameter, size_t tessellation, bool rhcoords, bool invertn) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + + ComputeSphere(vertices, indices, diameter, tessellation, rhcoords, invertn); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateSphere(std::vector& vertices, std::vector& indices, float diameter, size_t tessellation, bool rhcoords, bool invertn) +{ + ComputeSphere(vertices, indices, diameter, tessellation, rhcoords, invertn); +} + + +//-------------------------------------------------------------------------------------- +// Geodesic sphere +//-------------------------------------------------------------------------------------- + +// Creates a geosphere primitive. +std::unique_ptr GeometricPrimitive::CreateGeoSphere(float diameter, size_t tessellation, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeGeoSphere(vertices, indices, diameter, tessellation, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateGeoSphere(std::vector& vertices, std::vector& indices, float diameter, size_t tessellation, bool rhcoords) +{ + ComputeGeoSphere(vertices, indices, diameter, tessellation, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Cylinder / Cone +//-------------------------------------------------------------------------------------- + +// Creates a cylinder primitive. +std::unique_ptr GeometricPrimitive::CreateCylinder(float height, float diameter, size_t tessellation, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeCylinder(vertices, indices, height, diameter, tessellation, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateCylinder(std::vector& vertices, std::vector& indices, float height, float diameter, size_t tessellation, bool rhcoords) +{ + ComputeCylinder(vertices, indices, height, diameter, tessellation, rhcoords); +} + + +// Creates a cone primitive. +std::unique_ptr GeometricPrimitive::CreateCone(float diameter, float height, size_t tessellation, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeCone(vertices, indices, diameter, height, tessellation, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateCone(std::vector& vertices, std::vector& indices, float diameter, float height, size_t tessellation, bool rhcoords) +{ + ComputeCone(vertices, indices, diameter, height, tessellation, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Torus +//-------------------------------------------------------------------------------------- + +// Creates a torus primitive. +std::unique_ptr GeometricPrimitive::CreateTorus(float diameter, float thickness, size_t tessellation, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeTorus(vertices, indices, diameter, thickness, tessellation, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateTorus(std::vector& vertices, std::vector& indices, float diameter, float thickness, size_t tessellation, bool rhcoords) +{ + ComputeTorus(vertices, indices, diameter, thickness, tessellation, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Tetrahedron +//-------------------------------------------------------------------------------------- + +std::unique_ptr GeometricPrimitive::CreateTetrahedron(float size, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeTetrahedron(vertices, indices, size, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateTetrahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords) +{ + ComputeTetrahedron(vertices, indices, size, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Octahedron +//-------------------------------------------------------------------------------------- + +std::unique_ptr GeometricPrimitive::CreateOctahedron(float size, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeOctahedron(vertices, indices, size, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateOctahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords) +{ + ComputeOctahedron(vertices, indices, size, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Dodecahedron +//-------------------------------------------------------------------------------------- + +std::unique_ptr GeometricPrimitive::CreateDodecahedron(float size, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeDodecahedron(vertices, indices, size, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateDodecahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords) +{ + ComputeDodecahedron(vertices, indices, size, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Icosahedron +//-------------------------------------------------------------------------------------- + +std::unique_ptr GeometricPrimitive::CreateIcosahedron(float size, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeIcosahedron(vertices, indices, size, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateIcosahedron(std::vector& vertices, std::vector& indices, float size, bool rhcoords) +{ + ComputeIcosahedron(vertices, indices, size, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Teapot +//-------------------------------------------------------------------------------------- + +// Creates a teapot primitive. +std::unique_ptr GeometricPrimitive::CreateTeapot(float size, size_t tessellation, bool rhcoords) +{ + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + VertexCollection vertices; + IndexCollection indices; + ComputeTeapot(vertices, indices, size, tessellation, rhcoords); + + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} + +void GeometricPrimitive::CreateTeapot(std::vector& vertices, std::vector& indices, float size, size_t tessellation, bool rhcoords) +{ + ComputeTeapot(vertices, indices, size, tessellation, rhcoords); +} + + +//-------------------------------------------------------------------------------------- +// Custom +//-------------------------------------------------------------------------------------- + +std::unique_ptr GeometricPrimitive::CreateCustom(const std::vector& vertices, const std::vector& indices) +{ + // Extra validation + if (vertices.empty() || indices.empty()) + throw std::exception("Requires both vertices and indices"); + + if (indices.size() % 3) + throw std::exception("Expected triangular faces"); + + size_t nVerts = vertices.size(); + if (nVerts >= USHRT_MAX) + throw std::exception("Too many vertices for 16-bit index buffer"); + + for (auto it = indices.cbegin(); it != indices.cend(); ++it) + { + if (*it >= nVerts) + { + throw std::exception("Index not in vertices list"); + } + } + // Create the primitive object. + std::unique_ptr primitive(new GeometricPrimitive()); + + // copy geometry + primitive->pImpl->Initialize(vertices, indices); + + return primitive; +} diff --git a/Kits/DirectXTK12/Src/Geometry.cpp b/Kits/DirectXTK12/Src/Geometry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b5c3b80d042284c5928163cf9b7095023238822 --- /dev/null +++ b/Kits/DirectXTK12/Src/Geometry.cpp @@ -0,0 +1,1184 @@ +//-------------------------------------------------------------------------------------- +// File: Geometry.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Geometry.h" +#include "Bezier.h" + +using namespace DirectX; + +namespace +{ + const float SQRT2 = 1.41421356237309504880f; + const float SQRT3 = 1.73205080756887729352f; + const float SQRT6 = 2.44948974278317809820f; + + inline void CheckIndexOverflow(size_t value) + { + // Use >=, not > comparison, because some D3D level 9_x hardware does not support 0xFFFF index values. + if (value >= USHRT_MAX) + throw std::exception("Index value out of range: cannot tesselate primitive so finely"); + } + + + // Collection types used when generating the geometry. + inline void index_push_back(IndexCollection& indices, size_t value) + { + CheckIndexOverflow(value); + indices.push_back((uint16_t)value); + } + + + // Helper for flipping winding of geometric primitives for LH vs. RH coords + inline void ReverseWinding(IndexCollection& indices, VertexCollection& vertices) + { + assert((indices.size() % 3) == 0); + for (auto it = indices.begin(); it != indices.end(); it += 3) + { + std::swap(*it, *(it + 2)); + } + + for (auto it = vertices.begin(); it != vertices.end(); ++it) + { + it->textureCoordinate.x = (1.f - it->textureCoordinate.x); + } + } + + + // Helper for inverting normals of geometric primitives for 'inside' vs. 'outside' viewing + inline void InvertNormals(VertexCollection& vertices) + { + for (auto it = vertices.begin(); it != vertices.end(); ++it) + { + it->normal.x = -it->normal.x; + it->normal.y = -it->normal.y; + it->normal.z = -it->normal.z; + } + } +} + + +//-------------------------------------------------------------------------------------- +// Cube (aka a Hexahedron) or Box +//-------------------------------------------------------------------------------------- +void DirectX::ComputeBox(VertexCollection& vertices, IndexCollection& indices, const XMFLOAT3& size, bool rhcoords, bool invertn) +{ + vertices.clear(); + indices.clear(); + + // A box has six faces, each one pointing in a different direction. + const int FaceCount = 6; + + static const XMVECTORF32 faceNormals[FaceCount] = + { + { 0, 0, 1 }, + { 0, 0, -1 }, + { 1, 0, 0 }, + { -1, 0, 0 }, + { 0, 1, 0 }, + { 0, -1, 0 }, + }; + + static const XMVECTORF32 textureCoordinates[4] = + { + { 1, 0 }, + { 1, 1 }, + { 0, 1 }, + { 0, 0 }, + }; + + XMVECTOR tsize = XMLoadFloat3(&size); + tsize = XMVectorDivide(tsize, g_XMTwo); + + // Create each face in turn. + for (int i = 0; i < FaceCount; i++) + { + XMVECTOR normal = faceNormals[i]; + + // Get two vectors perpendicular both to the face normal and to each other. + XMVECTOR basis = (i >= 4) ? g_XMIdentityR2 : g_XMIdentityR1; + + XMVECTOR side1 = XMVector3Cross(normal, basis); + XMVECTOR side2 = XMVector3Cross(normal, side1); + + // Six indices (two triangles) per face. + size_t vbase = vertices.size(); + index_push_back(indices, vbase + 0); + index_push_back(indices, vbase + 1); + index_push_back(indices, vbase + 2); + + index_push_back(indices, vbase + 0); + index_push_back(indices, vbase + 2); + index_push_back(indices, vbase + 3); + + // Four vertices per face. + vertices.push_back(VertexPositionNormalTexture((normal - side1 - side2) * tsize, normal, textureCoordinates[0])); + vertices.push_back(VertexPositionNormalTexture((normal - side1 + side2) * tsize, normal, textureCoordinates[1])); + vertices.push_back(VertexPositionNormalTexture((normal + side1 + side2) * tsize, normal, textureCoordinates[2])); + vertices.push_back(VertexPositionNormalTexture((normal + side1 - side2) * tsize, normal, textureCoordinates[3])); + } + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); + + if (invertn) + InvertNormals(vertices); +} + + +//-------------------------------------------------------------------------------------- +// Sphere +//-------------------------------------------------------------------------------------- +void DirectX::ComputeSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords, bool invertn) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + size_t verticalSegments = tessellation; + size_t horizontalSegments = tessellation * 2; + + float radius = diameter / 2; + + // Create rings of vertices at progressively higher latitudes. + for (size_t i = 0; i <= verticalSegments; i++) + { + float v = 1 - (float)i / verticalSegments; + + float latitude = (i * XM_PI / verticalSegments) - XM_PIDIV2; + float dy, dxz; + + XMScalarSinCos(&dy, &dxz, latitude); + + // Create a single ring of vertices at this latitude. + for (size_t j = 0; j <= horizontalSegments; j++) + { + float u = (float)j / horizontalSegments; + + float longitude = j * XM_2PI / horizontalSegments; + float dx, dz; + + XMScalarSinCos(&dx, &dz, longitude); + + dx *= dxz; + dz *= dxz; + + XMVECTOR normal = XMVectorSet(dx, dy, dz, 0); + XMVECTOR textureCoordinate = XMVectorSet(u, v, 0, 0); + + vertices.push_back(VertexPositionNormalTexture(normal * radius, normal, textureCoordinate)); + } + } + + // Fill the index buffer with triangles joining each pair of latitude rings. + size_t stride = horizontalSegments + 1; + + for (size_t i = 0; i < verticalSegments; i++) + { + for (size_t j = 0; j <= horizontalSegments; j++) + { + size_t nextI = i + 1; + size_t nextJ = (j + 1) % stride; + + index_push_back(indices, i * stride + j); + index_push_back(indices, nextI * stride + j); + index_push_back(indices, i * stride + nextJ); + + index_push_back(indices, i * stride + nextJ); + index_push_back(indices, nextI * stride + j); + index_push_back(indices, nextI * stride + nextJ); + } + } + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); + + if (invertn) + InvertNormals(vertices); +} + + +//-------------------------------------------------------------------------------------- +// Geodesic sphere +//-------------------------------------------------------------------------------------- +void DirectX::ComputeGeoSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + // An undirected edge between two vertices, represented by a pair of indexes into a vertex array. + // Becuse this edge is undirected, (a,b) is the same as (b,a). + typedef std::pair UndirectedEdge; + + // Makes an undirected edge. Rather than overloading comparison operators to give us the (a,b)==(b,a) property, + // we'll just ensure that the larger of the two goes first. This'll simplify things greatly. + auto makeUndirectedEdge = [](uint16_t a, uint16_t b) + { + return std::make_pair(std::max(a, b), std::min(a, b)); + }; + + // Key: an edge + // Value: the index of the vertex which lies midway between the two vertices pointed to by the key value + // This map is used to avoid duplicating vertices when subdividing triangles along edges. + typedef std::map EdgeSubdivisionMap; + + + static const XMFLOAT3 OctahedronVertices[] = + { + // when looking down the negative z-axis (into the screen) + XMFLOAT3(0, 1, 0), // 0 top + XMFLOAT3(0, 0, -1), // 1 front + XMFLOAT3(1, 0, 0), // 2 right + XMFLOAT3(0, 0, 1), // 3 back + XMFLOAT3(-1, 0, 0), // 4 left + XMFLOAT3(0, -1, 0), // 5 bottom + }; + static const uint16_t OctahedronIndices[] = + { + 0, 1, 2, // top front-right face + 0, 2, 3, // top back-right face + 0, 3, 4, // top back-left face + 0, 4, 1, // top front-left face + 5, 1, 4, // bottom front-left face + 5, 4, 3, // bottom back-left face + 5, 3, 2, // bottom back-right face + 5, 2, 1, // bottom front-right face + }; + + const float radius = diameter / 2.0f; + + // Start with an octahedron; copy the data into the vertex/index collection. + + std::vector vertexPositions(std::begin(OctahedronVertices), std::end(OctahedronVertices)); + + indices.insert(indices.begin(), std::begin(OctahedronIndices), std::end(OctahedronIndices)); + + // We know these values by looking at the above index list for the octahedron. Despite the subdivisions that are + // about to go on, these values aren't ever going to change because the vertices don't move around in the array. + // We'll need these values later on to fix the singularities that show up at the poles. + const uint16_t northPoleIndex = 0; + const uint16_t southPoleIndex = 5; + + for (size_t iSubdivision = 0; iSubdivision < tessellation; ++iSubdivision) + { + assert(indices.size() % 3 == 0); // sanity + + // We use this to keep track of which edges have already been subdivided. + EdgeSubdivisionMap subdividedEdges; + + // The new index collection after subdivision. + IndexCollection newIndices; + + const size_t triangleCount = indices.size() / 3; + for (size_t iTriangle = 0; iTriangle < triangleCount; ++iTriangle) + { + // For each edge on this triangle, create a new vertex in the middle of that edge. + // The winding order of the triangles we output are the same as the winding order of the inputs. + + // Indices of the vertices making up this triangle + uint16_t iv0 = indices[iTriangle * 3 + 0]; + uint16_t iv1 = indices[iTriangle * 3 + 1]; + uint16_t iv2 = indices[iTriangle * 3 + 2]; + + // Get the new vertices + XMFLOAT3 v01; // vertex on the midpoint of v0 and v1 + XMFLOAT3 v12; // ditto v1 and v2 + XMFLOAT3 v20; // ditto v2 and v0 + uint16_t iv01; // index of v01 + uint16_t iv12; // index of v12 + uint16_t iv20; // index of v20 + + // Function that, when given the index of two vertices, creates a new vertex at the midpoint of those vertices. + auto divideEdge = [&](uint16_t i0, uint16_t i1, XMFLOAT3& outVertex, uint16_t& outIndex) + { + const UndirectedEdge edge = makeUndirectedEdge(i0, i1); + + // Check to see if we've already generated this vertex + auto it = subdividedEdges.find(edge); + if (it != subdividedEdges.end()) + { + // We've already generated this vertex before + outIndex = it->second; // the index of this vertex + outVertex = vertexPositions[outIndex]; // and the vertex itself + } + else + { + // Haven't generated this vertex before: so add it now + + // outVertex = (vertices[i0] + vertices[i1]) / 2 + XMStoreFloat3( + &outVertex, + XMVectorScale( + XMVectorAdd(XMLoadFloat3(&vertexPositions[i0]), XMLoadFloat3(&vertexPositions[i1])), + 0.5f + ) + ); + + outIndex = static_cast(vertexPositions.size()); + CheckIndexOverflow(outIndex); + vertexPositions.push_back(outVertex); + + // Now add it to the map. + subdividedEdges.insert(std::make_pair(edge, outIndex)); + } + }; + + // Add/get new vertices and their indices + divideEdge(iv0, iv1, v01, iv01); + divideEdge(iv1, iv2, v12, iv12); + divideEdge(iv0, iv2, v20, iv20); + + // Add the new indices. We have four new triangles from our original one: + // v0 + // o + // /a\ + // v20 o---o v01 + // /b\c/d\ + // v2 o---o---o v1 + // v12 + const uint16_t indicesToAdd[] = + { + iv0, iv01, iv20, // a + iv20, iv12, iv2, // b + iv20, iv01, iv12, // c + iv01, iv1, iv12, // d + }; + newIndices.insert(newIndices.end(), std::begin(indicesToAdd), std::end(indicesToAdd)); + } + + indices = std::move(newIndices); + } + + // Now that we've completed subdivision, fill in the final vertex collection + vertices.reserve(vertexPositions.size()); + for (auto it = vertexPositions.begin(); it != vertexPositions.end(); ++it) + { + auto vertexValue = *it; + + auto normal = XMVector3Normalize(XMLoadFloat3(&vertexValue)); + auto pos = XMVectorScale(normal, radius); + + XMFLOAT3 normalFloat3; + XMStoreFloat3(&normalFloat3, normal); + + // calculate texture coordinates for this vertex + float longitude = atan2(normalFloat3.x, -normalFloat3.z); + float latitude = acos(normalFloat3.y); + + float u = longitude / XM_2PI + 0.5f; + float v = latitude / XM_PI; + + auto texcoord = XMVectorSet(1.0f - u, v, 0.0f, 0.0f); + vertices.push_back(VertexPositionNormalTexture(pos, normal, texcoord)); + } + + // There are a couple of fixes to do. One is a texture coordinate wraparound fixup. At some point, there will be + // a set of triangles somewhere in the mesh with texture coordinates such that the wraparound across 0.0/1.0 + // occurs across that triangle. Eg. when the left hand side of the triangle has a U coordinate of 0.98 and the + // right hand side has a U coordinate of 0.0. The intent is that such a triangle should render with a U of 0.98 to + // 1.0, not 0.98 to 0.0. If we don't do this fixup, there will be a visible seam across one side of the sphere. + // + // Luckily this is relatively easy to fix. There is a straight edge which runs down the prime meridian of the + // completed sphere. If you imagine the vertices along that edge, they circumscribe a semicircular arc starting at + // y=1 and ending at y=-1, and sweeping across the range of z=0 to z=1. x stays zero. It's along this edge that we + // need to duplicate our vertices - and provide the correct texture coordinates. + size_t preFixupVertexCount = vertices.size(); + for (size_t i = 0; i < preFixupVertexCount; ++i) + { + // This vertex is on the prime meridian if position.x and texcoord.u are both zero (allowing for small epsilon). + bool isOnPrimeMeridian = XMVector2NearEqual( + XMVectorSet(vertices[i].position.x, vertices[i].textureCoordinate.x, 0.0f, 0.0f), + XMVectorZero(), + XMVectorSplatEpsilon()); + + if (isOnPrimeMeridian) + { + size_t newIndex = vertices.size(); // the index of this vertex that we're about to add + CheckIndexOverflow(newIndex); + + // copy this vertex, correct the texture coordinate, and add the vertex + VertexPositionNormalTexture v = vertices[i]; + v.textureCoordinate.x = 1.0f; + vertices.push_back(v); + + // Now find all the triangles which contain this vertex and update them if necessary + for (size_t j = 0; j < indices.size(); j += 3) + { + uint16_t* triIndex0 = &indices[j + 0]; + uint16_t* triIndex1 = &indices[j + 1]; + uint16_t* triIndex2 = &indices[j + 2]; + + if (*triIndex0 == i) + { + // nothing; just keep going + } + else if (*triIndex1 == i) + { + std::swap(triIndex0, triIndex1); // swap the pointers (not the values) + } + else if (*triIndex2 == i) + { + std::swap(triIndex0, triIndex2); // swap the pointers (not the values) + } + else + { + // this triangle doesn't use the vertex we're interested in + continue; + } + + // If we got to this point then triIndex0 is the pointer to the index to the vertex we're looking at + assert(*triIndex0 == i); + assert(*triIndex1 != i && *triIndex2 != i); // assume no degenerate triangles + + const VertexPositionNormalTexture& v0 = vertices[*triIndex0]; + const VertexPositionNormalTexture& v1 = vertices[*triIndex1]; + const VertexPositionNormalTexture& v2 = vertices[*triIndex2]; + + // check the other two vertices to see if we might need to fix this triangle + + if (abs(v0.textureCoordinate.x - v1.textureCoordinate.x) > 0.5f || + abs(v0.textureCoordinate.x - v2.textureCoordinate.x) > 0.5f) + { + // yep; replace the specified index to point to the new, corrected vertex + *triIndex0 = static_cast(newIndex); + } + } + } + } + + // And one last fix we need to do: the poles. A common use-case of a sphere mesh is to map a rectangular texture onto + // it. If that happens, then the poles become singularities which map the entire top and bottom rows of the texture + // onto a single point. In general there's no real way to do that right. But to match the behavior of non-geodesic + // spheres, we need to duplicate the pole vertex for every triangle that uses it. This will introduce seams near the + // poles, but reduce stretching. + auto fixPole = [&](size_t poleIndex) + { + auto poleVertex = vertices[poleIndex]; + bool overwrittenPoleVertex = false; // overwriting the original pole vertex saves us one vertex + + for (size_t i = 0; i < indices.size(); i += 3) + { + // These pointers point to the three indices which make up this triangle. pPoleIndex is the pointer to the + // entry in the index array which represents the pole index, and the other two pointers point to the other + // two indices making up this triangle. + uint16_t* pPoleIndex; + uint16_t* pOtherIndex0; + uint16_t* pOtherIndex1; + if (indices[i + 0] == poleIndex) + { + pPoleIndex = &indices[i + 0]; + pOtherIndex0 = &indices[i + 1]; + pOtherIndex1 = &indices[i + 2]; + } + else if (indices[i + 1] == poleIndex) + { + pPoleIndex = &indices[i + 1]; + pOtherIndex0 = &indices[i + 2]; + pOtherIndex1 = &indices[i + 0]; + } + else if (indices[i + 2] == poleIndex) + { + pPoleIndex = &indices[i + 2]; + pOtherIndex0 = &indices[i + 0]; + pOtherIndex1 = &indices[i + 1]; + } + else + { + continue; + } + + const auto& otherVertex0 = vertices[*pOtherIndex0]; + const auto& otherVertex1 = vertices[*pOtherIndex1]; + + // Calculate the texcoords for the new pole vertex, add it to the vertices and update the index + VertexPositionNormalTexture newPoleVertex = poleVertex; + newPoleVertex.textureCoordinate.x = (otherVertex0.textureCoordinate.x + otherVertex1.textureCoordinate.x) / 2; + newPoleVertex.textureCoordinate.y = poleVertex.textureCoordinate.y; + + if (!overwrittenPoleVertex) + { + vertices[poleIndex] = newPoleVertex; + overwrittenPoleVertex = true; + } + else + { + CheckIndexOverflow(vertices.size()); + + *pPoleIndex = static_cast(vertices.size()); + vertices.push_back(newPoleVertex); + } + } + }; + + fixPole(northPoleIndex); + fixPole(southPoleIndex); + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +//-------------------------------------------------------------------------------------- +// Cylinder / Cone +//-------------------------------------------------------------------------------------- +namespace +{ + // Helper computes a point on a unit circle, aligned to the x/z plane and centered on the origin. + inline XMVECTOR GetCircleVector(size_t i, size_t tessellation) + { + float angle = i * XM_2PI / tessellation; + float dx, dz; + + XMScalarSinCos(&dx, &dz, angle); + + XMVECTORF32 v = { dx, 0, dz, 0 }; + return v; + } + + inline XMVECTOR GetCircleTangent(size_t i, size_t tessellation) + { + float angle = (i * XM_2PI / tessellation) + XM_PIDIV2; + float dx, dz; + + XMScalarSinCos(&dx, &dz, angle); + + XMVECTORF32 v = { dx, 0, dz, 0 }; + return v; + } + + + // Helper creates a triangle fan to close the end of a cylinder / cone + void CreateCylinderCap(VertexCollection& vertices, IndexCollection& indices, size_t tessellation, float height, float radius, bool isTop) + { + // Create cap indices. + for (size_t i = 0; i < tessellation - 2; i++) + { + size_t i1 = (i + 1) % tessellation; + size_t i2 = (i + 2) % tessellation; + + if (isTop) + { + std::swap(i1, i2); + } + + size_t vbase = vertices.size(); + index_push_back(indices, vbase); + index_push_back(indices, vbase + i1); + index_push_back(indices, vbase + i2); + } + + // Which end of the cylinder is this? + XMVECTOR normal = g_XMIdentityR1; + XMVECTOR textureScale = g_XMNegativeOneHalf; + + if (!isTop) + { + normal = -normal; + textureScale *= g_XMNegateX; + } + + // Create cap vertices. + for (size_t i = 0; i < tessellation; i++) + { + XMVECTOR circleVector = GetCircleVector(i, tessellation); + + XMVECTOR position = (circleVector * radius) + (normal * height); + + XMVECTOR textureCoordinate = XMVectorMultiplyAdd(XMVectorSwizzle<0, 2, 3, 3>(circleVector), textureScale, g_XMOneHalf); + + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); + } + } +} + +void DirectX::ComputeCylinder(VertexCollection& vertices, IndexCollection& indices, float height, float diameter, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + height /= 2; + + XMVECTOR topOffset = g_XMIdentityR1 * height; + + float radius = diameter / 2; + size_t stride = tessellation + 1; + + // Create a ring of triangles around the outside of the cylinder. + for (size_t i = 0; i <= tessellation; i++) + { + XMVECTOR normal = GetCircleVector(i, tessellation); + + XMVECTOR sideOffset = normal * radius; + + float u = (float)i / tessellation; + + XMVECTOR textureCoordinate = XMLoadFloat(&u); + + vertices.push_back(VertexPositionNormalTexture(sideOffset + topOffset, normal, textureCoordinate)); + vertices.push_back(VertexPositionNormalTexture(sideOffset - topOffset, normal, textureCoordinate + g_XMIdentityR1)); + + index_push_back(indices, i * 2); + index_push_back(indices, (i * 2 + 2) % (stride * 2)); + index_push_back(indices, i * 2 + 1); + + index_push_back(indices, i * 2 + 1); + index_push_back(indices, (i * 2 + 2) % (stride * 2)); + index_push_back(indices, (i * 2 + 3) % (stride * 2)); + } + + // Create flat triangle fan caps to seal the top and bottom. + CreateCylinderCap(vertices, indices, tessellation, height, radius, true); + CreateCylinderCap(vertices, indices, tessellation, height, radius, false); + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +// Creates a cone primitive. +void DirectX::ComputeCone(VertexCollection& vertices, IndexCollection& indices, float diameter, float height, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + height /= 2; + + XMVECTOR topOffset = g_XMIdentityR1 * height; + + float radius = diameter / 2; + size_t stride = tessellation + 1; + + // Create a ring of triangles around the outside of the cone. + for (size_t i = 0; i <= tessellation; i++) + { + XMVECTOR circlevec = GetCircleVector(i, tessellation); + + XMVECTOR sideOffset = circlevec * radius; + + float u = (float)i / tessellation; + + XMVECTOR textureCoordinate = XMLoadFloat(&u); + + XMVECTOR pt = sideOffset - topOffset; + + XMVECTOR normal = XMVector3Cross(GetCircleTangent(i, tessellation), topOffset - pt); + normal = XMVector3Normalize(normal); + + // Duplicate the top vertex for distinct normals + vertices.push_back(VertexPositionNormalTexture(topOffset, normal, g_XMZero)); + vertices.push_back(VertexPositionNormalTexture(pt, normal, textureCoordinate + g_XMIdentityR1)); + + index_push_back(indices, i * 2); + index_push_back(indices, (i * 2 + 3) % (stride * 2)); + index_push_back(indices, (i * 2 + 1) % (stride * 2)); + } + + // Create flat triangle fan caps to seal the bottom. + CreateCylinderCap(vertices, indices, tessellation, height, radius, false); + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +//-------------------------------------------------------------------------------------- +// Torus +//-------------------------------------------------------------------------------------- +void DirectX::ComputeTorus(VertexCollection& vertices, IndexCollection& indices, float diameter, float thickness, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 3) + throw std::out_of_range("tesselation parameter out of range"); + + size_t stride = tessellation + 1; + + // First we loop around the main ring of the torus. + for (size_t i = 0; i <= tessellation; i++) + { + float u = (float)i / tessellation; + + float outerAngle = i * XM_2PI / tessellation - XM_PIDIV2; + + // Create a transform matrix that will align geometry to + // slice perpendicularly though the current ring position. + XMMATRIX transform = XMMatrixTranslation(diameter / 2, 0, 0) * XMMatrixRotationY(outerAngle); + + // Now we loop along the other axis, around the side of the tube. + for (size_t j = 0; j <= tessellation; j++) + { + float v = 1 - (float)j / tessellation; + + float innerAngle = j * XM_2PI / tessellation + XM_PI; + float dx, dy; + + XMScalarSinCos(&dy, &dx, innerAngle); + + // Create a vertex. + XMVECTOR normal = XMVectorSet(dx, dy, 0, 0); + XMVECTOR position = normal * thickness / 2; + XMVECTOR textureCoordinate = XMVectorSet(u, v, 0, 0); + + position = XMVector3Transform(position, transform); + normal = XMVector3TransformNormal(normal, transform); + + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); + + // And create indices for two triangles. + size_t nextI = (i + 1) % stride; + size_t nextJ = (j + 1) % stride; + + index_push_back(indices, i * stride + j); + index_push_back(indices, i * stride + nextJ); + index_push_back(indices, nextI * stride + j); + + index_push_back(indices, i * stride + nextJ); + index_push_back(indices, nextI * stride + nextJ); + index_push_back(indices, nextI * stride + j); + } + } + + // Build RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} + + +//-------------------------------------------------------------------------------------- +// Tetrahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeTetrahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const XMVECTORF32 verts[4] = + { + { 0.f, 0.f, 1.f }, + { 2.f*SQRT2 / 3.f, 0.f, -1.f / 3.f }, + { -SQRT2 / 3.f, SQRT6 / 3.f, -1.f / 3.f }, + { -SQRT2 / 3.f, -SQRT6 / 3.f, -1.f / 3.f } + }; + + static const uint32_t faces[4 * 3] = + { + 0, 1, 2, + 0, 2, 3, + 0, 3, 1, + 1, 3, 2, + }; + + for (size_t j = 0; j < _countof(faces); j += 3) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMZero /* 0, 0 */)); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR0 /* 1, 0 */)); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR1 /* 0, 1 */)); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 4 * 3); + assert(indices.size() == 4 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Octahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeOctahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const XMVECTORF32 verts[6] = + { + { 1, 0, 0 }, + { -1, 0, 0 }, + { 0, 1, 0 }, + { 0, -1, 0 }, + { 0, 0, 1 }, + { 0, 0, -1 } + }; + + static const uint32_t faces[8 * 3] = + { + 4, 0, 2, + 4, 2, 1, + 4, 1, 3, + 4, 3, 0, + 5, 2, 0, + 5, 1, 2, + 5, 3, 1, + 5, 0, 3 + }; + + for (size_t j = 0; j < _countof(faces); j += 3) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMZero /* 0, 0 */)); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR0 /* 1, 0 */)); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR1 /* 0, 1*/)); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 8 * 3); + assert(indices.size() == 8 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Dodecahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeDodecahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const float a = 1.f / SQRT3; + static const float b = 0.356822089773089931942f; // sqrt( ( 3 - sqrt(5) ) / 6 ) + static const float c = 0.934172358962715696451f; // sqrt( ( 3 + sqrt(5) ) / 6 ); + + static const XMVECTORF32 verts[20] = + { + { a, a, a }, + { a, a, -a }, + { a, -a, a }, + { a, -a, -a }, + { -a, a, a }, + { -a, a, -a }, + { -a, -a, a }, + { -a, -a, -a }, + { b, c, 0 }, + { -b, c, 0 }, + { b, -c, 0 }, + { -b, -c, 0 }, + { c, 0, b }, + { c, 0, -b }, + { -c, 0, b }, + { -c, 0, -b }, + { 0, b, c }, + { 0, -b, c }, + { 0, b, -c }, + { 0, -b, -c } + }; + + static const uint32_t faces[12 * 5] = + { + 0, 8, 9, 4, 16, + 0, 16, 17, 2, 12, + 12, 2, 10, 3, 13, + 9, 5, 15, 14, 4, + 3, 19, 18, 1, 13, + 7, 11, 6, 14, 15, + 0, 12, 13, 1, 8, + 8, 1, 18, 5, 9, + 16, 4, 14, 6, 17, + 6, 11, 10, 2, 17, + 7, 15, 5, 18, 19, + 7, 19, 3, 10, 11, + }; + + static const XMVECTORF32 textureCoordinates[5] = + { + { 0.654508f, 0.0244717f }, + { 0.0954915f, 0.206107f }, + { 0.0954915f, 0.793893f }, + { 0.654508f, 0.975528f }, + { 1.f, 0.5f } + }; + + static const uint32_t textureIndex[12][5] = + { + { 0, 1, 2, 3, 4 }, + { 2, 3, 4, 0, 1 }, + { 4, 0, 1, 2, 3 }, + { 1, 2, 3, 4, 0 }, + { 2, 3, 4, 0, 1 }, + { 0, 1, 2, 3, 4 }, + { 1, 2, 3, 4, 0 }, + { 4, 0, 1, 2, 3 }, + { 4, 0, 1, 2, 3 }, + { 1, 2, 3, 4, 0 }, + { 0, 1, 2, 3, 4 }, + { 2, 3, 4, 0, 1 }, + }; + + size_t t = 0; + for (size_t j = 0; j < _countof(faces); j += 5, ++t) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + uint32_t v3 = faces[j + 3]; + uint32_t v4 = faces[j + 4]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + index_push_back(indices, base); + index_push_back(indices, base + 2); + index_push_back(indices, base + 3); + + index_push_back(indices, base); + index_push_back(indices, base + 3); + index_push_back(indices, base + 4); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][0]])); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][1]])); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][2]])); + + position = XMVectorScale(verts[v3], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][3]])); + + position = XMVectorScale(verts[v4], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinates[textureIndex[t][4]])); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 12 * 5); + assert(indices.size() == 12 * 3 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Icosahedron +//-------------------------------------------------------------------------------------- +void DirectX::ComputeIcosahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + static const float t = 1.618033988749894848205f; // (1 + sqrt(5)) / 2 + static const float t2 = 1.519544995837552493271f; // sqrt( 1 + sqr( (1 + sqrt(5)) / 2 ) ) + + static const XMVECTORF32 verts[12] = + { + { t / t2, 1.f / t2, 0 }, + { -t / t2, 1.f / t2, 0 }, + { t / t2, -1.f / t2, 0 }, + { -t / t2, -1.f / t2, 0 }, + { 1.f / t2, 0, t / t2 }, + { 1.f / t2, 0, -t / t2 }, + { -1.f / t2, 0, t / t2 }, + { -1.f / t2, 0, -t / t2 }, + { 0, t / t2, 1.f / t2 }, + { 0, -t / t2, 1.f / t2 }, + { 0, t / t2, -1.f / t2 }, + { 0, -t / t2, -1.f / t2 } + }; + + static const uint32_t faces[20 * 3] = + { + 0, 8, 4, + 0, 5, 10, + 2, 4, 9, + 2, 11, 5, + 1, 6, 8, + 1, 10, 7, + 3, 9, 6, + 3, 7, 11, + 0, 10, 8, + 1, 8, 10, + 2, 9, 11, + 3, 11, 9, + 4, 2, 0, + 5, 0, 2, + 6, 1, 3, + 7, 3, 1, + 8, 6, 4, + 9, 4, 6, + 10, 5, 7, + 11, 7, 5 + }; + + for (size_t j = 0; j < _countof(faces); j += 3) + { + uint32_t v0 = faces[j]; + uint32_t v1 = faces[j + 1]; + uint32_t v2 = faces[j + 2]; + + XMVECTOR normal = XMVector3Cross(verts[v1].v - verts[v0].v, + verts[v2].v - verts[v0].v); + normal = XMVector3Normalize(normal); + + size_t base = vertices.size(); + index_push_back(indices, base); + index_push_back(indices, base + 1); + index_push_back(indices, base + 2); + + // Duplicate vertices to use face normals + XMVECTOR position = XMVectorScale(verts[v0], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMZero /* 0, 0 */)); + + position = XMVectorScale(verts[v1], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR0 /* 1, 0 */)); + + position = XMVectorScale(verts[v2], size); + vertices.push_back(VertexPositionNormalTexture(position, normal, g_XMIdentityR1 /* 0, 1 */)); + } + + // Built LH above + if (rhcoords) + ReverseWinding(indices, vertices); + + assert(vertices.size() == 20 * 3); + assert(indices.size() == 20 * 3); +} + + +//-------------------------------------------------------------------------------------- +// Teapot +//-------------------------------------------------------------------------------------- + +// Include the teapot control point data. +namespace +{ +#include "TeapotData.inc" + + // Tessellates the specified bezier patch. + void XM_CALLCONV TessellatePatch(VertexCollection& vertices, IndexCollection& indices, TeapotPatch const& patch, size_t tessellation, FXMVECTOR scale, bool isMirrored) + { + // Look up the 16 control points for this patch. + XMVECTOR controlPoints[16]; + + for (int i = 0; i < 16; i++) + { + controlPoints[i] = TeapotControlPoints[patch.indices[i]] * scale; + } + + // Create the index data. + size_t vbase = vertices.size(); + Bezier::CreatePatchIndices(tessellation, isMirrored, [&](size_t index) + { + index_push_back(indices, vbase + index); + }); + + // Create the vertex data. + Bezier::CreatePatchVertices(controlPoints, tessellation, isMirrored, [&](FXMVECTOR position, FXMVECTOR normal, FXMVECTOR textureCoordinate) + { + vertices.push_back(VertexPositionNormalTexture(position, normal, textureCoordinate)); + }); + } +} + + +// Creates a teapot primitive. +void DirectX::ComputeTeapot(VertexCollection& vertices, IndexCollection& indices, float size, size_t tessellation, bool rhcoords) +{ + vertices.clear(); + indices.clear(); + + if (tessellation < 1) + throw std::out_of_range("tesselation parameter out of range"); + + XMVECTOR scaleVector = XMVectorReplicate(size); + + XMVECTOR scaleNegateX = scaleVector * g_XMNegateX; + XMVECTOR scaleNegateZ = scaleVector * g_XMNegateZ; + XMVECTOR scaleNegateXZ = scaleVector * g_XMNegateX * g_XMNegateZ; + + for (int i = 0; i < sizeof(TeapotPatches) / sizeof(TeapotPatches[0]); i++) + { + TeapotPatch const& patch = TeapotPatches[i]; + + // Because the teapot is symmetrical from left to right, we only store + // data for one side, then tessellate each patch twice, mirroring in X. + TessellatePatch(vertices, indices, patch, tessellation, scaleVector, false); + TessellatePatch(vertices, indices, patch, tessellation, scaleNegateX, true); + + if (patch.mirrorZ) + { + // Some parts of the teapot (the body, lid, and rim, but not the + // handle or spout) are also symmetrical from front to back, so + // we tessellate them four times, mirroring in Z as well as X. + TessellatePatch(vertices, indices, patch, tessellation, scaleNegateZ, true); + TessellatePatch(vertices, indices, patch, tessellation, scaleNegateXZ, false); + } + } + + // Built RH above + if (!rhcoords) + ReverseWinding(indices, vertices); +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Src/Geometry.h b/Kits/DirectXTK12/Src/Geometry.h new file mode 100644 index 0000000000000000000000000000000000000000..2afc7d0f411cfc4f83e5dd5bdff4392fc793b9e0 --- /dev/null +++ b/Kits/DirectXTK12/Src/Geometry.h @@ -0,0 +1,32 @@ +//-------------------------------------------------------------------------------------- +// File: Geometry.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "VertexTypes.h" + +namespace DirectX +{ + typedef std::vector VertexCollection; + typedef std::vector IndexCollection; + + void ComputeBox(VertexCollection& vertices, IndexCollection& indices, const XMFLOAT3& size, bool rhcoords, bool invertn); + void ComputeSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords, bool invertn); + void ComputeGeoSphere(VertexCollection& vertices, IndexCollection& indices, float diameter, size_t tessellation, bool rhcoords); + void ComputeCylinder(VertexCollection& vertices, IndexCollection& indices, float height, float diameter, size_t tessellation, bool rhcoords); + void ComputeCone(VertexCollection& vertices, IndexCollection& indices, float diameter, float height, size_t tessellation, bool rhcoords); + void ComputeTorus(VertexCollection& vertices, IndexCollection& indices, float diameter, float thickness, size_t tessellation, bool rhcoords); + void ComputeTetrahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeOctahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeDodecahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeIcosahedron(VertexCollection& vertices, IndexCollection& indices, float size, bool rhcoords); + void ComputeTeapot(VertexCollection& vertices, IndexCollection& indices, float size, size_t tessellation, bool rhcoords); +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Src/GraphicsMemory.cpp b/Kits/DirectXTK12/Src/GraphicsMemory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..108f0a937aa025b1bd7323e65a78819c7fbe13f3 --- /dev/null +++ b/Kits/DirectXTK12/Src/GraphicsMemory.cpp @@ -0,0 +1,365 @@ +//-------------------------------------------------------------------------------------- +// File: GraphicsMemory.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "GraphicsMemory.h" +#include "PlatformHelpers.h" +#include "LinearAllocator.h" + +#include + +using namespace DirectX; +using Microsoft::WRL::ComPtr; +using ScopedLock = std::lock_guard; + +namespace +{ + static const size_t MinPageSize = 64 * 1024; + static const size_t MinAllocSize = 4 * 1024; + static const size_t AllocatorIndexShift = 12; // start block sizes at 4KB + static const size_t AllocatorPoolCount = 21; // allocation sizes up to 2GB supported + static const size_t PoolIndexScale = 1; // multiply the allocation size this amount to push large values into the next bucket + + static_assert((1 << AllocatorIndexShift) == MinAllocSize, "1 << AllocatorIndexShift must == MinPageSize (in KiB)"); + static_assert((MinPageSize & (MinPageSize - 1)) == 0, "MinPageSize size must be a power of 2"); + static_assert((MinAllocSize & (MinAllocSize - 1)) == 0, "MinAllocSize size must be a power of 2"); + static_assert(MinAllocSize >= (4 * 1024), "MinAllocSize size must be greater than 4K"); + + inline constexpr bool WordSize64() + { + return sizeof(size_t) == 8; + } + + inline size_t NextPow2(size_t x) + { + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; +#ifdef _WIN64 + x |= x >> 32; +#endif + return ++x; + } + + inline size_t GetPoolIndexFromSize(size_t x) + { + size_t allocatorPageSize = x >> AllocatorIndexShift; + // gives a value from range: + // 0 - sub-4k allocator + // 1 - 4k allocator + // 2 - 8k allocator + // 4 - 16k allocator + // etc... + // Need to convert to an index. + DWORD bitIndex = 0; +#ifdef _WIN64 + return _BitScanForward64(&bitIndex, allocatorPageSize) ? bitIndex + 1 : 0; +#else + return _BitScanForward(&bitIndex, (DWORD)allocatorPageSize) ? bitIndex + 1 : 0; +#endif + } + + inline size_t GetPageSizeFromPoolIndex(size_t x) + { + x = (x == 0) ? 0 : x - 1; // clamp to zero + return std::max(MinPageSize, size_t(1) << (x + AllocatorIndexShift)); + } + + //-------------------------------------------------------------------------------------- + // DeviceAllocator : honors memory requests associated with a particular device + //-------------------------------------------------------------------------------------- + class DeviceAllocator + { + public: + DeviceAllocator(_In_ ComPtr device) + : mDevice(device) + { + for (size_t i = 0; i < mPools.size(); ++i) + { + size_t pageSize = GetPageSizeFromPoolIndex(i); + mPools[i] = std::make_unique( + mDevice.Get(), + pageSize); + } + } + + GraphicsResource Alloc(_In_ size_t size, _In_ size_t alignment) + { + ScopedLock lock(mMutex); + + // Which memory pool does it live in? + size_t poolSize = NextPow2((alignment + size) * PoolIndexScale); + size_t poolIndex = GetPoolIndexFromSize(poolSize); + assert(poolIndex < mPools.size()); + + // If the allocator isn't initialized yet, do so now + auto& allocator = mPools[poolIndex]; + assert(allocator != nullptr); + assert(poolSize < MinPageSize || poolSize == allocator->PageSize()); + + LinearAllocatorPage* page = allocator->FindPageForAlloc(size, alignment); + if (page == nullptr) + throw std::exception("Out of memory"); + + size_t offset = page->Suballocate(size, alignment); + + // Return the information to the user + return std::move(GraphicsResource( + page, + page->GpuAddress() + offset, + page->UploadResource(), + reinterpret_cast(page->BaseMemory()) + offset, + offset, + size)); + } + + // Submit page fences to the command queue + void KickFences(_In_ ID3D12CommandQueue* commandQueue) + { + ScopedLock lock(mMutex); + + for (auto& i : mPools) + { + if (i != nullptr) + { + i->RetirePendingPages(); + i->FenceCommittedPages(commandQueue); + } + } + } + + void GarbageCollect() + { + ScopedLock lock(mMutex); + + for (auto& i : mPools) + { + if (i != nullptr) + { + i->Shrink(); + } + } + } + + private: + ComPtr mDevice; + std::array, AllocatorPoolCount> mPools; + std::mutex mMutex; + }; +} // anonymous namespace + + +//-------------------------------------------------------------------------------------- +// GraphicsMemory::Impl +//-------------------------------------------------------------------------------------- + +class GraphicsMemory::Impl +{ +public: + Impl(GraphicsMemory* owner) + : mOwner(owner) + { + if (s_graphicsMemory) + { + throw std::exception("GraphicsMemory is a singleton"); + } + + s_graphicsMemory = this; + } + + ~Impl() + { + mDeviceAllocator.reset(); + s_graphicsMemory = nullptr; + } + + void Initialize(_In_ ID3D12Device* device) + { + mDeviceAllocator = std::make_unique(device); + } + + GraphicsResource Allocate(size_t size, size_t alignment) + { + return std::move(mDeviceAllocator->Alloc(size, alignment)); + } + + void Commit(_In_ ID3D12CommandQueue* commandQueue) + { + mDeviceAllocator->KickFences(commandQueue); + } + + void GarbageCollect() + { + mDeviceAllocator->GarbageCollect(); + } + + GraphicsMemory* mOwner; + static GraphicsMemory::Impl* s_graphicsMemory; + +private: + std::unique_ptr mDeviceAllocator; +}; + +GraphicsMemory::Impl* GraphicsMemory::Impl::s_graphicsMemory = nullptr; + + +//-------------------------------------------------------------------------------------- +// GraphicsMemory +//-------------------------------------------------------------------------------------- + +// Public constructor. +GraphicsMemory::GraphicsMemory(_In_ ID3D12Device* device) + : pImpl(new Impl(this)) +{ + pImpl->Initialize(device); +} + + +// Move constructor. +GraphicsMemory::GraphicsMemory(GraphicsMemory&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ + pImpl->mOwner = this; +} + + +// Move assignment. +GraphicsMemory& GraphicsMemory::operator= (GraphicsMemory&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + pImpl->mOwner = this; + return *this; +} + + +// Public destructor. +GraphicsMemory::~GraphicsMemory() +{ +} + +GraphicsResource GraphicsMemory::Allocate(size_t size, size_t alignment) +{ + return std::move(pImpl->Allocate(size, alignment)); +} + + +void GraphicsMemory::Commit(_In_ ID3D12CommandQueue* commandQueue) +{ + pImpl->Commit(commandQueue); +} + +void GraphicsMemory::GarbageCollect() +{ + pImpl->GarbageCollect(); +} + + +GraphicsMemory& GraphicsMemory::Get() +{ + if (!Impl::s_graphicsMemory || !Impl::s_graphicsMemory->mOwner) + throw std::exception("GraphicsMemory singleton not created"); + + return *Impl::s_graphicsMemory->mOwner; +} + + +//-------------------------------------------------------------------------------------- +// GraphicsResource smart-pointer interface +//-------------------------------------------------------------------------------------- + +GraphicsResource::GraphicsResource() + : mPage(nullptr) + , mGpuAddress {} + , mResource(nullptr) + , mMemory(nullptr) + , mBufferOffset(0) + , mSize(0) +{ +} + +GraphicsResource::GraphicsResource( + _In_ LinearAllocatorPage* page, + _In_ D3D12_GPU_VIRTUAL_ADDRESS gpuAddress, + _In_ ID3D12Resource* resource, + _In_ void* memory, + _In_ size_t offset, + _In_ size_t size) + : mPage(page) + , mGpuAddress(gpuAddress) + , mResource(resource) + , mMemory(memory) + , mBufferOffset(offset) + , mSize(size) +{ + mPage->AddRef(); +} + +GraphicsResource::GraphicsResource(GraphicsResource&& other) + : mPage(nullptr) +{ + Reset(std::move(other)); +} + +GraphicsResource::~GraphicsResource() +{ + if (mPage != nullptr) + { + mPage->Release(); + } +} + +GraphicsResource&& GraphicsResource::operator= (GraphicsResource&& other) +{ + Reset(std::move(other)); + return std::move(*this); +} + +void GraphicsResource::Reset() +{ + if (mPage != nullptr) + { + mPage->Release(); + } + + mPage = nullptr; + mGpuAddress = {}; + mResource = nullptr; + mMemory = nullptr; + mBufferOffset = 0; + mSize = 0; +} + +void GraphicsResource::Reset(GraphicsResource&& alloc) +{ + if (mPage != nullptr) + { + mPage->Release(); + } + + mGpuAddress = alloc.GpuAddress(); + mResource = alloc.Resource(); + mMemory = alloc.Memory(); + mBufferOffset = alloc.ResourceOffset(); + mSize = alloc.Size(); + mPage = alloc.mPage; + + alloc.mGpuAddress = {}; + alloc.mResource = nullptr; + alloc.mMemory = nullptr; + alloc.mBufferOffset = 0; + alloc.mSize = 0; + alloc.mPage = nullptr; +} diff --git a/Kits/DirectXTK12/Src/Keyboard.cpp b/Kits/DirectXTK12/Src/Keyboard.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d42f9defb6d8b8dd814f1b4aacd7cc7c8dcef66c --- /dev/null +++ b/Kits/DirectXTK12/Src/Keyboard.cpp @@ -0,0 +1,520 @@ +//-------------------------------------------------------------------------------------- +// File: Keyboard.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Keyboard.h" + +#include "PlatformHelpers.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +static_assert(sizeof(Keyboard::State) == (256 / 8), "Size mismatch for State"); + +namespace +{ + void KeyDown(int key, Keyboard::State& state) + { + if (key < 0 || key > 0xfe) + return; + + auto ptr = reinterpret_cast(&state); + + unsigned int bf = 1u << (key & 0x1f); + ptr[(key >> 5)] |= bf; + } + + void KeyUp(int key, Keyboard::State& state) + { + if (key < 0 || key > 0xfe) + return; + + auto ptr = reinterpret_cast(&state); + + unsigned int bf = 1u << (key & 0x1f); + ptr[(key >> 5)] &= ~bf; + } +} + + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) + +//====================================================================================== +// Windows Store or Universal Windows Platform (UWP) app implementation +//====================================================================================== + +// +// For a Windows Store app or Universal Windows Platform (UWP) app, add the following: +// +// void App::SetWindow(CoreWindow^ window ) +// { +// m_keyboard->SetWindow(window); +// } +// + +class Keyboard::Impl +{ +public: + Impl(Keyboard* owner) : + mOwner(owner) + { + mAcceleratorKeyToken.value = 0; + mActivatedToken.value = 0; + + if ( s_keyboard ) + { + throw std::exception( "Keyboard is a singleton" ); + } + + s_keyboard = this; + + memset( &mState, 0, sizeof(State) ); + } + + ~Impl() + { + s_keyboard = nullptr; + + RemoveHandlers(); + } + + void GetState(State& state) const + { + memcpy( &state, &mState, sizeof(State) ); + } + + void Reset() + { + memset( &mState, 0, sizeof(State) ); + } + + void SetWindow(ABI::Windows::UI::Core::ICoreWindow* window) + { + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::UI::Core; + + if (mWindow.Get() == window) + return; + + RemoveHandlers(); + + mWindow = window; + + if (!window) + return; + + typedef __FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowActivatedEventArgs ActivatedHandler; + HRESULT hr = window->add_Activated(Callback(Activated).Get(), &mActivatedToken); + ThrowIfFailed(hr); + + ComPtr dispatcher; + hr = window->get_Dispatcher( dispatcher.GetAddressOf() ); + ThrowIfFailed(hr); + + ComPtr keys; + hr = dispatcher.As(&keys); + ThrowIfFailed(hr); + + typedef __FITypedEventHandler_2_Windows__CUI__CCore__CCoreDispatcher_Windows__CUI__CCore__CAcceleratorKeyEventArgs AcceleratorKeyHandler; + hr = keys->add_AcceleratorKeyActivated( Callback(AcceleratorKeyEvent).Get(), &mAcceleratorKeyToken); + ThrowIfFailed(hr); + } + + State mState; + Keyboard* mOwner; + + static Keyboard::Impl* s_keyboard; + +private: + ComPtr mWindow; + + EventRegistrationToken mAcceleratorKeyToken; + EventRegistrationToken mActivatedToken; + + void RemoveHandlers() + { + if (mWindow) + { + using namespace ABI::Windows::UI::Core; + + ComPtr dispatcher; + HRESULT hr = mWindow->get_Dispatcher( dispatcher.GetAddressOf() ); + ThrowIfFailed(hr); + + mWindow->remove_Activated(mActivatedToken); + mActivatedToken.value = 0; + + ComPtr keys; + hr = dispatcher.As(&keys); + ThrowIfFailed(hr); + + keys->remove_AcceleratorKeyActivated(mAcceleratorKeyToken); + mAcceleratorKeyToken.value = 0; + } + } + + static HRESULT Activated( IInspectable *, ABI::Windows::UI::Core::IWindowActivatedEventArgs* ) + { + auto pImpl = Impl::s_keyboard; + + if (!pImpl) + return S_OK; + + pImpl->Reset(); + + return S_OK; + } + + static HRESULT AcceleratorKeyEvent( IInspectable *, ABI::Windows::UI::Core::IAcceleratorKeyEventArgs* args ) + { + using namespace ABI::Windows::System; + using namespace ABI::Windows::UI::Core; + + auto pImpl = Impl::s_keyboard; + + if (!pImpl) + return S_OK; + + CoreAcceleratorKeyEventType evtType; + HRESULT hr = args->get_EventType(&evtType); + ThrowIfFailed(hr); + + bool down = false; + + switch (evtType) + { + case CoreAcceleratorKeyEventType_KeyDown: + case CoreAcceleratorKeyEventType_SystemKeyDown: + down = true; + break; + + case CoreAcceleratorKeyEventType_KeyUp: + case CoreAcceleratorKeyEventType_SystemKeyUp: + break; + + default: + return S_OK; + } + + CorePhysicalKeyStatus status; + hr = args->get_KeyStatus(&status); + ThrowIfFailed(hr); + + VirtualKey virtualKey; + hr = args->get_VirtualKey(&virtualKey); + ThrowIfFailed(hr); + + int vk = static_cast( virtualKey ); + + switch (vk) + { + case VK_SHIFT: + vk = (status.ScanCode == 0x36) ? VK_RSHIFT : VK_LSHIFT; + if ( !down ) + { + // Workaround to ensure left vs. right shift get cleared when both were pressed at same time + KeyUp(VK_LSHIFT, pImpl->mState); + KeyUp(VK_RSHIFT, pImpl->mState); + } + break; + + case VK_CONTROL: + vk = (status.IsExtendedKey) ? VK_RCONTROL : VK_LCONTROL; + break; + + case VK_MENU: + vk = (status.IsExtendedKey) ? VK_RMENU : VK_LMENU; + break; + } + + if (down) + { + KeyDown(vk, pImpl->mState); + } + else + { + KeyUp(vk, pImpl->mState); + } + + return S_OK; + } +}; + + +Keyboard::Impl* Keyboard::Impl::s_keyboard = nullptr; + + +void Keyboard::SetWindow(ABI::Windows::UI::Core::ICoreWindow* window) +{ + pImpl->SetWindow(window); +} + +#elif defined(_XBOX_ONE) || ( defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) ) + +//====================================================================================== +// Null device for Windows Phone and Xbox One +//====================================================================================== + +class Keyboard::Impl +{ +public: + Impl(Keyboard* owner) : + mOwner(owner) + { + if ( s_keyboard ) + { + throw std::exception( "Keyboard is a singleton" ); + } + + s_keyboard = this; + } + + ~Impl() + { + s_keyboard = nullptr; + } + + void GetState(State& state) const + { + memset( &state, 0, sizeof(State) ); + } + + void Reset() + { + } + + Keyboard* mOwner; + + static Keyboard::Impl* s_keyboard; +}; + +Keyboard::Impl* Keyboard::Impl::s_keyboard = nullptr; + +#else + +//====================================================================================== +// Win32 desktop implementation +//====================================================================================== + +// +// For a Win32 desktop application, call this function from your Window Message Procedure +// +// LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +// { +// switch (message) +// { +// +// case WM_ACTIVATEAPP: +// Keyboard::ProcessMessage(message, wParam, lParam); +// break; +// +// case WM_KEYDOWN: +// case WM_SYSKEYDOWN: +// case WM_KEYUP: +// case WM_SYSKEYUP: +// Keyboard::ProcessMessage(message, wParam, lParam); +// break; +// +// } +// } +// + +class Keyboard::Impl +{ +public: + Impl(Keyboard* owner) : + mOwner(owner) + { + if ( s_keyboard ) + { + throw std::exception( "Keyboard is a singleton" ); + } + + s_keyboard = this; + + memset( &mState, 0, sizeof(State) ); + } + + ~Impl() + { + s_keyboard = nullptr; + } + + void GetState(State& state) const + { + memcpy( &state, &mState, sizeof(State) ); + } + + void Reset() + { + memset( &mState, 0, sizeof(State) ); + } + + State mState; + Keyboard* mOwner; + + static Keyboard::Impl* s_keyboard; +}; + + +Keyboard::Impl* Keyboard::Impl::s_keyboard = nullptr; + + +void Keyboard::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam) +{ + auto pImpl = Impl::s_keyboard; + + if (!pImpl) + return; + + bool down = false; + + switch (message) + { + case WM_ACTIVATEAPP: + pImpl->Reset(); + return; + + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + down = true; + break; + + case WM_KEYUP: + case WM_SYSKEYUP: + break; + + default: + return; + } + + int vk = static_cast( wParam ); + switch (vk) + { + case VK_SHIFT: + vk = MapVirtualKey((lParam & 0x00ff0000) >> 16, MAPVK_VSC_TO_VK_EX); + if ( !down ) + { + // Workaround to ensure left vs. right shift get cleared when both were pressed at same time + KeyUp(VK_LSHIFT, pImpl->mState); + KeyUp(VK_RSHIFT, pImpl->mState); + } + break; + + case VK_CONTROL: + vk = (lParam & 0x01000000) ? VK_RCONTROL : VK_LCONTROL; + break; + + case VK_MENU: + vk = (lParam & 0x01000000) ? VK_RMENU : VK_LMENU; + break; + } + + if (down) + { + KeyDown(vk, pImpl->mState); + } + else + { + KeyUp(vk, pImpl->mState); + } +} + +#endif + +#pragma warning( disable : 4355 ) + +// Public constructor. +Keyboard::Keyboard() + : pImpl( new Impl(this) ) +{ +} + + +// Move constructor. +Keyboard::Keyboard(Keyboard&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ + pImpl->mOwner = this; +} + + +// Move assignment. +Keyboard& Keyboard::operator= (Keyboard&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + pImpl->mOwner = this; + return *this; +} + + +// Public destructor. +Keyboard::~Keyboard() +{ +} + + +Keyboard::State Keyboard::GetState() const +{ + State state; + pImpl->GetState(state); + return state; +} + + +void Keyboard::Reset() +{ + pImpl->Reset(); +} + + +Keyboard& Keyboard::Get() +{ + if ( !Impl::s_keyboard || !Impl::s_keyboard->mOwner ) + throw std::exception( "Keyboard is a singleton" ); + + return *Impl::s_keyboard->mOwner; +} + + + +//====================================================================================== +// KeyboardStateTracker +//====================================================================================== + +void Keyboard::KeyboardStateTracker::Update( const State& state ) +{ + auto currPtr = reinterpret_cast(&state); + auto prevPtr = reinterpret_cast(&lastState); + auto releasedPtr = reinterpret_cast(&released); + auto pressedPtr = reinterpret_cast(&pressed); + for (size_t j = 0; j < (256 / 32); ++j) + { + *pressedPtr = *currPtr & ~(*prevPtr); + *releasedPtr = ~(*currPtr) & *prevPtr; + + ++currPtr; + ++prevPtr; + ++releasedPtr; + ++pressedPtr; + } + + lastState = state; +} + + +void Keyboard::KeyboardStateTracker::Reset() +{ + memset( this, 0, sizeof(KeyboardStateTracker) ); +} diff --git a/Kits/DirectXTK12/Src/LinearAllocator.cpp b/Kits/DirectXTK12/Src/LinearAllocator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9ecc843ac5ee2b37e2978d22e035759a3fa7fd34 --- /dev/null +++ b/Kits/DirectXTK12/Src/LinearAllocator.cpp @@ -0,0 +1,498 @@ +//-------------------------------------------------------------------------------------- +// File: LinearAllocator.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "LinearAllocator.h" + +#define VALIDATE_LISTS 0 + +#if VALIDATE_LISTS +# include +#endif + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +namespace +{ + inline size_t AlignOffset(size_t offset, size_t alignment) + { + if (alignment > 0) + { + // Alignment must be a power of 2 + assert((alignment & (alignment - 1)) == 0); + offset = (offset + alignment - 1) & ~(alignment - 1); + } + return offset; + } +} + +LinearAllocatorPage::LinearAllocatorPage() + : pPrevPage(nullptr) + , pNextPage(nullptr) + , mMemory(nullptr) + , mUploadResource(nullptr) + , mFence(nullptr) + , mPendingFence(0) + , mGpuAddress {} + , mOffset(0) + , mSize(0) + , mRefCount(0) +{ +} + +size_t LinearAllocatorPage::Suballocate(_In_ size_t size, _In_ size_t alignment) +{ + size_t offset = AlignOffset(mOffset, alignment); +#ifdef _DEBUG + if (offset + size > mSize) + throw std::exception("Out of free memory in page suballoc"); +#endif + mOffset = offset + size; + return offset; +} + +LinearAllocator::LinearAllocator( + _In_ ID3D12Device* pDevice, + _In_ size_t pageSize, + _In_ size_t preallocateBytes) + : m_pendingPages( nullptr ) + , m_usedPages( nullptr ) + , m_unusedPages( nullptr ) + , m_increment( 0 ) +{ + m_increment = pageSize; + m_usedPages = nullptr; + m_unusedPages = nullptr; + m_pendingPages = nullptr; + m_device = pDevice; + m_totalPages = 0; + m_numPending = 0; + + size_t preallocatePageCount = ( ( preallocateBytes + pageSize - 1 ) / pageSize ); + for (size_t preallocatePages = 0; preallocateBytes != 0 && preallocatePages < preallocatePageCount; ++preallocatePages ) + { + if ( GetNewPage() == nullptr ) + { + throw std::exception("Out of memory."); + } + } +} + +LinearAllocator::~LinearAllocator() +{ + // Must wait for all pending fences! + while ( m_pendingPages != nullptr ) + { + RetirePendingPages(); + } + + assert( m_pendingPages == nullptr ); + + // Return all the memory + FreePages( m_unusedPages ); + FreePages( m_usedPages ); + + m_pendingPages = nullptr; + m_usedPages = nullptr; + m_unusedPages = nullptr; + m_increment = 0; +} + +LinearAllocatorPage* LinearAllocator::FindPageForAlloc(_In_ size_t size, _In_ size_t alignment) +{ +#ifdef _DEBUG + if( size > m_increment ) + throw std::out_of_range(__FUNCTION__ " size must be less or equal to the allocator's increment"); + if( alignment > m_increment ) + throw std::out_of_range(__FUNCTION__ " alignment must be less or equal to the allocator's increment"); + if ( size == 0 ) + throw std::exception("Cannot honor zero size allocation request."); +#endif + + LinearAllocatorPage* page = GetPageForAlloc( size, alignment ); + if ( page == nullptr ) + { + throw std::exception("Out of memory."); + } + + return page; +} + +// Call this after you submit your work to the driver. +void LinearAllocator::FenceCommittedPages(_In_ ID3D12CommandQueue* commandQueue) +{ + // No pending pages + if (m_usedPages == nullptr) + return; + + // For all the used pages, fence them + UINT numReady = 0; + LinearAllocatorPage* readyPages = nullptr; + LinearAllocatorPage* unreadyPages = nullptr; + LinearAllocatorPage* nextPage = nullptr; + for (LinearAllocatorPage* page = m_usedPages; page != nullptr; page = nextPage) + { + nextPage = page->pNextPage; + + // Disconnect from the list + page->pPrevPage = nullptr; + + if (page->RefCount() == 0) + { + // Signal the fence + numReady++; + commandQueue->Signal(page->mFence.Get(), ++page->mPendingFence); + + // Link to the ready pages list + page->pNextPage = readyPages; + if (readyPages) readyPages->pPrevPage = page; + readyPages = page; + } + else + { + // Link to the unready list + page->pNextPage = unreadyPages; + if (unreadyPages) unreadyPages->pPrevPage = page; + unreadyPages = page; + } + } + + // Replace the used pages list with the new unready list + m_usedPages = unreadyPages; + + // Append all those pages from the ready list to the pending list + if (numReady > 0) + { + m_numPending += numReady; + LinkPageChain(readyPages, m_pendingPages); + } + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif +} + +// Call this once a frame after all of your driver submissions. +// (immediately before or after Present-time) +void LinearAllocator::RetirePendingPages() +{ + // For each page that we know has a fence pending, check it. If the fence has passed, + // we can mark the page for re-use. + LinearAllocatorPage* page = m_pendingPages; + while ( page != nullptr ) + { + LinearAllocatorPage* nextPage = page->pNextPage; + + assert( page->mPendingFence != 0 ); + + if ( page->mFence->GetCompletedValue() >= page->mPendingFence ) + { + // Fence has passed. It is safe to use this page again. + ReleasePage( page ); + } + + page = nextPage; + } +} + +void LinearAllocator::Shrink() +{ + FreePages( m_unusedPages ); + m_unusedPages = nullptr; + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif +} + +LinearAllocatorPage* LinearAllocator::GetCleanPageForAlloc() +{ + // Grab the first unused page, if one exists. Else, allocate a new page. + LinearAllocatorPage* page = m_unusedPages; + if (page == nullptr) + { + // Allocate a new page + page = GetNewPage(); + if (page == nullptr) + { + // OOM. + return nullptr; + } + } + + // Mark this page as used + UnlinkPage(page); + LinkPage(page, m_usedPages); + + assert(page->mOffset == 0); + + return page; +} + +LinearAllocatorPage* LinearAllocator::GetPageForAlloc( + size_t sizeBytes, + size_t alignment) +{ + // Fast path + if ( sizeBytes == m_increment && (alignment == 0 || alignment == m_increment) ) + { + return GetCleanPageForAlloc(); + } + + // Find a page in the pending pages list that has space. + LinearAllocatorPage* page = FindPageForAlloc( m_usedPages, sizeBytes, alignment ); + if ( page == nullptr ) + { + page = GetCleanPageForAlloc(); + } + + return page; +} + +LinearAllocatorPage* LinearAllocator::FindPageForAlloc( + LinearAllocatorPage* list, + size_t sizeBytes, + size_t alignment) +{ + for ( LinearAllocatorPage* page = list; page != nullptr; page = page->pNextPage ) + { + size_t offset = AlignOffset(page->mOffset, alignment); + if ( offset + sizeBytes <= m_increment ) + return page; + } + return nullptr; +} + +LinearAllocatorPage* LinearAllocator::GetNewPage() +{ + ComPtr spResource; + + CD3DX12_HEAP_PROPERTIES uploadHeapProperties( D3D12_HEAP_TYPE_UPLOAD ); + CD3DX12_RESOURCE_DESC bufferDesc = CD3DX12_RESOURCE_DESC::Buffer( m_increment ); + + // Allocate the upload heap + if (FAILED(m_device->CreateCommittedResource( + &uploadHeapProperties, + D3D12_HEAP_FLAG_NONE, + &bufferDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, + IID_GRAPHICS_PPV_ARGS(spResource.ReleaseAndGetAddressOf()) ))) + { + return nullptr; + } + + if (m_debugName.size() > 0) + { + spResource->SetName(m_debugName.c_str()); + } + + // Get a pointer to the memory + void* pMemory = nullptr; + ThrowIfFailed(spResource->Map( 0, nullptr, &pMemory )); + memset(pMemory, 0, m_increment); + + // Create a fence + ComPtr spFence; + if (FAILED(m_device->CreateFence( + 0, + D3D12_FENCE_FLAG_NONE, + IID_GRAPHICS_PPV_ARGS(spFence.ReleaseAndGetAddressOf()) ))) + { + return nullptr; + } + + // Add the page to the page list + LinearAllocatorPage* page = new LinearAllocatorPage; + page->mSize = m_increment; + page->mMemory = pMemory; + page->pPrevPage = nullptr; + page->pNextPage = m_unusedPages; + page->mUploadResource = spResource; + page->mFence = spFence; + page->mGpuAddress = spResource->GetGPUVirtualAddress(); + + // Set as head of the list + page->pNextPage = m_unusedPages; + if (m_unusedPages) m_unusedPages->pPrevPage = page; + m_unusedPages = page; + m_totalPages++; + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif + + return page; +} + +void LinearAllocator::UnlinkPage( LinearAllocatorPage* page ) +{ + if ( page->pPrevPage ) + page->pPrevPage->pNextPage = page->pNextPage; + + // Check that it isn't the head of any of our tracked lists + else if ( page == m_unusedPages ) + m_unusedPages = page->pNextPage; + else if ( page == m_usedPages ) + m_usedPages = page->pNextPage; + else if ( page == m_pendingPages ) + m_pendingPages = page->pNextPage; + + if ( page->pNextPage ) + page->pNextPage->pPrevPage = page->pPrevPage; + + page->pNextPage = nullptr; + page->pPrevPage = nullptr; + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif +} + +void LinearAllocator::LinkPageChain(LinearAllocatorPage* page, LinearAllocatorPage*& list) +{ +#if VALIDATE_LISTS + // Walk the chain and ensure it's not in the list twice + for (LinearAllocatorPage* cur = list; cur != nullptr; cur = cur->pNextPage) + { + assert(cur != page); + } +#endif + assert(page->pPrevPage == nullptr); + assert(list == nullptr || list->pPrevPage == nullptr); + + // Follow chain to the end and append + LinearAllocatorPage* lastPage = nullptr; + for (lastPage = page; lastPage->pNextPage != nullptr; lastPage = lastPage->pNextPage) {} + + lastPage->pNextPage = list; + if (list) + list->pPrevPage = lastPage; + + list = page; + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif +} + +void LinearAllocator::LinkPage( LinearAllocatorPage* page, LinearAllocatorPage*& list ) +{ +#if VALIDATE_LISTS + // Walk the chain and ensure it's not in the list twice + for ( LinearAllocatorPage* cur = list; cur != nullptr; cur = cur->pNextPage ) + { + assert( cur != page ); + } +#endif + assert(page->pNextPage == nullptr); + assert(page->pPrevPage == nullptr); + assert(list == nullptr || list->pPrevPage == nullptr); + + page->pNextPage = list; + if ( list ) + list->pPrevPage = page; + + list = page; + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif +} + +void LinearAllocator::ReleasePage( LinearAllocatorPage* page ) +{ + assert( m_numPending > 0 ); + m_numPending--; + + UnlinkPage( page ); + LinkPage( page, m_unusedPages ); + + // Reset the page offset (effectively erasing the memory) + page->mOffset = 0; + +#ifdef _DEBUG + memset( page->mMemory, 0, m_increment ); +#endif + +#if VALIDATE_LISTS + ValidatePageLists(); +#endif +} + +void LinearAllocator::FreePages( LinearAllocatorPage* page ) +{ + while ( page != nullptr ) + { + LinearAllocatorPage* nextPage = page->pNextPage; + + page->mUploadResource->Unmap( 0, nullptr ); + delete page; + + page = nextPage; + m_totalPages--; + } +} + +#if VALIDATE_LISTS +void LinearAllocator::ValidateList(LinearAllocatorPage* list) +{ + for (LinearAllocatorPage* page = list, *lastPage = nullptr; + page != nullptr; + lastPage = page, page = page->pNextPage) + { + if (page->pPrevPage != lastPage) + { + throw std::exception("Broken link to previous"); + } + } +} + +void LinearAllocator::ValidatePageLists() +{ + ValidateList(m_pendingPages); + ValidateList(m_usedPages); + ValidateList(m_unusedPages); +} +#endif + +void LinearAllocator::SetDebugName(const char* name) +{ + wchar_t wname[MAX_PATH] = {}; + int result = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, (int) strlen(name), wname, MAX_PATH); + if ( result > 0 ) + { + SetDebugName(wname); + } +} + +void LinearAllocator::SetDebugName(const wchar_t* name) +{ + m_debugName = name; + + // Rename existing pages + SetPageDebugName(m_pendingPages); + SetPageDebugName(m_usedPages); + SetPageDebugName(m_unusedPages); +} + +void LinearAllocator::SetPageDebugName(LinearAllocatorPage* list) +{ + for ( LinearAllocatorPage* page = list; page != nullptr; page = page->pNextPage ) + { + page->mUploadResource->SetName(m_debugName.c_str()); + } +} diff --git a/Kits/DirectXTK12/Src/LinearAllocator.h b/Kits/DirectXTK12/Src/LinearAllocator.h new file mode 100644 index 0000000000000000000000000000000000000000..6c6388644d5f62cb34df60cb78f1d0752fc8ebc1 --- /dev/null +++ b/Kits/DirectXTK12/Src/LinearAllocator.h @@ -0,0 +1,161 @@ +//-------------------------------------------------------------------------------------- +// LinearAllocator.h +// +// A linear allocator. When Allocate is called it will try to return you a pointer into +// existing graphics memory. If there is no space left from what is allocated, more +// pages are allocated on-the-fly. +// +// Each allocation must be smaller or equal to pageSize. It is not necessary but is most +// efficient for the sizes to be some fraction of pageSize. pageSize does not determine +// the size of the physical pages underneath the virtual memory (that's given by the +// XMemAttributes) but is how much additional memory the allocator should allocate +// each time you run out of space. +// +// preallocatePages specifies how many pages to initially allocate. Specifying zero will +// preallocate two pages by default. +// +// This class is NOT thread safe. You should protect this with the appropriate sync +// primitives or, even better, use one linear allocator per thread. +// +// Pages are freed once the GPU is done with them. As such, you need to specify when a +// page is in use and when it is no longer in use. Use RetirePages to prompt the +// allocator to check if pages are no longer being used by the GPU. Use InsertFences to +// mark all used pages as in-use by the GPU, removing them from the available pages +// list. It is recommended you call RetirePages and InsertFences once a frame, usually +// just before Present(). +// +// Why is RetirePages decoupled from InsertFences? It's possible that you might want to +// reclaim pages more frequently than locking used pages. For example, if you find the +// allocator is burning through pages too quickly you can call RetirePages to reclaim +// some that the GPU has finished with. However, this adds additional CPU overhead so it +// is left to you to decide. In most cases this is sufficient: +// +// allocator.RetirePages(); +// allocator.InsertFences( pContext, 0 ); +// DXGIXPresentArray(...); +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include + + +namespace DirectX +{ + class LinearAllocatorPage + { + public: + LinearAllocatorPage(); + + size_t Suballocate(_In_ size_t size, _In_ size_t alignment); + + void* BaseMemory() const { return mMemory; } + ID3D12Resource* UploadResource() const { return mUploadResource.Get(); } + D3D12_GPU_VIRTUAL_ADDRESS GpuAddress() const { return mGpuAddress; } + size_t BytesUsed() const { return mOffset; } + size_t Size() const { return mSize; } + + int32_t AddRef() { return mRefCount.fetch_add(1); } + int32_t Release() { assert(mRefCount > 0); return mRefCount.fetch_sub(1); } + int32_t RefCount() const { return mRefCount.load(); } + + protected: + friend class LinearAllocator; + + LinearAllocatorPage* pPrevPage; + LinearAllocatorPage* pNextPage; + + void* mMemory; + Microsoft::WRL::ComPtr mUploadResource; + Microsoft::WRL::ComPtr mFence; + uint64_t mPendingFence; + D3D12_GPU_VIRTUAL_ADDRESS mGpuAddress; + size_t mOffset; + size_t mSize; + + private: + std::atomic mRefCount; + }; + + class LinearAllocator + { + public: + // These values will be rounded up to the nearest 64k. + // You can specify zero for incrementalSizeBytes to increment + // by 1 page (64k). + LinearAllocator( + _In_ ID3D12Device* pDevice, + _In_ size_t pageSize, + _In_ size_t preallocateBytes = 0); + + LinearAllocator(const LinearAllocator& m) = delete; + LinearAllocator& operator = (const LinearAllocator& m) = delete; + + ~LinearAllocator(); + + // Allow move semantics on this object. + LinearAllocator(LinearAllocator&& m) = default; + + LinearAllocatorPage* FindPageForAlloc(_In_ size_t requestedSize, _In_ size_t alignment); + + // Call this at least once a frame to check if pages have become available. + void RetirePendingPages(); + + // Call this after you submit your work to the driver. + // (e.g. immediately before Present.) + void FenceCommittedPages(_In_ ID3D12CommandQueue* commandQueue); + + // Throws away all currently unused pages + void Shrink(); + + // Statistics + size_t CommittedPageCount() const { return m_numPending; } + size_t TotalPageCount() const { return m_totalPages; } + size_t CommittedMemoryUsage() const { return m_numPending * m_increment; } + size_t TotalMemoryUsage() const { return m_totalPages * m_increment; } + size_t PageSize() const { return m_increment; } + + // Debug info + const wchar_t* GetDebugName() const { return m_debugName.c_str(); } + void SetDebugName(const wchar_t* name); + void SetDebugName(const char* name); + + private: + std::wstring m_debugName; + Microsoft::WRL::ComPtr m_device; + LinearAllocatorPage* m_pendingPages; // Pages in use by the GPU + LinearAllocatorPage* m_usedPages; // Pages to be submitted to the GPU + LinearAllocatorPage* m_unusedPages; // Pages not being used right now + size_t m_increment; + size_t m_numPending; + size_t m_totalPages; + + LinearAllocatorPage* GetPageForAlloc(size_t sizeBytes, size_t alignment); + LinearAllocatorPage* GetCleanPageForAlloc(); + + LinearAllocatorPage* FindPageForAlloc(LinearAllocatorPage* list, size_t sizeBytes, size_t alignment); + + LinearAllocatorPage* GetNewPage(); + + void UnlinkPage(LinearAllocatorPage* page); + void LinkPage(LinearAllocatorPage* page, LinearAllocatorPage*& list); + void LinkPageChain(LinearAllocatorPage* page, LinearAllocatorPage*& list); + void ReleasePage(LinearAllocatorPage* page); + void FreePages(LinearAllocatorPage* list); + + // Debug only + static void ValidateList(LinearAllocatorPage* list); + void ValidatePageLists(); + + void SetPageDebugName(LinearAllocatorPage* list); + }; +} diff --git a/Kits/DirectXTK12/Src/LoaderHelpers.h b/Kits/DirectXTK12/Src/LoaderHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..c12c0fe71cc37b326491c6f700c2118edf258ed7 --- /dev/null +++ b/Kits/DirectXTK12/Src/LoaderHelpers.h @@ -0,0 +1,858 @@ +//-------------------------------------------------------------------------------------- +// File: LoaderHelpers.h +// +// Helper functions for texture loaders and screen grabber +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "DDS.h" +#include "DDSTextureLoader.h" + + +namespace DirectX +{ + //-------------------------------------------------------------------------------------- + // Return the BPP for a particular format + //-------------------------------------------------------------------------------------- + inline size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: + case DXGI_FORMAT_R32G32B32A32_FLOAT: + case DXGI_FORMAT_R32G32B32A32_UINT: + case DXGI_FORMAT_R32G32B32A32_SINT: + return 128; + + case DXGI_FORMAT_R32G32B32_TYPELESS: + case DXGI_FORMAT_R32G32B32_FLOAT: + case DXGI_FORMAT_R32G32B32_UINT: + case DXGI_FORMAT_R32G32B32_SINT: + return 96; + + case DXGI_FORMAT_R16G16B16A16_TYPELESS: + case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_UNORM: + case DXGI_FORMAT_R16G16B16A16_UINT: + case DXGI_FORMAT_R16G16B16A16_SNORM: + case DXGI_FORMAT_R16G16B16A16_SINT: + case DXGI_FORMAT_R32G32_TYPELESS: + case DXGI_FORMAT_R32G32_FLOAT: + case DXGI_FORMAT_R32G32_UINT: + case DXGI_FORMAT_R32G32_SINT: + case DXGI_FORMAT_R32G8X24_TYPELESS: + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: + case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: + case DXGI_FORMAT_Y416: + case DXGI_FORMAT_Y210: + case DXGI_FORMAT_Y216: + return 64; + + case DXGI_FORMAT_R10G10B10A2_TYPELESS: + case DXGI_FORMAT_R10G10B10A2_UNORM: + case DXGI_FORMAT_R10G10B10A2_UINT: + case DXGI_FORMAT_R11G11B10_FLOAT: + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + case DXGI_FORMAT_R8G8B8A8_UINT: + case DXGI_FORMAT_R8G8B8A8_SNORM: + case DXGI_FORMAT_R8G8B8A8_SINT: + case DXGI_FORMAT_R16G16_TYPELESS: + case DXGI_FORMAT_R16G16_FLOAT: + case DXGI_FORMAT_R16G16_UNORM: + case DXGI_FORMAT_R16G16_UINT: + case DXGI_FORMAT_R16G16_SNORM: + case DXGI_FORMAT_R16G16_SINT: + case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_FLOAT: + case DXGI_FORMAT_R32_UINT: + case DXGI_FORMAT_R32_SINT: + case DXGI_FORMAT_R24G8_TYPELESS: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X24_TYPELESS_G8_UINT: + case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8X8_UNORM: + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: + case DXGI_FORMAT_B8G8R8A8_TYPELESS: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + case DXGI_FORMAT_B8G8R8X8_TYPELESS: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: + case DXGI_FORMAT_AYUV: + case DXGI_FORMAT_Y410: + case DXGI_FORMAT_YUY2: + return 32; + + case DXGI_FORMAT_P010: + case DXGI_FORMAT_P016: + return 24; + + case DXGI_FORMAT_R8G8_TYPELESS: + case DXGI_FORMAT_R8G8_UNORM: + case DXGI_FORMAT_R8G8_UINT: + case DXGI_FORMAT_R8G8_SNORM: + case DXGI_FORMAT_R8G8_SINT: + case DXGI_FORMAT_R16_TYPELESS: + case DXGI_FORMAT_R16_FLOAT: + case DXGI_FORMAT_D16_UNORM: + case DXGI_FORMAT_R16_UNORM: + case DXGI_FORMAT_R16_UINT: + case DXGI_FORMAT_R16_SNORM: + case DXGI_FORMAT_R16_SINT: + case DXGI_FORMAT_B5G6R5_UNORM: + case DXGI_FORMAT_B5G5R5A1_UNORM: + case DXGI_FORMAT_A8P8: + case DXGI_FORMAT_B4G4R4A4_UNORM: + return 16; + + case DXGI_FORMAT_NV12: + case DXGI_FORMAT_420_OPAQUE: + case DXGI_FORMAT_NV11: + return 12; + + case DXGI_FORMAT_R8_TYPELESS: + case DXGI_FORMAT_R8_UNORM: + case DXGI_FORMAT_R8_UINT: + case DXGI_FORMAT_R8_SNORM: + case DXGI_FORMAT_R8_SINT: + case DXGI_FORMAT_A8_UNORM: + case DXGI_FORMAT_AI44: + case DXGI_FORMAT_IA44: + case DXGI_FORMAT_P8: + return 8; + + case DXGI_FORMAT_R1_UNORM: + return 1; + + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + return 4; + + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + return 8; + +#if defined(_XBOX_ONE) && defined(_TITLE) + + case DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT: + case DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT: + case DXGI_FORMAT_R10G10B10_SNORM_A2_UNORM: + return 32; + + case DXGI_FORMAT_D16_UNORM_S8_UINT: + case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X16_TYPELESS_G8_UINT: + return 24; + + case DXGI_FORMAT_R4G4_UNORM: + return 8; + +#endif // _XBOX_ONE && _TITLE + + default: + return 0; + } + } + + //-------------------------------------------------------------------------------------- + inline DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) + { + switch (format) + { + case DXGI_FORMAT_R8G8B8A8_UNORM: + return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + + case DXGI_FORMAT_BC1_UNORM: + return DXGI_FORMAT_BC1_UNORM_SRGB; + + case DXGI_FORMAT_BC2_UNORM: + return DXGI_FORMAT_BC2_UNORM_SRGB; + + case DXGI_FORMAT_BC3_UNORM: + return DXGI_FORMAT_BC3_UNORM_SRGB; + + case DXGI_FORMAT_B8G8R8A8_UNORM: + return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; + + case DXGI_FORMAT_B8G8R8X8_UNORM: + return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; + + case DXGI_FORMAT_BC7_UNORM: + return DXGI_FORMAT_BC7_UNORM_SRGB; + + default: + return format; + } + } + + //-------------------------------------------------------------------------------------- + inline bool IsCompressed(_In_ DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + return true; + + default: + return false; + } + } + + //-------------------------------------------------------------------------------------- + inline DXGI_FORMAT EnsureNotTypeless(DXGI_FORMAT fmt) + { + // Assumes UNORM or FLOAT; doesn't use UINT or SINT + switch (fmt) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: return DXGI_FORMAT_R32G32B32A32_FLOAT; + case DXGI_FORMAT_R32G32B32_TYPELESS: return DXGI_FORMAT_R32G32B32_FLOAT; + case DXGI_FORMAT_R16G16B16A16_TYPELESS: return DXGI_FORMAT_R16G16B16A16_UNORM; + case DXGI_FORMAT_R32G32_TYPELESS: return DXGI_FORMAT_R32G32_FLOAT; + case DXGI_FORMAT_R10G10B10A2_TYPELESS: return DXGI_FORMAT_R10G10B10A2_UNORM; + case DXGI_FORMAT_R8G8B8A8_TYPELESS: return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_R16G16_TYPELESS: return DXGI_FORMAT_R16G16_UNORM; + case DXGI_FORMAT_R32_TYPELESS: return DXGI_FORMAT_R32_FLOAT; + case DXGI_FORMAT_R8G8_TYPELESS: return DXGI_FORMAT_R8G8_UNORM; + case DXGI_FORMAT_R16_TYPELESS: return DXGI_FORMAT_R16_UNORM; + case DXGI_FORMAT_R8_TYPELESS: return DXGI_FORMAT_R8_UNORM; + case DXGI_FORMAT_BC1_TYPELESS: return DXGI_FORMAT_BC1_UNORM; + case DXGI_FORMAT_BC2_TYPELESS: return DXGI_FORMAT_BC2_UNORM; + case DXGI_FORMAT_BC3_TYPELESS: return DXGI_FORMAT_BC3_UNORM; + case DXGI_FORMAT_BC4_TYPELESS: return DXGI_FORMAT_BC4_UNORM; + case DXGI_FORMAT_BC5_TYPELESS: return DXGI_FORMAT_BC5_UNORM; + case DXGI_FORMAT_B8G8R8A8_TYPELESS: return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_B8G8R8X8_TYPELESS: return DXGI_FORMAT_B8G8R8X8_UNORM; + case DXGI_FORMAT_BC7_TYPELESS: return DXGI_FORMAT_BC7_UNORM; + default: return fmt; + } + } + + //-------------------------------------------------------------------------------------- + inline HRESULT LoadTextureDataFromFile(_In_z_ const wchar_t* fileName, + std::unique_ptr& ddsData, + DDS_HEADER** header, + uint8_t** bitData, + size_t* bitSize + ) + { + if (!header || !bitData || !bitSize) + { + return E_POINTER; + } + + // open the file +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + ScopedHandle hFile(safe_handle(CreateFile2(fileName, + GENERIC_READ, + FILE_SHARE_READ, + OPEN_EXISTING, + nullptr))); +#else + ScopedHandle hFile(safe_handle(CreateFileW(fileName, + GENERIC_READ, + FILE_SHARE_READ, + nullptr, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + nullptr))); +#endif + + if (!hFile) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + // Get the file size + FILE_STANDARD_INFO fileInfo; + if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo))) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + // File is too big for 32-bit allocation, so reject read + if (fileInfo.EndOfFile.HighPart > 0) + { + return E_FAIL; + } + + // Need at least enough data to fill the header and magic number to be a valid DDS + if (fileInfo.EndOfFile.LowPart < (sizeof(DDS_HEADER) + sizeof(uint32_t))) + { + return E_FAIL; + } + + // create enough space for the file data + ddsData.reset(new (std::nothrow) uint8_t[fileInfo.EndOfFile.LowPart]); + if (!ddsData) + { + return E_OUTOFMEMORY; + } + + // read the data in + DWORD BytesRead = 0; + if (!ReadFile(hFile.get(), + ddsData.get(), + fileInfo.EndOfFile.LowPart, + &BytesRead, + nullptr + )) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + + if (BytesRead < fileInfo.EndOfFile.LowPart) + { + return E_FAIL; + } + + // DDS files always start with the same magic number ("DDS ") + uint32_t dwMagicNumber = *(const uint32_t*)(ddsData.get()); + if (dwMagicNumber != DDS_MAGIC) + { + return E_FAIL; + } + + auto hdr = reinterpret_cast(ddsData.get() + sizeof(uint32_t)); + + // Verify header to validate DDS file + if (hdr->size != sizeof(DDS_HEADER) || + hdr->ddspf.size != sizeof(DDS_PIXELFORMAT)) + { + return E_FAIL; + } + + // Check for DX10 extension + bool bDXT10Header = false; + if ((hdr->ddspf.flags & DDS_FOURCC) && + (MAKEFOURCC('D', 'X', '1', '0') == hdr->ddspf.fourCC)) + { + // Must be long enough for both headers and magic value + if (fileInfo.EndOfFile.LowPart < (sizeof(DDS_HEADER) + sizeof(uint32_t) + sizeof(DDS_HEADER_DXT10))) + { + return E_FAIL; + } + + bDXT10Header = true; + } + + // setup the pointers in the process request + *header = hdr; + ptrdiff_t offset = sizeof(uint32_t) + sizeof(DDS_HEADER) + + (bDXT10Header ? sizeof(DDS_HEADER_DXT10) : 0); + *bitData = ddsData.get() + offset; + *bitSize = fileInfo.EndOfFile.LowPart - offset; + + return S_OK; + } + + //-------------------------------------------------------------------------------------- + // Get surface information for a particular format + //-------------------------------------------------------------------------------------- + inline void GetSurfaceInfo(_In_ size_t width, + _In_ size_t height, + _In_ DXGI_FORMAT fmt, + _Out_opt_ size_t* outNumBytes, + _Out_opt_ size_t* outRowBytes, + _Out_opt_ size_t* outNumRows) + { + size_t numBytes = 0; + size_t rowBytes = 0; + size_t numRows = 0; + + bool bc = false; + bool packed = false; + bool planar = false; + size_t bpe = 0; + switch (fmt) + { + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + bc = true; + bpe = 8; + break; + + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + case DXGI_FORMAT_BC6H_TYPELESS: + case DXGI_FORMAT_BC6H_UF16: + case DXGI_FORMAT_BC6H_SF16: + case DXGI_FORMAT_BC7_TYPELESS: + case DXGI_FORMAT_BC7_UNORM: + case DXGI_FORMAT_BC7_UNORM_SRGB: + bc = true; + bpe = 16; + break; + + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: + case DXGI_FORMAT_YUY2: + packed = true; + bpe = 4; + break; + + case DXGI_FORMAT_Y210: + case DXGI_FORMAT_Y216: + packed = true; + bpe = 8; + break; + + case DXGI_FORMAT_NV12: + case DXGI_FORMAT_420_OPAQUE: + planar = true; + bpe = 2; + break; + + case DXGI_FORMAT_P010: + case DXGI_FORMAT_P016: + planar = true; + bpe = 4; + break; + +#if defined(_XBOX_ONE) && defined(_TITLE) + + case DXGI_FORMAT_D16_UNORM_S8_UINT: + case DXGI_FORMAT_R16_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X16_TYPELESS_G8_UINT: + planar = true; + bpe = 4; + break; + +#endif + } + + if (bc) + { + size_t numBlocksWide = 0; + if (width > 0) + { + numBlocksWide = std::max(1, (width + 3) / 4); + } + size_t numBlocksHigh = 0; + if (height > 0) + { + numBlocksHigh = std::max(1, (height + 3) / 4); + } + rowBytes = numBlocksWide * bpe; + numRows = numBlocksHigh; + numBytes = rowBytes * numBlocksHigh; + } + else if (packed) + { + rowBytes = ((width + 1) >> 1) * bpe; + numRows = height; + numBytes = rowBytes * height; + } + else if (fmt == DXGI_FORMAT_NV11) + { + rowBytes = ((width + 3) >> 2) * 4; + numRows = height * 2; // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data + numBytes = rowBytes * numRows; + } + else if (planar) + { + rowBytes = ((width + 1) >> 1) * bpe; + numBytes = (rowBytes * height) + ((rowBytes * height + 1) >> 1); + numRows = height + ((height + 1) >> 1); + } + else + { + size_t bpp = BitsPerPixel(fmt); + rowBytes = (width * bpp + 7) / 8; // round up to nearest byte + numRows = height; + numBytes = rowBytes * height; + } + + if (outNumBytes) + { + *outNumBytes = numBytes; + } + if (outRowBytes) + { + *outRowBytes = rowBytes; + } + if (outNumRows) + { + *outNumRows = numRows; + } + } + + //-------------------------------------------------------------------------------------- + #define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a ) + + inline DXGI_FORMAT GetDXGIFormat(const DDS_PIXELFORMAT& ddpf) + { + if (ddpf.flags & DDS_RGB) + { + // Note that sRGB formats are written using the "DX10" extended header + + switch (ddpf.RGBBitCount) + { + case 32: + if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) + { + return DXGI_FORMAT_R8G8B8A8_UNORM; + } + + if (ISBITMASK(0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000)) + { + return DXGI_FORMAT_B8G8R8A8_UNORM; + } + + if (ISBITMASK(0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000)) + { + return DXGI_FORMAT_B8G8R8X8_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x000000ff,0x0000ff00,0x00ff0000,0x00000000) aka D3DFMT_X8B8G8R8 + + // Note that many common DDS reader/writers (including D3DX) swap the + // the RED/BLUE masks for 10:10:10:2 formats. We assume + // below that the 'backwards' header mask is being used since it is most + // likely written by D3DX. The more robust solution is to use the 'DX10' + // header extension and specify the DXGI_FORMAT_R10G10B10A2_UNORM format directly + + // For 'correct' writers, this should be 0x000003ff,0x000ffc00,0x3ff00000 for RGB data + if (ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000)) + { + return DXGI_FORMAT_R10G10B10A2_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x000003ff,0x000ffc00,0x3ff00000,0xc0000000) aka D3DFMT_A2R10G10B10 + + if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R16G16_UNORM; + } + + if (ISBITMASK(0xffffffff, 0x00000000, 0x00000000, 0x00000000)) + { + // Only 32-bit color channel format in D3D9 was R32F + return DXGI_FORMAT_R32_FLOAT; // D3DX writes this out as a FourCC of 114 + } + break; + + case 24: + // No 24bpp DXGI formats aka D3DFMT_R8G8B8 + break; + + case 16: + if (ISBITMASK(0x7c00, 0x03e0, 0x001f, 0x8000)) + { + return DXGI_FORMAT_B5G5R5A1_UNORM; + } + if (ISBITMASK(0xf800, 0x07e0, 0x001f, 0x0000)) + { + return DXGI_FORMAT_B5G6R5_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x7c00,0x03e0,0x001f,0x0000) aka D3DFMT_X1R5G5B5 + + if (ISBITMASK(0x0f00, 0x00f0, 0x000f, 0xf000)) + { + return DXGI_FORMAT_B4G4R4A4_UNORM; + } + + // No DXGI format maps to ISBITMASK(0x0f00,0x00f0,0x000f,0x0000) aka D3DFMT_X4R4G4B4 + + // No 3:3:2, 3:3:2:8, or paletted DXGI formats aka D3DFMT_A8R3G3B2, D3DFMT_R3G3B2, D3DFMT_P8, D3DFMT_A8P8, etc. + break; + } + } + else if (ddpf.flags & DDS_LUMINANCE) + { + if (8 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x000000ff, 0x00000000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R8_UNORM; // D3DX10/11 writes this out as DX10 extension + } + + // No DXGI format maps to ISBITMASK(0x0f,0x00,0x00,0xf0) aka D3DFMT_A4L4 + } + + if (16 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x0000ffff, 0x00000000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R16_UNORM; // D3DX10/11 writes this out as DX10 extension + } + if (ISBITMASK(0x000000ff, 0x00000000, 0x00000000, 0x0000ff00)) + { + return DXGI_FORMAT_R8G8_UNORM; // D3DX10/11 writes this out as DX10 extension + } + } + } + else if (ddpf.flags & DDS_ALPHA) + { + if (8 == ddpf.RGBBitCount) + { + return DXGI_FORMAT_A8_UNORM; + } + } + else if (ddpf.flags & DDS_BUMPDUDV) + { + if (16 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x00ff, 0xff00, 0x0000, 0x0000)) + { + return DXGI_FORMAT_R8G8_SNORM; // D3DX10/11 writes this out as DX10 extension + } + } + + if (32 == ddpf.RGBBitCount) + { + if (ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)) + { + return DXGI_FORMAT_R8G8B8A8_SNORM; // D3DX10/11 writes this out as DX10 extension + } + if (ISBITMASK(0x0000ffff, 0xffff0000, 0x00000000, 0x00000000)) + { + return DXGI_FORMAT_R16G16_SNORM; // D3DX10/11 writes this out as DX10 extension + } + + // No DXGI format maps to ISBITMASK(0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000) aka D3DFMT_A2W10V10U10 + } + } + else if (ddpf.flags & DDS_FOURCC) + { + if (MAKEFOURCC('D', 'X', 'T', '1') == ddpf.fourCC) + { + return DXGI_FORMAT_BC1_UNORM; + } + if (MAKEFOURCC('D', 'X', 'T', '3') == ddpf.fourCC) + { + return DXGI_FORMAT_BC2_UNORM; + } + if (MAKEFOURCC('D', 'X', 'T', '5') == ddpf.fourCC) + { + return DXGI_FORMAT_BC3_UNORM; + } + + // While pre-multiplied alpha isn't directly supported by the DXGI formats, + // they are basically the same as these BC formats so they can be mapped + if (MAKEFOURCC('D', 'X', 'T', '2') == ddpf.fourCC) + { + return DXGI_FORMAT_BC2_UNORM; + } + if (MAKEFOURCC('D', 'X', 'T', '4') == ddpf.fourCC) + { + return DXGI_FORMAT_BC3_UNORM; + } + + if (MAKEFOURCC('A', 'T', 'I', '1') == ddpf.fourCC) + { + return DXGI_FORMAT_BC4_UNORM; + } + if (MAKEFOURCC('B', 'C', '4', 'U') == ddpf.fourCC) + { + return DXGI_FORMAT_BC4_UNORM; + } + if (MAKEFOURCC('B', 'C', '4', 'S') == ddpf.fourCC) + { + return DXGI_FORMAT_BC4_SNORM; + } + + if (MAKEFOURCC('A', 'T', 'I', '2') == ddpf.fourCC) + { + return DXGI_FORMAT_BC5_UNORM; + } + if (MAKEFOURCC('B', 'C', '5', 'U') == ddpf.fourCC) + { + return DXGI_FORMAT_BC5_UNORM; + } + if (MAKEFOURCC('B', 'C', '5', 'S') == ddpf.fourCC) + { + return DXGI_FORMAT_BC5_SNORM; + } + + // BC6H and BC7 are written using the "DX10" extended header + + if (MAKEFOURCC('R', 'G', 'B', 'G') == ddpf.fourCC) + { + return DXGI_FORMAT_R8G8_B8G8_UNORM; + } + if (MAKEFOURCC('G', 'R', 'G', 'B') == ddpf.fourCC) + { + return DXGI_FORMAT_G8R8_G8B8_UNORM; + } + + if (MAKEFOURCC('Y', 'U', 'Y', '2') == ddpf.fourCC) + { + return DXGI_FORMAT_YUY2; + } + + // Check for D3DFORMAT enums being set here + switch (ddpf.fourCC) + { + case 36: // D3DFMT_A16B16G16R16 + return DXGI_FORMAT_R16G16B16A16_UNORM; + + case 110: // D3DFMT_Q16W16V16U16 + return DXGI_FORMAT_R16G16B16A16_SNORM; + + case 111: // D3DFMT_R16F + return DXGI_FORMAT_R16_FLOAT; + + case 112: // D3DFMT_G16R16F + return DXGI_FORMAT_R16G16_FLOAT; + + case 113: // D3DFMT_A16B16G16R16F + return DXGI_FORMAT_R16G16B16A16_FLOAT; + + case 114: // D3DFMT_R32F + return DXGI_FORMAT_R32_FLOAT; + + case 115: // D3DFMT_G32R32F + return DXGI_FORMAT_R32G32_FLOAT; + + case 116: // D3DFMT_A32B32G32R32F + return DXGI_FORMAT_R32G32B32A32_FLOAT; + } + } + + return DXGI_FORMAT_UNKNOWN; + } + + #undef ISBITMASK + + //-------------------------------------------------------------------------------------- + inline DirectX::DDS_ALPHA_MODE GetAlphaMode(_In_ const DDS_HEADER* header) + { + if (header->ddspf.flags & DDS_FOURCC) + { + if (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC) + { + auto d3d10ext = reinterpret_cast((const char*)header + sizeof(DDS_HEADER)); + auto mode = static_cast(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK); + switch (mode) + { + case DDS_ALPHA_MODE_STRAIGHT: + case DDS_ALPHA_MODE_PREMULTIPLIED: + case DDS_ALPHA_MODE_OPAQUE: + case DDS_ALPHA_MODE_CUSTOM: + return mode; + } + } + else if ((MAKEFOURCC('D', 'X', 'T', '2') == header->ddspf.fourCC) + || (MAKEFOURCC('D', 'X', 'T', '4') == header->ddspf.fourCC)) + { + return DDS_ALPHA_MODE_PREMULTIPLIED; + } + } + + return DDS_ALPHA_MODE_UNKNOWN; + } + + //-------------------------------------------------------------------------------------- + class auto_delete_file + { + public: + auto_delete_file(HANDLE hFile) : m_handle(hFile) {} + + auto_delete_file(const auto_delete_file&) = delete; + auto_delete_file& operator=(const auto_delete_file&) = delete; + + ~auto_delete_file() + { + if (m_handle) + { + FILE_DISPOSITION_INFO info = {}; + info.DeleteFile = TRUE; + (void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); + } + } + + void clear() { m_handle = 0; } + + private: + HANDLE m_handle; + }; + + class auto_delete_file_wic + { + public: + auto_delete_file_wic(Microsoft::WRL::ComPtr& hFile, LPCWSTR szFile) : m_handle(hFile), m_filename(szFile) {} + + auto_delete_file_wic(const auto_delete_file_wic&) = delete; + auto_delete_file_wic& operator=(const auto_delete_file_wic&) = delete; + + ~auto_delete_file_wic() + { + if (m_filename) + { + m_handle.Reset(); + DeleteFileW(m_filename); + } + } + + void clear() { m_filename = 0; } + + private: + LPCWSTR m_filename; + Microsoft::WRL::ComPtr& m_handle; + }; +} \ No newline at end of file diff --git a/Kits/DirectXTK12/Src/Model.cpp b/Kits/DirectXTK12/Src/Model.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a94bd7c65771a0b69bba723609a7b85deb7c14d4 --- /dev/null +++ b/Kits/DirectXTK12/Src/Model.cpp @@ -0,0 +1,279 @@ +//-------------------------------------------------------------------------------------- +// File: Model.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Model.h" + +#include "CommonStates.h" +#include "DirectXHelpers.h" +#include "Effects.h" +#include "PlatformHelpers.h" +#include "DescriptorHeap.h" + +using namespace DirectX; + +#ifndef _CPPRTTI +#error Model requires RTTI +#endif + + +//-------------------------------------------------------------------------------------- +// ModelMeshPart +//-------------------------------------------------------------------------------------- + +ModelMeshPart::ModelMeshPart() : + indexCount(0), + startIndex(0), + vertexOffset(0), + vertexStride(0), + primitiveType(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST), + indexFormat(DXGI_FORMAT_R16_UINT), + isAlpha(false) +{ +} + + +ModelMeshPart::~ModelMeshPart() +{ +} + + +_Use_decl_annotations_ +void ModelMeshPart::Draw(_In_ ID3D12GraphicsCommandList* commandList) const +{ + D3D12_VERTEX_BUFFER_VIEW vbv; + vbv.BufferLocation = vertexBuffer.GpuAddress(); + vbv.StrideInBytes = vertexStride; + vbv.SizeInBytes = (UINT)vertexBuffer.Size(); + commandList->IASetVertexBuffers(0, 1, &vbv); + + D3D12_INDEX_BUFFER_VIEW ibv; + ibv.BufferLocation = indexBuffer.GpuAddress(); + ibv.SizeInBytes = (UINT)indexBuffer.Size(); + ibv.Format = indexFormat; + commandList->IASetIndexBuffer(&ibv); + + commandList->IASetPrimitiveTopology(primitiveType); + + commandList->DrawIndexedInstanced( indexCount, 1, startIndex, vertexOffset, 0 ); +} + +_Use_decl_annotations_ +void ModelMeshPart::DrawMeshParts(ID3D12GraphicsCommandList* commandList, const ModelMeshPart::Collection& meshParts) +{ + for ( auto it = meshParts.cbegin(); it != meshParts.cend(); ++it ) + { + auto part = (*it).get(); + assert( part != 0 ); + + part->Draw(commandList); + } +} + + +_Use_decl_annotations_ +void ModelMeshPart::DrawMeshParts(ID3D12GraphicsCommandList* commandList, const ModelMeshPart::Collection& meshParts, ModelMeshPart::DrawCallback callback) +{ + for ( auto it = meshParts.cbegin(); it != meshParts.cend(); ++it ) + { + auto part = (*it).get(); + assert( part != 0 ); + + callback(commandList, *part); + part->Draw(commandList); + } +} + + +_Use_decl_annotations_ +void ModelMeshPart::DrawMeshParts(ID3D12GraphicsCommandList* commandList, const ModelMeshPart::Collection& meshParts, IEffect* effect) +{ + effect->Apply(commandList); + DrawMeshParts(commandList, meshParts); +} + + +//-------------------------------------------------------------------------------------- +// ModelMesh +//-------------------------------------------------------------------------------------- + +ModelMesh::ModelMesh() : + ccw(true), + pmalpha(true) +{ +} + + +ModelMesh::~ModelMesh() +{ +} + +// Draw the mesh +void __cdecl ModelMesh::DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList) const +{ + ModelMeshPart::DrawMeshParts(commandList, opaqueMeshParts); +} +void __cdecl ModelMesh::DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList) const +{ + ModelMeshPart::DrawMeshParts(commandList, alphaMeshParts); +} + +// Draw the mesh with an effect +void __cdecl ModelMesh::DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, _In_ IEffect* effect) const +{ + ModelMeshPart::DrawMeshParts(commandList, opaqueMeshParts, effect); +} +void __cdecl ModelMesh::DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, _In_ IEffect* effect) const +{ + ModelMeshPart::DrawMeshParts(commandList, alphaMeshParts, effect); +} + +// Draw the mesh with a callback for each mesh part +void __cdecl ModelMesh::DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, ModelMeshPart::DrawCallback callback) const +{ + ModelMeshPart::DrawMeshParts(commandList, opaqueMeshParts, callback); +} +void __cdecl ModelMesh::DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, ModelMeshPart::DrawCallback callback) const +{ + ModelMeshPart::DrawMeshParts(commandList, alphaMeshParts, callback); +} + + +//-------------------------------------------------------------------------------------- +// Model +//-------------------------------------------------------------------------------------- +Model::Model() +{ +} + + +Model::~Model() +{ +} + + +// Load texture resources +void Model::LoadTextures(_In_ IEffectTextureFactory& texFactory, _In_opt_ int destinationDescriptorOffset) +{ + for (size_t i = 0; i < textureNames.size(); ++i) + { + texFactory.CreateTexture(textureNames[i].c_str(), destinationDescriptorOffset + (int) i); + } +} + + +// Load texture resources (helper function) +std::unique_ptr Model::LoadTextures(_In_ ID3D12Device* device, _Inout_ ResourceUploadBatch& resourceUploadBatch, _In_opt_z_ const wchar_t* texturesPath, _In_opt_ D3D12_DESCRIPTOR_HEAP_FLAGS flags) +{ + if (textureNames.size() == 0) + return nullptr; + + std::unique_ptr texFactory = std::make_unique( + device, + resourceUploadBatch, + textureNames.size(), + flags); + if (texturesPath != nullptr && *texturesPath != 0) + { + texFactory->SetDirectory(texturesPath); + } + + LoadTextures(*texFactory); + + return std::move(texFactory); +} + + +// Create effects for each mesh piece +std::vector> Model::CreateEffects( + _In_ IEffectFactory& fxFactory, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_opt_ int descriptorOffset) +{ + std::vector> effects; + effects.reserve(materials.size()); + + for (const auto& mesh : meshes) + { + assert(mesh != nullptr); + + for (const auto& part : mesh->opaqueMeshParts) + { + assert(part != nullptr); + + if (part->materialIndex == ~0ull) + continue; + + effects.push_back(CreateEffectForMeshPart(fxFactory, pipelineState, descriptorOffset, part.get())); + } + + for (const auto& part : mesh->alphaMeshParts) + { + assert(part != nullptr); + + if (part->materialIndex == ~0ull) + continue; + + effects.push_back(CreateEffectForMeshPart(fxFactory, pipelineState, descriptorOffset, part.get())); + } + } + + return std::move(effects); +} + +// Creates an effect for a mesh part +std::shared_ptr Model::CreateEffectForMeshPart( + _In_ IEffectFactory& fxFactory, + _In_ const EffectPipelineStateDescription& pipelineState, + _In_opt_ int descriptorOffset, + _In_ const ModelMeshPart* part) const +{ + assert(part->materialIndex < materials.size()); + + const auto& m = materials[part->materialIndex]; + + D3D12_INPUT_LAYOUT_DESC il = {}; + il.NumElements = (uint32_t) part->vbDecl->size(); + il.pInputElementDescs = part->vbDecl->data(); + + return fxFactory.CreateEffect(m, pipelineState, il, descriptorOffset); +} + +// Create effects for each mesh piece with the default factory +std::vector> Model::CreateEffects( + _In_ const EffectPipelineStateDescription& pipelineState, + _In_ ID3D12DescriptorHeap* gpuVisibleTextureDescriptorHeap, + _In_opt_ int descriptorOffset) +{ + EffectFactory fxFactory(gpuVisibleTextureDescriptorHeap); + return CreateEffects(fxFactory, pipelineState, descriptorOffset); +} + +// Updates effect matrices (if applicable) +void XM_CALLCONV Model::UpdateEffectMatrices( + _In_ std::vector>& effectList, + DirectX::FXMMATRIX world, + DirectX::CXMMATRIX view, + DirectX::CXMMATRIX proj) +{ + for (auto& fx : effectList) + { + IEffectMatrices* matFx = dynamic_cast(fx.get()); + if (matFx != nullptr) + { + matFx->SetWorld(world); + matFx->SetView(view); + matFx->SetProjection(proj); + } + } +} diff --git a/Kits/DirectXTK12/Src/ModelLoadSDKMESH.cpp b/Kits/DirectXTK12/Src/ModelLoadSDKMESH.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8df725f468d4eb87b792b16b11184a5b59754fdb --- /dev/null +++ b/Kits/DirectXTK12/Src/ModelLoadSDKMESH.cpp @@ -0,0 +1,576 @@ +//-------------------------------------------------------------------------------------- +// File: ModelLoadSDKMESH.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Model.h" + +#include "Effects.h" +#include "VertexTypes.h" + +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "BinaryReader.h" +#include "DescriptorHeap.h" + +#include "SDKMesh.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +namespace +{ + int GetUniqueTextureIndex(const wchar_t* textureName, std::map& textureDictionary) + { + if (textureName == nullptr || !textureName[0]) + return -1; + + auto i = textureDictionary.find(textureName); + if (i == std::cend(textureDictionary)) + { + int index = (int) textureDictionary.size(); + textureDictionary[textureName] = index; + return index; + } + else + { + return i->second; + } + } + + void InitMaterial( + _In_ const DXUT::SDKMESH_MATERIAL& mh, + _In_ bool perVertexColor, + _In_ bool enableSkinning, + _In_ bool enableDualTexture, + _In_ bool isPremultipliedAlpha, + _Out_ Model::ModelMaterialInfo& m, + _Inout_ std::map& textureDictionary) + { + wchar_t matName[DXUT::MAX_MATERIAL_NAME]; + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mh.Name, -1, matName, DXUT::MAX_MATERIAL_NAME); + + wchar_t txtName[DXUT::MAX_TEXTURE_NAME]; + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mh.DiffuseTexture, -1, txtName, DXUT::MAX_TEXTURE_NAME); + + wchar_t txtName2[DXUT::MAX_TEXTURE_NAME]; + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mh.SpecularTexture, -1, txtName2, DXUT::MAX_TEXTURE_NAME); + + if (!mh.SpecularTexture[0] && enableDualTexture) + { + DebugTrace("WARNING: Material '%s' has multiple texture coords but not multiple textures\n", mh.Name); + enableDualTexture = false; + } + + m = {}; + m.name = matName; + m.perVertexColor = perVertexColor; + m.enableSkinning = enableSkinning; + m.enableDualTexture = enableDualTexture; + m.isPremultipliedAlpha = isPremultipliedAlpha; + m.ambientColor = XMFLOAT3(mh.Ambient.x, mh.Ambient.y, mh.Ambient.z); + m.diffuseColor = XMFLOAT3(mh.Diffuse.x, mh.Diffuse.y, mh.Diffuse.z); + m.emissiveColor = XMFLOAT3(mh.Emissive.x, mh.Emissive.y, mh.Emissive.z); + + if (mh.Diffuse.w != 1.f && mh.Diffuse.w != 0.f) + { + m.alphaValue = mh.Diffuse.w; + } + else + m.alphaValue = 1.f; + + if (mh.Power) + { + m.specularPower = mh.Power; + m.specularColor = XMFLOAT3(mh.Specular.x, mh.Specular.y, mh.Specular.z); + } + + m.textureIndex = GetUniqueTextureIndex(txtName, textureDictionary); + m.textureIndex2 = GetUniqueTextureIndex(txtName2, textureDictionary); + } + + + //-------------------------------------------------------------------------------------- + // Direct3D 9 Vertex Declaration to Direct3D 12 Input Layout mapping + + void GetInputLayoutDesc(_In_reads_(32) const DXUT::D3DVERTEXELEMENT9 decl[], std::vector& inputDesc, + bool &perVertexColor, bool& enableSkinning, bool& dualTexture) + { + static const D3D12_INPUT_ELEMENT_DESC elements[] = + { + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "BINORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "BLENDINDICES",0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "BLENDWEIGHT", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + using namespace DXUT; + + uint32_t offset = 0; + uint32_t texcoords = 0; + + bool posfound = false; + + for (uint32_t index = 0; index < DXUT::MAX_VERTEX_ELEMENTS; ++index) + { + if (decl[index].Usage == 0xFF) + break; + + if (decl[index].Type == D3DDECLTYPE_UNUSED) + break; + + if (decl[index].Offset != offset) + break; + + if (decl[index].Usage == D3DDECLUSAGE_POSITION && decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[0]); + offset += 12; + posfound = true; + } + else if (decl[index].Usage == D3DDECLUSAGE_NORMAL) + { + if (decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[1]); + offset += 12; + } + else if (decl[index].Type == D3DDECLTYPE_FLOAT16_4) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[1]; + desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_SHORT4N) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[1]; + desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[1]; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + inputDesc.push_back(desc); + offset += 4; + } + else + break; + } + else if (decl[index].Usage == D3DDECLUSAGE_COLOR && decl[index].Type == D3DDECLTYPE_D3DCOLOR) + { + inputDesc.push_back(elements[2]); + offset += 4; + perVertexColor = true; + } + else if (decl[index].Usage == D3DDECLUSAGE_TANGENT) + { + if (decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[3]); + offset += 12; + } + else if (decl[index].Type == D3DDECLTYPE_FLOAT16_4) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[3]; + desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_SHORT4N) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[3]; + desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[3]; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + inputDesc.push_back(desc); + offset += 4; + } + else + break; + } + else if (decl[index].Usage == D3DDECLUSAGE_BINORMAL) + { + if (decl[index].Type == D3DDECLTYPE_FLOAT3) + { + inputDesc.push_back(elements[4]); + offset += 12; + } + else if (decl[index].Type == D3DDECLTYPE_FLOAT16_4) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[4]; + desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_SHORT4N) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[4]; + desc.Format = DXGI_FORMAT_R16G16B16A16_SNORM; + inputDesc.push_back(desc); + offset += 8; + } + else if (decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[4]; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + inputDesc.push_back(desc); + offset += 4; + } + else + break; + } + else if (decl[index].Usage == D3DDECLUSAGE_TEXCOORD) + { + D3D12_INPUT_ELEMENT_DESC desc = elements[5]; + desc.SemanticIndex = decl[index].UsageIndex; + + bool unk = false; + switch (decl[index].Type) + { + case D3DDECLTYPE_FLOAT2: offset += 8; break; + case D3DDECLTYPE_FLOAT1: desc.Format = DXGI_FORMAT_R32_FLOAT; offset += 4; break; + case D3DDECLTYPE_FLOAT3: desc.Format = DXGI_FORMAT_R32G32B32_FLOAT; offset += 12; break; + case D3DDECLTYPE_FLOAT4: desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; offset += 16; break; + case D3DDECLTYPE_FLOAT16_2: desc.Format = DXGI_FORMAT_R16G16_FLOAT; offset += 4; break; + case D3DDECLTYPE_FLOAT16_4: desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; offset += 8; break; + + default: + unk = true; + break; + } + + if (unk) + break; + + ++texcoords; + + inputDesc.push_back(desc); + } + else if (decl[index].Usage == D3DDECLUSAGE_BLENDINDICES && decl[index].Type == D3DDECLTYPE_UBYTE4) + { + enableSkinning = true; + inputDesc.push_back(elements[6]); + offset += 4; + } + else if (decl[index].Usage == D3DDECLUSAGE_BLENDWEIGHT && decl[index].Type == D3DDECLTYPE_UBYTE4N) + { + enableSkinning = true; + inputDesc.push_back(elements[7]); + offset += 4; + } + else + break; + } + + if (!posfound) + throw std::exception("SV_Position is required"); + + if (texcoords == 2) + { + dualTexture = true; + } + } +} + +//====================================================================================== +// Model Loader +//====================================================================================== + +_Use_decl_annotations_ +std::unique_ptr DirectX::Model::CreateFromSDKMESH( const uint8_t* meshData, size_t dataSize, bool ccw, bool pmalpha ) +{ + if ( !meshData ) + throw std::exception("meshData cannot be null"); + + // File Headers + if ( dataSize < sizeof(DXUT::SDKMESH_HEADER) ) + throw std::exception("End of file"); + auto header = reinterpret_cast( meshData ); + + size_t headerSize = sizeof( DXUT::SDKMESH_HEADER ) + + header->NumVertexBuffers * sizeof(DXUT::SDKMESH_VERTEX_BUFFER_HEADER) + + header->NumIndexBuffers * sizeof(DXUT::SDKMESH_INDEX_BUFFER_HEADER); + if ( header->HeaderSize != headerSize ) + throw std::exception("Not a valid SDKMESH file"); + + if ( dataSize < header->HeaderSize ) + throw std::exception("End of file"); + + if( header->Version != DXUT::SDKMESH_FILE_VERSION ) + throw std::exception("Not a supported SDKMESH version"); + + if ( header->IsBigEndian ) + throw std::exception("Loading BigEndian SDKMESH files not supported"); + + if ( !header->NumMeshes ) + throw std::exception("No meshes found"); + + if ( !header->NumVertexBuffers ) + throw std::exception("No vertex buffers found"); + + if ( !header->NumIndexBuffers ) + throw std::exception("No index buffers found"); + + if ( !header->NumTotalSubsets ) + throw std::exception("No subsets found"); + + if ( !header->NumMaterials ) + throw std::exception("No materials found"); + + // Sub-headers + if ( dataSize < header->VertexStreamHeadersOffset + || ( dataSize < (header->VertexStreamHeadersOffset + header->NumVertexBuffers * sizeof(DXUT::SDKMESH_VERTEX_BUFFER_HEADER) ) ) ) + throw std::exception("End of file"); + auto vbArray = reinterpret_cast( meshData + header->VertexStreamHeadersOffset ); + + if ( dataSize < header->IndexStreamHeadersOffset + || ( dataSize < (header->IndexStreamHeadersOffset + header->NumIndexBuffers * sizeof(DXUT::SDKMESH_INDEX_BUFFER_HEADER) ) ) ) + throw std::exception("End of file"); + auto ibArray = reinterpret_cast( meshData + header->IndexStreamHeadersOffset ); + + if ( dataSize < header->MeshDataOffset + || ( dataSize < (header->MeshDataOffset + header->NumMeshes * sizeof(DXUT::SDKMESH_MESH) ) ) ) + throw std::exception("End of file"); + auto meshArray = reinterpret_cast( meshData + header->MeshDataOffset ); + + if ( dataSize < header->SubsetDataOffset + || ( dataSize < (header->SubsetDataOffset + header->NumTotalSubsets * sizeof(DXUT::SDKMESH_SUBSET) ) ) ) + throw std::exception("End of file"); + auto subsetArray = reinterpret_cast( meshData + header->SubsetDataOffset ); + + if ( dataSize < header->FrameDataOffset + || (dataSize < (header->FrameDataOffset + header->NumFrames * sizeof(DXUT::SDKMESH_FRAME) ) ) ) + throw std::exception("End of file"); + // TODO - auto frameArray = reinterpret_cast( meshData + header->FrameDataOffset ); + + if ( dataSize < header->MaterialDataOffset + || (dataSize < (header->MaterialDataOffset + header->NumMaterials * sizeof(DXUT::SDKMESH_MATERIAL) ) ) ) + throw std::exception("End of file"); + auto materialArray = reinterpret_cast( meshData + header->MaterialDataOffset ); + + // Buffer data + uint64_t bufferDataOffset = header->HeaderSize + header->NonBufferDataSize; + if ( ( dataSize < bufferDataOffset ) + || ( dataSize < bufferDataOffset + header->BufferDataSize ) ) + throw std::exception("End of file"); + const uint8_t* bufferData = meshData + bufferDataOffset; + + // Create vertex buffers + std::vector>> vbDecls; + vbDecls.resize( header->NumVertexBuffers ); + + std::vector perVertexColor; + perVertexColor.resize( header->NumVertexBuffers ); + + std::vector enableSkinning; + enableSkinning.resize( header->NumVertexBuffers ); + + std::vector enableDualTexture; + enableDualTexture.resize( header->NumVertexBuffers ); + + for( UINT j=0; j < header->NumVertexBuffers; ++j ) + { + auto& vh = vbArray[j]; + + if ( dataSize < vh.DataOffset + || ( dataSize < vh.DataOffset + vh.SizeBytes ) ) + throw std::exception("End of file"); + + vbDecls[j] = std::make_shared>(); + bool vertColor = false; + bool skinning = false; + bool dualTexture = false; + GetInputLayoutDesc( vh.Decl, *vbDecls[j].get(), vertColor, skinning, dualTexture ); + perVertexColor[j] = vertColor; + enableSkinning[j] = skinning; + enableDualTexture[j] = dualTexture; + } + + // Validate index buffers + for (UINT j = 0; j < header->NumIndexBuffers; ++j) + { + auto& ih = ibArray[j]; + + if (dataSize < ih.DataOffset + || (dataSize < ih.DataOffset + ih.SizeBytes)) + throw std::exception("End of file"); + + if (ih.IndexType != DXUT::IT_16BIT && ih.IndexType != DXUT::IT_32BIT) + throw std::exception("Invalid index buffer type found"); + } + + // Create meshes + std::vector materials; + materials.resize( header->NumMaterials ); + + std::map textureDictionary; + + std::unique_ptr model(new Model); + model->meshes.reserve( header->NumMeshes ); + + for( UINT meshIndex = 0; meshIndex < header->NumMeshes; ++meshIndex ) + { + auto& mh = meshArray[ meshIndex ]; + + if ( !mh.NumSubsets + || !mh.NumVertexBuffers + || mh.IndexBuffer >= header->NumIndexBuffers + || mh.VertexBuffers[0] >= header->NumVertexBuffers ) + throw std::exception("Invalid mesh found"); + + // mh.NumVertexBuffers is sometimes not what you'd expect, so we skip validating it + + if ( dataSize < mh.SubsetOffset + || (dataSize < mh.SubsetOffset + mh.NumSubsets*sizeof(UINT) ) ) + throw std::exception("End of file"); + + auto subsets = reinterpret_cast( meshData + mh.SubsetOffset ); + + if ( mh.NumFrameInfluences > 0 ) + { + if ( dataSize < mh.FrameInfluenceOffset + || (dataSize < mh.FrameInfluenceOffset + mh.NumFrameInfluences*sizeof(UINT) ) ) + throw std::exception("End of file"); + + // TODO - auto influences = reinterpret_cast( meshData + mh.FrameInfluenceOffset ); + } + + auto mesh = std::make_shared(); + wchar_t meshName[ DXUT::MAX_MESH_NAME ]; + MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, mh.Name, -1, meshName, DXUT::MAX_MESH_NAME ); + mesh->name = meshName; + mesh->ccw = ccw; + mesh->pmalpha = pmalpha; + + // Extents + mesh->boundingBox.Center = mh.BoundingBoxCenter; + mesh->boundingBox.Extents = mh.BoundingBoxExtents; + BoundingSphere::CreateFromBoundingBox( mesh->boundingSphere, mesh->boundingBox ); + + // Create subsets + for( UINT j = 0; j < mh.NumSubsets; ++j ) + { + auto sIndex = subsets[ j ]; + if ( sIndex >= header->NumTotalSubsets ) + throw std::exception("Invalid mesh found"); + + auto& subset = subsetArray[ sIndex ]; + + D3D_PRIMITIVE_TOPOLOGY primType; + switch( subset.PrimitiveType ) + { + case DXUT::PT_TRIANGLE_LIST: primType = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; break; + case DXUT::PT_TRIANGLE_STRIP: primType = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; break; + case DXUT::PT_LINE_LIST: primType = D3D_PRIMITIVE_TOPOLOGY_LINELIST; break; + case DXUT::PT_LINE_STRIP: primType = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; break; + case DXUT::PT_POINT_LIST: primType = D3D_PRIMITIVE_TOPOLOGY_POINTLIST; break; + case DXUT::PT_TRIANGLE_LIST_ADJ: primType = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; break; + case DXUT::PT_TRIANGLE_STRIP_ADJ: primType = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; break; + case DXUT::PT_LINE_LIST_ADJ: primType = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; break; + case DXUT::PT_LINE_STRIP_ADJ: primType = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; break; + + case DXUT::PT_QUAD_PATCH_LIST: + case DXUT::PT_TRIANGLE_PATCH_LIST: + throw std::exception("Direct3D9 era tessellation not supported"); + + default: + throw std::exception("Unknown primitive type"); + } + + if ( subset.MaterialID >= header->NumMaterials ) + throw std::exception("Invalid mesh found"); + + auto& mat = materials[ subset.MaterialID ]; + + const size_t vi = mh.VertexBuffers[0]; + InitMaterial(materialArray[subset.MaterialID], + perVertexColor[vi], enableSkinning[vi], enableDualTexture[vi], mesh->pmalpha, + mat, textureDictionary); + + auto part = new ModelMeshPart(); + part->isAlpha = mat.alphaValue < 1.0f; + + const auto& vh = vbArray[mh.VertexBuffers[0]]; + const auto& ih = ibArray[mh.IndexBuffer]; + + part->indexCount = static_cast( subset.IndexCount ); + part->startIndex = static_cast( subset.IndexStart ); + part->vertexOffset = static_cast( subset.VertexStart ); + part->vertexStride = static_cast( vh.StrideBytes ); + part->indexFormat = ( ibArray[ mh.IndexBuffer ].IndexType == DXUT::IT_32BIT ) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT; + part->primitiveType = primType; + + // Vertex data + auto verts = reinterpret_cast(bufferData + (vh.DataOffset - bufferDataOffset)); + part->vertexBuffer = GraphicsMemory::Get().Allocate((size_t) vh.SizeBytes); + memcpy(part->vertexBuffer.Memory(), verts, (size_t) vh.SizeBytes); + + // Index data + auto indices = reinterpret_cast(bufferData + (ih.DataOffset - bufferDataOffset)); + part->indexBuffer = GraphicsMemory::Get().Allocate((size_t) ih.SizeBytes); + memcpy(part->indexBuffer.Memory(), indices, (size_t) ih.SizeBytes); + + part->materialIndex = subset.MaterialID; + part->vbDecl = vbDecls[ mh.VertexBuffers[0] ]; + + if (part->isAlpha) + mesh->alphaMeshParts.emplace_back( part ); + else + mesh->opaqueMeshParts.emplace_back( part ); + } + + model->meshes.emplace_back( mesh ); + } + + // Copy the materials and texture names into contiguous arrays + model->materials = std::move(materials); + model->textureNames.resize(textureDictionary.size()); + for (auto texture = std::cbegin(textureDictionary); texture != std::cend(textureDictionary); ++texture) + { + model->textureNames[texture->second] = texture->first; + } + + return model; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +std::unique_ptr DirectX::Model::CreateFromSDKMESH( const wchar_t* szFileName, bool ccw, bool pmalpha ) +{ + size_t dataSize = 0; + std::unique_ptr data; + HRESULT hr = BinaryReader::ReadEntireFile( szFileName, data, &dataSize ); + if ( FAILED(hr) ) + { + DebugTrace( "CreateFromSDKMESH failed (%08X) loading '%ls'\n", hr, szFileName ); + throw std::exception( "CreateFromSDKMESH" ); + } + + auto model = CreateFromSDKMESH( data.get(), dataSize, ccw, pmalpha ); + + model->name = szFileName; + + return model; +} diff --git a/Kits/DirectXTK12/Src/ModelLoadVBO.cpp b/Kits/DirectXTK12/Src/ModelLoadVBO.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2ec5713abd00c1a03c382fe7219dacc603706ab6 --- /dev/null +++ b/Kits/DirectXTK12/Src/ModelLoadVBO.cpp @@ -0,0 +1,132 @@ +//-------------------------------------------------------------------------------------- +// File: ModelLoadVBO.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Model.h" + +#include "Effects.h" +#include "VertexTypes.h" + +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "BinaryReader.h" + +#include "vbo.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +static_assert(sizeof(VertexPositionNormalTexture) == 32, "VBO vertex size mismatch"); + +namespace +{ + //-------------------------------------------------------------------------------------- + // Shared VB input element description + INIT_ONCE g_InitOnce = INIT_ONCE_STATIC_INIT; + std::shared_ptr> g_vbdecl; + + BOOL CALLBACK InitializeDecl(PINIT_ONCE initOnce, PVOID Parameter, PVOID *lpContext) + { + UNREFERENCED_PARAMETER(initOnce); + UNREFERENCED_PARAMETER(Parameter); + UNREFERENCED_PARAMETER(lpContext); + + g_vbdecl = std::make_shared>(VertexPositionNormalTexture::InputLayout.pInputElementDescs, + VertexPositionNormalTexture::InputLayout.pInputElementDescs + VertexPositionNormalTexture::InputLayout.NumElements); + + return TRUE; + } +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +std::unique_ptr DirectX::Model::CreateFromVBO(const uint8_t* meshData, size_t dataSize, bool ccw, bool pmalpha) +{ + if (!InitOnceExecuteOnce(&g_InitOnce, InitializeDecl, nullptr, nullptr)) + throw std::exception("One-time initialization failed"); + + if ( !meshData ) + throw std::exception("meshData cannot be null"); + + // File Header + if ( dataSize < sizeof(VBO::header_t) ) + throw std::exception("End of file"); + auto header = reinterpret_cast( meshData ); + + if ( !header->numVertices || !header->numIndices ) + throw std::exception("No vertices or indices found"); + + size_t vertSize = sizeof(VertexPositionNormalTexture) * header->numVertices; + + if (dataSize < (vertSize + sizeof(VBO::header_t))) + throw std::exception("End of file"); + auto verts = reinterpret_cast( meshData + sizeof(VBO::header_t) ); + + size_t indexSize = sizeof(uint16_t) * header->numIndices; + + if (dataSize < (sizeof(VBO::header_t) + vertSize + indexSize)) + throw std::exception("End of file"); + auto indices = reinterpret_cast( meshData + sizeof(VBO::header_t) + vertSize ); + + // Create vertex buffer + auto vb = GraphicsMemory::Get().Allocate(vertSize); + memcpy(vb.Memory(), verts, vertSize); + + // Create index buffer + auto ib = GraphicsMemory::Get().Allocate(indexSize); + memcpy(ib.Memory(), indices, indexSize); + + auto part = new ModelMeshPart(); + part->indexCount = header->numIndices; + part->startIndex = 0; + part->vertexStride = static_cast( sizeof(VertexPositionNormalTexture) ); + part->indexBuffer = std::move(ib); + part->vertexBuffer = std::move(vb); + part->materialIndex = 0; + part->vbDecl = g_vbdecl; + + auto mesh = std::make_shared(); + mesh->ccw = ccw; + mesh->pmalpha = pmalpha; + BoundingSphere::CreateFromPoints(mesh->boundingSphere, header->numVertices, &verts->position, sizeof(VertexPositionNormalTexture)); + BoundingBox::CreateFromPoints(mesh->boundingBox, header->numVertices, &verts->position, sizeof(VertexPositionNormalTexture)); + mesh->opaqueMeshParts.emplace_back(part); + + std::unique_ptr model(new Model()); + model->meshes.emplace_back(mesh); + + return model; +} + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +std::unique_ptr DirectX::Model::CreateFromVBO(const wchar_t* szFileName, + bool ccw, bool pmalpha) +{ + size_t dataSize = 0; + std::unique_ptr data; + HRESULT hr = BinaryReader::ReadEntireFile( szFileName, data, &dataSize ); + if ( FAILED(hr) ) + { + DebugTrace( "CreateFromVBO failed (%08X) loading '%ls'\n", hr, szFileName ); + throw std::exception( "CreateFromVBO" ); + } + + auto model = CreateFromVBO( data.get(), dataSize, ccw, pmalpha ); + + model->name = szFileName; + + return model; +} diff --git a/Kits/DirectXTK12/Src/Mouse.cpp b/Kits/DirectXTK12/Src/Mouse.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f72fb6e23c4abcf676df1f792d11ee25a2d14a8 --- /dev/null +++ b/Kits/DirectXTK12/Src/Mouse.cpp @@ -0,0 +1,961 @@ +//-------------------------------------------------------------------------------------- +// File: Mouse.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "Mouse.h" + +#include "PlatformHelpers.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) + +//====================================================================================== +// Windows Store or Universal Windows Platform (UWP) app implementation +//====================================================================================== + +// +// For a Windows Store app or Universal Windows Platform (UWP) app, add the following to your existing +// application methods: +// +// void App::SetWindow(CoreWindow^ window ) +// { +// m_mouse->SetWindow(window); +// } +// +// void App::OnDpiChanged(DisplayInformation^ sender, Object^ args) +// { +// m_mouse->SetDpi(sender->LogicalDpi); +// } +// + +#include + +class Mouse::Impl +{ +public: + Impl(Mouse* owner) : + mOwner(owner), + mDPI(96.f), + mMode(MODE_ABSOLUTE) + { + mPointerPressedToken.value = 0; + mPointerReleasedToken.value = 0; + mPointerMovedToken.value = 0; + mPointerWheelToken.value = 0; + mPointerMouseMovedToken.value = 0; + + if ( s_mouse ) + { + throw std::exception( "Mouse is a singleton" ); + } + + s_mouse = this; + + memset( &mState, 0, sizeof(State) ); + + mScrollWheelValue.reset( CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_MODIFY_STATE | SYNCHRONIZE) ); + mRelativeRead.reset( CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_MODIFY_STATE | SYNCHRONIZE) ); + if ( !mScrollWheelValue + || !mRelativeRead ) + { + throw std::exception( "CreateEventEx" ); + } + } + + ~Impl() + { + s_mouse = nullptr; + + RemoveHandlers(); + } + + void GetState(State& state) const + { + memcpy( &state, &mState, sizeof(State) ); + + DWORD result = WaitForSingleObjectEx( mScrollWheelValue.get(), 0, FALSE ); + if ( result == WAIT_FAILED ) + throw std::exception( "WaitForSingleObjectEx" ); + + if ( result == WAIT_OBJECT_0 ) + { + state.scrollWheelValue = 0; + } + + if (mMode == MODE_RELATIVE) + { + result = WaitForSingleObjectEx( mRelativeRead.get(), 0, FALSE ); + + if (result == WAIT_FAILED) + throw std::exception("WaitForSingleObjectEx"); + + if (result == WAIT_OBJECT_0) + { + state.x = 0; + state.y = 0; + } + else + { + SetEvent(mRelativeRead.get()); + } + } + + state.positionMode = mMode; + } + + void ResetScrollWheelValue() + { + SetEvent(mScrollWheelValue.get()); + } + + void SetMode(Mode mode) + { + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::UI::Core; + using namespace ABI::Windows::Foundation; + + if (mMode == mode) + return; + + ComPtr statics; + HRESULT hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), statics.GetAddressOf() ); + ThrowIfFailed( hr ); + + ComPtr window; + hr = statics->GetForCurrentThread( window.GetAddressOf() ); + ThrowIfFailed( hr ); + + if (mode == MODE_RELATIVE) + { + hr = window->get_PointerCursor( mCursor.ReleaseAndGetAddressOf() ); + ThrowIfFailed(hr); + + hr = window->put_PointerCursor(nullptr); + ThrowIfFailed(hr); + + SetEvent(mRelativeRead.get()); + + mMode = MODE_RELATIVE; + } + else + { + if (!mCursor) + { + ComPtr factory; + hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_UI_Core_CoreCursor).Get(), factory.GetAddressOf() ); + ThrowIfFailed( hr ); + + hr = factory->CreateCursor( CoreCursorType_Arrow, 0, mCursor.GetAddressOf() ); + ThrowIfFailed( hr ); + } + + hr = window->put_PointerCursor( mCursor.Get() ); + ThrowIfFailed(hr); + + mCursor.Reset(); + + mMode = MODE_ABSOLUTE; + } + } + + void SetWindow(ABI::Windows::UI::Core::ICoreWindow* window) + { + using namespace Microsoft::WRL; + using namespace Microsoft::WRL::Wrappers; + using namespace ABI::Windows::Foundation; + using namespace ABI::Windows::Devices::Input; + + if (mWindow.Get() == window) + return; + + RemoveHandlers(); + + mWindow = window; + + if (!window) + { + mCursor.Reset(); + mMouse.Reset(); + return; + } + + ComPtr mouseStatics; + HRESULT hr = GetActivationFactory( HStringReference(RuntimeClass_Windows_Devices_Input_MouseDevice).Get(), mouseStatics.GetAddressOf() ); + ThrowIfFailed( hr ); + + hr = mouseStatics->GetForCurrentView(mMouse.ReleaseAndGetAddressOf()); + ThrowIfFailed(hr); + + typedef __FITypedEventHandler_2_Windows__CDevices__CInput__CMouseDevice_Windows__CDevices__CInput__CMouseEventArgs MouseMovedHandler; + hr = mMouse->add_MouseMoved( Callback(MouseMovedEvent).Get(), &mPointerMouseMovedToken ); + ThrowIfFailed(hr); + + typedef __FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs PointerHandler; + auto cb = Callback(PointerEvent); + + hr = window->add_PointerPressed(cb.Get(), &mPointerPressedToken); + ThrowIfFailed(hr); + + hr = window->add_PointerReleased(cb.Get(), &mPointerReleasedToken); + ThrowIfFailed(hr); + + hr = window->add_PointerMoved(cb.Get(), &mPointerMovedToken); + ThrowIfFailed(hr); + + hr = window->add_PointerWheelChanged(Callback(PointerWheel).Get(), &mPointerWheelToken); + ThrowIfFailed(hr); + } + + State mState; + float mDPI; + Mouse* mOwner; + + static Mouse::Impl* s_mouse; + +private: + Mode mMode; + + ComPtr mWindow; + ComPtr mMouse; + ComPtr mCursor; + + ScopedHandle mScrollWheelValue; + ScopedHandle mRelativeRead; + + EventRegistrationToken mPointerPressedToken; + EventRegistrationToken mPointerReleasedToken; + EventRegistrationToken mPointerMovedToken; + EventRegistrationToken mPointerWheelToken; + EventRegistrationToken mPointerMouseMovedToken; + + void RemoveHandlers() + { + if (mWindow) + { + mWindow->remove_PointerPressed(mPointerPressedToken); + mPointerPressedToken.value = 0; + + mWindow->remove_PointerReleased(mPointerReleasedToken); + mPointerReleasedToken.value = 0; + + mWindow->remove_PointerMoved(mPointerMovedToken); + mPointerMovedToken.value = 0; + + mWindow->remove_PointerWheelChanged(mPointerWheelToken); + mPointerWheelToken.value = 0; + } + + if (mMouse) + { + mMouse->remove_MouseMoved(mPointerMouseMovedToken); + mPointerMouseMovedToken.value = 0; + } + } + + static HRESULT PointerEvent( IInspectable *, ABI::Windows::UI::Core::IPointerEventArgs*args ) + { + using namespace ABI::Windows::Foundation; + using namespace ABI::Windows::UI::Input; + using namespace ABI::Windows::Devices::Input; + + if (!s_mouse) + return S_OK; + + ComPtr currentPoint; + HRESULT hr = args->get_CurrentPoint( currentPoint.GetAddressOf() ); + ThrowIfFailed(hr); + + ComPtr pointerDevice; + hr = currentPoint->get_PointerDevice( pointerDevice.GetAddressOf() ); + ThrowIfFailed(hr); + + PointerDeviceType devType; + hr = pointerDevice->get_PointerDeviceType( &devType ); + ThrowIfFailed(hr); + + if (devType == PointerDeviceType::PointerDeviceType_Mouse) + { + ComPtr props; + hr = currentPoint->get_Properties( props.GetAddressOf() ); + ThrowIfFailed(hr); + + boolean value; + hr = props->get_IsLeftButtonPressed(&value); + ThrowIfFailed(hr); + s_mouse->mState.leftButton = value != 0; + + hr = props->get_IsRightButtonPressed(&value); + ThrowIfFailed(hr); + s_mouse->mState.rightButton = value != 0; + + hr = props->get_IsMiddleButtonPressed(&value); + ThrowIfFailed(hr); + s_mouse->mState.middleButton = value != 0; + + hr = props->get_IsXButton1Pressed(&value); + ThrowIfFailed(hr); + s_mouse->mState.xButton1 = value != 0; + + hr = props->get_IsXButton2Pressed(&value); + ThrowIfFailed(hr); + s_mouse->mState.xButton2 = value != 0; + } + + if (s_mouse->mMode == MODE_ABSOLUTE) + { + Point pos; + hr = currentPoint->get_Position( &pos ); + ThrowIfFailed(hr); + + float dpi = s_mouse->mDPI; + + s_mouse->mState.x = static_cast( pos.X * dpi / 96.f + 0.5f ); + s_mouse->mState.y = static_cast( pos.Y * dpi / 96.f + 0.5f ); + } + + return S_OK; + } + + static HRESULT PointerWheel( IInspectable *, ABI::Windows::UI::Core::IPointerEventArgs*args ) + { + using namespace ABI::Windows::Foundation; + using namespace ABI::Windows::UI::Input; + using namespace ABI::Windows::Devices::Input; + + if (!s_mouse) + return S_OK; + + ComPtr currentPoint; + HRESULT hr = args->get_CurrentPoint( currentPoint.GetAddressOf() ); + ThrowIfFailed(hr); + + ComPtr pointerDevice; + hr = currentPoint->get_PointerDevice( pointerDevice.GetAddressOf() ); + ThrowIfFailed(hr); + + PointerDeviceType devType; + hr = pointerDevice->get_PointerDeviceType( &devType ); + ThrowIfFailed(hr); + + if (devType == PointerDeviceType::PointerDeviceType_Mouse) + { + ComPtr props; + hr = currentPoint->get_Properties( props.GetAddressOf() ); + ThrowIfFailed(hr); + + INT32 value; + hr = props->get_MouseWheelDelta(&value); + ThrowIfFailed(hr); + + HANDLE evt = s_mouse->mScrollWheelValue.get(); + if (WaitForSingleObjectEx(evt, 0, FALSE) == WAIT_OBJECT_0) + { + s_mouse->mState.scrollWheelValue = 0; + ResetEvent(evt); + } + + s_mouse->mState.scrollWheelValue += value; + + if (s_mouse->mMode == MODE_ABSOLUTE) + { + Point pos; + hr = currentPoint->get_Position( &pos ); + ThrowIfFailed(hr); + + float dpi = s_mouse->mDPI; + + s_mouse->mState.x = static_cast( pos.X * dpi / 96.f + 0.5f ); + s_mouse->mState.y = static_cast( pos.Y * dpi / 96.f + 0.5f ); + } + } + + return S_OK; + } + + static HRESULT MouseMovedEvent( IInspectable *, ABI::Windows::Devices::Input::IMouseEventArgs* args ) + { + using namespace ABI::Windows::Devices::Input; + + if (!s_mouse) + return S_OK; + + if (s_mouse->mMode == MODE_RELATIVE) + { + MouseDelta delta; + HRESULT hr = args->get_MouseDelta(&delta); + ThrowIfFailed(hr); + + s_mouse->mState.x = delta.X; + s_mouse->mState.y = delta.Y; + + ResetEvent( s_mouse->mRelativeRead.get() ); + } + + return S_OK; + } +}; + + +Mouse::Impl* Mouse::Impl::s_mouse = nullptr; + + +void Mouse::SetWindow(ABI::Windows::UI::Core::ICoreWindow* window) +{ + pImpl->SetWindow(window); +} + + +void Mouse::SetDpi(float dpi) +{ + auto pImpl = Impl::s_mouse; + + if (!pImpl) + return; + + pImpl->mDPI = dpi; +} + + +#elif defined(_XBOX_ONE) || ( defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) ) + +//====================================================================================== +// Null device for Windows Phone and Xbox One +//====================================================================================== + +class Mouse::Impl +{ +public: + Impl(Mouse* owner) : + mOwner(owner) + { + if ( s_mouse ) + { + throw std::exception( "Mouse is a singleton" ); + } + + s_mouse = this; + } + + ~Impl() + { + s_mouse = nullptr; + } + + void GetState(State& state) const + { + memset( &state, 0, sizeof(State) ); + } + + void ResetScrollWheelValue() + { + } + + void SetMode(Mode mode) + { + UNREFERENCED_PARAMETER(mode); + } + + Mouse* mOwner; + + static Mouse::Impl* s_mouse; +}; + +Mouse::Impl* Mouse::Impl::s_mouse = nullptr; + +#else + +//====================================================================================== +// Win32 desktop implementation +//====================================================================================== + +// +// For a Win32 desktop application, in your window setup be sure to call this method: +// +// m_mouse->SetWindow(hwnd); +// +// And call this static function from your Window Message Procedure +// +// LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +// { +// switch (message) +// { +// case WM_ACTIVATEAPP: +// case WM_INPUT: +// case WM_MOUSEMOVE: +// case WM_LBUTTONDOWN: +// case WM_LBUTTONUP: +// case WM_RBUTTONDOWN: +// case WM_RBUTTONUP: +// case WM_MBUTTONDOWN: +// case WM_MBUTTONUP: +// case WM_MOUSEWHEEL: +// case WM_XBUTTONDOWN: +// case WM_XBUTTONUP: +// case WM_MOUSEHOVER: +// Mouse::ProcessMessage(message, wParam, lParam); +// break; +// +// } +// } +// + +class Mouse::Impl +{ +public: + Impl(Mouse* owner) : + mOwner(owner), + mMode(MODE_ABSOLUTE), + mLastX(0), + mLastY(0), + mInFocus(true) + { + if ( s_mouse ) + { + throw std::exception( "Mouse is a singleton" ); + } + + s_mouse = this; + + memset( &mState, 0, sizeof(State) ); + + mScrollWheelValue.reset( CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_MODIFY_STATE | SYNCHRONIZE) ); + mRelativeRead.reset( CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_MODIFY_STATE | SYNCHRONIZE) ); + mAbsoluteMode.reset( CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE) ); + mRelativeMode.reset( CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE) ); + if ( !mScrollWheelValue + || !mRelativeRead + || !mAbsoluteMode + || !mRelativeMode ) + { + throw std::exception( "CreateEventEx" ); + } + } + + ~Impl() + { + s_mouse = nullptr; + } + + void GetState(State& state) const + { + memcpy( &state, &mState, sizeof(State) ); + state.positionMode = mMode; + + DWORD result = WaitForSingleObjectEx( mScrollWheelValue.get(), 0, FALSE ); + if ( result == WAIT_FAILED ) + throw std::exception( "WaitForSingleObjectEx" ); + + if ( result == WAIT_OBJECT_0 ) + { + state.scrollWheelValue = 0; + } + + if (state.positionMode == MODE_RELATIVE) + { + result = WaitForSingleObjectEx( mRelativeRead.get(), 0, FALSE ); + + if (result == WAIT_FAILED) + throw std::exception("WaitForSingleObjectEx"); + + if (result == WAIT_OBJECT_0) + { + state.x = 0; + state.y = 0; + } + else + { + SetEvent(mRelativeRead.get()); + } + } + } + + void ResetScrollWheelValue() + { + SetEvent(mScrollWheelValue.get()); + } + + void SetMode(Mode mode) + { + if (mMode == mode) + return; + + SetEvent((mode == MODE_ABSOLUTE) ? mAbsoluteMode.get() : mRelativeMode.get()); + + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_HOVER; + tme.hwndTrack = mWindow; + tme.dwHoverTime = 1; + if (!TrackMouseEvent(&tme)) + { + throw std::exception("TrackMouseEvent"); + } + } + + void SetWindow(HWND window) + { + if (mWindow == window) + return; + + RAWINPUTDEVICE Rid; + Rid.usUsagePage = 0x1 /* HID_USAGE_PAGE_GENERIC */; + Rid.usUsage = 0x2 /* HID_USAGE_GENERIC_MOUSE */; + Rid.dwFlags = RIDEV_INPUTSINK; + Rid.hwndTarget = window; + if ( !RegisterRawInputDevices(&Rid, 1, sizeof(RAWINPUTDEVICE)) ) + { + throw std::exception("RegisterRawInputDevices"); + } + + mWindow = window; + } + + State mState; + + Mouse* mOwner; + + static Mouse::Impl* s_mouse; + +private: + HWND mWindow; + Mode mMode; + + ScopedHandle mScrollWheelValue; + ScopedHandle mRelativeRead; + ScopedHandle mAbsoluteMode; + ScopedHandle mRelativeMode; + + int mLastX; + int mLastY; + + bool mInFocus; + + friend void Mouse::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam); + + void ClipToWindow() + { + RECT rect; + GetClientRect(mWindow, &rect); + + POINT ul; + ul.x = rect.left; + ul.y = rect.top; + + POINT lr; + lr.x = rect.right; + lr.y = rect.bottom; + + MapWindowPoints(mWindow, nullptr, &ul, 1); + MapWindowPoints(mWindow, nullptr, &lr, 1); + + rect.left = ul.x; + rect.top = ul.y; + + rect.right = lr.x; + rect.bottom = lr.y; + + ClipCursor(&rect); + } +}; + + +Mouse::Impl* Mouse::Impl::s_mouse = nullptr; + + +void Mouse::SetWindow( HWND window ) +{ + pImpl->SetWindow(window); +} + + +void Mouse::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam) +{ + auto pImpl = Impl::s_mouse; + + if (!pImpl) + return; + + HANDLE evts[3]; + evts[0] = pImpl->mScrollWheelValue.get(); + evts[1] = pImpl->mAbsoluteMode.get(); + evts[2] = pImpl->mRelativeMode.get(); + switch (WaitForMultipleObjectsEx(_countof(evts), evts, FALSE, 0, FALSE)) + { + case WAIT_OBJECT_0: + pImpl->mState.scrollWheelValue = 0; + ResetEvent(evts[0]); + break; + + case (WAIT_OBJECT_0 + 1) : + { + pImpl->mMode = MODE_ABSOLUTE; + ClipCursor(nullptr); + + POINT point; + point.x = pImpl->mLastX; + point.y = pImpl->mLastY; + if (MapWindowPoints(pImpl->mWindow, nullptr, &point, 1)) + { + SetCursorPos(point.x, point.y); + } + ShowCursor(TRUE); + pImpl->mState.x = pImpl->mLastX; + pImpl->mState.y = pImpl->mLastY; + } + break; + + case (WAIT_OBJECT_0 + 2) : + { + ResetEvent( pImpl->mRelativeRead.get() ); + + pImpl->mMode = MODE_RELATIVE; + pImpl->mState.x = pImpl->mState.y = 0; + + ShowCursor(FALSE); + + pImpl->ClipToWindow(); + } + break; + + case WAIT_FAILED: + throw std::exception("WaitForMultipleObjectsEx"); + } + + switch (message) + { + case WM_ACTIVATEAPP: + if (wParam) + { + pImpl->mInFocus = true; + + if (pImpl->mMode == MODE_RELATIVE) + { + pImpl->mState.x = pImpl->mState.y = 0; + + ShowCursor(FALSE); + + pImpl->ClipToWindow(); + } + } + else + { + int scrollWheel = pImpl->mState.scrollWheelValue; + memset(&pImpl->mState, 0, sizeof(State)); + pImpl->mState.scrollWheelValue = scrollWheel; + + pImpl->mInFocus = false; + } + return; + + case WM_INPUT: + if (pImpl->mInFocus && pImpl->mMode == MODE_RELATIVE) + { + RAWINPUT raw; + UINT rawSize = sizeof(raw); + + UINT resultData = GetRawInputData(reinterpret_cast(lParam), RID_INPUT, &raw, &rawSize, sizeof(RAWINPUTHEADER)); + if (resultData == UINT(-1)) + { + throw std::exception("GetRawInputData"); + } + + if (raw.header.dwType == RIM_TYPEMOUSE) + { + if ( !(raw.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) ) + { + pImpl->mState.x = raw.data.mouse.lLastX; + pImpl->mState.y = raw.data.mouse.lLastY; + + ResetEvent( pImpl->mRelativeRead.get() ); + } + + // Note that with Remote Desktop input comes through as MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP, + // so this imlementation doesn't suport relative mode via remote desktop. + } + } + return; + + case WM_MOUSEMOVE: + break; + + case WM_LBUTTONDOWN: + pImpl->mState.leftButton = true; + break; + + case WM_LBUTTONUP: + pImpl->mState.leftButton = false; + break; + + case WM_RBUTTONDOWN: + pImpl->mState.rightButton = true; + break; + + case WM_RBUTTONUP: + pImpl->mState.rightButton = false; + break; + + case WM_MBUTTONDOWN: + pImpl->mState.middleButton = true; + break; + + case WM_MBUTTONUP: + pImpl->mState.middleButton = false; + break; + + case WM_MOUSEWHEEL: + pImpl->mState.scrollWheelValue += GET_WHEEL_DELTA_WPARAM(wParam); + return; + + case WM_XBUTTONDOWN: + switch (GET_XBUTTON_WPARAM(wParam)) + { + case XBUTTON1: + pImpl->mState.xButton1 = true; + break; + + case XBUTTON2: + pImpl->mState.xButton2 = true; + break; + } + break; + + case WM_XBUTTONUP: + switch (GET_XBUTTON_WPARAM(wParam)) + { + case XBUTTON1: + pImpl->mState.xButton1 = false; + break; + + case XBUTTON2: + pImpl->mState.xButton2 = false; + break; + } + break; + + case WM_MOUSEHOVER: + break; + + default: + // Not a mouse message, so exit + return; + } + + if (pImpl->mMode == MODE_ABSOLUTE) + { + // All mouse messages provide a new pointer position + int xPos = static_cast(LOWORD(lParam)); // GET_X_LPARAM(lParam); + int yPos = static_cast(HIWORD(lParam)); // GET_Y_LPARAM(lParam); + + pImpl->mState.x = pImpl->mLastX = xPos; + pImpl->mState.y = pImpl->mLastY = yPos; + } +} + +#endif + +#pragma warning( disable : 4355 ) + +// Public constructor. +Mouse::Mouse() + : pImpl( new Impl(this) ) +{ +} + + +// Move constructor. +Mouse::Mouse(Mouse&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ + pImpl->mOwner = this; +} + + +// Move assignment. +Mouse& Mouse::operator= (Mouse&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + pImpl->mOwner = this; + return *this; +} + + +// Public destructor. +Mouse::~Mouse() +{ +} + + +Mouse::State Mouse::GetState() const +{ + State state; + pImpl->GetState(state); + return state; +} + + +void Mouse::ResetScrollWheelValue() +{ + pImpl->ResetScrollWheelValue(); +} + + +void Mouse::SetMode(Mode mode) +{ + pImpl->SetMode(mode); +} + + +Mouse& Mouse::Get() +{ + if ( !Impl::s_mouse || !Impl::s_mouse->mOwner ) + throw std::exception( "Mouse is a singleton" ); + + return *Impl::s_mouse->mOwner; +} + + + +//====================================================================================== +// ButtonStateTracker +//====================================================================================== + +#define UPDATE_BUTTON_STATE(field) field = static_cast( ( !!state.field ) | ( ( !!state.field ^ !!lastState.field ) << 1 ) ); + +void Mouse::ButtonStateTracker::Update( const Mouse::State& state ) +{ + UPDATE_BUTTON_STATE(leftButton); + + assert( ( !state.leftButton && !lastState.leftButton ) == ( leftButton == UP ) ); + assert( ( state.leftButton && lastState.leftButton ) == ( leftButton == HELD ) ); + assert( ( !state.leftButton && lastState.leftButton ) == ( leftButton == RELEASED ) ); + assert( ( state.leftButton && !lastState.leftButton ) == ( leftButton == PRESSED ) ); + + UPDATE_BUTTON_STATE(middleButton); + UPDATE_BUTTON_STATE(rightButton); + UPDATE_BUTTON_STATE(xButton1); + UPDATE_BUTTON_STATE(xButton2); + + lastState = state; +} + +#undef UPDATE_BUTTON_STATE + + +void Mouse::ButtonStateTracker::Reset() +{ + memset( this, 0, sizeof(ButtonStateTracker) ); +} diff --git a/Kits/DirectXTK12/Src/PlatformHelpers.h b/Kits/DirectXTK12/Src/PlatformHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..823ec1877af60682f177ae0eec8352134f4bca8c --- /dev/null +++ b/Kits/DirectXTK12/Src/PlatformHelpers.h @@ -0,0 +1,152 @@ +//-------------------------------------------------------------------------------------- +// File: PlatformHelpers.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#pragma warning(disable : 4324) + +#include +#include + + +namespace DirectX +{ + // Helper class for COM exceptions + class com_exception : public std::exception + { + public: + com_exception(HRESULT hr) : result(hr) {} + + virtual const char* what() const override + { + static char s_str[64] = {}; + sprintf_s(s_str, "Failure with HRESULT of %08X", result); + return s_str; + } + + private: + HRESULT result; + }; + + // Helper utility converts D3D API failures into exceptions. + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + throw com_exception(hr); + } + } + + + // Helper for output debug tracing + inline void DebugTrace( _In_z_ _Printf_format_string_ const char* format, ... ) + { +#ifdef _DEBUG + va_list args; + va_start( args, format ); + + char buff[1024] = {}; + vsprintf_s( buff, format, args ); + OutputDebugStringA( buff ); + va_end( args ); +#else + UNREFERENCED_PARAMETER( format ); +#endif + } + + + // Helper smart-pointers +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10) || (defined(_XBOX_ONE) && defined(_TITLE)) || !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) + struct virtual_deleter { void operator()(void* p) { if (p) VirtualFree(p, 0, MEM_RELEASE); } }; +#endif + + struct aligned_deleter { void operator()(void* p) { _aligned_free(p); } }; + + struct handle_closer { void operator()(HANDLE h) { if (h) CloseHandle(h); } }; + + typedef public std::unique_ptr ScopedHandle; + + inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } +} + + +#ifdef DIRECTX_EMULATE_MUTEX + +// Emulate the C++0x mutex and lock_guard types when building with Visual Studio CRT versions < 2012. +namespace std +{ + class mutex + { + public: + mutex() { InitializeCriticalSection(&mCriticalSection); } + ~mutex() { DeleteCriticalSection(&mCriticalSection); } + + void lock() { EnterCriticalSection(&mCriticalSection); } + void unlock() { LeaveCriticalSection(&mCriticalSection); } + bool try_lock() { return TryEnterCriticalSection(&mCriticalSection) != 0; } + + private: + CRITICAL_SECTION mCriticalSection; + + mutex(mutex const&); + mutex& operator= (mutex const&); + }; + + + template + class lock_guard + { + public: + typedef Mutex mutex_type; + + explicit lock_guard(mutex_type& mutex) + : mMutex(mutex) + { + mMutex.lock(); + } + + ~lock_guard() + { + mMutex.unlock(); + } + + private: + mutex_type& mMutex; + + lock_guard(lock_guard const&); + lock_guard& operator= (lock_guard const&); + }; +} + +#else + +#include + +#endif + + +#ifdef DIRECTX_EMULATE_MAKE_UNIQUE + +// Emulate make_unique when building with Visual Studio CRT versions < 2012. +namespace std +{ + + template + std::unique_ptr make_unique(Args&&... args) + { + return std::unique_ptr(new T(std::forward(args)...)); + } + +} + +#endif \ No newline at end of file diff --git a/Kits/DirectXTK12/Src/PrimitiveBatch.cpp b/Kits/DirectXTK12/Src/PrimitiveBatch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f1a6865a2c828104bb9a048e6134f50f668e760 --- /dev/null +++ b/Kits/DirectXTK12/Src/PrimitiveBatch.cpp @@ -0,0 +1,282 @@ +//-------------------------------------------------------------------------------------- +// File: PrimitiveBatch.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PrimitiveBatch.h" +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "GraphicsMemory.h" + +using namespace DirectX; +using namespace DirectX::Internal; +using Microsoft::WRL::ComPtr; + + +// Internal PrimitiveBatch implementation class. +class PrimitiveBatchBase::Impl +{ +public: + Impl(_In_ ID3D12Device* device, size_t maxIndices, size_t maxVertices, size_t vertexSize); + + void Begin( _In_ ID3D12GraphicsCommandList* cmdList ); + void End(); + + void Draw(D3D_PRIMITIVE_TOPOLOGY topology, bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, size_t indexCount, size_t vertexCount, _Outptr_ void** pMappedVertices); + +private: + void FlushBatch(); + + GraphicsResource mVertexSegment; + GraphicsResource mIndexSegment; + + ComPtr mDevice; + ComPtr mCommandList; + + size_t mMaxIndices; + size_t mMaxVertices; + size_t mVertexSize; + size_t mVertexPageSize; + size_t mIndexPageSize; + + bool mInBeginEndPair; + + D3D_PRIMITIVE_TOPOLOGY mCurrentTopology; + bool mCurrentlyIndexed; + + size_t mIndexCount; + size_t mVertexCount; + + size_t mBaseIndex; + size_t mBaseVertex; +}; + + +// Constructor. +PrimitiveBatchBase::Impl::Impl(_In_ ID3D12Device* device, size_t maxIndices, size_t maxVertices, size_t vertexSize) + : mCommandList(nullptr), + mDevice(device), + mMaxIndices(maxIndices), + mMaxVertices(maxVertices), + mVertexSize(vertexSize), + mVertexPageSize(maxVertices * vertexSize), + mIndexPageSize(maxIndices * sizeof(uint16_t)), + mInBeginEndPair(false), + mCurrentTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED), + mCurrentlyIndexed(false), + mIndexCount(0), + mVertexCount(0) +{ + if (maxVertices == 0) + throw std::exception("maxVertices must be greater than 0"); +} + + +// Begins a batch of primitive drawing operations. + +void PrimitiveBatchBase::Impl::Begin( _In_ ID3D12GraphicsCommandList* cmdList ) +{ + if (mInBeginEndPair) + throw std::exception("Cannot nest Begin calls"); + + mCommandList = cmdList; + mInBeginEndPair = true; +} + + +// Ends a batch of primitive drawing operations. +void PrimitiveBatchBase::Impl::End() +{ + if (!mInBeginEndPair) + throw std::exception("Begin must be called before End"); + + FlushBatch(); + + // Release our smart pointers and end the block + mIndexSegment.Reset(); + mVertexSegment.Reset(); + mCommandList.Reset(); + mInBeginEndPair = false; +} + + +// Can we combine adjacent primitives using this topology into a single draw call? +static bool CanBatchPrimitives(D3D_PRIMITIVE_TOPOLOGY topology) +{ + switch (topology) + { + case D3D_PRIMITIVE_TOPOLOGY_POINTLIST: + case D3D_PRIMITIVE_TOPOLOGY_LINELIST: + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: + // Lists can easily be merged. + return true; + + default: + // Strips cannot. + return false; + } + + // We could also merge indexed strips by inserting degenerates, + // but that's not always a perf win, so let's keep things simple. +} + + +// Adds new geometry to the batch. +_Use_decl_annotations_ +void PrimitiveBatchBase::Impl::Draw(D3D_PRIMITIVE_TOPOLOGY topology, bool isIndexed, uint16_t const* indices, size_t indexCount, size_t vertexCount, void** pMappedVertices) +{ + if (isIndexed && !indices) + throw std::exception("Indices cannot be null"); + + if (indexCount >= mMaxIndices) + throw std::exception("Too many indices"); + + if (vertexCount >= mMaxVertices) + throw std::exception("Too many vertices"); + + if (!mInBeginEndPair) + throw std::exception("Begin must be called before Draw"); + + assert(pMappedVertices != nullptr); + + // Can we merge this primitive in with an existing batch, or must we flush first? + bool wrapIndexBuffer = (mIndexCount + indexCount > mMaxIndices); + bool wrapVertexBuffer = (mVertexCount + vertexCount > mMaxVertices); + + if ((topology != mCurrentTopology) || + (isIndexed != mCurrentlyIndexed) || + !CanBatchPrimitives(topology) || + wrapIndexBuffer || wrapVertexBuffer) + { + FlushBatch(); + } + + // If we are not already in a batch, lock the buffers. + if (mCurrentTopology == D3D_PRIMITIVE_TOPOLOGY_UNDEFINED) + { + mIndexCount = 0; + mVertexCount = 0; + mBaseIndex = 0; + mBaseVertex = 0; + mCurrentTopology = topology; + mCurrentlyIndexed = isIndexed; + + // Allocate a page for the primitive data + if (isIndexed) + mIndexSegment = GraphicsMemory::Get().Allocate(mIndexPageSize); + + mVertexSegment = GraphicsMemory::Get().Allocate(mVertexPageSize); + } + + // Copy over the index data. + if (isIndexed) + { + uint16_t* outputIndices = (uint16_t*)mIndexSegment.Memory() + mIndexCount; + + for (size_t i = 0; i < indexCount; i++) + { + outputIndices[i] = (uint16_t)(indices[i] + mVertexCount - mBaseIndex); + } + + mIndexCount += indexCount; + } + + // Return the output vertex data location. + *pMappedVertices = (uint8_t*)mVertexSegment.Memory() + mVertexSize * mVertexCount; + + mVertexCount += vertexCount; +} + + +// Sends queued primitives to the graphics device. +void PrimitiveBatchBase::Impl::FlushBatch() +{ + // Early out if there is nothing to flush. + if (mCurrentTopology == D3D_PRIMITIVE_TOPOLOGY_UNDEFINED) + return; + + mCommandList->IASetPrimitiveTopology(mCurrentTopology); + + // Set the vertex buffer view + D3D12_VERTEX_BUFFER_VIEW vbv; + vbv.BufferLocation = mVertexSegment.GpuAddress(); + vbv.SizeInBytes = (UINT) ( mVertexSize * (mVertexCount - mBaseVertex) ); + vbv.StrideInBytes = (UINT) mVertexSize; + mCommandList->IASetVertexBuffers(0, 1, &vbv); + + if (mCurrentlyIndexed) + { + // Set the index buffer view + D3D12_INDEX_BUFFER_VIEW ibv; + ibv.BufferLocation = mIndexSegment.GpuAddress(); + ibv.Format = DXGI_FORMAT_R16_UINT; + ibv.SizeInBytes = (UINT) (mIndexCount - mBaseIndex) * sizeof(uint16_t); + mCommandList->IASetIndexBuffer(&ibv); + + // Draw indexed geometry. + mCommandList->DrawIndexedInstanced((UINT)(mIndexCount - mBaseIndex), 1, 0, 0, 0); + } + else + { + // Draw non-indexed geometry. + mCommandList->DrawInstanced((UINT)(mVertexCount - mBaseVertex), 1, 0, 0); + } + + mCurrentTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; +} + + +// Public constructor. +PrimitiveBatchBase::PrimitiveBatchBase(_In_ ID3D12Device* device, size_t maxIndices, size_t maxVertices, size_t vertexSize) + : pImpl(new Impl(device, maxIndices, maxVertices, vertexSize)) +{ +} + + +// Move constructor. +PrimitiveBatchBase::PrimitiveBatchBase(PrimitiveBatchBase&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +PrimitiveBatchBase& PrimitiveBatchBase::operator= (PrimitiveBatchBase&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +PrimitiveBatchBase::~PrimitiveBatchBase() +{ +} + + +void PrimitiveBatchBase::Begin( _In_ ID3D12GraphicsCommandList* cmdList ) +{ + pImpl->Begin( cmdList ); +} + + +void PrimitiveBatchBase::End() +{ + pImpl->End(); +} + + +_Use_decl_annotations_ +void PrimitiveBatchBase::Draw(D3D12_PRIMITIVE_TOPOLOGY topology, bool isIndexed, uint16_t const* indices, size_t indexCount, size_t vertexCount, void** pMappedVertices) +{ + pImpl->Draw(topology, isIndexed, indices, indexCount, vertexCount, pMappedVertices); +} diff --git a/Kits/DirectXTK12/Src/ResourceUploadBatch.cpp b/Kits/DirectXTK12/Src/ResourceUploadBatch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a7c05e75d73ac5b0de6a2258ba07a60078bba27 --- /dev/null +++ b/Kits/DirectXTK12/Src/ResourceUploadBatch.cpp @@ -0,0 +1,589 @@ +//-------------------------------------------------------------------------------------- +// File: ResourceUploadBatch.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "ResourceUploadBatch.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +namespace DirectX +{ + uint32_t CountMips(uint32_t width, uint32_t height) + { + if (width == 0 || height == 0) + return 0; + + uint32_t count = 1; + while (width > 1 || height > 1) + { + width >>= 1; + height >>= 1; + count++; + } + return count; + } +} + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) +# include "Shaders/Compiled/XboxOneGenerateMips_main.inc" +#else +# include "Shaders/Compiled/GenerateMips_main.inc" +#endif + + DXGI_FORMAT ConvertSRVtoUAVFormat(DXGI_FORMAT format) + { + switch (format) + { + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + return DXGI_FORMAT_R8G8B8A8_UNORM; + + case DXGI_FORMAT_B8G8R8A8_TYPELESS: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + return DXGI_FORMAT_B8G8R8A8_UNORM; + + case DXGI_FORMAT_B8G8R8X8_TYPELESS: + case DXGI_FORMAT_B8G8R8X8_UNORM: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: + return DXGI_FORMAT_B8G8R8X8_UNORM; + + case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_R32_FLOAT: + return DXGI_FORMAT_R32_FLOAT; + + default: + return format; + } + } + + class GenerateMipsResources + { + public: + enum RootParameterIndex + { + Constants, + SourceTexture, + TargetTexture, + RootParameterCount + }; + +#pragma pack(push, 4) + struct ConstantData + { + XMFLOAT2 InvOutTexelSize; + uint32_t SrcMipIndex; + }; +#pragma pack(pop) + + static const uint32_t Num32BitConstants = (uint32_t)(sizeof(ConstantData) / sizeof(uint32_t)); + static const uint32_t ThreadGroupSize = 8; + + ComPtr rootSignature; + ComPtr generateMipsPSO; + + GenerateMipsResources( + _In_ ID3D12Device* device) + { + rootSignature = CreateGenMipsRootSignature(device); + generateMipsPSO = CreateGenMipsPipelineState(device, rootSignature.Get(), GenerateMips_main, sizeof(GenerateMips_main)); + } + + private: + static ComPtr CreateGenMipsRootSignature( + _In_ ID3D12Device* device) + { + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC sampler( + 0, // register + D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP); + + CD3DX12_DESCRIPTOR_RANGE sourceDescriptorRange(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + CD3DX12_DESCRIPTOR_RANGE targetDescriptorRange(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0); + + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::Constants].InitAsConstants(Num32BitConstants, 0); + rootParameters[RootParameterIndex::SourceTexture].InitAsDescriptorTable(1, &sourceDescriptorRange); + rootParameters[RootParameterIndex::TargetTexture].InitAsDescriptorTable(1, &targetDescriptorRange); + + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, 1, &sampler, rootSignatureFlags); + + ComPtr rootSignature; + ThrowIfFailed(CreateRootSignature(device, &rsigDesc, rootSignature.ReleaseAndGetAddressOf())); + + SetDebugObjectName(rootSignature.Get(), L"GenerateMips RootSignature"); + + return rootSignature; + } + + static ComPtr CreateGenMipsPipelineState( + _In_ ID3D12Device* device, + _In_ ID3D12RootSignature* rootSignature, + _In_reads_(bytecodeSize) const uint8_t* bytecode, + _In_ size_t bytecodeSize) + { + D3D12_COMPUTE_PIPELINE_STATE_DESC desc = {}; + desc.CS.BytecodeLength = bytecodeSize; + desc.CS.pShaderBytecode = bytecode; +#if !defined(_XBOX_ONE) || !defined(_TITLE) + desc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE; +#endif + desc.pRootSignature = rootSignature; + + ComPtr pso; + ThrowIfFailed(device->CreateComputePipelineState(&desc, IID_GRAPHICS_PPV_ARGS(pso.GetAddressOf()))); + + SetDebugObjectName(pso.Get(), L"GenerateMips PSO"); + + return pso; + } + }; +} // anonymous namespace + +class ResourceUploadBatch::Impl +{ +public: + Impl( + _In_ ID3D12Device* device) + : mDevice(device) + , mInBeginEndBlock(false) + { + } + + // Call this before your multiple calls to Upload. + void Begin() + { + if (mInBeginEndBlock) + throw std::exception("Can't Begin: already in a Begin-End block."); + + ThrowIfFailed(mDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_GRAPHICS_PPV_ARGS(mCmdAlloc.ReleaseAndGetAddressOf()))); + ThrowIfFailed(mDevice->CreateCommandList(1, D3D12_COMMAND_LIST_TYPE_DIRECT, mCmdAlloc.Get(), nullptr, IID_GRAPHICS_PPV_ARGS(mList.ReleaseAndGetAddressOf()))); + + PIXBeginEvent(mList.Get(), 0, __FUNCTIONW__); + + mInBeginEndBlock = true; + } + + // Asynchronously uploads a resource. The memory in subRes is copied. + // The resource must be in the COPY_DEST state. + void Upload( + _In_ ID3D12Resource* resource, + _In_ uint32_t subresourceIndexStart, + _In_reads_(numSubresources) D3D12_SUBRESOURCE_DATA* subRes, + _In_ uint32_t numSubresources) + { + if (!mInBeginEndBlock) + throw std::exception("Can't call Upload on a closed ResourceUploadBatch."); + + PIXBeginEvent(mList.Get(), 0, __FUNCTIONW__); + + UINT64 uploadSize = GetRequiredIntermediateSize( + resource, + subresourceIndexStart, + numSubresources); + + CD3DX12_HEAP_PROPERTIES heapProps(D3D12_HEAP_TYPE_UPLOAD); + CD3DX12_RESOURCE_DESC resDesc = CD3DX12_RESOURCE_DESC::Buffer(uploadSize); + + // Create a temporary buffer + ComPtr scratchResource = nullptr; + ThrowIfFailed(mDevice->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &resDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, // D3D12_CLEAR_VALUE* pOptimizedClearValue + IID_GRAPHICS_PPV_ARGS(scratchResource.GetAddressOf()))); + + SetDebugObjectName(scratchResource.Get(), L"ResourceUploadBatch Temporary"); + + // Transition the resource to a copy target, copy and transition back + UpdateSubresources(mList.Get(), resource, scratchResource.Get(), 0, subresourceIndexStart, numSubresources, subRes); + + // Remember this upload object for delayed release + mTrackedObjects.push_back(scratchResource); + + PIXEndEvent(mList.Get()); + } + + // Asynchronously generate mips from a resource. + // Resource must be in the PIXEL_SHADER_RESOURCE state + void GenerateMips( + _In_ ID3D12Resource* resource) + { + if (resource == nullptr) + { + throw std::invalid_argument("Nullptr passed to GenerateMips"); + } + + ScopedPixEvent pix(mList.Get(), 0, __FUNCTIONW__); + + const auto& desc = resource->GetDesc(); + + if (desc.MipLevels == 1) + { + // Nothing to do + return; + } + if (desc.MipLevels == 0) + { + throw std::exception("GenerateMips: texture has no mips"); + } + if (desc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D) + { + throw std::exception("GenerateMips only supports Texture2D resources"); + } + if (desc.DepthOrArraySize != 1) + { + throw std::exception("GenerateMips only supports 2D textures of array size 1"); + } + + // Ensure that we have valid generate mips data + if (mGenMipsResources == nullptr) + { + mGenMipsResources = std::make_unique(mDevice.Get()); + } + + // Create a staging resource if we have to + ComPtr staging; + if ((desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) == 0) + { + D3D12_RESOURCE_DESC stagingDesc = desc; + stagingDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; + + CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + ThrowIfFailed(mDevice->CreateCommittedResource( + &defaultHeapProperties, + D3D12_HEAP_FLAG_NONE, + &stagingDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(staging.GetAddressOf()))); + + SetDebugObjectName(staging.Get(), L"GenerateMips Staging"); + + // Copy the resource to staging + Transition(resource, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_COPY_SOURCE); + mList->CopyResource(staging.Get(), resource); + Transition(staging.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + } + else + { + // Resource is already a UAV so we can do this in-place + staging = resource; + } + + // Create a descriptor heap that holds our resource descriptors + ComPtr descriptorHeap; + D3D12_DESCRIPTOR_HEAP_DESC descriptorHeapDesc = {}; + descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + descriptorHeapDesc.NumDescriptors = desc.MipLevels; + mDevice->CreateDescriptorHeap(&descriptorHeapDesc, IID_GRAPHICS_PPV_ARGS(descriptorHeap.GetAddressOf())); + + uint32_t descriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + + // Create the top-level SRV + CD3DX12_CPU_DESCRIPTOR_HANDLE handleIt(descriptorHeap->GetCPUDescriptorHandleForHeapStart()); + D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; + srvDesc.Format = desc.Format; + srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + srvDesc.Texture2D.MostDetailedMip = 0; + srvDesc.Texture2D.MipLevels = desc.MipLevels; + + mDevice->CreateShaderResourceView(staging.Get(), &srvDesc, handleIt); + + // Create the UAVs for the tail + for (uint16_t mip = 1; mip < desc.MipLevels; ++mip) + { + D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = {}; + uavDesc.Format = ConvertSRVtoUAVFormat(desc.Format); + uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D; + uavDesc.Texture2D.MipSlice = mip; + + handleIt.Offset(descriptorSize); + mDevice->CreateUnorderedAccessView(staging.Get(), nullptr, &uavDesc, handleIt); + } + + // Set up UAV barrier (used in loop) + D3D12_RESOURCE_BARRIER barrierUAV = {}; + barrierUAV.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrierUAV.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + barrierUAV.UAV.pResource = staging.Get(); + + // Barrier for transitioning the subresources to UAVs + D3D12_RESOURCE_BARRIER srv2uavDesc = {}; + srv2uavDesc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + srv2uavDesc.Transition.pResource = staging.Get(); + srv2uavDesc.Transition.Subresource = 0; + srv2uavDesc.Transition.StateBefore = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + srv2uavDesc.Transition.StateAfter = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + + // Barrier for transitioning the subresources to SRVs + D3D12_RESOURCE_BARRIER uav2srvDesc = {}; + uav2srvDesc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + uav2srvDesc.Transition.pResource = staging.Get(); + uav2srvDesc.Transition.Subresource = 0; + uav2srvDesc.Transition.StateBefore = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + uav2srvDesc.Transition.StateAfter = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + + // based on format, select srgb or not + ComPtr pso = mGenMipsResources->generateMipsPSO; + + // Set up state + mList->SetComputeRootSignature(mGenMipsResources->rootSignature.Get()); + mList->SetPipelineState(pso.Get()); + mList->SetDescriptorHeaps(1, descriptorHeap.GetAddressOf()); + mList->SetComputeRootDescriptorTable(GenerateMipsResources::SourceTexture, descriptorHeap->GetGPUDescriptorHandleForHeapStart()); + + // Get the descriptor handle -- uavH will increment over each loop + CD3DX12_GPU_DESCRIPTOR_HANDLE uavH( + descriptorHeap->GetGPUDescriptorHandleForHeapStart(), + descriptorSize); // offset by 1 descriptor + + // Process each mip + uint32_t mipWidth = (uint32_t)desc.Width; + uint32_t mipHeight = desc.Height; + for (uint32_t mip = 1; mip < desc.MipLevels; ++mip) + { + mipWidth = std::max(1, mipWidth >> 1); + mipHeight = std::max(1, mipHeight >> 1); + + // Transition the mip to a UAV + srv2uavDesc.Transition.Subresource = mip; + mList->ResourceBarrier(1, &srv2uavDesc); + + // Bind the mip subresources + mList->SetComputeRootDescriptorTable(GenerateMipsResources::TargetTexture, uavH); + + // Set constants + GenerateMipsResources::ConstantData constants; + constants.SrcMipIndex = mip - 1; + constants.InvOutTexelSize = XMFLOAT2(1 / (float)mipWidth, 1 / (float)mipHeight); + mList->SetComputeRoot32BitConstants( + GenerateMipsResources::Constants, + GenerateMipsResources::Num32BitConstants, + &constants, + 0); + + // Process this mip + mList->Dispatch( + (mipWidth + GenerateMipsResources::ThreadGroupSize - 1) / GenerateMipsResources::ThreadGroupSize, + (mipHeight + GenerateMipsResources::ThreadGroupSize - 1) / GenerateMipsResources::ThreadGroupSize, + 1); + + mList->ResourceBarrier(1, &barrierUAV); + + // Transition the mip to an SRV + uav2srvDesc.Transition.Subresource = mip; + mList->ResourceBarrier(1, &uav2srvDesc); + + // Offset the descriptor heap handles + uavH.Offset(descriptorSize); + } + + // If the staging resource is NOT the same as the resource, we need to copy everything back + if (staging.Get() != resource) + { + // Transition the resources ready for copy + Transition(staging.Get(), D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_COPY_SOURCE); + Transition(resource, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_COPY_DEST); + + // Copy the entire resource back + mList->CopyResource(resource, staging.Get()); + + // Transition the target resource back to pixel shader resource + Transition(resource, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + + mTrackedObjects.push_back(staging); + } + + // Add our temporary objects to the deferred deletion queue + mTrackedObjects.push_back(mGenMipsResources->rootSignature); + mTrackedObjects.push_back(pso); + mTrackedObjects.push_back(resource); + mTrackedObjects.push_back(descriptorHeap); + } + + // Transition a resource once you're done with it + void Transition( + _In_ ID3D12Resource* resource, + _In_ D3D12_RESOURCE_STATES stateBefore, + _In_ D3D12_RESOURCE_STATES stateAfter) + { + if (!mInBeginEndBlock) + throw std::exception("Can't call Upload on a closed ResourceUploadBatch."); + + TransitionResource(mList.Get(), resource, stateBefore, stateAfter); + } + + // Submits all the uploads to the driver. + // No more uploads can happen after this call until Begin is called again. + // This returns a handle to an event that can be waited on. + std::future End( + _In_ ID3D12CommandQueue* commandQueue) + { + if (!mInBeginEndBlock) + throw std::exception("ResourceUploadBatch already closed."); + + PIXEndEvent(mList.Get()); + + ThrowIfFailed(mList->Close()); + + // Submit the job to the GPU + commandQueue->ExecuteCommandLists(1, (ID3D12CommandList**)mList.GetAddressOf()); + + // Set an event so we get notified when the GPU has completed all its work + ComPtr fence; + ThrowIfFailed(mDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(fence.GetAddressOf()))); + HANDLE gpuCompletedEvent = CreateEventEx(nullptr, nullptr, 0, EVENT_ALL_ACCESS); + if (!gpuCompletedEvent) + throw std::exception("CreateEventEx"); + + ThrowIfFailed(commandQueue->Signal(fence.Get(), 1ULL)); + ThrowIfFailed(fence->SetEventOnCompletion(1ULL, gpuCompletedEvent)); + + // Create a packet of data that'll be passed to our waiting upload thread + UploadBatch* uploadBatch = new UploadBatch(); + uploadBatch->CommandList = mList; + uploadBatch->Fence = fence; + uploadBatch->GpuCompleteEvent = gpuCompletedEvent; + uploadBatch->TrackedObjects.insert(std::end(uploadBatch->TrackedObjects), std::begin(mTrackedObjects), std::end(mTrackedObjects)); + + // Kick off a thread that waits for the upload to complete on the GPU timeline. + // Let the thread run autonomously, but provide a future the user can wait on. + std::future future = std::async(std::launch::async, [uploadBatch]() + { + // Wait on the GPU-complete notification + auto wr = WaitForSingleObject(uploadBatch->GpuCompleteEvent, INFINITE); + assert(wr == WAIT_OBJECT_0); + wr; + + // Delete the batch + // Because the vector contains ComPtrs, their destructors will fire and the + // resources will be Released. + delete uploadBatch; + }); + + // Reset our state + mInBeginEndBlock = false; + mTrackedObjects.resize(0); + mList.Reset(); + mCmdAlloc.Reset(); + + return std::move(future); + } + +private: + struct UploadBatch + { + std::vector> TrackedObjects; + ComPtr CommandList; + ComPtr Fence; + HANDLE GpuCompleteEvent; + }; + + ComPtr mDevice; + ComPtr mCmdAlloc; + ComPtr mList; + std::unique_ptr mGenMipsResources; + + std::vector> mTrackedObjects; + bool mInBeginEndBlock; +}; + + + +// Public constructor. +ResourceUploadBatch::ResourceUploadBatch(_In_ ID3D12Device* device) + : pImpl(std::make_unique(device)) +{ +} + + +// Public destructor. +ResourceUploadBatch::~ResourceUploadBatch() +{ +} + + +// Move constructor. +ResourceUploadBatch::ResourceUploadBatch(ResourceUploadBatch&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +ResourceUploadBatch& ResourceUploadBatch::operator= (ResourceUploadBatch&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +void ResourceUploadBatch::Begin() +{ + pImpl->Begin(); +} + + +void ResourceUploadBatch::Upload( + _In_ ID3D12Resource* resource, + _In_ uint32_t subresourceIndexStart, + _In_reads_(numSubresources) D3D12_SUBRESOURCE_DATA* subRes, + _In_ uint32_t numSubresources) +{ + pImpl->Upload(resource, subresourceIndexStart, subRes, numSubresources); +} + + +void ResourceUploadBatch::GenerateMips(_In_ ID3D12Resource* resource) +{ + pImpl->GenerateMips(resource); +} + + +void ResourceUploadBatch::Transition( + _In_ ID3D12Resource* resource, + _In_ D3D12_RESOURCE_STATES stateBefore, + _In_ D3D12_RESOURCE_STATES stateAfter) +{ + pImpl->Transition(resource, stateBefore, stateAfter); +} + + +std::future ResourceUploadBatch::End(_In_ ID3D12CommandQueue* commandQueue) +{ + return std::move(pImpl->End(commandQueue)); +} + diff --git a/Kits/DirectXTK12/Src/SDKMesh.h b/Kits/DirectXTK12/Src/SDKMesh.h new file mode 100644 index 0000000000000000000000000000000000000000..6848d9e5a22fe6e472d6a0939423837dd60af186 --- /dev/null +++ b/Kits/DirectXTK12/Src/SDKMesh.h @@ -0,0 +1,340 @@ +//-------------------------------------------------------------------------------------- +// File: SDKMesh.h +// +// SDKMESH format is generated by the legacy DirectX SDK's Content Exporter and +// originally rendered by the DXUT helper class SDKMesh +// +// http://go.microsoft.com/fwlink/?LinkId=226208 +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + + +namespace DXUT +{ + // .SDKMESH files + + // SDKMESH_HEADER + // SDKMESH_VERTEX_BUFFER_HEADER header->VertexStreamHeadersOffset + // SDKMESH_INDEX_BUFFER_HEADER header->IndexStreamHeadersOffset + // SDKMESH_MESH header->MeshDataOffset + // SDKMESH_SUBSET header->SubsetDataOffset + // SDKMESH_FRAME header->FrameDataOffset + // SDKMESH_MATERIAL header->MaterialDataOffset + // [header->NonBufferDataSize] + // { [ header->NumVertexBuffers] + // VB data + // } + // { [ header->NumIndexBuffers] + // IB data + // } + + + // .SDDKANIM files + + // SDKANIMATION_FILE_HEADER + // uint8_t[] - Length of fileheader->AnimationDataSize + + // .SDKMESH uses Direct3D 9 decls, but only a subset of these is ever generated by the legacy DirectX SDK Content Exporter + + // D3DDECLUSAGE_POSITION / D3DDECLTYPE_FLOAT3 + // (D3DDECLUSAGE_BLENDWEIGHT / D3DDECLTYPE_UBYTE4N + // D3DDECLUSAGE_BLENDINDICES / D3DDECLTYPE_UBYTE4)? + // (D3DDECLUSAGE_NORMAL / D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_SHORT4N, D3DDECLTYPE_UBYTE4N, or D3DDECLTYPE_DEC3N [not supported])? + // (D3DDECLUSAGE_COLOR / D3DDECLTYPE_D3DCOLOR)? + // (D3DDECLUSAGE_TEXCOORD / D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT2 or D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT3 or D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT4 or D3DDECLTYPE_FLOAT16_4)* + // (D3DDECLUSAGE_TANGENT / same as D3DDECLUSAGE_NORMAL)? + // (D3DDECLUSAGE_BINORMAL / same as D3DDECLUSAGE_NORMAL)? + + enum D3DDECLUSAGE + { + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT =1, + D3DDECLUSAGE_BLENDINDICES =2, + D3DDECLUSAGE_NORMAL =3, + D3DDECLUSAGE_TEXCOORD = 5, + D3DDECLUSAGE_TANGENT = 6, + D3DDECLUSAGE_BINORMAL = 7, + D3DDECLUSAGE_COLOR = 10, + }; + + enum D3DDECLTYPE + { + D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) + D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) + D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) + D3DDECLTYPE_FLOAT4 = 3, // 4D float + D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) + D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned uint8_t + D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 + D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) + // Note: There is no equivalent to D3DDECLTYPE_DEC3N (14) as a DXGI_FORMAT + D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) + D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values + + D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. + }; + + #pragma pack(push,4) + + struct D3DVERTEXELEMENT9 + { + uint16_t Stream; // Stream index + uint16_t Offset; // Offset in the stream in bytes + uint8_t Type; // Data type + uint8_t Method; // Processing method + uint8_t Usage; // Semantics + uint8_t UsageIndex; // Semantic index + }; + + #pragma pack(pop) + + //-------------------------------------------------------------------------------------- + // Hard Defines for the various structures + //-------------------------------------------------------------------------------------- + const uint32_t SDKMESH_FILE_VERSION = 101; + const uint32_t MAX_VERTEX_ELEMENTS = 32; + const uint32_t MAX_VERTEX_STREAMS = 16; + const uint32_t MAX_FRAME_NAME = 100; + const uint32_t MAX_MESH_NAME = 100; + const uint32_t MAX_SUBSET_NAME = 100; + const uint32_t MAX_MATERIAL_NAME = 100; + const uint32_t MAX_TEXTURE_NAME = MAX_PATH; + const uint32_t MAX_MATERIAL_PATH = MAX_PATH; + const uint32_t INVALID_FRAME = uint32_t(-1); + const uint32_t INVALID_MESH = uint32_t(-1); + const uint32_t INVALID_MATERIAL = uint32_t(-1); + const uint32_t INVALID_SUBSET = uint32_t(-1); + const uint32_t INVALID_ANIMATION_DATA = uint32_t(-1); + const uint32_t INVALID_SAMPLER_SLOT = uint32_t(-1); + const uint32_t ERROR_RESOURCE_VALUE = 1; + + //-------------------------------------------------------------------------------------- + // Enumerated Types. + //-------------------------------------------------------------------------------------- + enum SDKMESH_PRIMITIVE_TYPE + { + PT_TRIANGLE_LIST = 0, + PT_TRIANGLE_STRIP, + PT_LINE_LIST, + PT_LINE_STRIP, + PT_POINT_LIST, + PT_TRIANGLE_LIST_ADJ, + PT_TRIANGLE_STRIP_ADJ, + PT_LINE_LIST_ADJ, + PT_LINE_STRIP_ADJ, + PT_QUAD_PATCH_LIST, + PT_TRIANGLE_PATCH_LIST, + }; + + enum SDKMESH_INDEX_TYPE + { + IT_16BIT = 0, + IT_32BIT, + }; + + enum FRAME_TRANSFORM_TYPE + { + FTT_RELATIVE = 0, + FTT_ABSOLUTE, //This is not currently used but is here to support absolute transformations in the future + }; + + //-------------------------------------------------------------------------------------- + // Structures. + //-------------------------------------------------------------------------------------- + #pragma pack(push,8) + + struct SDKMESH_HEADER + { + //Basic Info and sizes + uint32_t Version; + uint8_t IsBigEndian; + uint64_t HeaderSize; + uint64_t NonBufferDataSize; + uint64_t BufferDataSize; + + //Stats + uint32_t NumVertexBuffers; + uint32_t NumIndexBuffers; + uint32_t NumMeshes; + uint32_t NumTotalSubsets; + uint32_t NumFrames; + uint32_t NumMaterials; + + //Offsets to Data + uint64_t VertexStreamHeadersOffset; + uint64_t IndexStreamHeadersOffset; + uint64_t MeshDataOffset; + uint64_t SubsetDataOffset; + uint64_t FrameDataOffset; + uint64_t MaterialDataOffset; + }; + + struct SDKMESH_VERTEX_BUFFER_HEADER + { + uint64_t NumVertices; + uint64_t SizeBytes; + uint64_t StrideBytes; + D3DVERTEXELEMENT9 Decl[MAX_VERTEX_ELEMENTS]; + union + { + uint64_t DataOffset; + }; + }; + + struct SDKMESH_INDEX_BUFFER_HEADER + { + uint64_t NumIndices; + uint64_t SizeBytes; + uint32_t IndexType; + union + { + uint64_t DataOffset; + }; + }; + + struct SDKMESH_MESH + { + char Name[MAX_MESH_NAME]; + uint8_t NumVertexBuffers; + uint32_t VertexBuffers[MAX_VERTEX_STREAMS]; + uint32_t IndexBuffer; + uint32_t NumSubsets; + uint32_t NumFrameInfluences; //aka bones + + DirectX::XMFLOAT3 BoundingBoxCenter; + DirectX::XMFLOAT3 BoundingBoxExtents; + + union + { + uint64_t SubsetOffset; + INT* pSubsets; + }; + union + { + uint64_t FrameInfluenceOffset; + uint32_t* pFrameInfluences; + }; + }; + + struct SDKMESH_SUBSET + { + char Name[MAX_SUBSET_NAME]; + uint32_t MaterialID; + uint32_t PrimitiveType; + uint64_t IndexStart; + uint64_t IndexCount; + uint64_t VertexStart; + uint64_t VertexCount; + }; + + struct SDKMESH_FRAME + { + char Name[MAX_FRAME_NAME]; + uint32_t Mesh; + uint32_t ParentFrame; + uint32_t ChildFrame; + uint32_t SiblingFrame; + DirectX::XMFLOAT4X4 Matrix; + uint32_t AnimationDataIndex; //Used to index which set of keyframes transforms this frame + }; + + struct SDKMESH_MATERIAL + { + char Name[MAX_MATERIAL_NAME]; + + // Use MaterialInstancePath + char MaterialInstancePath[MAX_MATERIAL_PATH]; + + // Or fall back to d3d8-type materials + char DiffuseTexture[MAX_TEXTURE_NAME]; + char NormalTexture[MAX_TEXTURE_NAME]; + char SpecularTexture[MAX_TEXTURE_NAME]; + + DirectX::XMFLOAT4 Diffuse; + DirectX::XMFLOAT4 Ambient; + DirectX::XMFLOAT4 Specular; + DirectX::XMFLOAT4 Emissive; + float Power; + + union + { + uint64_t Force64_1; //Force the union to 64bits + }; + union + { + uint64_t Force64_2; //Force the union to 64bits + }; + union + { + uint64_t Force64_3; //Force the union to 64bits + }; + + union + { + uint64_t Force64_4; //Force the union to 64bits + }; + union + { + uint64_t Force64_5; //Force the union to 64bits + }; + union + { + uint64_t Force64_6; //Force the union to 64bits + }; + }; + + struct SDKANIMATION_FILE_HEADER + { + uint32_t Version; + uint8_t IsBigEndian; + uint32_t FrameTransformType; + uint32_t NumFrames; + uint32_t NumAnimationKeys; + uint32_t AnimationFPS; + uint64_t AnimationDataSize; + uint64_t AnimationDataOffset; + }; + + struct SDKANIMATION_DATA + { + DirectX::XMFLOAT3 Translation; + DirectX::XMFLOAT4 Orientation; + DirectX::XMFLOAT3 Scaling; + }; + + struct SDKANIMATION_FRAME_DATA + { + char FrameName[MAX_FRAME_NAME]; + union + { + uint64_t DataOffset; + SDKANIMATION_DATA* pAnimationData; + }; + }; + + #pragma pack(pop) + +} // namespace + +static_assert( sizeof(DXUT::D3DVERTEXELEMENT9) == 8, "Direct3D9 Decl structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_HEADER)== 104, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_VERTEX_BUFFER_HEADER) == 288, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_INDEX_BUFFER_HEADER) == 32, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_MESH) == 224, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_SUBSET) == 144, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_FRAME) == 184, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKMESH_MATERIAL) == 1256, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKANIMATION_FILE_HEADER) == 40, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKANIMATION_DATA) == 40, "SDK Mesh structure size incorrect" ); +static_assert( sizeof(DXUT::SDKANIMATION_FRAME_DATA) == 112, "SDK Mesh structure size incorrect" ); diff --git a/Kits/DirectXTK12/Src/ScreenGrab.cpp b/Kits/DirectXTK12/Src/ScreenGrab.cpp new file mode 100644 index 0000000000000000000000000000000000000000..24045e74e2691970135979ef2b225233854dc00b --- /dev/null +++ b/Kits/DirectXTK12/Src/ScreenGrab.cpp @@ -0,0 +1,713 @@ +//-------------------------------------------------------------------------------------- +// File: ScreenGrab.cpp +// +// Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' +// when used on a Direct3D Render Target). +// +// Note these functions are useful as a light-weight runtime screen grabber. For +// full-featured texture capture, DDS writer, and texture processing pipeline, +// see the 'Texconv' sample and the 'DirectXTex' library. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +// Does not capture 1D textures or 3D textures (volume maps) + +// Does not capture mipmap chains, only the top-most texture level is saved + +// For 2D array textures and cubemaps, it captures only the first image in the array + +#include "pch.h" + +#include "ScreenGrab.h" +#include "DirectXHelpers.h" + +#include "dds.h" +#include "PlatformHelpers.h" +#include "LoaderHelpers.h" + +using Microsoft::WRL::ComPtr; +using namespace DirectX; + +namespace +{ + //-------------------------------------------------------------------------------------- + HRESULT CaptureTexture(_In_ ID3D12Device* device, + _In_ ID3D12CommandQueue* pCommandQ, + _In_ ID3D12Resource* pSource, + _In_ UINT64 srcPitch, + _In_ const D3D12_RESOURCE_DESC& desc, + _Inout_ ComPtr& pStaging) + { + if (!pCommandQ || !pSource) + return E_INVALIDARG; + + if (desc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D) + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + + D3D12_HEAP_PROPERTIES sourceHeapProperties; + D3D12_HEAP_FLAGS sourceHeapFlags; + HRESULT hr = pSource->GetHeapProperties(&sourceHeapProperties, &sourceHeapFlags); + if (FAILED(hr)) + return hr; + + if (sourceHeapProperties.Type == D3D12_HEAP_TYPE_READBACK) + { + // Handle case where the source is already a staging texture we can use directly + pStaging = pSource; + return S_OK; + } + + // Create a command allocator + ComPtr commandAlloc; + hr = device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_GRAPHICS_PPV_ARGS(commandAlloc.GetAddressOf())); + if (FAILED(hr)) + return hr; + + // Spin up a new command list + ComPtr commandList; + hr = device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, commandAlloc.Get(), nullptr, IID_GRAPHICS_PPV_ARGS(commandList.GetAddressOf())); + if (FAILED(hr)) + return hr; + + // Create a fence + ComPtr fence; + hr = device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(fence.GetAddressOf())); + if (FAILED(hr)) + return hr; + + assert((srcPitch & 0xFF) == 0); + + CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + CD3DX12_HEAP_PROPERTIES readBackHeapProperties(D3D12_HEAP_TYPE_READBACK); + + // Readback resources must be buffers + D3D12_RESOURCE_DESC bufferDesc = {}; + bufferDesc.Alignment = desc.Alignment; + bufferDesc.DepthOrArraySize = 1; + bufferDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + bufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + bufferDesc.Format = DXGI_FORMAT_UNKNOWN; + bufferDesc.Height = 1; + bufferDesc.Width = srcPitch * desc.Height; + bufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + bufferDesc.MipLevels = 1; + bufferDesc.SampleDesc.Count = 1; + bufferDesc.SampleDesc.Quality = 0; + + ComPtr copySource(pSource); + if (desc.SampleDesc.Count > 1) + { + // MSAA content must be resolved before being copied to a staging texture + auto descCopy = desc; + descCopy.SampleDesc.Count = 1; + descCopy.SampleDesc.Quality = 0; + + ComPtr pTemp; + hr = device->CreateCommittedResource( + &defaultHeapProperties, + D3D12_HEAP_FLAG_NONE, + &descCopy, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(pTemp.GetAddressOf())); + if (FAILED(hr)) + return hr; + + assert(pTemp); + + DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format); + + D3D12_FEATURE_DATA_FORMAT_SUPPORT formatInfo = { fmt }; + hr = device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &formatInfo, sizeof(formatInfo)); + if (FAILED(hr)) + return hr; + + if (!(formatInfo.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D)) + return E_FAIL; + + for (UINT item = 0; item < desc.DepthOrArraySize; ++item) + { + for (UINT level = 0; level < desc.MipLevels; ++level) + { + UINT index = D3D12CalcSubresource(level, item, 0, desc.MipLevels, desc.DepthOrArraySize); + commandList->ResolveSubresource(pTemp.Get(), index, pSource, index, fmt); + } + } + + copySource = pTemp; + } + + // Create a staging texture + hr = device->CreateCommittedResource( + &readBackHeapProperties, + D3D12_HEAP_FLAG_NONE, + &bufferDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(pStaging.GetAddressOf())); + if (FAILED(hr)) + return hr; + + assert(pStaging); + + // Get the copy target location + D3D12_PLACED_SUBRESOURCE_FOOTPRINT bufferFootprint = {}; + bufferFootprint.Footprint.Width = (UINT)desc.Width; + bufferFootprint.Footprint.Height = desc.Height; + bufferFootprint.Footprint.Depth = 1; + bufferFootprint.Footprint.RowPitch = (UINT)(srcPitch); + bufferFootprint.Footprint.Format = desc.Format; + + CD3DX12_TEXTURE_COPY_LOCATION copyDest(pStaging.Get(), bufferFootprint); + CD3DX12_TEXTURE_COPY_LOCATION copySrc(copySource.Get(), 0); + + // Copy the texture + commandList->CopyTextureRegion(©Dest, 0, 0, 0, ©Src, nullptr); + + commandList->Close(); + + // Execute the command list + pCommandQ->ExecuteCommandLists(1, (ID3D12CommandList**)commandList.GetAddressOf()); + + // Signal the fence + pCommandQ->Signal(fence.Get(), 1); + + // Block until the copy is complete + while (fence->GetCompletedValue() < 1) + SwitchToThread(); + + return S_OK; + } +} // anonymous namespace + + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::SaveDDSTextureToFile( ID3D12CommandQueue* pCommandQ, + ID3D12Resource* pSource, + const wchar_t* fileName ) +{ + if ( !fileName ) + return E_INVALIDARG; + + ComPtr device; + pCommandQ->GetDevice(IID_GRAPHICS_PPV_ARGS(device.GetAddressOf())); + + // Get the size of the image + D3D12_RESOURCE_DESC desc = pSource->GetDesc(); + UINT64 totalResourceSize = 0; + UINT64 fpRowPitch = 0; + UINT fpRowCount = 0; + // Get the rowcount, pitch and size of the top mip + device->GetCopyableFootprints( + &desc, + 0, + 1, + 0, + nullptr, + &fpRowCount, + &fpRowPitch, + &totalResourceSize); + + // Round up the srcPitch to multiples of 256 + UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFF; + + ComPtr pStaging; + HRESULT hr = CaptureTexture( device.Get(), pCommandQ, pSource, dstRowPitch, desc, pStaging ); + if ( FAILED(hr) ) + return hr; + + // Create file +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + ScopedHandle hFile( safe_handle( CreateFile2( fileName, GENERIC_WRITE, 0, CREATE_ALWAYS, 0 ) ) ); +#else + ScopedHandle hFile( safe_handle( CreateFileW( fileName, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0 ) ) ); +#endif + if ( !hFile ) + return HRESULT_FROM_WIN32( GetLastError() ); + + auto_delete_file delonfail(hFile.get()); + + // Setup header + const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10); + uint8_t fileHeader[ MAX_HEADER_SIZE ]; + + *reinterpret_cast(&fileHeader[0]) = DDS_MAGIC; + + auto header = reinterpret_cast( &fileHeader[0] + sizeof(uint32_t) ); + size_t headerSize = sizeof(uint32_t) + sizeof(DDS_HEADER); + memset( header, 0, sizeof(DDS_HEADER) ); + header->size = sizeof( DDS_HEADER ); + header->flags = DDS_HEADER_FLAGS_TEXTURE | DDS_HEADER_FLAGS_MIPMAP; + header->height = desc.Height; + header->width = (uint32_t) desc.Width; + header->mipMapCount = 1; + header->caps = DDS_SURFACE_FLAGS_TEXTURE; + + // Try to use a legacy .DDS pixel format for better tools support, otherwise fallback to 'DX10' header extension + DDS_HEADER_DXT10* extHeader = nullptr; + switch( desc.Format ) + { + case DXGI_FORMAT_R8G8B8A8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A8B8G8R8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R16G16_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_G16R16, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R8G8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A8L8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R16_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_L16, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_L8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_A8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R8G8_B8G8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_R8G8_B8G8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_G8R8_G8B8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_G8R8_G8B8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC1_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_DXT1, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC2_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_DXT3, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC3_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_DXT5, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC4_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_BC4_UNORM, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC4_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_BC4_SNORM, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC5_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_BC5_UNORM, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_BC5_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_BC5_SNORM, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_B5G6R5_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_R5G6B5, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_B5G5R5A1_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A1R5G5B5, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R8G8_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_V8U8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R8G8B8A8_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_Q8W8V8U8, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_R16G16_SNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_V16U16, sizeof(DDS_PIXELFORMAT) ); break; + case DXGI_FORMAT_B8G8R8A8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A8R8G8B8, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.1 + case DXGI_FORMAT_B8G8R8X8_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_X8R8G8B8, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.1 + case DXGI_FORMAT_YUY2: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_YUY2, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.2 + case DXGI_FORMAT_B4G4R4A4_UNORM: memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_A4R4G4B4, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.2 + + // Legacy D3DX formats using D3DFMT enum value as FourCC + case DXGI_FORMAT_R32G32B32A32_FLOAT: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 116; break; // D3DFMT_A32B32G32R32F + case DXGI_FORMAT_R16G16B16A16_FLOAT: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 113; break; // D3DFMT_A16B16G16R16F + case DXGI_FORMAT_R16G16B16A16_UNORM: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 36; break; // D3DFMT_A16B16G16R16 + case DXGI_FORMAT_R16G16B16A16_SNORM: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 110; break; // D3DFMT_Q16W16V16U16 + case DXGI_FORMAT_R32G32_FLOAT: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 115; break; // D3DFMT_G32R32F + case DXGI_FORMAT_R16G16_FLOAT: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 112; break; // D3DFMT_G16R16F + case DXGI_FORMAT_R32_FLOAT: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 114; break; // D3DFMT_R32F + case DXGI_FORMAT_R16_FLOAT: header->ddspf.size = sizeof(DDS_PIXELFORMAT); header->ddspf.flags = DDS_FOURCC; header->ddspf.fourCC = 111; break; // D3DFMT_R16F + + case DXGI_FORMAT_AI44: + case DXGI_FORMAT_IA44: + case DXGI_FORMAT_P8: + case DXGI_FORMAT_A8P8: + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + + default: + memcpy_s( &header->ddspf, sizeof(header->ddspf), &DDSPF_DX10, sizeof(DDS_PIXELFORMAT) ); + + headerSize += sizeof(DDS_HEADER_DXT10); + extHeader = reinterpret_cast( reinterpret_cast(&fileHeader[0]) + sizeof(uint32_t) + sizeof(DDS_HEADER) ); + memset( extHeader, 0, sizeof(DDS_HEADER_DXT10) ); + extHeader->dxgiFormat = desc.Format; + extHeader->resourceDimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + extHeader->arraySize = 1; + break; + } + + size_t rowPitch, slicePitch, rowCount; + GetSurfaceInfo( (size_t)desc.Width, desc.Height, desc.Format, &slicePitch, &rowPitch, &rowCount ); + + if ( IsCompressed( desc.Format ) ) + { + header->flags |= DDS_HEADER_FLAGS_LINEARSIZE; + header->pitchOrLinearSize = static_cast( slicePitch ); + } + else + { + header->flags |= DDS_HEADER_FLAGS_PITCH; + header->pitchOrLinearSize = static_cast( rowPitch ); + } + + // Setup pixels + std::unique_ptr pixels( new (std::nothrow) uint8_t[ slicePitch ] ); + if (!pixels) + return E_OUTOFMEMORY; + + assert(fpRowCount == rowCount); + assert(fpRowPitch == rowPitch); + + void* pMappedMemory; + D3D12_RANGE readRange = { 0, static_cast(dstRowPitch * rowCount) }; + D3D12_RANGE writeRange = { 0, 0 }; + hr = pStaging->Map(0, &readRange, &pMappedMemory ); + if ( FAILED(hr) ) + return hr; + + auto sptr = reinterpret_cast(pMappedMemory); + if ( !sptr ) + { + pStaging->Unmap(0, &writeRange); + return E_POINTER; + } + + uint8_t* dptr = pixels.get(); + + size_t msize = std::min( rowPitch, rowPitch ); + for( size_t h = 0; h < rowCount; ++h ) + { + memcpy_s( dptr, rowPitch, sptr, msize ); + sptr += dstRowPitch; + dptr += rowPitch; + } + + pStaging->Unmap( 0, &writeRange ); + + // Write header & pixels + DWORD bytesWritten; + if ( !WriteFile( hFile.get(), fileHeader, static_cast( headerSize ), &bytesWritten, 0 ) ) + return HRESULT_FROM_WIN32( GetLastError() ); + + if ( bytesWritten != headerSize ) + return E_FAIL; + + if ( !WriteFile( hFile.get(), pixels.get(), static_cast( slicePitch ), &bytesWritten, 0 ) ) + return HRESULT_FROM_WIN32( GetLastError() ); + + if ( bytesWritten != slicePitch ) + return E_FAIL; + + delonfail.clear(); + + return S_OK; +} + +//-------------------------------------------------------------------------------------- +namespace DirectX +{ +extern IWICImagingFactory2* _GetWIC(); +} + +_Use_decl_annotations_ +HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ, + ID3D12Resource* pSource, + REFGUID guidContainerFormat, + const wchar_t* fileName, + const GUID* targetFormat, + std::function setCustomProps ) +{ + if ( !fileName ) + return E_INVALIDARG; + + ComPtr device; + pCommandQ->GetDevice(IID_GRAPHICS_PPV_ARGS(device.GetAddressOf())); + + // Get the size of the image + D3D12_RESOURCE_DESC desc = pSource->GetDesc(); + UINT64 totalResourceSize = 0; + UINT64 fpRowPitch = 0; + UINT fpRowCount = 0; + // Get the rowcount, pitch and size of the top mip + device->GetCopyableFootprints( + &desc, + 0, + 1, + 0, + nullptr, + &fpRowCount, + &fpRowPitch, + &totalResourceSize); + + // Round up the srcPitch to multiples of 256 + UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFF; + + ComPtr pStaging; + HRESULT hr = CaptureTexture(device.Get(), pCommandQ, pSource, dstRowPitch, desc, pStaging); + if (FAILED(hr)) + return hr; + + // Determine source format's WIC equivalent + WICPixelFormatGUID pfGuid; + bool sRGB = false; + switch ( desc.Format ) + { + case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break; + case DXGI_FORMAT_R16G16B16A16_FLOAT: pfGuid = GUID_WICPixelFormat64bppRGBAHalf; break; + case DXGI_FORMAT_R16G16B16A16_UNORM: pfGuid = GUID_WICPixelFormat64bppRGBA; break; + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: pfGuid = GUID_WICPixelFormat32bppRGBA1010102XR; break; // DXGI 1.1 + case DXGI_FORMAT_R10G10B10A2_UNORM: pfGuid = GUID_WICPixelFormat32bppRGBA1010102; break; + case DXGI_FORMAT_B5G5R5A1_UNORM: pfGuid = GUID_WICPixelFormat16bppBGRA5551; break; + case DXGI_FORMAT_B5G6R5_UNORM: pfGuid = GUID_WICPixelFormat16bppBGR565; break; + case DXGI_FORMAT_R32_FLOAT: pfGuid = GUID_WICPixelFormat32bppGrayFloat; break; + case DXGI_FORMAT_R16_FLOAT: pfGuid = GUID_WICPixelFormat16bppGrayHalf; break; + case DXGI_FORMAT_R16_UNORM: pfGuid = GUID_WICPixelFormat16bppGray; break; + case DXGI_FORMAT_R8_UNORM: pfGuid = GUID_WICPixelFormat8bppGray; break; + case DXGI_FORMAT_A8_UNORM: pfGuid = GUID_WICPixelFormat8bppAlpha; break; + + case DXGI_FORMAT_R8G8B8A8_UNORM: + pfGuid = GUID_WICPixelFormat32bppRGBA; + break; + + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + pfGuid = GUID_WICPixelFormat32bppRGBA; + sRGB = true; + break; + + case DXGI_FORMAT_B8G8R8A8_UNORM: // DXGI 1.1 + pfGuid = GUID_WICPixelFormat32bppBGRA; + break; + + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: // DXGI 1.1 + pfGuid = GUID_WICPixelFormat32bppBGRA; + sRGB = true; + break; + + case DXGI_FORMAT_B8G8R8X8_UNORM: // DXGI 1.1 + pfGuid = GUID_WICPixelFormat32bppBGR; + break; + + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: // DXGI 1.1 + pfGuid = GUID_WICPixelFormat32bppBGR; + sRGB = true; + break; + + default: + return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); + } + + auto pWIC = _GetWIC(); + if ( !pWIC ) + return E_NOINTERFACE; + + ComPtr stream; + hr = pWIC->CreateStream( stream.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + hr = stream->InitializeFromFilename( fileName, GENERIC_WRITE ); + if ( FAILED(hr) ) + return hr; + + auto_delete_file_wic delonfail(stream, fileName); + + ComPtr encoder; + hr = pWIC->CreateEncoder( guidContainerFormat, 0, encoder.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + hr = encoder->Initialize( stream.Get(), WICBitmapEncoderNoCache ); + if ( FAILED(hr) ) + return hr; + + ComPtr frame; + ComPtr props; + hr = encoder->CreateNewFrame( frame.GetAddressOf(), props.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + if ( targetFormat && memcmp( &guidContainerFormat, &GUID_ContainerFormatBmp, sizeof(WICPixelFormatGUID) ) == 0 ) + { + // Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel + PROPBAG2 option = {}; + option.pstrName = L"EnableV5Header32bppBGRA"; + + VARIANT varValue; + varValue.vt = VT_BOOL; + varValue.boolVal = VARIANT_TRUE; + (void)props->Write( 1, &option, &varValue ); + } + + if ( setCustomProps ) + { + setCustomProps( props.Get() ); + } + + hr = frame->Initialize( props.Get() ); + if ( FAILED(hr) ) + return hr; + + hr = frame->SetSize( (UINT)desc.Width, desc.Height ); + if ( FAILED(hr) ) + return hr; + + hr = frame->SetResolution( 72, 72 ); + if ( FAILED(hr) ) + return hr; + + // Pick a target format + WICPixelFormatGUID targetGuid; + if ( targetFormat ) + { + targetGuid = *targetFormat; + } + else + { + // Screenshots don’t typically include the alpha channel of the render target + switch ( desc.Format ) + { + case DXGI_FORMAT_R32G32B32A32_FLOAT: + case DXGI_FORMAT_R16G16B16A16_FLOAT: + targetGuid = GUID_WICPixelFormat96bppRGBFloat; // WIC 2 + break; + + case DXGI_FORMAT_R16G16B16A16_UNORM: targetGuid = GUID_WICPixelFormat48bppBGR; break; + case DXGI_FORMAT_B5G5R5A1_UNORM: targetGuid = GUID_WICPixelFormat16bppBGR555; break; + case DXGI_FORMAT_B5G6R5_UNORM: targetGuid = GUID_WICPixelFormat16bppBGR565; break; + + case DXGI_FORMAT_R32_FLOAT: + case DXGI_FORMAT_R16_FLOAT: + case DXGI_FORMAT_R16_UNORM: + case DXGI_FORMAT_R8_UNORM: + case DXGI_FORMAT_A8_UNORM: + targetGuid = GUID_WICPixelFormat8bppGray; + break; + + default: + targetGuid = GUID_WICPixelFormat24bppBGR; + break; + } + } + + hr = frame->SetPixelFormat( &targetGuid ); + if ( FAILED(hr) ) + return hr; + + if ( targetFormat && memcmp( targetFormat, &targetGuid, sizeof(WICPixelFormatGUID) ) != 0 ) + { + // Requested output pixel format is not supported by the WIC codec + return E_FAIL; + } + + // Encode WIC metadata + ComPtr metawriter; + if ( SUCCEEDED( frame->GetMetadataQueryWriter( metawriter.GetAddressOf() ) ) ) + { + PROPVARIANT value; + PropVariantInit( &value ); + + value.vt = VT_LPSTR; + value.pszVal = "DirectXTK"; + + if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID) ) == 0 ) + { + // Set Software name + (void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value ); + + // Set sRGB chunk + if ( sRGB ) + { + value.vt = VT_UI1; + value.bVal = 0; + (void)metawriter->SetMetadataByName( L"/sRGB/RenderingIntent", &value ); + } + } +#if defined(_XBOX_ONE) && defined(_TITLE) + else if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatJpeg, sizeof(GUID) ) == 0 ) + { + // Set Software name + (void)metawriter->SetMetadataByName( L"/app1/ifd/{ushort=305}", &value ); + + if ( sRGB ) + { + // Set EXIF Colorspace of sRGB + value.vt = VT_UI2; + value.uiVal = 1; + (void)metawriter->SetMetadataByName( L"/app1/ifd/exif/{ushort=40961}", &value ); + } + } + else if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID) ) == 0 ) + { + // Set Software name + (void)metawriter->SetMetadataByName( L"/ifd/{ushort=305}", &value ); + + if ( sRGB ) + { + // Set EXIF Colorspace of sRGB + value.vt = VT_UI2; + value.uiVal = 1; + (void)metawriter->SetMetadataByName( L"/ifd/exif/{ushort=40961}", &value ); + } + } +#else + else + { + // Set Software name + (void)metawriter->SetMetadataByName( L"System.ApplicationName", &value ); + + if ( sRGB ) + { + // Set EXIF Colorspace of sRGB + value.vt = VT_UI2; + value.uiVal = 1; + (void)metawriter->SetMetadataByName( L"System.Image.ColorSpace", &value ); + } + } +#endif + } + + void* pMappedMemory; + D3D12_RANGE readRange = {0, static_cast(dstRowPitch * desc.Height)}; + D3D12_RANGE writeRange = {0, 0}; + hr = pStaging->Map(0, &readRange, &pMappedMemory); + if (FAILED(hr)) + return hr; + + if ( memcmp( &targetGuid, &pfGuid, sizeof(WICPixelFormatGUID) ) != 0 ) + { + // Conversion required to write + ComPtr source; + hr = pWIC->CreateBitmapFromMemory((UINT) desc.Width, desc.Height, pfGuid, + (UINT) dstRowPitch, (UINT) dstRowPitch * desc.Height, + reinterpret_cast(pMappedMemory), source.GetAddressOf() ); + if ( FAILED(hr) ) + { + pStaging->Unmap( 0, &writeRange ); + return hr; + } + + ComPtr FC; + hr = pWIC->CreateFormatConverter( FC.GetAddressOf() ); + if ( FAILED(hr) ) + { + pStaging->Unmap(0, &writeRange); + return hr; + } + + BOOL canConvert = FALSE; + hr = FC->CanConvert( pfGuid, targetGuid, &canConvert ); + if ( FAILED(hr) || !canConvert ) + { + return E_UNEXPECTED; + } + + hr = FC->Initialize( source.Get(), targetGuid, WICBitmapDitherTypeNone, 0, 0, WICBitmapPaletteTypeCustom ); + if ( FAILED(hr) ) + { + pStaging->Unmap(0, &writeRange); + return hr; + } + + WICRect rect = { 0, 0, static_cast( desc.Width ), static_cast( desc.Height ) }; + hr = frame->WriteSource( FC.Get(), &rect ); + if ( FAILED(hr) ) + { + pStaging->Unmap(0, &writeRange); + return hr; + } + } + else + { + // No conversion required + hr = frame->WritePixels( desc.Height, (UINT) dstRowPitch, (UINT) dstRowPitch * desc.Height, reinterpret_cast( pMappedMemory ) ); + if ( FAILED(hr) ) + return hr; + } + + pStaging->Unmap(0, &writeRange); + + hr = frame->Commit(); + if ( FAILED(hr) ) + return hr; + + hr = encoder->Commit(); + if ( FAILED(hr) ) + return hr; + + delonfail.clear(); + + return S_OK; +} diff --git a/Kits/DirectXTK12/Src/Shaders/AlphaTestEffect.fx b/Kits/DirectXTK12/Src/Shaders/AlphaTestEffect.fx new file mode 100644 index 0000000000000000000000000000000000000000..d6aee2e005d80705a2a26141ff3b5dc8f4f6c7f0 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/AlphaTestEffect.fx @@ -0,0 +1,140 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +Texture2D Texture : register(t0); +sampler Sampler : register(s0); + + +cbuffer Parameters : register(b0) +{ + float4 DiffuseColor : packoffset(c0); + float4 AlphaTest : packoffset(c1); + float3 FogColor : packoffset(c2); + float4 FogVector : packoffset(c3); + float4x4 WorldViewProj : packoffset(c4); +}; + +#include "Structures.fxh" +#include "Common.fxh" +#include "RootSig.fxh" + +// Vertex shader: basic. +[RootSignature(MainRS)] +VSOutputTx VSAlphaTest(VSInputTx vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: no fog. +[RootSignature(MainRS)] +VSOutputTxNoFog VSAlphaTestNoFog(VSInputTx vin) +{ + VSOutputTxNoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: vertex color. +[RootSignature(MainRS)] +VSOutputTx VSAlphaTestVc(VSInputTxVc vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: vertex color, no fog. +[RootSignature(MainRS)] +VSOutputTxNoFog VSAlphaTestVcNoFog(VSInputTxVc vin) +{ + VSOutputTxNoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.TexCoord = vin.TexCoord; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Pixel shader: less/greater compare function. +[RootSignature(MainRS)] +float4 PSAlphaTestLtGt(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + clip((color.a < AlphaTest.x) ? AlphaTest.z : AlphaTest.w); + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: less/greater compare function, no fog. +[RootSignature(MainRS)] +float4 PSAlphaTestLtGtNoFog(PSInputTxNoFog pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + clip((color.a < AlphaTest.x) ? AlphaTest.z : AlphaTest.w); + + return color; +} + + +// Pixel shader: equal/notequal compare function. +[RootSignature(MainRS)] +float4 PSAlphaTestEqNe(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + clip((abs(color.a - AlphaTest.x) < AlphaTest.y) ? AlphaTest.z : AlphaTest.w); + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: equal/notequal compare function, no fog. +[RootSignature(MainRS)] +float4 PSAlphaTestEqNeNoFog(PSInputTxNoFog pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + clip((abs(color.a - AlphaTest.x) < AlphaTest.y) ? AlphaTest.z : AlphaTest.w); + + return color; +} diff --git a/Kits/DirectXTK12/Src/Shaders/BasicEffect.fx b/Kits/DirectXTK12/Src/Shaders/BasicEffect.fx new file mode 100644 index 0000000000000000000000000000000000000000..e9d7ffd9d97dff18a02406224fc8d07918ae90e1 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/BasicEffect.fx @@ -0,0 +1,471 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +Texture2D Texture : register(t0); +sampler Sampler : register(s0); + + +cbuffer Parameters : register(b0) +{ + float4 DiffuseColor : packoffset(c0); + float3 EmissiveColor : packoffset(c1); + float3 SpecularColor : packoffset(c2); + float SpecularPower : packoffset(c2.w); + + float3 LightDirection[3] : packoffset(c3); + float3 LightDiffuseColor[3] : packoffset(c6); + float3 LightSpecularColor[3] : packoffset(c9); + + float3 EyePosition : packoffset(c12); + + float3 FogColor : packoffset(c13); + float4 FogVector : packoffset(c14); + + float4x4 World : packoffset(c15); + float3x3 WorldInverseTranspose : packoffset(c19); + float4x4 WorldViewProj : packoffset(c22); +}; + + +#include "Structures.fxh" +#include "Common.fxh" +#include "RootSig.fxh" +#include "Lighting.fxh" + + +// Vertex shader: basic. +[RootSignature(MainRS)] +VSOutput VSBasic(VSInput vin) +{ + VSOutput vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + return vout; +} + + +// Vertex shader: no fog. +[RootSignature(MainRS)] +VSOutputNoFog VSBasicNoFog(VSInput vin) +{ + VSOutputNoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + return vout; +} + + +// Vertex shader: vertex color. +[RootSignature(MainRS)] +VSOutput VSBasicVc(VSInputVc vin) +{ + VSOutput vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: vertex color, no fog. +[RootSignature(MainRS)] +VSOutputNoFog VSBasicVcNoFog(VSInputVc vin) +{ + VSOutputNoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: texture. +[RootSignature(MainRS)] +VSOutputTx VSBasicTx(VSInputTx vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: texture, no fog. +[RootSignature(MainRS)] +VSOutputTxNoFog VSBasicTxNoFog(VSInputTx vin) +{ + VSOutputTxNoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: texture + vertex color. +[RootSignature(MainRS)] +VSOutputTx VSBasicTxVc(VSInputTxVc vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: texture + vertex color, no fog. +[RootSignature(MainRS)] +VSOutputTxNoFog VSBasicTxVcNoFog(VSInputTxVc vin) +{ + VSOutputTxNoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.TexCoord = vin.TexCoord; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: vertex lighting. +[RootSignature(MainRS)] +VSOutput VSBasicVertexLighting(VSInputNm vin) +{ + VSOutput vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + return vout; +} + + +// Vertex shader: vertex lighting + vertex color. +[RootSignature(MainRS)] +VSOutput VSBasicVertexLightingVc(VSInputNmVc vin) +{ + VSOutput vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: vertex lighting + texture. +[RootSignature(MainRS)] +VSOutputTx VSBasicVertexLightingTx(VSInputNmTx vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: vertex lighting + texture + vertex color. +[RootSignature(MainRS)] +VSOutputTx VSBasicVertexLightingTxVc(VSInputNmTxVc vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: one light. +[RootSignature(MainRS)] +VSOutput VSBasicOneLight(VSInputNm vin) +{ + VSOutput vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + return vout; +} + + +// Vertex shader: one light + vertex color. +[RootSignature(MainRS)] +VSOutput VSBasicOneLightVc(VSInputNmVc vin) +{ + VSOutput vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: one light + texture. +[RootSignature(MainRS)] +VSOutputTx VSBasicOneLightTx(VSInputNmTx vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: one light + texture + vertex color. +[RootSignature(MainRS)] +VSOutputTx VSBasicOneLightTxVc(VSInputNmTxVc vin) +{ + VSOutputTx vout; + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: pixel lighting. +[RootSignature(MainRS)] +VSOutputPixelLighting VSBasicPixelLighting(VSInputNm vin) +{ + VSOutputPixelLighting vout; + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse = float4(1, 1, 1, DiffuseColor.a); + + return vout; +} + + +// Vertex shader: pixel lighting + vertex color. +[RootSignature(MainRS)] +VSOutputPixelLighting VSBasicPixelLightingVc(VSInputNmVc vin) +{ + VSOutputPixelLighting vout; + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse.rgb = vin.Color.rgb; + vout.Diffuse.a = vin.Color.a * DiffuseColor.a; + + return vout; +} + + +// Vertex shader: pixel lighting + texture. +[RootSignature(MainRS)] +VSOutputPixelLightingTx VSBasicPixelLightingTx(VSInputNmTx vin) +{ + VSOutputPixelLightingTx vout; + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse = float4(1, 1, 1, DiffuseColor.a); + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: pixel lighting + texture + vertex color. +[RootSignature(MainRS)] +VSOutputPixelLightingTx VSBasicPixelLightingTxVc(VSInputNmTxVc vin) +{ + VSOutputPixelLightingTx vout; + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse.rgb = vin.Color.rgb; + vout.Diffuse.a = vin.Color.a * DiffuseColor.a; + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Pixel shader: basic. +[RootSignature(MainRS)] +float4 PSBasic(PSInput pin) : SV_Target0 +{ + float4 color = pin.Diffuse; + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: no fog. +[RootSignature(MainRS)] +float4 PSBasicNoFog(PSInputNoFog pin) : SV_Target0 +{ + return pin.Diffuse; +} + + +// Pixel shader: texture. +[RootSignature(MainRS)] +float4 PSBasicTx(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: texture, no fog. +[RootSignature(MainRS)] +float4 PSBasicTxNoFog(PSInputTxNoFog pin) : SV_Target0 +{ + return Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; +} + + +// Pixel shader: vertex lighting. +[RootSignature(MainRS)] +float4 PSBasicVertexLighting(PSInput pin) : SV_Target0 +{ + float4 color = pin.Diffuse; + + AddSpecular(color, pin.Specular.rgb); + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: vertex lighting, no fog. +[RootSignature(MainRS)] +float4 PSBasicVertexLightingNoFog(PSInput pin) : SV_Target0 +{ + float4 color = pin.Diffuse; + + AddSpecular(color, pin.Specular.rgb); + + return color; +} + + +// Pixel shader: vertex lighting + texture. +[RootSignature(MainRS)] +float4 PSBasicVertexLightingTx(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + AddSpecular(color, pin.Specular.rgb); + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: vertex lighting + texture, no fog. +[RootSignature(MainRS)] +float4 PSBasicVertexLightingTxNoFog(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + AddSpecular(color, pin.Specular.rgb); + + return color; +} + + +// Pixel shader: pixel lighting. +[RootSignature(MainRS)] +float4 PSBasicPixelLighting(PSInputPixelLighting pin) : SV_Target0 +{ + float4 color = pin.Diffuse; + + float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz); + float3 worldNormal = normalize(pin.NormalWS); + + ColorPair lightResult = ComputeLights(eyeVector, worldNormal, 3); + + color.rgb *= lightResult.Diffuse; + + AddSpecular(color, lightResult.Specular); + ApplyFog(color, pin.PositionWS.w); + + return color; +} + + +// Pixel shader: pixel lighting + texture. +[RootSignature(MainRS)] +float4 PSBasicPixelLightingTx(PSInputPixelLightingTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz); + float3 worldNormal = normalize(pin.NormalWS); + + ColorPair lightResult = ComputeLights(eyeVector, worldNormal, 3); + + color.rgb *= lightResult.Diffuse; + + AddSpecular(color, lightResult.Specular); + ApplyFog(color, pin.PositionWS.w); + + return color; +} diff --git a/Kits/DirectXTK12/Src/Shaders/Common.fxh b/Kits/DirectXTK12/Src/Shaders/Common.fxh new file mode 100644 index 0000000000000000000000000000000000000000..54ffe4e0871e76adab23b6baf35d9615689de3b4 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Common.fxh @@ -0,0 +1,60 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +float ComputeFogFactor(float4 position) +{ + return saturate(dot(position, FogVector)); +} + + +void ApplyFog(inout float4 color, float fogFactor) +{ + color.rgb = lerp(color.rgb, FogColor * color.a, fogFactor); +} + + +void AddSpecular(inout float4 color, float3 specular) +{ + color.rgb += specular * color.a; +} + + +struct CommonVSOutput +{ + float4 Pos_ps; + float4 Diffuse; + float3 Specular; + float FogFactor; +}; + + +CommonVSOutput ComputeCommonVSOutput(float4 position) +{ + CommonVSOutput vout; + + vout.Pos_ps = mul(position, WorldViewProj); + vout.Diffuse = DiffuseColor; + vout.Specular = 0; + vout.FogFactor = ComputeFogFactor(position); + + return vout; +} + + +#define SetCommonVSOutputParams \ + vout.PositionPS = cout.Pos_ps; \ + vout.Diffuse = cout.Diffuse; \ + vout.Specular = float4(cout.Specular, cout.FogFactor); + + +#define SetCommonVSOutputParamsNoFog \ + vout.PositionPS = cout.Pos_ps; \ + vout.Diffuse = cout.Diffuse; diff --git a/Kits/DirectXTK12/Src/Shaders/CompileShaders.cmd b/Kits/DirectXTK12/Src/Shaders/CompileShaders.cmd new file mode 100644 index 0000000000000000000000000000000000000000..30e9bcbe7878b22a5a58f7ead00345548c2907a1 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/CompileShaders.cmd @@ -0,0 +1,166 @@ +@echo off +rem THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +rem ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +rem THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +rem PARTICULAR PURPOSE. +rem +rem Copyright (c) Microsoft Corporation. All rights reserved. + +setlocal +set error=0 + +if %1.==xbox. goto continuexbox +if %1.==. goto continue +echo usage: CompileShaders [xbox] +exit /b + +:continuexbox +set XBOXFXC="%XboxOneXDKLatest%xdk\FXC\amd64\FXC.exe" +if exist %XBOXFXC% goto continue +set XBOXFXC="%XboxOneXDKBuild%xdk\FXC\amd64\FXC.exe" +if exist %XBOXFXC% goto continue +set XBOXFXC="%DurangoXDK%xdk\FXC\amd64\FXC.exe" +if not exist %XBOXFXC% goto needxdk + +:continue + +call :CompileShader%1 AlphaTestEffect vs VSAlphaTest +call :CompileShader%1 AlphaTestEffect vs VSAlphaTestNoFog +call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVc +call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVcNoFog + +call :CompileShader%1 AlphaTestEffect ps PSAlphaTestLtGt +call :CompileShader%1 AlphaTestEffect ps PSAlphaTestLtGtNoFog +call :CompileShader%1 AlphaTestEffect ps PSAlphaTestEqNe +call :CompileShader%1 AlphaTestEffect ps PSAlphaTestEqNeNoFog + +call :CompileShader%1 BasicEffect vs VSBasic +call :CompileShader%1 BasicEffect vs VSBasicNoFog +call :CompileShader%1 BasicEffect vs VSBasicVc +call :CompileShader%1 BasicEffect vs VSBasicVcNoFog +call :CompileShader%1 BasicEffect vs VSBasicTx +call :CompileShader%1 BasicEffect vs VSBasicTxNoFog +call :CompileShader%1 BasicEffect vs VSBasicTxVc +call :CompileShader%1 BasicEffect vs VSBasicTxVcNoFog + +call :CompileShader%1 BasicEffect vs VSBasicVertexLighting +call :CompileShader%1 BasicEffect vs VSBasicVertexLightingVc +call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTx +call :CompileShader%1 BasicEffect vs VSBasicVertexLightingTxVc + +call :CompileShader%1 BasicEffect vs VSBasicOneLight +call :CompileShader%1 BasicEffect vs VSBasicOneLightVc +call :CompileShader%1 BasicEffect vs VSBasicOneLightTx +call :CompileShader%1 BasicEffect vs VSBasicOneLightTxVc + +call :CompileShader%1 BasicEffect vs VSBasicPixelLighting +call :CompileShader%1 BasicEffect vs VSBasicPixelLightingVc +call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTx +call :CompileShader%1 BasicEffect vs VSBasicPixelLightingTxVc + +call :CompileShader%1 BasicEffect ps PSBasic +call :CompileShader%1 BasicEffect ps PSBasicNoFog +call :CompileShader%1 BasicEffect ps PSBasicTx +call :CompileShader%1 BasicEffect ps PSBasicTxNoFog + +call :CompileShader%1 BasicEffect ps PSBasicVertexLighting +call :CompileShader%1 BasicEffect ps PSBasicVertexLightingNoFog +call :CompileShader%1 BasicEffect ps PSBasicVertexLightingTx +call :CompileShader%1 BasicEffect ps PSBasicVertexLightingTxNoFog + +call :CompileShader%1 BasicEffect ps PSBasicPixelLighting +call :CompileShader%1 BasicEffect ps PSBasicPixelLightingTx + +call :CompileShader%1 DualTextureEffect vs VSDualTexture +call :CompileShader%1 DualTextureEffect vs VSDualTextureNoFog +call :CompileShader%1 DualTextureEffect vs VSDualTextureVc +call :CompileShader%1 DualTextureEffect vs VSDualTextureVcNoFog + +call :CompileShader%1 DualTextureEffect ps PSDualTexture +call :CompileShader%1 DualTextureEffect ps PSDualTextureNoFog + +call :CompileShader%1 EnvironmentMapEffect vs VSEnvMap +call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapFresnel +call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLight +call :CompileShader%1 EnvironmentMapEffect vs VSEnvMapOneLightFresnel + +call :CompileShader%1 EnvironmentMapEffect ps PSEnvMap +call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapNoFog +call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapSpecular +call :CompileShader%1 EnvironmentMapEffect ps PSEnvMapSpecularNoFog + +call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingOneBone +call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingTwoBones +call :CompileShader%1 SkinnedEffect vs VSSkinnedVertexLightingFourBones + +call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightOneBone +call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightTwoBones +call :CompileShader%1 SkinnedEffect vs VSSkinnedOneLightFourBones + +call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingOneBone +call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingTwoBones +call :CompileShader%1 SkinnedEffect vs VSSkinnedPixelLightingFourBones + +call :CompileShader%1 SkinnedEffect ps PSSkinnedVertexLighting +call :CompileShader%1 SkinnedEffect ps PSSkinnedVertexLightingNoFog +call :CompileShader%1 SkinnedEffect ps PSSkinnedPixelLighting + +call :CompileShader%1 SpriteEffect vs SpriteVertexShader +call :CompileShader%1 SpriteEffect ps SpritePixelShader + +call :CompileComputeShader%1 GenerateMips main +echo. + +if %error% == 0 ( + echo Shaders compiled ok +) else ( + echo There were shader compilation errors! +) + +endlocal +exit /b + +:CompileShader +set fxc=fxc /nologo %1.fx /T%2_5_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b + +:CompileShaderHLSL +set fxc=fxc /nologo %1.hlsl /T%2_5_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b + +:CompileComputeShader +set fxc=fxc /nologo %1.hlsl /Tcs_5_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%2 /FhCompiled\%1_%2.inc /FdCompiled\%1_%2.pdb /Vn%1_%2 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b +:CompileShaderxbox +set fxc=%XBOXFXC% /nologo %1.fx /T%2_5_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b + +:CompileShaderHLSLxbox +set fxc=%XBOXFXC% /nologo %1.hlsl /T%2_5_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b + +:CompileComputeShaderxbox +set fxc==%XBOXFXC% /nologo %1.hlsl /Tcs_5_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%2 /FhCompiled\XboxOne%1_%2.inc /FdCompiled\XboxOne%1_%2.pdb /Vn%1_%2 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b + +:needxdk +echo ERROR: CompileShaders xbox requires the Microsoft Xbox One XDK +echo (try re-running from the XDK Command Prompt) \ No newline at end of file diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc new file mode 100644 index 0000000000000000000000000000000000000000..8be6ad15b27adf5391edde9449cea461b2e7a5e8 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc @@ -0,0 +1,182 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float w +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[3], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.w +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mad r1.x, r0.w, v0.w, -cb0[1].x +mul r0.xyzw, r0.xyzw, v0.xyzw +lt r1.x, |r1.x|, cb0[1].y +movc r1.x, r1.x, cb0[1].z, cb0[1].w +lt r1.x, r1.x, l(0.000000) +discard_nz r1.x +mad r1.xyz, cb0[2].xyzx, r0.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_PSAlphaTestEqNe[] = +{ + 68, 88, 66, 67, 246, 229, + 60, 14, 207, 0, 194, 16, + 172, 158, 131, 17, 251, 44, + 249, 202, 1, 0, 0, 0, + 40, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 152, 2, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 8, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 196, 1, + 0, 0, 80, 0, 0, 0, + 113, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 130, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 18, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 58, 16, + 16, 0, 0, 0, 0, 0, + 10, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 49, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 128, + 129, 0, 0, 0, 1, 0, + 0, 0, 26, 128, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 55, 0, 0, 11, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 42, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 13, 0, 4, 3, + 10, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 32, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..6bc98d8d636f62baa4542e9bc0e4d342f3fb9289 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc @@ -0,0 +1,159 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[2], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v1.xyxx, t0.xyzw, s0 +mad r1.x, r0.w, v0.w, -cb0[1].x +mul r0.xyzw, r0.xyzw, v0.xyzw +mov o0.xyzw, r0.xyzw +lt r0.x, |r1.x|, cb0[1].y +movc r0.x, r0.x, cb0[1].z, cb0[1].w +lt r0.x, r0.x, l(0.000000) +discard_nz r0.x +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_PSAlphaTestEqNeNoFog[] = +{ + 68, 88, 66, 67, 167, 227, + 27, 122, 158, 221, 85, 112, + 68, 68, 198, 102, 215, 143, + 72, 162, 1, 0, 0, 0, + 180, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 128, 0, 0, 0, 180, 0, + 0, 0, 36, 2, 0, 0, + 73, 83, 71, 78, 72, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 62, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 104, 1, + 0, 0, 80, 0, 0, 0, + 90, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 18, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 58, 16, + 16, 0, 0, 0, 0, 0, + 10, 128, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 49, 0, + 0, 9, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 128, 129, 0, 0, 0, + 1, 0, 0, 0, 26, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 55, 0, + 0, 11, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 42, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 49, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 13, 0, + 4, 3, 10, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc new file mode 100644 index 0000000000000000000000000000000000000000..24f78ad2717f1f1dc5902da76c33304ee579dc32 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc @@ -0,0 +1,173 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float w +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[3], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.w +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +lt r1.x, r0.w, cb0[1].x +movc r1.x, r1.x, cb0[1].z, cb0[1].w +lt r1.x, r1.x, l(0.000000) +discard_nz r1.x +mad r1.xyz, cb0[2].xyzx, r0.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_PSAlphaTestLtGt[] = +{ + 68, 88, 66, 67, 139, 244, + 70, 17, 72, 71, 124, 4, + 47, 166, 100, 136, 165, 85, + 177, 13, 1, 0, 0, 0, + 248, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 104, 2, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 8, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 148, 1, + 0, 0, 80, 0, 0, 0, + 101, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 130, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 49, 0, 0, 8, 18, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 55, 0, 0, 11, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 42, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 13, 0, 4, 3, + 10, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 32, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..d6dc7df729b295ee8b97e9d48be44b526ff6fdea --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc @@ -0,0 +1,150 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[2], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +lt r1.x, r0.w, cb0[1].x +mov o0.xyzw, r0.xyzw +movc r0.x, r1.x, cb0[1].z, cb0[1].w +lt r0.x, r0.x, l(0.000000) +discard_nz r0.x +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_PSAlphaTestLtGtNoFog[] = +{ + 68, 88, 66, 67, 234, 228, + 163, 50, 105, 221, 210, 115, + 167, 213, 22, 11, 154, 83, + 176, 199, 1, 0, 0, 0, + 132, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 128, 0, 0, 0, 180, 0, + 0, 0, 244, 1, 0, 0, + 73, 83, 71, 78, 72, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 62, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 56, 1, + 0, 0, 80, 0, 0, 0, + 78, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 49, 0, 0, 8, 18, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 55, 0, + 0, 11, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 42, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 49, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 13, 0, + 4, 3, 10, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc new file mode 100644 index 0000000000000000000000000000000000000000..215fa1ac2e804faf3a32a08f80db3390c6a480e9 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc @@ -0,0 +1,175 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[8], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +mov o0.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[3].xyzw +mov o1.xyz, l(0,0,0,0) +mov o2.xy, v1.xyxx +dp4 o3.x, v0.xyzw, cb0[4].xyzw +dp4 o3.y, v0.xyzw, cb0[5].xyzw +dp4 o3.z, v0.xyzw, cb0[6].xyzw +dp4 o3.w, v0.xyzw, cb0[7].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_VSAlphaTest[] = +{ + 68, 88, 66, 67, 221, 190, + 1, 135, 99, 166, 223, 88, + 57, 207, 182, 209, 221, 22, + 231, 6, 1, 0, 0, 0, + 4, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 136, 0, 0, 0, 20, 1, + 0, 0, 116, 2, 0, 0, + 73, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 132, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 3, 12, + 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 88, 1, + 0, 0, 80, 0, 1, 0, + 86, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 2, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..d0162d0deb414086d02db30cd205b4af528c3070 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc @@ -0,0 +1,154 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[8], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output_siv o2.xyzw, position +mov o0.xyzw, cb0[0].xyzw +mov o1.xy, v1.xyxx +dp4 o2.x, v0.xyzw, cb0[4].xyzw +dp4 o2.y, v0.xyzw, cb0[5].xyzw +dp4 o2.z, v0.xyzw, cb0[6].xyzw +dp4 o2.w, v0.xyzw, cb0[7].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_VSAlphaTestNoFog[] = +{ + 68, 88, 66, 67, 101, 199, + 167, 153, 238, 12, 61, 99, + 72, 61, 191, 121, 181, 83, + 219, 21, 1, 0, 0, 0, + 160, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 136, 0, 0, 0, 252, 0, + 0, 0, 16, 2, 0, 0, + 73, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 108, 0, 0, 0, + 3, 0, 0, 0, 8, 0, + 0, 0, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 86, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 12, + 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 12, 1, + 0, 0, 80, 0, 1, 0, + 67, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..5284d7f04f659b49f43a23552436cdf14a9c6cb4 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc @@ -0,0 +1,185 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[8], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +mul o0.xyzw, v2.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[3].xyzw +mov o1.xyz, l(0,0,0,0) +mov o2.xy, v1.xyxx +dp4 o3.x, v0.xyzw, cb0[4].xyzw +dp4 o3.y, v0.xyzw, cb0[5].xyzw +dp4 o3.z, v0.xyzw, cb0[6].xyzw +dp4 o3.w, v0.xyzw, cb0[7].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_VSAlphaTestVc[] = +{ + 68, 88, 66, 67, 68, 140, + 236, 178, 51, 120, 159, 181, + 137, 177, 117, 230, 67, 55, + 161, 161, 1, 0, 0, 0, + 52, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 48, 1, + 0, 0, 164, 2, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 101, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 132, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 110, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 119, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 108, 1, 0, 0, + 80, 0, 1, 0, 91, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..3c39927747fba7069035b996bbb189c7ed1192b2 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc @@ -0,0 +1,164 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[8], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output_siv o2.xyzw, position +mul o0.xyzw, v2.xyzw, cb0[0].xyzw +mov o1.xy, v1.xyxx +dp4 o2.x, v0.xyzw, cb0[4].xyzw +dp4 o2.y, v0.xyzw, cb0[5].xyzw +dp4 o2.z, v0.xyzw, cb0[6].xyzw +dp4 o2.w, v0.xyzw, cb0[7].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE AlphaTestEffect_VSAlphaTestVcNoFog[] = +{ + 68, 88, 66, 67, 250, 244, + 57, 14, 109, 121, 124, 244, + 77, 227, 64, 98, 34, 172, + 148, 18, 1, 0, 0, 0, + 208, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 24, 1, + 0, 0, 64, 2, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 101, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 108, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 86, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 95, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 32, 1, 0, 0, + 80, 0, 1, 0, 72, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 2, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasic.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasic.inc new file mode 100644 index 0000000000000000000000000000000000000000..fff3b087cfae8a1ae2e0cc45c4677e88391703e5 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasic.inc @@ -0,0 +1,120 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float w +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.w +dcl_output o0.xyzw +dcl_temps 1 +mad r0.xyz, cb0[13].xyzx, v0.wwww, -v0.xyzx +mad o0.xyz, v1.wwww, r0.xyzx, v0.xyzx +mov o0.w, v0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasic[] = +{ + 68, 88, 66, 67, 183, 60, + 196, 208, 177, 115, 92, 82, + 111, 165, 146, 165, 113, 31, + 214, 112, 1, 0, 0, 0, + 244, 1, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 120, 0, 0, 0, 172, 0, + 0, 0, 100, 1, 0, 0, + 73, 83, 71, 78, 64, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 56, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 8, 0, 0, 67, 79, + 76, 79, 82, 0, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 69, 88, 176, 0, 0, 0, + 80, 0, 0, 0, 44, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 130, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 1, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 246, 31, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 246, 31, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 16, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..de39ffd64fc31eca3aca066dfa59f90a113670c0 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicNoFog.inc @@ -0,0 +1,90 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_input_ps linear v0.xyzw +dcl_output o0.xyzw +mov o0.xyzw, v0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicNoFog[] = +{ + 68, 88, 66, 67, 58, 161, + 116, 209, 214, 104, 20, 135, + 146, 234, 83, 150, 47, 95, + 231, 68, 1, 0, 0, 0, + 104, 1, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 96, 0, 0, 0, 148, 0, + 0, 0, 216, 0, 0, 0, + 73, 83, 71, 78, 40, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 67, 79, + 76, 79, 82, 0, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 69, 88, 60, 0, 0, 0, + 80, 0, 0, 0, 15, 0, + 0, 0, 106, 8, 0, 1, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc new file mode 100644 index 0000000000000000000000000000000000000000..7247dcc8ee40a9c488fa66e996bf2ba44ccb336f --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc @@ -0,0 +1,392 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xyzw 0 NONE float xyzw +// TEXCOORD 1 xyz 1 NONE float xyz +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xyzw +dcl_output o0.xyzw +dcl_temps 4 +add r0.xyz, -v0.xyzx, cb0[12].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mad r1.xyz, r0.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r1.xyzx, r1.xyzx +rsq r1.w, r1.w +mul r1.xyz, r1.wwww, r1.xyzx +dp3 r1.w, v1.xyzx, v1.xyzx +rsq r1.w, r1.w +mul r2.xyz, r1.wwww, v1.xyzx +dp3 r1.x, r1.xyzx, r2.xyzx +mad r3.xyz, r0.xyzx, r0.wwww, -cb0[4].xyzx +mad r0.xyz, r0.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r3.xyzx, r3.xyzx +rsq r0.w, r0.w +mul r3.xyz, r0.wwww, r3.xyzx +dp3 r1.y, r3.xyzx, r2.xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.z, r0.xyzx, r2.xyzx +max r0.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +dp3 r1.x, -cb0[3].xyzx, r2.xyzx +dp3 r1.y, -cb0[4].xyzx, r2.xyzx +dp3 r1.z, -cb0[5].xyzx, r2.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r0.xyz, r0.xyzx, r2.xyzx +mul r1.xyz, r1.xyzx, r2.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r2.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul r0.xyz, r0.xyzx, cb0[2].xyzx +mul r0.xyz, r0.xyzx, v2.wwww +mul r2.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r2.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad r1.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mad r0.xyz, v2.xyzx, r1.xyzx, r0.xyzx +mad r1.xyz, cb0[13].xyzx, v2.wwww, -r0.xyzx +mad o0.xyz, v0.wwww, r1.xyzx, r0.xyzx +mov o0.w, v2.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicPixelLighting[] = +{ + 68, 88, 66, 67, 80, 119, + 109, 150, 219, 119, 195, 227, + 25, 193, 36, 62, 131, 64, + 117, 159, 1, 0, 0, 0, + 76, 7, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 188, 6, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 89, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 232, 5, + 0, 0, 80, 0, 0, 0, + 122, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 98, 16, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 98, 16, 0, 3, 242, 16, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 0, 0, 0, 9, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 52, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 9, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 9, 66, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 29, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 47, 0, 0, 5, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 143, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 2, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 70, 8, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 166, 10, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 11, 0, 0, 0, 70, 3, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 1, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 70, 8, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 1, 0, 0, 0, + 166, 10, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 70, 3, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 246, 31, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 246, 31, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 16, 16, 0, + 2, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..4f0b8ce764f1113dae8b79f352fff6e791de4512 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc @@ -0,0 +1,420 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xy +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xyz +dcl_input_ps linear v3.xyzw +dcl_output o0.xyzw +dcl_temps 4 +add r0.xyz, -v1.xyzx, cb0[12].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mad r1.xyz, r0.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r1.xyzx, r1.xyzx +rsq r1.w, r1.w +mul r1.xyz, r1.wwww, r1.xyzx +dp3 r1.w, v2.xyzx, v2.xyzx +rsq r1.w, r1.w +mul r2.xyz, r1.wwww, v2.xyzx +dp3 r1.x, r1.xyzx, r2.xyzx +mad r3.xyz, r0.xyzx, r0.wwww, -cb0[4].xyzx +mad r0.xyz, r0.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r3.xyzx, r3.xyzx +rsq r0.w, r0.w +mul r3.xyz, r0.wwww, r3.xyzx +dp3 r1.y, r3.xyzx, r2.xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.z, r0.xyzx, r2.xyzx +max r0.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +dp3 r1.x, -cb0[3].xyzx, r2.xyzx +dp3 r1.y, -cb0[4].xyzx, r2.xyzx +dp3 r1.z, -cb0[5].xyzx, r2.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r0.xyz, r0.xyzx, r2.xyzx +mul r1.xyz, r1.xyzx, r2.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r2.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul r0.xyz, r0.xyzx, cb0[2].xyzx +sample_indexable(texture2d)(float,float,float,float) r2.xyzw, v0.xyxx, t0.xyzw, s0 +mul r2.xyzw, r2.xyzw, v3.xyzw +mul r0.xyz, r0.xyzx, r2.wwww +mul r3.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r3.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad r1.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mad r0.xyz, r2.xyzx, r1.xyzx, r0.xyzx +mad r1.xyz, cb0[13].xyzx, r2.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r2.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicPixelLightingTx[] = +{ + 68, 88, 66, 67, 205, 238, + 143, 140, 178, 65, 203, 209, + 67, 78, 138, 68, 75, 82, + 38, 112, 1, 0, 0, 0, + 212, 7, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 68, 7, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 3, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 7, 0, 0, 113, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 88, 6, + 0, 0, 80, 0, 0, 0, + 150, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 4, 0, 0, 0, + 0, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 3, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 0, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 1, 0, + 0, 0, 70, 136, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 70, 8, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 1, 0, 0, 0, 166, 10, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 70, 3, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 246, 15, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 114, 32, + 16, 0, 0, 0, 0, 0, + 246, 31, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..dc8a862ed7addb37bfcfd31a604f87d0a9b9b9b5 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicTx.inc @@ -0,0 +1,150 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float w +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.w +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +mad r1.xyz, cb0[13].xyzx, r0.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicTx[] = +{ + 68, 88, 66, 67, 162, 232, + 220, 1, 165, 64, 33, 107, + 255, 154, 86, 105, 51, 250, + 4, 165, 1, 0, 0, 0, + 132, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 244, 1, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 8, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 32, 1, + 0, 0, 80, 0, 0, 0, + 72, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 130, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 246, 31, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..a21cb801c8e77315351de2a57bc4508d9dd487c6 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc @@ -0,0 +1,118 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul o0.xyzw, r0.xyzw, v0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicTxNoFog[] = +{ + 68, 88, 66, 67, 139, 129, + 110, 56, 73, 191, 71, 92, + 53, 195, 34, 82, 243, 212, + 243, 147, 1, 0, 0, 0, + 236, 1, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 128, 0, 0, 0, 180, 0, + 0, 0, 92, 1, 0, 0, + 73, 83, 71, 78, 72, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 62, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 160, 0, + 0, 0, 80, 0, 0, 0, + 40, 0, 0, 0, 106, 8, + 0, 1, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc new file mode 100644 index 0000000000000000000000000000000000000000..e19928f52a64b6ae4de88d9120b0d169051aec41 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc @@ -0,0 +1,127 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyzw +dcl_output o0.xyzw +dcl_temps 2 +mad r0.xyz, v1.xyzx, v0.wwww, v0.xyzx +mad r1.xyz, cb0[13].xyzx, v0.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, v0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicVertexLighting[] = +{ + 68, 88, 66, 67, 31, 92, + 30, 4, 201, 166, 30, 4, + 49, 191, 200, 228, 6, 176, + 146, 104, 1, 0, 0, 0, + 24, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 120, 0, 0, 0, 172, 0, + 0, 0, 136, 1, 0, 0, + 73, 83, 71, 78, 64, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 56, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 67, 79, + 76, 79, 82, 0, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 69, 88, 212, 0, 0, 0, + 80, 0, 0, 0, 53, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 50, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 246, 31, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 246, 31, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 246, 31, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 16, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..ee3122e02a1e459e9cc477eebc71f6b5970c1b04 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc @@ -0,0 +1,105 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyz +dcl_output o0.xyzw +mad o0.xyz, v1.xyzx, v0.wwww, v0.xyzx +mov o0.w, v0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicVertexLightingNoFog[] = +{ + 68, 88, 66, 67, 71, 10, + 125, 168, 154, 176, 219, 94, + 67, 33, 136, 223, 81, 243, + 31, 11, 1, 0, 0, 0, + 176, 1, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 120, 0, 0, 0, 172, 0, + 0, 0, 32, 1, 0, 0, + 73, 83, 71, 78, 64, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 56, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 7, 0, 0, 67, 79, + 76, 79, 82, 0, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 69, 88, 108, 0, 0, 0, + 80, 0, 0, 0, 27, 0, + 0, 0, 106, 8, 0, 1, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 98, 16, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 246, 31, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..44c3d39b91f4808894c161bc2cabd658ebf6342c --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc @@ -0,0 +1,157 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +mad r0.xyz, v1.xyzx, r0.wwww, r0.xyzx +mad r1.xyz, cb0[13].xyzx, r0.wwww, -r0.xyzx +mov o0.w, r0.w +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicVertexLightingTx[] = +{ + 68, 88, 66, 67, 34, 223, + 3, 44, 153, 63, 227, 172, + 41, 191, 222, 82, 131, 245, + 43, 22, 1, 0, 0, 0, + 168, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 24, 2, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 68, 1, + 0, 0, 80, 0, 0, 0, + 81, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 32, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..3d61faad1a3c21fe27a4d069ccdfd7f439ea6061 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc @@ -0,0 +1,138 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 1 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +mad o0.xyz, v1.xyzx, r0.wwww, r0.xyzx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_PSBasicVertexLightingTxNoFog[] = +{ + 68, 88, 66, 67, 164, 58, + 62, 66, 161, 173, 104, 194, + 104, 188, 84, 59, 140, 69, + 107, 145, 1, 0, 0, 0, + 72, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 184, 1, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 7, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 228, 0, + 0, 0, 80, 0, 0, 0, + 57, 0, 0, 0, 106, 8, + 0, 1, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 98, 16, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 2, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasic.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasic.inc new file mode 100644 index 0000000000000000000000000000000000000000..eee7ff732b8a20cd3562c008d3fdac0cc7c610e1 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasic.inc @@ -0,0 +1,151 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output_siv o2.xyzw, position +mov o0.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o1.xyz, l(0,0,0,0) +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasic[] = +{ + 68, 88, 66, 67, 171, 205, + 230, 20, 233, 2, 32, 110, + 209, 17, 101, 27, 25, 114, + 120, 158, 1, 0, 0, 0, + 148, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 100, 0, 0, 0, 208, 0, + 0, 0, 4, 2, 0, 0, + 73, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 79, 83, + 71, 78, 100, 0, 0, 0, + 3, 0, 0, 0, 8, 0, + 0, 0, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 80, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 86, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 83, 86, 95, 80, + 111, 115, 105, 116, 105, 111, + 110, 0, 171, 171, 83, 72, + 69, 88, 44, 1, 0, 0, + 80, 0, 1, 0, 75, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 2, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 54, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 22, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 23, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 24, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 25, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..6038eb7e29b61455a8c67313d3706d38ac5fa4ee --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicNoFog.inc @@ -0,0 +1,131 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// SV_Position 0 xyzw 1 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_output o0.xyzw +dcl_output_siv o1.xyzw, position +mov o0.xyzw, cb0[0].xyzw +dp4 o1.x, v0.xyzw, cb0[22].xyzw +dp4 o1.y, v0.xyzw, cb0[23].xyzw +dp4 o1.z, v0.xyzw, cb0[24].xyzw +dp4 o1.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicNoFog[] = +{ + 68, 88, 66, 67, 144, 119, + 211, 194, 50, 207, 226, 145, + 113, 190, 13, 247, 166, 229, + 194, 196, 1, 0, 0, 0, + 48, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 100, 0, 0, 0, 184, 0, + 0, 0, 160, 1, 0, 0, + 73, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 79, 83, + 71, 78, 76, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 62, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 83, 86, 95, 80, + 111, 115, 105, 116, 105, 111, + 110, 0, 171, 171, 83, 72, + 69, 88, 224, 0, 0, 0, + 80, 0, 1, 0, 56, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc new file mode 100644 index 0000000000000000000000000000000000000000..7320572a88c144c26c20381ee1991893e3834556 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLight.inc @@ -0,0 +1,335 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output_siv o2.xyzw, position +dcl_temps 3 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r1.x, r0.w, l(0.000000) +and r1.x, r1.x, l(0x3f800000) +mul r0.w, r0.w, r1.x +mul r1.yzw, r0.wwww, cb0[6].xxyz +mad o0.xyz, r1.yzwy, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +dp4 r2.x, v0.xyzw, cb0[15].xyzw +dp4 r2.y, v0.xyzw, cb0[16].xyzw +dp4 r2.z, v0.xyzw, cb0[17].xyzw +add r1.yzw, -r2.xxyz, cb0[12].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mad r1.yzw, r1.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mul r1.yzw, r0.wwww, r1.yyzw +dp3 r0.x, r1.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r1.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicOneLight[] = +{ + 68, 88, 66, 67, 205, 187, + 83, 238, 154, 120, 243, 11, + 92, 1, 22, 178, 29, 9, + 165, 0, 1, 0, 0, 0, + 32, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 132, 0, 0, 0, 240, 0, + 0, 0, 144, 5, 0, 0, + 73, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 171, + 79, 83, 71, 78, 100, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 171, 171, + 83, 72, 69, 88, 152, 4, + 0, 0, 80, 0, 1, 0, + 38, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 16, 0, 0, 8, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 19, 0, + 0, 0, 16, 0, 0, 8, + 34, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 16, 0, + 0, 8, 66, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 21, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 29, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 226, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 0, 0, 0, 9, + 226, 0, 16, 0, 1, 0, + 0, 0, 6, 9, 16, 128, + 65, 0, 0, 0, 2, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 1, 0, + 0, 0, 86, 14, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 226, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 86, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 52, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..6d84cdf36f61b4dca821616bc1ae8a398548e22e --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTx.inc @@ -0,0 +1,358 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 3 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r1.x, r0.w, l(0.000000) +and r1.x, r1.x, l(0x3f800000) +mul r0.w, r0.w, r1.x +mul r1.yzw, r0.wwww, cb0[6].xxyz +mad o0.xyz, r1.yzwy, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +dp4 r2.x, v0.xyzw, cb0[15].xyzw +dp4 r2.y, v0.xyzw, cb0[16].xyzw +dp4 r2.z, v0.xyzw, cb0[17].xyzw +add r1.yzw, -r2.xxyz, cb0[12].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mad r1.yzw, r1.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mul r1.yzw, r0.wwww, r1.yyzw +dp3 r0.x, r1.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r1.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicOneLightTx[] = +{ + 68, 88, 66, 67, 252, 138, + 84, 165, 124, 145, 38, 173, + 137, 62, 237, 53, 36, 157, + 123, 84, 1, 0, 0, 0, + 140, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 48, 1, + 0, 0, 252, 5, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 132, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 110, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 119, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 196, 4, 0, 0, + 80, 0, 1, 0, 49, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 3, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 226, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 54, 0, 0, 6, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 17, 0, 0, 8, 18, 0, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 17, 0, 0, 8, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 17, 0, + 0, 8, 66, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 0, 0, 0, 9, 226, 0, + 16, 0, 1, 0, 0, 0, + 6, 9, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 6, 137, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 226, 0, + 16, 0, 1, 0, 0, 0, + 86, 14, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 6, 137, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 226, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 86, 14, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 56, 0, 0, 8, + 114, 32, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 54, 0, 0, 5, 50, 32, + 16, 0, 2, 0, 0, 0, + 70, 16, 16, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..5e37181fb0481bbfb7cf4e48d249b509f02739c3 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightTxVc.inc @@ -0,0 +1,374 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 3 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r1.x, r0.w, l(0.000000) +and r1.x, r1.x, l(0x3f800000) +mul r0.w, r0.w, r1.x +mul r1.yzw, r0.wwww, cb0[6].xxyz +mad r1.yzw, r1.yyzw, cb0[0].xxyz, cb0[1].xxyz +mul o0.xyz, r1.yzwy, v3.xyzx +mul o0.w, v3.w, cb0[0].w +dp4 r2.x, v0.xyzw, cb0[15].xyzw +dp4 r2.y, v0.xyzw, cb0[16].xyzw +dp4 r2.z, v0.xyzw, cb0[17].xyzw +add r1.yzw, -r2.xxyz, cb0[12].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mad r1.yzw, r1.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mul r1.yzw, r0.wwww, r1.yyzw +dp3 r0.x, r1.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r1.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicOneLightTxVc[] = +{ + 68, 88, 66, 67, 24, 212, + 100, 197, 10, 221, 20, 255, + 101, 83, 94, 253, 47, 95, + 104, 135, 1, 0, 0, 0, + 220, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 196, 0, 0, 0, 80, 1, + 0, 0, 76, 6, 0, 0, + 73, 83, 71, 78, 140, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 132, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 79, 83, + 71, 78, 132, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 3, 12, + 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 244, 4, + 0, 0, 80, 0, 1, 0, + 61, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 3, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 2, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 16, 0, 0, 8, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 19, 0, + 0, 0, 16, 0, 0, 8, + 34, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 16, 0, + 0, 8, 66, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 21, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 29, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 226, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 50, 0, 0, 11, 226, 0, + 16, 0, 1, 0, 0, 0, + 86, 14, 16, 0, 1, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 114, 32, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 8, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 16, 16, 0, 3, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 0, 0, 0, 9, + 226, 0, 16, 0, 1, 0, + 0, 0, 6, 9, 16, 128, + 65, 0, 0, 0, 2, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 1, 0, + 0, 0, 86, 14, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 226, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 86, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 52, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..a2d7669cfb0d86427f130d6bc5fed89f715938e6 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicOneLightVc.inc @@ -0,0 +1,351 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output_siv o2.xyzw, position +dcl_temps 3 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r1.x, r0.w, l(0.000000) +and r1.x, r1.x, l(0x3f800000) +mul r0.w, r0.w, r1.x +mul r1.yzw, r0.wwww, cb0[6].xxyz +mad r1.yzw, r1.yyzw, cb0[0].xxyz, cb0[1].xxyz +mul o0.xyz, r1.yzwy, v2.xyzx +mul o0.w, v2.w, cb0[0].w +dp4 r2.x, v0.xyzw, cb0[15].xyzw +dp4 r2.y, v0.xyzw, cb0[16].xyzw +dp4 r2.z, v0.xyzw, cb0[17].xyzw +add r1.yzw, -r2.xxyz, cb0[12].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mad r1.yzw, r1.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r1.yzwy, r1.yzwy +rsq r0.w, r0.w +mul r1.yzw, r0.wwww, r1.yyzw +dp3 r0.x, r1.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r1.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicOneLightVc[] = +{ + 68, 88, 66, 67, 45, 15, + 24, 39, 17, 51, 114, 208, + 10, 54, 206, 175, 244, 212, + 243, 90, 1, 0, 0, 0, + 112, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 16, 1, + 0, 0, 224, 5, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 67, + 79, 76, 79, 82, 0, 171, + 171, 171, 79, 83, 71, 78, + 100, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 80, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 86, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 171, 171, 83, 72, 69, 88, + 200, 4, 0, 0, 80, 0, + 1, 0, 50, 1, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 3, 0, + 0, 0, 16, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 8, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, + 16, 0, 0, 8, 66, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 9, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 29, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 56, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 226, 0, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 1, 0, + 0, 0, 86, 14, 16, 0, + 1, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 16, 16, 0, + 2, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 9, 226, 0, 16, 0, + 1, 0, 0, 0, 6, 9, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 226, 0, 16, 0, + 1, 0, 0, 0, 86, 14, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 6, 137, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 150, 7, 16, 0, 1, 0, + 0, 0, 150, 7, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 226, 0, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 1, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 52, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 47, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 25, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 56, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc new file mode 100644 index 0000000000000000000000000000000000000000..4f1cfb49ac2ee0b9404fd45158de6813b1d7efb2 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc @@ -0,0 +1,226 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xyzw 0 NONE float xyzw +// TEXCOORD 1 xyz 1 NONE float xyz +// COLOR 0 xyzw 2 NONE float xyzw +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_output o0.xyzw +dcl_output o1.xyz +dcl_output o2.xyzw +dcl_output_siv o3.xyzw, position +dcl_temps 1 +dp4 o0.x, v0.xyzw, cb0[15].xyzw +dp4 o0.y, v0.xyzw, cb0[16].xyzw +dp4 o0.z, v0.xyzw, cb0[17].xyzw +dp4_sat o0.w, v0.xyzw, cb0[14].xyzw +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o1.xyz, r0.wwww, r0.xyzx +mov o2.xyz, l(1.000000,1.000000,1.000000,0) +mov o2.w, cb0[0].w +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicPixelLighting[] = +{ + 68, 88, 66, 67, 123, 23, + 144, 57, 219, 78, 135, 217, + 87, 168, 89, 226, 235, 100, + 64, 73, 1, 0, 0, 0, + 0, 4, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 132, 0, 0, 0, 16, 1, + 0, 0, 112, 3, 0, 0, + 73, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 8, 0, 0, 113, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 0, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 88, 2, 0, 0, 80, 0, + 1, 0, 150, 0, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 114, 32, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 54, 0, + 0, 6, 130, 32, 16, 0, + 2, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..b324112e71a4e9dbbda5f5e0e78ab984966c56f1 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc @@ -0,0 +1,248 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xy +dcl_output o1.xyzw +dcl_output o2.xyz +dcl_output o3.xyzw +dcl_output_siv o4.xyzw, position +dcl_temps 1 +mov o0.xy, v2.xyxx +dp4 o1.x, v0.xyzw, cb0[15].xyzw +dp4 o1.y, v0.xyzw, cb0[16].xyzw +dp4 o1.z, v0.xyzw, cb0[17].xyzw +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o2.xyz, r0.wwww, r0.xyzx +mov o3.xyz, l(1.000000,1.000000,1.000000,0) +mov o3.w, cb0[0].w +dp4 o4.x, v0.xyzw, cb0[22].xyzw +dp4 o4.y, v0.xyzw, cb0[23].xyzw +dp4 o4.z, v0.xyzw, cb0[24].xyzw +dp4 o4.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicPixelLightingTx[] = +{ + 68, 88, 66, 67, 255, 247, + 52, 216, 247, 126, 208, 221, + 159, 136, 128, 158, 202, 40, + 148, 150, 1, 0, 0, 0, + 100, 4, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 72, 1, + 0, 0, 212, 3, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 156, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 3, 12, 0, 0, + 128, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 128, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 7, 8, 0, 0, + 137, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 15, 0, 0, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 67, 79, 76, + 79, 82, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 132, 2, 0, 0, + 80, 0, 1, 0, 161, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 3, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 1, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 2, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 16, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 8, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, + 16, 0, 0, 8, 66, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 32, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 3, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..37fcf481ae947dc01c75f6a101e12cbf37ce720d --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc @@ -0,0 +1,256 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xyzw +dcl_output o0.xy +dcl_output o1.xyzw +dcl_output o2.xyz +dcl_output o3.xyzw +dcl_output_siv o4.xyzw, position +dcl_temps 1 +mov o0.xy, v2.xyxx +dp4 o1.x, v0.xyzw, cb0[15].xyzw +dp4 o1.y, v0.xyzw, cb0[16].xyzw +dp4 o1.z, v0.xyzw, cb0[17].xyzw +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o2.xyz, r0.wwww, r0.xyzx +mul o3.w, v3.w, cb0[0].w +mov o3.xyz, v3.xyzx +dp4 o4.x, v0.xyzw, cb0[22].xyzw +dp4 o4.y, v0.xyzw, cb0[23].xyzw +dp4 o4.z, v0.xyzw, cb0[24].xyzw +dp4 o4.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicPixelLightingTxVc[] = +{ + 68, 88, 66, 67, 189, 67, + 72, 46, 89, 194, 134, 249, + 140, 53, 177, 146, 7, 35, + 112, 212, 1, 0, 0, 0, + 140, 4, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 196, 0, 0, 0, 104, 1, + 0, 0, 252, 3, 0, 0, + 73, 83, 71, 78, 140, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 132, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 79, 83, + 71, 78, 156, 0, 0, 0, + 5, 0, 0, 0, 8, 0, + 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 3, 12, + 0, 0, 128, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 128, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 7, 8, + 0, 0, 137, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 143, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 4, 0, 0, 0, 15, 0, + 0, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 67, + 79, 76, 79, 82, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 140, 2, + 0, 0, 80, 0, 1, 0, + 163, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 3, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 3, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 4, 0, 0, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 1, 0, 0, 0, + 54, 0, 0, 5, 50, 32, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 130, 32, 16, 0, 3, 0, + 0, 0, 58, 16, 16, 0, + 3, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 114, 32, 16, 0, + 3, 0, 0, 0, 70, 18, + 16, 0, 3, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 22, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 23, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 24, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 25, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..fceb71cf33df65705b1c4945daecb97f7ac6bbfd --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc @@ -0,0 +1,235 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xyzw 0 NONE float xyzw +// TEXCOORD 1 xyz 1 NONE float xyz +// COLOR 0 xyzw 2 NONE float xyzw +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xyz +dcl_output o2.xyzw +dcl_output_siv o3.xyzw, position +dcl_temps 1 +dp4 o0.x, v0.xyzw, cb0[15].xyzw +dp4 o0.y, v0.xyzw, cb0[16].xyzw +dp4 o0.z, v0.xyzw, cb0[17].xyzw +dp4_sat o0.w, v0.xyzw, cb0[14].xyzw +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o1.xyz, r0.wwww, r0.xyzx +mul o2.w, v2.w, cb0[0].w +mov o2.xyz, v2.xyzx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicPixelLightingVc[] = +{ + 68, 88, 66, 67, 18, 121, + 232, 225, 1, 225, 238, 79, + 246, 90, 6, 77, 56, 232, + 84, 128, 1, 0, 0, 0, + 40, 4, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 48, 1, + 0, 0, 152, 3, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 67, + 79, 76, 79, 82, 0, 171, + 171, 171, 79, 83, 71, 78, + 132, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 7, 8, 0, 0, + 113, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 119, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 67, 79, 76, + 79, 82, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 96, 2, 0, 0, + 80, 0, 1, 0, 152, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 2, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 16, 0, 0, 8, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 19, 0, + 0, 0, 16, 0, 0, 8, + 34, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 16, 0, + 0, 8, 66, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 21, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 32, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 130, 32, 16, 0, + 2, 0, 0, 0, 58, 16, + 16, 0, 2, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 114, 32, + 16, 0, 2, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..e082869b6a369bf74177777b1e60d87b14388a77 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTx.inc @@ -0,0 +1,175 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +mov o0.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o1.xyz, l(0,0,0,0) +mov o2.xy, v1.xyxx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicTx[] = +{ + 68, 88, 66, 67, 221, 251, + 208, 100, 43, 35, 132, 199, + 12, 152, 221, 60, 109, 243, + 133, 36, 1, 0, 0, 0, + 4, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 136, 0, 0, 0, 20, 1, + 0, 0, 116, 2, 0, 0, + 73, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 132, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 3, 12, + 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 88, 1, + 0, 0, 80, 0, 1, 0, + 86, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 2, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..f790aaa5cfd9e2c0223945fb0755fb70130dc136 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc @@ -0,0 +1,154 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output_siv o2.xyzw, position +mov o0.xyzw, cb0[0].xyzw +mov o1.xy, v1.xyxx +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicTxNoFog[] = +{ + 68, 88, 66, 67, 138, 43, + 16, 52, 95, 16, 173, 22, + 214, 115, 41, 115, 102, 12, + 105, 159, 1, 0, 0, 0, + 160, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 136, 0, 0, 0, 252, 0, + 0, 0, 16, 2, 0, 0, + 73, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 108, 0, 0, 0, + 3, 0, 0, 0, 8, 0, + 0, 0, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 86, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 12, + 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 12, 1, + 0, 0, 80, 0, 1, 0, + 67, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 22, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 23, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 24, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 25, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..f5821ede2440141fca43bdb26cec300d301a0c8f --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxVc.inc @@ -0,0 +1,185 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +mul o0.xyzw, v2.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o1.xyz, l(0,0,0,0) +mov o2.xy, v1.xyxx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicTxVc[] = +{ + 68, 88, 66, 67, 73, 233, + 255, 88, 37, 104, 152, 178, + 54, 218, 25, 1, 22, 189, + 243, 144, 1, 0, 0, 0, + 52, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 48, 1, + 0, 0, 164, 2, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 101, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 132, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 110, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 119, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 108, 1, 0, 0, + 80, 0, 1, 0, 91, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..1bf5e9ac1148523625d2f98ea35365e53a691637 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc @@ -0,0 +1,164 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output_siv o2.xyzw, position +mul o0.xyzw, v2.xyzw, cb0[0].xyzw +mov o1.xy, v1.xyxx +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicTxVcNoFog[] = +{ + 68, 88, 66, 67, 106, 168, + 188, 243, 85, 145, 202, 24, + 220, 4, 165, 204, 114, 63, + 39, 142, 1, 0, 0, 0, + 208, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 24, 1, + 0, 0, 64, 2, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 101, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 108, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 86, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 95, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 32, 1, 0, 0, + 80, 0, 1, 0, 72, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 2, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 22, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 23, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 24, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 25, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..a61a23200cb46c5e5e0ae1f9836c6f8b2a08ceba --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVc.inc @@ -0,0 +1,162 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output_siv o2.xyzw, position +mul o0.xyzw, v1.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o1.xyz, l(0,0,0,0) +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicVc[] = +{ + 68, 88, 66, 67, 202, 59, + 230, 54, 33, 38, 17, 77, + 97, 40, 240, 59, 229, 163, + 167, 115, 1, 0, 0, 0, + 200, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 132, 0, 0, 0, 240, 0, + 0, 0, 56, 2, 0, 0, + 73, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 67, 79, + 76, 79, 82, 0, 171, 171, + 79, 83, 71, 78, 100, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 171, 171, + 83, 72, 69, 88, 64, 1, + 0, 0, 80, 0, 1, 0, + 80, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 8, + 114, 32, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..434cf9d9ea43a39db3d5175cc8ca65dd1e3cfba0 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc @@ -0,0 +1,141 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// SV_Position 0 xyzw 1 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyzw +dcl_output o0.xyzw +dcl_output_siv o1.xyzw, position +mul o0.xyzw, v1.xyzw, cb0[0].xyzw +dp4 o1.x, v0.xyzw, cb0[22].xyzw +dp4 o1.y, v0.xyzw, cb0[23].xyzw +dp4 o1.z, v0.xyzw, cb0[24].xyzw +dp4 o1.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicVcNoFog[] = +{ + 68, 88, 66, 67, 176, 224, + 240, 49, 217, 200, 194, 36, + 211, 109, 165, 60, 43, 78, + 154, 144, 1, 0, 0, 0, + 100, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 132, 0, 0, 0, 216, 0, + 0, 0, 212, 1, 0, 0, + 73, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 67, 79, + 76, 79, 82, 0, 171, 171, + 79, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 62, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 171, 171, + 83, 72, 69, 88, 244, 0, + 0, 0, 80, 0, 1, 0, + 61, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 22, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 23, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 24, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 25, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc new file mode 100644 index 0000000000000000000000000000000000000000..cbf4db18bec59ca57a45ead027e4edb922f46965 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc @@ -0,0 +1,445 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output_siv o2.xyzw, position +dcl_temps 5 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.x, -cb0[3].xyzx, r0.xyzx +dp3 r1.y, -cb0[4].xyzx, r0.xyzx +dp3 r1.z, -cb0[5].xyzx, r0.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r1.xyz, r1.xyzx, r2.xyzx +mul r3.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r3.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad o0.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +dp4 r1.x, v0.xyzw, cb0[15].xyzw +dp4 r1.y, v0.xyzw, cb0[16].xyzw +dp4 r1.z, v0.xyzw, cb0[17].xyzw +add r1.xyz, -r1.xyzx, cb0[12].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mad r3.xyz, r1.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r3.xyzx, r3.xyzx +rsq r1.w, r1.w +mul r3.xyz, r1.wwww, r3.xyzx +dp3 r3.x, r3.xyzx, r0.xyzx +mad r4.xyz, r1.xyzx, r0.wwww, -cb0[4].xyzx +mad r1.xyz, r1.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r4.xyzx, r4.xyzx +rsq r0.w, r0.w +mul r4.xyz, r0.wwww, r4.xyzx +dp3 r3.y, r4.xyzx, r0.xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r3.z, r1.xyzx, r0.xyzx +max r0.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r2.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r1.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r1.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicVertexLighting[] = +{ + 68, 88, 66, 67, 218, 195, + 148, 176, 26, 158, 220, 114, + 181, 226, 173, 169, 82, 184, + 32, 28, 1, 0, 0, 0, + 84, 8, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 132, 0, 0, 0, 240, 0, + 0, 0, 196, 7, 0, 0, + 73, 83, 71, 78, 76, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 171, + 79, 83, 71, 78, 100, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 171, 171, + 83, 72, 69, 88, 204, 6, + 0, 0, 80, 0, 1, 0, + 179, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 5, 0, 0, 0, + 16, 0, 0, 8, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 19, 0, + 0, 0, 16, 0, 0, 8, + 34, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 16, 0, + 0, 8, 66, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 21, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 66, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 29, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 1, 0, + 0, 0, 70, 136, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 70, 8, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 1, 0, 0, 0, 166, 10, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 70, 3, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 130, 32, 16, 0, + 0, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 9, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 3, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc new file mode 100644 index 0000000000000000000000000000000000000000..d3c6f2ad7360811761524c78b97e7f92797cd17a --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc @@ -0,0 +1,468 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 5 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.x, -cb0[3].xyzx, r0.xyzx +dp3 r1.y, -cb0[4].xyzx, r0.xyzx +dp3 r1.z, -cb0[5].xyzx, r0.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r1.xyz, r1.xyzx, r2.xyzx +mul r3.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r3.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad o0.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +dp4 r1.x, v0.xyzw, cb0[15].xyzw +dp4 r1.y, v0.xyzw, cb0[16].xyzw +dp4 r1.z, v0.xyzw, cb0[17].xyzw +add r1.xyz, -r1.xyzx, cb0[12].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mad r3.xyz, r1.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r3.xyzx, r3.xyzx +rsq r1.w, r1.w +mul r3.xyz, r1.wwww, r3.xyzx +dp3 r3.x, r3.xyzx, r0.xyzx +mad r4.xyz, r1.xyzx, r0.wwww, -cb0[4].xyzx +mad r1.xyz, r1.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r4.xyzx, r4.xyzx +rsq r0.w, r0.w +mul r4.xyz, r0.wwww, r4.xyzx +dp3 r3.y, r4.xyzx, r0.xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r3.z, r1.xyzx, r0.xyzx +max r0.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r2.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r1.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r1.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicVertexLightingTx[] = +{ + 68, 88, 66, 67, 192, 69, + 99, 157, 44, 225, 124, 78, + 233, 21, 150, 217, 23, 45, + 116, 186, 1, 0, 0, 0, + 192, 8, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 48, 1, + 0, 0, 48, 8, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 132, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 110, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 119, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 248, 6, 0, 0, + 80, 0, 1, 0, 190, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 5, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 3, 0, + 0, 0, 86, 5, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 8, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 166, 10, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 70, 3, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 0, 0, 0, 9, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 3, 0, 0, 0, 246, 15, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 4, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 16, 0, + 0, 7, 66, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 52, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 47, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 143, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 25, 0, 0, 5, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 10, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 136, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 70, 8, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 166, 10, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 11, 0, 0, 0, + 70, 3, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 32, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 54, 0, 0, 5, 50, 32, + 16, 0, 2, 0, 0, 0, + 70, 16, 16, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 24, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..cdfedb4f48f009607d4a47f435257151b3bc9536 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc @@ -0,0 +1,484 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 5 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.x, -cb0[3].xyzx, r0.xyzx +dp3 r1.y, -cb0[4].xyzx, r0.xyzx +dp3 r1.z, -cb0[5].xyzx, r0.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r1.xyz, r1.xyzx, r2.xyzx +mul r3.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r3.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad r1.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mul o0.xyz, r1.xyzx, v3.xyzx +mul o0.w, v3.w, cb0[0].w +dp4 r1.x, v0.xyzw, cb0[15].xyzw +dp4 r1.y, v0.xyzw, cb0[16].xyzw +dp4 r1.z, v0.xyzw, cb0[17].xyzw +add r1.xyz, -r1.xyzx, cb0[12].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mad r3.xyz, r1.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r3.xyzx, r3.xyzx +rsq r1.w, r1.w +mul r3.xyz, r1.wwww, r3.xyzx +dp3 r3.x, r3.xyzx, r0.xyzx +mad r4.xyz, r1.xyzx, r0.wwww, -cb0[4].xyzx +mad r1.xyz, r1.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r4.xyzx, r4.xyzx +rsq r0.w, r0.w +mul r4.xyz, r0.wwww, r4.xyzx +dp3 r3.y, r4.xyzx, r0.xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r3.z, r1.xyzx, r0.xyzx +max r0.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r2.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r1.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r1.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, v0.xyzw, cb0[22].xyzw +dp4 o3.y, v0.xyzw, cb0[23].xyzw +dp4 o3.z, v0.xyzw, cb0[24].xyzw +dp4 o3.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicVertexLightingTxVc[] = +{ + 68, 88, 66, 67, 93, 208, + 172, 95, 24, 74, 88, 134, + 98, 249, 84, 250, 108, 129, + 97, 6, 1, 0, 0, 0, + 16, 9, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 196, 0, 0, 0, 80, 1, + 0, 0, 128, 8, 0, 0, + 73, 83, 71, 78, 140, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 132, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 79, 83, + 71, 78, 132, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 3, 12, + 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 40, 7, + 0, 0, 80, 0, 1, 0, + 202, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 26, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 3, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 2, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 5, 0, 0, 0, + 16, 0, 0, 8, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 19, 0, + 0, 0, 16, 0, 0, 8, + 34, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 20, 0, 0, 0, 16, 0, + 0, 8, 66, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 21, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 9, 66, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 29, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 1, 0, + 0, 0, 70, 136, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 70, 8, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 1, 0, 0, 0, 166, 10, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 70, 3, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 8, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 16, 16, 0, + 3, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 9, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 3, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..0016d2b39414ccc11778771d715b682cebe09121 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc @@ -0,0 +1,461 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// COLOR 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[26], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output_siv o2.xyzw, position +dcl_temps 5 +dp3 r0.x, v1.xyzx, cb0[19].xyzx +dp3 r0.y, v1.xyzx, cb0[20].xyzx +dp3 r0.z, v1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.x, -cb0[3].xyzx, r0.xyzx +dp3 r1.y, -cb0[4].xyzx, r0.xyzx +dp3 r1.z, -cb0[5].xyzx, r0.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r1.xyz, r1.xyzx, r2.xyzx +mul r3.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r3.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad r1.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mul o0.xyz, r1.xyzx, v2.xyzx +mul o0.w, v2.w, cb0[0].w +dp4 r1.x, v0.xyzw, cb0[15].xyzw +dp4 r1.y, v0.xyzw, cb0[16].xyzw +dp4 r1.z, v0.xyzw, cb0[17].xyzw +add r1.xyz, -r1.xyzx, cb0[12].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mad r3.xyz, r1.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r3.xyzx, r3.xyzx +rsq r1.w, r1.w +mul r3.xyz, r1.wwww, r3.xyzx +dp3 r3.x, r3.xyzx, r0.xyzx +mad r4.xyz, r1.xyzx, r0.wwww, -cb0[4].xyzx +mad r1.xyz, r1.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r4.xyzx, r4.xyzx +rsq r0.w, r0.w +mul r4.xyz, r0.wwww, r4.xyzx +dp3 r3.y, r4.xyzx, r0.xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r3.z, r1.xyzx, r0.xyzx +max r0.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r2.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r1.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r1.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, v0.xyzw, cb0[14].xyzw +dp4 o2.x, v0.xyzw, cb0[22].xyzw +dp4 o2.y, v0.xyzw, cb0[23].xyzw +dp4 o2.z, v0.xyzw, cb0[24].xyzw +dp4 o2.w, v0.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE BasicEffect_VSBasicVertexLightingVc[] = +{ + 68, 88, 66, 67, 103, 212, + 119, 83, 173, 89, 117, 173, + 87, 117, 162, 6, 55, 184, + 174, 30, 1, 0, 0, 0, + 164, 8, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 16, 1, + 0, 0, 20, 8, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 67, + 79, 76, 79, 82, 0, 171, + 171, 171, 79, 83, 71, 78, + 100, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 80, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 86, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 171, 171, 83, 72, 69, 88, + 252, 6, 0, 0, 80, 0, + 1, 0, 191, 1, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 5, 0, + 0, 0, 16, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 8, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, + 16, 0, 0, 8, 66, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 9, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 9, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 9, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 29, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 3, 0, 0, 0, + 86, 5, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 1, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 70, 8, + 16, 0, 3, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 1, 0, 0, 0, + 166, 10, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 70, 3, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 8, 130, 32, 16, 0, + 0, 0, 0, 0, 58, 16, + 16, 0, 2, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 17, 0, 0, 8, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 17, 0, 0, 8, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 17, 0, + 0, 8, 66, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 0, 0, 0, 9, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 4, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 52, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 143, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 1, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 9, 0, 0, 0, + 70, 8, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 166, 10, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 11, 0, 0, 0, 70, 3, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc new file mode 100644 index 0000000000000000000000000000000000000000..251a03dc1a6773d5c2f69893c2ff3b4e3b39837a --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_PSDualTexture.inc @@ -0,0 +1,201 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float w +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 zw 2 NONE float zw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[2], immediateIndexed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.w +dcl_input_ps linear v2.xy +dcl_input_ps linear v2.zw +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.zwzz, t1.xyzw, s1 +mul r0.xyzw, r0.xyzw, v0.xyzw +sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v2.xyxx, t0.xyzw, s0 +mul r1.xyzw, r1.xyzw, l(2.000000, 2.000000, 2.000000, 1.000000) +mul r0.xyzw, r0.xyzw, r1.xyzw +mad r1.xyz, cb0[1].xyzx, r0.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE DualTextureEffect_PSDualTexture[] = +{ + 68, 88, 66, 67, 84, 118, + 192, 38, 244, 27, 96, 67, + 87, 19, 87, 219, 43, 122, + 231, 144, 1, 0, 0, 0, + 144, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 164, 2, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 8, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 110, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 12, 12, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 184, 1, + 0, 0, 80, 0, 0, 0, + 110, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 1, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 1, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 98, 16, 0, 3, + 130, 16, 16, 0, 1, 0, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 98, 16, 0, 3, + 194, 16, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 69, 0, + 0, 139, 194, 0, 0, 128, + 67, 85, 21, 0, 242, 0, + 16, 0, 0, 0, 0, 0, + 230, 26, 16, 0, 2, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 69, 0, + 0, 139, 194, 0, 0, 128, + 67, 85, 21, 0, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 16, 16, 0, 2, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 64, 0, 0, + 0, 64, 0, 0, 0, 64, + 0, 0, 128, 63, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 32, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 32, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 228, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 24, 0, 0, 0, + 2, 0, 0, 0, 124, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 88, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 116, 0, 0, 0, + 1, 0, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 1, 0, + 0, 0, 96, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..06b9dc85056dbbb97a33fc67d02985a6fde5d347 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc @@ -0,0 +1,170 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xy +dcl_input_ps linear v1.zw +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v1.zwzz, t1.xyzw, s1 +mul r0.xyzw, r0.xyzw, v0.xyzw +sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v1.xyxx, t0.xyzw, s0 +mul r1.xyzw, r1.xyzw, l(2.000000, 2.000000, 2.000000, 1.000000) +mul o0.xyzw, r0.xyzw, r1.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE DualTextureEffect_PSDualTextureNoFog[] = +{ + 68, 88, 66, 67, 232, 140, + 86, 233, 43, 143, 191, 22, + 102, 31, 178, 156, 60, 166, + 146, 205, 1, 0, 0, 0, + 248, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 12, 2, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 86, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 12, 12, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 56, 1, + 0, 0, 80, 0, 0, 0, + 78, 0, 0, 0, 106, 8, + 0, 1, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 1, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 1, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 194, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 230, 26, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 1, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 64, + 0, 0, 0, 64, 0, 0, + 0, 64, 0, 0, 128, 63, + 56, 0, 0, 7, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 228, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 24, 0, 0, 0, 2, 0, + 0, 0, 124, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 88, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 116, 0, 0, 0, 1, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 1, 0, 0, 0, + 96, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc new file mode 100644 index 0000000000000000000000000000000000000000..7fd733b5d11063c8a6c58fc256251541b2f13c40 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTexture.inc @@ -0,0 +1,211 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 zw 2 NONE float zw +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[7], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output o2.zw +dcl_output_siv o3.xyzw, position +mov o0.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[2].xyzw +mov o1.xyz, l(0,0,0,0) +mov o2.xy, v1.xyxx +mov o2.zw, v2.xxxy +dp4 o3.x, v0.xyzw, cb0[3].xyzw +dp4 o3.y, v0.xyzw, cb0[4].xyzw +dp4 o3.z, v0.xyzw, cb0[5].xyzw +dp4 o3.w, v0.xyzw, cb0[6].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE DualTextureEffect_VSDualTexture[] = +{ + 68, 88, 66, 67, 140, 232, + 207, 173, 189, 238, 151, 106, + 133, 153, 105, 159, 135, 205, + 242, 8, 1, 0, 0, 0, + 188, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 160, 0, 0, 0, 68, 1, + 0, 0, 208, 2, 0, 0, + 73, 83, 71, 78, 104, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 92, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 156, 0, 0, 0, + 5, 0, 0, 0, 8, 0, + 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 128, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 134, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 3, 12, + 0, 0, 134, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 12, 3, + 0, 0, 143, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 132, 1, + 0, 0, 80, 0, 1, 0, + 97, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 194, 32, + 16, 0, 2, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 54, 0, + 0, 5, 194, 32, 16, 0, + 2, 0, 0, 0, 6, 20, + 16, 0, 2, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..9d9c223c4a7af7d17455b88da127849ba85bb2a5 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc @@ -0,0 +1,190 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[7], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output o1.zw +dcl_output_siv o2.xyzw, position +mov o0.xyzw, cb0[0].xyzw +mov o1.xy, v1.xyxx +mov o1.zw, v2.xxxy +dp4 o2.x, v0.xyzw, cb0[3].xyzw +dp4 o2.y, v0.xyzw, cb0[4].xyzw +dp4 o2.z, v0.xyzw, cb0[5].xyzw +dp4 o2.w, v0.xyzw, cb0[6].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE DualTextureEffect_VSDualTextureNoFog[] = +{ + 68, 88, 66, 67, 20, 214, + 202, 154, 189, 123, 20, 187, + 69, 15, 156, 71, 193, 40, + 204, 248, 1, 0, 0, 0, + 88, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 160, 0, 0, 0, 44, 1, + 0, 0, 108, 2, 0, 0, + 73, 83, 71, 78, 104, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 92, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 132, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 12, + 0, 0, 110, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 12, 3, + 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 0, + 0, 0, 67, 79, 76, 79, + 82, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 83, + 86, 95, 80, 111, 115, 105, + 116, 105, 111, 110, 0, 171, + 83, 72, 69, 88, 56, 1, + 0, 0, 80, 0, 1, 0, + 78, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 50, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 194, 32, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 6, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 194, 32, + 16, 0, 1, 0, 0, 0, + 6, 20, 16, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 228, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 24, 0, 0, 0, 2, 0, + 0, 0, 124, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 88, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 116, 0, 0, 0, 1, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 1, 0, 0, 0, + 96, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc new file mode 100644 index 0000000000000000000000000000000000000000..9c25a50034dded752c175e3c4812e71ba247d187 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc @@ -0,0 +1,221 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xy 2 NONE float xy +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 zw 2 NONE float zw +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[7], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xy +dcl_input v3.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output o2.zw +dcl_output_siv o3.xyzw, position +mul o0.xyzw, v3.xyzw, cb0[0].xyzw +dp4_sat o1.w, v0.xyzw, cb0[2].xyzw +mov o1.xyz, l(0,0,0,0) +mov o2.xy, v1.xyxx +mov o2.zw, v2.xxxy +dp4 o3.x, v0.xyzw, cb0[3].xyzw +dp4 o3.y, v0.xyzw, cb0[4].xyzw +dp4 o3.z, v0.xyzw, cb0[5].xyzw +dp4 o3.w, v0.xyzw, cb0[6].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE DualTextureEffect_VSDualTextureVc[] = +{ + 68, 88, 66, 67, 254, 227, + 99, 148, 11, 12, 82, 218, + 221, 166, 168, 104, 7, 33, + 207, 201, 1, 0, 0, 0, + 236, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 188, 0, 0, 0, 96, 1, + 0, 0, 0, 3, 0, 0, + 73, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 125, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 156, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 128, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 134, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 12, 3, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 152, 1, 0, 0, + 80, 0, 1, 0, 102, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 194, 32, 16, 0, + 2, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 54, 0, 0, 8, 114, 32, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 54, 0, + 0, 5, 194, 32, 16, 0, + 2, 0, 0, 0, 6, 20, + 16, 0, 2, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 3, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 3, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 3, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..27d3dc68e3ca861e793d02f6a4a7a06ef2964006 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc @@ -0,0 +1,200 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xy 2 NONE float xy +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[7], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xy +dcl_input v3.xyzw +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output o1.zw +dcl_output_siv o2.xyzw, position +mul o0.xyzw, v3.xyzw, cb0[0].xyzw +mov o1.xy, v1.xyxx +mov o1.zw, v2.xxxy +dp4 o2.x, v0.xyzw, cb0[3].xyzw +dp4 o2.y, v0.xyzw, cb0[4].xyzw +dp4 o2.z, v0.xyzw, cb0[5].xyzw +dp4 o2.w, v0.xyzw, cb0[6].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE DualTextureEffect_VSDualTextureVcNoFog[] = +{ + 68, 88, 66, 67, 211, 41, + 84, 141, 130, 240, 152, 3, + 75, 200, 17, 59, 116, 89, + 102, 11, 1, 0, 0, 0, + 136, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 188, 0, 0, 0, 72, 1, + 0, 0, 156, 2, 0, 0, + 73, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 125, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 132, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 110, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 110, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 12, 3, 0, 0, + 119, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 76, 1, 0, 0, + 80, 0, 1, 0, 83, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 194, 32, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 2, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 194, 32, + 16, 0, 1, 0, 0, 0, + 6, 20, 16, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 2, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 17, 0, 0, 8, + 130, 32, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 228, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 24, 0, 0, 0, 2, 0, + 0, 0, 124, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 88, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 116, 0, 0, 0, 1, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 1, 0, 0, 0, + 96, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc new file mode 100644 index 0000000000000000000000000000000000000000..9f9c82823af1347d922d6c5f7442c0d77c8cba5b --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc @@ -0,0 +1,203 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[12], immediateIndexed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texturecube (float,float,float,float) t1 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xy +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texturecube)(float,float,float,float) r0.xyz, v3.xyzx, t1.xyzw, s1 +sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v2.xyxx, t0.xyzw, s0 +mul r1.xyzw, r1.xyzw, v0.xyzw +mad r0.xyz, r0.xyzx, r1.wwww, -r1.xyzx +mad r0.xyz, v1.xyzx, r0.xyzx, r1.xyzx +mad r1.xyz, cb0[11].xyzx, r1.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r1.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_PSEnvMap[] = +{ + 68, 88, 66, 67, 157, 9, + 99, 156, 11, 99, 91, 141, + 218, 79, 141, 114, 94, 69, + 126, 40, 1, 0, 0, 0, + 152, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 172, 2, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 110, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 7, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 192, 1, + 0, 0, 80, 0, 0, 0, + 112, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 1, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 88, 48, + 0, 4, 0, 112, 16, 0, + 1, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 1, 0, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 3, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 69, 0, + 0, 139, 130, 1, 0, 128, + 67, 85, 21, 0, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 11, 0, 0, 0, 246, 15, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 114, 32, + 16, 0, 0, 0, 0, 0, + 246, 31, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..d856e5451464dc07758fd8ccdb54270d300de719 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc @@ -0,0 +1,184 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texturecube (float,float,float,float) t1 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xy +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texturecube)(float,float,float,float) r0.xyz, v3.xyzx, t1.xyzw, s1 +sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v2.xyxx, t0.xyzw, s0 +mul r1.xyzw, r1.xyzw, v0.xyzw +mad r0.xyz, r0.xyzx, r1.wwww, -r1.xyzx +mad o0.xyz, v1.xyzx, r0.xyzx, r1.xyzx +mov o0.w, r1.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_PSEnvMapNoFog[] = +{ + 68, 88, 66, 67, 69, 131, + 102, 255, 198, 7, 8, 191, + 110, 207, 207, 220, 90, 166, + 34, 61, 1, 0, 0, 0, + 56, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 76, 2, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 7, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 110, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 7, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 96, 1, + 0, 0, 80, 0, 0, 0, + 88, 0, 0, 0, 106, 8, + 0, 1, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 1, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 88, 48, 0, 4, 0, 112, + 16, 0, 1, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 130, 1, + 0, 128, 67, 85, 21, 0, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 3, 0, 0, 0, 70, 126, + 16, 0, 1, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 2, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 9, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc new file mode 100644 index 0000000000000000000000000000000000000000..5a6655aa6d06dc8869836ea11fc81623e02c32fe --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc @@ -0,0 +1,216 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[12], immediateIndexed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texturecube (float,float,float,float) t1 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xy +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texturecube)(float,float,float,float) r0.xyzw, v3.xyzx, t1.xyzw, s1 +sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v2.xyxx, t0.xyzw, s0 +mul r1.xyzw, r1.xyzw, v0.xyzw +mad r0.xyz, r0.xyzx, r1.wwww, -r1.xyzx +mul r0.w, r0.w, r1.w +mad r0.xyz, v1.xyzx, r0.xyzx, r1.xyzx +mad r0.xyz, cb0[0].xyzx, r0.wwww, r0.xyzx +mad r1.xyz, cb0[11].xyzx, r1.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r1.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_PSEnvMapSpecular[] = +{ + 68, 88, 66, 67, 3, 3, + 118, 118, 47, 120, 137, 76, + 211, 129, 169, 16, 12, 223, + 109, 239, 1, 0, 0, 0, + 220, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 240, 2, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 110, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 7, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 4, 2, + 0, 0, 80, 0, 0, 0, + 129, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 1, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 88, 48, + 0, 4, 0, 112, 16, 0, + 1, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 1, 0, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 3, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 69, 0, + 0, 139, 130, 1, 0, 128, + 67, 85, 21, 0, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 9, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 11, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 246, 31, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 228, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 24, 0, 0, 0, 2, 0, + 0, 0, 124, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 88, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 116, 0, 0, 0, 1, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 1, 0, 0, 0, + 96, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..c74bd04f8a7a8359fb8970ecd6f687e1fbef1480 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc @@ -0,0 +1,201 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texturecube (float,float,float,float) t1 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xy +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texturecube)(float,float,float,float) r0.xyzw, v3.xyzx, t1.xyzw, s1 +sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v2.xyxx, t0.xyzw, s0 +mul r1.xyzw, r1.xyzw, v0.xyzw +mad r0.xyz, r0.xyzx, r1.wwww, -r1.xyzx +mul r0.w, r0.w, r1.w +mad r0.xyz, v1.xyzx, r0.xyzx, r1.xyzx +mov o0.w, r1.w +mad o0.xyz, cb0[0].xyzx, r0.wwww, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_PSEnvMapSpecularNoFog[] = +{ + 68, 88, 66, 67, 169, 57, + 65, 205, 202, 70, 74, 80, + 98, 117, 65, 126, 198, 71, + 210, 186, 1, 0, 0, 0, + 140, 3, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 160, 2, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 7, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 110, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 7, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 180, 1, + 0, 0, 80, 0, 0, 0, + 109, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 1, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 88, 48, + 0, 4, 0, 112, 16, 0, + 1, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 98, 16, 0, 3, + 114, 16, 16, 0, 3, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 69, 0, + 0, 139, 130, 1, 0, 128, + 67, 85, 21, 0, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 9, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc new file mode 100644 index 0000000000000000000000000000000000000000..5436f5533f0b58c3f267c298da1f8554b4b5f0f2 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc @@ -0,0 +1,377 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[24], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output o3.xyz +dcl_output_siv o4.xyzw, position +dcl_temps 3 +dp3 r0.x, v1.xyzx, cb0[17].xyzx +dp3 r0.y, v1.xyzx, cb0[18].xyzx +dp3 r0.z, v1.xyzx, cb0[19].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.x, -cb0[4].xyzx, r0.xyzx +dp3 r1.y, -cb0[5].xyzx, r0.xyzx +dp3 r1.z, -cb0[6].xyzx, r0.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r1.xyz, r1.xyzx, r2.xyzx +mul r2.xyz, r1.yyyy, cb0[8].xyzx +mad r1.xyw, r1.xxxx, cb0[7].xyxz, r2.xyxz +mad r1.xyz, r1.zzzz, cb0[9].xyzx, r1.xywx +mad o0.xyz, r1.xyzx, cb0[2].xyzx, cb0[3].xyzx +mov o0.w, cb0[2].w +dp4_sat o1.w, v0.xyzw, cb0[12].xyzw +mov o1.xyz, cb0[1].xxxx +mov o2.xy, v2.xyxx +dp4 r1.x, v0.xyzw, cb0[13].xyzw +dp4 r1.y, v0.xyzw, cb0[14].xyzw +dp4 r1.z, v0.xyzw, cb0[15].xyzw +add r1.xyz, -r1.xyzx, cb0[10].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r0.w, -r1.xyzx, r0.xyzx +add r0.w, r0.w, r0.w +mad o3.xyz, r0.xyzx, -r0.wwww, -r1.xyzx +dp4 o4.x, v0.xyzw, cb0[20].xyzw +dp4 o4.y, v0.xyzw, cb0[21].xyzw +dp4 o4.z, v0.xyzw, cb0[22].xyzw +dp4 o4.w, v0.xyzw, cb0[23].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_VSEnvMap[] = +{ + 68, 88, 66, 67, 131, 31, + 168, 141, 23, 224, 53, 49, + 50, 52, 102, 39, 187, 242, + 82, 62, 1, 0, 0, 0, + 4, 7, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 72, 1, + 0, 0, 24, 6, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 156, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 128, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 134, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 8, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 200, 4, 0, 0, + 80, 0, 1, 0, 50, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 3, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 3, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 18, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 2, 0, + 0, 0, 86, 5, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 70, 8, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 166, 10, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 3, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 54, 0, + 0, 6, 114, 32, 16, 0, + 1, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 2, 0, 0, 0, 70, 16, + 16, 0, 2, 0, 0, 0, + 17, 0, 0, 8, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 13, 0, + 0, 0, 17, 0, 0, 8, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 17, 0, + 0, 8, 66, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 0, 0, 0, 9, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 10, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 16, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc new file mode 100644 index 0000000000000000000000000000000000000000..79f4622b03064f39f3f3a52484225ce2abeff4bd --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc @@ -0,0 +1,411 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[24], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output o3.xyz +dcl_output_siv o4.xyzw, position +dcl_temps 3 +dp3 r0.x, v1.xyzx, cb0[17].xyzx +dp3 r0.y, v1.xyzx, cb0[18].xyzx +dp3 r0.z, v1.xyzx, cb0[19].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.x, -cb0[4].xyzx, r0.xyzx +dp3 r1.y, -cb0[5].xyzx, r0.xyzx +dp3 r1.z, -cb0[6].xyzx, r0.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r1.xyz, r1.xyzx, r2.xyzx +mul r2.xyz, r1.yyyy, cb0[8].xyzx +mad r1.xyw, r1.xxxx, cb0[7].xyxz, r2.xyxz +mad r1.xyz, r1.zzzz, cb0[9].xyzx, r1.xywx +mad o0.xyz, r1.xyzx, cb0[2].xyzx, cb0[3].xyzx +mov o0.w, cb0[2].w +dp4 r1.x, v0.xyzw, cb0[13].xyzw +dp4 r1.y, v0.xyzw, cb0[14].xyzw +dp4 r1.z, v0.xyzw, cb0[15].xyzw +add r1.xyz, -r1.xyzx, cb0[10].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r0.w, r1.xyzx, r0.xyzx +add r0.w, -|r0.w|, l(1.000000) +max r0.w, r0.w, l(0.000000) +log r0.w, r0.w +mul r0.w, r0.w, cb0[1].y +exp r0.w, r0.w +mul o1.xyz, r0.wwww, cb0[1].xxxx +dp4_sat o1.w, v0.xyzw, cb0[12].xyzw +mov o2.xy, v2.xyxx +dp3 r0.w, -r1.xyzx, r0.xyzx +add r0.w, r0.w, r0.w +mad o3.xyz, r0.xyzx, -r0.wwww, -r1.xyzx +dp4 o4.x, v0.xyzw, cb0[20].xyzw +dp4 o4.y, v0.xyzw, cb0[21].xyzw +dp4 o4.z, v0.xyzw, cb0[22].xyzw +dp4 o4.w, v0.xyzw, cb0[23].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_VSEnvMapFresnel[] = +{ + 68, 88, 66, 67, 71, 172, + 126, 31, 77, 105, 250, 80, + 172, 118, 91, 20, 70, 100, + 127, 147, 1, 0, 0, 0, + 172, 7, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 72, 1, + 0, 0, 192, 6, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 156, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 128, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 134, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 8, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 112, 5, 0, 0, + 80, 0, 1, 0, 92, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 3, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 3, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 18, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 2, 0, + 0, 0, 86, 5, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 70, 8, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 166, 10, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 3, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 0, 0, 0, 9, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 128, 193, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 52, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 47, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 26, 128, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 25, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 17, 0, 0, 8, 18, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 17, 0, 0, 8, + 34, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 17, 0, + 0, 8, 66, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 130, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 228, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 24, 0, + 0, 0, 2, 0, 0, 0, + 124, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 116, 0, + 0, 0, 1, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 96, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc new file mode 100644 index 0000000000000000000000000000000000000000..f54dd6f1af1b8fd0927463229280c103106a6810 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLight.inc @@ -0,0 +1,343 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[24], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output o3.xyz +dcl_output_siv o4.xyzw, position +dcl_temps 2 +dp3 r0.x, v1.xyzx, cb0[17].xyzx +dp3 r0.y, v1.xyzx, cb0[18].xyzx +dp3 r0.z, v1.xyzx, cb0[19].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[4].xyzx, r0.xyzx +ge r1.x, r0.w, l(0.000000) +and r1.x, r1.x, l(0x3f800000) +mul r0.w, r0.w, r1.x +mul r1.xyz, r0.wwww, cb0[7].xyzx +mad o0.xyz, r1.xyzx, cb0[2].xyzx, cb0[3].xyzx +mov o0.w, cb0[2].w +dp4_sat o1.w, v0.xyzw, cb0[12].xyzw +mov o1.xyz, cb0[1].xxxx +mov o2.xy, v2.xyxx +dp4 r1.x, v0.xyzw, cb0[13].xyzw +dp4 r1.y, v0.xyzw, cb0[14].xyzw +dp4 r1.z, v0.xyzw, cb0[15].xyzw +add r1.xyz, -r1.xyzx, cb0[10].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r0.w, -r1.xyzx, r0.xyzx +add r0.w, r0.w, r0.w +mad o3.xyz, r0.xyzx, -r0.wwww, -r1.xyzx +dp4 o4.x, v0.xyzw, cb0[20].xyzw +dp4 o4.y, v0.xyzw, cb0[21].xyzw +dp4 o4.z, v0.xyzw, cb0[22].xyzw +dp4 o4.w, v0.xyzw, cb0[23].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_VSEnvMapOneLight[] = +{ + 68, 88, 66, 67, 215, 39, + 2, 90, 92, 167, 221, 160, + 68, 56, 185, 26, 25, 218, + 60, 249, 1, 0, 0, 0, + 84, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 72, 1, + 0, 0, 104, 5, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 156, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 128, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 134, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 8, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 24, 4, 0, 0, + 80, 0, 1, 0, 6, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 3, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 18, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 6, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 54, 0, 0, 6, + 114, 32, 16, 0, 1, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 0, 0, + 0, 9, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 8, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 32, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 228, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 24, 0, 0, 0, + 2, 0, 0, 0, 124, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 88, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 116, 0, 0, 0, + 1, 0, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 1, 0, + 0, 0, 96, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc new file mode 100644 index 0000000000000000000000000000000000000000..72eb00a67197325dfd6d4294c83e9cb605f63e0e --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/EnvironmentMapEffect_VSEnvMapOneLightFresnel.inc @@ -0,0 +1,377 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// TEXCOORD 1 xyz 3 NONE float xyz +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[24], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output o3.xyz +dcl_output_siv o4.xyzw, position +dcl_temps 2 +dp3 r0.x, v1.xyzx, cb0[17].xyzx +dp3 r0.y, v1.xyzx, cb0[18].xyzx +dp3 r0.z, v1.xyzx, cb0[19].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[4].xyzx, r0.xyzx +ge r1.x, r0.w, l(0.000000) +and r1.x, r1.x, l(0x3f800000) +mul r0.w, r0.w, r1.x +mul r1.xyz, r0.wwww, cb0[7].xyzx +mad o0.xyz, r1.xyzx, cb0[2].xyzx, cb0[3].xyzx +mov o0.w, cb0[2].w +dp4 r1.x, v0.xyzw, cb0[13].xyzw +dp4 r1.y, v0.xyzw, cb0[14].xyzw +dp4 r1.z, v0.xyzw, cb0[15].xyzw +add r1.xyz, -r1.xyzx, cb0[10].xyzx +dp3 r0.w, r1.xyzx, r1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, r1.xyzx +dp3 r0.w, r1.xyzx, r0.xyzx +add r0.w, -|r0.w|, l(1.000000) +max r0.w, r0.w, l(0.000000) +log r0.w, r0.w +mul r0.w, r0.w, cb0[1].y +exp r0.w, r0.w +mul o1.xyz, r0.wwww, cb0[1].xxxx +dp4_sat o1.w, v0.xyzw, cb0[12].xyzw +mov o2.xy, v2.xyxx +dp3 r0.w, -r1.xyzx, r0.xyzx +add r0.w, r0.w, r0.w +mad o3.xyz, r0.xyzx, -r0.wwww, -r1.xyzx +dp4 o4.x, v0.xyzw, cb0[20].xyzw +dp4 o4.y, v0.xyzw, cb0[21].xyzw +dp4 o4.z, v0.xyzw, cb0[22].xyzw +dp4 o4.w, v0.xyzw, cb0[23].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE EnvironmentMapEffect_VSEnvMapOneLightFresnel[] = +{ + 68, 88, 66, 67, 183, 50, + 20, 91, 199, 254, 128, 97, + 48, 63, 67, 36, 199, 86, + 150, 229, 1, 0, 0, 0, + 252, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 72, 1, + 0, 0, 16, 6, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 99, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 79, 83, 71, 78, + 156, 0, 0, 0, 5, 0, + 0, 0, 8, 0, 0, 0, + 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 128, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 0, 0, 0, + 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 3, 12, 0, 0, + 134, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 8, 0, 0, + 143, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 192, 4, 0, 0, + 80, 0, 1, 0, 48, 1, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 114, 32, 16, 0, + 3, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 18, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 19, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 6, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 0, 0, 8, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 13, 0, + 0, 0, 17, 0, 0, 8, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 17, 0, + 0, 8, 66, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 0, 0, 0, 9, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 10, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 8, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 128, + 193, 0, 0, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 52, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 26, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 25, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 32, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 17, 32, + 0, 8, 130, 32, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 54, 0, 0, 5, 50, 32, + 16, 0, 2, 0, 0, 0, + 70, 16, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 8, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 32, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 20, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 4, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 21, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 4, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 4, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 23, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 228, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 24, 0, 0, 0, + 2, 0, 0, 0, 124, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 88, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 116, 0, 0, 0, + 1, 0, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 1, 0, + 0, 0, 96, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/GenerateMips_main.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/GenerateMips_main.inc new file mode 100644 index 0000000000000000000000000000000000000000..09eff9e82a6acb19606ab8825ee57443be70bed5 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/GenerateMips_main.inc @@ -0,0 +1,145 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// no Input +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// no Output +cs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_uav_typed_texture2d (float,float,float,float) u0 +dcl_input vThreadGroupID.xy +dcl_input vThreadIDInGroup.xy +dcl_temps 2 +dcl_thread_group 8, 8, 1 +imad r0.xyzw, vThreadGroupID.xyyy, l(8, 8, 8, 8), vThreadIDInGroup.xyyy +utof r1.xy, r0.xwxx +add r1.xy, r1.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000) +mul r1.xy, r1.xyxx, cb0[0].xyxx +utof r1.z, cb0[0].z +sample_l_indexable(texture2d)(float,float,float,float) r1.xyzw, r1.xyxx, t0.xyzw, s0, r1.z +store_uav_typed u0.xyzw, r0.xyzw, r1.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE GenerateMips_main[] = +{ + 68, 88, 66, 67, 139, 43, + 171, 21, 172, 255, 118, 42, + 154, 115, 210, 228, 19, 66, + 84, 18, 1, 0, 0, 0, + 116, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 64, 0, 0, 0, 80, 0, + 0, 0, 184, 1, 0, 0, + 73, 83, 71, 78, 8, 0, + 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 79, 83, + 71, 78, 8, 0, 0, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 83, 72, 69, 88, + 96, 1, 0, 0, 80, 0, + 5, 0, 88, 0, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 156, 24, 0, 4, 0, 224, + 17, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 95, 0, + 0, 2, 50, 16, 2, 0, + 95, 0, 0, 2, 50, 32, + 2, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 155, 0, + 0, 4, 8, 0, 0, 0, + 8, 0, 0, 0, 1, 0, + 0, 0, 35, 0, 0, 10, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 21, 2, 0, + 2, 64, 0, 0, 8, 0, + 0, 0, 8, 0, 0, 0, + 8, 0, 0, 0, 8, 0, + 0, 0, 70, 37, 2, 0, + 86, 0, 0, 5, 50, 0, + 16, 0, 1, 0, 0, 0, + 198, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 10, + 50, 0, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 50, 0, + 16, 0, 1, 0, 0, 0, + 70, 0, 16, 0, 1, 0, + 0, 0, 70, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 86, 0, 0, 6, + 66, 0, 16, 0, 1, 0, + 0, 0, 42, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 72, 0, 0, 141, + 194, 0, 0, 128, 67, 85, + 21, 0, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 0, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 42, 0, + 16, 0, 1, 0, 0, 0, + 164, 0, 0, 7, 242, 224, + 17, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 180, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 128, 0, 0, 0, + 62, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 100, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 80, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 1, 0, 0, 0, + 108, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 20, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc new file mode 100644 index 0000000000000000000000000000000000000000..7a03f2867cb9daabcfa7ff17515ab87c5e9265c4 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc @@ -0,0 +1,420 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xy +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xyz +dcl_input_ps linear v3.xyzw +dcl_output o0.xyzw +dcl_temps 4 +add r0.xyz, -v1.xyzx, cb0[12].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mad r1.xyz, r0.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r1.w, r1.xyzx, r1.xyzx +rsq r1.w, r1.w +mul r1.xyz, r1.wwww, r1.xyzx +dp3 r1.w, v2.xyzx, v2.xyzx +rsq r1.w, r1.w +mul r2.xyz, r1.wwww, v2.xyzx +dp3 r1.x, r1.xyzx, r2.xyzx +mad r3.xyz, r0.xyzx, r0.wwww, -cb0[4].xyzx +mad r0.xyz, r0.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r3.xyzx, r3.xyzx +rsq r0.w, r0.w +mul r3.xyz, r0.wwww, r3.xyzx +dp3 r1.y, r3.xyzx, r2.xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r1.z, r0.xyzx, r2.xyzx +max r0.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +dp3 r1.x, -cb0[3].xyzx, r2.xyzx +dp3 r1.y, -cb0[4].xyzx, r2.xyzx +dp3 r1.z, -cb0[5].xyzx, r2.xyzx +ge r2.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r2.xyz, r2.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r0.xyz, r0.xyzx, r2.xyzx +mul r1.xyz, r1.xyzx, r2.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r2.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul r0.xyz, r0.xyzx, cb0[2].xyzx +sample_indexable(texture2d)(float,float,float,float) r2.xyzw, v0.xyxx, t0.xyzw, s0 +mul r2.xyzw, r2.xyzw, v3.xyzw +mul r0.xyz, r0.xyzx, r2.wwww +mul r3.xyz, r1.yyyy, cb0[7].xyzx +mad r1.xyw, r1.xxxx, cb0[6].xyxz, r3.xyxz +mad r1.xyz, r1.zzzz, cb0[8].xyzx, r1.xywx +mad r1.xyz, r1.xyzx, cb0[0].xyzx, cb0[1].xyzx +mad r0.xyz, r2.xyzx, r1.xyzx, r0.xyzx +mad r1.xyz, cb0[13].xyzx, r2.wwww, -r0.xyzx +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +mov o0.w, r2.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_PSSkinnedPixelLighting[] = +{ + 68, 88, 66, 67, 205, 238, + 143, 140, 178, 65, 203, 209, + 67, 78, 138, 68, 75, 82, + 38, 112, 1, 0, 0, 0, + 212, 7, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 176, 0, 0, 0, 228, 0, + 0, 0, 68, 7, 0, 0, + 73, 83, 71, 78, 120, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 3, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 104, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 7, 0, 0, 113, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 88, 6, + 0, 0, 80, 0, 0, 0, + 150, 1, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 4, 0, 0, 0, + 0, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 12, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 3, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 0, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 1, 0, + 0, 0, 70, 136, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 70, 8, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 1, 0, 0, 0, 166, 10, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 70, 3, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 246, 15, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 114, 32, + 16, 0, 0, 0, 0, 0, + 246, 31, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 2, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc new file mode 100644 index 0000000000000000000000000000000000000000..0033fde827a687d698e381ee2c171890aa42f5bb --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc @@ -0,0 +1,157 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[14], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyzw +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 2 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +mad r0.xyz, v1.xyzx, r0.wwww, r0.xyzx +mad r1.xyz, cb0[13].xyzx, r0.wwww, -r0.xyzx +mov o0.w, r0.w +mad o0.xyz, v1.wwww, r1.xyzx, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_PSSkinnedVertexLighting[] = +{ + 68, 88, 66, 67, 34, 223, + 3, 44, 153, 63, 227, 172, + 41, 191, 222, 82, 131, 245, + 43, 22, 1, 0, 0, 0, + 168, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 24, 2, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 15, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 68, 1, + 0, 0, 80, 0, 0, 0, + 81, 0, 0, 0, 106, 8, + 0, 1, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 114, 32, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc new file mode 100644 index 0000000000000000000000000000000000000000..486684ec7e217a3a102231a291d5bba56ed00637 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc @@ -0,0 +1,138 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xy +dcl_output o0.xyzw +dcl_temps 1 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0 +mul r0.xyzw, r0.xyzw, v0.xyzw +mad o0.xyz, v1.xyzx, r0.wwww, r0.xyzx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_PSSkinnedVertexLightingNoFog[] = +{ + 68, 88, 66, 67, 164, 58, + 62, 66, 161, 173, 104, 194, + 104, 188, 84, 59, 140, 69, + 107, 145, 1, 0, 0, 0, + 72, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 152, 0, 0, 0, 204, 0, + 0, 0, 184, 1, 0, 0, + 73, 83, 71, 78, 96, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 80, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 7, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 228, 0, + 0, 0, 80, 0, 0, 0, + 57, 0, 0, 0, 106, 8, + 0, 1, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 98, 16, 0, 3, 114, 16, + 16, 0, 1, 0, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 2, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc new file mode 100644 index 0000000000000000000000000000000000000000..7603eef7111ef70d520feb9d684f2fa318952427 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc @@ -0,0 +1,529 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint xyzw +// BLENDWEIGHT 0 xyzw 4 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xyzw +dcl_input v4.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 4 +imul null, r0.xyzw, v3.xyzw, l(3, 3, 3, 3) +mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw +mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw +mad r1.xyzw, cb0[r0.z + 26].xyzw, v4.zzzz, r1.xyzw +mad r1.xyzw, cb0[r0.w + 26].xyzw, v4.wwww, r1.xyzw +dp3 r2.x, v1.xyzx, r1.xyzx +dp4 r1.x, v0.xyzw, r1.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw +mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw +mad r3.xyzw, cb0[r0.z + 27].xyzw, v4.zzzz, r3.xyzw +mad r3.xyzw, cb0[r0.w + 27].xyzw, v4.wwww, r3.xyzw +dp3 r2.y, v1.xyzx, r3.xyzx +dp4 r1.y, v0.xyzw, r3.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw +mad r3.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw +mad r3.xyzw, cb0[r0.z + 28].xyzw, v4.zzzz, r3.xyzw +mad r0.xyzw, cb0[r0.w + 28].xyzw, v4.wwww, r3.xyzw +dp3 r2.z, v1.xyzx, r0.xyzx +dp4 r1.z, v0.xyzw, r0.xyzw +dp3 r0.x, r2.xyzx, cb0[19].xyzx +dp3 r0.y, r2.xyzx, cb0[20].xyzx +dp3 r0.z, r2.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r2.x, r0.w, l(0.000000) +and r2.x, r2.x, l(0x3f800000) +mul r0.w, r0.w, r2.x +mul r2.yzw, r0.wwww, cb0[6].xxyz +mad o0.xyz, r2.yzwy, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +mov r1.w, v0.w +dp4 r3.x, r1.xyzw, cb0[15].xyzw +dp4 r3.y, r1.xyzw, cb0[16].xyzw +dp4 r3.z, r1.xyzw, cb0[17].xyzw +add r2.yzw, -r3.xxyz, cb0[12].xxyz +dp3 r0.w, r2.yzwy, r2.yzwy +rsq r0.w, r0.w +mad r2.yzw, r2.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r2.yzwy, r2.yzwy +rsq r0.w, r0.w +mul r2.yzw, r0.wwww, r2.yyzw +dp3 r0.x, r2.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r2.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, r1.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, r1.xyzw, cb0[22].xyzw +dp4 o3.y, r1.xyzw, cb0[23].xyzw +dp4 o3.z, r1.xyzw, cb0[24].xyzw +dp4 o3.w, r1.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedOneLightFourBones[] = +{ + 68, 88, 66, 67, 247, 59, + 5, 109, 75, 221, 79, 216, + 220, 196, 152, 20, 92, 159, + 55, 73, 1, 0, 0, 0, + 0, 10, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 124, 1, + 0, 0, 112, 9, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 12, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 236, 7, 0, 0, 80, 0, + 1, 0, 251, 1, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 38, 0, 0, 11, + 0, 208, 0, 0, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 26, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 166, 26, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 27, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 166, 26, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 17, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 28, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 166, 26, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 226, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 54, 0, 0, 6, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 0, 0, 0, 9, + 226, 0, 16, 0, 2, 0, + 0, 0, 6, 9, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 2, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 2, 0, + 0, 0, 86, 14, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 150, 7, 16, 0, 2, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 226, 0, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 86, 14, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 52, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc new file mode 100644 index 0000000000000000000000000000000000000000..4067262f681fe22597be7e1f5cc484bfa1bfe9aa --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc @@ -0,0 +1,446 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint x +// BLENDWEIGHT 0 xyzw 4 NONE float x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.x +dcl_input v4.x +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 4 +imul null, r0.x, v3.x, l(3) +mul r1.xyzw, v4.xxxx, cb0[r0.x + 26].xyzw +dp3 r2.x, v1.xyzx, r1.xyzx +dp4 r1.x, v0.xyzw, r1.xyzw +mul r3.xyzw, v4.xxxx, cb0[r0.x + 27].xyzw +mul r0.xyzw, v4.xxxx, cb0[r0.x + 28].xyzw +dp3 r2.y, v1.xyzx, r3.xyzx +dp4 r1.y, v0.xyzw, r3.xyzw +dp3 r2.z, v1.xyzx, r0.xyzx +dp4 r1.z, v0.xyzw, r0.xyzw +dp3 r0.x, r2.xyzx, cb0[19].xyzx +dp3 r0.y, r2.xyzx, cb0[20].xyzx +dp3 r0.z, r2.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r2.x, r0.w, l(0.000000) +and r2.x, r2.x, l(0x3f800000) +mul r0.w, r0.w, r2.x +mul r2.yzw, r0.wwww, cb0[6].xxyz +mad o0.xyz, r2.yzwy, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +mov r1.w, v0.w +dp4 r3.x, r1.xyzw, cb0[15].xyzw +dp4 r3.y, r1.xyzw, cb0[16].xyzw +dp4 r3.z, r1.xyzw, cb0[17].xyzw +add r2.yzw, -r3.xxyz, cb0[12].xxyz +dp3 r0.w, r2.yzwy, r2.yzwy +rsq r0.w, r0.w +mad r2.yzw, r2.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r2.yzwy, r2.yzwy +rsq r0.w, r0.w +mul r2.yzw, r0.wwww, r2.yyzw +dp3 r0.x, r2.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r2.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, r1.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, r1.xyzw, cb0[22].xyzw +dp4 o3.y, r1.xyzw, cb0[23].xyzw +dp4 o3.z, r1.xyzw, cb0[24].xyzw +dp4 o3.w, r1.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedOneLightOneBone[] = +{ + 68, 88, 66, 67, 79, 146, + 189, 140, 61, 29, 188, 98, + 129, 101, 234, 167, 61, 250, + 30, 61, 1, 0, 0, 0, + 68, 8, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 124, 1, + 0, 0, 180, 7, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 1, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 1, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 12, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 48, 6, 0, 0, 80, 0, + 1, 0, 140, 1, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 18, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 18, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 38, 0, 0, 8, + 0, 208, 0, 0, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 16, 16, 0, 3, 0, + 0, 0, 1, 64, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 26, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 27, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 242, 0, 16, 0, 0, 0, + 0, 0, 6, 16, 16, 0, + 4, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 28, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 2, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 226, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 54, 0, 0, 6, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 0, 0, 0, 9, + 226, 0, 16, 0, 2, 0, + 0, 0, 6, 9, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 2, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 2, 0, + 0, 0, 86, 14, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 150, 7, 16, 0, 2, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 226, 0, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 86, 14, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 52, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc new file mode 100644 index 0000000000000000000000000000000000000000..847abe1883061543b1a0b466fe23c08824bf0947 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc @@ -0,0 +1,475 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint xy +// BLENDWEIGHT 0 xyzw 4 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xy +dcl_input v4.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 4 +imul null, r0.xy, v3.xyxx, l(3, 3, 0, 0) +mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw +mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw +dp3 r2.x, v1.xyzx, r1.xyzx +dp4 r1.x, v0.xyzw, r1.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw +mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw +dp3 r2.y, v1.xyzx, r3.xyzx +dp4 r1.y, v0.xyzw, r3.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw +mad r0.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw +dp3 r2.z, v1.xyzx, r0.xyzx +dp4 r1.z, v0.xyzw, r0.xyzw +dp3 r0.x, r2.xyzx, cb0[19].xyzx +dp3 r0.y, r2.xyzx, cb0[20].xyzx +dp3 r0.z, r2.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r0.w, -cb0[3].xyzx, r0.xyzx +ge r2.x, r0.w, l(0.000000) +and r2.x, r2.x, l(0x3f800000) +mul r0.w, r0.w, r2.x +mul r2.yzw, r0.wwww, cb0[6].xxyz +mad o0.xyz, r2.yzwy, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +mov r1.w, v0.w +dp4 r3.x, r1.xyzw, cb0[15].xyzw +dp4 r3.y, r1.xyzw, cb0[16].xyzw +dp4 r3.z, r1.xyzw, cb0[17].xyzw +add r2.yzw, -r3.xxyz, cb0[12].xxyz +dp3 r0.w, r2.yzwy, r2.yzwy +rsq r0.w, r0.w +mad r2.yzw, r2.yyzw, r0.wwww, -cb0[3].xxyz +dp3 r0.w, r2.yzwy, r2.yzwy +rsq r0.w, r0.w +mul r2.yzw, r0.wwww, r2.yyzw +dp3 r0.x, r2.yzwy, r0.xyzx +max r0.x, r0.x, l(0.000000) +mul r0.x, r2.x, r0.x +log r0.x, r0.x +mul r0.x, r0.x, cb0[2].w +exp r0.x, r0.x +mul r0.xyz, r0.xxxx, cb0[9].xyzx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, r1.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, r1.xyzw, cb0[22].xyzw +dp4 o3.y, r1.xyzw, cb0[23].xyzw +dp4 o3.z, r1.xyzw, cb0[24].xyzw +dp4 o3.w, r1.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedOneLightTwoBones[] = +{ + 68, 88, 66, 67, 106, 23, + 95, 36, 179, 155, 36, 16, + 91, 165, 182, 252, 8, 66, + 111, 185, 1, 0, 0, 0, + 224, 8, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 124, 1, + 0, 0, 80, 8, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 3, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 12, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 204, 6, 0, 0, 80, 0, + 1, 0, 179, 1, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 38, 0, 0, 11, + 0, 208, 0, 0, 50, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 26, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 27, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 17, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 28, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 7, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 226, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 6, 137, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 50, 0, + 0, 11, 114, 32, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 54, 0, 0, 6, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 1, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 0, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 0, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 0, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 0, 0, 0, 9, + 226, 0, 16, 0, 2, 0, + 0, 0, 6, 9, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 6, 137, 32, 0, + 0, 0, 0, 0, 12, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 2, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 226, 0, 16, 0, 2, 0, + 0, 0, 86, 14, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 6, 137, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 2, 0, 0, 0, + 150, 7, 16, 0, 2, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 226, 0, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 86, 14, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 52, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 58, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc new file mode 100644 index 0000000000000000000000000000000000000000..ed0e0564c4a3db70050025d1673f10708dc2cecf --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc @@ -0,0 +1,419 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint xyzw +// BLENDWEIGHT 0 xyzw 4 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xyzw +dcl_input v4.xyzw +dcl_output o0.xy +dcl_output o1.xyzw +dcl_output o2.xyz +dcl_output o3.xyzw +dcl_output_siv o4.xyzw, position +dcl_temps 4 +mov o0.xy, v2.xyxx +imul null, r0.xyzw, v3.xyzw, l(3, 3, 3, 3) +mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw +mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw +mad r1.xyzw, cb0[r0.z + 26].xyzw, v4.zzzz, r1.xyzw +mad r1.xyzw, cb0[r0.w + 26].xyzw, v4.wwww, r1.xyzw +dp4 r2.x, v0.xyzw, r1.xyzw +dp3 r1.x, v1.xyzx, r1.xyzx +mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw +mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw +mad r3.xyzw, cb0[r0.z + 27].xyzw, v4.zzzz, r3.xyzw +mad r3.xyzw, cb0[r0.w + 27].xyzw, v4.wwww, r3.xyzw +dp4 r2.y, v0.xyzw, r3.xyzw +dp3 r1.y, v1.xyzx, r3.xyzx +mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw +mad r3.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw +mad r3.xyzw, cb0[r0.z + 28].xyzw, v4.zzzz, r3.xyzw +mad r0.xyzw, cb0[r0.w + 28].xyzw, v4.wwww, r3.xyzw +dp4 r2.z, v0.xyzw, r0.xyzw +dp3 r1.z, v1.xyzx, r0.xyzx +mov r2.w, v0.w +dp4 o1.x, r2.xyzw, cb0[15].xyzw +dp4 o1.y, r2.xyzw, cb0[16].xyzw +dp4 o1.z, r2.xyzw, cb0[17].xyzw +dp4_sat o1.w, r2.xyzw, cb0[14].xyzw +dp3 r0.x, r1.xyzx, cb0[19].xyzx +dp3 r0.y, r1.xyzx, cb0[20].xyzx +dp3 r0.z, r1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o2.xyz, r0.wwww, r0.xyzx +mov o3.xyz, l(1.000000,1.000000,1.000000,0) +mov o3.w, cb0[0].w +dp4 o4.x, r2.xyzw, cb0[22].xyzw +dp4 o4.y, r2.xyzw, cb0[23].xyzw +dp4 o4.z, r2.xyzw, cb0[24].xyzw +dp4 o4.w, r2.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedPixelLightingFourBones[] = +{ + 68, 88, 66, 67, 155, 128, + 143, 249, 117, 182, 54, 178, + 22, 157, 217, 95, 239, 32, + 232, 182, 1, 0, 0, 0, + 216, 7, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 148, 1, + 0, 0, 72, 7, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 156, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 12, 0, 0, 128, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 128, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 137, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 143, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 0, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 172, 5, 0, 0, 80, 0, + 1, 0, 107, 1, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 3, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 4, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 38, 0, + 0, 11, 0, 208, 0, 0, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 1, 0, 0, 0, + 86, 21, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 26, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 26, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 166, 26, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 26, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 246, 31, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 86, 21, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 27, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 27, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 166, 26, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 27, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 246, 31, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 34, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 86, 21, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 28, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 28, 0, 0, 0, 42, 0, + 16, 0, 0, 0, 0, 0, + 166, 26, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 28, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 246, 31, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 66, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 2, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 1, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 114, 32, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 54, 0, + 0, 6, 130, 32, 16, 0, + 3, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc new file mode 100644 index 0000000000000000000000000000000000000000..949e1314befa4319776c8183fac6ad584f4fe598 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc @@ -0,0 +1,336 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint x +// BLENDWEIGHT 0 xyzw 4 NONE float x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.x +dcl_input v4.x +dcl_output o0.xy +dcl_output o1.xyzw +dcl_output o2.xyz +dcl_output o3.xyzw +dcl_output_siv o4.xyzw, position +dcl_temps 4 +mov o0.xy, v2.xyxx +imul null, r0.x, v3.x, l(3) +mul r1.xyzw, v4.xxxx, cb0[r0.x + 26].xyzw +dp4 r2.x, v0.xyzw, r1.xyzw +dp3 r1.x, v1.xyzx, r1.xyzx +mul r3.xyzw, v4.xxxx, cb0[r0.x + 27].xyzw +mul r0.xyzw, v4.xxxx, cb0[r0.x + 28].xyzw +dp4 r2.y, v0.xyzw, r3.xyzw +dp3 r1.y, v1.xyzx, r3.xyzx +dp4 r2.z, v0.xyzw, r0.xyzw +dp3 r1.z, v1.xyzx, r0.xyzx +mov r2.w, v0.w +dp4 o1.x, r2.xyzw, cb0[15].xyzw +dp4 o1.y, r2.xyzw, cb0[16].xyzw +dp4 o1.z, r2.xyzw, cb0[17].xyzw +dp4_sat o1.w, r2.xyzw, cb0[14].xyzw +dp3 r0.x, r1.xyzx, cb0[19].xyzx +dp3 r0.y, r1.xyzx, cb0[20].xyzx +dp3 r0.z, r1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o2.xyz, r0.wwww, r0.xyzx +mov o3.xyz, l(1.000000,1.000000,1.000000,0) +mov o3.w, cb0[0].w +dp4 o4.x, r2.xyzw, cb0[22].xyzw +dp4 o4.y, r2.xyzw, cb0[23].xyzw +dp4 o4.z, r2.xyzw, cb0[24].xyzw +dp4 o4.w, r2.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedPixelLightingOneBone[] = +{ + 68, 88, 66, 67, 85, 8, + 248, 162, 17, 213, 231, 107, + 95, 211, 244, 108, 233, 119, + 107, 74, 1, 0, 0, 0, + 28, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 148, 1, + 0, 0, 140, 5, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 1, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 1, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 156, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 12, 0, 0, 128, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 128, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 137, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 143, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 0, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 240, 3, 0, 0, 80, 0, + 1, 0, 252, 0, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 18, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 18, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 3, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 4, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 38, 0, + 0, 8, 0, 208, 0, 0, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 16, 16, 0, + 3, 0, 0, 0, 1, 64, + 0, 0, 3, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 1, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 17, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 28, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 66, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 2, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 1, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 114, 32, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 54, 0, + 0, 6, 130, 32, 16, 0, + 3, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc new file mode 100644 index 0000000000000000000000000000000000000000..94e3e3117612ea1d3359b3594394fa2769a575e3 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc @@ -0,0 +1,365 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint xy +// BLENDWEIGHT 0 xyzw 4 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// TEXCOORD 1 xyzw 1 NONE float xyzw +// TEXCOORD 2 xyz 2 NONE float xyz +// COLOR 0 xyzw 3 NONE float xyzw +// SV_Position 0 xyzw 4 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xy +dcl_input v4.xy +dcl_output o0.xy +dcl_output o1.xyzw +dcl_output o2.xyz +dcl_output o3.xyzw +dcl_output_siv o4.xyzw, position +dcl_temps 4 +mov o0.xy, v2.xyxx +imul null, r0.xy, v3.xyxx, l(3, 3, 0, 0) +mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw +mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw +dp4 r2.x, v0.xyzw, r1.xyzw +dp3 r1.x, v1.xyzx, r1.xyzx +mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw +mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw +dp4 r2.y, v0.xyzw, r3.xyzw +dp3 r1.y, v1.xyzx, r3.xyzx +mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw +mad r0.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw +dp4 r2.z, v0.xyzw, r0.xyzw +dp3 r1.z, v1.xyzx, r0.xyzx +mov r2.w, v0.w +dp4 o1.x, r2.xyzw, cb0[15].xyzw +dp4 o1.y, r2.xyzw, cb0[16].xyzw +dp4 o1.z, r2.xyzw, cb0[17].xyzw +dp4_sat o1.w, r2.xyzw, cb0[14].xyzw +dp3 r0.x, r1.xyzx, cb0[19].xyzx +dp3 r0.y, r1.xyzx, cb0[20].xyzx +dp3 r0.z, r1.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul o2.xyz, r0.wwww, r0.xyzx +mov o3.xyz, l(1.000000,1.000000,1.000000,0) +mov o3.w, cb0[0].w +dp4 o4.x, r2.xyzw, cb0[22].xyzw +dp4 o4.y, r2.xyzw, cb0[23].xyzw +dp4 o4.z, r2.xyzw, cb0[24].xyzw +dp4 o4.w, r2.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedPixelLightingTwoBones[] = +{ + 68, 88, 66, 67, 136, 60, + 2, 50, 157, 149, 150, 225, + 43, 37, 107, 28, 64, 67, + 215, 124, 1, 0, 0, 0, + 184, 6, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 148, 1, + 0, 0, 40, 6, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 3, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 156, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 12, 0, 0, 128, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 128, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 137, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 143, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 0, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 67, 79, 76, 79, 82, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 140, 4, 0, 0, 80, 0, + 1, 0, 35, 1, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 2, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 3, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 4, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 4, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 38, 0, + 0, 11, 0, 208, 0, 0, + 50, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 1, 0, 0, 0, + 86, 21, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 26, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 17, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 86, 21, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 3, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 27, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 34, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 86, 21, 16, 0, 4, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 26, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 12, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 28, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 6, 16, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 66, 0, 16, 0, + 2, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 1, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 0, + 16, 0, 2, 0, 0, 0, + 58, 16, 16, 0, 0, 0, + 0, 0, 17, 0, 0, 8, + 18, 32, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 17, 0, + 0, 8, 34, 32, 16, 0, + 1, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 17, 0, 0, 8, 66, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 17, 0, + 0, 0, 17, 32, 0, 8, + 130, 32, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 32, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 114, 32, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 54, 0, + 0, 6, 130, 32, 16, 0, + 3, 0, 0, 0, 58, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 4, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 4, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc new file mode 100644 index 0000000000000000000000000000000000000000..811bb4ff12175bc949040c1eda391fe624f83d1e --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc @@ -0,0 +1,639 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint xyzw +// BLENDWEIGHT 0 xyzw 4 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xyzw +dcl_input v4.xyzw +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 6 +imul null, r0.xyzw, v3.xyzw, l(3, 3, 3, 3) +mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw +mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw +mad r1.xyzw, cb0[r0.z + 26].xyzw, v4.zzzz, r1.xyzw +mad r1.xyzw, cb0[r0.w + 26].xyzw, v4.wwww, r1.xyzw +dp3 r2.x, v1.xyzx, r1.xyzx +dp4 r1.x, v0.xyzw, r1.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw +mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw +mad r3.xyzw, cb0[r0.z + 27].xyzw, v4.zzzz, r3.xyzw +mad r3.xyzw, cb0[r0.w + 27].xyzw, v4.wwww, r3.xyzw +dp3 r2.y, v1.xyzx, r3.xyzx +dp4 r1.y, v0.xyzw, r3.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw +mad r3.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw +mad r3.xyzw, cb0[r0.z + 28].xyzw, v4.zzzz, r3.xyzw +mad r0.xyzw, cb0[r0.w + 28].xyzw, v4.wwww, r3.xyzw +dp3 r2.z, v1.xyzx, r0.xyzx +dp4 r1.z, v0.xyzw, r0.xyzw +dp3 r0.x, r2.xyzx, cb0[19].xyzx +dp3 r0.y, r2.xyzx, cb0[20].xyzx +dp3 r0.z, r2.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r2.x, -cb0[3].xyzx, r0.xyzx +dp3 r2.y, -cb0[4].xyzx, r0.xyzx +dp3 r2.z, -cb0[5].xyzx, r0.xyzx +ge r3.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r3.xyz, r3.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r2.xyz, r2.xyzx, r3.xyzx +mul r4.xyz, r2.yyyy, cb0[7].xyzx +mad r2.xyw, r2.xxxx, cb0[6].xyxz, r4.xyxz +mad r2.xyz, r2.zzzz, cb0[8].xyzx, r2.xywx +mad o0.xyz, r2.xyzx, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +mov r1.w, v0.w +dp4 r2.x, r1.xyzw, cb0[15].xyzw +dp4 r2.y, r1.xyzw, cb0[16].xyzw +dp4 r2.z, r1.xyzw, cb0[17].xyzw +add r2.xyz, -r2.xyzx, cb0[12].xyzx +dp3 r0.w, r2.xyzx, r2.xyzx +rsq r0.w, r0.w +mad r4.xyz, r2.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r2.w, r4.xyzx, r4.xyzx +rsq r2.w, r2.w +mul r4.xyz, r2.wwww, r4.xyzx +dp3 r4.x, r4.xyzx, r0.xyzx +mad r5.xyz, r2.xyzx, r0.wwww, -cb0[4].xyzx +mad r2.xyz, r2.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r5.xyzx, r5.xyzx +rsq r0.w, r0.w +mul r5.xyz, r0.wwww, r5.xyzx +dp3 r4.y, r5.xyzx, r0.xyzx +dp3 r0.w, r2.xyzx, r2.xyzx +rsq r0.w, r0.w +mul r2.xyz, r0.wwww, r2.xyzx +dp3 r4.z, r2.xyzx, r0.xyzx +max r0.xyz, r4.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r3.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r2.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, r1.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, r1.xyzw, cb0[22].xyzw +dp4 o3.y, r1.xyzw, cb0[23].xyzw +dp4 o3.z, r1.xyzw, cb0[24].xyzw +dp4 o3.w, r1.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedVertexLightingFourBones[] = +{ + 68, 88, 66, 67, 252, 39, + 215, 100, 48, 56, 40, 65, + 206, 101, 134, 130, 186, 146, + 201, 118, 1, 0, 0, 0, + 52, 12, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 124, 1, + 0, 0, 164, 11, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 15, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 12, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 32, 10, 0, 0, 80, 0, + 1, 0, 136, 2, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 6, 0, + 0, 0, 38, 0, 0, 11, + 0, 208, 0, 0, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 26, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 166, 26, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 27, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 166, 26, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 17, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 28, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 166, 26, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 246, 31, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 4, 0, + 0, 0, 86, 5, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 2, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 8, 16, 0, 4, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 70, 3, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 16, 16, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 9, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 2, 0, 0, 0, 58, 0, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 5, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc new file mode 100644 index 0000000000000000000000000000000000000000..bc6bd04e1321c95c506fc7ae31c0bf275c004b00 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc @@ -0,0 +1,556 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint x +// BLENDWEIGHT 0 xyzw 4 NONE float x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.x +dcl_input v4.x +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 6 +imul null, r0.x, v3.x, l(3) +mul r1.xyzw, v4.xxxx, cb0[r0.x + 26].xyzw +dp3 r2.x, v1.xyzx, r1.xyzx +dp4 r1.x, v0.xyzw, r1.xyzw +mul r3.xyzw, v4.xxxx, cb0[r0.x + 27].xyzw +mul r0.xyzw, v4.xxxx, cb0[r0.x + 28].xyzw +dp3 r2.y, v1.xyzx, r3.xyzx +dp4 r1.y, v0.xyzw, r3.xyzw +dp3 r2.z, v1.xyzx, r0.xyzx +dp4 r1.z, v0.xyzw, r0.xyzw +dp3 r0.x, r2.xyzx, cb0[19].xyzx +dp3 r0.y, r2.xyzx, cb0[20].xyzx +dp3 r0.z, r2.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r2.x, -cb0[3].xyzx, r0.xyzx +dp3 r2.y, -cb0[4].xyzx, r0.xyzx +dp3 r2.z, -cb0[5].xyzx, r0.xyzx +ge r3.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r3.xyz, r3.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r2.xyz, r2.xyzx, r3.xyzx +mul r4.xyz, r2.yyyy, cb0[7].xyzx +mad r2.xyw, r2.xxxx, cb0[6].xyxz, r4.xyxz +mad r2.xyz, r2.zzzz, cb0[8].xyzx, r2.xywx +mad o0.xyz, r2.xyzx, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +mov r1.w, v0.w +dp4 r2.x, r1.xyzw, cb0[15].xyzw +dp4 r2.y, r1.xyzw, cb0[16].xyzw +dp4 r2.z, r1.xyzw, cb0[17].xyzw +add r2.xyz, -r2.xyzx, cb0[12].xyzx +dp3 r0.w, r2.xyzx, r2.xyzx +rsq r0.w, r0.w +mad r4.xyz, r2.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r2.w, r4.xyzx, r4.xyzx +rsq r2.w, r2.w +mul r4.xyz, r2.wwww, r4.xyzx +dp3 r4.x, r4.xyzx, r0.xyzx +mad r5.xyz, r2.xyzx, r0.wwww, -cb0[4].xyzx +mad r2.xyz, r2.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r5.xyzx, r5.xyzx +rsq r0.w, r0.w +mul r5.xyz, r0.wwww, r5.xyzx +dp3 r4.y, r5.xyzx, r0.xyzx +dp3 r0.w, r2.xyzx, r2.xyzx +rsq r0.w, r0.w +mul r2.xyz, r0.wwww, r2.xyzx +dp3 r4.z, r2.xyzx, r0.xyzx +max r0.xyz, r4.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r3.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r2.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, r1.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, r1.xyzw, cb0[22].xyzw +dp4 o3.y, r1.xyzw, cb0[23].xyzw +dp4 o3.z, r1.xyzw, cb0[24].xyzw +dp4 o3.w, r1.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedVertexLightingOneBone[] = +{ + 68, 88, 66, 67, 171, 181, + 234, 46, 5, 98, 131, 128, + 181, 232, 74, 29, 94, 203, + 101, 251, 1, 0, 0, 0, + 120, 10, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 124, 1, + 0, 0, 232, 9, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 1, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 1, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 12, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 100, 8, 0, 0, 80, 0, + 1, 0, 25, 2, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 18, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 18, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 6, 0, + 0, 0, 38, 0, 0, 8, + 0, 208, 0, 0, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 16, 16, 0, 3, 0, + 0, 0, 1, 64, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 26, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 27, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 242, 0, 16, 0, 0, 0, + 0, 0, 6, 16, 16, 0, + 4, 0, 0, 0, 70, 142, + 32, 6, 0, 0, 0, 0, + 28, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 2, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 17, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 4, 0, + 0, 0, 86, 5, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 2, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 8, 16, 0, 4, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 70, 3, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 16, 16, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 9, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 2, 0, 0, 0, 58, 0, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 5, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc new file mode 100644 index 0000000000000000000000000000000000000000..e139f6a90ba697fe00225d0078623ffd6b880cc1 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc @@ -0,0 +1,585 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// TEXCOORD 0 xy 2 NONE float xy +// BLENDINDICES 0 xyzw 3 NONE uint xy +// BLENDWEIGHT 0 xyzw 4 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// COLOR 1 xyzw 1 NONE float xyzw +// TEXCOORD 0 xy 2 NONE float xy +// SV_Position 0 xyzw 3 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[242], dynamicIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_input v2.xy +dcl_input v3.xy +dcl_input v4.xy +dcl_output o0.xyzw +dcl_output o1.xyzw +dcl_output o2.xy +dcl_output_siv o3.xyzw, position +dcl_temps 6 +imul null, r0.xy, v3.xyxx, l(3, 3, 0, 0) +mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw +mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw +dp3 r2.x, v1.xyzx, r1.xyzx +dp4 r1.x, v0.xyzw, r1.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw +mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw +dp3 r2.y, v1.xyzx, r3.xyzx +dp4 r1.y, v0.xyzw, r3.xyzw +mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw +mad r0.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw +dp3 r2.z, v1.xyzx, r0.xyzx +dp4 r1.z, v0.xyzw, r0.xyzw +dp3 r0.x, r2.xyzx, cb0[19].xyzx +dp3 r0.y, r2.xyzx, cb0[20].xyzx +dp3 r0.z, r2.xyzx, cb0[21].xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +dp3 r2.x, -cb0[3].xyzx, r0.xyzx +dp3 r2.y, -cb0[4].xyzx, r0.xyzx +dp3 r2.z, -cb0[5].xyzx, r0.xyzx +ge r3.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +and r3.xyz, r3.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) +mul r2.xyz, r2.xyzx, r3.xyzx +mul r4.xyz, r2.yyyy, cb0[7].xyzx +mad r2.xyw, r2.xxxx, cb0[6].xyxz, r4.xyxz +mad r2.xyz, r2.zzzz, cb0[8].xyzx, r2.xywx +mad o0.xyz, r2.xyzx, cb0[0].xyzx, cb0[1].xyzx +mov o0.w, cb0[0].w +mov r1.w, v0.w +dp4 r2.x, r1.xyzw, cb0[15].xyzw +dp4 r2.y, r1.xyzw, cb0[16].xyzw +dp4 r2.z, r1.xyzw, cb0[17].xyzw +add r2.xyz, -r2.xyzx, cb0[12].xyzx +dp3 r0.w, r2.xyzx, r2.xyzx +rsq r0.w, r0.w +mad r4.xyz, r2.xyzx, r0.wwww, -cb0[3].xyzx +dp3 r2.w, r4.xyzx, r4.xyzx +rsq r2.w, r2.w +mul r4.xyz, r2.wwww, r4.xyzx +dp3 r4.x, r4.xyzx, r0.xyzx +mad r5.xyz, r2.xyzx, r0.wwww, -cb0[4].xyzx +mad r2.xyz, r2.xyzx, r0.wwww, -cb0[5].xyzx +dp3 r0.w, r5.xyzx, r5.xyzx +rsq r0.w, r0.w +mul r5.xyz, r0.wwww, r5.xyzx +dp3 r4.y, r5.xyzx, r0.xyzx +dp3 r0.w, r2.xyzx, r2.xyzx +rsq r0.w, r0.w +mul r2.xyz, r0.wwww, r2.xyzx +dp3 r4.z, r2.xyzx, r0.xyzx +max r0.xyz, r4.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) +mul r0.xyz, r3.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, cb0[2].wwww +exp r0.xyz, r0.xyzx +mul r2.xyz, r0.yyyy, cb0[10].xyzx +mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz +mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx +mul o1.xyz, r0.xyzx, cb0[2].xyzx +dp4_sat o1.w, r1.xyzw, cb0[14].xyzw +mov o2.xy, v2.xyxx +dp4 o3.x, r1.xyzw, cb0[22].xyzw +dp4 o3.y, r1.xyzw, cb0[23].xyzw +dp4 o3.z, r1.xyzw, cb0[24].xyzw +dp4 o3.w, r1.xyzw, cb0[25].xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = +{ + 68, 88, 66, 67, 253, 236, + 140, 3, 210, 8, 102, 44, + 105, 54, 158, 230, 216, 73, + 64, 8, 1, 0, 0, 0, + 20, 11, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 240, 0, 0, 0, 124, 1, + 0, 0, 132, 10, 0, 0, + 73, 83, 71, 78, 184, 0, + 0, 0, 5, 0, 0, 0, + 8, 0, 0, 0, 128, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 140, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 7, 0, 0, 147, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 3, 0, 0, 156, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 15, 3, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 15, 3, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 78, 79, + 82, 77, 65, 76, 0, 84, + 69, 88, 67, 79, 79, 82, + 68, 0, 66, 76, 69, 78, + 68, 73, 78, 68, 73, 67, + 69, 83, 0, 66, 76, 69, + 78, 68, 87, 69, 73, 71, + 72, 84, 0, 171, 171, 171, + 79, 83, 71, 78, 132, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 110, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 3, 12, 0, 0, 119, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 15, 0, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 83, 72, 69, 88, + 0, 9, 0, 0, 80, 0, + 1, 0, 64, 2, 0, 0, + 106, 8, 0, 1, 89, 8, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 242, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 2, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 3, 0, + 0, 0, 95, 0, 0, 3, + 50, 16, 16, 0, 4, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 2, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 2, 6, 0, + 0, 0, 38, 0, 0, 11, + 0, 208, 0, 0, 50, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 26, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 26, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 17, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 27, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 3, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 27, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 17, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 56, 0, + 0, 10, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 21, + 16, 0, 4, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 28, 0, 0, 0, + 26, 0, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 12, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 6, + 0, 0, 0, 0, 28, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 4, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 16, 0, 0, 7, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 7, 66, 0, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 16, 0, 0, 8, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 20, 0, + 0, 0, 16, 0, 0, 8, + 66, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 18, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 34, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 9, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 4, 0, + 0, 0, 86, 5, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 50, 0, + 0, 10, 178, 0, 16, 0, + 2, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 70, 8, 16, 0, 4, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 70, 3, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 11, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 16, 16, 0, + 0, 0, 0, 0, 17, 0, + 0, 8, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 17, 0, 0, 8, 34, 0, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 17, 0, 0, 8, + 66, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 9, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 2, 0, 0, 0, 58, 0, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 11, + 114, 0, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 50, 0, + 0, 11, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 16, 0, 0, 7, 130, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 68, 0, + 0, 5, 130, 0, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 5, 0, 0, 0, + 246, 15, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 5, 0, 0, 0, 16, 0, + 0, 7, 34, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 130, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 68, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 246, 15, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 16, 0, 0, 7, 66, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 52, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 50, 0, 0, 10, + 178, 0, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 136, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 70, 8, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 166, 10, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 11, 0, + 0, 0, 70, 3, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 17, 32, 0, 8, 130, 32, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 14, 0, + 0, 0, 54, 0, 0, 5, + 50, 32, 16, 0, 2, 0, + 0, 0, 70, 16, 16, 0, + 2, 0, 0, 0, 17, 0, + 0, 8, 18, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 22, 0, 0, 0, + 17, 0, 0, 8, 34, 32, + 16, 0, 3, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 23, 0, + 0, 0, 17, 0, 0, 8, + 66, 32, 16, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 24, 0, 0, 0, 17, 0, + 0, 8, 130, 32, 16, 0, + 3, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 25, 0, 0, 0, + 62, 0, 0, 1, 82, 84, + 83, 48, 136, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 24, 0, 0, 0, + 1, 0, 0, 0, 84, 0, + 0, 0, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 48, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, + 1, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 85, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 255, 255, 127, 127, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc new file mode 100644 index 0000000000000000000000000000000000000000..1600f6d7b96cf3fde9ee9b1167fe61ee050a2d89 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SpriteEffect_SpritePixelShader.inc @@ -0,0 +1,118 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xyzw +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul o0.xyzw, r0.xyzw, v0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SpriteEffect_SpritePixelShader[] = +{ + 68, 88, 66, 67, 139, 129, + 110, 56, 73, 191, 71, 92, + 53, 195, 34, 82, 243, 212, + 243, 147, 1, 0, 0, 0, + 236, 1, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 128, 0, 0, 0, 180, 0, + 0, 0, 92, 1, 0, 0, + 73, 83, 71, 78, 72, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 62, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 97, 114, + 103, 101, 116, 0, 171, 171, + 83, 72, 69, 88, 160, 0, + 0, 0, 80, 0, 0, 0, + 40, 0, 0, 0, 106, 8, + 0, 1, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 139, + 194, 0, 0, 128, 67, 85, + 21, 0, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 82, 84, 83, 48, 136, 0, + 0, 0, 1, 0, 0, 0, + 2, 0, 0, 0, 24, 0, + 0, 0, 1, 0, 0, 0, + 84, 0, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 76, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, + 0, 0, 85, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 16, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 127, 127, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc b/Kits/DirectXTK12/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc new file mode 100644 index 0000000000000000000000000000000000000000..a16ed61dc35180516fe52b5bfcf7c292809399aa --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc @@ -0,0 +1,169 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// SV_Position 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// COLOR 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// SV_Position 0 xyzw 2 POS float xyzw +// +vs_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[4], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xy +dcl_input v2.xyzw +dcl_output o0.xyzw +dcl_output o1.xy +dcl_output_siv o2.xyzw, position +dcl_temps 1 +mov o0.xyzw, v0.xyzw +mov o1.xy, v1.xyxx +mul r0.xyzw, v2.yyyy, cb0[1].xyzw +mad r0.xyzw, v2.xxxx, cb0[0].xyzw, r0.xyzw +mad r0.xyzw, v2.zzzz, cb0[2].xyzw, r0.xyzw +mad o2.xyzw, v2.wwww, cb0[3].xyzw, r0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE SpriteEffect_SpriteVertexShader[] = +{ + 68, 88, 66, 67, 37, 58, + 176, 11, 214, 165, 86, 72, + 235, 236, 218, 113, 26, 203, + 253, 51, 1, 0, 0, 0, + 228, 2, 0, 0, 4, 0, + 0, 0, 48, 0, 0, 0, + 164, 0, 0, 0, 24, 1, + 0, 0, 84, 2, 0, 0, + 73, 83, 71, 78, 108, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 86, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 95, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 67, 79, + 76, 79, 82, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 111, + 115, 105, 116, 105, 111, 110, + 0, 171, 79, 83, 71, 78, + 108, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 86, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 95, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 67, 79, 76, 79, 82, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 83, 86, 95, + 80, 111, 115, 105, 116, 105, + 111, 110, 0, 171, 83, 72, + 69, 88, 52, 1, 0, 0, + 80, 0, 1, 0, 77, 0, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 2, 0, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 2, + 1, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 50, 32, + 16, 0, 1, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 0, 0, + 0, 0, 86, 21, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 0, 0, 0, 0, 6, 16, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 10, + 242, 0, 16, 0, 0, 0, + 0, 0, 166, 26, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 242, 32, + 16, 0, 2, 0, 0, 0, + 246, 31, 16, 0, 2, 0, + 0, 0, 70, 142, 32, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 82, 84, 83, 48, + 136, 0, 0, 0, 1, 0, + 0, 0, 2, 0, 0, 0, + 24, 0, 0, 0, 1, 0, + 0, 0, 84, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 127, 127, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/Kits/DirectXTK12/Src/Shaders/DualTextureEffect.fx b/Kits/DirectXTK12/Src/Shaders/DualTextureEffect.fx new file mode 100644 index 0000000000000000000000000000000000000000..87a5c9f391c4a9423b9eda17d323277838e4303c --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/DualTextureEffect.fx @@ -0,0 +1,126 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +Texture2D Texture : register(t0); +Texture2D Texture2 : register(t1); + +sampler Sampler : register(s0); +sampler Sampler2 : register(s1); + + +cbuffer Parameters : register(b0) +{ + float4 DiffuseColor : packoffset(c0); + float3 FogColor : packoffset(c1); + float4 FogVector : packoffset(c2); + float4x4 WorldViewProj : packoffset(c3); +}; + + +#include "Structures.fxh" +#include "RootSig.fxh" +#include "Common.fxh" + + +// Vertex shader: basic. +[RootSignature(DualTextureRS)] +VSOutputTx2 VSDualTexture(VSInputTx2 vin) +{ + VSOutputTx2 vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + vout.TexCoord2 = vin.TexCoord2; + + return vout; +} + + +// Vertex shader: no fog. +[RootSignature(DualTextureRS)] +VSOutputTx2NoFog VSDualTextureNoFog(VSInputTx2 vin) +{ + VSOutputTx2NoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.TexCoord = vin.TexCoord; + vout.TexCoord2 = vin.TexCoord2; + + return vout; +} + + +// Vertex shader: vertex color. +[RootSignature(DualTextureRS)] +VSOutputTx2 VSDualTextureVc(VSInputTx2Vc vin) +{ + VSOutputTx2 vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + vout.TexCoord2 = vin.TexCoord2; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Vertex shader: vertex color, no fog. +[RootSignature(DualTextureRS)] +VSOutputTx2NoFog VSDualTextureVcNoFog(VSInputTx2Vc vin) +{ + VSOutputTx2NoFog vout; + + CommonVSOutput cout = ComputeCommonVSOutput(vin.Position); + SetCommonVSOutputParamsNoFog; + + vout.TexCoord = vin.TexCoord; + vout.TexCoord2 = vin.TexCoord2; + vout.Diffuse *= vin.Color; + + return vout; +} + + +// Pixel shader: basic. +[RootSignature(DualTextureRS)] +float4 PSDualTexture(PSInputTx2 pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord); + float4 overlay = Texture2.Sample(Sampler2, pin.TexCoord2); + + color.rgb *= 2; + color *= overlay * pin.Diffuse; + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: no fog. +[RootSignature(DualTextureRS)] +float4 PSDualTextureNoFog(PSInputTx2NoFog pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord); + float4 overlay = Texture2.Sample(Sampler2, pin.TexCoord2); + + color.rgb *= 2; + color *= overlay * pin.Diffuse; + + return color; +} diff --git a/Kits/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx b/Kits/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx new file mode 100644 index 0000000000000000000000000000000000000000..96868370080ba4fbf8de03e4245f3e9692d129a5 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx @@ -0,0 +1,175 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +Texture2D Texture : register(t0); +TextureCube EnvironmentMap : register(t1); + +sampler Sampler : register(s0); +sampler EnvMapSampler : register(s1); + + +cbuffer Parameters : register(b0) +{ + float3 EnvironmentMapSpecular : packoffset(c0); + float EnvironmentMapAmount : packoffset(c1.x); + float FresnelFactor : packoffset(c1.y); + + float4 DiffuseColor : packoffset(c2); + float3 EmissiveColor : packoffset(c3); + + float3 LightDirection[3] : packoffset(c4); + float3 LightDiffuseColor[3] : packoffset(c7); + + float3 EyePosition : packoffset(c10); + + float3 FogColor : packoffset(c11); + float4 FogVector : packoffset(c12); + + float4x4 World : packoffset(c13); + float3x3 WorldInverseTranspose : packoffset(c17); + float4x4 WorldViewProj : packoffset(c20); +}; + + +// We don't use these parameters, but Lighting.fxh won't compile without them. +#define SpecularPower 0 +#define SpecularColor 0 +#define LightSpecularColor float3(0, 0, 0) + + +#include "Structures.fxh" +#include "Common.fxh" +#include "RootSig.fxh" +#include "Lighting.fxh" + + +float ComputeFresnelFactor(float3 eyeVector, float3 worldNormal) +{ + float viewAngle = dot(eyeVector, worldNormal); + + return pow(max(1 - abs(viewAngle), 0), FresnelFactor) * EnvironmentMapAmount; +} + + +VSOutputTxEnvMap ComputeEnvMapVSOutput(VSInputNmTx vin, uniform bool useFresnel, uniform int numLights) +{ + VSOutputTxEnvMap vout; + + float4 pos_ws = mul(vin.Position, World); + float3 eyeVector = normalize(EyePosition - pos_ws.xyz); + float3 worldNormal = normalize(mul(vin.Normal, WorldInverseTranspose)); + + ColorPair lightResult = ComputeLights(eyeVector, worldNormal, numLights); + + vout.PositionPS = mul(vin.Position, WorldViewProj); + vout.Diffuse = float4(lightResult.Diffuse, DiffuseColor.a); + + if (useFresnel) + vout.Specular.rgb = ComputeFresnelFactor(eyeVector, worldNormal); + else + vout.Specular.rgb = EnvironmentMapAmount; + + vout.Specular.a = ComputeFogFactor(vin.Position); + vout.TexCoord = vin.TexCoord; + vout.EnvCoord = reflect(-eyeVector, worldNormal); + + return vout; +} + + +// Vertex shader: basic. +[RootSignature(DualTextureRS)] +VSOutputTxEnvMap VSEnvMap(VSInputNmTx vin) +{ + return ComputeEnvMapVSOutput(vin, false, 3); +} + + +// Vertex shader: fresnel. +[RootSignature(DualTextureRS)] +VSOutputTxEnvMap VSEnvMapFresnel(VSInputNmTx vin) +{ + return ComputeEnvMapVSOutput(vin, true, 3); +} + + +// Vertex shader: one light. +[RootSignature(DualTextureRS)] +VSOutputTxEnvMap VSEnvMapOneLight(VSInputNmTx vin) +{ + return ComputeEnvMapVSOutput(vin, false, 1); +} + + +// Vertex shader: one light, fresnel. +[RootSignature(DualTextureRS)] +VSOutputTxEnvMap VSEnvMapOneLightFresnel(VSInputNmTx vin) +{ + return ComputeEnvMapVSOutput(vin, true, 1); +} + + +// Pixel shader: basic. +[RootSignature(DualTextureRS)] +float4 PSEnvMap(PSInputTxEnvMap pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + float4 envmap = EnvironmentMap.Sample(EnvMapSampler, pin.EnvCoord) * color.a; + + color.rgb = lerp(color.rgb, envmap.rgb, pin.Specular.rgb); + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: no fog. +[RootSignature(DualTextureRS)] +float4 PSEnvMapNoFog(PSInputTxEnvMap pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + float4 envmap = EnvironmentMap.Sample(EnvMapSampler, pin.EnvCoord) * color.a; + + color.rgb = lerp(color.rgb, envmap.rgb, pin.Specular.rgb); + + return color; +} + + +// Pixel shader: specular. +[RootSignature(DualTextureRS)] +float4 PSEnvMapSpecular(PSInputTxEnvMap pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + float4 envmap = EnvironmentMap.Sample(EnvMapSampler, pin.EnvCoord) * color.a; + + color.rgb = lerp(color.rgb, envmap.rgb, pin.Specular.rgb); + color.rgb += EnvironmentMapSpecular * envmap.a; + + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: specular, no fog. +[RootSignature(DualTextureRS)] +float4 PSEnvMapSpecularNoFog(PSInputTxEnvMap pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + float4 envmap = EnvironmentMap.Sample(EnvMapSampler, pin.EnvCoord) * color.a; + + color.rgb = lerp(color.rgb, envmap.rgb, pin.Specular.rgb); + color.rgb += EnvironmentMapSpecular * envmap.a; + + return color; +} diff --git a/Kits/DirectXTK12/Src/Shaders/GenerateMips.hlsl b/Kits/DirectXTK12/Src/Shaders/GenerateMips.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..72b76dac3bb5e392617f859ef0517f65ab16b008 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/GenerateMips.hlsl @@ -0,0 +1,37 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + +#include "Structures.fxh" +#include "RootSig.fxh" + +SamplerState Sampler : register(s0); +Texture2D SrcMip : register(t0); +RWTexture2D OutMip : register(u0); + +cbuffer MipConstants : register(b0) +{ + float2 InvOutTexelSize; // texel size for OutMip (NOT SrcMip) + uint SrcMipIndex; +} + +float4 Mip(uint2 coord) +{ + float2 uv = (coord.xy + 0.5) * InvOutTexelSize; + return SrcMip.SampleLevel(Sampler, uv, SrcMipIndex); +} + +[RootSignature(GenerateMipsRS)] +// Workaround for NVidia bug: some driver versions don't handle SV_DispatchThreadID correctly. +[numthreads(8, 8, 1)] +void main(uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID) +{ + uint3 DTid = Gid * uint3(8,8,1) + GTid; + OutMip[DTid.xy] = Mip(DTid.xy); +} diff --git a/Kits/DirectXTK12/Src/Shaders/Lighting.fxh b/Kits/DirectXTK12/Src/Shaders/Lighting.fxh new file mode 100644 index 0000000000000000000000000000000000000000..d5b8452c07c87c20556897c184157d44dfa26969 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Lighting.fxh @@ -0,0 +1,97 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +struct ColorPair +{ + float3 Diffuse; + float3 Specular; +}; + + +ColorPair ComputeLights(float3 eyeVector, float3 worldNormal, uniform int numLights) +{ + float3x3 lightDirections = 0; + float3x3 lightDiffuse = 0; + float3x3 lightSpecular = 0; + float3x3 halfVectors = 0; + + [unroll] + for (int i = 0; i < numLights; i++) + { + lightDirections[i] = LightDirection[i]; + lightDiffuse[i] = LightDiffuseColor[i]; + lightSpecular[i] = LightSpecularColor[i]; + + halfVectors[i] = normalize(eyeVector - lightDirections[i]); + } + + float3 dotL = mul(-lightDirections, worldNormal); + float3 dotH = mul(halfVectors, worldNormal); + + float3 zeroL = step(0, dotL); + + float3 diffuse = zeroL * dotL; + float3 specular = pow(max(dotH, 0) * zeroL, SpecularPower); + + ColorPair result; + + result.Diffuse = mul(diffuse, lightDiffuse) * DiffuseColor.rgb + EmissiveColor; + result.Specular = mul(specular, lightSpecular) * SpecularColor; + + return result; +} + + +CommonVSOutput ComputeCommonVSOutputWithLighting(float4 position, float3 normal, uniform int numLights) +{ + CommonVSOutput vout; + + float4 pos_ws = mul(position, World); + float3 eyeVector = normalize(EyePosition - pos_ws.xyz); + float3 worldNormal = normalize(mul(normal, WorldInverseTranspose)); + + ColorPair lightResult = ComputeLights(eyeVector, worldNormal, numLights); + + vout.Pos_ps = mul(position, WorldViewProj); + vout.Diffuse = float4(lightResult.Diffuse, DiffuseColor.a); + vout.Specular = lightResult.Specular; + vout.FogFactor = ComputeFogFactor(position); + + return vout; +} + + +struct CommonVSOutputPixelLighting +{ + float4 Pos_ps; + float3 Pos_ws; + float3 Normal_ws; + float FogFactor; +}; + + +CommonVSOutputPixelLighting ComputeCommonVSOutputPixelLighting(float4 position, float3 normal) +{ + CommonVSOutputPixelLighting vout; + + vout.Pos_ps = mul(position, WorldViewProj); + vout.Pos_ws = mul(position, World).xyz; + vout.Normal_ws = normalize(mul(normal, WorldInverseTranspose)); + vout.FogFactor = ComputeFogFactor(position); + + return vout; +} + + +#define SetCommonVSOutputParamsPixelLighting \ + vout.PositionPS = cout.Pos_ps; \ + vout.PositionWS = float4(cout.Pos_ws, cout.FogFactor); \ + vout.NormalWS = cout.Normal_ws; diff --git a/Kits/DirectXTK12/Src/Shaders/RootSig.fxh b/Kits/DirectXTK12/Src/Shaders/RootSig.fxh new file mode 100644 index 0000000000000000000000000000000000000000..2693580d7aa6a986721f5522330e206747fbb896 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/RootSig.fxh @@ -0,0 +1,44 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 + +// Root signatures must match definition in each effect, or shaders will be recompiled on Xbox when PSO loads +#define MainRS \ +"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ +" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ +" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ +" DENY_HULL_SHADER_ROOT_ACCESS )," \ +"DescriptorTable ( SRV(t0) ),"\ +"CBV(b0)," \ +"StaticSampler(s0)" + +#define DualTextureRS \ +"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ +" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ +" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ +" DENY_HULL_SHADER_ROOT_ACCESS )," \ +"DescriptorTable ( SRV(t0) )," \ +"DescriptorTable ( SRV(t1) )," \ +"CBV(b0)," \ +"StaticSampler(s0)," \ +"StaticSampler(s1)" + +#define GenerateMipsRS \ +"RootFlags ( DENY_VERTEX_SHADER_ROOT_ACCESS |" \ +" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ +" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ +" DENY_HULL_SHADER_ROOT_ACCESS |" \ +" DENY_PIXEL_SHADER_ROOT_ACCESS )," \ +"RootConstants(num32BitConstants=3, b0)," \ +"DescriptorTable ( SRV(t0) )," \ +"DescriptorTable ( UAV(u0) )," \ +"StaticSampler(s0,"\ +" filter = FILTER_MIN_MAG_LINEAR_MIP_POINT,"\ +" addressU = TEXTURE_ADDRESS_CLAMP,"\ +" addressV = TEXTURE_ADDRESS_CLAMP,"\ +" addressW = TEXTURE_ADDRESS_CLAMP )" diff --git a/Kits/DirectXTK12/Src/Shaders/SkinnedEffect.fx b/Kits/DirectXTK12/Src/Shaders/SkinnedEffect.fx new file mode 100644 index 0000000000000000000000000000000000000000..941acb6f5039f175c85c8c9ad466a4cc5d824050 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/SkinnedEffect.fx @@ -0,0 +1,259 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +Texture2D Texture : register(t0); +sampler Sampler : register(s0); + + +cbuffer Parameters : register(b0) +{ + float4 DiffuseColor : packoffset(c0); + float3 EmissiveColor : packoffset(c1); + float3 SpecularColor : packoffset(c2); + float SpecularPower : packoffset(c2.w); + + float3 LightDirection[3] : packoffset(c3); + float3 LightDiffuseColor[3] : packoffset(c6); + float3 LightSpecularColor[3] : packoffset(c9); + + float3 EyePosition : packoffset(c12); + + float3 FogColor : packoffset(c13); + float4 FogVector : packoffset(c14); + + float4x4 World : packoffset(c15); + float3x3 WorldInverseTranspose : packoffset(c19); + float4x4 WorldViewProj : packoffset(c22); + + float4x3 Bones[72] : packoffset(c26); +}; + + +#include "Structures.fxh" +#include "Common.fxh" +#include "RootSig.fxh" +#include "Lighting.fxh" + +[RootSignature(MainRS)] +void Skin(inout VSInputNmTxWeights vin, uniform int boneCount) +{ + float4x3 skinning = 0; + + [unroll] + for (int i = 0; i < boneCount; i++) + { + skinning += Bones[vin.Indices[i]] * vin.Weights[i]; + } + + vin.Position.xyz = mul(vin.Position, skinning); + vin.Normal = mul(vin.Normal, (float3x3)skinning); +} + + +// Vertex shader: vertex lighting, one bone. +[RootSignature(MainRS)] +VSOutputTx VSSkinnedVertexLightingOneBone(VSInputNmTxWeights vin) +{ + VSOutputTx vout; + + Skin(vin, 1); + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: vertex lighting, two bones. +[RootSignature(MainRS)] +VSOutputTx VSSkinnedVertexLightingTwoBones(VSInputNmTxWeights vin) +{ + VSOutputTx vout; + + Skin(vin, 2); + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: vertex lighting, four bones. +[RootSignature(MainRS)] +VSOutputTx VSSkinnedVertexLightingFourBones(VSInputNmTxWeights vin) +{ + VSOutputTx vout; + + Skin(vin, 4); + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: one light, one bone. +[RootSignature(MainRS)] +VSOutputTx VSSkinnedOneLightOneBone(VSInputNmTxWeights vin) +{ + VSOutputTx vout; + + Skin(vin, 1); + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: one light, two bones. +[RootSignature(MainRS)] +VSOutputTx VSSkinnedOneLightTwoBones(VSInputNmTxWeights vin) +{ + VSOutputTx vout; + + Skin(vin, 2); + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: one light, four bones. +[RootSignature(MainRS)] +VSOutputTx VSSkinnedOneLightFourBones(VSInputNmTxWeights vin) +{ + VSOutputTx vout; + + Skin(vin, 4); + + CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1); + SetCommonVSOutputParams; + + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: pixel lighting, one bone. +[RootSignature(MainRS)] +VSOutputPixelLightingTx VSSkinnedPixelLightingOneBone(VSInputNmTxWeights vin) +{ + VSOutputPixelLightingTx vout; + + Skin(vin, 1); + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse = float4(1, 1, 1, DiffuseColor.a); + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: pixel lighting, two bones. +[RootSignature(MainRS)] +VSOutputPixelLightingTx VSSkinnedPixelLightingTwoBones(VSInputNmTxWeights vin) +{ + VSOutputPixelLightingTx vout; + + Skin(vin, 2); + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse = float4(1, 1, 1, DiffuseColor.a); + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Vertex shader: pixel lighting, four bones. +[RootSignature(MainRS)] +VSOutputPixelLightingTx VSSkinnedPixelLightingFourBones(VSInputNmTxWeights vin) +{ + VSOutputPixelLightingTx vout; + + Skin(vin, 4); + + CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal); + SetCommonVSOutputParamsPixelLighting; + + vout.Diffuse = float4(1, 1, 1, DiffuseColor.a); + vout.TexCoord = vin.TexCoord; + + return vout; +} + + +// Pixel shader: vertex lighting. +[RootSignature(MainRS)] +float4 PSSkinnedVertexLighting(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + AddSpecular(color, pin.Specular.rgb); + ApplyFog(color, pin.Specular.w); + + return color; +} + + +// Pixel shader: vertex lighting, no fog. +[RootSignature(MainRS)] +float4 PSSkinnedVertexLightingNoFog(PSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + AddSpecular(color, pin.Specular.rgb); + + return color; +} + + +// Pixel shader: pixel lighting. +[RootSignature(MainRS)] +float4 PSSkinnedPixelLighting(PSInputPixelLightingTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse; + + float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz); + float3 worldNormal = normalize(pin.NormalWS); + + ColorPair lightResult = ComputeLights(eyeVector, worldNormal, 3); + + color.rgb *= lightResult.Diffuse; + + AddSpecular(color, lightResult.Specular); + ApplyFog(color, pin.PositionWS.w); + + return color; +} diff --git a/Kits/DirectXTK12/Src/Shaders/SpriteEffect.fx b/Kits/DirectXTK12/Src/Shaders/SpriteEffect.fx new file mode 100644 index 0000000000000000000000000000000000000000..946b3d999d3cbc02572b96cf2b8cd7ce28f1870c --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/SpriteEffect.fx @@ -0,0 +1,36 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + +#include "Structures.fxh" +#include "RootSig.fxh" + +Texture2D Texture : register(t0); +sampler TextureSampler : register(s0); + + +cbuffer Parameters : register(b0) +{ + row_major float4x4 MatrixTransform; +}; + +[RootSignature(MainRS)] +void SpriteVertexShader(inout float4 color : COLOR0, + inout float2 texCoord : TEXCOORD0, + inout float4 position : SV_Position) +{ + position = mul(position, MatrixTransform); +} + +[RootSignature(MainRS)] +float4 SpritePixelShader(float4 color : COLOR0, + float2 texCoord : TEXCOORD0) : SV_Target0 +{ + return Texture.Sample(TextureSampler, texCoord) * color; +} diff --git a/Kits/DirectXTK12/Src/Shaders/Structures.fxh b/Kits/DirectXTK12/Src/Shaders/Structures.fxh new file mode 100644 index 0000000000000000000000000000000000000000..e7815b523730705b87a492c743891f61b7e7e863 --- /dev/null +++ b/Kits/DirectXTK12/Src/Shaders/Structures.fxh @@ -0,0 +1,229 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +// http://create.msdn.com/en-US/education/catalog/sample/stock_effects + + +// Vertex shader input structures. + +struct VSInput +{ + float4 Position : SV_Position; +}; + +struct VSInputVc +{ + float4 Position : SV_Position; + float4 Color : COLOR; +}; + +struct VSInputTx +{ + float4 Position : SV_Position; + float2 TexCoord : TEXCOORD0; +}; + +struct VSInputTxVc +{ + float4 Position : SV_Position; + float2 TexCoord : TEXCOORD0; + float4 Color : COLOR; +}; + +struct VSInputNm +{ + float4 Position : SV_Position; + float3 Normal : NORMAL; +}; + +struct VSInputNmVc +{ + float4 Position : SV_Position; + float3 Normal : NORMAL; + float4 Color : COLOR; +}; + +struct VSInputNmTx +{ + float4 Position : SV_Position; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; +}; + +struct VSInputNmTxVc +{ + float4 Position : SV_Position; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + float4 Color : COLOR; +}; + +struct VSInputTx2 +{ + float4 Position : SV_Position; + float2 TexCoord : TEXCOORD0; + float2 TexCoord2 : TEXCOORD1; +}; + +struct VSInputTx2Vc +{ + float4 Position : SV_Position; + float2 TexCoord : TEXCOORD0; + float2 TexCoord2 : TEXCOORD1; + float4 Color : COLOR; +}; + +struct VSInputNmTxWeights +{ + float4 Position : SV_Position; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + uint4 Indices : BLENDINDICES0; + float4 Weights : BLENDWEIGHT0; +}; + + + +// Vertex shader output structures. + +struct VSOutput +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float4 PositionPS : SV_Position; +}; + +struct VSOutputNoFog +{ + float4 Diffuse : COLOR0; + float4 PositionPS : SV_Position; +}; + +struct VSOutputTx +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float2 TexCoord : TEXCOORD0; + float4 PositionPS : SV_Position; +}; + +struct VSOutputTxNoFog +{ + float4 Diffuse : COLOR0; + float2 TexCoord : TEXCOORD0; + float4 PositionPS : SV_Position; +}; + +struct VSOutputPixelLighting +{ + float4 PositionWS : TEXCOORD0; + float3 NormalWS : TEXCOORD1; + float4 Diffuse : COLOR0; + float4 PositionPS : SV_Position; +}; + +struct VSOutputPixelLightingTx +{ + float2 TexCoord : TEXCOORD0; + float4 PositionWS : TEXCOORD1; + float3 NormalWS : TEXCOORD2; + float4 Diffuse : COLOR0; + float4 PositionPS : SV_Position; +}; + +struct VSOutputTx2 +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float2 TexCoord : TEXCOORD0; + float2 TexCoord2 : TEXCOORD1; + float4 PositionPS : SV_Position; +}; + +struct VSOutputTx2NoFog +{ + float4 Diffuse : COLOR0; + float2 TexCoord : TEXCOORD0; + float2 TexCoord2 : TEXCOORD1; + float4 PositionPS : SV_Position; +}; + +struct VSOutputTxEnvMap +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float2 TexCoord : TEXCOORD0; + float3 EnvCoord : TEXCOORD1; + float4 PositionPS : SV_Position; +}; + + + +// Pixel shader input structures. + +struct PSInput +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; +}; + +struct PSInputNoFog +{ + float4 Diffuse : COLOR0; +}; + +struct PSInputTx +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float2 TexCoord : TEXCOORD0; +}; + +struct PSInputTxNoFog +{ + float4 Diffuse : COLOR0; + float2 TexCoord : TEXCOORD0; +}; + +struct PSInputPixelLighting +{ + float4 PositionWS : TEXCOORD0; + float3 NormalWS : TEXCOORD1; + float4 Diffuse : COLOR0; +}; + +struct PSInputPixelLightingTx +{ + float2 TexCoord : TEXCOORD0; + float4 PositionWS : TEXCOORD1; + float3 NormalWS : TEXCOORD2; + float4 Diffuse : COLOR0; +}; + +struct PSInputTx2 +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float2 TexCoord : TEXCOORD0; + float2 TexCoord2 : TEXCOORD1; +}; + +struct PSInputTx2NoFog +{ + float4 Diffuse : COLOR0; + float2 TexCoord : TEXCOORD0; + float2 TexCoord2 : TEXCOORD1; +}; + +struct PSInputTxEnvMap +{ + float4 Diffuse : COLOR0; + float4 Specular : COLOR1; + float2 TexCoord : TEXCOORD0; + float3 EnvCoord : TEXCOORD1; +}; diff --git a/Kits/DirectXTK12/Src/SharedResourcePool.h b/Kits/DirectXTK12/Src/SharedResourcePool.h new file mode 100644 index 0000000000000000000000000000000000000000..459e35ca6fdce1f6a62e39875c352ecc11b99b80 --- /dev/null +++ b/Kits/DirectXTK12/Src/SharedResourcePool.h @@ -0,0 +1,105 @@ +//-------------------------------------------------------------------------------------- +// File: SharedResourcePool.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#include +#include + +#include "PlatformHelpers.h" + + +namespace DirectX +{ + // Pool manager ensures that only a single TData instance is created for each unique TKey. + // This is used to avoid duplicate resource creation, so that for instance a caller can + // create any number of SpriteBatch instances, but these can internally share shaders and + // vertex buffer if more than one SpriteBatch uses the same underlying D3D device. + template + class SharedResourcePool + { + public: + SharedResourcePool() + : mResourceMap(std::make_shared()) + { } + + SharedResourcePool(SharedResourcePool const&) = delete; + SharedResourcePool& operator= (SharedResourcePool const&) = delete; + + // Allocates or looks up the shared TData instance for the specified key. + std::shared_ptr DemandCreate(TKey key, TConstructorArgs... args) + { + std::lock_guard lock(mResourceMap->mutex); + + // Return an existing instance? + auto pos = mResourceMap->find(key); + + if (pos != mResourceMap->end()) + { + auto existingValue = pos->second.lock(); + + if (existingValue) + return existingValue; + else + mResourceMap->erase(pos); + } + + // Allocate a new instance. + auto newValue = std::make_shared(key, mResourceMap, args...); + + mResourceMap->insert(std::make_pair(key, newValue)); + + return newValue; + } + + + private: + // Keep track of all allocated TData instances. + struct ResourceMap : public std::map> + { + std::mutex mutex; + }; + + std::shared_ptr mResourceMap; + + + // Wrap TData with our own subclass, so we can hook the destructor + // to remove instances from our pool before they are freed. + struct WrappedData : public TData + { + WrappedData(TKey key, std::shared_ptr const& resourceMap, TConstructorArgs... args) + : mKey(key), + mResourceMap(resourceMap), + TData(key, args...) + { } + + ~WrappedData() + { + std::lock_guard lock(mResourceMap->mutex); + + auto pos = mResourceMap->find(mKey); + + // Check for weak reference expiry before erasing, in case DemandCreate runs on + // a different thread at the same time as a previous instance is being destroyed. + // We mustn't erase replacement objects that have just been added! + if (pos != mResourceMap->end() && pos->second.expired()) + { + mResourceMap->erase(pos); + } + } + + TKey mKey; + std::shared_ptr mResourceMap; + }; + }; +} diff --git a/Kits/DirectXTK12/Src/SimpleMath.cpp b/Kits/DirectXTK12/Src/SimpleMath.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6fee593021d1e4b41ea4364768c74a2e93029190 --- /dev/null +++ b/Kits/DirectXTK12/Src/SimpleMath.cpp @@ -0,0 +1,192 @@ +//------------------------------------------------------------------------------------- +// SimpleMath.cpp -- Simplified C++ Math wrapper for DirectXMath +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SimpleMath.h" + +/**************************************************************************** + * + * Constants + * + ****************************************************************************/ + +namespace DirectX +{ + namespace SimpleMath + { + #if defined(_MSC_VER) && (_MSC_VER < 1800) + const Vector2 Vector2::Zero(0.f, 0.f); + const Vector2 Vector2::One(1.f, 1.f); + const Vector2 Vector2::UnitX(1.f, 0.f); + const Vector2 Vector2::UnitY(0.f, 1.f); + + const Vector3 Vector3::Zero(0.f, 0.f, 0.f); + const Vector3 Vector3::One(1.f, 1.f, 1.f); + const Vector3 Vector3::UnitX(1.f, 0.f, 0.f); + const Vector3 Vector3::UnitY(0.f, 1.f, 0.f); + const Vector3 Vector3::UnitZ(0.f, 0.f, 1.f); + const Vector3 Vector3::Up(0.f, 1.f, 0.f); + const Vector3 Vector3::Down(0.f, -1.f, 0.f); + const Vector3 Vector3::Right(1.f, 0.f, 0.f); + const Vector3 Vector3::Left(-1.f, 0.f, 0.f); + const Vector3 Vector3::Forward(0.f, 0.f, -1.f); + const Vector3 Vector3::Backward(0.f, 0.f, 1.f); + + const Vector4 Vector4::Zero(0.f, 0.f, 0.f, 0.f); + const Vector4 Vector4::One(1.f, 1.f, 1.f, 1.f); + const Vector4 Vector4::UnitX(1.f, 0.f, 0.f, 0.f); + const Vector4 Vector4::UnitY(0.f, 1.f, 0.f, 0.f); + const Vector4 Vector4::UnitZ(0.f, 0.f, 1.f, 0.f); + const Vector4 Vector4::UnitW(0.f, 0.f, 0.f, 1.f); + + const Matrix Matrix::Identity(1.f, 0.f, 0.f, 0.f, + 0.f, 1.f, 0.f, 0.f, + 0.f, 0.f, 1.f, 0.f, + 0.f, 0.f, 0.f, 1.f); + + const Quaternion Quaternion::Identity(0.f, 0.f, 0.f, 1.f); + #else + const Vector2 Vector2::Zero = { 0.f, 0.f }; + const Vector2 Vector2::One = { 1.f, 1.f }; + const Vector2 Vector2::UnitX = { 1.f, 0.f }; + const Vector2 Vector2::UnitY = { 0.f, 1.f }; + + const Vector3 Vector3::Zero = { 0.f, 0.f, 0.f }; + const Vector3 Vector3::One = { 1.f, 1.f, 1.f }; + const Vector3 Vector3::UnitX = { 1.f, 0.f, 0.f }; + const Vector3 Vector3::UnitY = { 0.f, 1.f, 0.f }; + const Vector3 Vector3::UnitZ = { 0.f, 0.f, 1.f }; + const Vector3 Vector3::Up = { 0.f, 1.f, 0.f }; + const Vector3 Vector3::Down = { 0.f, -1.f, 0.f }; + const Vector3 Vector3::Right = { 1.f, 0.f, 0.f }; + const Vector3 Vector3::Left = { -1.f, 0.f, 0.f }; + const Vector3 Vector3::Forward = { 0.f, 0.f, -1.f }; + const Vector3 Vector3::Backward = { 0.f, 0.f, 1.f }; + + const Vector4 Vector4::Zero = { 0.f, 0.f, 0.f, 0.f }; + const Vector4 Vector4::One = { 1.f, 1.f, 1.f, 1.f }; + const Vector4 Vector4::UnitX = { 1.f, 0.f, 0.f, 0.f }; + const Vector4 Vector4::UnitY = { 0.f, 1.f, 0.f, 0.f }; + const Vector4 Vector4::UnitZ = { 0.f, 0.f, 1.f, 0.f }; + const Vector4 Vector4::UnitW = { 0.f, 0.f, 0.f, 1.f }; + + const Matrix Matrix::Identity = { 1.f, 0.f, 0.f, 0.f, + 0.f, 1.f, 0.f, 0.f, + 0.f, 0.f, 1.f, 0.f, + 0.f, 0.f, 0.f, 1.f }; + + const Quaternion Quaternion::Identity = { 0.f, 0.f, 0.f, 1.f }; + #endif + } +} + + +/**************************************************************************** + * + * Viewport + * + ****************************************************************************/ + +#if defined(__d3d11_h__) || defined(__d3d11_x_h__) +static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D11_VIEWPORT), "Size mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, x) == FIELD_OFFSET(D3D11_VIEWPORT, TopLeftX), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, y) == FIELD_OFFSET(D3D11_VIEWPORT, TopLeftY), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, width) == FIELD_OFFSET(D3D11_VIEWPORT, Width), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, height) == FIELD_OFFSET(D3D11_VIEWPORT, Height), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, minDepth) == FIELD_OFFSET(D3D11_VIEWPORT, MinDepth), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, maxDepth) == FIELD_OFFSET(D3D11_VIEWPORT, MaxDepth), "Layout mismatch"); +#endif + +#if defined(__d3d12_h__) || defined(__d3d12_x_h__) +static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D12_VIEWPORT), "Size mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, x) == FIELD_OFFSET(D3D12_VIEWPORT, TopLeftX), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, y) == FIELD_OFFSET(D3D12_VIEWPORT, TopLeftY), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, width) == FIELD_OFFSET(D3D12_VIEWPORT, Width), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, height) == FIELD_OFFSET(D3D12_VIEWPORT, Height), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, minDepth) == FIELD_OFFSET(D3D12_VIEWPORT, MinDepth), "Layout mismatch"); +static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, maxDepth) == FIELD_OFFSET(D3D12_VIEWPORT, MaxDepth), "Layout mismatch"); +#endif + +RECT DirectX::SimpleMath::Viewport::ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight) +{ + RECT rct; + + switch (int(scaling)) + { + case DXGI_SCALING_STRETCH: + // Output fills the entire window area + rct.top = 0; + rct.left = 0; + rct.right = outputWidth; + rct.bottom = outputHeight; + break; + + case 2 /*DXGI_SCALING_ASPECT_RATIO_STRETCH*/: + // Output fills the window area but respects the original aspect ratio, using pillar boxing or letter boxing as required + // Note: This scaling option is not supported for legacy Win32 windows swap chains + { + assert(backBufferHeight > 0); + float aspectRatio = float(backBufferWidth) / float(backBufferHeight); + + // Horizontal fill + float scaledWidth = float(outputWidth); + float scaledHeight = float(outputWidth) / aspectRatio; + if (scaledHeight >= outputHeight) + { + // Do vertical fill + scaledWidth = float(outputHeight) * aspectRatio; + scaledHeight = float(outputHeight); + } + + float offsetX = (float(outputWidth) - scaledWidth) * 0.5f; + float offsetY = (float(outputHeight) - scaledHeight) * 0.5f; + + rct.left = static_cast( offsetX ); + rct.top = static_cast( offsetY ); + rct.right = static_cast( offsetX + scaledWidth ); + rct.bottom = static_cast( offsetY + scaledHeight ); + + // Clip to display window + rct.left = std::max( 0, rct.left ); + rct.top = std::max( 0, rct.top ); + rct.right = std::min( outputWidth, rct.right ); + rct.bottom = std::min( outputHeight, rct.bottom ); + } + break; + + case DXGI_SCALING_NONE: + default: + // Output is displayed in the upper left corner of the window area + rct.top = 0; + rct.left = 0; + rct.right = std::min( backBufferWidth, UINT(outputWidth) ); + rct.bottom = std::min( backBufferHeight, UINT(outputHeight) ); + break; + } + + return rct; +} + +RECT DirectX::SimpleMath::Viewport::ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight) +{ + float safew = (float(backBufferWidth) + 19.f) / 20.f; + float safeh = (float(backBufferHeight) + 19.f) / 20.f; + + RECT rct; + rct.left = static_cast(safew); + rct.top = static_cast(safeh); + rct.right = static_cast(float(backBufferWidth) - safew + 0.5f); + rct.bottom = static_cast(float(backBufferHeight) - safeh + 0.5f); + + return rct; +} diff --git a/Kits/DirectXTK12/Src/SkinnedEffect.cpp b/Kits/DirectXTK12/Src/SkinnedEffect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..786da98192f0016ee378b2c7035f52c26dfbee1f --- /dev/null +++ b/Kits/DirectXTK12/Src/SkinnedEffect.cpp @@ -0,0 +1,550 @@ +//-------------------------------------------------------------------------------------- +// File: SkinnedEffect.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "EffectCommon.h" + +using namespace DirectX; + + +// Constant buffer layout. Must match the shader! +struct SkinnedEffectConstants +{ + XMVECTOR diffuseColor; + XMVECTOR emissiveColor; + XMVECTOR specularColorAndPower; + + XMVECTOR lightDirection[IEffectLights::MaxDirectionalLights]; + XMVECTOR lightDiffuseColor[IEffectLights::MaxDirectionalLights]; + XMVECTOR lightSpecularColor[IEffectLights::MaxDirectionalLights]; + + XMVECTOR eyePosition; + + XMVECTOR fogColor; + XMVECTOR fogVector; + + XMMATRIX world; + XMVECTOR worldInverseTranspose[3]; + XMMATRIX worldViewProj; + + XMVECTOR bones[SkinnedEffect::MaxBones][3]; +}; + +static_assert( ( sizeof(SkinnedEffectConstants) % 16 ) == 0, "CB size not padded correctly" ); + + +// Traits type describes our characteristics to the EffectBase template. +struct SkinnedEffectTraits +{ + typedef SkinnedEffectConstants ConstantBufferType; + + static const int VertexShaderCount = 9; + static const int PixelShaderCount = 3; + static const int ShaderPermutationCount = 18; +}; + + +// Internal SkinnedEffect implementation class. +class SkinnedEffect::Impl : public EffectBase +{ +public: + Impl(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription); + + enum DescriptorIndex + { + Texture, + DescriptorCount + }; + + enum RootParameterIndex + { + TextureSRV, + ConstantBuffer, + RootParameterCount + }; + + bool preferPerPixelLighting; + int weightsPerVertex; + + D3D12_GPU_DESCRIPTOR_HANDLE texture; + + EffectLights lights; + + int GetCurrentPipelineStatePermutation() const; + + void Apply(_In_ ID3D12GraphicsCommandList* commandList); +}; + + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedVertexLightingOneBone.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedVertexLightingTwoBones.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedVertexLightingFourBones.inc" + + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedOneLightOneBone.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedOneLightTwoBones.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedOneLightFourBones.inc" + + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedPixelLightingOneBone.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedPixelLightingTwoBones.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedPixelLightingFourBones.inc" + + #include "Shaders/Compiled/XboxOneSkinnedEffect_PSSkinnedVertexLighting.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_PSSkinnedVertexLightingNoFog.inc" + #include "Shaders/Compiled/XboxOneSkinnedEffect_PSSkinnedPixelLighting.inc" +#else + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingOneBone.inc" + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingTwoBones.inc" + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc" + + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightOneBone.inc" + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightTwoBones.inc" + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedOneLightFourBones.inc" + + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingOneBone.inc" + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingTwoBones.inc" + #include "Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc" + + #include "Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc" + #include "Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc" + #include "Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc" +#endif +} + + +const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytecode[] = +{ + { SkinnedEffect_VSSkinnedVertexLightingOneBone, sizeof(SkinnedEffect_VSSkinnedVertexLightingOneBone) }, + { SkinnedEffect_VSSkinnedVertexLightingTwoBones, sizeof(SkinnedEffect_VSSkinnedVertexLightingTwoBones) }, + { SkinnedEffect_VSSkinnedVertexLightingFourBones, sizeof(SkinnedEffect_VSSkinnedVertexLightingFourBones) }, + + { SkinnedEffect_VSSkinnedOneLightOneBone, sizeof(SkinnedEffect_VSSkinnedOneLightOneBone) }, + { SkinnedEffect_VSSkinnedOneLightTwoBones, sizeof(SkinnedEffect_VSSkinnedOneLightTwoBones) }, + { SkinnedEffect_VSSkinnedOneLightFourBones, sizeof(SkinnedEffect_VSSkinnedOneLightFourBones) }, + + { SkinnedEffect_VSSkinnedPixelLightingOneBone, sizeof(SkinnedEffect_VSSkinnedPixelLightingOneBone) }, + { SkinnedEffect_VSSkinnedPixelLightingTwoBones, sizeof(SkinnedEffect_VSSkinnedPixelLightingTwoBones) }, + { SkinnedEffect_VSSkinnedPixelLightingFourBones, sizeof(SkinnedEffect_VSSkinnedPixelLightingFourBones) }, +}; + + +const int EffectBase::VertexShaderIndices[] = +{ + 0, // vertex lighting, one bone + 0, // vertex lighting, one bone, no fog + 1, // vertex lighting, two bones + 1, // vertex lighting, two bones, no fog + 2, // vertex lighting, four bones + 2, // vertex lighting, four bones, no fog + + 3, // one light, one bone + 3, // one light, one bone, no fog + 4, // one light, two bones + 4, // one light, two bones, no fog + 5, // one light, four bones + 5, // one light, four bones, no fog + + 6, // pixel lighting, one bone + 6, // pixel lighting, one bone, no fog + 7, // pixel lighting, two bones + 7, // pixel lighting, two bones, no fog + 8, // pixel lighting, four bones + 8, // pixel lighting, four bones, no fog +}; + + +const D3D12_SHADER_BYTECODE EffectBase::PixelShaderBytecode[] = +{ + { SkinnedEffect_PSSkinnedVertexLighting, sizeof(SkinnedEffect_PSSkinnedVertexLighting) }, + { SkinnedEffect_PSSkinnedVertexLightingNoFog, sizeof(SkinnedEffect_PSSkinnedVertexLightingNoFog) }, + { SkinnedEffect_PSSkinnedPixelLighting, sizeof(SkinnedEffect_PSSkinnedPixelLighting) }, +}; + + +const int EffectBase::PixelShaderIndices[] = +{ + 0, // vertex lighting, one bone + 1, // vertex lighting, one bone, no fog + 0, // vertex lighting, two bones + 1, // vertex lighting, two bones, no fog + 0, // vertex lighting, four bones + 1, // vertex lighting, four bones, no fog + + 0, // one light, one bone + 1, // one light, one bone, no fog + 0, // one light, two bones + 1, // one light, two bones, no fog + 0, // one light, four bones + 1, // one light, four bones, no fog + + 2, // pixel lighting, one bone + 2, // pixel lighting, one bone, no fog + 2, // pixel lighting, two bones + 2, // pixel lighting, two bones, no fog + 2, // pixel lighting, four bones + 2, // pixel lighting, four bones, no fog +}; + + +// Global pool of per-device SkinnedEffect resources. +SharedResourcePool::DeviceResources> EffectBase::deviceResourcesPool; + + +// Constructor. +SkinnedEffect::Impl::Impl(_In_ ID3D12Device* device, int flags, const EffectPipelineStateDescription& pipelineDescription) + : EffectBase(device), + preferPerPixelLighting(false), + weightsPerVertex(4) +{ + static_assert( _countof(EffectBase::VertexShaderIndices) == SkinnedEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::VertexShaderBytecode) == SkinnedEffectTraits::VertexShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderBytecode) == SkinnedEffectTraits::PixelShaderCount, "array/max mismatch" ); + static_assert( _countof(EffectBase::PixelShaderIndices) == SkinnedEffectTraits::ShaderPermutationCount, "array/max mismatch" ); + + lights.InitializeConstants(constants.specularColorAndPower, constants.lightDirection, constants.lightDiffuseColor, constants.lightSpecularColor); + + for (int i = 0; i < MaxBones; i++) + { + constants.bones[i][0] = g_XMIdentityR0; + constants.bones[i][1] = g_XMIdentityR1; + constants.bones[i][2] = g_XMIdentityR2; + } + + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer. + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC sampler(0); + CD3DX12_DESCRIPTOR_RANGE descriptorRanges[DescriptorIndex::DescriptorCount]; + descriptorRanges[DescriptorIndex::Texture].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::TextureSRV].InitAsDescriptorTable( + _countof(descriptorRanges), + descriptorRanges); + rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL); + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, 1, &sampler, rootSignatureFlags); + + ThrowIfFailed(CreateRootSignature(device, &rsigDesc, mRootSignature.ReleaseAndGetAddressOf())); + + fog.enabled = (flags & EffectFlags::Fog) != 0; + preferPerPixelLighting = (flags & EffectFlags::PerPixelLighting) != 0; + + int sp = GetCurrentPipelineStatePermutation(); + int vi = EffectBase::VertexShaderIndices[sp]; + int pi = EffectBase::PixelShaderIndices[sp]; + + EffectBase::CreatePipelineState( + mRootSignature.Get(), + pipelineDescription.inputLayout, + &EffectBase::VertexShaderBytecode[vi], + &EffectBase::PixelShaderBytecode[pi], + pipelineDescription.blendDesc, + pipelineDescription.depthStencilDesc, + pipelineDescription.rasterizerDesc, + pipelineDescription.renderTargetState, + pipelineDescription.primitiveTopology, + pipelineDescription.stripCutValue); +} + + +int SkinnedEffect::Impl::GetCurrentPipelineStatePermutation() const +{ + int permutation = 0; + + // Use optimized shaders if fog is disabled. + if (!fog.enabled) + { + permutation += 1; + } + + // Evaluate 1, 2, or 4 weights per vertex? + if (weightsPerVertex == 2) + { + permutation += 2; + } + else if (weightsPerVertex == 4) + { + permutation += 4; + } + + if (preferPerPixelLighting) + { + // Do lighting in the pixel shader. + permutation += 12; + } + else if (!lights.lightEnabled[1] && !lights.lightEnabled[2]) + { + // Use the only-bother-with-the-first-light shader optimization. + permutation += 6; + } + + return permutation; +} + + +// Sets our state onto the D3D device. +void SkinnedEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + // Compute derived parameter values. + matrices.SetConstants(dirtyFlags, constants.worldViewProj); + fog.SetConstants(dirtyFlags, matrices.worldView, constants.fogVector); + lights.SetConstants(dirtyFlags, matrices, constants.world, constants.worldInverseTranspose, constants.eyePosition, constants.diffuseColor, constants.emissiveColor, true); + + UpdateConstants(); + + // Set the root signature + commandList->SetGraphicsRootSignature(mRootSignature.Get()); + + // Set the texture. + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture); + + // Set constants + commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, GetConstantBufferGpuAddress()); + + // Set the pipeline state + commandList->SetPipelineState(EffectBase::mPipelineState.Get()); +} + + +// Public constructor. +SkinnedEffect::SkinnedEffect(_In_ ID3D12Device* device, int effectFlags, const EffectPipelineStateDescription& pipelineDescription) + : pImpl(new Impl(device, effectFlags, pipelineDescription)) +{ +} + + +// Move constructor. +SkinnedEffect::SkinnedEffect(SkinnedEffect&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +SkinnedEffect& SkinnedEffect::operator= (SkinnedEffect&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +SkinnedEffect::~SkinnedEffect() +{ +} + + +void SkinnedEffect::Apply(_In_ ID3D12GraphicsCommandList* commandList) +{ + pImpl->Apply(commandList); +} + +void XM_CALLCONV SkinnedEffect::SetWorld(FXMMATRIX value) +{ + pImpl->matrices.world = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::WorldInverseTranspose | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV SkinnedEffect::SetView(FXMMATRIX value) +{ + pImpl->matrices.view = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj | EffectDirtyFlags::EyePosition | EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV SkinnedEffect::SetProjection(FXMMATRIX value) +{ + pImpl->matrices.projection = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::WorldViewProj; +} + + +void XM_CALLCONV SkinnedEffect::SetDiffuseColor(FXMVECTOR value) +{ + pImpl->lights.diffuseColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void XM_CALLCONV SkinnedEffect::SetEmissiveColor(FXMVECTOR value) +{ + pImpl->lights.emissiveColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void XM_CALLCONV SkinnedEffect::SetSpecularColor(FXMVECTOR value) +{ + // Set xyz to new value, but preserve existing w (specular power). + pImpl->constants.specularColorAndPower = XMVectorSelect(pImpl->constants.specularColorAndPower, value, g_XMSelect1110); + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void SkinnedEffect::SetSpecularPower(float value) +{ + // Set w to new value, but preserve existing xyz (specular color). + pImpl->constants.specularColorAndPower = XMVectorSetW(pImpl->constants.specularColorAndPower, value); + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + +void SkinnedEffect::DisableSpecular() +{ + // Set specular color to black, power to 1 + // Note: Don't use a power of 0 or the shader will generate strange highlights on non-specular materials + + pImpl->constants.specularColorAndPower = g_XMIdentityR3; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + +void SkinnedEffect::SetAlpha(float value) +{ + pImpl->lights.alpha = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + +void XM_CALLCONV SkinnedEffect::SetAmbientLightColor(FXMVECTOR value) +{ + pImpl->lights.ambientLightColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::MaterialColor; +} + + +void SkinnedEffect::SetLightEnabled(int whichLight, bool value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightEnabled(whichLight, value, pImpl->constants.lightDiffuseColor, pImpl->constants.lightSpecularColor); +} + + +void XM_CALLCONV SkinnedEffect::SetLightDirection(int whichLight, FXMVECTOR value) +{ + EffectLights::ValidateLightIndex(whichLight); + + pImpl->constants.lightDirection[whichLight] = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void XM_CALLCONV SkinnedEffect::SetLightDiffuseColor(int whichLight, FXMVECTOR value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightDiffuseColor(whichLight, value, pImpl->constants.lightDiffuseColor); +} + + +void XM_CALLCONV SkinnedEffect::SetLightSpecularColor(int whichLight, FXMVECTOR value) +{ + pImpl->dirtyFlags |= pImpl->lights.SetLightSpecularColor(whichLight, value, pImpl->constants.lightSpecularColor); +} + + +void SkinnedEffect::EnableDefaultLighting() +{ + EffectLights::EnableDefaultLighting(this); +} + +void SkinnedEffect::SetFogStart(float value) +{ + pImpl->fog.start = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void SkinnedEffect::SetFogEnd(float value) +{ + pImpl->fog.end = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::FogVector; +} + + +void XM_CALLCONV SkinnedEffect::SetFogColor(FXMVECTOR value) +{ + pImpl->constants.fogColor = value; + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void SkinnedEffect::SetTexture(_In_ D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor) +{ + pImpl->texture = srvDescriptor; +} + + +void SkinnedEffect::SetWeightsPerVertex(int value) +{ + if ((value != 1) && + (value != 2) && + (value != 4)) + { + throw std::out_of_range("WeightsPerVertex must be 1, 2, or 4"); + } + + pImpl->weightsPerVertex = value; +} + + +void SkinnedEffect::SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) +{ + if (count > MaxBones) + throw std::out_of_range("count parameter out of range"); + + auto boneConstant = pImpl->constants.bones; + + for (size_t i = 0; i < count; i++) + { + XMMATRIX boneMatrix = XMMatrixTranspose(value[i]); + + boneConstant[i][0] = boneMatrix.r[0]; + boneConstant[i][1] = boneMatrix.r[1]; + boneConstant[i][2] = boneMatrix.r[2]; + } + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} + + +void SkinnedEffect::ResetBoneTransforms() +{ + auto boneConstant = pImpl->constants.bones; + + XMMATRIX id = XMMatrixIdentity(); + + for(size_t i = 0; i < MaxBones; ++i) + { + boneConstant[i][0] = g_XMIdentityR0; + boneConstant[i][1] = g_XMIdentityR1; + boneConstant[i][2] = g_XMIdentityR2; + } + + pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer; +} diff --git a/Kits/DirectXTK12/Src/SpriteBatch.cpp b/Kits/DirectXTK12/Src/SpriteBatch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..df7324003fb807c95d2522eefa2b58f545701cd4 --- /dev/null +++ b/Kits/DirectXTK12/Src/SpriteBatch.cpp @@ -0,0 +1,1078 @@ +//-------------------------------------------------------------------------------------- +// File: SpriteBatch.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" + +#include "SpriteBatch.h" +#include "CommonStates.h" +#include "VertexTypes.h" +#include "SharedResourcePool.h" +#include "AlignedNew.h" +#include "ResourceUploadBatch.h" +#include "GraphicsMemory.h" +#include "DirectXHelpers.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +namespace +{ + // Include the precompiled shader code. + #if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneSpriteEffect_SpriteVertexShader.inc" + #include "Shaders/Compiled/XboxOneSpriteEffect_SpritePixelShader.inc" + #else + #include "Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc" + #include "Shaders/Compiled/SpriteEffect_SpritePixelShader.inc" + #endif + + inline bool operator ! (D3D12_GPU_DESCRIPTOR_HANDLE h) + { + return h.ptr == 0; + } + inline bool operator != (D3D12_GPU_DESCRIPTOR_HANDLE a, D3D12_GPU_DESCRIPTOR_HANDLE b) + { + return a.ptr != b.ptr; + } + inline bool operator < (D3D12_GPU_DESCRIPTOR_HANDLE a, D3D12_GPU_DESCRIPTOR_HANDLE b) + { + return a.ptr < b.ptr; + } + + // Helper converts a RECT to XMVECTOR. + inline XMVECTOR LoadRect(_In_ RECT const* rect) + { + XMVECTOR v = XMLoadInt4(reinterpret_cast(rect)); + + v = XMConvertVectorIntToFloat(v, 0); + + // Convert right/bottom to width/height. + v -= XMVectorPermute<0, 1, 4, 5>(XMVectorZero(), v); + + return v; + } +} + +// Internal SpriteBatch implementation class. +__declspec(align(16)) class SpriteBatch::Impl : public AlignedNew +{ +public: + Impl(_In_ ID3D12Device* device, + _In_ ResourceUploadBatch& upload, + _In_ const SpriteBatchPipelineStateDescription* psoDesc, + _In_opt_ const D3D12_VIEWPORT* viewport); + + void XM_CALLCONV Begin( + _In_ ID3D12GraphicsCommandList* commandList, + _In_opt_ SpriteSortMode sortMode = SpriteSortMode_Deferred, + _In_opt_ FXMMATRIX transformMatrix = MatrixIdentity); + void End(); + + void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, + _In_ XMUINT2 textureSize, + FXMVECTOR destination, + _In_opt_ RECT const* sourceRectangle, + FXMVECTOR color, + FXMVECTOR originRotationDepth, + int flags); + + // Info about a single sprite that is waiting to be drawn. + __declspec(align(16)) struct SpriteInfo : public AlignedNew + { + XMFLOAT4A source; + XMFLOAT4A destination; + XMFLOAT4A color; + XMFLOAT4A originRotationDepth; + D3D12_GPU_DESCRIPTOR_HANDLE texture; + XMVECTOR textureSize; + int flags; + + // Combine values from the public SpriteEffects enum with these internal-only flags. + static const int SourceInTexels = 4; + static const int DestSizeInPixels = 8; + + static_assert((SpriteEffects_FlipBoth & (SourceInTexels | DestSizeInPixels)) == 0, "Flag bits must not overlap"); + }; + + DXGI_MODE_ROTATION mRotation; + + bool mSetViewport; + D3D12_VIEWPORT mViewPort; + +private: + // Implementation helper methods. + void GrowSpriteQueue(); + void PrepareForRendering(); + void FlushBatch(); + void SortSprites(); + void GrowSortedSprites(); + + void RenderBatch(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, _In_ XMVECTOR textureSize, _In_reads_(count) SpriteInfo const* const* sprites, size_t count); + + static void XM_CALLCONV RenderSprite(_In_ SpriteInfo const* sprite, + _Out_writes_(VerticesPerSprite) VertexPositionColorTexture* vertices, + FXMVECTOR textureSize, + FXMVECTOR inverseTextureSize); + + XMMATRIX GetViewportTransform(_In_ DXGI_MODE_ROTATION rotation); + + // Constants. + static const size_t MaxBatchSize = 2048; + static const size_t MinBatchSize = 128; + static const size_t InitialQueueSize = 64; + static const size_t VerticesPerSprite = 4; + static const size_t IndicesPerSprite = 6; + + // + // The following functions and members are used to create the default pipeline state objects. + // + static const D3D12_SHADER_BYTECODE s_DefaultVertexShaderByteCode; + static const D3D12_SHADER_BYTECODE s_DefaultPixelShaderByteCode; + static const D3D12_INPUT_LAYOUT_DESC s_DefaultInputLayoutDesc; + static const D3D12_BLEND_DESC s_DefaultBlendDesc; + static const D3D12_RASTERIZER_DESC s_DefaultRasterizerDesc; + static const D3D12_DEPTH_STENCIL_DESC s_DefaultDepthStencilDesc; + + + // Queue of sprites waiting to be drawn. + std::unique_ptr mSpriteQueue; + + size_t mSpriteQueueCount; + size_t mSpriteQueueArraySize; + + + // To avoid needlessly copying around bulky SpriteInfo structures, we leave that + // actual data alone and just sort this array of pointers instead. But we want contiguous + // memory for cache efficiency, so these pointers are just shortcuts into the single + // mSpriteQueue array, and we take care to keep them in order when sorting is disabled. + std::vector mSortedSprites; + + + // Mode settings from the last Begin call. + bool mInBeginEndPair; + + SpriteSortMode mSortMode; + ComPtr mPSO; + ComPtr mRootSignature; + XMMATRIX mTransformMatrix; + ComPtr mCommandList; + + // Batched data + GraphicsResource mVertexSegment; + size_t mVertexPageSize; + size_t mSpriteCount; + GraphicsResource mConstantBuffer; + + enum DescriptorIndex + { + Texture, + DescriptorCount + }; + + enum RootParameterIndex + { + TextureSRV, + ConstantBuffer, + RootParameterCount + }; + + // Only one of these helpers is allocated per D3D device, even if there are multiple SpriteBatch instances. + struct DeviceResources + { + DeviceResources(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload); + + ComPtr indexBuffer; + D3D12_INDEX_BUFFER_VIEW indexBufferView; + ComPtr rootSignature; + + private: + void CreateIndexBuffer(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload); + void CreateRootSignature(_In_ ID3D12Device* device); + + static std::vector CreateIndexValues(); + }; + + // Per-device data. + std::shared_ptr mDeviceResources; + static SharedResourcePool deviceResourcesPool; +}; + + +// Global pools of per-device and per-context SpriteBatch resources. +SharedResourcePool SpriteBatch::Impl::deviceResourcesPool; + + +// Constants. +const XMMATRIX SpriteBatch::MatrixIdentity = XMMatrixIdentity(); +const XMFLOAT2 SpriteBatch::Float2Zero(0, 0); + +const D3D12_SHADER_BYTECODE SpriteBatch::Impl::s_DefaultVertexShaderByteCode = {SpriteEffect_SpriteVertexShader, sizeof(SpriteEffect_SpriteVertexShader)}; +const D3D12_SHADER_BYTECODE SpriteBatch::Impl::s_DefaultPixelShaderByteCode = {SpriteEffect_SpritePixelShader, sizeof(SpriteEffect_SpritePixelShader)}; +const D3D12_INPUT_LAYOUT_DESC SpriteBatch::Impl::s_DefaultInputLayoutDesc = VertexPositionColorTexture::InputLayout; +const D3D12_BLEND_DESC SpriteBatch::Impl::s_DefaultBlendDesc = {FALSE, FALSE, {TRUE, FALSE, D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, D3D12_BLEND_ONE, D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_OP_ADD, D3D12_LOGIC_OP_CLEAR, D3D12_COLOR_WRITE_ENABLE_ALL}}; +const D3D12_RASTERIZER_DESC SpriteBatch::Impl::s_DefaultRasterizerDesc = {D3D12_FILL_MODE_SOLID, D3D12_CULL_MODE_NONE, FALSE, 0, 0, 0, FALSE, FALSE, FALSE, 0, D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF}; +const D3D12_DEPTH_STENCIL_DESC SpriteBatch::Impl::s_DefaultDepthStencilDesc = {FALSE, D3D12_DEPTH_WRITE_MASK_ALL, D3D12_COMPARISON_FUNC_ALWAYS, FALSE, 0, 0}; + +// Per-device constructor. +SpriteBatch::Impl::DeviceResources::DeviceResources(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload) +{ + CreateIndexBuffer(device, upload); + CreateRootSignature(device); +} + +// Creates the SpriteBatch index buffer. +void SpriteBatch::Impl::DeviceResources::CreateIndexBuffer(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload) +{ + static_assert((MaxBatchSize * VerticesPerSprite) < USHRT_MAX, "MaxBatchSize too large for 16-bit indices"); + + CD3DX12_HEAP_PROPERTIES heapProps(D3D12_HEAP_TYPE_DEFAULT); + CD3DX12_RESOURCE_DESC bufferDesc = CD3DX12_RESOURCE_DESC::Buffer(sizeof(short) * MaxBatchSize * IndicesPerSprite); + + // Create the constant buffer. + ThrowIfFailed(device->CreateCommittedResource( + &heapProps, + D3D12_HEAP_FLAG_NONE, + &bufferDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(indexBuffer.ReleaseAndGetAddressOf()))); + + auto indexValues = CreateIndexValues(); + + D3D12_SUBRESOURCE_DATA indexDataDesc = {}; + indexDataDesc.pData = indexValues.data(); + indexDataDesc.RowPitch = (LONG_PTR) bufferDesc.Width; + indexDataDesc.SlicePitch = indexDataDesc.RowPitch; + + // Upload the resource + upload.Upload(indexBuffer.Get(), 0, &indexDataDesc, 1); + upload.Transition(indexBuffer.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDEX_BUFFER); + SetDebugObjectName(indexBuffer.Get(), L"DirectXTK:SpriteBatch Index Buffer"); + + // Create the index buffer view + indexBufferView.BufferLocation = indexBuffer->GetGPUVirtualAddress(); + indexBufferView.Format = DXGI_FORMAT_R16_UINT; + indexBufferView.SizeInBytes = (UINT) bufferDesc.Width; +} + +void SpriteBatch::Impl::DeviceResources::CreateRootSignature(_In_ ID3D12Device* device) +{ + D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags = + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | // Only the input assembler stage needs access to the constant buffer. + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS; + + CD3DX12_STATIC_SAMPLER_DESC sampler(0); + CD3DX12_DESCRIPTOR_RANGE descriptorRanges[DescriptorIndex::DescriptorCount]; + descriptorRanges[DescriptorIndex::Texture].Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0); + CD3DX12_ROOT_PARAMETER rootParameters[RootParameterIndex::RootParameterCount]; + rootParameters[RootParameterIndex::TextureSRV].InitAsDescriptorTable( + _countof(descriptorRanges), + descriptorRanges); + rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL); + CD3DX12_ROOT_SIGNATURE_DESC rsigDesc; + rsigDesc.Init(_countof(rootParameters), rootParameters, 1, &sampler, rootSignatureFlags); + + ThrowIfFailed(::CreateRootSignature(device, &rsigDesc, rootSignature.ReleaseAndGetAddressOf())); +} + +// Helper for populating the SpriteBatch index buffer. +std::vector SpriteBatch::Impl::DeviceResources::CreateIndexValues() +{ + std::vector indices; + + indices.reserve(MaxBatchSize * IndicesPerSprite); + + for (short i = 0; i < MaxBatchSize * VerticesPerSprite; i += VerticesPerSprite) + { + indices.push_back(i); + indices.push_back(i + 1); + indices.push_back(i + 2); + + indices.push_back(i + 1); + indices.push_back(i + 3); + indices.push_back(i + 2); + } + + return indices; +} + +// Per-SpriteBatch constructor. +_Use_decl_annotations_ +SpriteBatch::Impl::Impl(ID3D12Device* device, ResourceUploadBatch& upload, const SpriteBatchPipelineStateDescription* psoDesc, const D3D12_VIEWPORT* viewport) + : mRotation(DXGI_MODE_ROTATION_IDENTITY), + mSetViewport(false), + mSpriteQueueCount(0), + mSpriteQueueArraySize(0), + mInBeginEndPair(false), + mSortMode(SpriteSortMode_Deferred), + mTransformMatrix(MatrixIdentity), + mDeviceResources(deviceResourcesPool.DemandCreate(device, upload)), + mVertexPageSize(sizeof(VertexPositionNormalColorTexture) * MaxBatchSize * VerticesPerSprite), + mVertexSegment {}, + mSpriteCount(0) +{ + if (psoDesc == nullptr) + throw std::exception("SpriteBatch: PSO description cannot be null."); + + if (psoDesc->renderTargetState == nullptr) + throw std::exception("SpriteBatchPipelineStateDescription must have a non-null render target state."); + + if (viewport != nullptr) + { + mViewPort = *viewport; + mSetViewport = true; + } + + mRootSignature = mDeviceResources->rootSignature.Get(); + D3D12_SHADER_BYTECODE vertexShader = s_DefaultVertexShaderByteCode; + D3D12_SHADER_BYTECODE pixelShader = s_DefaultPixelShaderByteCode; + + if (psoDesc->shaders) + { + if (psoDesc->shaders->rootSignature) + mRootSignature = psoDesc->shaders->rootSignature; + if (psoDesc->shaders->vertexShaderByteCode) + vertexShader = *psoDesc->shaders->vertexShaderByteCode; + if (psoDesc->shaders->pixelShaderByteCode) + pixelShader = *psoDesc->shaders->pixelShaderByteCode; + } + + D3D12_GRAPHICS_PIPELINE_STATE_DESC d3dDesc = {}; + d3dDesc.pRootSignature = mRootSignature.Get(); + d3dDesc.VS = vertexShader; + d3dDesc.PS = pixelShader; + d3dDesc.InputLayout = s_DefaultInputLayoutDesc; + d3dDesc.BlendState = psoDesc->blendDesc ? *psoDesc->blendDesc : s_DefaultBlendDesc; + d3dDesc.DepthStencilState = psoDesc->depthStencilDesc ? *psoDesc->depthStencilDesc : s_DefaultDepthStencilDesc; + d3dDesc.RasterizerState = psoDesc->rasterizerDesc ? *psoDesc->rasterizerDesc : s_DefaultRasterizerDesc; + d3dDesc.DSVFormat = psoDesc->renderTargetState->dsvFormat; + d3dDesc.NodeMask = psoDesc->renderTargetState->nodeMask; + d3dDesc.NumRenderTargets = psoDesc->renderTargetState->numRenderTargets; + memcpy(d3dDesc.RTVFormats, psoDesc->renderTargetState->rtvFormats, sizeof(d3dDesc.RTVFormats)); + d3dDesc.SampleDesc = psoDesc->renderTargetState->sampleDesc; + d3dDesc.SampleMask = psoDesc->renderTargetState->sampleMask; + d3dDesc.IBStripCutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED; + d3dDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + + ThrowIfFailed(device->CreateGraphicsPipelineState( + &d3dDesc, + IID_GRAPHICS_PPV_ARGS(mPSO.ReleaseAndGetAddressOf()))); +} + +// Begins a batch of sprite drawing operations. +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Impl::Begin(ID3D12GraphicsCommandList* commandList, SpriteSortMode sortMode, FXMMATRIX transformMatrix) +{ + if (mInBeginEndPair) + throw std::exception("Cannot nest Begin calls on a single SpriteBatch"); + + mSortMode = sortMode; + mTransformMatrix = transformMatrix; + mCommandList = commandList; + mSpriteCount = 0; + + if (sortMode == SpriteSortMode_Immediate) + { + PrepareForRendering(); + } + + mInBeginEndPair = true; +} + + +// Ends a batch of sprite drawing operations. +void SpriteBatch::Impl::End() +{ + if (!mInBeginEndPair) + throw std::exception("Begin must be called before End"); + + if (mSortMode != SpriteSortMode_Immediate) + { + PrepareForRendering(); + FlushBatch(); + } + + // Release this memory + mVertexSegment.Reset(); + + // Break circular reference chains, in case the state lambda closed + // over an object that holds a reference to this SpriteBatch. + mCommandList = nullptr; + mInBeginEndPair = false; +} + + +// Adds a single sprite to the queue. +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Impl::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + FXMVECTOR destination, + RECT const* sourceRectangle, + FXMVECTOR color, + FXMVECTOR originRotationDepth, + int flags) +{ + if (!mInBeginEndPair) + throw std::exception("Begin must be called before Draw"); + + // Get a pointer to the output sprite. + if (mSpriteQueueCount >= mSpriteQueueArraySize) + { + GrowSpriteQueue(); + } + + SpriteInfo* sprite = &mSpriteQueue[mSpriteQueueCount]; + + XMVECTOR dest = destination; + + if (sourceRectangle) + { + // User specified an explicit source region. + XMVECTOR source = LoadRect(sourceRectangle); + + XMStoreFloat4A(&sprite->source, source); + + // If the destination size is relative to the source region, convert it to pixels. + if (!(flags & SpriteInfo::DestSizeInPixels)) + { + dest = XMVectorPermute<0, 1, 6, 7>(dest, dest * source); // dest.zw *= source.zw + } + + flags |= SpriteInfo::SourceInTexels | SpriteInfo::DestSizeInPixels; + } + else + { + // No explicit source region, so use the entire texture. + static const XMVECTORF32 wholeTexture = {0, 0, 1, 1}; + + XMStoreFloat4A(&sprite->source, wholeTexture); + } + + // Convert texture size + XMVECTOR textureSizeV = XMLoadUInt2(&textureSize); + + // Store sprite parameters. + XMStoreFloat4A(&sprite->destination, dest); + XMStoreFloat4A(&sprite->color, color); + XMStoreFloat4A(&sprite->originRotationDepth, originRotationDepth); + + sprite->texture = texture; + sprite->textureSize = textureSizeV; + sprite->flags = flags; + + if (mSortMode == SpriteSortMode_Immediate) + { + // If we are in immediate mode, draw this sprite straight away. + RenderBatch(texture, textureSizeV, &sprite, 1); + } + else + { + // Queue this sprite for later sorting and batched rendering. + mSpriteQueueCount++; + } +} + + +// Dynamically expands the array used to store pending sprite information. +void SpriteBatch::Impl::GrowSpriteQueue() +{ + // Grow by a factor of 2. + size_t newSize = std::max(InitialQueueSize, mSpriteQueueArraySize * 2); + + // Allocate the new array. + std::unique_ptr newArray(new SpriteInfo[newSize]); + + // Copy over any existing sprites. + for (size_t i = 0; i < mSpriteQueueCount; i++) + { + newArray[i] = mSpriteQueue[i]; + } + + // Replace the previous array with the new one. + mSpriteQueue = std::move(newArray); + mSpriteQueueArraySize = newSize; + + // Clear any dangling SpriteInfo pointers left over from previous rendering. + mSortedSprites.clear(); +} + + +// Sets up D3D device state ready for drawing sprites. +void SpriteBatch::Impl::PrepareForRendering() +{ + auto commandList = mCommandList.Get(); + + // Set root signature + commandList->SetGraphicsRootSignature(mRootSignature.Get()); + + // Set render state + commandList->SetPipelineState(mPSO.Get()); + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + + // Set the index buffer. + commandList->IASetIndexBuffer(&mDeviceResources->indexBufferView); + + // Set the transform matrix. + XMMATRIX transformMatrix = (mRotation == DXGI_MODE_ROTATION_UNSPECIFIED) + ? mTransformMatrix + : (mTransformMatrix * GetViewportTransform(mRotation)); + + mConstantBuffer = GraphicsMemory::Get().AllocateConstant(transformMatrix); + commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, mConstantBuffer.GpuAddress()); +} + + +// Sends queued sprites to the graphics device. +void SpriteBatch::Impl::FlushBatch() +{ + if (!mSpriteQueueCount) + return; + + SortSprites(); + + // Walk through the sorted sprite list, looking for adjacent entries that share a texture. + D3D12_GPU_DESCRIPTOR_HANDLE batchTexture = {}; + XMVECTOR batchTextureSize = {}; + size_t batchStart = 0; + + for (size_t pos = 0; pos < mSpriteQueueCount; pos++) + { + D3D12_GPU_DESCRIPTOR_HANDLE texture = mSortedSprites[pos]->texture; + XMVECTOR textureSize = mSortedSprites[pos]->textureSize; + + // Flush whenever the texture changes. + if (texture != batchTexture) + { + if (pos > batchStart) + { + RenderBatch(batchTexture, batchTextureSize, &mSortedSprites[batchStart], pos - batchStart); + } + + batchTexture = texture; + batchTextureSize = textureSize; + batchStart = pos; + } + } + + // Flush the final batch. + RenderBatch(batchTexture, batchTextureSize, &mSortedSprites[batchStart], mSpriteQueueCount - batchStart); + + // Reset the queue. + mSpriteQueueCount = 0; + + // When sorting is disabled, we persist mSortedSprites data from one batch to the next, to avoid + // uneccessary work in GrowSortedSprites. But we never reuse these when sorting, because re-sorting + // previously sorted items gives unstable ordering if some sprites have identical sort keys. + if (mSortMode != SpriteSortMode_Deferred) + { + mSortedSprites.clear(); + } +} + + +// Sorts the array of queued sprites. +void SpriteBatch::Impl::SortSprites() +{ + // Fill the mSortedSprites vector. + if (mSortedSprites.size() < mSpriteQueueCount) + { + GrowSortedSprites(); + } + + switch (mSortMode) + { + case SpriteSortMode_Texture: + // Sort by texture. + std::sort(mSortedSprites.begin(), mSortedSprites.begin() + mSpriteQueueCount, [] (SpriteInfo const* x, SpriteInfo const* y) -> bool + { + return x->texture < y->texture; + }); + break; + + case SpriteSortMode_BackToFront: + // Sort back to front. + std::sort(mSortedSprites.begin(), mSortedSprites.begin() + mSpriteQueueCount, [] (SpriteInfo const* x, SpriteInfo const* y) -> bool + { + return x->originRotationDepth.w > y->originRotationDepth.w; + }); + break; + + case SpriteSortMode_FrontToBack: + // Sort front to back. + std::sort(mSortedSprites.begin(), mSortedSprites.begin() + mSpriteQueueCount, [] (SpriteInfo const* x, SpriteInfo const* y) -> bool + { + return x->originRotationDepth.w < y->originRotationDepth.w; + }); + break; + } +} + + +// Populates the mSortedSprites vector with pointers to individual elements of the mSpriteQueue array. +void SpriteBatch::Impl::GrowSortedSprites() +{ + size_t previousSize = mSortedSprites.size(); + + mSortedSprites.resize(mSpriteQueueCount); + + for (size_t i = previousSize; i < mSpriteQueueCount; i++) + { + mSortedSprites[i] = &mSpriteQueue[i]; + } +} + + +// Submits a batch of sprites to the GPU. +_Use_decl_annotations_ +void SpriteBatch::Impl::RenderBatch(D3D12_GPU_DESCRIPTOR_HANDLE texture, XMVECTOR textureSize, SpriteInfo const* const* sprites, size_t count) +{ + auto commandList = mCommandList.Get(); + + // Draw using the specified texture. + commandList->SetGraphicsRootDescriptorTable(RootParameterIndex::TextureSRV, texture); + + // Convert to vector format. + XMVECTOR inverseTextureSize = XMVectorReciprocal(textureSize); + + while (count > 0) + { + // How many sprites do we want to draw? + size_t batchSize = count; + + // How many sprites does the D3D vertex buffer have room for? + size_t remainingSpace = MaxBatchSize - mSpriteCount; + + if (batchSize > remainingSpace) + { + if (remainingSpace < MinBatchSize) + { + // If we are out of room, or about to submit an excessively small batch, wrap back to the start of the vertex buffer. + mSpriteCount = 0; + + batchSize = std::min(count, MaxBatchSize); + } + else + { + // Take however many sprites fit in what's left of the vertex buffer. + batchSize = remainingSpace; + } + } + + // Allocate a new page of vertex memory if we're starting the batch + if (mSpriteCount == 0) + { + mVertexSegment = GraphicsMemory::Get().Allocate(mVertexPageSize); + } + + auto vertices = static_cast(mVertexSegment.Memory()) + mSpriteCount * VerticesPerSprite; + + // Generate sprite vertex data. + for (size_t i = 0; i < batchSize; i++) + { + assert(i < count); + _Analysis_assume_(i < count); + RenderSprite(sprites[i], vertices, textureSize, inverseTextureSize); + + vertices += VerticesPerSprite; + } + + // Set the vertex buffer view + D3D12_VERTEX_BUFFER_VIEW vbv; + size_t spriteVertexTotalSize = sizeof(VertexPositionColorTexture) * VerticesPerSprite; + vbv.BufferLocation = mVertexSegment.GpuAddress() + mSpriteCount * spriteVertexTotalSize; + vbv.StrideInBytes = sizeof(VertexPositionColorTexture); + vbv.SizeInBytes = (UINT) (batchSize * spriteVertexTotalSize); + commandList->IASetVertexBuffers(0, 1, &vbv); + + // Ok lads, the time has come for us draw ourselves some sprites! + UINT indexCount = (UINT) batchSize * IndicesPerSprite; + + commandList->DrawIndexedInstanced(indexCount, 1, 0, 0, 0); + + // Advance the buffer position. + mSpriteCount += batchSize; + + sprites += batchSize; + count -= batchSize; + } +} + + +// Generates vertex data for drawing a single sprite. +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Impl::RenderSprite(SpriteInfo const* sprite, VertexPositionColorTexture* vertices, FXMVECTOR textureSize, FXMVECTOR inverseTextureSize) +{ + // Load sprite parameters into SIMD registers. + XMVECTOR source = XMLoadFloat4A(&sprite->source); + XMVECTOR destination = XMLoadFloat4A(&sprite->destination); + XMVECTOR color = XMLoadFloat4A(&sprite->color); + XMVECTOR originRotationDepth = XMLoadFloat4A(&sprite->originRotationDepth); + + float rotation = sprite->originRotationDepth.z; + int flags = sprite->flags; + + // Extract the source and destination sizes into separate vectors. + XMVECTOR sourceSize = XMVectorSwizzle<2, 3, 2, 3>(source); + XMVECTOR destinationSize = XMVectorSwizzle<2, 3, 2, 3>(destination); + + // Scale the origin offset by source size, taking care to avoid overflow if the source region is zero. + XMVECTOR isZeroMask = XMVectorEqual(sourceSize, XMVectorZero()); + XMVECTOR nonZeroSourceSize = XMVectorSelect(sourceSize, g_XMEpsilon, isZeroMask); + + XMVECTOR origin = XMVectorDivide(originRotationDepth, nonZeroSourceSize); + + // Convert the source region from texels to mod-1 texture coordinate format. + if (flags & SpriteInfo::SourceInTexels) + { + source *= inverseTextureSize; + sourceSize *= inverseTextureSize; + } + else + { + origin *= inverseTextureSize; + } + + // If the destination size is relative to the source region, convert it to pixels. + if (!(flags & SpriteInfo::DestSizeInPixels)) + { + destinationSize *= textureSize; + } + + // Compute a 2x2 rotation matrix. + XMVECTOR rotationMatrix1; + XMVECTOR rotationMatrix2; + + if (rotation != 0) + { + float sin, cos; + + XMScalarSinCos(&sin, &cos, rotation); + + XMVECTOR sinV = XMLoadFloat(&sin); + XMVECTOR cosV = XMLoadFloat(&cos); + + rotationMatrix1 = XMVectorMergeXY(cosV, sinV); + rotationMatrix2 = XMVectorMergeXY(-sinV, cosV); + } + else + { + rotationMatrix1 = g_XMIdentityR0; + rotationMatrix2 = g_XMIdentityR1; + } + + // The four corner vertices are computed by transforming these unit-square positions. + static XMVECTORF32 cornerOffsets[VerticesPerSprite] = + { + { 0, 0 }, + { 1, 0 }, + { 0, 1 }, + { 1, 1 }, + }; + + // Tricksy alert! Texture coordinates are computed from the same cornerOffsets + // table as vertex positions, but if the sprite is mirrored, this table + // must be indexed in a different order. This is done as follows: + // + // position = cornerOffsets[i] + // texcoord = cornerOffsets[i ^ SpriteEffects] + + static_assert(SpriteEffects_FlipHorizontally == 1 && + SpriteEffects_FlipVertically == 2, "If you change these enum values, the mirroring implementation must be updated to match"); + + int mirrorBits = flags & 3; + + // Generate the four output vertices. + for (int i = 0; i < VerticesPerSprite; i++) + { + // Calculate position. + XMVECTOR cornerOffset = (cornerOffsets[i] - origin) * destinationSize; + + // Apply 2x2 rotation matrix. + XMVECTOR position1 = XMVectorMultiplyAdd(XMVectorSplatX(cornerOffset), rotationMatrix1, destination); + XMVECTOR position2 = XMVectorMultiplyAdd(XMVectorSplatY(cornerOffset), rotationMatrix2, position1); + + // Set z = depth. + XMVECTOR position = XMVectorPermute<0, 1, 7, 6>(position2, originRotationDepth); + + // Write position as a Float4, even though VertexPositionColor::position is an XMFLOAT3. + // This is faster, and harmless as we are just clobbering the first element of the + // following color field, which will immediately be overwritten with its correct value. + XMStoreFloat4(reinterpret_cast(&vertices[i].position), position); + + // Write the color. + XMStoreFloat4(&vertices[i].color, color); + + // Compute and write the texture coordinate. + XMVECTOR textureCoordinate = XMVectorMultiplyAdd(cornerOffsets[i ^ mirrorBits], sourceSize, source); + + XMStoreFloat2(&vertices[i].textureCoordinate, textureCoordinate); + } +} + + +// Generates a viewport transform matrix for rendering sprites using x-right y-down screen pixel coordinates. +XMMATRIX SpriteBatch::Impl::GetViewportTransform(_In_ DXGI_MODE_ROTATION rotation) +{ + if (!mSetViewport) + throw std::exception("Viewport not set."); + + // Compute the matrix. + float xScale = (mViewPort.Width > 0) ? 2.0f / mViewPort.Width : 0.0f; + float yScale = (mViewPort.Height > 0) ? 2.0f / mViewPort.Height : 0.0f; + + switch (rotation) + { + case DXGI_MODE_ROTATION_ROTATE90: + return XMMATRIX + ( + 0, -yScale, 0, 0, + -xScale, 0, 0, 0, + 0, 0, 1, 0, + 1, 1, 0, 1 + ); + + case DXGI_MODE_ROTATION_ROTATE270: + return XMMATRIX + ( + 0, yScale, 0, 0, + xScale, 0, 0, 0, + 0, 0, 1, 0, + -1, -1, 0, 1 + ); + + case DXGI_MODE_ROTATION_ROTATE180: + return XMMATRIX + ( + -xScale, 0, 0, 0, + 0, yScale, 0, 0, + 0, 0, 1, 0, + 1, -1, 0, 1 + ); + + default: + return XMMATRIX + ( + xScale, 0, 0, 0, + 0, -yScale, 0, 0, + 0, 0, 1, 0, + -1, 1, 0, 1 + ); + } +} + + +// Public constructor. +_Use_decl_annotations_ +SpriteBatch::SpriteBatch(ID3D12Device* device, + ResourceUploadBatch& upload, + const SpriteBatchPipelineStateDescription* psoDesc, + const D3D12_VIEWPORT* viewport) + : pImpl(new Impl(device, upload, psoDesc, viewport)) +{ +} + + +// Move constructor. +SpriteBatch::SpriteBatch(SpriteBatch&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +SpriteBatch& SpriteBatch::operator= (SpriteBatch&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +SpriteBatch::~SpriteBatch() +{ +} + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Begin( + ID3D12GraphicsCommandList* commandList, + SpriteSortMode sortMode, + FXMMATRIX transformMatrix) +{ + pImpl->Begin( + commandList, + sortMode, + transformMatrix); +} + + +void SpriteBatch::End() +{ + pImpl->End(); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + XMFLOAT2 const& position, + FXMVECTOR color) +{ + XMVECTOR destination = XMVectorPermute<0, 1, 4, 5>(XMLoadFloat2(&position), g_XMOne); // x, y, 1, 1 + + pImpl->Draw(texture, textureSize, destination, nullptr, color, g_XMZero, 0); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + XMFLOAT2 const& position, + RECT const* sourceRectangle, + FXMVECTOR color, + float rotation, + XMFLOAT2 const& origin, + float scale, + SpriteEffects effects, + float layerDepth) +{ + XMVECTOR destination = XMVectorPermute<0, 1, 4, 4>(XMLoadFloat2(&position), XMLoadFloat(&scale)); // x, y, scale, scale + + XMVECTOR originRotationDepth = XMVectorSet(origin.x, origin.y, rotation, layerDepth); + + pImpl->Draw(texture, textureSize, destination, sourceRectangle, color, originRotationDepth, effects); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + XMFLOAT2 const& position, + RECT const* sourceRectangle, + FXMVECTOR color, + float rotation, + XMFLOAT2 const& origin, + XMFLOAT2 const& scale, + SpriteEffects effects, + float layerDepth) +{ + XMVECTOR destination = XMVectorPermute<0, 1, 4, 5>(XMLoadFloat2(&position), XMLoadFloat2(&scale)); // x, y, scale.x, scale.y + + XMVECTOR originRotationDepth = XMVectorSet(origin.x, origin.y, rotation, layerDepth); + + pImpl->Draw(texture, textureSize, destination, sourceRectangle, color, originRotationDepth, effects); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, XMUINT2 textureSize, FXMVECTOR position, FXMVECTOR color) +{ + XMVECTOR destination = XMVectorPermute<0, 1, 4, 5>(position, g_XMOne); // x, y, 1, 1 + + pImpl->Draw(texture, textureSize, destination, nullptr, color, g_XMZero, 0); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + FXMVECTOR position, + RECT const* sourceRectangle, + FXMVECTOR color, + float rotation, + FXMVECTOR origin, + float scale, + SpriteEffects effects, + float layerDepth) +{ + XMVECTOR destination = XMVectorPermute<0, 1, 4, 4>(position, XMLoadFloat(&scale)); // x, y, scale, scale + + XMVECTOR rotationDepth = XMVectorMergeXY(XMVectorReplicate(rotation), XMVectorReplicate(layerDepth)); + + XMVECTOR originRotationDepth = XMVectorPermute<0, 1, 4, 5>(origin, rotationDepth); + + pImpl->Draw(texture, textureSize, destination, sourceRectangle, color, originRotationDepth, effects); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + FXMVECTOR position, + RECT const* sourceRectangle, + FXMVECTOR color, + float rotation, + FXMVECTOR origin, + GXMVECTOR scale, + SpriteEffects effects, + float layerDepth) +{ + XMVECTOR destination = XMVectorPermute<0, 1, 4, 5>(position, scale); // x, y, scale.x, scale.y + + XMVECTOR rotationDepth = XMVectorMergeXY(XMVectorReplicate(rotation), XMVectorReplicate(layerDepth)); + + XMVECTOR originRotationDepth = XMVectorPermute<0, 1, 4, 5>(origin, rotationDepth); + + pImpl->Draw(texture, textureSize, destination, sourceRectangle, color, originRotationDepth, effects); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + RECT const& destinationRectangle, + FXMVECTOR color) +{ + XMVECTOR destination = LoadRect(&destinationRectangle); // x, y, w, h + + pImpl->Draw(texture, textureSize, destination, nullptr, color, g_XMZero, Impl::SpriteInfo::DestSizeInPixels); +} + + +_Use_decl_annotations_ +void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, + XMUINT2 textureSize, + RECT const& destinationRectangle, + RECT const* sourceRectangle, + FXMVECTOR color, + float rotation, + XMFLOAT2 const& origin, + SpriteEffects effects, + float layerDepth) +{ + XMVECTOR destination = LoadRect(&destinationRectangle); // x, y, w, h + + XMVECTOR originRotationDepth = XMVectorSet(origin.x, origin.y, rotation, layerDepth); + + pImpl->Draw(texture, textureSize, destination, sourceRectangle, color, originRotationDepth, effects | Impl::SpriteInfo::DestSizeInPixels); +} + + +void SpriteBatch::SetRotation(DXGI_MODE_ROTATION mode) +{ + pImpl->mRotation = mode; +} + + +DXGI_MODE_ROTATION SpriteBatch::GetRotation() const +{ + return pImpl->mRotation; +} + + +void SpriteBatch::SetViewport(const D3D12_VIEWPORT& viewPort) +{ + pImpl->mSetViewport = true; + pImpl->mViewPort = viewPort; +} diff --git a/Kits/DirectXTK12/Src/SpriteFont.cpp b/Kits/DirectXTK12/Src/SpriteFont.cpp new file mode 100644 index 0000000000000000000000000000000000000000..07e2b4d3c989397fb189d38b2f0d92b9c34e2e89 --- /dev/null +++ b/Kits/DirectXTK12/Src/SpriteFont.cpp @@ -0,0 +1,532 @@ +//-------------------------------------------------------------------------------------- +// File: SpriteFont.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" + +#include +#include + +#include "SpriteFont.h" +#include "DirectXHelpers.h" +#include "BinaryReader.h" +#include "ResourceUploadBatch.h" +#include "DescriptorHeap.h" + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + + +// Internal SpriteFont implementation class. +class SpriteFont::Impl +{ +public: + Impl(_In_ ID3D12Device* device, + _In_ ResourceUploadBatch& upload, + _In_ BinaryReader* reader, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE cpuDesc, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE gpuDesc); + Impl(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, + _In_ XMUINT2 textureSize, + _In_reads_(glyphCount) Glyph const* glyphs, + _In_ size_t glyphCount, + _In_ float lineSpacing); + + Glyph const* FindGlyph(wchar_t character) const; + + void SetDefaultCharacter(wchar_t character); + + template + void ForEachGlyph(_In_z_ wchar_t const* text, TAction action) const; + + void CreateTextureResource(_In_ ID3D12Device* device, + _In_ ResourceUploadBatch& upload, + _In_ uint32_t width, _In_ uint32_t height, + _In_ DXGI_FORMAT format, + _In_ uint32_t stride, _In_ uint32_t rows, + _In_reads_(stride * rows) const uint8_t* data); + + // Fields. + ComPtr textureResource; + D3D12_GPU_DESCRIPTOR_HANDLE texture; + XMUINT2 textureSize; + std::vector glyphs; + Glyph const* defaultGlyph; + float lineSpacing; +}; + + +// Constants. +const XMFLOAT2 SpriteFont::Float2Zero(0, 0); + +static const char spriteFontMagic[] = "DXTKfont"; + + +// Comparison operators make our sorted glyph vector work with std::binary_search and lower_bound. +namespace DirectX +{ + static inline bool operator< (SpriteFont::Glyph const& left, SpriteFont::Glyph const& right) + { + return left.Character < right.Character; + } + + static inline bool operator< (wchar_t left, SpriteFont::Glyph const& right) + { + return left < right.Character; + } + + static inline bool operator< (SpriteFont::Glyph const& left, wchar_t right) + { + return left.Character < right; + } +} + + +// Reads a SpriteFont from the binary format created by the MakeSpriteFont utility. +_Use_decl_annotations_ +SpriteFont::Impl::Impl( + ID3D12Device* device, + ResourceUploadBatch& upload, + BinaryReader* reader, + D3D12_CPU_DESCRIPTOR_HANDLE cpuDesc, + D3D12_GPU_DESCRIPTOR_HANDLE gpuDesc) +{ + // Validate the header. + for (char const* magic = spriteFontMagic; *magic; magic++) + { + if (reader->Read() != *magic) + { + DebugTrace( "SpriteFont provided with an invalid .spritefont file\n" ); + throw std::exception("Not a MakeSpriteFont output binary"); + } + } + + // Read the glyph data. + auto glyphCount = reader->Read(); + auto glyphData = reader->ReadArray(glyphCount); + + glyphs.assign(glyphData, glyphData + glyphCount); + + // Read font properties. + lineSpacing = reader->Read(); + + SetDefaultCharacter((wchar_t)reader->Read()); + + // Read the texture data. + auto textureWidth = reader->Read(); + auto textureHeight = reader->Read(); + auto textureFormat = reader->Read(); + auto textureStride = reader->Read(); + auto textureRows = reader->Read(); + auto textureData = reader->ReadArray(textureStride * textureRows); + + // Create the D3D texture object. + CreateTextureResource( + device, upload, + textureWidth, textureHeight, + textureFormat, + textureStride, textureRows, + textureData ); + + // Create the shader resource view + CreateShaderResourceView( + device, textureResource.Get(), + cpuDesc, false); + + // Save off the GPU descriptor pointer and size. + texture = gpuDesc; + textureSize = XMUINT2(textureWidth, textureHeight); +} + + +// Constructs a SpriteFont from arbitrary user specified glyph data. +_Use_decl_annotations_ +SpriteFont::Impl::Impl(D3D12_GPU_DESCRIPTOR_HANDLE texture, XMUINT2 textureSize, Glyph const* glyphs, size_t glyphCount, float lineSpacing) + : texture(texture), + textureSize(textureSize), + glyphs(glyphs, glyphs + glyphCount), + lineSpacing(lineSpacing), + defaultGlyph(nullptr) +{ + if (!std::is_sorted(glyphs, glyphs + glyphCount)) + { + throw std::exception("Glyphs must be in ascending codepoint order"); + } +} + + +// Looks up the requested glyph, falling back to the default character if it is not in the font. +SpriteFont::Glyph const* SpriteFont::Impl::FindGlyph(wchar_t character) const +{ + auto glyph = std::lower_bound(glyphs.begin(), glyphs.end(), character); + + if (glyph != glyphs.end() && glyph->Character == character) + { + return &*glyph; + } + + if (defaultGlyph) + { + return defaultGlyph; + } + + DebugTrace( "SpriteFont encountered a character not in the font (%u, %C), and no default glyph was provided\n", character, character ); + throw std::exception("Character not in font"); +} + + +// Sets the missing-character fallback glyph. +void SpriteFont::Impl::SetDefaultCharacter(wchar_t character) +{ + defaultGlyph = nullptr; + + if (character) + { + defaultGlyph = FindGlyph(character); + } +} + + +// The core glyph layout algorithm, shared between DrawString and MeasureString. +template +void SpriteFont::Impl::ForEachGlyph(_In_z_ wchar_t const* text, TAction action) const +{ + float x = 0; + float y = 0; + + for (; *text; text++) + { + wchar_t character = *text; + + switch (character) + { + case '\r': + // Skip carriage returns. + continue; + + case '\n': + // New line. + x = 0; + y += lineSpacing; + break; + + default: + // Output this character. + auto glyph = FindGlyph(character); + + x += glyph->XOffset; + + if (x < 0) + x = 0; + + float advance = glyph->Subrect.right - glyph->Subrect.left + glyph->XAdvance; + + if ( !iswspace(character) + || ( ( glyph->Subrect.right - glyph->Subrect.left ) > 1 ) + || ( ( glyph->Subrect.bottom - glyph->Subrect.top ) > 1 ) ) + { + action(glyph, x, y, advance); + } + + x += advance; + break; + } + } +} + + +_Use_decl_annotations_ +void SpriteFont::Impl::CreateTextureResource( + ID3D12Device* device, + ResourceUploadBatch& upload, + uint32_t width, uint32_t height, + DXGI_FORMAT format, + uint32_t stride, uint32_t rows, + const uint8_t* data) +{ + D3D12_RESOURCE_DESC desc = {}; + desc.Width = static_cast(width); + desc.Height = static_cast(height); + desc.MipLevels = 1; + desc.DepthOrArraySize = 1; + desc.Format = format; + desc.Flags = D3D12_RESOURCE_FLAG_NONE; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + + CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + ThrowIfFailed(device->CreateCommittedResource( + &defaultHeapProperties, + D3D12_HEAP_FLAG_NONE, + &desc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(textureResource.ReleaseAndGetAddressOf()))); + + SetDebugObjectName(textureResource.Get(), L"SpriteFont:Texture"); + + D3D12_SUBRESOURCE_DATA subres = {}; + subres.pData = data; + subres.RowPitch = stride; + subres.SlicePitch = stride * rows; + + upload.Upload( + textureResource.Get(), + 0, + &subres, + 1); + + upload.Transition( + textureResource.Get(), + D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); +} + + +// Construct from a binary file created by the MakeSpriteFont utility. +_Use_decl_annotations_ +SpriteFont::SpriteFont(ID3D12Device* device, ResourceUploadBatch& upload, wchar_t const* fileName, D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptorDest) +{ + BinaryReader reader(fileName); + + pImpl = std::make_unique(device, upload, &reader, cpuDescriptorDest, gpuDescriptorDest); +} + + +// Construct from a binary blob created by the MakeSpriteFont utility and already loaded into memory. +_Use_decl_annotations_ +SpriteFont::SpriteFont(ID3D12Device* device, ResourceUploadBatch& upload, uint8_t const* dataBlob, size_t dataSize, D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptorDest) +{ + BinaryReader reader(dataBlob, dataSize); + + pImpl = std::make_unique(device, upload, &reader, cpuDescriptorDest, gpuDescriptorDest); +} + + +// Construct from arbitrary user specified glyph data (for those not using the MakeSpriteFont utility). +SpriteFont::SpriteFont(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, _In_ XMUINT2 textureSize, _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, _In_ float lineSpacing) + : pImpl(new Impl(texture, textureSize, glyphs, glyphCount, lineSpacing)) +{ +} + + +// Move constructor. +SpriteFont::SpriteFont(SpriteFont&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +SpriteFont& SpriteFont::operator= (SpriteFont&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +SpriteFont::~SpriteFont() +{ +} + + +void XM_CALLCONV SpriteFont::DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, float scale, SpriteEffects effects, float layerDepth) const +{ + DrawString(spriteBatch, text, XMLoadFloat2(&position), color, rotation, XMLoadFloat2(&origin), XMVectorReplicate(scale), effects, layerDepth); +} + + +void XM_CALLCONV SpriteFont::DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects, float layerDepth) const +{ + DrawString(spriteBatch, text, XMLoadFloat2(&position), color, rotation, XMLoadFloat2(&origin), XMLoadFloat2(&scale), effects, layerDepth); +} + + +void XM_CALLCONV SpriteFont::DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, float scale, SpriteEffects effects, float layerDepth) const +{ + DrawString(spriteBatch, text, position, color, rotation, origin, XMVectorReplicate(scale), effects, layerDepth); +} + + +void XM_CALLCONV SpriteFont::DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects, float layerDepth) const +{ + static_assert(SpriteEffects_FlipHorizontally == 1 && + SpriteEffects_FlipVertically == 2, "If you change these enum values, the following tables must be updated to match"); + + // Lookup table indicates which way to move along each axis per SpriteEffects enum value. + static XMVECTORF32 axisDirectionTable[4] = + { + { -1, -1 }, + { 1, -1 }, + { -1, 1 }, + { 1, 1 }, + }; + + // Lookup table indicates which axes are mirrored for each SpriteEffects enum value. + static XMVECTORF32 axisIsMirroredTable[4] = + { + { 0, 0 }, + { 1, 0 }, + { 0, 1 }, + { 1, 1 }, + }; + + XMVECTOR baseOffset = origin; + + // If the text is mirrored, offset the start position accordingly. + if (effects) + { + baseOffset -= MeasureString(text) * axisIsMirroredTable[effects & 3]; + } + + // Draw each character in turn. + pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance) + { + UNREFERENCED_PARAMETER(advance); + + XMVECTOR offset = XMVectorMultiplyAdd(XMVectorSet(x, y + glyph->YOffset, 0, 0), axisDirectionTable[effects & 3], baseOffset); + + if (effects) + { + // For mirrored characters, specify bottom and/or right instead of top left. + XMVECTOR glyphRect = XMConvertVectorIntToFloat(XMLoadInt4(reinterpret_cast(&glyph->Subrect)), 0); + + // xy = glyph width/height. + glyphRect = XMVectorSwizzle<2, 3, 0, 1>(glyphRect) - glyphRect; + + offset = XMVectorMultiplyAdd(glyphRect, axisIsMirroredTable[effects & 3], offset); + } + + spriteBatch->Draw(pImpl->texture, pImpl->textureSize, position, &glyph->Subrect, color, rotation, offset, scale, effects, layerDepth); + }); +} + + +XMVECTOR XM_CALLCONV SpriteFont::MeasureString(_In_z_ wchar_t const* text) const +{ + XMVECTOR result = XMVectorZero(); + + pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance) + { + UNREFERENCED_PARAMETER(advance); + + float w = (float)(glyph->Subrect.right - glyph->Subrect.left); + float h = (float)(glyph->Subrect.bottom - glyph->Subrect.top) + glyph->YOffset; + + h = std::max(h, pImpl->lineSpacing); + + result = XMVectorMax(result, XMVectorSet(x + w, y + h, 0, 0)); + }); + + return result; +} + + +RECT SpriteFont::MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& position) const +{ + RECT result = { LONG_MAX, LONG_MAX, 0, 0 }; + + pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance) + { + float w = (float)(glyph->Subrect.right - glyph->Subrect.left); + float h = (float)(glyph->Subrect.bottom - glyph->Subrect.top); + + float minX = position.x + x; + float minY = position.y + y + glyph->YOffset; + + float maxX = std::max(minX + advance, minX + w); + float maxY = minY + h; + + if (minX < result.left) + result.left = long(minX); + + if (minY < result.top) + result.top = long(minY); + + if (result.right < maxX) + result.right = long(maxX); + + if (result.bottom < maxY) + result.bottom = long(maxY); + }); + + if (result.left == LONG_MAX) + { + result.left = 0; + result.top = 0; + } + + return result; +} + + +RECT XM_CALLCONV SpriteFont::MeasureDrawBounds(_In_z_ wchar_t const* text, FXMVECTOR position) const +{ + XMFLOAT2 pos; + XMStoreFloat2(&pos, position); + + return MeasureDrawBounds(text, pos); +} + + +// Spacing properties +float SpriteFont::GetLineSpacing() const +{ + return pImpl->lineSpacing; +} + + +void SpriteFont::SetLineSpacing(float spacing) +{ + pImpl->lineSpacing = spacing; +} + + +// Font properties +wchar_t SpriteFont::GetDefaultCharacter() const +{ + return pImpl->defaultGlyph ? (wchar_t)pImpl->defaultGlyph->Character : 0; +} + + +void SpriteFont::SetDefaultCharacter(wchar_t character) +{ + pImpl->SetDefaultCharacter(character); +} + + +bool SpriteFont::ContainsCharacter(wchar_t character) const +{ + return std::binary_search(pImpl->glyphs.begin(), pImpl->glyphs.end(), character); +} + + +// Custom layout/rendering +SpriteFont::Glyph const* SpriteFont::FindGlyph(wchar_t character) const +{ + return pImpl->FindGlyph(character); +} + + +D3D12_GPU_DESCRIPTOR_HANDLE SpriteFont::GetSpriteSheet() const +{ + return pImpl->texture; +} + + +XMUINT2 SpriteFont::GetSpriteSheetSize() const +{ + return pImpl->textureSize; +} diff --git a/Kits/DirectXTK12/Src/TeapotData.inc b/Kits/DirectXTK12/Src/TeapotData.inc new file mode 100644 index 0000000000000000000000000000000000000000..00def9c9228a62e5befb54df38cefeefe65c3bb2 --- /dev/null +++ b/Kits/DirectXTK12/Src/TeapotData.inc @@ -0,0 +1,185 @@ +//-------------------------------------------------------------------------------------- +// File: TeapotData.inc +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + + +// The teapot model consists of 10 bezier patches. Each patch has 16 control +// points, plus a flag indicating whether it should be mirrored in the Z axis +// as well as in X (all of the teapot is symmetrical from left to right, but +// only some parts are symmetrical from front to back). The control points +// are stored as integer indices into the TeapotControlPoints array. + +struct TeapotPatch +{ + bool mirrorZ; + int indices[16]; +}; + + +// Static data array defines the bezier patches that make up the teapot. +const TeapotPatch TeapotPatches[] = +{ + // Rim. + { true, { 102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } }, + + // Body. + { true, { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 } }, + { true, { 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 } }, + + // Lid. + { true, { 96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, 101, 0, 1, 2, 3 } }, + { true, { 0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117 } }, + + // Handle. + { false, { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 } }, + { false, { 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 65, 66, 67 } }, + + // Spout. + { false, { 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83 } }, + { false, { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 } }, + + // Bottom. + { true, { 118, 118, 118, 118, 124, 122, 119, 121, 123, 126, 125, 120, 40, 39, 38, 37 } }, +}; + + +// Static array defines the control point positions that make up the teapot. +const DirectX::XMVECTORF32 TeapotControlPoints[] = +{ + { 0, 0.345f, -0.05f }, + { -0.028f, 0.345f, -0.05f }, + { -0.05f, 0.345f, -0.028f }, + { -0.05f, 0.345f, -0 }, + { 0, 0.3028125f, -0.334375f }, + { -0.18725f, 0.3028125f, -0.334375f }, + { -0.334375f, 0.3028125f, -0.18725f }, + { -0.334375f, 0.3028125f, -0 }, + { 0, 0.3028125f, -0.359375f }, + { -0.20125f, 0.3028125f, -0.359375f }, + { -0.359375f, 0.3028125f, -0.20125f }, + { -0.359375f, 0.3028125f, -0 }, + { 0, 0.27f, -0.375f }, + { -0.21f, 0.27f, -0.375f }, + { -0.375f, 0.27f, -0.21f }, + { -0.375f, 0.27f, -0 }, + { 0, 0.13875f, -0.4375f }, + { -0.245f, 0.13875f, -0.4375f }, + { -0.4375f, 0.13875f, -0.245f }, + { -0.4375f, 0.13875f, -0 }, + { 0, 0.007499993f, -0.5f }, + { -0.28f, 0.007499993f, -0.5f }, + { -0.5f, 0.007499993f, -0.28f }, + { -0.5f, 0.007499993f, -0 }, + { 0, -0.105f, -0.5f }, + { -0.28f, -0.105f, -0.5f }, + { -0.5f, -0.105f, -0.28f }, + { -0.5f, -0.105f, -0 }, + { 0, -0.105f, 0.5f }, + { 0, -0.2175f, -0.5f }, + { -0.28f, -0.2175f, -0.5f }, + { -0.5f, -0.2175f, -0.28f }, + { -0.5f, -0.2175f, -0 }, + { 0, -0.27375f, -0.375f }, + { -0.21f, -0.27375f, -0.375f }, + { -0.375f, -0.27375f, -0.21f }, + { -0.375f, -0.27375f, -0 }, + { 0, -0.2925f, -0.375f }, + { -0.21f, -0.2925f, -0.375f }, + { -0.375f, -0.2925f, -0.21f }, + { -0.375f, -0.2925f, -0 }, + { 0, 0.17625f, 0.4f }, + { -0.075f, 0.17625f, 0.4f }, + { -0.075f, 0.2325f, 0.375f }, + { 0, 0.2325f, 0.375f }, + { 0, 0.17625f, 0.575f }, + { -0.075f, 0.17625f, 0.575f }, + { -0.075f, 0.2325f, 0.625f }, + { 0, 0.2325f, 0.625f }, + { 0, 0.17625f, 0.675f }, + { -0.075f, 0.17625f, 0.675f }, + { -0.075f, 0.2325f, 0.75f }, + { 0, 0.2325f, 0.75f }, + { 0, 0.12f, 0.675f }, + { -0.075f, 0.12f, 0.675f }, + { -0.075f, 0.12f, 0.75f }, + { 0, 0.12f, 0.75f }, + { 0, 0.06375f, 0.675f }, + { -0.075f, 0.06375f, 0.675f }, + { -0.075f, 0.007499993f, 0.75f }, + { 0, 0.007499993f, 0.75f }, + { 0, -0.04875001f, 0.625f }, + { -0.075f, -0.04875001f, 0.625f }, + { -0.075f, -0.09562501f, 0.6625f }, + { 0, -0.09562501f, 0.6625f }, + { -0.075f, -0.105f, 0.5f }, + { -0.075f, -0.18f, 0.475f }, + { 0, -0.18f, 0.475f }, + { 0, 0.02624997f, -0.425f }, + { -0.165f, 0.02624997f, -0.425f }, + { -0.165f, -0.18f, -0.425f }, + { 0, -0.18f, -0.425f }, + { 0, 0.02624997f, -0.65f }, + { -0.165f, 0.02624997f, -0.65f }, + { -0.165f, -0.12375f, -0.775f }, + { 0, -0.12375f, -0.775f }, + { 0, 0.195f, -0.575f }, + { -0.0625f, 0.195f, -0.575f }, + { -0.0625f, 0.17625f, -0.6f }, + { 0, 0.17625f, -0.6f }, + { 0, 0.27f, -0.675f }, + { -0.0625f, 0.27f, -0.675f }, + { -0.0625f, 0.27f, -0.825f }, + { 0, 0.27f, -0.825f }, + { 0, 0.28875f, -0.7f }, + { -0.0625f, 0.28875f, -0.7f }, + { -0.0625f, 0.2934375f, -0.88125f }, + { 0, 0.2934375f, -0.88125f }, + { 0, 0.28875f, -0.725f }, + { -0.0375f, 0.28875f, -0.725f }, + { -0.0375f, 0.298125f, -0.8625f }, + { 0, 0.298125f, -0.8625f }, + { 0, 0.27f, -0.7f }, + { -0.0375f, 0.27f, -0.7f }, + { -0.0375f, 0.27f, -0.8f }, + { 0, 0.27f, -0.8f }, + { 0, 0.4575f, -0 }, + { 0, 0.4575f, -0.2f }, + { -0.1125f, 0.4575f, -0.2f }, + { -0.2f, 0.4575f, -0.1125f }, + { -0.2f, 0.4575f, -0 }, + { 0, 0.3825f, -0 }, + { 0, 0.27f, -0.35f }, + { -0.196f, 0.27f, -0.35f }, + { -0.35f, 0.27f, -0.196f }, + { -0.35f, 0.27f, -0 }, + { 0, 0.3075f, -0.1f }, + { -0.056f, 0.3075f, -0.1f }, + { -0.1f, 0.3075f, -0.056f }, + { -0.1f, 0.3075f, -0 }, + { 0, 0.3075f, -0.325f }, + { -0.182f, 0.3075f, -0.325f }, + { -0.325f, 0.3075f, -0.182f }, + { -0.325f, 0.3075f, -0 }, + { 0, 0.27f, -0.325f }, + { -0.182f, 0.27f, -0.325f }, + { -0.325f, 0.27f, -0.182f }, + { -0.325f, 0.27f, -0 }, + { 0, -0.33f, -0 }, + { -0.1995f, -0.33f, -0.35625f }, + { 0, -0.31125f, -0.375f }, + { 0, -0.33f, -0.35625f }, + { -0.35625f, -0.33f, -0.1995f }, + { -0.375f, -0.31125f, -0 }, + { -0.35625f, -0.33f, -0 }, + { -0.21f, -0.31125f, -0.375f }, + { -0.375f, -0.31125f, -0.21f }, +}; diff --git a/Kits/DirectXTK12/Src/VertexTypes.cpp b/Kits/DirectXTK12/Src/VertexTypes.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5fbc9f6e51d4846a03639e509aaa0bb50a036822 --- /dev/null +++ b/Kits/DirectXTK12/Src/VertexTypes.cpp @@ -0,0 +1,166 @@ +//-------------------------------------------------------------------------------------- +// File: VertexTypes.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "VertexTypes.h" + +using namespace DirectX; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position information. +const D3D12_INPUT_ELEMENT_DESC VertexPosition::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert(sizeof(VertexPosition) == 12, "Vertex struct/layout mismatch"); + +const D3D12_INPUT_LAYOUT_DESC VertexPosition::InputLayout = +{ + VertexPosition::InputElements, + VertexPosition::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position and color information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionColor::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionColor) == 28, "Vertex struct/layout mismatch" ); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionColor::InputLayout = +{ + VertexPositionColor::InputElements, + VertexPositionColor::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position and texture mapping information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionTexture::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionTexture) == 20, "Vertex struct/layout mismatch" ); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionTexture::InputLayout = +{ + VertexPositionTexture::InputElements, + VertexPositionTexture::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position and dual texture mapping information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionDualTexture::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert(sizeof(VertexPositionDualTexture) == 28, "Vertex struct/layout mismatch"); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionDualTexture::InputLayout = +{ + VertexPositionDualTexture::InputElements, + VertexPositionDualTexture::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position and normal vector. +const D3D12_INPUT_ELEMENT_DESC VertexPositionNormal::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionNormal) == 24, "Vertex struct/layout mismatch" ); + + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position, color, and texture mapping information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionColorTexture::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionColorTexture) == 36, "Vertex struct/layout mismatch" ); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionColorTexture::InputLayout = +{ + VertexPositionColorTexture::InputElements, + VertexPositionColorTexture::InputElementCount +}; + + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position, normal vector, and color information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionNormalColor::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionNormalColor) == 40, "Vertex struct/layout mismatch" ); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionNormalColor::InputLayout = +{ + VertexPositionNormalColor::InputElements, + VertexPositionNormalColor::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position, normal vector, and texture mapping information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionNormalTexture::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionNormalTexture) == 32, "Vertex struct/layout mismatch" ); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionNormalTexture::InputLayout = +{ + VertexPositionNormalTexture::InputElements, + VertexPositionNormalTexture::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// Vertex struct holding position, normal vector, color, and texture mapping information. +const D3D12_INPUT_ELEMENT_DESC VertexPositionNormalColorTexture::InputElements[] = +{ + { "SV_Position", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, +}; + +static_assert( sizeof(VertexPositionNormalColorTexture) == 48, "Vertex struct/layout mismatch" ); + +const D3D12_INPUT_LAYOUT_DESC VertexPositionNormalColorTexture::InputLayout = +{ + VertexPositionNormalColorTexture::InputElements, + VertexPositionNormalColorTexture::InputElementCount +}; + +//-------------------------------------------------------------------------------------- +// VertexPositionNormalTangentColorTexture, VertexPositionNormalTangentColorTextureSkinning are not +// supported for DirectX 12 since they were only present for DGSL \ No newline at end of file diff --git a/Kits/DirectXTK12/Src/WICTextureLoader.cpp b/Kits/DirectXTK12/Src/WICTextureLoader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d8da4deddb2668c292d459cd4f93b4d17705f638 --- /dev/null +++ b/Kits/DirectXTK12/Src/WICTextureLoader.cpp @@ -0,0 +1,693 @@ +//-------------------------------------------------------------------------------------- +// File: WICTextureLoader.cpp +// +// Function for loading a WIC image and creating a Direct3D runtime texture for it +// (auto-generating mipmaps if possible) +// +// Note: Assumes application has already called CoInitializeEx +// +// Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for +// auto-gen mipmap support. +// +// Note these functions are useful for images created as simple 2D textures. For +// more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. +// For a full-featured DDS file reader, writer, and texture processing pipeline see +// the 'Texconv' sample and the 'DirectXTex' library. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +// We could load multi-frame images (TIFF/GIF) into a texture array. +// For now, we just load the first frame (note: DirectXTex supports multi-frame images) + +#include "pch.h" + +#include "WICTextureLoader.h" + +#include "DirectXHelpers.h" +#include "PlatformHelpers.h" +#include "LoaderHelpers.h" +#include "ResourceUploadBatch.h" + +namespace DirectX +{ + uint32_t CountMips(uint32_t width, uint32_t height); +} + +using namespace DirectX; +using Microsoft::WRL::ComPtr; + +namespace +{ + //------------------------------------------------------------------------------------- + // WIC Pixel Format Translation Data + //------------------------------------------------------------------------------------- + struct WICTranslate + { + GUID wic; + DXGI_FORMAT format; + }; + + WICTranslate g_WICFormats[] = + { + { GUID_WICPixelFormat128bppRGBAFloat, DXGI_FORMAT_R32G32B32A32_FLOAT }, + + { GUID_WICPixelFormat64bppRGBAHalf, DXGI_FORMAT_R16G16B16A16_FLOAT }, + { GUID_WICPixelFormat64bppRGBA, DXGI_FORMAT_R16G16B16A16_UNORM }, + + { GUID_WICPixelFormat32bppRGBA, DXGI_FORMAT_R8G8B8A8_UNORM }, + { GUID_WICPixelFormat32bppBGRA, DXGI_FORMAT_B8G8R8A8_UNORM }, // DXGI 1.1 + { GUID_WICPixelFormat32bppBGR, DXGI_FORMAT_B8G8R8X8_UNORM }, // DXGI 1.1 + + { GUID_WICPixelFormat32bppRGBA1010102XR, DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM }, // DXGI 1.1 + { GUID_WICPixelFormat32bppRGBA1010102, DXGI_FORMAT_R10G10B10A2_UNORM }, + + { GUID_WICPixelFormat16bppBGRA5551, DXGI_FORMAT_B5G5R5A1_UNORM }, + { GUID_WICPixelFormat16bppBGR565, DXGI_FORMAT_B5G6R5_UNORM }, + + { GUID_WICPixelFormat32bppGrayFloat, DXGI_FORMAT_R32_FLOAT }, + { GUID_WICPixelFormat16bppGrayHalf, DXGI_FORMAT_R16_FLOAT }, + { GUID_WICPixelFormat16bppGray, DXGI_FORMAT_R16_UNORM }, + { GUID_WICPixelFormat8bppGray, DXGI_FORMAT_R8_UNORM }, + + { GUID_WICPixelFormat8bppAlpha, DXGI_FORMAT_A8_UNORM }, + + { GUID_WICPixelFormat96bppRGBFloat, DXGI_FORMAT_R32G32B32_FLOAT }, // WIC 2 + }; + + //------------------------------------------------------------------------------------- + // WIC Pixel Format nearest conversion table + //------------------------------------------------------------------------------------- + + struct WICConvert + { + GUID source; + GUID target; + }; + + WICConvert g_WICConvert[] = + { + // Note target GUID in this conversion table must be one of those directly supported formats (above). + + { GUID_WICPixelFormatBlackWhite, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM + + { GUID_WICPixelFormat1bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat2bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat4bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat8bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + + { GUID_WICPixelFormat2bppGray, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM + { GUID_WICPixelFormat4bppGray, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM + + { GUID_WICPixelFormat16bppGrayFixedPoint, GUID_WICPixelFormat16bppGrayHalf }, // DXGI_FORMAT_R16_FLOAT + { GUID_WICPixelFormat32bppGrayFixedPoint, GUID_WICPixelFormat32bppGrayFloat }, // DXGI_FORMAT_R32_FLOAT + + { GUID_WICPixelFormat16bppBGR555, GUID_WICPixelFormat16bppBGRA5551 }, // DXGI_FORMAT_B5G5R5A1_UNORM + + { GUID_WICPixelFormat32bppBGR101010, GUID_WICPixelFormat32bppRGBA1010102 }, // DXGI_FORMAT_R10G10B10A2_UNORM + + { GUID_WICPixelFormat24bppBGR, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat24bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + + { GUID_WICPixelFormat48bppRGB, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + { GUID_WICPixelFormat48bppBGR, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + { GUID_WICPixelFormat64bppBGRA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + { GUID_WICPixelFormat64bppPRGBA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + { GUID_WICPixelFormat64bppPBGRA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + + { GUID_WICPixelFormat48bppRGBFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + { GUID_WICPixelFormat48bppBGRFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + { GUID_WICPixelFormat64bppRGBAFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + { GUID_WICPixelFormat64bppBGRAFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + { GUID_WICPixelFormat64bppRGBFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + { GUID_WICPixelFormat64bppRGBHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + { GUID_WICPixelFormat48bppRGBHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT + + { GUID_WICPixelFormat128bppPRGBAFloat, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT + { GUID_WICPixelFormat128bppRGBFloat, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT + { GUID_WICPixelFormat128bppRGBAFixedPoint, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT + { GUID_WICPixelFormat128bppRGBFixedPoint, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT + { GUID_WICPixelFormat32bppRGBE, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT + + { GUID_WICPixelFormat32bppCMYK, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM + { GUID_WICPixelFormat64bppCMYK, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + { GUID_WICPixelFormat40bppCMYKAlpha, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + { GUID_WICPixelFormat80bppCMYKAlpha, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM + + { GUID_WICPixelFormat32bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM (WIC2) + { GUID_WICPixelFormat64bppRGB, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM (WIC2) + { GUID_WICPixelFormat64bppPRGBAHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT (WIC2) + + { GUID_WICPixelFormat96bppRGBFixedPoint, GUID_WICPixelFormat96bppRGBFloat }, // DXGI_FORMAT_R32G32B32_FLOAT (WIC2) + + // We don't support n-channel formats + }; +} + +//-------------------------------------------------------------------------------------- +namespace DirectX +{ + IWICImagingFactory2* _GetWIC() + { + static IWICImagingFactory2* s_Factory = nullptr; + + if (s_Factory) + return s_Factory; + + HRESULT hr = CoCreateInstance( + CLSID_WICImagingFactory2, + nullptr, + CLSCTX_INPROC_SERVER, + IID_PPV_ARGS(&s_Factory)); + if (FAILED(hr)) + { + s_Factory = nullptr; + return nullptr; + } + return s_Factory; + } + +} // namespace DirectX + + +namespace +{ + //--------------------------------------------------------------------------------- + DXGI_FORMAT _WICToDXGI(const GUID& guid) + { + for (size_t i = 0; i < _countof(g_WICFormats); ++i) + { + if (memcmp(&g_WICFormats[i].wic, &guid, sizeof(GUID)) == 0) + return g_WICFormats[i].format; + } + + return DXGI_FORMAT_UNKNOWN; + } + + //--------------------------------------------------------------------------------- + size_t _WICBitsPerPixel(REFGUID targetGuid) + { + auto pWIC = _GetWIC(); + if (!pWIC) + return 0; + + ComPtr cinfo; + if (FAILED(pWIC->CreateComponentInfo(targetGuid, cinfo.GetAddressOf()))) + return 0; + + WICComponentType type; + if (FAILED(cinfo->GetComponentType(&type))) + return 0; + + if (type != WICPixelFormat) + return 0; + + ComPtr pfinfo; + if (FAILED(cinfo.As(&pfinfo))) + return 0; + + UINT bpp; + if (FAILED(pfinfo->GetBitsPerPixel(&bpp))) + return 0; + + return bpp; + } + + //--------------------------------------------------------------------------------- + HRESULT CreateTextureFromWIC(_In_ ID3D12Device* d3dDevice, + _In_ ResourceUploadBatch& resourceUpload, + _In_ IWICBitmapFrameDecode *frame, + _In_ size_t maxsize, + _In_ D3D12_RESOURCE_FLAGS flags, + _In_ bool forceSRGB, + _In_ bool generateMips, + _Outptr_ ID3D12Resource** texture) + { + UINT width, height; + HRESULT hr = frame->GetSize(&width, &height); + if (FAILED(hr)) + return hr; + + assert(width > 0 && height > 0); + + if (!maxsize) + { + maxsize = D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION; + } + + assert(maxsize > 0); + + UINT twidth, theight; + if (width > maxsize || height > maxsize) + { + float ar = static_cast(height) / static_cast(width); + if (width > height) + { + twidth = static_cast(maxsize); + theight = static_cast(static_cast(maxsize) * ar); + } + else + { + theight = static_cast(maxsize); + twidth = static_cast(static_cast(maxsize) / ar); + } + assert(twidth <= maxsize && theight <= maxsize); + } + else + { + twidth = width; + theight = height; + } + + // Determine format + WICPixelFormatGUID pixelFormat; + hr = frame->GetPixelFormat(&pixelFormat); + if (FAILED(hr)) + return hr; + + WICPixelFormatGUID convertGUID; + memcpy(&convertGUID, &pixelFormat, sizeof(WICPixelFormatGUID)); + + size_t bpp = 0; + + DXGI_FORMAT format = _WICToDXGI(pixelFormat); + if (format == DXGI_FORMAT_UNKNOWN) + { + for (size_t i = 0; i < _countof(g_WICConvert); ++i) + { + if (memcmp(&g_WICConvert[i].source, &pixelFormat, sizeof(WICPixelFormatGUID)) == 0) + { + memcpy(&convertGUID, &g_WICConvert[i].target, sizeof(WICPixelFormatGUID)); + + format = _WICToDXGI(g_WICConvert[i].target); + assert(format != DXGI_FORMAT_UNKNOWN); + bpp = _WICBitsPerPixel(convertGUID); + break; + } + } + + if (format == DXGI_FORMAT_UNKNOWN) + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + } + else + { + bpp = _WICBitsPerPixel(pixelFormat); + } + + if (!bpp) + return E_FAIL; + + // Handle sRGB formats + if (forceSRGB) + { + format = MakeSRGB(format); + } + else + { + ComPtr metareader; + if (SUCCEEDED(frame->GetMetadataQueryReader(metareader.GetAddressOf()))) + { + GUID containerFormat; + if (SUCCEEDED(metareader->GetContainerFormat(&containerFormat))) + { + // Check for sRGB colorspace metadata + bool sRGB = false; + + PROPVARIANT value; + PropVariantInit(&value); + + if (memcmp(&containerFormat, &GUID_ContainerFormatPng, sizeof(GUID)) == 0) + { + // Check for sRGB chunk + if (SUCCEEDED(metareader->GetMetadataByName(L"/sRGB/RenderingIntent", &value)) && value.vt == VT_UI1) + { + sRGB = true; + } + } +#if defined(_XBOX_ONE) && defined(_TITLE) + else if (memcmp(&containerFormat, &GUID_ContainerFormatJpeg, sizeof(GUID)) == 0) + { + if (SUCCEEDED(metareader->GetMetadataByName(L"/app1/ifd/exif/{ushort=40961}", &value)) && value.vt == VT_UI2 && value.uiVal == 1) + { + sRGB = true; + } + } + else if (memcmp(&containerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)) == 0) + { + if (SUCCEEDED(metareader->GetMetadataByName(L"/ifd/exif/{ushort=40961}", &value)) && value.vt == VT_UI2 && value.uiVal == 1) + { + sRGB = true; + } + } +#else + else if (SUCCEEDED(metareader->GetMetadataByName(L"System.Image.ColorSpace", &value)) && value.vt == VT_UI2 && value.uiVal == 1) + { + sRGB = true; + } +#endif + + PropVariantClear(&value); + + if (sRGB) + format = MakeSRGB(format); + } + } + } + + // Verify our target format is supported by the current device + // (handles WDDM 1.0 or WDDM 1.1 device driver cases as well as DirectX 11.0 Runtime without 16bpp format support) + D3D12_FEATURE_DATA_FORMAT_SUPPORT support = {}; + support.Format = format; + hr = d3dDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &support, sizeof(support)); + if (FAILED(hr) || !(support.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D)) + { + // Fallback to RGBA 32-bit format which is supported by all devices + memcpy(&convertGUID, &GUID_WICPixelFormat32bppRGBA, sizeof(WICPixelFormatGUID)); + format = DXGI_FORMAT_R8G8B8A8_UNORM; + bpp = 32; + } + + // Allocate temporary memory for image + size_t rowPitch = (twidth * bpp + 7) / 8; + size_t imageSize = rowPitch * theight; + + std::unique_ptr temp(new (std::nothrow) uint8_t[imageSize]); + if (!temp) + return E_OUTOFMEMORY; + + // Load image data + if (memcmp(&convertGUID, &pixelFormat, sizeof(GUID)) == 0 + && twidth == width + && theight == height) + { + // No format conversion or resize needed + hr = frame->CopyPixels(0, static_cast(rowPitch), static_cast(imageSize), temp.get()); + if (FAILED(hr)) + return hr; + } + else if (twidth != width || theight != height) + { + // Resize + auto pWIC = _GetWIC(); + if (!pWIC) + return E_NOINTERFACE; + + ComPtr scaler; + hr = pWIC->CreateBitmapScaler(scaler.GetAddressOf()); + if (FAILED(hr)) + return hr; + + hr = scaler->Initialize(frame, twidth, theight, WICBitmapInterpolationModeFant); + if (FAILED(hr)) + return hr; + + WICPixelFormatGUID pfScaler; + hr = scaler->GetPixelFormat(&pfScaler); + if (FAILED(hr)) + return hr; + + if (memcmp(&convertGUID, &pfScaler, sizeof(GUID)) == 0) + { + // No format conversion needed + hr = scaler->CopyPixels(0, static_cast(rowPitch), static_cast(imageSize), temp.get()); + if (FAILED(hr)) + return hr; + } + else + { + ComPtr FC; + hr = pWIC->CreateFormatConverter(FC.GetAddressOf()); + if (FAILED(hr)) + return hr; + + BOOL canConvert = FALSE; + hr = FC->CanConvert(pfScaler, convertGUID, &canConvert); + if (FAILED(hr) || !canConvert) + { + return E_UNEXPECTED; + } + + hr = FC->Initialize(scaler.Get(), convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom); + if (FAILED(hr)) + return hr; + + hr = FC->CopyPixels(0, static_cast(rowPitch), static_cast(imageSize), temp.get()); + if (FAILED(hr)) + return hr; + } + } + else + { + // Format conversion but no resize + auto pWIC = _GetWIC(); + if (!pWIC) + return E_NOINTERFACE; + + ComPtr FC; + hr = pWIC->CreateFormatConverter(FC.GetAddressOf()); + if (FAILED(hr)) + return hr; + + BOOL canConvert = FALSE; + hr = FC->CanConvert(pixelFormat, convertGUID, &canConvert); + if (FAILED(hr) || !canConvert) + { + return E_UNEXPECTED; + } + + hr = FC->Initialize(frame, convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom); + if (FAILED(hr)) + return hr; + + hr = FC->CopyPixels(0, static_cast(rowPitch), static_cast(imageSize), temp.get()); + if (FAILED(hr)) + return hr; + } + + // Count the number of mips + uint32_t mipCount = (generateMips) ? CountMips(twidth, theight) : 1; + + // Create texture + D3D12_RESOURCE_DESC desc = {}; + desc.Width = twidth; + desc.Height = theight; + desc.MipLevels = (uint16_t)mipCount; + desc.DepthOrArraySize = 1; + desc.Format = format; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Flags = flags; + desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + + CD3DX12_HEAP_PROPERTIES defaultHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + ID3D12Resource* tex = nullptr; + hr = d3dDevice->CreateCommittedResource( + &defaultHeapProperties, + D3D12_HEAP_FLAG_NONE, + &desc, + D3D12_RESOURCE_STATE_COPY_DEST, + nullptr, + IID_GRAPHICS_PPV_ARGS(&tex)); + + if (FAILED(hr)) + { + return hr; + } + + _Analysis_assume_(tex != 0); + + // Upload the texture data + D3D12_SUBRESOURCE_DATA initData; + initData.pData = temp.get(); + initData.RowPitch = static_cast(rowPitch); + initData.SlicePitch = static_cast(imageSize); + + resourceUpload.Upload( + tex, + 0, + &initData, + 1); + + resourceUpload.Transition( + tex, + D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + + // Generate mips? + if (generateMips) + { + resourceUpload.GenerateMips(tex); + } + + *texture = tex; + return hr; + } +} // anonymous namespace + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::CreateWICTextureFromMemory( ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const uint8_t* wicData, + size_t wicDataSize, + ID3D12Resource** texture, + bool generateMips, + size_t maxsize ) +{ + return CreateWICTextureFromMemoryEx( d3dDevice, resourceUpload, wicData, wicDataSize, maxsize, + D3D12_RESOURCE_FLAG_NONE, false, generateMips, + texture ); +} + + +_Use_decl_annotations_ +HRESULT DirectX::CreateWICTextureFromMemoryEx( ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const uint8_t* wicData, + size_t wicDataSize, + size_t maxsize, + D3D12_RESOURCE_FLAGS flags, + bool forceSRGB, + bool generateMips, + ID3D12Resource** texture ) +{ + if ( texture ) + { + *texture = nullptr; + } + + if (!d3dDevice || !wicData || !texture) + return E_INVALIDARG; + + if ( !wicDataSize ) + return E_FAIL; + +#ifdef _M_AMD64 + if ( wicDataSize > 0xFFFFFFFF ) + return HRESULT_FROM_WIN32( ERROR_FILE_TOO_LARGE ); +#endif + + auto pWIC = _GetWIC(); + if ( !pWIC ) + return E_NOINTERFACE; + + // Create input stream for memory + ComPtr stream; + HRESULT hr = pWIC->CreateStream( stream.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + hr = stream->InitializeFromMemory( const_cast( wicData ), static_cast( wicDataSize ) ); + if ( FAILED(hr) ) + return hr; + + // Initialize WIC + ComPtr decoder; + hr = pWIC->CreateDecoderFromStream( stream.Get(), 0, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + ComPtr frame; + hr = decoder->GetFrame( 0, frame.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + hr = CreateTextureFromWIC( d3dDevice, resourceUpload, + frame.Get(), maxsize, + flags, forceSRGB, + generateMips, texture ); + if ( FAILED(hr)) + return hr; + + _Analysis_assume_(*texture != nullptr); + SetDebugObjectName(*texture, L"WICTextureLoader"); + + return hr; +} + +//-------------------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT DirectX::CreateWICTextureFromFile( ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const wchar_t* fileName, + ID3D12Resource** texture, + bool generateMips, + size_t maxsize ) +{ + return CreateWICTextureFromFileEx( d3dDevice, resourceUpload, fileName, maxsize, + D3D12_RESOURCE_FLAG_NONE, false, generateMips, + texture ); +} + + +_Use_decl_annotations_ +HRESULT DirectX::CreateWICTextureFromFileEx( ID3D12Device* d3dDevice, + ResourceUploadBatch& resourceUpload, + const wchar_t* fileName, + size_t maxsize, + D3D12_RESOURCE_FLAGS flags, + bool forceSRGB, + bool generateMips, + ID3D12Resource** texture ) +{ + if ( texture ) + { + *texture = nullptr; + } + + if (!d3dDevice || !fileName || !texture ) + return E_INVALIDARG; + + auto pWIC = _GetWIC(); + if ( !pWIC ) + return E_NOINTERFACE; + + // Initialize WIC + ComPtr decoder; + HRESULT hr = pWIC->CreateDecoderFromFilename( fileName, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + ComPtr frame; + hr = decoder->GetFrame( 0, frame.GetAddressOf() ); + if ( FAILED(hr) ) + return hr; + + hr = CreateTextureFromWIC( d3dDevice, resourceUpload, + frame.Get(), maxsize, + flags, forceSRGB, + generateMips, texture ); + +#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) + if ( SUCCEEDED(hr) ) + { + const wchar_t* pstrName = wcsrchr(fileName, '\\' ); + if (!pstrName) + { + pstrName = fileName; + } + else + { + pstrName++; + } + + if (texture != 0 && *texture != 0) + { + (*texture)->SetName(pstrName); + } + } +#endif + + return hr; +} + diff --git a/Kits/DirectXTK12/Src/d3dx12.h b/Kits/DirectXTK12/Src/d3dx12.h new file mode 100644 index 0000000000000000000000000000000000000000..82f35e76d3d7c322471d85f7becc4e826638e1fa --- /dev/null +++ b/Kits/DirectXTK12/Src/d3dx12.h @@ -0,0 +1,1534 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#ifndef __D3DX12_H__ +#define __D3DX12_H__ + +#include + +#if defined( __cplusplus ) + +struct CD3DX12_DEFAULT {}; +extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT; + +//------------------------------------------------------------------------------------------------ +inline bool operator==( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ + return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && + l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; +} + +//------------------------------------------------------------------------------------------------ +inline bool operator!=( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RECT : public D3D12_RECT +{ + CD3DX12_RECT() + {} + explicit CD3DX12_RECT( const D3D12_RECT& o ) : + D3D12_RECT( o ) + {} + explicit CD3DX12_RECT( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + right = Right; + bottom = Bottom; + } + ~CD3DX12_RECT() {} + operator const D3D12_RECT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BOX : public D3D12_BOX +{ + CD3DX12_BOX() + {} + explicit CD3DX12_BOX( const D3D12_BOX& o ) : + D3D12_BOX( o ) + {} + explicit CD3DX12_BOX( + LONG Left, + LONG Right ) + { + left = Left; + top = 0; + front = 0; + right = Right; + bottom = 1; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + front = 0; + right = Right; + bottom = Bottom; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Front, + LONG Right, + LONG Bottom, + LONG Back ) + { + left = Left; + top = Top; + front = Front; + right = Right; + bottom = Bottom; + back = Back; + } + ~CD3DX12_BOX() {} + operator const D3D12_BOX&() const { return *this; } +}; +inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r ) +{ + return l.left == r.left && l.top == r.top && l.front == r.front && + l.right == r.right && l.bottom == r.bottom && l.back == r.back; +} +inline bool operator!=( const D3D12_BOX& l, const D3D12_BOX& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC +{ + CD3DX12_DEPTH_STENCIL_DESC() + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( const D3D12_DEPTH_STENCIL_DESC& o ) : + D3D12_DEPTH_STENCIL_DESC( o ) + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( CD3DX12_DEFAULT ) + { + DepthEnable = TRUE; + DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; + DepthFunc = D3D12_COMPARISON_FUNC_LESS; + StencilEnable = FALSE; + StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK; + StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK; + const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = + { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS }; + FrontFace = defaultStencilOp; + BackFace = defaultStencilOp; + } + explicit CD3DX12_DEPTH_STENCIL_DESC( + BOOL depthEnable, + D3D12_DEPTH_WRITE_MASK depthWriteMask, + D3D12_COMPARISON_FUNC depthFunc, + BOOL stencilEnable, + UINT8 stencilReadMask, + UINT8 stencilWriteMask, + D3D12_STENCIL_OP frontStencilFailOp, + D3D12_STENCIL_OP frontStencilDepthFailOp, + D3D12_STENCIL_OP frontStencilPassOp, + D3D12_COMPARISON_FUNC frontStencilFunc, + D3D12_STENCIL_OP backStencilFailOp, + D3D12_STENCIL_OP backStencilDepthFailOp, + D3D12_STENCIL_OP backStencilPassOp, + D3D12_COMPARISON_FUNC backStencilFunc ) + { + DepthEnable = depthEnable; + DepthWriteMask = depthWriteMask; + DepthFunc = depthFunc; + StencilEnable = stencilEnable; + StencilReadMask = stencilReadMask; + StencilWriteMask = stencilWriteMask; + FrontFace.StencilFailOp = frontStencilFailOp; + FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; + FrontFace.StencilPassOp = frontStencilPassOp; + FrontFace.StencilFunc = frontStencilFunc; + BackFace.StencilFailOp = backStencilFailOp; + BackFace.StencilDepthFailOp = backStencilDepthFailOp; + BackFace.StencilPassOp = backStencilPassOp; + BackFace.StencilFunc = backStencilFunc; + } + ~CD3DX12_DEPTH_STENCIL_DESC() {} + operator const D3D12_DEPTH_STENCIL_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC +{ + CD3DX12_BLEND_DESC() + {} + explicit CD3DX12_BLEND_DESC( const D3D12_BLEND_DESC& o ) : + D3D12_BLEND_DESC( o ) + {} + explicit CD3DX12_BLEND_DESC( CD3DX12_DEFAULT ) + { + AlphaToCoverageEnable = FALSE; + IndependentBlendEnable = FALSE; + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + FALSE,FALSE, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + RenderTarget[ i ] = defaultRenderTargetBlendDesc; + } + ~CD3DX12_BLEND_DESC() {} + operator const D3D12_BLEND_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC +{ + CD3DX12_RASTERIZER_DESC() + {} + explicit CD3DX12_RASTERIZER_DESC( const D3D12_RASTERIZER_DESC& o ) : + D3D12_RASTERIZER_DESC( o ) + {} + explicit CD3DX12_RASTERIZER_DESC( CD3DX12_DEFAULT ) + { + FillMode = D3D12_FILL_MODE_SOLID; + CullMode = D3D12_CULL_MODE_BACK; + FrontCounterClockwise = FALSE; + DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + DepthClipEnable = TRUE; + MultisampleEnable = FALSE; + AntialiasedLineEnable = FALSE; + ForcedSampleCount = 0; + ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + } + explicit CD3DX12_RASTERIZER_DESC( + D3D12_FILL_MODE fillMode, + D3D12_CULL_MODE cullMode, + BOOL frontCounterClockwise, + INT depthBias, + FLOAT depthBiasClamp, + FLOAT slopeScaledDepthBias, + BOOL depthClipEnable, + BOOL multisampleEnable, + BOOL antialiasedLineEnable, + UINT forcedSampleCount, + D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) + { + FillMode = fillMode; + CullMode = cullMode; + FrontCounterClockwise = frontCounterClockwise; + DepthBias = depthBias; + DepthBiasClamp = depthBiasClamp; + SlopeScaledDepthBias = slopeScaledDepthBias; + DepthClipEnable = depthClipEnable; + MultisampleEnable = multisampleEnable; + AntialiasedLineEnable = antialiasedLineEnable; + ForcedSampleCount = forcedSampleCount; + ConservativeRaster = conservativeRaster; + } + ~CD3DX12_RASTERIZER_DESC() {} + operator const D3D12_RASTERIZER_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO +{ + CD3DX12_RESOURCE_ALLOCATION_INFO() + {} + explicit CD3DX12_RESOURCE_ALLOCATION_INFO( const D3D12_RESOURCE_ALLOCATION_INFO& o ) : + D3D12_RESOURCE_ALLOCATION_INFO( o ) + {} + CD3DX12_RESOURCE_ALLOCATION_INFO( + UINT64 size, + UINT64 alignment ) + { + SizeInBytes = size; + Alignment = alignment; + } + operator const D3D12_RESOURCE_ALLOCATION_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES +{ + CD3DX12_HEAP_PROPERTIES() + {} + explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES &o) : + D3D12_HEAP_PROPERTIES(o) + {} + CD3DX12_HEAP_PROPERTIES( + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = D3D12_HEAP_TYPE_CUSTOM; + CPUPageProperty = cpuPageProperty; + MemoryPoolPreference = memoryPoolPreference; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + explicit CD3DX12_HEAP_PROPERTIES( + D3D12_HEAP_TYPE type, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = type; + CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + operator const D3D12_HEAP_PROPERTIES&() const { return *this; } + bool IsCPUAccessible() const + { + return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK || (Type == D3D12_HEAP_TYPE_CUSTOM && + (CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE || CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK)); + } +}; +inline bool operator==( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ + return l.Type == r.Type && l.CPUPageProperty == r.CPUPageProperty && + l.MemoryPoolPreference == r.MemoryPoolPreference && + l.CreationNodeMask == r.CreationNodeMask && + l.VisibleNodeMask == r.VisibleNodeMask; +} +inline bool operator!=( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC +{ + CD3DX12_HEAP_DESC() + {} + explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC &o) : + D3D12_HEAP_DESC(o) + {} + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_PROPERTIES properties, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = properties; + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_TYPE type, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_PROPERTIES properties, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = properties; + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_TYPE type, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + operator const D3D12_HEAP_DESC&() const { return *this; } + bool IsCPUAccessible() const + { return static_cast< const CD3DX12_HEAP_PROPERTIES* >( &Properties )->IsCPUAccessible(); } +}; +inline bool operator==( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ + return l.SizeInBytes == r.SizeInBytes && + l.Properties == r.Properties && + l.Alignment == r.Alignment && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE +{ + CD3DX12_CLEAR_VALUE() + {} + explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE &o) : + D3D12_CLEAR_VALUE(o) + {} + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + const FLOAT color[4] ) + { + Format = format; + memcpy( Color, color, sizeof( Color ) ); + } + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + FLOAT depth, + UINT8 stencil ) + { + Format = format; + /* Use memcpy to preserve NAN values */ + memcpy( &DepthStencil.Depth, &depth, sizeof( depth ) ); + DepthStencil.Stencil = stencil; + } + operator const D3D12_CLEAR_VALUE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RANGE : public D3D12_RANGE +{ + CD3DX12_RANGE() + {} + explicit CD3DX12_RANGE(const D3D12_RANGE &o) : + D3D12_RANGE(o) + {} + CD3DX12_RANGE( + SIZE_T begin, + SIZE_T end ) + { + Begin = begin; + End = end; + } + operator const D3D12_RANGE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE +{ + CD3DX12_SHADER_BYTECODE() + {} + explicit CD3DX12_SHADER_BYTECODE(const D3D12_SHADER_BYTECODE &o) : + D3D12_SHADER_BYTECODE(o) + {} + CD3DX12_SHADER_BYTECODE( + ID3DBlob* pShaderBlob ) + { + pShaderBytecode = pShaderBlob->GetBufferPointer(); + BytecodeLength = pShaderBlob->GetBufferSize(); + } + CD3DX12_SHADER_BYTECODE( + void* _pShaderBytecode, + SIZE_T bytecodeLength ) + { + pShaderBytecode = _pShaderBytecode; + BytecodeLength = bytecodeLength; + } + operator const D3D12_SHADER_BYTECODE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE +{ + CD3DX12_TILED_RESOURCE_COORDINATE() + {} + explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE &o) : + D3D12_TILED_RESOURCE_COORDINATE(o) + {} + CD3DX12_TILED_RESOURCE_COORDINATE( + UINT x, + UINT y, + UINT z, + UINT subresource ) + { + X = x; + Y = y; + Z = z; + Subresource = subresource; + } + operator const D3D12_TILED_RESOURCE_COORDINATE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE +{ + CD3DX12_TILE_REGION_SIZE() + {} + explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE &o) : + D3D12_TILE_REGION_SIZE(o) + {} + CD3DX12_TILE_REGION_SIZE( + UINT numTiles, + BOOL useBox, + UINT width, + UINT16 height, + UINT16 depth ) + { + NumTiles = numTiles; + UseBox = useBox; + Width = width; + Height = height; + Depth = depth; + } + operator const D3D12_TILE_REGION_SIZE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING +{ + CD3DX12_SUBRESOURCE_TILING() + {} + explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING &o) : + D3D12_SUBRESOURCE_TILING(o) + {} + CD3DX12_SUBRESOURCE_TILING( + UINT widthInTiles, + UINT16 heightInTiles, + UINT16 depthInTiles, + UINT startTileIndexInOverallResource ) + { + WidthInTiles = widthInTiles; + HeightInTiles = heightInTiles; + DepthInTiles = depthInTiles; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_SUBRESOURCE_TILING&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE +{ + CD3DX12_TILE_SHAPE() + {} + explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE &o) : + D3D12_TILE_SHAPE(o) + {} + CD3DX12_TILE_SHAPE( + UINT widthInTexels, + UINT heightInTexels, + UINT depthInTexels ) + { + WidthInTexels = widthInTexels; + HeightInTexels = heightInTexels; + DepthInTexels = depthInTexels; + } + operator const D3D12_TILE_SHAPE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER +{ + CD3DX12_RESOURCE_BARRIER() + {} + explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) : + D3D12_RESOURCE_BARRIER(o) + {} + static inline CD3DX12_RESOURCE_BARRIER Transition( + _In_ ID3D12Resource* pResource, + D3D12_RESOURCE_STATES stateBefore, + D3D12_RESOURCE_STATES stateAfter, + UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + result.Flags = flags; + barrier.Transition.pResource = pResource; + barrier.Transition.StateBefore = stateBefore; + barrier.Transition.StateAfter = stateAfter; + barrier.Transition.Subresource = subresource; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER Aliasing( + _In_ ID3D12Resource* pResourceBefore, + _In_ ID3D12Resource* pResourceAfter) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING; + barrier.Aliasing.pResourceBefore = pResourceBefore; + barrier.Aliasing.pResourceAfter = pResourceAfter; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER UAV( + _In_ ID3D12Resource* pResource) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.UAV.pResource = pResource; + return result; + } + operator const D3D12_RESOURCE_BARRIER&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO +{ + CD3DX12_PACKED_MIP_INFO() + {} + explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO &o) : + D3D12_PACKED_MIP_INFO(o) + {} + CD3DX12_PACKED_MIP_INFO( + UINT8 numStandardMips, + UINT8 numPackedMips, + UINT numTilesForPackedMips, + UINT startTileIndexInOverallResource ) + { + NumStandardMips = numStandardMips; + NumPackedMips = numPackedMips; + NumTilesForPackedMips = numTilesForPackedMips; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_PACKED_MIP_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT +{ + CD3DX12_SUBRESOURCE_FOOTPRINT() + {} + explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT &o) : + D3D12_SUBRESOURCE_FOOTPRINT(o) + {} + CD3DX12_SUBRESOURCE_FOOTPRINT( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT rowPitch ) + { + Format = format; + Width = width; + Height = height; + Depth = depth; + RowPitch = rowPitch; + } + explicit CD3DX12_SUBRESOURCE_FOOTPRINT( + const D3D12_RESOURCE_DESC& resDesc, + UINT rowPitch ) + { + Format = resDesc.Format; + Width = UINT( resDesc.Width ); + Height = resDesc.Height; + Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1); + RowPitch = rowPitch; + } + operator const D3D12_SUBRESOURCE_FOOTPRINT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION +{ + CD3DX12_TEXTURE_COPY_LOCATION() + {} + explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION &o) : + D3D12_TEXTURE_COPY_LOCATION(o) + {} + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes) { pResource = pRes; } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, D3D12_PLACED_SUBRESOURCE_FOOTPRINT const& Footprint) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + PlacedFootprint = Footprint; + } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, UINT Sub) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + SubresourceIndex = Sub; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE +{ + CD3DX12_DESCRIPTOR_RANGE() { } + explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) : + D3D12_DESCRIPTOR_RANGE(o) + {} + CD3DX12_DESCRIPTOR_RANGE( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + inline void Init( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + static inline void Init( + _Out_ D3D12_DESCRIPTOR_RANGE &range, + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + range.RangeType = rangeType; + range.NumDescriptors = numDescriptors; + range.BaseShaderRegister = baseShaderRegister; + range.RegisterSpace = registerSpace; + range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE +{ + CD3DX12_ROOT_DESCRIPTOR_TABLE() {} + explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) : + D3D12_ROOT_DESCRIPTOR_TABLE(o) + {} + CD3DX12_ROOT_DESCRIPTOR_TABLE( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(numDescriptorRanges, _pDescriptorRanges); + } + + inline void Init( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(*this, numDescriptorRanges, _pDescriptorRanges); + } + + static inline void Init( + _Out_ D3D12_ROOT_DESCRIPTOR_TABLE &rootDescriptorTable, + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges; + rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS +{ + CD3DX12_ROOT_CONSTANTS() {} + explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) : + D3D12_ROOT_CONSTANTS(o) + {} + CD3DX12_ROOT_CONSTANTS( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(num32BitValues, shaderRegister, registerSpace); + } + + inline void Init( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, num32BitValues, shaderRegister, registerSpace); + } + + static inline void Init( + _Out_ D3D12_ROOT_CONSTANTS &rootConstants, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + rootConstants.Num32BitValues = num32BitValues; + rootConstants.ShaderRegister = shaderRegister; + rootConstants.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR +{ + CD3DX12_ROOT_DESCRIPTOR() {} + explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) : + D3D12_ROOT_DESCRIPTOR(o) + {} + CD3DX12_ROOT_DESCRIPTOR( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(shaderRegister, registerSpace); + } + + inline void Init( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, shaderRegister, registerSpace); + } + + static inline void Init(_Out_ D3D12_ROOT_DESCRIPTOR &table, UINT shaderRegister, UINT registerSpace = 0) + { + table.ShaderRegister = shaderRegister; + table.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER +{ + CD3DX12_ROOT_PARAMETER() {} + explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) : + D3D12_ROOT_PARAMETER(o) + {} + + static inline void InitAsDescriptorTable( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR_TABLE::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges); + } + + static inline void InitAsConstants( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace); + } + + static inline void InitAsConstantBufferView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsShaderResourceView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsUnorderedAccessView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + inline void InitAsDescriptorTable( + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility); + } + + inline void InitAsConstants( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility); + } + + inline void InitAsConstantBufferView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstantBufferView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsShaderResourceView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsShaderResourceView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsUnorderedAccessView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, visibility); + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC +{ + CD3DX12_STATIC_SAMPLER_DESC() {} + explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) : + D3D12_STATIC_SAMPLER_DESC(o) + {} + CD3DX12_STATIC_SAMPLER_DESC( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + + static inline void Init( + _Out_ D3D12_STATIC_SAMPLER_DESC &samplerDesc, + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + samplerDesc.ShaderRegister = shaderRegister; + samplerDesc.Filter = filter; + samplerDesc.AddressU = addressU; + samplerDesc.AddressV = addressV; + samplerDesc.AddressW = addressW; + samplerDesc.MipLODBias = mipLODBias; + samplerDesc.MaxAnisotropy = maxAnisotropy; + samplerDesc.ComparisonFunc = comparisonFunc; + samplerDesc.BorderColor = borderColor; + samplerDesc.MinLOD = minLOD; + samplerDesc.MaxLOD = maxLOD; + samplerDesc.ShaderVisibility = shaderVisibility; + samplerDesc.RegisterSpace = registerSpace; + } + inline void Init( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + *this, + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC +{ + CD3DX12_ROOT_SIGNATURE_DESC() {} + explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) : + D3D12_ROOT_SIGNATURE_DESC(o) + {} + CD3DX12_ROOT_SIGNATURE_DESC( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + CD3DX12_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) + { + Init(0, NULL, 0, NULL, D3D12_ROOT_SIGNATURE_FLAG_NONE); + } + + inline void Init( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + + static inline void Init( + _Out_ D3D12_ROOT_SIGNATURE_DESC &desc, + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + desc.NumParameters = numParameters; + desc.pParameters = _pParameters; + desc.NumStaticSamplers = numStaticSamplers; + desc.pStaticSamplers = _pStaticSamplers; + desc.Flags = flags; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE +{ + CD3DX12_CPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) : + D3D12_CPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_CPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + bool operator!=(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE &operator=(const D3D12_CPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE +{ + CD3DX12_GPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) : + D3D12_GPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_GPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + inline bool operator!=(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE &operator=(const D3D12_GPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +inline UINT D3D12CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT PlaneSlice, UINT MipLevels, UINT ArraySize ) +{ + return MipSlice + ArraySlice * MipLevels + PlaneSlice * MipLevels * ArraySize; +} + +//------------------------------------------------------------------------------------------------ +template +inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice ) +{ + MipSlice = static_cast(Subresource % MipLevels); + ArraySlice = static_cast((Subresource / MipLevels) % ArraySize); + PlaneSlice = static_cast(Subresource / (MipLevels * ArraySize)); +} + +//------------------------------------------------------------------------------------------------ +inline UINT8 D3D12GetFormatPlaneCount( + _In_ ID3D12Device* pDevice, + DXGI_FORMAT Format + ) +{ + D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format}; + if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo)))) + { + return 0; + } + return formatInfo.PlaneCount; +} + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC +{ + CD3DX12_RESOURCE_DESC() + {} + explicit CD3DX12_RESOURCE_DESC( const D3D12_RESOURCE_DESC& o ) : + D3D12_RESOURCE_DESC( o ) + {} + CD3DX12_RESOURCE_DESC( + D3D12_RESOURCE_DIMENSION dimension, + UINT64 alignment, + UINT64 width, + UINT height, + UINT16 depthOrArraySize, + UINT16 mipLevels, + DXGI_FORMAT format, + UINT sampleCount, + UINT sampleQuality, + D3D12_TEXTURE_LAYOUT layout, + D3D12_RESOURCE_FLAGS flags ) + { + Dimension = dimension; + Alignment = alignment; + Width = width; + Height = height; + DepthOrArraySize = depthOrArraySize; + MipLevels = mipLevels; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Layout = layout; + Flags = flags; + } + static inline CD3DX12_RESOURCE_DESC Buffer( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, + 1, 1, 1, DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Buffer( + UINT64 width, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, + DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex1D( + DXGI_FORMAT format, + UINT64 width, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, + mipLevels, format, 1, 0, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex2D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, + mipLevels, format, sampleCount, sampleQuality, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex3D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 depth, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, + mipLevels, format, 1, 0, layout, flags ); + } + inline UINT16 Depth() const + { return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT16 ArraySize() const + { return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const + { return D3D12GetFormatPlaneCount(pDevice, Format); } + inline UINT Subresources(_In_ ID3D12Device* pDevice) const + { return MipLevels * ArraySize() * PlaneCount(pDevice); } + inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) + { return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); } + operator const D3D12_RESOURCE_DESC&() const { return *this; } +}; +inline bool operator==( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ + return l.Dimension == r.Dimension && + l.Alignment == r.Alignment && + l.Width == r.Width && + l.Height == r.Height && + l.DepthOrArraySize == r.DepthOrArraySize && + l.MipLevels == r.MipLevels && + l.Format == r.Format && + l.SampleDesc.Count == r.SampleDesc.Count && + l.SampleDesc.Quality == r.SampleDesc.Quality && + l.Layout == r.Layout && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +// Row-by-row memcpy +inline void MemcpySubresource( + _In_ const D3D12_MEMCPY_DEST* pDest, + _In_ const D3D12_SUBRESOURCE_DATA* pSrc, + SIZE_T RowSizeInBytes, + UINT NumRows, + UINT NumSlices) +{ + for (UINT z = 0; z < NumSlices; ++z) + { + BYTE* pDestSlice = reinterpret_cast(pDest->pData) + pDest->SlicePitch * z; + const BYTE* pSrcSlice = reinterpret_cast(pSrc->pData) + pSrc->SlicePitch * z; + for (UINT y = 0; y < NumRows; ++y) + { + memcpy(pDestSlice + pDest->RowPitch * y, + pSrcSlice + pSrc->RowPitch * y, + RowSizeInBytes); + } + } +} + +//------------------------------------------------------------------------------------------------ +// Returns required size of a buffer to be used for data upload +inline UINT64 GetRequiredIntermediateSize( + _In_ ID3D12Resource* pDestinationResource, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources) +{ + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + UINT64 RequiredSize = 0; + + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize); + pDevice->Release(); + + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// All arrays must be populated (e.g. by calling GetCopyableFootprints) +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 RequiredSize, + _In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts, + _In_reads_(NumSubresources) const UINT* pNumRows, + _In_reads_(NumSubresources) const UINT64* pRowSizesInBytes, + _In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) +{ + // Minor validation + D3D12_RESOURCE_DESC IntermediateDesc = pIntermediate->GetDesc(); + D3D12_RESOURCE_DESC DestinationDesc = pDestinationResource->GetDesc(); + if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER || + IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset || + RequiredSize > (SIZE_T)-1 || + (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER && + (FirstSubresource != 0 || NumSubresources != 1))) + { + return 0; + } + + BYTE* pData; + HRESULT hr = pIntermediate->Map(0, NULL, reinterpret_cast(&pData)); + if (FAILED(hr)) + { + return 0; + } + + for (UINT i = 0; i < NumSubresources; ++i) + { + if (pRowSizesInBytes[i] > (SIZE_T)-1) return 0; + D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, pLayouts[i].Footprint.RowPitch * pNumRows[i] }; + MemcpySubresource(&DestData, &pSrcData[i], (SIZE_T)pRowSizesInBytes[i], pNumRows[i], pLayouts[i].Footprint.Depth); + } + pIntermediate->Unmap(0, NULL); + + if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + CD3DX12_BOX SrcBox( UINT( pLayouts[0].Offset ), UINT( pLayouts[0].Offset + pLayouts[0].Footprint.Width ) ); + pCmdList->CopyBufferRegion( + pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width); + } + else + { + for (UINT i = 0; i < NumSubresources; ++i) + { + CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource); + CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]); + pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr); + } + } + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// Heap-allocating UpdateSubresources implementation +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + UINT64 MemToAlloc = static_cast(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources; + if (MemToAlloc > SIZE_MAX) + { + return 0; + } + void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast(MemToAlloc)); + if (pMem == NULL) + { + return 0; + } + D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts = reinterpret_cast(pMem); + UINT64* pRowSizesInBytes = reinterpret_cast(pLayouts + NumSubresources); + UINT* pNumRows = reinterpret_cast(pRowSizesInBytes + NumSubresources); + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize); + pDevice->Release(); + + UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData); + HeapFree(GetProcessHeap(), 0, pMem); + return Result; +} + +//------------------------------------------------------------------------------------------------ +// Stack-allocating UpdateSubresources implementation +template +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0, MaxSubresources) UINT FirstSubresource, + _In_range_(1, MaxSubresources - FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources]; + UINT NumRows[MaxSubresources]; + UINT64 RowSizesInBytes[MaxSubresources]; + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize); + pDevice->Release(); + + return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData); +} + +//------------------------------------------------------------------------------------------------ +inline bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout ) +{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; } + +//------------------------------------------------------------------------------------------------ +inline ID3D12CommandList * const * CommandListCast(ID3D12GraphicsCommandList * const * pp) +{ + // This cast is useful for passing strongly typed command list pointers into + // ExecuteCommandLists. + // This cast is valid as long as the const-ness is respected. D3D12 APIs do + // respect the const-ness of their arguments. + return reinterpret_cast(pp); +} + + +#endif // defined( __cplusplus ) + +#endif //__D3DX12_H__ + + + diff --git a/Kits/DirectXTK12/Src/dds.h b/Kits/DirectXTK12/Src/dds.h new file mode 100644 index 0000000000000000000000000000000000000000..3bd63cd97156c8d453f01f3d06e68a9e3481abbf --- /dev/null +++ b/Kits/DirectXTK12/Src/dds.h @@ -0,0 +1,228 @@ +//-------------------------------------------------------------------------------------- +// dds.h +// +// This header defines constants and structures that are useful when parsing +// DDS files. DDS files were originally designed to use several structures +// and constants that are native to DirectDraw and are defined in ddraw.h, +// such as DDSURFACEDESC2 and DDSCAPS2. This file defines similar +// (compatible) constants and structures so that one can use DDS files +// without needing to include ddraw.h. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248926 +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + + +namespace DirectX +{ + +#pragma pack(push,1) + +const uint32_t DDS_MAGIC = 0x20534444; // "DDS " + +struct DDS_PIXELFORMAT +{ + uint32_t size; + uint32_t flags; + uint32_t fourCC; + uint32_t RGBBitCount; + uint32_t RBitMask; + uint32_t GBitMask; + uint32_t BBitMask; + uint32_t ABitMask; +}; + +#define DDS_FOURCC 0x00000004 // DDPF_FOURCC +#define DDS_RGB 0x00000040 // DDPF_RGB +#define DDS_RGBA 0x00000041 // DDPF_RGB | DDPF_ALPHAPIXELS +#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE +#define DDS_LUMINANCEA 0x00020001 // DDPF_LUMINANCE | DDPF_ALPHAPIXELS +#define DDS_ALPHA 0x00000002 // DDPF_ALPHA +#define DDS_PAL8 0x00000020 // DDPF_PALETTEINDEXED8 +#define DDS_BUMPDUDV 0x00080000 // DDPF_BUMPDUDV + +#ifndef MAKEFOURCC + #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \ + ((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 )) +#endif /* defined(MAKEFOURCC) */ + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT1 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT2 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT3 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT4 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT5 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_UNORM = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','U'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_SNORM = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','S'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_UNORM = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','U'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_SNORM = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','S'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8_B8G8 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G8R8_G8B8 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_YUY2 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8R8G8B8 = + { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8R8G8B8 = + { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8B8G8R8 = + { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8B8G8R8 = + { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G16R16 = + { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R5G6B5 = + { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A1R5G5B5 = + { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A4R4G4B4 = + { sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8B8 = + { sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L8 = + { sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 8, 0xff, 0x00, 0x00, 0x00 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L16 = + { sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0x0000, 0x0000, 0x0000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8 = + { sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0x0000, 0x0000, 0xff00 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8 = + { sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0x00, 0x00, 0x00, 0xff }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_V8U8 = + { sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0x0000, 0x0000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_Q8W8V8U8 = + { sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_V16U16 = + { sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 }; + +// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue + +// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat) +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DX10 = + { sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','1','0'), 0, 0, 0, 0, 0 }; + +#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT +#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT +#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH +#define DDS_HEADER_FLAGS_PITCH 0x00000008 // DDSD_PITCH +#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000 // DDSD_LINEARSIZE + +#define DDS_HEIGHT 0x00000002 // DDSD_HEIGHT +#define DDS_WIDTH 0x00000004 // DDSD_WIDTH + +#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE +#define DDS_SURFACE_FLAGS_MIPMAP 0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP +#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX + +#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX +#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX +#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY +#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY +#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ +#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ + +#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\ + DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\ + DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ ) + +#define DDS_CUBEMAP 0x00000200 // DDSCAPS2_CUBEMAP + +#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME + +// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION +enum DDS_RESOURCE_DIMENSION +{ + DDS_DIMENSION_TEXTURE1D = 2, + DDS_DIMENSION_TEXTURE2D = 3, + DDS_DIMENSION_TEXTURE3D = 4, +}; + +// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG +enum DDS_RESOURCE_MISC_FLAG +{ + DDS_RESOURCE_MISC_TEXTURECUBE = 0x4L, +}; + +enum DDS_MISC_FLAGS2 +{ + DDS_MISC_FLAGS2_ALPHA_MODE_MASK = 0x7L, +}; + +struct DDS_HEADER +{ + uint32_t size; + uint32_t flags; + uint32_t height; + uint32_t width; + uint32_t pitchOrLinearSize; + uint32_t depth; // only if DDS_HEADER_FLAGS_VOLUME is set in flags + uint32_t mipMapCount; + uint32_t reserved1[11]; + DDS_PIXELFORMAT ddspf; + uint32_t caps; + uint32_t caps2; + uint32_t caps3; + uint32_t caps4; + uint32_t reserved2; +}; + +struct DDS_HEADER_DXT10 +{ + DXGI_FORMAT dxgiFormat; + uint32_t resourceDimension; + uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG + uint32_t arraySize; + uint32_t miscFlags2; // see DDS_MISC_FLAGS2 +} ; + +#pragma pack(pop) + +static_assert( sizeof(DDS_HEADER) == 124, "DDS Header size mismatch" ); +static_assert( sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch"); + +} // namespace diff --git a/Kits/DirectXTK12/Src/pch.cpp b/Kits/DirectXTK12/Src/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f12bcd06c8e0cf1a041fe0e40eadce3b7ce6030c --- /dev/null +++ b/Kits/DirectXTK12/Src/pch.cpp @@ -0,0 +1,14 @@ +//-------------------------------------------------------------------------------------- +// File: pch.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#include "pch.h" diff --git a/Kits/DirectXTK12/Src/pch.h b/Kits/DirectXTK12/Src/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..a9c9e6223e5bb674343232ecbe8222d20c9f4c11 --- /dev/null +++ b/Kits/DirectXTK12/Src/pch.h @@ -0,0 +1,78 @@ +//-------------------------------------------------------------------------------------- +// File: pch.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkID=615561 +//-------------------------------------------------------------------------------------- + +#pragma once + +#pragma warning(push) +#pragma warning(disable : 4005) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#define NODRAWTEXT +#define NOGDI +#define NOBITMAP +#define NOMCX +#define NOSERVICE +#define NOHELP +#pragma warning(pop) + +#include + +#ifndef _WIN32_WINNT_WIN10 +#define _WIN32_WINNT_WIN10 0x0A00 +#endif + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include + +#if _XDK_VER < 0x295A044C /* XDK Edition 160200 */ +#error DirectX Tool Kit for Direct3D 12 requires the February 2016 XDK or later +#endif + +#include // core 12.x header +#include // utility 12.x header +#define DCOMMON_H_INCLUDED +#else +#include +#include +#include "d3dx12.h" +#endif + +#if (defined(_XBOX_ONE) && defined(_TITLE)) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) +#include +#endif + +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +#include +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include diff --git a/Kits/DirectXTK12/Src/vbo.h b/Kits/DirectXTK12/Src/vbo.h new file mode 100644 index 0000000000000000000000000000000000000000..5087ed1c3c288529e9d88e652d0f219cdd45f3ba --- /dev/null +++ b/Kits/DirectXTK12/Src/vbo.h @@ -0,0 +1,38 @@ +//-------------------------------------------------------------------------------------- +// File: vbo.h +// +// The VBO file format was introduced in the Windows 8.0 ResourceLoading sample. It's +// a simple binary file containing a 16-bit index buffer and a fixed-format vertex buffer. +// +// The meshconvert sample tool for DirectXMesh can produce this file type +// http://go.microsoft.com/fwlink/?LinkID=324981 +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + + +namespace VBO +{ +#pragma pack(push,1) + + struct header_t + { + uint32_t numVertices; + uint32_t numIndices; + }; + +#pragma pack(pop) + +}; // namespace + +static_assert(sizeof(VBO::header_t) == 8, "VBO header size mismatch"); + diff --git a/Samples/Audio/SimplePlay3DSoundUWP/SimplePlay3DSound.vcxproj b/Samples/Audio/SimplePlay3DSoundUWP/SimplePlay3DSound.vcxproj index 4465f3a3efd6c4a384e99d12b6a648372d468dcc..4ca465eb10e76613f2f15298a1192ad40255d287 100644 --- a/Samples/Audio/SimplePlay3DSoundUWP/SimplePlay3DSound.vcxproj +++ b/Samples/Audio/SimplePlay3DSoundUWP/SimplePlay3DSound.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/Audio/SimplePlaySoundUWP/SimplePlaySound.vcxproj b/Samples/Audio/SimplePlaySoundUWP/SimplePlaySound.vcxproj index e10b2f331d4116223089b2141eb3e301f280afc2..5091b2d53b3a09c4e0a572231b05de35daa4fabe 100644 --- a/Samples/Audio/SimplePlaySoundUWP/SimplePlaySound.vcxproj +++ b/Samples/Audio/SimplePlaySoundUWP/SimplePlaySound.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/Audio/SimpleWASAPICaptureUWP/SimpleWASAPICaptureUWP.vcxproj b/Samples/Audio/SimpleWASAPICaptureUWP/SimpleWASAPICaptureUWP.vcxproj index 418406a92db4252b238b47dec3dc6b2f0a4ea549..48d529d0ee79e22fe108d2c02f276f4f57bb516f 100644 --- a/Samples/Audio/SimpleWASAPICaptureUWP/SimpleWASAPICaptureUWP.vcxproj +++ b/Samples/Audio/SimpleWASAPICaptureUWP/SimpleWASAPICaptureUWP.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/Audio/SimpleWASAPIPlaySoundUWP/SimpleWASAPIPlaySound.vcxproj b/Samples/Audio/SimpleWASAPIPlaySoundUWP/SimpleWASAPIPlaySound.vcxproj index 85d9faead609b36204b9bc3de7b894e9edcc779c..5e0bbd208eba6f7606e685e1991f49f9e8a6fb7d 100644 --- a/Samples/Audio/SimpleWASAPIPlaySoundUWP/SimpleWASAPIPlaySound.vcxproj +++ b/Samples/Audio/SimpleWASAPIPlaySoundUWP/SimpleWASAPIPlaySound.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.cpp b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.cpp index 09fba3dfdff96403eb0ea33e3e6827c00622a834..2897efbcce0e497ecaee48041911033057ad26c8 100644 --- a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.cpp +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.cpp @@ -244,7 +244,7 @@ void XM_CALLCONV Sample::DrawGrid(FXMVECTOR xAxis, FXMVECTOR yAxis, FXMVECTOR or for (size_t i = 0; i <= ydivs; i++) { - FLOAT fPercent = float(i) / float(ydivs); + float fPercent = float(i) / float(ydivs); fPercent = (fPercent * 2.0f) - 1.0f; XMVECTOR vScale = XMVectorScale(yAxis, fPercent); vScale = XMVectorAdd(vScale, origin); diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.vcxproj b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.vcxproj index 4b094416e365a46c38b4c33714df33ab64db4d56..da9f152089118a565e2855ed509f487dac13cde8 100644 --- a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.vcxproj +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP/DirectXTKSimpleSample.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/Logo.png b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7e704a106b99487be0f1eded426e6c5a2c65a9 Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/Logo.png differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/SmallLogo.png b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/SmallLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..98b09d91991638282fc2426bbfd4a517733ff15a Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/SmallLogo.png differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/SplashScreen.png b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/SplashScreen.png new file mode 100644 index 0000000000000000000000000000000000000000..c352b156fd090a57aec7da81b3b19a3fb5888b43 Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/SplashScreen.png differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/StoreLogo.png b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..315472e10b9d380e509b2f041ea9ace5f994f5d2 Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/StoreLogo.png differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/WideLogo.png b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/WideLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..c70f68e2c59214e0ff54844ccd8ae5e955826e10 Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/WideLogo.png differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/seafloor.dds b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/seafloor.dds new file mode 100644 index 0000000000000000000000000000000000000000..fc313c451d513fc5db6b8bb8a73b84235243b69b Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/seafloor.dds differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/windowslogo.dds b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/windowslogo.dds new file mode 100644 index 0000000000000000000000000000000000000000..6488e0b8db84c07e909c690fab5ba810ea4b6484 Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Assets/windowslogo.dds differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DeviceResources.cpp b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DeviceResources.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7dbf8dd107e90060280c0d1ffe2f9e8187a45531 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DeviceResources.cpp @@ -0,0 +1,660 @@ +// +// DeviceResources.cpp - A wrapper for the Direct3D 12 device and swapchain +// + +#include "pch.h" +#include "DeviceResources.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +// Constants used to calculate screen rotations +namespace ScreenRotation +{ + // 0-degree Z-rotation + static const XMFLOAT4X4 Rotation0( + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 90-degree Z-rotation + static const XMFLOAT4X4 Rotation90( + 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 180-degree Z-rotation + static const XMFLOAT4X4 Rotation180( + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 270-degree Z-rotation + static const XMFLOAT4X4 Rotation270( + 0.0f, -1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); +}; + +namespace +{ + inline DXGI_FORMAT NoSRGB(DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8X8_UNORM; + default: return fmt; + } + } +}; + +// Constructor for DeviceResources. +DX::DeviceResources::DeviceResources(DXGI_FORMAT backBufferFormat, DXGI_FORMAT depthBufferFormat, UINT backBufferCount, D3D_FEATURE_LEVEL minFeatureLevel) : + m_backBufferIndex(0), + m_fenceValues{}, + m_rtvDescriptorSize(0), + m_screenViewport{}, + m_scissorRect{}, + m_backBufferFormat(backBufferFormat), + m_depthBufferFormat(depthBufferFormat), + m_backBufferCount(backBufferCount), + m_d3dMinFeatureLevel(minFeatureLevel), + m_window(0), + m_d3dFeatureLevel(D3D_FEATURE_LEVEL_11_0), + m_rotation(DXGI_MODE_ROTATION_IDENTITY), + m_outputSize{0, 0, 1, 1}, + m_orientationTransform3D(ScreenRotation::Rotation0), + m_deviceNotify(nullptr) +{ + if (backBufferCount > MAX_BACK_BUFFER_COUNT) + { + throw std::out_of_range("backBufferCount too large"); + } + + if (minFeatureLevel < D3D_FEATURE_LEVEL_11_0) + { + throw std::out_of_range("minFeatureLevel too low"); + } +} + +// Destructor for DeviceResources. +DX::DeviceResources::~DeviceResources() +{ + // Ensure that the GPU is no longer referencing resources that are about to be destroyed. + WaitForGpu(); +} + +// Configures the Direct3D device, and stores handles to it and the device context. +void DX::DeviceResources::CreateDeviceResources() +{ +#if defined(_DEBUG) + // Enable the debug layer (only available if the Graphics Tools feature-on-demand is enabled). + { + ComPtr debugController; + if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(debugController.GetAddressOf())))) + { + debugController->EnableDebugLayer(); + } + else + { + OutputDebugStringA("WARNING: Direct3D Debug Device is not available\n"); + } + + ComPtr dxgiInfoQueue; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(dxgiInfoQueue.GetAddressOf())))) + { + dxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, true); + dxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, true); + } + } +#endif + + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(m_dxgiFactory.ReleaseAndGetAddressOf()))); + + ComPtr adapter; + GetAdapter(adapter.GetAddressOf()); + + // Create the DX12 API device object. + DX::ThrowIfFailed(D3D12CreateDevice( + adapter.Get(), + m_d3dMinFeatureLevel, + IID_PPV_ARGS(m_d3dDevice.ReleaseAndGetAddressOf()) + )); + +#ifndef NDEBUG + // Configure debug device (if active). + ComPtr d3dInfoQueue; + if (SUCCEEDED(m_d3dDevice.As(&d3dInfoQueue))) + { +#ifdef _DEBUG + d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true); + d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true); +#endif + D3D12_MESSAGE_ID hide[] = + { + D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE, + D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE + }; + D3D12_INFO_QUEUE_FILTER filter = {}; + filter.DenyList.NumIDs = _countof(hide); + filter.DenyList.pIDList = hide; + d3dInfoQueue->AddStorageFilterEntries(&filter); + } +#endif + + // Determine maximum supported feature level for this device + static const D3D_FEATURE_LEVEL s_featureLevels[] = + { + D3D_FEATURE_LEVEL_12_1, + D3D_FEATURE_LEVEL_12_0, + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + }; + + D3D12_FEATURE_DATA_FEATURE_LEVELS featLevels = + { + _countof(s_featureLevels), s_featureLevels, D3D_FEATURE_LEVEL_11_0 + }; + + HRESULT hr = m_d3dDevice->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &featLevels, sizeof(featLevels)); + if (SUCCEEDED(hr)) + { + m_d3dFeatureLevel = featLevels.MaxSupportedFeatureLevel; + } + else + { + m_d3dFeatureLevel = m_d3dMinFeatureLevel; + } + + // Create the command queue. + D3D12_COMMAND_QUEUE_DESC queueDesc = {}; + queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; + queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + + DX::ThrowIfFailed(m_d3dDevice->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(m_commandQueue.ReleaseAndGetAddressOf()))); + + // Create descriptor heaps for render target views and depth stencil views. + D3D12_DESCRIPTOR_HEAP_DESC rtvDescriptorHeapDesc = {}; + rtvDescriptorHeapDesc.NumDescriptors = m_backBufferCount; + rtvDescriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + + DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&rtvDescriptorHeapDesc, IID_PPV_ARGS(m_rtvDescriptorHeap.ReleaseAndGetAddressOf()))); + + m_rtvDescriptorSize = m_d3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + D3D12_DESCRIPTOR_HEAP_DESC dsvDescriptorHeapDesc = {}; + dsvDescriptorHeapDesc.NumDescriptors = 1; + dsvDescriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; + + DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&dsvDescriptorHeapDesc, IID_PPV_ARGS(m_dsvDescriptorHeap.ReleaseAndGetAddressOf()))); + } + + // Create a command allocator for each back buffer that will be rendered to. + for (UINT n = 0; n < m_backBufferCount; n++) + { + DX::ThrowIfFailed(m_d3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(m_commandAllocators[n].ReleaseAndGetAddressOf()))); + } + + // Create a command list for recording graphics commands. + DX::ThrowIfFailed(m_d3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocators[0].Get(), nullptr, IID_PPV_ARGS(m_commandList.ReleaseAndGetAddressOf()))); + DX::ThrowIfFailed(m_commandList->Close()); + + // Create a fence for tracking GPU execution progress. + DX::ThrowIfFailed(m_d3dDevice->CreateFence(m_fenceValues[m_backBufferIndex], D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.ReleaseAndGetAddressOf()))); + m_fenceValues[m_backBufferIndex]++; + + m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); + if (!m_fenceEvent.IsValid()) + { + throw std::exception("CreateEvent"); + } +} + +// These resources need to be recreated every time the window size is changed. +void DX::DeviceResources::CreateWindowSizeDependentResources() +{ + if (!m_window) + { + throw std::exception("Call SetWindow with a valid CoreWindow pointer"); + } + + // Wait until all previous GPU work is complete. + WaitForGpu(); + + // Release resources that are tied to the swap chain and update fence values. + for (UINT n = 0; n < m_backBufferCount; n++) + { + m_renderTargets[n].Reset(); + m_fenceValues[n] = m_fenceValues[m_backBufferIndex]; + } + + // Determine the render target size in pixels. + UINT backBufferWidth = std::max(m_outputSize.right - m_outputSize.left, 1); + UINT backBufferHeight = std::max(m_outputSize.bottom - m_outputSize.top, 1); + DXGI_FORMAT backBufferFormat = NoSRGB(m_backBufferFormat); + + // If the swap chain already exists, resize it, otherwise create one. + if (m_swapChain) + { + // If the swap chain already exists, resize it. + HRESULT hr = m_swapChain->ResizeBuffers( + m_backBufferCount, + backBufferWidth, + backBufferHeight, + backBufferFormat, + 0 + ); + + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on ResizeBuffers: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + // If the device was removed for any reason, a new device and swap chain will need to be created. + HandleDeviceLost(); + + // Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method + // and correctly set up the new device. + return; + } + else + { + DX::ThrowIfFailed(hr); + } + } + else + { + // Create a descriptor for the swap chain. + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {}; + swapChainDesc.Width = backBufferWidth; + swapChainDesc.Height = backBufferHeight; + swapChainDesc.Format = backBufferFormat; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = m_backBufferCount; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE; + + // Create a swap chain for the window. + ComPtr swapChain; + DX::ThrowIfFailed(m_dxgiFactory->CreateSwapChainForCoreWindow( + m_commandQueue.Get(), + m_window, + &swapChainDesc, + nullptr, + swapChain.GetAddressOf() + )); + + DX::ThrowIfFailed(swapChain.As(&m_swapChain)); + } + + // Set the proper orientation for the swap chain, and generate + // matrix transformations for rendering to the rotated swap chain. + switch (m_rotation) + { + default: + case DXGI_MODE_ROTATION_IDENTITY: + m_orientationTransform3D = ScreenRotation::Rotation0; + break; + + case DXGI_MODE_ROTATION_ROTATE90: + m_orientationTransform3D = ScreenRotation::Rotation270; + break; + + case DXGI_MODE_ROTATION_ROTATE180: + m_orientationTransform3D = ScreenRotation::Rotation180; + break; + + case DXGI_MODE_ROTATION_ROTATE270: + m_orientationTransform3D = ScreenRotation::Rotation90; + break; + } + + DX::ThrowIfFailed(m_swapChain->SetRotation(m_rotation)); + + // Obtain the back buffers for this window which will be the final render targets + // and create render target views for each of them. + for (UINT n = 0; n < m_backBufferCount; n++) + { + DX::ThrowIfFailed(m_swapChain->GetBuffer(n, IID_PPV_ARGS(m_renderTargets[n].GetAddressOf()))); + + wchar_t name[25] = {}; + swprintf_s(name, L"Render target %u", n); + m_renderTargets[n]->SetName(name); + + D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {}; + rtvDesc.Format = m_backBufferFormat; + rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + + CD3DX12_CPU_DESCRIPTOR_HANDLE rtvDescriptor(m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), n, m_rtvDescriptorSize); + m_d3dDevice->CreateRenderTargetView(m_renderTargets[n].Get(), &rtvDesc, rtvDescriptor); + } + + // Reset the index to the current back buffer. + m_backBufferIndex = m_swapChain->GetCurrentBackBufferIndex(); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + // Allocate a 2-D surface as the depth/stencil buffer and create a depth/stencil view + // on this surface. + CD3DX12_HEAP_PROPERTIES depthHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + D3D12_RESOURCE_DESC depthStencilDesc = CD3DX12_RESOURCE_DESC::Tex2D( + m_depthBufferFormat, + backBufferWidth, + backBufferHeight, + 1, // This depth stencil view has only one texture. + 1 // Use a single mipmap level. + ); + depthStencilDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; + + D3D12_CLEAR_VALUE depthOptimizedClearValue = {}; + depthOptimizedClearValue.Format = m_depthBufferFormat; + depthOptimizedClearValue.DepthStencil.Depth = 1.0f; + depthOptimizedClearValue.DepthStencil.Stencil = 0; + + DX::ThrowIfFailed(m_d3dDevice->CreateCommittedResource( + &depthHeapProperties, + D3D12_HEAP_FLAG_NONE, + &depthStencilDesc, + D3D12_RESOURCE_STATE_DEPTH_WRITE, + &depthOptimizedClearValue, + IID_PPV_ARGS(m_depthStencil.ReleaseAndGetAddressOf()) + )); + + m_depthStencil->SetName(L"Depth stencil"); + + D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = {}; + dsvDesc.Format = m_depthBufferFormat; + dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D; + + m_d3dDevice->CreateDepthStencilView(m_depthStencil.Get(), &dsvDesc, m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); + } + + // Set the 3D rendering viewport and scissor rectangle to target the entire window. + m_screenViewport.TopLeftX = m_screenViewport.TopLeftY = 0.f; + m_screenViewport.Width = static_cast(backBufferWidth); + m_screenViewport.Height = static_cast(backBufferHeight); + m_screenViewport.MinDepth = D3D12_MIN_DEPTH; + m_screenViewport.MaxDepth = D3D12_MAX_DEPTH; + + m_scissorRect.left = m_scissorRect.top = 0; + m_scissorRect.right = backBufferWidth; + m_scissorRect.bottom = backBufferHeight; +} + +// This method is called when the CoreWindow is created (or re-created). +void DX::DeviceResources::SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_window = window; + + m_outputSize.left = m_outputSize.top = 0; + m_outputSize.right = width; + m_outputSize.bottom = height; + + m_rotation = rotation; +} + +// This method is called when the window changes size. +bool DX::DeviceResources::WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + RECT newRc; + newRc.left = newRc.top = 0; + newRc.right = width; + newRc.bottom = height; + if (newRc.left == m_outputSize.left + && newRc.top == m_outputSize.top + && newRc.right == m_outputSize.right + && newRc.bottom == m_outputSize.bottom + && rotation == m_rotation) + { + return false; + } + + m_outputSize = newRc; + m_rotation = rotation; + CreateWindowSizeDependentResources(); + return true; +} + +// This method is called in the event handler for the DisplayContentsInvalidated event. +void DX::DeviceResources::ValidateDevice() +{ + // The D3D Device is no longer valid if the default adapter changed since the device + // was created or if the device has been removed. + + DXGI_ADAPTER_DESC previousDesc; + { + ComPtr previousDefaultAdapter; + DX::ThrowIfFailed(m_dxgiFactory->EnumAdapters1(0, previousDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(previousDefaultAdapter->GetDesc(&previousDesc)); + } + + DXGI_ADAPTER_DESC currentDesc; + { + ComPtr currentFactory; + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(currentFactory.GetAddressOf()))); + + ComPtr currentDefaultAdapter; + DX::ThrowIfFailed(currentFactory->EnumAdapters1(0, currentDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(currentDefaultAdapter->GetDesc(¤tDesc)); + } + + // If the adapter LUIDs don't match, or if the device reports that it has been removed, + // a new D3D device must be created. + + if (previousDesc.AdapterLuid.LowPart != currentDesc.AdapterLuid.LowPart + || previousDesc.AdapterLuid.HighPart != currentDesc.AdapterLuid.HighPart + || FAILED(m_d3dDevice->GetDeviceRemovedReason())) + { +#ifdef _DEBUG + OutputDebugStringA("Device Lost on ValidateDevice\n"); +#endif + + // Create a new device and swap chain. + HandleDeviceLost(); + } +} + +// Recreate all device resources and set them back to the current state. +void DX::DeviceResources::HandleDeviceLost() +{ + WaitForGpu(); + + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceLost(); + } + + for (UINT n = 0; n < m_backBufferCount; n++) + { + m_commandAllocators[n].Reset(); + m_renderTargets[n].Reset(); + } + + m_depthStencil.Reset(); + m_commandQueue.Reset(); + m_commandList.Reset(); + m_fence.Reset(); + m_rtvDescriptorHeap.Reset(); + m_dsvDescriptorHeap.Reset(); + m_swapChain.Reset(); + m_d3dDevice.Reset(); + m_dxgiFactory.Reset(); + +#ifdef _DEBUG + { + ComPtr dxgiDebug; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&dxgiDebug)))) + { + dxgiDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_FLAGS(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL)); + } + } +#endif + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); + + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceRestored(); + } +} + +// Prepare the command list and render target for rendering. +void DX::DeviceResources::Prepare() +{ + // Reset command list and allocator. + DX::ThrowIfFailed(m_commandAllocators[m_backBufferIndex]->Reset()); + DX::ThrowIfFailed(m_commandList->Reset(m_commandAllocators[m_backBufferIndex].Get(), nullptr)); + + // Transition the render target into the correct state to allow for drawing into it. + D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_backBufferIndex].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET); + m_commandList->ResourceBarrier(1, &barrier); +} + +// Present the contents of the swap chain to the screen. +void DX::DeviceResources::Present() +{ + // Transition the render target to the state that allows it to be presented to the display. + D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_backBufferIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT); + m_commandList->ResourceBarrier(1, &barrier); + + // Send the command list off to the GPU for processing. + DX::ThrowIfFailed(m_commandList->Close()); + m_commandQueue->ExecuteCommandLists(1, CommandListCast(m_commandList.GetAddressOf())); + + // The first argument instructs DXGI to block until VSync, putting the application + // to sleep until the next VSync. This ensures we don't waste any cycles rendering + // frames that will never be displayed to the screen. + HRESULT hr = m_swapChain->Present(1, 0); + + // If the device was reset we must completely reinitialize the renderer. + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on Present: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + HandleDeviceLost(); + } + else + { + DX::ThrowIfFailed(hr); + + MoveToNextFrame(); + } +} + +// Wait for pending GPU work to complete. +void DX::DeviceResources::WaitForGpu() noexcept +{ + if (m_commandQueue && m_fence && m_fenceEvent.IsValid()) + { + // Schedule a Signal command in the GPU queue. + UINT64 fenceValue = m_fenceValues[m_backBufferIndex]; + if (SUCCEEDED(m_commandQueue->Signal(m_fence.Get(), fenceValue))) + { + // Wait until the Signal has been processed. + if (SUCCEEDED(m_fence->SetEventOnCompletion(fenceValue, m_fenceEvent.Get()))) + { + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + + // Increment the fence value for the current frame. + m_fenceValues[m_backBufferIndex]++; + } + } + } +} + +// Prepare to render the next frame. +void DX::DeviceResources::MoveToNextFrame() +{ + // Schedule a Signal command in the queue. + const UINT64 currentFenceValue = m_fenceValues[m_backBufferIndex]; + DX::ThrowIfFailed(m_commandQueue->Signal(m_fence.Get(), currentFenceValue)); + + // Update the back buffer index. + m_backBufferIndex = m_swapChain->GetCurrentBackBufferIndex(); + + // If the next frame is not ready to be rendered yet, wait until it is ready. + if (m_fence->GetCompletedValue() < m_fenceValues[m_backBufferIndex]) + { + DX::ThrowIfFailed(m_fence->SetEventOnCompletion(m_fenceValues[m_backBufferIndex], m_fenceEvent.Get())); + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + } + + // Set the fence value for the next frame. + m_fenceValues[m_backBufferIndex] = currentFenceValue + 1; +} + +// This method acquires the first available hardware adapter that supports Direct3D 12. +// If no such adapter can be found, try WARP. Otherwise throw an exception. +void DX::DeviceResources::GetAdapter(IDXGIAdapter1** ppAdapter) +{ + *ppAdapter = nullptr; + + ComPtr adapter; + for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != m_dxgiFactory->EnumAdapters1(adapterIndex, adapter.ReleaseAndGetAddressOf()); ++adapterIndex) + { + DXGI_ADAPTER_DESC1 desc; + DX::ThrowIfFailed(adapter->GetDesc1(&desc)); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the actual device yet. + if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), m_d3dMinFeatureLevel, _uuidof(ID3D12Device), nullptr))) + { +#ifdef _DEBUG + wchar_t buff[256] = {}; + swprintf_s(buff, L"Direct3D Adapter (%u): VID:%04X, PID:%04X - %ls\n", adapterIndex, desc.VendorId, desc.DeviceId, desc.Description); + OutputDebugStringW(buff); +#endif + break; + } + } + +#if !defined(NDEBUG) + if (!adapter) + { + // Try WARP12 instead + if (FAILED(m_dxgiFactory->EnumWarpAdapter(IID_PPV_ARGS(adapter.ReleaseAndGetAddressOf())))) + { + throw std::exception("WARP12 not available. Enable the 'Graphics Tools' feature-on-demand"); + } + + OutputDebugStringA("Direct3D Adapter - WARP12\n"); + } +#endif + + if (!adapter) + { + throw std::exception("No Direct3D 12 device found"); + } + + *ppAdapter = adapter.Detach(); +} diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DeviceResources.h b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DeviceResources.h new file mode 100644 index 0000000000000000000000000000000000000000..086d0cec4aaa5f1800fd90959c4c40269f121952 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DeviceResources.h @@ -0,0 +1,117 @@ +// +// DeviceResources.h - A wrapper for the Direct3D 12 device and swapchain +// + +#pragma once + +namespace DX +{ + // Provides an interface for an application that owns DeviceResources to be notified of the device being lost or created. + interface IDeviceNotify + { + virtual void OnDeviceLost() = 0; + virtual void OnDeviceRestored() = 0; + }; + + // Controls all the DirectX device resources. + class DeviceResources + { + public: + DeviceResources(DXGI_FORMAT backBufferFormat = DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT depthBufferFormat = DXGI_FORMAT_D32_FLOAT, + UINT backBufferCount = 2, + D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL_11_0); + ~DeviceResources(); + + void CreateDeviceResources(); + void CreateWindowSizeDependentResources(); + void SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + bool WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + void HandleDeviceLost(); + void RegisterDeviceNotify(IDeviceNotify* deviceNotify) { m_deviceNotify = deviceNotify; } + void Prepare(); + void Present(); + void WaitForGpu() noexcept; + + // Device Accessors. + RECT GetOutputSize() const { return m_outputSize; } + DXGI_MODE_ROTATION GetRotation() const { return m_rotation; } + + // Direct3D Accessors. + ID3D12Device* GetD3DDevice() const { return m_d3dDevice.Get(); } + IDXGISwapChain3* GetSwapChain() const { return m_swapChain.Get(); } + D3D_FEATURE_LEVEL GetDeviceFeatureLevel() const { return m_d3dFeatureLevel; } + ID3D12Resource* GetRenderTarget() const { return m_renderTargets[m_backBufferIndex].Get(); } + ID3D12Resource* GetDepthStencil() const { return m_depthStencil.Get(); } + ID3D12CommandQueue* GetCommandQueue() const { return m_commandQueue.Get(); } + ID3D12CommandAllocator* GetCommandAllocator() const { return m_commandAllocators[m_backBufferIndex].Get(); } + ID3D12GraphicsCommandList* GetCommandList() const { return m_commandList.Get(); } + DXGI_FORMAT GetBackBufferFormat() const { return m_backBufferFormat; } + DXGI_FORMAT GetDepthBufferFormat() const { return m_depthBufferFormat; } + D3D12_VIEWPORT GetScreenViewport() const { return m_screenViewport; } + D3D12_RECT GetScissorRect() const { return m_scissorRect; } + UINT GetCurrentFrameIndex() const { return m_backBufferIndex; } + UINT GetBackBufferCount() const { return m_backBufferCount; } + DirectX::XMFLOAT4X4 GetOrientationTransform3D() const { return m_orientationTransform3D; } + + CD3DX12_CPU_DESCRIPTOR_HANDLE GetRenderTargetView() const + { + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), m_backBufferIndex, m_rtvDescriptorSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE GetDepthStencilView() const + { + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); + } + + private: + void MoveToNextFrame(); + void GetAdapter(IDXGIAdapter1** ppAdapter); + + const static size_t MAX_BACK_BUFFER_COUNT = 3; + + UINT m_backBufferIndex; + + // Direct3D objects. + Microsoft::WRL::ComPtr m_d3dDevice; + Microsoft::WRL::ComPtr m_commandQueue; + Microsoft::WRL::ComPtr m_commandList; + Microsoft::WRL::ComPtr m_commandAllocators[MAX_BACK_BUFFER_COUNT]; + + // Swap chain objects. + Microsoft::WRL::ComPtr m_dxgiFactory; + Microsoft::WRL::ComPtr m_swapChain; + Microsoft::WRL::ComPtr m_renderTargets[MAX_BACK_BUFFER_COUNT]; + Microsoft::WRL::ComPtr m_depthStencil; + + // Presentation fence objects. + Microsoft::WRL::ComPtr m_fence; + UINT64 m_fenceValues[MAX_BACK_BUFFER_COUNT]; + Microsoft::WRL::Wrappers::Event m_fenceEvent; + + // Direct3D rendering objects. + Microsoft::WRL::ComPtr m_rtvDescriptorHeap; + Microsoft::WRL::ComPtr m_dsvDescriptorHeap; + UINT m_rtvDescriptorSize; + D3D12_VIEWPORT m_screenViewport; + D3D12_RECT m_scissorRect; + + // Direct3D properties. + DXGI_FORMAT m_backBufferFormat; + DXGI_FORMAT m_depthBufferFormat; + UINT m_backBufferCount; + D3D_FEATURE_LEVEL m_d3dMinFeatureLevel; + + // Cached device properties. + IUnknown* m_window; + D3D_FEATURE_LEVEL m_d3dFeatureLevel; + DXGI_MODE_ROTATION m_rotation; + RECT m_outputSize; + + // Transforms used for display orientation. + DirectX::XMFLOAT4X4 m_orientationTransform3D; + + // The IDeviceNotify can be held directly as it owns the DeviceResources. + IDeviceNotify* m_deviceNotify; + }; +} diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.cpp b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e9f77887acf6e8442be6038d6212c5d7c41da26 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.cpp @@ -0,0 +1,500 @@ +//-------------------------------------------------------------------------------------- +// DirectXTKSimpleSample12.cpp +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "DirectXTKSimpleSample12.h" + +using namespace DirectX; +using namespace DirectX::SimpleMath; + +using Microsoft::WRL::ComPtr; + +Sample::Sample() +{ + m_deviceResources = std::make_unique(); + m_deviceResources->RegisterDeviceNotify(this); +} + +// Initialize the Direct3D resources required to run. +void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_gamePad = std::make_unique(); + + m_keyboard = std::make_unique(); + m_keyboard->SetWindow(reinterpret_cast(window)); + + m_mouse = std::make_unique(); + m_mouse->SetWindow(reinterpret_cast(window)); + + m_deviceResources->SetWindow(window, width, height, rotation); + + m_deviceResources->CreateDeviceResources(); + CreateDeviceDependentResources(); + + m_deviceResources->CreateWindowSizeDependentResources(); + CreateWindowSizeDependentResources(); + + // Create DirectXTK for Audio objects + AUDIO_ENGINE_FLAGS eflags = AudioEngine_Default; +#ifdef _DEBUG + eflags = eflags | AudioEngine_Debug; +#endif + + m_audEngine = std::make_unique(eflags); + + m_audioEvent = 0; + m_audioTimerAcc = 10.f; + m_retryDefault = false; + + m_waveBank = std::make_unique(m_audEngine.get(), L"adpcmdroid.xwb"); + m_soundEffect = std::make_unique(m_audEngine.get(), L"MusicMono_adpcm.wav"); + m_effect1 = m_soundEffect->CreateInstance(); + m_effect2 = m_waveBank->CreateInstance(10); + + m_effect1->Play(true); + m_effect2->Play(); +} + +#pragma region Frame Update +// Executes basic render loop. +void Sample::Tick() +{ + m_timer.Tick([&]() + { + Update(m_timer); + }); + + // Only update audio engine once per frame + if (!m_audEngine->IsCriticalError() && m_audEngine->Update()) + { + // Setup a retry in 1 second + m_audioTimerAcc = 1.f; + m_retryDefault = true; + } + + Render(); +} + +// Updates the world. +void Sample::Update(DX::StepTimer const& timer) +{ + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Update"); + + Vector3 eye(0.0f, 0.7f, 1.5f); + Vector3 at(0.0f, -0.1f, 0.0f); + + m_view = Matrix::CreateLookAt(eye, at, Vector3::UnitY); + + m_world = Matrix::CreateRotationY(float(timer.GetTotalSeconds() * XM_PIDIV4)); + + m_lineEffect->SetView(m_view); + m_lineEffect->SetWorld(Matrix::Identity); + + m_shapeEffect->SetView(m_view); + + m_audioTimerAcc -= (float)timer.GetElapsedSeconds(); + if (m_audioTimerAcc < 0) + { + if (m_retryDefault) + { + m_retryDefault = false; + if (m_audEngine->Reset()) + { + // Restart looping audio + m_effect1->Play(true); + } + } + else + { + m_audioTimerAcc = 4.f; + + m_waveBank->Play(m_audioEvent++); + + if (m_audioEvent >= 11) + m_audioEvent = 0; + } + } + + auto pad = m_gamePad->GetState(0); + if (pad.IsConnected()) + { + m_gamePadButtons.Update(pad); + + if (pad.IsViewPressed()) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + } + else + { + m_gamePadButtons.Reset(); + } + + auto kb = m_keyboard->GetState(); + m_keyboardButtons.Update(kb); + + if (kb.Escape) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + + auto mouse = m_mouse->GetState(); + mouse; + + PIXEndEvent(); +} +#pragma endregion + +#pragma region Frame Render +// Draws the scene. +void Sample::Render() +{ + // Don't try to render anything before the first Update. + if (m_timer.GetFrameCount() == 0) + { + return; + } + + // Prepare the command list to render a new frame. + m_deviceResources->Prepare(); + Clear(); + + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Render"); + + // Draw procedurally generated dynamic grid + const XMVECTORF32 xaxis = { 20.f, 0.f, 0.f }; + const XMVECTORF32 yaxis = { 0.f, 0.f, 20.f }; + DrawGrid(xaxis, yaxis, g_XMZero, 20, 20, Colors::Gray); + + // Set the descriptor heaps + ID3D12DescriptorHeap* heaps[] = { m_resourceDescriptors->Heap() }; + commandList->SetDescriptorHeaps(1, heaps); + + // Draw sprite + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Draw sprite"); + m_sprites->Begin(commandList); + m_sprites->Draw(m_resourceDescriptors->GetGpuHandle(Descriptors::WindowsLogo), GetTextureSize(m_texture2.Get()), + XMFLOAT2(10, 75)); + + m_font->DrawString(m_sprites.get(), L"DirectXTK Simple Sample", XMFLOAT2(100, 10), Colors::Yellow); + m_sprites->End(); + PIXEndEvent(commandList); + + // Draw 3D object + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Draw teapot"); + XMMATRIX local = m_world * Matrix::CreateTranslation(-2.f, -2.f, -4.f); + m_shapeEffect->SetWorld(local); + m_shapeEffect->Apply(commandList); + m_shape->Draw(commandList); + PIXEndEvent(commandList); + + // Draw model + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Draw model"); + const XMVECTORF32 scale = { 0.01f, 0.01f, 0.01f }; + const XMVECTORF32 translate = { 3.f, -2.f, -4.f }; + XMVECTOR rotate = Quaternion::CreateFromYawPitchRoll(XM_PI / 2.f, 0.f, -XM_PI / 2.f); + local = m_world * XMMatrixTransformation(g_XMZero, Quaternion::Identity, scale, g_XMZero, rotate, translate); + Model::UpdateEffectMatrices(m_modelEffects, local, m_view, m_projection); + heaps[0] = m_modelResources->DescriptorHeap(); + commandList->SetDescriptorHeaps(1, heaps); + m_model->Draw(commandList, m_modelEffects.begin()); + PIXEndEvent(commandList); + + PIXEndEvent(commandList); + + // Show the new frame. + PIXBeginEvent(m_deviceResources->GetCommandQueue(), PIX_COLOR_DEFAULT, L"Present"); + m_deviceResources->Present(); + m_graphicsMemory->Commit(m_deviceResources->GetCommandQueue()); + PIXEndEvent(m_deviceResources->GetCommandQueue()); +} + +// Helper method to clear the back buffers. +void Sample::Clear() +{ + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Clear"); + + // Clear the views. + auto rtvDescriptor = m_deviceResources->GetRenderTargetView(); + auto dsvDescriptor = m_deviceResources->GetDepthStencilView(); + + commandList->OMSetRenderTargets(1, &rtvDescriptor, FALSE, &dsvDescriptor); + commandList->ClearRenderTargetView(rtvDescriptor, Colors::CornflowerBlue, 0, nullptr); + commandList->ClearDepthStencilView(dsvDescriptor, D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr); + + // Set the viewport and scissor rect. + auto viewport = m_deviceResources->GetScreenViewport(); + auto scissorRect = m_deviceResources->GetScissorRect(); + commandList->RSSetViewports(1, &viewport); + commandList->RSSetScissorRects(1, &scissorRect); + + PIXEndEvent(commandList); +} + +void XM_CALLCONV Sample::DrawGrid(FXMVECTOR xAxis, FXMVECTOR yAxis, FXMVECTOR origin, size_t xdivs, size_t ydivs, GXMVECTOR color) +{ + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Draw grid"); + + m_lineEffect->Apply(commandList); + + m_batch->Begin(commandList); + + xdivs = std::max(1, xdivs); + ydivs = std::max(1, ydivs); + + for (size_t i = 0; i <= xdivs; ++i) + { + float fPercent = float(i) / float(xdivs); + fPercent = (fPercent * 2.0f) - 1.0f; + XMVECTOR vScale = XMVectorScale(xAxis, fPercent); + vScale = XMVectorAdd(vScale, origin); + + VertexPositionColor v1(XMVectorSubtract(vScale, yAxis), color); + VertexPositionColor v2(XMVectorAdd(vScale, yAxis), color); + m_batch->DrawLine(v1, v2); + } + + for (size_t i = 0; i <= ydivs; i++) + { + float fPercent = float(i) / float(ydivs); + fPercent = (fPercent * 2.0f) - 1.0f; + XMVECTOR vScale = XMVectorScale(yAxis, fPercent); + vScale = XMVectorAdd(vScale, origin); + + VertexPositionColor v1(XMVectorSubtract(vScale, xAxis), color); + VertexPositionColor v2(XMVectorAdd(vScale, xAxis), color); + m_batch->DrawLine(v1, v2); + } + + m_batch->End(); + + PIXEndEvent(commandList); +} +#pragma endregion + +#pragma region Message Handlers +// Message handlers +void Sample::OnActivated() +{ +} + +void Sample::OnDeactivated() +{ +} + +void Sample::OnSuspending() +{ + m_audEngine->Suspend(); +} + +void Sample::OnResuming() +{ + m_timer.ResetElapsedTime(); + m_gamePadButtons.Reset(); + m_keyboardButtons.Reset(); + m_audEngine->Resume(); +} + +void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + if (!m_deviceResources->WindowSizeChanged(width, height, rotation)) + return; + + CreateWindowSizeDependentResources(); +} + +void Sample::ValidateDevice() +{ + m_deviceResources->ValidateDevice(); +} + +void Sample::NewAudioDevice() +{ + if (m_audEngine && !m_audEngine->IsAudioDevicePresent()) + { + // Setup a retry in 1 second + m_audioTimerAcc = 1.f; + m_retryDefault = true; + } +} + +// Properties +void Sample::GetDefaultSize(int& width, int& height) const +{ + width = 1280; + height = 720; +} +#pragma endregion + +#pragma region Direct3D Resources +// These are the resources that depend on the device. +void Sample::CreateDeviceDependentResources() +{ + auto device = m_deviceResources->GetD3DDevice(); + + m_graphicsMemory = std::make_unique(device); + + m_resourceDescriptors = std::make_unique(device, + D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, + D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, + Descriptors::Count); + + m_batch = std::make_unique>(device); + + m_shape = GeometricPrimitive::CreateTeapot(4.f, 8); + + // SDKMESH has to use clockwise winding with right-handed coordinates, so textures are flipped in U + m_model = Model::CreateFromSDKMESH(L"tiny.sdkmesh"); + + { + ResourceUploadBatch resourceUpload(device); + + resourceUpload.Begin(); + + DX::ThrowIfFailed( + CreateDDSTextureFromFile(device, resourceUpload, L"assets\\seafloor.dds", m_texture1.ReleaseAndGetAddressOf()) + ); + + CreateShaderResourceView(device, m_texture1.Get(), m_resourceDescriptors->GetCpuHandle(Descriptors::SeaFloor)); + + DX::ThrowIfFailed( + CreateDDSTextureFromFile(device, resourceUpload, L"assets\\windowslogo.dds", m_texture2.ReleaseAndGetAddressOf()) + ); + + CreateShaderResourceView(device, m_texture2.Get(), m_resourceDescriptors->GetCpuHandle(Descriptors::WindowsLogo)); + + RenderTargetState rtState(m_deviceResources->GetBackBufferFormat(), m_deviceResources->GetDepthBufferFormat()); + + { + EffectPipelineStateDescription pd( + &VertexPositionColor::InputLayout, + &CommonStates::Opaque, + &CommonStates::DepthNone, + &CommonStates::CullNone, + &rtState, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE); + + m_lineEffect = std::make_unique(device, EffectFlags::VertexColor, pd); + } + + { + EffectPipelineStateDescription pd( + &GeometricPrimitive::VertexType::InputLayout, + &CommonStates::Opaque, + &CommonStates::DepthDefault, + &CommonStates::CullNone, + &rtState); + + m_shapeEffect = std::make_unique(device, EffectFlags::PerPixelLighting | EffectFlags::Texture, pd); + m_shapeEffect->EnableDefaultLighting(); + m_shapeEffect->SetTexture(m_resourceDescriptors->GetGpuHandle(Descriptors::SeaFloor)); + } + + { + SpriteBatchPipelineStateDescription pd(&rtState); + + m_sprites = std::make_unique(device, resourceUpload, &pd); + } + + m_modelResources = m_model->LoadTextures(device, resourceUpload, L"Assets\\Cathedral"); + + { + EffectPipelineStateDescription psd( + &VertexPositionNormalColorTexture::InputLayout, + &CommonStates::Opaque, + &CommonStates::DepthDefault, + &CommonStates::CullNone, + &rtState); + + m_modelEffects = m_model->CreateEffects(psd, m_modelResources->DescriptorHeap(), 0); + } + + m_font = std::make_unique(device, resourceUpload, + L"SegoeUI_18.spritefont", + m_resourceDescriptors->GetCpuHandle(Descriptors::SegoeFont), + m_resourceDescriptors->GetGpuHandle(Descriptors::SegoeFont)); + + // Upload the resources to the GPU. + auto uploadResourcesFinished = resourceUpload.End(m_deviceResources->GetCommandQueue()); + + // Wait for the command list to finish executing + m_deviceResources->WaitForGpu(); + + // Wait for the upload thread to terminate + uploadResourcesFinished.wait(); + } +} + +// Allocate all memory resources that change on a window SizeChanged event. +void Sample::CreateWindowSizeDependentResources() +{ + auto size = m_deviceResources->GetOutputSize(); + float aspectRatio = float(size.right) / float(size.bottom); + float fovAngleY = 70.0f * XM_PI / 180.0f; + + // This is a simple example of change that can be made when the app is in + // portrait or snapped view. + if (aspectRatio < 1.0f) + { + fovAngleY *= 2.0f; + } + + // Note that the OrientationTransform3D matrix is post-multiplied here + // in order to correctly orient the scene to match the display orientation. + // This post-multiplication step is required for any draw calls that are + // made to the swap chain render target. For draw calls to other targets, + // this transform should not be applied. + + // This sample makes use of a right-handed coordinate system using row-major matrices. + Matrix perspectiveMatrix = Matrix::CreatePerspectiveFieldOfView( + fovAngleY, + aspectRatio, + 0.01f, + 100.0f + ); + + Matrix orientationMatrix = m_deviceResources->GetOrientationTransform3D(); + + m_projection = perspectiveMatrix * orientationMatrix; + + m_lineEffect->SetProjection(m_projection); + m_shapeEffect->SetProjection(m_projection); + + auto viewport = m_deviceResources->GetScreenViewport(); + m_sprites->SetViewport(viewport); + + m_sprites->SetRotation(m_deviceResources->GetRotation()); +} + +void Sample::OnDeviceLost() +{ + m_texture1.Reset(); + m_texture2.Reset(); + + m_font.reset(); + m_batch.reset(); + m_shape.reset(); + m_model.reset(); + m_lineEffect.reset(); + m_shapeEffect.reset(); + m_modelEffects.clear(); + m_modelResources.reset(); + m_sprites.reset(); + m_resourceDescriptors.reset(); + m_graphicsMemory.reset(); +} + +void Sample::OnDeviceRestored() +{ + CreateDeviceDependentResources(); + + CreateWindowSizeDependentResources(); +} +#pragma endregion diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.h b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.h new file mode 100644 index 0000000000000000000000000000000000000000..6e25d69b5f5c92e957e69ae68bb0a29d2da17524 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.h @@ -0,0 +1,110 @@ +//-------------------------------------------------------------------------------------- +// DirectXTKSimpleSample12.h +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "DeviceResources.h" +#include "StepTimer.h" + + +// A basic sample implementation that creates a D3D12 device and +// provides a render loop. +class Sample : public DX::IDeviceNotify +{ +public: + + Sample(); + + // Initialization and management + void Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + + // Basic render loop + void Tick(); + void Render(); + + // Rendering helpers + void Clear(); + + // IDeviceNotify + virtual void OnDeviceLost() override; + virtual void OnDeviceRestored() override; + + // Messages + void OnActivated(); + void OnDeactivated(); + void OnSuspending(); + void OnResuming(); + void OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + void NewAudioDevice(); + + // Properties + void GetDefaultSize( int& width, int& height ) const; + +private: + + void Update(DX::StepTimer const& timer); + + void CreateDeviceDependentResources(); + void CreateWindowSizeDependentResources(); + + void XM_CALLCONV DrawGrid(DirectX::FXMVECTOR xAxis, DirectX::FXMVECTOR yAxis, DirectX::FXMVECTOR origin, size_t xdivs, size_t ydivs, DirectX::GXMVECTOR color); + + // Device resources. + std::unique_ptr m_deviceResources; + + // Rendering loop timer. + DX::StepTimer m_timer; + + // Input devices. + std::unique_ptr m_gamePad; + std::unique_ptr m_keyboard; + std::unique_ptr m_mouse; + + DirectX::GamePad::ButtonStateTracker m_gamePadButtons; + DirectX::Keyboard::KeyboardStateTracker m_keyboardButtons; + + // DirectXTK objects. + std::unique_ptr m_graphicsMemory; + std::unique_ptr m_resourceDescriptors; + std::unique_ptr m_lineEffect; + std::unique_ptr> m_batch; + std::unique_ptr m_shapeEffect; + std::unique_ptr m_model; + std::vector> m_modelEffects; + std::unique_ptr m_modelResources; + std::unique_ptr m_shape; + std::unique_ptr m_sprites; + std::unique_ptr m_font; + + std::unique_ptr m_audEngine; + std::unique_ptr m_waveBank; + std::unique_ptr m_soundEffect; + std::unique_ptr m_effect1; + std::unique_ptr m_effect2; + + Microsoft::WRL::ComPtr m_texture1; + Microsoft::WRL::ComPtr m_texture2; + + uint32_t m_audioEvent; + float m_audioTimerAcc; + + bool m_retryDefault; + + DirectX::SimpleMath::Matrix m_world; + DirectX::SimpleMath::Matrix m_view; + DirectX::SimpleMath::Matrix m_projection; + + // Descriptors + enum Descriptors + { + WindowsLogo, + SeaFloor, + SegoeFont, + Count = 256 + }; +}; \ No newline at end of file diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.sln b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.sln new file mode 100644 index 0000000000000000000000000000000000000000..22f4a414c0424982ee7e27a2e0985caf906cb98b --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTKSimpleSample12", "DirectXTKSimpleSample12.vcxproj", "{CE7FAEDA-7DD4-451D-814F-EC053C536DF3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK12", "..\..\..\Kits\DirectXTK12\DirectXTK_Windows10.vcxproj", "{945B8F0E-AE5F-447C-933A-9D069532D3E4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|ARM.ActiveCfg = Debug|ARM + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|ARM.Build.0 = Debug|ARM + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|ARM.Deploy.0 = Debug|ARM + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|x64.ActiveCfg = Debug|x64 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|x64.Build.0 = Debug|x64 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|x64.Deploy.0 = Debug|x64 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|x86.ActiveCfg = Debug|Win32 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|x86.Build.0 = Debug|Win32 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Debug|x86.Deploy.0 = Debug|Win32 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|ARM.ActiveCfg = Release|ARM + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|ARM.Build.0 = Release|ARM + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|ARM.Deploy.0 = Release|ARM + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|x64.ActiveCfg = Release|x64 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|x64.Build.0 = Release|x64 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|x64.Deploy.0 = Release|x64 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|x86.ActiveCfg = Release|Win32 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|x86.Build.0 = Release|Win32 + {CE7FAEDA-7DD4-451D-814F-EC053C536DF3}.Release|x86.Deploy.0 = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.ActiveCfg = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.Build.0 = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.ActiveCfg = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.Build.0 = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.ActiveCfg = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.Build.0 = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.ActiveCfg = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.Build.0 = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.ActiveCfg = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.Build.0 = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.ActiveCfg = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.vcxproj b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..0383f8371ccf4faa41f299fb80367d51a854ef61 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.vcxproj @@ -0,0 +1,288 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {ce7faeda-7dd4-451d-814f-ec053c536df3} + DirectXApp + DirectXTKSimpleSample12 + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + DirectXTKSimpleSample12_TemporaryKey.pfx + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + Designer + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + {945b8f0e-ae5f-447c-933a-9d069532d3e4} + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.vcxproj.filters b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..1d7bbf954b7a9f23fdf01c5d3211442d694dcd39 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12.vcxproj.filters @@ -0,0 +1,80 @@ + + + + + 1c08aa7a-3171-48ca-91ed-430fcd59db0b + + + 4573178e-7ad6-400a-b813-912afa4bc70d + bmp;dds;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + + + Common + + + Common + + + Common + + + + + + + + Common + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + Assets + + + + Assets + + + Assets + + + + + Assets + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12_TemporaryKey.pfx b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..0f74dba48f8d007a4ccdc88cc22b66155a3eb8fc Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/DirectXTKSimpleSample12_TemporaryKey.pfx differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Main.cpp b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..92b4e0d51944292f1cdfc49ff01095c2cf2316ef --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Main.cpp @@ -0,0 +1,382 @@ +//-------------------------------------------------------------------------------------- +// Main.cpp +// +// Entry point for Universal Windows Platform (UWP) app. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "DirectXTKSimpleSample12.h" + +#include + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace Windows::Devices::Enumeration; +using namespace DirectX; + +ref class ViewProvider sealed : public IFrameworkView +{ +public: + ViewProvider() : + m_exit(false), + m_visible(true), + m_DPI(96.f), + m_logicalWidth(800.f), + m_logicalHeight(600.f), + m_nativeOrientation(DisplayOrientations::None), + m_currentOrientation(DisplayOrientations::None) + { + } + + // IFrameworkView methods + virtual void Initialize(CoreApplicationView^ applicationView) + { + applicationView->Activated += ref new + TypedEventHandler(this, &ViewProvider::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &ViewProvider::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &ViewProvider::OnResuming); + + m_sample = std::make_unique(); + + m_audioWatcher = DeviceInformation::CreateWatcher(DeviceClass::AudioRender); + + m_audioWatcher->Added += ref new TypedEventHandler(this, &ViewProvider::OnAudioDeviceAdded); + m_audioWatcher->Updated += ref new TypedEventHandler(this, &ViewProvider::OnAudioDeviceUpdated); + + m_audioWatcher->Start(); + } + + virtual void Uninitialize() + { + m_sample.reset(); + } + + virtual void SetWindow(CoreWindow^ window) + { + window->SizeChanged += + ref new TypedEventHandler(this, &ViewProvider::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &ViewProvider::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &ViewProvider::OnWindowClosed); + + auto dispatcher = CoreWindow::GetForCurrentThread()->Dispatcher; + + dispatcher->AcceleratorKeyActivated += + ref new TypedEventHandler(this, &ViewProvider::OnAcceleratorKeyActivated); + + auto currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &ViewProvider::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &ViewProvider::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &ViewProvider::OnDisplayContentsInvalidated); + + m_DPI = currentDisplayInformation->LogicalDpi; + + m_logicalWidth = window->Bounds.Width; + m_logicalHeight = window->Bounds.Height; + + m_nativeOrientation = currentDisplayInformation->NativeOrientation; + m_currentOrientation = currentDisplayInformation->CurrentOrientation; + + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->Initialize(reinterpret_cast(window), + outputWidth, outputHeight, rotation ); + } + + virtual void Load(Platform::String^ entryPoint) + { + } + + virtual void Run() + { + while (!m_exit) + { + if (m_visible) + { + m_sample->Tick(); + + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } + } + +protected: + // Event handlers + void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) + { + if (args->Kind == ActivationKind::Launch) + { + auto launchArgs = static_cast(args); + + if (launchArgs->PrelaunchActivated) + { + // Opt-out of Prelaunch + CoreApplication::Exit(); + return; + } + } + + int w, h; + m_sample->GetDefaultSize(w, h); + + m_DPI = DisplayInformation::GetForCurrentView()->LogicalDpi; + + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; + // Change to ApplicationViewWindowingMode::FullScreen to default to full screen + + auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h)); + + ApplicationView::PreferredLaunchViewSize = desiredSize; + + auto view = ApplicationView::GetForCurrentView(); + + auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200)); + + view->SetPreferredMinSize(minSize); + + CoreWindow::GetForCurrentThread()->Activate(); + + view->FullScreenSystemOverlayMode = FullScreenSystemOverlayMode::Minimal; + + view->TryResizeView(desiredSize); + } + + void OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) + { + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + create_task([this, deferral]() + { + m_sample->OnSuspending(); + + deferral->Complete(); + }); + } + + void OnResuming(Platform::Object^ sender, Platform::Object^ args) + { + m_sample->OnResuming(); + } + + void OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) + { + m_logicalWidth = sender->Bounds.Width; + m_logicalHeight = sender->Bounds.Height; + + HandleWindowSizeChanged(); + } + + void OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) + { + m_visible = args->Visible; + if (m_visible) + m_sample->OnActivated(); + else + m_sample->OnDeactivated(); + } + + void OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) + { + m_exit = true; + } + + void OnAcceleratorKeyActivated(CoreDispatcher^, AcceleratorKeyEventArgs^ args) + { + if (args->EventType == CoreAcceleratorKeyEventType::SystemKeyDown + && args->VirtualKey == VirtualKey::Enter + && args->KeyStatus.IsMenuKeyDown + && !args->KeyStatus.WasKeyDown) + { + // Implements the classic ALT+ENTER fullscreen toggle + auto view = ApplicationView::GetForCurrentView(); + + if (view->IsFullScreenMode) + view->ExitFullScreenMode(); + else + view->TryEnterFullScreenMode(); + + args->Handled = true; + } + } + + void OnDpiChanged(DisplayInformation^ sender, Object^ args) + { + m_DPI = sender->LogicalDpi; + + HandleWindowSizeChanged(); + } + + void OnOrientationChanged(DisplayInformation^ sender, Object^ args) + { + m_currentOrientation = sender->CurrentOrientation; + + HandleWindowSizeChanged(); + } + + void OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) + { + m_sample->ValidateDevice(); + } + + void OnAudioDeviceAdded(Windows::Devices::Enumeration::DeviceWatcher^ sender, Windows::Devices::Enumeration::DeviceInformation^ args) + { + m_sample->NewAudioDevice(); + } + + void OnAudioDeviceUpdated(Windows::Devices::Enumeration::DeviceWatcher^ sender, Windows::Devices::Enumeration::DeviceInformationUpdate^ args) + { + m_sample->NewAudioDevice(); + } + +private: + bool m_exit; + bool m_visible; + float m_DPI; + float m_logicalWidth; + float m_logicalHeight; + std::unique_ptr m_sample; + + Windows::Graphics::Display::DisplayOrientations m_nativeOrientation; + Windows::Graphics::Display::DisplayOrientations m_currentOrientation; + + Windows::Devices::Enumeration::DeviceWatcher^ m_audioWatcher; + + inline int ConvertDipsToPixels(float dips) const + { + return int(dips * m_DPI / 96.f + 0.5f); + } + + inline float ConvertPixelsToDips(int pixels) const + { + return (float(pixels) * 96.f / m_DPI); + } + + DXGI_MODE_ROTATION ComputeDisplayRotation() const + { + DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; + + switch (m_nativeOrientation) + { + case DisplayOrientations::Landscape: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + } + break; + + case DisplayOrientations::Portrait: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + } + break; + } + + return rotation; + } + + void HandleWindowSizeChanged() + { + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->OnWindowSizeChanged(outputWidth, outputHeight, rotation); + } +}; + +ref class ViewProviderFactory : IFrameworkViewSource +{ +public: + virtual IFrameworkView^ CreateView() + { + return ref new ViewProvider(); + } +}; + + +// Entry point +[Platform::MTAThread] +int main(Platform::Array^ argv) +{ + UNREFERENCED_PARAMETER(argv); + + if (!XMVerifyCPUSupport()) + { + throw std::exception("XMVerifyCPUSupport"); + } + + auto viewProviderFactory = ref new ViewProviderFactory(); + CoreApplication::Run(viewProviderFactory); + return 0; +} diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Package.appxmanifest b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Package.appxmanifest new file mode 100644 index 0000000000000000000000000000000000000000..5883de9be903cd7484e9c49c9256937d2990b476 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + DirectXTKSimpleSample12 + Xbox Advanced Technology Group + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Readme.docx b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Readme.docx new file mode 100644 index 0000000000000000000000000000000000000000..5ac43e6b0b615989e29526ac6fc380198155f566 Binary files /dev/null and b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/Readme.docx differ diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/StepTimer.h b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/StepTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f7acf56417f3184f8c17beecfbb1aaa124cdaf --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/StepTimer.h @@ -0,0 +1,188 @@ +// +// StepTimer.h - A simple timer that provides elapsed time information +// + +#pragma once + +#include +#include + +namespace DX +{ + // Helper class for animation and simulation timing. + class StepTimer + { + public: + StepTimer() : + m_elapsedTicks(0), + m_totalTicks(0), + m_leftOverTicks(0), + m_frameCount(0), + m_framesPerSecond(0), + m_framesThisSecond(0), + m_qpcSecondCounter(0), + m_isFixedTimeStep(false), + m_targetElapsedTicks(TicksPerSecond / 60) + { + if (!QueryPerformanceFrequency(&m_qpcFrequency)) + { + throw std::exception( "QueryPerformanceFrequency" ); + } + + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + // Initialize max delta to 1/10 of a second. + m_qpcMaxDelta = m_qpcFrequency.QuadPart / 10; + } + + // Get elapsed time since the previous Update call. + uint64_t GetElapsedTicks() const { return m_elapsedTicks; } + double GetElapsedSeconds() const { return TicksToSeconds(m_elapsedTicks); } + + // Get total time since the start of the program. + uint64_t GetTotalTicks() const { return m_totalTicks; } + double GetTotalSeconds() const { return TicksToSeconds(m_totalTicks); } + + // Get total number of updates since start of the program. + uint32_t GetFrameCount() const { return m_frameCount; } + + // Get the current framerate. + uint32_t GetFramesPerSecond() const { return m_framesPerSecond; } + + // Set whether to use fixed or variable timestep mode. + void SetFixedTimeStep(bool isFixedTimestep) { m_isFixedTimeStep = isFixedTimestep; } + + // Set how often to call Update when in fixed timestep mode. + void SetTargetElapsedTicks(uint64_t targetElapsed) { m_targetElapsedTicks = targetElapsed; } + void SetTargetElapsedSeconds(double targetElapsed) { m_targetElapsedTicks = SecondsToTicks(targetElapsed); } + + // Integer format represents time using 10,000,000 ticks per second. + static const uint64_t TicksPerSecond = 10000000; + + static double TicksToSeconds(uint64_t ticks) { return static_cast(ticks) / TicksPerSecond; } + static uint64_t SecondsToTicks(double seconds) { return static_cast(seconds * TicksPerSecond); } + + // After an intentional timing discontinuity (for instance a blocking IO operation) + // call this to avoid having the fixed timestep logic attempt a set of catch-up + // Update calls. + + void ResetElapsedTime() + { + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception("QueryPerformanceCounter"); + } + + m_leftOverTicks = 0; + m_framesPerSecond = 0; + m_framesThisSecond = 0; + m_qpcSecondCounter = 0; + } + + // Update timer state, calling the specified Update function the appropriate number of times. + template + void Tick(const TUpdate& update) + { + // Query the current time. + LARGE_INTEGER currentTime; + + if (!QueryPerformanceCounter(¤tTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + uint64_t timeDelta = currentTime.QuadPart - m_qpcLastTime.QuadPart; + + m_qpcLastTime = currentTime; + m_qpcSecondCounter += timeDelta; + + // Clamp excessively large time deltas (e.g. after paused in the debugger). + if (timeDelta > m_qpcMaxDelta) + { + timeDelta = m_qpcMaxDelta; + } + + // Convert QPC units into a canonical tick format. This cannot overflow due to the previous clamp. + timeDelta *= TicksPerSecond; + timeDelta /= m_qpcFrequency.QuadPart; + + uint32_t lastFrameCount = m_frameCount; + + if (m_isFixedTimeStep) + { + // Fixed timestep update logic + + // If the app is running very close to the target elapsed time (within 1/4 of a millisecond) just clamp + // the clock to exactly match the target value. This prevents tiny and irrelevant errors + // from accumulating over time. Without this clamping, a game that requested a 60 fps + // fixed update, running with vsync enabled on a 59.94 NTSC display, would eventually + // accumulate enough tiny errors that it would drop a frame. It is better to just round + // small deviations down to zero to leave things running smoothly. + + if (abs(static_cast(timeDelta - m_targetElapsedTicks)) < TicksPerSecond / 4000) + { + timeDelta = m_targetElapsedTicks; + } + + m_leftOverTicks += timeDelta; + + while (m_leftOverTicks >= m_targetElapsedTicks) + { + m_elapsedTicks = m_targetElapsedTicks; + m_totalTicks += m_targetElapsedTicks; + m_leftOverTicks -= m_targetElapsedTicks; + m_frameCount++; + + update(); + } + } + else + { + // Variable timestep update logic. + m_elapsedTicks = timeDelta; + m_totalTicks += timeDelta; + m_leftOverTicks = 0; + m_frameCount++; + + update(); + } + + // Track the current framerate. + if (m_frameCount != lastFrameCount) + { + m_framesThisSecond++; + } + + if (m_qpcSecondCounter >= static_cast(m_qpcFrequency.QuadPart)) + { + m_framesPerSecond = m_framesThisSecond; + m_framesThisSecond = 0; + m_qpcSecondCounter %= m_qpcFrequency.QuadPart; + } + } + + private: + // Source timing data uses QPC units. + LARGE_INTEGER m_qpcFrequency; + LARGE_INTEGER m_qpcLastTime; + uint64_t m_qpcMaxDelta; + + // Derived timing data uses a canonical tick format. + uint64_t m_elapsedTicks; + uint64_t m_totalTicks; + uint64_t m_leftOverTicks; + + // Members for tracking the framerate. + uint32_t m_frameCount; + uint32_t m_framesPerSecond; + uint32_t m_framesThisSecond; + uint64_t m_qpcSecondCounter; + + // Members for configuring fixed timestep mode. + bool m_isFixedTimeStep; + uint64_t m_targetElapsedTicks; + }; +} diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/d3dx12.h b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/d3dx12.h new file mode 100644 index 0000000000000000000000000000000000000000..351914d38a47281f2e9ee95e1f4aff0f039cf7b2 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/d3dx12.h @@ -0,0 +1,1534 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#ifndef __D3DX12_H__ +#define __D3DX12_H__ + +#include "d3d12.h" + +#if defined( __cplusplus ) + +struct CD3DX12_DEFAULT {}; +extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT; + +//------------------------------------------------------------------------------------------------ +inline bool operator==( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ + return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && + l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; +} + +//------------------------------------------------------------------------------------------------ +inline bool operator!=( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RECT : public D3D12_RECT +{ + CD3DX12_RECT() + {} + explicit CD3DX12_RECT( const D3D12_RECT& o ) : + D3D12_RECT( o ) + {} + explicit CD3DX12_RECT( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + right = Right; + bottom = Bottom; + } + ~CD3DX12_RECT() {} + operator const D3D12_RECT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BOX : public D3D12_BOX +{ + CD3DX12_BOX() + {} + explicit CD3DX12_BOX( const D3D12_BOX& o ) : + D3D12_BOX( o ) + {} + explicit CD3DX12_BOX( + LONG Left, + LONG Right ) + { + left = Left; + top = 0; + front = 0; + right = Right; + bottom = 1; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + front = 0; + right = Right; + bottom = Bottom; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Front, + LONG Right, + LONG Bottom, + LONG Back ) + { + left = Left; + top = Top; + front = Front; + right = Right; + bottom = Bottom; + back = Back; + } + ~CD3DX12_BOX() {} + operator const D3D12_BOX&() const { return *this; } +}; +inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r ) +{ + return l.left == r.left && l.top == r.top && l.front == r.front && + l.right == r.right && l.bottom == r.bottom && l.back == r.back; +} +inline bool operator!=( const D3D12_BOX& l, const D3D12_BOX& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC +{ + CD3DX12_DEPTH_STENCIL_DESC() + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( const D3D12_DEPTH_STENCIL_DESC& o ) : + D3D12_DEPTH_STENCIL_DESC( o ) + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( CD3DX12_DEFAULT ) + { + DepthEnable = TRUE; + DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; + DepthFunc = D3D12_COMPARISON_FUNC_LESS; + StencilEnable = FALSE; + StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK; + StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK; + const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = + { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS }; + FrontFace = defaultStencilOp; + BackFace = defaultStencilOp; + } + explicit CD3DX12_DEPTH_STENCIL_DESC( + BOOL depthEnable, + D3D12_DEPTH_WRITE_MASK depthWriteMask, + D3D12_COMPARISON_FUNC depthFunc, + BOOL stencilEnable, + UINT8 stencilReadMask, + UINT8 stencilWriteMask, + D3D12_STENCIL_OP frontStencilFailOp, + D3D12_STENCIL_OP frontStencilDepthFailOp, + D3D12_STENCIL_OP frontStencilPassOp, + D3D12_COMPARISON_FUNC frontStencilFunc, + D3D12_STENCIL_OP backStencilFailOp, + D3D12_STENCIL_OP backStencilDepthFailOp, + D3D12_STENCIL_OP backStencilPassOp, + D3D12_COMPARISON_FUNC backStencilFunc ) + { + DepthEnable = depthEnable; + DepthWriteMask = depthWriteMask; + DepthFunc = depthFunc; + StencilEnable = stencilEnable; + StencilReadMask = stencilReadMask; + StencilWriteMask = stencilWriteMask; + FrontFace.StencilFailOp = frontStencilFailOp; + FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; + FrontFace.StencilPassOp = frontStencilPassOp; + FrontFace.StencilFunc = frontStencilFunc; + BackFace.StencilFailOp = backStencilFailOp; + BackFace.StencilDepthFailOp = backStencilDepthFailOp; + BackFace.StencilPassOp = backStencilPassOp; + BackFace.StencilFunc = backStencilFunc; + } + ~CD3DX12_DEPTH_STENCIL_DESC() {} + operator const D3D12_DEPTH_STENCIL_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC +{ + CD3DX12_BLEND_DESC() + {} + explicit CD3DX12_BLEND_DESC( const D3D12_BLEND_DESC& o ) : + D3D12_BLEND_DESC( o ) + {} + explicit CD3DX12_BLEND_DESC( CD3DX12_DEFAULT ) + { + AlphaToCoverageEnable = FALSE; + IndependentBlendEnable = FALSE; + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + FALSE,FALSE, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + RenderTarget[ i ] = defaultRenderTargetBlendDesc; + } + ~CD3DX12_BLEND_DESC() {} + operator const D3D12_BLEND_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC +{ + CD3DX12_RASTERIZER_DESC() + {} + explicit CD3DX12_RASTERIZER_DESC( const D3D12_RASTERIZER_DESC& o ) : + D3D12_RASTERIZER_DESC( o ) + {} + explicit CD3DX12_RASTERIZER_DESC( CD3DX12_DEFAULT ) + { + FillMode = D3D12_FILL_MODE_SOLID; + CullMode = D3D12_CULL_MODE_BACK; + FrontCounterClockwise = FALSE; + DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + DepthClipEnable = TRUE; + MultisampleEnable = FALSE; + AntialiasedLineEnable = FALSE; + ForcedSampleCount = 0; + ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + } + explicit CD3DX12_RASTERIZER_DESC( + D3D12_FILL_MODE fillMode, + D3D12_CULL_MODE cullMode, + BOOL frontCounterClockwise, + INT depthBias, + FLOAT depthBiasClamp, + FLOAT slopeScaledDepthBias, + BOOL depthClipEnable, + BOOL multisampleEnable, + BOOL antialiasedLineEnable, + UINT forcedSampleCount, + D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) + { + FillMode = fillMode; + CullMode = cullMode; + FrontCounterClockwise = frontCounterClockwise; + DepthBias = depthBias; + DepthBiasClamp = depthBiasClamp; + SlopeScaledDepthBias = slopeScaledDepthBias; + DepthClipEnable = depthClipEnable; + MultisampleEnable = multisampleEnable; + AntialiasedLineEnable = antialiasedLineEnable; + ForcedSampleCount = forcedSampleCount; + ConservativeRaster = conservativeRaster; + } + ~CD3DX12_RASTERIZER_DESC() {} + operator const D3D12_RASTERIZER_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO +{ + CD3DX12_RESOURCE_ALLOCATION_INFO() + {} + explicit CD3DX12_RESOURCE_ALLOCATION_INFO( const D3D12_RESOURCE_ALLOCATION_INFO& o ) : + D3D12_RESOURCE_ALLOCATION_INFO( o ) + {} + CD3DX12_RESOURCE_ALLOCATION_INFO( + UINT64 size, + UINT64 alignment ) + { + SizeInBytes = size; + Alignment = alignment; + } + operator const D3D12_RESOURCE_ALLOCATION_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES +{ + CD3DX12_HEAP_PROPERTIES() + {} + explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES &o) : + D3D12_HEAP_PROPERTIES(o) + {} + CD3DX12_HEAP_PROPERTIES( + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = D3D12_HEAP_TYPE_CUSTOM; + CPUPageProperty = cpuPageProperty; + MemoryPoolPreference = memoryPoolPreference; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + explicit CD3DX12_HEAP_PROPERTIES( + D3D12_HEAP_TYPE type, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = type; + CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + operator const D3D12_HEAP_PROPERTIES&() const { return *this; } + bool IsCPUAccessible() const + { + return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK || (Type == D3D12_HEAP_TYPE_CUSTOM && + (CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE || CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK)); + } +}; +inline bool operator==( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ + return l.Type == r.Type && l.CPUPageProperty == r.CPUPageProperty && + l.MemoryPoolPreference == r.MemoryPoolPreference && + l.CreationNodeMask == r.CreationNodeMask && + l.VisibleNodeMask == r.VisibleNodeMask; +} +inline bool operator!=( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC +{ + CD3DX12_HEAP_DESC() + {} + explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC &o) : + D3D12_HEAP_DESC(o) + {} + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_PROPERTIES properties, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = properties; + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_TYPE type, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_PROPERTIES properties, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = properties; + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_TYPE type, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + operator const D3D12_HEAP_DESC&() const { return *this; } + bool IsCPUAccessible() const + { return static_cast< const CD3DX12_HEAP_PROPERTIES* >( &Properties )->IsCPUAccessible(); } +}; +inline bool operator==( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ + return l.SizeInBytes == r.SizeInBytes && + l.Properties == r.Properties && + l.Alignment == r.Alignment && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE +{ + CD3DX12_CLEAR_VALUE() + {} + explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE &o) : + D3D12_CLEAR_VALUE(o) + {} + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + const FLOAT color[4] ) + { + Format = format; + memcpy( Color, color, sizeof( Color ) ); + } + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + FLOAT depth, + UINT8 stencil ) + { + Format = format; + /* Use memcpy to preserve NAN values */ + memcpy( &DepthStencil.Depth, &depth, sizeof( depth ) ); + DepthStencil.Stencil = stencil; + } + operator const D3D12_CLEAR_VALUE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RANGE : public D3D12_RANGE +{ + CD3DX12_RANGE() + {} + explicit CD3DX12_RANGE(const D3D12_RANGE &o) : + D3D12_RANGE(o) + {} + CD3DX12_RANGE( + SIZE_T begin, + SIZE_T end ) + { + Begin = begin; + End = end; + } + operator const D3D12_RANGE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE +{ + CD3DX12_SHADER_BYTECODE() + {} + explicit CD3DX12_SHADER_BYTECODE(const D3D12_SHADER_BYTECODE &o) : + D3D12_SHADER_BYTECODE(o) + {} + CD3DX12_SHADER_BYTECODE( + ID3DBlob* pShaderBlob ) + { + pShaderBytecode = pShaderBlob->GetBufferPointer(); + BytecodeLength = pShaderBlob->GetBufferSize(); + } + CD3DX12_SHADER_BYTECODE( + void* _pShaderBytecode, + SIZE_T bytecodeLength ) + { + pShaderBytecode = _pShaderBytecode; + BytecodeLength = bytecodeLength; + } + operator const D3D12_SHADER_BYTECODE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE +{ + CD3DX12_TILED_RESOURCE_COORDINATE() + {} + explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE &o) : + D3D12_TILED_RESOURCE_COORDINATE(o) + {} + CD3DX12_TILED_RESOURCE_COORDINATE( + UINT x, + UINT y, + UINT z, + UINT subresource ) + { + X = x; + Y = y; + Z = z; + Subresource = subresource; + } + operator const D3D12_TILED_RESOURCE_COORDINATE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE +{ + CD3DX12_TILE_REGION_SIZE() + {} + explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE &o) : + D3D12_TILE_REGION_SIZE(o) + {} + CD3DX12_TILE_REGION_SIZE( + UINT numTiles, + BOOL useBox, + UINT width, + UINT16 height, + UINT16 depth ) + { + NumTiles = numTiles; + UseBox = useBox; + Width = width; + Height = height; + Depth = depth; + } + operator const D3D12_TILE_REGION_SIZE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING +{ + CD3DX12_SUBRESOURCE_TILING() + {} + explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING &o) : + D3D12_SUBRESOURCE_TILING(o) + {} + CD3DX12_SUBRESOURCE_TILING( + UINT widthInTiles, + UINT16 heightInTiles, + UINT16 depthInTiles, + UINT startTileIndexInOverallResource ) + { + WidthInTiles = widthInTiles; + HeightInTiles = heightInTiles; + DepthInTiles = depthInTiles; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_SUBRESOURCE_TILING&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE +{ + CD3DX12_TILE_SHAPE() + {} + explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE &o) : + D3D12_TILE_SHAPE(o) + {} + CD3DX12_TILE_SHAPE( + UINT widthInTexels, + UINT heightInTexels, + UINT depthInTexels ) + { + WidthInTexels = widthInTexels; + HeightInTexels = heightInTexels; + DepthInTexels = depthInTexels; + } + operator const D3D12_TILE_SHAPE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER +{ + CD3DX12_RESOURCE_BARRIER() + {} + explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) : + D3D12_RESOURCE_BARRIER(o) + {} + static inline CD3DX12_RESOURCE_BARRIER Transition( + _In_ ID3D12Resource* pResource, + D3D12_RESOURCE_STATES stateBefore, + D3D12_RESOURCE_STATES stateAfter, + UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + result.Flags = flags; + barrier.Transition.pResource = pResource; + barrier.Transition.StateBefore = stateBefore; + barrier.Transition.StateAfter = stateAfter; + barrier.Transition.Subresource = subresource; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER Aliasing( + _In_ ID3D12Resource* pResourceBefore, + _In_ ID3D12Resource* pResourceAfter) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING; + barrier.Aliasing.pResourceBefore = pResourceBefore; + barrier.Aliasing.pResourceAfter = pResourceAfter; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER UAV( + _In_ ID3D12Resource* pResource) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.UAV.pResource = pResource; + return result; + } + operator const D3D12_RESOURCE_BARRIER&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO +{ + CD3DX12_PACKED_MIP_INFO() + {} + explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO &o) : + D3D12_PACKED_MIP_INFO(o) + {} + CD3DX12_PACKED_MIP_INFO( + UINT8 numStandardMips, + UINT8 numPackedMips, + UINT numTilesForPackedMips, + UINT startTileIndexInOverallResource ) + { + NumStandardMips = numStandardMips; + NumPackedMips = numPackedMips; + NumTilesForPackedMips = numTilesForPackedMips; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_PACKED_MIP_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT +{ + CD3DX12_SUBRESOURCE_FOOTPRINT() + {} + explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT &o) : + D3D12_SUBRESOURCE_FOOTPRINT(o) + {} + CD3DX12_SUBRESOURCE_FOOTPRINT( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT rowPitch ) + { + Format = format; + Width = width; + Height = height; + Depth = depth; + RowPitch = rowPitch; + } + explicit CD3DX12_SUBRESOURCE_FOOTPRINT( + const D3D12_RESOURCE_DESC& resDesc, + UINT rowPitch ) + { + Format = resDesc.Format; + Width = UINT( resDesc.Width ); + Height = resDesc.Height; + Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1); + RowPitch = rowPitch; + } + operator const D3D12_SUBRESOURCE_FOOTPRINT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION +{ + CD3DX12_TEXTURE_COPY_LOCATION() + {} + explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION &o) : + D3D12_TEXTURE_COPY_LOCATION(o) + {} + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes) { pResource = pRes; } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, D3D12_PLACED_SUBRESOURCE_FOOTPRINT const& Footprint) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + PlacedFootprint = Footprint; + } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, UINT Sub) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + SubresourceIndex = Sub; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE +{ + CD3DX12_DESCRIPTOR_RANGE() { } + explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) : + D3D12_DESCRIPTOR_RANGE(o) + {} + CD3DX12_DESCRIPTOR_RANGE( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + inline void Init( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + static inline void Init( + _Out_ D3D12_DESCRIPTOR_RANGE &range, + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + range.RangeType = rangeType; + range.NumDescriptors = numDescriptors; + range.BaseShaderRegister = baseShaderRegister; + range.RegisterSpace = registerSpace; + range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE +{ + CD3DX12_ROOT_DESCRIPTOR_TABLE() {} + explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) : + D3D12_ROOT_DESCRIPTOR_TABLE(o) + {} + CD3DX12_ROOT_DESCRIPTOR_TABLE( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(numDescriptorRanges, _pDescriptorRanges); + } + + inline void Init( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(*this, numDescriptorRanges, _pDescriptorRanges); + } + + static inline void Init( + _Out_ D3D12_ROOT_DESCRIPTOR_TABLE &rootDescriptorTable, + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges; + rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS +{ + CD3DX12_ROOT_CONSTANTS() {} + explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) : + D3D12_ROOT_CONSTANTS(o) + {} + CD3DX12_ROOT_CONSTANTS( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(num32BitValues, shaderRegister, registerSpace); + } + + inline void Init( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, num32BitValues, shaderRegister, registerSpace); + } + + static inline void Init( + _Out_ D3D12_ROOT_CONSTANTS &rootConstants, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + rootConstants.Num32BitValues = num32BitValues; + rootConstants.ShaderRegister = shaderRegister; + rootConstants.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR +{ + CD3DX12_ROOT_DESCRIPTOR() {} + explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) : + D3D12_ROOT_DESCRIPTOR(o) + {} + CD3DX12_ROOT_DESCRIPTOR( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(shaderRegister, registerSpace); + } + + inline void Init( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, shaderRegister, registerSpace); + } + + static inline void Init(_Out_ D3D12_ROOT_DESCRIPTOR &table, UINT shaderRegister, UINT registerSpace = 0) + { + table.ShaderRegister = shaderRegister; + table.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER +{ + CD3DX12_ROOT_PARAMETER() {} + explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) : + D3D12_ROOT_PARAMETER(o) + {} + + static inline void InitAsDescriptorTable( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR_TABLE::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges); + } + + static inline void InitAsConstants( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace); + } + + static inline void InitAsConstantBufferView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsShaderResourceView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsUnorderedAccessView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + inline void InitAsDescriptorTable( + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility); + } + + inline void InitAsConstants( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility); + } + + inline void InitAsConstantBufferView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstantBufferView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsShaderResourceView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsShaderResourceView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsUnorderedAccessView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, visibility); + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC +{ + CD3DX12_STATIC_SAMPLER_DESC() {} + explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) : + D3D12_STATIC_SAMPLER_DESC(o) + {} + CD3DX12_STATIC_SAMPLER_DESC( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + + static inline void Init( + _Out_ D3D12_STATIC_SAMPLER_DESC &samplerDesc, + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + samplerDesc.ShaderRegister = shaderRegister; + samplerDesc.Filter = filter; + samplerDesc.AddressU = addressU; + samplerDesc.AddressV = addressV; + samplerDesc.AddressW = addressW; + samplerDesc.MipLODBias = mipLODBias; + samplerDesc.MaxAnisotropy = maxAnisotropy; + samplerDesc.ComparisonFunc = comparisonFunc; + samplerDesc.BorderColor = borderColor; + samplerDesc.MinLOD = minLOD; + samplerDesc.MaxLOD = maxLOD; + samplerDesc.ShaderVisibility = shaderVisibility; + samplerDesc.RegisterSpace = registerSpace; + } + inline void Init( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + *this, + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC +{ + CD3DX12_ROOT_SIGNATURE_DESC() {} + explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) : + D3D12_ROOT_SIGNATURE_DESC(o) + {} + CD3DX12_ROOT_SIGNATURE_DESC( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + CD3DX12_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) + { + Init(0, NULL, 0, NULL, D3D12_ROOT_SIGNATURE_FLAG_NONE); + } + + inline void Init( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + + static inline void Init( + _Out_ D3D12_ROOT_SIGNATURE_DESC &desc, + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + desc.NumParameters = numParameters; + desc.pParameters = _pParameters; + desc.NumStaticSamplers = numStaticSamplers; + desc.pStaticSamplers = _pStaticSamplers; + desc.Flags = flags; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE +{ + CD3DX12_CPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) : + D3D12_CPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_CPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + bool operator!=(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE &operator=(const D3D12_CPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE +{ + CD3DX12_GPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) : + D3D12_GPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_GPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + inline bool operator!=(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE &operator=(const D3D12_GPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +inline UINT D3D12CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT PlaneSlice, UINT MipLevels, UINT ArraySize ) +{ + return MipSlice + ArraySlice * MipLevels + PlaneSlice * MipLevels * ArraySize; +} + +//------------------------------------------------------------------------------------------------ +template +inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice ) +{ + MipSlice = static_cast(Subresource % MipLevels); + ArraySlice = static_cast((Subresource / MipLevels) % ArraySize); + PlaneSlice = static_cast(Subresource / (MipLevels * ArraySize)); +} + +//------------------------------------------------------------------------------------------------ +inline UINT8 D3D12GetFormatPlaneCount( + _In_ ID3D12Device* pDevice, + DXGI_FORMAT Format + ) +{ + D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format}; + if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo)))) + { + return 0; + } + return formatInfo.PlaneCount; +} + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC +{ + CD3DX12_RESOURCE_DESC() + {} + explicit CD3DX12_RESOURCE_DESC( const D3D12_RESOURCE_DESC& o ) : + D3D12_RESOURCE_DESC( o ) + {} + CD3DX12_RESOURCE_DESC( + D3D12_RESOURCE_DIMENSION dimension, + UINT64 alignment, + UINT64 width, + UINT height, + UINT16 depthOrArraySize, + UINT16 mipLevels, + DXGI_FORMAT format, + UINT sampleCount, + UINT sampleQuality, + D3D12_TEXTURE_LAYOUT layout, + D3D12_RESOURCE_FLAGS flags ) + { + Dimension = dimension; + Alignment = alignment; + Width = width; + Height = height; + DepthOrArraySize = depthOrArraySize; + MipLevels = mipLevels; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Layout = layout; + Flags = flags; + } + static inline CD3DX12_RESOURCE_DESC Buffer( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, + 1, 1, 1, DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Buffer( + UINT64 width, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, + DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex1D( + DXGI_FORMAT format, + UINT64 width, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, + mipLevels, format, 1, 0, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex2D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, + mipLevels, format, sampleCount, sampleQuality, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex3D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 depth, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, + mipLevels, format, 1, 0, layout, flags ); + } + inline UINT16 Depth() const + { return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT16 ArraySize() const + { return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const + { return D3D12GetFormatPlaneCount(pDevice, Format); } + inline UINT Subresources(_In_ ID3D12Device* pDevice) const + { return MipLevels * ArraySize() * PlaneCount(pDevice); } + inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) + { return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); } + operator const D3D12_RESOURCE_DESC&() const { return *this; } +}; +inline bool operator==( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ + return l.Dimension == r.Dimension && + l.Alignment == r.Alignment && + l.Width == r.Width && + l.Height == r.Height && + l.DepthOrArraySize == r.DepthOrArraySize && + l.MipLevels == r.MipLevels && + l.Format == r.Format && + l.SampleDesc.Count == r.SampleDesc.Count && + l.SampleDesc.Quality == r.SampleDesc.Quality && + l.Layout == r.Layout && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +// Row-by-row memcpy +inline void MemcpySubresource( + _In_ const D3D12_MEMCPY_DEST* pDest, + _In_ const D3D12_SUBRESOURCE_DATA* pSrc, + SIZE_T RowSizeInBytes, + UINT NumRows, + UINT NumSlices) +{ + for (UINT z = 0; z < NumSlices; ++z) + { + BYTE* pDestSlice = reinterpret_cast(pDest->pData) + pDest->SlicePitch * z; + const BYTE* pSrcSlice = reinterpret_cast(pSrc->pData) + pSrc->SlicePitch * z; + for (UINT y = 0; y < NumRows; ++y) + { + memcpy(pDestSlice + pDest->RowPitch * y, + pSrcSlice + pSrc->RowPitch * y, + RowSizeInBytes); + } + } +} + +//------------------------------------------------------------------------------------------------ +// Returns required size of a buffer to be used for data upload +inline UINT64 GetRequiredIntermediateSize( + _In_ ID3D12Resource* pDestinationResource, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources) +{ + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + UINT64 RequiredSize = 0; + + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize); + pDevice->Release(); + + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// All arrays must be populated (e.g. by calling GetCopyableFootprints) +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 RequiredSize, + _In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts, + _In_reads_(NumSubresources) const UINT* pNumRows, + _In_reads_(NumSubresources) const UINT64* pRowSizesInBytes, + _In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) +{ + // Minor validation + D3D12_RESOURCE_DESC IntermediateDesc = pIntermediate->GetDesc(); + D3D12_RESOURCE_DESC DestinationDesc = pDestinationResource->GetDesc(); + if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER || + IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset || + RequiredSize > (SIZE_T)-1 || + (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER && + (FirstSubresource != 0 || NumSubresources != 1))) + { + return 0; + } + + BYTE* pData; + HRESULT hr = pIntermediate->Map(0, NULL, reinterpret_cast(&pData)); + if (FAILED(hr)) + { + return 0; + } + + for (UINT i = 0; i < NumSubresources; ++i) + { + if (pRowSizesInBytes[i] > (SIZE_T)-1) return 0; + D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, pLayouts[i].Footprint.RowPitch * pNumRows[i] }; + MemcpySubresource(&DestData, &pSrcData[i], (SIZE_T)pRowSizesInBytes[i], pNumRows[i], pLayouts[i].Footprint.Depth); + } + pIntermediate->Unmap(0, NULL); + + if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + CD3DX12_BOX SrcBox( UINT( pLayouts[0].Offset ), UINT( pLayouts[0].Offset + pLayouts[0].Footprint.Width ) ); + pCmdList->CopyBufferRegion( + pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width); + } + else + { + for (UINT i = 0; i < NumSubresources; ++i) + { + CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource); + CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]); + pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr); + } + } + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// Heap-allocating UpdateSubresources implementation +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + UINT64 MemToAlloc = static_cast(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources; + if (MemToAlloc > SIZE_MAX) + { + return 0; + } + void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast(MemToAlloc)); + if (pMem == NULL) + { + return 0; + } + D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts = reinterpret_cast(pMem); + UINT64* pRowSizesInBytes = reinterpret_cast(pLayouts + NumSubresources); + UINT* pNumRows = reinterpret_cast(pRowSizesInBytes + NumSubresources); + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize); + pDevice->Release(); + + UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData); + HeapFree(GetProcessHeap(), 0, pMem); + return Result; +} + +//------------------------------------------------------------------------------------------------ +// Stack-allocating UpdateSubresources implementation +template +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0, MaxSubresources) UINT FirstSubresource, + _In_range_(1, MaxSubresources - FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources]; + UINT NumRows[MaxSubresources]; + UINT64 RowSizesInBytes[MaxSubresources]; + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize); + pDevice->Release(); + + return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData); +} + +//------------------------------------------------------------------------------------------------ +inline bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout ) +{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; } + +//------------------------------------------------------------------------------------------------ +inline ID3D12CommandList * const * CommandListCast(ID3D12GraphicsCommandList * const * pp) +{ + // This cast is useful for passing strongly typed command list pointers into + // ExecuteCommandLists. + // This cast is valid as long as the const-ness is respected. D3D12 APIs do + // respect the const-ness of their arguments. + return reinterpret_cast(pp); +} + + +#endif // defined( __cplusplus ) + +#endif //__D3DX12_H__ + + + diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/pch.cpp b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..851c81be9b30ae3e8175fb950b95a1c9508580a3 --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/pch.cpp @@ -0,0 +1,10 @@ +//-------------------------------------------------------------------------------------- +// pch.cpp +// +// Include the standard header and generate the precompiled header. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" diff --git a/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/pch.h b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..9ca9171faf92b33c60d449629f6e190d99fcc46c --- /dev/null +++ b/Samples/IntroGraphics/DirectXTKSimpleSampleUWP12/pch.h @@ -0,0 +1,83 @@ +//-------------------------------------------------------------------------------------- +// pch.h +// +// Header for standard system include files. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +// Use the C++ standard templated min/max +#define NOMINMAX + +#include + +#include +#include +#include +#include + +#include "d3dx12.h" + +#include +#include +#include +#include + +#include +#include + +#ifdef _DEBUG +#include +#endif + +#include "Audio.h" +#include "CommonStates.h" +#include "DirectXHelpers.h" +#include "DDSTextureLoader.h" +#include "DescriptorHeap.h" +#include "Effects.h" +#include "GamePad.h" +#include "GeometricPrimitive.h" +#include "GraphicsMemory.h" +#include "Keyboard.h" +#include "Model.h" +#include "Mouse.h" +#include "PrimitiveBatch.h" +#include "ResourceUploadBatch.h" +#include "RenderTargetState.h" +#include "SimpleMath.h" +#include "SpriteBatch.h" +#include "SpriteFont.h" +#include "VertexTypes.h" + +namespace DX +{ + // Helper class for COM exceptions + class com_exception : public std::exception + { + public: + com_exception(HRESULT hr) : result(hr) {} + + virtual const char* what() const override + { + static char s_str[64] = { 0 }; + sprintf_s(s_str, "Failure with HRESULT of %08X", result); + return s_str; + } + + private: + HRESULT result; + }; + + // Helper utility converts D3D API failures into exceptions. + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + throw com_exception(hr); + } + } +} \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP/SimpleBezier.vcxproj b/Samples/IntroGraphics/SimpleBezierUWP/SimpleBezier.vcxproj index 06f61076f885cc6e72dace44448ae35f3b34a507..6b4d7e4ab37a94e62ab12bea1e3474dab0e61d44 100644 --- a/Samples/IntroGraphics/SimpleBezierUWP/SimpleBezier.vcxproj +++ b/Samples/IntroGraphics/SimpleBezierUWP/SimpleBezier.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierDS.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierDS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..c65077845a509a493c769b4c85a72d2827e0bc15 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierDS.hlsl @@ -0,0 +1 @@ +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_fracEven.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_fracEven.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..7964c584f37f5b6b48089d7640dff274f18f66bb --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_fracEven.hlsl @@ -0,0 +1,3 @@ +// Compiled with /D "BEZIER_HS_PARTITION=\\"fractional_even\\"" for fractional even partitioning. + +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_fracOdd.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_fracOdd.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..acc5de8df3613a6de4c6a5da4c6481a521644c99 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_fracOdd.hlsl @@ -0,0 +1,3 @@ +// Compiled with /D "BEZIER_HS_PARTITION=\\"fractional_odd\\"" for fractional odd partitioning. + +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_int.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_int.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..db418915856282691247d148b5484ce31c798183 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierHS_int.hlsl @@ -0,0 +1,3 @@ +// Compiled with /D "BEZIER_HS_PARTITION=\\"integer\\"" for integer partitioning. + +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierPS.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierPS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..c65077845a509a493c769b4c85a72d2827e0bc15 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierPS.hlsl @@ -0,0 +1 @@ +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierVS.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierVS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..c65077845a509a493c769b4c85a72d2827e0bc15 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/BezierVS.hlsl @@ -0,0 +1 @@ +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/Logo.png b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7e704a106b99487be0f1eded426e6c5a2c65a9 Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/Logo.png differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SimpleBezier.hlsli b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SimpleBezier.hlsli new file mode 100644 index 0000000000000000000000000000000000000000..98752539d5026632b5f5f51d907e9efdf8fe2dc5 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SimpleBezier.hlsli @@ -0,0 +1,229 @@ +//-------------------------------------------------------------------------------------- +// SimpleBezier.hlsli +// +// Shader demonstrating DirectX tessellation of a bezier surface +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + + +// The input patch size. In this sample, it is 16 control points. +// This value should match the call to IASetPrimitiveTopology() +#define INPUT_PATCH_SIZE 16 + +// The output patch size. In this sample, it is also 16 control points. +#define OUTPUT_PATCH_SIZE 16 + +//-------------------------------------------------------------------------------------- +// Constant Buffers +//-------------------------------------------------------------------------------------- +cbuffer cbPerFrame : register(b0) +{ + row_major matrix g_mViewProjection; + float3 g_cameraWorldPos; + float g_tessellationFactor; +}; + +//-------------------------------------------------------------------------------------- +// Vertex shader section +//-------------------------------------------------------------------------------------- +struct VS_CONTROL_POINT_INPUT +{ + float3 pos : POSITION; +}; + +struct VS_CONTROL_POINT_OUTPUT +{ + float3 pos : POSITION; +}; + +//-------------------------------------------------------------------------------------- +// This simple vertex shader passes the control points straight through to the +// hull shader. In a more complex scene, you might transform the control points +// or perform skinning at this step. +// +// The input to the vertex shader comes from the vertex buffer. +// +// The output from the vertex shader will go into the hull shader. +//-------------------------------------------------------------------------------------- +VS_CONTROL_POINT_OUTPUT BezierVS(VS_CONTROL_POINT_INPUT Input) +{ + VS_CONTROL_POINT_OUTPUT output; + + output.pos = Input.pos; + + return output; +} + +//-------------------------------------------------------------------------------------- +// Constant data function for the BezierHS. This is executed once per patch. +//-------------------------------------------------------------------------------------- +struct HS_CONSTANT_DATA_OUTPUT +{ + float Edges[4] : SV_TessFactor; + float Inside[2] : SV_InsideTessFactor; +}; + +struct HS_OUTPUT +{ + float3 pos : BEZIERPOS; +}; + +//-------------------------------------------------------------------------------------- +// This constant hull shader is executed once per patch. For the simple Mobius strip +// model, it will be executed 4 times. In this sample, we set the tessellation factor +// via SV_TessFactor and SV_InsideTessFactor for each patch. In a more complex scene, +// you might calculate a variable tessellation factor based on the camera's distance. +//-------------------------------------------------------------------------------------- +HS_CONSTANT_DATA_OUTPUT BezierConstantHS(InputPatch< VS_CONTROL_POINT_OUTPUT, INPUT_PATCH_SIZE > ip, + uint PatchID : SV_PrimitiveID) +{ + HS_CONSTANT_DATA_OUTPUT output; + + float TessAmount = g_tessellationFactor; + + output.Edges[0] = output.Edges[1] = output.Edges[2] = output.Edges[3] = TessAmount; + output.Inside[0] = output.Inside[1] = TessAmount; + + return output; +} + +//-------------------------------------------------------------------------------------- +// BezierHS +// The hull shader is called once per output control point, which is specified with +// outputcontrolpoints. For this sample, we take the control points from the vertex +// shader and pass them directly off to the domain shader. In a more complex scene, +// you might perform a basis conversion from the input control points into a Bezier +// patch, such as the SubD11 SimpleBezier. +// +// The input to the hull shader comes from the vertex shader. +// +// The output from the hull shader will go to the domain shader. +// The tessellation factor, topology, and partition mode will go to the fixed function +// tessellator stage to calculate the UVW barycentric coordinates and domain points. +//-------------------------------------------------------------------------------------- +[domain("quad")] +[partitioning(BEZIER_HS_PARTITION)] +[outputtopology("triangle_cw")] +[outputcontrolpoints(OUTPUT_PATCH_SIZE)] +[patchconstantfunc("BezierConstantHS")] +HS_OUTPUT BezierHS(InputPatch< VS_CONTROL_POINT_OUTPUT, INPUT_PATCH_SIZE > p, + uint i : SV_OutputControlPointID, + uint PatchID : SV_PrimitiveID) +{ + HS_OUTPUT output; + output.pos = p[i].pos; + return output; +} + +//-------------------------------------------------------------------------------------- +// Bezier evaluation domain shader section +//-------------------------------------------------------------------------------------- +struct DS_OUTPUT +{ + float4 pos : SV_POSITION; + float3 worldPos : WORLDPOS; + float3 normal : NORMAL; +}; + +//-------------------------------------------------------------------------------------- +float4 BernsteinBasis(float t) +{ + float invT = 1.0f - t; + + return float4(invT * invT * invT, + 3.0f * t * invT * invT, + 3.0f * t * t * invT, + t * t * t); +} + +//-------------------------------------------------------------------------------------- +float4 dBernsteinBasis(float t) +{ + float invT = 1.0f - t; + + return float4(-3 * invT * invT, + 3 * invT * invT - 6 * t * invT, + 6 * t * invT - 3 * t * t, + 3 * t * t); +} + +//-------------------------------------------------------------------------------------- +float3 EvaluateBezier(const OutputPatch< HS_OUTPUT, OUTPUT_PATCH_SIZE > BezPatch, + float4 BasisU, + float4 BasisV) +{ + float3 value = float3(0, 0, 0); + value = BasisV.x * (BezPatch[0].pos * BasisU.x + BezPatch[1].pos * BasisU.y + BezPatch[2].pos * BasisU.z + BezPatch[3].pos * BasisU.w); + value += BasisV.y * (BezPatch[4].pos * BasisU.x + BezPatch[5].pos * BasisU.y + BezPatch[6].pos * BasisU.z + BezPatch[7].pos * BasisU.w); + value += BasisV.z * (BezPatch[8].pos * BasisU.x + BezPatch[9].pos * BasisU.y + BezPatch[10].pos * BasisU.z + BezPatch[11].pos * BasisU.w); + value += BasisV.w * (BezPatch[12].pos * BasisU.x + BezPatch[13].pos * BasisU.y + BezPatch[14].pos * BasisU.z + BezPatch[15].pos * BasisU.w); + + return value; +} + + +//-------------------------------------------------------------------------------------- +// The domain shader is run once per vertex and calculates the final vertex's position +// and attributes. It receives the UVW from the fixed function tessellator and the +// control point outputs from the hull shader. Since we are using the DirectX 11 +// Tessellation pipeline, it is the domain shader's responsibility to calculate the +// final SV_POSITION for each vertex. In this sample, we evaluate the vertex's +// position using a Bernstein polynomial and the normal is calculated as the cross +// product of the U and V derivatives. +// +// The input SV_DomainLocation to the domain shader comes from fixed function +// tessellator. And the OutputPatch comes from the hull shader. From these, you +// must calculate the final vertex position, color, texcoords, and other attributes. +// +// The output from the domain shader will be a vertex that will go to the video card's +// rasterization pipeline and get drawn to the screen. +//-------------------------------------------------------------------------------------- +[domain("quad")] +DS_OUTPUT BezierDS(HS_CONSTANT_DATA_OUTPUT input, + float2 UV : SV_DomainLocation, + const OutputPatch< HS_OUTPUT, OUTPUT_PATCH_SIZE > BezPatch) +{ + float4 BasisU = BernsteinBasis(UV.x); + float4 BasisV = BernsteinBasis(UV.y); + float4 dBasisU = dBernsteinBasis(UV.x); + float4 dBasisV = dBernsteinBasis(UV.y); + + float3 worldPos = EvaluateBezier(BezPatch, BasisU, BasisV); + float3 tangent = EvaluateBezier(BezPatch, dBasisU, BasisV); + float3 biTangent = EvaluateBezier(BezPatch, BasisU, dBasisV); + float3 normal = normalize(cross(tangent, biTangent)); + + DS_OUTPUT output; + output.pos = mul(float4(worldPos, 1), g_mViewProjection); + output.worldPos = worldPos; + output.normal = normal; + + return output; +} + +//-------------------------------------------------------------------------------------- +// Smooth shading pixel shader section +//-------------------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------------------- +// The pixel shader works the same as it would in a normal graphics pipeline. +// In this sample, it performs very simple N dot L lighting. +//-------------------------------------------------------------------------------------- +float4 BezierPS(DS_OUTPUT Input) : SV_TARGET +{ + float3 N = normalize(Input.normal); + float3 L = normalize(Input.worldPos - g_cameraWorldPos); + return abs(dot(N, L)) * float4(1, 0, 0, 1); +} + +//-------------------------------------------------------------------------------------- +// Solid color shading pixel shader (used for wireframe overlay) +//-------------------------------------------------------------------------------------- +float4 SolidColorPS(DS_OUTPUT Input) : SV_TARGET +{ + // Return a dark green color + return float4(0, 0.25, 0, 1); +} diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SmallLogo.png b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SmallLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..98b09d91991638282fc2426bbfd4a517733ff15a Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SmallLogo.png differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SolidColorPS.hlsl b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SolidColorPS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..c65077845a509a493c769b4c85a72d2827e0bc15 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SolidColorPS.hlsl @@ -0,0 +1 @@ +#include "SimpleBezier.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SplashScreen.png b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SplashScreen.png new file mode 100644 index 0000000000000000000000000000000000000000..c352b156fd090a57aec7da81b3b19a3fb5888b43 Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/SplashScreen.png differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/StoreLogo.png b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..315472e10b9d380e509b2f041ea9ace5f994f5d2 Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/StoreLogo.png differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Assets/WideLogo.png b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/WideLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..c70f68e2c59214e0ff54844ccd8ae5e955826e10 Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/Assets/WideLogo.png differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/DeviceResources.cpp b/Samples/IntroGraphics/SimpleBezierUWP12/DeviceResources.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a7415aba2e798e929420df40b7eb12d7b5b85205 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/DeviceResources.cpp @@ -0,0 +1,658 @@ +// +// DeviceResources.cpp - A wrapper for the Direct3D 12 device and swapchain +// + +#include "pch.h" +#include "DeviceResources.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +// Constants used to calculate screen rotations +namespace ScreenRotation +{ + // 0-degree Z-rotation + static const XMFLOAT4X4 Rotation0( + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 90-degree Z-rotation + static const XMFLOAT4X4 Rotation90( + 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 180-degree Z-rotation + static const XMFLOAT4X4 Rotation180( + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 270-degree Z-rotation + static const XMFLOAT4X4 Rotation270( + 0.0f, -1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); +}; + +namespace +{ + inline DXGI_FORMAT NoSRGB(DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8X8_UNORM; + default: return fmt; + } + } +}; + +// Constructor for DeviceResources. +DX::DeviceResources::DeviceResources(DXGI_FORMAT backBufferFormat, DXGI_FORMAT depthBufferFormat, UINT backBufferCount, D3D_FEATURE_LEVEL minFeatureLevel) : + m_backBufferIndex(0), + m_fenceValues{}, + m_rtvDescriptorSize(0), + m_screenViewport{}, + m_scissorRect{}, + m_backBufferFormat(backBufferFormat), + m_depthBufferFormat(depthBufferFormat), + m_backBufferCount(backBufferCount), + m_d3dMinFeatureLevel(minFeatureLevel), + m_window(0), + m_d3dFeatureLevel(D3D_FEATURE_LEVEL_11_0), + m_rotation(DXGI_MODE_ROTATION_IDENTITY), + m_outputSize{0, 0, 1, 1}, + m_orientationTransform3D(ScreenRotation::Rotation0), + m_deviceNotify(nullptr) +{ + if (backBufferCount > MAX_BACK_BUFFER_COUNT) + { + throw std::out_of_range("backBufferCount too large"); + } + + if (minFeatureLevel < D3D_FEATURE_LEVEL_11_0) + { + throw std::out_of_range("minFeatureLevel too low"); + } +} + +// Destructor for DeviceResources. +DX::DeviceResources::~DeviceResources() +{ + // Ensure that the GPU is no longer referencing resources that are about to be destroyed. + WaitForGpu(); +} + +// Configures the Direct3D device, and stores handles to it and the device context. +void DX::DeviceResources::CreateDeviceResources() +{ +#if defined(_DEBUG) + // Enable the debug layer (only available if the Graphics Tools feature-on-demand is enabled). + { + ComPtr debugController; + if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(debugController.GetAddressOf())))) + { + debugController->EnableDebugLayer(); + } + else + { + OutputDebugStringA("WARNING: Direct3D Debug Device is not available\n"); + } + + ComPtr dxgiInfoQueue; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(dxgiInfoQueue.GetAddressOf())))) + { + dxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, true); + dxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, true); + } + } +#endif + + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(m_dxgiFactory.ReleaseAndGetAddressOf()))); + + ComPtr adapter; + GetAdapter(adapter.GetAddressOf()); + + // Create the DX12 API device object. + DX::ThrowIfFailed(D3D12CreateDevice( + adapter.Get(), + m_d3dMinFeatureLevel, + IID_PPV_ARGS(m_d3dDevice.ReleaseAndGetAddressOf()) + )); + +#ifndef NDEBUG + // Configure debug device (if active). + ComPtr d3dInfoQueue; + if (SUCCEEDED(m_d3dDevice.As(&d3dInfoQueue))) + { +#ifdef _DEBUG + d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true); + d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true); +#endif + D3D12_MESSAGE_ID hide[] = + { + D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE, + D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE + }; + D3D12_INFO_QUEUE_FILTER filter = {}; + filter.DenyList.NumIDs = _countof(hide); + filter.DenyList.pIDList = hide; + d3dInfoQueue->AddStorageFilterEntries(&filter); + } +#endif + + // Determine maximum supported feature level for this device + static const D3D_FEATURE_LEVEL s_featureLevels[] = + { + D3D_FEATURE_LEVEL_12_1, + D3D_FEATURE_LEVEL_12_0, + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + }; + + D3D12_FEATURE_DATA_FEATURE_LEVELS featLevels = + { + _countof(s_featureLevels), s_featureLevels, D3D_FEATURE_LEVEL_11_0 + }; + + HRESULT hr = m_d3dDevice->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &featLevels, sizeof(featLevels)); + if (SUCCEEDED(hr)) + { + m_d3dFeatureLevel = featLevels.MaxSupportedFeatureLevel; + } + else + { + m_d3dFeatureLevel = m_d3dMinFeatureLevel; + } + + // Create the command queue. + D3D12_COMMAND_QUEUE_DESC queueDesc = {}; + queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; + queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + + DX::ThrowIfFailed(m_d3dDevice->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(m_commandQueue.ReleaseAndGetAddressOf()))); + + // Create descriptor heaps for render target views and depth stencil views. + D3D12_DESCRIPTOR_HEAP_DESC rtvDescriptorHeapDesc = {}; + rtvDescriptorHeapDesc.NumDescriptors = m_backBufferCount; + rtvDescriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + + DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&rtvDescriptorHeapDesc, IID_PPV_ARGS(m_rtvDescriptorHeap.ReleaseAndGetAddressOf()))); + + m_rtvDescriptorSize = m_d3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + D3D12_DESCRIPTOR_HEAP_DESC dsvDescriptorHeapDesc = {}; + dsvDescriptorHeapDesc.NumDescriptors = 1; + dsvDescriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; + + DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&dsvDescriptorHeapDesc, IID_PPV_ARGS(m_dsvDescriptorHeap.ReleaseAndGetAddressOf()))); + } + + // Create a command allocator for each back buffer that will be rendered to. + for (UINT n = 0; n < m_backBufferCount; n++) + { + DX::ThrowIfFailed(m_d3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(m_commandAllocators[n].ReleaseAndGetAddressOf()))); + } + + // Create a command list for recording graphics commands. + DX::ThrowIfFailed(m_d3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocators[0].Get(), nullptr, IID_PPV_ARGS(m_commandList.ReleaseAndGetAddressOf()))); + DX::ThrowIfFailed(m_commandList->Close()); + + // Create a fence for tracking GPU execution progress. + DX::ThrowIfFailed(m_d3dDevice->CreateFence(m_fenceValues[m_backBufferIndex], D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.ReleaseAndGetAddressOf()))); + m_fenceValues[m_backBufferIndex]++; + + m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); + if (!m_fenceEvent.IsValid()) + { + throw std::exception("CreateEvent"); + } +} + +// These resources need to be recreated every time the window size is changed. +void DX::DeviceResources::CreateWindowSizeDependentResources() +{ + if (!m_window) + { + throw std::exception("Call SetWindow with a valid CoreWindow pointer"); + } + + // Wait until all previous GPU work is complete. + WaitForGpu(); + + // Release resources that are tied to the swap chain and update fence values. + for (UINT n = 0; n < m_backBufferCount; n++) + { + m_renderTargets[n].Reset(); + m_fenceValues[n] = m_fenceValues[m_backBufferIndex]; + } + + // Determine the render target size in pixels. + UINT backBufferWidth = std::max(m_outputSize.right - m_outputSize.left, 1); + UINT backBufferHeight = std::max(m_outputSize.bottom - m_outputSize.top, 1); + DXGI_FORMAT backBufferFormat = NoSRGB(m_backBufferFormat); + + // If the swap chain already exists, resize it, otherwise create one. + if (m_swapChain) + { + // If the swap chain already exists, resize it. + HRESULT hr = m_swapChain->ResizeBuffers( + m_backBufferCount, + backBufferWidth, + backBufferHeight, + backBufferFormat, + 0 + ); + + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on ResizeBuffers: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + // If the device was removed for any reason, a new device and swap chain will need to be created. + HandleDeviceLost(); + + // Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method + // and correctly set up the new device. + return; + } + else + { + DX::ThrowIfFailed(hr); + } + } + else + { + // Create a descriptor for the swap chain. + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {}; + swapChainDesc.Width = backBufferWidth; + swapChainDesc.Height = backBufferHeight; + swapChainDesc.Format = backBufferFormat; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = m_backBufferCount; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE; + + // Create a swap chain for the window. + ComPtr swapChain; + DX::ThrowIfFailed(m_dxgiFactory->CreateSwapChainForCoreWindow( + m_commandQueue.Get(), + m_window, + &swapChainDesc, + nullptr, + swapChain.GetAddressOf() + )); + + DX::ThrowIfFailed(swapChain.As(&m_swapChain)); + } + + // Set the proper orientation for the swap chain, and generate + // matrix transformations for rendering to the rotated swap chain. + switch (m_rotation) + { + default: + case DXGI_MODE_ROTATION_IDENTITY: + m_orientationTransform3D = ScreenRotation::Rotation0; + break; + + case DXGI_MODE_ROTATION_ROTATE90: + m_orientationTransform3D = ScreenRotation::Rotation270; + break; + + case DXGI_MODE_ROTATION_ROTATE180: + m_orientationTransform3D = ScreenRotation::Rotation180; + break; + + case DXGI_MODE_ROTATION_ROTATE270: + m_orientationTransform3D = ScreenRotation::Rotation90; + break; + } + + DX::ThrowIfFailed(m_swapChain->SetRotation(m_rotation)); + + // Obtain the back buffers for this window which will be the final render targets + // and create render target views for each of them. + for (UINT n = 0; n < m_backBufferCount; n++) + { + DX::ThrowIfFailed(m_swapChain->GetBuffer(n, IID_PPV_ARGS(m_renderTargets[n].GetAddressOf()))); + + wchar_t name[25] = {}; + swprintf_s(name, L"Render target %u", n); + m_renderTargets[n]->SetName(name); + + D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {}; + rtvDesc.Format = m_backBufferFormat; + rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + + CD3DX12_CPU_DESCRIPTOR_HANDLE rtvDescriptor(m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), n, m_rtvDescriptorSize); + m_d3dDevice->CreateRenderTargetView(m_renderTargets[n].Get(), &rtvDesc, rtvDescriptor); + } + + // Reset the index to the current back buffer. + m_backBufferIndex = m_swapChain->GetCurrentBackBufferIndex(); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + // Allocate a 2-D surface as the depth/stencil buffer and create a depth/stencil view + // on this surface. + CD3DX12_HEAP_PROPERTIES depthHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + D3D12_RESOURCE_DESC depthStencilDesc = CD3DX12_RESOURCE_DESC::Tex2D( + m_depthBufferFormat, + backBufferWidth, + backBufferHeight, + 1, // This depth stencil view has only one texture. + 1 // Use a single mipmap level. + ); + depthStencilDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; + + D3D12_CLEAR_VALUE depthOptimizedClearValue = {}; + depthOptimizedClearValue.Format = m_depthBufferFormat; + depthOptimizedClearValue.DepthStencil.Depth = 1.0f; + depthOptimizedClearValue.DepthStencil.Stencil = 0; + + DX::ThrowIfFailed(m_d3dDevice->CreateCommittedResource( + &depthHeapProperties, + D3D12_HEAP_FLAG_NONE, + &depthStencilDesc, + D3D12_RESOURCE_STATE_DEPTH_WRITE, + &depthOptimizedClearValue, + IID_PPV_ARGS(m_depthStencil.ReleaseAndGetAddressOf()) + )); + + m_depthStencil->SetName(L"Depth stencil"); + + D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = {}; + dsvDesc.Format = m_depthBufferFormat; + dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D; + + m_d3dDevice->CreateDepthStencilView(m_depthStencil.Get(), &dsvDesc, m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); + } + + // Set the 3D rendering viewport and scissor rectangle to target the entire window. + m_screenViewport.TopLeftX = m_screenViewport.TopLeftY = 0.f; + m_screenViewport.Width = static_cast(backBufferWidth); + m_screenViewport.Height = static_cast(backBufferHeight); + m_screenViewport.MinDepth = D3D12_MIN_DEPTH; + m_screenViewport.MaxDepth = D3D12_MAX_DEPTH; + + m_scissorRect.left = m_scissorRect.top = 0; + m_scissorRect.right = backBufferWidth; + m_scissorRect.bottom = backBufferHeight; +} + +// This method is called when the CoreWindow is created (or re-created). +void DX::DeviceResources::SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_window = window; + + m_outputSize.left = m_outputSize.top = 0; + m_outputSize.right = width; + m_outputSize.bottom = height; + + m_rotation = rotation; +} + +// This method is called when the window changes size. +bool DX::DeviceResources::WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + RECT newRc; + newRc.left = newRc.top = 0; + newRc.right = width; + newRc.bottom = height; + if (newRc.left == m_outputSize.left + && newRc.top == m_outputSize.top + && newRc.right == m_outputSize.right + && newRc.bottom == m_outputSize.bottom + && rotation == m_rotation) + { + return false; + } + + m_outputSize = newRc; + m_rotation = rotation; + CreateWindowSizeDependentResources(); + return true; +} + +// This method is called in the event handler for the DisplayContentsInvalidated event. +void DX::DeviceResources::ValidateDevice() +{ + // The D3D Device is no longer valid if the default adapter changed since the device + // was created or if the device has been removed. + + DXGI_ADAPTER_DESC previousDesc; + { + ComPtr previousDefaultAdapter; + DX::ThrowIfFailed(m_dxgiFactory->EnumAdapters1(0, previousDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(previousDefaultAdapter->GetDesc(&previousDesc)); + } + + DXGI_ADAPTER_DESC currentDesc; + { + ComPtr currentFactory; + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(currentFactory.GetAddressOf()))); + + ComPtr currentDefaultAdapter; + DX::ThrowIfFailed(currentFactory->EnumAdapters1(0, currentDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(currentDefaultAdapter->GetDesc(¤tDesc)); + } + + // If the adapter LUIDs don't match, or if the device reports that it has been removed, + // a new D3D device must be created. + + if (previousDesc.AdapterLuid.LowPart != currentDesc.AdapterLuid.LowPart + || previousDesc.AdapterLuid.HighPart != currentDesc.AdapterLuid.HighPart + || FAILED(m_d3dDevice->GetDeviceRemovedReason())) + { +#ifdef _DEBUG + OutputDebugStringA("Device Lost on ValidateDevice\n"); +#endif + + // Create a new device and swap chain. + HandleDeviceLost(); + } +} + +// Recreate all device resources and set them back to the current state. +void DX::DeviceResources::HandleDeviceLost() +{ + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceLost(); + } + + for (UINT n = 0; n < m_backBufferCount; n++) + { + m_commandAllocators[n].Reset(); + m_renderTargets[n].Reset(); + } + + m_depthStencil.Reset(); + m_commandQueue.Reset(); + m_commandList.Reset(); + m_fence.Reset(); + m_rtvDescriptorHeap.Reset(); + m_dsvDescriptorHeap.Reset(); + m_swapChain.Reset(); + m_d3dDevice.Reset(); + m_dxgiFactory.Reset(); + +#ifdef _DEBUG + { + ComPtr dxgiDebug; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&dxgiDebug)))) + { + dxgiDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_FLAGS(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL)); + } + } +#endif + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); + + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceRestored(); + } +} + +// Prepare the command list and render target for rendering. +void DX::DeviceResources::Prepare() +{ + // Reset command list and allocator. + DX::ThrowIfFailed(m_commandAllocators[m_backBufferIndex]->Reset()); + DX::ThrowIfFailed(m_commandList->Reset(m_commandAllocators[m_backBufferIndex].Get(), nullptr)); + + // Transition the render target into the correct state to allow for drawing into it. + D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_backBufferIndex].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET); + m_commandList->ResourceBarrier(1, &barrier); +} + +// Present the contents of the swap chain to the screen. +void DX::DeviceResources::Present() +{ + // Transition the render target to the state that allows it to be presented to the display. + D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_backBufferIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT); + m_commandList->ResourceBarrier(1, &barrier); + + // Send the command list off to the GPU for processing. + DX::ThrowIfFailed(m_commandList->Close()); + m_commandQueue->ExecuteCommandLists(1, CommandListCast(m_commandList.GetAddressOf())); + + // The first argument instructs DXGI to block until VSync, putting the application + // to sleep until the next VSync. This ensures we don't waste any cycles rendering + // frames that will never be displayed to the screen. + HRESULT hr = m_swapChain->Present(1, 0); + + // If the device was reset we must completely reinitialize the renderer. + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on Present: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + HandleDeviceLost(); + } + else + { + DX::ThrowIfFailed(hr); + + MoveToNextFrame(); + } +} + +// Wait for pending GPU work to complete. +void DX::DeviceResources::WaitForGpu() noexcept +{ + if (m_commandQueue && m_fence && m_fenceEvent.IsValid()) + { + // Schedule a Signal command in the GPU queue. + UINT64 fenceValue = m_fenceValues[m_backBufferIndex]; + if (SUCCEEDED(m_commandQueue->Signal(m_fence.Get(), fenceValue))) + { + // Wait until the Signal has been processed. + if (SUCCEEDED(m_fence->SetEventOnCompletion(fenceValue, m_fenceEvent.Get()))) + { + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + + // Increment the fence value for the current frame. + m_fenceValues[m_backBufferIndex]++; + } + } + } +} + +// Prepare to render the next frame. +void DX::DeviceResources::MoveToNextFrame() +{ + // Schedule a Signal command in the queue. + const UINT64 currentFenceValue = m_fenceValues[m_backBufferIndex]; + DX::ThrowIfFailed(m_commandQueue->Signal(m_fence.Get(), currentFenceValue)); + + // Update the back buffer index. + m_backBufferIndex = m_swapChain->GetCurrentBackBufferIndex(); + + // If the next frame is not ready to be rendered yet, wait until it is ready. + if (m_fence->GetCompletedValue() < m_fenceValues[m_backBufferIndex]) + { + DX::ThrowIfFailed(m_fence->SetEventOnCompletion(m_fenceValues[m_backBufferIndex], m_fenceEvent.Get())); + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + } + + // Set the fence value for the next frame. + m_fenceValues[m_backBufferIndex] = currentFenceValue + 1; +} + +// This method acquires the first available hardware adapter that supports Direct3D 12. +// If no such adapter can be found, try WARP. Otherwise throw an exception. +void DX::DeviceResources::GetAdapter(IDXGIAdapter1** ppAdapter) +{ + *ppAdapter = nullptr; + + ComPtr adapter; + for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != m_dxgiFactory->EnumAdapters1(adapterIndex, adapter.ReleaseAndGetAddressOf()); ++adapterIndex) + { + DXGI_ADAPTER_DESC1 desc; + DX::ThrowIfFailed(adapter->GetDesc1(&desc)); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the actual device yet. + if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), m_d3dMinFeatureLevel, _uuidof(ID3D12Device), nullptr))) + { +#ifdef _DEBUG + wchar_t buff[256] = {}; + swprintf_s(buff, L"Direct3D Adapter (%u): VID:%04X, PID:%04X - %ls\n", adapterIndex, desc.VendorId, desc.DeviceId, desc.Description); + OutputDebugStringW(buff); +#endif + break; + } + } + +#if !defined(NDEBUG) + if (!adapter) + { + // Try WARP12 instead + if (FAILED(m_dxgiFactory->EnumWarpAdapter(IID_PPV_ARGS(adapter.ReleaseAndGetAddressOf())))) + { + throw std::exception("WARP12 not available. Enable the 'Graphics Tools' feature-on-demand"); + } + + OutputDebugStringA("Direct3D Adapter - WARP12\n"); + } +#endif + + if (!adapter) + { + throw std::exception("No Direct3D 12 device found"); + } + + *ppAdapter = adapter.Detach(); +} diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/DeviceResources.h b/Samples/IntroGraphics/SimpleBezierUWP12/DeviceResources.h new file mode 100644 index 0000000000000000000000000000000000000000..086d0cec4aaa5f1800fd90959c4c40269f121952 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/DeviceResources.h @@ -0,0 +1,117 @@ +// +// DeviceResources.h - A wrapper for the Direct3D 12 device and swapchain +// + +#pragma once + +namespace DX +{ + // Provides an interface for an application that owns DeviceResources to be notified of the device being lost or created. + interface IDeviceNotify + { + virtual void OnDeviceLost() = 0; + virtual void OnDeviceRestored() = 0; + }; + + // Controls all the DirectX device resources. + class DeviceResources + { + public: + DeviceResources(DXGI_FORMAT backBufferFormat = DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT depthBufferFormat = DXGI_FORMAT_D32_FLOAT, + UINT backBufferCount = 2, + D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL_11_0); + ~DeviceResources(); + + void CreateDeviceResources(); + void CreateWindowSizeDependentResources(); + void SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + bool WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + void HandleDeviceLost(); + void RegisterDeviceNotify(IDeviceNotify* deviceNotify) { m_deviceNotify = deviceNotify; } + void Prepare(); + void Present(); + void WaitForGpu() noexcept; + + // Device Accessors. + RECT GetOutputSize() const { return m_outputSize; } + DXGI_MODE_ROTATION GetRotation() const { return m_rotation; } + + // Direct3D Accessors. + ID3D12Device* GetD3DDevice() const { return m_d3dDevice.Get(); } + IDXGISwapChain3* GetSwapChain() const { return m_swapChain.Get(); } + D3D_FEATURE_LEVEL GetDeviceFeatureLevel() const { return m_d3dFeatureLevel; } + ID3D12Resource* GetRenderTarget() const { return m_renderTargets[m_backBufferIndex].Get(); } + ID3D12Resource* GetDepthStencil() const { return m_depthStencil.Get(); } + ID3D12CommandQueue* GetCommandQueue() const { return m_commandQueue.Get(); } + ID3D12CommandAllocator* GetCommandAllocator() const { return m_commandAllocators[m_backBufferIndex].Get(); } + ID3D12GraphicsCommandList* GetCommandList() const { return m_commandList.Get(); } + DXGI_FORMAT GetBackBufferFormat() const { return m_backBufferFormat; } + DXGI_FORMAT GetDepthBufferFormat() const { return m_depthBufferFormat; } + D3D12_VIEWPORT GetScreenViewport() const { return m_screenViewport; } + D3D12_RECT GetScissorRect() const { return m_scissorRect; } + UINT GetCurrentFrameIndex() const { return m_backBufferIndex; } + UINT GetBackBufferCount() const { return m_backBufferCount; } + DirectX::XMFLOAT4X4 GetOrientationTransform3D() const { return m_orientationTransform3D; } + + CD3DX12_CPU_DESCRIPTOR_HANDLE GetRenderTargetView() const + { + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), m_backBufferIndex, m_rtvDescriptorSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE GetDepthStencilView() const + { + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); + } + + private: + void MoveToNextFrame(); + void GetAdapter(IDXGIAdapter1** ppAdapter); + + const static size_t MAX_BACK_BUFFER_COUNT = 3; + + UINT m_backBufferIndex; + + // Direct3D objects. + Microsoft::WRL::ComPtr m_d3dDevice; + Microsoft::WRL::ComPtr m_commandQueue; + Microsoft::WRL::ComPtr m_commandList; + Microsoft::WRL::ComPtr m_commandAllocators[MAX_BACK_BUFFER_COUNT]; + + // Swap chain objects. + Microsoft::WRL::ComPtr m_dxgiFactory; + Microsoft::WRL::ComPtr m_swapChain; + Microsoft::WRL::ComPtr m_renderTargets[MAX_BACK_BUFFER_COUNT]; + Microsoft::WRL::ComPtr m_depthStencil; + + // Presentation fence objects. + Microsoft::WRL::ComPtr m_fence; + UINT64 m_fenceValues[MAX_BACK_BUFFER_COUNT]; + Microsoft::WRL::Wrappers::Event m_fenceEvent; + + // Direct3D rendering objects. + Microsoft::WRL::ComPtr m_rtvDescriptorHeap; + Microsoft::WRL::ComPtr m_dsvDescriptorHeap; + UINT m_rtvDescriptorSize; + D3D12_VIEWPORT m_screenViewport; + D3D12_RECT m_scissorRect; + + // Direct3D properties. + DXGI_FORMAT m_backBufferFormat; + DXGI_FORMAT m_depthBufferFormat; + UINT m_backBufferCount; + D3D_FEATURE_LEVEL m_d3dMinFeatureLevel; + + // Cached device properties. + IUnknown* m_window; + D3D_FEATURE_LEVEL m_d3dFeatureLevel; + DXGI_MODE_ROTATION m_rotation; + RECT m_outputSize; + + // Transforms used for display orientation. + DirectX::XMFLOAT4X4 m_orientationTransform3D; + + // The IDeviceNotify can be held directly as it owns the DeviceResources. + IDeviceNotify* m_deviceNotify; + }; +} diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Main.cpp b/Samples/IntroGraphics/SimpleBezierUWP12/Main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..45d8f8a1ccd7e00b2c0c49af99f962e4c4e9fb00 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Main.cpp @@ -0,0 +1,357 @@ +//-------------------------------------------------------------------------------------- +// Main.cpp +// +// Entry point for Universal Windows Platform (UWP) app. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SimpleBezier.h" + +#include + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace DirectX; + +ref class ViewProvider sealed : public IFrameworkView +{ +public: + ViewProvider() : + m_exit(false), + m_visible(true), + m_DPI(96.f), + m_logicalWidth(800.f), + m_logicalHeight(600.f), + m_nativeOrientation(DisplayOrientations::None), + m_currentOrientation(DisplayOrientations::None) + { + } + + // IFrameworkView methods + virtual void Initialize(CoreApplicationView^ applicationView) + { + applicationView->Activated += ref new + TypedEventHandler(this, &ViewProvider::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &ViewProvider::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &ViewProvider::OnResuming); + + m_sample = std::make_unique(); + } + + virtual void Uninitialize() + { + m_sample.reset(); + } + + virtual void SetWindow(CoreWindow^ window) + { + window->SizeChanged += + ref new TypedEventHandler(this, &ViewProvider::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &ViewProvider::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &ViewProvider::OnWindowClosed); + + auto dispatcher = CoreWindow::GetForCurrentThread()->Dispatcher; + + dispatcher->AcceleratorKeyActivated += + ref new TypedEventHandler(this, &ViewProvider::OnAcceleratorKeyActivated); + + auto currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &ViewProvider::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &ViewProvider::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &ViewProvider::OnDisplayContentsInvalidated); + + m_DPI = currentDisplayInformation->LogicalDpi; + + m_logicalWidth = window->Bounds.Width; + m_logicalHeight = window->Bounds.Height; + + m_nativeOrientation = currentDisplayInformation->NativeOrientation; + m_currentOrientation = currentDisplayInformation->CurrentOrientation; + + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->Initialize(reinterpret_cast(window), + outputWidth, outputHeight, rotation ); + } + + virtual void Load(Platform::String^ entryPoint) + { + } + + virtual void Run() + { + while (!m_exit) + { + if (m_visible) + { + m_sample->Tick(); + + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } + } + +protected: + // Event handlers + void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) + { + if (args->Kind == ActivationKind::Launch) + { + auto launchArgs = static_cast(args); + + if (launchArgs->PrelaunchActivated) + { + // Opt-out of Prelaunch + CoreApplication::Exit(); + return; + } + } + + int w, h; + m_sample->GetDefaultSize(w, h); + + m_DPI = DisplayInformation::GetForCurrentView()->LogicalDpi; + + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; + // Change to ApplicationViewWindowingMode::FullScreen to default to full screen + + auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h)); + + ApplicationView::PreferredLaunchViewSize = desiredSize; + + auto view = ApplicationView::GetForCurrentView(); + + auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200)); + + view->SetPreferredMinSize(minSize); + + CoreWindow::GetForCurrentThread()->Activate(); + + view->FullScreenSystemOverlayMode = FullScreenSystemOverlayMode::Minimal; + + view->TryResizeView(desiredSize); + } + + void OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) + { + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + create_task([this, deferral]() + { + m_sample->OnSuspending(); + + deferral->Complete(); + }); + } + + void OnResuming(Platform::Object^ sender, Platform::Object^ args) + { + m_sample->OnResuming(); + } + + void OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) + { + m_logicalWidth = sender->Bounds.Width; + m_logicalHeight = sender->Bounds.Height; + + HandleWindowSizeChanged(); + } + + void OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) + { + m_visible = args->Visible; + if (m_visible) + m_sample->OnActivated(); + else + m_sample->OnDeactivated(); + } + + void OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) + { + m_exit = true; + } + + void OnAcceleratorKeyActivated(CoreDispatcher^, AcceleratorKeyEventArgs^ args) + { + if (args->EventType == CoreAcceleratorKeyEventType::SystemKeyDown + && args->VirtualKey == VirtualKey::Enter + && args->KeyStatus.IsMenuKeyDown + && !args->KeyStatus.WasKeyDown) + { + // Implements the classic ALT+ENTER fullscreen toggle + auto view = ApplicationView::GetForCurrentView(); + + if (view->IsFullScreenMode) + view->ExitFullScreenMode(); + else + view->TryEnterFullScreenMode(); + + args->Handled = true; + } + } + + void OnDpiChanged(DisplayInformation^ sender, Object^ args) + { + m_DPI = sender->LogicalDpi; + + HandleWindowSizeChanged(); + } + + void OnOrientationChanged(DisplayInformation^ sender, Object^ args) + { + m_currentOrientation = sender->CurrentOrientation; + + HandleWindowSizeChanged(); + } + + void OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) + { + m_sample->ValidateDevice(); + } + +private: + bool m_exit; + bool m_visible; + float m_DPI; + float m_logicalWidth; + float m_logicalHeight; + std::unique_ptr m_sample; + + Windows::Graphics::Display::DisplayOrientations m_nativeOrientation; + Windows::Graphics::Display::DisplayOrientations m_currentOrientation; + + inline int ConvertDipsToPixels(float dips) const + { + return int(dips * m_DPI / 96.f + 0.5f); + } + + inline float ConvertPixelsToDips(int pixels) const + { + return (float(pixels) * 96.f / m_DPI); + } + + DXGI_MODE_ROTATION ComputeDisplayRotation() const + { + DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; + + switch (m_nativeOrientation) + { + case DisplayOrientations::Landscape: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + } + break; + + case DisplayOrientations::Portrait: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + } + break; + } + + return rotation; + } + + void HandleWindowSizeChanged() + { + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->OnWindowSizeChanged(outputWidth, outputHeight, rotation); + } +}; + +ref class ViewProviderFactory : IFrameworkViewSource +{ +public: + virtual IFrameworkView^ CreateView() + { + return ref new ViewProvider(); + } +}; + + +// Entry point +[Platform::MTAThread] +int main(Platform::Array^ argv) +{ + UNREFERENCED_PARAMETER(argv); + + auto viewProviderFactory = ref new ViewProviderFactory(); + CoreApplication::Run(viewProviderFactory); + return 0; +} diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Package.appxmanifest b/Samples/IntroGraphics/SimpleBezierUWP12/Package.appxmanifest new file mode 100644 index 0000000000000000000000000000000000000000..a8a5fdf8f4b685ee36424aef1d73a4c148b077cc --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + SimpleBezier + Xbox Advanced Technology Group + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/Readme.docx b/Samples/IntroGraphics/SimpleBezierUWP12/Readme.docx new file mode 100644 index 0000000000000000000000000000000000000000..6e1133489783ba56f95ce99442947350e19bc9be Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/Readme.docx differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.cpp b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ab195aad0d5f6ec47547d3906083c2ed84e1932e --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.cpp @@ -0,0 +1,548 @@ +//-------------------------------------------------------------------------------------- +// SimpleBezier.cpp +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SimpleBezier.h" + +#include "ATGColors.h" +#include "ReadData.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +#pragma region Globals +// Global variables +namespace +{ + // Min and max divisions of the patch per side for the slider control. + const float c_minDivs = 4; + const float c_maxDivs = 16; + // Startup subdivisions per side. + const float c_defaultSubdivs = 8.0f; + // Camera's rotation angle per step. + const float c_rotationAnglePerStep = XM_2PI / 360.0f; + + // Initial camera setup + const XMVECTORF32 c_cameraEye = { 0.0f, 0.45f, 2.7f, 0.0f }; + const XMVECTORF32 c_cameraAt = { 0.0f, 0.0f, 0.0f, 0.0f }; + const XMVECTORF32 c_cameraUp = { 0.0f, 1.0f, 0.0f, 0.0f }; + + // Draw the mesh with shaded triangles at start. + const bool c_defaultWireframeRendering = false; + + // Simple Bezier patch for a Mobius strip. + // 4 patches with 16 control points each. + const XMFLOAT3 c_mobiusStrip[64] = { + { 1.0f, -0.5f, 0.0f }, + { 1.0f, -0.5f, 0.5f }, + { 0.5f, -0.3536f, 1.354f }, + { 0.0f, -0.3536f, 1.354f }, + { 1.0f, -0.1667f, 0.0f }, + { 1.0f, -0.1667f, 0.5f }, + { 0.5f, -0.1179f, 1.118f }, + { 0.0f, -0.1179f, 1.118f }, + { 1.0f, 0.1667f, 0.0f }, + { 1.0f, 0.1667f, 0.5f }, + { 0.5f, 0.1179f, 0.8821f }, + { 0.0f, 0.1179f, 0.8821f }, + { 1.0f, 0.5f, 0.0f }, + { 1.0f, 0.5f, 0.5f }, + { 0.5f, 0.3536f, 0.6464f }, + { 0.0f, 0.3536f, 0.6464f }, + { 0.0f, -0.3536f, 1.354f }, + { -0.5f, -0.3536f, 1.354f }, + { -1.5f, 0.0f, 0.5f }, + { -1.5f, 0.0f, 0.0f }, + { 0.0f, -0.1179f, 1.118f }, + { -0.5f, -0.1179f, 1.118f }, + { -1.167f, 0.0f, 0.5f }, + { -1.167f, 0.0f, 0.0f }, + { 0.0f, 0.1179f, 0.8821f }, + { -0.5f, 0.1179f, 0.8821f }, + { -0.8333f, 0.0f, 0.5f }, + { -0.8333f, 0.0f, 0.0f }, + { 0.0f, 0.3536f, 0.6464f }, + { -0.5f, 0.3536f, 0.6464f }, + { -0.5f, 0.0f, 0.5f }, + { -0.5f, 0.0f, 0.0f }, + { -1.5f, 0.0f, 0.0f }, + { -1.5f, 0.0f, -0.5f }, + { -0.5f, 0.3536f, -1.354f }, + { 0.0f, 0.3536f, -1.354f }, + { -1.167f, 0.0f, 0.0f }, + { -1.167f, 0.0f, -0.5f }, + { -0.5f, 0.1179f, -1.118f }, + { 0.0f, 0.1179f, -1.118f }, + { -0.8333f, 0.0f, 0.0f }, + { -0.8333f, 0.0f, -0.5f }, + { -0.5f, -0.1179f, -0.8821f }, + { 0.0f, -0.1179f, -0.8821f }, + { -0.5f, 0.0f, 0.0f }, + { -0.5f, 0.0f, -0.5f }, + { -0.5f, -0.3536f, -0.6464f }, + { 0.0f, -0.3536f, -0.6464f }, + { 0.0f, 0.3536f, -1.354f }, + { 0.5f, 0.3536f, -1.354f }, + { 1.0f, 0.5f, -0.5f }, + { 1.0f, 0.5f, 0.0f }, + { 0.0f, 0.1179f, -1.118f }, + { 0.5f, 0.1179f, -1.118f }, + { 1.0f, 0.1667f, -0.5f }, + { 1.0f, 0.1667f, 0.0f }, + { 0.0f, -0.1179f, -0.8821f }, + { 0.5f, -0.1179f, -0.8821f }, + { 1.0f, -0.1667f, -0.5f }, + { 1.0f, -0.1667f, 0.0f }, + { 0.0f, -0.3536f, -0.6464f }, + { 0.5f, -0.3536f, -0.6464f }, + { 1.0f, -0.5f, -0.5f }, + { 1.0f, -0.5f, 0.0f }, + }; + + inline size_t AlignSize(size_t size, size_t alignment) + { + return (size + alignment - 1) & ~(alignment - 1); + } +} +#pragma endregion + +Sample::Sample() + : m_subdivs(c_defaultSubdivs) + , m_drawWires(c_defaultWireframeRendering) + , m_partitionMode(PartitionMode::PartitionInteger) + , m_mappedConstantData(nullptr) +{ + // Use gamma-correct rendering. + m_deviceResources = std::make_unique(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); + m_deviceResources->RegisterDeviceNotify(this); +} + +// Initialize the Direct3D resources required to run. +void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_gamePad = std::make_unique(); + + m_keyboard = std::make_unique(); + m_keyboard->SetWindow(reinterpret_cast(window)); + + m_deviceResources->SetWindow(window, width, height, rotation); + + m_deviceResources->CreateDeviceResources(); + CreateDeviceDependentResources(); + + m_deviceResources->CreateWindowSizeDependentResources(); + CreateWindowSizeDependentResources(); +} + +#pragma region Frame Update +// Executes basic render loop. +void Sample::Tick() +{ + m_timer.Tick([&]() + { + Update(m_timer); + }); + + Render(); +} + +// Updates the world. +void Sample::Update(DX::StepTimer const&) +{ + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Update"); + + auto pad = m_gamePad->GetState(0); + if (pad.IsConnected()) + { + m_gamePadButtons.Update(pad); + } + else + { + m_gamePadButtons.Reset(); + } + + auto kb = m_keyboard->GetState(); + m_keyboardButtons.Update(kb); + + if (m_keyboardButtons.IsKeyPressed(Keyboard::Escape) || pad.IsViewPressed()) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + + if (m_keyboardButtons.IsKeyPressed(Keyboard::W) || m_gamePadButtons.y == GamePad::ButtonStateTracker::PRESSED) + { + m_drawWires = !m_drawWires; + } + else if (m_keyboardButtons.IsKeyPressed(Keyboard::D1) || m_keyboardButtons.IsKeyPressed(Keyboard::NumPad1) || + m_gamePadButtons.x == GamePad::ButtonStateTracker::PRESSED) + { + m_partitionMode = PartitionMode::PartitionInteger; + } + else if (m_keyboardButtons.IsKeyPressed(Keyboard::D2) || m_keyboardButtons.IsKeyPressed(Keyboard::NumPad2) || + m_gamePadButtons.a == GamePad::ButtonStateTracker::PRESSED) + { + m_partitionMode = PartitionMode::PartitionFractionalEven; + } + else if (m_keyboardButtons.IsKeyPressed(Keyboard::D3) || m_keyboardButtons.IsKeyPressed(Keyboard::NumPad3) || + m_gamePadButtons.b == GamePad::ButtonStateTracker::PRESSED) + { + m_partitionMode = PartitionMode::PartitionFractionalOdd; + } + + if (kb.Down || pad.IsLeftTriggerPressed()) + { + m_subdivs = std::max(m_subdivs - 0.1f, c_minDivs); + } + + if (kb.Up || pad.IsRightTriggerPressed()) + { + m_subdivs = std::min(m_subdivs + 0.1f, c_maxDivs); + } + + float rotationAxisY = 0.0f; + + if (pad.thumbSticks.leftX != 0.0f) + { + rotationAxisY = -pad.thumbSticks.leftX * c_rotationAnglePerStep; + } + else if (kb.Left) + { + rotationAxisY = c_rotationAnglePerStep; + } + else if (kb.Right) + { + rotationAxisY = -c_rotationAnglePerStep; + } + + if (rotationAxisY != 0.0f) + { + XMVECTOR eye = XMLoadFloat3(&m_cameraEye); + eye = XMVector3Transform(eye, XMMatrixRotationY(rotationAxisY)); + XMMATRIX view = XMMatrixLookAtLH(eye, c_cameraAt, c_cameraUp); + XMStoreFloat4x4(&m_viewMatrix, view); + XMStoreFloat3(&m_cameraEye, eye); + } + + PIXEndEvent(); +} +#pragma endregion + +#pragma region Frame Render +// Draws the scene. +void Sample::Render() +{ + // Don't try to render anything before the first Update. + if (m_timer.GetFrameCount() == 0) + { + return; + } + + // Prepare the command list to render a new frame. + m_deviceResources->Prepare(); + Clear(); + + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Render"); + + //Set appropriate pipeline state. + commandList->SetPipelineState(m_PSOs[m_drawWires ? 1 : 0][(int)m_partitionMode].Get()); + + // Set root signature and descriptor heaps. + commandList->SetGraphicsRootSignature(m_rootSignature.Get()); + ID3D12DescriptorHeap* heaps[] = { m_resourceDescriptors->Heap() }; + commandList->SetDescriptorHeaps(_countof(heaps), heaps); + + // Calculate world-view-projection matrix. + XMMATRIX view = XMLoadFloat4x4(&m_viewMatrix); + XMMATRIX projection = XMLoadFloat4x4(&m_projectionMatrix); + XMMATRIX viewProjectionMatrix = XMMatrixMultiply(view, projection); + + // Update per-frame variables. + if (m_mappedConstantData != nullptr) + { + XMStoreFloat4x4(&m_mappedConstantData->viewProjectionMatrix, viewProjectionMatrix); + m_mappedConstantData->cameraWorldPos = m_cameraEye; + m_mappedConstantData->tessellationFactor = (float)m_subdivs; + } + + // Finalize dynamic constant buffer into descriptor heap. + commandList->SetGraphicsRootDescriptorTable(c_rootParameterCB, m_resourceDescriptors->GetGpuHandle(c_rootParameterCB)); + + commandList->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST); + commandList->IASetVertexBuffers(0, 1, &m_controlPointVBView); + + // Draw the mesh + commandList->DrawInstanced(_countof(c_mobiusStrip), 1, 0, 0); + + PIXEndEvent(commandList); + + // Show the new frame. + PIXBeginEvent(m_deviceResources->GetCommandQueue(), PIX_COLOR_DEFAULT, L"Present"); + m_deviceResources->Present(); + m_graphicsMemory->Commit(m_deviceResources->GetCommandQueue()); + PIXEndEvent(m_deviceResources->GetCommandQueue()); +} + +// Helper method to clear the back buffers. +void Sample::Clear() +{ + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Clear"); + + // Clear the views. + auto rtvDescriptor = m_deviceResources->GetRenderTargetView(); + auto dsvDescriptor = m_deviceResources->GetDepthStencilView(); + + commandList->OMSetRenderTargets(1, &rtvDescriptor, FALSE, &dsvDescriptor); + // Use linear clear color for gamma-correct rendering. + commandList->ClearRenderTargetView(rtvDescriptor, ATG::ColorsLinear::Background, 0, nullptr); + commandList->ClearDepthStencilView(dsvDescriptor, D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr); + + // Set the viewport and scissor rect. + auto viewport = m_deviceResources->GetScreenViewport(); + auto scissorRect = m_deviceResources->GetScissorRect(); + commandList->RSSetViewports(1, &viewport); + commandList->RSSetScissorRects(1, &scissorRect); + + PIXEndEvent(commandList); +} +#pragma endregion + +#pragma region Message Handlers +// Message handlers +void Sample::OnActivated() +{ +} + +void Sample::OnDeactivated() +{ +} + +void Sample::OnSuspending() +{ +} + +void Sample::OnResuming() +{ + m_timer.ResetElapsedTime(); + m_gamePadButtons.Reset(); + m_keyboardButtons.Reset(); +} + +void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + if (!m_deviceResources->WindowSizeChanged(width, height, rotation)) + return; + + CreateWindowSizeDependentResources(); +} + +void Sample::ValidateDevice() +{ + m_deviceResources->ValidateDevice(); +} + +// Properties +void Sample::GetDefaultSize(int& width, int& height) const +{ + width = 1280; + height = 720; +} +#pragma endregion + +#pragma region Direct3D Resources +// These are the resources that depend on the device. +void Sample::CreateDeviceDependentResources() +{ + auto device = m_deviceResources->GetD3DDevice(); + + m_graphicsMemory = std::make_unique(device); + + CreateShaders(); + + // Initialize the world and view matrices. + XMMATRIX world = XMMatrixIdentity(); + XMMATRIX view = XMMatrixLookAtLH(c_cameraEye, c_cameraAt, c_cameraUp); + XMStoreFloat4x4(&m_worldMatrix, world); + XMStoreFloat4x4(&m_viewMatrix, view); + XMStoreFloat3(&m_cameraEye, c_cameraEye); +} + +// Creates and initializes shaders and their data. +void Sample::CreateShaders() +{ + auto device = m_deviceResources->GetD3DDevice(); + + { + // Define root table layout. + CD3DX12_DESCRIPTOR_RANGE descRange[1]; + descRange[c_rootParameterCB].Init(D3D12_DESCRIPTOR_RANGE_TYPE_CBV, 1, 0); + CD3DX12_ROOT_PARAMETER rootParameters[1]; + rootParameters[c_rootParameterCB].InitAsDescriptorTable( + 1, &descRange[c_rootParameterCB], D3D12_SHADER_VISIBILITY_ALL); // b0 + + // Create the root signature. + CD3DX12_ROOT_SIGNATURE_DESC rootSignatureDesc(_countof(rootParameters), rootParameters, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT); + + ComPtr signature; + ComPtr error; + DX::ThrowIfFailed(D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error)); + DX::ThrowIfFailed( + device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(), + IID_PPV_ARGS(m_rootSignature.ReleaseAndGetAddressOf()))); + } + + // Create our vertex input layout. + const D3D12_INPUT_ELEMENT_DESC c_inputElementDesc[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + // Load shaders. + auto vertexShaderBlob = DX::ReadData(L"BezierVS.cso"); + + std::vector hullShaderBlobs[c_numHullShaders]; + hullShaderBlobs[(int)PartitionMode::PartitionInteger] = DX::ReadData(L"BezierHS_int.cso"); + hullShaderBlobs[(int)PartitionMode::PartitionFractionalEven] = DX::ReadData(L"BezierHS_fracEven.cso"); + hullShaderBlobs[(int)PartitionMode::PartitionFractionalOdd] = DX::ReadData(L"BezierHS_fracOdd.cso"); + + auto domainShaderBlob = DX::ReadData(L"BezierDS.cso"); + + std::vector pixelShaderBlobs[c_numPixelShaders]; + pixelShaderBlobs[0] = DX::ReadData(L"BezierPS.cso"); + pixelShaderBlobs[1] = DX::ReadData(L"SolidColorPS.cso"); + + // Create solid and wireframe rasterizer state objects. + D3D12_RASTERIZER_DESC RasterDesc = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT); + RasterDesc.CullMode = D3D12_CULL_MODE_NONE; + RasterDesc.DepthClipEnable = TRUE; + + // Describe and create the graphics pipeline state object (PSO). + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + psoDesc.InputLayout.pInputElementDescs = c_inputElementDesc; + psoDesc.InputLayout.NumElements = _countof(c_inputElementDesc); + psoDesc.pRootSignature = m_rootSignature.Get(); + psoDesc.VS = CD3DX12_SHADER_BYTECODE(vertexShaderBlob.data(), vertexShaderBlob.size()); + psoDesc.DS = CD3DX12_SHADER_BYTECODE(domainShaderBlob.data(), domainShaderBlob.size()); + psoDesc.RasterizerState = RasterDesc; + + psoDesc.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT); + psoDesc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT); + psoDesc.SampleMask = UINT_MAX; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH; + psoDesc.NumRenderTargets = 1; + psoDesc.RTVFormats[0] = m_deviceResources->GetBackBufferFormat(); + psoDesc.DSVFormat = m_deviceResources->GetDepthBufferFormat(); + psoDesc.SampleDesc.Count = 1; + + // Enumerate PSOs. + D3D12_FILL_MODE fillModes[] = { D3D12_FILL_MODE_SOLID, D3D12_FILL_MODE_WIREFRAME }; + for (uint8_t i = 0; i < c_numPixelShaders; i++) + { + psoDesc.RasterizerState.FillMode = fillModes[i]; + psoDesc.PS = CD3DX12_SHADER_BYTECODE(pixelShaderBlobs[i].data(), pixelShaderBlobs[i].size()); + + for (uint8_t j = 0; j < c_numHullShaders; j++) + { + psoDesc.HS = CD3DX12_SHADER_BYTECODE(hullShaderBlobs[j].data(), hullShaderBlobs[j].size()); + + DX::ThrowIfFailed( + device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(m_PSOs[i][j].ReleaseAndGetAddressOf()))); + } + } + + { + // Create constant buffer. + const D3D12_HEAP_PROPERTIES uploadHeapProperties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD); + + size_t cbSize = AlignSize(sizeof(ConstantBuffer), D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT); + + const D3D12_RESOURCE_DESC constantBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(cbSize); + DX::ThrowIfFailed(device->CreateCommittedResource(&uploadHeapProperties, D3D12_HEAP_FLAG_NONE, + &constantBufferDesc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(m_cbPerFrame.GetAddressOf()))); + DX::ThrowIfFailed(m_cbPerFrame->SetName(L"Per Frame CB")); + + // Map it to a CPU variable. Leave the mapping active for per-frame updates. + DX::ThrowIfFailed(m_cbPerFrame->Map(0, nullptr, reinterpret_cast< void** >(&m_mappedConstantData))); + + // Create constant buffer view. + const uint32_t c_cbCount = 1; + m_resourceDescriptors = std::make_unique(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, c_cbCount); + + D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc = {}; + cbvDesc.BufferLocation = m_cbPerFrame->GetGPUVirtualAddress(); + cbvDesc.SizeInBytes = UINT(cbSize); + device->CreateConstantBufferView(&cbvDesc, m_resourceDescriptors->GetCpuHandle(c_rootParameterCB)); + + // Create vertex buffer containing a mesh's control points. + // Note: Using upload heaps to transfer static data like vert buffers is not + // recommended. Every time the GPU needs it, the upload heap will be marshalled + // over. Please read up on Default Heap usage. An upload heap is used here for + // code simplicity and because there are few verts to actually transfer. + const D3D12_RESOURCE_DESC vertexBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(sizeof(c_mobiusStrip)); + DX::ThrowIfFailed(device->CreateCommittedResource(&uploadHeapProperties, D3D12_HEAP_FLAG_NONE, + &vertexBufferDesc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(m_controlPointVB.GetAddressOf()))); + DX::ThrowIfFailed(m_controlPointVB->SetName(L"Control Point VB")); + + // Copy the MobiusStrip data to the vertex buffer. + uint8_t* dataBegin; + CD3DX12_RANGE readRange(0, 0); // We do not intend to read from this resource on the CPU. + DX::ThrowIfFailed(m_controlPointVB->Map( + 0, &readRange, reinterpret_cast(&dataBegin))); + memcpy(dataBegin, c_mobiusStrip, sizeof(c_mobiusStrip)); + m_controlPointVB->Unmap(0, nullptr); + + // Initialize vertex buffer view. + ZeroMemory(&m_controlPointVBView, sizeof(m_controlPointVBView)); + m_controlPointVBView.BufferLocation = m_controlPointVB->GetGPUVirtualAddress(); + m_controlPointVBView.StrideInBytes = sizeof(XMFLOAT3); + m_controlPointVBView.SizeInBytes = sizeof(c_mobiusStrip); + } + + // Wait until assets have been uploaded to the GPU. + m_deviceResources->WaitForGpu(); +} + +// Allocate all memory resources that change on a window SizeChanged event. +void Sample::CreateWindowSizeDependentResources() +{ + auto size = m_deviceResources->GetOutputSize(); + + XMMATRIX projection = XMMatrixPerspectiveFovLH(XM_PIDIV4, float(size.right) / float(size.bottom), 0.01f, 100.0f); + + XMFLOAT4X4 orient = m_deviceResources->GetOrientationTransform3D(); + + XMStoreFloat4x4(&m_projectionMatrix, projection * XMLoadFloat4x4(&orient)); +} + +void Sample::OnDeviceLost() +{ + m_graphicsMemory.reset(); + m_rootSignature.Reset(); + m_resourceDescriptors.reset(); + + for (uint8_t i = 0; i < c_numPixelShaders; i++) + { + for (uint8_t j = 0; j < c_numHullShaders; j++) + { + m_PSOs[i][j].Reset(); + } + } + + m_controlPointVB.Reset(); + m_cbPerFrame.Reset(); + m_mappedConstantData = nullptr; +} + +void Sample::OnDeviceRestored() +{ + CreateDeviceDependentResources(); + + CreateWindowSizeDependentResources(); +} +#pragma endregion diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.h b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.h new file mode 100644 index 0000000000000000000000000000000000000000..f2b777aa5d6c81d8c46aa12a0552e51a243c9026 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.h @@ -0,0 +1,111 @@ +//-------------------------------------------------------------------------------------- +// SimpleBezier.h +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "DeviceResources.h" +#include "StepTimer.h" + + +// A basic sample implementation that creates a D3D12 device and +// provides a render loop. +class Sample : public DX::IDeviceNotify +{ +public: + + Sample(); + + // Initialization and management + void Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + + // Basic render loop + void Tick(); + void Render(); + + // Rendering helpers + void Clear(); + + // IDeviceNotify + virtual void OnDeviceLost() override; + virtual void OnDeviceRestored() override; + + // Messages + void OnActivated(); + void OnDeactivated(); + void OnSuspending(); + void OnResuming(); + void OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + + // Properties + void GetDefaultSize( int& width, int& height ) const; + +private: + + void Update(DX::StepTimer const& timer); + + void CreateDeviceDependentResources(); + void CreateShaders(); + void CreateWindowSizeDependentResources(); + + // Device resources + std::unique_ptr m_deviceResources; + + // Rendering loop timer + DX::StepTimer m_timer; + + // Input devices + std::unique_ptr m_gamePad; + std::unique_ptr m_keyboard; + + DirectX::GamePad::ButtonStateTracker m_gamePadButtons; + DirectX::Keyboard::KeyboardStateTracker m_keyboardButtons; + + // DirectXTK objects + std::unique_ptr m_graphicsMemory; + + // Sample objects + struct ConstantBuffer + { + DirectX::XMFLOAT4X4 viewProjectionMatrix; + DirectX::XMFLOAT3 cameraWorldPos; + float tessellationFactor; + }; + + enum class PartitionMode + { + PartitionInteger, + PartitionFractionalEven, + PartitionFractionalOdd + }; + + static const size_t c_numPixelShaders = 2; + static const size_t c_numHullShaders = 3; + + Microsoft::WRL::ComPtr m_rootSignature; + Microsoft::WRL::ComPtr m_PSOs[c_numPixelShaders][c_numHullShaders]; + + std::unique_ptr m_resourceDescriptors; + + D3D12_VERTEX_BUFFER_VIEW m_controlPointVBView; + Microsoft::WRL::ComPtr m_controlPointVB; // Control points for mesh + Microsoft::WRL::ComPtr m_cbPerFrame; + ConstantBuffer* m_mappedConstantData; + + // Index in the root parameter table + static const UINT c_rootParameterCB = 0; + + // Control variables + float m_subdivs; + bool m_drawWires; + PartitionMode m_partitionMode; + + DirectX::XMFLOAT4X4 m_worldMatrix; + DirectX::XMFLOAT4X4 m_viewMatrix; + DirectX::XMFLOAT4X4 m_projectionMatrix; + DirectX::XMFLOAT3 m_cameraEye; +}; \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.sln b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.sln new file mode 100644 index 0000000000000000000000000000000000000000..7cc3512f2efcb0eabca2125622aa73ef08245460 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleBezier", "SimpleBezier.vcxproj", "{9F4DCF08-85F6-4277-8434-109931C9138F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK12", "..\..\..\Kits\DirectXTK12\DirectXTK_Windows10.vcxproj", "{945B8F0E-AE5F-447C-933A-9D069532D3E4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|ARM.ActiveCfg = Debug|ARM + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|ARM.Build.0 = Debug|ARM + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|ARM.Deploy.0 = Debug|ARM + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|x64.ActiveCfg = Debug|x64 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|x64.Build.0 = Debug|x64 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|x64.Deploy.0 = Debug|x64 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|x86.ActiveCfg = Debug|Win32 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|x86.Build.0 = Debug|Win32 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Debug|x86.Deploy.0 = Debug|Win32 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|ARM.ActiveCfg = Release|ARM + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|ARM.Build.0 = Release|ARM + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|ARM.Deploy.0 = Release|ARM + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|x64.ActiveCfg = Release|x64 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|x64.Build.0 = Release|x64 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|x64.Deploy.0 = Release|x64 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|x86.ActiveCfg = Release|Win32 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|x86.Build.0 = Release|Win32 + {9F4DCF08-85F6-4277-8434-109931C9138F}.Release|x86.Deploy.0 = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.ActiveCfg = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.Build.0 = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.ActiveCfg = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.Build.0 = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.ActiveCfg = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.Build.0 = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.ActiveCfg = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.Build.0 = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.ActiveCfg = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.Build.0 = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.ActiveCfg = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.vcxproj b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..a8276c4aad076370fd0aa1ba7a63c192257cd167 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.vcxproj @@ -0,0 +1,403 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {9f4dcf08-85f6-4277-8434-109931c9138f} + DirectXApp + SimpleBezier + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + SimpleBezier_TemporaryKey.pfx + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + Designer + + + + + + + + + + + + + + + {945b8f0e-ae5f-447c-933a-9d069532d3e4} + + + + + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BezierDS + Domain + BezierDS + Domain + BezierDS + Domain + BezierDS + Domain + BezierDS + Domain + BezierDS + Domain + + + BEZIER_HS_PARTITION=\"fractional_even\" + BEZIER_HS_PARTITION=\"fractional_even\" + BEZIER_HS_PARTITION=\"fractional_even\" + BEZIER_HS_PARTITION=\"fractional_even\" + BEZIER_HS_PARTITION=\"fractional_even\" + BEZIER_HS_PARTITION=\"fractional_even\" + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + + + BEZIER_HS_PARTITION=\"fractional_odd\" + BEZIER_HS_PARTITION=\"fractional_odd\" + BEZIER_HS_PARTITION=\"fractional_odd\" + BEZIER_HS_PARTITION=\"fractional_odd\" + BEZIER_HS_PARTITION=\"fractional_odd\" + BEZIER_HS_PARTITION=\"fractional_odd\" + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + + + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + BezierHS + Hull + + + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + BezierPS + BezierPS + BezierPS + BezierPS + BezierPS + BezierPS + + + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BEZIER_HS_PARTITION=\"integer\" + BezierVS + Vertex + BezierVS + Vertex + BezierVS + Vertex + BezierVS + Vertex + BezierVS + Vertex + BezierVS + Vertex + + + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + SolidColorPS + BEZIER_HS_PARTITION=\"integer\" + SolidColorPS + BEZIER_HS_PARTITION=\"integer\" + SolidColorPS + BEZIER_HS_PARTITION=\"integer\" + SolidColorPS + BEZIER_HS_PARTITION=\"integer\" + SolidColorPS + BEZIER_HS_PARTITION=\"integer\" + SolidColorPS + BEZIER_HS_PARTITION=\"integer\" + + + + + + + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.vcxproj.filters b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..b24b065ec192e1ac763fd2077af0a4429dd23209 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier.vcxproj.filters @@ -0,0 +1,95 @@ + + + + + cc2ce594-f595-4717-8112-5d71f86945fb + + + ff1dd3e1-56e0-410b-884d-e8f8e675ef92 + bmp;dds;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + {b863b83a-8e80-46e1-896b-904035394bae} + + + {f2fed98e-04ee-4146-bb6c-332ced8ad09c} + + + + + + + Common + + + Common + + + Common + + + ATG Tool Kit + + + ATG Tool Kit + + + + + + + + Common + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + Shaders + + + + + + Shaders + + + Shaders + + + Shaders + + + Shaders + + + Shaders + + + Shaders + + + Shaders + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier_TemporaryKey.pfx b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..ef3e885480c63f08af47e10b331b1e9ecdcb2262 Binary files /dev/null and b/Samples/IntroGraphics/SimpleBezierUWP12/SimpleBezier_TemporaryKey.pfx differ diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/StepTimer.h b/Samples/IntroGraphics/SimpleBezierUWP12/StepTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f7acf56417f3184f8c17beecfbb1aaa124cdaf --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/StepTimer.h @@ -0,0 +1,188 @@ +// +// StepTimer.h - A simple timer that provides elapsed time information +// + +#pragma once + +#include +#include + +namespace DX +{ + // Helper class for animation and simulation timing. + class StepTimer + { + public: + StepTimer() : + m_elapsedTicks(0), + m_totalTicks(0), + m_leftOverTicks(0), + m_frameCount(0), + m_framesPerSecond(0), + m_framesThisSecond(0), + m_qpcSecondCounter(0), + m_isFixedTimeStep(false), + m_targetElapsedTicks(TicksPerSecond / 60) + { + if (!QueryPerformanceFrequency(&m_qpcFrequency)) + { + throw std::exception( "QueryPerformanceFrequency" ); + } + + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + // Initialize max delta to 1/10 of a second. + m_qpcMaxDelta = m_qpcFrequency.QuadPart / 10; + } + + // Get elapsed time since the previous Update call. + uint64_t GetElapsedTicks() const { return m_elapsedTicks; } + double GetElapsedSeconds() const { return TicksToSeconds(m_elapsedTicks); } + + // Get total time since the start of the program. + uint64_t GetTotalTicks() const { return m_totalTicks; } + double GetTotalSeconds() const { return TicksToSeconds(m_totalTicks); } + + // Get total number of updates since start of the program. + uint32_t GetFrameCount() const { return m_frameCount; } + + // Get the current framerate. + uint32_t GetFramesPerSecond() const { return m_framesPerSecond; } + + // Set whether to use fixed or variable timestep mode. + void SetFixedTimeStep(bool isFixedTimestep) { m_isFixedTimeStep = isFixedTimestep; } + + // Set how often to call Update when in fixed timestep mode. + void SetTargetElapsedTicks(uint64_t targetElapsed) { m_targetElapsedTicks = targetElapsed; } + void SetTargetElapsedSeconds(double targetElapsed) { m_targetElapsedTicks = SecondsToTicks(targetElapsed); } + + // Integer format represents time using 10,000,000 ticks per second. + static const uint64_t TicksPerSecond = 10000000; + + static double TicksToSeconds(uint64_t ticks) { return static_cast(ticks) / TicksPerSecond; } + static uint64_t SecondsToTicks(double seconds) { return static_cast(seconds * TicksPerSecond); } + + // After an intentional timing discontinuity (for instance a blocking IO operation) + // call this to avoid having the fixed timestep logic attempt a set of catch-up + // Update calls. + + void ResetElapsedTime() + { + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception("QueryPerformanceCounter"); + } + + m_leftOverTicks = 0; + m_framesPerSecond = 0; + m_framesThisSecond = 0; + m_qpcSecondCounter = 0; + } + + // Update timer state, calling the specified Update function the appropriate number of times. + template + void Tick(const TUpdate& update) + { + // Query the current time. + LARGE_INTEGER currentTime; + + if (!QueryPerformanceCounter(¤tTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + uint64_t timeDelta = currentTime.QuadPart - m_qpcLastTime.QuadPart; + + m_qpcLastTime = currentTime; + m_qpcSecondCounter += timeDelta; + + // Clamp excessively large time deltas (e.g. after paused in the debugger). + if (timeDelta > m_qpcMaxDelta) + { + timeDelta = m_qpcMaxDelta; + } + + // Convert QPC units into a canonical tick format. This cannot overflow due to the previous clamp. + timeDelta *= TicksPerSecond; + timeDelta /= m_qpcFrequency.QuadPart; + + uint32_t lastFrameCount = m_frameCount; + + if (m_isFixedTimeStep) + { + // Fixed timestep update logic + + // If the app is running very close to the target elapsed time (within 1/4 of a millisecond) just clamp + // the clock to exactly match the target value. This prevents tiny and irrelevant errors + // from accumulating over time. Without this clamping, a game that requested a 60 fps + // fixed update, running with vsync enabled on a 59.94 NTSC display, would eventually + // accumulate enough tiny errors that it would drop a frame. It is better to just round + // small deviations down to zero to leave things running smoothly. + + if (abs(static_cast(timeDelta - m_targetElapsedTicks)) < TicksPerSecond / 4000) + { + timeDelta = m_targetElapsedTicks; + } + + m_leftOverTicks += timeDelta; + + while (m_leftOverTicks >= m_targetElapsedTicks) + { + m_elapsedTicks = m_targetElapsedTicks; + m_totalTicks += m_targetElapsedTicks; + m_leftOverTicks -= m_targetElapsedTicks; + m_frameCount++; + + update(); + } + } + else + { + // Variable timestep update logic. + m_elapsedTicks = timeDelta; + m_totalTicks += timeDelta; + m_leftOverTicks = 0; + m_frameCount++; + + update(); + } + + // Track the current framerate. + if (m_frameCount != lastFrameCount) + { + m_framesThisSecond++; + } + + if (m_qpcSecondCounter >= static_cast(m_qpcFrequency.QuadPart)) + { + m_framesPerSecond = m_framesThisSecond; + m_framesThisSecond = 0; + m_qpcSecondCounter %= m_qpcFrequency.QuadPart; + } + } + + private: + // Source timing data uses QPC units. + LARGE_INTEGER m_qpcFrequency; + LARGE_INTEGER m_qpcLastTime; + uint64_t m_qpcMaxDelta; + + // Derived timing data uses a canonical tick format. + uint64_t m_elapsedTicks; + uint64_t m_totalTicks; + uint64_t m_leftOverTicks; + + // Members for tracking the framerate. + uint32_t m_frameCount; + uint32_t m_framesPerSecond; + uint32_t m_framesThisSecond; + uint64_t m_qpcSecondCounter; + + // Members for configuring fixed timestep mode. + bool m_isFixedTimeStep; + uint64_t m_targetElapsedTicks; + }; +} diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/d3dx12.h b/Samples/IntroGraphics/SimpleBezierUWP12/d3dx12.h new file mode 100644 index 0000000000000000000000000000000000000000..351914d38a47281f2e9ee95e1f4aff0f039cf7b2 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/d3dx12.h @@ -0,0 +1,1534 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#ifndef __D3DX12_H__ +#define __D3DX12_H__ + +#include "d3d12.h" + +#if defined( __cplusplus ) + +struct CD3DX12_DEFAULT {}; +extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT; + +//------------------------------------------------------------------------------------------------ +inline bool operator==( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ + return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && + l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; +} + +//------------------------------------------------------------------------------------------------ +inline bool operator!=( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RECT : public D3D12_RECT +{ + CD3DX12_RECT() + {} + explicit CD3DX12_RECT( const D3D12_RECT& o ) : + D3D12_RECT( o ) + {} + explicit CD3DX12_RECT( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + right = Right; + bottom = Bottom; + } + ~CD3DX12_RECT() {} + operator const D3D12_RECT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BOX : public D3D12_BOX +{ + CD3DX12_BOX() + {} + explicit CD3DX12_BOX( const D3D12_BOX& o ) : + D3D12_BOX( o ) + {} + explicit CD3DX12_BOX( + LONG Left, + LONG Right ) + { + left = Left; + top = 0; + front = 0; + right = Right; + bottom = 1; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + front = 0; + right = Right; + bottom = Bottom; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Front, + LONG Right, + LONG Bottom, + LONG Back ) + { + left = Left; + top = Top; + front = Front; + right = Right; + bottom = Bottom; + back = Back; + } + ~CD3DX12_BOX() {} + operator const D3D12_BOX&() const { return *this; } +}; +inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r ) +{ + return l.left == r.left && l.top == r.top && l.front == r.front && + l.right == r.right && l.bottom == r.bottom && l.back == r.back; +} +inline bool operator!=( const D3D12_BOX& l, const D3D12_BOX& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC +{ + CD3DX12_DEPTH_STENCIL_DESC() + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( const D3D12_DEPTH_STENCIL_DESC& o ) : + D3D12_DEPTH_STENCIL_DESC( o ) + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( CD3DX12_DEFAULT ) + { + DepthEnable = TRUE; + DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; + DepthFunc = D3D12_COMPARISON_FUNC_LESS; + StencilEnable = FALSE; + StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK; + StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK; + const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = + { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS }; + FrontFace = defaultStencilOp; + BackFace = defaultStencilOp; + } + explicit CD3DX12_DEPTH_STENCIL_DESC( + BOOL depthEnable, + D3D12_DEPTH_WRITE_MASK depthWriteMask, + D3D12_COMPARISON_FUNC depthFunc, + BOOL stencilEnable, + UINT8 stencilReadMask, + UINT8 stencilWriteMask, + D3D12_STENCIL_OP frontStencilFailOp, + D3D12_STENCIL_OP frontStencilDepthFailOp, + D3D12_STENCIL_OP frontStencilPassOp, + D3D12_COMPARISON_FUNC frontStencilFunc, + D3D12_STENCIL_OP backStencilFailOp, + D3D12_STENCIL_OP backStencilDepthFailOp, + D3D12_STENCIL_OP backStencilPassOp, + D3D12_COMPARISON_FUNC backStencilFunc ) + { + DepthEnable = depthEnable; + DepthWriteMask = depthWriteMask; + DepthFunc = depthFunc; + StencilEnable = stencilEnable; + StencilReadMask = stencilReadMask; + StencilWriteMask = stencilWriteMask; + FrontFace.StencilFailOp = frontStencilFailOp; + FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; + FrontFace.StencilPassOp = frontStencilPassOp; + FrontFace.StencilFunc = frontStencilFunc; + BackFace.StencilFailOp = backStencilFailOp; + BackFace.StencilDepthFailOp = backStencilDepthFailOp; + BackFace.StencilPassOp = backStencilPassOp; + BackFace.StencilFunc = backStencilFunc; + } + ~CD3DX12_DEPTH_STENCIL_DESC() {} + operator const D3D12_DEPTH_STENCIL_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC +{ + CD3DX12_BLEND_DESC() + {} + explicit CD3DX12_BLEND_DESC( const D3D12_BLEND_DESC& o ) : + D3D12_BLEND_DESC( o ) + {} + explicit CD3DX12_BLEND_DESC( CD3DX12_DEFAULT ) + { + AlphaToCoverageEnable = FALSE; + IndependentBlendEnable = FALSE; + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + FALSE,FALSE, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + RenderTarget[ i ] = defaultRenderTargetBlendDesc; + } + ~CD3DX12_BLEND_DESC() {} + operator const D3D12_BLEND_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC +{ + CD3DX12_RASTERIZER_DESC() + {} + explicit CD3DX12_RASTERIZER_DESC( const D3D12_RASTERIZER_DESC& o ) : + D3D12_RASTERIZER_DESC( o ) + {} + explicit CD3DX12_RASTERIZER_DESC( CD3DX12_DEFAULT ) + { + FillMode = D3D12_FILL_MODE_SOLID; + CullMode = D3D12_CULL_MODE_BACK; + FrontCounterClockwise = FALSE; + DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + DepthClipEnable = TRUE; + MultisampleEnable = FALSE; + AntialiasedLineEnable = FALSE; + ForcedSampleCount = 0; + ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + } + explicit CD3DX12_RASTERIZER_DESC( + D3D12_FILL_MODE fillMode, + D3D12_CULL_MODE cullMode, + BOOL frontCounterClockwise, + INT depthBias, + FLOAT depthBiasClamp, + FLOAT slopeScaledDepthBias, + BOOL depthClipEnable, + BOOL multisampleEnable, + BOOL antialiasedLineEnable, + UINT forcedSampleCount, + D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) + { + FillMode = fillMode; + CullMode = cullMode; + FrontCounterClockwise = frontCounterClockwise; + DepthBias = depthBias; + DepthBiasClamp = depthBiasClamp; + SlopeScaledDepthBias = slopeScaledDepthBias; + DepthClipEnable = depthClipEnable; + MultisampleEnable = multisampleEnable; + AntialiasedLineEnable = antialiasedLineEnable; + ForcedSampleCount = forcedSampleCount; + ConservativeRaster = conservativeRaster; + } + ~CD3DX12_RASTERIZER_DESC() {} + operator const D3D12_RASTERIZER_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO +{ + CD3DX12_RESOURCE_ALLOCATION_INFO() + {} + explicit CD3DX12_RESOURCE_ALLOCATION_INFO( const D3D12_RESOURCE_ALLOCATION_INFO& o ) : + D3D12_RESOURCE_ALLOCATION_INFO( o ) + {} + CD3DX12_RESOURCE_ALLOCATION_INFO( + UINT64 size, + UINT64 alignment ) + { + SizeInBytes = size; + Alignment = alignment; + } + operator const D3D12_RESOURCE_ALLOCATION_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES +{ + CD3DX12_HEAP_PROPERTIES() + {} + explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES &o) : + D3D12_HEAP_PROPERTIES(o) + {} + CD3DX12_HEAP_PROPERTIES( + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = D3D12_HEAP_TYPE_CUSTOM; + CPUPageProperty = cpuPageProperty; + MemoryPoolPreference = memoryPoolPreference; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + explicit CD3DX12_HEAP_PROPERTIES( + D3D12_HEAP_TYPE type, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = type; + CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + operator const D3D12_HEAP_PROPERTIES&() const { return *this; } + bool IsCPUAccessible() const + { + return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK || (Type == D3D12_HEAP_TYPE_CUSTOM && + (CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE || CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK)); + } +}; +inline bool operator==( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ + return l.Type == r.Type && l.CPUPageProperty == r.CPUPageProperty && + l.MemoryPoolPreference == r.MemoryPoolPreference && + l.CreationNodeMask == r.CreationNodeMask && + l.VisibleNodeMask == r.VisibleNodeMask; +} +inline bool operator!=( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC +{ + CD3DX12_HEAP_DESC() + {} + explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC &o) : + D3D12_HEAP_DESC(o) + {} + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_PROPERTIES properties, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = properties; + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_TYPE type, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_PROPERTIES properties, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = properties; + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_TYPE type, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + operator const D3D12_HEAP_DESC&() const { return *this; } + bool IsCPUAccessible() const + { return static_cast< const CD3DX12_HEAP_PROPERTIES* >( &Properties )->IsCPUAccessible(); } +}; +inline bool operator==( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ + return l.SizeInBytes == r.SizeInBytes && + l.Properties == r.Properties && + l.Alignment == r.Alignment && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE +{ + CD3DX12_CLEAR_VALUE() + {} + explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE &o) : + D3D12_CLEAR_VALUE(o) + {} + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + const FLOAT color[4] ) + { + Format = format; + memcpy( Color, color, sizeof( Color ) ); + } + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + FLOAT depth, + UINT8 stencil ) + { + Format = format; + /* Use memcpy to preserve NAN values */ + memcpy( &DepthStencil.Depth, &depth, sizeof( depth ) ); + DepthStencil.Stencil = stencil; + } + operator const D3D12_CLEAR_VALUE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RANGE : public D3D12_RANGE +{ + CD3DX12_RANGE() + {} + explicit CD3DX12_RANGE(const D3D12_RANGE &o) : + D3D12_RANGE(o) + {} + CD3DX12_RANGE( + SIZE_T begin, + SIZE_T end ) + { + Begin = begin; + End = end; + } + operator const D3D12_RANGE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE +{ + CD3DX12_SHADER_BYTECODE() + {} + explicit CD3DX12_SHADER_BYTECODE(const D3D12_SHADER_BYTECODE &o) : + D3D12_SHADER_BYTECODE(o) + {} + CD3DX12_SHADER_BYTECODE( + ID3DBlob* pShaderBlob ) + { + pShaderBytecode = pShaderBlob->GetBufferPointer(); + BytecodeLength = pShaderBlob->GetBufferSize(); + } + CD3DX12_SHADER_BYTECODE( + void* _pShaderBytecode, + SIZE_T bytecodeLength ) + { + pShaderBytecode = _pShaderBytecode; + BytecodeLength = bytecodeLength; + } + operator const D3D12_SHADER_BYTECODE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE +{ + CD3DX12_TILED_RESOURCE_COORDINATE() + {} + explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE &o) : + D3D12_TILED_RESOURCE_COORDINATE(o) + {} + CD3DX12_TILED_RESOURCE_COORDINATE( + UINT x, + UINT y, + UINT z, + UINT subresource ) + { + X = x; + Y = y; + Z = z; + Subresource = subresource; + } + operator const D3D12_TILED_RESOURCE_COORDINATE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE +{ + CD3DX12_TILE_REGION_SIZE() + {} + explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE &o) : + D3D12_TILE_REGION_SIZE(o) + {} + CD3DX12_TILE_REGION_SIZE( + UINT numTiles, + BOOL useBox, + UINT width, + UINT16 height, + UINT16 depth ) + { + NumTiles = numTiles; + UseBox = useBox; + Width = width; + Height = height; + Depth = depth; + } + operator const D3D12_TILE_REGION_SIZE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING +{ + CD3DX12_SUBRESOURCE_TILING() + {} + explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING &o) : + D3D12_SUBRESOURCE_TILING(o) + {} + CD3DX12_SUBRESOURCE_TILING( + UINT widthInTiles, + UINT16 heightInTiles, + UINT16 depthInTiles, + UINT startTileIndexInOverallResource ) + { + WidthInTiles = widthInTiles; + HeightInTiles = heightInTiles; + DepthInTiles = depthInTiles; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_SUBRESOURCE_TILING&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE +{ + CD3DX12_TILE_SHAPE() + {} + explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE &o) : + D3D12_TILE_SHAPE(o) + {} + CD3DX12_TILE_SHAPE( + UINT widthInTexels, + UINT heightInTexels, + UINT depthInTexels ) + { + WidthInTexels = widthInTexels; + HeightInTexels = heightInTexels; + DepthInTexels = depthInTexels; + } + operator const D3D12_TILE_SHAPE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER +{ + CD3DX12_RESOURCE_BARRIER() + {} + explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) : + D3D12_RESOURCE_BARRIER(o) + {} + static inline CD3DX12_RESOURCE_BARRIER Transition( + _In_ ID3D12Resource* pResource, + D3D12_RESOURCE_STATES stateBefore, + D3D12_RESOURCE_STATES stateAfter, + UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + result.Flags = flags; + barrier.Transition.pResource = pResource; + barrier.Transition.StateBefore = stateBefore; + barrier.Transition.StateAfter = stateAfter; + barrier.Transition.Subresource = subresource; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER Aliasing( + _In_ ID3D12Resource* pResourceBefore, + _In_ ID3D12Resource* pResourceAfter) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING; + barrier.Aliasing.pResourceBefore = pResourceBefore; + barrier.Aliasing.pResourceAfter = pResourceAfter; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER UAV( + _In_ ID3D12Resource* pResource) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.UAV.pResource = pResource; + return result; + } + operator const D3D12_RESOURCE_BARRIER&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO +{ + CD3DX12_PACKED_MIP_INFO() + {} + explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO &o) : + D3D12_PACKED_MIP_INFO(o) + {} + CD3DX12_PACKED_MIP_INFO( + UINT8 numStandardMips, + UINT8 numPackedMips, + UINT numTilesForPackedMips, + UINT startTileIndexInOverallResource ) + { + NumStandardMips = numStandardMips; + NumPackedMips = numPackedMips; + NumTilesForPackedMips = numTilesForPackedMips; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_PACKED_MIP_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT +{ + CD3DX12_SUBRESOURCE_FOOTPRINT() + {} + explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT &o) : + D3D12_SUBRESOURCE_FOOTPRINT(o) + {} + CD3DX12_SUBRESOURCE_FOOTPRINT( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT rowPitch ) + { + Format = format; + Width = width; + Height = height; + Depth = depth; + RowPitch = rowPitch; + } + explicit CD3DX12_SUBRESOURCE_FOOTPRINT( + const D3D12_RESOURCE_DESC& resDesc, + UINT rowPitch ) + { + Format = resDesc.Format; + Width = UINT( resDesc.Width ); + Height = resDesc.Height; + Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1); + RowPitch = rowPitch; + } + operator const D3D12_SUBRESOURCE_FOOTPRINT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION +{ + CD3DX12_TEXTURE_COPY_LOCATION() + {} + explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION &o) : + D3D12_TEXTURE_COPY_LOCATION(o) + {} + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes) { pResource = pRes; } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, D3D12_PLACED_SUBRESOURCE_FOOTPRINT const& Footprint) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + PlacedFootprint = Footprint; + } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, UINT Sub) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + SubresourceIndex = Sub; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE +{ + CD3DX12_DESCRIPTOR_RANGE() { } + explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) : + D3D12_DESCRIPTOR_RANGE(o) + {} + CD3DX12_DESCRIPTOR_RANGE( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + inline void Init( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + static inline void Init( + _Out_ D3D12_DESCRIPTOR_RANGE &range, + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + range.RangeType = rangeType; + range.NumDescriptors = numDescriptors; + range.BaseShaderRegister = baseShaderRegister; + range.RegisterSpace = registerSpace; + range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE +{ + CD3DX12_ROOT_DESCRIPTOR_TABLE() {} + explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) : + D3D12_ROOT_DESCRIPTOR_TABLE(o) + {} + CD3DX12_ROOT_DESCRIPTOR_TABLE( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(numDescriptorRanges, _pDescriptorRanges); + } + + inline void Init( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(*this, numDescriptorRanges, _pDescriptorRanges); + } + + static inline void Init( + _Out_ D3D12_ROOT_DESCRIPTOR_TABLE &rootDescriptorTable, + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges; + rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS +{ + CD3DX12_ROOT_CONSTANTS() {} + explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) : + D3D12_ROOT_CONSTANTS(o) + {} + CD3DX12_ROOT_CONSTANTS( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(num32BitValues, shaderRegister, registerSpace); + } + + inline void Init( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, num32BitValues, shaderRegister, registerSpace); + } + + static inline void Init( + _Out_ D3D12_ROOT_CONSTANTS &rootConstants, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + rootConstants.Num32BitValues = num32BitValues; + rootConstants.ShaderRegister = shaderRegister; + rootConstants.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR +{ + CD3DX12_ROOT_DESCRIPTOR() {} + explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) : + D3D12_ROOT_DESCRIPTOR(o) + {} + CD3DX12_ROOT_DESCRIPTOR( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(shaderRegister, registerSpace); + } + + inline void Init( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, shaderRegister, registerSpace); + } + + static inline void Init(_Out_ D3D12_ROOT_DESCRIPTOR &table, UINT shaderRegister, UINT registerSpace = 0) + { + table.ShaderRegister = shaderRegister; + table.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER +{ + CD3DX12_ROOT_PARAMETER() {} + explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) : + D3D12_ROOT_PARAMETER(o) + {} + + static inline void InitAsDescriptorTable( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR_TABLE::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges); + } + + static inline void InitAsConstants( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace); + } + + static inline void InitAsConstantBufferView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsShaderResourceView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsUnorderedAccessView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + inline void InitAsDescriptorTable( + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility); + } + + inline void InitAsConstants( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility); + } + + inline void InitAsConstantBufferView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstantBufferView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsShaderResourceView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsShaderResourceView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsUnorderedAccessView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, visibility); + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC +{ + CD3DX12_STATIC_SAMPLER_DESC() {} + explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) : + D3D12_STATIC_SAMPLER_DESC(o) + {} + CD3DX12_STATIC_SAMPLER_DESC( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + + static inline void Init( + _Out_ D3D12_STATIC_SAMPLER_DESC &samplerDesc, + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + samplerDesc.ShaderRegister = shaderRegister; + samplerDesc.Filter = filter; + samplerDesc.AddressU = addressU; + samplerDesc.AddressV = addressV; + samplerDesc.AddressW = addressW; + samplerDesc.MipLODBias = mipLODBias; + samplerDesc.MaxAnisotropy = maxAnisotropy; + samplerDesc.ComparisonFunc = comparisonFunc; + samplerDesc.BorderColor = borderColor; + samplerDesc.MinLOD = minLOD; + samplerDesc.MaxLOD = maxLOD; + samplerDesc.ShaderVisibility = shaderVisibility; + samplerDesc.RegisterSpace = registerSpace; + } + inline void Init( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + *this, + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC +{ + CD3DX12_ROOT_SIGNATURE_DESC() {} + explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) : + D3D12_ROOT_SIGNATURE_DESC(o) + {} + CD3DX12_ROOT_SIGNATURE_DESC( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + CD3DX12_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) + { + Init(0, NULL, 0, NULL, D3D12_ROOT_SIGNATURE_FLAG_NONE); + } + + inline void Init( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + + static inline void Init( + _Out_ D3D12_ROOT_SIGNATURE_DESC &desc, + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + desc.NumParameters = numParameters; + desc.pParameters = _pParameters; + desc.NumStaticSamplers = numStaticSamplers; + desc.pStaticSamplers = _pStaticSamplers; + desc.Flags = flags; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE +{ + CD3DX12_CPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) : + D3D12_CPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_CPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + bool operator!=(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE &operator=(const D3D12_CPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE +{ + CD3DX12_GPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) : + D3D12_GPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_GPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + inline bool operator!=(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE &operator=(const D3D12_GPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +inline UINT D3D12CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT PlaneSlice, UINT MipLevels, UINT ArraySize ) +{ + return MipSlice + ArraySlice * MipLevels + PlaneSlice * MipLevels * ArraySize; +} + +//------------------------------------------------------------------------------------------------ +template +inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice ) +{ + MipSlice = static_cast(Subresource % MipLevels); + ArraySlice = static_cast((Subresource / MipLevels) % ArraySize); + PlaneSlice = static_cast(Subresource / (MipLevels * ArraySize)); +} + +//------------------------------------------------------------------------------------------------ +inline UINT8 D3D12GetFormatPlaneCount( + _In_ ID3D12Device* pDevice, + DXGI_FORMAT Format + ) +{ + D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format}; + if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo)))) + { + return 0; + } + return formatInfo.PlaneCount; +} + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC +{ + CD3DX12_RESOURCE_DESC() + {} + explicit CD3DX12_RESOURCE_DESC( const D3D12_RESOURCE_DESC& o ) : + D3D12_RESOURCE_DESC( o ) + {} + CD3DX12_RESOURCE_DESC( + D3D12_RESOURCE_DIMENSION dimension, + UINT64 alignment, + UINT64 width, + UINT height, + UINT16 depthOrArraySize, + UINT16 mipLevels, + DXGI_FORMAT format, + UINT sampleCount, + UINT sampleQuality, + D3D12_TEXTURE_LAYOUT layout, + D3D12_RESOURCE_FLAGS flags ) + { + Dimension = dimension; + Alignment = alignment; + Width = width; + Height = height; + DepthOrArraySize = depthOrArraySize; + MipLevels = mipLevels; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Layout = layout; + Flags = flags; + } + static inline CD3DX12_RESOURCE_DESC Buffer( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, + 1, 1, 1, DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Buffer( + UINT64 width, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, + DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex1D( + DXGI_FORMAT format, + UINT64 width, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, + mipLevels, format, 1, 0, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex2D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, + mipLevels, format, sampleCount, sampleQuality, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex3D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 depth, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, + mipLevels, format, 1, 0, layout, flags ); + } + inline UINT16 Depth() const + { return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT16 ArraySize() const + { return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const + { return D3D12GetFormatPlaneCount(pDevice, Format); } + inline UINT Subresources(_In_ ID3D12Device* pDevice) const + { return MipLevels * ArraySize() * PlaneCount(pDevice); } + inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) + { return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); } + operator const D3D12_RESOURCE_DESC&() const { return *this; } +}; +inline bool operator==( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ + return l.Dimension == r.Dimension && + l.Alignment == r.Alignment && + l.Width == r.Width && + l.Height == r.Height && + l.DepthOrArraySize == r.DepthOrArraySize && + l.MipLevels == r.MipLevels && + l.Format == r.Format && + l.SampleDesc.Count == r.SampleDesc.Count && + l.SampleDesc.Quality == r.SampleDesc.Quality && + l.Layout == r.Layout && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +// Row-by-row memcpy +inline void MemcpySubresource( + _In_ const D3D12_MEMCPY_DEST* pDest, + _In_ const D3D12_SUBRESOURCE_DATA* pSrc, + SIZE_T RowSizeInBytes, + UINT NumRows, + UINT NumSlices) +{ + for (UINT z = 0; z < NumSlices; ++z) + { + BYTE* pDestSlice = reinterpret_cast(pDest->pData) + pDest->SlicePitch * z; + const BYTE* pSrcSlice = reinterpret_cast(pSrc->pData) + pSrc->SlicePitch * z; + for (UINT y = 0; y < NumRows; ++y) + { + memcpy(pDestSlice + pDest->RowPitch * y, + pSrcSlice + pSrc->RowPitch * y, + RowSizeInBytes); + } + } +} + +//------------------------------------------------------------------------------------------------ +// Returns required size of a buffer to be used for data upload +inline UINT64 GetRequiredIntermediateSize( + _In_ ID3D12Resource* pDestinationResource, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources) +{ + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + UINT64 RequiredSize = 0; + + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize); + pDevice->Release(); + + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// All arrays must be populated (e.g. by calling GetCopyableFootprints) +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 RequiredSize, + _In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts, + _In_reads_(NumSubresources) const UINT* pNumRows, + _In_reads_(NumSubresources) const UINT64* pRowSizesInBytes, + _In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) +{ + // Minor validation + D3D12_RESOURCE_DESC IntermediateDesc = pIntermediate->GetDesc(); + D3D12_RESOURCE_DESC DestinationDesc = pDestinationResource->GetDesc(); + if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER || + IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset || + RequiredSize > (SIZE_T)-1 || + (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER && + (FirstSubresource != 0 || NumSubresources != 1))) + { + return 0; + } + + BYTE* pData; + HRESULT hr = pIntermediate->Map(0, NULL, reinterpret_cast(&pData)); + if (FAILED(hr)) + { + return 0; + } + + for (UINT i = 0; i < NumSubresources; ++i) + { + if (pRowSizesInBytes[i] > (SIZE_T)-1) return 0; + D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, pLayouts[i].Footprint.RowPitch * pNumRows[i] }; + MemcpySubresource(&DestData, &pSrcData[i], (SIZE_T)pRowSizesInBytes[i], pNumRows[i], pLayouts[i].Footprint.Depth); + } + pIntermediate->Unmap(0, NULL); + + if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + CD3DX12_BOX SrcBox( UINT( pLayouts[0].Offset ), UINT( pLayouts[0].Offset + pLayouts[0].Footprint.Width ) ); + pCmdList->CopyBufferRegion( + pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width); + } + else + { + for (UINT i = 0; i < NumSubresources; ++i) + { + CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource); + CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]); + pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr); + } + } + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// Heap-allocating UpdateSubresources implementation +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + UINT64 MemToAlloc = static_cast(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources; + if (MemToAlloc > SIZE_MAX) + { + return 0; + } + void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast(MemToAlloc)); + if (pMem == NULL) + { + return 0; + } + D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts = reinterpret_cast(pMem); + UINT64* pRowSizesInBytes = reinterpret_cast(pLayouts + NumSubresources); + UINT* pNumRows = reinterpret_cast(pRowSizesInBytes + NumSubresources); + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize); + pDevice->Release(); + + UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData); + HeapFree(GetProcessHeap(), 0, pMem); + return Result; +} + +//------------------------------------------------------------------------------------------------ +// Stack-allocating UpdateSubresources implementation +template +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0, MaxSubresources) UINT FirstSubresource, + _In_range_(1, MaxSubresources - FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources]; + UINT NumRows[MaxSubresources]; + UINT64 RowSizesInBytes[MaxSubresources]; + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize); + pDevice->Release(); + + return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData); +} + +//------------------------------------------------------------------------------------------------ +inline bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout ) +{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; } + +//------------------------------------------------------------------------------------------------ +inline ID3D12CommandList * const * CommandListCast(ID3D12GraphicsCommandList * const * pp) +{ + // This cast is useful for passing strongly typed command list pointers into + // ExecuteCommandLists. + // This cast is valid as long as the const-ness is respected. D3D12 APIs do + // respect the const-ness of their arguments. + return reinterpret_cast(pp); +} + + +#endif // defined( __cplusplus ) + +#endif //__D3DX12_H__ + + + diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/pch.cpp b/Samples/IntroGraphics/SimpleBezierUWP12/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..851c81be9b30ae3e8175fb950b95a1c9508580a3 --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/pch.cpp @@ -0,0 +1,10 @@ +//-------------------------------------------------------------------------------------- +// pch.cpp +// +// Include the standard header and generate the precompiled header. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" diff --git a/Samples/IntroGraphics/SimpleBezierUWP12/pch.h b/Samples/IntroGraphics/SimpleBezierUWP12/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..8aceb3eeb33b04c65556704c36be7be3ec19427d --- /dev/null +++ b/Samples/IntroGraphics/SimpleBezierUWP12/pch.h @@ -0,0 +1,70 @@ +//-------------------------------------------------------------------------------------- +// pch.h +// +// Header for standard system include files. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +// Use the C++ standard templated min/max +#define NOMINMAX + +#include + +#include +#include +#include +#include + +#include "d3dx12.h" + +#include +#include +#include +#include + +#include +#include + +#ifdef _DEBUG +#include +#endif + +#include "GamePad.h" +#include "GraphicsMemory.h" +#include "Keyboard.h" +#include "Mouse.h" +#include "DirectXHelpers.h" +#include "DescriptorHeap.h" + +namespace DX +{ + // Helper class for COM exceptions + class com_exception : public std::exception + { + public: + com_exception(HRESULT hr) : result(hr) {} + + virtual const char* what() const override + { + static char s_str[64] = { 0 }; + sprintf_s(s_str, "Failure with HRESULT of %08X", result); + return s_str; + } + + private: + HRESULT result; + }; + + // Helper utility converts D3D API failures into exceptions. + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + throw com_exception(hr); + } + } +} \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleInstancingUWP/SimpleInstancing.vcxproj b/Samples/IntroGraphics/SimpleInstancingUWP/SimpleInstancing.vcxproj index 834be22210e909a811458c49d950dcf78ffac78f..063bfab24fc628b3f4f1695645a74d406ec2829f 100644 --- a/Samples/IntroGraphics/SimpleInstancingUWP/SimpleInstancing.vcxproj +++ b/Samples/IntroGraphics/SimpleInstancingUWP/SimpleInstancing.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/IntroGraphics/SimpleLightingUWP/SimpleLighting.hlsli b/Samples/IntroGraphics/SimpleLightingUWP/SimpleLighting.hlsli index 0f5a2630b4ac35efba3f149f3dac4254f6efea30..4a34225c2c0311a3afe5f585f6a76de90cc4c116 100644 --- a/Samples/IntroGraphics/SimpleLightingUWP/SimpleLighting.hlsli +++ b/Samples/IntroGraphics/SimpleLightingUWP/SimpleLighting.hlsli @@ -11,7 +11,7 @@ //-------------------------------------------------------------------------------------- // Constant Buffer Variables //-------------------------------------------------------------------------------------- -cbuffer ConstantBuffer : register( b0 ) +cbuffer Constants : register( b0 ) { float4x4 mWorld; float4x4 mView; diff --git a/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.cpp b/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.cpp index dccf784809ad51f81097cf4d3fb2a82ada9b8554..4b3a9e1cdbc9cbefa0da6a0ef148e549cd455527 100644 --- a/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.cpp +++ b/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.cpp @@ -34,10 +34,11 @@ namespace static_assert((sizeof(ConstantBuffer) % 16) == 0, "Constant buffer must always be 16-byte aligned"); } + Sample::Sample() : m_curRotationAngleRad(0.0f) { - m_deviceResources = std::make_unique(); + m_deviceResources = std::make_unique(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); m_deviceResources->RegisterDeviceNotify(this); } @@ -417,10 +418,10 @@ void Sample::CreateDeviceDependentResources() XMStoreFloat4x4(&m_worldMatrix, XMMatrixIdentity()); // Initialize the view matrix - static const XMVECTORF32 eye = { 0.0f, 4.0f, -10.0f, 0.0f }; - static const XMVECTORF32 at = { 0.0f, 1.0f, 0.0f, 0.0f }; - static const XMVECTORF32 up = { 0.0f, 1.0f, 0.0f, 0.0 }; - XMStoreFloat4x4(&m_viewMatrix, XMMatrixLookAtLH(eye, at, up)); + static const XMVECTORF32 c_eye = { 0.0f, 4.0f, -10.0f, 0.0f }; + static const XMVECTORF32 c_at = { 0.0f, 1.0f, 0.0f, 0.0f }; + static const XMVECTORF32 c_up = { 0.0f, 1.0f, 0.0f, 0.0 }; + XMStoreFloat4x4(&m_viewMatrix, XMMatrixLookAtLH(c_eye, c_at, c_up)); // Initialize the lighting parameters m_lightDirs[0] = XMFLOAT4(-0.577f, 0.577f, -0.577f, 1.0f); diff --git a/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.sln b/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.sln index 1a6192407321d8b0192db69ed2029d79136595ca..aec6524b79acbf0f1915a4464f6b4d7f25ff553d 100644 --- a/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.sln +++ b/Samples/IntroGraphics/SimpleLightingUWP/SimpleLightingUWP.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleLightingUWP", "SimpleLightingUWP.vcxproj", "{A66CACF8-EB0A-4D35-A39F-65CBB6C546B8}" EndProject diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Assets/Logo.png b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7e704a106b99487be0f1eded426e6c5a2c65a9 Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/Logo.png differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Assets/SmallLogo.png b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/SmallLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..98b09d91991638282fc2426bbfd4a517733ff15a Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/SmallLogo.png differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Assets/SplashScreen.png b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/SplashScreen.png new file mode 100644 index 0000000000000000000000000000000000000000..c352b156fd090a57aec7da81b3b19a3fb5888b43 Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/SplashScreen.png differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Assets/StoreLogo.png b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..315472e10b9d380e509b2f041ea9ace5f994f5d2 Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/StoreLogo.png differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Assets/WideLogo.png b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/WideLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..c70f68e2c59214e0ff54844ccd8ae5e955826e10 Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/Assets/WideLogo.png differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/DeviceResources.cpp b/Samples/IntroGraphics/SimpleLightingUWP12/DeviceResources.cpp new file mode 100644 index 0000000000000000000000000000000000000000..137803bd4fe1f8f4981b1ac95d8784c1e6cb7808 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/DeviceResources.cpp @@ -0,0 +1,658 @@ +// +// DeviceResources.cpp - A wrapper for the Direct3D 12 device and swapchain +// + +#include "pch.h" +#include "DeviceResources.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +// Constants used to calculate screen rotations +namespace ScreenRotation +{ + // 0-degree Z-rotation + static const XMFLOAT4X4 Rotation0( + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 90-degree Z-rotation + static const XMFLOAT4X4 Rotation90( + 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 180-degree Z-rotation + static const XMFLOAT4X4 Rotation180( + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 270-degree Z-rotation + static const XMFLOAT4X4 Rotation270( + 0.0f, -1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); +}; + +namespace +{ + inline DXGI_FORMAT NoSRGB(DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8X8_UNORM; + default: return fmt; + } + } +}; + +// Constructor for DeviceResources. +DX::DeviceResources::DeviceResources(DXGI_FORMAT backBufferFormat, DXGI_FORMAT depthBufferFormat, UINT backBufferCount, D3D_FEATURE_LEVEL minFeatureLevel) : + m_backBufferIndex(0), + m_fenceValues{}, + m_rtvDescriptorSize(0), + m_screenViewport{}, + m_scissorRect{}, + m_backBufferFormat(backBufferFormat), + m_depthBufferFormat(depthBufferFormat), + m_backBufferCount(backBufferCount), + m_d3dMinFeatureLevel(minFeatureLevel), + m_window(0), + m_d3dFeatureLevel(D3D_FEATURE_LEVEL_11_0), + m_rotation(DXGI_MODE_ROTATION_IDENTITY), + m_outputSize{0, 0, 1, 1}, + m_orientationTransform3D(ScreenRotation::Rotation0), + m_deviceNotify(nullptr) +{ + if (backBufferCount > MAX_BACK_BUFFER_COUNT) + { + throw std::out_of_range("backBufferCount too large"); + } + + if (minFeatureLevel < D3D_FEATURE_LEVEL_11_0) + { + throw std::out_of_range("minFeatureLevel too low"); + } +} + +// Destructor for DeviceResources. +DX::DeviceResources::~DeviceResources() +{ + // Ensure that the GPU is no longer referencing resources that are about to be destroyed. + WaitForGpu(); +} + +// Configures the Direct3D device, and stores handles to it and the device context. +void DX::DeviceResources::CreateDeviceResources() +{ +#if defined(_DEBUG) + // Enable the debug layer (only available if the Graphics Tools feature-on-demand is enabled). + { + ComPtr debugController; + if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(debugController.GetAddressOf())))) + { + debugController->EnableDebugLayer(); + } + else + { + OutputDebugStringA("WARNING: Direct3D Debug Device is not available\n"); + } + + ComPtr dxgiInfoQueue; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(dxgiInfoQueue.GetAddressOf())))) + { + dxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, true); + dxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, true); + } + } +#endif + + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(m_dxgiFactory.ReleaseAndGetAddressOf()))); + + ComPtr adapter; + GetAdapter(adapter.GetAddressOf()); + + // Create the DX12 API device object. + DX::ThrowIfFailed(D3D12CreateDevice( + adapter.Get(), + m_d3dMinFeatureLevel, + IID_PPV_ARGS(m_d3dDevice.ReleaseAndGetAddressOf()) + )); + +#ifndef NDEBUG + // Configure debug device (if active). + ComPtr d3dInfoQueue; + if (SUCCEEDED(m_d3dDevice.As(&d3dInfoQueue))) + { +#ifdef _DEBUG + d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true); + d3dInfoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true); +#endif + D3D12_MESSAGE_ID hide[] = + { + D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE, + D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE + }; + D3D12_INFO_QUEUE_FILTER filter = {}; + filter.DenyList.NumIDs = _countof(hide); + filter.DenyList.pIDList = hide; + d3dInfoQueue->AddStorageFilterEntries(&filter); + } +#endif + + // Determine maximum supported feature level for this device + static const D3D_FEATURE_LEVEL s_featureLevels[] = + { + D3D_FEATURE_LEVEL_12_1, + D3D_FEATURE_LEVEL_12_0, + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + }; + + D3D12_FEATURE_DATA_FEATURE_LEVELS featLevels = + { + _countof(s_featureLevels), s_featureLevels, D3D_FEATURE_LEVEL_11_0 + }; + + HRESULT hr = m_d3dDevice->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &featLevels, sizeof(featLevels)); + if (SUCCEEDED(hr)) + { + m_d3dFeatureLevel = featLevels.MaxSupportedFeatureLevel; + } + else + { + m_d3dFeatureLevel = m_d3dMinFeatureLevel; + } + + // Create the command queue. + D3D12_COMMAND_QUEUE_DESC queueDesc = {}; + queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; + queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + + DX::ThrowIfFailed(m_d3dDevice->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(m_commandQueue.ReleaseAndGetAddressOf()))); + + // Create descriptor heaps for render target views and depth stencil views. + D3D12_DESCRIPTOR_HEAP_DESC rtvDescriptorHeapDesc = {}; + rtvDescriptorHeapDesc.NumDescriptors = m_backBufferCount; + rtvDescriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + + DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&rtvDescriptorHeapDesc, IID_PPV_ARGS(m_rtvDescriptorHeap.ReleaseAndGetAddressOf()))); + + m_rtvDescriptorSize = m_d3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + D3D12_DESCRIPTOR_HEAP_DESC dsvDescriptorHeapDesc = {}; + dsvDescriptorHeapDesc.NumDescriptors = 1; + dsvDescriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; + + DX::ThrowIfFailed(m_d3dDevice->CreateDescriptorHeap(&dsvDescriptorHeapDesc, IID_PPV_ARGS(m_dsvDescriptorHeap.ReleaseAndGetAddressOf()))); + } + + // Create a command allocator for each back buffer that will be rendered to. + for (UINT n = 0; n < m_backBufferCount; n++) + { + DX::ThrowIfFailed(m_d3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(m_commandAllocators[n].ReleaseAndGetAddressOf()))); + } + + // Create a command list for recording graphics commands. + DX::ThrowIfFailed(m_d3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocators[0].Get(), nullptr, IID_PPV_ARGS(m_commandList.ReleaseAndGetAddressOf()))); + DX::ThrowIfFailed(m_commandList->Close()); + + // Create a fence for tracking GPU execution progress. + DX::ThrowIfFailed(m_d3dDevice->CreateFence(m_fenceValues[m_backBufferIndex], D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.ReleaseAndGetAddressOf()))); + m_fenceValues[m_backBufferIndex]++; + + m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); + if (!m_fenceEvent.IsValid()) + { + throw std::exception("CreateEvent"); + } +} + +// These resources need to be recreated every time the window size is changed. +void DX::DeviceResources::CreateWindowSizeDependentResources() +{ + if (!m_window) + { + throw std::exception("Call SetWindow with a valid CoreWindow pointer"); + } + + // Wait until all previous GPU work is complete. + WaitForGpu(); + + // Release resources that are tied to the swap chain and update fence values. + for (UINT n = 0; n < m_backBufferCount; n++) + { + m_renderTargets[n].Reset(); + m_fenceValues[n] = m_fenceValues[m_backBufferIndex]; + } + + // Determine the render target size in pixels. + UINT backBufferWidth = std::max(m_outputSize.right - m_outputSize.left, 1); + UINT backBufferHeight = std::max(m_outputSize.bottom - m_outputSize.top, 1); + DXGI_FORMAT backBufferFormat = NoSRGB(m_backBufferFormat); + + // If the swap chain already exists, resize it, otherwise create one. + if (m_swapChain) + { + // If the swap chain already exists, resize it. + HRESULT hr = m_swapChain->ResizeBuffers( + m_backBufferCount, + backBufferWidth, + backBufferHeight, + backBufferFormat, + 0 + ); + + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on ResizeBuffers: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + // If the device was removed for any reason, a new device and swap chain will need to be created. + HandleDeviceLost(); + + // Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method + // and correctly set up the new device. + return; + } + else + { + DX::ThrowIfFailed(hr); + } + } + else + { + // Create a descriptor for the swap chain. + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {}; + swapChainDesc.Width = backBufferWidth; + swapChainDesc.Height = backBufferHeight; + swapChainDesc.Format = backBufferFormat; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = m_backBufferCount; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE; + + // Create a swap chain for the window. + ComPtr swapChain; + DX::ThrowIfFailed(m_dxgiFactory->CreateSwapChainForCoreWindow( + m_commandQueue.Get(), + m_window, + &swapChainDesc, + nullptr, + swapChain.GetAddressOf() + )); + + DX::ThrowIfFailed(swapChain.As(&m_swapChain)); + } + + // Set the proper orientation for the swap chain, and generate + // matrix transformations for rendering to the rotated swap chain. + switch (m_rotation) + { + default: + case DXGI_MODE_ROTATION_IDENTITY: + m_orientationTransform3D = ScreenRotation::Rotation0; + break; + + case DXGI_MODE_ROTATION_ROTATE90: + m_orientationTransform3D = ScreenRotation::Rotation270; + break; + + case DXGI_MODE_ROTATION_ROTATE180: + m_orientationTransform3D = ScreenRotation::Rotation180; + break; + + case DXGI_MODE_ROTATION_ROTATE270: + m_orientationTransform3D = ScreenRotation::Rotation90; + break; + } + + DX::ThrowIfFailed(m_swapChain->SetRotation(m_rotation)); + + // Obtain the back buffers for this window which will be the final render targets + // and create render target views for each of them. + for (UINT n = 0; n < m_backBufferCount; n++) + { + DX::ThrowIfFailed(m_swapChain->GetBuffer(n, IID_PPV_ARGS(m_renderTargets[n].GetAddressOf()))); + + wchar_t name[25] = {}; + swprintf_s(name, L"Render target %u", n); + m_renderTargets[n]->SetName(name); + + D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {}; + rtvDesc.Format = m_backBufferFormat; + rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + + CD3DX12_CPU_DESCRIPTOR_HANDLE rtvDescriptor(m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), n, m_rtvDescriptorSize); + m_d3dDevice->CreateRenderTargetView(m_renderTargets[n].Get(), &rtvDesc, rtvDescriptor); + } + + // Reset the index to the current back buffer. + m_backBufferIndex = m_swapChain->GetCurrentBackBufferIndex(); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + // Allocate a 2-D surface as the depth/stencil buffer and create a depth/stencil view + // on this surface. + CD3DX12_HEAP_PROPERTIES depthHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + + D3D12_RESOURCE_DESC depthStencilDesc = CD3DX12_RESOURCE_DESC::Tex2D( + m_depthBufferFormat, + backBufferWidth, + backBufferHeight, + 1, // This depth stencil view has only one texture. + 1 // Use a single mipmap level. + ); + depthStencilDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; + + D3D12_CLEAR_VALUE depthOptimizedClearValue = {}; + depthOptimizedClearValue.Format = m_depthBufferFormat; + depthOptimizedClearValue.DepthStencil.Depth = 1.0f; + depthOptimizedClearValue.DepthStencil.Stencil = 0; + + DX::ThrowIfFailed(m_d3dDevice->CreateCommittedResource( + &depthHeapProperties, + D3D12_HEAP_FLAG_NONE, + &depthStencilDesc, + D3D12_RESOURCE_STATE_DEPTH_WRITE, + &depthOptimizedClearValue, + IID_PPV_ARGS(m_depthStencil.ReleaseAndGetAddressOf()) + )); + + m_depthStencil->SetName(L"Depth stencil"); + + D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = {}; + dsvDesc.Format = m_depthBufferFormat; + dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D; + + m_d3dDevice->CreateDepthStencilView(m_depthStencil.Get(), &dsvDesc, m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); + } + + // Set the 3D rendering viewport and scissor rectangle to target the entire window. + m_screenViewport.TopLeftX = m_screenViewport.TopLeftY = 0.f; + m_screenViewport.Width = static_cast(backBufferWidth); + m_screenViewport.Height = static_cast(backBufferHeight); + m_screenViewport.MinDepth = D3D12_MIN_DEPTH; + m_screenViewport.MaxDepth = D3D12_MAX_DEPTH; + + m_scissorRect.left = m_scissorRect.top = 0; + m_scissorRect.right = backBufferWidth; + m_scissorRect.bottom = backBufferHeight; +} + +// This method is called when the CoreWindow is created (or re-created). +void DX::DeviceResources::SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_window = window; + + m_outputSize.left = m_outputSize.top = 0; + m_outputSize.right = width; + m_outputSize.bottom = height; + + m_rotation = rotation; +} + +// This method is called when the window changes size. +bool DX::DeviceResources::WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + RECT newRc; + newRc.left = newRc.top = 0; + newRc.right = width; + newRc.bottom = height; + if (newRc.left == m_outputSize.left + && newRc.top == m_outputSize.top + && newRc.right == m_outputSize.right + && newRc.bottom == m_outputSize.bottom + && rotation == m_rotation) + { + return false; + } + + m_outputSize = newRc; + m_rotation = rotation; + CreateWindowSizeDependentResources(); + return true; +} + +// This method is called in the event handler for the DisplayContentsInvalidated event. +void DX::DeviceResources::ValidateDevice() +{ + // The D3D Device is no longer valid if the default adapter changed since the device + // was created or if the device has been removed. + + DXGI_ADAPTER_DESC previousDesc; + { + ComPtr previousDefaultAdapter; + DX::ThrowIfFailed(m_dxgiFactory->EnumAdapters1(0, previousDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(previousDefaultAdapter->GetDesc(&previousDesc)); + } + + DXGI_ADAPTER_DESC currentDesc; + { + ComPtr currentFactory; + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(currentFactory.GetAddressOf()))); + + ComPtr currentDefaultAdapter; + DX::ThrowIfFailed(currentFactory->EnumAdapters1(0, currentDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(currentDefaultAdapter->GetDesc(¤tDesc)); + } + + // If the adapter LUIDs don't match, or if the device reports that it has been removed, + // a new D3D device must be created. + + if (previousDesc.AdapterLuid.LowPart != currentDesc.AdapterLuid.LowPart + || previousDesc.AdapterLuid.HighPart != currentDesc.AdapterLuid.HighPart + || FAILED(m_d3dDevice->GetDeviceRemovedReason())) + { +#ifdef _DEBUG + OutputDebugStringA("Device Lost on ValidateDevice\n"); +#endif + + // Create a new device and swap chain. + HandleDeviceLost(); + } +} + +// Recreate all device resources and set them back to the current state. +void DX::DeviceResources::HandleDeviceLost() +{ + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceLost(); + } + + for (UINT n = 0; n < m_backBufferCount; n++) + { + m_commandAllocators[n].Reset(); + m_renderTargets[n].Reset(); + } + + m_depthStencil.Reset(); + m_commandQueue.Reset(); + m_commandList.Reset(); + m_fence.Reset(); + m_rtvDescriptorHeap.Reset(); + m_dsvDescriptorHeap.Reset(); + m_swapChain.Reset(); + m_d3dDevice.Reset(); + m_dxgiFactory.Reset(); + +#ifdef _DEBUG + { + ComPtr dxgiDebug; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&dxgiDebug)))) + { + dxgiDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_FLAGS(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL)); + } + } +#endif + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); + + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceRestored(); + } +} + +// Prepare the command list and render target for rendering. +void DX::DeviceResources::Prepare() +{ + // Reset command list and allocator. + DX::ThrowIfFailed(m_commandAllocators[m_backBufferIndex]->Reset()); + DX::ThrowIfFailed(m_commandList->Reset(m_commandAllocators[m_backBufferIndex].Get(), nullptr)); + + // Transition the render target into the correct state to allow for drawing into it. + D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_backBufferIndex].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET); + m_commandList->ResourceBarrier(1, &barrier); +} + +// Present the contents of the swap chain to the screen. +void DX::DeviceResources::Present() +{ + // Transition the render target to the state that allows it to be presented to the display. + D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_backBufferIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT); + m_commandList->ResourceBarrier(1, &barrier); + + // Send the command list off to the GPU for processing. + DX::ThrowIfFailed(m_commandList->Close()); + m_commandQueue->ExecuteCommandLists(1, CommandListCast(m_commandList.GetAddressOf())); + + // The first argument instructs DXGI to block until VSync, putting the application + // to sleep until the next VSync. This ensures we don't waste any cycles rendering + // frames that will never be displayed to the screen. + HRESULT hr = m_swapChain->Present(1, 0); + + // If the device was reset we must completely reinitialize the renderer. + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on Present: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + HandleDeviceLost(); + } + else + { + DX::ThrowIfFailed(hr); + + MoveToNextFrame(); + } +} + +// Wait for pending GPU work to complete. +void DX::DeviceResources::WaitForGpu() noexcept +{ + if (m_commandQueue && m_fence && m_fenceEvent.IsValid()) + { + // Schedule a Signal command in the GPU queue. + UINT64 fenceValue = m_fenceValues[m_backBufferIndex]; + if (SUCCEEDED(m_commandQueue->Signal(m_fence.Get(), fenceValue))) + { + // Wait until the Signal has been processed. + if (SUCCEEDED(m_fence->SetEventOnCompletion(fenceValue, m_fenceEvent.Get()))) + { + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + + // Increment the fence value for the current frame. + m_fenceValues[m_backBufferIndex]++; + } + } + } +} + +// Prepare to render the next frame. +void DX::DeviceResources::MoveToNextFrame() +{ + // Schedule a Signal command in the queue. + const UINT64 currentFenceValue = m_fenceValues[m_backBufferIndex]; + DX::ThrowIfFailed(m_commandQueue->Signal(m_fence.Get(), currentFenceValue)); + + // Update the back buffer index. + m_backBufferIndex = m_swapChain->GetCurrentBackBufferIndex(); + + // If the next frame is not ready to be rendered yet, wait until it is ready. + if (m_fence->GetCompletedValue() < m_fenceValues[m_backBufferIndex]) + { + DX::ThrowIfFailed(m_fence->SetEventOnCompletion(m_fenceValues[m_backBufferIndex], m_fenceEvent.Get())); + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + } + + // Set the fence value for the next frame. + m_fenceValues[m_backBufferIndex] = currentFenceValue + 1; +} + +// This method acquires the first available hardware adapter that supports Direct3D 12. +// If no such adapter can be found, try WARP. Otherwise throw an exception. +void DX::DeviceResources::GetAdapter(IDXGIAdapter1** ppAdapter) +{ + *ppAdapter = nullptr; + + ComPtr adapter; + for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != m_dxgiFactory->EnumAdapters1(adapterIndex, adapter.ReleaseAndGetAddressOf()); ++adapterIndex) + { + DXGI_ADAPTER_DESC1 desc; + DX::ThrowIfFailed(adapter->GetDesc1(&desc)); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + continue; + } + + // Check to see if the adapter supports Direct3D 12, but don't create the actual device yet. + if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), m_d3dMinFeatureLevel, _uuidof(ID3D12Device), nullptr))) + { +#ifdef _DEBUG + wchar_t buff[256] = {}; + swprintf_s(buff, L"Direct3D Adapter (%u): VID:%04X, PID:%04X - %ls\n", adapterIndex, desc.VendorId, desc.DeviceId, desc.Description); + OutputDebugStringW(buff); +#endif + break; + } + } + +#if !defined(NDEBUG) + if (!adapter) + { + // Try WARP12 instead + if (FAILED(m_dxgiFactory->EnumWarpAdapter(IID_PPV_ARGS(adapter.ReleaseAndGetAddressOf())))) + { + throw std::exception("WARP12 not available. Enable the 'Graphics Tools' feature-on-demand"); + } + + OutputDebugStringA("Direct3D Adapter - WARP12\n"); + } +#endif + + if (!adapter) + { + throw std::exception("No Direct3D 12 device found"); + } + + *ppAdapter = adapter.Detach(); +} diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/DeviceResources.h b/Samples/IntroGraphics/SimpleLightingUWP12/DeviceResources.h new file mode 100644 index 0000000000000000000000000000000000000000..086d0cec4aaa5f1800fd90959c4c40269f121952 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/DeviceResources.h @@ -0,0 +1,117 @@ +// +// DeviceResources.h - A wrapper for the Direct3D 12 device and swapchain +// + +#pragma once + +namespace DX +{ + // Provides an interface for an application that owns DeviceResources to be notified of the device being lost or created. + interface IDeviceNotify + { + virtual void OnDeviceLost() = 0; + virtual void OnDeviceRestored() = 0; + }; + + // Controls all the DirectX device resources. + class DeviceResources + { + public: + DeviceResources(DXGI_FORMAT backBufferFormat = DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT depthBufferFormat = DXGI_FORMAT_D32_FLOAT, + UINT backBufferCount = 2, + D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL_11_0); + ~DeviceResources(); + + void CreateDeviceResources(); + void CreateWindowSizeDependentResources(); + void SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + bool WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + void HandleDeviceLost(); + void RegisterDeviceNotify(IDeviceNotify* deviceNotify) { m_deviceNotify = deviceNotify; } + void Prepare(); + void Present(); + void WaitForGpu() noexcept; + + // Device Accessors. + RECT GetOutputSize() const { return m_outputSize; } + DXGI_MODE_ROTATION GetRotation() const { return m_rotation; } + + // Direct3D Accessors. + ID3D12Device* GetD3DDevice() const { return m_d3dDevice.Get(); } + IDXGISwapChain3* GetSwapChain() const { return m_swapChain.Get(); } + D3D_FEATURE_LEVEL GetDeviceFeatureLevel() const { return m_d3dFeatureLevel; } + ID3D12Resource* GetRenderTarget() const { return m_renderTargets[m_backBufferIndex].Get(); } + ID3D12Resource* GetDepthStencil() const { return m_depthStencil.Get(); } + ID3D12CommandQueue* GetCommandQueue() const { return m_commandQueue.Get(); } + ID3D12CommandAllocator* GetCommandAllocator() const { return m_commandAllocators[m_backBufferIndex].Get(); } + ID3D12GraphicsCommandList* GetCommandList() const { return m_commandList.Get(); } + DXGI_FORMAT GetBackBufferFormat() const { return m_backBufferFormat; } + DXGI_FORMAT GetDepthBufferFormat() const { return m_depthBufferFormat; } + D3D12_VIEWPORT GetScreenViewport() const { return m_screenViewport; } + D3D12_RECT GetScissorRect() const { return m_scissorRect; } + UINT GetCurrentFrameIndex() const { return m_backBufferIndex; } + UINT GetBackBufferCount() const { return m_backBufferCount; } + DirectX::XMFLOAT4X4 GetOrientationTransform3D() const { return m_orientationTransform3D; } + + CD3DX12_CPU_DESCRIPTOR_HANDLE GetRenderTargetView() const + { + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), m_backBufferIndex, m_rtvDescriptorSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE GetDepthStencilView() const + { + return CD3DX12_CPU_DESCRIPTOR_HANDLE(m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); + } + + private: + void MoveToNextFrame(); + void GetAdapter(IDXGIAdapter1** ppAdapter); + + const static size_t MAX_BACK_BUFFER_COUNT = 3; + + UINT m_backBufferIndex; + + // Direct3D objects. + Microsoft::WRL::ComPtr m_d3dDevice; + Microsoft::WRL::ComPtr m_commandQueue; + Microsoft::WRL::ComPtr m_commandList; + Microsoft::WRL::ComPtr m_commandAllocators[MAX_BACK_BUFFER_COUNT]; + + // Swap chain objects. + Microsoft::WRL::ComPtr m_dxgiFactory; + Microsoft::WRL::ComPtr m_swapChain; + Microsoft::WRL::ComPtr m_renderTargets[MAX_BACK_BUFFER_COUNT]; + Microsoft::WRL::ComPtr m_depthStencil; + + // Presentation fence objects. + Microsoft::WRL::ComPtr m_fence; + UINT64 m_fenceValues[MAX_BACK_BUFFER_COUNT]; + Microsoft::WRL::Wrappers::Event m_fenceEvent; + + // Direct3D rendering objects. + Microsoft::WRL::ComPtr m_rtvDescriptorHeap; + Microsoft::WRL::ComPtr m_dsvDescriptorHeap; + UINT m_rtvDescriptorSize; + D3D12_VIEWPORT m_screenViewport; + D3D12_RECT m_scissorRect; + + // Direct3D properties. + DXGI_FORMAT m_backBufferFormat; + DXGI_FORMAT m_depthBufferFormat; + UINT m_backBufferCount; + D3D_FEATURE_LEVEL m_d3dMinFeatureLevel; + + // Cached device properties. + IUnknown* m_window; + D3D_FEATURE_LEVEL m_d3dFeatureLevel; + DXGI_MODE_ROTATION m_rotation; + RECT m_outputSize; + + // Transforms used for display orientation. + DirectX::XMFLOAT4X4 m_orientationTransform3D; + + // The IDeviceNotify can be held directly as it owns the DeviceResources. + IDeviceNotify* m_deviceNotify; + }; +} diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/LambertPS.hlsl b/Samples/IntroGraphics/SimpleLightingUWP12/LambertPS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..62b916fdec14d115b6161b60eebc80c8000bce1f --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/LambertPS.hlsl @@ -0,0 +1,2 @@ +// LambertPS.hlsl file to provide an MSBuild target for the LambertPS pixel-shader entry point +#include "SimpleLighting.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Main.cpp b/Samples/IntroGraphics/SimpleLightingUWP12/Main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1aa89823bf5c2b616a5ae0b381788cb17408d354 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/Main.cpp @@ -0,0 +1,357 @@ +//-------------------------------------------------------------------------------------- +// Main.cpp +// +// Entry point for Universal Windows Platform (UWP) app. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SimpleLightingUWP12.h" + +#include + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace DirectX; + +ref class ViewProvider sealed : public IFrameworkView +{ +public: + ViewProvider() : + m_exit(false), + m_visible(true), + m_DPI(96.f), + m_logicalWidth(800.f), + m_logicalHeight(600.f), + m_nativeOrientation(DisplayOrientations::None), + m_currentOrientation(DisplayOrientations::None) + { + } + + // IFrameworkView methods + virtual void Initialize(CoreApplicationView^ applicationView) + { + applicationView->Activated += ref new + TypedEventHandler(this, &ViewProvider::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &ViewProvider::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &ViewProvider::OnResuming); + + m_sample = std::make_unique(); + } + + virtual void Uninitialize() + { + m_sample.reset(); + } + + virtual void SetWindow(CoreWindow^ window) + { + window->SizeChanged += + ref new TypedEventHandler(this, &ViewProvider::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &ViewProvider::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &ViewProvider::OnWindowClosed); + + auto dispatcher = CoreWindow::GetForCurrentThread()->Dispatcher; + + dispatcher->AcceleratorKeyActivated += + ref new TypedEventHandler(this, &ViewProvider::OnAcceleratorKeyActivated); + + auto currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &ViewProvider::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &ViewProvider::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &ViewProvider::OnDisplayContentsInvalidated); + + m_DPI = currentDisplayInformation->LogicalDpi; + + m_logicalWidth = window->Bounds.Width; + m_logicalHeight = window->Bounds.Height; + + m_nativeOrientation = currentDisplayInformation->NativeOrientation; + m_currentOrientation = currentDisplayInformation->CurrentOrientation; + + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->Initialize(reinterpret_cast(window), + outputWidth, outputHeight, rotation ); + } + + virtual void Load(Platform::String^ entryPoint) + { + } + + virtual void Run() + { + while (!m_exit) + { + if (m_visible) + { + m_sample->Tick(); + + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } + } + +protected: + // Event handlers + void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) + { + if (args->Kind == ActivationKind::Launch) + { + auto launchArgs = static_cast(args); + + if (launchArgs->PrelaunchActivated) + { + // Opt-out of Prelaunch + CoreApplication::Exit(); + return; + } + } + + int w, h; + m_sample->GetDefaultSize(w, h); + + m_DPI = DisplayInformation::GetForCurrentView()->LogicalDpi; + + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; + // Change to ApplicationViewWindowingMode::FullScreen to default to full screen + + auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h)); + + ApplicationView::PreferredLaunchViewSize = desiredSize; + + auto view = ApplicationView::GetForCurrentView(); + + auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200)); + + view->SetPreferredMinSize(minSize); + + CoreWindow::GetForCurrentThread()->Activate(); + + view->FullScreenSystemOverlayMode = FullScreenSystemOverlayMode::Minimal; + + view->TryResizeView(desiredSize); + } + + void OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) + { + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + create_task([this, deferral]() + { + m_sample->OnSuspending(); + + deferral->Complete(); + }); + } + + void OnResuming(Platform::Object^ sender, Platform::Object^ args) + { + m_sample->OnResuming(); + } + + void OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) + { + m_logicalWidth = sender->Bounds.Width; + m_logicalHeight = sender->Bounds.Height; + + HandleWindowSizeChanged(); + } + + void OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) + { + m_visible = args->Visible; + if (m_visible) + m_sample->OnActivated(); + else + m_sample->OnDeactivated(); + } + + void OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) + { + m_exit = true; + } + + void OnAcceleratorKeyActivated(CoreDispatcher^, AcceleratorKeyEventArgs^ args) + { + if (args->EventType == CoreAcceleratorKeyEventType::SystemKeyDown + && args->VirtualKey == VirtualKey::Enter + && args->KeyStatus.IsMenuKeyDown + && !args->KeyStatus.WasKeyDown) + { + // Implements the classic ALT+ENTER fullscreen toggle + auto view = ApplicationView::GetForCurrentView(); + + if (view->IsFullScreenMode) + view->ExitFullScreenMode(); + else + view->TryEnterFullScreenMode(); + + args->Handled = true; + } + } + + void OnDpiChanged(DisplayInformation^ sender, Object^ args) + { + m_DPI = sender->LogicalDpi; + + HandleWindowSizeChanged(); + } + + void OnOrientationChanged(DisplayInformation^ sender, Object^ args) + { + m_currentOrientation = sender->CurrentOrientation; + + HandleWindowSizeChanged(); + } + + void OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) + { + m_sample->ValidateDevice(); + } + +private: + bool m_exit; + bool m_visible; + float m_DPI; + float m_logicalWidth; + float m_logicalHeight; + std::unique_ptr m_sample; + + Windows::Graphics::Display::DisplayOrientations m_nativeOrientation; + Windows::Graphics::Display::DisplayOrientations m_currentOrientation; + + inline int ConvertDipsToPixels(float dips) const + { + return int(dips * m_DPI / 96.f + 0.5f); + } + + inline float ConvertPixelsToDips(int pixels) const + { + return (float(pixels) * 96.f / m_DPI); + } + + DXGI_MODE_ROTATION ComputeDisplayRotation() const + { + DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; + + switch (m_nativeOrientation) + { + case DisplayOrientations::Landscape: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + } + break; + + case DisplayOrientations::Portrait: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + } + break; + } + + return rotation; + } + + void HandleWindowSizeChanged() + { + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->OnWindowSizeChanged(outputWidth, outputHeight, rotation); + } +}; + +ref class ViewProviderFactory : IFrameworkViewSource +{ +public: + virtual IFrameworkView^ CreateView() + { + return ref new ViewProvider(); + } +}; + + +// Entry point +[Platform::MTAThread] +int main(Platform::Array^ argv) +{ + UNREFERENCED_PARAMETER(argv); + + auto viewProviderFactory = ref new ViewProviderFactory(); + CoreApplication::Run(viewProviderFactory); + return 0; +} diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Package.appxmanifest b/Samples/IntroGraphics/SimpleLightingUWP12/Package.appxmanifest new file mode 100644 index 0000000000000000000000000000000000000000..29f28984509e0797303ade86d479b8ac00d5720b --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + SimpleLightingUWP12 + Xbox Advanced Technology Group + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/Readme.docx b/Samples/IntroGraphics/SimpleLightingUWP12/Readme.docx new file mode 100644 index 0000000000000000000000000000000000000000..a3302a66cbccabf5cb9a2b57e2cf525dd94880ba Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/Readme.docx differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLighting.hlsli b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLighting.hlsli new file mode 100644 index 0000000000000000000000000000000000000000..90eed8cda69fc8a4461a11a7655821f0aeb5addb --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLighting.hlsli @@ -0,0 +1,80 @@ +//-------------------------------------------------------------------------------------- +// SimpleLighting.hlsl +// +// Shader demonstrating Lambertian lighting from multiple sources +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------------------- +// Constant Buffer Variables +//-------------------------------------------------------------------------------------- +cbuffer Constants : register( b0 ) +{ + float4x4 mWorld; + float4x4 mView; + float4x4 mProjection; + float4 lightDir[ 2 ]; + float4 lightColor[ 2 ]; + float4 outputColor; +}; + + +//-------------------------------------------------------------------------------------- +struct VS_INPUT +{ + float4 Pos : POSITION; + float3 Normal : NORMAL; +}; + +struct PS_INPUT +{ + float4 Pos : SV_POSITION; + float3 Normal : TEXCOORD0; +}; + + +//-------------------------------------------------------------------------------------- +// Name: TriangleVS +// Desc: Vertex shader +//-------------------------------------------------------------------------------------- +PS_INPUT TriangleVS( VS_INPUT input ) +{ + PS_INPUT output = ( PS_INPUT )0; + output.Pos = mul( input.Pos, mWorld ); + output.Pos = mul( output.Pos, mView ); + output.Pos = mul( output.Pos, mProjection ); + output.Normal = mul( input.Normal, ( ( float3x3 ) mWorld ) ); + + return output; +} + + +//-------------------------------------------------------------------------------------- +// Name: TrianglePS +// Desc: Pixel shader applying Lambertian lighting from two lights +//-------------------------------------------------------------------------------------- +float4 LambertPS( PS_INPUT input ) : SV_Target +{ + float4 finalColor = 0; + + //do NdotL lighting for 2 lights + for( int i=0; i< 2; i++ ) + { + finalColor += saturate( dot( ( float3 ) lightDir[ i ], input.Normal ) * lightColor[ i ] ); + } + finalColor.a = 1; + return finalColor; +} + + +//-------------------------------------------------------------------------------------- +// Name: TriangleSolidColorPS +// Desc: Pixel shader applying solid color +//-------------------------------------------------------------------------------------- +float4 SolidColorPS( PS_INPUT input ) : SV_Target +{ + return outputColor; +} diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.cpp b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4b827d3289e61382a863dbce81738a1c793a92ef --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.cpp @@ -0,0 +1,582 @@ +//-------------------------------------------------------------------------------------- +// SimpleLightingUWP12.cpp +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "SimpleLightingUWP12.h" + +#include "ATGColors.h" +#include "ReadData.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +namespace +{ + struct Vertex + { + XMFLOAT3 pos; + XMFLOAT3 normal; + }; +} + +Sample::Sample() + : m_mappedConstantData(nullptr) + , m_constantDataGpuAddr(0) + , m_curRotationAngleRad(0.0f) +{ + m_deviceResources = std::make_unique(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); + m_deviceResources->RegisterDeviceNotify(this); +} + +// Initialize the Direct3D resources required to run. +void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_gamePad = std::make_unique(); + + m_keyboard = std::make_unique(); + m_keyboard->SetWindow(reinterpret_cast(window)); + + m_deviceResources->SetWindow(window, width, height, rotation); + + m_deviceResources->CreateDeviceResources(); + CreateDeviceDependentResources(); + + m_deviceResources->CreateWindowSizeDependentResources(); + CreateWindowSizeDependentResources(); + m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); + if (!m_fenceEvent.IsValid()) + { + throw std::exception("CreateEvent"); + } +} + +#pragma region Frame Update +// Executes basic render loop. +void Sample::Tick() +{ + m_timer.Tick([&]() + { + Update(m_timer); + }); + + Render(); +} + +// Updates the world. +void Sample::Update(DX::StepTimer const& timer) +{ + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Update"); + + float elapsedTime = float(timer.GetElapsedSeconds()); + + // Update the rotation constant + m_curRotationAngleRad += elapsedTime / 3.f; + if (m_curRotationAngleRad >= XM_2PI) + { + m_curRotationAngleRad -= XM_2PI; + } + + // Rotate the cube around the origin + XMStoreFloat4x4(&m_worldMatrix, XMMatrixRotationY(m_curRotationAngleRad)); + + // Setup our lighting parameters + m_lightDirs[0] = XMFLOAT4(-0.577f, 0.577f, -0.577f, 1.0f); + m_lightDirs[1] = XMFLOAT4(0.0f, 0.0f, -1.0f, 1.0f); + + m_lightColors[0] = XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f); + m_lightColors[1] = XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f); + + // Rotate the second light around the origin + XMMATRIX rotate = XMMatrixRotationY(-2.0f * m_curRotationAngleRad); + XMVECTOR lightDir = XMLoadFloat4(&m_lightDirs[1]); + lightDir = XMVector3Transform(lightDir, rotate); + XMStoreFloat4(&m_lightDirs[1], lightDir); + + // Handle controller input for exit + auto pad = m_gamePad->GetState(0); + if (pad.IsConnected()) + { + m_gamePadButtons.Update(pad); + + if (pad.IsViewPressed()) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + } + else + { + m_gamePadButtons.Reset(); + } + + auto kb = m_keyboard->GetState(); + m_keyboardButtons.Update(kb); + + if (kb.Escape) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + + PIXEndEvent(); +} +#pragma endregion + +#pragma region Frame Render +// Draws the scene. +void Sample::Render() +{ + // Don't try to render anything before the first Update. + if (m_timer.GetFrameCount() == 0) + { + return; + } + + // Check to see if the GPU is keeping up + int frameIdx = m_deviceResources->GetCurrentFrameIndex(); + int numBackBuffers = m_deviceResources->GetBackBufferCount(); + uint64_t completedValue = m_fence->GetCompletedValue(); + if ((frameIdx > completedValue) // if frame index is reset to zero it may temporarily be smaller than the last GPU signal + && (frameIdx - completedValue > numBackBuffers)) + { + // GPU not caught up, wait for at least one available frame + DX::ThrowIfFailed(m_fence->SetEventOnCompletion(frameIdx - numBackBuffers, m_fenceEvent.Get())); + WaitForSingleObjectEx(m_fenceEvent.Get(), INFINITE, FALSE); + } + + // Prepare the command list to render a new frame. + m_deviceResources->Prepare(); + Clear(); + + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Render"); + + // Index into the available constant buffers based on the number + // of draw calls. We've allocated enough for a known number of + // draw calls per frame times the number of back buffers + unsigned int constantBufferIndex = c_numDrawCalls * (frameIdx % numBackBuffers); + + // Set the root signature and pipeline state for the command list + commandList->SetGraphicsRootSignature(m_rootSignature.Get()); + commandList->SetPipelineState(m_lambertPipelineState.Get()); + + // Set the per-frame constants + ConstantBuffer sceneParameters = {}; + + // Shaders compiled with default row-major matrices + sceneParameters.worldMatrix = XMMatrixTranspose(XMLoadFloat4x4(&m_worldMatrix)); + sceneParameters.viewMatrix = XMMatrixTranspose(XMLoadFloat4x4(&m_viewMatrix)); + sceneParameters.projectionMatrix = XMMatrixTranspose(XMLoadFloat4x4(&m_projectionMatrix)); + + sceneParameters.lightDir[0] = XMLoadFloat4(&m_lightDirs[0]); + sceneParameters.lightDir[1] = XMLoadFloat4(&m_lightDirs[1]); + sceneParameters.lightColor[0] = XMLoadFloat4(&m_lightColors[0]); + sceneParameters.lightColor[1] = XMLoadFloat4(&m_lightColors[1]); + sceneParameters.outputColor = XMLoadFloat4(&m_outputColor); + + // Set the constants for the first draw call + memcpy(&m_mappedConstantData[constantBufferIndex].constants, &sceneParameters, sizeof(ConstantBuffer)); + + // Bind the constants to the shader + auto baseGpuAddress = m_constantDataGpuAddr + sizeof(PaddedConstantBuffer) * constantBufferIndex; + commandList->SetGraphicsRootConstantBufferView(c_rootParameterCB, baseGpuAddress); + + // Set up the input assembler + commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView); + commandList->IASetIndexBuffer(&m_indexBufferView); + + // Draw the Lambert lit cube + commandList->DrawIndexedInstanced(36, 1, 0, 0, 0); + baseGpuAddress += sizeof(PaddedConstantBuffer); + ++constantBufferIndex; + + // Render each light + commandList->SetPipelineState(m_solidColorPipelineState.Get()); + + for (int m = 0; m < 2; ++m) + { + XMMATRIX lightMatrix = XMMatrixTranslationFromVector(5.0f * sceneParameters.lightDir[m]); + XMMATRIX lightScaleMatrix = XMMatrixScaling(0.2f, 0.2f, 0.2f); + lightMatrix = lightScaleMatrix * lightMatrix; + + // Update the world variable to reflect the current light + sceneParameters.worldMatrix = XMMatrixTranspose(lightMatrix); + sceneParameters.outputColor = sceneParameters.lightColor[m]; + + // Set the constants for the draw call + memcpy(&m_mappedConstantData[constantBufferIndex].constants, &sceneParameters, sizeof(ConstantBuffer)); + + // Bind the constants to the shader + commandList->SetGraphicsRootConstantBufferView(c_rootParameterCB, baseGpuAddress); + + commandList->DrawIndexedInstanced(36, 1, 0, 0, 0); + baseGpuAddress += sizeof(PaddedConstantBuffer); + ++constantBufferIndex; + } + + PIXEndEvent(commandList); + + // Show the new frame. + PIXBeginEvent(m_deviceResources->GetCommandQueue(), PIX_COLOR_DEFAULT, L"Present"); + m_deviceResources->Present(); + + // GPU will signal an increasing value each frame + m_deviceResources->GetCommandQueue()->Signal(m_fence.Get(), frameIdx); + + PIXEndEvent(m_deviceResources->GetCommandQueue()); +} + +// Helper method to clear the back buffers. +void Sample::Clear() +{ + auto commandList = m_deviceResources->GetCommandList(); + PIXBeginEvent(commandList, PIX_COLOR_DEFAULT, L"Clear"); + + // Clear the views. + auto rtvDescriptor = m_deviceResources->GetRenderTargetView(); + auto dsvDescriptor = m_deviceResources->GetDepthStencilView(); + + commandList->OMSetRenderTargets(1, &rtvDescriptor, FALSE, &dsvDescriptor); + commandList->ClearRenderTargetView(rtvDescriptor, ATG::ColorsLinear::Background, 0, nullptr); + commandList->ClearDepthStencilView(dsvDescriptor, D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr); + + // Set the viewport and scissor rect. + auto viewport = m_deviceResources->GetScreenViewport(); + auto scissorRect = m_deviceResources->GetScissorRect(); + commandList->RSSetViewports(1, &viewport); + commandList->RSSetScissorRects(1, &scissorRect); + + PIXEndEvent(commandList); +} +#pragma endregion + +#pragma region Message Handlers +// Message handlers +void Sample::OnActivated() +{ +} + +void Sample::OnDeactivated() +{ +} + +void Sample::OnSuspending() +{ +} + +void Sample::OnResuming() +{ + m_timer.ResetElapsedTime(); + m_gamePadButtons.Reset(); + m_keyboardButtons.Reset(); +} + +void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + if (!m_deviceResources->WindowSizeChanged(width, height, rotation)) + return; + + CreateWindowSizeDependentResources(); +} + +void Sample::ValidateDevice() +{ + m_deviceResources->ValidateDevice(); +} + +// Properties +void Sample::GetDefaultSize(int& width, int& height) const +{ + width = 1280; + height = 720; +} +#pragma endregion + +#pragma region Direct3D Resources +// These are the resources that depend on the device. +void Sample::CreateDeviceDependentResources() +{ + auto device = m_deviceResources->GetD3DDevice(); + + // Create a root signature with one constant buffer view + { + CD3DX12_ROOT_PARAMETER rp = {}; + rp.InitAsConstantBufferView(c_rootParameterCB, 0); + + CD3DX12_ROOT_SIGNATURE_DESC rootSignatureDesc = {}; + rootSignatureDesc.Init(1, &rp, 0, nullptr, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT + | D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS + | D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS + | D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS); + + ComPtr signature; + ComPtr error; + HRESULT hr = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error); + if (FAILED(hr)) + { + if (error) + { + OutputDebugStringA(reinterpret_cast(error->GetBufferPointer())); + } + throw DX::com_exception(hr); + } + + DX::ThrowIfFailed( + device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(), IID_PPV_ARGS(m_rootSignature.ReleaseAndGetAddressOf()))); + } + + // Create the constant buffer memory and map the CPU and GPU addresses + { + const D3D12_HEAP_PROPERTIES uploadHeapProperties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD); + size_t cbSize = c_numDrawCalls * m_deviceResources->GetBackBufferCount() * sizeof(PaddedConstantBuffer); + + const D3D12_RESOURCE_DESC constantBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(cbSize); + DX::ThrowIfFailed(device->CreateCommittedResource( + &uploadHeapProperties, + D3D12_HEAP_FLAG_NONE, + &constantBufferDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, + IID_PPV_ARGS(m_perFrameConstants.GetAddressOf()))); + DX::ThrowIfFailed(m_perFrameConstants->SetName(L"Per Frame CB")); + + DX::ThrowIfFailed(m_perFrameConstants->Map(0, nullptr, reinterpret_cast< void** >(&m_mappedConstantData))); + + m_constantDataGpuAddr = m_perFrameConstants->GetGPUVirtualAddress(); + } + + // Load the shader blob for the vertex shader that will be shared by two pipeline state objects + { + auto triangleVSBlob = DX::ReadData(L"TriangleVS.cso"); + + // Input element descriptor also shared by two pipeline state objects + static const D3D12_INPUT_ELEMENT_DESC s_inputElementDesc[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + // Create the Pipelline State Object for the Lambert pixel shader + { + auto lambertPSBlob = DX::ReadData(L"LambertPS.cso"); + + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + psoDesc.InputLayout = { s_inputElementDesc, _countof(s_inputElementDesc) }; + psoDesc.pRootSignature = m_rootSignature.Get(); + psoDesc.VS = CD3DX12_SHADER_BYTECODE(triangleVSBlob.data(), triangleVSBlob.size()); + psoDesc.PS = CD3DX12_SHADER_BYTECODE(lambertPSBlob.data(), lambertPSBlob.size()); + psoDesc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT); + psoDesc.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT); + psoDesc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT); + psoDesc.DSVFormat = DXGI_FORMAT_D32_FLOAT; + psoDesc.SampleMask = UINT_MAX; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + psoDesc.NumRenderTargets = 1; + psoDesc.RTVFormats[0] = m_deviceResources->GetBackBufferFormat(); + psoDesc.SampleDesc.Count = 1; + DX::ThrowIfFailed( + device->CreateGraphicsPipelineState(&psoDesc, + IID_PPV_ARGS(m_lambertPipelineState.ReleaseAndGetAddressOf()))); + } + + // Create the Pipeline State Object for the solid color pixel shader + { + auto solidColorPSBlob = DX::ReadData(L"SolidColorPS.cso"); + + D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {}; + psoDesc.InputLayout = { s_inputElementDesc, _countof(s_inputElementDesc) }; + psoDesc.pRootSignature = m_rootSignature.Get(); + psoDesc.VS = CD3DX12_SHADER_BYTECODE(triangleVSBlob.data(), triangleVSBlob.size()); + psoDesc.PS = CD3DX12_SHADER_BYTECODE(solidColorPSBlob.data(), solidColorPSBlob.size()); + psoDesc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT); + psoDesc.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT); + psoDesc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT); + psoDesc.DSVFormat = DXGI_FORMAT_D32_FLOAT; + psoDesc.SampleMask = UINT_MAX; + psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + psoDesc.NumRenderTargets = 1; + psoDesc.RTVFormats[0] = m_deviceResources->GetBackBufferFormat(); + psoDesc.SampleDesc.Count = 1; + DX::ThrowIfFailed( + device->CreateGraphicsPipelineState(&psoDesc, + IID_PPV_ARGS(m_solidColorPipelineState.ReleaseAndGetAddressOf()))); + } + } + + // Create the vertex buffer + { + static const Vertex vertices[] = + { + { XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) }, + { XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) }, + { XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) }, + { XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) }, + + { XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) }, + { XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) }, + { XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) }, + { XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) }, + + { XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) }, + + { XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) }, + + { XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) }, + { XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) }, + { XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) }, + { XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) }, + + { XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) }, + { XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) }, + { XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) }, + { XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) }, + }; + + // Note: using upload heaps to transfer static data like vert buffers is not + // recommended. Every time the GPU needs it, the upload heap will be marshalled + // over. Please read up on Default Heap usage. An upload heap is used here for + // code simplicity and because there are very few verts to actually transfer. + const D3D12_HEAP_PROPERTIES uploadHeapProperties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD); + const CD3DX12_RESOURCE_DESC resourceDesc = CD3DX12_RESOURCE_DESC::Buffer(sizeof(vertices)); + DX::ThrowIfFailed( + device->CreateCommittedResource(&uploadHeapProperties, + D3D12_HEAP_FLAG_NONE, + &resourceDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, + IID_PPV_ARGS(m_vertexBuffer.ReleaseAndGetAddressOf()))); + + // Copy the data to the vertex buffer. + UINT8* pVertexDataBegin; + CD3DX12_RANGE readRange(0, 0); // We do not intend to read from this resource on the CPU. + DX::ThrowIfFailed( + m_vertexBuffer->Map(0, &readRange, reinterpret_cast(&pVertexDataBegin))); + memcpy(pVertexDataBegin, vertices, sizeof(vertices)); + m_vertexBuffer->Unmap(0, nullptr); + + // Initialize the vertex buffer view. + m_vertexBufferView.BufferLocation = m_vertexBuffer->GetGPUVirtualAddress(); + m_vertexBufferView.StrideInBytes = sizeof(Vertex); + m_vertexBufferView.SizeInBytes = sizeof(vertices); + } + + // Create the index buffer + { + static const uint16_t indices[] = + { + 3,1,0, + 2,1,3, + + 6,4,5, + 7,4,6, + + 11,9,8, + 10,9,11, + + 14,12,13, + 15,12,14, + + 19,17,16, + 18,17,19, + + 22,20,21, + 23,20,22 + }; + + // See note above + const D3D12_HEAP_PROPERTIES uploadHeapProperties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD); + const CD3DX12_RESOURCE_DESC resourceDesc = CD3DX12_RESOURCE_DESC::Buffer(sizeof(indices)); + DX::ThrowIfFailed( + device->CreateCommittedResource(&uploadHeapProperties, + D3D12_HEAP_FLAG_NONE, + &resourceDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + nullptr, + IID_PPV_ARGS(m_indexBuffer.ReleaseAndGetAddressOf()))); + + // Copy the data to the index buffer. + UINT8* pVertexDataBegin; + CD3DX12_RANGE readRange(0, 0); // We do not intend to read from this resource on the CPU. + DX::ThrowIfFailed( + m_indexBuffer->Map(0, &readRange, reinterpret_cast(&pVertexDataBegin))); + memcpy(pVertexDataBegin, indices, sizeof(indices)); + m_indexBuffer->Unmap(0, nullptr); + + // Initialize the index buffer view. + m_indexBufferView.BufferLocation = m_indexBuffer->GetGPUVirtualAddress(); + m_indexBufferView.Format = DXGI_FORMAT_R16_UINT; + m_indexBufferView.SizeInBytes = sizeof(indices); + } + + // Wait until assets have been uploaded to the GPU. + m_deviceResources->WaitForGpu(); + + // Create a fence for synchronizing between the CPU and the GPU + DX::ThrowIfFailed(device->CreateFence(m_deviceResources->GetCurrentFrameIndex(), D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.ReleaseAndGetAddressOf()))); + + // Initialize the world matrix + XMStoreFloat4x4(&m_worldMatrix, XMMatrixIdentity()); + + // Initialize the view matrix + static const XMVECTORF32 c_eye = { 0.0f, 4.0f, -10.0f, 0.0f }; + static const XMVECTORF32 c_at = { 0.0f, 1.0f, 0.0f, 0.0f }; + static const XMVECTORF32 c_up = { 0.0f, 1.0f, 0.0f, 0.0 }; + XMStoreFloat4x4(&m_viewMatrix, XMMatrixLookAtLH(c_eye, c_at, c_up)); + + // Initialize the lighting parameters + m_lightDirs[0] = XMFLOAT4(-0.577f, 0.577f, -0.577f, 1.0f); + m_lightDirs[1] = XMFLOAT4(0.0f, 0.0f, -1.0f, 1.0f); + + m_lightColors[0] = XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f); + m_lightColors[1] = XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f); + + // Initialize the scene output color + m_outputColor = XMFLOAT4(0, 0, 0, 0); +} + +// Allocate all memory resources that change on a window SizeChanged event. +void Sample::CreateWindowSizeDependentResources() +{ + // Initialize the projection matrix + auto size = m_deviceResources->GetOutputSize(); + XMMATRIX projection = XMMatrixPerspectiveFovLH(XM_PIDIV4, float(size.right) / float(size.bottom), 0.01f, 100.0f); + + XMFLOAT4X4 orient = m_deviceResources->GetOrientationTransform3D(); + + XMStoreFloat4x4(&m_projectionMatrix, projection * XMLoadFloat4x4(&orient)); + + // The frame index will be reset to zero when the window size changes + // So we need to tell the GPU to signal our fence starting with zero + uint64_t currentIdx = m_deviceResources->GetCurrentFrameIndex(); + m_deviceResources->GetCommandQueue()->Signal(m_fence.Get(), currentIdx); +} + +void Sample::OnDeviceLost() +{ + m_rootSignature.Reset(); + m_lambertPipelineState.Reset(); + m_solidColorPipelineState.Reset(); + m_fence.Reset(); + m_vertexBuffer.Reset(); + m_indexBuffer.Reset(); + m_mappedConstantData = nullptr; + m_constantDataGpuAddr = 0; + m_perFrameConstants.Reset(); +} +void Sample::OnDeviceRestored() +{ + CreateDeviceDependentResources(); + CreateWindowSizeDependentResources(); +} +#pragma endregion diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.h b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.h new file mode 100644 index 0000000000000000000000000000000000000000..cefe410589a0a63fdbd7b0e241d330e92b9f97d4 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.h @@ -0,0 +1,127 @@ +//-------------------------------------------------------------------------------------- +// SimpleLightingUWP12.h +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "DeviceResources.h" +#include "StepTimer.h" + + +// A basic sample implementation that creates a D3D12 device and +// provides a render loop. +class Sample : public DX::IDeviceNotify +{ +public: + + Sample(); + + // Initialization and management + void Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + + // Basic render loop + void Tick(); + void Render(); + + // Rendering helpers + void Clear(); + + // IDeviceNotify + virtual void OnDeviceLost() override; + virtual void OnDeviceRestored() override; + + // Messages + void OnActivated(); + void OnDeactivated(); + void OnSuspending(); + void OnResuming(); + void OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + + // Properties + void GetDefaultSize( int& width, int& height ) const; + +private: + + struct ConstantBuffer + { + DirectX::XMMATRIX worldMatrix; + DirectX::XMMATRIX viewMatrix; + DirectX::XMMATRIX projectionMatrix; + DirectX::XMVECTOR lightDir[2]; + DirectX::XMVECTOR lightColor[2]; + DirectX::XMVECTOR outputColor; + }; + + // We'll allocate space for several of these and they will need to be padded for alignment. + static_assert(sizeof(ConstantBuffer) == 272, "Checking the size here."); + + // D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT < 272 < 2 * D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT + // Create a union with the correct size and enough room for one ConstantBuffer + union PaddedConstantBuffer + { + ConstantBuffer constants; + uint8_t bytes[2 * D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT]; + }; + + // Check the exact size of the PaddedConstantBuffer to make sure it will align properly + static_assert(sizeof(PaddedConstantBuffer) == 2 * D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT, "PaddedConstantBuffer is not aligned properly"); + + void Update(DX::StepTimer const& timer); + + void CreateDeviceDependentResources(); + void CreateWindowSizeDependentResources(); + + // Device resources. + std::unique_ptr m_deviceResources; + + // Rendering loop timer. + DX::StepTimer m_timer; + + // Input devices. + std::unique_ptr m_gamePad; + std::unique_ptr m_keyboard; + + DirectX::GamePad::ButtonStateTracker m_gamePadButtons; + DirectX::Keyboard::KeyboardStateTracker m_keyboardButtons; + + // DirectXTK objects. + Microsoft::WRL::ComPtr m_rootSignature; + Microsoft::WRL::ComPtr m_lambertPipelineState; + Microsoft::WRL::ComPtr m_solidColorPipelineState; + Microsoft::WRL::ComPtr m_vertexBuffer; + Microsoft::WRL::ComPtr m_indexBuffer; + Microsoft::WRL::ComPtr m_perFrameConstants; + PaddedConstantBuffer* m_mappedConstantData; + D3D12_GPU_VIRTUAL_ADDRESS m_constantDataGpuAddr; + D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView; + D3D12_INDEX_BUFFER_VIEW m_indexBufferView; + + // In this simple sample, we know that there are three draw calls + // and we will update the scene constants for each draw call. + static const unsigned int c_numDrawCalls = 3; + + // A synchronization fence and an event. These members will be used + // to synchronize the CPU with the GPU so that there will be no + // contention for the constant buffers. + Microsoft::WRL::ComPtr m_fence; + Microsoft::WRL::Wrappers::Event m_fenceEvent; + + // Index in the root parameter table + static const UINT c_rootParameterCB = 0; + + // Scene constants, updated per-frame + float m_curRotationAngleRad; + + // These computed values will be loaded into a ConstantBuffer + // during Render + DirectX::XMFLOAT4X4 m_worldMatrix; + DirectX::XMFLOAT4X4 m_viewMatrix; + DirectX::XMFLOAT4X4 m_projectionMatrix; + DirectX::XMFLOAT4 m_lightDirs[2]; + DirectX::XMFLOAT4 m_lightColors[2]; + DirectX::XMFLOAT4 m_outputColor; +}; \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.sln b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.sln new file mode 100644 index 0000000000000000000000000000000000000000..5b7fee85304fe5e9cfc763da93a2a50be5a7fcdd --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleLightingUWP12", "SimpleLightingUWP12.vcxproj", "{2D643F62-B746-49A0-903B-ED6C826A9F52}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK12", "..\..\..\Kits\DirectXTK12\DirectXTK_Windows10.vcxproj", "{945B8F0E-AE5F-447C-933A-9D069532D3E4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|ARM.ActiveCfg = Debug|ARM + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|ARM.Build.0 = Debug|ARM + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|ARM.Deploy.0 = Debug|ARM + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|x64.ActiveCfg = Debug|x64 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|x64.Build.0 = Debug|x64 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|x64.Deploy.0 = Debug|x64 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|x86.ActiveCfg = Debug|Win32 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|x86.Build.0 = Debug|Win32 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Debug|x86.Deploy.0 = Debug|Win32 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|ARM.ActiveCfg = Release|ARM + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|ARM.Build.0 = Release|ARM + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|ARM.Deploy.0 = Release|ARM + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|x64.ActiveCfg = Release|x64 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|x64.Build.0 = Release|x64 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|x64.Deploy.0 = Release|x64 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|x86.ActiveCfg = Release|Win32 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|x86.Build.0 = Release|Win32 + {2D643F62-B746-49A0-903B-ED6C826A9F52}.Release|x86.Deploy.0 = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.ActiveCfg = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.Build.0 = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.ActiveCfg = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.Build.0 = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.ActiveCfg = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.Build.0 = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.ActiveCfg = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.Build.0 = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.ActiveCfg = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.Build.0 = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.ActiveCfg = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.vcxproj b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..aad25d60c729ceb69e4cd569b53008ae366a8d8b --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.vcxproj @@ -0,0 +1,306 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {2d643f62-b746-49a0-903b-ed6c826a9f52} + DirectXApp + SimpleLightingUWP12 + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + true + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + SimpleLightingUWP12_TemporaryKey.pfx + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + d2d1.lib; d3d12.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 5.1 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + Designer + + + + + + + + + + + + + + + {945b8f0e-ae5f-447c-933a-9d069532d3e4} + + + + + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + LambertPS + LambertPS + LambertPS + LambertPS + LambertPS + LambertPS + + + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + SolidColorPS + SolidColorPS + SolidColorPS + SolidColorPS + SolidColorPS + SolidColorPS + + + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + TriangleVS + TriangleVS + TriangleVS + TriangleVS + TriangleVS + TriangleVS + + + + + + + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.vcxproj.filters b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..9959ab750d6425194306c5c04896c3c25fcf441e --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12.vcxproj.filters @@ -0,0 +1,83 @@ + + + + + 1fda9b28-2a50-4995-acfc-8bccdb53230d + + + d66fe45c-ff66-4e9d-8e30-28244a830931 + bmp;dds;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + {aa473492-121f-4e4e-ad9a-65846906512b} + + + {efe88b02-f065-480d-97c4-5c17f574d168} + + + + + + + Common + + + Common + + + Common + + + ATG Tool Kit + + + ATG Tool Kit + + + + + + + + Common + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + shaders + + + + + + shaders + + + shaders + + + shaders + + + \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12_TemporaryKey.pfx b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..ae581c65e146d2bbd122ee9673534f539bc03bea Binary files /dev/null and b/Samples/IntroGraphics/SimpleLightingUWP12/SimpleLightingUWP12_TemporaryKey.pfx differ diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/SolidColorPS.hlsl b/Samples/IntroGraphics/SimpleLightingUWP12/SolidColorPS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..9bfe2b51036d01b7ba65abd0042ecd226d3ebb2f --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/SolidColorPS.hlsl @@ -0,0 +1,2 @@ +// SolidColorPS.hlsl file to provide an MSBuild target for the SolidColorPS pixel-shader entry point +#include "SimpleLighting.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/StepTimer.h b/Samples/IntroGraphics/SimpleLightingUWP12/StepTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f7acf56417f3184f8c17beecfbb1aaa124cdaf --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/StepTimer.h @@ -0,0 +1,188 @@ +// +// StepTimer.h - A simple timer that provides elapsed time information +// + +#pragma once + +#include +#include + +namespace DX +{ + // Helper class for animation and simulation timing. + class StepTimer + { + public: + StepTimer() : + m_elapsedTicks(0), + m_totalTicks(0), + m_leftOverTicks(0), + m_frameCount(0), + m_framesPerSecond(0), + m_framesThisSecond(0), + m_qpcSecondCounter(0), + m_isFixedTimeStep(false), + m_targetElapsedTicks(TicksPerSecond / 60) + { + if (!QueryPerformanceFrequency(&m_qpcFrequency)) + { + throw std::exception( "QueryPerformanceFrequency" ); + } + + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + // Initialize max delta to 1/10 of a second. + m_qpcMaxDelta = m_qpcFrequency.QuadPart / 10; + } + + // Get elapsed time since the previous Update call. + uint64_t GetElapsedTicks() const { return m_elapsedTicks; } + double GetElapsedSeconds() const { return TicksToSeconds(m_elapsedTicks); } + + // Get total time since the start of the program. + uint64_t GetTotalTicks() const { return m_totalTicks; } + double GetTotalSeconds() const { return TicksToSeconds(m_totalTicks); } + + // Get total number of updates since start of the program. + uint32_t GetFrameCount() const { return m_frameCount; } + + // Get the current framerate. + uint32_t GetFramesPerSecond() const { return m_framesPerSecond; } + + // Set whether to use fixed or variable timestep mode. + void SetFixedTimeStep(bool isFixedTimestep) { m_isFixedTimeStep = isFixedTimestep; } + + // Set how often to call Update when in fixed timestep mode. + void SetTargetElapsedTicks(uint64_t targetElapsed) { m_targetElapsedTicks = targetElapsed; } + void SetTargetElapsedSeconds(double targetElapsed) { m_targetElapsedTicks = SecondsToTicks(targetElapsed); } + + // Integer format represents time using 10,000,000 ticks per second. + static const uint64_t TicksPerSecond = 10000000; + + static double TicksToSeconds(uint64_t ticks) { return static_cast(ticks) / TicksPerSecond; } + static uint64_t SecondsToTicks(double seconds) { return static_cast(seconds * TicksPerSecond); } + + // After an intentional timing discontinuity (for instance a blocking IO operation) + // call this to avoid having the fixed timestep logic attempt a set of catch-up + // Update calls. + + void ResetElapsedTime() + { + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception("QueryPerformanceCounter"); + } + + m_leftOverTicks = 0; + m_framesPerSecond = 0; + m_framesThisSecond = 0; + m_qpcSecondCounter = 0; + } + + // Update timer state, calling the specified Update function the appropriate number of times. + template + void Tick(const TUpdate& update) + { + // Query the current time. + LARGE_INTEGER currentTime; + + if (!QueryPerformanceCounter(¤tTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + uint64_t timeDelta = currentTime.QuadPart - m_qpcLastTime.QuadPart; + + m_qpcLastTime = currentTime; + m_qpcSecondCounter += timeDelta; + + // Clamp excessively large time deltas (e.g. after paused in the debugger). + if (timeDelta > m_qpcMaxDelta) + { + timeDelta = m_qpcMaxDelta; + } + + // Convert QPC units into a canonical tick format. This cannot overflow due to the previous clamp. + timeDelta *= TicksPerSecond; + timeDelta /= m_qpcFrequency.QuadPart; + + uint32_t lastFrameCount = m_frameCount; + + if (m_isFixedTimeStep) + { + // Fixed timestep update logic + + // If the app is running very close to the target elapsed time (within 1/4 of a millisecond) just clamp + // the clock to exactly match the target value. This prevents tiny and irrelevant errors + // from accumulating over time. Without this clamping, a game that requested a 60 fps + // fixed update, running with vsync enabled on a 59.94 NTSC display, would eventually + // accumulate enough tiny errors that it would drop a frame. It is better to just round + // small deviations down to zero to leave things running smoothly. + + if (abs(static_cast(timeDelta - m_targetElapsedTicks)) < TicksPerSecond / 4000) + { + timeDelta = m_targetElapsedTicks; + } + + m_leftOverTicks += timeDelta; + + while (m_leftOverTicks >= m_targetElapsedTicks) + { + m_elapsedTicks = m_targetElapsedTicks; + m_totalTicks += m_targetElapsedTicks; + m_leftOverTicks -= m_targetElapsedTicks; + m_frameCount++; + + update(); + } + } + else + { + // Variable timestep update logic. + m_elapsedTicks = timeDelta; + m_totalTicks += timeDelta; + m_leftOverTicks = 0; + m_frameCount++; + + update(); + } + + // Track the current framerate. + if (m_frameCount != lastFrameCount) + { + m_framesThisSecond++; + } + + if (m_qpcSecondCounter >= static_cast(m_qpcFrequency.QuadPart)) + { + m_framesPerSecond = m_framesThisSecond; + m_framesThisSecond = 0; + m_qpcSecondCounter %= m_qpcFrequency.QuadPart; + } + } + + private: + // Source timing data uses QPC units. + LARGE_INTEGER m_qpcFrequency; + LARGE_INTEGER m_qpcLastTime; + uint64_t m_qpcMaxDelta; + + // Derived timing data uses a canonical tick format. + uint64_t m_elapsedTicks; + uint64_t m_totalTicks; + uint64_t m_leftOverTicks; + + // Members for tracking the framerate. + uint32_t m_frameCount; + uint32_t m_framesPerSecond; + uint32_t m_framesThisSecond; + uint64_t m_qpcSecondCounter; + + // Members for configuring fixed timestep mode. + bool m_isFixedTimeStep; + uint64_t m_targetElapsedTicks; + }; +} diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/TriangleVS.hlsl b/Samples/IntroGraphics/SimpleLightingUWP12/TriangleVS.hlsl new file mode 100644 index 0000000000000000000000000000000000000000..1d13961b278ca338cbcd70386d614e2f2c11866e --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/TriangleVS.hlsl @@ -0,0 +1,2 @@ +// TriangleVS.hlsl file to provide an MSBuild target for the TriangleVS vertex-shader entry point +#include "SimpleLighting.hlsli" \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/d3dx12.h b/Samples/IntroGraphics/SimpleLightingUWP12/d3dx12.h new file mode 100644 index 0000000000000000000000000000000000000000..351914d38a47281f2e9ee95e1f4aff0f039cf7b2 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/d3dx12.h @@ -0,0 +1,1534 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#ifndef __D3DX12_H__ +#define __D3DX12_H__ + +#include "d3d12.h" + +#if defined( __cplusplus ) + +struct CD3DX12_DEFAULT {}; +extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT; + +//------------------------------------------------------------------------------------------------ +inline bool operator==( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ + return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && + l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; +} + +//------------------------------------------------------------------------------------------------ +inline bool operator!=( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RECT : public D3D12_RECT +{ + CD3DX12_RECT() + {} + explicit CD3DX12_RECT( const D3D12_RECT& o ) : + D3D12_RECT( o ) + {} + explicit CD3DX12_RECT( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + right = Right; + bottom = Bottom; + } + ~CD3DX12_RECT() {} + operator const D3D12_RECT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BOX : public D3D12_BOX +{ + CD3DX12_BOX() + {} + explicit CD3DX12_BOX( const D3D12_BOX& o ) : + D3D12_BOX( o ) + {} + explicit CD3DX12_BOX( + LONG Left, + LONG Right ) + { + left = Left; + top = 0; + front = 0; + right = Right; + bottom = 1; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + front = 0; + right = Right; + bottom = Bottom; + back = 1; + } + explicit CD3DX12_BOX( + LONG Left, + LONG Top, + LONG Front, + LONG Right, + LONG Bottom, + LONG Back ) + { + left = Left; + top = Top; + front = Front; + right = Right; + bottom = Bottom; + back = Back; + } + ~CD3DX12_BOX() {} + operator const D3D12_BOX&() const { return *this; } +}; +inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r ) +{ + return l.left == r.left && l.top == r.top && l.front == r.front && + l.right == r.right && l.bottom == r.bottom && l.back == r.back; +} +inline bool operator!=( const D3D12_BOX& l, const D3D12_BOX& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC +{ + CD3DX12_DEPTH_STENCIL_DESC() + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( const D3D12_DEPTH_STENCIL_DESC& o ) : + D3D12_DEPTH_STENCIL_DESC( o ) + {} + explicit CD3DX12_DEPTH_STENCIL_DESC( CD3DX12_DEFAULT ) + { + DepthEnable = TRUE; + DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; + DepthFunc = D3D12_COMPARISON_FUNC_LESS; + StencilEnable = FALSE; + StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK; + StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK; + const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = + { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS }; + FrontFace = defaultStencilOp; + BackFace = defaultStencilOp; + } + explicit CD3DX12_DEPTH_STENCIL_DESC( + BOOL depthEnable, + D3D12_DEPTH_WRITE_MASK depthWriteMask, + D3D12_COMPARISON_FUNC depthFunc, + BOOL stencilEnable, + UINT8 stencilReadMask, + UINT8 stencilWriteMask, + D3D12_STENCIL_OP frontStencilFailOp, + D3D12_STENCIL_OP frontStencilDepthFailOp, + D3D12_STENCIL_OP frontStencilPassOp, + D3D12_COMPARISON_FUNC frontStencilFunc, + D3D12_STENCIL_OP backStencilFailOp, + D3D12_STENCIL_OP backStencilDepthFailOp, + D3D12_STENCIL_OP backStencilPassOp, + D3D12_COMPARISON_FUNC backStencilFunc ) + { + DepthEnable = depthEnable; + DepthWriteMask = depthWriteMask; + DepthFunc = depthFunc; + StencilEnable = stencilEnable; + StencilReadMask = stencilReadMask; + StencilWriteMask = stencilWriteMask; + FrontFace.StencilFailOp = frontStencilFailOp; + FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; + FrontFace.StencilPassOp = frontStencilPassOp; + FrontFace.StencilFunc = frontStencilFunc; + BackFace.StencilFailOp = backStencilFailOp; + BackFace.StencilDepthFailOp = backStencilDepthFailOp; + BackFace.StencilPassOp = backStencilPassOp; + BackFace.StencilFunc = backStencilFunc; + } + ~CD3DX12_DEPTH_STENCIL_DESC() {} + operator const D3D12_DEPTH_STENCIL_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC +{ + CD3DX12_BLEND_DESC() + {} + explicit CD3DX12_BLEND_DESC( const D3D12_BLEND_DESC& o ) : + D3D12_BLEND_DESC( o ) + {} + explicit CD3DX12_BLEND_DESC( CD3DX12_DEFAULT ) + { + AlphaToCoverageEnable = FALSE; + IndependentBlendEnable = FALSE; + const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + FALSE,FALSE, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + RenderTarget[ i ] = defaultRenderTargetBlendDesc; + } + ~CD3DX12_BLEND_DESC() {} + operator const D3D12_BLEND_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC +{ + CD3DX12_RASTERIZER_DESC() + {} + explicit CD3DX12_RASTERIZER_DESC( const D3D12_RASTERIZER_DESC& o ) : + D3D12_RASTERIZER_DESC( o ) + {} + explicit CD3DX12_RASTERIZER_DESC( CD3DX12_DEFAULT ) + { + FillMode = D3D12_FILL_MODE_SOLID; + CullMode = D3D12_CULL_MODE_BACK; + FrontCounterClockwise = FALSE; + DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + DepthClipEnable = TRUE; + MultisampleEnable = FALSE; + AntialiasedLineEnable = FALSE; + ForcedSampleCount = 0; + ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + } + explicit CD3DX12_RASTERIZER_DESC( + D3D12_FILL_MODE fillMode, + D3D12_CULL_MODE cullMode, + BOOL frontCounterClockwise, + INT depthBias, + FLOAT depthBiasClamp, + FLOAT slopeScaledDepthBias, + BOOL depthClipEnable, + BOOL multisampleEnable, + BOOL antialiasedLineEnable, + UINT forcedSampleCount, + D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) + { + FillMode = fillMode; + CullMode = cullMode; + FrontCounterClockwise = frontCounterClockwise; + DepthBias = depthBias; + DepthBiasClamp = depthBiasClamp; + SlopeScaledDepthBias = slopeScaledDepthBias; + DepthClipEnable = depthClipEnable; + MultisampleEnable = multisampleEnable; + AntialiasedLineEnable = antialiasedLineEnable; + ForcedSampleCount = forcedSampleCount; + ConservativeRaster = conservativeRaster; + } + ~CD3DX12_RASTERIZER_DESC() {} + operator const D3D12_RASTERIZER_DESC&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO +{ + CD3DX12_RESOURCE_ALLOCATION_INFO() + {} + explicit CD3DX12_RESOURCE_ALLOCATION_INFO( const D3D12_RESOURCE_ALLOCATION_INFO& o ) : + D3D12_RESOURCE_ALLOCATION_INFO( o ) + {} + CD3DX12_RESOURCE_ALLOCATION_INFO( + UINT64 size, + UINT64 alignment ) + { + SizeInBytes = size; + Alignment = alignment; + } + operator const D3D12_RESOURCE_ALLOCATION_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES +{ + CD3DX12_HEAP_PROPERTIES() + {} + explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES &o) : + D3D12_HEAP_PROPERTIES(o) + {} + CD3DX12_HEAP_PROPERTIES( + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = D3D12_HEAP_TYPE_CUSTOM; + CPUPageProperty = cpuPageProperty; + MemoryPoolPreference = memoryPoolPreference; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + explicit CD3DX12_HEAP_PROPERTIES( + D3D12_HEAP_TYPE type, + UINT creationNodeMask = 1, + UINT nodeMask = 1 ) + { + Type = type; + CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + CreationNodeMask = creationNodeMask; + VisibleNodeMask = nodeMask; + } + operator const D3D12_HEAP_PROPERTIES&() const { return *this; } + bool IsCPUAccessible() const + { + return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK || (Type == D3D12_HEAP_TYPE_CUSTOM && + (CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE || CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK)); + } +}; +inline bool operator==( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ + return l.Type == r.Type && l.CPUPageProperty == r.CPUPageProperty && + l.MemoryPoolPreference == r.MemoryPoolPreference && + l.CreationNodeMask == r.CreationNodeMask && + l.VisibleNodeMask == r.VisibleNodeMask; +} +inline bool operator!=( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC +{ + CD3DX12_HEAP_DESC() + {} + explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC &o) : + D3D12_HEAP_DESC(o) + {} + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_PROPERTIES properties, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = properties; + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_HEAP_TYPE type, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + UINT64 size, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + UINT64 alignment = 0, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = size; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_PROPERTIES properties, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = properties; + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_HEAP_TYPE type, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( type ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + CD3DX12_HEAP_DESC( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_CPU_PAGE_PROPERTY cpuPageProperty, + D3D12_MEMORY_POOL memoryPoolPreference, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE ) + { + SizeInBytes = resAllocInfo.SizeInBytes; + Properties = CD3DX12_HEAP_PROPERTIES( cpuPageProperty, memoryPoolPreference ); + Alignment = resAllocInfo.Alignment; + Flags = flags; + } + operator const D3D12_HEAP_DESC&() const { return *this; } + bool IsCPUAccessible() const + { return static_cast< const CD3DX12_HEAP_PROPERTIES* >( &Properties )->IsCPUAccessible(); } +}; +inline bool operator==( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ + return l.SizeInBytes == r.SizeInBytes && + l.Properties == r.Properties && + l.Alignment == r.Alignment && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE +{ + CD3DX12_CLEAR_VALUE() + {} + explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE &o) : + D3D12_CLEAR_VALUE(o) + {} + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + const FLOAT color[4] ) + { + Format = format; + memcpy( Color, color, sizeof( Color ) ); + } + CD3DX12_CLEAR_VALUE( + DXGI_FORMAT format, + FLOAT depth, + UINT8 stencil ) + { + Format = format; + /* Use memcpy to preserve NAN values */ + memcpy( &DepthStencil.Depth, &depth, sizeof( depth ) ); + DepthStencil.Stencil = stencil; + } + operator const D3D12_CLEAR_VALUE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RANGE : public D3D12_RANGE +{ + CD3DX12_RANGE() + {} + explicit CD3DX12_RANGE(const D3D12_RANGE &o) : + D3D12_RANGE(o) + {} + CD3DX12_RANGE( + SIZE_T begin, + SIZE_T end ) + { + Begin = begin; + End = end; + } + operator const D3D12_RANGE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE +{ + CD3DX12_SHADER_BYTECODE() + {} + explicit CD3DX12_SHADER_BYTECODE(const D3D12_SHADER_BYTECODE &o) : + D3D12_SHADER_BYTECODE(o) + {} + CD3DX12_SHADER_BYTECODE( + ID3DBlob* pShaderBlob ) + { + pShaderBytecode = pShaderBlob->GetBufferPointer(); + BytecodeLength = pShaderBlob->GetBufferSize(); + } + CD3DX12_SHADER_BYTECODE( + void* _pShaderBytecode, + SIZE_T bytecodeLength ) + { + pShaderBytecode = _pShaderBytecode; + BytecodeLength = bytecodeLength; + } + operator const D3D12_SHADER_BYTECODE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE +{ + CD3DX12_TILED_RESOURCE_COORDINATE() + {} + explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE &o) : + D3D12_TILED_RESOURCE_COORDINATE(o) + {} + CD3DX12_TILED_RESOURCE_COORDINATE( + UINT x, + UINT y, + UINT z, + UINT subresource ) + { + X = x; + Y = y; + Z = z; + Subresource = subresource; + } + operator const D3D12_TILED_RESOURCE_COORDINATE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE +{ + CD3DX12_TILE_REGION_SIZE() + {} + explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE &o) : + D3D12_TILE_REGION_SIZE(o) + {} + CD3DX12_TILE_REGION_SIZE( + UINT numTiles, + BOOL useBox, + UINT width, + UINT16 height, + UINT16 depth ) + { + NumTiles = numTiles; + UseBox = useBox; + Width = width; + Height = height; + Depth = depth; + } + operator const D3D12_TILE_REGION_SIZE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING +{ + CD3DX12_SUBRESOURCE_TILING() + {} + explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING &o) : + D3D12_SUBRESOURCE_TILING(o) + {} + CD3DX12_SUBRESOURCE_TILING( + UINT widthInTiles, + UINT16 heightInTiles, + UINT16 depthInTiles, + UINT startTileIndexInOverallResource ) + { + WidthInTiles = widthInTiles; + HeightInTiles = heightInTiles; + DepthInTiles = depthInTiles; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_SUBRESOURCE_TILING&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE +{ + CD3DX12_TILE_SHAPE() + {} + explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE &o) : + D3D12_TILE_SHAPE(o) + {} + CD3DX12_TILE_SHAPE( + UINT widthInTexels, + UINT heightInTexels, + UINT depthInTexels ) + { + WidthInTexels = widthInTexels; + HeightInTexels = heightInTexels; + DepthInTexels = depthInTexels; + } + operator const D3D12_TILE_SHAPE&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER +{ + CD3DX12_RESOURCE_BARRIER() + {} + explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) : + D3D12_RESOURCE_BARRIER(o) + {} + static inline CD3DX12_RESOURCE_BARRIER Transition( + _In_ ID3D12Resource* pResource, + D3D12_RESOURCE_STATES stateBefore, + D3D12_RESOURCE_STATES stateAfter, + UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + result.Flags = flags; + barrier.Transition.pResource = pResource; + barrier.Transition.StateBefore = stateBefore; + barrier.Transition.StateAfter = stateAfter; + barrier.Transition.Subresource = subresource; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER Aliasing( + _In_ ID3D12Resource* pResourceBefore, + _In_ ID3D12Resource* pResourceAfter) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING; + barrier.Aliasing.pResourceBefore = pResourceBefore; + barrier.Aliasing.pResourceAfter = pResourceAfter; + return result; + } + static inline CD3DX12_RESOURCE_BARRIER UAV( + _In_ ID3D12Resource* pResource) + { + CD3DX12_RESOURCE_BARRIER result; + ZeroMemory(&result, sizeof(result)); + D3D12_RESOURCE_BARRIER &barrier = result; + result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.UAV.pResource = pResource; + return result; + } + operator const D3D12_RESOURCE_BARRIER&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO +{ + CD3DX12_PACKED_MIP_INFO() + {} + explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO &o) : + D3D12_PACKED_MIP_INFO(o) + {} + CD3DX12_PACKED_MIP_INFO( + UINT8 numStandardMips, + UINT8 numPackedMips, + UINT numTilesForPackedMips, + UINT startTileIndexInOverallResource ) + { + NumStandardMips = numStandardMips; + NumPackedMips = numPackedMips; + NumTilesForPackedMips = numTilesForPackedMips; + StartTileIndexInOverallResource = startTileIndexInOverallResource; + } + operator const D3D12_PACKED_MIP_INFO&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT +{ + CD3DX12_SUBRESOURCE_FOOTPRINT() + {} + explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT &o) : + D3D12_SUBRESOURCE_FOOTPRINT(o) + {} + CD3DX12_SUBRESOURCE_FOOTPRINT( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT rowPitch ) + { + Format = format; + Width = width; + Height = height; + Depth = depth; + RowPitch = rowPitch; + } + explicit CD3DX12_SUBRESOURCE_FOOTPRINT( + const D3D12_RESOURCE_DESC& resDesc, + UINT rowPitch ) + { + Format = resDesc.Format; + Width = UINT( resDesc.Width ); + Height = resDesc.Height; + Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1); + RowPitch = rowPitch; + } + operator const D3D12_SUBRESOURCE_FOOTPRINT&() const { return *this; } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION +{ + CD3DX12_TEXTURE_COPY_LOCATION() + {} + explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION &o) : + D3D12_TEXTURE_COPY_LOCATION(o) + {} + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes) { pResource = pRes; } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, D3D12_PLACED_SUBRESOURCE_FOOTPRINT const& Footprint) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + PlacedFootprint = Footprint; + } + CD3DX12_TEXTURE_COPY_LOCATION(ID3D12Resource* pRes, UINT Sub) + { + pResource = pRes; + Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + SubresourceIndex = Sub; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE +{ + CD3DX12_DESCRIPTOR_RANGE() { } + explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) : + D3D12_DESCRIPTOR_RANGE(o) + {} + CD3DX12_DESCRIPTOR_RANGE( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + inline void Init( + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + Init(*this, rangeType, numDescriptors, baseShaderRegister, registerSpace, offsetInDescriptorsFromTableStart); + } + + static inline void Init( + _Out_ D3D12_DESCRIPTOR_RANGE &range, + D3D12_DESCRIPTOR_RANGE_TYPE rangeType, + UINT numDescriptors, + UINT baseShaderRegister, + UINT registerSpace = 0, + UINT offsetInDescriptorsFromTableStart = + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) + { + range.RangeType = rangeType; + range.NumDescriptors = numDescriptors; + range.BaseShaderRegister = baseShaderRegister; + range.RegisterSpace = registerSpace; + range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE +{ + CD3DX12_ROOT_DESCRIPTOR_TABLE() {} + explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) : + D3D12_ROOT_DESCRIPTOR_TABLE(o) + {} + CD3DX12_ROOT_DESCRIPTOR_TABLE( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(numDescriptorRanges, _pDescriptorRanges); + } + + inline void Init( + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + Init(*this, numDescriptorRanges, _pDescriptorRanges); + } + + static inline void Init( + _Out_ D3D12_ROOT_DESCRIPTOR_TABLE &rootDescriptorTable, + UINT numDescriptorRanges, + _In_reads_opt_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* _pDescriptorRanges) + { + rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges; + rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS +{ + CD3DX12_ROOT_CONSTANTS() {} + explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) : + D3D12_ROOT_CONSTANTS(o) + {} + CD3DX12_ROOT_CONSTANTS( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(num32BitValues, shaderRegister, registerSpace); + } + + inline void Init( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, num32BitValues, shaderRegister, registerSpace); + } + + static inline void Init( + _Out_ D3D12_ROOT_CONSTANTS &rootConstants, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0) + { + rootConstants.Num32BitValues = num32BitValues; + rootConstants.ShaderRegister = shaderRegister; + rootConstants.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR +{ + CD3DX12_ROOT_DESCRIPTOR() {} + explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) : + D3D12_ROOT_DESCRIPTOR(o) + {} + CD3DX12_ROOT_DESCRIPTOR( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(shaderRegister, registerSpace); + } + + inline void Init( + UINT shaderRegister, + UINT registerSpace = 0) + { + Init(*this, shaderRegister, registerSpace); + } + + static inline void Init(_Out_ D3D12_ROOT_DESCRIPTOR &table, UINT shaderRegister, UINT registerSpace = 0) + { + table.ShaderRegister = shaderRegister; + table.RegisterSpace = registerSpace; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER +{ + CD3DX12_ROOT_PARAMETER() {} + explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) : + D3D12_ROOT_PARAMETER(o) + {} + + static inline void InitAsDescriptorTable( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR_TABLE::Init(rootParam.DescriptorTable, numDescriptorRanges, pDescriptorRanges); + } + + static inline void InitAsConstants( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_CONSTANTS::Init(rootParam.Constants, num32BitValues, shaderRegister, registerSpace); + } + + static inline void InitAsConstantBufferView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsShaderResourceView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + static inline void InitAsUnorderedAccessView( + _Out_ D3D12_ROOT_PARAMETER &rootParam, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + rootParam.ShaderVisibility = visibility; + CD3DX12_ROOT_DESCRIPTOR::Init(rootParam.Descriptor, shaderRegister, registerSpace); + } + + inline void InitAsDescriptorTable( + UINT numDescriptorRanges, + _In_reads_(numDescriptorRanges) const D3D12_DESCRIPTOR_RANGE* pDescriptorRanges, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsDescriptorTable(*this, numDescriptorRanges, pDescriptorRanges, visibility); + } + + inline void InitAsConstants( + UINT num32BitValues, + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstants(*this, num32BitValues, shaderRegister, registerSpace, visibility); + } + + inline void InitAsConstantBufferView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsConstantBufferView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsShaderResourceView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsShaderResourceView(*this, shaderRegister, registerSpace, visibility); + } + + inline void InitAsUnorderedAccessView( + UINT shaderRegister, + UINT registerSpace = 0, + D3D12_SHADER_VISIBILITY visibility = D3D12_SHADER_VISIBILITY_ALL) + { + InitAsUnorderedAccessView(*this, shaderRegister, registerSpace, visibility); + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC +{ + CD3DX12_STATIC_SAMPLER_DESC() {} + explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) : + D3D12_STATIC_SAMPLER_DESC(o) + {} + CD3DX12_STATIC_SAMPLER_DESC( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + + static inline void Init( + _Out_ D3D12_STATIC_SAMPLER_DESC &samplerDesc, + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + samplerDesc.ShaderRegister = shaderRegister; + samplerDesc.Filter = filter; + samplerDesc.AddressU = addressU; + samplerDesc.AddressV = addressV; + samplerDesc.AddressW = addressW; + samplerDesc.MipLODBias = mipLODBias; + samplerDesc.MaxAnisotropy = maxAnisotropy; + samplerDesc.ComparisonFunc = comparisonFunc; + samplerDesc.BorderColor = borderColor; + samplerDesc.MinLOD = minLOD; + samplerDesc.MaxLOD = maxLOD; + samplerDesc.ShaderVisibility = shaderVisibility; + samplerDesc.RegisterSpace = registerSpace; + } + inline void Init( + UINT shaderRegister, + D3D12_FILTER filter = D3D12_FILTER_ANISOTROPIC, + D3D12_TEXTURE_ADDRESS_MODE addressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + D3D12_TEXTURE_ADDRESS_MODE addressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP, + FLOAT mipLODBias = 0, + UINT maxAnisotropy = 16, + D3D12_COMPARISON_FUNC comparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL, + D3D12_STATIC_BORDER_COLOR borderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE, + FLOAT minLOD = 0.f, + FLOAT maxLOD = D3D12_FLOAT32_MAX, + D3D12_SHADER_VISIBILITY shaderVisibility = D3D12_SHADER_VISIBILITY_ALL, + UINT registerSpace = 0) + { + Init( + *this, + shaderRegister, + filter, + addressU, + addressV, + addressW, + mipLODBias, + maxAnisotropy, + comparisonFunc, + borderColor, + minLOD, + maxLOD, + shaderVisibility, + registerSpace); + } + +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC +{ + CD3DX12_ROOT_SIGNATURE_DESC() {} + explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) : + D3D12_ROOT_SIGNATURE_DESC(o) + {} + CD3DX12_ROOT_SIGNATURE_DESC( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + CD3DX12_ROOT_SIGNATURE_DESC(CD3DX12_DEFAULT) + { + Init(0, NULL, 0, NULL, D3D12_ROOT_SIGNATURE_FLAG_NONE); + } + + inline void Init( + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + Init(*this, numParameters, _pParameters, numStaticSamplers, _pStaticSamplers, flags); + } + + static inline void Init( + _Out_ D3D12_ROOT_SIGNATURE_DESC &desc, + UINT numParameters, + _In_reads_opt_(numParameters) const D3D12_ROOT_PARAMETER* _pParameters, + UINT numStaticSamplers = 0, + _In_reads_opt_(numStaticSamplers) const D3D12_STATIC_SAMPLER_DESC* _pStaticSamplers = NULL, + D3D12_ROOT_SIGNATURE_FLAGS flags = D3D12_ROOT_SIGNATURE_FLAG_NONE) + { + desc.NumParameters = numParameters; + desc.pParameters = _pParameters; + desc.NumStaticSamplers = numStaticSamplers; + desc.pStaticSamplers = _pStaticSamplers; + desc.Flags = flags; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE +{ + CD3DX12_CPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) : + D3D12_CPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_CPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + bool operator==(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + bool operator!=(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_CPU_DESCRIPTOR_HANDLE &operator=(const D3D12_CPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE +{ + CD3DX12_GPU_DESCRIPTOR_HANDLE() {} + explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) : + D3D12_GPU_DESCRIPTOR_HANDLE(o) + {} + CD3DX12_GPU_DESCRIPTOR_HANDLE(CD3DX12_DEFAULT) { ptr = 0; } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetScaledByIncrementSize) + { + InitOffsetted(other, offsetScaledByIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &other, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(other, offsetInDescriptors, descriptorIncrementSize); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) + { + ptr += offsetInDescriptors * descriptorIncrementSize; + return *this; + } + CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) + { + ptr += offsetScaledByIncrementSize; + return *this; + } + inline bool operator==(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr == other.ptr); + } + inline bool operator!=(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE& other) + { + return (ptr != other.ptr); + } + CD3DX12_GPU_DESCRIPTOR_HANDLE &operator=(const D3D12_GPU_DESCRIPTOR_HANDLE &other) + { + ptr = other.ptr; + return *this; + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + InitOffsetted(*this, base, offsetScaledByIncrementSize); + } + + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + InitOffsetted(*this, base, offsetInDescriptors, descriptorIncrementSize); + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) + { + handle.ptr = base.ptr + offsetScaledByIncrementSize; + } + + static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) + { + handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + } +}; + +//------------------------------------------------------------------------------------------------ +inline UINT D3D12CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT PlaneSlice, UINT MipLevels, UINT ArraySize ) +{ + return MipSlice + ArraySlice * MipLevels + PlaneSlice * MipLevels * ArraySize; +} + +//------------------------------------------------------------------------------------------------ +template +inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice ) +{ + MipSlice = static_cast(Subresource % MipLevels); + ArraySlice = static_cast((Subresource / MipLevels) % ArraySize); + PlaneSlice = static_cast(Subresource / (MipLevels * ArraySize)); +} + +//------------------------------------------------------------------------------------------------ +inline UINT8 D3D12GetFormatPlaneCount( + _In_ ID3D12Device* pDevice, + DXGI_FORMAT Format + ) +{ + D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format}; + if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo)))) + { + return 0; + } + return formatInfo.PlaneCount; +} + +//------------------------------------------------------------------------------------------------ +struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC +{ + CD3DX12_RESOURCE_DESC() + {} + explicit CD3DX12_RESOURCE_DESC( const D3D12_RESOURCE_DESC& o ) : + D3D12_RESOURCE_DESC( o ) + {} + CD3DX12_RESOURCE_DESC( + D3D12_RESOURCE_DIMENSION dimension, + UINT64 alignment, + UINT64 width, + UINT height, + UINT16 depthOrArraySize, + UINT16 mipLevels, + DXGI_FORMAT format, + UINT sampleCount, + UINT sampleQuality, + D3D12_TEXTURE_LAYOUT layout, + D3D12_RESOURCE_FLAGS flags ) + { + Dimension = dimension; + Alignment = alignment; + Width = width; + Height = height; + DepthOrArraySize = depthOrArraySize; + MipLevels = mipLevels; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Layout = layout; + Flags = flags; + } + static inline CD3DX12_RESOURCE_DESC Buffer( + const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, + 1, 1, 1, DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Buffer( + UINT64 width, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, + DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex1D( + DXGI_FORMAT format, + UINT64 width, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, + mipLevels, format, 1, 0, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex2D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 arraySize = 1, + UINT16 mipLevels = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, + mipLevels, format, sampleCount, sampleQuality, layout, flags ); + } + static inline CD3DX12_RESOURCE_DESC Tex3D( + DXGI_FORMAT format, + UINT64 width, + UINT height, + UINT16 depth, + UINT16 mipLevels = 0, + D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, + UINT64 alignment = 0 ) + { + return CD3DX12_RESOURCE_DESC( D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, + mipLevels, format, 1, 0, layout, flags ); + } + inline UINT16 Depth() const + { return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT16 ArraySize() const + { return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1); } + inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const + { return D3D12GetFormatPlaneCount(pDevice, Format); } + inline UINT Subresources(_In_ ID3D12Device* pDevice) const + { return MipLevels * ArraySize() * PlaneCount(pDevice); } + inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) + { return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); } + operator const D3D12_RESOURCE_DESC&() const { return *this; } +}; +inline bool operator==( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ + return l.Dimension == r.Dimension && + l.Alignment == r.Alignment && + l.Width == r.Width && + l.Height == r.Height && + l.DepthOrArraySize == r.DepthOrArraySize && + l.MipLevels == r.MipLevels && + l.Format == r.Format && + l.SampleDesc.Count == r.SampleDesc.Count && + l.SampleDesc.Quality == r.SampleDesc.Quality && + l.Layout == r.Layout && + l.Flags == r.Flags; +} +inline bool operator!=( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) +{ return !( l == r ); } + +//------------------------------------------------------------------------------------------------ +// Row-by-row memcpy +inline void MemcpySubresource( + _In_ const D3D12_MEMCPY_DEST* pDest, + _In_ const D3D12_SUBRESOURCE_DATA* pSrc, + SIZE_T RowSizeInBytes, + UINT NumRows, + UINT NumSlices) +{ + for (UINT z = 0; z < NumSlices; ++z) + { + BYTE* pDestSlice = reinterpret_cast(pDest->pData) + pDest->SlicePitch * z; + const BYTE* pSrcSlice = reinterpret_cast(pSrc->pData) + pSrc->SlicePitch * z; + for (UINT y = 0; y < NumRows; ++y) + { + memcpy(pDestSlice + pDest->RowPitch * y, + pSrcSlice + pSrc->RowPitch * y, + RowSizeInBytes); + } + } +} + +//------------------------------------------------------------------------------------------------ +// Returns required size of a buffer to be used for data upload +inline UINT64 GetRequiredIntermediateSize( + _In_ ID3D12Resource* pDestinationResource, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources) +{ + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + UINT64 RequiredSize = 0; + + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize); + pDevice->Release(); + + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// All arrays must be populated (e.g. by calling GetCopyableFootprints) +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 RequiredSize, + _In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts, + _In_reads_(NumSubresources) const UINT* pNumRows, + _In_reads_(NumSubresources) const UINT64* pRowSizesInBytes, + _In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) +{ + // Minor validation + D3D12_RESOURCE_DESC IntermediateDesc = pIntermediate->GetDesc(); + D3D12_RESOURCE_DESC DestinationDesc = pDestinationResource->GetDesc(); + if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER || + IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset || + RequiredSize > (SIZE_T)-1 || + (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER && + (FirstSubresource != 0 || NumSubresources != 1))) + { + return 0; + } + + BYTE* pData; + HRESULT hr = pIntermediate->Map(0, NULL, reinterpret_cast(&pData)); + if (FAILED(hr)) + { + return 0; + } + + for (UINT i = 0; i < NumSubresources; ++i) + { + if (pRowSizesInBytes[i] > (SIZE_T)-1) return 0; + D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, pLayouts[i].Footprint.RowPitch * pNumRows[i] }; + MemcpySubresource(&DestData, &pSrcData[i], (SIZE_T)pRowSizesInBytes[i], pNumRows[i], pLayouts[i].Footprint.Depth); + } + pIntermediate->Unmap(0, NULL); + + if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + CD3DX12_BOX SrcBox( UINT( pLayouts[0].Offset ), UINT( pLayouts[0].Offset + pLayouts[0].Footprint.Width ) ); + pCmdList->CopyBufferRegion( + pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width); + } + else + { + for (UINT i = 0; i < NumSubresources; ++i) + { + CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource); + CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]); + pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr); + } + } + return RequiredSize; +} + +//------------------------------------------------------------------------------------------------ +// Heap-allocating UpdateSubresources implementation +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + UINT64 MemToAlloc = static_cast(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources; + if (MemToAlloc > SIZE_MAX) + { + return 0; + } + void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast(MemToAlloc)); + if (pMem == NULL) + { + return 0; + } + D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts = reinterpret_cast(pMem); + UINT64* pRowSizesInBytes = reinterpret_cast(pLayouts + NumSubresources); + UINT* pNumRows = reinterpret_cast(pRowSizesInBytes + NumSubresources); + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize); + pDevice->Release(); + + UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData); + HeapFree(GetProcessHeap(), 0, pMem); + return Result; +} + +//------------------------------------------------------------------------------------------------ +// Stack-allocating UpdateSubresources implementation +template +inline UINT64 UpdateSubresources( + _In_ ID3D12GraphicsCommandList* pCmdList, + _In_ ID3D12Resource* pDestinationResource, + _In_ ID3D12Resource* pIntermediate, + UINT64 IntermediateOffset, + _In_range_(0, MaxSubresources) UINT FirstSubresource, + _In_range_(1, MaxSubresources - FirstSubresource) UINT NumSubresources, + _In_reads_(NumSubresources) D3D12_SUBRESOURCE_DATA* pSrcData) +{ + UINT64 RequiredSize = 0; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources]; + UINT NumRows[MaxSubresources]; + UINT64 RowSizesInBytes[MaxSubresources]; + + D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc(); + ID3D12Device* pDevice; + pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast(&pDevice)); + pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize); + pDevice->Release(); + + return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData); +} + +//------------------------------------------------------------------------------------------------ +inline bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout ) +{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; } + +//------------------------------------------------------------------------------------------------ +inline ID3D12CommandList * const * CommandListCast(ID3D12GraphicsCommandList * const * pp) +{ + // This cast is useful for passing strongly typed command list pointers into + // ExecuteCommandLists. + // This cast is valid as long as the const-ness is respected. D3D12 APIs do + // respect the const-ness of their arguments. + return reinterpret_cast(pp); +} + + +#endif // defined( __cplusplus ) + +#endif //__D3DX12_H__ + + + diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/pch.cpp b/Samples/IntroGraphics/SimpleLightingUWP12/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..851c81be9b30ae3e8175fb950b95a1c9508580a3 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/pch.cpp @@ -0,0 +1,10 @@ +//-------------------------------------------------------------------------------------- +// pch.cpp +// +// Include the standard header and generate the precompiled header. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" diff --git a/Samples/IntroGraphics/SimpleLightingUWP12/pch.h b/Samples/IntroGraphics/SimpleLightingUWP12/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..81c31dde0587a7710bc809e17b34ebed1345dbe2 --- /dev/null +++ b/Samples/IntroGraphics/SimpleLightingUWP12/pch.h @@ -0,0 +1,68 @@ +//-------------------------------------------------------------------------------------- +// pch.h +// +// Header for standard system include files. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +// Use the C++ standard templated min/max +#define NOMINMAX + +#include + +#include +#include +#include +#include + +#include "d3dx12.h" + +#include +#include +#include +#include + +#include +#include + +#ifdef _DEBUG +#include +#endif + +#include "GamePad.h" +#include "GraphicsMemory.h" +#include "Keyboard.h" +#include "Mouse.h" + +namespace DX +{ + // Helper class for COM exceptions + class com_exception : public std::exception + { + public: + com_exception(HRESULT hr) : result(hr) {} + + virtual const char* what() const override + { + static char s_str[64] = { 0 }; + sprintf_s(s_str, "Failure with HRESULT of %08X", result); + return s_str; + } + + private: + HRESULT result; + }; + + // Helper utility converts D3D API failures into exceptions. + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + throw com_exception(hr); + } + } +} \ No newline at end of file diff --git a/Samples/IntroGraphics/SimpleTextureUWP/SimpleTextureUWP.vcxproj b/Samples/IntroGraphics/SimpleTextureUWP/SimpleTextureUWP.vcxproj index 92a15bee4b70caaf25c058c2d0d4e568d74736fa..11af48d280cc258be007b5550e5cbede9d4d44d6 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP/SimpleTextureUWP.vcxproj +++ b/Samples/IntroGraphics/SimpleTextureUWP/SimpleTextureUWP.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/IntroGraphics/SimpleTextureUWP12/DeviceResources.cpp b/Samples/IntroGraphics/SimpleTextureUWP12/DeviceResources.cpp index c710962509ae1802e432fa4684554abd37fe160b..a7415aba2e798e929420df40b7eb12d7b5b85205 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP12/DeviceResources.cpp +++ b/Samples/IntroGraphics/SimpleTextureUWP12/DeviceResources.cpp @@ -217,6 +217,10 @@ void DX::DeviceResources::CreateDeviceResources() m_fenceValues[m_backBufferIndex]++; m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); + if (!m_fenceEvent.IsValid()) + { + throw std::exception("CreateEvent"); + } } // These resources need to be recreated every time the window size is changed. diff --git a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.cpp b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.cpp index b49e7b38fbdcd2b25844731c706e1cfcb6658e15..c671cf1a70a1238ed5ed20779ee51f1b41277417 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.cpp +++ b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.cpp @@ -170,6 +170,7 @@ void Sample::Render() // Show the new frame. PIXBeginEvent(m_deviceResources->GetCommandQueue(), PIX_COLOR_DEFAULT, L"Present"); m_deviceResources->Present(); + m_graphicsMemory->Commit(m_deviceResources->GetCommandQueue()); PIXEndEvent(m_deviceResources->GetCommandQueue()); } @@ -246,6 +247,8 @@ void Sample::CreateDeviceDependentResources() { auto device = m_deviceResources->GetD3DDevice(); + m_graphicsMemory = std::make_unique(device); + // Create descriptor heaps. { // Describe and create a shader resource view (SRV) heap for the texture. @@ -475,6 +478,7 @@ void Sample::OnDeviceLost() m_pipelineState.Reset(); m_rootSignature.Reset(); m_srvHeap.Reset(); + m_graphicsMemory.reset(); } void Sample::OnDeviceRestored() diff --git a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.h b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.h index 455960ca804a179f7a3b579d814a78389129d5ca..0ab74e4f079a3babb5b5f3528c6979b6a4e7fd91 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.h +++ b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.h @@ -61,6 +61,9 @@ private: std::unique_ptr m_gamePad; std::unique_ptr m_keyboard; + // DirectXTK objects. + std::unique_ptr m_graphicsMemory; + // Direct3D 12 objects Microsoft::WRL::ComPtr m_srvHeap; Microsoft::WRL::ComPtr m_rootSignature; diff --git a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.sln b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.sln index 22134bb63b8c010e2e639a42b7a80324efddd4a1..c8308168cdf427c4e5b344f2761dec8f3e65297a 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.sln +++ b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.sln @@ -1,11 +1,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleTextureUWP12", "SimpleTextureUWP12.vcxproj", "{3F23A13A-F9BF-4A86-B0FA-F5F0A93CB452}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK", "..\..\..\Kits\DirectXTK\DirectXTK_Windows10.vcxproj", "{F4776924-619C-42C7-88B2-82C947CCC9E7}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK12", "..\..\..\Kits\DirectXTK12\DirectXTK_Windows10.vcxproj", "{945B8F0E-AE5F-447C-933A-9D069532D3E4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -35,18 +35,18 @@ Global {3F23A13A-F9BF-4A86-B0FA-F5F0A93CB452}.Release|x86.ActiveCfg = Release|Win32 {3F23A13A-F9BF-4A86-B0FA-F5F0A93CB452}.Release|x86.Build.0 = Release|Win32 {3F23A13A-F9BF-4A86-B0FA-F5F0A93CB452}.Release|x86.Deploy.0 = Release|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.ActiveCfg = Debug|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.Build.0 = Debug|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.ActiveCfg = Debug|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.Build.0 = Debug|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.ActiveCfg = Debug|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.Build.0 = Debug|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.ActiveCfg = Release|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.Build.0 = Release|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.ActiveCfg = Release|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.Build.0 = Release|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.ActiveCfg = Release|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.Build.0 = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.ActiveCfg = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.Build.0 = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.ActiveCfg = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.Build.0 = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.ActiveCfg = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.Build.0 = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.ActiveCfg = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.Build.0 = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.ActiveCfg = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.Build.0 = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.ActiveCfg = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.vcxproj b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.vcxproj index c4dcdd4493e13b555dfaafbef7408ff8708355d0..e8a098dc59c12bcdceab87c40db46e0cb4eba52d 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.vcxproj +++ b/Samples/IntroGraphics/SimpleTextureUWP12/SimpleTextureUWP12.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true @@ -109,7 +108,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 _DEBUG;%(PreprocessorDefinitions) @@ -127,7 +126,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 NDEBUG;%(PreprocessorDefinitions) @@ -145,7 +144,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 _DEBUG;%(PreprocessorDefinitions) @@ -164,7 +163,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 NDEBUG;%(PreprocessorDefinitions) @@ -183,7 +182,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 _DEBUG;%(PreprocessorDefinitions) @@ -201,7 +200,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 NDEBUG;%(PreprocessorDefinitions) @@ -248,11 +247,6 @@ - - - {f4776924-619c-42c7-88b2-82c947ccc9e7} - - Pixel @@ -271,6 +265,11 @@ Vertex + + + {945b8f0e-ae5f-447c-933a-9d069532d3e4} + + diff --git a/Samples/IntroGraphics/SimpleTextureUWP12/pch.h b/Samples/IntroGraphics/SimpleTextureUWP12/pch.h index 887dcf72a664a1657c6499c3c6b965a5cda02324..d4a6714603f33439432584329bca19f4dbbe1e6d 100644 --- a/Samples/IntroGraphics/SimpleTextureUWP12/pch.h +++ b/Samples/IntroGraphics/SimpleTextureUWP12/pch.h @@ -36,6 +36,7 @@ #endif #include "GamePad.h" +#include "GraphicsMemory.h" #include "Keyboard.h" #include "Mouse.h" diff --git a/Samples/IntroGraphics/SimpleTriangleUWP/SimpleTriangleUWP.vcxproj b/Samples/IntroGraphics/SimpleTriangleUWP/SimpleTriangleUWP.vcxproj index c627a194bbbe5fb15ae707c6b5953445f3508c0a..910d7427fe43a2b18815eb2fd32245d04c19b1f1 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP/SimpleTriangleUWP.vcxproj +++ b/Samples/IntroGraphics/SimpleTriangleUWP/SimpleTriangleUWP.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/IntroGraphics/SimpleTriangleUWP12/DeviceResources.cpp b/Samples/IntroGraphics/SimpleTriangleUWP12/DeviceResources.cpp index c710962509ae1802e432fa4684554abd37fe160b..a7415aba2e798e929420df40b7eb12d7b5b85205 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP12/DeviceResources.cpp +++ b/Samples/IntroGraphics/SimpleTriangleUWP12/DeviceResources.cpp @@ -217,6 +217,10 @@ void DX::DeviceResources::CreateDeviceResources() m_fenceValues[m_backBufferIndex]++; m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); + if (!m_fenceEvent.IsValid()) + { + throw std::exception("CreateEvent"); + } } // These resources need to be recreated every time the window size is changed. diff --git a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.cpp b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.cpp index 42f77470367130c9aca10e05b57b79f908fcc977..9a2a7cbf7731404b8c00633a354e779c4841bcfc 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.cpp +++ b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.cpp @@ -124,6 +124,7 @@ void Sample::Render() // Show the new frame. PIXBeginEvent(m_deviceResources->GetCommandQueue(), PIX_COLOR_DEFAULT, L"Present"); m_deviceResources->Present(); + m_graphicsMemory->Commit(m_deviceResources->GetCommandQueue()); PIXEndEvent(m_deviceResources->GetCommandQueue()); } @@ -200,6 +201,8 @@ void Sample::CreateDeviceDependentResources() { auto device = m_deviceResources->GetD3DDevice(); + m_graphicsMemory = std::make_unique(device); + // Create an empty root signature. { CD3DX12_ROOT_SIGNATURE_DESC rootSignatureDesc; @@ -293,6 +296,7 @@ void Sample::OnDeviceLost() m_vertexBuffer.Reset(); m_pipelineState.Reset(); m_rootSignature.Reset(); + m_graphicsMemory.reset(); } void Sample::OnDeviceRestored() diff --git a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.h b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.h index d9a27ea3538a41aef5db539671f7e51c6eb71799..186848f79083bd01d37799d01ac3aff06509cc25 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.h +++ b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.h @@ -62,6 +62,9 @@ private: std::unique_ptr m_keyboard; std::unique_ptr m_mouse; + // DirectXTK objects. + std::unique_ptr m_graphicsMemory; + // Direct3D 12 objects Microsoft::WRL::ComPtr m_rootSignature; Microsoft::WRL::ComPtr m_pipelineState; diff --git a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.sln b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.sln index 8d8a47942d3cf5846d3ff9eff25a40df24cd3503..84f6dd32466dc74d52821d3523a096ffa895bad6 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.sln +++ b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.sln @@ -1,11 +1,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleTriangleUWP12", "SimpleTriangleUWP12.vcxproj", "{930ECC6F-E823-4989-9FAE-524452C6BF66}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK", "..\..\..\Kits\DirectXTK\DirectXTK_Windows10.vcxproj", "{F4776924-619C-42C7-88B2-82C947CCC9E7}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK12", "..\..\..\Kits\DirectXTK12\DirectXTK_Windows10.vcxproj", "{945B8F0E-AE5F-447C-933A-9D069532D3E4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -35,18 +35,18 @@ Global {930ECC6F-E823-4989-9FAE-524452C6BF66}.Release|x86.ActiveCfg = Release|Win32 {930ECC6F-E823-4989-9FAE-524452C6BF66}.Release|x86.Build.0 = Release|Win32 {930ECC6F-E823-4989-9FAE-524452C6BF66}.Release|x86.Deploy.0 = Release|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.ActiveCfg = Debug|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.Build.0 = Debug|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.ActiveCfg = Debug|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.Build.0 = Debug|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.ActiveCfg = Debug|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.Build.0 = Debug|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.ActiveCfg = Release|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.Build.0 = Release|ARM - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.ActiveCfg = Release|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.Build.0 = Release|x64 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.ActiveCfg = Release|Win32 - {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.Build.0 = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.ActiveCfg = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|ARM.Build.0 = Debug|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.ActiveCfg = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x64.Build.0 = Debug|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.ActiveCfg = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Debug|x86.Build.0 = Debug|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.ActiveCfg = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|ARM.Build.0 = Release|ARM + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.ActiveCfg = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x64.Build.0 = Release|x64 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.ActiveCfg = Release|Win32 + {945B8F0E-AE5F-447C-933A-9D069532D3E4}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.vcxproj b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.vcxproj index 9972274501398afb7ff180711f5f23830f4320ed..d300ce1967a6b5f05519766596d349c9263a659e 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.vcxproj +++ b/Samples/IntroGraphics/SimpleTriangleUWP12/SimpleTriangleUWP12.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true @@ -109,7 +108,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 _DEBUG;%(PreprocessorDefinitions) @@ -127,7 +126,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 NDEBUG;%(PreprocessorDefinitions) @@ -145,7 +144,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 _DEBUG;%(PreprocessorDefinitions) @@ -164,7 +163,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 NDEBUG;%(PreprocessorDefinitions) @@ -183,7 +182,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 _DEBUG;%(PreprocessorDefinitions) @@ -201,7 +200,7 @@ pch.h $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + $(ProjectDir);$(IntermediateOutputPath);..\..\..\Kits\DirectXTK12\Inc;..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Level4 NDEBUG;%(PreprocessorDefinitions) @@ -247,11 +246,6 @@ - - - {f4776924-619c-42c7-88b2-82c947ccc9e7} - - true @@ -282,6 +276,11 @@ Vertex + + + {945b8f0e-ae5f-447c-933a-9d069532d3e4} + + diff --git a/Samples/IntroGraphics/SimpleTriangleUWP12/pch.h b/Samples/IntroGraphics/SimpleTriangleUWP12/pch.h index d01c411a9d54c2d770f731d2c16309a4e5f6d86f..686d28e622ea5978c14cb848ab5306a5b5edf56f 100644 --- a/Samples/IntroGraphics/SimpleTriangleUWP12/pch.h +++ b/Samples/IntroGraphics/SimpleTriangleUWP12/pch.h @@ -36,6 +36,7 @@ #endif #include "GamePad.h" +#include "GraphicsMemory.h" #include "Keyboard.h" #include "Mouse.h" diff --git a/Samples/System/CPUSets/CPUSets.vcxproj b/Samples/System/CPUSets/CPUSets.vcxproj index cf2d899084548e5225b78a3c4799ff9a9f0c64a2..c3c67399a20733498b0127579935961dcf9f2e6c 100644 --- a/Samples/System/CPUSets/CPUSets.vcxproj +++ b/Samples/System/CPUSets/CPUSets.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/CollisionUWP/Collision.vcxproj b/Samples/System/CollisionUWP/Collision.vcxproj index 5105ccc05476c4acf2b715b2c860e45fa3c163d9..e2d74cdddde60db0db28b6ec1f226fdb02ea4461 100644 --- a/Samples/System/CollisionUWP/Collision.vcxproj +++ b/Samples/System/CollisionUWP/Collision.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/ExtendedExecutionUWP/Common/Assets/Logo.png b/Samples/System/ExtendedExecutionUWP/Common/Assets/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7e704a106b99487be0f1eded426e6c5a2c65a9 Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/Common/Assets/Logo.png differ diff --git a/Samples/System/ExtendedExecutionUWP/Common/Assets/SmallLogo.png b/Samples/System/ExtendedExecutionUWP/Common/Assets/SmallLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..98b09d91991638282fc2426bbfd4a517733ff15a Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/Common/Assets/SmallLogo.png differ diff --git a/Samples/System/ExtendedExecutionUWP/Common/Assets/SplashScreen.png b/Samples/System/ExtendedExecutionUWP/Common/Assets/SplashScreen.png new file mode 100644 index 0000000000000000000000000000000000000000..c352b156fd090a57aec7da81b3b19a3fb5888b43 Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/Common/Assets/SplashScreen.png differ diff --git a/Samples/System/ExtendedExecutionUWP/Common/Assets/StoreLogo.png b/Samples/System/ExtendedExecutionUWP/Common/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..315472e10b9d380e509b2f041ea9ace5f994f5d2 Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/Common/Assets/StoreLogo.png differ diff --git a/Samples/System/ExtendedExecutionUWP/Common/Assets/WideLogo.png b/Samples/System/ExtendedExecutionUWP/Common/Assets/WideLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..c70f68e2c59214e0ff54844ccd8ae5e955826e10 Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/Common/Assets/WideLogo.png differ diff --git a/Samples/System/ExtendedExecutionUWP/Common/DeviceResources.cpp b/Samples/System/ExtendedExecutionUWP/Common/DeviceResources.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba23c3af40f17d50564addcc12fe1337f018fa22 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/Common/DeviceResources.cpp @@ -0,0 +1,593 @@ +// +// DeviceResources.cpp - A wrapper for the Direct3D 11 device and swapchain +// (requires DirectX 11.3 Runtime) +// + + +#include "pch.h" +#include "DeviceResources.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +namespace +{ +#if defined(_DEBUG) + // Check for SDK Layer support. + inline bool SdkLayersAvailable() + { + HRESULT hr = D3D11CreateDevice( + nullptr, + D3D_DRIVER_TYPE_NULL, // There is no need to create a real hardware device. + 0, + D3D11_CREATE_DEVICE_DEBUG, // Check for the SDK layers. + nullptr, // Any feature level will do. + 0, + D3D11_SDK_VERSION, + nullptr, // No need to keep the D3D device reference. + nullptr, // No need to know the feature level. + nullptr // No need to keep the D3D device context reference. + ); + + return SUCCEEDED(hr); + } +#endif + + inline DXGI_FORMAT NoSRGB(DXGI_FORMAT fmt) + { + switch (fmt) + { + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return DXGI_FORMAT_B8G8R8X8_UNORM; + default: return fmt; + } + } +}; + +// Constants used to calculate screen rotations +namespace ScreenRotation +{ + // 0-degree Z-rotation + static const XMFLOAT4X4 Rotation0( + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 90-degree Z-rotation + static const XMFLOAT4X4 Rotation90( + 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 180-degree Z-rotation + static const XMFLOAT4X4 Rotation180( + -1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); + + // 270-degree Z-rotation + static const XMFLOAT4X4 Rotation270( + 0.0f, -1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + ); +}; + +// Constructor for DeviceResources. +DX::DeviceResources::DeviceResources(DXGI_FORMAT backBufferFormat, DXGI_FORMAT depthBufferFormat, UINT backBufferCount, D3D_FEATURE_LEVEL minFeatureLevel) : + m_screenViewport{}, + m_backBufferFormat(backBufferFormat), + m_depthBufferFormat(depthBufferFormat), + m_backBufferCount(backBufferCount), + m_d3dMinFeatureLevel(minFeatureLevel), + m_window(nullptr), + m_d3dFeatureLevel(D3D_FEATURE_LEVEL_9_1), + m_rotation(DXGI_MODE_ROTATION_IDENTITY), + m_outputSize{0, 0, 1, 1}, + m_orientationTransform3D(ScreenRotation::Rotation0), + m_deviceNotify(nullptr) +{ +} + +// Configures the Direct3D device, and stores handles to it and the device context. +void DX::DeviceResources::CreateDeviceResources() +{ + UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; + +#if defined(_DEBUG) + if (SdkLayersAvailable()) + { + // If the project is in a debug build, enable debugging via SDK Layers with this flag. + creationFlags |= D3D11_CREATE_DEVICE_DEBUG; + } + else + { + OutputDebugStringA("WARNING: Direct3D Debug Device is not available\n"); + } +#endif + + // Determine DirectX hardware feature levels this app will support. + static const D3D_FEATURE_LEVEL s_featureLevels[] = + { + D3D_FEATURE_LEVEL_12_1, + D3D_FEATURE_LEVEL_12_0, + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + D3D_FEATURE_LEVEL_9_3, + D3D_FEATURE_LEVEL_9_2, + D3D_FEATURE_LEVEL_9_1, + }; + + UINT featLevelCount = 0; + for (; featLevelCount < _countof(s_featureLevels); ++featLevelCount) + { + if (s_featureLevels[featLevelCount] < m_d3dMinFeatureLevel) + break; + } + + if (!featLevelCount) + { + throw std::out_of_range("minFeatureLevel too high"); + } + + ComPtr adapter; + GetHardwareAdapter(adapter.GetAddressOf()); + + // Create the Direct3D 11 API device object and a corresponding context. + ComPtr device; + ComPtr context; + + HRESULT hr = E_FAIL; + if (adapter) + { + hr = D3D11CreateDevice( + adapter.Get(), + D3D_DRIVER_TYPE_UNKNOWN, + 0, + creationFlags, // Set debug and Direct2D compatibility flags. + s_featureLevels, + featLevelCount, + D3D11_SDK_VERSION, + device.GetAddressOf(), // Returns the Direct3D device created. + &m_d3dFeatureLevel, // Returns feature level of device created. + context.GetAddressOf() // Returns the device immediate context. + ); + } +#if defined(NDEBUG) + else + { + throw std::exception("No Direct3D hardware device found"); + } +#else + if (FAILED(hr)) + { + // If the initialization fails, fall back to the WARP device. + // For more information on WARP, see: + // http://go.microsoft.com/fwlink/?LinkId=286690 + hr = D3D11CreateDevice( + nullptr, + D3D_DRIVER_TYPE_WARP, // Create a WARP device instead of a hardware device. + 0, + creationFlags, + s_featureLevels, + featLevelCount, + D3D11_SDK_VERSION, + device.GetAddressOf(), + &m_d3dFeatureLevel, + context.GetAddressOf() + ); + + if (SUCCEEDED(hr)) + { + OutputDebugStringA("Direct3D Adapter - WARP\n"); + } + } +#endif + + DX::ThrowIfFailed(hr); + +#ifndef NDEBUG + ComPtr d3dDebug; + if (SUCCEEDED(device.As(&d3dDebug))) + { + ComPtr d3dInfoQueue; + if (SUCCEEDED(d3dDebug.As(&d3dInfoQueue))) + { +#ifdef _DEBUG + d3dInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true); + d3dInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true); +#endif + D3D11_MESSAGE_ID hide[] = + { + D3D11_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS, + }; + D3D11_INFO_QUEUE_FILTER filter; + memset(&filter, 0, sizeof(filter)); + filter.DenyList.NumIDs = _countof(hide); + filter.DenyList.pIDList = hide; + d3dInfoQueue->AddStorageFilterEntries(&filter); + } + } +#endif + + DX::ThrowIfFailed(device.As(&m_d3dDevice)); + DX::ThrowIfFailed(context.As(&m_d3dContext)); +} + +// These resources need to be recreated every time the window size is changed. +void DX::DeviceResources::CreateWindowSizeDependentResources() +{ + if (!m_window) + { + throw std::exception("Call SetWindow with a valid CoreWindow pointer"); + } + + // Clear the previous window size specific context. + ID3D11RenderTargetView* nullViews[] = {nullptr}; + m_d3dContext->OMSetRenderTargets(_countof(nullViews), nullViews, nullptr); + m_d3dRenderTargetView.Reset(); + m_d3dDepthStencilView.Reset(); + m_d3dContext->Flush(); + + // Determine the render target size in pixels. + UINT backBufferWidth = std::max(m_outputSize.right - m_outputSize.left, 1); + UINT backBufferHeight = std::max(m_outputSize.bottom - m_outputSize.top, 1); + DXGI_FORMAT backBufferFormat = NoSRGB(m_backBufferFormat); + + if (m_swapChain) + { + // If the swap chain already exists, resize it. + HRESULT hr = m_swapChain->ResizeBuffers( + m_backBufferCount, + backBufferWidth, + backBufferHeight, + backBufferFormat, + 0 + ); + + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on ResizeBuffers: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + // If the device was removed for any reason, a new device and swap chain will need to be created. + HandleDeviceLost(); + + // Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method + // and correctly set up the new device. + return; + } + else + { + DX::ThrowIfFailed(hr); + } + } + else + { + // Otherwise, create a new one using the same adapter as the existing Direct3D device. + + // This sequence obtains the DXGI factory that was used to create the Direct3D device above. + ComPtr dxgiDevice; + DX::ThrowIfFailed(m_d3dDevice.As(&dxgiDevice)); + + ComPtr dxgiAdapter; + DX::ThrowIfFailed(dxgiDevice->GetAdapter(dxgiAdapter.GetAddressOf())); + + ComPtr dxgiFactory; + DX::ThrowIfFailed(dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.GetAddressOf()))); + + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {}; + swapChainDesc.Width = backBufferWidth; + swapChainDesc.Height = backBufferHeight; + swapChainDesc.Format = backBufferFormat; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = m_backBufferCount; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE; + + ComPtr swapChain; + DX::ThrowIfFailed(dxgiFactory->CreateSwapChainForCoreWindow( + m_d3dDevice.Get(), + m_window, + &swapChainDesc, + nullptr, + swapChain.GetAddressOf() + )); + + DX::ThrowIfFailed(swapChain.As(&m_swapChain)); + + // Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and + // ensures that the application will only render after each VSync, minimizing power consumption. + DX::ThrowIfFailed(dxgiDevice->SetMaximumFrameLatency(1)); + } + + // Set the proper orientation for the swap chain, and generate + // matrix transformations for rendering to the rotated swap chain. + switch (m_rotation) + { + default: + case DXGI_MODE_ROTATION_IDENTITY: + m_orientationTransform3D = ScreenRotation::Rotation0; + break; + + case DXGI_MODE_ROTATION_ROTATE90: + m_orientationTransform3D = ScreenRotation::Rotation270; + break; + + case DXGI_MODE_ROTATION_ROTATE180: + m_orientationTransform3D = ScreenRotation::Rotation180; + break; + + case DXGI_MODE_ROTATION_ROTATE270: + m_orientationTransform3D = ScreenRotation::Rotation90; + break; + } + + DX::ThrowIfFailed(m_swapChain->SetRotation(m_rotation)); + + // Create a render target view of the swap chain back buffer. + ComPtr backBuffer; + DX::ThrowIfFailed(m_swapChain->GetBuffer(0, IID_PPV_ARGS(backBuffer.GetAddressOf()))); + + CD3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc(D3D11_RTV_DIMENSION_TEXTURE2D, m_backBufferFormat); + DX::ThrowIfFailed(m_d3dDevice->CreateRenderTargetView( + backBuffer.Get(), + &renderTargetViewDesc, + m_d3dRenderTargetView.ReleaseAndGetAddressOf() + )); + + if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN) + { + // Create a depth stencil view for use with 3D rendering if needed. + CD3D11_TEXTURE2D_DESC depthStencilDesc( + m_depthBufferFormat, + backBufferWidth, + backBufferHeight, + 1, // This depth stencil view has only one texture. + 1, // Use a single mipmap level. + D3D11_BIND_DEPTH_STENCIL + ); + + ComPtr depthStencil; + DX::ThrowIfFailed(m_d3dDevice->CreateTexture2D( + &depthStencilDesc, + nullptr, + depthStencil.GetAddressOf() + )); + + CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc(D3D11_DSV_DIMENSION_TEXTURE2D); + DX::ThrowIfFailed(m_d3dDevice->CreateDepthStencilView( + depthStencil.Get(), + &depthStencilViewDesc, + m_d3dDepthStencilView.ReleaseAndGetAddressOf() + )); + } + + // Set the 3D rendering viewport to target the entire window. + m_screenViewport = CD3D11_VIEWPORT( + 0.0f, + 0.0f, + static_cast(backBufferWidth), + static_cast(backBufferHeight) + ); +} + +// This method is called when the CoreWindow is created (or re-created). +void DX::DeviceResources::SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_window = window; + + m_outputSize.left = m_outputSize.top = 0; + m_outputSize.right = width; + m_outputSize.bottom = height; + + m_rotation = rotation; +} + +// This method is called when the window changes size +bool DX::DeviceResources::WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + RECT newRc; + newRc.left = newRc.top = 0; + newRc.right = width; + newRc.bottom = height; + if (newRc == m_outputSize && rotation == m_rotation) + { + return false; + } + + m_outputSize = newRc; + m_rotation = rotation; + CreateWindowSizeDependentResources(); + return true; +} + +// This method is called in the event handler for the DisplayContentsInvalidated event. +void DX::DeviceResources::ValidateDevice() +{ + // The D3D Device is no longer valid if the default adapter changed since the device + // was created or if the device has been removed. + + DXGI_ADAPTER_DESC previousDesc; + { + ComPtr dxgiDevice; + DX::ThrowIfFailed(m_d3dDevice.As(&dxgiDevice)); + + ComPtr deviceAdapter; + DX::ThrowIfFailed(dxgiDevice->GetAdapter(deviceAdapter.GetAddressOf())); + + ComPtr deviceFactory; + DX::ThrowIfFailed(deviceAdapter->GetParent(IID_PPV_ARGS(deviceFactory.GetAddressOf()))); + + ComPtr previousDefaultAdapter; + DX::ThrowIfFailed(deviceFactory->EnumAdapters1(0, previousDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(previousDefaultAdapter->GetDesc(&previousDesc)); + } + + DXGI_ADAPTER_DESC currentDesc; + { + ComPtr currentFactory; + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(currentFactory.GetAddressOf()))); + + ComPtr currentDefaultAdapter; + DX::ThrowIfFailed(currentFactory->EnumAdapters1(0, currentDefaultAdapter.GetAddressOf())); + + DX::ThrowIfFailed(currentDefaultAdapter->GetDesc(¤tDesc)); + } + + // If the adapter LUIDs don't match, or if the device reports that it has been removed, + // a new D3D device must be created. + + if (previousDesc.AdapterLuid.LowPart != currentDesc.AdapterLuid.LowPart + || previousDesc.AdapterLuid.HighPart != currentDesc.AdapterLuid.HighPart + || FAILED(m_d3dDevice->GetDeviceRemovedReason())) + { +#ifdef _DEBUG + OutputDebugStringA("Device Lost on ValidateDevice\n"); +#endif + + // Create a new device and swap chain. + HandleDeviceLost(); + } +} + +// Recreate all device resources and set them back to the current state. +void DX::DeviceResources::HandleDeviceLost() +{ + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceLost(); + } + + m_d3dDepthStencilView.Reset(); + m_d3dRenderTargetView.Reset(); + m_swapChain.Reset(); + m_d3dContext.Reset(); + m_d3dDevice.Reset(); + +#ifdef _DEBUG + { + ComPtr dxgiDebug; + if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&dxgiDebug)))) + { + dxgiDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_FLAGS(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL)); + } + } +#endif + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); + + if (m_deviceNotify) + { + m_deviceNotify->OnDeviceRestored(); + } +} + +// Call this method when the app suspends. It provides a hint to the driver that the app +// is entering an idle state and that temporary buffers can be reclaimed for use by other apps. +void DX::DeviceResources::Trim() +{ + ComPtr dxgiDevice; + if (SUCCEEDED(m_d3dDevice.As(&dxgiDevice))) + { + dxgiDevice->Trim(); + } +} + +// Present the contents of the swap chain to the screen. +void DX::DeviceResources::Present() +{ + // The first argument instructs DXGI to block until VSync, putting the application + // to sleep until the next VSync. This ensures we don't waste any cycles rendering + // frames that will never be displayed to the screen. + HRESULT hr = m_swapChain->Present(1, 0); + + // Discard the contents of the render target. + // This is a valid operation only when the existing contents will be entirely + // overwritten. If dirty or scroll rects are used, this call should be removed. + m_d3dContext->DiscardView(m_d3dRenderTargetView.Get()); + + if (m_d3dDepthStencilView) + { + // Discard the contents of the depth stencil. + m_d3dContext->DiscardView(m_d3dDepthStencilView.Get()); + } + + // If the device was removed either by a disconnection or a driver upgrade, we + // must recreate all device resources. + if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) + { +#ifdef _DEBUG + char buff[64] = {}; + sprintf_s(buff, "Device Lost on Present: Reason code 0x%08X\n", (hr == DXGI_ERROR_DEVICE_REMOVED) ? m_d3dDevice->GetDeviceRemovedReason() : hr); + OutputDebugStringA(buff); +#endif + HandleDeviceLost(); + } + else + { + DX::ThrowIfFailed(hr); + } +} + +// This method acquires the first available hardware adapter. +// If no such adapter can be found, *ppAdapter will be set to nullptr. +void DX::DeviceResources::GetHardwareAdapter(IDXGIAdapter1** ppAdapter) +{ + *ppAdapter = nullptr; + + ComPtr dxgiFactory; +#ifdef _DEBUG + UINT creationFlags = 0; + + if (SdkLayersAvailable()) + { + creationFlags |= DXGI_CREATE_FACTORY_DEBUG; + } + + DX::ThrowIfFailed(CreateDXGIFactory2(creationFlags, IID_PPV_ARGS(dxgiFactory.GetAddressOf()))); +#else + DX::ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(dxgiFactory.GetAddressOf()))); +#endif + + ComPtr adapter; + for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != dxgiFactory->EnumAdapters1(adapterIndex, adapter.ReleaseAndGetAddressOf()); adapterIndex++) + { + DXGI_ADAPTER_DESC1 desc; + adapter->GetDesc1(&desc); + + if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) + { + // Don't select the Basic Render Driver adapter. + continue; + } + +#ifdef _DEBUG + WCHAR buff[256] = {}; + swprintf_s(buff, L"Direct3D Adapter (%u): VID:%04X, PID:%04X - %ls\n", adapterIndex, desc.VendorId, desc.DeviceId, desc.Description); + OutputDebugStringW(buff); +#endif + + break; + } + + *ppAdapter = adapter.Detach(); +} \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/Common/DeviceResources.h b/Samples/System/ExtendedExecutionUWP/Common/DeviceResources.h new file mode 100644 index 0000000000000000000000000000000000000000..1da562cac922f3a6421d6bb23ab08ac66697fe44 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/Common/DeviceResources.h @@ -0,0 +1,83 @@ +// +// DeviceResources.h - A wrapper for the Direct3D 11 device and swapchain +// + +#pragma once + +namespace DX +{ + // Provides an interface for an application that owns DeviceResources to be notified of the device being lost or created. + interface IDeviceNotify + { + virtual void OnDeviceLost() = 0; + virtual void OnDeviceRestored() = 0; + }; + + // Controls all the DirectX device resources. + class DeviceResources + { + public: + DeviceResources(DXGI_FORMAT backBufferFormat = DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT depthBufferFormat = DXGI_FORMAT_D24_UNORM_S8_UINT, + UINT backBufferCount = 2, + D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL_9_3); + + void CreateDeviceResources(); + void CreateWindowSizeDependentResources(); + void SetWindow(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + bool WindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + void HandleDeviceLost(); + void RegisterDeviceNotify(IDeviceNotify* deviceNotify) { m_deviceNotify = deviceNotify; } + void Trim(); + void Present(); + + // Device Accessors. + RECT GetOutputSize() const { return m_outputSize; } + DXGI_MODE_ROTATION GetRotation() const { return m_rotation; } + + // Direct3D Accessors. + ID3D11Device2* GetD3DDevice() const { return m_d3dDevice.Get(); } + ID3D11DeviceContext2* GetD3DDeviceContext() const { return m_d3dContext.Get(); } + IDXGISwapChain3* GetSwapChain() const { return m_swapChain.Get(); } + D3D_FEATURE_LEVEL GetDeviceFeatureLevel() const { return m_d3dFeatureLevel; } + ID3D11RenderTargetView* GetBackBufferRenderTargetView() const { return m_d3dRenderTargetView.Get(); } + ID3D11DepthStencilView* GetDepthStencilView() const { return m_d3dDepthStencilView.Get(); } + DXGI_FORMAT GetBackBufferFormat() const { return m_backBufferFormat; } + DXGI_FORMAT GetDepthBufferFormat() const { return m_depthBufferFormat; } + D3D11_VIEWPORT GetScreenViewport() const { return m_screenViewport; } + UINT GetBackBufferCount() const { return m_backBufferCount; } + DirectX::XMFLOAT4X4 GetOrientationTransform3D() const { return m_orientationTransform3D; } + + private: + void GetHardwareAdapter(IDXGIAdapter1** ppAdapter); + + // Direct3D objects. + Microsoft::WRL::ComPtr m_d3dDevice; + Microsoft::WRL::ComPtr m_d3dContext; + Microsoft::WRL::ComPtr m_swapChain; + + // Direct3D rendering objects. Required for 3D. + Microsoft::WRL::ComPtr m_d3dRenderTargetView; + Microsoft::WRL::ComPtr m_d3dDepthStencilView; + D3D11_VIEWPORT m_screenViewport; + + // Direct3D properties. + DXGI_FORMAT m_backBufferFormat; + DXGI_FORMAT m_depthBufferFormat; + UINT m_backBufferCount; + D3D_FEATURE_LEVEL m_d3dMinFeatureLevel; + + // Cached device properties. + IUnknown* m_window; + D3D_FEATURE_LEVEL m_d3dFeatureLevel; + DXGI_MODE_ROTATION m_rotation; + RECT m_outputSize; + + // Transforms used for display orientation. + DirectX::XMFLOAT4X4 m_orientationTransform3D; + + // The IDeviceNotify can be held directly as it owns the DeviceResources. + IDeviceNotify* m_deviceNotify; + }; +} \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/Common/StepTimer.h b/Samples/System/ExtendedExecutionUWP/Common/StepTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f7acf56417f3184f8c17beecfbb1aaa124cdaf --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/Common/StepTimer.h @@ -0,0 +1,188 @@ +// +// StepTimer.h - A simple timer that provides elapsed time information +// + +#pragma once + +#include +#include + +namespace DX +{ + // Helper class for animation and simulation timing. + class StepTimer + { + public: + StepTimer() : + m_elapsedTicks(0), + m_totalTicks(0), + m_leftOverTicks(0), + m_frameCount(0), + m_framesPerSecond(0), + m_framesThisSecond(0), + m_qpcSecondCounter(0), + m_isFixedTimeStep(false), + m_targetElapsedTicks(TicksPerSecond / 60) + { + if (!QueryPerformanceFrequency(&m_qpcFrequency)) + { + throw std::exception( "QueryPerformanceFrequency" ); + } + + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + // Initialize max delta to 1/10 of a second. + m_qpcMaxDelta = m_qpcFrequency.QuadPart / 10; + } + + // Get elapsed time since the previous Update call. + uint64_t GetElapsedTicks() const { return m_elapsedTicks; } + double GetElapsedSeconds() const { return TicksToSeconds(m_elapsedTicks); } + + // Get total time since the start of the program. + uint64_t GetTotalTicks() const { return m_totalTicks; } + double GetTotalSeconds() const { return TicksToSeconds(m_totalTicks); } + + // Get total number of updates since start of the program. + uint32_t GetFrameCount() const { return m_frameCount; } + + // Get the current framerate. + uint32_t GetFramesPerSecond() const { return m_framesPerSecond; } + + // Set whether to use fixed or variable timestep mode. + void SetFixedTimeStep(bool isFixedTimestep) { m_isFixedTimeStep = isFixedTimestep; } + + // Set how often to call Update when in fixed timestep mode. + void SetTargetElapsedTicks(uint64_t targetElapsed) { m_targetElapsedTicks = targetElapsed; } + void SetTargetElapsedSeconds(double targetElapsed) { m_targetElapsedTicks = SecondsToTicks(targetElapsed); } + + // Integer format represents time using 10,000,000 ticks per second. + static const uint64_t TicksPerSecond = 10000000; + + static double TicksToSeconds(uint64_t ticks) { return static_cast(ticks) / TicksPerSecond; } + static uint64_t SecondsToTicks(double seconds) { return static_cast(seconds * TicksPerSecond); } + + // After an intentional timing discontinuity (for instance a blocking IO operation) + // call this to avoid having the fixed timestep logic attempt a set of catch-up + // Update calls. + + void ResetElapsedTime() + { + if (!QueryPerformanceCounter(&m_qpcLastTime)) + { + throw std::exception("QueryPerformanceCounter"); + } + + m_leftOverTicks = 0; + m_framesPerSecond = 0; + m_framesThisSecond = 0; + m_qpcSecondCounter = 0; + } + + // Update timer state, calling the specified Update function the appropriate number of times. + template + void Tick(const TUpdate& update) + { + // Query the current time. + LARGE_INTEGER currentTime; + + if (!QueryPerformanceCounter(¤tTime)) + { + throw std::exception( "QueryPerformanceCounter" ); + } + + uint64_t timeDelta = currentTime.QuadPart - m_qpcLastTime.QuadPart; + + m_qpcLastTime = currentTime; + m_qpcSecondCounter += timeDelta; + + // Clamp excessively large time deltas (e.g. after paused in the debugger). + if (timeDelta > m_qpcMaxDelta) + { + timeDelta = m_qpcMaxDelta; + } + + // Convert QPC units into a canonical tick format. This cannot overflow due to the previous clamp. + timeDelta *= TicksPerSecond; + timeDelta /= m_qpcFrequency.QuadPart; + + uint32_t lastFrameCount = m_frameCount; + + if (m_isFixedTimeStep) + { + // Fixed timestep update logic + + // If the app is running very close to the target elapsed time (within 1/4 of a millisecond) just clamp + // the clock to exactly match the target value. This prevents tiny and irrelevant errors + // from accumulating over time. Without this clamping, a game that requested a 60 fps + // fixed update, running with vsync enabled on a 59.94 NTSC display, would eventually + // accumulate enough tiny errors that it would drop a frame. It is better to just round + // small deviations down to zero to leave things running smoothly. + + if (abs(static_cast(timeDelta - m_targetElapsedTicks)) < TicksPerSecond / 4000) + { + timeDelta = m_targetElapsedTicks; + } + + m_leftOverTicks += timeDelta; + + while (m_leftOverTicks >= m_targetElapsedTicks) + { + m_elapsedTicks = m_targetElapsedTicks; + m_totalTicks += m_targetElapsedTicks; + m_leftOverTicks -= m_targetElapsedTicks; + m_frameCount++; + + update(); + } + } + else + { + // Variable timestep update logic. + m_elapsedTicks = timeDelta; + m_totalTicks += timeDelta; + m_leftOverTicks = 0; + m_frameCount++; + + update(); + } + + // Track the current framerate. + if (m_frameCount != lastFrameCount) + { + m_framesThisSecond++; + } + + if (m_qpcSecondCounter >= static_cast(m_qpcFrequency.QuadPart)) + { + m_framesPerSecond = m_framesThisSecond; + m_framesThisSecond = 0; + m_qpcSecondCounter %= m_qpcFrequency.QuadPart; + } + } + + private: + // Source timing data uses QPC units. + LARGE_INTEGER m_qpcFrequency; + LARGE_INTEGER m_qpcLastTime; + uint64_t m_qpcMaxDelta; + + // Derived timing data uses a canonical tick format. + uint64_t m_elapsedTicks; + uint64_t m_totalTicks; + uint64_t m_leftOverTicks; + + // Members for tracking the framerate. + uint32_t m_frameCount; + uint32_t m_framesPerSecond; + uint32_t m_framesThisSecond; + uint64_t m_qpcSecondCounter; + + // Members for configuring fixed timestep mode. + bool m_isFixedTimeStep; + uint64_t m_targetElapsedTicks; + }; +} diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.cpp b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.cpp new file mode 100644 index 0000000000000000000000000000000000000000..88252cd625c4c1d71be44b5386ba550beb1ab7dc --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.cpp @@ -0,0 +1,340 @@ +//-------------------------------------------------------------------------------------- +// ExtendedExecutionOnSuspend.cpp +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "ExtendedExecutionOnSuspend.h" +#include + +using namespace DirectX; +using namespace Windows::ApplicationModel; +using namespace Windows::UI::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::ApplicationModel::ExtendedExecution; +using namespace Windows::Foundation; + +Sample::Sample() : + m_showToasts(false), + m_consoleIsValid(false), + m_extensionActive(false), + m_pingEveryTenSeconds(false) +{ + m_deviceResources = std::make_unique(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN); + m_deviceResources->RegisterDeviceNotify(this); + m_console = std::make_unique(); +} + +void Sample::ShowInstructions() +{ + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Extended Execution On Suspend Sample")); + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Toggle Windows notifications with A button or 'N' key (default is off)")); + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Toggle a log event every 10 seconds with Y button or 'P' key (default is off)")); +} + +void Sample::LogEvent(const wchar_t* primaryLog, const wchar_t* secondaryData) +{ + unsigned int tid = GetCurrentThreadId(); + SYSTEMTIME curTime; + GetSystemTime(&curTime); + + wchar_t timeAndTid[25] = {}; + swprintf_s(timeAndTid, L"[%02d:%02d:%02d:%03d](%d)", curTime.wHour, curTime.wMinute, curTime.wSecond, curTime.wMilliseconds, tid); + Platform::String^ LogLine = ref new Platform::String(timeAndTid) + " " + ref new Platform::String(primaryLog) + " " + ref new Platform::String(secondaryData); + + //Output to Debug Console. + OutputDebugStringW(LogLine->Data()); + OutputDebugStringW(L"\n"); + + //Output to screen. We must cache screen logs if a log occurs when there is no valid screen console yet. + if (!m_consoleIsValid) + { + m_logCache.insert(m_logCache.begin(), LogLine); + } + else + { + m_console->WriteLine(LogLine->Data()); + } + + //Output to Windows Notification Center. + if (m_showToasts) + { + m_toastManager->Show(primaryLog, secondaryData, timeAndTid); + } +} + +void Sample::RequestExtensionOnSuspend(ExtendedExecutionSession^ session) +{ + LogEvent(L"Requesting Extended Execution during suspension..."); + IAsyncOperation^ request = session->RequestExtensionAsync(); + + auto requestExtensionTask = concurrency::create_task(request); + requestExtensionTask.then([this](ExtendedExecutionResult result) + { + if (result == ExtendedExecutionResult::Allowed) + { + SetExtensionActive(true); + LogEvent(L"Extension Request During Suspend Completed.", L"Extension Allowed"); + } + else //Denied + { + LogEvent(L"Extension Request During Suspend Completed.", L"Extension Denied"); + } + }).wait(); +} + +void Sample::ToggleNotifications() +{ + m_showToasts = !m_showToasts; + if (m_showToasts) + { + LogEvent(L"Will log to Windows notifications."); + } + else + { + LogEvent(L"Will not log to Windows notifications."); + } +} + +void Sample::TogglePing() +{ + m_pingEveryTenSeconds = !m_pingEveryTenSeconds; + if (m_pingEveryTenSeconds) + { + //Creating a thread to handle the ping every 10 seconds. We cannot perform this operation during the normal update function + //because an extension requested during suspending will not result in the CoreWindow thread returning from the OnSuspending event + //handler. This logging thread represents the app's ability to continue doing work during an extended execution requested during + //the suspend event. + concurrency::create_task([this]() + { + while (m_pingEveryTenSeconds) + { + LogEvent(L"Logging every ten seconds."); + Sleep(10000); + } + }); + LogEvent(L"Will log an event every ten seconds."); + } + else + { + LogEvent(L"Will stop logging every ten seconds."); + } +} + +// Initialize the Direct3D resources required to run. +void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_gamePad = std::make_unique(); + + m_keyboard = std::make_unique(); + m_keyboard->SetWindow(reinterpret_cast(window)); + + m_toastManager = std::make_unique (); + + m_deviceResources->SetWindow(window, width, height, rotation); + + m_deviceResources->CreateDeviceResources(); + CreateDeviceDependentResources(); + + m_deviceResources->CreateWindowSizeDependentResources(); + CreateWindowSizeDependentResources(); +} + +#pragma region Frame Update +// Executes basic render loop. +void Sample::Tick() +{ + m_timer.Tick([&]() + { + Update(m_timer); + }); + + Render(); +} + +// Updates the world. +void Sample::Update(DX::StepTimer const&) +{ + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Update"); + + auto pad = m_gamePad->GetState(0); + if (pad.IsConnected()) + { + m_gamePadButtons.Update(pad); + + if (pad.IsViewPressed()) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + if (m_gamePadButtons.a == GamePad::ButtonStateTracker::PRESSED) + { + ToggleNotifications(); + } + if (m_gamePadButtons.y == GamePad::ButtonStateTracker::PRESSED) + { + TogglePing(); + } + } + else + { + m_gamePadButtons.Reset(); + } + + auto kb = m_keyboard->GetState(); + m_keyboardButtons.Update(kb); + + if (kb.Escape) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + if (m_keyboardButtons.IsKeyPressed(Keyboard::N)) + { + ToggleNotifications(); + } + if (m_keyboardButtons.IsKeyPressed(Keyboard::P)) + { + TogglePing(); + } + + PIXEndEvent(); +} +#pragma endregion + +#pragma region Frame Render +// Draws the scene. +void Sample::Render() +{ + // Don't try to render anything before the first Update. + if (m_timer.GetFrameCount() == 0) + { + return; + } + + Clear(); + + auto context = m_deviceResources->GetD3DDeviceContext(); + PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Render"); + + m_console->Render(); + + PIXEndEvent(context); + + // Show the new frame. + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present"); + m_deviceResources->Present(); + PIXEndEvent(); +} + +// Helper method to clear the back buffers. +void Sample::Clear() +{ + auto context = m_deviceResources->GetD3DDeviceContext(); + PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Clear"); + + // Clear the views. + auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView(); + + context->OMSetRenderTargets(1, &renderTarget, nullptr); + + // Set the viewport. + auto viewport = m_deviceResources->GetScreenViewport(); + context->RSSetViewports(1, &viewport); + + PIXEndEvent(context); +} +#pragma endregion + +#pragma region Message Handlers +// Message handlers +void Sample::OnActivated() +{ +} + +void Sample::OnDeactivated() +{ +} + +void Sample::OnSuspending(ExtendedExecutionSession^ session) +{ + RequestExtensionOnSuspend(session); + while (m_extensionActive) + { + //Once the suspend operation is completed by returning from this OnSuspending function and calling Complete on the suspend deferral + //the app will be suspended. The extension is only active while we do not complete suspending. This busy loop will prevent us from being + //suspended as long as our extension request was allowed and while the extension has not been revoked. If the extension was not allowed + //we would need to complete suspending within the normal timeout. Once the extension is revoked we also need to complete suspending within + //the normal timeout regardless of whether it is revoked by a resume or system policy. In the case of a revoke due to being resumed we will + //still be suspended but immediately resumed. + } + + LogEvent(L"Completing suspend."); + + auto context = m_deviceResources->GetD3DDeviceContext(); + context->ClearState(); + + m_deviceResources->Trim(); +} + +void Sample::OnResuming() +{ + m_timer.ResetElapsedTime(); + m_gamePadButtons.Reset(); + m_keyboardButtons.Reset(); +} + +void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + if (!m_deviceResources->WindowSizeChanged(width, height, rotation)) + return; + + CreateWindowSizeDependentResources(); +} + +void Sample::ValidateDevice() +{ + m_deviceResources->ValidateDevice(); +} + +// Properties +void Sample::GetDefaultSize(int& width, int& height) const +{ + width = 1280; + height = 720; +} +#pragma endregion + +#pragma region Direct3D Resources +// These are the resources that depend on the device. +void Sample::CreateDeviceDependentResources() +{ + m_console->RestoreDevice(m_deviceResources->GetD3DDeviceContext(), L"Courier_16.spritefont", L"ATGSampleBackground.DDS"); +} + +// Allocate all memory resources that change on a window SizeChanged event. +void Sample::CreateWindowSizeDependentResources() +{ + m_console->SetWindow(m_deviceResources->GetOutputSize(), true); + //Now that the Console is valid we can flush any logs to the console. + m_consoleIsValid = true; + while (!m_logCache.empty()) + { + m_console->WriteLine(m_logCache.back()->Data()); + m_logCache.pop_back(); + } +} + +void Sample::OnDeviceLost() +{ + m_consoleIsValid = false; + m_console->ReleaseDevice(); +} + +void Sample::OnDeviceRestored() +{ + CreateDeviceDependentResources(); + + CreateWindowSizeDependentResources(); +} +#pragma endregion diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.h b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.h new file mode 100644 index 0000000000000000000000000000000000000000..30268ff9edb802fb8c7dd7ad9083c82876b3cc37 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.h @@ -0,0 +1,86 @@ +//-------------------------------------------------------------------------------------- +// ExtendedExecutionOnSuspend.h +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "..\Common\DeviceResources.h" +#include "..\Common\StepTimer.h" + +#include "ToastManager.h" +#include "TextConsole.h" + +// A basic sample implementation that creates a D3D11 device and +// provides a render loop. +class Sample : public DX::IDeviceNotify +{ +public: + + Sample(); + + // Initialization and management + void Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + + // Basic render loop + void Tick(); + void Render(); + + // Rendering helpers + void Clear(); + + // IDeviceNotify + virtual void OnDeviceLost() override; + virtual void OnDeviceRestored() override; + + // Messages + void OnActivated(); + void OnDeactivated(); + void OnSuspending(Windows::ApplicationModel::ExtendedExecution::ExtendedExecutionSession^ session); + void OnResuming(); + void OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + + // Properties + void GetDefaultSize( int& width, int& height ) const; + + //SampleFunctions + void ShowInstructions(); + void LogEvent(const wchar_t* primaryLog, const wchar_t* secondaryData = L""); + void SetExtensionActive(bool isActive) { m_extensionActive = isActive; } + +private: + + void Update(DX::StepTimer const& timer); + + void CreateDeviceDependentResources(); + void CreateWindowSizeDependentResources(); + + // Device resources. + std::unique_ptr m_deviceResources; + + // Rendering loop timer. + DX::StepTimer m_timer; + + // Input devices. + std::unique_ptr m_gamePad; + std::unique_ptr m_keyboard; + + DirectX::GamePad::ButtonStateTracker m_gamePadButtons; + DirectX::Keyboard::KeyboardStateTracker m_keyboardButtons; + + // Sample Specific + void ToggleNotifications(); + void TogglePing(); + void RequestExtensionOnSuspend(Windows::ApplicationModel::ExtendedExecution::ExtendedExecutionSession^ session); + + std::unique_ptr m_console; + std::unique_ptr m_toastManager; + bool m_showToasts; + bool m_consoleIsValid; + std::vector m_logCache; + bool m_extensionActive; + bool m_pingEveryTenSeconds; +}; \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.vcxproj b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..5647a540984b560fb1ef84759cb896244ca11acf --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.vcxproj @@ -0,0 +1,275 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {a7adabda-e6fd-447c-8589-7c3260ad790c} + DirectXApp + ExtendedExecutionOnSuspend + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ExtendedExecutionOnSuspend_TemporaryKey.pfx + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + Designer + + + true + true + + + + + + + + Assets\Logo.png + + + Assets\SmallLogo.png + + + Assets\SplashScreen.png + + + Assets\StoreLogo.png + + + Assets\WideLogo.png + + + + + {f4776924-619c-42c7-88b2-82c947ccc9e7} + + + + + + + + + \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.vcxproj.filters b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..a753120390ff646e7dc530a00100886904531fff --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend.vcxproj.filters @@ -0,0 +1,75 @@ + + + + + e78e95ac-2cf7-4541-abbd-fe905a3c6622 + + + 2aa1ca82-5735-4a6a-b2ed-e1485fa82670 + bmp;dds;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + {0006e2a2-7c80-406e-abe9-b704daa8ef9e} + + + {82a56344-6fc8-460b-a4f5-48174d67ad37} + + + + + + + ATG Tool Kit + + + ATG Tool Kit + + + Common + + + Common + + + + + + + + ATG Tool Kit + + + Common + + + + + Media + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + Media + + + + \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend_TemporaryKey.pfx b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..a08eccad5938b0f29ee946fd443181aaa93160ad Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/ExtendedExecutionOnSuspend_TemporaryKey.pfx differ diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/Main.cpp b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/Main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c2dd3cd65c56e49253b4f18e68e2022934092a0e --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/Main.cpp @@ -0,0 +1,390 @@ +//-------------------------------------------------------------------------------------- +// Main.cpp +// +// Entry point for Universal Windows Platform (UWP) app. +// +// This file has been modified to facilitate the Extended Execution sample. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "ExtendedExecutionOnSuspend.h" + +#include + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace DirectX; +using namespace Windows::ApplicationModel::ExtendedExecution; + +ref class ViewProvider sealed : public IFrameworkView +{ +public: + ViewProvider() : + m_exit(false), + m_visible(true), + m_DPI(96.f), + m_logicalWidth(800.f), + m_logicalHeight(600.f), + m_nativeOrientation(DisplayOrientations::None), + m_currentOrientation(DisplayOrientations::None) + { + } + + // IFrameworkView methods + virtual void Initialize(CoreApplicationView^ applicationView) + { + applicationView->Activated += ref new + TypedEventHandler(this, &ViewProvider::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &ViewProvider::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &ViewProvider::OnResuming); + + m_sample = std::make_unique(); + m_sample->ShowInstructions(); + } + + virtual void Uninitialize() + { + m_sample.reset(); + } + + virtual void SetWindow(CoreWindow^ window) + { + window->SizeChanged += + ref new TypedEventHandler(this, &ViewProvider::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &ViewProvider::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &ViewProvider::OnWindowClosed); + + auto dispatcher = CoreWindow::GetForCurrentThread()->Dispatcher; + + dispatcher->AcceleratorKeyActivated += + ref new TypedEventHandler(this, &ViewProvider::OnAcceleratorKeyActivated); + + auto currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &ViewProvider::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &ViewProvider::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &ViewProvider::OnDisplayContentsInvalidated); + + m_DPI = currentDisplayInformation->LogicalDpi; + + m_logicalWidth = window->Bounds.Width; + m_logicalHeight = window->Bounds.Height; + + m_nativeOrientation = currentDisplayInformation->NativeOrientation; + m_currentOrientation = currentDisplayInformation->CurrentOrientation; + + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->Initialize(reinterpret_cast(window), + outputWidth, outputHeight, rotation ); + } + + virtual void Load(Platform::String^ entryPoint) + { + } + + virtual void Run() + { + while (!m_exit) + { + if (m_visible) + { + m_sample->Tick(); + + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } + } + +protected: + // Event handlers + void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) + { + if (args->Kind == ActivationKind::Launch) + { + auto launchArgs = static_cast(args); + + if (launchArgs->PrelaunchActivated) + { + // Opt-out of Prelaunch + CoreApplication::Exit(); + return; + } + } + + int w, h; + m_sample->GetDefaultSize(w, h); + + m_DPI = DisplayInformation::GetForCurrentView()->LogicalDpi; + + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; + // Change to ApplicationViewWindowingMode::FullScreen to default to full screen + + auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h)); + + ApplicationView::PreferredLaunchViewSize = desiredSize; + + auto view = ApplicationView::GetForCurrentView(); + + auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200)); + + view->SetPreferredMinSize(minSize); + + m_sample->LogEvent(L"OnActivated()", args->Kind.ToString()->Data()); + CoreWindow::GetForCurrentThread()->Activate(); + + view->FullScreenSystemOverlayMode = FullScreenSystemOverlayMode::Minimal; + + view->TryResizeView(desiredSize); + } + + void OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) + { + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + //We use a deferral when suspending so we can wait() on the result of the extended execution request. calling wait() on the + //core window thread will throw an exception. + concurrency::create_task([this, deferral]() + { + auto session = ref new ExtendedExecutionSession(); + //This must be set to SavingData otherwise the extension request will be denied during a suspension. + session->Reason = ExtendedExecutionReason::SavingData; + session->Description = "Testing Extended Execution behavior with a request during suspension."; + session->Revoked += ref new TypedEventHandler(this, &ViewProvider::ExtensionRevokedHandler); + + m_sample->LogEvent(L"OnSuspending()", L"using a deferral"); + m_sample->OnSuspending(session); + deferral->Complete(); + }); + } + + void OnResuming(Platform::Object^ sender, Platform::Object^ args) + { + m_sample->LogEvent(L"OnResuming()"); + m_sample->OnResuming(); + } + + void OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) + { + m_logicalWidth = sender->Bounds.Width; + m_logicalHeight = sender->Bounds.Height; + + HandleWindowSizeChanged(); + } + + void OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) + { + m_visible = args->Visible; + if (m_visible) + { + m_sample->LogEvent(L"OnVisibilityChanged()", L"Visible"); + m_sample->OnActivated(); + } + else + { + m_sample->LogEvent(L"OnVisibilityChanged()", L"Not Visible"); + m_sample->OnDeactivated(); + } + } + + void OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) + { + m_exit = true; + } + + void OnAcceleratorKeyActivated(CoreDispatcher^, AcceleratorKeyEventArgs^ args) + { + if (args->EventType == CoreAcceleratorKeyEventType::SystemKeyDown + && args->VirtualKey == VirtualKey::Enter + && args->KeyStatus.IsMenuKeyDown + && !args->KeyStatus.WasKeyDown) + { + // Implements the classic ALT+ENTER fullscreen toggle + auto view = ApplicationView::GetForCurrentView(); + + if (view->IsFullScreenMode) + view->ExitFullScreenMode(); + else + view->TryEnterFullScreenMode(); + + args->Handled = true; + } + } + + void OnDpiChanged(DisplayInformation^ sender, Object^ args) + { + m_DPI = sender->LogicalDpi; + + HandleWindowSizeChanged(); + } + + void OnOrientationChanged(DisplayInformation^ sender, Object^ args) + { + m_currentOrientation = sender->CurrentOrientation; + + HandleWindowSizeChanged(); + } + + void OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) + { + m_sample->ValidateDevice(); + } + + void ExtensionRevokedHandler(Platform::Object^ obj, ExtendedExecutionRevokedEventArgs^ args) + { + m_sample->SetExtensionActive(false); + if (args->Reason == ExtendedExecutionRevokedReason::Resumed) + { + m_sample->LogEvent(L"Extension Revoked.", L"Reason = Resumed"); + } + else if (args->Reason == ExtendedExecutionRevokedReason::SystemPolicy) + { + m_sample->LogEvent(L"Extension Revoked.", L"Reason = SystemPolicy"); + } + } + +private: + bool m_exit; + bool m_visible; + float m_DPI; + float m_logicalWidth; + float m_logicalHeight; + std::unique_ptr m_sample; + + Windows::Graphics::Display::DisplayOrientations m_nativeOrientation; + Windows::Graphics::Display::DisplayOrientations m_currentOrientation; + + inline int ConvertDipsToPixels(float dips) const + { + return int(dips * m_DPI / 96.f + 0.5f); + } + + inline float ConvertPixelsToDips(int pixels) const + { + return (float(pixels) * 96.f / m_DPI); + } + + DXGI_MODE_ROTATION ComputeDisplayRotation() const + { + DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; + + switch (m_nativeOrientation) + { + case DisplayOrientations::Landscape: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + } + break; + + case DisplayOrientations::Portrait: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + } + break; + } + + return rotation; + } + + void HandleWindowSizeChanged() + { + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->OnWindowSizeChanged(outputWidth, outputHeight, rotation); + } +}; + +ref class ViewProviderFactory : IFrameworkViewSource +{ +public: + virtual IFrameworkView^ CreateView() + { + return ref new ViewProvider(); + } +}; + + +// Entry point +[Platform::MTAThread] +int main(Platform::Array^ argv) +{ + UNREFERENCED_PARAMETER(argv); + + auto viewProviderFactory = ref new ViewProviderFactory(); + CoreApplication::Run(viewProviderFactory); + return 0; +} diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/Package.appxmanifest b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/Package.appxmanifest new file mode 100644 index 0000000000000000000000000000000000000000..6a294e03766e3f761d60a4dd2bb015a774294c60 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/Package.appxmanifest @@ -0,0 +1,28 @@ + + + + + + ExtendedExecutionOnSuspend + Xbox Advanced Technology Group + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/pch.cpp b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..851c81be9b30ae3e8175fb950b95a1c9508580a3 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/pch.cpp @@ -0,0 +1,10 @@ +//-------------------------------------------------------------------------------------- +// pch.cpp +// +// Include the standard header and generate the precompiled header. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/pch.h b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..2f0437db6268dc014750c40ec9ea9e377eb2dea6 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionOnSuspend/pch.h @@ -0,0 +1,67 @@ +//-------------------------------------------------------------------------------------- +// pch.h +// +// Header for standard system include files. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +// Use the C++ standard templated min/max +#define NOMINMAX + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#ifdef _DEBUG +#include +#endif + +#include "DDSTextureLoader.h" +#include "GamePad.h" +#include "Keyboard.h" +#include "SpriteBatch.h" +#include "SpriteFont.h" + +namespace DX +{ + // Helper class for COM exceptions + class com_exception : public std::exception + { + public: + com_exception(HRESULT hr) : result(hr) {} + + virtual const char* what() const override + { + static char s_str[64] = { 0 }; + sprintf_s(s_str, "Failure with HRESULT of %08X", result); + return s_str; + } + + private: + HRESULT result; + }; + + // Helper utility converts D3D API failures into exceptions. + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + throw com_exception(hr); + } + } +} \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/ExtendedExecutionUWP.sln b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionUWP.sln new file mode 100644 index 0000000000000000000000000000000000000000..8d2dbe0312953b84d1f5708e78a3a5c7e58e7c47 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/ExtendedExecutionUWP.sln @@ -0,0 +1,74 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExtendedExecutionOnSuspend", "ExtendedExecutionOnSuspend\ExtendedExecutionOnSuspend.vcxproj", "{A7ADABDA-E6FD-447C-8589-7C3260AD790C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTK", "..\..\..\Kits\DirectXTK\DirectXTK_Windows10.vcxproj", "{F4776924-619C-42C7-88B2-82C947CCC9E7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PreemptiveExtendedExecution", "PreemptiveExtendedExecution\PreemptiveExtendedExecution.vcxproj", "{AE64761E-2806-482C-96AE-B35C9F9D35D2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|ARM.ActiveCfg = Debug|ARM + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|ARM.Build.0 = Debug|ARM + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|ARM.Deploy.0 = Debug|ARM + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|x64.ActiveCfg = Debug|x64 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|x64.Build.0 = Debug|x64 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|x64.Deploy.0 = Debug|x64 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|x86.ActiveCfg = Debug|Win32 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|x86.Build.0 = Debug|Win32 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Debug|x86.Deploy.0 = Debug|Win32 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|ARM.ActiveCfg = Release|ARM + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|ARM.Build.0 = Release|ARM + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|ARM.Deploy.0 = Release|ARM + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|x64.ActiveCfg = Release|x64 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|x64.Build.0 = Release|x64 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|x64.Deploy.0 = Release|x64 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|x86.ActiveCfg = Release|Win32 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|x86.Build.0 = Release|Win32 + {A7ADABDA-E6FD-447C-8589-7C3260AD790C}.Release|x86.Deploy.0 = Release|Win32 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.ActiveCfg = Debug|ARM + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|ARM.Build.0 = Debug|ARM + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.ActiveCfg = Debug|x64 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x64.Build.0 = Debug|x64 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.ActiveCfg = Debug|Win32 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Debug|x86.Build.0 = Debug|Win32 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.ActiveCfg = Release|ARM + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|ARM.Build.0 = Release|ARM + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.ActiveCfg = Release|x64 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x64.Build.0 = Release|x64 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.ActiveCfg = Release|Win32 + {F4776924-619C-42C7-88B2-82C947CCC9E7}.Release|x86.Build.0 = Release|Win32 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|ARM.ActiveCfg = Debug|ARM + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|ARM.Build.0 = Debug|ARM + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|ARM.Deploy.0 = Debug|ARM + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|x64.ActiveCfg = Debug|x64 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|x64.Build.0 = Debug|x64 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|x64.Deploy.0 = Debug|x64 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|x86.ActiveCfg = Debug|Win32 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|x86.Build.0 = Debug|Win32 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Debug|x86.Deploy.0 = Debug|Win32 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|ARM.ActiveCfg = Release|ARM + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|ARM.Build.0 = Release|ARM + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|ARM.Deploy.0 = Release|ARM + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|x64.ActiveCfg = Release|x64 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|x64.Build.0 = Release|x64 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|x64.Deploy.0 = Release|x64 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|x86.ActiveCfg = Release|Win32 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|x86.Build.0 = Release|Win32 + {AE64761E-2806-482C-96AE-B35C9F9D35D2}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/Main.cpp b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/Main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f1c3bd0e839d1dad4395d7d232b31c6413835957 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/Main.cpp @@ -0,0 +1,388 @@ +//-------------------------------------------------------------------------------------- +// Main.cpp +// +// Entry point for Universal Windows Platform (UWP) app. +// +// This file has been modified to facilitate the Extended Execution sample. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PreemptiveExtendedExecution.h" + +#include + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace DirectX; +using namespace Windows::ApplicationModel::ExtendedExecution; + +ref class ViewProvider sealed : public IFrameworkView +{ +public: + ViewProvider() : + m_exit(false), + m_visible(true), + m_DPI(96.f), + m_logicalWidth(800.f), + m_logicalHeight(600.f), + m_nativeOrientation(DisplayOrientations::None), + m_currentOrientation(DisplayOrientations::None) + { + } + + // IFrameworkView methods + virtual void Initialize(CoreApplicationView^ applicationView) + { + applicationView->Activated += ref new + TypedEventHandler(this, &ViewProvider::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &ViewProvider::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &ViewProvider::OnResuming); + + m_session = ref new ExtendedExecutionSession(); + //This must be set to either Unspecified or LocationTracking otherwise the extension request will be denied for a preemptive request. + m_session->Reason = ExtendedExecutionReason::Unspecified; + m_session->Description = "Testing Extended Execution behavior with a preemptive request."; + m_session->Revoked += ref new TypedEventHandler(this, &ViewProvider::ExtensionRevokedHandler); + + m_sample = std::make_unique(m_session); + m_sample->ShowInstructions(); + } + + virtual void Uninitialize() + { + m_sample.reset(); + } + + virtual void SetWindow(CoreWindow^ window) + { + window->SizeChanged += + ref new TypedEventHandler(this, &ViewProvider::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &ViewProvider::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &ViewProvider::OnWindowClosed); + + auto dispatcher = CoreWindow::GetForCurrentThread()->Dispatcher; + + dispatcher->AcceleratorKeyActivated += + ref new TypedEventHandler(this, &ViewProvider::OnAcceleratorKeyActivated); + + auto currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &ViewProvider::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &ViewProvider::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &ViewProvider::OnDisplayContentsInvalidated); + + m_DPI = currentDisplayInformation->LogicalDpi; + + m_logicalWidth = window->Bounds.Width; + m_logicalHeight = window->Bounds.Height; + + m_nativeOrientation = currentDisplayInformation->NativeOrientation; + m_currentOrientation = currentDisplayInformation->CurrentOrientation; + + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->Initialize(reinterpret_cast(window), + outputWidth, outputHeight, rotation ); + } + + virtual void Load(Platform::String^ entryPoint) + { + } + + virtual void Run() + { + while (!m_exit) + { + m_sample->Tick(); + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + } + } + +protected: + // Event handlers + void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) + { + if (args->Kind == ActivationKind::Launch) + { + auto launchArgs = static_cast(args); + + if (launchArgs->PrelaunchActivated) + { + // Opt-out of Prelaunch + CoreApplication::Exit(); + return; + } + } + + int w, h; + m_sample->GetDefaultSize(w, h); + + m_DPI = DisplayInformation::GetForCurrentView()->LogicalDpi; + + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; + // Change to ApplicationViewWindowingMode::FullScreen to default to full screen + + auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h)); + + ApplicationView::PreferredLaunchViewSize = desiredSize; + + auto view = ApplicationView::GetForCurrentView(); + + auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200)); + + view->SetPreferredMinSize(minSize); + + m_sample->LogEvent(L"OnActivated()", args->Kind.ToString()->Data()); + CoreWindow::GetForCurrentThread()->Activate(); + + view->FullScreenSystemOverlayMode = FullScreenSystemOverlayMode::Minimal; + + view->TryResizeView(desiredSize); + } + + void OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) + { + if (m_sample->GetUseDeferral()) + { + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + concurrency::create_task([this, deferral]() + { + m_sample->LogEvent(L"OnSuspending()", L"using a deferral"); + m_sample->OnSuspending(); + deferral->Complete(); + }); + } + else + { + m_sample->LogEvent(L"OnSuspending()", L"not using a deferral"); + m_sample->OnSuspending(); + } + } + + void OnResuming(Platform::Object^ sender, Platform::Object^ args) + { + m_sample->LogEvent(L"OnResuming()"); + m_sample->OnResuming(); + } + + void OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) + { + m_logicalWidth = sender->Bounds.Width; + m_logicalHeight = sender->Bounds.Height; + + HandleWindowSizeChanged(); + } + + void OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) + { + m_visible = args->Visible; + if (m_visible) + { + m_sample->LogEvent(L"OnVisibilityChanged()", L"Visible"); + m_sample->OnActivated(); + } + else + { + m_sample->LogEvent(L"OnVisibilityChanged()", L"Not Visible"); + m_sample->OnDeactivated(); + } + } + + void OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) + { + m_exit = true; + } + + void OnAcceleratorKeyActivated(CoreDispatcher^, AcceleratorKeyEventArgs^ args) + { + if (args->EventType == CoreAcceleratorKeyEventType::SystemKeyDown + && args->VirtualKey == VirtualKey::Enter + && args->KeyStatus.IsMenuKeyDown + && !args->KeyStatus.WasKeyDown) + { + // Implements the classic ALT+ENTER fullscreen toggle + auto view = ApplicationView::GetForCurrentView(); + + if (view->IsFullScreenMode) + view->ExitFullScreenMode(); + else + view->TryEnterFullScreenMode(); + + args->Handled = true; + } + } + + void OnDpiChanged(DisplayInformation^ sender, Object^ args) + { + m_DPI = sender->LogicalDpi; + + HandleWindowSizeChanged(); + } + + void OnOrientationChanged(DisplayInformation^ sender, Object^ args) + { + m_currentOrientation = sender->CurrentOrientation; + + HandleWindowSizeChanged(); + } + + void OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) + { + m_sample->ValidateDevice(); + } + + void ExtensionRevokedHandler(Platform::Object^ obj, ExtendedExecutionRevokedEventArgs^ args) + { + if (args->Reason == ExtendedExecutionRevokedReason::Resumed) + { + m_sample->LogEvent(L"Extension Revoked.", L"Reason = Resumed"); + } + else if (args->Reason == ExtendedExecutionRevokedReason::SystemPolicy) + { + m_sample->LogEvent(L"Extension Revoked.", L"Reason = SystemPolicy"); + } + } + +private: + bool m_exit; + bool m_visible; + float m_DPI; + float m_logicalWidth; + float m_logicalHeight; + std::unique_ptr m_sample; + Windows::ApplicationModel::ExtendedExecution::ExtendedExecutionSession^ m_session; + + Windows::Graphics::Display::DisplayOrientations m_nativeOrientation; + Windows::Graphics::Display::DisplayOrientations m_currentOrientation; + + inline int ConvertDipsToPixels(float dips) const + { + return int(dips * m_DPI / 96.f + 0.5f); + } + + inline float ConvertPixelsToDips(int pixels) const + { + return (float(pixels) * 96.f / m_DPI); + } + + DXGI_MODE_ROTATION ComputeDisplayRotation() const + { + DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; + + switch (m_nativeOrientation) + { + case DisplayOrientations::Landscape: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + } + break; + + case DisplayOrientations::Portrait: + switch (m_currentOrientation) + { + case DisplayOrientations::Landscape: + rotation = DXGI_MODE_ROTATION_ROTATE90; + break; + + case DisplayOrientations::Portrait: + rotation = DXGI_MODE_ROTATION_IDENTITY; + break; + + case DisplayOrientations::LandscapeFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE270; + break; + + case DisplayOrientations::PortraitFlipped: + rotation = DXGI_MODE_ROTATION_ROTATE180; + break; + } + break; + } + + return rotation; + } + + void HandleWindowSizeChanged() + { + int outputWidth = ConvertDipsToPixels(m_logicalWidth); + int outputHeight = ConvertDipsToPixels(m_logicalHeight); + + DXGI_MODE_ROTATION rotation = ComputeDisplayRotation(); + + if (rotation == DXGI_MODE_ROTATION_ROTATE90 || rotation == DXGI_MODE_ROTATION_ROTATE270) + { + std::swap(outputWidth, outputHeight); + } + + m_sample->OnWindowSizeChanged(outputWidth, outputHeight, rotation); + } +}; + +ref class ViewProviderFactory : IFrameworkViewSource +{ +public: + virtual IFrameworkView^ CreateView() + { + return ref new ViewProvider(); + } +}; + + +// Entry point +[Platform::MTAThread] +int main(Platform::Array^ argv) +{ + UNREFERENCED_PARAMETER(argv); + + auto viewProviderFactory = ref new ViewProviderFactory(); + CoreApplication::Run(viewProviderFactory); + return 0; +} diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/Package.appxmanifest b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/Package.appxmanifest new file mode 100644 index 0000000000000000000000000000000000000000..955bad1cd4ccac8e15ef0a9f241f37b6a2d432ae --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/Package.appxmanifest @@ -0,0 +1,28 @@ + + + + + + PreemptiveExtendedExecution + Xbox Advanced Technology Group + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.cpp b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c0b9e1d1bc5c60dee9c146d7fec08fbb5a6a60df --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.cpp @@ -0,0 +1,345 @@ +//-------------------------------------------------------------------------------------- +// PreemptiveExtendedExecution.cpp +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PreemptiveExtendedExecution.h" +#include + +using namespace DirectX; +using namespace Windows::ApplicationModel; +using namespace Windows::UI::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::ApplicationModel::ExtendedExecution; +using namespace Windows::Foundation; + +Sample::Sample(ExtendedExecutionSession^ session) : + m_useDeferral(false), + m_showToasts(false), + m_consoleIsValid(false), + m_pingEveryTenSeconds(false) +{ + m_deviceResources = std::make_unique(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN); + m_deviceResources->RegisterDeviceNotify(this); + m_console = std::make_unique(); + m_session = session; +} + +void Sample::ShowInstructions() +{ + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Preemptive Extended Execution Sample")); + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Toggle Windows notifications with A button or 'N' key (default is off)")); + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Toggle suspend deferral with B button or 'D' key (default is off)")); + m_logCache.insert(m_logCache.begin(), ref new Platform::String(L"Toggle a log event every 10 seconds with Y button or 'P' key (default is off)")); +} + +void Sample::LogEvent(const wchar_t* primaryLog, const wchar_t* secondaryData) +{ + unsigned int tid = GetCurrentThreadId(); + SYSTEMTIME curTime; + GetSystemTime(&curTime); + + wchar_t timeAndTid[25] = {}; + swprintf_s(timeAndTid, L"[%02d:%02d:%02d:%03d](%d)", curTime.wHour, curTime.wMinute, curTime.wSecond, curTime.wMilliseconds, tid); + Platform::String^ LogLine = ref new Platform::String(timeAndTid) + " " + ref new Platform::String(primaryLog) + " " + ref new Platform::String(secondaryData); + + //Output to Debug Console. + OutputDebugStringW(LogLine->Data()); + OutputDebugStringW(L"\n"); + + //Output to screen. We must cache screen logs if a log occurs when there is no valid screen console yet. + if (!m_consoleIsValid) + { + m_logCache.insert(m_logCache.begin(), LogLine); + } + else + { + m_console->WriteLine(LogLine->Data()); + } + + //Output to Windows Notification Center. + if (m_showToasts) + { + m_toastManager->Show(primaryLog, secondaryData, timeAndTid); + } +} + +void Sample::RequestPreemptiveExtension() +{ + LogEvent(L"Requesting Extended Execution preemptively..."); + IAsyncOperation^ request = m_session->RequestExtensionAsync(); + + auto requestExtensionTask = concurrency::create_task(request); + requestExtensionTask.then([this](ExtendedExecutionResult result) + { + if (result == ExtendedExecutionResult::Allowed) + { + LogEvent(L"Preemptive Extension Request Completed.", L"Extension Allowed"); + } + else //Denied + { + LogEvent(L"Preemptive Extension Request Completed.", L"Extension Denied"); + } + }); +} + +void Sample::ToggleNotifications() +{ + m_showToasts = !m_showToasts; + if (m_showToasts) + { + LogEvent(L"Will log to Windows notifications."); + } + else + { + LogEvent(L"Will not log to Windows notifications."); + } +} + +void Sample::ToggleDeferral() +{ + m_useDeferral = !m_useDeferral; + if (m_useDeferral) + { + LogEvent(L"Will use a suspend deferral."); + } + else + { + LogEvent(L"Will not use a suspend deferral."); + } +} + +void Sample::TogglePing() +{ + m_pingEveryTenSeconds = !m_pingEveryTenSeconds; + if (m_pingEveryTenSeconds) + { + LogEvent(L"Will log an event every ten seconds."); + } + else + { + LogEvent(L"Will stop logging every ten seconds."); + } +} + +// Initialize the Direct3D resources required to run. +void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation) +{ + m_gamePad = std::make_unique(); + + m_keyboard = std::make_unique(); + m_keyboard->SetWindow(reinterpret_cast(window)); + + m_toastManager = std::make_unique (); + + m_deviceResources->SetWindow(window, width, height, rotation); + + m_deviceResources->CreateDeviceResources(); + CreateDeviceDependentResources(); + + m_deviceResources->CreateWindowSizeDependentResources(); + CreateWindowSizeDependentResources(); +} + +#pragma region Frame Update +// Executes basic render loop. +void Sample::Tick() +{ + m_timer.Tick([&]() + { + Update(m_timer); + }); + + Render(); +} + +// Updates the world. +void Sample::Update(DX::StepTimer const& timer) +{ + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Update"); + + static double pingTimer = 0; + if (m_pingEveryTenSeconds && timer.GetTotalSeconds() - pingTimer > 10) + { + LogEvent(L"Logging every ten seconds."); + pingTimer = timer.GetTotalSeconds(); + } + + auto pad = m_gamePad->GetState(0); + if (pad.IsConnected()) + { + m_gamePadButtons.Update(pad); + + if (pad.IsViewPressed()) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + if (m_gamePadButtons.a == GamePad::ButtonStateTracker::PRESSED) + { + ToggleNotifications(); + } + if (m_gamePadButtons.b == GamePad::ButtonStateTracker::PRESSED) + { + ToggleDeferral(); + } + if (m_gamePadButtons.y == GamePad::ButtonStateTracker::PRESSED) + { + TogglePing(); + } + } + else + { + m_gamePadButtons.Reset(); + } + + auto kb = m_keyboard->GetState(); + m_keyboardButtons.Update(kb); + + if (kb.Escape) + { + Windows::ApplicationModel::Core::CoreApplication::Exit(); + } + if (m_keyboardButtons.IsKeyPressed(Keyboard::N)) + { + ToggleNotifications(); + } + if (m_keyboardButtons.IsKeyPressed(Keyboard::D)) + { + ToggleDeferral(); + } + if (m_keyboardButtons.IsKeyPressed(Keyboard::P)) + { + TogglePing(); + } + + PIXEndEvent(); +} +#pragma endregion + +#pragma region Frame Render +// Draws the scene. +void Sample::Render() +{ + // Don't try to render anything before the first Update. + if (m_timer.GetFrameCount() == 0) + { + return; + } + + Clear(); + + auto context = m_deviceResources->GetD3DDeviceContext(); + PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Render"); + + m_console->Render(); + + PIXEndEvent(context); + + // Show the new frame. + PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present"); + m_deviceResources->Present(); + PIXEndEvent(); +} + +// Helper method to clear the back buffers. +void Sample::Clear() +{ + auto context = m_deviceResources->GetD3DDeviceContext(); + PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Clear"); + + // Clear the views. + auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView(); + + context->OMSetRenderTargets(1, &renderTarget, nullptr); + + // Set the viewport. + auto viewport = m_deviceResources->GetScreenViewport(); + context->RSSetViewports(1, &viewport); + + PIXEndEvent(context); +} +#pragma endregion + +#pragma region Message Handlers +// Message handlers +void Sample::OnActivated() +{ + RequestPreemptiveExtension(); +} + +void Sample::OnDeactivated() +{ +} + +void Sample::OnSuspending() +{ + auto context = m_deviceResources->GetD3DDeviceContext(); + context->ClearState(); + + m_deviceResources->Trim(); +} + +void Sample::OnResuming() +{ + m_timer.ResetElapsedTime(); + m_gamePadButtons.Reset(); + m_keyboardButtons.Reset(); +} + +void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) +{ + if (!m_deviceResources->WindowSizeChanged(width, height, rotation)) + return; + + CreateWindowSizeDependentResources(); +} + +void Sample::ValidateDevice() +{ + m_deviceResources->ValidateDevice(); +} + +// Properties +void Sample::GetDefaultSize(int& width, int& height) const +{ + width = 1280; + height = 720; +} +#pragma endregion + +#pragma region Direct3D Resources +// These are the resources that depend on the device. +void Sample::CreateDeviceDependentResources() +{ + m_console->RestoreDevice(m_deviceResources->GetD3DDeviceContext(), L"Courier_16.spritefont", L"ATGSampleBackground.DDS"); +} + +// Allocate all memory resources that change on a window SizeChanged event. +void Sample::CreateWindowSizeDependentResources() +{ + m_console->SetWindow(m_deviceResources->GetOutputSize(), true); + //Now that the Console is valid we can flush any logs to the console. + m_consoleIsValid = true; + while (!m_logCache.empty()) + { + m_console->WriteLine(m_logCache.back()->Data()); + m_logCache.pop_back(); + } +} + +void Sample::OnDeviceLost() +{ + m_consoleIsValid = false; + m_console->ReleaseDevice(); +} + +void Sample::OnDeviceRestored() +{ + CreateDeviceDependentResources(); + + CreateWindowSizeDependentResources(); +} +#pragma endregion diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.h b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.h new file mode 100644 index 0000000000000000000000000000000000000000..d23efe7ead5b652b42646d9472e65989137e6dcb --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.h @@ -0,0 +1,90 @@ +//-------------------------------------------------------------------------------------- +// PreemptiveExtendedExecution.h +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +#include "..\Common\DeviceResources.h" +#include "..\Common\StepTimer.h" + +#include "ToastManager.h" +#include "TextConsole.h" + +// A basic sample implementation that creates a D3D11 device and +// provides a render loop. +class Sample : public DX::IDeviceNotify +{ +public: + + Sample(Windows::ApplicationModel::ExtendedExecution::ExtendedExecutionSession^ session); + + // Initialization and management + void Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTATION rotation); + + // Basic render loop + void Tick(); + void Render(); + + // Rendering helpers + void Clear(); + + // IDeviceNotify + virtual void OnDeviceLost() override; + virtual void OnDeviceRestored() override; + + // Messages + void OnActivated(); + void OnDeactivated(); + void OnSuspending(); + void OnResuming(); + void OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation); + void ValidateDevice(); + + // Properties + void GetDefaultSize( int& width, int& height ) const; + + //SampleFunctions + void ShowInstructions(); + void LogEvent(const wchar_t* primaryLog, const wchar_t* secondaryData = L""); + bool GetUseDeferral() { return m_useDeferral; } + +private: + + void Update(DX::StepTimer const& timer); + + void CreateDeviceDependentResources(); + void CreateWindowSizeDependentResources(); + + // Device resources. + std::unique_ptr m_deviceResources; + + // Rendering loop timer. + DX::StepTimer m_timer; + + // Input devices. + std::unique_ptr m_gamePad; + std::unique_ptr m_keyboard; + + DirectX::GamePad::ButtonStateTracker m_gamePadButtons; + DirectX::Keyboard::KeyboardStateTracker m_keyboardButtons; + + // Sample Specific + void ToggleNotifications(); + void ToggleDeferral(); + void TogglePing(); + void RequestPreemptiveExtension(); + + std::unique_ptr m_console; + std::unique_ptr m_toastManager; + bool m_useDeferral; + bool m_showToasts; + bool m_consoleIsValid; + std::vector m_logCache; + bool m_pingEveryTenSeconds; + + Windows::ApplicationModel::ExtendedExecution::ExtendedExecutionSession^ m_session; + +}; \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.vcxproj b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..8e4f1917d329ef7e5e23a8600023d81e77a3e985 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.vcxproj @@ -0,0 +1,277 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {ae64761e-2806-482c-96ae-b35c9f9d35d2} + DirectXApp + PreemptiveExtendedExecution + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreemptiveExtendedExecution_TemporaryKey.pfx + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + StreamingSIMDExtensions2 + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + _DEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + d2d1.lib; d3d11.lib; dxgi.lib; dxguid.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);..\..\..\..\Kits\DirectXTK\Inc;..\..\..\..\Kits\ATGTK;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + Level4 + NDEBUG;%(PreprocessorDefinitions) + Fast + + + 4.0_level_9_3 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + Designer + + + true + true + true + true + + + + + + + + Assets\Logo.png + + + Assets\SmallLogo.png + + + Assets\SplashScreen.png + + + Assets\StoreLogo.png + + + Assets\WideLogo.png + + + + + {f4776924-619c-42c7-88b2-82c947ccc9e7} + + + + + + + + + \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.vcxproj.filters b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..0cfb823aeafbeef9c38d4808a3c8e8851829fb26 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution.vcxproj.filters @@ -0,0 +1,75 @@ + + + + + 628a1e60-8c8e-4f88-96b0-c0285a8e0547 + + + 6d09c25a-79e5-42a3-bd04-4fcc0d3284f8 + bmp;dds;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + {2027bc94-b028-4ee7-81c6-618f290f0cb9} + + + {85016833-bba2-48ac-88c8-c3f082f38b38} + + + + + + + Common + + + Common + + + ATG Tool Kit + + + ATG Tool Kit + + + + + + + + Common + + + ATG Tool Kit + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Media + + + + + + + + + Media + + + + \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution_TemporaryKey.pfx b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..fed812c45362fca6659efc0ac8a5cb78e292df25 Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/PreemptiveExtendedExecution_TemporaryKey.pfx differ diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/pch.cpp b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..851c81be9b30ae3e8175fb950b95a1c9508580a3 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/pch.cpp @@ -0,0 +1,10 @@ +//-------------------------------------------------------------------------------------- +// pch.cpp +// +// Include the standard header and generate the precompiled header. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#include "pch.h" diff --git a/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/pch.h b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..2f0437db6268dc014750c40ec9ea9e377eb2dea6 --- /dev/null +++ b/Samples/System/ExtendedExecutionUWP/PreemptiveExtendedExecution/pch.h @@ -0,0 +1,67 @@ +//-------------------------------------------------------------------------------------- +// pch.h +// +// Header for standard system include files. +// +// Advanced Technology Group (ATG) +// Copyright (C) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#pragma once + +// Use the C++ standard templated min/max +#define NOMINMAX + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#ifdef _DEBUG +#include +#endif + +#include "DDSTextureLoader.h" +#include "GamePad.h" +#include "Keyboard.h" +#include "SpriteBatch.h" +#include "SpriteFont.h" + +namespace DX +{ + // Helper class for COM exceptions + class com_exception : public std::exception + { + public: + com_exception(HRESULT hr) : result(hr) {} + + virtual const char* what() const override + { + static char s_str[64] = { 0 }; + sprintf_s(s_str, "Failure with HRESULT of %08X", result); + return s_str; + } + + private: + HRESULT result; + }; + + // Helper utility converts D3D API failures into exceptions. + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + throw com_exception(hr); + } + } +} \ No newline at end of file diff --git a/Samples/System/ExtendedExecutionUWP/Readme.docx b/Samples/System/ExtendedExecutionUWP/Readme.docx new file mode 100644 index 0000000000000000000000000000000000000000..9b4ff1f022502df23dd6849ab206c629e7802ce3 Binary files /dev/null and b/Samples/System/ExtendedExecutionUWP/Readme.docx differ diff --git a/Samples/System/GamepadUWP/GamepadUWP.vcxproj b/Samples/System/GamepadUWP/GamepadUWP.vcxproj index 534cfea79f89cd26c0492ff3df6e7f876bac6618..cec75d70684c2dbd36be3f5969d22e60819d6688 100644 --- a/Samples/System/GamepadUWP/GamepadUWP.vcxproj +++ b/Samples/System/GamepadUWP/GamepadUWP.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/GamepadVibrationUWP/GamepadVibrationUWP.vcxproj b/Samples/System/GamepadVibrationUWP/GamepadVibrationUWP.vcxproj index 660cd6a7107084da2e2fd32e26ea79ff6ade592d..5fe980aa684cc5d9e143a7af854ab4c4272f86cf 100644 --- a/Samples/System/GamepadVibrationUWP/GamepadVibrationUWP.vcxproj +++ b/Samples/System/GamepadVibrationUWP/GamepadVibrationUWP.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/MemoryStatisticsUWP/MemoryStatistics.vcxproj b/Samples/System/MemoryStatisticsUWP/MemoryStatistics.vcxproj index d6a503efd9124f805c0032251bc24a393d39e514..c763b1f8a01a1d092391c835d634f9ecaac3208e 100644 --- a/Samples/System/MemoryStatisticsUWP/MemoryStatistics.vcxproj +++ b/Samples/System/MemoryStatisticsUWP/MemoryStatistics.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/MouseCursor/MouseCursor.vcxproj b/Samples/System/MouseCursor/MouseCursor.vcxproj index 75a94d985a70f40f55a8f0a13e5a213a8c8116a6..80c82d0ad59f301ea4c81394550a788a399245cb 100644 --- a/Samples/System/MouseCursor/MouseCursor.vcxproj +++ b/Samples/System/MouseCursor/MouseCursor.vcxproj @@ -37,7 +37,6 @@ 10.0 10.0.10586.0 10.0.10586.0 - true 100 diff --git a/Samples/System/NLSAndLocalizationUWP/NLSAndLocalizationUWP.vcxproj b/Samples/System/NLSAndLocalizationUWP/NLSAndLocalizationUWP.vcxproj index 38309b01d051c43568dcf4bf02621bccd862ed25..893a8bf1a3ccfd4445ed5a4a26fbd41c7c046334 100644 --- a/Samples/System/NLSAndLocalizationUWP/NLSAndLocalizationUWP.vcxproj +++ b/Samples/System/NLSAndLocalizationUWP/NLSAndLocalizationUWP.vcxproj @@ -41,7 +41,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/SimplePLM_UWP/SimplePLM.vcxproj b/Samples/System/SimplePLM_UWP/SimplePLM.vcxproj index d314cd113c414a74865ae3616ccf9c93b561cf0f..ac13bd08273ab2f6b48296921c794abc040455a3 100644 --- a/Samples/System/SimplePLM_UWP/SimplePLM.vcxproj +++ b/Samples/System/SimplePLM_UWP/SimplePLM.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true diff --git a/Samples/System/SystemInfoUWP/SystemInfo.vcxproj b/Samples/System/SystemInfoUWP/SystemInfo.vcxproj index 569a242c79e111fb270d67438bbb26bf73636c16..cdf8bca6b5568c01822d8a71e65edd3f7bc0d678 100644 --- a/Samples/System/SystemInfoUWP/SystemInfo.vcxproj +++ b/Samples/System/SystemInfoUWP/SystemInfo.vcxproj @@ -37,7 +37,6 @@ 10.0.10586.0 10.0.10240.0 10.0 - true