* \author Michal Krol\r
*/\r
\r
+/* Set this to 1 when we are ready to use 3dlabs' front-end */\r
+#define USE_3DLABS_FRONTEND 0\r
\r
#include "glheader.h"\r
#include "shaderobjects.h"\r
#include "context.h"\r
#include "macros.h"\r
#include "hash.h"\r
+\r
+#if USE_3DLABS_FRONTEND\r
#include "slang_mesa.h"\r
#include "Public/ShaderLang.h"\r
+#endif\r
\r
struct gl2_unknown_obj\r
{\r
struct gl2_3dlabs_shhandle_obj\r
{\r
struct gl2_unkinner_obj _unknown;\r
+#if USE_3DLABS_FRONTEND\r
ShHandle handle;\r
+#endif\r
};\r
\r
struct gl2_3dlabs_shhandle_impl\r
static void\r
_3dlabs_shhandle_destructor (struct gl2_unknown_intf **intf)\r
{\r
-#if FEATURE_shading_language\r
+#if USE_3DLABS_FRONTEND\r
struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf;\r
-\r
ShDestruct (impl->_obj.handle);\r
- _unkinner_destructor (intf);\r
-#else\r
- (void) _unkinner_destructor;\r
#endif\r
+ _unkinner_destructor (intf);\r
}\r
\r
static GLvoid *\r
_3dlabs_shhandle_GetShHandle (struct gl2_3dlabs_shhandle_intf **intf)\r
{\r
+#if USE_3DLABS_FRONTEND\r
struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf;\r
-\r
return impl->_obj.handle;\r
+#else\r
+ return NULL;\r
+#endif\r
}\r
\r
static struct gl2_3dlabs_shhandle_intf _3dlabs_shhandle_vftbl = {\r
{\r
_unkinner_constructor ((struct gl2_unkinner_impl *) impl, outer);\r
impl->_vftbl = &_3dlabs_shhandle_vftbl;\r
+#if USE_3DLABS_FRONTEND\r
impl->_obj.handle = NULL;\r
+#endif\r
}\r
\r
struct gl2_shader_obj\r
static struct gl2_unknown_intf **\r
_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
{\r
+#if USE_3DLABS_FRONTEND\r
struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+#endif\r
\r
if (uiid == UIID_SHADER)\r
{\r
(**intf).AddRef (intf);\r
return intf;\r
}\r
+#if USE_3DLABS_FRONTEND\r
if (uiid == UIID_3DLABS_SHHANDLE)\r
{\r
(**intf).AddRef (intf);\r
return (struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl;\r
}\r
+#endif\r
return _generic_QueryInterface (intf, uiid);\r
}\r
\r
static GLvoid\r
_shader_Compile (struct gl2_shader_intf **intf)\r
{\r
-#if FEATURE_shading_language\r
struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+#if USE_3DLABS_FRONTEND\r
char **strings;\r
TBuiltInResource res;\r
+#endif\r
\r
impl->_obj.compile_status = GL_FALSE;\r
_mesa_free ((void *) impl->_obj._generic.info_log);\r
impl->_obj._generic.info_log = NULL;\r
\r
+#if USE_3DLABS_FRONTEND\r
/* 3dlabs compiler expects us to feed it with null-terminated string array,\r
we've got only one big string with offsets, so we must split it; but when\r
there's only one string to deal with, we pass its address directly */\r
struct gl2_container_obj _container;\r
GLboolean link_status;\r
GLboolean validate_status;\r
+#if USE_3DLABS_FRONTEND\r
ShHandle linker;\r
ShHandle uniforms;\r
+#endif\r
};\r
\r
struct gl2_program_impl\r
static void\r
_program_destructor (struct gl2_unknown_intf **intf)\r
{\r
-#if FEATURE_shading_language\r
+#if USE_3DLABS_FRONTEND\r
struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
\r
ShDestruct (impl->_obj.linker);\r
static GLvoid\r
_program_Link (struct gl2_program_intf **intf)\r
{\r
-#if FEATURE_shading_language\r
struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
+#if USE_3DLABS_FRONTEND\r
ShHandle *handles;\r
GLuint i;\r
+#endif\r
\r
impl->_obj.link_status = GL_FALSE;\r
_mesa_free ((void *) impl->_obj._container._generic.info_log);\r
impl->_obj._container._generic.info_log = NULL;\r
\r
+#if USE_3DLABS_FRONTEND\r
handles = (ShHandle *) _mesa_malloc (impl->_obj._container.attached_count * sizeof (ShHandle));\r
if (handles == NULL)\r
return;\r
static void\r
_program_constructor (struct gl2_program_impl *impl)\r
{\r
-#if FEATURE_shading_language\r
_container_constructor ((struct gl2_container_impl *) impl);\r
impl->_vftbl = &_program_vftbl;\r
impl->_obj._container._generic._unknown._destructor = _program_destructor;\r
impl->_obj.link_status = GL_FALSE;\r
impl->_obj.validate_status = GL_FALSE;\r
+#if USE_3DLABS_FRONTEND\r
impl->_obj.linker = ShConstructLinker (EShExVertexFragment, 0);\r
impl->_obj.uniforms = ShConstructUniformMap ();\r
-#else\r
- (void) _container_constructor;\r
- (void) _program_destructor;\r
- (void) _program_vftbl;\r
#endif\r
}\r
\r
static void\r
_fragment_shader_constructor (struct gl2_fragment_shader_impl *impl)\r
{\r
-#if FEATURE_shading_language\r
_shader_constructor ((struct gl2_shader_impl *) impl);\r
impl->_vftbl = &_fragment_shader_vftbl;\r
impl->_obj._shader._generic._unknown._destructor = _fragment_shader_destructor;\r
+#if USE_3DLABS_FRONTEND\r
impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangFragment, 0);\r
-#else\r
- (void) _shader_constructor;\r
- (void) _fragment_shader_vftbl;\r
- (void) _fragment_shader_destructor;\r
#endif\r
}\r
\r
static void\r
_vertex_shader_constructor (struct gl2_vertex_shader_impl *impl)\r
{\r
-#if FEATURE_shading_language\r
_shader_constructor ((struct gl2_shader_impl *) impl);\r
impl->_vftbl = &_vertex_shader_vftbl;\r
impl->_obj._shader._generic._unknown._destructor = _vertex_shader_destructor;\r
+#if USE_3DLABS_FRONTEND\r
impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangVertex, 0);\r
-#else\r
- (void) _vertex_shader_vftbl;\r
- (void) _vertex_shader_destructor;\r
#endif\r
}\r
\r
void\r
_mesa_init_shaderobjects_3dlabs (GLcontext *ctx)\r
{\r
-#if FEATURE_shading_language\r
+#if USE_3DLABS_FRONTEND\r
_glslang_3dlabs_InitProcess ();\r
_glslang_3dlabs_ShInitialize ();\r
#endif\r