25
25
#pragma once
26
26
27
27
#include < map>
28
+ #include " maths/vec.h"
28
29
29
30
namespace DXBC
30
31
{
31
32
enum ResourceRetType;
32
33
enum class InterpolationMode : uint8_t ;
34
+ class DXBCContainer ;
33
35
};
34
36
35
37
namespace DXBCBytecode
@@ -44,6 +46,41 @@ typedef DXBC::ResourceRetType ResourceRetType;
44
46
typedef DXBCBytecode::ResourceDimension ResourceDimension;
45
47
typedef DXBCBytecode::SamplerMode SamplerMode;
46
48
49
+ struct LaneData
50
+ {
51
+ Vec4f pixelPos;
52
+
53
+ uint32_t isHelper;
54
+ uint32_t quadId;
55
+ uint32_t quadLane;
56
+ uint32_t coverage;
57
+
58
+ // user data PSInput below here
59
+ };
60
+
61
+ struct PixelDebugHit
62
+ {
63
+ // only used in the first instance
64
+ uint32_t numHits;
65
+ // below here are per-hit properties
66
+ float posx;
67
+ float posy;
68
+ float depth;
69
+
70
+ float derivValid;
71
+ uint32_t primitive;
72
+ uint32_t isFrontFace;
73
+ uint32_t sample;
74
+
75
+ uint32_t quadLaneIndex;
76
+ uint32_t pad[3 ];
77
+
78
+ // LaneData quad[4] below here
79
+ };
80
+
81
+ // maximum number of overdraw levels before we start losing potential pixel hits
82
+ static const uint32_t maxPixelHits = 100 ;
83
+
47
84
struct PSInputElement
48
85
{
49
86
PSInputElement (int regster, int element, int numWords, ShaderBuiltin attr, bool inc)
@@ -64,13 +101,64 @@ struct PSInputElement
64
101
bool included;
65
102
};
66
103
67
- void GatherPSInputDataForInitialValues (const rdcarray<SigParameter> &stageInputSig,
68
- const rdcarray<SigParameter> &prevStageOutputSig,
69
- const rdcarray<DXBC::InterpolationMode> &interpModes,
70
- rdcarray<PSInputElement> &initialValues,
71
- rdcarray<rdcstr> &floatInputs, rdcarray<rdcstr> &inputVarNames,
72
- rdcstr &psInputDefinition, int &structureStride,
73
- std::map<ShaderBuiltin, rdcstr> &usedInputs);
104
+ struct SampleEvalCacheKey
105
+ {
106
+ int32_t quadIndex = -1 ; // index of this thread in the quad
107
+ int32_t inputRegisterIndex = -1 ; // index of the input register
108
+ int32_t firstComponent = 0 ; // the first component in the register
109
+ int32_t numComponents = 0 ; // how many components in the register
110
+ int32_t sample = -1 ; // -1 for offset-from-centroid lookups
111
+ int32_t offsetx = 0 , offsety = 0 ; // integer offset from centroid
112
+
113
+ bool operator <(const SampleEvalCacheKey &o) const
114
+ {
115
+ if (quadIndex != o.quadIndex )
116
+ return quadIndex < o.quadIndex ;
117
+
118
+ if (inputRegisterIndex != o.inputRegisterIndex )
119
+ return inputRegisterIndex < o.inputRegisterIndex ;
120
+
121
+ if (firstComponent != o.firstComponent )
122
+ return firstComponent < o.firstComponent ;
123
+
124
+ if (numComponents != o.numComponents )
125
+ return numComponents < o.numComponents ;
126
+
127
+ if (sample != o.sample )
128
+ return sample < o.sample ;
129
+
130
+ if (offsetx != o.offsetx )
131
+ return offsetx < o.offsetx ;
132
+
133
+ return offsety < o.offsety ;
134
+ }
135
+ bool operator ==(const SampleEvalCacheKey &o) const { return !(*this < o) && !(o < *this ); }
136
+ };
137
+
138
+ struct PSInputFetcherConfig
139
+ {
140
+ uint32_t x = 0 , y = 0 ;
141
+ uint32_t uavslot = 0 ;
142
+ uint32_t uavspace = 0 ;
143
+ uint32_t outputSampleCount = 1 ;
144
+ };
145
+
146
+ struct PSInputFetcher
147
+ {
148
+ // stride of the generated PSInput struct
149
+ uint32_t stride = 0 ;
150
+ // members of the PSInput struct
151
+ rdcarray<PSInputElement> inputs;
152
+
153
+ // per-sample evaluation cache
154
+ rdcarray<SampleEvalCacheKey> evalSampleCacheData;
155
+ uint64_t sampleEvalRegisterMask = 0 ;
156
+
157
+ rdcstr hlsl;
158
+ };
159
+
160
+ void CreatePSInputFetcher (const DXBC::DXBCContainer *dxbc, const DXBC::DXBCContainer *prevdxbc,
161
+ const PSInputFetcherConfig &cfg, PSInputFetcher &fetcher);
74
162
75
163
enum class GatherChannel : uint8_t
76
164
{
0 commit comments