1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/framework/platform/vertexinput-dx.cpp

34 lines
792 B
C++
Raw Normal View History

2024-04-09 15:15:11 -03:00
#include "vertexinput-dx.hpp"
#include "device-dx.hpp"
#include <d3dcompiler.h>
#include "dxgi.h"
#include "d3d11.h"
2024-04-12 15:21:00 -03:00
#include "databuffer-dx.hpp"
2024-04-09 15:15:11 -03:00
namespace xna {
2024-04-12 15:21:00 -03:00
bool VertexInputLayout::Initialize(GraphicsDevice& device, DataBuffer& blob, xna_error_ptr_arg){
if (!device._device || !blob._blob) {
2024-04-09 15:15:11 -03:00
xna_error_apply(err, XnaErrorCode::INVALID_OPERATION);
return false;
}
2024-04-12 15:21:00 -03:00
if (_inputLayout) {
_inputLayout->Release();
_inputLayout = nullptr;
}
const auto hr = device._device->CreateInputLayout(
2024-04-09 15:15:11 -03:00
_description.data(),
2024-04-10 09:51:03 -03:00
static_cast<UINT>(_description.size()),
2024-04-12 15:21:00 -03:00
blob._blob->GetBufferPointer(),
blob._blob->GetBufferSize(),
2024-04-09 15:15:11 -03:00
&_inputLayout);
if (FAILED(hr)) {
2024-04-12 15:21:00 -03:00
xna_error_apply(err, XnaErrorCode::FAILED_OPERATION);
2024-04-09 15:15:11 -03:00
return false;
}
return true;
}
}