From 1710d8d2cd8b73668c19bec9cad34e40b2aa68f8 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Wed, 11 Feb 2015 14:13:34 -0700 Subject: [PATCH] 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. --- demos/cube.c | 9 +++++++-- demos/tri.c | 11 ++++++++--- glave-generate.py | 9 ++++----- include/xgl.h | 6 ++---- layers/draw_state.c | 4 ++-- 5 files changed, 23 insertions(+), 16 deletions(-) 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 @@ static void demo_prepare_pipeline(struct demo *demo) 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 @@ static void demo_prepare_dynamic_states(struct demo *demo) 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 @@ static void demo_prepare_pipeline(struct demo *demo) 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 @@ static void demo_prepare_dynamic_states(struct demo *demo) 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 @@ class Subcommand(object): 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 @@ class Subcommand(object): 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/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 @@ typedef struct _XGL_PIPELINE_VP_STATE_CREATE_INFO 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 @@ typedef struct _XGL_DYNAMIC_VP_STATE_CREATE_INFO { 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 @@ static void insertDynamicState(const XGL_DYNAMIC_STATE_OBJECT state, const GENER 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); -- 2.7.4