diff options
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/shaderobjects.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/shaderobjects.h | 18 | ||||
-rwxr-xr-x | src/mesa/shader/shaderobjects_3dlabs.c | 112 | ||||
-rwxr-xr-x | src/mesa/shader/shaderobjects_3dlabs.h | 7 |
4 files changed, 137 insertions, 4 deletions
diff --git a/src/mesa/shader/shaderobjects.c b/src/mesa/shader/shaderobjects.c index 3d31546453..f26ff12adf 100644 --- a/src/mesa/shader/shaderobjects.c +++ b/src/mesa/shader/shaderobjects.c @@ -36,6 +36,8 @@ #include "shaderobjects_3dlabs.h" +#if FEATURE_ARB_shader_objects + #define RELEASE_GENERIC(x)\ (**x)._unknown.Release ((struct gl2_unknown_intf **) (x)) @@ -1198,6 +1200,8 @@ _mesa_GetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name) return loc; } +#endif + GLvoid _mesa_init_shaderobjects (GLcontext *ctx) { diff --git a/src/mesa/shader/shaderobjects.h b/src/mesa/shader/shaderobjects.h index 818049d17b..cc67021629 100644 --- a/src/mesa/shader/shaderobjects.h +++ b/src/mesa/shader/shaderobjects.h @@ -27,6 +27,8 @@ #include "context.h" +#if FEATURE_ARB_shader_objects + /** * gl2 unique interface identifier. * Each gl2 interface has its own interface id used for object queries. @@ -40,7 +42,8 @@ enum gl2_uiid UIID_FRAGMENT_SHADER, /* fragment shader */ UIID_VERTEX_SHADER, /* vertex shader */ UIID_PROGRAM, /* program object */ - UIID_3DLABS_SHHANDLE /* encapsulates 3dlabs' ShHandle */ + UIID_3DLABS_SHHANDLE, /* encapsulates 3DLabs' ShHandle */ + UIID_DEBUG /* debug object */ }; struct gl2_unknown_intf @@ -127,8 +130,15 @@ struct gl2_3dlabs_shhandle_intf GLvoid *(* GetShHandle) (struct gl2_3dlabs_shhandle_intf **); }; +struct gl2_debug_intf +{ + struct gl2_generic_intf _generic; + GLvoid (* ClearDebugLog) (struct gl2_debug_intf **, GLenum logType, GLenum shaderType); + GLvoid (* GetDebugLog) (struct gl2_debug_intf **, GLenum logType, GLenum shaderType, + GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); + GLsizei (* GetDebugLogLength) (struct gl2_debug_intf **, GLenum logType, GLenum shaderType); +}; -#if FEATURE_ARB_shader_objects extern void GLAPIENTRY _mesa_DeleteObjectARB(GLhandleARB obj); @@ -260,9 +270,9 @@ _mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *); #endif /* FEATURE_ARB_vertex_shader */ +#endif /* FEATURE_ARB_shader_objects */ + extern void _mesa_init_shaderobjects (GLcontext *ctx); -#endif /* FEATURE_ARB_shader_objects */ - #endif /* SHADEROBJECTS_H */ diff --git a/src/mesa/shader/shaderobjects_3dlabs.c b/src/mesa/shader/shaderobjects_3dlabs.c index deeb40332a..0def13d3b8 100755 --- a/src/mesa/shader/shaderobjects_3dlabs.c +++ b/src/mesa/shader/shaderobjects_3dlabs.c @@ -44,6 +44,8 @@ #include "slang_link.h" #endif +#if FEATURE_ARB_shader_objects + struct gl2_unknown_obj { GLuint reference_count; @@ -1774,6 +1776,101 @@ _vertex_shader_constructor (struct gl2_vertex_shader_impl *impl) #endif } +struct gl2_debug_obj +{ + struct gl2_generic_obj _generic; +}; + +struct gl2_debug_impl +{ + struct gl2_debug_intf *_vftbl; + struct gl2_debug_obj _obj; +}; + +static GLvoid +_debug_destructor (struct gl2_unknown_intf **intf) +{ + struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf); + + (void) (impl); + /* TODO */ + + _generic_destructor (intf); +} + +static struct gl2_unknown_intf ** +_debug_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_DEBUG) { + (**intf).AddRef (intf); + return intf; + } + return _generic_QueryInterface (intf, uiid); +} + +static GLenum +_debug_GetType (struct gl2_generic_intf **intf) +{ + return /*GL_DEBUG_OBJECT_MESA*/0; +} + +static GLvoid +_debug_ClearDebugLog (struct gl2_debug_intf **intf, GLenum logType, GLenum shaderType) +{ + struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf); + + (void) (impl); + /* TODO */ +} + +static GLvoid +_debug_GetDebugLog (struct gl2_debug_intf **intf, GLenum logType, GLenum shaderType, + GLsizei maxLength, GLsizei *length, GLcharARB *infoLog) +{ + struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf); + + (void) (impl); + /* TODO */ +} + +static GLsizei +_debug_GetDebugLogLength (struct gl2_debug_intf **intf, GLenum logType, GLenum shaderType) +{ + struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf); + + (void) (impl); + /* TODO */ + + return 0; +} + +static struct gl2_debug_intf _debug_vftbl = { + { + { + _unknown_AddRef, + _unknown_Release, + _debug_QueryInterface + }, + _generic_Delete, + _debug_GetType, + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog, + _generic_GetInfoLogLength + }, + _debug_ClearDebugLog, + _debug_GetDebugLog, + _debug_GetDebugLogLength +}; + +static GLvoid +_debug_constructor (struct gl2_debug_impl *impl) +{ + _generic_constructor ((struct gl2_generic_impl *) (impl)); + impl->_vftbl = &_debug_vftbl; + impl->_obj._generic._unknown._destructor = _debug_destructor; +} + GLhandleARB _mesa_3dlabs_create_shader_object (GLenum shaderType) { @@ -1823,6 +1920,19 @@ _mesa_3dlabs_create_program_object (void) return 0; } +GLhandleARB +_mesa_3dlabs_create_debug_object (GLvoid) +{ + struct gl2_debug_impl *obj; + + obj = (struct gl2_debug_impl *) (_mesa_malloc (sizeof (struct gl2_debug_impl))); + if (obj != NULL) { + _debug_constructor (obj); + return obj->_obj._generic.name; + } + return 0; +} + #include "slang_assemble.h" #include "slang_execute.h" @@ -1859,6 +1969,8 @@ GLvoid _slang_exec_vertex_shader (struct gl2_program_intf **pro) exec_shader (pro, SLANG_SHADER_VERTEX); } +#endif + void _mesa_init_shaderobjects_3dlabs (GLcontext *ctx) { diff --git a/src/mesa/shader/shaderobjects_3dlabs.h b/src/mesa/shader/shaderobjects_3dlabs.h index 8bf273ae9d..2092dd923e 100755 --- a/src/mesa/shader/shaderobjects_3dlabs.h +++ b/src/mesa/shader/shaderobjects_3dlabs.h @@ -25,6 +25,8 @@ #ifndef SHADEROBJECTS_3DLABS_H #define SHADEROBJECTS_3DLABS_H +#if FEATURE_ARB_shader_objects + extern int _slang_fetch_discard (struct gl2_program_intf **pro, GLboolean *val); extern GLvoid _slang_exec_fragment_shader (struct gl2_program_intf **pro); @@ -37,6 +39,11 @@ _mesa_3dlabs_create_shader_object (GLenum); extern GLhandleARB _mesa_3dlabs_create_program_object (GLvoid); +extern GLhandleARB +_mesa_3dlabs_create_debug_object (GLvoid); + +#endif /* FEATURE_ARB_shader_objects */ + extern void _mesa_init_shaderobjects_3dlabs (GLcontext *ctx); |