Silent compilation warning in sampler functions.
authorZhigang Gong <zhigang.gong@intel.com>
Sat, 8 Feb 2014 06:12:02 +0000 (14:12 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 11 Feb 2014 09:23:54 +0000 (17:23 +0800)
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
backend/src/ir/sampler.cpp
backend/src/ir/sampler.hpp
src/cl_sampler.c

index 462fab7..b67c1b7 100644 (file)
@@ -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";
index e6706b9..dd1f3b6 100644 (file)
@@ -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<uint32_t, SamplerRegSlot> samplerMap;
+    map<uint32_t, uint32_t> samplerMap;
     GBE_CLASS(SamplerSet);
   };
 } /* namespace ir */
index 3e88128..d718256 100644 (file)
@@ -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;