~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/mesa/shader/slang/slang_log.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Mesa 3-D graphics library
3
 
 * Version:  7.3
4
 
 *
5
 
 * Copyright (C) 2005-2007  Brian Paul   All Rights Reserved.
6
 
 * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
7
 
 *
8
 
 * Permission is hereby granted, free of charge, to any person obtaining a
9
 
 * copy of this software and associated documentation files (the "Software"),
10
 
 * to deal in the Software without restriction, including without limitation
11
 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
 
 * and/or sell copies of the Software, and to permit persons to whom the
13
 
 * Software is furnished to do so, subject to the following conditions:
14
 
 *
15
 
 * The above copyright notice and this permission notice shall be included
16
 
 * in all copies or substantial portions of the Software.
17
 
 *
18
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19
 
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21
 
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22
 
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
 
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
 
 */
25
 
 
26
 
#include "main/imports.h"
27
 
#include "slang_log.h"
28
 
#include "slang_utility.h"
29
 
 
30
 
 
31
 
 
32
 
static char *out_of_memory = "Error: Out of memory.\n";
33
 
 
34
 
void
35
 
slang_info_log_construct(slang_info_log * log)
36
 
{
37
 
   log->text = NULL;
38
 
   log->dont_free_text = GL_FALSE;
39
 
   log->error_flag = GL_FALSE;
40
 
}
41
 
 
42
 
void
43
 
slang_info_log_destruct(slang_info_log * log)
44
 
{
45
 
   if (!log->dont_free_text)
46
 
      free(log->text);
47
 
}
48
 
 
49
 
static int
50
 
slang_info_log_message(slang_info_log * log, const char *prefix,
51
 
                       const char *msg)
52
 
{
53
 
   GLuint size;
54
 
 
55
 
   if (log->dont_free_text)
56
 
      return 0;
57
 
   size = slang_string_length(msg) + 2;
58
 
   if (prefix != NULL)
59
 
      size += slang_string_length(prefix) + 2;
60
 
   if (log->text != NULL) {
61
 
      GLuint old_len = slang_string_length(log->text);
62
 
      log->text = (char *)
63
 
         _mesa_realloc(log->text, old_len + 1, old_len + size);
64
 
   }
65
 
   else {
66
 
      log->text = (char *) (malloc(size));
67
 
      if (log->text != NULL)
68
 
         log->text[0] = '\0';
69
 
   }
70
 
   if (log->text == NULL)
71
 
      return 0;
72
 
   if (prefix != NULL) {
73
 
      slang_string_concat(log->text, prefix);
74
 
      slang_string_concat(log->text, ": ");
75
 
   }
76
 
   slang_string_concat(log->text, msg);
77
 
   slang_string_concat(log->text, "\n");
78
 
 
79
 
   return 1;
80
 
}
81
 
 
82
 
int
83
 
slang_info_log_print(slang_info_log * log, const char *msg, ...)
84
 
{
85
 
   va_list va;
86
 
   char buf[1024];
87
 
 
88
 
   va_start(va, msg);
89
 
   vsprintf(buf, msg, va);
90
 
   va_end(va);
91
 
   return slang_info_log_message(log, NULL, buf);
92
 
}
93
 
 
94
 
int
95
 
slang_info_log_error(slang_info_log * log, const char *msg, ...)
96
 
{
97
 
   va_list va;
98
 
   char buf[1024];
99
 
 
100
 
   va_start(va, msg);
101
 
   vsprintf(buf, msg, va);
102
 
   va_end(va);
103
 
   log->error_flag = GL_TRUE;
104
 
   if (slang_info_log_message(log, "Error", buf))
105
 
      return 1;
106
 
   slang_info_log_memory(log);
107
 
   return 0;
108
 
}
109
 
 
110
 
int
111
 
slang_info_log_warning(slang_info_log * log, const char *msg, ...)
112
 
{
113
 
   va_list va;
114
 
   char buf[1024];
115
 
 
116
 
   va_start(va, msg);
117
 
   vsprintf(buf, msg, va);
118
 
   va_end(va);
119
 
   if (slang_info_log_message(log, "Warning", buf))
120
 
      return 1;
121
 
   slang_info_log_memory(log);
122
 
   return 0;
123
 
}
124
 
 
125
 
void
126
 
slang_info_log_memory(slang_info_log * log)
127
 
{
128
 
   if (!slang_info_log_message(log, "Error", "Out of memory.")) {
129
 
      log->dont_free_text = GL_TRUE;
130
 
      log->error_flag = GL_TRUE;
131
 
      log->text = out_of_memory;
132
 
   }
133
 
}