#include "sp_context.h"
#include "sp_state.h"
+
void *
softpipe_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *blend)
{
- struct pipe_blend_state *state = MALLOC( sizeof(struct pipe_blend_state) );
- memcpy(state, blend, sizeof(struct pipe_blend_state));
- return state;
+ return mem_dup(blend, sizeof(*blend));
}
void softpipe_bind_blend_state( struct pipe_context *pipe,
softpipe_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_alpha_state *depth_stencil)
{
- struct pipe_depth_stencil_alpha_state *state =
- MALLOC( sizeof(struct pipe_depth_stencil_alpha_state) );
- memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_alpha_state));
- return state;
+ return mem_dup(depth_stencil, sizeof(*depth_stencil));
}
void
void *
softpipe_create_rasterizer_state(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup)
+ const struct pipe_rasterizer_state *rast)
{
- struct pipe_rasterizer_state *state =
- MALLOC( sizeof(struct pipe_rasterizer_state) );
- memcpy(state, setup, sizeof(struct pipe_rasterizer_state));
- return state;
+ return mem_dup(rast, sizeof(*rast));
}
void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
softpipe_create_sampler_state(struct pipe_context *pipe,
const struct pipe_sampler_state *sampler)
{
- struct pipe_sampler_state *state = MALLOC( sizeof(struct pipe_sampler_state) );
- memcpy(state, sampler, sizeof(struct pipe_sampler_state));
- return state;
+ return mem_dup(sampler, sizeof(*sampler));
}
void