#ifndef AMF_Compute_h
#define AMF_Compute_h
#pragma once
#include "Buffer.h"
#include "Surface.h"
#if defined(__cplusplus)
namespace amf
{
#endif
typedef amf_uint64 AMF_KERNEL_ID;
typedef enum AMF_CHANNEL_ORDER
{
AMF_CHANNEL_ORDER_INVALID = 0,
AMF_CHANNEL_ORDER_R = 1,
AMF_CHANNEL_ORDER_RG = 2,
AMF_CHANNEL_ORDER_BGRA = 3,
AMF_CHANNEL_ORDER_RGBA = 4,
AMF_CHANNEL_ORDER_ARGB = 5,
AMF_CHANNEL_ORDER_YUY2 = 6,
AMF_CHANNEL_ORDER_ABGR = 7,
} AMF_CHANNEL_ORDER;
typedef enum AMF_CHANNEL_TYPE
{
AMF_CHANNEL_INVALID = 0,
AMF_CHANNEL_UNSIGNED_INT8 = 1,
AMF_CHANNEL_UNSIGNED_INT32 = 2,
AMF_CHANNEL_UNORM_INT8 = 3,
AMF_CHANNEL_UNORM_INT16 = 4,
AMF_CHANNEL_SNORM_INT16 = 5,
AMF_CHANNEL_FLOAT = 6,
AMF_CHANNEL_FLOAT16 = 7,
AMF_CHANNEL_UNSIGNED_INT16 = 8,
AMF_CHANNEL_UNORM_INT_101010 = 9,
} AMF_CHANNEL_TYPE;
#define AMF_STRUCTURED_BUFFER_FORMAT L"StructuredBufferFormat"
#if defined(_WIN32)
AMF_WEAK GUID AMFStructuredBufferFormatGUID = { 0x90c5d674, 0xe90, 0x4181, {0xbd, 0xef, 0x26, 0x13, 0xc1, 0xdf, 0xa3, 0xbd} }; #endif
typedef enum AMF_ARGUMENT_ACCESS_TYPE
{
AMF_ARGUMENT_ACCESS_READ = 0,
AMF_ARGUMENT_ACCESS_WRITE = 1,
AMF_ARGUMENT_ACCESS_READWRITE = 2,
AMF_ARGUMENT_ACCESS_READWRITE_MASK = 0xFFFF,
AMF_ARGUMENT_SAMPLER_LINEAR = 0x10000000,
AMF_ARGUMENT_SAMPLER_NORM_COORD = 0x20000000,
AMF_ARGUMENT_SAMPLER_POINT = 0x40000000,
AMF_ARGUMENT_SAMPLER_MASK = 0xFFFF0000,
} AMF_ARGUMENT_ACCESS_TYPE;
#if defined(__cplusplus)
class AMF_NO_VTABLE AMFComputeKernel : public AMFInterface
{
public:
AMF_DECLARE_IID(0x94815701, 0x6c84, 0x4ba6, 0xa9, 0xfe, 0xe9, 0xad, 0x40, 0xf8, 0x8, 0x8)
virtual void* AMF_STD_CALL GetNative() = 0;
virtual const wchar_t* AMF_STD_CALL GetIDName() = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgPlaneNative(amf_size index, void* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgBufferNative(amf_size index, void* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgPlane(amf_size index, AMFPlane* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgBuffer(amf_size index, AMFBuffer* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgInt32(amf_size index, amf_int32 data) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgInt64(amf_size index, amf_int64 data) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgFloat(amf_size index, amf_float data) = 0;
virtual AMF_RESULT AMF_STD_CALL SetArgBlob(amf_size index, amf_size dataSize, const void* pData) = 0;
virtual AMF_RESULT AMF_STD_CALL GetCompileWorkgroupSize(amf_size workgroupSize[3]) = 0;
virtual AMF_RESULT AMF_STD_CALL Enqueue(amf_size dimension, amf_size globalOffset[3], amf_size globalSize[3], amf_size localSize[3]) = 0;
};
typedef AMFInterfacePtr_T<AMFComputeKernel> AMFComputeKernelPtr;
#else
AMF_DECLARE_IID(AMFComputeKernel, 0x94815701, 0x6c84, 0x4ba6, 0xa9, 0xfe, 0xe9, 0xad, 0x40, 0xf8, 0x8, 0x8)
typedef struct AMFComputeKernel AMFComputeKernel;
typedef struct AMFComputeKernelVtbl
{
amf_long (AMF_STD_CALL *Acquire)(AMFComputeKernel* pThis);
amf_long (AMF_STD_CALL *Release)(AMFComputeKernel* pThis);
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeKernel* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
void* (AMF_STD_CALL *GetNative)(AMFComputeKernel* pThis);
const wchar_t* (AMF_STD_CALL *GetIDName)(AMFComputeKernel* pThis);
AMF_RESULT (AMF_STD_CALL *SetArgPlaneNative)(AMFComputeKernel* pThis, amf_size index, void* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess);
AMF_RESULT (AMF_STD_CALL *SetArgBufferNative)(AMFComputeKernel* pThis, amf_size index, void* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess);
AMF_RESULT (AMF_STD_CALL *SetArgPlane)(AMFComputeKernel* pThis, amf_size index, AMFPlane* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess);
AMF_RESULT (AMF_STD_CALL *SetArgBuffer)(AMFComputeKernel* pThis, amf_size index, AMFBuffer* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess);
AMF_RESULT (AMF_STD_CALL *SetArgInt32)(AMFComputeKernel* pThis, amf_size index, amf_int32 data);
AMF_RESULT (AMF_STD_CALL *SetArgInt64)(AMFComputeKernel* pThis, amf_size index, amf_int64 data);
AMF_RESULT (AMF_STD_CALL *SetArgFloat)(AMFComputeKernel* pThis, amf_size index, amf_float data);
AMF_RESULT (AMF_STD_CALL *SetArgBlob)(AMFComputeKernel* pThis, amf_size index, amf_size dataSize, const void* pData);
AMF_RESULT (AMF_STD_CALL *GetCompileWorkgroupSize)(AMFComputeKernel* pThis, amf_size workgroupSize[3]);
AMF_RESULT (AMF_STD_CALL *Enqueue)(AMFComputeKernel* pThis, amf_size dimension, amf_size globalOffset[3], amf_size globalSize[3], amf_size localSize[3]);
} AMFComputeKernelVtbl;
struct AMFComputeKernel
{
const AMFComputeKernelVtbl *pVtbl;
};
#endif
#if defined(__cplusplus)
class AMF_NO_VTABLE AMFComputeSyncPoint : public AMFInterface
{
public:
AMF_DECLARE_IID(0x66f33fe6, 0xaae, 0x4e65, 0xba, 0x3, 0xea, 0x8b, 0xa3, 0x60, 0x11, 0x2)
virtual amf_bool AMF_STD_CALL IsCompleted() = 0;
virtual void AMF_STD_CALL Wait() = 0;
};
typedef AMFInterfacePtr_T<AMFComputeSyncPoint> AMFComputeSyncPointPtr;
#else
AMF_DECLARE_IID(AMFComputeSyncPoint, 0x66f33fe6, 0xaae, 0x4e65, 0xba, 0x3, 0xea, 0x8b, 0xa3, 0x60, 0x11, 0x2)
typedef struct AMFComputeSyncPoint AMFComputeSyncPoint;
typedef struct AMFComputeSyncPointVtbl
{
amf_long (AMF_STD_CALL *Acquire)(AMFComputeSyncPoint* pThis);
amf_long (AMF_STD_CALL *Release)(AMFComputeSyncPoint* pThis);
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeSyncPoint* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
amf_bool (AMF_STD_CALL *IsCompleted)(AMFComputeSyncPoint* pThis);
void (AMF_STD_CALL *Wait)(AMFComputeSyncPoint* pThis);
} AMFComputeSyncPointVtbl;
struct AMFComputeSyncPoint
{
const AMFComputeSyncPointVtbl *pVtbl;
};
#endif
#if defined(__cplusplus)
class AMF_NO_VTABLE AMFCompute : public AMFInterface
{
public:
AMF_DECLARE_IID(0x3846233a, 0x3f43, 0x443f, 0x8a, 0x45, 0x75, 0x22, 0x11, 0xa9, 0xfb, 0xd5)
virtual AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType() = 0;
virtual void* AMF_STD_CALL GetNativeContext() = 0;
virtual void* AMF_STD_CALL GetNativeDeviceID() = 0;
virtual void* AMF_STD_CALL GetNativeCommandQueue() = 0;
virtual AMF_RESULT AMF_STD_CALL GetKernel(AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel) = 0;
virtual AMF_RESULT AMF_STD_CALL PutSyncPoint(AMFComputeSyncPoint** ppSyncPoint) = 0;
virtual AMF_RESULT AMF_STD_CALL FinishQueue() = 0;
virtual AMF_RESULT AMF_STD_CALL FlushQueue() = 0;
virtual AMF_RESULT AMF_STD_CALL FillPlane(AMFPlane *pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor) = 0;
virtual AMF_RESULT AMF_STD_CALL FillBuffer(AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize) = 0;
virtual AMF_RESULT AMF_STD_CALL ConvertPlaneToBuffer(AMFPlane *pSrcPlane, AMFBuffer** ppDstBuffer) = 0;
virtual AMF_RESULT AMF_STD_CALL CopyBuffer(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset) = 0;
virtual AMF_RESULT AMF_STD_CALL CopyPlane(AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]) = 0;
virtual AMF_RESULT AMF_STD_CALL CopyBufferToHost(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, amf_bool blocking) = 0;
virtual AMF_RESULT AMF_STD_CALL CopyBufferFromHost(const void* pSource, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffsetInBytes, amf_bool blocking) = 0;
virtual AMF_RESULT AMF_STD_CALL CopyPlaneToHost(AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, amf_bool blocking) = 0;
virtual AMF_RESULT AMF_STD_CALL CopyPlaneFromHost(void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, amf_bool blocking) = 0;
virtual AMF_RESULT AMF_STD_CALL ConvertPlaneToPlane(AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type) = 0;
};
typedef AMFInterfacePtr_T<AMFCompute> AMFComputePtr;
#else
AMF_DECLARE_IID(AMFCompute, 0x3846233a, 0x3f43, 0x443f, 0x8a, 0x45, 0x75, 0x22, 0x11, 0xa9, 0xfb, 0xd5)
typedef struct AMFCompute AMFCompute;
typedef struct AMFComputeVtbl
{
amf_long (AMF_STD_CALL *Acquire)(AMFCompute* pThis);
amf_long (AMF_STD_CALL *Release)(AMFCompute* pThis);
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCompute* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFCompute* pThis);
void* (AMF_STD_CALL *GetNativeContext)(AMFCompute* pThis);
void* (AMF_STD_CALL *GetNativeDeviceID)(AMFCompute* pThis);
void* (AMF_STD_CALL *GetNativeCommandQueue)(AMFCompute* pThis);
AMF_RESULT (AMF_STD_CALL *GetKernel)(AMFCompute* pThis, AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel);
AMF_RESULT (AMF_STD_CALL *PutSyncPoint)(AMFCompute* pThis, AMFComputeSyncPoint** ppSyncPoint);
AMF_RESULT (AMF_STD_CALL *FinishQueue)(AMFCompute* pThis);
AMF_RESULT (AMF_STD_CALL *FlushQueue)(AMFCompute* pThis);
AMF_RESULT (AMF_STD_CALL *FillPlane)(AMFCompute* pThis, AMFPlane *pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor);
AMF_RESULT (AMF_STD_CALL *FillBuffer)(AMFCompute* pThis, AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize);
AMF_RESULT (AMF_STD_CALL *ConvertPlaneToBuffer)(AMFCompute* pThis, AMFPlane *pSrcPlane, AMFBuffer** ppDstBuffer);
AMF_RESULT (AMF_STD_CALL *CopyBuffer)(AMFCompute* pThis, AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset);
AMF_RESULT (AMF_STD_CALL *CopyPlane)(AMFCompute* pThis, AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]);
AMF_RESULT (AMF_STD_CALL *CopyBufferToHost)(AMFCompute* pThis, AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, amf_bool blocking);
AMF_RESULT (AMF_STD_CALL *CopyBufferFromHost)(AMFCompute* pThis, const void* pSource, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffsetInBytes, amf_bool blocking);
AMF_RESULT (AMF_STD_CALL *CopyPlaneToHost)(AMFCompute* pThis, AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, amf_bool blocking);
AMF_RESULT (AMF_STD_CALL *CopyPlaneFromHost)(AMFCompute* pThis, void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, amf_bool blocking);
AMF_RESULT (AMF_STD_CALL *ConvertPlaneToPlane)(AMFCompute* pThis, AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type);
} AMFComputeVtbl;
struct AMFCompute
{
const AMFComputeVtbl *pVtbl;
};
#endif
#if defined(__cplusplus)
class AMF_NO_VTABLE AMFPrograms
{
public:
virtual AMF_RESULT AMF_STD_CALL RegisterKernelSourceFile(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, const wchar_t* filepath, const char* options) = 0;
virtual AMF_RESULT AMF_STD_CALL RegisterKernelSource(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
virtual AMF_RESULT AMF_STD_CALL RegisterKernelBinary(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
virtual AMF_RESULT AMF_STD_CALL RegisterKernelSource1(AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
virtual AMF_RESULT AMF_STD_CALL RegisterKernelBinary1(AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
};
#else
typedef struct AMFPrograms AMFPrograms;
typedef struct AMFProgramsVtbl
{
AMF_RESULT (AMF_STD_CALL *RegisterKernelSourceFile)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, const wchar_t* filepath, const char* options);
AMF_RESULT (AMF_STD_CALL *RegisterKernelSource)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
AMF_RESULT (AMF_STD_CALL *RegisterKernelBinary)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
AMF_RESULT (AMF_STD_CALL *RegisterKernelSource1)(AMFPrograms* pThis, AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
AMF_RESULT (AMF_STD_CALL *RegisterKernelBinary1)(AMFPrograms* pThis, AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
} AMFProgramsVtbl;
struct AMFPrograms
{
const AMFProgramsVtbl *pVtbl;
};
#endif
#if defined(__cplusplus)
} #endif
#endif