Permalink
Browse files

32-bit buildfix

  • Loading branch information...
hrydgard committed Aug 20, 2017
1 parent 6ffb3d6 commit 10cebb4195bb090b3d0e9558cc3127227994823b
View
@@ -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 @@ class DenseHashMap {
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 @@ class DenseHashMap {
// 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 @@ class PrehashMap {
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.
@@ -167,7 +167,7 @@ class DrawEngineD3D11 : public DrawEngineCommon {
ID3D11DeviceContext *context_;
ID3D11DeviceContext1 *context1_;
PrehashMap<VertexArrayInfoD3D11 *> vai_;
PrehashMap<VertexArrayInfoD3D11 *, nullptr> vai_;
struct InputLayoutKey {
D3D11VertexShader *vshader;
@@ -181,7 +181,7 @@ class DrawEngineD3D11 : public DrawEngineCommon {
}
};
DenseHashMap<InputLayoutKey, ID3D11InputLayout *> inputLayoutMap_;
DenseHashMap<InputLayoutKey, ID3D11InputLayout *, nullptr> inputLayoutMap_;
// Other
ShaderManagerD3D11 *shaderManager_ = nullptr;
@@ -154,8 +154,8 @@ class DrawEngineDX9 : public DrawEngineCommon {
LPDIRECT3DDEVICE9 device_ = nullptr;
PrehashMap<VertexArrayInfoDX9 *> vai_;
DenseHashMap<u32, IDirect3DVertexDeclaration9 *> vertexDeclMap_;
PrehashMap<VertexArrayInfoDX9 *, nullptr> vai_;
DenseHashMap<u32, IDirect3DVertexDeclaration9 *, nullptr> vertexDeclMap_;
// SimpleVertex
IDirect3DVertexDeclaration9* transformedVertexDecl_ = nullptr;
@@ -166,7 +166,7 @@ class DrawEngineGLES : public DrawEngineCommon, public GfxResourceHolder {
void MarkUnreliable(VertexArrayInfo *vai);
PrehashMap<VertexArrayInfo *> vai_;
PrehashMap<VertexArrayInfo *, nullptr> vai_;
// Vertex buffer objects
// Element buffer objects
@@ -197,7 +197,7 @@ class DrawEngineVulkan : public DrawEngineCommon {
VulkanPipeline *lastPipeline_;
VkDescriptorSet lastDs_ = VK_NULL_HANDLE;
PrehashMap<VertexArrayInfoVulkan *> vai_;
PrehashMap<VertexArrayInfoVulkan *, nullptr> vai_;
VulkanPushBuffer *vertexCache_;
int decimationCounter_ = 0;
@@ -228,7 +228,7 @@ class DrawEngineVulkan : public DrawEngineCommon {
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);
};
@@ -97,7 +97,7 @@ class PipelineManagerVulkan {
std::vector<std::string> DebugGetObjectIDs(DebugShaderType type);
private:
DenseHashMap<VulkanPipelineKey, VulkanPipeline *> pipelines_;
DenseHashMap<VulkanPipelineKey, VulkanPipeline *, nullptr> pipelines_;
VkPipelineCache pipelineCache_;
VulkanContext *vulkan_;
};

0 comments on commit 10cebb4

Please sign in to comment.