/**
    Copyright (c) 2010 yakiimo02
    Distributed under the New BSD License.
    See included license.txt or http://www.yakiimo3d.com/NewBSDLicense.txt
**/

#pragma once

/**
    @brief  DirectX helper functions.
            Mostly based on code from the DirectX SDK samples.
    @author yakiimo02
    @date   09/11/28
*/

HRESULT CreateShaderFromFile( ID3D11Device* pd3dDevice, LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, 
                              LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, 
                              ID3DX11ThreadPump* pPump, ID3D11DeviceChild** ppShader, ID3D10Blob** ppShaderBlob, 
                              BOOL bDumpShader);

HRESULT CompileShaderFromFile( WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut );

HRESULT CreateBufferSRV( ID3D11Device* pDevice, ID3D11Buffer* pBuffer, ID3D11ShaderResourceView** ppSRVOut );

HRESULT CreateBufferUAV( ID3D11Device* pDevice, ID3D11Buffer* pBuffer, ID3D11UnorderedAccessView** ppUAVOut );

HRESULT CreateStructuredBufferOnGPU( ID3D11Device* pDevice, UINT uElementSize, UINT uCount, VOID* pInitData, ID3D11Buffer** ppBufOut );

HRESULT CreateStructuredBufferForCPU( ID3D11Device* pDevice, UINT uElementSize, UINT uCount, VOID* pInitData, ID3D11Buffer** ppBufOut );

ID3D11Buffer* CreateAndCopyToDebugBuf( ID3D11Device* pDevice, ID3D11DeviceContext* pd3dImmediateContext, ID3D11Buffer* pBuffer );

HRESULT CreateSurface( ID3D11Device* pDevice, ID3D11Texture2D** ppTexture, ID3D11ShaderResourceView** ppTextureSRV,
                      ID3D11RenderTargetView** ppTextureRTV, DXGI_FORMAT Format, unsigned int uWidth,
                      unsigned int uHeight, const DXGI_SAMPLE_DESC& sampleDesc );

HRESULT CreateDepthStencil( ID3D11Device* pd3dDevice, ID3D11Texture2D** ppTexture, ID3D11DepthStencilView** ppDSV,
                            DXGI_FORMAT format, unsigned int nWidth, unsigned int nHeight, const DXGI_SAMPLE_DESC& sampleDesc );
