D3DX11Create*From* Sample

Open
#8 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start by reviewing the DirectXTex sample structure and comparing the four listed D3DX11CreateFromFile and D3DX11CreateFromMemory operations with the existing DirectXTex capabilities. Done means a utility demonstrates the equivalent synchronous texture and shader-resource-view workflows, including the listed load options, while excluding ThreadPump asynchronous loading.

Written by the indexing model from the issue text.

Description

documentation

There's no directly equivalent DirectXTex function to the legacy D3DX11 functions D3DX11CreateTextureFromFile, D3DX11CreateShaderResourceViewFromFile, D3DX11CreateTextureFromMemory, and D3DX11CreateShaderResourceViewFromMemory. The same operations can be performed by DirectXTex, and generally these old functions are total overkill for most users.

However, a utility that demonstrates how to implement all the old 'full-fat' functionality' could be useful for porting as well as be a good sample of how to use DirectXTex in complex ways (rather than just texconv/texassemble).

Note that I won't be implementing the "ThreadPump" async loader behavior that is tied into some D3DX11 only tech

typedef enum D3DX11_FILTER_FLAG { 
  D3DX11_FILTER_NONE              = (1 << 0),
  D3DX11_FILTER_POINT             = (2 << 0),
  D3DX11_FILTER_LINEAR            = (3 << 0),
  D3DX11_FILTER_TRIANGLE          = (4 << 0),
  D3DX11_FILTER_BOX               = (5 << 0),
  D3DX11_FILTER_MIRROR_U          = (1 << 16),
  D3DX11_FILTER_MIRROR_V          = (2 << 16),
  D3DX11_FILTER_MIRROR_W          = (4 << 16),
  D3DX11_FILTER_MIRROR            = (7 << 16),
  D3DX11_FILTER_DITHER            = (1 << 19),
  D3DX11_FILTER_DITHER_DIFFUSION  = (2 << 19),
  D3DX11_FILTER_SRGB_IN           = (1 << 21),
  D3DX11_FILTER_SRGB_OUT          = (2 << 21),
  D3DX11_FILTER_SRGB              = (3 << 21)
} D3DX11_FILTER_FLAG, *LPD3DX11_FILTER_FLAG;

typedef struct D3DX11_IMAGE_LOAD_INFO {
  UINT              Width;
  UINT              Height;
  UINT              Depth;
  UINT              FirstMipLevel;
  UINT              MipLevels;
  D3D11_USAGE       Usage;
  UINT              BindFlags;
  UINT              CpuAccessFlags;
  UINT              MiscFlags;
  DXGI_FORMAT       Format;
  UINT              Filter;
  UINT              MipFilter;
  D3DX11_IMAGE_INFO *pSrcInfo;
} D3DX11_IMAGE_LOAD_INFO, *LPD3DX11_IMAGE_LOAD_INFO;

HRESULT D3DX11CreateTextureFromFile(
  _In_   ID3D11Device *pDevice,
  _In_   LPCTSTR pSrcFile,
  _In_   D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
  _Out_  ID3D11Resource **ppTexture
);

HRESULT D3DX11CreateTextureFromMemory(
  _In_   ID3D11Device *pDevice,
  _In_   LPCVOID pSrcData,
  _In_   SIZE_T SrcDataSize,
  _In_   D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
  _Out_  ID3D11Resource **ppTexture
);

HRESULT D3DX11CreateShaderResourceViewFromFile(
  _In_   ID3D11Device *pDevice,
  _In_   LPCTSTR pSrcFile,
  _In_   D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
  _Out_  ID3D11ShaderResourceView **ppShaderResourceView
);

HRESULT D3DX11CreateShaderResourceViewFromMemory(
  _In_   ID3D11Device *pDevice,
  _In_   LPCVOID pSrcData,
  _In_   SIZE_T SrcDataSize,
  _In_   D3DX11_IMAGE_LOAD_INFO *pLoadInfo,
 _Out_  ID3D11ShaderResourceView **ppShaderResourceView
);
Dominant language
C++
Stars
2.2k
Forks
498
Avg merge
2d 5h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectXTex

All issues in microsoft/DirectXTex

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.