aaline_stage_from_pipe(struct pipe_context *pipe)
{
struct draw_context *draw = (struct draw_context *) pipe->draw;
- return aaline_stage(draw->pipeline.aaline);
+
+ if (draw) {
+ return aaline_stage(draw->pipeline.aaline);
+ } else {
+ return NULL;
+ }
}
const struct pipe_shader_state *fs)
{
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
- struct aaline_fragment_shader *aafs = CALLOC_STRUCT(aaline_fragment_shader);
+ struct aaline_fragment_shader *aafs = NULL;
+
+ if (aaline == NULL)
+ return NULL;
+
+ aafs = CALLOC_STRUCT(aaline_fragment_shader);
if (aafs == NULL)
return NULL;
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
+ if (aaline == NULL) {
+ return;
+ }
+
/* save current */
aaline->fs = aafs;
/* pass-through */
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
- /* pass-through */
- aaline->driver_delete_fs_state(pipe, aafs->driver_fs);
+ if (aafs == NULL) {
+ return;
+ }
- if (aafs->aaline_fs)
- aaline->driver_delete_fs_state(pipe, aafs->aaline_fs);
+ if (aaline != NULL) {
+ /* pass-through */
+ aaline->driver_delete_fs_state(pipe, aafs->driver_fs);
- FREE((void*)aafs->state.tokens);
+ if (aafs->aaline_fs)
+ aaline->driver_delete_fs_state(pipe, aafs->aaline_fs);
+ }
+ FREE((void*)aafs->state.tokens);
FREE(aafs);
}
{
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
+ if (aaline == NULL) {
+ return;
+ }
+
/* save current */
memcpy(aaline->state.sampler, sampler, num * sizeof(void *));
aaline->num_samplers = num;
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
uint i;
+ if (aaline == NULL) {
+ return;
+ }
+
/* save current */
for (i = 0; i < num; i++) {
pipe_sampler_view_reference(&aaline->state.sampler_views[i], views[i]);