1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/framework/platform/vertexbuffer-dx.cpp
2024-04-11 10:38:56 -03:00

29 lines
569 B
C++

#include "vertexbuffer-dx.hpp"
#include "device-dx.hpp"
namespace xna {
bool VertexBuffer::Initialize(GraphicsDevice& device, xna_error_ptr_arg)
{
if (!device._device) {
xna_error_apply(err, XnaErrorCode::ARGUMENT_IS_NULL);
return false;
}
if (_buffer) {
_buffer->Release();
_buffer = nullptr;
}
const auto hr = device._device->CreateBuffer(
&_description,
_useInitialData ? &_initialData : nullptr,
&_buffer);
if (FAILED(hr)) {
xna_error_apply(err, XnaErrorCode::FAILED_OPERATION);
return false;
}
return true;
}
}