• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  * Copyright (C) 2014-2015 Intel Corporation.   All Rights Reserved.
3  *
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:
10  *
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
13  * Software.
14  *
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
21  * IN THE SOFTWARE.
22  *
23  * @file streamout_jit.h
24  *
25  * @brief Definition of the streamout jitter
26  *
27  * Notes:
28  *
29  ******************************************************************************/
30 #pragma once
31 
32 #include "common/formats.h"
33 #include "core/state.h"
34 
35 //////////////////////////////////////////////////////////////////////////
36 /// STREAMOUT_DECL - Stream decl
37 //////////////////////////////////////////////////////////////////////////
38 struct STREAMOUT_DECL
39 {
40     // Buffer that stream maps to.
41     DWORD bufferIndex;
42 
43     // attribute to stream
44     uint32_t attribSlot;
45 
46     // attribute component mask
47     uint32_t componentMask;
48 
49     // indicates this decl is a hole
50     bool hole;
51 };
52 
53 //////////////////////////////////////////////////////////////////////////
54 /// STREAMOUT_STREAM - Stream decls
55 //////////////////////////////////////////////////////////////////////////
56 struct STREAMOUT_STREAM
57 {
58     // number of decls for this stream
59     uint32_t numDecls;
60 
61     // array of numDecls decls
62     STREAMOUT_DECL decl[128];
63 };
64 
65 //////////////////////////////////////////////////////////////////////////
66 /// State required for streamout jit
67 //////////////////////////////////////////////////////////////////////////
68 struct STREAMOUT_COMPILE_STATE
69 {
70     // number of verts per primitive
71     uint32_t numVertsPerPrim;
72     uint32_t
73         offsetAttribs; ///< attrib offset to subtract from all STREAMOUT_DECL::attribSlot values.
74 
75     uint64_t streamMask;
76 
77     // stream decls
78     STREAMOUT_STREAM stream;
79 
80     bool operator==(const STREAMOUT_COMPILE_STATE& other) const
81     {
82         if (numVertsPerPrim != other.numVertsPerPrim)
83             return false;
84         if (stream.numDecls != other.stream.numDecls)
85             return false;
86 
87         for (uint32_t i = 0; i < stream.numDecls; ++i)
88         {
89             if (stream.decl[i].bufferIndex != other.stream.decl[i].bufferIndex)
90                 return false;
91             if (stream.decl[i].attribSlot != other.stream.decl[i].attribSlot)
92                 return false;
93             if (stream.decl[i].componentMask != other.stream.decl[i].componentMask)
94                 return false;
95             if (stream.decl[i].hole != other.stream.decl[i].hole)
96                 return false;
97         }
98 
99         return true;
100     }
101 };
102