Commit aa0a5446 by Jamie Madill Committed by Commit Bot

Ensure gl State structs are zero filled.

In some cases we would hash or memcmp against structs with bools or other non-filled data. This could have implementation differences, and may have been causing cache errors on Clang. BUG=chromium:721648 BUG=angleproject:2044 Change-Id: I981a1e6e8d50a33f7fade568497b72b919accfce Reviewed-on: https://chromium-review.googlesource.com/516383Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 80616218
...@@ -155,4 +155,4 @@ rx::SamplerImpl *Sampler::getImplementation() const ...@@ -155,4 +155,4 @@ rx::SamplerImpl *Sampler::getImplementation() const
return mImpl; return mImpl;
} }
} } // namespace gl
...@@ -87,53 +87,17 @@ void State::initialize(const Caps &caps, ...@@ -87,53 +87,17 @@ void State::initialize(const Caps &caps,
mDepthClearValue = 1.0f; mDepthClearValue = 1.0f;
mStencilClearValue = 0; mStencilClearValue = 0;
mRasterizer.rasterizerDiscard = false;
mRasterizer.cullFace = false;
mRasterizer.cullMode = GL_BACK;
mRasterizer.frontFace = GL_CCW;
mRasterizer.polygonOffsetFill = false;
mRasterizer.polygonOffsetFactor = 0.0f;
mRasterizer.polygonOffsetUnits = 0.0f;
mRasterizer.pointDrawMode = false;
mRasterizer.multiSample = false;
mScissorTest = false; mScissorTest = false;
mScissor.x = 0; mScissor.x = 0;
mScissor.y = 0; mScissor.y = 0;
mScissor.width = 0; mScissor.width = 0;
mScissor.height = 0; mScissor.height = 0;
mBlend.blend = false;
mBlend.sourceBlendRGB = GL_ONE;
mBlend.sourceBlendAlpha = GL_ONE;
mBlend.destBlendRGB = GL_ZERO;
mBlend.destBlendAlpha = GL_ZERO;
mBlend.blendEquationRGB = GL_FUNC_ADD;
mBlend.blendEquationAlpha = GL_FUNC_ADD;
mBlend.sampleAlphaToCoverage = false;
mBlend.dither = true;
mBlendColor.red = 0; mBlendColor.red = 0;
mBlendColor.green = 0; mBlendColor.green = 0;
mBlendColor.blue = 0; mBlendColor.blue = 0;
mBlendColor.alpha = 0; mBlendColor.alpha = 0;
mDepthStencil.depthTest = false;
mDepthStencil.depthFunc = GL_LESS;
mDepthStencil.depthMask = true;
mDepthStencil.stencilTest = false;
mDepthStencil.stencilFunc = GL_ALWAYS;
mDepthStencil.stencilMask = static_cast<GLuint>(-1);
mDepthStencil.stencilWritemask = static_cast<GLuint>(-1);
mDepthStencil.stencilBackFunc = GL_ALWAYS;
mDepthStencil.stencilBackMask = static_cast<GLuint>(-1);
mDepthStencil.stencilBackWritemask = static_cast<GLuint>(-1);
mDepthStencil.stencilFail = GL_KEEP;
mDepthStencil.stencilPassDepthFail = GL_KEEP;
mDepthStencil.stencilPassDepthPass = GL_KEEP;
mDepthStencil.stencilBackFail = GL_KEEP;
mDepthStencil.stencilBackPassDepthFail = GL_KEEP;
mDepthStencil.stencilBackPassDepthPass = GL_KEEP;
mStencilRef = 0; mStencilRef = 0;
mStencilBackRef = 0; mStencilBackRef = 0;
......
...@@ -39,19 +39,103 @@ PrimitiveType GetPrimitiveType(GLenum drawMode) ...@@ -39,19 +39,103 @@ PrimitiveType GetPrimitiveType(GLenum drawMode)
} }
} }
RasterizerState::RasterizerState()
{
memset(this, 0, sizeof(RasterizerState));
rasterizerDiscard = false;
cullFace = false;
cullMode = GL_BACK;
frontFace = GL_CCW;
polygonOffsetFill = false;
polygonOffsetFactor = 0.0f;
polygonOffsetUnits = 0.0f;
pointDrawMode = false;
multiSample = false;
}
bool operator==(const RasterizerState &a, const RasterizerState &b)
{
return memcmp(&a, &b, sizeof(RasterizerState)) == 0;
}
bool operator!=(const RasterizerState &a, const RasterizerState &b)
{
return !(a == b);
}
BlendState::BlendState()
{
memset(this, 0, sizeof(BlendState));
blend = false;
sourceBlendRGB = GL_ONE;
sourceBlendAlpha = GL_ONE;
destBlendRGB = GL_ZERO;
destBlendAlpha = GL_ZERO;
blendEquationRGB = GL_FUNC_ADD;
blendEquationAlpha = GL_FUNC_ADD;
sampleAlphaToCoverage = false;
dither = true;
}
bool operator==(const BlendState &a, const BlendState &b)
{
return memcmp(&a, &b, sizeof(BlendState)) == 0;
}
bool operator!=(const BlendState &a, const BlendState &b)
{
return !(a == b);
}
DepthStencilState::DepthStencilState()
{
memset(this, 0, sizeof(DepthStencilState));
depthTest = false;
depthFunc = GL_LESS;
depthMask = true;
stencilTest = false;
stencilFunc = GL_ALWAYS;
stencilMask = static_cast<GLuint>(-1);
stencilWritemask = static_cast<GLuint>(-1);
stencilBackFunc = GL_ALWAYS;
stencilBackMask = static_cast<GLuint>(-1);
stencilBackWritemask = static_cast<GLuint>(-1);
stencilFail = GL_KEEP;
stencilPassDepthFail = GL_KEEP;
stencilPassDepthPass = GL_KEEP;
stencilBackFail = GL_KEEP;
stencilBackPassDepthFail = GL_KEEP;
stencilBackPassDepthPass = GL_KEEP;
}
bool operator==(const DepthStencilState &a, const DepthStencilState &b)
{
return memcmp(&a, &b, sizeof(DepthStencilState)) == 0;
}
bool operator!=(const DepthStencilState &a, const DepthStencilState &b)
{
return !(a == b);
}
SamplerState::SamplerState() SamplerState::SamplerState()
: minFilter(GL_NEAREST_MIPMAP_LINEAR),
magFilter(GL_LINEAR),
wrapS(GL_REPEAT),
wrapT(GL_REPEAT),
wrapR(GL_REPEAT),
maxAnisotropy(1.0f),
minLod(-1000.0f),
maxLod(1000.0f),
compareMode(GL_NONE),
compareFunc(GL_LEQUAL),
sRGBDecode(GL_DECODE_EXT)
{ {
memset(this, 0, sizeof(SamplerState));
minFilter = GL_NEAREST_MIPMAP_LINEAR;
magFilter = GL_LINEAR;
wrapS = GL_REPEAT;
wrapT = GL_REPEAT;
wrapR = GL_REPEAT;
maxAnisotropy = 1.0f;
minLod = -1000.0f;
maxLod = 1000.0f;
compareMode = GL_NONE;
compareFunc = GL_LEQUAL;
sRGBDecode = GL_DECODE_EXT;
} }
// static // static
...@@ -141,4 +225,4 @@ bool operator!=(const Extents &lhs, const Extents &rhs) ...@@ -141,4 +225,4 @@ bool operator!=(const Extents &lhs, const Extents &rhs)
{ {
return !(lhs == rhs); return !(lhs == rhs);
} }
} } // namespace gl
...@@ -111,9 +111,11 @@ struct Box ...@@ -111,9 +111,11 @@ struct Box
bool operator!=(const Box &other) const; bool operator!=(const Box &other) const;
}; };
struct RasterizerState final
struct RasterizerState
{ {
// This will zero-initialize the struct, including padding.
RasterizerState();
bool cullFace; bool cullFace;
GLenum cullMode; GLenum cullMode;
GLenum frontFace; GLenum frontFace;
...@@ -128,8 +130,14 @@ struct RasterizerState ...@@ -128,8 +130,14 @@ struct RasterizerState
bool rasterizerDiscard; bool rasterizerDiscard;
}; };
struct BlendState bool operator==(const RasterizerState &a, const RasterizerState &b);
bool operator!=(const RasterizerState &a, const RasterizerState &b);
struct BlendState final
{ {
// This will zero-initialize the struct, including padding.
BlendState();
bool blend; bool blend;
GLenum sourceBlendRGB; GLenum sourceBlendRGB;
GLenum destBlendRGB; GLenum destBlendRGB;
...@@ -148,8 +156,14 @@ struct BlendState ...@@ -148,8 +156,14 @@ struct BlendState
bool dither; bool dither;
}; };
struct DepthStencilState bool operator==(const BlendState &a, const BlendState &b);
bool operator!=(const BlendState &a, const BlendState &b);
struct DepthStencilState final
{ {
// This will zero-initialize the struct, including padding.
DepthStencilState();
bool depthTest; bool depthTest;
GLenum depthFunc; GLenum depthFunc;
bool depthMask; bool depthMask;
...@@ -169,31 +183,15 @@ struct DepthStencilState ...@@ -169,31 +183,15 @@ struct DepthStencilState
GLuint stencilBackWritemask; GLuint stencilBackWritemask;
}; };
struct DrawArraysIndirectCommand bool operator==(const DepthStencilState &a, const DepthStencilState &b);
{ bool operator!=(const DepthStencilState &a, const DepthStencilState &b);
GLuint count;
GLuint instanceCount;
GLuint first;
GLuint baseInstance;
};
static_assert(sizeof(DrawArraysIndirectCommand) == 16,
"Unexpected size of DrawArraysIndirectCommand");
struct DrawElementsIndirectCommand
{
GLuint count;
GLuint primCount;
GLuint firstIndex;
GLint baseVertex;
GLuint baseInstance;
};
static_assert(sizeof(DrawElementsIndirectCommand) == 20,
"Unexpected size of DrawElementsIndirectCommand");
// State from Table 6.10 (state per sampler object) // State from Table 6.10 (state per sampler object)
struct SamplerState struct SamplerState final
{ {
// This will zero-initialize the struct, including padding.
SamplerState(); SamplerState();
static SamplerState CreateDefaultForTarget(GLenum target); static SamplerState CreateDefaultForTarget(GLenum target);
GLenum minFilter; GLenum minFilter;
...@@ -218,6 +216,27 @@ struct SamplerState ...@@ -218,6 +216,27 @@ struct SamplerState
bool operator==(const SamplerState &a, const SamplerState &b); bool operator==(const SamplerState &a, const SamplerState &b);
bool operator!=(const SamplerState &a, const SamplerState &b); bool operator!=(const SamplerState &a, const SamplerState &b);
struct DrawArraysIndirectCommand
{
GLuint count;
GLuint instanceCount;
GLuint first;
GLuint baseInstance;
};
static_assert(sizeof(DrawArraysIndirectCommand) == 16,
"Unexpected size of DrawArraysIndirectCommand");
struct DrawElementsIndirectCommand
{
GLuint count;
GLuint primCount;
GLuint firstIndex;
GLint baseVertex;
GLuint baseInstance;
};
static_assert(sizeof(DrawElementsIndirectCommand) == 20,
"Unexpected size of DrawElementsIndirectCommand");
struct PixelStoreStateBase struct PixelStoreStateBase
{ {
BindingPointer<Buffer> pixelBuffer; BindingPointer<Buffer> pixelBuffer;
......
...@@ -24,16 +24,7 @@ inline bool operator!=(const Rectangle &a, const Rectangle &b) ...@@ -24,16 +24,7 @@ inline bool operator!=(const Rectangle &a, const Rectangle &b)
inline bool operator==(const SamplerState &a, const SamplerState &b) inline bool operator==(const SamplerState &a, const SamplerState &b)
{ {
return a.minFilter == b.minFilter && return memcmp(&a, &b, sizeof(SamplerState)) == 0;
a.magFilter == b.magFilter &&
a.wrapS == b.wrapS &&
a.wrapT == b.wrapT &&
a.wrapR == b.wrapR &&
a.maxAnisotropy == b.maxAnisotropy &&
a.minLod == b.minLod &&
a.maxLod == b.maxLod &&
a.compareMode == b.compareMode &&
a.compareFunc == b.compareFunc;
} }
inline bool operator!=(const SamplerState &a, const SamplerState &b) inline bool operator!=(const SamplerState &a, const SamplerState &b)
...@@ -41,4 +32,4 @@ inline bool operator!=(const SamplerState &a, const SamplerState &b) ...@@ -41,4 +32,4 @@ inline bool operator!=(const SamplerState &a, const SamplerState &b)
return !(a == b); return !(a == b);
} }
} } // namespace gl
...@@ -36,12 +36,10 @@ const unsigned int RenderStateCache::kMaxSamplerStates = 2048; ...@@ -36,12 +36,10 @@ const unsigned int RenderStateCache::kMaxSamplerStates = 2048;
RenderStateCache::RenderStateCache(Renderer11 *renderer) RenderStateCache::RenderStateCache(Renderer11 *renderer)
: mRenderer(renderer), : mRenderer(renderer),
mCounter(0), mCounter(0),
mBlendStateCache(kMaxBlendStates, HashBlendState, CompareBlendStates), mBlendStateCache(kMaxBlendStates, HashBlendState),
mRasterizerStateCache(kMaxRasterizerStates, HashRasterizerState, CompareRasterizerStates), mRasterizerStateCache(kMaxRasterizerStates, HashRasterizerState),
mDepthStencilStateCache(kMaxDepthStencilStates, mDepthStencilStateCache(kMaxDepthStencilStates, HashDepthStencilState),
HashDepthStencilState, mSamplerStateCache(kMaxSamplerStates, HashSamplerState)
CompareDepthStencilStates),
mSamplerStateCache(kMaxSamplerStates, HashSamplerState, CompareSamplerStates)
{ {
} }
...@@ -68,13 +66,6 @@ std::size_t RenderStateCache::HashBlendState(const d3d11::BlendStateKey &blendSt ...@@ -68,13 +66,6 @@ std::size_t RenderStateCache::HashBlendState(const d3d11::BlendStateKey &blendSt
} }
// static // static
bool RenderStateCache::CompareBlendStates(const d3d11::BlendStateKey &a,
const d3d11::BlendStateKey &b)
{
return memcmp(&a, &b, sizeof(d3d11::BlendStateKey)) == 0;
}
// static
d3d11::BlendStateKey RenderStateCache::GetBlendStateKey(const gl::Framebuffer *framebuffer, d3d11::BlendStateKey RenderStateCache::GetBlendStateKey(const gl::Framebuffer *framebuffer,
const gl::BlendState &blendState) const gl::BlendState &blendState)
{ {
...@@ -184,25 +175,19 @@ gl::Error RenderStateCache::getBlendState(const d3d11::BlendStateKey &key, ...@@ -184,25 +175,19 @@ gl::Error RenderStateCache::getBlendState(const d3d11::BlendStateKey &key,
} }
// static // static
std::size_t RenderStateCache::HashRasterizerState(const RasterizerStateKey &rasterState) std::size_t RenderStateCache::HashRasterizerState(const d3d11::RasterizerStateKey &rasterState)
{ {
static const unsigned int seed = 0xABCDEF98; static const unsigned int seed = 0xABCDEF98;
std::size_t hash = 0; std::size_t hash = 0;
MurmurHash3_x86_32(&rasterState, sizeof(RasterizerStateKey), seed, &hash); MurmurHash3_x86_32(&rasterState, sizeof(d3d11::RasterizerStateKey), seed, &hash);
return hash; return hash;
} }
// static
bool RenderStateCache::CompareRasterizerStates(const RasterizerStateKey &a, const RasterizerStateKey &b)
{
return memcmp(&a, &b, sizeof(RasterizerStateKey)) == 0;
}
gl::Error RenderStateCache::getRasterizerState(const gl::RasterizerState &rasterState, bool scissorEnabled, gl::Error RenderStateCache::getRasterizerState(const gl::RasterizerState &rasterState, bool scissorEnabled,
ID3D11RasterizerState **outRasterizerState) ID3D11RasterizerState **outRasterizerState)
{ {
RasterizerStateKey key = {}; d3d11::RasterizerStateKey key;
key.rasterizerState = rasterState; key.rasterizerState = rasterState;
key.scissorEnabled = scissorEnabled; key.scissorEnabled = scissorEnabled;
...@@ -281,12 +266,6 @@ std::size_t RenderStateCache::HashDepthStencilState(const gl::DepthStencilState ...@@ -281,12 +266,6 @@ std::size_t RenderStateCache::HashDepthStencilState(const gl::DepthStencilState
return hash; return hash;
} }
// static
bool RenderStateCache::CompareDepthStencilStates(const gl::DepthStencilState &a, const gl::DepthStencilState &b)
{
return memcmp(&a, &b, sizeof(gl::DepthStencilState)) == 0;
}
gl::Error RenderStateCache::getDepthStencilState(const gl::DepthStencilState &glState, gl::Error RenderStateCache::getDepthStencilState(const gl::DepthStencilState &glState,
ID3D11DepthStencilState **outDSState) ID3D11DepthStencilState **outDSState)
{ {
...@@ -350,12 +329,6 @@ std::size_t RenderStateCache::HashSamplerState(const gl::SamplerState &samplerSt ...@@ -350,12 +329,6 @@ std::size_t RenderStateCache::HashSamplerState(const gl::SamplerState &samplerSt
return hash; return hash;
} }
// static
bool RenderStateCache::CompareSamplerStates(const gl::SamplerState &a, const gl::SamplerState &b)
{
return memcmp(&a, &b, sizeof(gl::SamplerState)) == 0;
}
gl::Error RenderStateCache::getSamplerState(const gl::SamplerState &samplerState, ID3D11SamplerState **outSamplerState) gl::Error RenderStateCache::getSamplerState(const gl::SamplerState &samplerState, ID3D11SamplerState **outSamplerState)
{ {
SamplerStateMap::iterator keyIter = mSamplerStateCache.find(samplerState); SamplerStateMap::iterator keyIter = mSamplerStateCache.find(samplerState);
......
...@@ -48,62 +48,46 @@ class RenderStateCache : angle::NonCopyable ...@@ -48,62 +48,46 @@ class RenderStateCache : angle::NonCopyable
// Blend state cache // Blend state cache
static std::size_t HashBlendState(const d3d11::BlendStateKey &blendState); static std::size_t HashBlendState(const d3d11::BlendStateKey &blendState);
static bool CompareBlendStates(const d3d11::BlendStateKey &a, const d3d11::BlendStateKey &b);
static const unsigned int kMaxBlendStates; static const unsigned int kMaxBlendStates;
typedef std::size_t (*BlendStateHashFunction)(const d3d11::BlendStateKey &); typedef std::size_t (*BlendStateHashFunction)(const d3d11::BlendStateKey &);
typedef bool (*BlendStateEqualityFunction)(const d3d11::BlendStateKey &,
const d3d11::BlendStateKey &);
typedef std::pair<d3d11::BlendState, unsigned long long> BlendStateCounterPair; typedef std::pair<d3d11::BlendState, unsigned long long> BlendStateCounterPair;
typedef std::unordered_map<d3d11::BlendStateKey, typedef std::unordered_map<d3d11::BlendStateKey, BlendStateCounterPair, BlendStateHashFunction>
BlendStateCounterPair,
BlendStateHashFunction,
BlendStateEqualityFunction>
BlendStateMap; BlendStateMap;
BlendStateMap mBlendStateCache; BlendStateMap mBlendStateCache;
// Rasterizer state cache // Rasterizer state cache
struct RasterizerStateKey static std::size_t HashRasterizerState(const d3d11::RasterizerStateKey &rasterState);
{
gl::RasterizerState rasterizerState;
bool scissorEnabled;
};
static std::size_t HashRasterizerState(const RasterizerStateKey &rasterState);
static bool CompareRasterizerStates(const RasterizerStateKey &a, const RasterizerStateKey &b);
static const unsigned int kMaxRasterizerStates; static const unsigned int kMaxRasterizerStates;
typedef std::size_t (*RasterizerStateHashFunction)(const RasterizerStateKey &); typedef std::size_t (*RasterizerStateHashFunction)(const d3d11::RasterizerStateKey &);
typedef bool (*RasterizerStateEqualityFunction)(const RasterizerStateKey &, const RasterizerStateKey &);
typedef std::pair<d3d11::RasterizerState, unsigned long long> RasterizerStateCounterPair; typedef std::pair<d3d11::RasterizerState, unsigned long long> RasterizerStateCounterPair;
typedef std::unordered_map<RasterizerStateKey, RasterizerStateCounterPair, RasterizerStateHashFunction, RasterizerStateEqualityFunction> RasterizerStateMap; typedef std::unordered_map<d3d11::RasterizerStateKey,
RasterizerStateCounterPair,
RasterizerStateHashFunction>
RasterizerStateMap;
RasterizerStateMap mRasterizerStateCache; RasterizerStateMap mRasterizerStateCache;
// Depth stencil state cache // Depth stencil state cache
static std::size_t HashDepthStencilState(const gl::DepthStencilState &dsState); static std::size_t HashDepthStencilState(const gl::DepthStencilState &dsState);
static bool CompareDepthStencilStates(const gl::DepthStencilState &a, const gl::DepthStencilState &b);
static const unsigned int kMaxDepthStencilStates; static const unsigned int kMaxDepthStencilStates;
typedef std::size_t (*DepthStencilStateHashFunction)(const gl::DepthStencilState &); typedef std::size_t (*DepthStencilStateHashFunction)(const gl::DepthStencilState &);
typedef bool (*DepthStencilStateEqualityFunction)(const gl::DepthStencilState &, const gl::DepthStencilState &);
typedef std::pair<d3d11::DepthStencilState, unsigned long long> DepthStencilStateCounterPair; typedef std::pair<d3d11::DepthStencilState, unsigned long long> DepthStencilStateCounterPair;
typedef std::unordered_map<gl::DepthStencilState, typedef std::unordered_map<gl::DepthStencilState,
DepthStencilStateCounterPair, DepthStencilStateCounterPair,
DepthStencilStateHashFunction, DepthStencilStateHashFunction>
DepthStencilStateEqualityFunction> DepthStencilStateMap; DepthStencilStateMap;
DepthStencilStateMap mDepthStencilStateCache; DepthStencilStateMap mDepthStencilStateCache;
// Sample state cache // Sample state cache
static std::size_t HashSamplerState(const gl::SamplerState &samplerState); static std::size_t HashSamplerState(const gl::SamplerState &samplerState);
static bool CompareSamplerStates(const gl::SamplerState &a, const gl::SamplerState &b);
static const unsigned int kMaxSamplerStates; static const unsigned int kMaxSamplerStates;
typedef std::size_t (*SamplerStateHashFunction)(const gl::SamplerState &); typedef std::size_t (*SamplerStateHashFunction)(const gl::SamplerState &);
typedef bool (*SamplerStateEqualityFunction)(const gl::SamplerState &, const gl::SamplerState &);
typedef std::pair<d3d11::SamplerState, unsigned long long> SamplerStateCounterPair; typedef std::pair<d3d11::SamplerState, unsigned long long> SamplerStateCounterPair;
typedef std::unordered_map<gl::SamplerState, typedef std::unordered_map<gl::SamplerState, SamplerStateCounterPair, SamplerStateHashFunction>
SamplerStateCounterPair, SamplerStateMap;
SamplerStateHashFunction,
SamplerStateEqualityFunction> SamplerStateMap;
SamplerStateMap mSamplerStateCache; SamplerStateMap mSamplerStateCache;
}; };
......
...@@ -1872,6 +1872,36 @@ void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, flo ...@@ -1872,6 +1872,36 @@ void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, flo
vertex->s = s; vertex->s = s;
} }
BlendStateKey::BlendStateKey()
{
memset(this, 0, sizeof(BlendStateKey));
}
bool operator==(const BlendStateKey &a, const BlendStateKey &b)
{
return memcmp(&a, &b, sizeof(BlendStateKey)) == 0;
}
bool operator!=(const BlendStateKey &a, const BlendStateKey &b)
{
return !(a == b);
}
RasterizerStateKey::RasterizerStateKey()
{
memset(this, 0, sizeof(RasterizerStateKey));
}
bool operator==(const RasterizerStateKey &a, const RasterizerStateKey &b)
{
return memcmp(&a, &b, sizeof(RasterizerStateKey)) == 0;
}
bool operator!=(const RasterizerStateKey &a, const RasterizerStateKey &b)
{
return !(a == b);
}
HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name) HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
{ {
#if defined(_DEBUG) #if defined(_DEBUG)
......
...@@ -120,13 +120,31 @@ struct PositionVertex ...@@ -120,13 +120,31 @@ struct PositionVertex
float x, y, z, w; float x, y, z, w;
}; };
struct BlendStateKey struct BlendStateKey final
{ {
// This will zero-initialize the struct, including padding.
BlendStateKey();
gl::BlendState blendState; gl::BlendState blendState;
bool mrt; bool mrt;
uint8_t rtvMasks[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]; uint8_t rtvMasks[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
}; };
bool operator==(const BlendStateKey &a, const BlendStateKey &b);
bool operator!=(const BlendStateKey &a, const BlendStateKey &b);
struct RasterizerStateKey final
{
// This will zero-initialize the struct, including padding.
RasterizerStateKey();
gl::RasterizerState rasterizerState;
bool scissorEnabled;
};
bool operator==(const RasterizerStateKey &a, const RasterizerStateKey &b);
bool operator!=(const RasterizerStateKey &a, const RasterizerStateKey &b);
HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name); HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
template <typename T> template <typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment