wined3d: Allow shader_buffer_init() to fail.
This commit is contained in:
parent
40b411958b
commit
483d552e21
|
@ -4006,7 +4006,12 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *
|
|||
pixelshader_update_samplers(&shader->baseShader.reg_maps,
|
||||
((IWineD3DDeviceImpl *)shader->baseShader.device)->stateBlock->textures);
|
||||
|
||||
shader_buffer_init(&buffer);
|
||||
if (!shader_buffer_init(&buffer))
|
||||
{
|
||||
ERR("Failed to initialize shader buffer.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = shader_arb_generate_pshader(shader, &buffer, args,
|
||||
&shader_data->gl_shaders[shader_data->num_gl_shaders]);
|
||||
shader_buffer_free(&buffer);
|
||||
|
@ -4076,7 +4081,12 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl
|
|||
|
||||
shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args;
|
||||
|
||||
shader_buffer_init(&buffer);
|
||||
if (!shader_buffer_init(&buffer))
|
||||
{
|
||||
ERR("Failed to initialize shader buffer.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = shader_arb_generate_vshader(shader, &buffer, args,
|
||||
&shader_data->gl_shaders[shader_data->num_gl_shaders]);
|
||||
shader_buffer_free(&buffer);
|
||||
|
@ -5541,7 +5551,11 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
|
|||
}
|
||||
|
||||
/* Shader header */
|
||||
shader_buffer_init(&buffer);
|
||||
if (!shader_buffer_init(&buffer))
|
||||
{
|
||||
ERR("Failed to initialize shader buffer.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
shader_addline(&buffer, "!!ARBfp1.0\n");
|
||||
|
||||
|
@ -6304,7 +6318,11 @@ static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum yuv_fixup yuv_fixu
|
|||
struct arbfp_blit_priv *priv = device->blit_priv;
|
||||
|
||||
/* Shader header */
|
||||
shader_buffer_init(&buffer);
|
||||
if (!shader_buffer_init(&buffer))
|
||||
{
|
||||
ERR("Failed to initialize shader buffer.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glGenProgramsARB(1, &shader));
|
||||
|
|
|
@ -146,10 +146,17 @@ void shader_buffer_clear(struct wined3d_shader_buffer *buffer)
|
|||
buffer->newline = TRUE;
|
||||
}
|
||||
|
||||
void shader_buffer_init(struct wined3d_shader_buffer *buffer)
|
||||
BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer)
|
||||
{
|
||||
buffer->buffer = HeapAlloc(GetProcessHeap(), 0, SHADER_PGMSIZE);
|
||||
if (!buffer->buffer)
|
||||
{
|
||||
ERR("Failed to allocate shader buffer memory.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
shader_buffer_clear(buffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void shader_buffer_free(struct wined3d_shader_buffer *buffer)
|
||||
|
|
|
@ -4456,7 +4456,11 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
|
|||
struct shader_glsl_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_glsl_priv));
|
||||
SIZE_T stack_size = wined3d_log2i(max(GL_LIMITS(vshader_constantsF), GL_LIMITS(pshader_constantsF))) + 1;
|
||||
|
||||
shader_buffer_init(&priv->shader_buffer);
|
||||
if (!shader_buffer_init(&priv->shader_buffer))
|
||||
{
|
||||
ERR("Failed to initialize shader buffer.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
priv->stack = HeapAlloc(GetProcessHeap(), 0, stack_size * sizeof(*priv->stack));
|
||||
if (!priv->stack)
|
||||
|
|
|
@ -2601,7 +2601,7 @@ typedef struct IWineD3DBaseShaderImpl {
|
|||
} IWineD3DBaseShaderImpl;
|
||||
|
||||
void shader_buffer_clear(struct wined3d_shader_buffer *buffer);
|
||||
void shader_buffer_init(struct wined3d_shader_buffer *buffer);
|
||||
BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer);
|
||||
void shader_buffer_free(struct wined3d_shader_buffer *buffer);
|
||||
void shader_cleanup(IWineD3DBaseShader *iface);
|
||||
void shader_dump_src_param(const struct wined3d_shader_src_param *param,
|
||||
|
|
Loading…
Reference in New Issue