HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Nougat 7.1
|
7.1.1_r28
下载
查看原文件
收藏
根目录
external
deqp
modules
egl
teglGLES2SharingThreadedTests.cpp
/*------------------------------------------------------------------------- * drawElements Quality Program EGL Module * --------------------------------------- * * Copyright 2014 The Android Open Source Project * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *//*! * \file * \brief EGL gles2 sharing threaded tests *//*--------------------------------------------------------------------*/ #include "teglGLES2SharingThreadedTests.hpp" #include "tcuTestLog.hpp" #include "tcuThreadUtil.hpp" #include "deRandom.hpp" #include "deThread.hpp" #include "deSharedPtr.hpp" #include "deMutex.hpp" #include "deSemaphore.hpp" #include "deStringUtil.hpp" #include "deClock.h" #include "deString.h" #include "deMemory.h" #include "deMath.h" #include "gluDefs.hpp" #include "glwEnums.hpp" #include "glwFunctions.hpp" #include "egluUtil.hpp" #include "eglwLibrary.hpp" #include "eglwEnums.hpp" #include
#include
#include
#include
using std::vector; using std::string; using de::SharedPtr; using namespace glw; using namespace eglw; namespace deqp { namespace egl { namespace GLES2ThreadTest { class Texture; class Buffer; class Shader; class Program; class GLES2ResourceManager { public: SharedPtr
popTexture (int index); const SharedPtr
getTexture (int index) const { return m_textures[index]; } void addTexture (SharedPtr
texture) { m_textures.push_back(texture); } int getTextureCount (void) const { return (int)m_textures.size(); } SharedPtr
popBuffer (int index); const SharedPtr
getBuffer (int index) const { return m_buffers[index]; } void addBuffer (SharedPtr
buffer) { m_buffers.push_back(buffer); } int getBufferCount (void) const { return (int)m_buffers.size(); } SharedPtr
popShader (int index); const SharedPtr
getShader (int index) const { return m_shaders[index]; } void addShader (SharedPtr
shader) { m_shaders.push_back(shader); } int getShaderCount (void) const { return (int)m_shaders.size(); } SharedPtr
popProgram (int index); const SharedPtr
getProgram (int index) const { return m_programs[index]; } void addProgram (SharedPtr
program) { m_programs.push_back(program); } int getProgramCount (void) const { return (int)m_programs.size(); } private: std::vector
> m_textures; std::vector
> m_buffers; std::vector
> m_shaders; std::vector
> m_programs; }; SharedPtr
GLES2ResourceManager::popTexture (int index) { SharedPtr
texture = m_textures[index]; m_textures.erase(m_textures.begin() + index); return texture; } SharedPtr
GLES2ResourceManager::popBuffer (int index) { SharedPtr
buffer = m_buffers[index]; m_buffers.erase(m_buffers.begin() + index); return buffer; } SharedPtr
GLES2ResourceManager::popShader (int index) { SharedPtr
shader = m_shaders[index]; m_shaders.erase(m_shaders.begin() + index); return shader; } SharedPtr
GLES2ResourceManager::popProgram (int index) { SharedPtr
program = m_programs[index]; m_programs.erase(m_programs.begin() + index); return program; } class GLES2Context : public tcu::ThreadUtil::Object { public: GLES2Context (SharedPtr
event, SharedPtr
resourceManager); ~GLES2Context (void); // Call generation time attributes SharedPtr
resourceManager; // Run time attributes EGLDisplay display; EGLContext context; struct { glEGLImageTargetTexture2DOESFunc imageTargetTexture2D; } glExtensions; private: GLES2Context (const GLES2Context&); GLES2Context& operator= (const GLES2Context&); }; GLES2Context::GLES2Context (SharedPtr
event, SharedPtr
resourceManager_) : tcu::ThreadUtil::Object ("Context", event) , resourceManager (resourceManager_) , display (EGL_NO_DISPLAY) , context (EGL_NO_CONTEXT) { glExtensions.imageTargetTexture2D = DE_NULL; } GLES2Context::~GLES2Context (void) { } class Surface : public tcu::ThreadUtil::Object { public: Surface (SharedPtr
event); ~Surface (void); // Run time attributes EGLSurface surface; private: Surface (const Surface&); Surface& operator= (const Surface&); }; Surface::Surface (SharedPtr
event) : tcu::ThreadUtil::Object ("Surface", event) , surface (EGL_NO_SURFACE) { } Surface::~Surface (void) { } // EGL thread with thread specifig state class EGLThread : public tcu::ThreadUtil::Thread { public: EGLThread (const Library& egl_, const glw::Functions& gl_, int seed); ~EGLThread (void); virtual void deinit (void); const Library& egl; const glw::Functions& gl; // Generation time attributes SharedPtr
context; SharedPtr
surface; // Runtime attributes SharedPtr
runtimeContext; EGLSurface eglSurface; private: }; EGLThread::EGLThread (const Library& egl_, const glw::Functions& gl_, int seed) : tcu::ThreadUtil::Thread (seed) , egl (egl_) , gl (gl_) , eglSurface (EGL_NO_SURFACE) { } void EGLThread::deinit (void) { if (runtimeContext) { if (runtimeContext->context != EGL_NO_CONTEXT) egl.makeCurrent(runtimeContext->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); egl.destroyContext(runtimeContext->display, runtimeContext->context); runtimeContext->context = EGL_NO_CONTEXT; egl.destroySurface(runtimeContext->display, eglSurface); eglSurface = EGL_NO_SURFACE; } egl.releaseThread(); } EGLThread::~EGLThread (void) { EGLThread::deinit(); } class FenceSync { public: FenceSync (void); ~FenceSync (void); void init (EGLThread& thread, bool serverSync); bool waitReady (EGLThread& thread); void addWaiter (void); private: EGLDisplay m_display; EGLSyncKHR m_sync; de::Mutex m_lock; int m_waiterCount; bool m_serverSync; }; FenceSync::FenceSync (void) : m_display (EGL_NO_DISPLAY) , m_sync (NULL) , m_waiterCount (0) , m_serverSync (false) { } FenceSync::~FenceSync (void) { } void FenceSync::addWaiter (void) { m_lock.lock(); m_waiterCount++; m_lock.unlock(); } void FenceSync::init (EGLThread& thread, bool serverSync) { m_display = thread.runtimeContext->display; m_serverSync = serverSync; // Use sync only if somebody will actualy depend on it m_lock.lock(); if (m_waiterCount > 0) { thread.newMessage() << "Begin -- eglCreateSyncKHR(" << ((size_t)m_display) << ", EGL_SYNC_FENCE_KHR, DE_NULL)" << tcu::ThreadUtil::Message::End; m_sync = thread.egl.createSyncKHR(m_display, EGL_SYNC_FENCE_KHR, DE_NULL); thread.newMessage() << "End -- " << ((size_t)m_sync) << " = eglCreateSyncKHR()" << tcu::ThreadUtil::Message::End; TCU_CHECK(m_sync); } m_lock.unlock(); } bool FenceSync::waitReady (EGLThread& thread) { bool ok = true; if (m_serverSync) { thread.newMessage() << "Begin -- eglWaitSyncKHR(" << ((size_t)m_display) << ", " << ((size_t)m_sync) << ", 0)" << tcu::ThreadUtil::Message::End; EGLint result = thread.egl.waitSyncKHR(m_display, m_sync, 0); thread.newMessage() << "End -- " << result << " = eglWaitSyncKHR()" << tcu::ThreadUtil::Message::End; ok = result == EGL_TRUE; } else { thread.newMessage() << "Begin -- eglClientWaitSyncKHR(" << ((size_t)m_display) << ", " << ((size_t)m_sync) << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, 1000 000 000)" << tcu::ThreadUtil::Message::End; EGLint result = thread.egl.clientWaitSyncKHR(m_display, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, 1000000000); thread.newMessage() << "End -- " << result << " = eglClientWaitSyncKHR()" << tcu::ThreadUtil::Message::End; ok = result == EGL_CONDITION_SATISFIED_KHR; } m_lock.lock(); m_waiterCount--; DE_ASSERT(m_waiterCount >= 0); if (m_waiterCount == 0) { // \note [mika] This is no longer deterministic and eglDestroySyncKHR might happen in different places and in different threads thread.newMessage() << "Begin -- eglDestroySyncKHR(" << ((size_t)m_display) << ", " << ((size_t)m_sync) << ")" << tcu::ThreadUtil::Message::End; EGLint destroyResult = thread.egl.destroySyncKHR(m_display, m_sync); thread.newMessage() << "End -- " << destroyResult << " = eglDestroySyncKHR()" << tcu::ThreadUtil::Message::End; m_sync = DE_NULL; } m_lock.unlock(); return ok; } class Object : public tcu::ThreadUtil::Object { public: Object (const char* type, SharedPtr
e, SharedPtr
sync); ~Object (void); void readGL (SharedPtr
sync, std::vector
>& deps); void modifyGL (SharedPtr
sync, std::vector
>& deps); private: SharedPtr
m_modifySync; vector
> m_readSyncs; }; Object::Object (const char* type, SharedPtr
e, SharedPtr
sync) : tcu::ThreadUtil::Object (type, e) , m_modifySync (sync) { } Object::~Object (void) { } void Object::readGL (SharedPtr
sync, std::vector
>& deps) { if (m_modifySync) m_modifySync->addWaiter(); // Make call depend on last modifying call deps.push_back(m_modifySync); // Add read dependency m_readSyncs.push_back(sync); } void Object::modifyGL (SharedPtr
sync, std::vector
>& deps) { // Make call depend on all reads for (int readNdx = 0; readNdx < (int)m_readSyncs.size(); readNdx++) { if (m_readSyncs[readNdx]) m_readSyncs[readNdx]->addWaiter(); deps.push_back(m_readSyncs[readNdx]); } if (m_modifySync) m_modifySync->addWaiter(); deps.push_back(m_modifySync); // Update last modifying call m_modifySync = sync; // Clear read dependencies of last "version" of this object m_readSyncs.clear(); } class Operation : public tcu::ThreadUtil::Operation { public: Operation (const char* name, bool useSync, bool serverSync); virtual ~Operation (void); SharedPtr
getSync (void) { return m_sync; } void readGLObject (SharedPtr
object); void modifyGLObject (SharedPtr
object); virtual void execute (tcu::ThreadUtil::Thread& thread); private: bool m_useSync; bool m_serverSync; std::vector
> m_syncDeps; SharedPtr
m_sync; }; Operation::Operation (const char* name, bool useSync, bool serverSync) : tcu::ThreadUtil::Operation (name) , m_useSync (useSync) , m_serverSync (serverSync) , m_sync (useSync ? SharedPtr
(new FenceSync()) : SharedPtr
()) { } Operation::~Operation (void) { } void Operation::readGLObject (SharedPtr
object) { object->read(m_event, m_deps); object->readGL(m_sync, m_syncDeps); } void Operation::modifyGLObject (SharedPtr
object) { object->modify(m_event, m_deps); object->modifyGL(m_sync, m_syncDeps); } void Operation::execute (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); bool success = true; // Wait for dependencies and check that they succeeded for (int depNdx = 0; depNdx < (int)m_deps.size(); depNdx++) { if (!m_deps[depNdx]->waitReady()) success = false; } // Try execute operation if (success) { try { if (m_useSync) { for (int depNdx = 0; depNdx < (int)m_syncDeps.size(); depNdx++) { EGLThread* eglThread = dynamic_cast
(&thread); DE_ASSERT(eglThread); if (m_syncDeps[depNdx]->waitReady(*eglThread) != tcu::ThreadUtil::Event::RESULT_OK) { success = false; break; } } } if (success) { exec(thread); if (m_useSync) { EGLThread* eglThread = dynamic_cast
(&thread); DE_ASSERT(eglThread); m_sync->init(*eglThread, m_serverSync); thread.newMessage() << "Begin -- glFlush()" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, flush()); thread.newMessage() << "End -- glFlush()" << tcu::ThreadUtil::Message::End; } else { thread.newMessage() << "Begin -- glFinish()" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, finish()); thread.newMessage() << "End -- glFinish()" << tcu::ThreadUtil::Message::End; } } } catch (...) { // Got exception event failed m_event->setResult(tcu::ThreadUtil::Event::RESULT_FAILED); throw; } } if (success) m_event->setResult(tcu::ThreadUtil::Event::RESULT_OK); else m_event->setResult(tcu::ThreadUtil::Event::RESULT_FAILED); m_deps.clear(); m_event = SharedPtr
(); m_syncDeps.clear(); m_sync = SharedPtr
(); } class EGLImage : public Object { public: EGLImage (SharedPtr
event, SharedPtr
sync); virtual ~EGLImage (void) {} EGLImageKHR image; }; // EGLResource manager class EGLResourceManager { public: void addContext (SharedPtr
context) { m_contexts.push_back(context); } void addSurface (SharedPtr
surface) { m_surfaces.push_back(surface); } void addImage (SharedPtr
image) { m_images.push_back(image); } SharedPtr
popSurface (int index); SharedPtr
popContext (int index); SharedPtr
popImage (int index); int getContextCount (void) const { return (int)m_contexts.size(); } int getSurfaceCount (void) const { return (int)m_surfaces.size(); } int getImageCount (void) const { return (int)m_images.size(); } private: std::vector
> m_contexts; std::vector
> m_surfaces; std::vector
> m_images; }; SharedPtr
EGLResourceManager::popSurface (int index) { SharedPtr
surface = m_surfaces[index]; m_surfaces.erase(m_surfaces.begin() + index); return surface; } SharedPtr
EGLResourceManager::popContext (int index) { SharedPtr
context = m_contexts[index]; m_contexts.erase(m_contexts.begin() + index); return context; } SharedPtr
EGLResourceManager::popImage (int index) { SharedPtr
image = m_images[index]; m_images.erase(m_images.begin() + index); return image; } class CreateContext : public tcu::ThreadUtil::Operation { public: CreateContext (EGLDisplay display, EGLConfig config, SharedPtr
shared, SharedPtr
& context); void exec (tcu::ThreadUtil::Thread& thread); private: EGLDisplay m_display; EGLConfig m_config; SharedPtr
m_shared; SharedPtr
m_context; }; CreateContext::CreateContext (EGLDisplay display, EGLConfig config, SharedPtr
shared, SharedPtr
& context) : tcu::ThreadUtil::Operation ("CreateContext") , m_display (display) , m_config (config) , m_shared (shared) { if (shared) modifyObject(SharedPtr
(shared)); context = SharedPtr
(new GLES2Context(getEvent(), (shared ? shared->resourceManager : SharedPtr
(new GLES2ResourceManager)))); m_context = context; } void CreateContext::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); m_context->display = m_display; const EGLint attriblist[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; thread.newMessage() << "Begin -- eglBindAPI(EGL_OPENGL_ES_API)" << tcu::ThreadUtil::Message::End; EGLU_CHECK_CALL(thread.egl, bindAPI(EGL_OPENGL_ES_API)); thread.newMessage() << "End -- eglBindAPI()" << tcu::ThreadUtil::Message::End; if (m_shared) { DE_ASSERT(m_shared->context != EGL_NO_CONTEXT); DE_ASSERT(m_shared->display != EGL_NO_DISPLAY); DE_ASSERT(m_shared->display == m_display); thread.newMessage() << "Begin -- eglCreateContext(" << m_display << ", " << m_config << ", " << m_shared->context << ", { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE })" << tcu::ThreadUtil::Message::End; m_context->context = thread.egl.createContext(m_display, m_config, m_shared->context, attriblist); thread.newMessage() << "End -- " << m_context->context << " = eglCreateContext()" << tcu::ThreadUtil::Message::End; } else { thread.newMessage() << "Begin -- eglCreateContext(" << m_display << ", " << m_config << ", EGL_NO_CONTEXT, { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE })" << tcu::ThreadUtil::Message::End; m_context->context = thread.egl.createContext(m_display, m_config, EGL_NO_CONTEXT, attriblist); thread.newMessage() << "End -- " << m_context->context << " = eglCreateContext()" << tcu::ThreadUtil::Message::End; } EGLU_CHECK_MSG(thread.egl, "Failed to create GLES2 context"); TCU_CHECK(m_context->context != EGL_NO_CONTEXT); } class DestroyContext : public tcu::ThreadUtil::Operation { public: DestroyContext (SharedPtr
contex); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_context; }; DestroyContext::DestroyContext (SharedPtr
contex) : tcu::ThreadUtil::Operation ("DestroyContext") , m_context (contex) { modifyObject(SharedPtr
(m_context)); } void DestroyContext::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); thread.newMessage() << "Begin -- eglDestroyContext(" << m_context->display << ", " << m_context->context << ")" << tcu::ThreadUtil::Message::End; EGLU_CHECK_CALL(thread.egl, destroyContext(m_context->display, m_context->context)); thread.newMessage() << "End -- eglDestroyContext()" << tcu::ThreadUtil::Message::End; m_context->display = EGL_NO_DISPLAY; m_context->context = EGL_NO_CONTEXT; } class MakeCurrent : public tcu::ThreadUtil::Operation { public: MakeCurrent (EGLThread& thread, EGLDisplay display, SharedPtr
surface, SharedPtr
context); void exec (tcu::ThreadUtil::Thread& thread); private: EGLDisplay m_display; SharedPtr
m_surface; SharedPtr
m_context; }; MakeCurrent::MakeCurrent (EGLThread& thread, EGLDisplay display, SharedPtr
surface, SharedPtr
context) : tcu::ThreadUtil::Operation ("MakeCurrent") , m_display (display) , m_surface (surface) , m_context (context) { if (m_context) modifyObject(SharedPtr
(m_context)); if (m_surface) modifyObject(SharedPtr
(m_surface)); // Release old contexts if (thread.context) { modifyObject(SharedPtr
(thread.context)); } // Release old surface if (thread.surface) { modifyObject(SharedPtr
(thread.surface)); } thread.context = m_context; thread.surface = m_surface; } void MakeCurrent::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); if (m_context) { thread.eglSurface = m_surface->surface; thread.runtimeContext = m_context; DE_ASSERT(m_surface); thread.newMessage() << "Begin -- eglMakeCurrent(" << m_display << ", " << m_surface->surface << ", " << m_surface->surface << ", " << m_context->context << ")" << tcu::ThreadUtil::Message::End; EGLU_CHECK_CALL(thread.egl, makeCurrent(m_display, m_surface->surface, m_surface->surface, m_context->context)); thread.newMessage() << "End -- eglMakeCurrent()" << tcu::ThreadUtil::Message::End; } else { thread.runtimeContext = m_context; thread.newMessage() << "Begin -- eglMakeCurrent(" << m_display << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << tcu::ThreadUtil::Message::End; EGLU_CHECK_CALL(thread.egl, makeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); thread.newMessage() << "End -- eglMakeCurrent()" << tcu::ThreadUtil::Message::End; } } class InitGLExtension : public tcu::ThreadUtil::Operation { public: InitGLExtension (const char* extension); void exec (tcu::ThreadUtil::Thread& thread); private: std::string m_extension; }; InitGLExtension::InitGLExtension (const char* extension) : tcu::ThreadUtil::Operation ("InitGLExtension") , m_extension (extension) { } void InitGLExtension::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); // Check extensions bool found = false; thread.newMessage() << "Begin -- glGetString(GL_EXTENSIONS)" << tcu::ThreadUtil::Message::End; std::string extensions = (const char*)thread.gl.getString(GL_EXTENSIONS); thread.newMessage() << "End -- glGetString()" << tcu::ThreadUtil::Message::End; std::string::size_type pos = extensions.find(" "); do { std::string extension; if (pos != std::string::npos) { extension = extensions.substr(0, pos); extensions = extensions.substr(pos+1); } else { extension = extensions; extensions = ""; } if (extension == m_extension) { found = true; break; } pos = extensions.find(" "); } while (pos != std::string::npos); if (!found) throw tcu::NotSupportedError((m_extension + " not supported").c_str(), "", __FILE__, __LINE__); // Query function pointers if (m_extension == "GL_OES_EGL_image") { thread.newMessage() << "Begin -- eglGetProcAddress(\"glEGLImageTargetTexture2DOES\")" << tcu::ThreadUtil::Message::End; thread.runtimeContext->glExtensions.imageTargetTexture2D = (glEGLImageTargetTexture2DOESFunc)thread.egl.getProcAddress("glEGLImageTargetTexture2DOES"); thread.newMessage() << "End -- " << ((void*)thread.runtimeContext->glExtensions.imageTargetTexture2D) << " = eglGetProcAddress()"<< tcu::ThreadUtil::Message::End; } } class CreatePBufferSurface : public tcu::ThreadUtil::Operation { public: CreatePBufferSurface (EGLDisplay display, EGLConfig config, EGLint width, EGLint height, SharedPtr
& surface); void exec (tcu::ThreadUtil::Thread& thread); private: EGLDisplay m_display; EGLConfig m_config; EGLint m_width; EGLint m_height; SharedPtr
m_surface; }; CreatePBufferSurface::CreatePBufferSurface (EGLDisplay display, EGLConfig config, EGLint width, EGLint height, SharedPtr
& surface) : tcu::ThreadUtil::Operation ("CreatePBufferSurface") , m_display (display) , m_config (config) , m_width (width) , m_height (height) { surface = SharedPtr
(new Surface(getEvent())); m_surface = surface; } void CreatePBufferSurface::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); const EGLint attriblist[] = { EGL_WIDTH, m_width, EGL_HEIGHT, m_height, EGL_NONE }; thread.newMessage() << "Begin -- eglCreatePbufferSurface(" << m_display << ", " << m_config << ", { EGL_WIDTH, " << m_width << ", EGL_HEIGHT, " << m_height << ", EGL_NONE })" << tcu::ThreadUtil::Message::End; m_surface->surface = thread.egl.createPbufferSurface(m_display, m_config, attriblist); thread.newMessage() << "End -- " << m_surface->surface << "= eglCreatePbufferSurface()" << tcu::ThreadUtil::Message::End; EGLU_CHECK_MSG(thread.egl, "eglCreatePbufferSurface()"); } class DestroySurface : public tcu::ThreadUtil::Operation { public: DestroySurface (EGLDisplay display, SharedPtr
surface); void exec (tcu::ThreadUtil::Thread& thread); private: EGLDisplay m_display; SharedPtr
m_surface; }; DestroySurface::DestroySurface (EGLDisplay display, SharedPtr
surface) : tcu::ThreadUtil::Operation ("DestroySurface") , m_display (display) , m_surface (surface) { modifyObject(SharedPtr
(m_surface)); } void DestroySurface::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); thread.newMessage() << "Begin -- eglDestroySurface(" << m_display << ", " << m_surface->surface << ")" << tcu::ThreadUtil::Message::End; EGLU_CHECK_CALL(thread.egl, destroySurface(m_display, m_surface->surface)); thread.newMessage() << "End -- eglDestroySurface()" << tcu::ThreadUtil::Message::End; } EGLImage::EGLImage (SharedPtr
event, SharedPtr
sync) : Object ("EGLImage", event, sync) , image (EGL_NO_IMAGE_KHR) { } class Texture : public Object { public: Texture (SharedPtr
event, SharedPtr
sync); // Runtime parameters GLuint texture; // Call generation time parameters bool isDefined; SharedPtr
sourceImage; }; Texture::Texture (SharedPtr
event, SharedPtr
sync) : Object ("Texture", event, sync) , texture (0) , isDefined (false) { } class CreateTexture : public Operation { public: CreateTexture (SharedPtr
& texture, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_texture; }; CreateTexture::CreateTexture (SharedPtr
& texture, bool useSync, bool serverSync) : Operation ("CreateTexture", useSync, serverSync) { texture = SharedPtr
(new Texture(getEvent(), getSync())); m_texture = texture; } void CreateTexture::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint tex = 0; thread.newMessage() << "Begin -- glGenTextures(1, { 0 })" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, genTextures(1, &tex)); thread.newMessage() << "End -- glGenTextures(1, { " << tex << " })" << tcu::ThreadUtil::Message::End; m_texture->texture = tex; } class DeleteTexture : public Operation { public: DeleteTexture (SharedPtr
texture, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_texture; }; DeleteTexture::DeleteTexture (SharedPtr
texture, bool useSync, bool serverSync) : Operation ("DeleteTexture", useSync, serverSync) , m_texture (texture) { modifyGLObject(SharedPtr
(m_texture)); } void DeleteTexture::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint tex = m_texture->texture; thread.newMessage() << "Begin -- glDeleteTextures(1, { " << tex << " })" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, deleteTextures(1, &tex)); thread.newMessage() << "End -- glDeleteTextures()" << tcu::ThreadUtil::Message::End; m_texture->texture = 0; } class TexImage2D : public Operation { public: TexImage2D (SharedPtr
texture, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_texture; GLint m_level; GLint m_internalFormat; GLsizei m_width; GLsizei m_height; GLenum m_format; GLenum m_type; }; TexImage2D::TexImage2D (SharedPtr
texture, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, bool useSync, bool serverSync) : Operation ("TexImage2D", useSync, serverSync) , m_texture (texture) , m_level (level) , m_internalFormat (internalFormat) , m_width (width) , m_height (height) , m_format (format) , m_type (type) { modifyGLObject(SharedPtr
(m_texture)); m_texture->isDefined = true; // Orphang texture texture->sourceImage = SharedPtr
(); } void TexImage2D::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); void* dummyData = thread.getDummyData(m_width*m_height*4); thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, " << m_texture->texture << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, m_texture->texture)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glTexImage2D(GL_TEXTURE_2D, " << m_level << ", " << m_internalFormat << ", " << m_width << ", " << m_height << ", 0, " << m_format << ", " << m_type << ", data)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, texImage2D(GL_TEXTURE_2D, m_level, m_internalFormat, m_width, m_height, 0, m_format, m_type, dummyData)); thread.newMessage() << "End -- glTexImage2D()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, 0)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, 0)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; } class TexSubImage2D : public Operation { public: TexSubImage2D (SharedPtr
texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_texture; GLint m_level; GLint m_xoffset; GLint m_yoffset; GLsizei m_width; GLsizei m_height; GLenum m_format; GLenum m_type; }; TexSubImage2D::TexSubImage2D (SharedPtr
texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, bool useSync, bool serverSync) : Operation ("TexSubImage2D", useSync, serverSync) , m_texture (texture) , m_level (level) , m_xoffset (xoffset) , m_yoffset (yoffset) , m_width (width) , m_height (height) , m_format (format) , m_type (type) { modifyGLObject(SharedPtr
(m_texture)); if (m_texture->sourceImage) modifyGLObject(SharedPtr
(m_texture->sourceImage)); } void TexSubImage2D::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); void* dummyData = thread.getDummyData(m_width*m_height*4); thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, " << m_texture->texture << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, m_texture->texture)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glTexSubImage2D(GL_TEXTURE_2D, " << m_level << ", " << m_xoffset << ", " << m_yoffset << ", " << m_width << ", " << m_height << ", 0, " << m_format << ", " << m_type << ",
)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, texSubImage2D(GL_TEXTURE_2D, m_level, m_xoffset, m_yoffset, m_width, m_height, m_format, m_type, dummyData)); thread.newMessage() << "End -- glSubTexImage2D()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, 0)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, 0)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; } class CopyTexImage2D : public Operation { public: CopyTexImage2D (SharedPtr
texture, GLint level, GLint internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_texture; GLint m_level; GLint m_internalFormat; GLint m_x; GLint m_y; GLsizei m_width; GLsizei m_height; GLint m_border; }; CopyTexImage2D::CopyTexImage2D (SharedPtr
texture, GLint level, GLint internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border, bool useSync, bool serverSync) : Operation ("CopyTexImage2D", useSync, serverSync) , m_texture (texture) , m_level (level) , m_internalFormat (internalFormat) , m_x (x) , m_y (y) , m_width (width) , m_height (height) , m_border (border) { modifyGLObject(SharedPtr
(m_texture)); texture->isDefined = true; // Orphang texture texture->sourceImage = SharedPtr
(); } void CopyTexImage2D::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, " << m_texture->texture << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, m_texture->texture)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glCopyTexImage2D(GL_TEXTURE_2D, " << m_level << ", " << m_internalFormat << ", " << m_x << ", " << m_y << ", " << m_width << ", " << m_height << ", " << m_border << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, copyTexImage2D(GL_TEXTURE_2D, m_level, m_internalFormat, m_x, m_y, m_width, m_height, m_border)); thread.newMessage() << "End -- glCopyTexImage2D()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, 0)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, 0)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; } class CopyTexSubImage2D : public Operation { public: CopyTexSubImage2D (SharedPtr
texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_texture; GLint m_level; GLint m_xoffset; GLint m_yoffset; GLint m_x; GLint m_y; GLsizei m_width; GLsizei m_height; }; CopyTexSubImage2D::CopyTexSubImage2D (SharedPtr
texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, bool useSync, bool serverSync) : Operation ("CopyTexSubImage2D", useSync, serverSync) , m_texture (texture) , m_level (level) , m_xoffset (xoffset) , m_yoffset (yoffset) , m_x (x) , m_y (y) , m_width (width) , m_height (height) { modifyGLObject(SharedPtr
(m_texture)); if (m_texture->sourceImage) modifyGLObject(SharedPtr
(m_texture->sourceImage)); } void CopyTexSubImage2D::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, " << m_texture->texture << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, m_texture->texture)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glCopyTexSubImage2D(GL_TEXTURE_2D, " << m_level << ", " << m_xoffset << ", " << m_yoffset << ", " << m_x << ", " << m_y << ", " << m_width << ", " << m_height << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, copyTexSubImage2D(GL_TEXTURE_2D, m_level, m_xoffset, m_yoffset, m_x, m_y, m_width, m_height)); thread.newMessage() << "End -- glCopyTexSubImage2D()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBindTexture(GL_TEXTURE_2D, 0)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindTexture(GL_TEXTURE_2D, 0)); thread.newMessage() << "End -- glBindTexture()" << tcu::ThreadUtil::Message::End; } class Buffer : public Object { public: Buffer (SharedPtr
event, SharedPtr
sync); // Runtime attributes GLuint buffer; GLsizeiptr size; // Call generation time parameters bool isDefined; }; Buffer::Buffer (SharedPtr
event, SharedPtr
sync) : Object ("Buffer", event, sync) , buffer (0) , size (0) , isDefined (false) { } class CreateBuffer : public Operation { public: CreateBuffer (SharedPtr
& buffer, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_buffer; }; CreateBuffer::CreateBuffer (SharedPtr
& buffer, bool useSync, bool serverSync) : Operation ("CreateBuffer", useSync, serverSync) { buffer = SharedPtr
(new Buffer(getEvent(), getSync())); m_buffer = buffer; } void CreateBuffer::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint buffer = 0; thread.newMessage() << "Begin -- glGenBuffers(1, { 0 })" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, genBuffers(1, &buffer)); thread.newMessage() << "End -- glGenBuffers(1, { " << buffer << " })" << tcu::ThreadUtil::Message::End; m_buffer->buffer = buffer; } class DeleteBuffer : public Operation { public: DeleteBuffer (SharedPtr
buffer, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_buffer; }; DeleteBuffer::DeleteBuffer (SharedPtr
buffer, bool useSync, bool serverSync) : Operation ("DeleteBuffer", useSync, serverSync) , m_buffer (buffer) { modifyGLObject(SharedPtr
(m_buffer)); } void DeleteBuffer::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint buffer = m_buffer->buffer; thread.newMessage() << "Begin -- glDeleteBuffers(1, { " << buffer << " })" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, deleteBuffers(1, &buffer)); thread.newMessage() << "End -- glDeleteBuffers()" << tcu::ThreadUtil::Message::End; m_buffer->buffer = 0; } class BufferData : public Operation { public: BufferData (SharedPtr
buffer, GLenum target, GLsizeiptr size, GLenum usage, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_buffer; GLenum m_target; GLsizeiptr m_size; GLenum m_usage; }; BufferData::BufferData (SharedPtr
buffer, GLenum target, GLsizeiptr size, GLenum usage, bool useSync, bool serverSync) : Operation ("BufferData", useSync, serverSync) , m_buffer (buffer) , m_target (target) , m_size (size) , m_usage (usage) { modifyGLObject(SharedPtr
(m_buffer)); buffer->isDefined = true; buffer->size = size; } void BufferData::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); void* dummyData = thread.getDummyData(m_size); thread.newMessage() << "Begin -- glBindBuffer(" << m_target << ", " << m_buffer->buffer << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindBuffer(m_target, m_buffer->buffer)); thread.newMessage() << "End -- glBindBuffer()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBufferData(" << m_target << ", " << m_size << ",
, " << m_usage << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bufferData(m_target, m_size, dummyData, m_usage)); thread.newMessage() << "End -- glBufferData()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBindBuffer(" << m_target << ", 0)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindBuffer(m_target, 0)); thread.newMessage() << "End -- glBindBuffer()" << tcu::ThreadUtil::Message::End; } class BufferSubData : public Operation { public: BufferSubData (SharedPtr
buffer, GLenum target, GLintptr offset, GLsizeiptr size, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_buffer; GLenum m_target; GLintptr m_offset; GLsizeiptr m_size; }; BufferSubData::BufferSubData (SharedPtr
buffer, GLenum target, GLintptr offset, GLsizeiptr size, bool useSync, bool serverSync) : Operation ("BufferSubData", useSync, serverSync) , m_buffer (buffer) , m_target (target) , m_offset (offset) , m_size (size) { modifyGLObject(SharedPtr
(m_buffer)); } void BufferSubData::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); void* dummyData = thread.getDummyData(m_size); thread.newMessage() << "Begin -- glBindBuffer(" << m_target << ", " << m_buffer->buffer << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindBuffer(m_target, m_buffer->buffer)); thread.newMessage() << "End -- glBindBuffer()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBufferSubData(" << m_target << ", " << m_offset << ", " << m_size << ",
)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bufferSubData(m_target, m_offset, m_size, dummyData)); thread.newMessage() << "End -- glBufferSubData()" << tcu::ThreadUtil::Message::End; thread.newMessage() << "Begin -- glBindBuffer(" << m_target << ", 0)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, bindBuffer(m_target, 0)); thread.newMessage() << "End -- glBindBuffer()" << tcu::ThreadUtil::Message::End; } class Shader : public Object { public: Shader (SharedPtr
event, SharedPtr
sync); GLuint shader; GLenum type; bool isDefined; bool compiled; }; Shader::Shader (SharedPtr
event, SharedPtr
sync) : Object ("Shader", event, sync) , shader (0) , type (GL_NONE) , isDefined (false) , compiled (false) { } class CreateShader : public Operation { public: CreateShader (GLenum type, SharedPtr
& shader, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_shader; GLenum m_type; }; CreateShader::CreateShader (GLenum type, SharedPtr
& shader, bool useSync, bool serverSync) : Operation ("CreateShader", useSync, serverSync) , m_type (type) { shader = SharedPtr
(new Shader(getEvent(), getSync())); shader->type = type; m_shader = shader; } void CreateShader::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint shader = 0; thread.newMessage() << "Begin -- glCreateShader(" << m_type << ")" << tcu::ThreadUtil::Message::End; shader = thread.gl.createShader(m_type); GLU_CHECK_GLW_MSG(thread.gl, "glCreateShader()"); thread.newMessage() << "End -- " << shader << " = glCreateShader(" << m_type << ")" << tcu::ThreadUtil::Message::End; m_shader->shader = shader; } class DeleteShader : public Operation { public: DeleteShader (SharedPtr
shader, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_shader; }; DeleteShader::DeleteShader (SharedPtr
shader, bool useSync, bool serverSync) : Operation ("DeleteShader", useSync, serverSync) , m_shader (shader) { modifyGLObject(SharedPtr
(m_shader)); } void DeleteShader::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint shader = m_shader->shader; thread.newMessage() << "Begin -- glDeleteShader(" << shader << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, deleteShader(shader)); thread.newMessage() << "End -- glDeleteShader()" << tcu::ThreadUtil::Message::End; m_shader->shader = 0; } class ShaderSource : public Operation { public: ShaderSource (SharedPtr
sharder, const char* source, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_shader; string m_source; }; ShaderSource::ShaderSource (SharedPtr
shader, const char* source, bool useSync, bool serverSync) : Operation ("ShaderSource", useSync, serverSync) , m_shader (shader) , m_source (source) { modifyGLObject(SharedPtr
(m_shader)); m_shader->isDefined = true; } void ShaderSource::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); const char* shaderSource = m_source.c_str(); thread.newMessage() << "Begin -- glShaderSource(" << m_shader->shader << ", 1, \"" << shaderSource << "\", DE_NULL)" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, shaderSource(m_shader->shader, 1, &shaderSource, DE_NULL)); thread.newMessage() << "End -- glShaderSource()" << tcu::ThreadUtil::Message::End; } class ShaderCompile : public Operation { public: ShaderCompile (SharedPtr
sharder, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_shader; }; ShaderCompile::ShaderCompile (SharedPtr
shader, bool useSync, bool serverSync) : Operation ("ShaderCompile", useSync, serverSync) , m_shader (shader) { m_shader->compiled = true; modifyGLObject(SharedPtr
(m_shader)); } void ShaderCompile::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); thread.newMessage() << "Begin -- glCompileShader(" << m_shader->shader << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, compileShader(m_shader->shader)); thread.newMessage() << "End -- glCompileShader()" << tcu::ThreadUtil::Message::End; } class Program : public Object { public: Program (SharedPtr
event, SharedPtr
sync); // Generation time attributes SharedPtr
vertexShader; SharedPtr
fragmentShader; bool linked; // Runtime attributes GLuint program; GLuint runtimeVertexShader; GLuint runtimeFragmentShader; }; Program::Program (SharedPtr
event, SharedPtr
sync) : Object ("Program", event, sync) , linked (false) , program (0) , runtimeVertexShader (0) , runtimeFragmentShader (0) { } class CreateProgram : public Operation { public: CreateProgram (SharedPtr
& program, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_program; }; CreateProgram::CreateProgram (SharedPtr
& program, bool useSync, bool serverSync) : Operation ("CreateProgram", useSync, serverSync) { program = SharedPtr
(new Program(getEvent(), getSync())); m_program = program; } void CreateProgram::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint program = 0; thread.newMessage() << "Begin -- glCreateProgram()" << tcu::ThreadUtil::Message::End; program = thread.gl.createProgram(); GLU_CHECK_GLW_MSG(thread.gl, "glCreateProgram()"); thread.newMessage() << "End -- " << program << " = glCreateProgram()" << tcu::ThreadUtil::Message::End; m_program->program = program; } class DeleteProgram : public Operation { public: DeleteProgram (SharedPtr
program, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_program; }; DeleteProgram::DeleteProgram (SharedPtr
program, bool useSync, bool serverSync) : Operation ("DeleteProgram", useSync, serverSync) , m_program (program) { modifyGLObject(SharedPtr
(m_program)); } void DeleteProgram::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint program = m_program->program; thread.newMessage() << "Begin -- glDeleteProgram(" << program << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, deleteProgram(program)); thread.newMessage() << "End -- glDeleteProgram()" << tcu::ThreadUtil::Message::End; m_program->program = 0; } class AttachShader : public Operation { public: AttachShader (SharedPtr
sharder, SharedPtr
shader, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_program; SharedPtr
m_shader; }; AttachShader::AttachShader (SharedPtr
program, SharedPtr
shader, bool useSync, bool serverSync) : Operation ("AttachShader", useSync, serverSync) , m_program (program) , m_shader (shader) { modifyGLObject(SharedPtr
(m_program)); readGLObject(SharedPtr
(m_shader)); if (m_shader->type == GL_VERTEX_SHADER) m_program->vertexShader = shader; else if (m_shader->type == GL_FRAGMENT_SHADER) m_program->fragmentShader = shader; else DE_ASSERT(false); } void AttachShader::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); thread.newMessage() << "Begin -- glAttachShader(" << m_program->program << ", " << m_shader->shader << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, attachShader(m_program->program, m_shader->shader)); thread.newMessage() << "End -- glAttachShader()" << tcu::ThreadUtil::Message::End; if (m_shader->type == GL_VERTEX_SHADER) m_program->runtimeVertexShader = m_shader->shader; else if (m_shader->type == GL_FRAGMENT_SHADER) m_program->runtimeFragmentShader = m_shader->shader; else DE_ASSERT(false); } class DetachShader : public Operation { public: DetachShader (SharedPtr
sharder, GLenum type, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_program; GLenum m_type; }; DetachShader::DetachShader (SharedPtr
program, GLenum type, bool useSync, bool serverSync) : Operation ("DetachShader", useSync, serverSync) , m_program (program) , m_type (type) { modifyGLObject(SharedPtr
(m_program)); if (m_type == GL_VERTEX_SHADER) { DE_ASSERT(m_program->vertexShader); m_program->vertexShader = SharedPtr
(); } else if (m_type == GL_FRAGMENT_SHADER) { DE_ASSERT(m_program->fragmentShader); m_program->fragmentShader = SharedPtr
(); } else DE_ASSERT(false); } void DetachShader::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); if (m_type == GL_VERTEX_SHADER) { thread.newMessage() << "Begin -- glDetachShader(" << m_program->program << ", " << m_program->runtimeVertexShader << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, detachShader(m_program->program, m_program->runtimeVertexShader)); thread.newMessage() << "End -- glDetachShader()" << tcu::ThreadUtil::Message::End; m_program->runtimeVertexShader = 0; } else if (m_type == GL_FRAGMENT_SHADER) { thread.newMessage() << "Begin -- glDetachShader(" << m_program->program << ", " << m_program->runtimeFragmentShader << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, detachShader(m_program->program, m_program->runtimeFragmentShader)); thread.newMessage() << "End -- glDetachShader()" << tcu::ThreadUtil::Message::End; m_program->runtimeFragmentShader = 0; } else DE_ASSERT(false); } class LinkProgram : public Operation { public: LinkProgram (SharedPtr
program, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_program; }; LinkProgram::LinkProgram (SharedPtr
program, bool useSync, bool serverSync) : Operation ("LinkProgram", useSync, serverSync) , m_program (program) { modifyGLObject(SharedPtr
(m_program)); program->linked = true; } void LinkProgram::exec (tcu::ThreadUtil::Thread& t) { EGLThread& thread = dynamic_cast
(t); GLuint program = m_program->program; thread.newMessage() << "Begin -- glLinkProgram(" << program << ")" << tcu::ThreadUtil::Message::End; GLU_CHECK_GLW_CALL(thread.gl, linkProgram(program)); thread.newMessage() << "End -- glLinkProgram()" << tcu::ThreadUtil::Message::End; } class RenderBuffer : public Operation { public: RenderBuffer (SharedPtr
program, SharedPtr
buffer, bool useSync, bool serverSync); void exec (tcu::ThreadUtil::Thread& thread); private: SharedPtr
m_program; SharedPtr
m_buffer; }; RenderBuffer::RenderBuffer (SharedPtr