Skip to content

Commit

Permalink
Fix compilation error when DEBUG_COMMAND_STREAM is true (google#1588)
Browse files Browse the repository at this point in the history
Fixes issue google#1585
  • Loading branch information
romainguy authored Sep 3, 2019
1 parent 264cf02 commit 2bc9256
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
8 changes: 4 additions & 4 deletions filament/backend/include/backend/DriverEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ enum class Backend : uint8_t {
* Bitmask for selecting render buffers
*/
enum TargetBufferFlags : uint8_t {
NONE = 0x0, //!< No buffer selected.
COLOR = 0x1, //!< Color buffer selected.
DEPTH = 0x2, //!< Depth buffer selected.
STENCIL = 0x4, //!< Stencil buffer selected.
NONE = 0x0u, //!< No buffer selected.
COLOR = 0x1u, //!< Color buffer selected.
DEPTH = 0x2u, //!< Depth buffer selected.
STENCIL = 0x4u, //!< Stencil buffer selected.
COLOR_AND_DEPTH = COLOR | DEPTH,
COLOR_AND_STENCIL = COLOR | STENCIL,
DEPTH_AND_STENCIL = DEPTH | STENCIL,
Expand Down
4 changes: 2 additions & 2 deletions filament/backend/include/private/backend/CommandStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
#include <thread>
#include <utility>

#include <assert.h>
#include <cassert>
#include <cstddef>
#include <stdint.h>
#include <cstdint>

// Set to true to print every commands out on log.d. This requires RTTI and DEBUG
#define DEBUG_COMMAND_STREAM false
Expand Down
1 change: 1 addition & 0 deletions filament/backend/include/private/backend/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::Pixel
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::Precision precision);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PrimitiveType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TargetBufferFlags f);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::RenderPassParams const& b);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareFunc func);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareMode mode);
Expand Down
31 changes: 21 additions & 10 deletions filament/backend/src/CommandStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ io::ostream& operator<<(io::ostream& out, PixelDataFormat format) {
CASE(PixelDataFormat, DEPTH_COMPONENT)
CASE(PixelDataFormat, DEPTH_STENCIL)
CASE(PixelDataFormat, ALPHA)
CASE(PixelDataFormat, UNUSED)
}
return out;
}
Expand All @@ -287,6 +288,7 @@ io::ostream& operator<<(io::ostream& out, PixelDataType format) {
CASE(PixelDataType, HALF)
CASE(PixelDataType, FLOAT)
CASE(PixelDataType, COMPRESSED)
CASE(PixelDataType, UINT_10F_11F_11F_REV)
}
return out;
}
Expand Down Expand Up @@ -401,6 +403,8 @@ io::ostream& operator<<(io::ostream& out, TextureUsage usage) {
CASE(TextureUsage, COLOR_ATTACHMENT)
CASE(TextureUsage, DEPTH_ATTACHMENT)
CASE(TextureUsage, STENCIL_ATTACHMENT)
CASE(TextureUsage, UPLOADABLE)
CASE(TextureUsage, SAMPLEABLE)
}
return out;
}
Expand Down Expand Up @@ -475,7 +479,7 @@ io::ostream& operator<<(io::ostream& out, SamplerParams params) {
<< params.wrapS << ", "
<< params.wrapT << ", "
<< params.wrapR << ", "
<< (1 << params.anisotropyLog2) << ", "
<< (1u << params.anisotropyLog2) << ", "
<< params.compareMode << ", "
<< params.compareFunc
<< " }";
Expand Down Expand Up @@ -531,22 +535,22 @@ io::ostream& operator<<(io::ostream& out, const PipelineState& ps) {
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, BufferDescriptor const& b) {
out << "BufferDescriptor { buffer=" << b.buffer
<< ", size=" << b.size
<< ", callback=" << b.getCallback()
<< ", user=" << b.getUser() << " }";
<< ", size=" << b.size
<< ", callback=" << b.getCallback()
<< ", user=" << b.getUser() << " }";
return out;
}

UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, PixelBufferDescriptor const& b) {
BufferDescriptor const& base = static_cast<BufferDescriptor const&>(b);
out << "PixelBufferDescriptor { " << base
<< ", left=" << b.left
<< ", top=" << b.top
<< ", stride=" << b.stride
<< ", format=" << b.format
<< ", type=" << b.type
<< ", alignment=" << b.alignment << " }";
<< ", left=" << b.left
<< ", top=" << b.top
<< ", stride=" << b.stride
<< ", format=" << b.format
<< ", type=" << b.type
<< ", alignment=" << b.alignment << " }";
return out;
}

Expand All @@ -560,6 +564,13 @@ io::ostream& operator<<(io::ostream& out, filament::backend::Viewport const& vie
return out;
}

UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, TargetBufferFlags flags) {
// TODO: implement decoding of enum
out << uint8_t(flags);
return out;
}

UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, RenderPassParams const& params) {
out << "RenderPassParams{"
Expand Down
14 changes: 7 additions & 7 deletions libs/utils/include/utils/Profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class Profiler {
public:

enum {
EV_CPU_CYCLES = 1 << CPU_CYCLES,
EV_L1D_REFS = 1 << DCACHE_REFS,
EV_L1D_MISSES = 1 << DCACHE_MISSES,
EV_BPU_REFS = 1 << BRANCHES,
EV_BPU_MISSES = 1 << BRANCH_MISSES,
EV_L1I_REFS = 1 << ICACHE_REFS,
EV_L1I_MISSES = 1 << ICACHE_MISSES,
EV_CPU_CYCLES = 1u << CPU_CYCLES,
EV_L1D_REFS = 1u << DCACHE_REFS,
EV_L1D_MISSES = 1u << DCACHE_MISSES,
EV_BPU_REFS = 1u << BRANCHES,
EV_BPU_MISSES = 1u << BRANCH_MISSES,
EV_L1I_REFS = 1u << ICACHE_REFS,
EV_L1I_MISSES = 1u << ICACHE_MISSES,
// helpers
EV_L1D_RATES = EV_L1D_REFS | EV_L1D_MISSES,
EV_L1I_RATES = EV_L1I_REFS | EV_L1I_MISSES,
Expand Down

0 comments on commit 2bc9256

Please sign in to comment.