mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +01:00
[d3d11] Refactor InitTexture method
This commit is contained in:
parent
fb11acbc91
commit
51104c104d
@ -182,7 +182,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const Com<D3D11Texture1D> texture = new D3D11Texture1D(this, &desc);
|
const Com<D3D11Texture1D> texture = new D3D11Texture1D(this, &desc);
|
||||||
this->InitTexture(texture->GetCommonTexture()->GetImage(), pInitialData);
|
this->InitTexture(texture->GetCommonTexture(), pInitialData);
|
||||||
*ppTexture1D = texture.ref();
|
*ppTexture1D = texture.ref();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} catch (const DxvkError& e) {
|
} catch (const DxvkError& e) {
|
||||||
@ -219,7 +219,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const Com<D3D11Texture2D> texture = new D3D11Texture2D(this, &desc);
|
const Com<D3D11Texture2D> texture = new D3D11Texture2D(this, &desc);
|
||||||
this->InitTexture(texture->GetCommonTexture()->GetImage(), pInitialData);
|
this->InitTexture(texture->GetCommonTexture(), pInitialData);
|
||||||
*ppTexture2D = texture.ref();
|
*ppTexture2D = texture.ref();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} catch (const DxvkError& e) {
|
} catch (const DxvkError& e) {
|
||||||
@ -256,7 +256,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const Com<D3D11Texture3D> texture = new D3D11Texture3D(this, &desc);
|
const Com<D3D11Texture3D> texture = new D3D11Texture3D(this, &desc);
|
||||||
this->InitTexture(texture->GetCommonTexture()->GetImage(), pInitialData);
|
this->InitTexture(texture->GetCommonTexture(), pInitialData);
|
||||||
*ppTexture3D = texture.ref();
|
*ppTexture3D = texture.ref();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} catch (const DxvkError& e) {
|
} catch (const DxvkError& e) {
|
||||||
@ -1849,8 +1849,7 @@ namespace dxvk {
|
|||||||
void D3D11Device::InitBuffer(
|
void D3D11Device::InitBuffer(
|
||||||
D3D11Buffer* pBuffer,
|
D3D11Buffer* pBuffer,
|
||||||
const D3D11_SUBRESOURCE_DATA* pInitialData) {
|
const D3D11_SUBRESOURCE_DATA* pInitialData) {
|
||||||
const DxvkBufferSlice bufferSlice
|
const DxvkBufferSlice bufferSlice = pBuffer->GetBufferSlice();
|
||||||
= pBuffer->GetBufferSlice();
|
|
||||||
|
|
||||||
if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) {
|
if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) {
|
||||||
LockResourceInitContext();
|
LockResourceInitContext();
|
||||||
@ -1867,8 +1866,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void D3D11Device::InitTexture(
|
void D3D11Device::InitTexture(
|
||||||
const Rc<DxvkImage>& image,
|
D3D11CommonTexture* pTexture,
|
||||||
const D3D11_SUBRESOURCE_DATA* pInitialData) {
|
const D3D11_SUBRESOURCE_DATA* pInitialData) {
|
||||||
|
const Rc<DxvkImage> image = pTexture->GetImage();
|
||||||
const DxvkFormatInfo* formatInfo = imageFormatInfo(image->info().format);
|
const DxvkFormatInfo* formatInfo = imageFormatInfo(image->info().format);
|
||||||
|
|
||||||
if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) {
|
if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) {
|
||||||
|
@ -19,6 +19,7 @@ namespace dxvk {
|
|||||||
class DxgiAdapter;
|
class DxgiAdapter;
|
||||||
|
|
||||||
class D3D11Buffer;
|
class D3D11Buffer;
|
||||||
|
class D3D11CommonTexture;
|
||||||
class D3D11Counter;
|
class D3D11Counter;
|
||||||
class D3D11DeviceContext;
|
class D3D11DeviceContext;
|
||||||
class D3D11ImmediateContext;
|
class D3D11ImmediateContext;
|
||||||
@ -380,7 +381,7 @@ namespace dxvk {
|
|||||||
const D3D11_SUBRESOURCE_DATA* pInitialData);
|
const D3D11_SUBRESOURCE_DATA* pInitialData);
|
||||||
|
|
||||||
void InitTexture(
|
void InitTexture(
|
||||||
const Rc<DxvkImage>& image,
|
D3D11CommonTexture* pTexture,
|
||||||
const D3D11_SUBRESOURCE_DATA* pInitialData);
|
const D3D11_SUBRESOURCE_DATA* pInitialData);
|
||||||
|
|
||||||
HRESULT GetFormatSupportFlags(
|
HRESULT GetFormatSupportFlags(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user