Commit cfd280fd authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the tracing code in shader_vaddline().

parent dd239829
......@@ -3262,6 +3262,12 @@ static BOOL shader_arb_compile(const struct wined3d_gl_info *gl_info, GLenum tar
const char *ptr, *line;
GLint native, pos;
if (TRACE_ON(d3d_shader))
{
ptr = src;
while ((line = get_line(&ptr))) TRACE_(d3d_shader)(" %.*s", (int)(ptr - line), line);
}
GL_EXTCALL(glProgramStringARB(target, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(src), src));
checkGLcall("glProgramStringARB()");
......
......@@ -344,7 +344,16 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id
/* Context activation is done by the caller. */
static void shader_glsl_compile(const struct wined3d_gl_info *gl_info, GLuint shader, const char *src)
{
const char *ptr, *line;
TRACE("Compiling shader object %u.\n", shader);
if (TRACE_ON(d3d_shader))
{
ptr = src;
while ((line = get_info_log_line(&ptr))) TRACE_(d3d_shader)(" %.*s", (int)(ptr - line), line);
}
GL_EXTCALL(glShaderSource(shader, 1, &src, NULL));
checkGLcall("glShaderSource");
GL_EXTCALL(glCompileShader(shader));
......
......@@ -249,8 +249,6 @@ void shader_buffer_clear(struct wined3d_shader_buffer *buffer)
{
buffer->buffer[0] = '\0';
buffer->content_size = 0;
buffer->lineNo = 0;
buffer->newline = TRUE;
}
BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer)
......@@ -273,48 +271,28 @@ void shader_buffer_free(struct wined3d_shader_buffer *buffer)
int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *format, va_list args)
{
char *base = buffer->buffer + buffer->content_size;
unsigned int rem;
int rc;
char *new_buffer;
while(1)
for (;;)
{
rc = vsnprintf(base, buffer->buffer_size - buffer->content_size, format, args);
if (rc < 0 /* C89 */ || (unsigned int)rc >= buffer->buffer_size - buffer->content_size /* C99 */)
{
new_buffer = HeapReAlloc(GetProcessHeap(), 0, buffer->buffer, buffer->buffer_size * 2);
if (!new_buffer)
{
ERR("The buffer allocated for the shader program string is too small at %d bytes.\n", buffer->buffer_size);
buffer->content_size = buffer->buffer_size - 1;
return -1;
}
buffer->buffer = new_buffer;
buffer->buffer_size = buffer->buffer_size * 2;
base = buffer->buffer + buffer->content_size;
}
else
{
rem = buffer->buffer_size - buffer->content_size;
rc = vsnprintf(&buffer->buffer[buffer->content_size], rem, format, args);
if (rc >= 0 /* C89 */ && (unsigned int)rc < rem /* C99 */)
break;
}
}
if (buffer->newline)
{
TRACE("GL HW (%u, %u) : %s", buffer->lineNo + 1, buffer->content_size, base);
buffer->newline = FALSE;
}
else
{
TRACE("%s", base);
if (!(new_buffer = HeapReAlloc(GetProcessHeap(), 0, buffer->buffer, buffer->buffer_size * 2)))
{
ERR("Failed to grow buffer.\n");
buffer->buffer[buffer->content_size] = '\0';
return -1;
}
buffer->buffer = new_buffer;
buffer->buffer_size = buffer->buffer_size * 2;
}
buffer->content_size += rc;
if (buffer->buffer[buffer->content_size-1] == '\n')
{
++buffer->lineNo;
buffer->newline = TRUE;
}
return 0;
}
......
......@@ -440,8 +440,6 @@ struct wined3d_shader_buffer
char *buffer;
unsigned int buffer_size;
unsigned int content_size;
unsigned int lineNo;
BOOL newline;
};
enum WINED3D_SHADER_INSTRUCTION_HANDLER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment