15 const D3D11_VIEWPORT* pViewports) {
17 ERROR(
"DeviceContext",
"RSSetViewports",
"pViewports is nullptr");
25 unsigned int NumViews,
26 ID3D11ShaderResourceView*
const* ppShaderResourceViews) {
27 if (!ppShaderResourceViews) {
28 ERROR(
"DeviceContext",
"PSSetShaderResources",
"ppShaderResourceViews is nullptr");
31 m_deviceContext->PSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews);
37 ERROR(
"DeviceContext",
"IASetInputLayout",
"pInputLayout is nullptr");
45 ID3D11ClassInstance*
const* ppClassInstances,
46 unsigned int NumClassInstances) {
48 ERROR(
"DeviceContext",
"VSSetShader",
"pVertexShader is nullptr");
51 m_deviceContext->VSSetShader(pVertexShader, ppClassInstances, NumClassInstances);
56 ID3D11ClassInstance*
const* ppClassInstances,
57 unsigned int NumClassInstances) {
59 ERROR(
"DeviceContext",
"PSSetShader",
"pPixelShader is nullptr");
62 m_deviceContext->PSSetShader(pPixelShader, ppClassInstances, NumClassInstances);
67 unsigned int DstSubresource,
68 const D3D11_BOX* pDstBox,
70 unsigned int SrcRowPitch,
71 unsigned int SrcDepthPitch) {
72 if (!pDstResource || !pSrcData) {
73 ERROR(
"DeviceContext",
"UpdateSubresource",
74 "Invalid arguments: pDstResource or pSrcData is nullptr");
87 unsigned int NumBuffers,
88 ID3D11Buffer*
const* ppVertexBuffers,
89 const unsigned int* pStrides,
90 const unsigned int* pOffsets) {
91 if (!ppVertexBuffers || !pStrides || !pOffsets) {
92 ERROR(
"DeviceContext",
"IASetVertexBuffers",
93 "Invalid arguments: ppVertexBuffers, pStrides, or pOffsets is nullptr");
106 unsigned int Offset) {
108 ERROR(
"DeviceContext",
"IASetIndexBuffer",
"pIndexBuffer is nullptr");
116 unsigned int NumSamplers,
117 ID3D11SamplerState*
const* ppSamplers) {
119 ERROR(
"DeviceContext",
"PSSetSamplers",
"ppSamplers is nullptr");
127 if (!pRasterizerState) {
128 ERROR(
"DeviceContext",
"RSSetState",
"pRasterizerState is nullptr");
136 const float BlendFactor[4],
137 unsigned int SampleMask) {
139 ERROR(
"DeviceContext",
"OMSetBlendState",
"pBlendState is nullptr");
142 m_deviceContext->OMSetBlendState(pBlendState, BlendFactor, SampleMask);
147 ID3D11RenderTargetView*
const* ppRenderTargetViews,
148 ID3D11DepthStencilView* pDepthStencilView) {
150 if (!ppRenderTargetViews && !pDepthStencilView) {
151 ERROR(
"DeviceContext",
"OMSetRenderTargets",
152 "Both ppRenderTargetViews and pDepthStencilView are nullptr");
156 if (NumViews > 0 && !ppRenderTargetViews) {
157 ERROR(
"DeviceContext",
"OMSetRenderTargets",
158 "ppRenderTargetViews is nullptr, but NumViews > 0");
163 m_deviceContext->OMSetRenderTargets(NumViews, ppRenderTargetViews, pDepthStencilView);
169 if (Topology == D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED) {
170 ERROR(
"DeviceContext",
"IASetPrimitiveTopology",
171 "Topology is D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED");
181 const float ColorRGBA[4]) {
183 if (!pRenderTargetView) {
184 ERROR(
"DeviceContext",
"ClearRenderTargetView",
"pRenderTargetView is nullptr");
188 ERROR(
"DeviceContext",
"ClearRenderTargetView",
"ColorRGBA is nullptr");
198 unsigned int ClearFlags,
202 if (!pDepthStencilView) {
203 ERROR(
"DeviceContext",
"ClearDepthStencilView",
204 "pDepthStencilView is nullptr");
209 if ((ClearFlags & (D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL)) == 0) {
210 ERROR(
"DeviceContext",
"ClearDepthStencilView",
211 "Invalid ClearFlags: must include D3D11_CLEAR_DEPTH or D3D11_CLEAR_STENCIL");
216 m_deviceContext->ClearDepthStencilView(pDepthStencilView, ClearFlags, Depth, Stencil);
221 unsigned int NumBuffers,
222 ID3D11Buffer*
const* ppConstantBuffers) {
224 if (!ppConstantBuffers) {
225 ERROR(
"DeviceContext",
"VSSetConstantBuffers",
"ppConstantBuffers is nullptr");
230 m_deviceContext->VSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers);
235 unsigned int NumBuffers,
236 ID3D11Buffer*
const* ppConstantBuffers) {
238 if (!ppConstantBuffers) {
239 ERROR(
"DeviceContext",
"PSSetConstantBuffers",
"ppConstantBuffers is nullptr");
244 m_deviceContext->PSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers);
249 unsigned int StartIndexLocation,
250 int BaseVertexLocation) {
252 if (IndexCount == 0) {
253 ERROR(
"DeviceContext",
"DrawIndexed",
"IndexCount is zero");
258 m_deviceContext->DrawIndexed(IndexCount, StartIndexLocation, BaseVertexLocation);
Declara la API de DeviceContext dentro del subsistema Core.
#define ERROR(classObj, method, errorMSG)
void RSSetState(ID3D11RasterizerState *pRasterizerState)
Configura el Rasterizer State actual.
void DrawIndexed(unsigned int IndexCount, unsigned int StartIndexLocation, int BaseVertexLocation)
Envía un comando de dibujado de primitivas indexadas.
void OMSetBlendState(ID3D11BlendState *pBlendState, const float BlendFactor[4], unsigned int SampleMask)
Asigna un Blend State al Output Merger.
void PSSetShaderResources(unsigned int StartSlot, unsigned int NumViews, ID3D11ShaderResourceView *const *ppShaderResourceViews)
Asigna Shader Resource Views a la etapa de Pixel Shader.
void IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY Topology)
Define la topología de primitivas a renderizar.
void destroy()
Libera el recurso ID3D11DeviceContext.
void PSSetConstantBuffers(unsigned int StartSlot, unsigned int NumBuffers, ID3D11Buffer *const *ppConstantBuffers)
Asigna constant buffers a la etapa de Pixel Shader.
void RSSetViewports(unsigned int NumViewports, const D3D11_VIEWPORT *pViewports)
Configura los viewports en la etapa de rasterización.
void PSSetShader(ID3D11PixelShader *pPixelShader, ID3D11ClassInstance *const *ppClassInstances, unsigned int NumClassInstances)
Asigna un Pixel Shader al pipeline.
ID3D11DeviceContext * m_deviceContext
Puntero al contexto inmediato de Direct3D 11.
void VSSetConstantBuffers(unsigned int StartSlot, unsigned int NumBuffers, ID3D11Buffer *const *ppConstantBuffers)
Asigna constant buffers a la etapa de Vertex Shader.
void IASetIndexBuffer(ID3D11Buffer *pIndexBuffer, DXGI_FORMAT Format, unsigned int Offset)
Asigna un Index Buffer a la etapa de ensamblado de entrada.
void ClearDepthStencilView(ID3D11DepthStencilView *pDepthStencilView, unsigned int ClearFlags, float Depth, UINT8 Stencil)
Limpia un Depth Stencil View.
void OMSetRenderTargets(unsigned int NumViews, ID3D11RenderTargetView *const *ppRenderTargetViews, ID3D11DepthStencilView *pDepthStencilView)
Asigna Render Targets y Depth Stencil al Output Merger.
void UpdateSubresource(ID3D11Resource *pDstResource, unsigned int DstSubresource, const D3D11_BOX *pDstBox, const void *pSrcData, unsigned int SrcRowPitch, unsigned int SrcDepthPitch)
Copia datos desde CPU hacia un recurso en GPU.
void VSSetShader(ID3D11VertexShader *pVertexShader, ID3D11ClassInstance *const *ppClassInstances, unsigned int NumClassInstances)
Asigna un Vertex Shader al pipeline.
void IASetVertexBuffers(unsigned int StartSlot, unsigned int NumBuffers, ID3D11Buffer *const *ppVertexBuffers, const unsigned int *pStrides, const unsigned int *pOffsets)
Asigna buffers de vértices a la etapa de ensamblado de entrada.
void PSSetSamplers(unsigned int StartSlot, unsigned int NumSamplers, ID3D11SamplerState *const *ppSamplers)
Asigna Sampler States a la etapa de Pixel Shader.
void IASetInputLayout(ID3D11InputLayout *pInputLayout)
Define el Input Layout activo en la etapa de ensamblado de entrada.
void ClearRenderTargetView(ID3D11RenderTargetView *pRenderTargetView, const float ColorRGBA[4])
Limpia un Render Target con un color dado.