Debian Codegraph @

opencl/source/sharings/d3d/d3d_sharing.h

raw
1 /*
2 * Copyright (C) 2018-2023 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #pragma once
9 #include "opencl/source/sharings/sharing.h"
10
11 #include "d3d_sharing_functions.h"
12
13 #include <mutex>
14
15 namespace NEO {
16 enum class ImagePlane;
17 class Context;
18 class Gmm;
19 struct ClSurfaceFormatInfo;
20 struct ImageInfo;
21
22 template <typename D3D>
23 class D3DSharing : public SharingHandler {
24 typedef typename D3D::D3DQuery D3DQuery;
25 typedef typename D3D::D3DResource D3DResource;
26
27 public:
28 D3DSharing(Context *context, D3DResource *resource, D3DResource *resourceStaging, unsigned int subresource, bool sharedResource);
29
30 ~D3DSharing() override;
31
32 void synchronizeObject(UpdateData &updateData) override;
33 void releaseResource(MemObj *memObject, uint32_t rootDeviceIndex) override;
34
35 D3DResource **getResourceHandler() { return &resource; }
36 void *getResourceStaging() { return resourceStaging; }
37 unsigned int &getSubresource() { return subresource; }
38 D3DQuery *getQuery() { return d3dQuery; }
39 bool isSharedResource() { return sharedResource; }
40 static const ClSurfaceFormatInfo *findSurfaceFormatInfo(int gmmFormat, cl_mem_flags flags, bool supportsOcl20Features, bool packedSupported);
41 static bool isFormatWithPlane1(DXGI_FORMAT format);
42
43 protected:
44 static void updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, ImagePlane imagePlane, cl_uint arrayIndex);
45
46 Context *context;
47 D3DSharingFunctions<D3D> *sharingFunctions = nullptr;
48 D3DResource *resource = nullptr;
49 D3DResource *resourceStaging = nullptr;
50 D3DQuery *d3dQuery = nullptr;
51 bool sharedResource = false;
52 unsigned int subresource = 0;
53 std::mutex mtx;
54 };
55 } // namespace NEO