Class RenderingDevice

Class Documentation

class RenderingDevice

The boss of all rendering, all DirectX API calls requiring the Device or Context go through this.

Public Types

enum RasterizerState

Values:

Default
UI
UIScissor
Wireframe
Sky
enum SamplerState

Values:

Default
Anisotropic

Public Functions

void initialize(HWND hWnd, int width, int height)
void createOffScreenViews(int width, int height)
void createSwapChainAndRTVs(int width, int height, const HWND &hWnd)

Create resources which depend on window height and width.

void setScreenState(bool fullscreen)
ID3D11Device *getDevice()
ID3D11DeviceContext *getContext()
void enableSkyDSS()
void disableSkyDSS()
void disableDSS()
void enableDSS()
void createRTVAndSRV(Microsoft::WRL::ComPtr<ID3D11RenderTargetView> &rtv, Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> &srv)
Microsoft::WRL::ComPtr<ID3D11Buffer> createBuffer(const char *data, size_t size, D3D11_BIND_FLAG bindFlags, D3D11_USAGE usage, int cpuAccess)
void editBuffer(const char *data, size_t byteSize, ID3D11Buffer *bufferPointer)
template<class T>
Microsoft::WRL::ComPtr<ID3D11Buffer> createBuffer(const T &data, D3D11_BIND_FLAG bindFlags, D3D11_USAGE usage, D3D11_CPU_ACCESS_FLAG cpuAccess)
template<typename T>
void editBuffer(const T &data, ID3D11Buffer *bufferPointer)
Microsoft::WRL::ComPtr<ID3DBlob> compileShader(const String &shaderPath, const char *entryPoint, const char *profile)

To hold shader blobs loaded from the compiled shader files.

Microsoft::WRL::ComPtr<ID3D11PixelShader> createPS(ID3DBlob *blob)
Microsoft::WRL::ComPtr<ID3D11VertexShader> createVS(ID3DBlob *blob)
Microsoft::WRL::ComPtr<ID3D11InputLayout> createVL(ID3DBlob *vertexShaderBlob, const D3D11_INPUT_ELEMENT_DESC *ied, UINT size)
Ref<DirectX::SpriteFont> createFont(const String &fontFilePath)
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> createDDSTexture(const char *imageDDSFileData, size_t size)
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> createTexture(const char *imageFileData, size_t size)
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> createTextureFromPixels(const char *imageRawData, unsigned int width, unsigned int height)
unsigned char *downloadTexture(ID3D11Texture2D *texture, unsigned int width, unsigned int height)
Microsoft::WRL::ComPtr<ID3D11SamplerState> createSS(SamplerState type)
void setVSSRV(unsigned int slot, unsigned int count, ID3D11ShaderResourceView **texture)
void setPSSRV(unsigned int slot, unsigned int count, ID3D11ShaderResourceView **texture)
void setVSSS(unsigned int slot, unsigned int count, ID3D11SamplerState **samplerState)
void setPSSS(unsigned int slot, unsigned int count, ID3D11SamplerState **samplerState)
void setVSCB(unsigned int slot, unsigned int count, ID3D11Buffer **constantBuffer)
void setPSCB(unsigned int slot, unsigned int count, ID3D11Buffer **constantBuffer)
void bind(ID3D11Buffer *const *vertexBuffer, int count, const unsigned int *stride, const unsigned int *offset)
void bind(ID3D11Buffer *indexBuffer, DXGI_FORMAT format)
void bind(ID3D11VertexShader *vertexShader)
void bind(ID3D11PixelShader *pixelShader)
void bind(ID3D11InputLayout *inputLayout)
void mapBuffer(ID3D11Buffer *buffer, D3D11_MAPPED_SUBRESOURCE &subresource)
void unmapBuffer(ID3D11Buffer *buffer)
void setDefaultBS()
void setAlphaBS()
void setCurrentRS()
RasterizerState getRSType()
void setRSType(RasterizerState rs)
void setTemporaryUIRS()
void setTemporaryUIScissoredRS()
void setDSS()
void setScissorRectangle(int x, int y, int width, int height)
void setResolutionAndRefreshRate(int width, int height, int refreshRateNum, int refreshRateDeno)
void setOffScreenRTVDSV()
void setOffScreenRTVOnly()
void setMainRT()
void setRTV(Microsoft::WRL::ComPtr<ID3D11RenderTargetView> rtv)
void setRTV(ID3D11RenderTargetView *rtv)
void setInputLayout(ID3D11InputLayout *inputLayout)
void unbindSRVs()
void unbindRTVs()
void unbindDepthSRV()
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> getMainSRV()
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> getDepthSSRV()
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> getStencilSRV()
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> getOffScreenSRV()
Ref<DirectX::SpriteBatch> getUIBatch()
void setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY pt)
void setViewport(const D3D11_VIEWPORT *vp)
void drawIndexed(UINT indices)

The last boss, draws Triangles.

void drawIndexedInstanced(UINT indices, UINT instances, UINT startInstance)
void beginDrawUI()
void endDrawUI()
void draw(UINT vertexCount, UINT startVertexLocation)
void clearRTV(Microsoft::WRL::ComPtr<ID3D11RenderTargetView> rtv, float r, float g, float b, float a)
void clearMainRT(float r, float g, float b, float a)
void clearOffScreenRT(float r, float g, float b, float a)
void clearDSV()

Public Static Functions

static RenderingDevice *GetSingleton()