intel: Remove scissor enable and scissor count

bug #12925
header version: r29511
Remove separate scissor enable and scissor count. Scissor always
enabled and must always provide scissor rect for every viewport.
diff --git a/demos/cube.c b/demos/cube.c
index 42a9570..1e961a7 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -1142,7 +1142,6 @@
 
     memset(&vp, 0, sizeof(vp));
     vp.sType = XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO;
-    vp.scissorEnable = XGL_FALSE;
 
     memset(&ds, 0, sizeof(ds));
     ds.sType = XGL_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO;
@@ -1201,13 +1200,19 @@
 
     memset(&viewport_create, 0, sizeof(viewport_create));
     viewport_create.sType = XGL_STRUCTURE_TYPE_DYNAMIC_VP_STATE_CREATE_INFO;
-    viewport_create.viewportCount = 1;
+    viewport_create.viewportAndScissorCount = 1;
     XGL_VIEWPORT viewport;
+    XGL_RECT scissor;
     viewport.height = (float) demo->height;
     viewport.width = (float) demo->width;
     viewport.minDepth = (float) 0.0f;
     viewport.maxDepth = (float) 1.0f;
+    scissor.extent.width = demo->width;
+    scissor.extent.height = demo->height;
+    scissor.offset.x = 0;
+    scissor.offset.y = 0;
     viewport_create.pViewports = &viewport;
+    viewport_create.pScissors = &scissor;
 
     memset(&raster, 0, sizeof(raster));
     raster.sType = XGL_STRUCTURE_TYPE_DYNAMIC_RS_STATE_CREATE_INFO;
diff --git a/demos/tri.c b/demos/tri.c
index 74ba895..3cfb86d 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -757,7 +757,6 @@
 
     memset(&vp, 0, sizeof(vp));
     vp.sType = XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO;
-    vp.scissorEnable = XGL_FALSE;
 
 
     memset(&ds, 0, sizeof(ds));
@@ -817,14 +816,20 @@
 
     memset(&viewport_create, 0, sizeof(viewport_create));
     viewport_create.sType = XGL_STRUCTURE_TYPE_DYNAMIC_VP_STATE_CREATE_INFO;
-    viewport_create.viewportCount = 1;
+    viewport_create.viewportAndScissorCount = 1;
     XGL_VIEWPORT viewport;
+    XGL_RECT scissor;
     memset(&viewport, 0, sizeof(viewport));
-    viewport.width = (float) demo->width;
     viewport.height = (float) demo->height;
+    viewport.width = (float) demo->width;
     viewport.minDepth = (float) 0.0f;
     viewport.maxDepth = (float) 1.0f;
+    scissor.extent.width = demo->width;
+    scissor.extent.height = demo->height;
+    scissor.offset.x = 0;
+    scissor.offset.y = 0;
     viewport_create.pViewports = &viewport;
+    viewport_create.pScissors = &scissor;
 
     memset(&raster, 0, sizeof(raster));
     raster.sType = XGL_STRUCTURE_TYPE_DYNAMIC_RS_STATE_CREATE_INFO;
diff --git a/glave-generate.py b/glave-generate.py
index a136cec..a1c7cc1 100755
--- a/glave-generate.py
+++ b/glave-generate.py
@@ -479,9 +479,8 @@
                         func_body.append('    customSize = calculate_begin_cmdbuf_size(pBeginInfo->pNext);')
                         func_body.append('    CREATE_TRACE_PACKET(xglBeginCommandBuffer, sizeof(XGL_CMD_BUFFER_BEGIN_INFO) + customSize);')
                     elif 'CreateDynamicViewportState' == proto.name:
-                        func_body.append('    uint32_t vpCount = (pCreateInfo != NULL && pCreateInfo->pViewports != NULL) ? pCreateInfo->viewportCount : 0;')
-                        func_body.append('    uint32_t scCount = (pCreateInfo != NULL && pCreateInfo->pScissors != NULL) ? pCreateInfo->scissorCount : 0;')
-                        func_body.append('    customSize = vpCount * sizeof(XGL_VIEWPORT) + scCount * sizeof(XGL_RECT);')
+                        func_body.append('    uint32_t vpsCount = (pCreateInfo != NULL && pCreateInfo->pViewports != NULL) ? pCreateInfo->viewportAndScissorCount : 0;')
+                        func_body.append('    customSize = vpsCount * sizeof(XGL_VIEWPORT) + vpsCount * sizeof(XGL_RECT);')
                         func_body.append('    CREATE_TRACE_PACKET(xglCreateDynamicViewportState,  sizeof(XGL_DYNAMIC_VP_STATE_CREATE_INFO) + sizeof(XGL_DYNAMIC_VP_STATE_OBJECT) + customSize);')
                     elif 'AllocMemory' == proto.name:
                         func_body.append('    customSize = calculate_alloc_memory_size(pAllocInfo->pNext);')
@@ -585,8 +584,8 @@
                         elif 'BeginCommandBuffer' == proto.name:
                             func_body.append('    add_begin_cmdbuf_to_trace_packet(pHeader, (void**)&(pPacket->pBeginInfo->pNext), pBeginInfo->pNext);')
                         elif 'CreateDynamicViewportState' == proto.name:
-                            func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pViewports), vpCount * sizeof(XGL_VIEWPORT), pCreateInfo->pViewports);')
-                            func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pScissors), scCount * sizeof(XGL_RECT), pCreateInfo->pScissors);')
+                            func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pViewports), vpsCount * sizeof(XGL_VIEWPORT), pCreateInfo->pViewports);')
+                            func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pScissors), vpsCount * sizeof(XGL_RECT), pCreateInfo->pScissors);')
                             func_body.append('    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pViewports));')
                             func_body.append('    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pScissors));')
                         elif 'AllocMemory' == proto.name:
diff --git a/icd/intel/cmd_pipeline.c b/icd/intel/cmd_pipeline.c
index 2e400de..6e211a2 100644
--- a/icd/intel/cmd_pipeline.c
+++ b/icd/intel/cmd_pipeline.c
@@ -410,6 +410,9 @@
 
     dw2 = pipeline->cmd_sf_cull;
 
+    /* Scissor is always enabled */
+    dw2 |= GEN7_SF_DW2_SCISSOR_ENABLE;
+
     if (pipeline->sample_count > 1) {
           dw2 |= 128 << GEN7_SF_DW2_LINE_WIDTH__SHIFT |
                  GEN7_SF_DW2_MSRASTMODE_ON_PATTERN;
@@ -418,9 +421,6 @@
                  GEN7_SF_DW2_MSRASTMODE_OFF_PIXEL;
     }
 
-    if (pipeline->scissor_enable)
-        dw2 |= GEN7_SF_DW2_SCISSOR_ENABLE;
-
     /* in U8.3 */
     point_width = (int) (raster->rs_info.pointSize * 8.0f + 0.5f);
     point_width = U_CLAMP(point_width, 1, 2047);
@@ -1307,8 +1307,7 @@
         return;
 
     assert(viewport->cmd_len == (8 + 4 + 2) *
-            viewport->viewport_count + (viewport->has_scissor_rects) ?
-               (viewport->viewport_count * 2) : 0);
+            /* viewports */ viewport->viewport_count + (/* scissor */ viewport->viewport_count * 2));
 
     sf_offset = cmd_state_write(cmd, INTEL_CMD_ITEM_SF_VIEWPORT,
             GEN6_ALIGNMENT_SF_VIEWPORT, 8 * viewport->viewport_count,
@@ -1322,13 +1321,9 @@
             GEN6_ALIGNMENT_SF_VIEWPORT, 2 * viewport->viewport_count,
             &viewport->cmd[viewport->cmd_cc_pos]);
 
-    if (viewport->has_scissor_rects) {
-        scissor_offset = cmd_state_write(cmd, INTEL_CMD_ITEM_SCISSOR_RECT,
-                GEN6_ALIGNMENT_SCISSOR_RECT, 2 * viewport->viewport_count,
-                &viewport->cmd[viewport->cmd_scissor_rect_pos]);
-    } else {
-        scissor_offset = 0;
-    }
+    scissor_offset = cmd_state_write(cmd, INTEL_CMD_ITEM_SCISSOR_RECT,
+            GEN6_ALIGNMENT_SCISSOR_RECT, 2 * viewport->viewport_count,
+            &viewport->cmd[viewport->cmd_scissor_rect_pos]);
 
     gen6_3DSTATE_VIEWPORT_STATE_POINTERS(cmd,
             clip_offset, sf_offset, cc_offset);
@@ -1379,14 +1374,12 @@
 static void gen7_viewport_states(struct intel_cmd *cmd)
 {
     const struct intel_dynamic_vp *viewport = cmd->bind.state.viewport;
-    const struct intel_pipeline *pipeline = cmd->bind.pipeline.graphics;
     uint32_t offset;
 
     if (!viewport)
         return;
 
-    assert(viewport->cmd_len == (16 + 2 + 2 * pipeline->scissor_enable) *
-            viewport->viewport_count);
+    assert(viewport->cmd_len == (16 + 2 + 2) * viewport->viewport_count);
 
     offset = cmd_state_write(cmd, INTEL_CMD_ITEM_SF_VIEWPORT,
             GEN7_ALIGNMENT_SF_CLIP_VIEWPORT, 16 * viewport->viewport_count,
@@ -1402,14 +1395,12 @@
             GEN7_RENDER_OPCODE_3DSTATE_VIEWPORT_STATE_POINTERS_CC,
             offset);
 
-    if (pipeline->scissor_enable) {
-        offset = cmd_state_write(cmd, INTEL_CMD_ITEM_SCISSOR_RECT,
-                GEN6_ALIGNMENT_SCISSOR_RECT, 2 * viewport->viewport_count,
-                &viewport->cmd[viewport->cmd_scissor_rect_pos]);
-        gen7_3dstate_pointer(cmd,
-                GEN6_RENDER_OPCODE_3DSTATE_SCISSOR_STATE_POINTERS,
-                offset);
-    }
+    offset = cmd_state_write(cmd, INTEL_CMD_ITEM_SCISSOR_RECT,
+                             GEN6_ALIGNMENT_SCISSOR_RECT, 2 * viewport->viewport_count,
+                             &viewport->cmd[viewport->cmd_scissor_rect_pos]);
+    gen7_3dstate_pointer(cmd,
+                         GEN6_RENDER_OPCODE_3DSTATE_SCISSOR_STATE_POINTERS,
+                         offset);
 }
 
 static void gen6_pcb(struct intel_cmd *cmd, int subop,
diff --git a/icd/intel/pipeline.c b/icd/intel/pipeline.c
index 184989e..95de6c0 100644
--- a/icd/intel/pipeline.c
+++ b/icd/intel/pipeline.c
@@ -1262,8 +1262,6 @@
         pipeline->tess_state = info->tess;
     }
 
-    pipeline->scissor_enable = info->vp.scissorEnable;
-
     return ret;
 }
 
diff --git a/icd/intel/pipeline.h b/icd/intel/pipeline.h
index b1f4c14..5983f9c 100644
--- a/icd/intel/pipeline.h
+++ b/icd/intel/pipeline.h
@@ -194,7 +194,6 @@
     // XGL_PIPELINE_RS_STATE_CREATE_INFO rs_state;
     bool depthClipEnable;
     bool rasterizerDiscardEnable;
-    bool scissor_enable;
 
     XGL_PIPELINE_TESS_STATE_CREATE_INFO tess_state;
 
diff --git a/icd/intel/state.c b/icd/intel/state.c
index c40211b..5fe0cd3 100644
--- a/icd/intel/state.c
+++ b/icd/intel/state.c
@@ -96,31 +96,26 @@
 {
     INTEL_GPU_ASSERT(gpu, 6, 7.5);
 
-    state->viewport_count = info->viewportCount;
-    state->has_scissor_rects = (info->scissorCount > 0);
+    state->viewport_count = info->viewportAndScissorCount;
 
-    assert(info->viewportCount < INTEL_MAX_RENDER_TARGETS);
-    assert(info->scissorCount < INTEL_MAX_RENDER_TARGETS);
-    assert(!state->has_scissor_rects || info->scissorCount == info->viewportCount);
+    assert(info->viewportAndScissorCount < INTEL_MAX_RENDER_TARGETS);
 
     if (intel_gpu_gen(gpu) >= INTEL_GEN(7)) {
-        state->cmd_len = 16 * info->viewportCount;
+        state->cmd_len = 16 * info->viewportAndScissorCount;
 
         state->cmd_clip_pos = 8;
     } else {
-        state->cmd_len = 8 * info->viewportCount;
+        state->cmd_len = 8 * info->viewportAndScissorCount;
 
         state->cmd_clip_pos = state->cmd_len;
-        state->cmd_len += 4 * info->viewportCount;
+        state->cmd_len += 4 * info->viewportAndScissorCount;
     }
 
     state->cmd_cc_pos = state->cmd_len;
-    state->cmd_len += 2 * info->viewportCount;
+    state->cmd_len += 2 * info->viewportAndScissorCount;
 
-    if (state->has_scissor_rects) {
-        state->cmd_scissor_rect_pos = state->cmd_len;
-        state->cmd_len += 2 * info->viewportCount;
-    }
+    state->cmd_scissor_rect_pos = state->cmd_len;
+    state->cmd_len += 2 * info->viewportAndScissorCount;
 
     state->cmd = icd_alloc(sizeof(uint32_t) * state->cmd_len,
             0, XGL_SYSTEM_ALLOC_INTERNAL);
@@ -152,7 +147,7 @@
     cc_viewport = state->cmd + state->cmd_cc_pos;
     scissor_rect = state->cmd + state->cmd_scissor_rect_pos;
 
-    for (i = 0; i < info->viewportCount; i++) {
+    for (i = 0; i < info->viewportAndScissorCount; i++) {
         const XGL_VIEWPORT *viewport = &info->pViewports[i];
         uint32_t *dw = NULL;
         float translate[3], scale[3];
@@ -195,7 +190,7 @@
         cc_viewport += 2;
     }
 
-    for (i = 0; i < info->scissorCount; i++) {
+    for (i = 0; i < info->viewportAndScissorCount; i++) {
         const XGL_RECT *scissor = &info->pScissors[i];
         /* SCISSOR_RECT */
         int16_t max_x, max_y;
diff --git a/icd/intel/state.h b/icd/intel/state.h
index e41f9dd..67e3410 100644
--- a/icd/intel/state.h
+++ b/icd/intel/state.h
@@ -37,7 +37,6 @@
     struct intel_obj obj;
 
     uint32_t viewport_count;
-    bool has_scissor_rects;
     /* SF_CLIP_VIEWPORTs, CC_VIEWPORTs, and SCISSOR_RECTs */
     uint32_t *cmd;
     uint32_t cmd_len;
diff --git a/include/xgl.h b/include/xgl.h
index 968ab23..e27b910 100644
--- a/include/xgl.h
+++ b/include/xgl.h
@@ -33,7 +33,7 @@
 #include "xglPlatform.h"
 
 // XGL API version supported by this file
-#define XGL_API_VERSION XGL_MAKE_VERSION(0, 47, 1)
+#define XGL_API_VERSION XGL_MAKE_VERSION(0, 48, 1)
 
 #ifdef __cplusplus
 extern "C"
@@ -1919,7 +1919,6 @@
     XGL_STRUCTURE_TYPE                      sType;      // Must be XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO
     const void*                             pNext;      // Pointer to next structure
     uint32_t                                numViewports;
-    uint32_t                                scissorEnable;
     XGL_COORDINATE_ORIGIN                   clipOrigin;                 // optional (GL45)
     XGL_DEPTH_MODE                          depthMode;                  // optional (GL45)
 } XGL_PIPELINE_VP_STATE_CREATE_INFO;
@@ -2033,9 +2032,8 @@
 {
     XGL_STRUCTURE_TYPE                      sType;      // Must be XGL_STRUCTURE_TYPE_DYNAMIC_VP_STATE_CREATE_INFO
     const void*                             pNext;      // Pointer to next structure
-    uint32_t                                viewportCount;  // number of entries in pViewports
+    uint32_t                                viewportAndScissorCount;  // number of entries in pViewports and pScissors
     const XGL_VIEWPORT*                     pViewports;
-    uint32_t                                scissorCount;   // number of entries in pScissors
     const XGL_RECT*                         pScissors;
 } XGL_DYNAMIC_VP_STATE_CREATE_INFO;
 
diff --git a/layers/draw_state.c b/layers/draw_state.c
index c07367f..0fa5b7c 100644
--- a/layers/draw_state.c
+++ b/layers/draw_state.c
@@ -293,13 +293,13 @@
     if (XGL_STRUCTURE_TYPE_DYNAMIC_VP_STATE_CREATE_INFO == pCreateInfo->sType) {
         XGL_DYNAMIC_VP_STATE_CREATE_INFO* pVPCI = (XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pStateNode->pCreateInfo;
         XGL_VIEWPORT** ppViewports = (XGL_VIEWPORT**)&pVPCI->pViewports;
-        size_t vpSize = sizeof(XGL_VIEWPORT) * pVPCI->viewportCount;
+        size_t vpSize = sizeof(XGL_VIEWPORT) * pVPCI->viewportAndScissorCount;
         if (vpSize) {
             *ppViewports = (XGL_VIEWPORT*)malloc(vpSize);
             memcpy(*ppViewports, ((XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pCreateInfo)->pViewports, vpSize);
         }
         XGL_RECT** ppScissors = (XGL_RECT**)&pVPCI->pScissors;
-        size_t scSize = sizeof(XGL_RECT) * pVPCI->scissorCount;
+        size_t scSize = sizeof(XGL_RECT) * pVPCI->viewportAndScissorCount;
         if (scSize) {
             *ppScissors = (XGL_RECT*)malloc(scSize);
             memcpy(*ppScissors, ((XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pCreateInfo)->pScissors, scSize);
diff --git a/tests/xglrenderframework.cpp b/tests/xglrenderframework.cpp
index e8ce14d..9fc0786 100644
--- a/tests/xglrenderframework.cpp
+++ b/tests/xglrenderframework.cpp
@@ -121,18 +121,23 @@
     XGL_RESULT err;
 
     XGL_VIEWPORT viewport;
+    XGL_RECT scissor;
 
     XGL_DYNAMIC_VP_STATE_CREATE_INFO viewportCreate = {};
     viewportCreate.sType = XGL_STRUCTURE_TYPE_DYNAMIC_VP_STATE_CREATE_INFO;
-    viewportCreate.viewportCount         = 1;
-    viewportCreate.scissorCount          = 0;
+    viewportCreate.viewportAndScissorCount         = 1;
     viewport.originX  = 0;
     viewport.originY  = 0;
     viewport.width    = 1.f * width;
     viewport.height   = 1.f * height;
     viewport.minDepth = 0.f;
     viewport.maxDepth = 1.f;
+    scissor.extent.width = width;
+    scissor.extent.height = height;
+    scissor.offset.x = 0;
+    scissor.offset.y = 0;
     viewportCreate.pViewports = &viewport;
+    viewportCreate.pScissors = &scissor;
 
     err = xglCreateDynamicViewportState( device(), &viewportCreate, &m_stateViewport );
     ASSERT_XGL_SUCCESS( err );