Updates to glsm

This commit is contained in:
twinaphex 2016-02-12 01:42:33 +01:00
parent 9b521d665d
commit ce93da7cbf
3 changed files with 76 additions and 8 deletions

View File

@ -23,6 +23,7 @@
#include <glsym/glsym.h>
#include <glsm/glsm.h>
struct gl_cached_state
{
struct
@ -35,6 +36,12 @@ struct gl_cached_state
bool enabled[MAX_ATTRIB];
} vertex_attrib_pointer;
struct
{
GLenum pname;
GLint param;
} pixelstore_i;
struct
{
GLuint r;
@ -97,6 +104,7 @@ struct gl_cached_state
GLenum func;
} depthfunc;
struct
{
bool used;
@ -151,6 +159,11 @@ struct gl_cached_state
GLboolean mask;
} depthmask;
struct
{
GLenum mode;
} readbuffer;
GLuint vao;
GLuint framebuf;
GLuint program;
@ -167,6 +180,28 @@ static struct gl_cached_state gl_state;
/* GL wrapper-side */
void rglBlitFramebuffer(
GLint srcX0, GLint srcY0,
GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0,
GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
{
#ifndef HAVE_OPENGLES2
glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
#endif
}
void rglReadBuffer(GLenum mode)
{
#ifndef HAVE_OPENGLES2
glReadBuffer(mode);
#endif
gl_state.readbuffer.mode = mode;
}
void rglClearDepth(GLdouble depth)
{
glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL);
@ -179,6 +214,13 @@ void rglClearDepth(GLdouble depth)
gl_state.cleardepth.depth = depth;
}
void rglPixelStorei(GLenum pname, GLint param)
{
glPixelStorei(pname, param);
gl_state.pixelstore_i.pname = pname;
gl_state.pixelstore_i.param = param;
}
void rglDepthRange(GLclampd zNear, GLclampd zFar)
{
#ifdef HAVE_OPENGLES
@ -611,6 +653,11 @@ void rglUniform2f(GLint location, GLfloat v0, GLfloat v1)
glUniform2f(location, v0, v1);
}
void rglUniform2i(GLint location, GLint v0, GLint v1)
{
glUniform2i(location, v0, v1);
}
void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value)
{
glUniform2fv(location, count, value);

View File

@ -86,13 +86,20 @@ typedef GLclampf GLclampd;
enum
{
SGL_DEPTH_TEST = 0,
SGL_BLEND = 1,
SGL_POLYGON_OFFSET_FILL = 2,
SGL_FOG = 3,
SGL_CULL_FACE = 4,
SGL_ALPHA_TEST = 5,
SGL_SCISSOR_TEST = 6,
SGL_STENCIL_TEST = 7,
SGL_BLEND,
SGL_POLYGON_OFFSET_FILL,
SGL_FOG,
SGL_CULL_FACE,
SGL_ALPHA_TEST,
SGL_SCISSOR_TEST,
SGL_STENCIL_TEST,
#if !defined(HAVE_OPENGLES)
SGL_DEPTH_CLAMP,
SGL_CLIP_DISTANCE0,
#endif
SGL_DITHER,
SGL_SAMPLE_ALPHA_TO_COVERAGE,
SGL_SAMPLE_COVERAGE,
SGL_CAP_MAX
};

View File

@ -33,6 +33,7 @@ extern "C" {
#define glTexCoord2f rglTexCoord2f
/* more forward-compatible GL subset symbols */
#define glBlitFramebuffer rglBlitFramebuffer
#define glVertexAttrib4f rglVertexAttrib4f
#define glVertexAttrib4fv rglVertexAttrib4fv
#define glDrawArrays rglDrawArrays
@ -73,6 +74,7 @@ extern "C" {
#define glGenBuffers rglGenBuffers
#define glDisable(T) rglDisable(S##T)
#define glEnable(T) rglEnable(S##T)
#define glIsEnabled(T) rglIsEnabled(S##T)
#define glUseProgram rglUseProgram
#define glDepthMask rglDepthMask
#define glStencilMask rglStencilMask
@ -85,6 +87,7 @@ extern "C" {
#define glUniform1f rglUniform1f
#define glUniform1i rglUniform1i
#define glUniform2f rglUniform2f
#define glUniform2i rglUniform2i
#define glUniform2fv rglUniform2fv
#define glUniform3f rglUniform3f
#define glUniform3fv rglUniform3fv
@ -97,7 +100,6 @@ extern "C" {
#define glClearColor rglClearColor
#define glViewport rglViewport
#define glScissor rglScissor
#define glIsEnabled rglIsEnabled
#define glStencilFunc rglStencilFunc
#define glCullFace rglCullFace
#define glStencilOp rglStencilOp
@ -105,7 +107,11 @@ extern "C" {
#define glDepthRange rglDepthRange
#define glClearDepth rglClearDepth
#define glPolygonOffset rglPolygonOffset
#define glPixelStorei rglPixelStorei
#define glReadBuffer rglReadBuffer
void rglReadBuffer(GLenum mode);
void rglPixelStorei(GLenum pname, GLint param);
void rglTexCoord2f(GLfloat s, GLfloat t);
void rglDrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid * indices);
@ -167,6 +173,7 @@ void rglDeleteShader(GLuint shader);
void rglUniform1f(GLint location, GLfloat v0);
void rglUniform1i(GLint location, GLint v0);
void rglUniform2f(GLint location, GLfloat v0, GLfloat v1);
void rglUniform2i(GLint location, GLint v0, GLint v1);
void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value);
void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
void rglUniform3fv(GLint location, GLsizei count, const GLfloat *value);
@ -194,6 +201,13 @@ 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 rglBlitFramebuffer(
GLint srcX0, GLint srcY0,
GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0,
GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
#ifdef __cplusplus
}