xgl: Add new resource type for textures

This change modifies xgl.h to include a new descriptor set
slot type for textures, distinct from resources:

    XGL_SLOT_SHADER_TEXTURE_RESOURCE

Buffers continue to use:

    XGL_SLOT_SHADER_RESOURCE

The ordering of their inclusion in binding tables entries is
important: textures must come before buffers.  This is how
the compiler expects them to be laid out.
diff --git a/icd/intel/cmd_pipeline.c b/icd/intel/cmd_pipeline.c
index c16aff3..d0b5114 100644
--- a/icd/intel/cmd_pipeline.c
+++ b/icd/intel/cmd_pipeline.c
@@ -1484,7 +1484,7 @@
     if (!rmap || !rmap->sampler_count)
         return 0;
 
-    surface_count = rmap->rt_count + rmap->resource_count + rmap->uav_count;
+    surface_count = rmap->rt_count + rmap->texture_resource_count + rmap->resource_count + rmap->uav_count;
 
     border_offset = cmd_state_pointer(cmd, INTEL_CMD_ITEM_BLOB,
             GEN6_ALIGNMENT_SAMPLER_BORDER_COLOR,
@@ -1563,7 +1563,7 @@
     CMD_ASSERT(cmd, 6, 7.5);
 
     surface_count = (rmap) ?
-        rmap->rt_count + rmap->resource_count + rmap->uav_count : 0;
+        rmap->rt_count + rmap->texture_resource_count + rmap->resource_count + rmap->uav_count : 0;
     if (!surface_count)
         return 0;
 
diff --git a/icd/intel/compiler/pipeline/brw_shader.cpp b/icd/intel/compiler/pipeline/brw_shader.cpp
index 20490b6..9c84dc1 100644
--- a/icd/intel/compiler/pipeline/brw_shader.cpp
+++ b/icd/intel/compiler/pipeline/brw_shader.cpp
@@ -961,16 +961,6 @@
 void
 backend_visitor::assign_common_binding_table_offsets(uint32_t next_binding_table_offset)
 {
-   // LunarG:  Don't allow compiler to separate number spaces for textures and buffers
-   stage_prog_data->binding_table.texture_start = next_binding_table_offset;
-   stage_prog_data->binding_table.ubo_start     = next_binding_table_offset;
-
-   // LunarG: Turn these on when we are ready to support
-   //stage_prog_data->binding_table.gather_texture_start = ??;
-   //stage_prog_data->binding_table.abo_start = ??;
-   //stage_prog_data->binding_table.pull_constants_start = ??;
-   return;
-
    int num_textures = _mesa_fls(prog->SamplersUsed);
 
    stage_prog_data->binding_table.texture_start = next_binding_table_offset;
diff --git a/icd/intel/pipeline.h b/icd/intel/pipeline.h
index aa5845a..fbc0390 100644
--- a/icd/intel/pipeline.h
+++ b/icd/intel/pipeline.h
@@ -69,6 +69,7 @@
     /* this is not an intel_obj */
 
     XGL_UINT rt_count;
+    XGL_UINT texture_resource_count;
     XGL_UINT resource_count;
     XGL_UINT uav_count;
     XGL_UINT sampler_count;
diff --git a/icd/intel/pipeline_shader.c b/icd/intel/pipeline_shader.c
index 329bdba..b66c00f 100644
--- a/icd/intel/pipeline_shader.c
+++ b/icd/intel/pipeline_shader.c
@@ -33,7 +33,10 @@
                                                       XGL_DESCRIPTOR_SET_SLOT_TYPE type,
                                                       XGL_UINT index)
 {
-    const XGL_UINT resource_offset = rmap->rt_count;
+    // The ordering of below offsets is important.  Textures need to come before
+    // buffers with the current compiler conventions.
+    const XGL_UINT texture_resource_offset = rmap->rt_count;
+    const XGL_UINT resource_offset = texture_resource_offset + rmap->texture_resource_count;
     const XGL_UINT uav_offset = resource_offset + rmap->resource_count;
     const XGL_UINT sampler_offset = uav_offset + rmap->uav_count;
     struct intel_pipeline_rmap_slot *slot;
@@ -42,6 +45,9 @@
     case XGL_SLOT_UNUSED:
         slot = NULL;
         break;
+    case XGL_SLOT_SHADER_TEXTURE_RESOURCE:
+        slot = &rmap->slots[texture_resource_offset + index];
+        break;
     case XGL_SLOT_SHADER_RESOURCE:
         slot = &rmap->slots[resource_offset + index];
         break;
@@ -138,6 +144,10 @@
     switch (type) {
     case XGL_SLOT_UNUSED:
         break;
+    case XGL_SLOT_SHADER_TEXTURE_RESOURCE:
+        if (rmap->texture_resource_count < index + 1)
+            rmap->texture_resource_count = index + 1;
+        break;
     case XGL_SLOT_SHADER_RESOURCE:
         if (rmap->resource_count < index + 1)
             rmap->resource_count = index + 1;
@@ -225,7 +235,7 @@
     rmap_update_count(rmap, dyn->slotObjectType, dyn->shaderEntityIndex);
     rmap->rt_count = rt_count;
 
-    rmap->slot_count = rmap->rt_count + rmap->resource_count +
+    rmap->slot_count = rmap->rt_count + rmap->texture_resource_count + rmap->resource_count +
         rmap->uav_count + rmap->sampler_count;
 
     rmap->slots = icd_alloc(sizeof(rmap->slots[0]) * rmap->slot_count,
diff --git a/include/xgl.h b/include/xgl.h
index 52a5f80..f28aa22 100644
--- a/include/xgl.h
+++ b/include/xgl.h
@@ -288,8 +288,13 @@
     XGL_SLOT_SHADER_SAMPLER                                 = 0x00000003,
     XGL_SLOT_NEXT_DESCRIPTOR_SET                            = 0x00000004,
 
+    // LUNARG CHANGE BEGIN - differentiate between textures and buffers
+    XGL_SLOT_SHADER_TEXTURE_RESOURCE                        = 0x00000005,
+
     XGL_DESCRIPTOR_SET_SLOT_TYPE_BEGIN_RANGE                = XGL_SLOT_UNUSED,
-    XGL_DESCRIPTOR_SET_SLOT_TYPE_END_RANGE                  = XGL_SLOT_NEXT_DESCRIPTOR_SET,
+    XGL_DESCRIPTOR_SET_SLOT_TYPE_END_RANGE                  = XGL_SLOT_SHADER_TEXTURE_RESOURCE,
+    // LUNARG CHANGE END
+
     XGL_NUM_DESCRIPTOR_SET_SLOT_TYPE                        = (XGL_DESCRIPTOR_SET_SLOT_TYPE_END_RANGE - XGL_DESCRIPTOR_SET_SLOT_TYPE_BEGIN_RANGE + 1),
     XGL_MAX_ENUM(_XGL_DESCRIPTOR_SET_SLOT_TYPE)
 } XGL_DESCRIPTOR_SET_SLOT_TYPE;
diff --git a/layers/draw_state.c b/layers/draw_state.c
index 75193b8..1e8b163 100644
--- a/layers/draw_state.c
+++ b/layers/draw_state.c
@@ -760,6 +760,7 @@
     char str[1024];
     switch (shaderMapping)
     {
+        case XGL_SLOT_SHADER_TEXTURE_RESOURCE:
         case XGL_SLOT_SHADER_RESOURCE:
             if (MAPPING_MEMORY != slotBinding && MAPPING_IMAGE != slotBinding)
                 error = XGL_TRUE;