forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConstantBufferData.cs
61 lines (48 loc) · 1.85 KB
/
ConstantBufferData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
namespace TwoMGFX
{
internal partial class ConstantBufferData
{
public string Name { get; private set; }
public int Size { get; private set; }
public List<int> ParameterIndex { get; private set; }
public List<int> ParameterOffset { get; private set; }
public List<EffectObject.d3dx_parameter> Parameters { get; private set; }
public ConstantBufferData(string name)
{
Name = name;
ParameterIndex = new List<int>();
ParameterOffset = new List<int>();
Parameters = new List<EffectObject.d3dx_parameter>();
Size = 0;
}
public bool SameAs(ConstantBufferData other)
{
// If the names of the constant buffers don't
// match then consider them different right off
// the bat... even if their parameters are the same.
if (Name != other.Name)
return false;
// Do we have the same count of parameters and size?
if ( Size != other.Size ||
Parameters.Count != other.Parameters.Count)
return false;
// Compare the parameters themselves.
for (var i = 0; i < Parameters.Count; i++)
{
var p1 = Parameters[i];
var p2 = other.Parameters[i];
// Check the importaint bits.
if ( p1.name != p2.name ||
p1.rows != p2.rows ||
p1.columns != p2.columns ||
p1.class_ != p2.class_ ||
p1.type != p2.type ||
p1.bufferOffset != p2.bufferOffset)
return false;
}
// These are equal.
return true;
}
}
}