• 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     // numnber 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 offsetAttribs; ///< attrib offset to subtract from all STREAMOUT_DECL::attribSlot values.
73 
74     uint64_t streamMask;
75 
76     // stream decls
77     STREAMOUT_STREAM stream;
78 
79     bool operator==(const STREAMOUT_COMPILE_STATE &other) const
80     {
81         if (numVertsPerPrim != other.numVertsPerPrim) return false;
82         if (stream.numDecls != other.stream.numDecls) return false;
83 
84         for (uint32_t i = 0; i < stream.numDecls; ++i)
85         {
86             if (stream.decl[i].bufferIndex != other.stream.decl[i].bufferIndex) return false;
87             if (stream.decl[i].attribSlot != other.stream.decl[i].attribSlot) return false;
88             if (stream.decl[i].componentMask != other.stream.decl[i].componentMask) return false;
89             if (stream.decl[i].hole != other.stream.decl[i].hole) return false;
90         }
91 
92         return true;
93     }
94 };
95