Commit 904bb918 by Jamie Madill Committed by Commit Bot

Rename constants in blocklayout.h.

This adds the "k" prefix. Bug: angleproject:3024 Change-Id: I3771a8a9d90cd5edc7173f2b3817a5f1f053bdd4 Reviewed-on: https://chromium-review.googlesource.com/c/1392399Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 48bbc53e
......@@ -672,7 +672,7 @@ void ShaderStorageBlockOutputHLSL::writeEOpIndexDirectOrIndirectOutput(TInfoSink
{
if (mRowMajor)
{
out << " + " << str(BlockLayoutEncoder::BytesPerComponent);
out << " + " << str(BlockLayoutEncoder::kBytesPerComponent);
}
else
{
......@@ -687,7 +687,7 @@ void ShaderStorageBlockOutputHLSL::writeEOpIndexDirectOrIndirectOutput(TInfoSink
}
else
{
out << " + " << str(BlockLayoutEncoder::BytesPerComponent);
out << " + " << str(BlockLayoutEncoder::kBytesPerComponent);
}
}
......
......@@ -158,9 +158,9 @@ BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type,
getBlockLayoutInfo(type, arraySizes, isRowMajorMatrix, &arrayStride, &matrixStride);
const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * BytesPerComponent),
static_cast<int>(arrayStride * BytesPerComponent),
static_cast<int>(matrixStride * BytesPerComponent),
const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * kBytesPerComponent),
static_cast<int>(arrayStride * kBytesPerComponent),
static_cast<int>(matrixStride * kBytesPerComponent),
isRowMajorMatrix);
advanceOffset(type, arraySizes, isRowMajorMatrix, arrayStride, matrixStride);
......@@ -170,7 +170,7 @@ BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type,
void BlockLayoutEncoder::increaseCurrentOffset(size_t offsetInBytes)
{
mCurrentOffset += (offsetInBytes / BytesPerComponent);
mCurrentOffset += (offsetInBytes / kBytesPerComponent);
}
void BlockLayoutEncoder::setStructureBaseAlignment(size_t baseAlignment)
......@@ -181,18 +181,18 @@ void BlockLayoutEncoder::setStructureBaseAlignment(size_t baseAlignment)
// static
size_t BlockLayoutEncoder::GetBlockRegister(const BlockMemberInfo &info)
{
return (info.offset / BytesPerComponent) / ComponentsPerRegister;
return (info.offset / kBytesPerComponent) / kComponentsPerRegister;
}
// static
size_t BlockLayoutEncoder::GetBlockRegisterElement(const BlockMemberInfo &info)
{
return (info.offset / BytesPerComponent) % ComponentsPerRegister;
return (info.offset / kBytesPerComponent) % kComponentsPerRegister;
}
void BlockLayoutEncoder::nextRegister()
{
mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, kComponentsPerRegister);
}
Std140BlockEncoder::Std140BlockEncoder() {}
......@@ -214,7 +214,7 @@ void Std140BlockEncoder::getBlockLayoutInfo(GLenum type,
int *matrixStrideOut)
{
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == kBytesPerComponent);
size_t baseAlignment = 0;
int matrixStride = 0;
......@@ -222,19 +222,19 @@ void Std140BlockEncoder::getBlockLayoutInfo(GLenum type,
if (gl::IsMatrixType(type))
{
baseAlignment = ComponentsPerRegister;
matrixStride = ComponentsPerRegister;
baseAlignment = kComponentsPerRegister;
matrixStride = kComponentsPerRegister;
if (!arraySizes.empty())
{
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
arrayStride = ComponentsPerRegister * numRegisters;
arrayStride = kComponentsPerRegister * numRegisters;
}
}
else if (!arraySizes.empty())
{
baseAlignment = ComponentsPerRegister;
arrayStride = ComponentsPerRegister;
baseAlignment = kComponentsPerRegister;
arrayStride = kComponentsPerRegister;
}
else
{
......@@ -283,7 +283,7 @@ void Std430BlockEncoder::getBlockLayoutInfo(GLenum type,
int *matrixStrideOut)
{
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == kBytesPerComponent);
size_t baseAlignment = 0;
int matrixStride = 0;
......
......@@ -78,7 +78,7 @@ class BlockLayoutEncoder
const std::vector<unsigned int> &arraySizes,
bool isRowMajorMatrix);
size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
size_t getBlockSize() const { return mCurrentOffset * kBytesPerComponent; }
size_t getStructureBaseAlignment() const { return mStructureBaseAlignment; }
void increaseCurrentOffset(size_t offsetInBytes);
void setStructureBaseAlignment(size_t baseAlignment);
......@@ -86,8 +86,8 @@ class BlockLayoutEncoder
virtual void enterAggregateType() = 0;
virtual void exitAggregateType() = 0;
static const size_t BytesPerComponent = 4u;
static const unsigned int ComponentsPerRegister = 4u;
static constexpr size_t kBytesPerComponent = 4u;
static constexpr unsigned int kComponentsPerRegister = 4u;
static size_t GetBlockRegister(const BlockMemberInfo &info);
static size_t GetBlockRegisterElement(const BlockMemberInfo &info);
......
......@@ -35,7 +35,7 @@ void HLSLBlockEncoder::getBlockLayoutInfo(GLenum typeIn,
GLenum type = (mTransposeMatrices ? gl::TransposeMatrixType(typeIn) : typeIn);
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == kBytesPerComponent);
int matrixStride = 0;
int arrayStride = 0;
......@@ -50,22 +50,22 @@ void HLSLBlockEncoder::getBlockLayoutInfo(GLenum typeIn,
if (gl::IsMatrixType(type))
{
matrixStride = ComponentsPerRegister;
matrixStride = kComponentsPerRegister;
if (!arraySizes.empty())
{
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
arrayStride = ComponentsPerRegister * numRegisters;
arrayStride = kComponentsPerRegister * numRegisters;
}
}
else if (!arraySizes.empty())
{
arrayStride = ComponentsPerRegister;
arrayStride = kComponentsPerRegister;
}
else if (isPacked())
{
int numComponents = gl::VariableComponentCount(type);
if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) > ComponentsPerRegister)
if ((numComponents + (mCurrentOffset % kComponentsPerRegister)) > kComponentsPerRegister)
{
nextRegister();
}
......@@ -90,10 +90,10 @@ void HLSLBlockEncoder::advanceOffset(GLenum typeIn,
if (gl::IsMatrixType(type))
{
ASSERT(matrixStride == ComponentsPerRegister);
ASSERT(matrixStride == kComponentsPerRegister);
const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
mCurrentOffset += kComponentsPerRegister * (numRegisters - 1);
mCurrentOffset += numComponents;
}
else if (isPacked())
......@@ -102,13 +102,13 @@ void HLSLBlockEncoder::advanceOffset(GLenum typeIn,
}
else
{
mCurrentOffset += ComponentsPerRegister;
mCurrentOffset += kComponentsPerRegister;
}
}
void HLSLBlockEncoder::skipRegisters(unsigned int numRegisters)
{
mCurrentOffset += (numRegisters * ComponentsPerRegister);
mCurrentOffset += (numRegisters * kComponentsPerRegister);
}
HLSLBlockEncoder::HLSLBlockEncoderStrategy HLSLBlockEncoder::GetStrategyFor(
......@@ -156,7 +156,7 @@ unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput o
HLSLBlockEncoder encoder(HLSLBlockEncoder::GetStrategyFor(outputType), true);
HLSLVariableRegisterCount(variable, &encoder);
const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
const size_t registerBytes = (encoder.kBytesPerComponent * encoder.kComponentsPerRegister);
return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) /
registerBytes);
}
......
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