diff options
author | Tom Gall <tom.gall@linaro.org> | 2014-10-01 21:54:38 -0500 |
---|---|---|
committer | Tom Gall <tom.gall@linaro.org> | 2014-10-01 21:54:38 -0500 |
commit | f54d80b7b733e5f6ff7bc912231b8ecdd164752e (patch) | |
tree | ba8424f949c5ca43b69bc1d73962fe806f2ed9be | |
parent | 064b261c03209d154c9a4023b339d0013dc01d35 (diff) |
WIP sync point
Need to figure out how to properly work in OSGLESinit
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | ri/src/linux/riEGLOS.cpp | 19 | ||||
-rw-r--r-- | ri/src/riMiniEGL.cpp | 1 | ||||
-rw-r--r-- | samples/triangle/CMakeLists.txt | 12 | ||||
-rw-r--r-- | samples/triangle/main.c | 16 |
5 files changed, 29 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 814d56f..947442b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,8 +66,8 @@ set(LIB_FPERMS PERMISSIONS WORLD_READ) #set(CMAKE_CXX_FLAGS "-O3 -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -funsafe-math-optimizations -mfloat-abi=hard" CACHE STRING "" FORCE) -# set(CMAKE_CXX_FLAGS "-g -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -funsafe-math-optimizations" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS "-g -O3 -std=c++11 -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -funsafe-math-optimizations" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS "-g -std=c++11 -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -funsafe-math-optimizations" CACHE STRING "" FORCE) +# set(CMAKE_CXX_FLAGS "-g -O3 -std=c++11 -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -funsafe-math-optimizations" CACHE STRING "" FORCE) #set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) #same flags for C sources #LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/src) diff --git a/ri/src/linux/riEGLOS.cpp b/ri/src/linux/riEGLOS.cpp index 9c29d2b..1b46c6b 100644 --- a/ri/src/linux/riEGLOS.cpp +++ b/ri/src/linux/riEGLOS.cpp @@ -167,7 +167,9 @@ static bool isBigEndian() struct OSWindowContext { ESContext *esContext; - UserData *udata; + GLuint programObject; + GLuint vertexShader; + GLuint fragmentShader; EGLNativeWindowType window; unsigned int* tmp; int tmpWidth; @@ -260,8 +262,8 @@ GLuint LoadShader ( GLenum type, const char *shaderSrc ) -int OSGLESinit (ESContext *esContext, UserData *userData) { - +int OSGLESinit (void* v) { +OSWindowContext * ctx = (OSWindowContext *)v; GLbyte vShaderStr[] = "attribute vec4 position; \n" "attribute vec4 inputTextureCoordinate; \n" @@ -332,7 +334,9 @@ GLint linked; glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ); - userData->programObject=programObject; + ctx->programObject = programObject; + ctx->vertexShader = vertexShader; + ctx->fragmentShader = fragmentShader; } @@ -344,12 +348,11 @@ void* OSCreateWindowContext(EGLNativeWindowType window) ctx->esContext = RI_NEW(ESContext, ()); ctx->window = window; - esInitContext( ctx->esContext); - ctx->udata = RI_NEW(UserData, ());; - -/* ctx->tmp = NULL; + ctx->tmp = NULL; ctx->tmpWidth = window->width; ctx->tmpHeight = window->height; +/* + OSGLESinit(ctx); // Open the framebuffer fb for reading and writing ctx->fbfd = open("/dev/fb0", O_RDWR); diff --git a/ri/src/riMiniEGL.cpp b/ri/src/riMiniEGL.cpp index 56927af..3d662f6 100644 --- a/ri/src/riMiniEGL.cpp +++ b/ri/src/riMiniEGL.cpp @@ -55,6 +55,7 @@ void OSDeinitMutex(void); EGLDisplay OSGetDisplay(EGLNativeDisplayType display_id);
void* OSCreateWindowContext(EGLNativeWindowType window);
+int OSGLESinit(void *v);
void OSDestroyWindowContext(void* context);
bool OSIsWindow(const void* context);
void OSGetWindowSize(const void* context, int& width, int& height);
diff --git a/samples/triangle/CMakeLists.txt b/samples/triangle/CMakeLists.txt index 210d8df..46f1a9a 100644 --- a/samples/triangle/CMakeLists.txt +++ b/samples/triangle/CMakeLists.txt @@ -6,7 +6,7 @@ set(EXECUTABLE_NAME ${PROJECT_NAME}) # Linux on ARM #if(MALI_BUILD) -set(DUMMY_MALI_LIBRARIES EGL GLESv2 X11 pthread m MiniEGL gles2-bc OpenVG OpenVGU ) +set(DUMMY_MALI_LIBRARIES MiniEGL EGL GLESv2 X11 pthread m gles2-bc OpenVG OpenVGU ) #set(DUMMY_MALI_LIBRARIES GLESv2 MiniEGL gles2-bc EGL mali OpenVG OpenVGU X11 pthread m ) #else() # set(DUMMY_MALI_LIBRARIES MiniEGL OpenVG OpenVGU) @@ -19,6 +19,8 @@ INCLUDE_DIRECTORIES("./inc") INCLUDE_DIRECTORIES("/usr/local/include") INCLUDE_DIRECTORIES("../Common") +set(CMAKE_C_FLAGS "-g -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -funsafe-math-optimizations" CACHE STRING "" FORCE) + #add_subdirectory(arm) LINK_DIRECTORIES(${DEFAULT_LIB_PATH}) LINK_DIRECTORIES(${MALI_LIB_PATH}) @@ -28,11 +30,11 @@ set(ALL_LIBRARIES ${DUMMY_MALI_LIBRARIES}) set(TRIANGLE_TESTS_SOURCE main.c - ../Common/esShader.c - ../Common/esTransform.c - ../Common/esShapes.c - ../Common/esUtil.c ) +# ../Common/esShader.c +# ../Common/esTransform.c +# ../Common/esShapes.c +# ../Common/esUtil.c add_executable(${EXECUTABLE_NAME} ${TRIANGLE_TESTS_SOURCE}) target_link_libraries(${EXECUTABLE_NAME} ${ALL_LIBRARIES}) diff --git a/samples/triangle/main.c b/samples/triangle/main.c index 1e9508b..e228607 100644 --- a/samples/triangle/main.c +++ b/samples/triangle/main.c @@ -244,15 +244,15 @@ void Background(ESContext *esContext, unsigned int r, unsigned int g, unsigned i void Draw ( ESContext *esContext ) { UserData *userData = esContext->userData; - GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f, - -0.5f, -0.5f, 0.0f, - 0.5f, -0.5f, 0.0f }; +// GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f, +// -0.5f, -0.5f, 0.0f, +// 0.5f, -0.5f, 0.0f }; // Set the viewport - glViewport ( 0, 0, esContext->width, esContext->height ); +// glViewport ( 0, 0, esContext->width, esContext->height ); // Clear the color buffer - glClear ( GL_COLOR_BUFFER_BIT ); +// glClear ( GL_COLOR_BUFFER_BIT ); // Use the program object // glUseProgram ( userData->programObject ); @@ -279,10 +279,10 @@ int main ( int argc, char *argv[] ) esInitContext ( &esContext ); esContext.userData = &userData; - esCreateWindow ( &esContext, "Hello Triangle", 320, 240, ES_WINDOW_RGB ); + esCreateWindow ( &esContext, "Hello Triangle", 640, 480, ES_WINDOW_RGB ); - if ( !Init ( &esContext ) ) - return 0; +// if ( !Init ( &esContext ) ) +// return 0; esRegisterDrawFunc ( &esContext, Draw ); |