@@ -35,19 +35,19 @@ namespace Ogre {
35
35
D3D11HardwareBuffer::D3D11HardwareBuffer (
36
36
BufferType btype, size_t sizeBytes,
37
37
HardwareBuffer::Usage usage, D3D11Device & device,
38
- bool useSystemMemory, bool useShadowBuffer, bool streamOut)
39
- : HardwareBuffer(usage, useSystemMemory , useShadowBuffer),
38
+ bool useShadowBuffer, bool streamOut)
39
+ : HardwareBuffer(usage, false , useShadowBuffer),
40
40
mpTempStagingBuffer (0 ),
41
41
mUseTempStagingBuffer(false ),
42
42
mBufferType(btype),
43
43
mDevice(device)
44
44
{
45
45
mSizeInBytes = sizeBytes;
46
46
mDesc .ByteWidth = static_cast <UINT>(sizeBytes);
47
- mDesc .CPUAccessFlags = D3D11Mappings::_getAccessFlags ( mUsage );
47
+ mDesc .CPUAccessFlags = 0 ;
48
48
mDesc .MiscFlags = 0 ;
49
49
50
- if (useSystemMemory )
50
+ if (usage == HBU_CPU_ONLY )
51
51
{
52
52
mDesc .Usage = D3D11_USAGE_STAGING;
53
53
// A D3D11_USAGE_STAGING Resource cannot be bound to any parts of the graphics pipeline, so therefore cannot have any BindFlags bits set.
@@ -68,7 +68,7 @@ namespace Ogre {
68
68
mDesc .BindFlags |= D3D11_BIND_STREAM_OUTPUT;
69
69
}
70
70
71
- if (!useSystemMemory && ( usage & HardwareBuffer::HBU_DYNAMIC) )
71
+ if (usage == HBU_CPU_TO_GPU )
72
72
{
73
73
// We want to be able to map this buffer
74
74
mDesc .CPUAccessFlags |= D3D11_CPU_ACCESS_WRITE;
@@ -80,8 +80,6 @@ namespace Ogre {
80
80
// which themselves cannot be used for input / output to the GPU. Thus
81
81
// for any locks except write locks on dynamic resources, we have to use
82
82
// temporary staging resources instead and use async copies.
83
- // We use the 'useSystemMemory' option to indicate a staging resource
84
-
85
83
86
84
// TODO: we can explicitly initialise the buffer contents here if we like
87
85
// not doing this since OGRE doesn't support this model yet
@@ -91,7 +89,7 @@ namespace Ogre {
91
89
if (mUseShadowBuffer )
92
90
{
93
91
mShadowBuffer .reset (new D3D11HardwareBuffer (mBufferType ,
94
- mSizeInBytes , mUsage , mDevice , true , false , false ));
92
+ mSizeInBytes , HBU_CPU_ONLY , mDevice , false , false ));
95
93
}
96
94
97
95
}
@@ -113,8 +111,7 @@ namespace Ogre {
113
111
}
114
112
115
113
116
- if (mSystemMemory ||
117
- (mUsage & HardwareBuffer::HBU_DYNAMIC &&
114
+ if (mUsage == HBU_CPU_ONLY || (mUsage & HardwareBuffer::HBU_DYNAMIC &&
118
115
(options == HardwareBuffer::HBL_DISCARD || options == HardwareBuffer::HBL_NO_OVERWRITE)))
119
116
{
120
117
// Staging (system memory) buffers or dynamic, write-only buffers
@@ -129,12 +126,12 @@ namespace Ogre {
129
126
{
130
127
case HBL_DISCARD:
131
128
// To use D3D11_MAP_WRITE_DISCARD resource must have been created with write access and dynamic usage.
132
- mapType = mSystemMemory ? D3D11_MAP_WRITE : D3D11_MAP_WRITE_DISCARD;
129
+ mapType = mUsage == HBU_CPU_ONLY ? D3D11_MAP_WRITE : D3D11_MAP_WRITE_DISCARD;
133
130
break ;
134
131
case HBL_NO_OVERWRITE:
135
132
// To use D3D11_MAP_WRITE_NO_OVERWRITE resource must have been created with write access.
136
- // TODO: check (mSystemMemory aka D3D11_USAGE_STAGING => D3D11_MAP_WRITE_NO_OVERWRITE) combo - it`s not forbidden by MSDN
137
- mapType = mSystemMemory ? D3D11_MAP_WRITE : D3D11_MAP_WRITE_NO_OVERWRITE;
133
+ // TODO: check (D3D11_USAGE_STAGING => D3D11_MAP_WRITE_NO_OVERWRITE) combo - it`s not forbidden by MSDN
134
+ mapType = mUsage == HBU_CPU_ONLY ? D3D11_MAP_WRITE : D3D11_MAP_WRITE_NO_OVERWRITE;
138
135
break ;
139
136
case HBL_NORMAL:
140
137
mapType = (mDesc .CPUAccessFlags & D3D11_CPU_ACCESS_READ) ? D3D11_MAP_READ_WRITE : D3D11_MAP_WRITE;
@@ -164,7 +161,7 @@ namespace Ogre {
164
161
{
165
162
// create another buffer instance but use system memory
166
163
mpTempStagingBuffer = new D3D11HardwareBuffer (mBufferType ,
167
- mSizeInBytes , mUsage , mDevice , true , false , false );
164
+ mSizeInBytes , HBU_CPU_ONLY , mDevice , false , false );
168
165
}
169
166
170
167
// schedule a copy to the staging
0 commit comments