14 const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
15 ID3D11RenderTargetView** ppRTView) {
18 ERROR(
"Device",
"CreateRenderTargetView",
"pResource is nullptr");
22 ERROR(
"Device",
"CreateRenderTargetView",
"ppRTView is nullptr");
27 HRESULT hr =
m_device->CreateRenderTargetView(pResource, pDesc, ppRTView);
30 MESSAGE(
"Device",
"CreateRenderTargetView",
31 "Render Target View created successfully!");
34 ERROR(
"Device",
"CreateRenderTargetView",
35 (
"Failed to create Render Target View. HRESULT: " + std::to_string(hr)).c_str());
43 const D3D11_SUBRESOURCE_DATA* pInitialData,
44 ID3D11Texture2D** ppTexture2D) {
47 ERROR(
"Device",
"CreateTexture2D",
"pDesc is nullptr");
51 ERROR(
"Device",
"CreateTexture2D",
"ppTexture2D is nullptr");
56 HRESULT hr =
m_device->CreateTexture2D(pDesc, pInitialData, ppTexture2D);
59 MESSAGE(
"Device",
"CreateTexture2D",
60 "Texture2D created successfully!");
63 ERROR(
"Device",
"CreateTexture2D",
64 (
"Failed to create Texture2D. HRESULT: " + std::to_string(hr)).c_str());
72 const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
73 ID3D11DepthStencilView** ppDepthStencilView) {
76 ERROR(
"Device",
"CreateDepthStencilView",
"pResource is nullptr");
79 if (!ppDepthStencilView) {
80 ERROR(
"Device",
"CreateDepthStencilView",
"ppDepthStencilView is nullptr");
85 HRESULT hr =
m_device->CreateDepthStencilView(pResource, pDesc, ppDepthStencilView);
88 MESSAGE(
"Device",
"CreateDepthStencilView",
89 "Depth Stencil View created successfully!");
92 ERROR(
"Device",
"CreateDepthStencilView",
93 (
"Failed to create Depth Stencil View. HRESULT: " + std::to_string(hr)).c_str());
101 unsigned int BytecodeLength,
102 ID3D11ClassLinkage* pClassLinkage,
103 ID3D11VertexShader** ppVertexShader) {
105 if (!pShaderBytecode) {
106 ERROR(
"Device",
"CreateVertexShader",
"pShaderBytecode is nullptr");
109 if (!ppVertexShader) {
110 ERROR(
"Device",
"CreateVertexShader",
"ppVertexShader is nullptr");
115 HRESULT hr =
m_device->CreateVertexShader(pShaderBytecode,
121 MESSAGE(
"Device",
"CreateVertexShader",
122 "Vertex Shader created successfully!");
125 ERROR(
"Device",
"CreateVertexShader",
126 (
"Failed to create Vertex Shader. HRESULT: " + std::to_string(hr)).c_str());
134 unsigned int NumElements,
135 const void* pShaderBytecodeWithInputSignature,
136 unsigned int BytecodeLength,
137 ID3D11InputLayout** ppInputLayout) {
139 if (!pInputElementDescs) {
140 ERROR(
"Device",
"CreateInputLayout",
"pInputElementDescs is nullptr");
143 if (!ppInputLayout) {
144 ERROR(
"Device",
"CreateInputLayout",
"ppInputLayout is nullptr");
149 HRESULT hr =
m_device->CreateInputLayout(pInputElementDescs,
151 pShaderBytecodeWithInputSignature,
156 MESSAGE(
"Device",
"CreateInputLayout",
157 "Input Layout created successfully!");
160 ERROR(
"Device",
"CreateInputLayout",
161 (
"Failed to create Input Layout. HRESULT: " + std::to_string(hr)).c_str());
169 unsigned int BytecodeLength,
170 ID3D11ClassLinkage* pClassLinkage,
171 ID3D11PixelShader** ppPixelShader) {
173 if (!pShaderBytecode) {
174 ERROR(
"Device",
"CreatePixelShader",
"pShaderBytecode is nullptr");
177 if (!ppPixelShader) {
178 ERROR(
"Device",
"CreatePixelShader",
"ppPixelShader is nullptr");
183 HRESULT hr =
m_device->CreatePixelShader(pShaderBytecode,
189 MESSAGE(
"Device",
"CreatePixelShader",
190 "Pixel Shader created successfully!");
193 ERROR(
"Device",
"CreatePixelShader",
194 (
"Failed to create Pixel Shader. HRESULT: " + std::to_string(hr)).c_str());
202 ID3D11SamplerState** ppSamplerState) {
205 ERROR(
"Device",
"CreateSamplerState",
"pSamplerDesc is nullptr");
208 if (!ppSamplerState) {
209 ERROR(
"Device",
"CreateSamplerState",
"ppSamplerState is nullptr");
214 HRESULT hr =
m_device->CreateSamplerState(pSamplerDesc, ppSamplerState);
217 MESSAGE(
"Device",
"CreateSamplerState",
218 "Sampler State created successfully!");
221 ERROR(
"Device",
"CreateSamplerState",
222 (
"Failed to create Sampler State. HRESULT: " + std::to_string(hr)).c_str());
230 const D3D11_SUBRESOURCE_DATA* pInitialData,
231 ID3D11Buffer** ppBuffer) {
234 ERROR(
"Device",
"CreateBuffer",
"pDesc is nullptr");
238 ERROR(
"Device",
"CreateBuffer",
"ppBuffer is nullptr");
243 HRESULT hr =
m_device->CreateBuffer(pDesc, pInitialData, ppBuffer);
246 MESSAGE(
"Device",
"CreateBuffer",
247 "Buffer created successfully!");
250 ERROR(
"Device",
"CreateBuffer",
251 (
"Failed to create Buffer. HRESULT: " + std::to_string(hr)).c_str());
Declara la API de Device dentro del subsistema Core.
#define MESSAGE(classObj, method, state)
#define ERROR(classObj, method, errorMSG)
HRESULT CreateBuffer(const D3D11_BUFFER_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Buffer **ppBuffer)
Crea un Buffer genérico (vertex, index, constant, etc.).
HRESULT CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, unsigned int NumElements, const void *pShaderBytecodeWithInputSignature, unsigned int BytecodeLength, ID3D11InputLayout **ppInputLayout)
Crea un Input Layout.
HRESULT CreateTexture2D(const D3D11_TEXTURE2D_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture2D **ppTexture2D)
Crea una textura 2D.
HRESULT CreateRenderTargetView(ID3D11Resource *pResource, const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, ID3D11RenderTargetView **ppRTView)
Crea una Render Target View.
ID3D11Device * m_device
Puntero al dispositivo Direct3D 11.
HRESULT CreateDepthStencilView(ID3D11Resource *pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, ID3D11DepthStencilView **ppDepthStencilView)
Crea una Depth Stencil View.
HRESULT CreateVertexShader(const void *pShaderBytecode, unsigned int BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11VertexShader **ppVertexShader)
Crea un Vertex Shader.
HRESULT CreatePixelShader(const void *pShaderBytecode, unsigned int BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11PixelShader **ppPixelShader)
Crea un Pixel Shader.
HRESULT CreateSamplerState(const D3D11_SAMPLER_DESC *pSamplerDesc, ID3D11SamplerState **ppSamplerState)
Crea un Sampler State.