Post

HelloWinHlsl

Hello Windows Hlsl

Hlsl shader C++ library. Supports DirectX 9, DirectX 10, DirectX 11, DirectX 12. An attempt to understand the history of the development of shaders in DirectX. Provides an interface to customized DirectX of all versions, in one source file. You can see how the program code on the DirectX client side becomes more complicated. There are several examples of working with the library.

In general, it is suggested to use the library as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using CurDxVer = DxVer::v12;

template<class T> class seascape; // primary template

template<> class seascape<DxVer::v9> : public CurClientApp<DxVer::v9> { using T = DxVer::v9;
	bool init(DxCtx<T>::cref_ptr_t crpustDxCtx, ToolCtx<T>::cref_ptr_t puoTools, Adjust<T>* poAdjustDxAux) {
		// ... puoTools ->shader( ) ->loader( )
		// ... crpustDxCtx ->m_pcD3dDevice ->SetVertexShader( ... );
		// ... puoTools ->quad( ) ->createVertexBuf( );
	}
	void render_frame(DxCtx<T>::cref_ptr_t crpustDxCtx, Dynamic<T>::cref_ptr_t) {
		// ... crpustDxCtx ->m_pcD3dDevice ->BeginScene( );
	}
};

template<> class seascape<DxVer::v12> : public CurClientApp<DxVer::v12> { using T = DxVer::v12;
	bool init(DxCtx<T>::cref_ptr_t, ToolCtx<T>::cref_ptr_t puoTools, Adjust<T>* poAdjustDxAux) {
		// ... puoTools ->shader( ) ->loader( )
		// ... poAdjustDxAux ->onSetPso( ... )
	}
	void render_frame(DxCtx<T>::cref_ptr_t, Dynamic<T>::cref_ptr_t crpsoDynamic) {
		// ... crpsoDynamic ->m_pcCommandList ->IASetVertexBuffers( 0, 1, &m_stVertexBufferView );
	}
};

uptr<Sys::HolderClientApp> ClientTy::entryPoint() { return std::make_unique< Sys::HolderClientApp >( new seascape<CurDxVer> ); }
Config::uptrc_t ClientTy::configure() { return ClientApp::Configurator::Predef::getDefault( ); }

You can see that CurDxVer = DxVer::v12; indicates that the software will be compiled to work with DirectX 12.

Reports

StaticAnalysis

cpplint cppcheck

CodeMetrix

LinesOfСode Comments

GoogleTest

amount testsuites tests coverage

a link to repo

Under construction

TODO

  • Dx9
  • Dx10
  • Dx11
  • Dx12
  • API documentation
  • get rid of dependence on the boost::pfr library
  • get rid of dependence on the DirectXTK12 library
  • to header-only library

API documentation

TODO(Alex0vSky): makeme

This post is licensed under CC BY 4.0 by the author.