Quantcast
Channel: Games for Windows and the DirectX SDK
Viewing all 72 articles
Browse latest View live

Effects for Direct3D 11 Update

$
0
0

The Effects 11 library (FX11) was made available as shared-source in the DirectX SDK. Previous versions of the Effects library were part of D3DX (FX9) or built into the OS (FX10). With the DirectX SDK now legacy (see Where is the DirectX SDK?), there are still a number of people looking for the latest version since it is not included in the Windows 8.0 SDK. This post provides an updated version of the Effects 11 (FX11) library. The primary purpose of this release is to remove the dependencies on the legacy DirectX SDK for the D3DX11 headers, but it also includes some code tidying and a few customer requests.

Version 11.03

  • Removed the dependency on the D3DX11 headers, so FX11 no longer requires the legacy DirectX SDK to build. It does require the d3dcompiler.h header from either the Windows 8.0 SDK or from the legacy DirectX SDK
  • Removed references to D3D10 constants and interfaces
  • Deleted the d3dx11dbg.cpp and d3dx11dbg.h files
  • Deleted the D3DX11_EFFECT_PASS flags which were never implemented
  • General C++ code cleanups (nullptr, C++ style casting, stdint.h types, Safer CRT, etc.) which are compatible with Visual C++ 2010 and 2012
  • SAL2 annotation and /analyze cleanup
  • Added population of Direct3D debug names for object naming support in PIX and the SDK debug layer; added additional optional parameter to D3DX11CreateEffectFromMemory to provide a debug name
  • Added D3DX11CreateEffectFromFile, D3DX11CompileEffectFromMemory, and D3DX11CompileEffectFromFile

Version 11.04

  • Added IUnknown as a base class for all Effects 11 interfaces to simplify use in managed interop sceanrios, although the lifetime for these objects is still based on the lifetime of the parent ID3DX11Effect object. Therefore reference counting is ignored for these interfaces.
    • ID3DX11EffectType, ID3DX11EffectVariable and derived classes, ID3DX11EffectPass, ID3DX11EffectTechnique, and ID3DX11EffectGroup

Version 11.05

  • Cleaned up some warning level 4 warnings

Version 11.06

  • Added GetMatrixPointerArray, GetMatrixTransposePointerArray, SetMatrixPointerArray, SetMatrixTransposePointerArray methods
  • Reverted back to BOOL in some cases because sizeof(bool)==1, sizeof(BOOL)==4
  • Some code-cleanup: minor SAL fix, removed bad assert, and added use of override keyword

There are three Visual Studio solutions provided:

  • Visual Studio 2010 using the DirectX SDK (June 2010)
  • Visual Studio 2010 using the Windows 8.0 SDK via the 'v100-sdk80' Platform Toolset
  • Visual Studio 2012

If you still need Visual Studio 2008 support, you should keep using the legacy DirectX SDK (June 2010) version.

Disclaimer

Effects 11 is primarily being provided as a porting aid for older code that make use of the Effects 10 (FX10) API or Effects 9 (FX9) API in the deprecated D3DX9 library. See MSDN for a list of differences compared to the Effects 10 (FX10) library.

  • The Effects 11 library is for use in Win32 desktop applications. FX11 requires the D3DCompiler API be available at runtime to provide shader reflection functionality, and this API is not deployable for Windows Store apps on Windows 8 or Windows RT.
  • The fx_5_0 profile support in the HLSL compiler is deprecated, and does not fully support DirectX 11.1 HLSL features such as minimum precision types.  It is supported in the Windows 8.0 SDK version of the HLSL compiler (FXC.EXE) and D3DCompile API (#46), but could be removed in a future update.
  • The Visual Studio 2012 graphics diagnostics feature has had some problems when trying to debug fx_5_0 profile shaders. You may want to try the latest VS 2012 Update which is available as a prerelease.

Porting Tips

Here's a handy table of equivalents related to Effects:

D3DXCreateEffect
D3DXCreateEffectEx
D3DXCreateEffectFromResource
D3DXCreateEffectFromResourceEx
D3D10CompileEffectFromMemory

D3DX11CompileEffectFromMemory

D3DXCreateEffectFromFile
D3DXCreateEffectFromFileEx

D3DX11CompileEffectFromFile

D3D10CreateEffectFromMemory

D3DX11CreateEffectFromMemory

D3DXCreateEffectPool
D3D10CreateEffectPoolFromMemory

Effects 11 does not support 'effect pools'
or D3DCOMPILE_EFFECT_CHILD_EFFECT. Effect groups provide a more efficient solution for common scenarios previously addressed with 'effect pools'

D3DXDisassembleEffect
D3D10DisassembleEffect

D3DDisassemble
D3DDisassemble10Effect in D3DCompile

Release History

This version is marked with a preprocessor define D3DX11_EFFECTS_VERSION as “1106” to indicate a release version in the shared source library.

The initial release of Effects 11 (FX11) was in DirectX SDK (August 2009).

An update was shipped with the DirectX SDK (February 2010). This fixed a problem with the library which prevented it from working correctly on 9.x and 10.x feature levels.

The most recent previous release was in the DirectX SDK (June 2010) with some minor additional bug fixes. This also included the Effects 11-based sample DynamicShaderLinkageFX11.

Version 11.03 was the first 'blog' release (changes noted above) was released on October 24, 2012.

Version 11.04 was released on November 6, 2012.

Version 11.05 was released on February 22, 2013

Version 11.06 was released on June 13, 2013

License

The source code attached to this blog post is bound to the Microsoft Public License (MS-PL).


BUILD 2012 Conference

$
0
0

DirectXTex Update

$
0
0

The DirectX Texture library (aka DirectXTex) for Direct3D 11 (originally released on this blog and made an official CodePlex project) has continued to improve. It’s been a busy month of work, but with this release I’ve hit a milestone of sorts so I’m declaring this DirectXTex “Version 1.1”. This release includes custom filtering implementations to fully finish out the feature set, and as of this release all the functionality that was in D3DX11 for texture processing is now available in DirectXTex. Resizing and mipmap generation has been updated to avoid a number of known issues with the Windows Imaging Component (WIC) including proper HDR/XR format handling, sRGB gamma correct filtering and conversion behavior, mirror/wrap texture address mode filtering semantics, and implements the finite low-pass triangle filter that was available in D3DX. Volume map mipmap generation now supports all filtering modes and supports non-power-of-2 volume maps.

The DirectXTex package also include a new command-line utility for creating volume maps, cube maps, and texture arrays (texassemble). It loads each of the image files provided, performs any required resizing and format conversion to get them all to match, and outputs a .DDS files containing the new complex resource. This tool does not perform texture compression or mipmap generation, but the .DDS output file is suitable for use with texconv to do these operations. For convenience it will expand texture compressed .DDS files used as input files, but will exit with an error if given a complex .DDS file as input.

The latest release is available on Codeplex. The documentation on Codeplex has also been updated.

June 15, 2013

  • Custom filtering implementation for Resize & GenerateMipMaps(3D) - Point, Box, Linear, Cubic, and Triangle
    • TEX_FILTER_TRIANGLE finite low-pass triangle filter
    • TEX_FILTER_WRAP, TEX_FILTER_MIRROR texture semantics for custom filtering
    • TEX_FILTER_BOX alias for TEX_FILTER_FANT WIC
  • Ordered and error diffusion dithering for non-WIC conversion
  • sRGB gamma correct custom filtering and conversion
  • DDS_FLAGS_EXPAND_LUMINANCE - Reader conversion option for L8, L16, and A8L8 legacy DDS files
  • Added use of WIC metadata for sRGB pixel formats
  • Added BitsPerColor utility function
  • Fixed Convert threshold parameter usage
  • Non-power-of-2 volume map support, fixed bug with non-square volume maps
  • Texconv utility update with -xlum, -wrap, and -mirror options; reworked -if options for improved dithering
  • Texassemble utility for creating cubemaps, volume maps, and texture arrays
  • DDSTextureLoader and WICTextureLoader sync'd with DirectXTK versions

Visual Studio 2012 Update 3

$
0
0

An update to Visual Studio 2012 is now available for download.  For full details, see Somasegar's blog.

This update includes a fix to a regression that was introduced in Update 2 when using ATL on Windows XP.

See KB 2835600

Compiler and CRT

VS 2012 Update 3 includes a new verison of the compiler (17.00.60610.1) and the C/C++ Runtime (11.0.60610.1).

MSDN Downloads has the updated retail redistribution packages.

 

Related:Update 1, Update 2

BUILD 2013 Conference

$
0
0

Where is the DirectX SDK (2013 Edition)?

$
0
0

At BUILD 2013 last week, Microsoft released the Windows 8.1 Preview, Visual Studio 2013 Preview, and the Windows SDK for Windows 8.1 Preview (included in the VS 2013 Preview).

As with the Windows 8.0 SDK, the Windows 8.1 SDK is where you’ll find Direct3D 11.2, Direct2D 1.2, DXGI 1.3, DirectXMath 3.05, a new HLSL complier (#47), and some updates to WIC.

Note that there is no D3D_FEATURE_LEVEL_11_2 hardware feature level defined as of yet. New hardware features exposed by DirectX 11.2 are optional.

The 18.0 C++ compiler in the Visual Studio 2013 Preview includes support for a new __vectorcall x86 and x64 calling-convention, and DirectXMath 3.05 has been updated to take advantage of it. I refreshed XDSP and SHmath to integrate smoothly with this new version. The 18.0 C++ compiler supports additional C++11 and Standard Library/STL/C99 Library features as well. See the Visual C++ Team blog, Somasegar’s blog, and the Visual Studio blog. Remote Debugging Tools packages are also available.

You’ll find VS 2013 Preview projects for DirectXTex and DirectXTK on their respective Codeplex sites. There is a Windows Store app for Windows 8.1 Preview version of DirectXTK Simple Sample available on MSDN Code Gallery.

For developers and publishers of Windows Desktop PC games, be sure to review the Desktop Games on Windows 8.x recommendations, the latest Windows and Windows Server compatibility cookbook, and pay particular attention to the new appcompat behavior of the GetVersion(Ex) API—which you aren’t using, right?

_WIN32_WINNT: When building an application that is 'down-level' using headers in the Windows 8.1 SDK, be sure to explicitly select the correct 'minimum' _WIN32_WINNT value. VS 2013 Preview and the Windows 8.1 SDK default to 0x0603. For Windows 8 compatibility, use 0x0602; for Windows 7 use 0x0601; and for Windows Vista use 0x0600. Typically this is done as part of the project configuration via Preprocessor Definitions. See Using the Windows Headers for more information.

Developer Runtime: The Windows 8.1 SDK (also included with Visual Studio 2013 Preview) is where you obtain the latest Developer Runtime that is compatible with the Windows 8.1 Preview.

Windows Store app developers: Be sure to review the Migration Guide and how to Retarget to Windows 8.1 Preview.

System requirements: The Windows 8.1 Preview will run on the majority of hardware that can run Windows 8. The 64-bit version does require CPU support for some additional instructions which are not present on early first-generation 64-bit processors. See the Windows 8.1 Preview FAQ for details.

The Visual Studio 2013 Preview can be installed on Windows 8.1, Windows 8, and Windows 7 Service Pack 1. For Windows 7 SP1, installing KB 2670838 is required as part of the setup.

Related:Where is the DirectX SDK?,DirectX SDKs of a certain age

 

DirectXTex and Effects 11 Update

$
0
0

DirectXTex

It has been a busy summer which has resulted in "version 1.2" of the DirectXTex texture processing library. The focus of this release has been on improving Block Compression support. The biggest new feature is the integration of the DirectCompute 4.0 accelerated BC6H / BC7 texture compression codecs from the BC6HBC7EncoderCS sample. The latest texconv command-line tool will attempt to use the DirectCompute version when compressing for BC6H / BC7 when running on a system with a DirectCompute 4.0 capable hardware device (aka a Feature Level 10.0 or 10.1 video card with the optional DirectCompute feature or a Feature Level 11.x video card). This is a huge increase in performance compared to the original D3DX11 BC6H / BC7 software codecs.

For example, on my primary development system a 8K by 4K texture with mips took 25 minutes to compress using the multithreaded version of the D3DX11 BC6H / BC7 software codec across six hyper threaded CPU cores, which only took about 2.5 minutes using DirectCompute 4.0. I gave up on timing the single-threaded D3DX11 BC6H / BC7 software codec after an hour.

Note: 2.5 minutes is still a significant compress time for a single texture so future work here will focus on implementing a new faster algorithm using DirectCompute 5.0.

The latest release is available on Codeplex. The documentation on Codeplex has also been updated.

August 13, 2013

  • DirectCompute 4.0 BC6H/BC7 compressor integration
  • texconv utility uses DirectCompute compression by default for BC6H/BC7, -nogpu disables use of DirectCompute

August 1, 2013

  • Support for BC compression/decompression of non-power-of-2 mipmapped textures
  • Fixes for BC6H / BC7 codecs to better match published standard
  • Fix for BC4 / BC5 codecs when compressing RGB images
  • Minor fix for the BC1-3 codec
  • New optional flags for ComputeMSE to compare UNORM vs. SNORM images
  • New WIC loading flag added to control use of WIC metadata to return sRGB vs. non-sRGB formats
  • Code cleanup and /analyze fixes
  • Project file cleanup
  • Texconv utility uses parallel BC compression by default for BC6H/BC7, -singleproc disables multithreaded behavior

July 1, 2013

  • VS 2013 Preview projects added
  • SaveToWIC functions updated with new optional setCustomProps parameter

Related:DirectXTex Update (June 2013)DirectXTex (October 2011)

 

Effects11

In other news, the Effects 11 library now has a home on Codeplex. Be sure to read my original Effects for Direct3D 11 Update post for details on this library.

July 16, 2013 (11.07)

  • Added VS 2013 Preview project files
  • Cleaned up project files
  • Fixed a number of /analyze issues

June 13, 2013 (11.06)

  • Added GetMatrixPointerArray, GetMatrixTransposePointerArray, SetMatrixPointerArray, SetMatrixTransposePointerArray methods
  • Reverted back to BOOL in some cases because sizeof(bool)==1, sizeof(BOOL)==4
  • Some code-cleanup: minor SAL fix, removed bad assert, and added use of override keyword

February 22, 2013 (11.05)

  • Cleaned up some warning level 4 warnings

November 6, 2012 (11.04)

  • Added IUnknown as a base class for all Effects 11 interfaces to simplify use in managed interop scenarios, although the lifetime for these objects is still based on the lifetime of the parent ID3DX11Effect object. Therefore reference counting is ignored for these interfaces.
    • ID3DX11EffectType, ID3DX11EffectVariable and derived classes, ID3DX11EffectPass, ID3DX11EffectTechnique, and ID3DX11EffectGroup

 

Living without D3DX

$
0
0

Over the past few years, I've been working on a number of projects in part motivated by the need to replace legacy D3DX functionality. As noted on MSDN, all versions of D3DX are deprecated and are not shipped with the Windows 8.x SDK. This includes D3DX9, D3DX10, and D3DX11. There are plenty of options for moving existing code over to newer, more supportable solutions most of which are now shared-source.

I've built a number of porting notes tables for each of these topics, and then realized today I don't have a single place to see it all. So here it is, the "D3DX porting mega-table" for Direct3D 11.

Related:Where is the DirectX SDK?, Where is the DirectX SDK (2013 Edition)?, DirectX SDKs of a certain age

General Helpers

The DirectX Tool Kit provides a number of helpers that are designed to simplify Direct3D 11 programming in the tradition of the original D3DX library. You can find the library on CodePlex.

ID3DX10Sprite

SpriteBatch

ID3DX10Font

SpriteFont, SpriteBatch

ID3DX10Mesh

Model, ModelMesh, ModelMeshPart

D3DXCreateBox
D3DXCreateCylinder
D3DXCreateSphere
D3DXCreateTeapot
D3DXCreateTorus

GeometricPrimitive

D3DX11CreateShaderResourceViewFromFile

CreateXXXTextureFromFile

D3DX11CreateShaderResourceViewFromResource
D3DX11CreateShaderResourceViewFromMemory

CreateXXXTextureFromMemory

D3DX11CreateTextureFromFile

CreateXXXTextureFromFile

D3DX11CreateTextureFromResource
D3DX11CreateTextureFromMemory

CreateXXXTextureFromMemory

D3DX11SaveTextureToFile

SaveXXXTextureToFile

HLSL Functions

The HLSL compiler, shader reflection API, and related functionality has been broken out into it's own D3DCompile DLL for some time. D3DCompile is in the Windows 8.x SDK and is included with VS 2012 and VS 2013 Preview.

D3DXCompileShaderFromFile
D3DX10CompileFromFile
D3DX11CompileFromFile
D3DCompileFromFile
D3DXCompileShader
D3D10CompileShader
D3DX10CompileFromMemory
D3DX11CompileFromMemory
D3DCompile
D3DXCompileShaderFromResource
D3DX10CompileFromResource
D3DX11CompileFromResource
No direct equivalent. Can use resource APIs and then D3DCompile above.
D3DXPreprocessShader
D3DXPreprocessShaderFromFile
D3DXPreprocessShaderFromResource
D3D10PreprocessShader
D3DX10PreprocessShaderFromFile
D3DX10PreprocessShaderFromMemory
D3DX10PreprocessShaderFromResource
D3DX11PreprocessShaderFromFile
D3DX11PreprocessShaderFromMemory
D3DX11PreprocessShaderFromResource
D3DPreprocess
D3DXDisassembleShader
D3D10DisassembleShader
D3DX10DisassembleShader
D3DDisassemble
D3D10ReflectShader
D3DX10ReflectShader
D3DReflect
D3D11Reflect
ID3DXBuffer
ID3D10Blob
ID3DBlob
D3DXCreateBuffer
D3D10CreateBlob
D3DCreateBlob
D3D10GetInputSignatureBlob
D3D10GetOutputSignatureBlob
D3D10GetInputAndOutputSignatureBlob
D3D10GetShaderDebugInfo
D3DGetBlobPart

Texture Functions

The DirectXTex library is primarily intended for texture processing offline with tools, although it can also be used at runtime for doing texture block compression, mipmap generation, or handling more general image processing needs. DirectXTK is intended for use at runtime with light-weight helpers and image loaders, but does not provide support for general runtime texture format conversion. You can find both libraries on CodePlex.

D3DX11ComputeNormalMap

DirectXTex library, ComputeNormalMap

D3DX11CreateShaderResourceViewFromFile
D3DX11CreateTextureFromFile

DDSTextureLoader: CreateDDSTextureFromFile
WICTextureLoader: CreateWICTextureFromFile

DirectXTex library (tools), LoadFromXXXFile then CreateShaderResourceView or CreateTexture

D3DX11CreateShaderResourceViewFromMemory
D3DX11CreateTextureFromMemory

DDSTextureLoader: CreateDDSTextureFromMemory
WICTextureLoader: CreateWICTextureFromMemory

DirectXTex library (tools), LoadFromXXXMemory then CreateShaderResourceView or CreateTexture

D3DX11CreateShaderResourceViewFromResource
D3DX11CreateTextureFromResource

No direct equivalent, can use Win32 resource functions and then the ‘from memory’ APIs above.

D3DX11FilterTexture

DirectXTex library, GenerateMipMaps and GenerateMipMaps3D

D3DX11GetImageInfoFromFile

DirectXTex library, GetMetadataFromXXXFile

D3DX11GetImageInfoFromMemory

DirectXTex library, GetMetadataFromXXXMemory

D3DX11GetImageInfoFromResource

No direct equivalent, can use Win32 resource functions and then the ‘from memory’ APIs above.

D3DX11LoadTextureFromTexture

DirectXTex library, Resize, Convert, Compress, Decompress, and/or CopyRectangle

D3DX11SaveTextureToFile

ScreenGrab: SaveDDSTextureToFile or SaveWICTextureToFile

DirectXTex library, CaptureTexture then SaveToXXXFile

D3DX11SaveTextureToMemory

DirectXTex library, CaptureTexture then SaveToXXXMemory

Math

The legacy D3DXMath library has been replaced by DirectXMath. The library is in the Windows 8.x SDK and is included with VS 2012 and VS 2013 Preview.

D3DXFLOAT16HALF
D3DXMATRIXA16XMMATRIX or XMFLOAT4X4A

D3DXQUATERNION

D3DXPLANE

D3DXCOLOR

XMVECTOR is used rather than having unique types, so you will likely need to use an XMFLOAT4
D3DXVECTOR2XMFLOAT2
D3DXVECTOR2_16FXMHALF2
D3DXVECTOR3XMFLOAT3
D3DXVECTOR4XMFLOAT4

(or if you can guarantee the data is 16-byte aligned, XMVECTOR or XMFLOAT4A )

D3DXVECTOR4_16FXMHALF4
D3DX_PIXM_PI
D3DX_1BYPIXM_1DIVPI
D3DXToRadianXMConvertToRadians
D3DXToDegreeXMConvertToDegrees
D3DXBoxBoundProbeBoundingBox::Intersects(XMVECTOR, XMVECTOR, float&)
D3DXComputeBoundingBoxBoundingBox::CreateFromPoints
D3DXComputeBoundingSphereBoundingSphere::CreateFromPoints
D3DXSphereBoundProbeBoundingSphere::Intersects(XMVECTOR, XMVECTOR, float&)
D3DXIntersectTriFunctionTriangleTests::Intersects
D3DXFloat32To16ArrayXMConvertFloatToHalfStream
D3DXFloat16To32ArrayXMConvertHalfToFloatStream
D3DXVec2LengthXMVector2Length or XMVector2LengthEst
D3DXVec2LengthSqXMVector2LengthSq
D3DXVec2DotXMVector2Dot
D3DXVec2CCWXMVector2Cross
D3DXVec2AddXMVectorAdd
D3DXVec2SubtractXMVectorSubtract
D3DXVec2MinimizeXMVectorMin
D3DXVec2MaximizeXMVectorMax
D3DXVec2ScaleXMVectorScale
D3DXVec2LerpXMVectorLerp or XMVectorLerpV
D3DXVec2NormalizeXMVector2Normalize or XMVector2NormalizeEst
D3DXVec2HermiteXMVectorHermite or XMVectorHermiteV
D3DXVec2CatmullRomXMVectorCatmullRom or XMVectorCatmullRomV
D3DXVec2BaryCentricXMVectorBaryCentric or XMVectorBaryCentricV
D3DXVec2TransformXMVector2Transform
D3DXVec2TransformCoordXMVector2TransformCoord
D3DXVec2TransformNormalXMVector2TransformNormal
D3DXVec2TransformArrayXMVector2TransformStream
D3DXVec2TransformCoordArrayXMVector2TransformCoordStream
D3DXVec2TransformNormalArrayXMVector2TransformNormalStream
D3DXVec3LengthXMVector3Length or XMVector3LengthEst
D3DXVec3LengthSqXMVector3LengthSq
D3DXVec3DotXMVector3Dot
D3DXVec3CrossXMVector3Cross
D3DXVec3AddXMVectorAdd
D3DXVec3SubtractXMVectorSubtract
D3DXVec3MinimizeXMVectorMin
D3DXVec3MaximizeXMVectorMax
D3DXVec3ScaleXMVectorScale
D3DXVec3LerpXMVectorLerp or XMVectorLerpV
D3DXVec3NormalizeXMVector3Normalize or XMVector3NormalizeEst
D3DXVec3HermiteXMVectorHermite or XMVectorHermiteV
D3DXVec3CatmullRomXMVectorCatmullRom or XMVectorCatmullRomV
D3DXVec3BaryCentricXMVectorBaryCentric or XMVectorBaryCentricV
D3DXVec3TransformXMVector3Transform
D3DXVec3TransformCoordXMVector3TransformCoord
D3DXVec3TransformNormalXMVector3TransformNormal
D3DXVec3TransformArrayXMVector3TransformStream
D3DXVec3TransformCoordArrayXMVector3TransformCoordStream
D3DXVec3TransformNormalArrayXMVector3TransformNormalStream
D3DXVec3ProjectXMVector3Project
D3DXVec3UnprojectXMVector3Unproject
D3DXVec3ProjectArrayXMVector3ProjectStream
D3DXVec3UnprojectArrayXMVector3UnprojectStream
D3DXVec4LengthXMVector4Length or XMVector4LengthEst
D3DXVec4LengthSqXMVector4LengthSq
D3DXVec4DotXMVector4Dot
D3DXVec4AddXMVectorAdd
D3DXVec4SubtractXMVectorSubtract
D3DXVec4MinimizeXMVectorMin
D3DXVec4MaximizeXMVectorMax
D3DXVec4ScaleXMVectorScale
D3DXVec4LerpXMVectorLerp or XMVectorLerpV
D3DXVec4CrossXMVector4Cross
D3DXVec4NormalizeXMVector4Normalize or XMVector4NormalizeEst
D3DXVec4HermiteXMVectorHermite or XMVectorHermiteV
D3DXVec4CatmullRomXMVectorCatmullRom or XMVectorCatmullRomV
D3DXVec4BaryCentricXMVectorBaryCentric or XMVectorBaryCentricV
D3DXVec4TransformXMVector4Transform
D3DXVec4TransformArrayXMVector4TransformStream
D3DXMatrixIdentityXMMatrixIdentity
D3DXMatrixDeterminantXMMatrixDeterminant
D3DXMatrixDecomposeXMMatrixDecompose
D3DXMatrixTransposeXMMatrixTranspose
D3DXMatrixMultiplyXMMatrixMultiply
D3DXMatrixMultiplyTransposeXMMatrixMultiplyTranspose
D3DXMatrixInverseXMMatrixInverse
D3DXMatrixScalingXMMatrixScaling
D3DXMatrixTranslationXMMatrixTranslation
D3DXMatrixRotationXXMMatrixRotationX
D3DXMatrixRotationYXMMatrixRotationY
D3DXMatrixRotationZXMMatrixRotationZ
D3DXMatrixRotationAxisXMMatrixRotationAxis
D3DXMatrixRotationQuaternionXMMatrixRotationQuaternion
D3DXMatrixRotationYawPitchRollXMMatrixRotationRollPitchYaw
(Note the order of parameters is different:
D3DXMath takes yaw, pitch, roll,
DirectXMath takes pitch, yaw, roll)
D3DXMatrixTransformationXMMatrixTransformation
D3DXMatrixTransformation2DXMMatrixTransformation2D
D3DXMatrixAffineTransformationXMMatrixAffineTransformation
D3DXMatrixAffineTransformation2DXMMatrixAffineTransformation2D
D3DXMatrixLookAtRHXMMatrixLookAtRH
D3DXMatrixLookAtLHXMMatrixLookAtLH
D3DXMatrixPerspectiveRHXMMatrixPerspectiveRH
D3DXMatrixPerspectiveLHXMMatrixPerspectiveLH
D3DXMatrixPerspectiveFovRHXMMatrixPerspectiveFovRH
D3DXMatrixPerspectiveFovLHXMMatrixPerspectiveFovLH
D3DXMatrixPerspectiveOffCenterRHXMMatrixPerspectiveOffCenterRH
D3DXMatrixPerspectiveOffCenterLHXMMatrixPerspectiveOffCenterLH
D3DXMatrixOrthoRHXMMatrixOrthographicRH
D3DXMatrixOrthoLHXMMatrixOrthographicLH
D3DXMatrixOrthoOffCenterRHXMMatrixOrthographicOffCenterRH
D3DXMatrixOrthoOffCenterLHXMMatrixOrthographicOffCenterLH
D3DXMatrixShadowXMMatrixShadow
D3DXMatrixReflectXMMatrixReflect
D3DXQuaternionLengthXMQuaternionLength
D3DXQuaternionLengthSqXMQuaternionLengthSq
D3DXQuaternionDotXMQuaternionDot
D3DXQuaternionIdentityXMQuaternionIdentity
D3DXQuaternionIsIdentityXMQuaternionIsIdentity
D3DXQuaternionConjugateXMQuaternionConjugate
D3DXQuaternionToAxisAngleXMQuaternionToAxisAngle
D3DXQuaternionRotationMatrixXMQuaternionRotationMatrix
D3DXQuaternionRotationAxisXMQuaternionRotationAxis
D3DXQuaternionRotationYawPitchRollXMQuaternionRotationRollPitchYaw
(Note the order of parameters is different:
D3DXMath takes yaw, pitch, roll,
DirectXMath takes pitch, yaw, roll)
D3DXQuaternionMultiplyXMQuaternionMultiply
D3DXQuaternionNormalizeXMQuaternionNormalize or XMQuaternionNormalizeEst
D3DXQuaternionInverseXMQuaternionInverse
D3DXQuaternionLnXMQuaternionLn
D3DXQuaternionExpXMQuaternionExp
D3DXQuaternionSlerpXMQuaternionSlerp or XMQuaternionSlerpV
D3DXQuaternionSquadXMQuaternionSquad or XMQuaternionSquadV
D3DXQuaternionSquadSetupXMQuaternionSquadSetup
D3DXQuaternionBaryCentricXMQuaternionBaryCentric or XMQuaternionBaryCentricV
D3DXPlaneDotXMPlaneDot
D3DXPlaneDotCoordXMPlaneDotCoord
D3DXPlaneDotNormalXMPlaneDotNormal
D3DXPlaneScaleXMVectorScale
D3DXPlaneNormalizeXMPlaneNormalize or XMPlaneNormalizeEst
D3DXPlaneIntersectLineXMPlaneIntersectLine
D3DXPlaneFromPointNormalXMPlaneFromPointNormal
D3DXPlaneFromPointsXMPlaneFromPoints
D3DXPlaneTransformXMPlaneTransform
D3DXPlaneTransformArrayXMPlaneTransformStream
D3DXColorNegativeXMColorNegative
D3DXColorAddXMVectorAdd
D3DXColorSubtractXMVectorSubtract
D3DXColorScaleXMVectorScale
D3DXColorModulateXMColorModulate
D3DXColorLerpXMVectorLerp or XMVectorLerpV
D3DXColorAdjustSaturationXMColorAdjustSaturation
D3DXColorAdjustContrastXMColorAdjustContrast
D3DXFresnelTermXMFresnelTerm

Spherical Harmonics Math

The SHmath library is available as an add-on for DirectXMath.

XMSHEvalDirectionEvaluates the Spherical Harmonic basis functions. Equivalent to D3DXSHEvalDirection function.
XMSHRotateRotates SH vector by a rotation matrix. Equivalent to the D3DXSHRotate function.
XMSHRotateZRotates the SH vector in the Z axis by an angle. Equivalent to the D3DXSHRotateZ function.
XMSHAddAdds two SH vectors. Equivalent to the D3DXSHAdd function.
XMSHScaleScales a SH vector. Equivalent to the D3DXSHScale function.
XMSHDotComputes the dot product of two SH vectors. Equivalent to the D3DXSHDot function.
XMSHMultiply
XMSHMultiply2
XMSHMultiply3
XMSHMultiply4
XMSHMultiply5
XMSHMultiply6
Computes the product of two functions represented using SH. Equivalent to D3DXSHMultiply2, D3DXSHMultiply3, D3DXSHMultiply4, D3DXSHMultiply5, and D3DXSHMultiply6.
XMSHEvalDirectionalLightEvaluates a directional light and returns spectral SH data. Equivalent to the D3DXSHEvalDirectionalLight function.
XMSHEvalSphericalLightEvaluates a spherical light and returns spectral SH data. Equivalent to the D3DXEvalSphericalLight function.
XMSHEvalConeLightEvaluates a light that is a cone of constant intensity and returns spectral SH data. Equivalent to the D3DXSHEvalConeLight function.
XMSHEvalHemisphereLightEvaluates a light that is a linear interpolant between two colors over the sphere. Equivalent to the D3DXSHEvalHemisphereLight function.
SHProjectCubeMapProjects a function represented in a cube map into spherical harmonics. Equivalent to the D3DX11SHProjectCubeMap function.

Effects (FX)

The Effects system for Direct3D 11 is primarily provided as a porting aid for older code. The library is available on CodePlex.

D3DXCreateEffect
D3DXCreateEffectEx
D3DXCreateEffectFromResource
D3DXCreateEffectFromResourceEx
D3D10CompileEffectFromMemory

D3DX11CompileEffectFromMemory

D3DXCreateEffectFromFile
D3DXCreateEffectFromFileEx

D3DX11CompileEffectFromFile

D3D10CreateEffectFromMemory

D3DX11CreateEffectFromMemory

D3DXCreateEffectPool
D3D10CreateEffectPoolFromMemory

Effects 11 does not support 'effect pools'
or D3DCOMPILE_EFFECT_CHILD_EFFECT. Effect groups provide a more efficient solution for common scenarios previously addressed with 'effect pools'

D3DXDisassembleEffect
D3D10DisassembleEffect

D3DDisassemble
D3DDisassemble10Effect in D3DCompile

Performance/Profiling

D3DX9 included the entry-points intercepted by PIX for Windows for performance profiling. This is now handled by the DirectX runtime directly and is monitored by the Visual Studio Graphics Diagnostics tool.

D3DPERF_BeginEvent
D3DPERF_EndEvent
D3DPERF_SetMarker
D3DPERF_SetRegion
D3DPERF_QueryRepeatFrame
D3DPERF_SetOptions
D3DPERF_GetStatus

ID3DUserDefinedAnnotation which is supported by the DirectX 11.1 runtime on Windows 8.x and Windows 7 Service Pack 1 + KB2670838

Note

Careful readers will note that there are a few omissions from this table.

  • The ID3DXMatrixStack from D3DXMath doesn't have a new version, but it's actually pretty easy to implement your own. If someone has a burning need for this, please comment below.
  • The Precomputed Radiance Transfer (PRT) simulator is only available in closed-source form in legacy D3DX9. There are a number of papers that cover this technology in the literature, and the most generally useful parts of this functionality are the SHmath functions which are available.
  • UVAtlas is only available in closed-source form in legacy D3DX9. Again, this technology is covered in the literature.
  • Geometry processing is the biggest missing area of functionality, particularly the operations for computing tangent frames, optimizing vertex and index buffers, and generating adjacency information. These are part of the 'Future Work' proposal project DirectXMesh.

Visual Studio 2013 Release Candidate

$
0
0

The Visual Studio 2013 Release Candidate is now available. The VC 2013 RC Redistribution packages are also available (x86, x64, ARM), as well as the Remote Debugging Tools (x86, x64).

VS 2013 RC includes the Windows 8.1 SDK. As with VS 2012 / Windows 8.0 SDK, this release integrates many aspects of the legacy DirectX SDK. As discussed in Where is the DirectX SDK (2013 Edition)?, there's new support for Direct3D 11.2, Direct2D 1.2, DXGI 1.3, HLSL Compiler #47, updates to WIC, and many new 18.0 C++ compiler features. The Windows 8.1 SDK included in VS 2013 RC also includes DirectXMath 3.06 with a few minor changes compared to 3.05 in the Preview (see MSDN and this post). For more information on VS 2013 RC, see the Visual C++ Team blog, Somasegar's blog, and the Visual Studio blog.

For a comparison summary of new C++11 language features in VS 2013, take a look at the tables in the Dual-use Coding Techniques for Games post which have been refreshed for the latest toolset.

Windows 8.1: In related news, the Windows 8.1 RTM is now available on MSDN/TechNet for subscribers, with GA set for October 18, 2013. If you are developing Win32 desktop games, be sure to review the official appcompat cookbook and this post.

For developers working on Windows Store apps, see New APIs and features for developers and the Migration Guide from Windows 8. If you do not have access to the Windows 8.1 RTM build via a MSDN or TechNet subscription, you should continue to use VS 2013 Preview to develop and test Windows Store apps for Windows 8.1 Preview until GA.

Manifest Madness

$
0
0

This blog post discusses Application Manifest elements for use in Win32 desktop applications. This is not about the App package manifest (aka AppX) used for Windows Store apps for Windows 8.x.

User Account Control

Back when Windows Vista launched and the User Account Control feature was first introduced, there was one key recommendation for game developer writing PC games: your game should not require administrator rights to run, and you should add the proper embedded manifest to the game EXE so Windows Vista could tell the game was updated for the new OS. With Visual Studio 2005, this was done by turning on some settings for the Linker (Generate Manifest File: Yes) and Manifest Tool (Embed Manifest: Yes) and then setting the “Additional Manifests” field to point to a text file that contained:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="asInvoker" uiAccess="false" />
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
</assembly>

With Visual Studio 2008 and later, the project settings dialog offered direct support for this under Linker \ Manifest File – “Enable User Account Control (UAC)” and “UAC Execution Level”. This guidance still fully applies to Windows 7, Windows 8 and Windows 8.1. See User Account Control for Game Developers for more details on UAC and related implications. 

High-DPI

Windows Vista also introduced another feature, “High-DPI” which scaled the UI by a factor of 125% or 150% but was off by default. With Windows 7 this was enabled by default depending on the EDID native DPI information so the recommendation is for all Direct3D full-screen applications to declare themselves “High-DPI Aware”. Again, this is done via another manifest element. With Visual Studio 2005 and VS 2008, you add an “Additional Manifests” file reference to a text file containing:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

With Visual Studio 2010 and 2012, the project settings dialog offers the choice of “Enable DPI Awareness” set to “No” or “Yes”. See Writing High-DPI Win32 applications for more information.

Note the value in the <dpiAware> element is not case-sensitive, so you'll see it as both “true” and “True” in articles and samples.

Program Compatibility Assistant (PCA)

With Windows Vista, just having the UAC elements was enough to know that the application had been updated for Windows Vista. If no UAC manifest element was found, Windows Vista enabled the Program Compatibly Assistant (PCA) which could check for common failures and resolve them.

Windows 7 needed a new way to detect if the EXE really understood Windows 7 to avoid any use of the PCA, and UAC manifest elements alone wasn't sufficient. The solution was... (drum roll, please): more manifest elements! You again add an “Additional Manifests” file reference to a text file containing:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
</assembly>

Windows 8 also used the same mechanism with a new GUID to indicate Windows 8 support.

<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>

For most programs, the PCA behavior impact wasn't really noticeable, so the <compatibility> section was mostly ignored by developers. This, by the way, is what determines the column “Operating System Context” in the Windows 7 or Windows 8 Resource Monitor (resmon) which defaults to “Windows Vista” if there's no <compatibly> manifest elements. On Windows 8.x, you can also see “Operating System Context” as a column in the Task Manager (taskmgr).

Windows 8.1

Windows 8.1 has two important changes to this guidance. First, without the Windows 8.1 GUID in the <compatibility> section, GetVersion(Ex) APIs will always return “6.2” and not “6.3”. The default behavior improves appcompat for the vast majority of applications, but it could cause problems for custom OS-version telemetry, support tools, and potentially 3rd party DRM solutions. Adding the latest GUID to the manifest causes the process to get “6.3” when running on Windows 8.1:

<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>

See Windows 8.1 Preview and Windows Server 2012 R2 Preview AppCompat Cookbook for more details, as well as Certification requirements for Windows desktop apps. As I've recommended in the past, you really shouldn't be using GetVersion(Ex) APIs at all except perhaps in very specialized cases, and there are better ways to handle 'minimum supported OS' checks (See What's in a version number?)--the Windows 8.1 SDK also offers a set of helpers in VersionHelpers.h that are useful for such checks.

Windows 8.1 also includes enhancements to High-DPI support including per-monitor scaling, 200% scaling, and improved UI behavior. This has necessitated two additional settings for the <dpiaware> manifest value: “Per Monitor” means the application is Per-Monitor DPI-Aware on Windows 8.1. There is also a “True/PM” setting which is both “Per Monitor DPI-Aware” on Windows 8.1, and “System DPI-Aware” on Windows Vista / Windows 7 / Windows 8-- Per Monitor” by itself is interpreted the same as setting “false” down-level. The recommended High-DPI manifest elements for Direct3D full-screen applications is now:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

Visual Studio 2010 and 2012 do not offer the new “Per Monitor” or “True/PM” settings, so you will need to go back to using “Additional Manifests” and set the “Enable DPI Awareness” project setting to “No”.

See Writing DPI-Aware Desktop Applications in Windows 8.1 Preview.

Related: Desktop Games on Windows 8.x

DXUT for Win32 Desktop Update

$
0
0

With the deprecation of the DirectX SDK (see Where is the DirectX SDK? and Where is the DirectX SDK (2013 Edition)?), there’s been a lot of guidance both on this blog and on MSDN on moving to newer, supported solutions. As a number of folks have noticed, DXUT (aka the DirectX SDK samples framework) is not included in the Windows 8.x SDK.  This post provides an updated version of DXUT for Direct3D 11. The primary purpose of this release is to remove dependencies on the DirectX SDK for D3DX9, D3DX11, and DXERR. It also includes some code tidying and a few customer requests.

  • The DXUT framework is for use in Win32 desktop applications. It not usable for Windows Store apps on Windows 8.x or Windows RT.
  • This version of DXUT only supports Direct3D 11, and therefore is not compatible with Windows XP or early versions of Windows Vista.
  • It supports Windows 8.x Win32 desktop, Windows 7, Windows Vista Service Pack 2 with KB 971644, and Windows Server equivalents of these release.

If you still need support for Visual Studio 2008, Windows XP, or Direct3D 9 you should continue to use the legacy DirectX SDK (June 2010) version.

FAQ

Q: Is DXUT the official Microsoft samples framework for DirectX?

Over the years, DXUT has enjoyed a sort of ‘semi-official’ status because of its use in most of the DirectX SDK samples content. It has been adopted for samples from some video card manufacturer as well. In the past few years, the samples strategy for Microsoft has transitioned away from being packed into SDKs to the online MSDN Code Gallery which includes both ‘official’ Microsoft samples as well as community contributions.  The official samples on MSDN Code Gallery generally do not make use of any samples framework at all, and none use DXUT.  As such, DXUT has no special status as an ‘official’ or ‘supported’ samples framework.

Q: DXUT in the DirectX SDK supported Windows XP. Why is that not in the update?

The DXUT samples framework in the DirectX SDK provided ‘dual’ support for both Direct3D 9 and Direct3D 11 (and prior to that Direct3D 9 and Direct3D 10).  This was primarily to support the venerable Windows XP platform. DXUT relied heavily on functionality in the D3DX library, which is now deprecated and only available in the DirectX SDK. There are a host of D3DX replacements for Direct3D 11, but none for Direct3D 9. As such, if you still require Windows XP or Direct3D 9 support, you’ll need to stick with the end-of-life DirectX SDK (June 2010) release, and continue to rely on the legacy DirectSetup deployment model. If you are using VS 2012, you’ll want to read some of the special handling needed to mix the legacy DirectX SDK with the v110_xp Platform Toolset.

Q: Why is there no DXUT support for Windows Store apps?

The primary purpose of the DXUT framework is to handle the complex needs for device enumeration and selection, to provide GUI elements suitable for use with a full-screen DirectX application, and support a simplistic but useful mouse/keyboard input mechanism. Windows Store apps, however, have an entirely different presentation model, make use of XAML and/or Direct2D for GUI elements, support a touch-first input design, and has a heavily emphasis on power-friendly asynchronous I/O. As such, DXUT is not applicable to Windows Store apps or Windows phone.

Q: I’m new to Direct3D 11. Is DXUT a good place to start?

Visual Studio 2012 and 2013 include great DirectX templates for Windows Store apps that use Direct3D 11, and there are many samples on MSDN Code Gallery. This update to DXUT is primarily intended for those already familiar with DXUT who want to continue to develop Win32 desktop samples, prototypes, and demos for Direct3D 11 without requiring the DirectX SDK or Direct Setup be installed.

Version History

September 2013 (11.03)

  • Removed dependencies on the D3DX9 and D3DX11 libraries, so DXUT no longer requires the legacy DirectX SDK to build. It does require the d3dcompiler.h header from the Windows 8.x SDK.
  • Includes standalone DDSTextureLoader, WICTexureLoader, ScreenGrab, and DxErr modules.
  • Removed support for Direct3D 9 and Windows XP
  • Deleted the DXUTDevice9.h/.cpp, SDKSound.h/.cpp, and SDKWaveFile.h/.cpp files
  • Deleted legacy support for MCE relaunch
  • General C++ code cleanups (nullptr, auto keyword, C++ style casting, Safer CRT, etc.) which are compatible with Visual C++ 2010 and 2012
  • SAL2 annotation and /analyze cleanup
  • Added DXUTCompileFromFile, DXUTCreateShaderResourceViewFromFile, DXUTCreateTextureFromFile, DXUTSaveTextureToFile helpers
  • Added '-forcewarp' command-line switch
  • Added support for DXGI 1.1 and 1.2 formats
  • Added Direct3D 11.1 Device/Context state
  • Support Feature Level 11.1 when available

June 2010 (11.02)

  • The DirectX SDK (June 2010) included an update to DXUT11. This is the last version to support Visual Studio 2008, Windows XP, or Direct3D 9. The source code is located in Samples\C++\DXUT11.

February 2010 (11.01)

  • An update was shipped with the DirectX SDK (February 2010). This is the last version to support Visual Studio 2005. The source code is located in Samples\C++\DXUT11.

August 2009 (11.00)

  • The initial release of DXUT11 was in DirectX SDK (August 2009). The source code is located in Samples\C++\DXUT11. This was a port of the original DXUT which supported Direct3D 10 / Direct3D 9 applications on Windows XP and Windows Vista.

These files are provided subject to the Microsoft Public License (MS-PL).

Samples: DXUT Tutorial Win32 Samples, Basic DXUT Win32 Samples

DirectXTK Note: You can use DXUT in combination with DirectXTK in the same project, but you should remove the files DDSTextureLoader.h, DDSTextureLoader.cpp, ScreenGrab.h, ScreenGrab.cpp, WICTextureLoader.h, and WICTextureLoader.cpp from DXUT\Core. You may have to add additional include paths to the DXUT projects to find the DirectXTK\Inc folder as well.

Related:Living without D3DX, Effects 11, Where’s DXERR.lIB?

DirectX SDK Samples Catalog

$
0
0

Microsoft has moved away from providing samples in SDKs for a number of reasons, but primarily to reduce the size of the standalone downloads and to minimize the size of the SDKs when included in other products (such as the Windows 8.x SDK being included with VS 2012 and VS 2013). The MSDN Code Gallery provides an online repository for samples, including both official Microsoft samples as well as community contributions. Here’s a list of the samples from the legacy DirectX SDK (June 2010) and their locations online if available.

The majority of these samples are Win32 desktop applications. Where applicable, the table also notes similar samples for Windows Store apps on Windows 8.x.

Direct3D 11

Tutorials

Tutorial01 - 07
Direct3D Tutorial Win32 Sample

Windows Store apps version:
Direct3D tutorial sample

Tutorial08-10
DXUT Tutorial Win32 Sample

AdaptiveTessellationCS40
FluidCS11
HDRToneMappingCS11
NBodyGravityCS11
OIT11

DirectCompute Graphics Win32 Samples

Windows Store app samples:
Direct3D HLSL fractal generator sample

BasicCompute11
ComputeShaderSort11
DirectCompute Basic Win32 Samples
BasicHLSL11
EmptyProject11
SimpleSample11

Basic DXUT Win32 Samples

DXUT+DirectXTK Simple Win32 Sample

BasicHLSL10
DynamicShaderLinkageFX11
FixedFuncEMU

Effects 11 Win32 Samples

These samples make use of the Effects 11 (FX11) library.

BC6HBC7EncoderDecoder11

BC6H/BC7 DirectCompute Encoder Tool (Win32)

Note this functionality is also present in the latest DirectXTex.

CascadedShadowMaps11
VarianceShadows11

Direct3D Shadow Win32 Samples

Windows Store app samples:
Shadow mapping sample

DDSWithoutD3DX
DDSWithoutD3DX11

An updated version of this sample is posted here.

The DDSTextureLoader for Direct3D 11 from this sample is available in both DirectXTK and DirectXTex.

DynamicShaderLinkage11

Dynamic Shader Linkage Win32 Sample

MultithreadedRendering11

Direct3D Multithreaded Rendering Win32 Sample

SimpleBezier11
SubD11

Direct3D Tessellation Win32 Samples

Misc

ContentExporter

Samples Content Exporter Update

CoreDetection

Core Detection Sample (Win32)

D3D11InstallHelper

Direct3D 11 Install Helper (Win32)

FirewallInstallHelper

Windows Firewall Install Helper (Win32)

GameuxInstallHelper

Gameux Install Helper (Win32

VideoMemory

DirectX Video Memory (Win32)

XInput

XInput 1.4 is only supported on Windows 8.x. XInput 1.3 is only available in the DirectX SDK.

See XINPUT and Windows 8 for more information.

Windows Store samples:
Game controller sample
Audio controller sample

XAudio2

XAudio 2.8 is only supported on Windows 8.x. XAudio 2.7 is only available in the DirectX SDK.

See XAudio2 and Windows 8 for more information.

Windows Store app samples:
Audio file playback sample
Audio stream effect sample

DirectInput

Customformat
FFConst
Joystick

DirectInput Samples (Win32)

Keyboard and Mouse samples are not included as use of DirectInput for these scenarios is not recommended.

DirectShow

A list of Windows 7.x SDK DirectShow samples is available on MSDN.

Vendor Samples

DepthOfField10.1
HDAO10.1
TransparencyAA10.1

ContactHardeningShadows11
DetailTessellation11
PNTriangles11

AMD Radeon SDK

Retired Samples

Direct3D9

The Direct3D 9 samples require D3DX9, so these remain available only in the DirectX SDK.

DirectDraw

The DirectX SDK 8.1 was the last to contain the DirectDraw samples.

DirectMusic
DirectPlay

DirectX 9.0b (Summer 2003) was the last release of the DirectMusic or DirectPlay samples.

DirectSound

The DirectX SDK (November 2007) release was the last time the DirectSound samples were shipped.

Managed DirectX 1.1

The DirectX SDK (August 2006) release was the last time the C# samples for legacy Managed DirectX 1.1 were shipped

XACT

The DirectX SDK (June 2010) contains the last release of XACT and related samples.

Related:DXUT for Win32 Desktop Update, Living without D3DX

A Brief History of Windows SDKs

$
0
0

A common source of confusion for Windows development is the Windows SDK naming scheme. For example: Can someone use the "Windows SDK for Windows Server 2008 and .NET Framework 3.5" to target Windows XP? 

The recommendation is for developers to use the latest version of the Windows SDK they can for access to the latest technologies and APIs, given the restrictions of your projects development platform, target platforms, and toolset. Figuring out this matrix of choices is a bit challenging, so this blog post spells out some key differences.

For a more complete version history, you might want to check out Wikipedia.

Q: What SDK am I using currently?

Most developers get a copy of the Windows SDK or Platform SDK with their Visual Studio installation.

Visual Studio 2013

Windows 8.1 SDK

Windows 7.1A SDK for "xp_110" Platform Toolset

VS 2013 Express for Windows only includes a subset of the full Windows 8.1 SDK

Visual Studio 2012

Windows 8.0 SDK

Windows 7.1A SDK for "xp_110" Platform Toolset

VS 2012 Express for Windows only includes a subset of the full Windows 8.0 SDK

Visual Studio 2010

Windows SDK 7.0A

Similar to Windows SDK for Windows 7 and .NET Framework 3.5 SP1 (August 2009)

Visual Studio 2008

Windows SDK 6.0A

Similar to Windows SDK for Windows Vista Update and .NET Framework 3.0 (February 2007)

Visual Studio 2005

Similar to Windows Server 2003 SP1 Platform SDK (April 2005)

VS 2005 Express did not include the Platform SDK

Q: What platform does a given Windows SDK target?

Given the naming scheme for the Window SDKs, this is probably the most confusing aspect of choosing a Windows SDK. The easiest way to describe it is to list the last releases which allowed you to target a given OS.

  • Windows SDK 7.1 (aka Windows SDK for Windows 7 and .NET Framework 4.0) was the last release to support targeting Windows XP and Windows Server 2003.
  • Windows Server 2003 SP1 Platform SDK (April 2005) was the last release to support targeting Windows 2000.

Q: What platform does a given Window SDK support for development?

Another aspect is that the Windows SDK often supports a smaller set of platforms for development (i.e. it can be installed on) compared to those it can target (i.e. deploy applications to).

  • Windows 8.1 SDK requires Windows 7 SP1, Windows 8, or Windows 8.1
  • Windows 8.0 SDK requires Windows 7 or Windows 8.x

Q: What compiler toolset does a given Windows SDK support?

Not all Windows SDKs can be used with all versions of Visual Studio. Changes in language features, /analyze SAL annotation, and other aspects of the compiler toolset are assumed as the baseline for a given Visual Studio release--usually that version that comes with a given Visual Studio release is the 'oldest' one it supports.

  • Windows 8.0 SDK and Windows 8.1 SDK support Visual Studio 2010 or later.
  • Windows 7.1 SDK supports Visual Studio 2005 or later.
  • Platform SDK (February 2003) was the last release to support Visual Studio 6.

Related: DirectX SDKs of a certain age, Windows 7.1 SDK, Windows 8.0 SDK, VS 2012 Update 1

Visual Studio 2013 and Windows 8.1 SDK RTM are now available

$
0
0

Visual Studio 2013 RTM is now available. The VS 2013 RTM Redistribution packages are also available (x86, x64, ARM), as well as the Remote Debugging Tools (x86, x64, ARM). For more information, see the Visual C++ team blog, Somasegar’s blog, and the Visual Studio team blog.

VS 2013 RTM includes the Windows Software Development Kit (SDK) for Windows 8.1, which is also available standalone. This includes DirectXMath 3.06, Direct3D 11.2/DXGI 1.3/Direct2D 1.2 headers for Windows 8.1, D3DCompiler #47, and the Direct3D Debug Runtime for Windows 8.1. This includes an update of GDFMaker with some minor bugs fixes, and a few more caps detection features in DxCapsViewer as well.

Today is also Windows 8.1 and Windows Server 2012 R2 GA (build 9600). Might be a good time to review and Manifest Madness, Desktop Games on Windows 8.x, and the latest AppCompat Cookbook.

Related:Where is the DirectX SDK (2013 Edition)?, Visual Studio 2013 RC, VS 2012 and Windows 8.0 SDK RTM

Windows XP developers: as with VS 2012, the "v120_xp" platform toolset in VS 2013 uses a version of the Windows 7.1 SDK, not Windows 8.x SDK. See Visual Studio 2012 Update 1.

Windows 7 users: VS 2013 originally required IE10 be installed which requires KB 2670838 (DirectX 11.1 and Windows 7 Update and DirectX 11.1 and Windows 7). The VS 2013 setup has been refreshed and no longer requires IE10 be installed. KB 2670838 and IE10 are still recommended as there are a number of known issues on Windows 7 if they are not present (see KB 2906882).

Windows 8 users: If you upgrade to Windows 8.1, remember that all attempts to use D3Dxx_CREATE_DEVICE_DEBUG will fail until you upgrade the Developer Runtime. You can do this by installing VS 2013, the standalone Windows 8.1 SDK, or by installing the VS 2013 Remote Debugging Tools. If you are missing the updated SDK Debug Layers, you should see the following message in your debug output:

D3D11CreateDevice: Flags (0x2) were specified which require the D3D11 SDK Layers for Windows 8.1, but they are not present on the system.
These flags must be removed, or the Windows 8.1 SDK must be installed.

DirectX SDK users: Using the legacy DirectX SDK (June 2010) with VS 2013 is the same as it was using it with VS 2012. See MSDN.

Express users: VS 2013 Express for Windows edition include Graphics Diagnostics (aka VS PIX) and the Visual Studio content tools. These are not included with the VS 2013 Express for Windows Desktop edition.

VS 2010/2012 users: You can use the property sheet technique for the Windows 8.1 SDK that was described in this Visual C++ Team blog post originally for VS 2010+Windows 8.0 SDK. For VS 2010, just change the part of the paths with "8.0"/"win8" to "8.1"/"winv6.3" but otherwise use all those instructions. For VS 2012, you can simplify all the paths to just add the 8.1 paths before the existing value for each variable. The updated .props are attached to this blog post. This should only be used for Win32 desktop application development. Windows Store apps should use VS 2013 with the Windows 8.1 SDK.

Windows Store app developers: Remember if writing Windows Store apps for Windows 8.1, you must use the VS 2013 toolset, the Windows 8.1 SDK, and the Windows 8.1 OS. You can optionally install the VS 2012 toolset and Windows 8.0 SDK as part of your VS 2013 setup (called "Tools for Maintaining Store apps for Windows 8" in the optional features list) to maintain Windows Store apps for Windows 8.0. You cannot install VS 2013 on the Windows 8.0 OS to build Windows Store apps for Windows 8.1. None of these restrictions apply to Win32 desktop development.

Update: Refreshed the attached .props with some fixes on October 21, 2013. There are new releases of DirectXTex, DirectXTKEffects 11, and DXUT for Direct3D 11 with support for VS 2013 / Windows 8.1 SDK available as well.

DirectXMath 3.06

$
0
0

DirectXMath version 3.06 is included in the release of VS 2013. You can use this with VS 2012 or VS 2010 as well via the standalone Windows 8.1 SDK.

The high-level What's New is covered on MSDN, but here is a more technical summary of the changes between DirectXMath 3.03 in the VS 2012 / Windows 8.0 SDK and 3.06.

This release includes the fixes mentioned in a previous post:

  • Corrected bug with ARM-NEON version of XMVector3Cross
  • Fixed behavior problem on odd whole numbers with XMVectorFloor and XMVectorCeiling
  • Range issue with XMConvertHalfToFloat and XMConvertFloatToHalf which incorrectly still used the extended non-standard Xbox 360 range instead of the IEEE 754 standard variant
  • Scaling transformation with BoundingOrientedBox::Transform and BoundFrustum::Transform
  • Fixed XMLoadFloat3SE and XMStoreFloatSE to actually match DXGI_FORMAT_R9G9B9E5_SHAREDEXP

DirectXMath 3.06 also includes the following changes

  • Take advantage of the __vectorcall calling convention when available. This introduced the XM_CALLCONV macro and some new typedefs: HXMVECTOR and FXMMATRIX. Details of using this convention in your own code are covered on MSDN.
  • New functions XMColorRGBToSRGB and XMColorSRGBToRGB
  • New functions XMVectorExp2, XMVectorExpE, XMVectorLog2, XMVectorLogE.
    • The older XMVectorExp is now an alias for XMVectorExp2, XMVectorLog is an alias for XMVectorLog2
  • New functions XMLoadUDecN4_XR and XMStoreUDecN4_XR to match DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM

 

  • Makes use of the multiply-by-scalar ARM-NEON instructions to avoid some extra vdups, working around some bugs in the older VS 2012 compiler releases if needed
  • Some cleanup of the ARM-NEON implementations to make use of the 'typed' register types rather than the generic __n64/__n128
  • Some cleanup of the SSE implementations to use _mm_cast* instead of C++ style casts

 

  • Improved XMVectorRound
  • ARM-NEON and SSE optimized versions of XMVectorExp* and XMVectorLog*
  • Optimized XMMATRIX::operator/= and operator/
  • Optimized all the XMVector*Stream functions for ARM-NEON and SSE, including making use of _mm_stream_ps when possible.

 

Rounding 

The original XMVectorRound implementation was not truly a round-to-nearest and did not match the behavior of the SSE4.1 instruction _mm_round_ps, so I revisited it for this release.

Here is the new version:

namespace Internal
{
inline float round_to_nearest( float x )
{
float i = floorf(x);
x -= i;
if(x < 0.5f)
return i;
if(x > 0.5f)
return i + 1.f;

float int_part;
modff( i / 2.f, &int_part );
if ( (2.f*int_part) == i )
{
return i;
}

return i + 1.f;
}
};

#if !defined(_XM_NO_INTRINSICS_)
#pragma float_control(push)
#pragma float_control(precise, on)
#endif

inline XMVECTOR XMVectorRound ( FXMVECTOR V )
{
#if defined(_XM_NO_INTRINSICS_)

XMVECTOR vResult = {
Internal::round_to_nearest(V.vector4_f32[0]),
Internal::round_to_nearest(V.vector4_f32[1]),
Internal::round_to_nearest(V.vector4_f32[2]),
Internal::round_to_nearest(V.vector4_f32[3])
};
return vResult;

#elif defined(_XM_ARM_NEON_INTRINSICS_)
static const XMVECTORI32 magic = {0x4B000000, 0x4B000000, 0x4B000000, 0x4B000000};
uint32x4_t sign = vandq_u32( V, g_XMNegativeZero );
uint32x4_t sMagic = vorrq_u32( magic, sign );
XMVECTOR vResult = vaddq_f32( V, sMagic );
vResult = vsubq_f32( vResult, sMagic );
return vResult;
#elif defined(_XM_SSE_INTRINSICS_)
static const XMVECTORI32 magic = {0x4B000000, 0x4B000000, 0x4B000000, 0x4B000000};
__m128 sign = _mm_and_ps( V, g_XMNegativeZero );
__m128 sMagic = _mm_or_ps( magic, sign );
XMVECTOR vResult = _mm_add_ps( V, sMagic );
vResult = _mm_sub_ps( vResult, sMagic );
return vResult;
#else // _XM_VMX128_INTRINSICS_
#endif // _XM_VMX128_INTRINSICS_
}

#if !defined(_XM_NO_INTRINSICS_)
#pragma float_control(pop)
#endif

The revisited XMVectorFloor and XMVectorCeiling were already covered by the previous blog post.

Exponent and Logarithm

XMVectorExp was renamed XMVectorExp2 and optimized for ARM-NEON and SSE.

inline XMVECTOR XMVectorExp2
(
FXMVECTOR V
)
{
#if defined(_XM_NO_INTRINSICS_)

XMVECTOR Result;
Result.vector4_f32[0] = powf(2.0f, V.vector4_f32[0]);
Result.vector4_f32[1] = powf(2.0f, V.vector4_f32[1]);
Result.vector4_f32[2] = powf(2.0f, V.vector4_f32[2]);
Result.vector4_f32[3] = powf(2.0f, V.vector4_f32[3]);
return Result;

#elif defined(_XM_ARM_NEON_INTRINSICS_)
int32x4_t itrunc = vcvtq_s32_f32(V);
float32x4_t ftrunc = vcvtq_f32_s32(itrunc);
float32x4_t y = vsubq_f32(V, ftrunc);

float32x4_t poly = vmlaq_f32( g_XMExpEst6, g_XMExpEst7, y );
poly = vmlaq_f32( g_XMExpEst5, poly, y );
poly = vmlaq_f32( g_XMExpEst4, poly, y );
poly = vmlaq_f32( g_XMExpEst3, poly, y );
poly = vmlaq_f32( g_XMExpEst2, poly, y );
poly = vmlaq_f32( g_XMExpEst1, poly, y );
poly = vmlaq_f32( g_XMOne, poly, y );

int32x4_t biased = vaddq_s32(itrunc, g_XMExponentBias);
biased = vshlq_n_s32(biased, 23);
float32x4_t result0 = XMVectorDivide(biased, poly);

biased = vaddq_s32(itrunc, g_XM253);
biased = vshlq_n_s32(biased, 23);
float32x4_t result1 = XMVectorDivide(biased, poly);
result1 = vmulq_f32(g_XMMinNormal.v, result1);

// Use selection to handle the cases
// if (V is NaN) -> QNaN;
// else if (V sign bit set)
// if (V > -150)
// if (V.exponent < -126) -> result1
// else -> result0
// else -> +0
// else
// if (V < 128) -> result0
// else -> +inf

int32x4_t comp = vcltq_s32( V, g_XMBin128);
float32x4_t result2 = vbslq_f32( comp, result0, g_XMInfinity );

comp = vcltq_s32(itrunc, g_XMSubnormalExponent);
float32x4_t result3 = vbslq_f32( comp, result1, result0 );

comp = vcltq_s32(V, g_XMBinNeg150);
float32x4_t result4 = vbslq_f32( comp, result3, g_XMZero );

int32x4_t sign = vandq_s32(V, g_XMNegativeZero);
comp = vceqq_s32(sign, g_XMNegativeZero);
float32x4_t result5 = vbslq_f32( comp, result4, result2 );

int32x4_t t0 = vandq_s32(V, g_XMQNaNTest);
int32x4_t t1 = vandq_s32(V, g_XMInfinity);
t0 = vceqq_s32(t0, g_XMZero);
t1 = vceqq_s32(t1, g_XMInfinity);
int32x4_t isNaN = vbicq_s32( t1,t0);

float32x4_t vResult = vbslq_f32( isNaN, g_XMQNaN, result5 );
return vResult;
#elif defined(_XM_SSE_INTRINSICS_)
__m128i itrunc = _mm_cvttps_epi32(V);
__m128 ftrunc = _mm_cvtepi32_ps(itrunc);
__m128 y = _mm_sub_ps(V, ftrunc);
__m128 poly = _mm_mul_ps(g_XMExpEst7, y);
poly = _mm_add_ps(g_XMExpEst6, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst5, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst4, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst3, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst2, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst1, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMOne, poly);

__m128i biased = _mm_add_epi32(itrunc, g_XMExponentBias);
biased = _mm_slli_epi32(biased, 23);
__m128 result0 = _mm_div_ps(_mm_castsi128_ps(biased), poly);

biased = _mm_add_epi32(itrunc, g_XM253);
biased = _mm_slli_epi32(biased, 23);
__m128 result1 = _mm_div_ps(_mm_castsi128_ps(biased), poly);
result1 = _mm_mul_ps(g_XMMinNormal.v, result1);

// Use selection to handle the cases
// if (V is NaN) -> QNaN;
// else if (V sign bit set)
// if (V > -150)
// if (V.exponent < -126) -> result1
// else -> result0
// else -> +0
// else
// if (V < 128) -> result0
// else -> +inf

__m128i comp = _mm_cmplt_epi32( _mm_castps_si128(V), g_XMBin128);
__m128i select0 = _mm_and_si128(comp, _mm_castps_si128(result0));
__m128i select1 = _mm_andnot_si128(comp, g_XMInfinity);
__m128i result2 = _mm_or_si128(select0, select1);

comp = _mm_cmplt_epi32(itrunc, g_XMSubnormalExponent);
select1 = _mm_and_si128(comp, _mm_castps_si128(result1));
select0 = _mm_andnot_si128(comp, _mm_castps_si128(result0));
__m128i result3 = _mm_or_si128(select0, select1);

comp = _mm_cmplt_epi32(_mm_castps_si128(V), g_XMBinNeg150);
select0 = _mm_and_si128(comp, result3);
select1 = _mm_andnot_si128(comp, g_XMZero);
__m128i result4 = _mm_or_si128(select0, select1);

__m128i sign = _mm_and_si128(_mm_castps_si128(V), g_XMNegativeZero);
comp = _mm_cmpeq_epi32(sign, g_XMNegativeZero);
select0 = _mm_and_si128(comp, result4);
select1 = _mm_andnot_si128(comp, result2);
__m128i result5 = _mm_or_si128(select0, select1);

__m128i t0 = _mm_and_si128(_mm_castps_si128(V), g_XMQNaNTest);
__m128i t1 = _mm_and_si128(_mm_castps_si128(V), g_XMInfinity);
t0 = _mm_cmpeq_epi32(t0, g_XMZero);
t1 = _mm_cmpeq_epi32(t1, g_XMInfinity);
__m128i isNaN = _mm_andnot_si128(t0, t1);

select0 = _mm_and_si128(isNaN, g_XMQNaN);
select1 = _mm_andnot_si128(isNaN, result5);
__m128i vResult = _mm_or_si128(select0, select1);

return _mm_castsi128_ps(vResult);
#else // _XM_VMX128_INTRINSICS_
#endif // _XM_VMX128_INTRINSICS_
}

Here is the base-E version which was added to the library, XMVectorExpE

inline XMVECTOR XMVectorExpE
(
FXMVECTOR V
)
{
#if defined(_XM_NO_INTRINSICS_)

XMVECTOR Result;
Result.vector4_f32[0] = expf(V.vector4_f32[0]);
Result.vector4_f32[1] = expf(V.vector4_f32[1]);
Result.vector4_f32[2] = expf(V.vector4_f32[2]);
Result.vector4_f32[3] = expf(V.vector4_f32[3]);
return Result;

#elif defined(_XM_ARM_NEON_INTRINSICS_)
// expE(V) = exp2(vin*log2(e))
float32x4_t Ve = vmulq_f32(g_XMLgE, V);

int32x4_t itrunc = vcvtq_s32_f32(Ve);
float32x4_t ftrunc = vcvtq_f32_s32(itrunc);
float32x4_t y = vsubq_f32(Ve, ftrunc);


float32x4_t poly = vmlaq_f32( g_XMExpEst6, g_XMExpEst7, y );
poly = vmlaq_f32( g_XMExpEst5, poly, y );
poly = vmlaq_f32( g_XMExpEst4, poly, y );
poly = vmlaq_f32( g_XMExpEst3, poly, y );
poly = vmlaq_f32( g_XMExpEst2, poly, y );
poly = vmlaq_f32( g_XMExpEst1, poly, y );
poly = vmlaq_f32( g_XMOne, poly, y );

int32x4_t biased = vaddq_s32(itrunc, g_XMExponentBias);
biased = vshlq_n_s32(biased, 23);
float32x4_t result0 = XMVectorDivide(biased, poly);

biased = vaddq_s32(itrunc, g_XM253);
biased = vshlq_n_s32(biased, 23);
float32x4_t result1 = XMVectorDivide(biased, poly);
result1 = vmulq_f32(g_XMMinNormal.v, result1);

// Use selection to handle the cases
// if (V is NaN) -> QNaN;
// else if (V sign bit set)
// if (V > -150)
// if (V.exponent < -126) -> result1
// else -> result0
// else -> +0
// else
// if (V < 128) -> result0
// else -> +inf

int32x4_t comp = vcltq_s32( Ve, g_XMBin128);
float32x4_t result2 = vbslq_f32( comp, result0, g_XMInfinity );

comp = vcltq_s32(itrunc, g_XMSubnormalExponent);
float32x4_t result3 = vbslq_f32( comp, result1, result0 );

comp = vcltq_s32(Ve, g_XMBinNeg150);
float32x4_t result4 = vbslq_f32( comp, result3, g_XMZero );

int32x4_t sign = vandq_s32(Ve, g_XMNegativeZero);
comp = vceqq_s32(sign, g_XMNegativeZero);
float32x4_t result5 = vbslq_f32( comp, result4, result2 );

int32x4_t t0 = vandq_s32(Ve, g_XMQNaNTest);
int32x4_t t1 = vandq_s32(Ve, g_XMInfinity);
t0 = vceqq_s32(t0, g_XMZero);
t1 = vceqq_s32(t1, g_XMInfinity);
int32x4_t isNaN = vbicq_s32( t1,t0);

float32x4_t vResult = vbslq_f32( isNaN, g_XMQNaN, result5 );
return vResult;
#elif defined(_XM_SSE_INTRINSICS_)
// expE(V) = exp2(vin*log2(e))
__m128 Ve = _mm_mul_ps(g_XMLgE, V);

__m128i itrunc = _mm_cvttps_epi32(Ve);
__m128 ftrunc = _mm_cvtepi32_ps(itrunc);
__m128 y = _mm_sub_ps(Ve, ftrunc);
__m128 poly = _mm_mul_ps(g_XMExpEst7, y);
poly = _mm_add_ps(g_XMExpEst6, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst5, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst4, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst3, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst2, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMExpEst1, poly);
poly = _mm_mul_ps(poly, y);
poly = _mm_add_ps(g_XMOne, poly);

__m128i biased = _mm_add_epi32(itrunc, g_XMExponentBias);
biased = _mm_slli_epi32(biased, 23);
__m128 result0 = _mm_div_ps(_mm_castsi128_ps(biased), poly);

biased = _mm_add_epi32(itrunc, g_XM253);
biased = _mm_slli_epi32(biased, 23);
__m128 result1 = _mm_div_ps(_mm_castsi128_ps(biased), poly);
result1 = _mm_mul_ps(g_XMMinNormal.v, result1);

// Use selection to handle the cases
// if (V is NaN) -> QNaN;
// else if (V sign bit set)
// if (V > -150)
// if (V.exponent < -126) -> result1
// else -> result0
// else -> +0
// else
// if (V < 128) -> result0
// else -> +inf

__m128i comp = _mm_cmplt_epi32( _mm_castps_si128(Ve), g_XMBin128);
__m128i select0 = _mm_and_si128(comp, _mm_castps_si128(result0));
__m128i select1 = _mm_andnot_si128(comp, g_XMInfinity);
__m128i result2 = _mm_or_si128(select0, select1);

comp = _mm_cmplt_epi32(itrunc, g_XMSubnormalExponent);
select1 = _mm_and_si128(comp, _mm_castps_si128(result1));
select0 = _mm_andnot_si128(comp, _mm_castps_si128(result0));
__m128i result3 = _mm_or_si128(select0, select1);

comp = _mm_cmplt_epi32(_mm_castps_si128(Ve), g_XMBinNeg150);
select0 = _mm_and_si128(comp, result3);
select1 = _mm_andnot_si128(comp, g_XMZero);
__m128i result4 = _mm_or_si128(select0, select1);

__m128i sign = _mm_and_si128(_mm_castps_si128(Ve), g_XMNegativeZero);
comp = _mm_cmpeq_epi32(sign, g_XMNegativeZero);
select0 = _mm_and_si128(comp, result4);
select1 = _mm_andnot_si128(comp, result2);
__m128i result5 = _mm_or_si128(select0, select1);

__m128i t0 = _mm_and_si128(_mm_castps_si128(Ve), g_XMQNaNTest);
__m128i t1 = _mm_and_si128(_mm_castps_si128(Ve), g_XMInfinity);
t0 = _mm_cmpeq_epi32(t0, g_XMZero);
t1 = _mm_cmpeq_epi32(t1, g_XMInfinity);
__m128i isNaN = _mm_andnot_si128(t0, t1);

select0 = _mm_and_si128(isNaN, g_XMQNaN);
select1 = _mm_andnot_si128(isNaN, result5);
__m128i vResult = _mm_or_si128(select0, select1);

return _mm_castsi128_ps(vResult);
#else // _XM_VMX128_INTRINSICS_
#endif // _XM_VMX128_INTRINSICS_
}

XMVectorLog was renamed XMVectorLog2 and optimized for SSE and ARM-NEON.

inline XMVECTOR XMVectorLog2
(
FXMVECTOR V
)
{
#if defined(_XM_NO_INTRINSICS_)

const float fScale = 1.4426950f; // (1.0f / logf(2.0f));

XMVECTOR Result;
Result.vector4_f32[0] = logf(V.vector4_f32[0])*fScale;
Result.vector4_f32[1] = logf(V.vector4_f32[1])*fScale;
Result.vector4_f32[2] = logf(V.vector4_f32[2])*fScale;
Result.vector4_f32[3] = logf(V.vector4_f32[3])*fScale;
return Result;

#elif defined(_XM_ARM_NEON_INTRINSICS_)
int32x4_t rawBiased = vandq_s32(V, g_XMInfinity);
int32x4_t trailing = vandq_s32(V, g_XMQNaNTest);
int32x4_t isExponentZero = vceqq_s32(g_XMZero, rawBiased);

// Compute exponent and significand for normals.
int32x4_t biased = vshrq_n_u32(rawBiased, 23);
int32x4_t exponentNor = vsubq_s32(biased, g_XMExponentBias);
int32x4_t trailingNor = trailing;

// Compute exponent and significand for subnormals.
int32x4_t leading = Internal::GetLeadingBit(trailing);
int32x4_t shift = vsubq_s32(g_XMNumTrailing, leading);
int32x4_t exponentSub = vsubq_s32(g_XMSubnormalExponent, shift);
int32x4_t trailingSub = vshlq_u32(trailing, shift);
trailingSub = vandq_s32(trailingSub, g_XMQNaNTest);
int32x4_t e = vbslq_f32( isExponentZero, exponentSub, exponentNor );
int32x4_t t = vbslq_f32( isExponentZero, trailingSub, trailingNor );

// Compute the approximation.
int32x4_t tmp = vorrq_s32(g_XMOne, t);
float32x4_t y = vsubq_f32(tmp, g_XMOne);

float32x4_t log2 = vmlaq_f32( g_XMLogEst6, g_XMLogEst7, y );
log2 = vmlaq_f32( g_XMLogEst5, log2, y );
log2 = vmlaq_f32( g_XMLogEst4, log2, y );
log2 = vmlaq_f32( g_XMLogEst3, log2, y );
log2 = vmlaq_f32( g_XMLogEst2, log2, y );
log2 = vmlaq_f32( g_XMLogEst1, log2, y );
log2 = vmlaq_f32( g_XMLogEst0, log2, y );
log2 = vmlaq_f32( vcvtq_f32_s32(e), log2, y );

// if (x is NaN) -> QNaN
// else if (V is positive)
// if (V is infinite) -> +inf
// else -> log2(V)
// else
// if (V is zero) -> -inf
// else -> -QNaN

int32x4_t isInfinite = vandq_s32((V), g_XMAbsMask);
isInfinite = vceqq_s32(isInfinite, g_XMInfinity);

int32x4_t isGreaterZero = vcgtq_s32((V), g_XMZero);
int32x4_t isNotFinite = vcgtq_s32((V), g_XMInfinity);
int32x4_t isPositive = vbicq_s32( isGreaterZero,isNotFinite);

int32x4_t isZero = vandq_s32((V), g_XMAbsMask);
isZero = vceqq_s32(isZero, g_XMZero);

int32x4_t t0 = vandq_s32((V), g_XMQNaNTest);
int32x4_t t1 = vandq_s32((V), g_XMInfinity);
t0 = vceqq_s32(t0, g_XMZero);
t1 = vceqq_s32(t1, g_XMInfinity);
int32x4_t isNaN = vbicq_s32( t1,t0);

float32x4_t result = vbslq_f32( isInfinite, g_XMInfinity, log2 );
tmp = vbslq_f32( isZero, g_XMNegInfinity, g_XMNegQNaN );
result = vbslq_f32(isPositive, result, tmp);
result = vbslq_f32(isNaN, g_XMQNaN, result );
return result;
#elif defined(_XM_SSE_INTRINSICS_)
__m128i rawBiased = _mm_and_si128(_mm_castps_si128(V), g_XMInfinity);
__m128i trailing = _mm_and_si128(_mm_castps_si128(V), g_XMQNaNTest);
__m128i isExponentZero = _mm_cmpeq_epi32(g_XMZero, rawBiased);

// Compute exponent and significand for normals.
__m128i biased = _mm_srli_epi32(rawBiased, 23);
__m128i exponentNor = _mm_sub_epi32(biased, g_XMExponentBias);
__m128i trailingNor = trailing;

// Compute exponent and significand for subnormals.
__m128i leading = Internal::GetLeadingBit(trailing);
__m128i shift = _mm_sub_epi32(g_XMNumTrailing, leading);
__m128i exponentSub = _mm_sub_epi32(g_XMSubnormalExponent, shift);
__m128i trailingSub = Internal::multi_sll_epi32(trailing, shift);
trailingSub = _mm_and_si128(trailingSub, g_XMQNaNTest);

__m128i select0 = _mm_and_si128(isExponentZero, exponentSub);
__m128i select1 = _mm_andnot_si128(isExponentZero, exponentNor);
__m128i e = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isExponentZero, trailingSub);
select1 = _mm_andnot_si128(isExponentZero, trailingNor);
__m128i t = _mm_or_si128(select0, select1);

// Compute the approximation.
__m128i tmp = _mm_or_si128(g_XMOne, t);
__m128 y = _mm_sub_ps(_mm_castsi128_ps(tmp), g_XMOne);

__m128 log2 = _mm_mul_ps(g_XMLogEst7, y);
log2 = _mm_add_ps(g_XMLogEst6, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst5, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst4, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst3, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst2, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst1, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst0, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(log2, _mm_cvtepi32_ps(e));

// if (x is NaN) -> QNaN
// else if (V is positive)
// if (V is infinite) -> +inf
// else -> log2(V)
// else
// if (V is zero) -> -inf
// else -> -QNaN

__m128i isInfinite = _mm_and_si128(_mm_castps_si128(V), g_XMAbsMask);
isInfinite = _mm_cmpeq_epi32(isInfinite, g_XMInfinity);

__m128i isGreaterZero = _mm_cmpgt_epi32(_mm_castps_si128(V), g_XMZero);
__m128i isNotFinite = _mm_cmpgt_epi32(_mm_castps_si128(V), g_XMInfinity);
__m128i isPositive = _mm_andnot_si128(isNotFinite, isGreaterZero);

__m128i isZero = _mm_and_si128(_mm_castps_si128(V), g_XMAbsMask);
isZero = _mm_cmpeq_epi32(isZero, g_XMZero);

__m128i t0 = _mm_and_si128(_mm_castps_si128(V), g_XMQNaNTest);
__m128i t1 = _mm_and_si128(_mm_castps_si128(V), g_XMInfinity);
t0 = _mm_cmpeq_epi32(t0, g_XMZero);
t1 = _mm_cmpeq_epi32(t1, g_XMInfinity);
__m128i isNaN = _mm_andnot_si128(t0, t1);

select0 = _mm_and_si128(isInfinite, g_XMInfinity);
select1 = _mm_andnot_si128(isInfinite, _mm_castps_si128(log2));
__m128i result = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isZero, g_XMNegInfinity);
select1 = _mm_andnot_si128(isZero, g_XMNegQNaN);
tmp = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isPositive, result);
select1 = _mm_andnot_si128(isPositive, tmp);
result = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isNaN, g_XMQNaN);
select1 = _mm_andnot_si128(isNaN, result);
result = _mm_or_si128(select0, select1);

return _mm_castsi128_ps(result);
#else // _XM_VMX128_INTRINSICS_
#endif // _XM_VMX128_INTRINSICS_
}

And the base-E version was added, XMVectorLogE

inline XMVECTOR XMVectorLogE
(
FXMVECTOR V
)
{
#if defined(_XM_NO_INTRINSICS_)

XMVECTOR Result;
Result.vector4_f32[0] = logf(V.vector4_f32[0]);
Result.vector4_f32[1] = logf(V.vector4_f32[1]);
Result.vector4_f32[2] = logf(V.vector4_f32[2]);
Result.vector4_f32[3] = logf(V.vector4_f32[3]);
return Result;

#elif defined(_XM_ARM_NEON_INTRINSICS_)
int32x4_t rawBiased = vandq_s32(V, g_XMInfinity);
int32x4_t trailing = vandq_s32(V, g_XMQNaNTest);
int32x4_t isExponentZero = vceqq_s32(g_XMZero, rawBiased);

// Compute exponent and significand for normals.
int32x4_t biased = vshrq_n_u32(rawBiased, 23);
int32x4_t exponentNor = vsubq_s32(biased, g_XMExponentBias);
int32x4_t trailingNor = trailing;

// Compute exponent and significand for subnormals.
int32x4_t leading = Internal::GetLeadingBit(trailing);
int32x4_t shift = vsubq_s32(g_XMNumTrailing, leading);
int32x4_t exponentSub = vsubq_s32(g_XMSubnormalExponent, shift);
int32x4_t trailingSub = vshlq_u32(trailing, shift);
trailingSub = vandq_s32(trailingSub, g_XMQNaNTest);
int32x4_t e = vbslq_f32( isExponentZero, exponentSub, exponentNor );
int32x4_t t = vbslq_f32( isExponentZero, trailingSub, trailingNor );

// Compute the approximation.
int32x4_t tmp = vorrq_s32(g_XMOne, t);
float32x4_t y = vsubq_f32(tmp, g_XMOne);

float32x4_t log2 = vmlaq_f32( g_XMLogEst6, g_XMLogEst7, y );
log2 = vmlaq_f32( g_XMLogEst5, log2, y );
log2 = vmlaq_f32( g_XMLogEst4, log2, y );
log2 = vmlaq_f32( g_XMLogEst3, log2, y );
log2 = vmlaq_f32( g_XMLogEst2, log2, y );
log2 = vmlaq_f32( g_XMLogEst1, log2, y );
log2 = vmlaq_f32( g_XMLogEst0, log2, y );
log2 = vmlaq_f32( vcvtq_f32_s32(e), log2, y );

log2 = vmulq_f32(g_XMInvLgE, log2);

// if (x is NaN) -> QNaN
// else if (V is positive)
// if (V is infinite) -> +inf
// else -> log2(V)
// else
// if (V is zero) -> -inf
// else -> -QNaN

int32x4_t isInfinite = vandq_s32((V), g_XMAbsMask);
isInfinite = vceqq_s32(isInfinite, g_XMInfinity);

int32x4_t isGreaterZero = vcgtq_s32((V), g_XMZero);
int32x4_t isNotFinite = vcgtq_s32((V), g_XMInfinity);
int32x4_t isPositive = vbicq_s32( isGreaterZero,isNotFinite);

int32x4_t isZero = vandq_s32((V), g_XMAbsMask);
isZero = vceqq_s32(isZero, g_XMZero);

int32x4_t t0 = vandq_s32((V), g_XMQNaNTest);
int32x4_t t1 = vandq_s32((V), g_XMInfinity);
t0 = vceqq_s32(t0, g_XMZero);
t1 = vceqq_s32(t1, g_XMInfinity);
int32x4_t isNaN = vbicq_s32( t1,t0);

float32x4_t result = vbslq_f32( isInfinite, g_XMInfinity, log2 );
tmp = vbslq_f32( isZero, g_XMNegInfinity, g_XMNegQNaN );
result = vbslq_f32(isPositive, result, tmp);
result = vbslq_f32(isNaN, g_XMQNaN, result );
return result;
#elif defined(_XM_SSE_INTRINSICS_)
__m128i rawBiased = _mm_and_si128(_mm_castps_si128(V), g_XMInfinity);
__m128i trailing = _mm_and_si128(_mm_castps_si128(V), g_XMQNaNTest);
__m128i isExponentZero = _mm_cmpeq_epi32(g_XMZero, rawBiased);

// Compute exponent and significand for normals.
__m128i biased = _mm_srli_epi32(rawBiased, 23);
__m128i exponentNor = _mm_sub_epi32(biased, g_XMExponentBias);
__m128i trailingNor = trailing;

// Compute exponent and significand for subnormals.
__m128i leading = Internal::GetLeadingBit(trailing);
__m128i shift = _mm_sub_epi32(g_XMNumTrailing, leading);
__m128i exponentSub = _mm_sub_epi32(g_XMSubnormalExponent, shift);
__m128i trailingSub = Internal::multi_sll_epi32(trailing, shift);
trailingSub = _mm_and_si128(trailingSub, g_XMQNaNTest);

__m128i select0 = _mm_and_si128(isExponentZero, exponentSub);
__m128i select1 = _mm_andnot_si128(isExponentZero, exponentNor);
__m128i e = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isExponentZero, trailingSub);
select1 = _mm_andnot_si128(isExponentZero, trailingNor);
__m128i t = _mm_or_si128(select0, select1);

// Compute the approximation.
__m128i tmp = _mm_or_si128(g_XMOne, t);
__m128 y = _mm_sub_ps(_mm_castsi128_ps(tmp), g_XMOne);

__m128 log2 = _mm_mul_ps(g_XMLogEst7, y);
log2 = _mm_add_ps(g_XMLogEst6, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst5, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst4, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst3, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst2, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst1, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(g_XMLogEst0, log2);
log2 = _mm_mul_ps(log2, y);
log2 = _mm_add_ps(log2, _mm_cvtepi32_ps(e));

log2 = _mm_mul_ps(g_XMInvLgE, log2);

// if (x is NaN) -> QNaN
// else if (V is positive)
// if (V is infinite) -> +inf
// else -> log2(V)
// else
// if (V is zero) -> -inf
// else -> -QNaN

__m128i isInfinite = _mm_and_si128(_mm_castps_si128(V), g_XMAbsMask);
isInfinite = _mm_cmpeq_epi32(isInfinite, g_XMInfinity);

__m128i isGreaterZero = _mm_cmpgt_epi32(_mm_castps_si128(V), g_XMZero);
__m128i isNotFinite = _mm_cmpgt_epi32(_mm_castps_si128(V), g_XMInfinity);
__m128i isPositive = _mm_andnot_si128(isNotFinite, isGreaterZero);

__m128i isZero = _mm_and_si128(_mm_castps_si128(V), g_XMAbsMask);
isZero = _mm_cmpeq_epi32(isZero, g_XMZero);

__m128i t0 = _mm_and_si128(_mm_castps_si128(V), g_XMQNaNTest);
__m128i t1 = _mm_and_si128(_mm_castps_si128(V), g_XMInfinity);
t0 = _mm_cmpeq_epi32(t0, g_XMZero);
t1 = _mm_cmpeq_epi32(t1, g_XMInfinity);
__m128i isNaN = _mm_andnot_si128(t0, t1);

select0 = _mm_and_si128(isInfinite, g_XMInfinity);
select1 = _mm_andnot_si128(isInfinite, _mm_castps_si128(log2));
__m128i result = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isZero, g_XMNegInfinity);
select1 = _mm_andnot_si128(isZero, g_XMNegQNaN);
tmp = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isPositive, result);
select1 = _mm_andnot_si128(isPositive, tmp);
result = _mm_or_si128(select0, select1);

select0 = _mm_and_si128(isNaN, g_XMQNaN);
select1 = _mm_andnot_si128(isNaN, result);
result = _mm_or_si128(select0, select1);

return _mm_castsi128_ps(result);
#else // _XM_VMX128_INTRINSICS_
#endif // _XM_VMX128_INTRINSICS_
}

These all make use of new constants:

XMGLOBALCONST XMVECTORI32 g_XMExponentBias = {127, 127, 127, 127};
XMGLOBALCONST XMVECTORI32 g_XMSubnormalExponent = {-126, -126, -126, -126};
XMGLOBALCONST XMVECTORI32 g_XMNumTrailing = {23, 23, 23, 23};
XMGLOBALCONST XMVECTORI32 g_XMMinNormal = {0x00800000, 0x00800000, 0x00800000, 0x00800000};
XMGLOBALCONST XMVECTORI32 g_XMNegInfinity = {0xFF800000, 0xFF800000, 0xFF800000, 0xFF800000};
XMGLOBALCONST XMVECTORI32 g_XMNegQNaN = {0xFFC00000, 0xFFC00000, 0xFFC00000, 0xFFC00000};
XMGLOBALCONST XMVECTORI32 g_XMBin128 = {0x43000000, 0x43000000, 0x43000000, 0x43000000};
XMGLOBALCONST XMVECTORI32 g_XMBinNeg150 = {0xC3160000, 0xC3160000, 0xC3160000, 0xC3160000};
XMGLOBALCONST XMVECTORI32 g_XM253 = {253, 253, 253, 253};
XMGLOBALCONST XMVECTORF32 g_XMExpEst1 = {-6.93147182e-1f, -6.93147182e-1f, -6.93147182e-1f, -6.93147182e-1f};
XMGLOBALCONST XMVECTORF32 g_XMExpEst2 = {+2.40226462e-1f, +2.40226462e-1f, +2.40226462e-1f, +2.40226462e-1f};
XMGLOBALCONST XMVECTORF32 g_XMExpEst3 = {-5.55036440e-2f, -5.55036440e-2f, -5.55036440e-2f, -5.55036440e-2f};
XMGLOBALCONST XMVECTORF32 g_XMExpEst4 = {+9.61597636e-3f, +9.61597636e-3f, +9.61597636e-3f, +9.61597636e-3f};
XMGLOBALCONST XMVECTORF32 g_XMExpEst5 = {-1.32823968e-3f, -1.32823968e-3f, -1.32823968e-3f, -1.32823968e-3f};
XMGLOBALCONST XMVECTORF32 g_XMExpEst6 = {+1.47491097e-4f, +1.47491097e-4f, +1.47491097e-4f, +1.47491097e-4f};
XMGLOBALCONST XMVECTORF32 g_XMExpEst7 = {-1.08635004e-5f, -1.08635004e-5f, -1.08635004e-5f, -1.08635004e-5f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst0 = {+1.442693f, +1.442693f, +1.442693f, +1.442693f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst1 = {-0.721242f, -0.721242f, -0.721242f, -0.721242f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst2 = {+0.479384f, +0.479384f, +0.479384f, +0.479384f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst3 = {-0.350295f, -0.350295f, -0.350295f, -0.350295f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst4 = {+0.248590f, +0.248590f, +0.248590f, +0.248590f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst5 = {-0.145700f, -0.145700f, -0.145700f, -0.145700f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst6 = {+0.057148f, +0.057148f, +0.057148f, +0.057148f};
XMGLOBALCONST XMVECTORF32 g_XMLogEst7 = {-0.010578f, -0.010578f, -0.010578f, -0.010578f};
XMGLOBALCONST XMVECTORF32 g_XMLgE = {+1.442695f, +1.442695f, +1.442695f, +1.442695f};
XMGLOBALCONST XMVECTORF32 g_XMInvLgE = {+6.93147182e-1f, +6.93147182e-1f, +6.93147182e-1f, +6.93147182e-1f};

Related:Visual Studio 2013 and Windows 8.1 SDK RTM, DirectXMath: SSE, SSE2, and ARM-NEON, Introducing DirectXMath

Note that both DirectXTex and DirectXTK have been updated to work with the new version of DirectXMath 3.06 when available including the __vectorcall convention.


CodePlex VS 2013 Refresh

$
0
0

Now that VS 2013 has shipped, Windows 8.1 SDK is finished, and Windows 8.1 has hit GA--see this post for details--, I've made new releases of my CodePlex projects. Here is a summary of the changes since the last time I blogged about these projects.

All these updates includes the .props files needed to use the Windows 8.1 SDK with VS 2010 and VS 2012, as well as projects for VS 2013.

DirectX Tool Kit

http://go.microsoft.com/fwlink/?LinkId=248929

The October 2013 release includes support for the Visual Studio 2012 and 2013 Shader Designer (DGSL) via the new DGSLEffect, which can be used with both .CMO and .SDKMESH models via the DGSLEffectFactory. This includes support for both rigid models and skinned models. Also, the EffectFactory for BasicEffect has been updated to use SkinnedEffect for skinned models loaded from either .CMO or .SDKMESH. This update also fixes some problems with UV texture coordinates from .CMO models which were ignoring the materials UV transform matrix.

Details on DGSLEffect and other changes are covered on the CodePlex documentation wiki.

Note: Support for playing back .CMO keyframe animations and .SDKMESH_ANIM files is in progress. I hope to have it ready for release next month.

Over the summer a number of smaller improvements have been made to DirectXTK including use of sRGB metadata when loading JPEG, PNG, and TIFF files; support for setting custom encoder properties for the WIC version of ScreenGrab; and more GeometricPrimitive shapes including Cone, Tetrahedron, Octahedron, Dodecahedron, and Icosahedron. SimpleMath was added back in February as 'training wheels' for using DirectXMath and to simplify porting code from XNA Game Studio math.

The five versions of DirectXTK Simple Sample have been updated on MSDN Code Gallery for the October 2013 release.

Related:DirectXTK (March 2012), DirectXTK Update (Jan 2013)

DirectXTex

http://go.microsoft.com/fwlink/?LinkId=248926

The October 2013 release includes updates to take advantage of DirectXMath 3.06, as well as some fixes for sRGB handling with premultiplied alpha and with the BC7 DirectCompute compressor.

Related:DirectXTex (October 2011), DirectXTex Update (June 2013), DirectXTex and Effects 11 Update (August 2013)

Effects for Direct3D 11

http://go.microsoft.com/fwlink/p/?LinkId=271568

The October 2013 release (11.08) is a minor update for the new VS 2013 toolset and Windows 8.1 SDK.

Related:Effects for Direct3D 11 Update (October 2012), DirectXTex and Effects 11 Update (August 2013)

DXUT for Direct3D 11

http://go.microsoft.com/fwlink/?LinkId=320437

The October 2013 release (11.04) is a minor update for the new VS 2013 toolset and Windows 8.1 SDK.

Related: DXUT for Win32 Desktop Update (September 2013)

Visual Studio 2012 Update 4

$
0
0

An update to Visual Studio 2012 is now available for download. VS 2012 Update 4 was originally mentioned on Brian Harry's blog, and has now been officially released.

See KB 2872520.

Compiler and CRT

VS 2012 Update 4 includes a new version of the compiler (17.00.61030) and the C/C++ Runtime (11.00.61030).

MSDN Downloads has the updated retail redistribution packages, as well as the updated remote debugging tools packages.

Related: Visual Studio 2012 Update 1, Visual Studio 2012 Update 2, Visual Studio 2012 Update 3

DirectX Tool Kit for Audio

$
0
0

The December 2013 release of DirectXTK is now available on CodePlex, and includes a C++ implementation of the XNA Game Studio's low-level audio framework using XAudio2 and X3DAudio.

  • AudioEngine - This class represents an XAudio2 audio graph, device, and mastering voice; similar to XNA's AudioEngine.
  • SoundEffect - A container class for sound resources which can be loaded from .wav files similar to XNA's SoundEffect.
  • SoundEffectInstance - Provides a single playing, paused, or stopped instance of a sound similar to XNA's SoundEffectInstance.
  • DynamicSoundEffectInstance - SoundEffectInstance where the application provides the audio data on demand similar to XNA's DynamicSoundEffectInstance.
  • WaveBank - A container class for sound resources packaged into an XACT-style .xwb wave bank, similar to XNA's WaveBank but with support for directly playing one-shots and creating SoundEffectInstances that refer to entries in the wave bank.
  • AudioListener, AudioEmitter - Utility classes used with SoundEffectInstance::Apply3D.

DirectXTK for Audio uses XAudio 2.8 for Windows Store apps for Windows 8.1, Windows Store apps for Windows 8.0, Windows phone 8, and Xbox One*. The VS projects for these platforms all include the graphics and audio components.

When building Win32 desktop applications, you can either make use of XAudio 2.8 if targeting Windows 8.0 or later, or you can make use of XAudio 2.7 with the legacy DirectX SDK (June 2010) to target Windows Vista, Windows 7, or later. There is one VS project for the graphics component, another for the Windows 8.x version of the audio components, and another for the down-level version that requires the legacy DirectX SDK to build.

The DirectXTK package also includes a new command-line tool, XWBTool, which can be used to build XACT-style wave banks for more efficient management of audio data. DirectXTK for Audio does not make use of the legacy XACT Engine, XACT Cue, or XACT SoundBank. It only uses .xwb wave banks as a method for packing .wav data. The WaveBank class can use .xwb wave banks built with XWBTool or the legacy XACTBLD tool.

More detailed documentation, full release notes, and other information can be found on the DirectXTK CodePlex site.

Related:XAudio2 and Windows 8, DirectXTK (March 2012), DirectXTK Update (Jan 2013), CodePlex VS 2013 Refresh

* = The December 2013 releases of DirectXTK and DirectXTex on CodePlex fully support development for both Xbox One ADK and Xbox One XDK developers. See ID@Xbox.

Update: The January 2014 release of DirectXTK includes voice management and optional mastering volume limiter.

Visual Studio 2013 Update 1

Windows 10 SDK (November 2015)

$
0
0

The Windows 10 SDK for the November 2015 update of Windows 10 (build 10586) is now available. It can be installed via an optional install with VS 2015 Update 1 or as a standalone installer. This includes DirectXMath 3.08, Direct3D 11.4, Direct3D 12.0, DXGI 1.5, updates to Direct2D/DirectWrite 1.3, and XAudio 2.9.

GitHub: All of my open source project have new releases to support VS 2015 Update 1 and the Windows 10 SDK (10586): DirectXTK, DirectXTex, DirectXMesh, UVAtlas, Effects11, and DXUT11.

DirectX Developer Runtime: The DirectX Developer Runtime for Windows 10 is an optional feature called Graphics Tools as described in this blog post. When upgrading from 10240 to 10586, the optional feature can be disabled rather than updated, which can be fixed by re-enabling the optional feature. Note that WARP12 is part of the Graphics Tools optional feature as it’s currently intended only for use by developers.

XInput: For UWP, you can continue to use the XInput 1.4 API but need to change from linking to xinput.lib to xinputuap.lib. Alternatively, you can make use of the GamePad class in DirectX Tool Kit which uses the new Windows.Gaming.Input API. See XInput and Windows 8.

XAudio: With the Windows 10 SDK, if you are linking with xaudio2.lib you are linking against XAudio 2.9 and should build your application using _WIN32_WINNT=0x0A00. If you want to use XAudio 2.8 with the Windows 10 SDK, you need to set _WIN32_WINNT=0x0602 or _WIN32_WINNT=0x0603 and link against xaudio2_8.lib. See XAudio2 and Windows 8 for more details.

VS 2013 Users: As with the past few releases, the Windows 10 SDK only integrates with the latest Visual Studio, VS 2015. You can use the Windows 10 SDK with VS 2013 by using the props attached per this Visual C+ Team Blog.

Samples: As with the Windows 10 SDK RTM, official Windows samples are hosted on GitHub: Windows-universal-samplesWindows-classic-samples, Windows-driver-samples. Additional Direct3D 12 samples can be found in DirectX-Graphics-Samples. See also DirectX SDK Samples Catalog.

Related: Windows 10 SDK RTM, Windows 10 Anniversary Update SDK

Windows10SDKVS13-10586.zip

Viewing all 72 articles
Browse latest View live