I am using AdrenoSDK 5.0's opengl es emulator under Window10 64 bit, Visual Studio 2015.
I created a minimal opengl es window project, the source code is at the end.
The problem is , when I compile a frag shader(very simple, only output white color),
the glGetShaderiv returns false, and the error message returned by glGetShaderInfoLog is :
0(172) : error C0117: cannot undef predefined macro 'GL_ARB_texture_query_lod'
but the vert shader is ok.
My graphic card is nVidia 1060 5G,
I tried to install the dirver 39x.xx and 441.87, it stills reports error.
Here is my source code:
(In visual studio, create a console application with only a main.cpp, and set the include path and lib path to adrenoSDK's include "D:\AdrenoSDK\Development\Inc" in my case, and lib directory "D:\AdrenoSDK\Development\Lib\Win32" in my case, then link with libEGL.lib and libGLESv2.lib)
#include <stdio.h>#include <Windows.h>#include <wchar.h>#include <EGL/egl.h>#include <EGL/eglext.h>#include "GLES3/gl3.h"typedef int int32;typedef unsigned int uint32;typedef unsigned int uint;void* m_windowHandle;EGLDisplay m_display;EGLSurface m_surface;EGLContext m_context;int m_width;int m_height;int32 __stdcall WndProc(void* hWnd, uint32 message, uint32 wParam, uint32 lParam){if (message == WM_DESTROY){PostQuitMessage(0);return 0;}return DefWindowProc(static_cast<HWND>(hWnd), message, wParam, lParam);}bool create_window(int width, int height){HINSTANCE hInstance = GetModuleHandle(0);m_width = width;m_height = height;::RECT window_rect;::SetRect(&window_rect,0,0,m_width,m_height);::AdjustWindowRect(&window_rect, WS_OVERLAPPEDWINDOW, FALSE);const TCHAR szWindowClass[] = L"MainWindowClass";WNDCLASSEX wcex;wcex.cbSize = sizeof(WNDCLASSEX);wcex.style = CS_HREDRAW | CS_VREDRAW;wcex.lpfnWndProc = reinterpret_cast<WNDPROC>(&WndProc);wcex.cbClsExtra = 0;wcex.cbWndExtra = 0;wcex.hInstance = hInstance;wcex.hIcon = LoadIcon(hInstance, NULL);wcex.hCursor = LoadCursor(NULL, IDC_ARROW);wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);wcex.lpszMenuName = NULL;wcex.lpszClassName = szWindowClass;wcex.hIconSm = 0;RegisterClassEx(&wcex);m_windowHandle = ::CreateWindow(szWindowClass, // LPCTSTR lpClassName,L"title", // LPCTSTR lpWindowName,WS_OVERLAPPEDWINDOW, // DWORD dwStyle,CW_USEDEFAULT, // int x,window_rect.top, // int y,window_rect.right - window_rect.left, // int nWidth,window_rect.bottom - window_rect.top, // int nHeight,NULL, // HWND hWndParent,NULL, // HMENU hMenu,hInstance, // HINSTANCE hInstance,NULL); // LPVOID lpParamif (!m_windowHandle)return false;ShowWindow(static_cast<HWND>(m_windowHandle), SW_SHOW);UpdateWindow(static_cast<HWND>(m_windowHandle));return true;}bool window_run(){::MSG msg;while (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE)){::TranslateMessage(&msg);::DispatchMessage(&msg);if (msg.message == WM_QUIT)return false;}return true;}bool eglWindow_create(void* hwnd, EGLDisplay& display, EGLSurface& surface, EGLContext& context){display = eglGetDisplay(EGL_DEFAULT_DISPLAY);if (display == EGL_NO_DISPLAY)return false;EGLBoolean r = EGL_FALSE;r = eglBindAPI(EGL_OPENGL_ES_API);if (!r)return false;r = eglInitialize(display, NULL, NULL);if (!r)return false;//choose configint attr[] ={EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR,EGL_RED_SIZE, 8,EGL_GREEN_SIZE, 8,EGL_BLUE_SIZE, 8,EGL_ALPHA_SIZE, 8,EGL_DEPTH_SIZE, 24,EGL_NONE,};EGLint config_count = 0;EGLConfig config = NULL;r = eglChooseConfig(display, attr, &config, 1, &config_count);if (!r || config_count == 0)return false;// surfacesurface = eglCreateWindowSurface(display, config, static_cast<HWND>(hwnd), NULL);if (surface == EGL_NO_SURFACE)return false;// contextEGLint contextAttributes[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };context = eglCreateContext(display, config, NULL, contextAttributes);if (context == EGL_NO_CONTEXT)return false;r = eglMakeCurrent(display, surface, surface, context);if (!r)return false;return true;}static const char* const ps_source = R"(#version 300 esprecision mediump float;in vec4 vertex_color;in vec2 vertex_coord;out vec4 out_color;uniform sampler2D tex;void main(){out_color = texture(tex, vertex_coord);})";int main(){create_window(800, 600);eglWindow_create(m_windowHandle, m_display, m_surface, m_context);int r = 0;const uint ps = glCreateShader(GL_FRAGMENT_SHADER);const char* ppsource[1] = { 0 };ppsource[0] = ps_source;glShaderSource(ps, 1, ppsource, NULL);glCompileShader(ps);glGetShaderiv(ps, GL_COMPILE_STATUS, &r);if (!r){char log[1024] = { 0 };glGetShaderInfoLog(ps, 1024, NULL, log);printf("%ss\n", log);glDeleteShader(ps);}while (window_run()){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// ...// do render// ...eglSwapBuffers(m_display, m_surface);}return 0;}
Update :
I installed nVidia Driver 384.76, now it's ok.
But this is still a problem, I can't stay in such an old driver version for all the time.
Will the AdrenoSDK update to 6.0 or etc?
I strongly hope so...
I think Qualcomm should be update Vulkan SDK instead of AdrenoSDK with OpenGL ES.