4
* VBox crOpenGL: GLSL related state info
8
* Copyright (C) 2009 Sun Microsystems, Inc.
10
* This file is part of VirtualBox Open Source Edition (OSE), as
11
* available from http://www.virtualbox.org. This file is free software;
12
* you can redistribute it and/or modify it under the terms of the GNU
13
* General Public License (GPL) as published by the Free Software
14
* Foundation, in version 2 as it comes in the "COPYING" file of the
15
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19
* Clara, CA 95054 USA or visit http://www.sun.com if you need
20
* additional information or have any questions.
23
#ifndef CR_STATE_GLSL_H
24
#define CR_STATE_GLSL_H
27
#include "state/cr_statetypes.h"
28
#include "state/cr_statefuncs.h"
34
/* We can't go the "easy" way of just extracting all the required data when taking snapshots.
35
Shader objects might be modified *after* program linkage and wouldn't affect program untill it's relinked.
36
So we have to keep track of shaders statuses right before each program was linked as well as their "current" status.
39
/*@todo: check rare case when successfully linked and active program is relinked with failure*/
43
GLenum type; /*GL_VERTEX_SHADER or GL_FRAGMENT_SHADER*/
44
GLchar* source; /*NULL after context loading unless in program's "active" hash*/
45
GLboolean compiled, deleted;
46
GLuint refCount; /*valid only for shaders in CRGLSLState's hash*/
54
/*Note: active state will hold copies of shaders while current state references shaders in the CRGLSLState hashtable*/
55
/*@todo: probably don't need a hashtable here*/
57
CRHashTable *attachedShaders;
58
CRGLSLAttrib *pAttribs; /*several names could be bound to the same index*/
73
GLboolean validated, linked, deleted;
74
CRGLSLProgramState activeState, currentState;
75
CRGLSLUniform *pUniforms;
78
GLboolean bUniformsSynced; /*uniforms info is updated since last link program call.*/
84
CRHashTable *programs;
86
CRGLSLProgram *activeProgram;
88
/* Indicates that we have to resend GLSL data to GPU on first glMakeCurrent call with owning context */
89
GLboolean bResyncNeeded;
92
DECLEXPORT(void) STATE_APIENTRY crStateGLSLInit(CRContext *ctx);
93
DECLEXPORT(void) STATE_APIENTRY crStateGLSLDestroy(CRContext *ctx);
94
DECLEXPORT(void) STATE_APIENTRY crStateGLSLSwitch(CRContext *from, CRContext *to);
96
DECLEXPORT(GLuint) STATE_APIENTRY crStateGetShaderHWID(GLuint id);
97
DECLEXPORT(GLuint) STATE_APIENTRY crStateGetProgramHWID(GLuint id);
98
DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLProgramHWIDtoID(GLuint hwid);
99
DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLShaderHWIDtoID(GLuint hwid);
101
DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformSize(GLenum type);
102
DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsIntUniform(GLenum type);
104
DECLEXPORT(void) STATE_APIENTRY crStateCreateShader(GLuint id, GLenum type);
105
DECLEXPORT(void) STATE_APIENTRY crStateCreateProgram(GLuint id);
107
DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached(GLuint program);
110
DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms(GLuint program, GLsizei cbData, GLvoid *pData);
112
DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms(GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData);
119
#endif /* CR_STATE_GLSL_H */