mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 17:41:26 +08:00
Return zero formats for plane > 1 in dx11
Related-To: NEO-612 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
97dba1eb00
commit
a48dde79e7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -211,8 +211,9 @@ void D3DSharingFunctions<D3D>::createTexture3d(D3DTexture3d **texture, D3DTextur
|
||||
}
|
||||
|
||||
template <typename D3D>
|
||||
void D3DSharingFunctions<D3D>::checkFormatSupport(DXGI_FORMAT format, UINT *pFormat) {
|
||||
d3dDevice->CheckFormatSupport(format, pFormat);
|
||||
bool D3DSharingFunctions<D3D>::checkFormatSupport(DXGI_FORMAT format, UINT *pFormat) {
|
||||
auto errorCode = d3dDevice->CheckFormatSupport(format, pFormat);
|
||||
return errorCode == S_OK;
|
||||
}
|
||||
|
||||
template <typename D3D>
|
||||
@@ -230,11 +231,12 @@ std::vector<DXGI_FORMAT> &D3DSharingFunctions<D3D>::retrieveTextureFormats(cl_me
|
||||
cached_formats.reserve(arrayCount(DXGIFormats));
|
||||
for (auto DXGIFormat : DXGIFormats) {
|
||||
UINT format = 0;
|
||||
checkFormatSupport(DXGIFormat, &format);
|
||||
if (memObjectFormatSupport(imageType, format)) {
|
||||
cached_formats.push_back(DXGIFormat);
|
||||
if (D3DSharing<D3D>::isFormatWithPlane1(DXGIFormat)) {
|
||||
planarFormats.push_back(DXGIFormat);
|
||||
if (checkFormatSupport(DXGIFormat, &format)) {
|
||||
if (memObjectFormatSupport(imageType, format)) {
|
||||
cached_formats.push_back(DXGIFormat);
|
||||
if (D3DSharing<D3D>::isFormatWithPlane1(DXGIFormat)) {
|
||||
planarFormats.push_back(DXGIFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -56,7 +56,8 @@ void D3DSharingFunctions<D3DTypesHelper::D3D9>::createTexture3d(D3DTexture3d **t
|
||||
}
|
||||
|
||||
template <>
|
||||
void D3DSharingFunctions<D3DTypesHelper::D3D9>::checkFormatSupport(DXGI_FORMAT format, UINT *pFormat) {
|
||||
bool D3DSharingFunctions<D3DTypesHelper::D3D9>::checkFormatSupport(DXGI_FORMAT format, UINT *pFormat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -117,7 +117,7 @@ class D3DSharingFunctions : public SharingFunctions {
|
||||
MOCKABLE_VIRTUAL void getRenderTargetData(D3DTexture2d *renderTarget, D3DTexture2d *dstSurface);
|
||||
MOCKABLE_VIRTUAL void updateSurface(D3DTexture2d *src, D3DTexture2d *dst);
|
||||
MOCKABLE_VIRTUAL void updateDevice(D3DResource *resource);
|
||||
MOCKABLE_VIRTUAL void checkFormatSupport(DXGI_FORMAT format, UINT *pFormat);
|
||||
MOCKABLE_VIRTUAL bool checkFormatSupport(DXGI_FORMAT format, UINT *pFormat);
|
||||
MOCKABLE_VIRTUAL bool memObjectFormatSupport(cl_mem_object_type object, UINT format);
|
||||
|
||||
GetDxgiDescFcn getDxgiDescFcn = nullptr;
|
||||
@@ -169,14 +169,18 @@ static inline cl_int getSupportedDXTextureFormats(cl_context context, cl_mem_obj
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
auto supported_formats = pSharing->retrieveTextureFormats(imageType, plane);
|
||||
size_t numberOfFormats = 0;
|
||||
if (plane <= 1) {
|
||||
auto supported_formats = pSharing->retrieveTextureFormats(imageType, plane);
|
||||
numberOfFormats = supported_formats.size();
|
||||
|
||||
if (formats != nullptr) {
|
||||
memcpy_s(formats, sizeof(DXGI_FORMAT) * numEntries, supported_formats.data(), sizeof(DXGI_FORMAT) * std::min(static_cast<size_t>(numEntries), supported_formats.size()));
|
||||
if (formats != nullptr) {
|
||||
memcpy_s(formats, sizeof(DXGI_FORMAT) * numEntries, supported_formats.data(), sizeof(DXGI_FORMAT) * std::min(static_cast<size_t>(numEntries), numberOfFormats));
|
||||
}
|
||||
}
|
||||
|
||||
if (numImageFormats) {
|
||||
*numImageFormats = static_cast<cl_uint>(supported_formats.size());
|
||||
*numImageFormats = static_cast<cl_uint>(numberOfFormats);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user