2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:29:41 +00:00
|
|
|
// Refer to the license.txt file included.
|
2011-06-11 19:37:21 +00:00
|
|
|
|
|
|
|
#include <d3d11.h>
|
2014-02-17 10:18:15 +00:00
|
|
|
|
|
|
|
#include "VideoBackends/D3D/D3DBlob.h"
|
2011-06-11 19:37:21 +00:00
|
|
|
|
|
|
|
namespace DX11
|
|
|
|
{
|
|
|
|
|
2014-03-09 20:14:26 +00:00
|
|
|
D3DBlob::D3DBlob(unsigned int blob_size, const u8* init_data) : ref(1), size(blob_size), blob(nullptr)
|
2011-06-11 19:37:21 +00:00
|
|
|
{
|
|
|
|
data = new u8[blob_size];
|
|
|
|
if (init_data) memcpy(data, init_data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
D3DBlob::D3DBlob(ID3D10Blob* d3dblob) : ref(1)
|
|
|
|
{
|
|
|
|
blob = d3dblob;
|
|
|
|
data = (u8*)blob->GetBufferPointer();
|
|
|
|
size = (unsigned int)blob->GetBufferSize();
|
|
|
|
d3dblob->AddRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
D3DBlob::~D3DBlob()
|
|
|
|
{
|
|
|
|
if (blob) blob->Release();
|
|
|
|
else delete[] data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DBlob::AddRef()
|
|
|
|
{
|
|
|
|
++ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int D3DBlob::Release()
|
|
|
|
{
|
|
|
|
if (--ref == 0)
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2015-04-15 04:38:21 +00:00
|
|
|
unsigned int D3DBlob::Size() const
|
2011-06-11 19:37:21 +00:00
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
u8* D3DBlob::Data()
|
|
|
|
{
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2015-03-01 16:17:09 +00:00
|
|
|
} // namespace DX11
|