From e5869701daebd3c2cc092d373475c5d15eb3e193 Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Sat, 8 Feb 2014 14:12:02 +0800 Subject: [PATCH] Silent compilation warning in sampler functions. Signed-off-by: Zhigang Gong Reviewed-by: "Yang, Rong R" --- backend/src/ir/sampler.cpp | 21 +++++++++------------ backend/src/ir/sampler.hpp | 9 ++------- src/cl_sampler.c | 4 ++-- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/backend/src/ir/sampler.cpp b/backend/src/ir/sampler.cpp index 462fab7..b67c1b7 100644 --- a/backend/src/ir/sampler.cpp +++ b/backend/src/ir/sampler.cpp @@ -28,17 +28,16 @@ namespace gbe { namespace ir { uint8_t SamplerSet::appendReg(uint32_t key, Context *ctx) { - struct SamplerRegSlot samplerSlot; - samplerSlot.slot = samplerMap.size(); + uint8_t samplerSlot = samplerMap.size(); samplerMap.insert(std::make_pair(key, samplerSlot)); - return samplerSlot.slot; + return samplerSlot; } uint8_t SamplerSet::append(uint32_t samplerValue, Context *ctx) { auto it = samplerMap.find(samplerValue); if (it != samplerMap.end()) - return it->second.slot; + return it->second; // This register is just used as a key. return appendReg(samplerValue, ctx); } @@ -58,7 +57,7 @@ namespace ir { auto it = samplerMap.find(SAMPLER_ID(id)); if (it != samplerMap.end()) { - return it->second.slot; + return it->second; } return appendReg(SAMPLER_ID(id), ctx); } @@ -75,8 +74,7 @@ namespace ir { OUT_UPDATE_SZ(samplerMap.size()); for (auto iter : samplerMap) { OUT_UPDATE_SZ(iter.first); - OUT_UPDATE_SZ(iter.second.reg); - OUT_UPDATE_SZ(iter.second.slot); + OUT_UPDATE_SZ(iter.second); } OUT_UPDATE_SZ(magic_end); @@ -97,12 +95,11 @@ namespace ir { IN_UPDATE_SZ(sampler_map_sz); for (size_t i = 0; i < sampler_map_sz; i++) { uint32_t key; - ir::SamplerRegSlot reg_slot; + uint32_t slot; IN_UPDATE_SZ(key); - IN_UPDATE_SZ(reg_slot.reg); - IN_UPDATE_SZ(reg_slot.slot); - samplerMap.insert(std::make_pair(key, reg_slot)); + IN_UPDATE_SZ(slot); + samplerMap.insert(std::make_pair(key, slot)); } IN_UPDATE_SZ(magic); @@ -129,7 +126,7 @@ namespace ir { for (auto iter : samplerMap) { outs << spaces_nl << " [" << iter.first << ", " - << iter.second.reg << ", " << iter.second.slot << "]\n"; + << iter.second << "]\n"; } outs << spaces << "------------- End SamplerSet -------------" << "\n"; diff --git a/backend/src/ir/sampler.hpp b/backend/src/ir/sampler.hpp index e6706b9..dd1f3b6 100644 --- a/backend/src/ir/sampler.hpp +++ b/backend/src/ir/sampler.hpp @@ -36,11 +36,6 @@ namespace ir { */ class Context; - struct SamplerRegSlot { - Register reg; - uint32_t slot; - }; - class SamplerSet : public Serializable { public: @@ -54,7 +49,7 @@ namespace ir { size_t getDataSize(void) const { return samplerMap.size(); } void getData(uint32_t *samplers) const { for(auto &it : samplerMap) - samplers[it.second.slot] = it.first; + samplers[it.second] = it.first; } void operator = (const SamplerSet& other) { @@ -88,7 +83,7 @@ namespace ir { private: uint8_t appendReg(uint32_t key, Context *ctx); - map samplerMap; + map samplerMap; GBE_CLASS(SamplerSet); }; } /* namespace ir */ diff --git a/src/cl_sampler.c b/src/cl_sampler.c index 3e88128..d718256 100644 --- a/src/cl_sampler.c +++ b/src/cl_sampler.c @@ -30,8 +30,8 @@ uint32_t cl_to_clk(cl_bool normalized_coords, cl_addressing_mode address, cl_filter_mode filter) { - int clk_address; - int clk_filter; + int clk_address = CLK_ADDRESS_NONE; + int clk_filter = CLK_FILTER_NEAREST; switch (address) { case CL_ADDRESS_NONE: clk_address = CLK_ADDRESS_NONE; break; case CL_ADDRESS_CLAMP: clk_address = CLK_ADDRESS_CLAMP; break; -- 2.7.4