checkpoint: Adding GLSL compiler extension
diff --git a/include/xglIntelExt.h b/include/xglIntelExt.h
new file mode 100644
index 0000000..d593561
--- /dev/null
+++ b/include/xglIntelExt.h
@@ -0,0 +1,24 @@
+/* IN DEVELOPMENT.  DO NOT SHIP. */
+
+#ifndef __XGLINTELEXT_H__
+#define __XGLINTELEXT_H__
+
+#include <xcb/xcb.h>
+#include <xcb/randr.h>
+#include "xgl.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+typedef enum _XGL_INTEL_STRUCTURE_TYPE
+{
+    XGL_INTEL_STRUCTURE_TYPE_SHADER_CREATE_INFO             = 1000,
+} XGL_INTEL_STRUCTURE_TYPE;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // __XGLINTELEXT_H__
diff --git a/tests/common.c b/tests/common.c
index a3de3d7..e99e9a7 100644
--- a/tests/common.c
+++ b/tests/common.c
@@ -112,6 +112,7 @@
 
     static const XGL_CHAR *known_extensions[] = {
         (const XGL_CHAR *) "some_extension",
+        (const XGL_CHAR *) "XGL_COMPILE_GLSL",
     };
 
     for (i = 0; i < ARRAY_SIZE(known_extensions); i++) {
diff --git a/tests/render_tests.cpp b/tests/render_tests.cpp
index fec406d..5eef4b7 100644
--- a/tests/render_tests.cpp
+++ b/tests/render_tests.cpp
@@ -62,6 +62,7 @@
 using namespace std;
 
 #include <xgl.h>
+#include <xglIntelExt.h>
 #include "gtest-1.7.0/include/gtest/gtest.h"
 
 #include "xgldevice.h"
@@ -321,28 +322,31 @@
                                  const char *shader_code,
                                  XGL_SHADER *pshader)
 {
-    struct icd_bil_header *pBIL;
-    char * memblock;
-    const char *kernel;
-    size_t kernel_size;
     XGL_RESULT err;
     std::vector<unsigned int> bil;
-
-    GLSLtoBIL(stage, shader_code, bil);
-
     XGL_SHADER_CREATE_INFO createInfo;
     XGL_SHADER shader;
 
     createInfo.sType = XGL_STRUCTURE_TYPE_SHADER_CREATE_INFO;
     createInfo.pNext = NULL;
-    createInfo.pCode = bil.data();
-    createInfo.codeSize = bil.size() * sizeof(unsigned int);
-    createInfo.flags = 0;
+
+    if (this->m_device->extension_exist("XGL_COMPILE_GLSL")) {
+        // Driver has extended CreateShader to process GLSL
+        createInfo.sType = (XGL_STRUCTURE_TYPE) XGL_INTEL_STRUCTURE_TYPE_SHADER_CREATE_INFO;
+        createInfo.pCode = shader_code;
+        createInfo.codeSize = strlen(shader_code);
+        createInfo.flags = 0;
+    } else {
+        // Use Reference GLSL to BIL compiler
+        GLSLtoBIL(stage, shader_code, bil);
+        createInfo.pCode = bil.data();
+        createInfo.codeSize = bil.size() * sizeof(unsigned int);
+        createInfo.flags = 0;
+    }
+
     err = xglCreateShader(device(), &createInfo, &shader);
     ASSERT_XGL_SUCCESS(err);
 
-    delete[] memblock;
-
     *pshader = shader;
 }
 
diff --git a/tests/xglgpu.cpp b/tests/xglgpu.cpp
index 38e1675..5e98155 100644
--- a/tests/xglgpu.cpp
+++ b/tests/xglgpu.cpp
@@ -76,7 +76,7 @@
     XGL_UINT i;
 
     static const XGL_CHAR *known_extensions[] = {
-        (const XGL_CHAR *) "some_extension",
+        (const XGL_CHAR *) "XGL_COMPILE_GLSL",
     };
     this->extension_count = 0;
 
@@ -102,3 +102,15 @@
     }
 }
 
+bool XglGpu::extension_exist(const char *ext_name)
+{
+    XGL_UINT i;
+
+    for (i=0; i<this->extension_count; i++) {
+        if (strcmp((const char *) this->extensions[i], ext_name) == 0)
+            return true;
+    }
+
+    return false;
+}
+
diff --git a/tests/xglgpu.h b/tests/xglgpu.h
index e2b7cb8..41f5f84 100644
--- a/tests/xglgpu.h
+++ b/tests/xglgpu.h
@@ -16,6 +16,7 @@
     void init_gpu();
     void init_extensions();
     void init_formats();
+    bool extension_exist(const char *ext_name);
 
     // Do we want to hide/abstract this data?
 // private:
diff --git a/tests/xglinfo.c b/tests/xglinfo.c
index 96c0036..38558ac 100644
--- a/tests/xglinfo.c
+++ b/tests/xglinfo.c
@@ -242,6 +242,20 @@
     printf("\tpixelsPerClock = %f\n",   perf->pixelsPerClock);
 }
 
+static void app_gpu_dump_extensions(const struct app_gpu *gpu)
+{
+    int i;
+    printf("Extensions");
+    printf("\tcount = %d\n",            gpu->extension_count);
+    printf("\t");
+    for (i=0; i< gpu->extension_count; i++) {
+        if (i>0)
+            printf(", "); // separator between extension names
+        printf("%s",                    gpu->extensions[i]);
+    }
+    printf("\n");
+}
+
 static void app_gpu_dump_queue_props(const struct app_gpu *gpu, XGL_UINT id)
 {
     const XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *props = &gpu->queue_props[id];
@@ -276,6 +290,8 @@
     printf("GPU%u\n", gpu->id);
     app_gpu_dump_props(gpu);
     printf("\n");
+    app_gpu_dump_extensions(gpu);
+    printf("\n");
     app_gpu_dump_perf(gpu);
     printf("\n");
     for (i = 0; i < gpu->queue_count; i++) {