2 * Copyright 2008 Ben Skeggs
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #include "draw/draw_context.h"
24 #include "pipe/p_defines.h"
25 #include "pipe/internal/p_winsys_screen.h"
27 #include "nv50_context.h"
28 #include "nv50_screen.h"
31 nv50_flush(struct pipe_context
*pipe
, unsigned flags
,
32 struct pipe_fence_handle
**fence
)
34 struct nv50_context
*nv50
= (struct nv50_context
*)pipe
;
36 FIRE_RING(nv50
->screen
->base
.channel
);
40 nv50_destroy(struct pipe_context
*pipe
)
42 struct nv50_context
*nv50
= (struct nv50_context
*)pipe
;
44 draw_destroy(nv50
->draw
);
50 nv50_set_edgeflags(struct pipe_context
*pipe
, const unsigned *bitfield
)
55 nv50_is_texture_referenced( struct pipe_context
*pipe
,
56 struct pipe_texture
*texture
,
57 unsigned face
, unsigned level
)
63 return PIPE_REFERENCED_FOR_READ
| PIPE_REFERENCED_FOR_WRITE
;
67 nv50_is_buffer_referenced( struct pipe_context
*pipe
,
68 struct pipe_buffer
*buf
)
74 return PIPE_REFERENCED_FOR_READ
| PIPE_REFERENCED_FOR_WRITE
;
78 nv50_create(struct pipe_screen
*pscreen
, unsigned pctx_id
)
80 struct pipe_winsys
*pipe_winsys
= pscreen
->winsys
;
81 struct nv50_screen
*screen
= nv50_screen(pscreen
);
82 struct nv50_context
*nv50
;
84 nv50
= CALLOC_STRUCT(nv50_context
);
87 nv50
->screen
= screen
;
88 nv50
->pctx_id
= pctx_id
;
90 nv50
->pipe
.winsys
= pipe_winsys
;
91 nv50
->pipe
.screen
= pscreen
;
93 nv50
->pipe
.destroy
= nv50_destroy
;
95 nv50
->pipe
.set_edgeflags
= nv50_set_edgeflags
;
96 nv50
->pipe
.draw_arrays
= nv50_draw_arrays
;
97 nv50
->pipe
.draw_elements
= nv50_draw_elements
;
98 nv50
->pipe
.clear
= nv50_clear
;
100 nv50
->pipe
.flush
= nv50_flush
;
102 nv50
->pipe
.is_texture_referenced
= nv50_is_texture_referenced
;
103 nv50
->pipe
.is_buffer_referenced
= nv50_is_buffer_referenced
;
105 nv50_init_surface_functions(nv50
);
106 nv50_init_state_functions(nv50
);
107 nv50_init_query_functions(nv50
);
109 nv50
->draw
= draw_create();
111 draw_set_rasterize_stage(nv50
->draw
, nv50_draw_render_stage(nv50
));