Commit 0661eb89 by Jiawei Shao Committed by Commit Bot

Fix compile error in iterating ShaderBitSet

This patch fixes a compile error when we do iteration on ShaderBitSet. Now we can directly get a ShaderType variable in a range-for iteration on a ShaderBitSet. BUG=angleproject:2169 Change-Id: I23e38f2ebd1c72145a2e54be374f7dcd9f5fb9e2 Reviewed-on: https://chromium-review.googlesource.com/1100312 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 06a22620
...@@ -54,7 +54,7 @@ class BitSetT final ...@@ -54,7 +54,7 @@ class BitSetT final
bool operator==(const Iterator &other) const; bool operator==(const Iterator &other) const;
bool operator!=(const Iterator &other) const; bool operator!=(const Iterator &other) const;
std::size_t operator*() const; ParamT operator*() const;
private: private:
std::size_t getNextBit(); std::size_t getNextBit();
...@@ -423,7 +423,7 @@ template <size_t N, typename BitsT, typename ParamT> ...@@ -423,7 +423,7 @@ template <size_t N, typename BitsT, typename ParamT>
typename BitSetT<N, BitsT, ParamT>::Iterator &BitSetT<N, BitsT, ParamT>::Iterator::operator++() typename BitSetT<N, BitsT, ParamT>::Iterator &BitSetT<N, BitsT, ParamT>::Iterator::operator++()
{ {
ASSERT(mBitsCopy.any()); ASSERT(mBitsCopy.any());
mBitsCopy.reset(mCurrentBit); mBitsCopy.reset(static_cast<ParamT>(mCurrentBit));
mCurrentBit = getNextBit(); mCurrentBit = getNextBit();
return *this; return *this;
} }
...@@ -441,9 +441,9 @@ bool BitSetT<N, BitsT, ParamT>::Iterator::operator!=(const Iterator &other) cons ...@@ -441,9 +441,9 @@ bool BitSetT<N, BitsT, ParamT>::Iterator::operator!=(const Iterator &other) cons
} }
template <size_t N, typename BitsT, typename ParamT> template <size_t N, typename BitsT, typename ParamT>
std::size_t BitSetT<N, BitsT, ParamT>::Iterator::operator*() const ParamT BitSetT<N, BitsT, ParamT>::Iterator::operator*() const
{ {
return mCurrentBit; return static_cast<ParamT>(mCurrentBit);
} }
template <size_t N, typename BitsT, typename ParamT> template <size_t N, typename BitsT, typename ParamT>
......
...@@ -1695,11 +1695,10 @@ void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShade ...@@ -1695,11 +1695,10 @@ void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShade
continue; continue;
} }
for (gl::ShaderType shaderType : gl::AllShaderTypes()) for (gl::ShaderType shaderType : availableShaderStages)
{ {
if (d3dUniform->isReferencedByShader(shaderType)) if (d3dUniform->isReferencedByShader(shaderType))
{ {
ASSERT(availableShaderStages[shaderType]);
shaderRegisters[shaderType] = std::max( shaderRegisters[shaderType] = std::max(
shaderRegisters[shaderType], shaderRegisters[shaderType],
d3dUniform->mShaderRegisterIndexes[shaderType] + d3dUniform->registerCount); d3dUniform->mShaderRegisterIndexes[shaderType] + d3dUniform->registerCount);
...@@ -1709,13 +1708,10 @@ void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShade ...@@ -1709,13 +1708,10 @@ void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShade
// We only reset uniform storages for the shader stages available in the program (attached // We only reset uniform storages for the shader stages available in the program (attached
// shaders in ProgramD3D::link() and linkedShaderStages in ProgramD3D::load()). // shaders in ProgramD3D::link() and linkedShaderStages in ProgramD3D::load()).
for (gl::ShaderType shaderType : gl::AllShaderTypes()) for (gl::ShaderType shaderType : availableShaderStages)
{ {
if (availableShaderStages[shaderType]) mShaderUniformStorages[shaderType].reset(
{ mRenderer->createUniformStorage(shaderRegisters[shaderType] * 16u));
mShaderUniformStorages[shaderType].reset(
mRenderer->createUniformStorage(shaderRegisters[shaderType] * 16u));
}
} }
// Iterate the uniforms again to assign data pointers to default block uniforms. // Iterate the uniforms again to assign data pointers to default block uniforms.
...@@ -1727,7 +1723,7 @@ void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShade ...@@ -1727,7 +1723,7 @@ void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShade
continue; continue;
} }
for (gl::ShaderType shaderType : gl::AllShaderTypes()) for (gl::ShaderType shaderType : availableShaderStages)
{ {
if (d3dUniform->isReferencedByShader(shaderType)) if (d3dUniform->isReferencedByShader(shaderType))
{ {
......
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