| 82 | } |
| 83 | |
| 84 | Status CreateEnvironment(Environment* result, bool shared, |
| 85 | cl_context_properties egl_context, |
| 86 | cl_context_properties egl_display) { |
| 87 | CLDevice gpu; |
| 88 | RETURN_IF_ERROR(CreateDefaultGPUDevice(&gpu)); |
| 89 | |
| 90 | CLContext context; |
| 91 | if (shared) { |
| 92 | RETURN_IF_ERROR(CreateCLGLContext(gpu, egl_context, egl_display, &context)); |
| 93 | } else { |
| 94 | RETURN_IF_ERROR(CreateCLContext(gpu, &context)); |
| 95 | } |
| 96 | CLCommandQueue queue; |
| 97 | RETURN_IF_ERROR(CreateCLCommandQueue(gpu, context, &queue)); |
| 98 | ProfilingCommandQueue profiling_queue; |
| 99 | RETURN_IF_ERROR(CreateProfilingCommandQueue(gpu, context, &profiling_queue)); |
| 100 | |
| 101 | *result = Environment(std::move(gpu), std::move(context), std::move(queue), |
| 102 | std::move(profiling_queue)); |
| 103 | |
| 104 | if (result->device().IsAdreno() && result->device().SupportsTextureArray()) { |
| 105 | bool supports_one_layer; |
| 106 | RETURN_IF_ERROR( |
| 107 | CheckKernelSupportOfOneLayerTextureArray(result, &supports_one_layer)); |
| 108 | if (!supports_one_layer) { |
| 109 | result->GetDevicePtr()->DisableOneLayerTextureArray(); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | return OkStatus(); |
| 114 | } |
| 115 | } // namespace |
| 116 | |
| 117 | Environment::Environment(CLDevice&& device, CLContext&& context, |
no test coverage detected