From 79799e4f60eed040d100e821c52a8de34eaec8c2 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 11 Apr 2018 18:06:24 -0700 Subject: [PATCH] D3DX12 updates including VS 2017 (15.7 Preview) /analyze fixes --- DirectXTex/d3dx12.h | 166 ++++++++++++++++---------------------------- 1 file changed, 59 insertions(+), 107 deletions(-) diff --git a/DirectXTex/d3dx12.h b/DirectXTex/d3dx12.h index e28e539..d6b7180 100644 --- a/DirectXTex/d3dx12.h +++ b/DirectXTex/d3dx12.h @@ -33,8 +33,7 @@ inline bool operator!=( const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r ) //------------------------------------------------------------------------------------------------ struct CD3DX12_RECT : public D3D12_RECT { - CD3DX12_RECT() - {} + CD3DX12_RECT() = default; explicit CD3DX12_RECT( const D3D12_RECT& o ) : D3D12_RECT( o ) {} @@ -50,14 +49,12 @@ struct CD3DX12_RECT : public D3D12_RECT bottom = Bottom; } ~CD3DX12_RECT() {} - operator const D3D12_RECT&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_VIEWPORT : public D3D12_VIEWPORT { - CD3DX12_VIEWPORT() - {} + CD3DX12_VIEWPORT() = default; explicit CD3DX12_VIEWPORT( const D3D12_VIEWPORT& o ) : D3D12_VIEWPORT( o ) {} @@ -115,14 +112,12 @@ struct CD3DX12_VIEWPORT : public D3D12_VIEWPORT MaxDepth = maxDepth; } ~CD3DX12_VIEWPORT() {} - operator const D3D12_VIEWPORT&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_BOX : public D3D12_BOX { - CD3DX12_BOX() - {} + CD3DX12_BOX() = default; explicit CD3DX12_BOX( const D3D12_BOX& o ) : D3D12_BOX( o ) {} @@ -166,7 +161,6 @@ struct CD3DX12_BOX : public D3D12_BOX back = Back; } ~CD3DX12_BOX() {} - operator const D3D12_BOX&() const { return *this; } }; inline bool operator==( const D3D12_BOX& l, const D3D12_BOX& r ) { @@ -179,8 +173,7 @@ inline bool operator!=( const D3D12_BOX& l, const D3D12_BOX& r ) //------------------------------------------------------------------------------------------------ struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC { - CD3DX12_DEPTH_STENCIL_DESC() - {} + CD3DX12_DEPTH_STENCIL_DESC() = default; explicit CD3DX12_DEPTH_STENCIL_DESC( const D3D12_DEPTH_STENCIL_DESC& o ) : D3D12_DEPTH_STENCIL_DESC( o ) {} @@ -229,7 +222,6 @@ struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC BackFace.StencilFunc = backStencilFunc; } ~CD3DX12_DEPTH_STENCIL_DESC() {} - operator const D3D12_DEPTH_STENCIL_DESC&() const { return *this; } }; //------------------------------------------------------------------------------------------------ @@ -237,8 +229,7 @@ struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC #if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) struct CD3DX12_DEPTH_STENCIL_DESC1 : public D3D12_DEPTH_STENCIL_DESC1 { - CD3DX12_DEPTH_STENCIL_DESC1() - {} + CD3DX12_DEPTH_STENCIL_DESC1() = default; explicit CD3DX12_DEPTH_STENCIL_DESC1( const D3D12_DEPTH_STENCIL_DESC1& o ) : D3D12_DEPTH_STENCIL_DESC1( o ) {} @@ -308,8 +299,7 @@ struct CD3DX12_DEPTH_STENCIL_DESC1 : public D3D12_DEPTH_STENCIL_DESC1 DepthBoundsTestEnable = depthBoundsTestEnable; } ~CD3DX12_DEPTH_STENCIL_DESC1() {} - operator const D3D12_DEPTH_STENCIL_DESC1&() const { return *this; } - operator const D3D12_DEPTH_STENCIL_DESC() const + operator D3D12_DEPTH_STENCIL_DESC() const { D3D12_DEPTH_STENCIL_DESC D; D.DepthEnable = DepthEnable; @@ -334,8 +324,7 @@ struct CD3DX12_DEPTH_STENCIL_DESC1 : public D3D12_DEPTH_STENCIL_DESC1 //------------------------------------------------------------------------------------------------ struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC { - CD3DX12_BLEND_DESC() - {} + CD3DX12_BLEND_DESC() = default; explicit CD3DX12_BLEND_DESC( const D3D12_BLEND_DESC& o ) : D3D12_BLEND_DESC( o ) {} @@ -355,14 +344,12 @@ struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC RenderTarget[ i ] = defaultRenderTargetBlendDesc; } ~CD3DX12_BLEND_DESC() {} - operator const D3D12_BLEND_DESC&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC { - CD3DX12_RASTERIZER_DESC() - {} + CD3DX12_RASTERIZER_DESC() = default; explicit CD3DX12_RASTERIZER_DESC( const D3D12_RASTERIZER_DESC& o ) : D3D12_RASTERIZER_DESC( o ) {} @@ -406,14 +393,12 @@ struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC ConservativeRaster = conservativeRaster; } ~CD3DX12_RASTERIZER_DESC() {} - operator const D3D12_RASTERIZER_DESC&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO { - CD3DX12_RESOURCE_ALLOCATION_INFO() - {} + CD3DX12_RESOURCE_ALLOCATION_INFO() = default; explicit CD3DX12_RESOURCE_ALLOCATION_INFO( const D3D12_RESOURCE_ALLOCATION_INFO& o ) : D3D12_RESOURCE_ALLOCATION_INFO( o ) {} @@ -424,14 +409,12 @@ struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO SizeInBytes = size; Alignment = alignment; } - operator const D3D12_RESOURCE_ALLOCATION_INFO&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES { - CD3DX12_HEAP_PROPERTIES() - {} + CD3DX12_HEAP_PROPERTIES() = default; explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES &o) : D3D12_HEAP_PROPERTIES(o) {} @@ -458,7 +441,6 @@ struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES CreationNodeMask = creationNodeMask; VisibleNodeMask = nodeMask; } - operator const D3D12_HEAP_PROPERTIES&() const { return *this; } bool IsCPUAccessible() const { return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK || (Type == D3D12_HEAP_TYPE_CUSTOM && @@ -478,8 +460,7 @@ inline bool operator!=( const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERT //------------------------------------------------------------------------------------------------ struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC { - CD3DX12_HEAP_DESC() - {} + CD3DX12_HEAP_DESC() = default; explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC &o) : D3D12_HEAP_DESC(o) {} @@ -548,7 +529,6 @@ struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC Alignment = resAllocInfo.Alignment; Flags = flags; } - operator const D3D12_HEAP_DESC&() const { return *this; } bool IsCPUAccessible() const { return static_cast< const CD3DX12_HEAP_PROPERTIES* >( &Properties )->IsCPUAccessible(); } }; @@ -565,8 +545,7 @@ inline bool operator!=( const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r ) //------------------------------------------------------------------------------------------------ struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE { - CD3DX12_CLEAR_VALUE() - {} + CD3DX12_CLEAR_VALUE() = default; explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE &o) : D3D12_CLEAR_VALUE(o) {} @@ -587,14 +566,12 @@ struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE memcpy( &DepthStencil.Depth, &depth, sizeof( depth ) ); DepthStencil.Stencil = stencil; } - operator const D3D12_CLEAR_VALUE&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_RANGE : public D3D12_RANGE { - CD3DX12_RANGE() - {} + CD3DX12_RANGE() = default; explicit CD3DX12_RANGE(const D3D12_RANGE &o) : D3D12_RANGE(o) {} @@ -605,7 +582,6 @@ struct CD3DX12_RANGE : public D3D12_RANGE Begin = begin; End = end; } - operator const D3D12_RANGE&() const { return *this; } }; //------------------------------------------------------------------------------------------------ @@ -613,8 +589,7 @@ struct CD3DX12_RANGE : public D3D12_RANGE #if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) struct CD3DX12_RANGE_UINT64 : public D3D12_RANGE_UINT64 { - CD3DX12_RANGE_UINT64() - {} + CD3DX12_RANGE_UINT64() = default; explicit CD3DX12_RANGE_UINT64(const D3D12_RANGE_UINT64 &o) : D3D12_RANGE_UINT64(o) {} @@ -625,14 +600,12 @@ struct CD3DX12_RANGE_UINT64 : public D3D12_RANGE_UINT64 Begin = begin; End = end; } - operator const D3D12_RANGE_UINT64&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_SUBRESOURCE_RANGE_UINT64 : public D3D12_SUBRESOURCE_RANGE_UINT64 { - CD3DX12_SUBRESOURCE_RANGE_UINT64() - {} + CD3DX12_SUBRESOURCE_RANGE_UINT64() = default; explicit CD3DX12_SUBRESOURCE_RANGE_UINT64(const D3D12_SUBRESOURCE_RANGE_UINT64 &o) : D3D12_SUBRESOURCE_RANGE_UINT64(o) {} @@ -652,15 +625,13 @@ struct CD3DX12_SUBRESOURCE_RANGE_UINT64 : public D3D12_SUBRESOURCE_RANGE_UINT64 Range.Begin = begin; Range.End = end; } - operator const D3D12_SUBRESOURCE_RANGE_UINT64&() const { return *this; } }; #endif //------------------------------------------------------------------------------------------------ struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE { - CD3DX12_SHADER_BYTECODE() - {} + CD3DX12_SHADER_BYTECODE() = default; explicit CD3DX12_SHADER_BYTECODE(const D3D12_SHADER_BYTECODE &o) : D3D12_SHADER_BYTECODE(o) {} @@ -677,14 +648,12 @@ struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE pShaderBytecode = _pShaderBytecode; BytecodeLength = bytecodeLength; } - operator const D3D12_SHADER_BYTECODE&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE { - CD3DX12_TILED_RESOURCE_COORDINATE() - {} + CD3DX12_TILED_RESOURCE_COORDINATE() = default; explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE &o) : D3D12_TILED_RESOURCE_COORDINATE(o) {} @@ -699,14 +668,12 @@ struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINAT Z = z; Subresource = subresource; } - operator const D3D12_TILED_RESOURCE_COORDINATE&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE { - CD3DX12_TILE_REGION_SIZE() - {} + CD3DX12_TILE_REGION_SIZE() = default; explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE &o) : D3D12_TILE_REGION_SIZE(o) {} @@ -723,14 +690,12 @@ struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE Height = height; Depth = depth; } - operator const D3D12_TILE_REGION_SIZE&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING { - CD3DX12_SUBRESOURCE_TILING() - {} + CD3DX12_SUBRESOURCE_TILING() = default; explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING &o) : D3D12_SUBRESOURCE_TILING(o) {} @@ -745,14 +710,12 @@ struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING DepthInTiles = depthInTiles; StartTileIndexInOverallResource = startTileIndexInOverallResource; } - operator const D3D12_SUBRESOURCE_TILING&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE { - CD3DX12_TILE_SHAPE() - {} + CD3DX12_TILE_SHAPE() = default; explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE &o) : D3D12_TILE_SHAPE(o) {} @@ -765,14 +728,12 @@ struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE HeightInTexels = heightInTexels; DepthInTexels = depthInTexels; } - operator const D3D12_TILE_SHAPE&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER { - CD3DX12_RESOURCE_BARRIER() - {} + CD3DX12_RESOURCE_BARRIER() = default; explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) : D3D12_RESOURCE_BARRIER(o) {} @@ -816,14 +777,12 @@ struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER barrier.UAV.pResource = pResource; return result; } - operator const D3D12_RESOURCE_BARRIER&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO { - CD3DX12_PACKED_MIP_INFO() - {} + CD3DX12_PACKED_MIP_INFO() = default; explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO &o) : D3D12_PACKED_MIP_INFO(o) {} @@ -838,14 +797,12 @@ struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO NumTilesForPackedMips = numTilesForPackedMips; StartTileIndexInOverallResource = startTileIndexInOverallResource; } - operator const D3D12_PACKED_MIP_INFO&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT { - CD3DX12_SUBRESOURCE_FOOTPRINT() - {} + CD3DX12_SUBRESOURCE_FOOTPRINT() = default; explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT &o) : D3D12_SUBRESOURCE_FOOTPRINT(o) {} @@ -872,14 +829,12 @@ struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1); RowPitch = rowPitch; } - operator const D3D12_SUBRESOURCE_FOOTPRINT&() const { return *this; } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION { - CD3DX12_TEXTURE_COPY_LOCATION() - {} + CD3DX12_TEXTURE_COPY_LOCATION() = default; explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION &o) : D3D12_TEXTURE_COPY_LOCATION(o) {} @@ -901,7 +856,7 @@ struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION //------------------------------------------------------------------------------------------------ struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE { - CD3DX12_DESCRIPTOR_RANGE() { } + CD3DX12_DESCRIPTOR_RANGE() = default; explicit CD3DX12_DESCRIPTOR_RANGE(const D3D12_DESCRIPTOR_RANGE &o) : D3D12_DESCRIPTOR_RANGE(o) {} @@ -947,7 +902,7 @@ struct CD3DX12_DESCRIPTOR_RANGE : public D3D12_DESCRIPTOR_RANGE //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE { - CD3DX12_ROOT_DESCRIPTOR_TABLE() {} + CD3DX12_ROOT_DESCRIPTOR_TABLE() = default; explicit CD3DX12_ROOT_DESCRIPTOR_TABLE(const D3D12_ROOT_DESCRIPTOR_TABLE &o) : D3D12_ROOT_DESCRIPTOR_TABLE(o) {} @@ -978,7 +933,7 @@ struct CD3DX12_ROOT_DESCRIPTOR_TABLE : public D3D12_ROOT_DESCRIPTOR_TABLE //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS { - CD3DX12_ROOT_CONSTANTS() {} + CD3DX12_ROOT_CONSTANTS() = default; explicit CD3DX12_ROOT_CONSTANTS(const D3D12_ROOT_CONSTANTS &o) : D3D12_ROOT_CONSTANTS(o) {} @@ -1013,7 +968,7 @@ struct CD3DX12_ROOT_CONSTANTS : public D3D12_ROOT_CONSTANTS //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR { - CD3DX12_ROOT_DESCRIPTOR() {} + CD3DX12_ROOT_DESCRIPTOR() = default; explicit CD3DX12_ROOT_DESCRIPTOR(const D3D12_ROOT_DESCRIPTOR &o) : D3D12_ROOT_DESCRIPTOR(o) {} @@ -1041,7 +996,7 @@ struct CD3DX12_ROOT_DESCRIPTOR : public D3D12_ROOT_DESCRIPTOR //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER { - CD3DX12_ROOT_PARAMETER() {} + CD3DX12_ROOT_PARAMETER() = default; explicit CD3DX12_ROOT_PARAMETER(const D3D12_ROOT_PARAMETER &o) : D3D12_ROOT_PARAMETER(o) {} @@ -1147,7 +1102,7 @@ struct CD3DX12_ROOT_PARAMETER : public D3D12_ROOT_PARAMETER //------------------------------------------------------------------------------------------------ struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC { - CD3DX12_STATIC_SAMPLER_DESC() {} + CD3DX12_STATIC_SAMPLER_DESC() = default; explicit CD3DX12_STATIC_SAMPLER_DESC(const D3D12_STATIC_SAMPLER_DESC &o) : D3D12_STATIC_SAMPLER_DESC(o) {} @@ -1249,7 +1204,7 @@ struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC { - CD3DX12_ROOT_SIGNATURE_DESC() {} + CD3DX12_ROOT_SIGNATURE_DESC() = default; explicit CD3DX12_ROOT_SIGNATURE_DESC(const D3D12_ROOT_SIGNATURE_DESC &o) : D3D12_ROOT_SIGNATURE_DESC(o) {} @@ -1296,7 +1251,7 @@ struct CD3DX12_ROOT_SIGNATURE_DESC : public D3D12_ROOT_SIGNATURE_DESC //------------------------------------------------------------------------------------------------ struct CD3DX12_DESCRIPTOR_RANGE1 : public D3D12_DESCRIPTOR_RANGE1 { - CD3DX12_DESCRIPTOR_RANGE1() { } + CD3DX12_DESCRIPTOR_RANGE1() = default; explicit CD3DX12_DESCRIPTOR_RANGE1(const D3D12_DESCRIPTOR_RANGE1 &o) : D3D12_DESCRIPTOR_RANGE1(o) {} @@ -1346,7 +1301,7 @@ struct CD3DX12_DESCRIPTOR_RANGE1 : public D3D12_DESCRIPTOR_RANGE1 //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_DESCRIPTOR_TABLE1 : public D3D12_ROOT_DESCRIPTOR_TABLE1 { - CD3DX12_ROOT_DESCRIPTOR_TABLE1() {} + CD3DX12_ROOT_DESCRIPTOR_TABLE1() = default; explicit CD3DX12_ROOT_DESCRIPTOR_TABLE1(const D3D12_ROOT_DESCRIPTOR_TABLE1 &o) : D3D12_ROOT_DESCRIPTOR_TABLE1(o) {} @@ -1377,7 +1332,7 @@ struct CD3DX12_ROOT_DESCRIPTOR_TABLE1 : public D3D12_ROOT_DESCRIPTOR_TABLE1 //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_DESCRIPTOR1 : public D3D12_ROOT_DESCRIPTOR1 { - CD3DX12_ROOT_DESCRIPTOR1() {} + CD3DX12_ROOT_DESCRIPTOR1() = default; explicit CD3DX12_ROOT_DESCRIPTOR1(const D3D12_ROOT_DESCRIPTOR1 &o) : D3D12_ROOT_DESCRIPTOR1(o) {} @@ -1412,7 +1367,7 @@ struct CD3DX12_ROOT_DESCRIPTOR1 : public D3D12_ROOT_DESCRIPTOR1 //------------------------------------------------------------------------------------------------ struct CD3DX12_ROOT_PARAMETER1 : public D3D12_ROOT_PARAMETER1 { - CD3DX12_ROOT_PARAMETER1() {} + CD3DX12_ROOT_PARAMETER1() = default; explicit CD3DX12_ROOT_PARAMETER1(const D3D12_ROOT_PARAMETER1 &o) : D3D12_ROOT_PARAMETER1(o) {} @@ -1524,7 +1479,7 @@ struct CD3DX12_ROOT_PARAMETER1 : public D3D12_ROOT_PARAMETER1 //------------------------------------------------------------------------------------------------ struct CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC : public D3D12_VERSIONED_ROOT_SIGNATURE_DESC { - CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC() {} + CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC() = default; explicit CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC &o) : D3D12_VERSIONED_ROOT_SIGNATURE_DESC(o) {} @@ -1617,7 +1572,7 @@ struct CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC : public D3D12_VERSIONED_ROOT_SIGNA //------------------------------------------------------------------------------------------------ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE { - CD3DX12_CPU_DESCRIPTOR_HANDLE() {} + CD3DX12_CPU_DESCRIPTOR_HANDLE() = default; explicit CD3DX12_CPU_DESCRIPTOR_HANDLE(const D3D12_CPU_DESCRIPTOR_HANDLE &o) : D3D12_CPU_DESCRIPTOR_HANDLE(o) {} @@ -1632,7 +1587,7 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE } CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) { - ptr += offsetInDescriptors * descriptorIncrementSize; + ptr += UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); return *this; } CD3DX12_CPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) @@ -1653,7 +1608,7 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE ptr = other.ptr; return *this; } - + inline void InitOffsetted(_In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) { InitOffsetted(*this, base, offsetScaledByIncrementSize); @@ -1671,14 +1626,14 @@ struct CD3DX12_CPU_DESCRIPTOR_HANDLE : public D3D12_CPU_DESCRIPTOR_HANDLE static inline void InitOffsetted(_Out_ D3D12_CPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_CPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) { - handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + handle.ptr = base.ptr + UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); } }; //------------------------------------------------------------------------------------------------ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE { - CD3DX12_GPU_DESCRIPTOR_HANDLE() {} + CD3DX12_GPU_DESCRIPTOR_HANDLE() = default; explicit CD3DX12_GPU_DESCRIPTOR_HANDLE(const D3D12_GPU_DESCRIPTOR_HANDLE &o) : D3D12_GPU_DESCRIPTOR_HANDLE(o) {} @@ -1693,7 +1648,7 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE } CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetInDescriptors, UINT descriptorIncrementSize) { - ptr += offsetInDescriptors * descriptorIncrementSize; + ptr += UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); return *this; } CD3DX12_GPU_DESCRIPTOR_HANDLE& Offset(INT offsetScaledByIncrementSize) @@ -1714,7 +1669,7 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE ptr = other.ptr; return *this; } - + inline void InitOffsetted(_In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetScaledByIncrementSize) { InitOffsetted(*this, base, offsetScaledByIncrementSize); @@ -1732,7 +1687,7 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE static inline void InitOffsetted(_Out_ D3D12_GPU_DESCRIPTOR_HANDLE &handle, _In_ const D3D12_GPU_DESCRIPTOR_HANDLE &base, INT offsetInDescriptors, UINT descriptorIncrementSize) { - handle.ptr = base.ptr + offsetInDescriptors * descriptorIncrementSize; + handle.ptr = base.ptr + UINT64(offsetInDescriptors) * UINT64(descriptorIncrementSize); } }; @@ -1768,8 +1723,7 @@ inline UINT8 D3D12GetFormatPlaneCount( //------------------------------------------------------------------------------------------------ struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC { - CD3DX12_RESOURCE_DESC() - {} + CD3DX12_RESOURCE_DESC() = default; explicit CD3DX12_RESOURCE_DESC( const D3D12_RESOURCE_DESC& o ) : D3D12_RESOURCE_DESC( o ) {} @@ -1863,7 +1817,6 @@ struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC { return MipLevels * ArraySize() * PlaneCount(pDevice); } inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) { return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); } - operator const D3D12_RESOURCE_DESC&() const { return *this; } }; inline bool operator==( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r ) { @@ -1887,8 +1840,7 @@ inline bool operator!=( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& #if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3) struct CD3DX12_VIEW_INSTANCING_DESC : public D3D12_VIEW_INSTANCING_DESC { - CD3DX12_VIEW_INSTANCING_DESC() - {} + CD3DX12_VIEW_INSTANCING_DESC() = default; explicit CD3DX12_VIEW_INSTANCING_DESC( const D3D12_VIEW_INSTANCING_DESC& o ) : D3D12_VIEW_INSTANCING_DESC( o ) {} @@ -1908,7 +1860,6 @@ struct CD3DX12_VIEW_INSTANCING_DESC : public D3D12_VIEW_INSTANCING_DESC Flags = InFlags; } ~CD3DX12_VIEW_INSTANCING_DESC() {} - operator const D3D12_VIEW_INSTANCING_DESC&() const { return *this; } }; #endif @@ -1988,7 +1939,7 @@ inline UINT64 UpdateSubresources( for (UINT i = 0; i < NumSubresources; ++i) { if (pRowSizesInBytes[i] > (SIZE_T)-1) return 0; - D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, pLayouts[i].Footprint.RowPitch * pNumRows[i] }; + D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, SIZE_T(pLayouts[i].Footprint.RowPitch) * SIZE_T(pNumRows[i]) }; MemcpySubresource(&DestData, &pSrcData[i], (SIZE_T)pRowSizesInBytes[i], pNumRows[i], pLayouts[i].Footprint.Depth); } pIntermediate->Unmap(0, NULL); @@ -2213,7 +2164,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature( #if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) struct CD3DX12_RT_FORMAT_ARRAY : public D3D12_RT_FORMAT_ARRAY { - CD3DX12_RT_FORMAT_ARRAY() {} + CD3DX12_RT_FORMAT_ARRAY() = default; explicit CD3DX12_RT_FORMAT_ARRAY(const D3D12_RT_FORMAT_ARRAY& o) : D3D12_RT_FORMAT_ARRAY(o) {} @@ -2223,7 +2174,6 @@ struct CD3DX12_RT_FORMAT_ARRAY : public D3D12_RT_FORMAT_ARRAY memcpy(RTFormats, pFormats, sizeof(RTFormats)); // assumes ARRAY_SIZE(pFormats) == ARRAY_SIZE(RTFormats) } - operator const D3D12_RT_FORMAT_ARRAY&() const { return *this; } }; //------------------------------------------------------------------------------------------------ @@ -2245,7 +2195,7 @@ private: D3D12_PIPELINE_STATE_SUBOBJECT_TYPE _Type; InnerStructType _Inner; public: - CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT() : _Type(Type), _Inner(DefaultArg()) {} + CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT() noexcept : _Type(Type), _Inner(DefaultArg()) {} CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT(InnerStructType const& i) : _Type(Type), _Inner(i) {} CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT& operator=(InnerStructType const& i) { _Inner = i; return *this; } operator InnerStructType() const { return _Inner; } @@ -2323,7 +2273,7 @@ struct ID3DX12PipelineParserCallbacks // Use CD3DX12_PIPELINE_STATE_STREAM for RS2+ support. struct CD3DX12_PIPELINE_STATE_STREAM1 { - CD3DX12_PIPELINE_STATE_STREAM1() {} + CD3DX12_PIPELINE_STATE_STREAM1() = default; CD3DX12_PIPELINE_STATE_STREAM1(const D3D12_GRAPHICS_PIPELINE_STATE_DESC& Desc) : Flags(Desc.Flags) , NodeMask(Desc.NodeMask) @@ -2353,7 +2303,9 @@ struct CD3DX12_PIPELINE_STATE_STREAM1 , pRootSignature(Desc.pRootSignature) , CS(CD3DX12_SHADER_BYTECODE(Desc.CS)) , CachedPSO(Desc.CachedPSO) - {} + { + static_cast(DepthStencilState).DepthEnable = false; + } CD3DX12_PIPELINE_STATE_STREAM_FLAGS Flags; CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK NodeMask; CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE pRootSignature; @@ -2419,7 +2371,7 @@ struct CD3DX12_PIPELINE_STATE_STREAM1 // See CD3DX12_PIPELINE_STATE_STREAM1 for instance. struct CD3DX12_PIPELINE_STATE_STREAM { - CD3DX12_PIPELINE_STATE_STREAM() {} + CD3DX12_PIPELINE_STATE_STREAM() = default; CD3DX12_PIPELINE_STATE_STREAM(const D3D12_GRAPHICS_PIPELINE_STATE_DESC& Desc) : Flags(Desc.Flags) , NodeMask(Desc.NodeMask) @@ -2515,7 +2467,7 @@ struct CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER : public ID3DX12PipelineParser #else CD3DX12_PIPELINE_STATE_STREAM PipelineStream; #endif - CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER() + CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER() noexcept : SeenDSS(false) { // Adjust defaults to account for absent members. @@ -2524,6 +2476,7 @@ struct CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER : public ID3DX12PipelineParser // Depth disabled if no DSV format specified. static_cast(PipelineStream.DepthStencilState).DepthEnable = false; } + virtual ~CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER() {} // ID3DX12PipelineParserCallbacks void FlagsCb(D3D12_PIPELINE_STATE_FLAGS Flags) {PipelineStream.Flags = Flags;} @@ -2588,15 +2541,14 @@ inline D3D12_PIPELINE_STATE_SUBOBJECT_TYPE D3DX12GetBaseSubobjectType(D3D12_PIPE inline HRESULT D3DX12ParsePipelineStream(const D3D12_PIPELINE_STATE_STREAM_DESC& Desc, ID3DX12PipelineParserCallbacks* pCallbacks) { - if (Desc.SizeInBytes == 0 || Desc.pPipelineStateSubobjectStream == nullptr) + if (pCallbacks == nullptr) { - pCallbacks->ErrorBadInputParameter(1); // first parameter issue return E_INVALIDARG; } - if (pCallbacks == nullptr) + if (Desc.SizeInBytes == 0 || Desc.pPipelineStateSubobjectStream == nullptr) { - pCallbacks->ErrorBadInputParameter(2); // second parameter issue + pCallbacks->ErrorBadInputParameter(1); // first parameter issue return E_INVALIDARG; }