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

32 lines
823 B
C++

#include "platform-dx/vertexinput-dx.hpp"
#include "platform-dx/device-dx.hpp"
#include "platform-dx/dxheaders.hpp"
#include "platform-dx/implementations.hpp"
namespace xna {
bool VertexInputLayout::Initialize(GraphicsDevice& device, DataBuffer& blob, xna_error_ptr_arg){
if (!device._device || !blob.impl->_blob) {
xna_error_apply(err, XnaErrorCode::INVALID_OPERATION);
return false;
}
if (_inputLayout) {
_inputLayout->Release();
_inputLayout = nullptr;
}
const auto hr = device._device->CreateInputLayout(
_description.data(),
static_cast<UINT>(_description.size()),
blob.impl->_blob->GetBufferPointer(),
blob.impl->_blob->GetBufferSize(),
&_inputLayout);
if (FAILED(hr)) {
xna_error_apply(err, XnaErrorCode::FAILED_OPERATION);
return false;
}
return true;
}
}