Skip to content

Commit

Permalink
minor typo / spelling / clang-tidy fixes (google#468)
Browse files Browse the repository at this point in the history
* Minor clean-ups

- fix a couple usage of std::function
- fix a couple usage of std::string
- remove ALIGN_LOOP, which didn't work
- fix a couple explicit/noexcept
- virtual -> override

* Fix spelling typos and other minor clang-tidy
  • Loading branch information
pixelflinger committed Nov 8, 2018
1 parent 5fb0696 commit f8f24f4
Show file tree
Hide file tree
Showing 64 changed files with 136 additions and 136 deletions.
2 changes: 1 addition & 1 deletion filament/include/filament/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class UTILS_PUBLIC Camera : public FilamentAPI {
* between 1/8000 and 30.
*
* @param sensitivity Sensitivity in ISO, clamped between 10 and 204,800.
* A higher \p sensitivity increases the exposure. Realistice values are
* A higher \p sensitivity increases the exposure. Realistic values are
* between 50 and 25600.
*
* @note
Expand Down
2 changes: 1 addition & 1 deletion filament/include/filament/IndirectLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class UTILS_PUBLIC IndirectLight : public FilamentAPI {
* @return pointer to the newly created object or nullptr if exceptions are disabled and
* an error occurred.
*
* @exception utils::PostConditionPanic if a runtime error occured, such as running out of
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
* memory or other resources.
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
*/
Expand Down
2 changes: 1 addition & 1 deletion filament/include/filament/LightManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class UTILS_PUBLIC LightManager : public FilamentAPI {

/** Distance from the camera after which shadows are clipped. this is used to clip
* shadows that are too far and wouldn't contribute to the scene much, improving
* performance and quality. This valie is always positive.
* performance and quality. This value is always positive.
* Use 0.0f to use the camera far distance.
*/
float shadowFar = 0.0f;
Expand Down
2 changes: 1 addition & 1 deletion filament/include/filament/MaterialInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class UTILS_PUBLIC MaterialInstance : public FilamentAPI {
*
* @param name Name of the parameter as defined by Material. Cannot be nullptr.
* @param type Whether the color value is encoded as Linear or sRGB.
* @param color Array of read, green, blue chanels values.
* @param color Array of read, green, blue channels values.
* @throws utils::PreConditionPanic if name doesn't exist or no-op if exceptions are disabled.
*/
void setParameter(const char* name, RgbType type, math::float3 color) noexcept;
Expand Down
4 changes: 2 additions & 2 deletions filament/include/filament/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class UTILS_PUBLIC Renderer : public FilamentAPI {
* +--------------------+
* | | .stride .alignment
* | | ----------------------->-->
* | | O----------------------+--+ low adresses
* | | O----------------------+--+ low addresses
* | | | | | |
* | w | | | .top | |
* | <---------> | | V | |
Expand All @@ -226,7 +226,7 @@ class UTILS_PUBLIC Renderer : public FilamentAPI {
* +------>| v | | +---->| | | |
* | +.........+ | | +.........+ | |
* | ^ | | | |
* | y | | +----------------------+--+ high adresses
* | y | | +----------------------+--+ high addresses
* O------------+-------+
*
*
Expand Down
2 changes: 1 addition & 1 deletion filament/include/filament/TransformManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class UTILS_PUBLIC TransformManager : public FilamentAPI {
* @param e An entity.
*
* @note If this transform had children, these are orphaned, which means their local
* transform becomes a world transform. Usually it's not sensical. It's recommended to make
* transform becomes a world transform. Usually it's nonsensical. It's recommended to make
* sure that a destroyed transform doesn't have have children.
*
* @see create()
Expand Down
2 changes: 1 addition & 1 deletion filament/include/filament/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class UTILS_PUBLIC View : public FilamentAPI {
* correct when rendering a single view.
*
* However, when rendering a View on top of another one on the same render target,
* it is necessary toindicate that the color buffer cannot be discarded.
* it is necessary to indicate that the color buffer cannot be discarded.
*
* @param discard Buffers that need to be discarded before rendering.
*
Expand Down
6 changes: 3 additions & 3 deletions filament/src/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ void FEngine::shutdown() {
}
cleanupResourceList(mFences);

for (size_t i = 0; i < POST_PROCESS_STAGES_COUNT; i++) {
driver.destroyProgram(mPostProcessPrograms[i]);
for (const auto& mPostProcessProgram : mPostProcessPrograms) {
driver.destroyProgram(mPostProcessProgram);
}

// There might be commands added by the terminate() calls
Expand Down Expand Up @@ -702,7 +702,7 @@ bool FEngine::execute() {

// wait until we get command buffers to be executed (or thread exit requested)
auto buffers = mCommandBufferQueue.waitForCommands();
if (UTILS_UNLIKELY(!buffers.size())) {
if (UTILS_UNLIKELY(buffers.empty())) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions filament/src/FrameInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <assert.h>
#include <math/fast.h>

// set EXTRA_TIMING_INFO to enable and print extra timing infos about the render loop
// set EXTRA_TIMING_INFO to enable and print extra timing info about the render loop
#define EXTRA_TIMING_INFO false

namespace filament {
Expand Down Expand Up @@ -75,7 +75,7 @@ class FrameInfoManager {
static constexpr size_t HISTORY_COUNT = 5;
static constexpr size_t POOL_COUNT = 8;

// set this to true to enable extra timing infos
// set this to true to enable extra timing info
static constexpr bool mLapRecordsEnabled = EXTRA_TIMING_INFO;

public:
Expand Down
2 changes: 1 addition & 1 deletion filament/src/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ FMaterial::FMaterial(FEngine& engine, const Material::Builder& builder)
parser->getVertexDomain(&mVertexDomain);
parser->getRequiredAttributes(&mRequiredAttributes);
if (mBlendingMode == BlendingMode::MASKED) {
parser->getMaskThreshold(&mMaskTreshold);
parser->getMaskThreshold(&mMaskThreshold);
}
if (mShading == Shading::UNLIT) {
parser->hasShadowMultiplier(&mHasShadowMultiplier);
Expand Down
2 changes: 1 addition & 1 deletion filament/src/RenderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void RenderPass::render(

// compute how much maximum storage we need for this pass
uint32_t growBy = FScene::getPrimitiveCount(soa, vr.last);
// double the color pass for transparents that need to render twice
// double the color pass for transparent objects that need to render twice
const bool colorPass = bool(commandTypeFlags & CommandTypeFlags::COLOR);
const bool depthPass = bool(commandTypeFlags & (CommandTypeFlags::DEPTH | CommandTypeFlags::SHADOW));
growBy *= uint32_t(colorPass * 2 + depthPass);
Expand Down
2 changes: 1 addition & 1 deletion filament/src/RenderTargetPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RenderTargetPool {
// 1280 x 720 is ~ 7 MB for color buffer
static constexpr size_t POOL_MAX_SIZE = 128 * 1024 * 1024;

// 2 pages is way enough for the entry sturctures (should be about 400)
// 2 pages is way enough for the entry structures (should be about 400)
static constexpr size_t POOL_ENTRY_ARENA_SIZE = 8192;

public:
Expand Down
4 changes: 2 additions & 2 deletions filament/src/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FScene::FScene(FEngine& engine) :
FScene::~FScene() noexcept = default;


void FScene::prepare(const math::mat4f& worldOriginTansform) {
void FScene::prepare(const math::mat4f& worldOriginTransform) {
// TODO: can we skip this in most cases? Since we rely on indices staying the same,
// we could only skip, if nothing changed in the RCM.

Expand Down Expand Up @@ -103,7 +103,7 @@ void FScene::prepare(const math::mat4f& worldOriginTansform) {

// get the world transform
auto ti = tcm.getInstance(e);
const mat4f worldTransform = worldOriginTansform * tcm.getWorldTransform(ti);
const mat4f worldTransform = worldOriginTransform * tcm.getWorldTransform(ti);

// don't even draw this object if it doesn't have a transform (which shouldn't happen
// because one is always created when creating a Renderable component).
Expand Down
2 changes: 1 addition & 1 deletion filament/src/ShadowMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace details {
// do this only if depth-clamp is available
static constexpr bool USE_DEPTH_CLAMP = false;

// currently disabled because it creates shadow acnee problems at a distance
// currently disabled because it creates shadow acne problems at a distance
static constexpr bool ENABLE_LISPSM = true;

ShadowMap::ShadowMap(FEngine& engine) noexcept :
Expand Down
4 changes: 2 additions & 2 deletions filament/src/VertexBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ VertexBuffer::Builder& VertexBuffer::Builder::attribute(VertexAttribute attribut

#ifndef NDEBUG
if (byteOffset & 0x3) {
utils::slog.d << "[performace] VertexBuffer::Builder::attribute() "
utils::slog.d << "[performance] VertexBuffer::Builder::attribute() "
"byteOffset not multiple of 4" << utils::io::endl;
}
if (byteStride & 0x3) {
utils::slog.d << "[performace] VertexBuffer::Builder::attribute() "
utils::slog.d << "[performance] VertexBuffer::Builder::attribute() "
"byteStride not multiple of 4" << utils::io::endl;
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions filament/src/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ math::float2 FView::updateScale(duration frameTime) noexcept {
const float maxMajorScale = minor / major;
const float majorScale = std::max(scale, maxMajorScale);

// then the minor axis is scaled down to the original aspec-ratio
// then the minor axis is scaled down to the original aspect-ratio
const float minorScale = std::max(scale / majorScale, majorScale * maxMajorScale);

// if we have some scaling capacity left, scale homogeneously
Expand Down Expand Up @@ -728,9 +728,9 @@ void FView::prepareVisibleLights(FLightManager& lcm, utils::JobSystem&, FScene::
}

void FView::updatePrimitivesLod(FEngine& engine, const CameraInfo&,
FScene::RenderableSoa& renderableData, Range visibles) noexcept {
FScene::RenderableSoa& renderableData, Range visible) noexcept {
FRenderableManager const& rcm = engine.getRenderableManager();
for (uint32_t index : visibles) {
for (uint32_t index : visible) {
uint8_t level = 0; // TODO: pick the proper level of detail
auto ri = renderableData.elementAt<FScene::RENDERABLE_INSTANCE>(index);
renderableData.elementAt<FScene::PRIMITIVES>(index) = rcm.getRenderPrimitives(ri, level);
Expand Down
2 changes: 1 addition & 1 deletion filament/src/components/RenderableManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ RenderableManager::Builder::Result RenderableManager::Builder::build(Engine& eng
material = upcast(entry.materialInstance->getMaterial());
}

// primitves without indices or vertices will be ignored
// primitives without indices or vertices will be ignored
if (!entry.indices || !entry.vertices) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion filament/src/components/TransformManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void FTransformManager::insertNode(Instance i, Instance parent) noexcept {
manager[i].parent = parent;
manager[i].prev = 0;
if (parent) {
// we insert ourself first in the parent's list
// we insert ourselves first in the parent's list
Instance next = manager[parent].firstChild;
manager[i].next = next;
// we're our parent's first child now
Expand Down
4 changes: 2 additions & 2 deletions filament/src/details/Culler.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Culler {
using result_type = uint8_t;

/*
* returns whether each AABB in an array intersects with the furstum
* returns whether each AABB in an array intersects with the frustum
*/
static void intersects(result_type* results,
Frustum const& frustum,
Expand All @@ -58,7 +58,7 @@ class Culler {
size_t count, size_t bit) noexcept;

/*
* returns whether each shpere in an array intersects with the furstum
* returns whether each sphere in an array intersects with the frustum
*/
static void intersects(
result_type* results,
Expand Down
2 changes: 1 addition & 1 deletion filament/src/details/Fence.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class FFence : public Fence {
static std::condition_variable sCondition;

struct FenceSignal {
FenceSignal(Type type) noexcept : mType(type) { }
explicit FenceSignal(Type type) noexcept : mType(type) { }
enum State : uint8_t { UNSIGNALED, SIGNALED, DESTROYED };
// we store mType here instead of in FFence, because it allows sizeof(FFence) to be
// much smaller (since it needs to be multiple of 8 on 64 bits architectures)
Expand Down
5 changes: 2 additions & 3 deletions filament/src/details/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ namespace filament {
namespace details {

class FEngine;
struct ShaderGenerator;

class FMaterial : public Material {
public:
Expand Down Expand Up @@ -101,7 +100,7 @@ class FMaterial : public Material {
return mRasterState.depthFunc != Driver::RasterState::DepthFunc::A;
}
bool isDoubleSided() const noexcept { return mDoubleSided; }
float getMaskThreshold() const noexcept { return mMaskTreshold; }
float getMaskThreshold() const noexcept { return mMaskThreshold; }
bool hasShadowMultiplier() const noexcept { return mHasShadowMultiplier; }
AttributeBitset getRequiredAttributes() const noexcept { return mRequiredAttributes; }

Expand All @@ -126,7 +125,7 @@ class FMaterial : public Material {
AttributeBitset mRequiredAttributes;
bool mDoubleSided;
CullingMode mCullingMode;
float mMaskTreshold;
float mMaskThreshold;
bool mHasShadowMultiplier = false;
bool mHasCustomDepthShader = false;
bool mIsDefaultMaterial = false;
Expand Down
2 changes: 1 addition & 1 deletion filament/src/details/ResourceList.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace details {
class ResourceListBase {
public:
UTILS_NOINLINE
ResourceListBase(const char* typeName)
explicit ResourceListBase(const char* typeName)
#ifndef NDEBUG
: mTypeName(typeName)
#endif
Expand Down
6 changes: 3 additions & 3 deletions filament/src/details/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class FScene : public Scene {
~FScene() noexcept;
void terminate(FEngine& engine);

void prepare(const math::mat4f& worldOriginTansform);
void prepare(const math::mat4f& worldOriginTransform);
void prepareDynamicLights(const CameraInfo& camera, ArenaScope& arena, Handle<HwUniformBuffer> lightUbh) noexcept;
void computeBounds(Aabb& castersBox, Aabb& receiversBox, uint32_t visibleLayers) const noexcept;

Expand Down Expand Up @@ -128,13 +128,13 @@ class FScene : public Scene {

static inline uint32_t getPrimitiveCount(RenderableSoa const& soa,
uint32_t first, uint32_t last) noexcept {
// the caller must guarantee that last is dereferencable
// the caller must guarantee that last is dereferenceable
return soa.elementAt<SUMMED_PRIMITIVE_COUNT>(last) -
soa.elementAt<SUMMED_PRIMITIVE_COUNT>(first);
}

static inline uint32_t getPrimitiveCount(RenderableSoa const& soa, uint32_t last) noexcept {
// the caller must guarantee that last is dereferencable
// the caller must guarantee that last is dereferenceable
return soa.elementAt<SUMMED_PRIMITIVE_COUNT>(last);
}

Expand Down
3 changes: 1 addition & 2 deletions filament/src/details/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class FEngine;
class FMaterialInstance;
class FRenderer;
class FScene;
class Froxelizer;

class FView : public View {
public:
Expand Down Expand Up @@ -134,7 +133,7 @@ class FView : public View {

void updatePrimitivesLod(
FEngine& engine, const CameraInfo& camera,
FScene::RenderableSoa& renderableData, Range visibles) noexcept;
FScene::RenderableSoa& renderableData, Range visible) noexcept;

static void cullRenderables(utils::JobSystem& js, FScene::RenderableSoa& renderableData,
Frustum const& frustum, size_t bit) noexcept;
Expand Down
2 changes: 1 addition & 1 deletion filament/src/driver/CommandBufferQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CommandBufferQueue::CommandBufferQueue(size_t requiredSize, size_t bufferSize)
}

CommandBufferQueue::~CommandBufferQueue() {
assert(!mCommandBuffersToExecute.size());
assert(mCommandBuffersToExecute.empty());
}

void CommandBufferQueue::requestExit() {
Expand Down
2 changes: 1 addition & 1 deletion filament/src/driver/CommandBufferQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CommandBufferQueue {
// call blocks until the CircularBuffer has at least mRequiredSize bytes available.
void flush() noexcept;

// returns from waitForcommands() immediately.
// returns from waitForCommands() immediately.
void requestExit();
};

Expand Down
5 changes: 2 additions & 3 deletions filament/src/driver/CommandStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ void CommandStream::execute(void* buffer) {

Driver& UTILS_RESTRICT driver = *mDriver;
CommandBase* UTILS_RESTRICT base = static_cast<CommandBase*>(buffer);
UTILS_ALIGN_LOOP
while (UTILS_LIKELY(base)) {
base = base->execute(driver);
}
Expand All @@ -96,7 +95,7 @@ void CommandStream::execute(void* buffer) {
}

void CommandStream::queueCommand(std::function<void()> command) {
new(allocateCommand(CustomCommand::align(sizeof(CustomCommand)))) CustomCommand(command);
new(allocateCommand(CustomCommand::align(sizeof(CustomCommand)))) CustomCommand(std::move(command));
}

template<typename... ARGS>
Expand All @@ -119,7 +118,7 @@ void CommandType<void (Driver::*)(ARGS...)>::Command<METHOD>::log() noexcept {
}

/*
* When DEBUG_COMMAND_STREAM is activated, we need to explicitely instantiate the log() method
* When DEBUG_COMMAND_STREAM is activated, we need to explicitly instantiate the log() method
* (this is because we don't want it in the header file)
*/

Expand Down
Loading

0 comments on commit f8f24f4

Please sign in to comment.