Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
198 user(s) are online (89 user(s) are browsing Forums)

Members: 1
Guests: 197

FlynnTheAvatar, more...

Support us!

Headlines

 
  Register To Post  

« 1 ... 7 8 9 (10) 11 12 13 ... 43 »
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just can't stay away
Just can't stay away


See User information
@kas1e

Somewhere in the GLES4 source there were prototypes for the wrapper functions (using the identical names but without VARARGS68K APICALL). Have you ruled out them?

I would not blame Cadog yet. Or if you want to debug it, start with Valgrind and Clang sanitizer instead of diving in blindly.

Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Capehill
Quote:

Somewhere in the GLES4 source there were prototypes for the wrapper functions (using the identical names but without VARARGS68K APICALL). Have you ruled out them?


Yep, they all in the agl.c which i at moment didn't build, so libgl4es.a didn't have even that object with those wrapper functions.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just popping in
Just popping in


See User information
@kas1e

Try

struct TagItem tags[] =
{
    {
OGLES2_CCT_WINDOW               , (ULONG)hidden->win},
    {
OGLES2_CCT_DEPTH                , 16                },
    {
OGLES2_CCT_STENCIL              , 8                 },
    {
OGLES2_CCT_VSYNC                , 0                 },
    {
OGLES2_CCT_SINGLE_GET_ERROR_MODE, 1                 },
    {
OGLES2_CCT_RESIZE_VIEWPORT      , TRUE              },
    {
TAG_DONE                                            }
};

hidden->IGL=IOGLES2->aglCreateContext(0, tags);


Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Georg
Yeah, tried it yesterday : it did fix issue for Cadog, but still trashing of memory in another game (letters fall) still present. Its like it just once i use another function for context creation, issue with memory trashing shifts somewhere else.

Visually it look like this (press to open in new tab for fullsize images):

Resized Image

Resized Image

Of course it can be different issue, but as Cadog background disappear with depend on prinfs before context creation, i feel that trahing in the lettersfall game are of the same roots.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just can't stay away
Just can't stay away


See User information
@kas1e

Do you have a smaller OpenGL example which uses succesfully glDrawArrays and GL_TRIANGLE_FANs? If you get consistently this drawing bug I think it's something else.

Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Capehill
Quote:

Do you have a smaller OpenGL example which uses succesfully glDrawArrays and GL_TRIANGLE_FANs?


Some small test cases works.

Tested 4 games so far:

Bloboats : have no problems

Cadog: have no problems, except that this disappeared title background pic if before context creation put some prinfs in the SDL code.

LettersFall : that trashing as show on screenhots above. But to add, Daniel on his setup didn't have that.

Quake3: works fine when it use glbegin/glend code path, but have bugs when use glDrawElements. From ogles2 side there is all ok as Daniel test. And it also seems like memory trahing issue. We made some workaround for it in gl4es , but it's just shift memory trashing somewhere else, but not actually fix anything.

IrrLicht Engine: have the same kind of problems as quake3 have (also use a lot of glDrawElements and glDrawArrays), and also by our workaround shift the trashing somewhere else.


We can think about some particular function being broken or so, but, example with Cadog (and the way how it reacts when there is just before printf ("aaa") or printfs ("aaaa") ; mean that there is 100% memory trahing issue.

I will try for now to remove all the opening of amiga stuff from gl4es, and doint 100% everything from SDL, to see if it will change anything.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just popping in
Just popping in


See User information
@kas1e

Check this context array creation/finding/expanding/shrinking routines in agl.c. This in agl_context_remove() looks suspicious:

while(agl_context_len && !agl_context[agl_context_len].context) --agl_context_len;


If an array contains len items then accessing array[len] is invalid. Even here where array is allocated/reallocated in chunks of multiple of 10 (agl_context_cap) and zeroed. Especially in case len happens to be multiple of 10, because then array[len] points to unallocated memory/chunk (not zeroed).


Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Georg

It should be treated as false, and stop right there.
I think program is understand that if statement agl_context_len is 0 then first part of the statement is false, then there is no point for program and check if second part is also false, and requires bout to be TRUE.

Depending on agl_context_len being a index or the number of items. but i agree this make more sense:

while(agl_context_len && !agl_context[agl_context_len-1].context) agl_context_len--;


(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Georg
Quote:

Check this context array creation/finding/expanding/shrinking routines in agl.c

For now i even didn't use agl.c at all, and those agl_context_remove() in no use. I just open/close ogles2.library / iface from SDL, create context, and only after creating of context do call initialize_gl4es(); (so i do that to avoid any gl4es loading before context creation, in case its gl4es cause trashing at begining).

That how my SDL_os4gl.c currently looks like (which i link against libgl4es.a , without compiled agl.c in it).

/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2006 Sam Lantinga

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Sam Lantinga
    slouken@libsdl.org
*/
/*
 * GL support for AmigaOS 4 using GL4ES->OGLES2
 */

#include "SDL_config.h"

#if SDL_VIDEO_OPENGL

#include "SDL_os4video.h"
#include "SDL_os4utils.h"
#include "SDL_os4blit.h"

#include <proto/exec.h>
#include <proto/intuition.h>

#include <proto/ogles2.h>
#include <GL4ES/gl.h>

#include "../../main/amigaos4/SDL_os4debug.h"

void* aglGetProcAddress(const char *);  // gl4es's aglGetProcAddress
void amiga_pre_swap(); // from gl4es to make working aglSwapBuffers()
void amiga_post_swap(); // from gl4es to make working aglSwapBuffers()
extern void initialize_gl4es(); // initialisation of gl4es.

/*
 * initialize OGLES2 context
 */
 
struct Library *LOGLES2 = 0;  
struct OGLES2IFace *IOGLES2 = 0; 


int os4video_GL_Init(_THIS)
{
    
struct SDL_PrivateVideoData *hidden = _this->hidden;

    
LOGLES2 = IExec->OpenLibrary("ogles2.library", 0);
    if(!
LOGLES2) {
        
printf("LIBGL: Warning, cannot open ogles2 Library!\n");
        return;
    }
    
IOGLES2 = (struct OGLES2IFace *)IExec->GetInterface(LOGLES2, "main", 1, NULL); 
    if(!
IOGLES2) {
        
printf("LIBGL: Warning, cannot openogles2 Interface!\n");
        
IExec->CloseLibrary(LOGLES2);
        
LOGLES2 = NULL;
    }
    
    
dprintf("Initializing GL4ES->OGLES2..\n");    
    
    
hidden->IGL=IOGLES2->aglCreateContextTags(0,
                
OGLES2_CCT_WINDOW,(ULONG)hidden->win,
                
OGLES2_CCT_DEPTH,16,
                
OGLES2_CCT_STENCIL,8,
                
OGLES2_CCT_VSYNC,0,
                
OGLES2_CCT_SINGLE_GET_ERROR_MODE,1,
                
OGLES2_CCT_RESIZE_VIEWPORT, TRUE,
            
TAG_DONE);
    
    
/*
    struct TagItem tags[] = 
    { 
        {OGLES2_CCT_WINDOW               , (ULONG)hidden->win}, 
        {OGLES2_CCT_DEPTH                , 16                }, 
        {OGLES2_CCT_STENCIL              , 8                 }, 
        {OGLES2_CCT_VSYNC                , 0                 }, 
        {OGLES2_CCT_SINGLE_GET_ERROR_MODE, 1                 }, 
        {OGLES2_CCT_RESIZE_VIEWPORT      , TRUE              }, 
        {TAG_DONE                                            } 
    }; 

    hidden->IGL=IOGLES2->aglCreateContext(0, tags);
    */

    
initialize_gl4es();


    if (
hidden->IGL)
    {
        
_this->gl_config.driver_loaded = 1;
    
        
IOGLES2->aglMakeCurrent(hidden->IGL);
        
        
hidden->OpenGL = TRUE;

        return 
0;
    }
    else
    {
        
_this->gl_config.driver_loaded = 0;
        
SDL_SetError("Failed to create OGLES2 context");
    }

    return -
1;

}

void os4video_GL_Term(_THIS)
{
    
struct SDL_PrivateVideoData *hidden = _this->hidden;
    
    
dprintf("Terminate GL4ES->OGLES2..\n");
    
    
IOGLES2->aglDestroyContext(hidden->IGL);
        
    
IExec->DropInterface((struct Interface *)IOGLES2);
    
IExec->CloseLibrary(LOGLES2);

    
_this->gl_config.driver_loaded = 0;

    
hidden->OpenGL = FALSE;
    
}

int    os4video_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
{
   return 
0;
}

int    os4video_GL_MakeCurrent(_THIS)
{
    return 
0;
}

void os4video_GL_SwapBuffers(_THIS)
{
    
amiga_pre_swap();
    
// Swap the Buffers!
    
if(IOGLES2) {
        
IOGLES2->aglSwapBuffers();
    }
    
amiga_post_swap(); 
}


void *os4video_GL_GetProcAddress(_THIS, const char *proc) {
    
void *func = NULL;

    if ( !
_this->gl_config.driver_loaded )
    {
        if (
os4video_GL_Init(_this) != 0)
        {
            return 
NULL;
        }
    }

    
func = (void *)aglGetProcAddress(proc);
    return 
func;
}

int os4video_GL_LoadLibrary(_THIS, const char *path) {
    
/* Library is always open */
    
_this->gl_config.driver_loaded = 1;

    return 
0;
}
#endif


From gl4es side agl.c in no use, only amigaos.c , which for now looks like this:

#include "amigaos.h"

#include <stdlib.h> 
#include <stdio.h>
#include <string.h>
#include <proto/exec.h>
// make sure we don't use inline version here
#undef __USE_INLINE__
#include <proto/ogles2.h>


extern struct Library *LOGLES2; 
extern struct OGLES2IFace *IOGLES2;


// Open OGLES2 library and interface
void os4OpenLib(void** lib)
{
    *
lib = LOGLES2;
}

// Close OGLES2 lib and interface
void os4CloseLib()
{
}

static 
void AmiglActiveTexture (GLenum texture) {
    return 
IOGLES2->glActiveTexture(texture);
}

static 
void AmiglAttachShader (GLuint program, GLuint shader) {
    return 
IOGLES2->glAttachShader(program, shader);
}

static 
void AmiglBindAttribLocation (GLuint program, GLuint index, const GLchar *name) {
    return 
IOGLES2->glBindAttribLocation(program, index, name);
}

static 
void AmiglBindBuffer (GLenum target, GLuint buffer) {
    return 
IOGLES2->glBindBuffer(target, buffer);
}

static 
void AmiglBindFramebuffer (GLenum target, GLuint framebuffer) {
    return 
IOGLES2->glBindFramebuffer(target, framebuffer);
}

static 
void AmiglBindRenderbuffer (GLenum target, GLuint renderbuffer) {
    return 
IOGLES2->glBindRenderbuffer(target, renderbuffer);
}

static 
void AmiglBindTexture (GLenum target, GLuint texture) {
    return 
IOGLES2->glBindTexture(target, texture);
}

static 
void AmiglBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
    return 
IOGLES2->glBlendColor(red, green, blue, alpha);
}

static 
void AmiglBlendEquation (GLenum mode) {
    return 
IOGLES2->glBlendEquation(mode);
}

static 
void AmiglBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) {
    return 
IOGLES2->glBlendEquationSeparate(modeRGB, modeAlpha);
}

static 
void AmiglBlendFunc (GLenum sfactor, GLenum dfactor) {
    return 
IOGLES2->glBlendFunc(sfactor, dfactor);
}

static 
void AmiglBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) {
    return 
IOGLES2->glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
}

static 
void AmiglBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
    return 
IOGLES2->glBufferData(target, size, data, usage);
}

static 
void AmiglBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data) {
    return 
IOGLES2->glBufferSubData(target, offset, size, data);
}

static 
GLenum AmiglCheckFramebufferStatus (GLenum target) {
    return 
IOGLES2->glCheckFramebufferStatus(target);
}

static 
void AmiglClear (GLbitfield mask) {
    return 
IOGLES2->glClear(mask);
}

static 
void AmiglClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
    return 
IOGLES2->glClearColor(red, green, blue, alpha);
}

static 
void AmiglClearDepthf (GLfloat d) {
    return 
IOGLES2->glClearDepthf(d);
}

static 
void AmiglClearStencil (GLint s) {
    return 
IOGLES2->glClearStencil(s);
}

static 
void AmiglColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
    return 
IOGLES2->glColorMask(red, green, blue, alpha);
}

static 
void AmiglCompileShader (GLuint shader) {
    return 
IOGLES2->glCompileShader(shader);
}

static 
void AmiglCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data) {
    return 
IOGLES2->glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
}

static 
void AmiglCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data) {
    return 
IOGLES2->glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
}

static 
void AmiglCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
    return 
IOGLES2->glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

static 
void AmiglCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
    return 
IOGLES2->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}

static 
GLuint AmiglCreateProgram (void) {
    return 
IOGLES2->glCreateProgram();
}

static 
GLuint AmiglCreateShader (GLenum type) {
    return 
IOGLES2->glCreateShader(type);
}

static 
void AmiglCullFace (GLenum mode) {
    return 
IOGLES2->glCullFace(mode);
}

static 
void AmiglDeleteBuffers (GLsizei n, const GLuint *buffers) {
    return 
IOGLES2->glDeleteBuffers(n, buffers);
}

static 
void AmiglDeleteFramebuffers (GLsizei n, const GLuint *framebuffers) {
    return 
IOGLES2->glDeleteFramebuffers(n, framebuffers);
}

static 
void AmiglDeleteProgram (GLuint program) {
    return 
IOGLES2->glDeleteProgram(program);
}

static 
void AmiglDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers) {
    return 
IOGLES2->glDeleteRenderbuffers(n, renderbuffers);
}

static 
void AmiglDeleteShader (GLuint shader) {
    return 
IOGLES2->glDeleteShader(shader);
}

static 
void AmiglDeleteTextures (GLsizei n, const GLuint *textures) {
    return 
IOGLES2->glDeleteTextures(n, textures);
}

static 
void AmiglDepthFunc (GLenum func) {
    return 
IOGLES2->glDepthFunc(func);
}

static 
void AmiglDepthMask (GLboolean flag) {
    return 
IOGLES2->glDepthMask(flag);
}

static 
void AmiglDepthRangef (GLfloat n, GLfloat f) {
    return 
IOGLES2->glDepthRangef(n, f);
}

static 
void AmiglDetachShader (GLuint program, GLuint shader) {
    return 
IOGLES2->glDetachShader(program, shader);
}

static 
void AmiglDisable (GLenum cap) {
    return 
IOGLES2->glDisable(cap);
}

static 
void AmiglDisableVertexAttribArray (GLuint index) {
    return 
IOGLES2->glDisableVertexAttribArray(index);
}

static 
void AmiglDrawArrays (GLenum mode, GLint first, GLsizei count) {
    return 
IOGLES2->glDrawArrays(mode, first, count);
}

static 
void AmiglDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices) {
    return 
IOGLES2->glDrawElements(mode, count, type, indices);
}

static 
void AmiglEnable (GLenum cap) {
    return 
IOGLES2->glEnable(cap);
}

static 
void AmiglEnableVertexAttribArray (GLuint index) {
    return 
IOGLES2->glEnableVertexAttribArray(index);
}

static 
void AmiglFinish (void) {
    return 
IOGLES2->glFinish();
}

static 
void AmiglFlush (void) {
    return 
IOGLES2->glFlush();
}

static 
void AmiglFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
    return 
IOGLES2->glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}

static 
void AmiglFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
    return 
IOGLES2->glFramebufferTexture2D(target, attachment, textarget, texture, level);
}

static 
void AmiglFrontFace (GLenum mode) {
    return 
IOGLES2->glFrontFace(mode);
}

static 
void AmiglGenBuffers (GLsizei n, GLuint *buffers) {
    return 
IOGLES2->glGenBuffers(n, buffers);
}

static 
void AmiglGenerateMipmap (GLenum target) {
    return 
IOGLES2->glGenerateMipmap(target);
}

static 
void AmiglGenFramebuffers (GLsizei n, GLuint *framebuffers) {
    return 
IOGLES2->glGenFramebuffers(n, framebuffers);
}

static 
void AmiglGenRenderbuffers (GLsizei n, GLuint *renderbuffers) {
    return 
IOGLES2->glGenRenderbuffers(n, renderbuffers);
}

static 
void AmiglGenTextures (GLsizei n, GLuint *textures) {
    return 
IOGLES2->glGenTextures(n, textures);
}

static 
void AmiglGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) {
    return 
IOGLES2->glGetActiveAttrib(program, index, bufSize, length, size, type, name);
}

static 
void AmiglGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) {
    return 
IOGLES2->glGetActiveUniform(program,  index, bufSize, length, size, type, name);
}

static 
void AmiglGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders) {
    return 
IOGLES2->glGetAttachedShaders(program, maxCount, count, shaders);
}

static 
GLint AmiglGetAttribLocation (GLuint program, const GLchar *name) {
    return 
IOGLES2->glGetAttribLocation(program, name);
}

static 
void AmiglGetBooleanv (GLenum pname, GLboolean *data) {
    return 
IOGLES2->glGetBooleanv(pname, data);
}

static 
void AmiglGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetBufferParameteriv(target, pname, params);
}

static 
GLenum AmiglGetError (void) {
    return 
IOGLES2->glGetError();
}

static 
void AmiglGetFloatv (GLenum pname, GLfloat *data) {
    return 
IOGLES2->glGetFloatv(pname, data);
}

static 
void AmiglGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
}

static 
void AmiglGetIntegerv (GLenum pname, GLint *data) {
    return 
IOGLES2->glGetIntegerv(pname, data);
}

static 
void AmiglGetProgramiv (GLuint program, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetProgramiv(program, pname, params);
}

static 
void AmiglGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) {
    return 
IOGLES2->glGetProgramInfoLog(program, bufSize, length, infoLog);
}

static 
void AmiglGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetRenderbufferParameteriv(target, pname, params);
}

static 
void AmiglGetShaderiv (GLuint shader, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetShaderiv(shader, pname, params);
}

static 
void AmiglGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) {
    return 
IOGLES2->glGetShaderInfoLog(shader, bufSize, length, infoLog);
}

static 
void AmiglGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision) {
    return 
IOGLES2->glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
}

static 
void AmiglGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) {
    return 
IOGLES2->glGetShaderSource(shader, bufSize, length, source);
}

static const 
GLubyte *AmiglGetString (GLenum name) {
    return 
IOGLES2->glGetString(name);
}

static 
void AmiglGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params) {
    return 
IOGLES2->glGetTexParameterfv(target, pname, params);
}

static 
void AmiglGetTexParameteriv (GLenum target, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetTexParameteriv(target, pname, params);
}

static 
void AmiglGetUniformfv (GLuint program, GLint location, GLfloat *params) {
    return 
IOGLES2->glGetUniformfv(program, location, params);
}

static 
void AmiglGetUniformiv (GLuint program, GLint location, GLint *params) {
    return 
IOGLES2->glGetUniformiv(program, location, params);
}

static 
GLint AmiglGetUniformLocation (GLuint program, const GLchar *name) {
    return 
IOGLES2->glGetUniformLocation(program, name);
}

static 
void AmiglGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params) {
    return 
IOGLES2->glGetVertexAttribfv(index, pname, params);
}

static 
void AmiglGetVertexAttribiv (GLuint index, GLenum pname, GLint *params) {
    return 
IOGLES2->glGetVertexAttribiv(index, pname, params);
}

static 
void AmiglGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer) {
    return 
IOGLES2->glGetVertexAttribPointerv(index, pname, pointer);
}

static 
void AmiglHint (GLenum target, GLenum mode) {
    return 
IOGLES2->glHint(target, mode);
}

static 
GLboolean AmiglIsBuffer (GLuint buffer) {
    return 
IOGLES2->glIsBuffer(buffer);
}

static 
GLboolean AmiglIsEnabled (GLenum cap) {
    return 
IOGLES2->glIsEnabled(cap);
}

static 
GLboolean AmiglIsFramebuffer (GLuint framebuffer) {
    return 
IOGLES2->glIsFramebuffer(framebuffer);
}

static 
GLboolean AmiglIsProgram (GLuint program) {
    return 
IOGLES2->glIsProgram(program);
}

static 
GLboolean AmiglIsRenderbuffer (GLuint renderbuffer) {
    return 
IOGLES2->glIsRenderbuffer(renderbuffer);
}

static 
GLboolean AmiglIsShader (GLuint shader) {
    return 
IOGLES2->glIsShader(shader);
}

static 
GLboolean AmiglIsTexture (GLuint texture) {
    return 
IOGLES2->glIsTexture(texture);
}

static 
void AmiglLineWidth (GLfloat width) {
    return 
IOGLES2->glLineWidth(width);
}

static 
void AmiglLinkProgram (GLuint program) {
    return 
IOGLES2->glLinkProgram(program);
}

static 
void AmiglPixelStorei (GLenum pname, GLint param) {
    return 
IOGLES2->glPixelStorei(pname, param);
}

static 
void AmiglPolygonOffset (GLfloat factor, GLfloat units) {
    return 
IOGLES2->glPolygonOffset(factor, units);
}

static 
void AmiglReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) {
    return 
IOGLES2->glReadPixels(x, y, width, height, format, type, pixels);
}

static 
void AmiglReleaseShaderCompiler (void) {
    return 
IOGLES2->glReleaseShaderCompiler();
}

static 
void AmiglRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
    return 
IOGLES2->glRenderbufferStorage(target, internalformat, width, height);
}

static 
void AmiglSampleCoverage (GLfloat value, GLboolean invert) {
    return 
IOGLES2->glSampleCoverage(value, invert);
}

static 
void AmiglScissor (GLint x, GLint y, GLsizei width, GLsizei height) {
    return 
IOGLES2->glScissor(x, y, width, height);
}

static 
void AmiglShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length) {
    return 
IOGLES2->glShaderBinary(count, shaders, binaryformat, binary, length);
}

static 
void AmiglShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length) {
    return 
IOGLES2->glShaderSource(shader, count, string, length);
}

static 
void AmiglStencilFunc (GLenum func, GLint ref, GLuint mask) {
    return 
IOGLES2->glStencilFunc(func, ref, mask);
}

static 
void AmiglStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) {
    return 
IOGLES2->glStencilFuncSeparate(face, func, ref, mask);
}

static 
void AmiglStencilMask (GLuint mask) {
    return 
IOGLES2->glStencilMask(mask);
}

static 
void AmiglStencilMaskSeparate (GLenum face, GLuint mask) {
    return 
IOGLES2->glStencilMaskSeparate(face, mask);
}

static 
void AmiglStencilOp (GLenum fail, GLenum zfail, GLenum zpass) {
    return 
IOGLES2->glStencilOp(fail, zfail, zpass);
}

static 
void AmiglStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) {
    return 
IOGLES2->glStencilOpSeparate(face, sfail, dpfail, dppass);
}

static 
void AmiglTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) {
    return 
IOGLES2->glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}

static 
void AmiglTexParameterf (GLenum target, GLenum pname, GLfloat param) {
    return 
IOGLES2->glTexParameterf(target, pname, param);
}

static 
void AmiglTexParameterfv (GLenum target, GLenum pname, const GLfloat *params) {
    return 
IOGLES2->glTexParameterfv(target, pname, params);
}

static 
void AmiglTexParameteri (GLenum target, GLenum pname, GLint param) {
    return 
IOGLES2->glTexParameteri(target, pname, param);
}

static 
void AmiglTexParameteriv (GLenum target, GLenum pname, const GLint *params) {
    return 
IOGLES2->glTexParameteriv(target, pname, params);
}

static 
void AmiglTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) {
    return 
IOGLES2->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
}

static 
void AmiglUniform1f (GLint location, GLfloat v0) {
    return 
IOGLES2->glUniform1f(location, v0);
}

static 
void AmiglUniform1fv (GLint location, GLsizei count, const GLfloat *value) {
    return 
IOGLES2->glUniform1fv(location, count, value);
}

static 
void AmiglUniform1i (GLint location, GLint v0) {
    return 
IOGLES2->glUniform1i(location, v0);
}

static 
void AmiglUniform1iv (GLint location, GLsizei count, const GLint *value) {
    return 
IOGLES2->glUniform1iv(location, count, value);
}

static 
void AmiglUniform2f (GLint location, GLfloat v0, GLfloat v1) {
    return 
IOGLES2->glUniform2f(location, v0, v1);
}

static 
void AmiglUniform2fv (GLint location, GLsizei count, const GLfloat *value) {
    return 
IOGLES2->glUniform2fv(location, count, value);
}

static 
void AmiglUniform2i (GLint location, GLint v0, GLint v1) {
    return 
IOGLES2->glUniform2i(location, v0, v1);
}

static 
void AmiglUniform2iv (GLint location, GLsizei count, const GLint *value) {
    return 
IOGLES2->glUniform2iv(location, count, value);
}

static 
void AmiglUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
    return 
IOGLES2->glUniform3f(location, v0, v1, v2);
}

static 
void AmiglUniform3fv (GLint location, GLsizei count, const GLfloat *value) {
    return 
IOGLES2->glUniform3fv(location, count, value);
}

static 
void AmiglUniform3i (GLint location, GLint v0, GLint v1, GLint v2) {
    return 
IOGLES2->glUniform3i(location, v0, v1, v2);
}

static 
void AmiglUniform3iv (GLint location, GLsizei count, const GLint *value) {
    return 
IOGLES2->glUniform3iv(location, count, value);
}

static 
void AmiglUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) {
    return 
IOGLES2->glUniform4f(location, v0, v1, v2, v3);
}

static 
void AmiglUniform4fv (GLint location, GLsizei count, const GLfloat *value) {
    return 
IOGLES2->glUniform4fv(location, count, value);
}

static 
void AmiglUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) {
    return 
IOGLES2->glUniform4i(location, v0, v1, v2, v3);
}

static 
void AmiglUniform4iv (GLint location, GLsizei count, const GLint *value) {
    return 
IOGLES2->glUniform4iv(location, count, value);
}

static 
void AmiglUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
    return 
IOGLES2->glUniformMatrix2fv(location, count, transpose, value);
}

static 
void AmiglUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
    return 
IOGLES2->glUniformMatrix3fv(location, count, transpose, value);
}

static 
void AmiglUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
    return 
IOGLES2->glUniformMatrix4fv(location, count, transpose, value);
}

static 
void AmiglUseProgram (GLuint program) {
    return 
IOGLES2->glUseProgram(program);
}

static 
void AmiglValidateProgram (GLuint program) {
    return 
IOGLES2->glValidateProgram(program);
}

static 
void AmiglVertexAttrib1f (GLuint index, GLfloat x) {
    return 
IOGLES2->glVertexAttrib1f(index, x);
}

static 
void AmiglVertexAttrib1fv (GLuint index, const GLfloat *v) {
    return 
IOGLES2->glVertexAttrib1fv(index, v);
}

static 
void AmiglVertexAttrib2f (GLuint index, GLfloat x, GLfloat y) {
    return 
IOGLES2->glVertexAttrib2f(index, x, y);
}

static 
void AmiglVertexAttrib2fv (GLuint index, const GLfloat *v) {
    return 
IOGLES2->glVertexAttrib2fv(index, v);
}

static 
void AmiglVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z) {
    return 
IOGLES2->glVertexAttrib3f(index, x, y, z);
}

static 
void AmiglVertexAttrib3fv (GLuint index, const GLfloat *v) {
    return 
IOGLES2->glVertexAttrib3fv(index, v);
}

static 
void AmiglVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
    return 
IOGLES2->glVertexAttrib4f(index, x, y, z, w);
}

static 
void AmiglVertexAttrib4fv (GLuint index, const GLfloat *v) {
    return 
IOGLES2->glVertexAttrib4fv(index, v);
}

static 
void AmiglVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) {
    return 
IOGLES2->glVertexAttribPointer(index, size, type, normalized, stride, pointer);
}

static 
void AmiglViewport (GLint x, GLint y, GLsizei width, GLsizei height) {
    return 
IOGLES2->glViewport(x, y, width, height);
}

// Using glXXX name, return the function pointer of that function in ogles2 library
#define MAP(func_name, func) \
    
if (strcmp(name, func_name) == 0) return (void *)Ami##func;

#define EX(func_name) MAP(#func_name, func_name)

void* os4GetProcAddress(const char* name)
{
    if(!
IOGLES2)
        return 
NULL;
    
// All GL functions from OGLES2 drivers
    
EX(glActiveTexture)
    
EX(glAttachShader)
    
EX(glBindAttribLocation)
    
EX(glBindBuffer)
    
EX(glBindFramebuffer)
    
EX(glBindRenderbuffer)
    
EX(glBindTexture)
    
EX(glBlendColor)
    
EX(glBlendEquation)
    
EX(glBlendEquationSeparate)
    
EX(glBlendFunc)
    
EX(glBlendFuncSeparate)
    
EX(glBufferData)
    
EX(glBufferSubData)
    
EX(glCheckFramebufferStatus)
    
EX(glClear)
    
EX(glClearColor)
    
EX(glClearDepthf)
    
EX(glClearStencil)
    
EX(glColorMask)
    
EX(glCompileShader)
    
EX(glCompressedTexImage2D)
    
EX(glCompressedTexSubImage2D)
    
EX(glCopyTexImage2D)
    
EX(glCopyTexSubImage2D)
    
EX(glCreateProgram)
    
EX(glCreateShader)
    
EX(glCullFace)
    
EX(glDeleteBuffers)
    
EX(glDeleteFramebuffers)
    
EX(glDeleteProgram)
    
EX(glDeleteRenderbuffers)
    
EX(glDeleteShader)
    
EX(glDeleteTextures)
    
EX(glDepthFunc)
    
EX(glDepthMask)
    
EX(glDepthRangef)
    
EX(glDetachShader)
    
EX(glDisable)
    
EX(glDisableVertexAttribArray)
    
EX(glDrawArrays)
    
EX(glDrawElements)
    
EX(glEnable)
    
EX(glEnableVertexAttribArray)
    
EX(glFinish)
    
EX(glFlush)
    
EX(glFramebufferRenderbuffer)
    
EX(glFramebufferTexture2D)
    
EX(glFrontFace)
    
EX(glGenBuffers)
    
EX(glGenerateMipmap)
    
EX(glGenFramebuffers)
    
EX(glGenRenderbuffers)
    
EX(glGenTextures)
    
EX(glGetActiveAttrib)
    
EX(glGetActiveUniform)
    
EX(glGetAttachedShaders)
    
EX(glGetAttribLocation)
    
EX(glGetBooleanv)
    
EX(glGetBufferParameteriv)
    
EX(glGetError)
    
EX(glGetFloatv)
    
EX(glGetFramebufferAttachmentParameteriv)
    
EX(glGetIntegerv)
    
EX(glGetProgramiv)
    
EX(glGetProgramInfoLog)
    
EX(glGetRenderbufferParameteriv)
    
EX(glGetShaderiv)
    
EX(glGetShaderInfoLog)
    
EX(glGetShaderPrecisionFormat)
    
EX(glGetShaderSource)
    
EX(glGetString)
    
EX(glGetTexParameterfv)
    
EX(glGetTexParameteriv)
    
EX(glGetUniformfv)
    
EX(glGetUniformiv)
    
EX(glGetUniformLocation)
    
EX(glGetVertexAttribfv)
    
EX(glGetVertexAttribiv)
    
EX(glGetVertexAttribPointerv)
    
EX(glHint)
    
EX(glIsBuffer)
    
EX(glIsEnabled)
    
EX(glIsFramebuffer)
    
EX(glIsProgram)
    
EX(glIsRenderbuffer)
    
EX(glIsShader)
    
EX(glIsTexture)
    
EX(glLineWidth)
    
EX(glLinkProgram)
    
EX(glPixelStorei)
    
EX(glPolygonOffset)
    
EX(glReadPixels)
    
EX(glReleaseShaderCompiler)
    
EX(glRenderbufferStorage)
    
EX(glSampleCoverage)
    
EX(glScissor)
    
EX(glShaderBinary)
    
EX(glShaderSource)
    
EX(glStencilFunc)
    
EX(glStencilFuncSeparate)
    
EX(glStencilMask)
    
EX(glStencilMaskSeparate)
    
EX(glStencilOp)
    
EX(glStencilOpSeparate)
    
EX(glTexImage2D)
    
EX(glTexParameterf)
    
EX(glTexParameterfv)
    
EX(glTexParameteri)
    
EX(glTexParameteriv)
    
EX(glTexSubImage2D)
    
EX(glUniform1f)
    
EX(glUniform1fv)
    
EX(glUniform1i)
    
EX(glUniform1iv)
    
EX(glUniform2f)
    
EX(glUniform2fv)
    
EX(glUniform2i)
    
EX(glUniform2iv)
    
EX(glUniform3f)
    
EX(glUniform3fv)
    
EX(glUniform3i)
    
EX(glUniform3iv)
    
EX(glUniform4f)
    
EX(glUniform4fv)
    
EX(glUniform4i)
    
EX(glUniform4iv)
    
EX(glUniformMatrix2fv)
    
EX(glUniformMatrix3fv)
    
EX(glUniformMatrix4fv)
    
EX(glUseProgram)
    
EX(glValidateProgram)
    
EX(glVertexAttrib1f)
    
EX(glVertexAttrib1fv)
    
EX(glVertexAttrib2f)
    
EX(glVertexAttrib2fv)
    
EX(glVertexAttrib3f)
    
EX(glVertexAttrib3fv)
    
EX(glVertexAttrib4f)
    
EX(glVertexAttrib4fv)
    
EX(glVertexAttribPointer)
    
EX(glViewport)
    
//EX(glPolygonMode) //This is a non-standard function, and gl4es will ignore it (and emulate it), even if Amiga OGLES2 driver implement it

    
return NULL;
}


So, after that little reorganization, cadog issue with title pic, always there, and does not matter if i use dprintf or will just use some tiny 1 byte's pritnf("a"); (probably trashed memory shifts as i do open library / iface before context now).

But replacing IOGLES2->aglCreateContextTags() on IOGLES2->aglCreateContext(), make issue disappear (which again mean nothing , but only that issue with trashed memory shifts differently).

Now question is, WTF ! :) gl4es guy say that he offten check gl4es with Valgrind, so he sure there hould't be trashing coming from gl4es. SDL1 to blame ? But i remember i build quake3 without usage of SDL at all, just taken some pure MiniGL version and replaced it on GL4ES one, and have same issues as with SDL/MiniGL version.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just can't stay away
Just can't stay away


See User information
@kas1e

I doubt he has checked any Amiga-specific code with Valgrind.

Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just popping in
Just popping in


See User information
@kas1e

I would not rule out other kind of error (= not necessarily memory trash). Maybe the vararg function call simply goes wrong, like some header trouble causing VARARGS68K being defined to nothing and then the aglCreateContextTags() goes wrong, ie. it no longer pushes all args on the stack, instead some in registers, some on stack, like in a normal (non VARARGS68K) vararg call.

Look at generated compiler output (gcc -S). Add some dummy function which does the call and nothing else. So it's easier to read the asm (PPC asm is bad enough to read already):

int dummydebugfunc(void)
{
    return (int)
IOGLES2->aglCreateContextTags(0,
                
OGLES2_CCT_WINDOW,0x12345678,
                
OGLES2_CCT_DEPTH,16,
                
OGLES2_CCT_STENCIL,8,
                
OGLES2_CCT_VSYNC,0,
                
OGLES2_CCT_SINGLE_GET_ERROR_MODE,1,
                
OGLES2_CCT_RESIZE_VIEWPORT, TRUE,
            
TAG_DONE);
}



Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Capehill
Quote:

I doubt he has checked any Amiga-specific code with Valgrind.

Sure he didn't, but he about Gl4ES, which he think can't be cause of memory trashing, as he check it with valgrind.

In other words, he mean that we can rule out gl4es itself from being guilty for memory trashing, and so we leave with SDL1 (+ my intergration of gl4es in), ogles2 and warp3dnova.

@Georg

There is output:

.section    ".text"
.Ltext0:
    .
align 2
    
.globl dummydebugfunc
    
.type    dummydebugfunc, @function
dummydebugfunc:
.
LFB376:
    .
file 1 "src/video/amigaos4/SDL_os4gl.c"
    
.loc 1 43 0
    stwu 
%r1,-64(%r1)
.
LCFI0:
    .
loc 1 44 0
    lis 
%r11,0x1234
    
.loc 1 43 0
    mflr 
%r0
.LCFI1:
    .
loc 1 44 0
    li 
%r9,0
    ori 
%r11,%r11,22136
    li 
%r4,0
    stw 
%r11,12(%r1)
    
li %r11,3
    stw 
%r11,16(%r1)
    
li %r11,16
    stw 
%r11,20(%r1)
    
li %r11,4
    stw 
%r11,24(%r1)
    
li %r11,8
    stw 
%r11,28(%r1)
    
li %r11,5
    stw 
%r11,32(%r1)
    
li %r11,6
    
.loc 1 43 0
    stw 
%r0,68(%r1)
.
LCFI2:
    .
loc 1 44 0
    li 
%r0,1
    stw 
%r11,40(%r1)
    
li %r11,12
    stw 
%r9,56(%r1)
    
stw %r9,36(%r1)
    
lis %r9,IOGLES2@ha
    stw 
%r11,48(%r1)
    
stw %r0,52(%r1)
    
stw %r0,8(%r1)
    
stw %r0,44(%r1)
    
lwz %r9,IOGLES2@l(%r9)
    
lwz %r0,80(%r9)
    
mr %r3,%r9
    mtctr 
%r0
    bctrl
    
.loc 1 52 0
    lwz 
%r0,68(%r1)
    
addi %r1,%r1,64
    mtlr 
%r0
    blr
.LFE376:
    .
size    dummydebugfunc, .-dummydebugfunc


Should to add , that when i play with the settings of context, i.e., for example comment out OGLES2_CCT_STENCIL,8, and OGLES2_CCT_VSYNC,0, and made OGLES2_CCT_DEPTH not 16 , but 32, then background picture in Cadog back.


Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just popping in
Just popping in


See User information
@kas1e

That asm is really hard to read for me. Do I see this correctly that tags are #defined (I don't have headers)
to

OGLES2_CCT_WINDOW = 1
OGLES2_CCT_DEPTH 
= 3


Normally tags need to be >= TAG_USER (0x80000000 + something). Does OGLES2 parse tags manually. Because otherwise there is conflict, because TAG_IGNORE = 3, and TAG_SKIP = 1, so such a taglist would be broken when used with normal tag parsing functions like NextTagItem().

I noticed

#undef __USE_INLINE__


Does other OGLES test programs/demos/games/whatever work if they do this too and they are at the same time using vararg functions like aglCreateContextTags(). Because when USE_INLINE is active the IOGLES2->aglCreateContextTags() probably never gets called as the inlines likely map it to IOGLES2->aglCreateContext().

So it could be that IOGLES2->aglCreateContextTags() itself is broken inside IOGLES2.


Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Georg
There is ogles2 includes: http://kas1e.mikendezign.com/aos4/gl4es/gles2_os4_includes.zip

See there in ogles2/ogles2_defs.h at top enum for tags.

Quote:

Does other OGLES test programs/demos/games/whatever work if they do this too and they are at the same time using vararg functions like aglCreateContextTags().


Never tried to be honest.

But , still, that we talk about Cadog issue only, while, if i just use pure aglCreateContext() (without Tags at end). This fix issue with Cadog, but didn't fix issues with trashed textures in the LettersFall game.

That of course can be just 2 different issues, through..

Quote:

probably never gets called as the inlines likely map it to IOGLES2->aglCreateContext().


At least in inlines of ogles2, i see that :

Quote:

#define aglCreateContext(errcode, tags) IOGLES2->aglCreateContext((errcode), (tags))
#define aglCreateContextTags(errcode, ...) IOGLES2->aglCreateContextTags((errcode), __VA_ARGS__)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Georg
After checking more about: #undef __USE_INLINE__ used only in gl4es's amigaos.c / agl.c files, just so he sure that we don't use inline version here (he do so before when he use wrapper functinos with the same names, so to avoid conflicts just in case).

Now i don't use agl.c , only amigaos.c , and as it part of GL4ES, it builds separately from SDL (from where i do context creation), it builds when i build libgl4es.a. What mean, that it can't be related, as well as gcc -S on SDL file where i create ogles2 context, will show nothing wrong , as undef is only for amigaos.c which is in libgl4es.a.

At moment i trying to short as possible Cadog game by cutting off all the game's code , so to just keep loading of texture and showing menu. At moment cut off levels, music/sound loading (so on linking stage no more links with music/sound libs), and bug still there. Hope to reduce it to very minimum and bug still will be there, then it will be much easer to find out what wrong.


Edited by kas1e on 2018/3/19 11:51:54
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
Was able to cut off from cadog as much as possible, i.e. pure loading of necessary stuff and ability to choice exit from. No music, no sounds, no leveles, no game, just first title pic, and ability to choice exit from game.

Now, when i step by step reduce code of game, bug was the same always : i.e. i just replace aglCreateContextTags() with aglCreateContext() and all works. Then, at some point when i remove quite a lot, background picture was ok in both cases, and with aglCreateContextTags(), and with aglCreateContext(), but then, i add some "printf" before aglCreateContextTags(), and bug appears again. Once a put aglCreateContext() in use, with the same printf, then all fine.

And in code which keept at moment in Cadog, even no single glDraw... function is used. Just some crap like:

glBegin(GL_QUADS);
glTexCoord2f(0,0); glVertex3f(x,y,z);
glEnd;

and co.


Dunno where to look next. Maybe trying to get rid of SDL and open ogles2 / create context / initialize gl4es from game's code itself, but then if bug will just disappear, and can't be triggered again that will mean nothing. As it now at least it reproducable (sort of).

I even can't understand what kind of bug it can be, as it all looks like depends of how big/small sections of code/data, and how they shifted, or how and where data placed. Like not like just usuall memmory trashing

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Not too shy to talk
Not too shy to talk


See User information
@Georg
Quote:
Normally tags need to be >= TAG_USER (0x80000000 + something). Does OGLES2 parse tags manually.

Nice great stupidity by me indeed
But yes, I do parse those manually so as long as you only use the tags that are defined by ogles2.lib everything is good (and if you don't "comply" here then the context will not be created as you configured it (or maybe in worst case simply crash there), no matter if you use the vararg or the struct-ptr variant, which internally boil down to execute the same code). I just fixed it for the next lib release. Thanks for noting!

@kas1e
Please upload your minimal test examples (like Cadog stripped down) to my FTP. The less complex a test prog is the better.
Also note that the beforementioned fixed ogles2.lib 1.20 wip-version (also containing some other new features) is on the FTP too.


Edited by Daytona675x on 2018/3/20 6:17:24
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Just popping in
Just popping in


See User information
@kas1e

Quote:

I even can't understand what kind of bug it can be


Apart from mem trashes it could be things like compiler generating wrong code. Where sometimes it may not be even 100 % compiler fault, like with this strict aliasing stuff where it could be more a fault in the sources. Ever tried compiling with -O0 and or things like -fno-strict-aliasing? Maybe have once a gain a look at disassembled function which calls aglCreateContextTags() (the real function, not the dummy one, because it can be that correct code is generated for dummy one, but not real one which does more things incl. dprintf etc.).

Or it could be inside OGLES2's aglCreateContextTags() which must ~extract/~cast/~convert the "..." correctly to a struct TagItem* before passing it on to aglCreateContext(). On the various OSes/cpus and versions of it and it's compilers there are different methods (&lastparam +1, va_start() + co., va_startlinear() + co.,)


Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Home away from home
Home away from home


See User information
@Daniel
Quote:

Please upload your minimal test examples (like Cadog stripped down) to my FTP. The less complex a test prog is the better.


Uploaded reports_here/cadog_test.lha. Inside 2 binaries, one with debugprintf before aglcreatecontexttags, and another without debugprinfs before aglcreatecontexttags.

There after running you can navigate to "exit" and exit from, all other stuff removed (most of it).

Run bins like this "bin_name -w - s 640x480". That one without debugprinfs before contexttags, should show background picture, another one, with debugprinfs before contexttags, show white background.

Through when you first time run "no debug printf" one, it also may not show background, but if you run it second time, it will (which all point on those random issues).

Quote:

Also note that the beforementioned fixed ogles2.lib 1.20 wip-version (also containing some other new features) is on the FTP too.


Yeah, will test it all now with all the games.

@Georg
Quote:

Or it could be inside OGLES2's aglCreateContextTags() which must ~extract/~cast/~convert the "..." correctly to a struct TagItem* before passing it on to aglCreateContext(). On the various OSes/cpus and versions of it and it's compilers there are different methods (&lastparam +1, va_start() + co., va_startlinear() + co.,)


But then, pure aglCreateContext() should works fine. While with Cadog it is , memory trashing in LettersFall game still here.

But i will recheck with latest Daniel's ogles2.library with all those new createcontext functions, to see how it will behave now.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
Not too shy to talk
Not too shy to talk


See User information
@kas1e
Quote:
But i will recheck with latest Daniel's ogles2.library with all those new createcontext functions, to see how it will behave now.

It won't behave differently (well, if it does then it's just a sideeffect of sth. else) and it is certainly not the cause for any of our issues here.
As being said: while Georg was of course absolutely right by pointing out the tags-wrong-IDs-bug in ogles2, there is nothing more there. And unless you used TAG_SKIP or other special tags (which AFAIK you did not), it simply did what you expected it to do. Other than this now fixed incompatibility to std. tags-processing, there is / was nothing wrong here.
Don't forget to read the changelog.

Go to top

  Register To Post
« 1 ... 7 8 9 (10) 11 12 13 ... 43 »

 




Currently Active Users Viewing This Thread: 3 ( 0 members and 3 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project