Nxna2
 All Classes Namespaces Functions Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | List of all members
Nxna::Graphics::GraphicsDevice Class Reference

Public Member Functions

void SetMessageCallback (GraphicsDeviceMessageCallback callback)
 
constexpr GraphicsDeviceType GetType ()
 
const NxnaResultDetailsGetErrorDetails ()
 
CapabilitiesGetCaps ()
 
void SetViewport (int x, int y, int width, int height)
 Sets the current viewport.
 
void SetViewport (Viewport viewport)
 Sets the current viewport.
 
NxnaResult CreateShader (ShaderType type, const void *bytecode, int bytecodeLength, Shader *result)
 
void DestroyShader (Shader *shader)
 
NxnaResult CreateTexture2D (const TextureCreationDesc *desc, Texture2D *result)
 
void BindTexture (Texture2D *texture, int textureUnit)
 
void DestroyTexture2D (Texture2D *texture)
 
NxnaResult CreateShaderPipeline (const ShaderPipelineDesc *desc, ShaderPipeline *result)
 
void SetShaderPipeline (ShaderPipeline *pipeline)
 
void DestroyShaderPipeline (ShaderPipeline *pipeline)
 
NxnaResult CreateBlendState (const BlendStateDesc *desc, BlendState *result)
 
void SetBlendState (BlendState *state)
 
void DestroyBlendState (BlendState *state)
 
NxnaResult CreateRasterizerState (const RasterizerStateDesc *desc, RasterizerState *result)
 
void SetRasterizerState (RasterizerState *state)
 
void DestroyRasterizerState (RasterizerState *state)
 
NxnaResult CreateIndexBuffer (const IndexBufferDesc *desc, IndexBuffer *result)
 
void DestroyIndexBuffer (IndexBuffer buffer)
 
void UpdateIndexBuffer (IndexBuffer buffer, unsigned int startOffset, void *data, unsigned int dataLengthInBytes)
 
void SetIndices (IndexBuffer indices)
 
NxnaResult CreateVertexBuffer (const VertexBufferDesc *desc, VertexBuffer *result)
 
void DestroyVertexBuffer (VertexBuffer buffer)
 
void UpdateVertexBuffer (VertexBuffer buffer, unsigned int startOffset, void *data, unsigned int dataLengthInBytes)
 
void SetVertexBuffer (VertexBuffer vertexBuffer, unsigned int offset, unsigned int stride)
 
NxnaResult CreateConstantBuffer (const ConstantBufferDesc *desc, ConstantBuffer *result)
 
void UpdateConstantBuffer (ConstantBuffer buffer, void *data, unsigned int dataLengthInBytes)
 
void SetConstantBuffer (ConstantBuffer buffer, int index)
 
void DestroyConstantBuffer (ConstantBuffer *buffer)
 
void * MapBuffer (IndexBuffer buffer, MapType type)
 
void * MapBuffer (VertexBuffer buffer, MapType type)
 
void * MapBuffer (ConstantBuffer buffer, MapType type)
 
void UnmapBuffer (IndexBuffer buffer)
 
void UnmapBuffer (VertexBuffer buffer)
 
void UnmapBuffer (ConstantBuffer buffer)
 
void DrawIndexedPrimitives (PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
 
void DrawPrimitives (PrimitiveType primitiveType, int startVertex, int primitiveCount)
 
void Clear (float r, float g, float b, float a)
 
void Present ()
 

Static Public Member Functions

static NxnaResult CreateGraphicsDevice (const GraphicsDeviceDesc *params, GraphicsDevice *result)
 
static void DestroyGraphicsDevice (GraphicsDevice *device)
 

Member Function Documentation

NxnaResult Nxna::Graphics::GraphicsDevice::CreateBlendState ( const BlendStateDesc desc,
BlendState result 
)

Create a new BlendState object

Parameters
[in]descA pointer to a BlendStateDesc object describing the new blend state
[out]resultA pointer to a BlendState object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateConstantBuffer ( const ConstantBufferDesc desc,
ConstantBuffer result 
)

Create a new ConstantBuffer object

Parameters
[in]descA pointer to a ConstantBufferDesc object describing the new constant buffer
[out]resultA pointer to a ConstantBuffer object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateGraphicsDevice ( const GraphicsDeviceDesc params,
GraphicsDevice result 
)
static

Initializes a new GraphicsDevice

Parameters
[in]paramsA pointer to a filled out GraphicsDeviceDesc struct describing the new GraphicsDevice
[out]resultA pointer to a GraphicsDevice object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateIndexBuffer ( const IndexBufferDesc desc,
IndexBuffer result 
)

Create a new IndexBuffer object

Parameters
[in]descA pointer to a IndexBufferDesc object describing the new index buffer
[out]resultA pointer to a IndexBuffer object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateShader ( ShaderType  type,
const void *  bytecode,
int  bytecodeLength,
Shader result 
)

Creates a new shader object

Parameters
[in]typeThe type of shader to create
[in]bytecodeA pointer to the bytecode of the shader. This can be Direct3D bytecode, or GLSL source code.
[in]bytecodeLengthThe length in bytes of the bytecode
[out]resultA pointer to a Shader object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateShaderPipeline ( const ShaderPipelineDesc desc,
ShaderPipeline result 
)

Create a new ShaderPipeline object

Parameters
[in]descA pointer to a ShaderPipelineDesc object describing the new shader pipeline
[out]resultA pointer to a Texture2D object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateTexture2D ( const TextureCreationDesc desc,
Texture2D result 
)

Create a new texture object

Parameters
[in]descA pointer to a TextureCreationDesc object describing the new texture
[out]resultA pointer to a Texture2D object
Returns
NxnaResult::Success if successful, or an error otherwise
NxnaResult Nxna::Graphics::GraphicsDevice::CreateVertexBuffer ( const VertexBufferDesc desc,
VertexBuffer result 
)

Create a new VertexBuffer object

Parameters
[in]descA pointer to a VertexBufferDesc object describing the new vertex buffer
[out]resultA pointer to a VertexBuffer object
Returns
True if successful, false otherwise
void Nxna::Graphics::GraphicsDevice::DestroyBlendState ( BlendState state)

Destroys an existing shader object

Parameters
[in]stateA pointer to the blend state to delete
void Nxna::Graphics::GraphicsDevice::DestroyConstantBuffer ( ConstantBuffer buffer)

Destroys an existing vertex buffer

Parameters
[in]bufferA pointer to the constant buffer to delete
void Nxna::Graphics::GraphicsDevice::DestroyIndexBuffer ( IndexBuffer  buffer)

Destroys an existing index buffer

Parameters
[in]bufferThe index buffer to delete
void Nxna::Graphics::GraphicsDevice::DestroyShader ( Shader shader)

Destroys an existing shader object

Parameters
[in]shaderA pointer to the shader object to delete

Destroying a shader that is being used (including as part of a ShaderPipeline) is allowed. The underlying API will delete the shader when appropriate.

void Nxna::Graphics::GraphicsDevice::DestroyShaderPipeline ( ShaderPipeline pipeline)

Destroys an existing shader pipeline object

Parameters
[in]pipelineA pointer to the shader pipeline object to delete
void Nxna::Graphics::GraphicsDevice::DestroyTexture2D ( Texture2D texture)

Destroys an existing texture object

Parameters
[in]textureA pointer to the texture to delete
void Nxna::Graphics::GraphicsDevice::DestroyVertexBuffer ( VertexBuffer  buffer)

Destroys an existing vertex buffer

Parameters
[in]bufferThe vertex buffer to delete
void * Nxna::Graphics::GraphicsDevice::MapBuffer ( IndexBuffer  buffer,
MapType  type 
)

Maps an IndexBuffer for writing or reading

Parameters
[in]bufferAn index buffer to map
[in]typeThe type of mapping to perform
Returns
A pointer to memory representing the contents of the buffer, or nullptr if unable to map the buffer

This is equivalent to glMapBufferRange() on OpenGL or ID3D11DeviceContext::Map() on Direct3D 11

void * Nxna::Graphics::GraphicsDevice::MapBuffer ( VertexBuffer  buffer,
MapType  type 
)

Maps a VertexBuffer for writing or reading

Parameters
[in]bufferA vertex buffer to map
[in]typeThe type of mapping to perform
Returns
A pointer to memory representing the contents of the buffer, or nullptr if unable to map the buffer

This is equivalent to glMapBufferRange() on OpenGL or ID3D11DeviceContext::Map() on Direct3D 11

void * Nxna::Graphics::GraphicsDevice::MapBuffer ( ConstantBuffer  buffer,
MapType  type 
)

Maps a ConstantBuffer for writing or reading

Parameters
[in]bufferA constant buffer to map
[in]typeThe type of mapping to perform
Returns
A pointer to memory representing the contents of the buffer, or nullptr if unable to map the buffer

This is equivalent to glMapBufferRange() on OpenGL or ID3D11DeviceContext::Map() on Direct3D 11

void Nxna::Graphics::GraphicsDevice::UnmapBuffer ( IndexBuffer  buffer)

Unmaps a previously mapped IndexBuffer

Parameters
[in]bufferAn index buffer
void Nxna::Graphics::GraphicsDevice::UnmapBuffer ( VertexBuffer  buffer)

Unmaps a previously mapped VertexBuffer

Parameters
[in]bufferA vertex buffer
void Nxna::Graphics::GraphicsDevice::UnmapBuffer ( ConstantBuffer  buffer)

Unmaps a previously mapped ConstantBuffer

Parameters
[in]bufferA constant buffer
void Nxna::Graphics::GraphicsDevice::UpdateConstantBuffer ( ConstantBuffer  buffer,
void *  data,
unsigned int  dataLengthInBytes 
)

Updates the contents of a ConstantBuffer

This is equivalent to glBufferSubData() on OpenGL and ID3D11DeviceContext::UpdateSubresource() on Direct3D 11

void Nxna::Graphics::GraphicsDevice::UpdateIndexBuffer ( IndexBuffer  buffer,
unsigned int  startOffset,
void *  data,
unsigned int  dataLengthInBytes 
)

Updates the contents of an IndexBuffer

This is equivalent to glBufferSubData() on OpenGL and ID3D11DeviceContext::UpdateSubresource() on Direct3D 11

void Nxna::Graphics::GraphicsDevice::UpdateVertexBuffer ( VertexBuffer  buffer,
unsigned int  startOffset,
void *  data,
unsigned int  dataLengthInBytes 
)

Updates the contents of a VertexBuffer

This is equivalent to glBufferSubData() on OpenGL and ID3D11DeviceContext::UpdateSubresource() on Direct3D 11


The documentation for this class was generated from the following files: