iris: Don't enable smooth points when point sprites are enabled
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_debug.cpp
index 11e9f92189f00305659fa423316da74a192192eb..23ada3d0433c1e1c9f8048a20c9a560ca427de6f 100644 (file)
 extern "C" boolean
 lp_check_alignment(const void *ptr, unsigned alignment)
 {
-   assert(util_is_power_of_two(alignment));
+   assert(util_is_power_of_two_or_zero(alignment));
    return ((uintptr_t)ptr & (alignment - 1)) == 0;
 }
 
-#if (defined(PIPE_OS_WINDOWS) && !defined(PIPE_CC_MSVC)) || defined(PIPE_OS_EMBEDDED)
-
-class raw_debug_ostream :
-   public llvm::raw_ostream
-{
-private:
-   uint64_t pos;
-
-public:
-   raw_debug_ostream() : pos(0) { }
-
-   void write_impl(const char *Ptr, size_t Size);
-
-   uint64_t current_pos() const { return pos; }
-   size_t preferred_buffer_size() const { return 512; }
-};
-
-
-void
-raw_debug_ostream::write_impl(const char *Ptr, size_t Size)
-{
-   if (Size > 0) {
-      char *lastPtr = (char *)&Ptr[Size];
-      char last = *lastPtr;
-      *lastPtr = 0;
-      _debug_printf("%*s", Size, Ptr);
-      *lastPtr = last;
-      pos += Size;
-   }
-}
-
-#endif
-
-extern "C" const char *
-lp_get_module_id(LLVMModuleRef module)
-{
-   return llvm::unwrap(module)->getModuleIdentifier().c_str();
-}
-
 
 /**
  * Same as LLVMDumpValue, but through our debugging channels.
@@ -110,10 +71,17 @@ lp_get_module_id(LLVMModuleRef module)
 extern "C" void
 lp_debug_dump_value(LLVMValueRef value)
 {
-#if (defined(PIPE_OS_WINDOWS) && !defined(PIPE_CC_MSVC)) || defined(PIPE_OS_EMBEDDED)
-   raw_debug_ostream os;
+#if HAVE_LLVM >= 0x0304
+   char *str = LLVMPrintValueToString(value);
+   if (str) {
+      os_log_message(str);
+      LLVMDisposeMessage(str);
+   }
+#elif defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_EMBEDDED)
+   std::string str;
+   llvm::raw_string_ostream os(str);
    llvm::unwrap(value)->print(os);
-   os.flush();
+   os_log_message(str.c_str());
 #else
    LLVMDumpValue(value);
 #endif
@@ -141,13 +109,13 @@ disassemble(const void* func, std::ostream &buffer)
     * Initialize all used objects.
     */
 
-   std::string Triple = llvm::sys::getProcessTriple();
-   LLVMDisasmContextRef D = LLVMCreateDisasm(Triple.c_str(), NULL, 0, NULL, NULL);
+   const char *triple = LLVM_HOST_TRIPLE;
+   LLVMDisasmContextRef D = LLVMCreateDisasm(triple, NULL, 0, NULL, NULL);
    char outline[1024];
 
    if (!D) {
       buffer << "error: could not create disassembler for triple "
-             << Triple.c_str() << '\n';
+             << triple << '\n';
       return 0;
    }