swr/rast: Split rasterizer.cpp to improve compile time
Hardcode split to four files currently. Decreases swr build time on KNL by over 50%. Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
This commit is contained in:
parent
5eecaca911
commit
0cc7c46cf4
|
@ -67,7 +67,12 @@ BUILT_SOURCES = \
|
|||
rasterizer/core/backends/gen_BackendPixelRate1.cpp \
|
||||
rasterizer/core/backends/gen_BackendPixelRate2.cpp \
|
||||
rasterizer/core/backends/gen_BackendPixelRate3.cpp \
|
||||
rasterizer/core/backends/gen_BackendPixelRate.hpp
|
||||
rasterizer/core/backends/gen_BackendPixelRate.hpp \
|
||||
rasterizer/core/backends/gen_rasterizer0.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer1.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer2.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer3.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer.hpp
|
||||
|
||||
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
|
||||
PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
|
||||
|
@ -173,6 +178,35 @@ backend.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/temp
|
|||
--cpp \
|
||||
--hpp
|
||||
|
||||
rasterizer/core/backends/gen_rasterizer0.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer1.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer2.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer3.cpp \
|
||||
rasterizer/core/backends/gen_rasterizer.hpp: \
|
||||
rasterizer.intermediate
|
||||
|
||||
# 5 SWR_MULTISAMPLE_TYPE_COUNT
|
||||
# 2 CenterPattern
|
||||
# 2 Conservative
|
||||
# 3 SWR_INPUT_COVERAGE_COUNT
|
||||
# 5 STATE_VALID_TRI_EDGE_COUNT
|
||||
# 2 RasterScissorEdges
|
||||
|
||||
# use intermediate rule to tell make that all files can be
|
||||
# generated in one invocation of gen_backends.py (prevents
|
||||
# parallel make race condition)
|
||||
.INTERMEDIATE: rasterizer.intermediate
|
||||
rasterizer.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/gen_rasterizer.cpp rasterizer/codegen/templates/gen_header_init.hpp
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) \
|
||||
$(srcdir)/rasterizer/codegen/gen_backends.py \
|
||||
--outdir rasterizer/core/backends \
|
||||
--rast \
|
||||
--dim 5 2 2 3 5 2 \
|
||||
--numfiles 4 \
|
||||
--cpp \
|
||||
--hpp
|
||||
|
||||
COMMON_LIBADD = \
|
||||
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
|
||||
$(top_builddir)/src/mesa/libmesagallium.la \
|
||||
|
@ -247,4 +281,5 @@ EXTRA_DIST = \
|
|||
rasterizer/codegen/templates/gen_builder.hpp \
|
||||
rasterizer/codegen/templates/gen_header_init.hpp \
|
||||
rasterizer/codegen/templates/gen_knobs.cpp \
|
||||
rasterizer/codegen/templates/gen_llvm.hpp
|
||||
rasterizer/codegen/templates/gen_llvm.hpp \
|
||||
rasterizer/codegen/templates/gen_rasterizer.cpp
|
||||
|
|
|
@ -95,12 +95,12 @@ CORE_CXX_SOURCES := \
|
|||
rasterizer/core/frontend.h \
|
||||
rasterizer/core/knobs.h \
|
||||
rasterizer/core/knobs_init.h \
|
||||
rasterizer/core/multisample.cpp \
|
||||
rasterizer/core/multisample.h \
|
||||
rasterizer/core/pa_avx.cpp \
|
||||
rasterizer/core/pa.h \
|
||||
rasterizer/core/rasterizer.cpp \
|
||||
rasterizer/core/rasterizer.h \
|
||||
rasterizer/core/rasterizer_impl.h \
|
||||
rasterizer/core/rdtsc_core.cpp \
|
||||
rasterizer/core/rdtsc_core.h \
|
||||
rasterizer/core/ringbuffer.h \
|
||||
|
|
|
@ -156,6 +156,28 @@ Depends(backendPixelRateFiles,
|
|||
'rasterizer/codegen/gen_knobs.h']
|
||||
)
|
||||
|
||||
# 5 SWR_MULTISAMPLE_TYPE_COUNT
|
||||
# 2 CenterPattern
|
||||
# 2 Conservative
|
||||
# 3 SWR_INPUT_COVERAGE_COUNT
|
||||
# 5 STATE_VALID_TRI_EDGE_COUNT
|
||||
# 2 RasterScissorEdges
|
||||
genRasterizerFileCount = 4
|
||||
genRasterizerFilePat = "rasterizer/core/backends/gen_rasterizer%s.cpp"
|
||||
genRasterizerFiles = map(lambda x: genRasterizerFilePat % x,
|
||||
range(0, genRasterizerFileCount))
|
||||
env.CodeGenerate(
|
||||
target = 'rasterizer/core/backends/gen_rasterizer.hpp',
|
||||
script = swrroot + 'rasterizer/codegen/gen_backends.py',
|
||||
source = '',
|
||||
command = python_cmd + ' $SCRIPT --outdir ' + bldroot + '/rasterizer/core/backends --rast --dim 5 2 2 3 5 2 --numfiles ' + str(genRasterizerFileCount) + ' --cpp --hpp'
|
||||
)
|
||||
Depends(genRasterizerFiles,
|
||||
['rasterizer/core/backends/gen_rasterizer.hpp',
|
||||
'rasterizer/archrast/gen_ar_event.hpp',
|
||||
'rasterizer/codegen/gen_knobs.h']
|
||||
)
|
||||
|
||||
Depends('rasterizer/jitter/gen_state_llvm.h',
|
||||
swrroot + 'rasterizer/codegen/templates/gen_backend.cpp')
|
||||
|
||||
|
@ -165,7 +187,7 @@ built_sources = [
|
|||
'rasterizer/archrast/gen_ar_event.cpp',
|
||||
]
|
||||
|
||||
built_sources += backendPixelRateFiles
|
||||
built_sources += [backendPixelRateFiles, genRasterizerFiles]
|
||||
|
||||
source = built_sources
|
||||
source += env.ParseSourceList(swrroot + 'Makefile.sources', [
|
||||
|
|
|
@ -39,6 +39,7 @@ def main(args=sys.argv[1:]):
|
|||
parser.add_argument('--cpp', help='Generate cpp file(s)', action='store_true', default=False)
|
||||
parser.add_argument('--hpp', help='Generate hpp file', action='store_true', default=False)
|
||||
parser.add_argument('--cmake', help='Generate cmake file', action='store_true', default=False)
|
||||
parser.add_argument('--rast', help='Generate rasterizer functions instead of normal backend', action='store_true', default=False)
|
||||
|
||||
args = parser.parse_args(args)
|
||||
|
||||
|
@ -55,6 +56,17 @@ def main(args=sys.argv[1:]):
|
|||
self.cmakeSrcVar = 'GEN_BACKEND_SOURCES'
|
||||
self.tableName = 'BackendPixelRate'
|
||||
|
||||
if args.rast:
|
||||
self.outFileName = 'gen_rasterizer%s.cpp'
|
||||
self.outHeaderName = 'gen_rasterizer.hpp'
|
||||
self.functionTableName = 'gRasterizerFuncs'
|
||||
self.funcInstanceHeader = ' = RasterizeTriangle<RasterizerTraits<'
|
||||
self.template = 'gen_rasterizer.cpp'
|
||||
self.cmakeFileName = 'gen_rasterizer.cmake'
|
||||
self.cmakeSrcVar = 'GEN_RASTERIZER_SOURCES'
|
||||
self.tableName = 'RasterizerFuncs'
|
||||
|
||||
|
||||
backend = backendStrs()
|
||||
|
||||
output_list = []
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
//============================================================================
|
||||
// Copyright (C) 2017 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.
|
||||
//
|
||||
// @file gen_rasterizer${fileNum}.cpp
|
||||
//
|
||||
// @brief auto-generated file
|
||||
//
|
||||
// DO NOT EDIT
|
||||
//
|
||||
// Generation Command Line:
|
||||
// ${'\n// '.join(cmdline)}
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
#include "core/rasterizer.h"
|
||||
#include "core/rasterizer_impl.h"
|
||||
|
||||
void InitRasterizerFuncs${fileNum}()
|
||||
{
|
||||
%for func in funcList:
|
||||
${func}
|
||||
%endfor
|
||||
}
|
|
@ -1651,6 +1651,7 @@ void SwrInit()
|
|||
|
||||
InitClearTilesTable();
|
||||
InitBackendFuncTables();
|
||||
InitRasterizerFunctions();
|
||||
}
|
||||
|
||||
void SwrGetInterface(SWR_INTERFACE &out_funcs)
|
||||
|
|
|
@ -1,48 +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.
|
||||
*
|
||||
* @file multisample.cpp
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "multisample.h"
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_1X>::samplePosXi[1];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_1X>::samplePosYi[1];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_2X>::samplePosXi[2];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_2X>::samplePosYi[2];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_4X>::samplePosXi[4];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_4X>::samplePosYi[4];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_8X>::samplePosXi[8];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_8X>::samplePosYi[8];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_16X>::samplePosXi[16];
|
||||
constexpr uint32_t MultisampleTraits<SWR_MULTISAMPLE_16X>::samplePosYi[16];
|
||||
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_1X>::samplePosX[1];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_1X>::samplePosY[1];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_2X>::samplePosX[2];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_2X>::samplePosY[2];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_4X>::samplePosX[4];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_4X>::samplePosY[4];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_8X>::samplePosX[8];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_8X>::samplePosY[8];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_16X>::samplePosX[16];
|
||||
constexpr float MultisampleTraits<SWR_MULTISAMPLE_16X>::samplePosY[16];
|
File diff suppressed because it is too large
Load Diff
|
@ -35,6 +35,7 @@
|
|||
void RasterizeLine(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
|
||||
void RasterizeSimplePoint(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
|
||||
void RasterizeTriPoint(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
|
||||
void InitRasterizerFunctions();
|
||||
|
||||
INLINE
|
||||
__m128i fpToFixedPoint(const __m128 vIn)
|
||||
|
@ -43,15 +44,6 @@ __m128i fpToFixedPoint(const __m128 vIn)
|
|||
return _mm_cvtps_epi32(vFixed);
|
||||
}
|
||||
|
||||
// Selector for correct templated RasterizeTriangle function
|
||||
PFN_WORK_FUNC GetRasterizerFunc(
|
||||
uint32_t numSamples,
|
||||
bool IsCenter,
|
||||
bool IsConservative,
|
||||
uint32_t InputCoverage,
|
||||
uint32_t EdgeEnable,
|
||||
bool RasterizeScissorEdges);
|
||||
|
||||
enum TriEdgesStates
|
||||
{
|
||||
STATE_NO_VALID_EDGES = 0,
|
||||
|
@ -72,6 +64,15 @@ enum TriEdgesValues
|
|||
VALID_TRI_EDGE_COUNT,
|
||||
};
|
||||
|
||||
// Selector for correct templated RasterizeTriangle function
|
||||
PFN_WORK_FUNC GetRasterizerFunc(
|
||||
SWR_MULTISAMPLE_COUNT numSamples,
|
||||
bool IsCenter,
|
||||
bool IsConservative,
|
||||
SWR_INPUT_COVERAGE InputCoverage,
|
||||
uint32_t EdgeEnable,
|
||||
bool RasterizeScissorEdges);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ValidTriEdges convenience typedefs used for templated function
|
||||
/// specialization supported Fixed Point precisions
|
||||
|
@ -173,7 +174,7 @@ struct RasterEdgeTraits<std::false_type, std::false_type, EdgeMaskT>
|
|||
/// (only used with conservative rasterization)
|
||||
/// @tparam RasterScissorEdgesT: do we need to rasterize with a scissor?
|
||||
template <typename NumSamplesT, typename CenterPatternT, typename ConservativeT, typename InputCoverageT, typename EdgeEnableT, typename RasterScissorEdgesT>
|
||||
struct RasterizerTraits final : public ConservativeRastBETraits<ConservativeT, InputCoverageT>,
|
||||
struct _RasterizerTraits : public ConservativeRastBETraits<ConservativeT, InputCoverageT>,
|
||||
public RasterEdgeTraits<RasterScissorEdgesT, ConservativeT, EdgeEnableT>
|
||||
{
|
||||
typedef MultisampleTraits<static_cast<SWR_MULTISAMPLE_COUNT>(NumSamplesT::value), CenterPatternT::value> MT;
|
||||
|
@ -197,3 +198,13 @@ struct RasterizerTraits final : public ConservativeRastBETraits<ConservativeT, I
|
|||
static const int depthRasterTileRowStep{(KNOB_MACROTILE_X_DIM / KNOB_TILE_X_DIM)* depthRasterTileStep};
|
||||
static const int stencilRasterTileRowStep{(KNOB_MACROTILE_X_DIM / KNOB_TILE_X_DIM) * stencilRasterTileStep};
|
||||
};
|
||||
|
||||
template <uint32_t NumSamplesT, uint32_t CenterPatternT, uint32_t ConservativeT, uint32_t InputCoverageT, uint32_t EdgeEnableT, uint32_t RasterScissorEdgesT>
|
||||
struct RasterizerTraits final : public _RasterizerTraits <
|
||||
std::integral_constant<uint32_t, NumSamplesT>,
|
||||
std::integral_constant<bool, CenterPatternT != 0>,
|
||||
std::integral_constant<bool, ConservativeT != 0>,
|
||||
std::integral_constant<uint32_t, InputCoverageT>,
|
||||
std::integral_constant<uint32_t, EdgeEnableT>,
|
||||
std::integral_constant<bool, RasterScissorEdgesT != 0> >
|
||||
{};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue