mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
wined3d: Make shader buffer dynamic.
This commit is contained in:
parent
b5ff0a6983
commit
cf12f51b15
@ -251,6 +251,7 @@ BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer)
|
||||
ERR("Failed to allocate shader buffer memory.\n");
|
||||
return FALSE;
|
||||
}
|
||||
buffer->buffer_size = SHADER_PGMSIZE;
|
||||
|
||||
shader_buffer_clear(buffer);
|
||||
return TRUE;
|
||||
@ -265,15 +266,28 @@ int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *format, va
|
||||
{
|
||||
char *base = buffer->buffer + buffer->content_size;
|
||||
int rc;
|
||||
char *new_buffer;
|
||||
|
||||
rc = vsnprintf(base, SHADER_PGMSIZE - 1 - buffer->content_size, format, args);
|
||||
|
||||
if (rc < 0 /* C89 */ || (unsigned int)rc > SHADER_PGMSIZE - 1 - buffer->content_size /* C99 */)
|
||||
while(1)
|
||||
{
|
||||
ERR("The buffer allocated for the shader program string "
|
||||
"is too small at %d bytes.\n", SHADER_PGMSIZE);
|
||||
buffer->content_size = SHADER_PGMSIZE - 1;
|
||||
return -1;
|
||||
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
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer->newline)
|
||||
|
@ -402,11 +402,12 @@ enum wined3d_shader_rel_op
|
||||
* Shader model 3 according to msdn (and for software shaders) */
|
||||
#define MAX_LABELS 16
|
||||
|
||||
#define SHADER_PGMSIZE 65535
|
||||
#define SHADER_PGMSIZE 16384
|
||||
|
||||
struct wined3d_shader_buffer
|
||||
{
|
||||
char *buffer;
|
||||
unsigned int buffer_size;
|
||||
unsigned int content_size;
|
||||
unsigned int lineNo;
|
||||
BOOL newline;
|
||||
|
Loading…
Reference in New Issue
Block a user