Add context types.
Change-Id: Ie8f76de97ce2a41c55e78b715b0ab7db039f5b3b
This commit is contained in:
parent
d44507708c
commit
41e77d2fdf
|
@ -26,6 +26,12 @@ struct OpenCLObjectMapper<_cl_context> {
|
||||||
typedef class Context DerivedType;
|
typedef class Context DerivedType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class ContextType {
|
||||||
|
CONTEXT_TYPE_DEFAULT,
|
||||||
|
CONTEXT_TYPE_SPECIALIZED,
|
||||||
|
CONTEXT_TYPE_UNRESTRICTIVE
|
||||||
|
};
|
||||||
|
|
||||||
class Context : public BaseObject<_cl_context> {
|
class Context : public BaseObject<_cl_context> {
|
||||||
public:
|
public:
|
||||||
static const cl_ulong objectMagic = 0xA4234321DC002130LL;
|
static const cl_ulong objectMagic = 0xA4234321DC002130LL;
|
||||||
|
@ -110,6 +116,8 @@ class Context : public BaseObject<_cl_context> {
|
||||||
bool getInteropUserSyncEnabled() { return interopUserSync; }
|
bool getInteropUserSyncEnabled() { return interopUserSync; }
|
||||||
void setInteropUserSyncEnabled(bool enabled) { interopUserSync = enabled; }
|
void setInteropUserSyncEnabled(bool enabled) { interopUserSync = enabled; }
|
||||||
|
|
||||||
|
ContextType peekContextType() { return this->contextType; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Context(void(CL_CALLBACK *pfnNotify)(const char *, const void *, size_t, void *) = nullptr,
|
Context(void(CL_CALLBACK *pfnNotify)(const char *, const void *, size_t, void *) = nullptr,
|
||||||
void *userData = nullptr);
|
void *userData = nullptr);
|
||||||
|
@ -131,5 +139,6 @@ class Context : public BaseObject<_cl_context> {
|
||||||
DriverDiagnostics *driverDiagnostics;
|
DriverDiagnostics *driverDiagnostics;
|
||||||
bool interopUserSync = false;
|
bool interopUserSync = false;
|
||||||
cl_bool preferD3dSharedResources = 0u;
|
cl_bool preferD3dSharedResources = 0u;
|
||||||
|
ContextType contextType = ContextType::CONTEXT_TYPE_DEFAULT;
|
||||||
};
|
};
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -340,3 +340,8 @@ TEST_P(ContextWithAsyncDeleterTest, givenContextWithMemoryManagerWhenAsyncDelete
|
||||||
INSTANTIATE_TEST_CASE_P(ContextTests,
|
INSTANTIATE_TEST_CASE_P(ContextTests,
|
||||||
ContextWithAsyncDeleterTest,
|
ContextWithAsyncDeleterTest,
|
||||||
::testing::Bool());
|
::testing::Bool());
|
||||||
|
|
||||||
|
TEST(DefaultContext, givenDefaultContextWhenItIsQueriedForTypeThenDefaultTypeIsReturned) {
|
||||||
|
MockContext context;
|
||||||
|
EXPECT_EQ(ContextType::CONTEXT_TYPE_DEFAULT, context.peekContextType());
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue