Rename some constants in BlockLayoutEncoder for clarity.
TRAC #23748
Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
diff --git a/src/compiler/BlockLayoutEncoder.cpp b/src/compiler/BlockLayoutEncoder.cpp
index 15aee6c..ca5b471 100644
--- a/src/compiler/BlockLayoutEncoder.cpp
+++ b/src/compiler/BlockLayoutEncoder.cpp
@@ -50,7 +50,7 @@
ASSERT(field.fields.empty());
getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &arrayStride, &matrixStride);
- const BlockMemberInfo memberInfo(mCurrentOffset * ComponentSize, arrayStride * ComponentSize, matrixStride * ComponentSize, field.isRowMajorMatrix);
+ const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix);
if (mBlockInfoOut)
{
@@ -67,7 +67,7 @@
getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &arrayStride, &matrixStride);
- const BlockMemberInfo memberInfo(mCurrentOffset * ComponentSize, arrayStride * ComponentSize, matrixStride * ComponentSize, isRowMajorMatrix);
+ const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
if (mBlockInfoOut)
{
@@ -79,7 +79,7 @@
void BlockLayoutEncoder::nextRegister()
{
- mCurrentOffset = rx::roundUp(mCurrentOffset, RegisterSize);
+ mCurrentOffset = rx::roundUp(mCurrentOffset, ComponentsPerRegister);
}
Std140BlockEncoder::Std140BlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut)
@@ -100,7 +100,7 @@
void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
{
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
- ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == ComponentSize);
+ ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == BytesPerComponent);
int numComponents = gl::UniformComponentCount(type);
size_t baseAlignment = 0;
@@ -109,19 +109,19 @@
if (gl::IsMatrixType(type))
{
- baseAlignment = RegisterSize;
- matrixStride = RegisterSize;
+ baseAlignment = ComponentsPerRegister;
+ matrixStride = ComponentsPerRegister;
if (arraySize > 0)
{
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- arrayStride = RegisterSize * numRegisters;
+ arrayStride = ComponentsPerRegister * numRegisters;
}
}
else if (arraySize > 0)
{
- baseAlignment = RegisterSize;
- arrayStride = RegisterSize;
+ baseAlignment = ComponentsPerRegister;
+ arrayStride = ComponentsPerRegister;
}
else
{
@@ -143,9 +143,9 @@
}
else if (gl::IsMatrixType(type))
{
- ASSERT(matrixStride == RegisterSize);
+ ASSERT(matrixStride == ComponentsPerRegister);
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- mCurrentOffset += RegisterSize * numRegisters;
+ mCurrentOffset += ComponentsPerRegister * numRegisters;
}
else
{
diff --git a/src/compiler/BlockLayoutEncoder.h b/src/compiler/BlockLayoutEncoder.h
index 3ff1a2d..b16b61a 100644
--- a/src/compiler/BlockLayoutEncoder.h
+++ b/src/compiler/BlockLayoutEncoder.h
@@ -27,10 +27,10 @@
void encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields);
void encodeInterfaceBlockField(const InterfaceBlockField &field);
void encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
- size_t getBlockSize() { return mCurrentOffset * ComponentSize; }
+ size_t getBlockSize() { return mCurrentOffset * BytesPerComponent; }
- static const size_t ComponentSize = 4u;
- static const unsigned int RegisterSize = 4u;
+ static const size_t BytesPerComponent = 4u;
+ static const unsigned int ComponentsPerRegister = 4u;
protected:
size_t mCurrentOffset;
diff --git a/src/compiler/HLSLLayoutEncoder.cpp b/src/compiler/HLSLLayoutEncoder.cpp
index 97124ba..f3501a6 100644
--- a/src/compiler/HLSLLayoutEncoder.cpp
+++ b/src/compiler/HLSLLayoutEncoder.cpp
@@ -29,7 +29,7 @@
void HLSLBlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
{
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
- ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == ComponentSize);
+ ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == BytesPerComponent);
int matrixStride = 0;
int arrayStride = 0;
@@ -37,23 +37,23 @@
if (gl::IsMatrixType(type))
{
nextRegister();
- matrixStride = RegisterSize;
+ matrixStride = ComponentsPerRegister;
if (arraySize > 0)
{
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- arrayStride = RegisterSize * numRegisters;
+ arrayStride = ComponentsPerRegister * numRegisters;
}
}
else if (arraySize > 0)
{
nextRegister();
- arrayStride = RegisterSize;
+ arrayStride = ComponentsPerRegister;
}
else
{
int numComponents = gl::UniformComponentCount(type);
- if ((numComponents + (mCurrentOffset % RegisterSize)) > RegisterSize)
+ if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) > ComponentsPerRegister)
{
nextRegister();
}
@@ -72,10 +72,10 @@
if (gl::IsMatrixType(type))
{
- ASSERT(matrixStride == RegisterSize);
+ ASSERT(matrixStride == ComponentsPerRegister);
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
- mCurrentOffset += RegisterSize * (numRegisters - 1);
+ mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
mCurrentOffset += numComponents;
}
else