1 /****************************************************************************
2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * @brief Definition of the fetch jitter
29 ******************************************************************************/
32 #include "common/formats.h"
33 #include "core/state.h"
35 //////////////////////////////////////////////////////////////////////////
36 /// INPUT_ELEMENT_DESC
37 //////////////////////////////////////////////////////////////////////////
38 struct INPUT_ELEMENT_DESC
44 uint32_t AlignedByteOffset
: 12;
46 uint32_t StreamIndex
: 6;
47 uint32_t InstanceEnable
: 1;
48 uint32_t ComponentControl0
: 3;
49 uint32_t ComponentControl1
: 3;
50 uint32_t ComponentControl2
: 3;
51 uint32_t ComponentControl3
: 3;
52 uint32_t ComponentPacking
: 4;
53 uint32_t _reserved
: 19;
57 uint32_t InstanceDataStepRate
;
60 // used to set ComponentPacking
92 //////////////////////////////////////////////////////////////////////////
93 /// State required for fetch shader jit compile.
94 //////////////////////////////////////////////////////////////////////////
95 struct FETCH_COMPILE_STATE
98 INPUT_ELEMENT_DESC layout
[KNOB_NUM_ATTRIBUTES
];
100 uint32_t cutIndex
{ 0xffffffff };
102 // Options that effect the JIT'd code
103 bool bDisableVGATHER
; // If enabled, FetchJit will generate loads/shuffles instead of VGATHERs
104 bool bDisableIndexOOBCheck
; // If enabled, FetchJit will exclude index OOB check
105 bool bEnableCutIndex
{ false }; // Compares indices with the cut index and returns a cut mask
106 bool bVertexIDOffsetEnable
{ false }; // Offset vertexID by StartVertex for non-indexed draws or BaseVertex for indexed draws
108 FETCH_COMPILE_STATE(bool disableVGATHER
= false, bool diableIndexOOBCheck
= false):
109 bDisableVGATHER(disableVGATHER
), bDisableIndexOOBCheck(diableIndexOOBCheck
){ };
111 bool operator==(const FETCH_COMPILE_STATE
&other
) const
113 if (numAttribs
!= other
.numAttribs
) return false;
114 if (indexType
!= other
.indexType
) return false;
115 if (bDisableVGATHER
!= other
.bDisableVGATHER
) return false;
116 if (bDisableIndexOOBCheck
!= other
.bDisableIndexOOBCheck
) return false;
117 if (bEnableCutIndex
!= other
.bEnableCutIndex
) return false;
118 if (cutIndex
!= other
.cutIndex
) return false;
119 if (bVertexIDOffsetEnable
!= other
.bVertexIDOffsetEnable
) return false;
121 for(uint32_t i
= 0; i
< numAttribs
; ++i
)
123 if((layout
[i
].bits
!= other
.layout
[i
].bits
) ||
124 ((layout
[i
].InstanceEnable
== 1) &&
125 (layout
[i
].InstanceDataStepRate
!= other
.layout
[i
].InstanceDataStepRate
))){