32-bit buildfix

This commit is contained in:
Henrik Rydgård 2017-08-20 15:33:53 +02:00
parent 6ffb3d6b53
commit 10cebb4195
6 changed files with 14 additions and 14 deletions

View file

@ -29,7 +29,7 @@ enum class BucketState {
// we always use very small values, so it's probably better to have them in the same
// cache-line as the corresponding key.
// Enforces that value are pointers to make sure that combined storage makes sense.
template <class Key, class Value>
template <class Key, class Value, Value NullValue>
class DenseHashMap {
public:
DenseHashMap(int initialCapacity) : capacity_(initialCapacity) {
@ -46,12 +46,12 @@ public:
if (map[p].state == BucketState::TAKEN && KeyEquals(key, map[p].key))
return map[p].value;
else if (map[p].state == BucketState::FREE)
return nullptr;
return NullValue;
p = (p + 1) & mask; // If the state is REMOVED, we just keep on walking.
if (p == pos)
Crash();
}
return nullptr;
return NullValue;
}
// Returns false if we already had the key! Which is a bit different.
@ -170,7 +170,7 @@ private:
// Like the above, uses linear probing for cache-friendliness.
// Does not perform hashing at all so expects well-distributed keys.
template <class Value>
template <class Value, Value NullValue>
class PrehashMap {
public:
PrehashMap(int initialCapacity) : capacity_(initialCapacity) {
@ -187,12 +187,12 @@ public:
if (map[p].state == BucketState::TAKEN && hash == map[p].hash)
return map[p].value;
else if (map[p].state == BucketState::FREE)
return nullptr;
return NullValue;
p = (p + 1) & mask; // If the state is REMOVED, we just keep on walking.
if (p == pos)
Crash();
}
return nullptr;
return NullValue;
}
// Returns false if we already had the key! Which is a bit different.

View file

@ -167,7 +167,7 @@ private:
ID3D11DeviceContext *context_;
ID3D11DeviceContext1 *context1_;
PrehashMap<VertexArrayInfoD3D11 *> vai_;
PrehashMap<VertexArrayInfoD3D11 *, nullptr> vai_;
struct InputLayoutKey {
D3D11VertexShader *vshader;
@ -181,7 +181,7 @@ private:
}
};
DenseHashMap<InputLayoutKey, ID3D11InputLayout *> inputLayoutMap_;
DenseHashMap<InputLayoutKey, ID3D11InputLayout *, nullptr> inputLayoutMap_;
// Other
ShaderManagerD3D11 *shaderManager_ = nullptr;

View file

@ -154,8 +154,8 @@ private:
LPDIRECT3DDEVICE9 device_ = nullptr;
PrehashMap<VertexArrayInfoDX9 *> vai_;
DenseHashMap<u32, IDirect3DVertexDeclaration9 *> vertexDeclMap_;
PrehashMap<VertexArrayInfoDX9 *, nullptr> vai_;
DenseHashMap<u32, IDirect3DVertexDeclaration9 *, nullptr> vertexDeclMap_;
// SimpleVertex
IDirect3DVertexDeclaration9* transformedVertexDecl_ = nullptr;

View file

@ -166,7 +166,7 @@ private:
void MarkUnreliable(VertexArrayInfo *vai);
PrehashMap<VertexArrayInfo *> vai_;
PrehashMap<VertexArrayInfo *, nullptr> vai_;
// Vertex buffer objects
// Element buffer objects

View file

@ -197,7 +197,7 @@ private:
VulkanPipeline *lastPipeline_;
VkDescriptorSet lastDs_ = VK_NULL_HANDLE;
PrehashMap<VertexArrayInfoVulkan *> vai_;
PrehashMap<VertexArrayInfoVulkan *, nullptr> vai_;
VulkanPushBuffer *vertexCache_;
int decimationCounter_ = 0;
@ -228,7 +228,7 @@ private:
VulkanPushBuffer *pushVertex;
VulkanPushBuffer *pushIndex;
// We do rolling allocation and reset instead of caching across frames. That we might do later.
DenseHashMap<DescriptorSetKey, VkDescriptorSet> descSets;
DenseHashMap<DescriptorSetKey, VkDescriptorSet, VK_NULL_HANDLE> descSets;
void Destroy(VulkanContext *vulkan);
};

View file

@ -97,7 +97,7 @@ public:
std::vector<std::string> DebugGetObjectIDs(DebugShaderType type);
private:
DenseHashMap<VulkanPipelineKey, VulkanPipeline *> pipelines_;
DenseHashMap<VulkanPipelineKey, VulkanPipeline *, nullptr> pipelines_;
VkPipelineCache pipelineCache_;
VulkanContext *vulkan_;
};