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.
|
2010-06-13 19:50:06 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2011-01-29 20:16:51 +00:00
|
|
|
#include <d3d11.h>
|
|
|
|
|
|
|
|
namespace DX11
|
|
|
|
{
|
2010-06-13 19:50:06 +00:00
|
|
|
|
|
|
|
namespace D3D
|
|
|
|
{
|
2010-06-19 18:14:05 +00:00
|
|
|
void ReplaceRGBATexture2D(ID3D11Texture2D* pTexture, const u8* buffer, unsigned int width, unsigned int height, unsigned int pitch, unsigned int level, D3D11_USAGE usage);
|
2010-06-13 19:50:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class D3DTexture2D
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// there are two ways to create a D3DTexture2D object:
|
|
|
|
// either create an ID3D11Texture2D object, pass it to the constructor and specify what views to create
|
|
|
|
// or let the texture automatically be created by D3DTexture2D::Create
|
|
|
|
|
2011-06-11 19:37:21 +00:00
|
|
|
D3DTexture2D(ID3D11Texture2D* texptr, D3D11_BIND_FLAG bind, DXGI_FORMAT srv_format = DXGI_FORMAT_UNKNOWN, DXGI_FORMAT dsv_format = DXGI_FORMAT_UNKNOWN, DXGI_FORMAT rtv_format = DXGI_FORMAT_UNKNOWN, bool multisampled = false);
|
2014-11-13 23:24:53 +00:00
|
|
|
static D3DTexture2D* Create(unsigned int width, unsigned int height, D3D11_BIND_FLAG bind, D3D11_USAGE usage, DXGI_FORMAT, unsigned int levels = 1, unsigned int slices = 1, D3D11_SUBRESOURCE_DATA* data = nullptr);
|
2010-06-13 19:50:06 +00:00
|
|
|
|
2011-06-11 19:37:21 +00:00
|
|
|
// reference counting, use AddRef() when creating a new reference and Release() it when you don't need it anymore
|
|
|
|
void AddRef();
|
|
|
|
UINT Release();
|
2010-06-13 19:50:06 +00:00
|
|
|
|
2011-06-11 19:37:21 +00:00
|
|
|
ID3D11Texture2D* &GetTex();
|
|
|
|
ID3D11ShaderResourceView* &GetSRV();
|
|
|
|
ID3D11RenderTargetView* &GetRTV();
|
|
|
|
ID3D11DepthStencilView* &GetDSV();
|
2010-06-13 19:50:06 +00:00
|
|
|
|
2011-06-11 19:37:21 +00:00
|
|
|
private:
|
2010-06-13 19:50:06 +00:00
|
|
|
~D3DTexture2D();
|
|
|
|
|
2011-06-11 19:37:21 +00:00
|
|
|
ID3D11Texture2D* tex;
|
2010-06-13 19:50:06 +00:00
|
|
|
ID3D11ShaderResourceView* srv;
|
|
|
|
ID3D11RenderTargetView* rtv;
|
|
|
|
ID3D11DepthStencilView* dsv;
|
|
|
|
D3D11_BIND_FLAG bindflags;
|
|
|
|
UINT ref;
|
|
|
|
};
|
2011-01-29 20:16:51 +00:00
|
|
|
|
2015-03-01 16:17:09 +00:00
|
|
|
} // namespace DX11
|