mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-29 17:52:18 +01:00
[d3d11] Clean up resource validation around tiled resources
This commit is contained in:
parent
df5756c9a5
commit
9964e4a632
@ -177,7 +177,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11Buffer::NormalizeBufferProperties(D3D11_BUFFER_DESC* pDesc, D3D11_TILED_RESOURCES_TIER TiledTier) {
|
||||
HRESULT D3D11Buffer::NormalizeBufferProperties(D3D11_BUFFER_DESC* pDesc) {
|
||||
// Zero-sized buffers are illegal
|
||||
if (!pDesc->ByteWidth && !(pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL))
|
||||
return E_INVALIDARG;
|
||||
@ -207,8 +207,7 @@ namespace dxvk {
|
||||
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILED) {
|
||||
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL)
|
||||
|| (pDesc->Usage != D3D11_USAGE_DEFAULT)
|
||||
|| (pDesc->CPUAccessFlags)
|
||||
|| (!TiledTier))
|
||||
|| (pDesc->CPUAccessFlags))
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
@ -218,8 +217,7 @@ namespace dxvk {
|
||||
|| (pDesc->ByteWidth % SparseMemoryPageSize)
|
||||
|| (pDesc->Usage != D3D11_USAGE_DEFAULT)
|
||||
|| (pDesc->BindFlags)
|
||||
|| (pDesc->CPUAccessFlags)
|
||||
|| (!TiledTier))
|
||||
|| (pDesc->CPUAccessFlags))
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
|
@ -146,12 +146,10 @@ namespace dxvk {
|
||||
* \brief Normalizes buffer description
|
||||
*
|
||||
* \param [in] pDesc Buffer description
|
||||
* \param [in] TiledTier Tiled resources tier
|
||||
* \returns \c S_OK if the parameters are valid
|
||||
*/
|
||||
static HRESULT NormalizeBufferProperties(
|
||||
D3D11_BUFFER_DESC* pDesc,
|
||||
D3D11_TILED_RESOURCES_TIER TiledTier);
|
||||
D3D11_BUFFER_DESC* pDesc);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -86,12 +86,15 @@ namespace dxvk {
|
||||
return E_INVALIDARG;
|
||||
|
||||
D3D11_BUFFER_DESC desc = *pDesc;
|
||||
HRESULT hr = D3D11Buffer::NormalizeBufferProperties(&desc,
|
||||
m_deviceFeatures.GetTiledResourcesTier());
|
||||
HRESULT hr = D3D11Buffer::NormalizeBufferProperties(&desc);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if ((desc.MiscFlags & (D3D11_RESOURCE_MISC_TILED | D3D11_RESOURCE_MISC_TILE_POOL))
|
||||
&& !m_deviceFeatures.GetTiledResourcesTier())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!ppBuffer)
|
||||
return S_FALSE;
|
||||
|
||||
@ -133,12 +136,14 @@ namespace dxvk {
|
||||
desc.MiscFlags = pDesc->MiscFlags;
|
||||
desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED;
|
||||
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc,
|
||||
D3D11_TILED_RESOURCES_NOT_SUPPORTED);
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
||||
if (desc.MiscFlags & D3D11_RESOURCE_MISC_TILED)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!ppTexture1D)
|
||||
return S_FALSE;
|
||||
|
||||
@ -210,8 +215,11 @@ namespace dxvk {
|
||||
desc.MiscFlags = pDesc->MiscFlags;
|
||||
desc.TextureLayout = pDesc->TextureLayout;
|
||||
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc,
|
||||
m_deviceFeatures.GetTiledResourcesTier());
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
|
||||
|
||||
if ((desc.MiscFlags & D3D11_RESOURCE_MISC_TILED)
|
||||
&& !m_deviceFeatures.GetTiledResourcesTier())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
@ -286,14 +294,12 @@ namespace dxvk {
|
||||
desc.MiscFlags = pDesc->MiscFlags;
|
||||
desc.TextureLayout = pDesc->TextureLayout;
|
||||
|
||||
D3D11_TILED_RESOURCES_TIER tiledResourcesTier = m_deviceFeatures.GetTiledResourcesTier();
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc, tiledResourcesTier);
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if ((desc.MiscFlags & D3D11_RESOURCE_MISC_TILED)
|
||||
&& (tiledResourcesTier < D3D11_TILED_RESOURCES_TIER_3))
|
||||
if (desc.MiscFlags & D3D11_RESOURCE_MISC_TILED)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!ppTexture3D)
|
||||
@ -1966,6 +1972,10 @@ namespace dxvk {
|
||||
|| !m_dxvkDevice->features().vk12.shaderOutputLayer))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (shader->flags().test(DxvkShaderFlag::UsesSparseResidency)
|
||||
&& !m_dxvkDevice->features().core.features.shaderResourceResidency)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (shader->flags().test(DxvkShaderFlag::UsesFragmentCoverage)
|
||||
&& !m_dxvkDevice->properties().extConservativeRasterization.fullyCoveredFragmentShaderInputVariable)
|
||||
return E_INVALIDARG;
|
||||
|
@ -146,8 +146,7 @@ namespace dxvk {
|
||||
desc.MiscFlags = pDesc->MiscFlags;
|
||||
desc.TextureLayout = pDesc->TextureLayout;
|
||||
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc,
|
||||
D3D11_TILED_RESOURCES_NOT_SUPPORTED);
|
||||
HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
@ -402,7 +402,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11CommonTexture::NormalizeTextureProperties(D3D11_COMMON_TEXTURE_DESC* pDesc, D3D11_TILED_RESOURCES_TIER TiledTier) {
|
||||
HRESULT D3D11CommonTexture::NormalizeTextureProperties(D3D11_COMMON_TEXTURE_DESC* pDesc) {
|
||||
if (pDesc->Width == 0 || pDesc->Height == 0 || pDesc->Depth == 0 || pDesc->ArraySize == 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@ -434,8 +434,7 @@ namespace dxvk {
|
||||
|
||||
if ((pDesc->MiscFlags & invalidFlags)
|
||||
|| (pDesc->Usage != D3D11_USAGE_DEFAULT)
|
||||
|| (pDesc->CPUAccessFlags)
|
||||
|| (!TiledTier))
|
||||
|| (pDesc->CPUAccessFlags))
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
|
@ -442,12 +442,10 @@ namespace dxvk {
|
||||
* parameters. Any error returned by this method should
|
||||
* be forwarded to the application.
|
||||
* \param [in,out] pDesc Texture description
|
||||
* \param [in] TiledTier Tiled resources tier
|
||||
* \returns \c S_OK if the parameters are valid
|
||||
*/
|
||||
static HRESULT NormalizeTextureProperties(
|
||||
D3D11_COMMON_TEXTURE_DESC* pDesc,
|
||||
D3D11_TILED_RESOURCES_TIER TiledTier);
|
||||
D3D11_COMMON_TEXTURE_DESC* pDesc);
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user