本文整理汇总了C++中draw_do_flush函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_do_flush函数的具体用法?C++ draw_do_flush怎么用?C++ draw_do_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_do_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_set_clip_state
/**
* Set the draw module's clipping state.
*/
void draw_set_clip_state( struct draw_context *draw,
const struct pipe_clip_state *clip )
{
draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE);
memcpy(&draw->plane[6], clip->ucp, sizeof(clip->ucp));
}
示例2: draw_set_mapped_constant_buffer
void
draw_set_mapped_constant_buffer(struct draw_context *draw,
unsigned shader_type,
unsigned slot,
const void *buffer,
unsigned size )
{
debug_assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_GEOMETRY);
debug_assert(slot < PIPE_MAX_CONSTANT_BUFFERS);
draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE);
switch (shader_type) {
case PIPE_SHADER_VERTEX:
draw->pt.user.vs_constants[slot] = buffer;
draw->pt.user.vs_constants_size[slot] = size;
break;
case PIPE_SHADER_GEOMETRY:
draw->pt.user.gs_constants[slot] = buffer;
draw->pt.user.gs_constants_size[slot] = size;
break;
default:
assert(0 && "invalid shader type in draw_set_mapped_constant_buffer");
}
}
示例3: draw_pt_so_emit_prepare
void draw_pt_so_emit_prepare(struct pt_so_emit *emit)
{
struct draw_context *draw = emit->draw;
emit->has_so = (draw->vs.vertex_shader->state.stream_output.num_outputs > 0);
/* if we have a state with outputs make sure we have
* buffers to output to */
if (emit->has_so) {
boolean has_valid_buffer = FALSE;
unsigned i;
for (i = 0; i < draw->so.num_targets; ++i) {
if (draw->so.targets[i]) {
has_valid_buffer = TRUE;
break;
}
}
emit->has_so = has_valid_buffer;
}
if (!emit->has_so)
return;
/* XXX: need to flush to get prim_vbuf.c to release its allocation??
*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
}
示例4: draw_set_samplers
void
draw_set_samplers(struct draw_context *draw,
unsigned shader_stage,
struct pipe_sampler_state **samplers,
unsigned num)
{
unsigned i;
debug_assert(shader_stage < PIPE_SHADER_TYPES);
debug_assert(num <= PIPE_MAX_SAMPLERS);
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
for (i = 0; i < num; ++i)
draw->samplers[shader_stage][i] = samplers[i];
for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
draw->samplers[shader_stage][i] = NULL;
draw->num_samplers[shader_stage] = num;
#ifdef HAVE_LLVM
if (draw->llvm && shader_stage == PIPE_SHADER_VERTEX)
draw_llvm_set_sampler_state(draw);
#endif
}
示例5: fse_run_linear
static void
fse_run_linear(struct draw_pt_middle_end *middle,
unsigned start,
unsigned count,
unsigned prim_flags)
{
struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle;
struct draw_context *draw = fse->draw;
char *hw_verts;
/* XXX: need to flush to get prim_vbuf.c to release its allocation??
*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
if (!draw->render->allocate_vertices( draw->render,
(ushort)fse->key.output_stride,
(ushort)count ))
goto fail;
hw_verts = draw->render->map_vertices( draw->render );
if (!hw_verts)
goto fail;
/* Single routine to fetch vertices, run shader and emit HW verts.
* Clipping is done elsewhere -- either by the API or on hardware,
* or for some other reason not required...
*/
fse->active->run_linear( fse->active,
start, count,
hw_verts );
if (0) {
unsigned i;
for (i = 0; i < count; i++) {
debug_printf("\n\n%s vertex %d: (stride %d, offset %d)\n", __FUNCTION__, i,
fse->key.output_stride,
fse->key.output_stride * i);
draw_dump_emitted_vertex( fse->vinfo,
(const uint8_t *)hw_verts + fse->key.output_stride * i );
}
}
draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
/* Draw arrays path to avoid re-emitting index list again and
* again.
*/
draw->render->draw_arrays( draw->render,
0,
count );
draw->render->release_vertices( draw->render );
return;
fail:
debug_warn_once("allocate or map of vertex buffer failed (out of memory?)");
return;
}
示例6: draw_set_viewport_states
/**
* Set the draw module's viewport state.
*/
void draw_set_viewport_states( struct draw_context *draw,
unsigned start_slot,
unsigned num_viewports,
const struct pipe_viewport_state *vps )
{
const struct pipe_viewport_state *viewport = vps;
draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE);
debug_assert(start_slot < PIPE_MAX_VIEWPORTS);
debug_assert((start_slot + num_viewports) <= PIPE_MAX_VIEWPORTS);
memcpy(draw->viewports + start_slot, vps,
sizeof(struct pipe_viewport_state) * num_viewports);
draw->identity_viewport = (num_viewports == 1) &&
(viewport->scale[0] == 1.0f &&
viewport->scale[1] == 1.0f &&
viewport->scale[2] == 1.0f &&
viewport->scale[3] == 1.0f &&
viewport->translate[0] == 0.0f &&
viewport->translate[1] == 0.0f &&
viewport->translate[2] == 0.0f &&
viewport->translate[3] == 0.0f);
draw->driver.bypass_clip_xy = vps[0].scale[3] == 0.0f;
draw->clip_xy = !draw->driver.bypass_clip_xy;
draw->identity_viewport =
draw->identity_viewport || vps[0].scale[3] == 0.0f;
}
示例7: draw_set_rasterize_stage
/**
* Plug in the primitive rendering/rasterization stage (which is the last
* stage in the drawing pipeline).
* This is provided by the device driver.
*/
void draw_set_rasterize_stage( struct draw_context *draw,
struct draw_stage *stage )
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->pipeline.rasterize = stage;
}
示例8: draw_pt_so_emit_prepare
void draw_pt_so_emit_prepare(struct pt_so_emit *emit, boolean use_pre_clip_pos)
{
struct draw_context *draw = emit->draw;
emit->use_pre_clip_pos = use_pre_clip_pos;
emit->has_so = draw_has_so(draw);
if (use_pre_clip_pos)
emit->pos_idx = draw_current_shader_position_output(draw);
/* if we have a state with outputs make sure we have
* buffers to output to */
if (emit->has_so) {
boolean has_valid_buffer = FALSE;
unsigned i;
for (i = 0; i < draw->so.num_targets; ++i) {
if (draw->so.targets[i]) {
has_valid_buffer = TRUE;
break;
}
}
emit->has_so = has_valid_buffer;
}
if (!emit->has_so)
return;
/* XXX: need to flush to get prim_vbuf.c to release its allocation??
*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
}
示例9: fetch_emit_run
static void fetch_emit_run( struct draw_pt_middle_end *middle,
const unsigned *fetch_elts,
unsigned fetch_count,
const ushort *draw_elts,
unsigned draw_count,
unsigned prim_flags )
{
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
void *hw_verts;
/* XXX: need to flush to get prim_vbuf.c to release its allocation??
*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
draw->render->allocate_vertices( draw->render,
(ushort)feme->translate->key.output_stride,
(ushort)fetch_count );
hw_verts = draw->render->map_vertices( draw->render );
if (!hw_verts) {
assert(0);
return;
}
/* Single routine to fetch vertices and emit HW verts.
*/
feme->translate->run_elts( feme->translate,
fetch_elts,
fetch_count,
draw->instance_id,
hw_verts );
if (0) {
unsigned i;
for (i = 0; i < fetch_count; i++) {
debug_printf("\n\nvertex %d:\n", i);
draw_dump_emitted_vertex( feme->vinfo,
(const uint8_t *)hw_verts + feme->vinfo->size * 4 * i );
}
}
draw->render->unmap_vertices( draw->render,
0,
(ushort)(fetch_count - 1) );
/* XXX: Draw arrays path to avoid re-emitting index list again and
* again.
*/
draw->render->draw_elements( draw->render,
draw_elts,
draw_count );
/* Done -- that was easy, wasn't it:
*/
draw->render->release_vertices( draw->render );
}
示例10: draw_bind_fragment_shader
void
draw_bind_fragment_shader(struct draw_context *draw,
struct draw_fragment_shader *dfs)
{
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
draw->fs.fragment_shader = dfs;
}
示例11: draw_set_driver_clipping
void draw_set_driver_clipping( struct draw_context *draw,
boolean bypass_clipping )
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->driver.bypass_clipping = bypass_clipping;
draw->bypass_clipping = draw->driver.bypass_clipping;
}
示例12: fse_run
static void
fse_run(struct draw_pt_middle_end *middle,
const unsigned *fetch_elts,
unsigned fetch_count,
const ushort *draw_elts,
unsigned draw_count,
unsigned prim_flags )
{
struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle;
struct draw_context *draw = fse->draw;
void *hw_verts;
/* XXX: need to flush to get prim_vbuf.c to release its allocation??
*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
if (!draw->render->allocate_vertices( draw->render,
(ushort)fse->key.output_stride,
(ushort)fetch_count ))
goto fail;
hw_verts = draw->render->map_vertices( draw->render );
if (!hw_verts)
goto fail;
/* Single routine to fetch vertices, run shader and emit HW verts.
*/
fse->active->run_elts( fse->active,
fetch_elts,
fetch_count,
hw_verts );
if (0) {
unsigned i;
for (i = 0; i < fetch_count; i++) {
debug_printf("\n\n%s vertex %d:\n", __FUNCTION__, i);
draw_dump_emitted_vertex( fse->vinfo,
(const uint8_t *)hw_verts +
fse->key.output_stride * i );
}
}
draw->render->unmap_vertices( draw->render, 0, (ushort)(fetch_count - 1) );
draw->render->draw_elements( draw->render,
draw_elts,
draw_count );
draw->render->release_vertices( draw->render );
return;
fail:
assert(0);
return;
}
示例13: draw_set_clip_state
/**
* Set the draw module's clipping state.
*/
void draw_set_clip_state( struct draw_context *draw,
const struct pipe_clip_state *clip )
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
assert(clip->nr <= PIPE_MAX_CLIP_PLANES);
memcpy(&draw->plane[6], clip->ucp, clip->nr * sizeof(clip->ucp[0]));
draw->nr_planes = 6 + clip->nr;
}
示例14: fetch_emit_run_linear
static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
unsigned start,
unsigned count )
{
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
void *hw_verts;
/* XXX: need to flush to get prim_vbuf.c to release its allocation??
*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
if (count >= UNDEFINED_VERTEX_ID)
goto fail;
if (!draw->render->allocate_vertices( draw->render,
(ushort)feme->translate->key.output_stride,
(ushort)count ))
goto fail;
hw_verts = draw->render->map_vertices( draw->render );
if (!hw_verts)
goto fail;
/* Single routine to fetch vertices and emit HW verts.
*/
feme->translate->run( feme->translate,
start,
count,
hw_verts );
if (0) {
unsigned i;
for (i = 0; i < count; i++) {
debug_printf("\n\nvertex %d:\n", i);
draw_dump_emitted_vertex( feme->vinfo,
(const uint8_t *)hw_verts + feme->vinfo->size * 4 * i );
}
}
draw->render->unmap_vertices( draw->render, 0, count - 1 );
/* XXX: Draw arrays path to avoid re-emitting index list again and
* again.
*/
draw->render->draw_arrays( draw->render, 0, count );
/* Done -- that was easy, wasn't it:
*/
draw->render->release_vertices( draw->render );
return;
fail:
assert(0);
return;
}
示例15: draw_set_rasterizer_state
/**
* Register new primitive rasterization/rendering state.
* This causes the drawing pipeline to be rebuilt.
*/
void draw_set_rasterizer_state( struct draw_context *draw,
const struct pipe_rasterizer_state *raster )
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->rasterizer = raster;
draw->bypass_clipping =
((draw->rasterizer && draw->rasterizer->bypass_clipping) ||
draw->driver.bypass_clipping);
}