2024-05-09 11:37:56 -03:00
|
|
|
#include "platform-dx/vertexinput-dx.hpp"
|
|
|
|
#include "platform-dx/device-dx.hpp"
|
|
|
|
#include "platform-dx/dxheaders.hpp"
|
2024-05-20 09:32:34 -03:00
|
|
|
#include "platform-dx/implementations.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){
|
2024-05-20 09:32:34 -03:00
|
|
|
if (!device._device || !blob.impl->_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-05-20 09:32:34 -03:00
|
|
|
blob.impl->_blob->GetBufferPointer(),
|
|
|
|
blob.impl->_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;
|
|
|
|
}
|
|
|
|
}
|