diff --git a/libretro-common/compat/compat_snprintf.c b/libretro-common/compat/compat_snprintf.c index 074cf8e1..f67301ad 100644 --- a/libretro-common/compat/compat_snprintf.c +++ b/libretro-common/compat/compat_snprintf.c @@ -24,7 +24,7 @@ #ifdef _MSC_VER #include -#if _MSC_VER >= 1900 +#if _MSC_VER >= 1800 #include /* added for _vsnprintf_s and _vscprintf on VS2015 and VS2017 */ #endif #include @@ -55,13 +55,19 @@ int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list if (size != 0) #if (_MSC_VER <= 1310) - count = _vsnprintf(outBuf, size, format, ap); + count = _vsnprintf(outBuf, size - 1, format, ap); #else - count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); + count = _vsnprintf_s(outBuf, size, size - 1, format, ap); #endif if (count == -1) count = _vscprintf(format, ap); + if (count == size) + { + /* there was no room for a NULL, so truncate the last character */ + outBuf[size - 1] = '\0'; + } + return count; } diff --git a/libretro-common/glsm/glsm.c b/libretro-common/glsm/glsm.c index 85a7ced7..dc40b725 100644 --- a/libretro-common/glsm/glsm.c +++ b/libretro-common/glsm/glsm.c @@ -31,6 +31,11 @@ #define GL_SAMPLE_MASK 0x8E51 #endif +#if 0 +extern retro_log_printf_t log_cb; +#define GLSM_DEBUG +#endif + struct gl_cached_state { struct @@ -163,7 +168,7 @@ struct gl_cached_state GLenum mode; } frontface; - struct + struct { bool used; GLenum mode; @@ -189,14 +194,14 @@ struct gl_cached_state GLuint vao; GLuint framebuf; GLuint array_buffer; - GLuint program; + GLuint program; GLenum active_texture; int cap_state[SGL_CAP_MAX]; int cap_translate[SGL_CAP_MAX]; }; static GLint glsm_max_textures; -static struct retro_hw_render_callback hw_render; +struct retro_hw_render_callback hw_render; static struct gl_cached_state gl_state; /* GL wrapper-side */ @@ -211,6 +216,50 @@ GLenum rglGetError(void) return glGetError(); } +/* + * + * Core in: + * OpenGL : 3.2 + * OpenGLES : 3.0 + */ +void rglGetInteger64v( GLenum pname, int64_t *data) +{ +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glGetInteger64v(pname, (GLint64*)data); +#endif +} + +/* + * + * Core in: + * OpenGL : 3.2 + * OpenGLES : 3.0 + */ +void rglSamplerParameteri( GLuint sampler, + GLenum pname, + GLint param) +{ +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glSamplerParameteri(sampler, pname, param); +#endif +} + +void rglGenSamplers( GLsizei n, + GLuint *samplers) +{ +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glGenSamplers(n, samplers); +#endif +} + +void rglBindSampler( GLuint unit, + GLuint sampler) +{ +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glBindSampler(unit, sampler); +#endif +} + /* * * Core in: @@ -218,6 +267,9 @@ GLenum rglGetError(void) */ void rglClear(GLbitfield mask) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glClear.\n"); +#endif glClear(mask); } @@ -228,6 +280,9 @@ void rglClear(GLbitfield mask) */ void rglValidateProgram(GLuint program) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glValidateProgram.\n"); +#endif glValidateProgram(program); } @@ -239,6 +294,9 @@ void rglValidateProgram(GLuint program) */ void rglPolygonMode(GLenum face, GLenum mode) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glPolygonMode.\n"); +#endif #ifndef HAVE_OPENGLES glPolygonMode(face, mode); #endif @@ -255,10 +313,27 @@ void rglTexSubImage2D( GLenum type, const GLvoid * pixels) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexSubImage2D.\n"); +#endif glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } + +void rglGetBufferSubData( GLenum target, + GLintptr offset, + GLsizeiptr size, + GLvoid * data) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetBufferSubData.\n"); +#endif +#if defined(HAVE_OPENGL) + glGetBufferSubData(target, offset, size, data); +#endif +} + /* * * Core in: @@ -266,6 +341,9 @@ void rglTexSubImage2D( */ void rglLineWidth(GLfloat width) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glLineWidth.\n"); +#endif glLineWidth(width); } @@ -283,6 +361,9 @@ void rglBlitFramebuffer( GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBlitFramebuffer.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, @@ -297,6 +378,9 @@ void rglBlitFramebuffer( */ void rglReadBuffer(GLenum mode) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glReadBuffer.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glReadBuffer(mode); gl_state.readbuffer.mode = mode; @@ -310,6 +394,9 @@ void rglReadBuffer(GLenum mode) */ void rglClearDepth(GLdouble depth) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glClearDepth.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); #ifdef HAVE_OPENGLES glClearDepthf(depth); @@ -327,6 +414,9 @@ void rglClearDepth(GLdouble depth) */ void rglPixelStorei(GLenum pname, GLint param) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glPixelStorei.\n"); +#endif glPixelStorei(pname, param); gl_state.pixelstore_i.pname = pname; gl_state.pixelstore_i.param = param; @@ -339,6 +429,9 @@ void rglPixelStorei(GLenum pname, GLint param) */ void rglDepthRange(GLclampd zNear, GLclampd zFar) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDepthRange.\n"); +#endif #ifdef HAVE_OPENGLES glDepthRangef(zNear, zFar); #else @@ -356,10 +449,13 @@ void rglDepthRange(GLclampd zNear, GLclampd zFar) */ void rglFrontFace(GLenum mode) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glFrontFace.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glFrontFace(mode); gl_state.frontface.used = true; - gl_state.frontface.mode = mode; + gl_state.frontface.mode = mode; } /* @@ -369,6 +465,9 @@ void rglFrontFace(GLenum mode) */ void rglDepthFunc(GLenum func) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDepthFunc.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); gl_state.depthfunc.used = true; gl_state.depthfunc.func = func; @@ -383,6 +482,9 @@ void rglDepthFunc(GLenum func) void rglColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glColorMask.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glColorMask(red, green, blue, alpha); gl_state.colormask.red = red; @@ -399,6 +501,9 @@ void rglColorMask(GLboolean red, GLboolean green, */ void rglCullFace(GLenum mode) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCullFace.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glCullFace(mode); gl_state.cullface.used = true; @@ -412,6 +517,9 @@ void rglCullFace(GLenum mode) */ void rglStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glStencilOp.\n"); +#endif glStencilOp(sfail, dpfail, dppass); gl_state.stencilop.used = true; gl_state.stencilop.sfail = sfail; @@ -426,6 +534,9 @@ void rglStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass) */ void rglStencilFunc(GLenum func, GLint ref, GLuint mask) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glStencilFunc.\n"); +#endif glStencilFunc(func, ref, mask); gl_state.stencilfunc.used = true; gl_state.stencilfunc.func = func; @@ -440,6 +551,9 @@ void rglStencilFunc(GLenum func, GLint ref, GLuint mask) */ GLboolean rglIsEnabled(GLenum cap) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glIsEnabled.\n"); +#endif return gl_state.cap_state[cap] ? GL_TRUE : GL_FALSE; } @@ -451,6 +565,9 @@ GLboolean rglIsEnabled(GLenum cap) void rglClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glClearColor.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glClearColor(red, green, blue, alpha); gl_state.clear_color.r = red; @@ -466,6 +583,9 @@ void rglClearColor(GLclampf red, GLclampf green, */ void rglScissor(GLint x, GLint y, GLsizei width, GLsizei height) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glScissor.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glScissor(x, y, width, height); gl_state.scissor.used = true; @@ -482,6 +602,9 @@ void rglScissor(GLint x, GLint y, GLsizei width, GLsizei height) */ void rglViewport(GLint x, GLint y, GLsizei width, GLsizei height) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glViewport.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glViewport(x, y, width, height); gl_state.viewport.x = x; @@ -492,6 +615,9 @@ void rglViewport(GLint x, GLint y, GLsizei width, GLsizei height) void rglBlendFunc(GLenum sfactor, GLenum dfactor) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBlendFunc.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); gl_state.blendfunc.used = true; gl_state.blendfunc.sfactor = sfactor; @@ -507,6 +633,9 @@ void rglBlendFunc(GLenum sfactor, GLenum dfactor) */ void rglBlendFuncSeparate(GLenum sfactor, GLenum dfactor) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBlendFuncSeparate.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); gl_state.blendfunc_separate.used = true; gl_state.blendfunc_separate.srcRGB = sfactor; @@ -520,10 +649,13 @@ void rglBlendFuncSeparate(GLenum sfactor, GLenum dfactor) * Category: Textures * * Core in: - * OpenGL : 1.3 + * OpenGL : 1.3 */ void rglActiveTexture(GLenum texture) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glActiveTexture.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glActiveTexture(texture); gl_state.active_texture = texture - GL_TEXTURE0; @@ -536,6 +668,9 @@ void rglActiveTexture(GLenum texture) */ void rglBindTexture(GLenum target, GLuint texture) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindTexture.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glBindTexture(target, texture); gl_state.bind_textures.ids[gl_state.active_texture] = texture; @@ -548,6 +683,9 @@ void rglBindTexture(GLenum target, GLuint texture) */ void rglDisable(GLenum cap) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDisable.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glDisable(gl_state.cap_translate[cap]); gl_state.cap_state[cap] = 0; @@ -560,6 +698,9 @@ void rglDisable(GLenum cap) */ void rglEnable(GLenum cap) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glEnable.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glEnable(gl_state.cap_translate[cap]); gl_state.cap_state[cap] = 1; @@ -569,10 +710,13 @@ void rglEnable(GLenum cap) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUseProgram(GLuint program) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUseProgram.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); gl_state.program = program; glUseProgram(program); @@ -585,6 +729,9 @@ void rglUseProgram(GLuint program) */ void rglDepthMask(GLboolean flag) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDepthMask.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glDepthMask(flag); gl_state.depthmask.used = true; @@ -598,6 +745,9 @@ void rglDepthMask(GLboolean flag) */ void rglStencilMask(GLenum mask) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glStencilMask.\n"); +#endif glStencilMask(mask); gl_state.stencilmask.used = true; gl_state.stencilmask.mask = mask; @@ -611,6 +761,9 @@ void rglStencilMask(GLenum mask) void rglBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBufferData.\n"); +#endif glBufferData(target, size, data, usage); } @@ -622,6 +775,9 @@ void rglBufferData(GLenum target, GLsizeiptr size, void rglBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBufferSubData.\n"); +#endif glBufferSubData(target, offset, size, data); } @@ -632,6 +788,9 @@ void rglBufferSubData(GLenum target, GLintptr offset, */ void rglBindBuffer(GLenum target, GLuint buffer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindBuffer.\n"); +#endif if (target == GL_ARRAY_BUFFER) gl_state.array_buffer = buffer; glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); @@ -646,6 +805,9 @@ void rglBindBuffer(GLenum target, GLuint buffer) */ void rglLinkProgram(GLuint program) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glLinkProgram.\n"); +#endif glLinkProgram(program); } @@ -653,12 +815,15 @@ void rglLinkProgram(GLuint program) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 2.0 */ void rglFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glFramebufferTexture2D.\n"); +#endif glFramebufferTexture2D(target, attachment, textarget, texture, level); } @@ -672,6 +837,9 @@ void rglFramebufferTexture2D(GLenum target, GLenum attachment, void rglFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glFramebufferTexture.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3_2) glFramebufferTexture(target, attachment, texture, level); #endif @@ -684,6 +852,9 @@ void rglFramebufferTexture(GLenum target, GLenum attachment, */ void rglDrawArrays(GLenum mode, GLint first, GLsizei count) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDrawArrays.\n"); +#endif glDrawArrays(mode, first, count); } @@ -695,6 +866,9 @@ void rglDrawArrays(GLenum mode, GLint first, GLsizei count) void rglDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDrawElements.\n"); +#endif glDrawElements(mode, count, type, indices); } @@ -702,29 +876,41 @@ void rglCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { - glCompressedTexImage2D(target, level, internalformat, +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCompressedTexImage2D.\n"); +#endif + glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); } void rglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteFramebuffers.\n"); +#endif glDeleteFramebuffers(n, framebuffers); } void rglDeleteTextures(GLsizei n, const GLuint *textures) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteTextures.\n"); +#endif glDeleteTextures(n, textures); } /* * * Core in: - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglRenderbufferStorage(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glRenderbufferStorage.\n"); +#endif glRenderbufferStorage(target, internalFormat, width, height); } @@ -733,10 +919,13 @@ void rglRenderbufferStorage(GLenum target, GLenum internalFormat, * Core in: * * OpenGL : 3.0 - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglBindRenderbuffer(GLenum target, GLuint renderbuffer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindRenderbuffer.\n"); +#endif glBindRenderbuffer(target, renderbuffer); } @@ -744,10 +933,13 @@ void rglBindRenderbuffer(GLenum target, GLuint renderbuffer) * * Core in: * - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteRenderbuffers.\n"); +#endif glDeleteRenderbuffers(n, renderbuffers); } @@ -756,10 +948,13 @@ void rglDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers) * Core in: * * OpenGL : 3.0 - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglGenRenderbuffers(GLsizei n, GLuint *renderbuffers) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenRenderbuffers.\n"); +#endif glGenRenderbuffers(n, renderbuffers); } @@ -768,10 +963,13 @@ void rglGenRenderbuffers(GLsizei n, GLuint *renderbuffers) * Core in: * * OpenGL : 3.0 - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglGenerateMipmap(GLenum target) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenerateMipmap.\n"); +#endif glGenerateMipmap(target); } @@ -779,10 +977,13 @@ void rglGenerateMipmap(GLenum target) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ GLenum rglCheckFramebufferStatus(GLenum target) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCheckFramebufferStatus.\n"); +#endif return glCheckFramebufferStatus(target); } @@ -790,12 +991,15 @@ GLenum rglCheckFramebufferStatus(GLenum target) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 2.0 */ void rglFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glFramebufferRenderbuffer.\n"); +#endif glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); } @@ -803,11 +1007,14 @@ void rglFramebufferRenderbuffer(GLenum target, GLenum attachment, * Category: Shaders * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ void rglBindFragDataLocation(GLuint program, GLuint colorNumber, const char * name) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindFragDataLocation.\n"); +#endif #if !defined(HAVE_OPENGLES2) glBindFragDataLocation(program, colorNumber, name); #endif @@ -818,10 +1025,13 @@ void rglBindFragDataLocation(GLuint program, GLuint colorNumber, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetProgramiv(GLuint shader, GLenum pname, GLint *params) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetProgramiv.\n"); +#endif glGetProgramiv(shader, pname, params); } @@ -829,13 +1039,16 @@ void rglGetProgramiv(GLuint shader, GLenum pname, GLint *params) * Category: Shaders * * Core in: - * OpenGL : 4.1 + * OpenGL : 4.1 * OpenGLES : 3.0 */ void rglProgramParameteri( GLuint program, GLenum pname, GLint value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glProgramParameteri.\n"); +#endif #if !defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES) && (defined(HAVE_OPENGLES3) || defined(HAVE_OPENGLES_3_1)) glProgramParameteri(program, pname, value); #else @@ -846,20 +1059,79 @@ void rglProgramParameteri( GLuint program, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetActiveUniform.\n"); +#endif glGetActiveUniform(program, index, bufsize, length, size, type, name); } +void rglGenQueries( GLsizei n, + GLuint * ids) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenQueries.\n"); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glGenQueries(n, ids); +#endif +} + +void rglGetQueryObjectuiv( GLuint id, + GLenum pname, + GLuint * params) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetQueryObjectuiv.\n"); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glGetQueryObjectuiv(id, pname, params); +#endif +} + +void rglDeleteQueries( GLsizei n, + const GLuint * ids) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteQueries.\n"); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glDeleteQueries(n, ids); +#endif +} + +void rglBeginQuery( GLenum target, + GLuint id) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBeginQuery.\n"); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glBeginQuery(target, id); +#endif +} + +void rglEndQuery( GLenum target) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glEndQuery.\n"); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glEndQuery(target); +#endif +} + + /* * Category: UBO * * Core in: * - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglGetActiveUniformBlockiv(GLuint program, @@ -867,6 +1139,9 @@ void rglGetActiveUniformBlockiv(GLuint program, GLenum pname, GLint *params) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetActiveUniformBlockiv.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params); @@ -887,6 +1162,9 @@ void rglGetActiveUniformsiv( GLuint program, GLenum pname, GLint *params) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetActiveUniformsiv.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params); @@ -906,6 +1184,9 @@ void rglGetUniformIndices(GLuint program, const GLchar **uniformNames, GLuint *uniformIndices) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetUniformIndices.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glGetUniformIndices(program, uniformCount, uniformNames, uniformIndices); @@ -925,6 +1206,9 @@ void rglBindBufferBase( GLenum target, GLuint index, GLuint buffer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindBufferBase.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glBindBufferBase(target, index, buffer); #else @@ -943,6 +1227,9 @@ void rglBindBufferBase( GLenum target, GLuint rglGetUniformBlockIndex( GLuint program, const GLchar *uniformBlockName) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetUniformBlockIndex.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) return glGetUniformBlockIndex(program, uniformBlockName); #else @@ -962,6 +1249,9 @@ void rglUniformBlockBinding( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniformBlockBinding.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); @@ -973,11 +1263,14 @@ void rglUniformBlockBinding( GLuint program, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform1ui(GLint location, GLuint v) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform1ui.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glUniform1ui(location ,v); #endif @@ -986,11 +1279,14 @@ void rglUniform1ui(GLint location, GLuint v) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform2ui(GLint location, GLuint v0, GLuint v1) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform2ui.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glUniform2ui(location, v0, v1); #endif @@ -999,11 +1295,14 @@ void rglUniform2ui(GLint location, GLuint v0, GLuint v1) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform3ui.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glUniform3ui(location, v0, v1, v2); #endif @@ -1012,11 +1311,14 @@ void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform4ui.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glUniform4ui(location, v0, v1, v2, v3); #endif @@ -1025,11 +1327,14 @@ void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniformMatrix4fv.\n"); +#endif glUniformMatrix4fv(location, count, transpose, value); } @@ -1037,10 +1342,13 @@ void rglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglDetachShader(GLuint program, GLuint shader) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDetachShader.\n"); +#endif glDetachShader(program, shader); } @@ -1048,10 +1356,13 @@ void rglDetachShader(GLuint program, GLuint shader) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetShaderiv(GLuint shader, GLenum pname, GLint *params) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetShaderiv.\n"); +#endif glGetShaderiv(shader, pname, params); } @@ -1059,20 +1370,26 @@ void rglGetShaderiv(GLuint shader, GLenum pname, GLint *params) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglAttachShader(GLuint program, GLuint shader) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glAttachShader.\n"); +#endif glAttachShader(program, shader); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLint rglGetAttribLocation(GLuint program, const GLchar *name) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetAttribLocation.\n"); +#endif return glGetAttribLocation(program, name); } @@ -1080,11 +1397,14 @@ GLint rglGetAttribLocation(GLuint program, const GLchar *name) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglShaderSource(GLuint shader, GLsizei count, const GLchar **string, const GLint *length) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glShaderSource.\n"); +#endif return glShaderSource(shader, count, string, length); } @@ -1092,10 +1412,13 @@ void rglShaderSource(GLuint shader, GLsizei count, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglCompileShader(GLuint shader) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCompileShader.\n"); +#endif glCompileShader(shader); } @@ -1103,52 +1426,67 @@ void rglCompileShader(GLuint shader) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLuint rglCreateProgram(void) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCreateProgram.\n"); +#endif return glCreateProgram(); } /* * * Core in: - * OpenGL : 1.1 + * OpenGL : 1.1 */ void rglGenTextures(GLsizei n, GLuint *textures) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenTextures.\n"); +#endif glGenTextures(n, textures); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetShaderInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *infoLog) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetShaderInfoLog.\n"); +#endif glGetShaderInfoLog(shader, maxLength, length, infoLog); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetProgramInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *infoLog) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetProgramInfoLog.\n"); +#endif glGetProgramInfoLog(shader, maxLength, length, infoLog); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLboolean rglIsProgram(GLuint program) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glIsProgram.\n"); +#endif return glIsProgram(program); } @@ -1156,6 +1494,9 @@ GLboolean rglIsProgram(GLuint program) void rglTexCoord2f(GLfloat s, GLfloat t) { #ifdef HAVE_LEGACY_GL +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexCoord2f.\n"); +#endif glTexCoord2f(s, t); #endif } @@ -1164,11 +1505,14 @@ void rglTexCoord2f(GLfloat s, GLfloat t) * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * */ void rglDisableVertexAttribArray(GLuint index) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDisableVertexAttribArray.\n"); +#endif gl_state.vertex_attrib_pointer.enabled[index] = 0; glDisableVertexAttribArray(index); } @@ -1177,10 +1521,13 @@ void rglDisableVertexAttribArray(GLuint index) * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglEnableVertexAttribArray(GLuint index) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glEnableVertexAttribArray.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); gl_state.vertex_attrib_pointer.enabled[index] = 1; glEnableVertexAttribArray(index); @@ -1190,7 +1537,7 @@ void rglEnableVertexAttribArray(GLuint index) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttribIPointer( GLuint index, @@ -1199,6 +1546,9 @@ void rglVertexAttribIPointer( GLsizei stride, const GLvoid * pointer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glVertexAttribIPointer.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glVertexAttribIPointer(index, size, type, stride, pointer); #endif @@ -1211,6 +1561,9 @@ void rglVertexAttribLPointer( GLsizei stride, const GLvoid * pointer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glVertexAttribLPointer.\n"); +#endif #if defined(HAVE_OPENGL) glVertexAttribLPointer(index, size, type, stride, pointer); #endif @@ -1220,12 +1573,15 @@ void rglVertexAttribLPointer( * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttribPointer(GLuint name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glVertexAttribPointer.\n"); +#endif gl_state.attrib_pointer.used[name] = 1; gl_state.attrib_pointer.size[name] = size; gl_state.attrib_pointer.type[name] = type; @@ -1240,42 +1596,54 @@ void rglVertexAttribPointer(GLuint name, GLint size, * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglBindAttribLocation(GLuint program, GLuint index, const GLchar *name) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindAttribLocation.\n"); +#endif glBindAttribLocation(program, index, name); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttrib4f(GLuint name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - glVertexAttrib4f(name, x, y, z, w); +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glVertexAttrib4f.\n"); +#endif + glVertexAttrib4f(name, x, y, z, w); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttrib4fv(GLuint name, GLfloat* v) { - glVertexAttrib4fv(name, v); +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glVertexAttrib4fv.\n"); +#endif + glVertexAttrib4fv(name, v); } /* * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLuint rglCreateShader(GLenum shaderType) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCreateShader.\n"); +#endif return glCreateShader(shaderType); } @@ -1283,10 +1651,13 @@ GLuint rglCreateShader(GLenum shaderType) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglDeleteProgram(GLuint program) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteProgram.\n"); +#endif glDeleteProgram(program); } @@ -1294,10 +1665,13 @@ void rglDeleteProgram(GLuint program) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglDeleteShader(GLuint shader) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteShader.\n"); +#endif glDeleteShader(shader); } @@ -1305,10 +1679,13 @@ void rglDeleteShader(GLuint shader) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLint rglGetUniformLocation(GLuint program, const GLchar *name) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetUniformLocation.\n"); +#endif return glGetUniformLocation(program, name); } @@ -1316,10 +1693,13 @@ GLint rglGetUniformLocation(GLuint program, const GLchar *name) * Category: VBO and PBO * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ void rglDeleteBuffers(GLsizei n, const GLuint *buffers) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteBuffers.\n"); +#endif glDeleteBuffers(n, buffers); } @@ -1327,10 +1707,13 @@ void rglDeleteBuffers(GLsizei n, const GLuint *buffers) * Category: VBO and PBO * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ void rglGenBuffers(GLsizei n, GLuint *buffers) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenBuffers.\n"); +#endif glGenBuffers(n, buffers); } @@ -1338,10 +1721,13 @@ void rglGenBuffers(GLsizei n, GLuint *buffers) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1f(GLint location, GLfloat v0) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform1f.\n"); +#endif glUniform1f(location, v0); } @@ -1349,10 +1735,13 @@ void rglUniform1f(GLint location, GLfloat v0) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform1fv.\n"); +#endif glUniform1fv(location, count, value); } @@ -1360,10 +1749,13 @@ void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1iv(GLint location, GLsizei count, const GLint *value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform1iv.\n"); +#endif glUniform1iv(location, count, value); } @@ -1371,6 +1763,9 @@ void rglClearBufferfv( GLenum buffer, GLint drawBuffer, const GLfloat * value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glClearBufferfv.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3) glClearBufferfv(buffer, drawBuffer, value); #endif @@ -1378,6 +1773,9 @@ void rglClearBufferfv( GLenum buffer, void rglTexBuffer(GLenum target, GLenum internalFormat, GLuint buffer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexBuffer.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3_2) glTexBuffer(target, internalFormat, buffer); #endif @@ -1386,11 +1784,14 @@ void rglTexBuffer(GLenum target, GLenum internalFormat, GLuint buffer) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ const GLubyte* rglGetStringi(GLenum name, GLuint index) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetString.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3) return glGetStringi(name, index); #else @@ -1403,6 +1804,9 @@ void rglClearBufferfi( GLenum buffer, GLfloat depth, GLint stencil) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glClearBufferfi.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3) glClearBufferfi(buffer, drawBuffer, depth, stencil); #endif @@ -1411,7 +1815,7 @@ void rglClearBufferfi( GLenum buffer, /* * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglRenderbufferStorageMultisample( GLenum target, @@ -1420,6 +1824,9 @@ void rglRenderbufferStorageMultisample( GLenum target, GLsizei width, GLsizei height) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glRenderbufferStorageMultisample.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3) glRenderbufferStorageMultisample(target, samples, internalformat, width, height); #endif @@ -1429,10 +1836,13 @@ void rglRenderbufferStorageMultisample( GLenum target, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1i(GLint location, GLint v0) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform1i.\n"); +#endif glUniform1i(location, v0); } @@ -1440,10 +1850,13 @@ void rglUniform1i(GLint location, GLint v0) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform2f(GLint location, GLfloat v0, GLfloat v1) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform2f.\n"); +#endif glUniform2f(location, v0, v1); } @@ -1451,10 +1864,13 @@ void rglUniform2f(GLint location, GLfloat v0, GLfloat v1) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform2i(GLint location, GLint v0, GLint v1) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform2i.\n"); +#endif glUniform2i(location, v0, v1); } @@ -1462,10 +1878,13 @@ void rglUniform2i(GLint location, GLint v0, GLint v1) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform2fv.\n"); +#endif glUniform2fv(location, count, value); } @@ -1473,10 +1892,13 @@ void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform3f.\n"); +#endif glUniform3f(location, v0, v1, v2); } @@ -1484,10 +1906,13 @@ void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform3fv(GLint location, GLsizei count, const GLfloat *value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform3fv.\n"); +#endif glUniform3fv(location, count, value); } @@ -1499,6 +1924,9 @@ void rglUniform3fv(GLint location, GLsizei count, const GLfloat *value) */ void rglUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform4i.\n"); +#endif glUniform4i(location, v0, v1, v2, v3); } @@ -1506,10 +1934,13 @@ void rglUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform4f.\n"); +#endif glUniform4f(location, v0, v1, v2, v3); } @@ -1517,10 +1948,13 @@ void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform4fv.\n"); +#endif glUniform4fv(location, count, value); } @@ -1528,10 +1962,13 @@ void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value) /* * * Core in: - * OpenGL : 1.0 + * OpenGL : 1.0 */ void rglPolygonOffset(GLfloat factor, GLfloat units) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glPolygonOffset.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glPolygonOffset(factor, units); gl_state.polygonoffset.used = true; @@ -1543,10 +1980,13 @@ void rglPolygonOffset(GLfloat factor, GLfloat units) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ void rglGenFramebuffers(GLsizei n, GLuint *ids) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenFramebuffers.\n"); +#endif glGenFramebuffers(n, ids); } @@ -1554,10 +1994,13 @@ void rglGenFramebuffers(GLsizei n, GLuint *ids) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ void rglBindFramebuffer(GLenum target, GLuint framebuffer) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindFramebuffer.\n"); +#endif glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glBindFramebuffer(target, framebuffer); gl_state.framebuf = framebuffer; @@ -1567,11 +2010,14 @@ void rglBindFramebuffer(GLenum target, GLuint framebuffer) * Category: FBO * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglDrawBuffers(GLsizei n, const GLenum *bufs) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDrawBuffers.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glDrawBuffers(n, bufs); #endif @@ -1581,7 +2027,7 @@ void rglDrawBuffers(GLsizei n, const GLenum *bufs) * Category: FBO * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void *rglMapBufferRange( GLenum target, @@ -1589,6 +2035,9 @@ void *rglMapBufferRange( GLenum target, GLsizeiptr length, GLbitfield access) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glMapBufferRange.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) return glMapBufferRange(target, offset, length, access); #else @@ -1607,6 +2056,9 @@ void rglTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexStorage2DMultisample.\n"); +#endif #if defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3_1) glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); @@ -1621,6 +2073,9 @@ void rglTexStorage2DMultisample(GLenum target, GLsizei samples, void rglTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexStorage2D.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glTexStorage2D(target, levels, internalFormat, width, height); #endif @@ -1629,11 +2084,14 @@ void rglTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, /* * * Core in: - * OpenGL : 4.2 + * OpenGL : 4.2 * OpenGLES : 3.1 */ void rglMemoryBarrier( GLbitfield barriers) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glMemoryBarrier.\n"); +#endif #if !defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3) && defined(HAVE_OPENGLES_3_1) glMemoryBarrier(barriers); #else @@ -1644,7 +2102,7 @@ void rglMemoryBarrier( GLbitfield barriers) /* * * Core in: - * OpenGL : 4.2 + * OpenGL : 4.2 * OpenGLES : 3.1 */ void rglBindImageTexture( GLuint unit, @@ -1655,6 +2113,9 @@ void rglBindImageTexture( GLuint unit, GLenum access, GLenum format) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindImageTexture.\n"); +#endif #if !defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3) && defined(HAVE_OPENGLES_3_1) glBindImageTexture(unit, texture, level, layered, layer, access, format); #else @@ -1674,6 +2135,9 @@ void rglGetProgramBinary( GLuint program, GLenum *binaryFormat, void *binary) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGetProgramBinary.\n"); +#endif #if !defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glGetProgramBinary(program, bufsize, length, binaryFormat, binary); #else @@ -1692,6 +2156,9 @@ void rglProgramBinary(GLuint program, const void *binary, GLsizei length) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glProgramBinary.\n"); +#endif #if !defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3_1) glProgramBinary(program, binaryFormat, binary, length); #else @@ -1706,18 +2173,44 @@ void rglTexImage2DMultisample( GLenum target, GLsizei height, GLboolean fixedsamplelocations) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexImage2DMultisample.\n"); +#endif #ifndef HAVE_OPENGLES glTexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); #endif } + +void rglTexImage3D( GLenum target, + GLint level, + GLint internalFormat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + const GLvoid * data) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTexImage3D.\n"); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) + glTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, data); +#endif +} + /* * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ void * rglMapBuffer( GLenum target, GLenum access) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glMapBuffer.\n"); +#endif #if defined(HAVE_OPENGLES) return glMapBufferOES(target, access); #else @@ -1728,10 +2221,13 @@ void * rglMapBuffer( GLenum target, GLenum access) /* * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ GLboolean rglUnmapBuffer( GLenum target) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUnmapBuffer.\n"); +#endif #if defined(HAVE_OPENGLES) return glUnmapBufferOES(target); #else @@ -1741,11 +2237,17 @@ GLboolean rglUnmapBuffer( GLenum target) void rglBlendEquation(GLenum mode) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBlendEquation.\n"); +#endif glBlendEquation(mode); } void rglBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBlendColor.\n"); +#endif glBlendColor(red, green, blue, alpha); } @@ -1753,17 +2255,20 @@ void rglBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) * Category: Blending * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBlendEquationSeparate.\n"); +#endif glBlendEquationSeparate(modeRGB, modeAlpha); } /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.2 */ void rglCopyImageSubData( GLuint srcName, @@ -1782,6 +2287,9 @@ void rglCopyImageSubData( GLuint srcName, GLsizei srcHeight, GLsizei srcDepth) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glCopyImageSubData.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3_2) glCopyImageSubData(srcName, srcTarget, @@ -1805,11 +2313,14 @@ void rglCopyImageSubData( GLuint srcName, * Category: VAO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglBindVertexArray(GLuint array) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBindVertexArray.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glBindVertexArray(array); #endif @@ -1819,11 +2330,14 @@ void rglBindVertexArray(GLuint array) * Category: VAO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglGenVertexArrays(GLsizei n, GLuint *arrays) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glGenVertexArrays.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glGenVertexArrays(n, arrays); #endif @@ -1833,11 +2347,14 @@ void rglGenVertexArrays(GLsizei n, GLuint *arrays) * Category: VAO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglDeleteVertexArrays(GLsizei n, const GLuint *arrays) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteVertexArrays.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glDeleteVertexArrays(n, arrays); #endif @@ -1851,6 +2368,9 @@ void rglDeleteVertexArrays(GLsizei n, const GLuint *arrays) */ void *rglFenceSync(GLenum condition, GLbitfield flags) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glFenceSync.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) return (GLsync)glFenceSync(condition, flags); #else @@ -1866,6 +2386,9 @@ void *rglFenceSync(GLenum condition, GLbitfield flags) */ void rglDeleteSync(void * sync) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDeleteSync.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glDeleteSync((GLsync)sync); #endif @@ -1879,6 +2402,9 @@ void rglDeleteSync(void * sync) */ void rglWaitSync(void *sync, GLbitfield flags, uint64_t timeout) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glWaitSync.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glWaitSync((GLsync)sync, flags, (GLuint64)timeout); #endif @@ -1890,9 +2416,70 @@ void rglWaitSync(void *sync, GLbitfield flags, uint64_t timeout) * OpenGL : 4.4 * OpenGLES : Not available */ -void rglBufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data, GLbitfield flags) { +void rglBufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data, GLbitfield flags) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glBufferStorage.\n"); +#endif #if defined(HAVE_OPENGL) - glBufferStorage(target, size, data, flags); + glBufferStorage(target, size, data, flags); +#endif +} + +/* + * + * Core in: + * OpenGL : 2.0 + * OpenGLES : 2.0 + */ + +void rglUniform2iv( GLint location, + GLsizei count, + const GLint *value) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform2iv.\n"); +#endif + glUniform2iv(location, count, value); +} + +/* + * + * Core in: + * OpenGL : 3.0 + * OpenGLES : ?.? + */ + +void rglUniform2uiv( GLint location, + GLsizei count, + const GLuint *value) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glUniform2uiv.\n"); +#endif + glUniform2uiv(location, count, value); +} + +/* + * + * Core in: + * OpenGL : 4.3 + * OpenGLES : ?.? + */ +void rglTextureView( GLuint texture, + GLenum target, + GLuint origtexture, + GLenum internalformat, + GLuint minlevel, + GLuint numlevels, + GLuint minlayer, + GLuint numlayers) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glTextureView.\n"); +#endif +#if defined(HAVE_OPENGL) + glTextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); #endif } @@ -1902,7 +2489,11 @@ void rglBufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data, GLbitf * OpenGL : 3.0 * OpenGLES : 3.0 */ -void rglFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) { +void rglFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glFlushMappedBufferRange.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) glFlushMappedBufferRange(target, offset, length); #endif @@ -1920,6 +2511,9 @@ void rglFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length */ GLenum rglClientWaitSync(void *sync, GLbitfield flags, uint64_t timeout) { +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glClientWaitSync.\n"); +#endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3) return glClientWaitSync((GLsync)sync, flags, (GLuint64)timeout); #else @@ -1934,9 +2528,13 @@ GLenum rglClientWaitSync(void *sync, GLbitfield flags, uint64_t timeout) * OpenGLES : Not available */ void rglDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - GLvoid *indices, GLint basevertex) { + GLvoid *indices, GLint basevertex) +{ +#ifdef GLSM_DEBUG + log_cb(RETRO_LOG_INFO, "glDrawElementsBaseVertex.\n"); +#endif #if defined(HAVE_OPENGL) - glDrawElementsBaseVertex(mode, count, type, indices, basevertex); + glDrawElementsBaseVertex(mode, count, type, indices, basevertex); #endif } @@ -1973,7 +2571,7 @@ static void glsm_state_setup(void) gl_state.framebuf = hw_render.get_current_framebuffer(); gl_state.cullface.mode = GL_BACK; - gl_state.frontface.mode = GL_CCW; + gl_state.frontface.mode = GL_CCW; gl_state.blendfunc_separate.used = false; gl_state.blendfunc_separate.srcRGB = GL_ONE; @@ -1982,7 +2580,7 @@ static void glsm_state_setup(void) gl_state.blendfunc_separate.dstAlpha = GL_ZERO; gl_state.depthfunc.used = false; - + gl_state.colormask.used = false; gl_state.colormask.red = GL_TRUE; gl_state.colormask.green = GL_TRUE; diff --git a/libretro-common/glsym/glgen.py b/libretro-common/glsym/glgen.py index 3e2c810c..898dcb3a 100755 --- a/libretro-common/glsym/glgen.py +++ b/libretro-common/glsym/glgen.py @@ -107,6 +107,13 @@ if __name__ == '__main__': f.write('typedef GLint GLfixed;\n') f.write('#endif\n') + f.write('#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_7)\n') + f.write('typedef long long int GLint64;\n') + f.write('typedef unsigned long long int GLuint64;\n') + f.write('typedef unsigned long long int GLuint64EXT;\n') + f.write('typedef struct __GLsync *GLsync;\n') + f.write('#endif\n') + dump(f, typedefs) dump(f, overrides) dump(f, externs) diff --git a/libretro-common/include/glsm/glsmsym.h b/libretro-common/include/glsm/glsmsym.h index 36114419..137f3cb5 100644 --- a/libretro-common/include/glsm/glsmsym.h +++ b/libretro-common/include/glsm/glsmsym.h @@ -33,6 +33,19 @@ RETRO_BEGIN_DECLS #define glTexCoord2f rglTexCoord2f /* more forward-compatible GL subset symbols */ +#define glGetInteger64v rglGetInteger64v +#define glGenSamplers rglGenSamplers +#define glBindSampler rglBindSampler +#define glSamplerParameteri rglSamplerParameteri +#define glGetBufferSubData rglGetBufferSubData +#define glUniform2iv rglUniform2iv +#define glUniform2uiv rglUniform2uiv +#define glTextureView rglTextureView +#define glGetQueryObjectuiv rglGetQueryObjectuiv +#define glGenQueries rglGenQueries +#define glDeleteQueries rglDeleteQueries +#define glBeginQuery rglBeginQuery +#define glEndQuery rglEndQuery #define glBlitFramebuffer rglBlitFramebuffer #define glVertexAttrib4f rglVertexAttrib4f #define glVertexAttrib4fv rglVertexAttrib4fv @@ -135,13 +148,14 @@ RETRO_BEGIN_DECLS #define glUniformBlockBinding rglUniformBlockBinding #define glGetUniformBlockIndex rglGetUniformBlockIndex #define glGetActiveUniformBlockiv rglGetActiveUniformBlockiv -#define glBindBufferBase rglBindBufferBase +#define glBindBufferBase rglBindBufferBase #define glGetUniformIndices rglGetUniformIndices #define glGetActiveUniformsiv rglGetActiveUniformsiv #define glGetError rglGetError #define glClear rglClear #define glPolygonMode rglPolygonMode #define glLineWidth rglLineWidth +#define glTexImage3D rglTexImage3D #define glTexImage2DMultisample rglTexImage2DMultisample #define glTexStorage2DMultisample rglTexStorage2DMultisample #define glMemoryBarrier rglMemoryBarrier @@ -329,6 +343,27 @@ void rglVertexAttrib4f(GLuint name, GLfloat x, GLfloat y, void rglVertexAttrib4fv(GLuint name, GLfloat* v); void rglDeleteProgram(GLuint program); void rglDeleteBuffers(GLsizei n, const GLuint *buffers); +void rglUniform2uiv( GLint location, + GLsizei count, + const GLuint *value); +void rglTextureView( GLuint texture, + GLenum target, + GLuint origtexture, + GLenum internalformat, + GLuint minlevel, + GLuint numlevels, + GLuint minlayer, + GLuint numlayers); +void rglGenQueries( GLsizei n, + GLuint * ids); +void rglDeleteQueries( GLsizei n, + const GLuint * ids); +void rglBeginQuery( GLenum target, + GLuint id); +void rglEndQuery( GLenum target); +void rglGetQueryObjectuiv( GLuint id, + GLenum pname, + GLuint * params); void rglBlitFramebuffer( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, @@ -383,6 +418,16 @@ GLenum rglGetError(void); void rglClear(GLbitfield mask); void rglPolygonMode(GLenum face, GLenum mode); void rglLineWidth(GLfloat width); +void rglTexImage3D( GLenum target, + GLint level, + GLint internalFormat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + const GLvoid * data); void rglTexImage2DMultisample( GLenum target, GLsizei samples, GLenum internalformat, @@ -408,6 +453,22 @@ void rglFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length GLenum rglClientWaitSync(void *sync, GLbitfield flags, uint64_t timeout); void rglDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, GLvoid *indices, GLint basevertex); +void rglGetBufferSubData( GLenum target, + GLintptr offset, + GLsizeiptr size, + GLvoid * data); +void rglSamplerParameteri( GLuint sampler, + GLenum pname, + GLint param); +void rglBindSampler( GLuint unit, + GLuint sampler); +void rglGenSamplers( GLsizei n, + GLuint *samplers); +void rglGetInteger64v( GLenum pname, + int64_t * data); +void rglUniform2iv( GLint location, + GLsizei count, + const GLint *value); RETRO_END_DECLS diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 804a6c26..39f80e03 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -599,9 +599,12 @@ enum retro_mod * GET_VARIABLE. * This allows the frontend to present these variables to * a user dynamically. - * This should be called as early as possible (ideally in - * retro_set_environment). - * + * This should be called the first time as early as + * possible (ideally in retro_set_environment). + * Afterward it may be called again for the core to communicate + * updated options to the frontend, but the number of core + * options must not change from the number in the initial call. + * * 'data' points to an array of retro_variable structs * terminated by a { NULL, NULL } element. * retro_variable::key should be namespaced to not collide @@ -775,17 +778,18 @@ enum retro_mod */ #define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31 /* const char ** -- - * Returns the "save" directory of the frontend. - * This directory can be used to store SRAM, memory cards, - * high scores, etc, if the libretro core + * Returns the "save" directory of the frontend, unless there is no + * save directory available. The save directory should be used to + * store SRAM, memory cards, high scores, etc, if the libretro core * cannot use the regular memory interface (retro_get_memory_data()). * - * NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for - * similar things before. - * They should still check GET_SYSTEM_DIRECTORY if they want to - * be backwards compatible. - * The path here can be NULL. It should only be non-NULL if the - * frontend user has set a specific save path. + * If the frontend cannot designate a save directory, it will return + * NULL to indicate that the core should attempt to operate without a + * save directory set. + * + * NOTE: early libretro cores used the system directory for save + * files. Cores that need to be backwards-compatible can still check + * GET_SYSTEM_DIRECTORY. */ #define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32 /* const struct retro_system_av_info * -- @@ -853,26 +857,39 @@ enum retro_mod #define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35 /* const struct retro_controller_info * -- * This environment call lets a libretro core tell the frontend - * which controller types are recognized in calls to + * which controller subclasses are recognized in calls to * retro_set_controller_port_device(). * - * Some emulators such as Super Nintendo - * support multiple lightgun types which must be specifically - * selected from. - * It is therefore sometimes necessary for a frontend to be able - * to tell the core about a special kind of input device which is - * not covered by the libretro input API. + * Some emulators such as Super Nintendo support multiple lightgun + * types which must be specifically selected from. It is therefore + * sometimes necessary for a frontend to be able to tell the core + * about a special kind of input device which is not specifcally + * provided by the Libretro API. * - * In order for a frontend to understand the workings of an input device, - * it must be a specialized type - * of the generic device types already defined in the libretro API. + * In order for a frontend to understand the workings of those devices, + * they must be defined as a specialized subclass of the generic device + * types already defined in the libretro API. * - * Which devices are supported can vary per input port. * The core must pass an array of const struct retro_controller_info which - * is terminated with a blanked out struct. Each element of the struct - * corresponds to an ascending port index to - * retro_set_controller_port_device(). - * Even if special device types are set in the libretro core, + * is terminated with a blanked out struct. Each element of the + * retro_controller_info struct corresponds to the ascending port index + * that is passed to retro_set_controller_port_device() when that function + * is called to indicate to the core that the frontend has changed the + * active device subclass. SEE ALSO: retro_set_controller_port_device() + * + * The ascending input port indexes provided by the core in the struct + * are generally presented by frontends as ascending User # or Player #, + * such as Player 1, Player 2, Player 3, etc. Which device subclasses are + * supported can vary per input port. + * + * The first inner element of each entry in the retro_controller_info array + * is a retro_controller_description struct that specifies the names and + * codes of all device subclasses that are available for the corresponding + * User or Player, beginning with the generic Libretro device that the + * subclasses are derived from. The second inner element of each entry is the + * total number of subclasses that are listed in the retro_controller_description. + * + * NOTE: Even if special device types are set in the libretro core, * libretro should only poll input based on the base input device types. */ #define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL) @@ -1159,6 +1176,41 @@ struct retro_led_interface * * State will never be saved when using Hard Disable Audio. */ +#define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL) + /* struct retro_midi_interface ** -- + * Returns a MIDI interface that can be used for raw data I/O. + */ + +/* Retrieves the current state of the MIDI input. + * Returns true if it's enabled, false otherwise. */ +typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void); + +/* Retrieves the current state of the MIDI output. + * Returns true if it's enabled, false otherwise */ +typedef bool (RETRO_CALLCONV *retro_midi_output_enabled_t)(void); + +/* Reads next byte from the input stream. + * Returns true if byte is read, false otherwise. */ +typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t *byte); + +/* Writes byte to the output stream. + * 'delta_time' is in microseconds and represent time elapsed since previous write. + * Returns true if byte is written, false otherwise. */ +typedef bool (RETRO_CALLCONV *retro_midi_write_t)(uint8_t byte, uint32_t delta_time); + +/* Flushes previously written data. + * Returns true if successful, false otherwise. */ +typedef bool (RETRO_CALLCONV *retro_midi_flush_t)(void); + +struct retro_midi_interface +{ + retro_midi_input_enabled_t input_enabled; + retro_midi_output_enabled_t output_enabled; + retro_midi_read_t read; + retro_midi_write_t write; + retro_midi_flush_t flush; +}; + #define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL) /* const struct retro_hw_render_interface ** -- * Returns an API specific rendering interface for accessing API specific data. @@ -2333,7 +2385,13 @@ RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info); * will only poll input based on that particular device type. It is only a * hint to the libretro core when a core cannot automatically detect the * appropriate input device type on its own. It is also relevant when a - * core can change its behavior depending on device type. */ + * core can change its behavior depending on device type. + * + * As part of the core's implementation of retro_set_controller_port_device, + * the core should call RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS to notify the + * frontend if the descriptions for any controls have changed as a + * result of changing the device type. + */ RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device); /* Resets the current game. */ @@ -2365,7 +2423,9 @@ RETRO_API bool retro_unserialize(const void *data, size_t size); RETRO_API void retro_cheat_reset(void); RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code); -/* Loads a game. */ +/* Loads a game. + * Return true to indicate successful loading and false to indicate load failure. + */ RETRO_API bool retro_load_game(const struct retro_game_info *game); /* Loads a "special" kind of game. Should not be used, @@ -2375,7 +2435,7 @@ RETRO_API bool retro_load_game_special( const struct retro_game_info *info, size_t num_info ); -/* Unloads a currently loaded game. */ +/* Unloads the currently loaded game. Called before retro_deinit(void). */ RETRO_API void retro_unload_game(void); /* Gets region of game. */ diff --git a/libretro-common/include/retro_environment.h b/libretro-common/include/retro_environment.h index 1a18cd6f..0a40593e 100644 --- a/libretro-common/include/retro_environment.h +++ b/libretro-common/include/retro_environment.h @@ -73,6 +73,34 @@ printf("This is C++, version %d.\n", __cplusplus); /* This is not standard C. __STDC__ is not defined. */ #endif +#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) +/* Try to find out if we're compiling for WinRT or non-WinRT */ +#if defined(_MSC_VER) && defined(__has_include) +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif +/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +#if HAVE_WINAPIFAMILY_H +#include +#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) +#else +#define WINAPI_FAMILY_WINRT 0 +#endif /* HAVE_WINAPIFAMILY_H */ + +#if WINAPI_FAMILY_WINRT +#undef __WINRT__ +#define __WINRT__ 1 +#endif #endif + +#endif \ No newline at end of file diff --git a/libretro-common/include/retro_miscellaneous.h b/libretro-common/include/retro_miscellaneous.h index afcb885c..2fd97d54 100644 --- a/libretro-common/include/retro_miscellaneous.h +++ b/libretro-common/include/retro_miscellaneous.h @@ -155,4 +155,18 @@ typedef struct uint32_t data[8]; } retro_bits_t; +#ifdef _WIN32 +# ifdef _WIN64 +# define PRI_SIZET PRIu64 +# else +#if _MSC_VER == 1800 +# define PRI_SIZET PRIu32 +#else +# define PRI_SIZET "u" +#endif +# endif +#else +# define PRI_SIZET "zu" +#endif + #endif diff --git a/libretro-common/include/streams/file_stream.h b/libretro-common/include/streams/file_stream.h index 546fd126..e10c6b3c 100644 --- a/libretro-common/include/streams/file_stream.h +++ b/libretro-common/include/streams/file_stream.h @@ -78,6 +78,8 @@ char *filestream_gets(RFILE *stream, char *s, size_t len); int filestream_getc(RFILE *stream); +int filestream_scanf(RFILE *stream, const char* format, ...); + int filestream_eof(RFILE *stream); bool filestream_write_file(const char *path, const void *data, int64_t size); diff --git a/libretro-common/include/string/stdstring.h b/libretro-common/include/string/stdstring.h index eb2954b8..3d278d7c 100644 --- a/libretro-common/include/string/stdstring.h +++ b/libretro-common/include/string/stdstring.h @@ -45,7 +45,10 @@ static INLINE bool string_is_equal(const char *a, const char *b) if (!a || !b) return false; while(*a && (*a == *b)) - a++, b++; + { + a++; + b++; + } return (*(const unsigned char*)a - *(const unsigned char*)b) == 0; } diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 5ccdbcfa..06b587b0 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #ifdef HAVE_CONFIG_H @@ -191,6 +192,98 @@ int filestream_getc(RFILE *stream) return EOF; } +int filestream_scanf(RFILE *stream, const char* format, ...) +{ + char buf[4096]; + char subfmt[64]; + va_list args; + + const char * bufiter = buf; + int64_t startpos = filestream_tell(stream); + int ret = 0; + int64_t maxlen = filestream_read(stream, buf, sizeof(buf)-1); + + buf[maxlen] = '\0'; + + va_start(args, format); + + while (*format) + { + if (*format == '%') + { + int sublen; + + char* subfmtiter = subfmt; + bool asterisk = false; + + *subfmtiter++ = *format++; /* '%' */ + + /* %[*][width][length]specifier */ + + if (*format == '*') + { + asterisk = true; + *subfmtiter++ = *format++; + } + + while (isdigit(*format)) *subfmtiter++ = *format++; /* width */ + + /* length */ + if (*format == 'h' || *format == 'l') + { + if (format[1] == format[0]) *subfmtiter++ = *format++; + *subfmtiter++ = *format++; + } + else if (*format == 'j' || *format == 'z' || *format == 't' || *format == 'L') + { + *subfmtiter++ = *format++; + } + + /* specifier - always a single character (except ]) */ + if (*format == '[') + { + while (*format != ']') *subfmtiter++ = *format++; + *subfmtiter++ = *format++; + } + else *subfmtiter++ = *format++; + + *subfmtiter++ = '%'; + *subfmtiter++ = 'n'; + *subfmtiter++ = '\0'; + + if (sizeof(void*) != sizeof(long*)) abort(); /* all pointers must have the same size */ + if (asterisk) + { + if (sscanf(bufiter, subfmt, &sublen) != 0) break; + } + else + { + if (sscanf(bufiter, subfmt, va_arg(args, void*), &sublen) != 1) break; + } + + ret++; + bufiter += sublen; + } + else if (isspace(*format)) + { + while (isspace(*bufiter)) bufiter++; + format++; + } + else + { + if (*bufiter != *format) + break; + bufiter++; + format++; + } + } + + va_end(args); + filestream_seek(stream, startpos+(bufiter-buf), RETRO_VFS_SEEK_POSITION_START); + + return ret; +} + int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position) { int64_t output; diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 6e1555db..71b2ea24 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -109,7 +109,10 @@ char *string_trim_whitespace_left(char *const s) char *cur = s; while(*cur && isspace((unsigned char)*cur)) - ++cur, --len; + { + ++cur; + --len; + } if(s != cur) memmove(s, cur, len + 1); @@ -128,7 +131,10 @@ char *string_trim_whitespace_right(char *const s) char *cur = s + len - 1; while(cur != s && isspace((unsigned char)*cur)) - --cur, --len; + { + --cur; + --len; + } cur[isspace((unsigned char)*cur) ? 0 : 1] = '\0'; }