[Mesa-dev] [PATCH 6/6] swr: [rasterizer] remove containers.hpp

Tim Rowley timothy.o.rowley at intel.com
Fri May 20 16:58:59 UTC 2016


---
 src/gallium/drivers/swr/Makefile.sources           |   1 -
 .../drivers/swr/rasterizer/common/containers.hpp   | 208 ---------------------
 .../drivers/swr/rasterizer/jitter/JitManager.cpp   |   1 -
 .../drivers/swr/rasterizer/jitter/blend_jit.cpp    |   1 -
 .../drivers/swr/rasterizer/jitter/fetch_jit.cpp    |   4 +-
 .../swr/rasterizer/jitter/streamout_jit.cpp        |   1 -
 6 files changed, 1 insertion(+), 215 deletions(-)
 delete mode 100644 src/gallium/drivers/swr/rasterizer/common/containers.hpp

diff --git a/src/gallium/drivers/swr/Makefile.sources b/src/gallium/drivers/swr/Makefile.sources
index 7e28f50..eb05c6f 100644
--- a/src/gallium/drivers/swr/Makefile.sources
+++ b/src/gallium/drivers/swr/Makefile.sources
@@ -45,7 +45,6 @@ CXX_SOURCES := \
 	swr_query.cpp
 
 COMMON_CXX_SOURCES := \
-	rasterizer/common/containers.hpp \
 	rasterizer/common/formats.cpp \
 	rasterizer/common/formats.h \
 	rasterizer/common/isa.hpp \
diff --git a/src/gallium/drivers/swr/rasterizer/common/containers.hpp b/src/gallium/drivers/swr/rasterizer/common/containers.hpp
deleted file mode 100644
index f3c0597..0000000
--- a/src/gallium/drivers/swr/rasterizer/common/containers.hpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-* Copyright (C) 2014-2015 Intel Corporation.   All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-* IN THE SOFTWARE.
-****************************************************************************/
-
-#ifndef SWRLIB_CONTAINERS_HPP__
-#define SWRLIB_CONTAINERS_HPP__
-
-#include <functional>
-#include "common/os.h"
-
-namespace SWRL
-{
-
-template <typename T, int NUM_ELEMENTS>
-struct UncheckedFixedVector
-{
-    UncheckedFixedVector() : mSize(0)
-    {
-    }
-
-    UncheckedFixedVector(std::size_t size, T const& exemplar)
-    {
-        this->mSize = 0;
-        for (std::size_t i = 0; i < size; ++i)
-            this->push_back(exemplar);
-    }
-
-    template <typename Iter>
-    UncheckedFixedVector(Iter fst, Iter lst)
-    {
-        this->mSize = 0;
-        for ( ; fst != lst; ++fst)
-            this->push_back(*fst);
-    }
-
-    UncheckedFixedVector(UncheckedFixedVector const& UFV)
-    {
-        this->mSize = 0;
-        for (std::size_t i = 0, N = UFV.size(); i < N; ++i)
-            (*this)[i] = UFV[i];
-        this->mSize = UFV.size();
-    }
-
-    UncheckedFixedVector& operator=(UncheckedFixedVector const& UFV)
-    {
-        for (std::size_t i = 0, N = UFV.size(); i < N; ++i)
-            (*this)[i] = UFV[i];
-        this->mSize = UFV.size();
-        return *this;
-    }
-
-    T* begin()  { return &this->mElements[0]; }
-    T* end()    { return &this->mElements[0] + this->mSize; }
-    T const* begin() const  { return &this->mElements[0]; }
-    T const* end() const    { return &this->mElements[0] + this->mSize; }
-
-    friend bool operator==(UncheckedFixedVector const& L, UncheckedFixedVector const& R)
-    {
-        if (L.size() != R.size()) return false;
-        for (std::size_t i = 0, N = L.size(); i < N; ++i)
-        {
-            if (L[i] != R[i]) return false;
-        }
-        return true;
-    }
-
-    friend bool operator!=(UncheckedFixedVector const& L, UncheckedFixedVector const& R)
-    {
-        if (L.size() != R.size()) return true;
-        for (std::size_t i = 0, N = L.size(); i < N; ++i)
-        {
-            if (L[i] != R[i]) return true;
-        }
-        return false;
-    }
-
-    T& operator[](std::size_t idx)
-    {
-        return this->mElements[idx];
-    }
-    T const& operator[](std::size_t idx) const
-    {
-        return this->mElements[idx];
-    }
-    void push_back(T const& t)
-    {
-        this->mElements[this->mSize]    = t;
-        ++this->mSize;
-    }
-    void pop_back()
-    {
-        SWR_ASSERT(this->mSize > 0);
-        --this->mSize;
-    }
-    T& back()
-    {
-        return this->mElements[this->mSize-1];
-    }
-    T const& back() const
-    {
-        return this->mElements[this->mSize-1];
-    }
-    bool empty() const
-    {
-        return this->mSize == 0;
-    }
-    std::size_t size() const
-    {
-        return this->mSize;
-    }
-    void resize(std::size_t sz)
-    {
-        this->mSize = sz;
-    }
-    void clear()
-    {
-        this->resize(0);
-    }
-private:
-    std::size_t    mSize{ 0 };
-    T mElements[NUM_ELEMENTS];
-};
-
-template <typename T, int NUM_ELEMENTS>
-struct FixedStack : UncheckedFixedVector<T, NUM_ELEMENTS>
-{
-    FixedStack() {}
-
-    void push(T const& t)
-    {
-        this->push_back(t);
-    }
-
-    void pop()
-    {
-        this->pop_back();
-    }
-
-    T& top()
-    {
-        return this->back();
-    }
-
-    T const& top() const
-    {
-        return this->back();
-    }
-};
-
-template <typename T>
-struct CRCHash
-{
-    static_assert((sizeof(T) % sizeof(UINT)) == 0, "CRCHash expects templated type size is even multiple of 4B");
-    UINT operator()(const T& k) const
-    {
-        UINT *pData = (UINT*)&k;
-        UINT crc = 0;
-        for (UINT i = 0; i < sizeof(T) / sizeof(UINT); ++i)
-        {
-            crc = _mm_crc32_u32(crc, pData[i]);
-        }
-        return crc;
-    }
-};
-
-}// end SWRL
-
-namespace std
-{
-
-template <typename T, int N>
-struct hash<SWRL::UncheckedFixedVector<T, N>>
-{
-    size_t operator() (SWRL::UncheckedFixedVector<T, N> const& v) const
-    {
-        if (v.size() == 0) return 0;
-        std::hash<T> H;
-        size_t x = H(v[0]);
-        if (v.size() == 1) return x;
-        for (size_t i = 1; i < v.size(); ++i)
-            x ^= H(v[i]) + 0x9e3779b9 + (x<<6) + (x>>2);
-        return x;
-    }
-};
-
-
-}// end std.
-
-#endif//SWRLIB_CONTAINERS_HPP__
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index d6755ed..4bbd9ad 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -54,7 +54,6 @@
 #endif
 
 #include "core/state.h"
-#include "common/containers.hpp"
 
 #include "state_llvm.h"
 
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
index a64f860..1b5290c 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
@@ -31,7 +31,6 @@
 #include "blend_jit.h"
 #include "builder.h"
 #include "state_llvm.h"
-#include "common/containers.hpp"
 #include "llvm/IR/DataLayout.h"
 
 #include <sstream>
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 0b805bc..71f1a3a 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -31,7 +31,6 @@
 #include "fetch_jit.h"
 #include "builder.h"
 #include "state_llvm.h"
-#include "common/containers.hpp"
 #include "llvm/IR/DataLayout.h"
 #include <sstream>
 #include <tuple>
@@ -236,8 +235,7 @@ void FetchJit::JitLoadVertices(const FETCH_COMPILE_STATE &fetchState, Value* fet
 {
     // Zack shuffles; a variant of the Charleston.
 
-    SWRL::UncheckedFixedVector<Value*, 16>    vectors;
-
+    std::vector<Value*> vectors(16);
     std::vector<Constant*>    pMask(mVWidth);
     for(uint32_t i = 0; i < mVWidth; ++i)
     {
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
index 36baa8d..d3ac298 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
@@ -31,7 +31,6 @@
 #include "streamout_jit.h"
 #include "builder.h"
 #include "state_llvm.h"
-#include "common/containers.hpp"
 #include "llvm/IR/DataLayout.h"
 
 #include <sstream>
-- 
1.9.1



More information about the mesa-dev mailing list