swr: [rasterizer core] remove driverType
authorTim Rowley <timothy.o.rowley@intel.com>
Thu, 10 Nov 2016 00:24:20 +0000 (18:24 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Mon, 14 Nov 2016 15:03:10 +0000 (09:03 -0600)
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/api.h
src/gallium/drivers/swr/rasterizer/core/context.h
src/gallium/drivers/swr/rasterizer/core/state.h
src/gallium/drivers/swr/swr_context.cpp

index 3c41aecf9b046721481c3709a2d586b122435457..7e305dafe777c341a197a3e60fab9ffbbd4e1bf6 100644 (file)
@@ -73,7 +73,6 @@ HANDLE SwrCreateContext(
     memset(pContextMem, 0, sizeof(SWR_CONTEXT));
     SWR_CONTEXT *pContext = new (pContextMem) SWR_CONTEXT();
 
-    pContext->driverType = pCreateInfo->driver;
     pContext->privateStateSize = pCreateInfo->privateStateSize;
 
     pContext->dcRing.Init(KNOB_MAX_DRAWS_IN_FLIGHT);
@@ -715,43 +714,8 @@ void SwrSetViewports(
     API_STATE* pState = GetDrawState(pContext);
 
     memcpy(&pState->vp[0], pViewports, sizeof(SWR_VIEWPORT) * numViewports);
-
-    if (pMatrices != nullptr)
-    {
-        // @todo Faster to copy portions of the SOA or just copy all of it?
-        memcpy(&pState->vpMatrices, pMatrices, sizeof(SWR_VIEWPORT_MATRICES));
-    }
-    else
-    {
-        // Compute default viewport transform.
-        for (uint32_t i = 0; i < numViewports; ++i)
-        {
-            if (pContext->driverType == DX)
-            {
-                pState->vpMatrices.m00[i] = pState->vp[i].width / 2.0f;
-                pState->vpMatrices.m11[i] = -pState->vp[i].height / 2.0f;
-                pState->vpMatrices.m22[i] = pState->vp[i].maxZ - pState->vp[i].minZ;
-                pState->vpMatrices.m30[i] = pState->vp[i].x + pState->vpMatrices.m00[i];
-                pState->vpMatrices.m31[i] = pState->vp[i].y - pState->vpMatrices.m11[i];
-                pState->vpMatrices.m32[i] = pState->vp[i].minZ;
-            }
-            else
-            {
-                // Standard, with the exception that Y is inverted.
-                pState->vpMatrices.m00[i] = (pState->vp[i].width - pState->vp[i].x) / 2.0f;
-                pState->vpMatrices.m11[i] = (pState->vp[i].y - pState->vp[i].height) / 2.0f;
-                pState->vpMatrices.m22[i] = (pState->vp[i].maxZ - pState->vp[i].minZ) / 2.0f;
-                pState->vpMatrices.m30[i] = pState->vp[i].x + pState->vpMatrices.m00[i];
-                pState->vpMatrices.m31[i] = pState->vp[i].height + pState->vpMatrices.m11[i];
-                pState->vpMatrices.m32[i] = pState->vp[i].minZ + pState->vpMatrices.m22[i];
-
-                // Now that the matrix is calculated, clip the view coords to screen size.
-                // OpenGL allows for -ve x,y in the viewport.
-                pState->vp[i].x = std::max(pState->vp[i].x, 0.0f);
-                pState->vp[i].y = std::max(pState->vp[i].y, 0.0f);
-            }
-        }
-    }
+    // @todo Faster to copy portions of the SOA or just copy all of it?
+    memcpy(&pState->vpMatrices, pMatrices, sizeof(SWR_VIEWPORT_MATRICES));
 
     updateGuardbands(pState);
 }
index cf4bf688ca1fed8b3268c5eb93e0e14554888b6b..6bebc39d3da52151596d54538b8c9f6b215f3a1d 100644 (file)
@@ -192,8 +192,6 @@ struct SWR_THREADING_INFO
 /////////////////////////////////////////////////////////////////////////
 struct SWR_CREATECONTEXT_INFO
 {
-    DRIVER_TYPE driver;
-
     // External functions (e.g. sampler) need per draw context state.
     // Use SwrGetPrivateContextState() to access private state.
     uint32_t privateStateSize;
index 5eb13651bcd4f1ed99676500661bc419cb3f660c..69be280fc3551596a9b93ffeb052187f3170e84e 100644 (file)
@@ -484,8 +484,6 @@ struct SWR_CONTEXT
     std::condition_variable FifosNotEmpty;
     std::mutex WaitLock;
 
-    DRIVER_TYPE driverType;
-
     uint32_t privateStateSize;
 
     HotTileMgr *pHotTileMgr;
index 062a1defbcc7b6f73f5a6445d407887cb07a3ec4..f6b6ed205ef5ed05365de00d5b9eac4ed83eae40 100644 (file)
 #define SWR_CLEAR_DEPTH      (1 << 1)
 #define SWR_CLEAR_STENCIL    (1 << 2)
 
-enum DRIVER_TYPE
-{
-    DX,
-    GL
-};
-
 //////////////////////////////////////////////////////////////////////////
 /// PRIMITIVE_TOPOLOGY.
 //////////////////////////////////////////////////////////////////////////
index cbc60e0aa0115272ea0e4423d566ccd8d38422ef..6c0782a40d31188760d3f819776baeeb0438c1fc 100644 (file)
@@ -400,7 +400,6 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
 
    SWR_CREATECONTEXT_INFO createInfo;
    memset(&createInfo, 0, sizeof(createInfo));
-   createInfo.driver = GL;
    createInfo.privateStateSize = sizeof(swr_draw_context);
    createInfo.pfnLoadTile = swr_LoadHotTile;
    createInfo.pfnStoreTile = swr_StoreHotTile;