mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Added comparability verification for GL associated devices query (#2231)
Fixes #1485 according to work plan from issue description.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Copyright (c) 2024 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -42,14 +42,19 @@ private:
|
||||
cl_platform_id m_platform;
|
||||
bool m_is_glut_init;
|
||||
|
||||
HGLRC m_hGLRC;
|
||||
HDC m_hDC;
|
||||
|
||||
public:
|
||||
WGLEnvironment()
|
||||
{
|
||||
m_device_count = 0;
|
||||
m_platform = 0;
|
||||
m_is_glut_init = false;
|
||||
m_hGLRC = 0;
|
||||
m_hDC = 0;
|
||||
}
|
||||
virtual int Init( int *argc, char **argv, int use_opengl_32 )
|
||||
int Init(int *argc, char **argv, int use_opengl_32) override
|
||||
{
|
||||
if (!m_is_glut_init)
|
||||
{
|
||||
@@ -64,21 +69,25 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual cl_context CreateCLContext( void )
|
||||
cl_context CreateCLContext(void) override
|
||||
{
|
||||
HGLRC hGLRC = wglGetCurrentContext();
|
||||
HDC hDC = wglGetCurrentDC();
|
||||
m_hGLRC = wglGetCurrentContext();
|
||||
m_hDC = wglGetCurrentDC();
|
||||
cl_context_properties properties[] = {
|
||||
CL_CONTEXT_PLATFORM, (cl_context_properties) m_platform,
|
||||
CL_GL_CONTEXT_KHR, (cl_context_properties) hGLRC,
|
||||
CL_WGL_HDC_KHR, (cl_context_properties) hDC,
|
||||
CL_CONTEXT_PLATFORM,
|
||||
(cl_context_properties)m_platform,
|
||||
CL_GL_CONTEXT_KHR,
|
||||
(cl_context_properties)m_hGLRC,
|
||||
CL_WGL_HDC_KHR,
|
||||
(cl_context_properties)m_hDC,
|
||||
0
|
||||
};
|
||||
cl_device_id devices[MAX_DEVICES];
|
||||
size_t dev_size;
|
||||
cl_int status;
|
||||
|
||||
if (!hGLRC || !hDC) {
|
||||
if (!m_hGLRC || !m_hDC)
|
||||
{
|
||||
print_error(CL_INVALID_CONTEXT, "No GL context bound");
|
||||
return 0;
|
||||
}
|
||||
@@ -155,7 +164,7 @@ public:
|
||||
return clCreateContext(properties, 1, &ctxDevice, NULL, NULL, &status);
|
||||
}
|
||||
|
||||
virtual int SupportsCLGLInterop( cl_device_type device_type )
|
||||
int SupportsCLGLInterop(cl_device_type device_type) override
|
||||
{
|
||||
cl_device_id devices[MAX_DEVICES];
|
||||
cl_uint num_of_devices;
|
||||
|
||||
Reference in New Issue
Block a user