Skip to content

Commit

Permalink
Direct3D 11 doesn't use strongly-typed enum bitmask flags
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed May 31, 2020
1 parent 6b1e199 commit f4eb038
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Inc/BufferHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ namespace DirectX
_In_reads_bytes_(count* stride) const void* ptr,
size_t count,
size_t stride,
D3D11_BIND_FLAG bindFlags,
unsigned int bindFlags,
_COM_Outptr_ ID3D11Buffer** pBuffer) noexcept;

template<typename T>
HRESULT CreateStaticBuffer(_In_ ID3D11Device* device,
_In_reads_(count) T const* data,
size_t count,
D3D11_BIND_FLAG bindFlags,
unsigned int bindFlags,
_COM_Outptr_ ID3D11Buffer** pBuffer) noexcept
{
return CreateStaticBuffer(device, data, count, sizeof(T), bindFlags, pBuffer);
Expand All @@ -44,7 +44,7 @@ namespace DirectX
template<typename T>
HRESULT CreateStaticBuffer(_In_ ID3D11Device* device,
T const& data,
D3D11_BIND_FLAG bindFlags,
unsigned int bindFlags,
_COM_Outptr_ ID3D11Buffer** pBuffer) noexcept
{
return CreateStaticBuffer(device, data.data(), data.size(), sizeof(typename T::value_type), bindFlags, pBuffer);
Expand All @@ -57,15 +57,15 @@ namespace DirectX
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture1D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView,
D3D11_BIND_FLAG bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;
unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;

HRESULT __cdecl CreateTextureFromMemory(_In_ ID3D11Device* device,
size_t width, size_t height,
DXGI_FORMAT format,
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture2D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView,
D3D11_BIND_FLAG bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;
unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;

HRESULT __cdecl CreateTextureFromMemory(
#if defined(_XBOX_ONE) && defined(_TITLE)
Expand All @@ -87,7 +87,7 @@ namespace DirectX
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture3D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView,
D3D11_BIND_FLAG bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;
unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;

// Strongly typed wrapper around a Direct3D constant buffer.
namespace Internal
Expand Down
8 changes: 4 additions & 4 deletions Src/BufferHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ HRESULT DirectX::CreateStaticBuffer(
const void* ptr,
size_t count,
size_t stride,
D3D11_BIND_FLAG bindFlags,
unsigned int bindFlags,
ID3D11Buffer** pBuffer) noexcept
{
if (!pBuffer)
Expand Down Expand Up @@ -64,7 +64,7 @@ HRESULT DirectX::CreateTextureFromMemory(
const D3D11_SUBRESOURCE_DATA& initData,
ID3D11Texture1D** texture,
ID3D11ShaderResourceView** textureView,
D3D11_BIND_FLAG bindFlags) noexcept
unsigned int bindFlags) noexcept
{
if (texture)
{
Expand Down Expand Up @@ -125,7 +125,7 @@ HRESULT DirectX::CreateTextureFromMemory(
const D3D11_SUBRESOURCE_DATA& initData,
ID3D11Texture2D** texture,
ID3D11ShaderResourceView** textureView,
D3D11_BIND_FLAG bindFlags) noexcept
unsigned int bindFlags) noexcept
{
if (texture)
{
Expand Down Expand Up @@ -295,7 +295,7 @@ HRESULT DirectX::CreateTextureFromMemory(
const D3D11_SUBRESOURCE_DATA& initData,
ID3D11Texture3D** texture,
ID3D11ShaderResourceView** textureView,
D3D11_BIND_FLAG bindFlags) noexcept
unsigned int bindFlags) noexcept
{
if (texture)
{
Expand Down

0 comments on commit f4eb038

Please sign in to comment.