This adds 'ut_renderer' - a host side unit test renderer. ut_renderer is used to take a command stream over a socket connection and render it into an opengl window. The renderer uses the GLESv1_dec decoder library and the ut_rendercontrol api to parse the command stream. The ut_renderer uses an external (plug-in) opengl impelementation. Change-Id: I77794044ca9ca8a75a66a95a248eac384710aafe
114 lines
3.9 KiB
C++
114 lines
3.9 KiB
C++
/*
|
|
* Copyright (C) 2011 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.
|
|
*/
|
|
#ifndef _RENDERING_THREAD_H_
|
|
#define _RENDERING_THREAD_H_
|
|
|
|
#include "TcpStream.h"
|
|
#include "GLDecoder.h"
|
|
#include "ut_rendercontrol_dec.h"
|
|
#include <pthread.h>
|
|
|
|
#define GL_API
|
|
#define GL_APIENTRY
|
|
|
|
#include <GLES/egl.h>
|
|
#include <GLES/gl.h>
|
|
|
|
|
|
#define WINDOW_WIDTH 320
|
|
#define WINDOW_HEIGHT 480
|
|
|
|
#define DECODER_BUF_SIZE (4 * 1024 * 1024)
|
|
|
|
class RendererContext;
|
|
|
|
class RenderingThread {
|
|
public:
|
|
RenderingThread(TcpStream *stream);
|
|
int start();
|
|
void *thread();
|
|
RendererContext *currentContext() { return m_currentContext; }
|
|
void setCurrentContext(RendererContext *ctx) { m_currentContext = ctx; }
|
|
GLDecoder & glDecoder() { return m_glDec; }
|
|
private:
|
|
void initBackendCaps();
|
|
|
|
private:
|
|
GLDecoder m_glDec;
|
|
ut_rendercontrol_decoder_context_t m_utDec;
|
|
|
|
TcpStream *m_stream;
|
|
pthread_t m_thread;
|
|
RendererContext * m_currentContext;
|
|
|
|
struct BackendCaps {
|
|
bool initialized;
|
|
GLuint maxTextureUnits;
|
|
} m_backendCaps;
|
|
|
|
static void * s_thread(void *data);
|
|
static __thread RenderingThread *m_tls;
|
|
|
|
static int s_createContext(uint32_t pid, uint32_t handle, uint32_t shareCtx);
|
|
static int s_createSurface(uint32_t pid, uint32_t handle);
|
|
static int s_destroySurface(uint32_t pid, uint32_t handle);
|
|
static int s_destroyContext(uint32_t pid, uint32_t handle);
|
|
static int s_makeCurrent(uint32_t pid, uint32_t drawSurface, uint32_t readSurface, uint32_t ctx);
|
|
static void s_swapBuffers(uint32_t pid, uint32_t surface);
|
|
#ifdef PVR_WAR
|
|
static void s_glTexParameteriv(GLenum target, GLenum param, int *p);
|
|
static void s_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h);
|
|
static void s_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort w, GLshort h);
|
|
static void s_glDrawTexiOES(GLint x, GLint y, GLint z, GLint w, GLint h);
|
|
static void s_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h);
|
|
static void s_glDrawTexfvOES(GLfloat *coords);
|
|
static void s_glDrawTexsvOES(GLshort *coords);
|
|
static void s_glDrawTexivOES(GLint *coords);
|
|
static void s_glDrawTexxvOES(GLfixed *coords);
|
|
|
|
static void s_glActiveTexture(GLenum texture);
|
|
static void s_glBindTexture(GLenum target, GLuint texture);
|
|
static void s_glEnable(GLenum cap);
|
|
static void s_glDisable(GLenum cap);
|
|
static void s_glClientActiveTexture(GLenum texture);
|
|
static void s_glEnableClientState(GLenum cap);
|
|
static void s_glDisableClientState(GLenum cap);
|
|
|
|
void applyPendingCropRects();
|
|
void fixTextureEnable();
|
|
|
|
glTexParameteriv_server_proc_t m_glTexParameteriv;
|
|
glDrawTexfOES_server_proc_t m_glDrawTexfOES;
|
|
glDrawTexiOES_server_proc_t m_glDrawTexiOES;
|
|
glDrawTexsOES_server_proc_t m_glDrawTexsOES;
|
|
glDrawTexxOES_server_proc_t m_glDrawTexxOES;
|
|
glDrawTexfvOES_server_proc_t m_glDrawTexfvOES;
|
|
glDrawTexivOES_server_proc_t m_glDrawTexivOES;
|
|
glDrawTexsvOES_server_proc_t m_glDrawTexsvOES;
|
|
glDrawTexxvOES_server_proc_t m_glDrawTexxvOES;
|
|
glActiveTexture_server_proc_t m_glActiveTexture;
|
|
glBindTexture_server_proc_t m_glBindTexture;
|
|
glEnable_server_proc_t m_glEnable;
|
|
glDisable_server_proc_t m_glDisable;
|
|
glClientActiveTexture_server_proc_t m_glClientActiveTexture;
|
|
glEnableClientState_server_proc_t m_glEnableClientState;
|
|
glDisableClientState_server_proc_t m_glDisableClientState;
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif
|