Files
compute-runtime/runtime/sharings/d3d/d3d_surface.h
Brandon Fliflet 7e9ad41290 Initial commit
Change-Id: I4bf1707bd3dfeadf2c17b0a7daff372b1925ebbd
2017-12-21 00:45:38 +01:00

65 lines
2.8 KiB
C++

/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include "runtime/sharings/d3d/d3d_sharing.h"
struct ErrorCodeHelper;
namespace OCLRT {
class Image;
class Context;
enum OCLPlane;
class D3DSurface : public D3DSharing<D3DTypesHelper::D3D9> {
typedef typename D3DTypesHelper::D3D9::D3DTexture2dDesc D3D9SurfaceDesc;
typedef typename D3DTypesHelper::D3D9::D3DTexture2d D3D9Surface;
typedef typename D3DTypesHelper::D3D9::D3DResource D3DResource;
typedef typename D3DTypesHelper::D3D9::D3DDevice D3DDevice;
public:
static Image *create(Context *context, cl_dx9_surface_info_khr *surfaceInfo, cl_mem_flags flags,
cl_dx9_media_adapter_type_khr adapterType, cl_uint plane, cl_int *retCode);
static cl_int findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat, cl_uint plane, OCLPlane &oclPlane);
void synchronizeObject(UpdateData *updateData) override;
void releaseResource(MemObj *memObject) override;
cl_dx9_surface_info_khr &getSurfaceInfo() { return surfaceInfo; }
cl_dx9_media_adapter_type_khr &getAdapterType() { return adapterType; }
cl_uint &getPlane() { return plane; }
~D3DSurface() override = default;
const bool lockable = false;
protected:
D3DSurface(Context *context, cl_dx9_surface_info_khr *surfaceInfo, D3D9Surface *surfaceStaging, cl_uint plane,
OCLPlane oclPlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable);
cl_dx9_media_adapter_type_khr adapterType = 0u;
cl_dx9_surface_info_khr surfaceInfo = {};
cl_uint plane = 0;
OCLPlane oclPlane;
D3D9Surface *d3d9Surface = nullptr;
D3D9Surface *d3d9SurfaceStaging = nullptr;
D3DDevice *resourceDevice = nullptr;
};
} // namespace OCLRT