2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:29:41 -06:00
|
|
|
// Refer to the license.txt file included.
|
2010-06-13 13:50:06 -06:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2011-01-29 13:16:51 -07:00
|
|
|
#include <d3d11.h>
|
2017-02-03 10:06:38 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2011-01-29 13:16:51 -07:00
|
|
|
|
|
|
|
namespace DX11
|
|
|
|
{
|
2010-06-13 13:50:06 -06:00
|
|
|
class D3DTexture2D
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 02:43:46 -06:00
|
|
|
// 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
|
|
|
|
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
|
|
|
|
// reference counting, use AddRef() when creating a new reference and Release() it when you don't
|
|
|
|
// need it anymore
|
|
|
|
void AddRef();
|
|
|
|
UINT Release();
|
|
|
|
|
|
|
|
ID3D11Texture2D*& GetTex();
|
|
|
|
ID3D11ShaderResourceView*& GetSRV();
|
|
|
|
ID3D11RenderTargetView*& GetRTV();
|
|
|
|
ID3D11DepthStencilView*& GetDSV();
|
2010-06-13 13:50:06 -06:00
|
|
|
|
2011-06-11 13:37:21 -06:00
|
|
|
private:
|
2016-06-24 02:43:46 -06:00
|
|
|
~D3DTexture2D();
|
|
|
|
|
|
|
|
ID3D11Texture2D* tex;
|
2017-09-03 11:07:18 -06:00
|
|
|
ID3D11ShaderResourceView* srv = nullptr;
|
|
|
|
ID3D11RenderTargetView* rtv = nullptr;
|
|
|
|
ID3D11DepthStencilView* dsv = nullptr;
|
|
|
|
UINT ref = 1;
|
2010-06-13 13:50:06 -06:00
|
|
|
};
|
2011-01-29 13:16:51 -07:00
|
|
|
|
2015-03-01 09:17:09 -07:00
|
|
|
} // namespace DX11
|