本文整理汇总了C++中CS_LOCALS函数的典型用法代码示例。如果您正苦于以下问题:C++ CS_LOCALS函数的具体用法?C++ CS_LOCALS怎么用?C++ CS_LOCALS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CS_LOCALS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: r300_render_draw_arrays
static void r300_render_draw_arrays(struct vbuf_render* render,
unsigned start,
unsigned count)
{
struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
uint8_t* ptr;
unsigned i;
unsigned dwords = 6;
CS_LOCALS(r300);
(void) i; (void) ptr;
assert(start == 0);
assert(count < (1 << 16));
DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count);
if (!r300_prepare_for_rendering(r300,
PREP_EMIT_STATES | PREP_EMIT_VARRAYS_SWTCL,
NULL, dwords, 0, 0, -1)) {
return;
}
BEGIN_CS(dwords);
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, r300render->prim));
OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count - 1);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300render->hwprim);
END_CS;
}
开发者ID:Thermionix,项目名称:Mesa-3D,代码行数:33,代码来源:r300_render.c
示例2: r300_emit_vertex_arrays_swtcl
void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, boolean indexed)
{
CS_LOCALS(r300);
DBG(r300, DBG_SWTCL, "r300: Preparing vertex buffer %p for render, "
"vertex size %d\n", r300->vbo,
r300->vertex_info.size);
/* Set the pointer to our vertex buffer. The emitted values are this:
* PACKET3 [3D_LOAD_VBPNTR]
* COUNT [1]
* FORMAT [size | stride << 8]
* OFFSET [offset into BO]
* VBPNTR [relocated BO]
*/
BEGIN_CS(7);
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
OUT_CS(1 | (!indexed ? R300_VC_FORCE_PREFETCH : 0));
OUT_CS(r300->vertex_info.size |
(r300->vertex_info.size << 8));
OUT_CS(r300->draw_vbo_offset);
OUT_CS(0);
assert(r300->vbo_cs);
OUT_CS(0xc0001000); /* PKT3_NOP */
OUT_CS(r300->rws->cs_get_reloc(r300->cs, r300->vbo_cs) * 4);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:27,代码来源:r300_emit.c
示例3: r300_emit_vertex_stream_state
void r300_emit_vertex_stream_state(struct r300_context* r300,
unsigned size, void* state)
{
struct r300_vertex_stream_state *streams =
(struct r300_vertex_stream_state*)state;
unsigned i;
CS_LOCALS(r300);
if (DBG_ON(r300, DBG_PSC)) {
fprintf(stderr, "r300: PSC emit:\n");
for (i = 0; i < streams->count; i++) {
fprintf(stderr, " : prog_stream_cntl%d: 0x%08x\n", i,
streams->vap_prog_stream_cntl[i]);
}
for (i = 0; i < streams->count; i++) {
fprintf(stderr, " : prog_stream_cntl_ext%d: 0x%08x\n", i,
streams->vap_prog_stream_cntl_ext[i]);
}
}
BEGIN_CS(size);
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, streams->count);
OUT_CS_TABLE(streams->vap_prog_stream_cntl, streams->count);
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, streams->count);
OUT_CS_TABLE(streams->vap_prog_stream_cntl_ext, streams->count);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:29,代码来源:r300_emit.c
示例4: r500_emit_fs
void r500_emit_fs(struct r300_context* r300, unsigned size, void *state)
{
struct r300_fragment_shader *fs = r300_fs(r300);
CS_LOCALS(r300);
WRITE_CS_TABLE(fs->shader->cb_code, fs->shader->cb_code_size);
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:7,代码来源:r300_emit.c
示例5: r500_emit_fs_rc_constant_state
void r500_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, void *state)
{
struct r300_fragment_shader *fs = r300_fs(r300);
struct rc_constant_list *constants = &fs->shader->code.constants;
unsigned i;
unsigned count = fs->shader->rc_state_count;
unsigned first = fs->shader->externals_count;
unsigned end = constants->Count;
CS_LOCALS(r300);
if (count == 0)
return;
BEGIN_CS(size);
for(i = first; i < end; ++i) {
if (constants->Constants[i].Type == RC_CONSTANT_STATE) {
float data[4];
get_rc_constant_state(data, r300, &constants->Constants[i]);
OUT_CS_REG(R500_GA_US_VECTOR_INDEX,
R500_GA_US_VECTOR_INDEX_TYPE_CONST |
(i & R500_GA_US_VECTOR_INDEX_MASK));
OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, 4);
OUT_CS_TABLE(data, 4);
}
}
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:29,代码来源:r300_emit.c
示例6: r300_emit_fs_constants
void r300_emit_fs_constants(struct r300_context* r300, unsigned size, void *state)
{
struct r300_fragment_shader *fs = r300_fs(r300);
struct r300_constant_buffer *buf = (struct r300_constant_buffer*)state;
unsigned count = fs->shader->externals_count;
unsigned i, j;
CS_LOCALS(r300);
if (count == 0)
return;
BEGIN_CS(size);
OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X, count * 4);
if (buf->remap_table){
for (i = 0; i < count; i++) {
float *data = (float*)&buf->ptr[buf->remap_table[i]*4];
for (j = 0; j < 4; j++)
OUT_CS(pack_float24(data[j]));
}
} else {
for (i = 0; i < count; i++)
for (j = 0; j < 4; j++)
OUT_CS(pack_float24(*(float*)&buf->ptr[i*4+j]));
}
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:27,代码来源:r300_emit.c
示例7: r300_emit_fs_rc_constant_state
void r300_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, void *state)
{
struct r300_fragment_shader *fs = r300_fs(r300);
struct rc_constant_list *constants = &fs->shader->code.constants;
unsigned i;
unsigned count = fs->shader->rc_state_count;
unsigned first = fs->shader->externals_count;
unsigned end = constants->Count;
unsigned j;
CS_LOCALS(r300);
if (count == 0)
return;
BEGIN_CS(size);
for(i = first; i < end; ++i) {
if (constants->Constants[i].Type == RC_CONSTANT_STATE) {
float data[4];
get_rc_constant_state(data, r300, &constants->Constants[i]);
OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X + i * 16, 4);
for (j = 0; j < 4; j++)
OUT_CS(pack_float24(data[j]));
}
}
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:28,代码来源:r300_emit.c
示例8: r300_emit_dsa_state
void r300_emit_dsa_state(struct r300_context* r300, unsigned size, void* state)
{
struct r300_dsa_state* dsa = (struct r300_dsa_state*)state;
struct pipe_framebuffer_state* fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
boolean is_r500 = r300->screen->caps.is_r500;
CS_LOCALS(r300);
uint32_t alpha_func = dsa->alpha_function;
/* Choose the alpha ref value between 8-bit (FG_ALPHA_FUNC.AM_VAL) and
* 16-bit (FG_ALPHA_VALUE). */
if (is_r500 && (alpha_func & R300_FG_ALPHA_FUNC_ENABLE)) {
struct pipe_surface *cb = fb->nr_cbufs ? r300_get_nonnull_cb(fb, 0) : NULL;
if (cb &&
(cb->format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
cb->format == PIPE_FORMAT_R16G16B16X16_FLOAT)) {
alpha_func |= R500_FG_ALPHA_FUNC_FP16_ENABLE;
} else {
alpha_func |= R500_FG_ALPHA_FUNC_8BIT;
}
}
/* Setup alpha-to-coverage. */
if (r300->alpha_to_coverage && r300->msaa_enable) {
/* Always set 3/6, it improves precision even for 2x and 4x MSAA. */
alpha_func |= R300_FG_ALPHA_FUNC_MASK_ENABLE |
R300_FG_ALPHA_FUNC_CFG_3_OF_6;
}
BEGIN_CS(size);
OUT_CS_REG(R300_FG_ALPHA_FUNC, alpha_func);
OUT_CS_TABLE(fb->zsbuf ? &dsa->cb_begin : dsa->cb_zb_no_readwrite, size-2);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:35,代码来源:r300_emit.c
示例9: r300_emit_draw_arrays
static void r300_emit_draw_arrays(struct r300_context *r300,
unsigned mode,
unsigned count)
{
boolean alt_num_verts = count > 65535;
CS_LOCALS(r300);
if (count >= (1 << 24)) {
fprintf(stderr, "r300: Got a huge number of vertices: %i, "
"refusing to render.\n", count);
return;
}
r300_emit_draw_init(r300, mode, count-1);
BEGIN_CS(2 + (alt_num_verts ? 2 : 0));
if (alt_num_verts) {
OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
}
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300_translate_primitive(mode) |
(alt_num_verts ? R500_VAP_VF_CNTL__USE_ALT_NUM_VERTS : 0));
END_CS;
}
开发者ID:Thermionix,项目名称:Mesa-3D,代码行数:25,代码来源:r300_render.c
示例10: r300_emit_texture_cache_inval
void r300_emit_texture_cache_inval(struct r300_context* r300, unsigned size, void* state)
{
CS_LOCALS(r300);
BEGIN_CS(size);
OUT_CS_REG(R300_TX_INVALTAGS, 0);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:8,代码来源:r300_emit.c
示例11: r300_emit_blend_color_state
void r300_emit_blend_color_state(struct r300_context* r300,
unsigned size, void* state)
{
struct r300_blend_color_state* bc = (struct r300_blend_color_state*)state;
CS_LOCALS(r300);
WRITE_CS_TABLE(bc->cb, size);
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:8,代码来源:r300_emit.c
示例12: r300_emit_clip_state
void r300_emit_clip_state(struct r300_context* r300,
unsigned size, void* state)
{
struct r300_clip_state* clip = (struct r300_clip_state*)state;
CS_LOCALS(r300);
WRITE_CS_TABLE(clip->cb, size);
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:8,代码来源:r300_emit.c
示例13: r300_emit_pvs_flush
void r300_emit_pvs_flush(struct r300_context* r300, unsigned size, void* state)
{
CS_LOCALS(r300);
BEGIN_CS(size);
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:8,代码来源:r300_emit.c
示例14: r500_emit_index_bias
void r500_emit_index_bias(struct r300_context *r300, int index_bias)
{
CS_LOCALS(r300);
BEGIN_CS(2);
OUT_CS_REG(R500_VAP_INDEX_OFFSET,
(index_bias & 0xFFFFFF) | (index_bias < 0 ? 1<<24 : 0));
END_CS;
}
开发者ID:Thermionix,项目名称:Mesa-3D,代码行数:9,代码来源:r300_render.c
示例15: r300_flush
void r300_flush(struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
struct r300_context *r300 = r300_context(pipe);
if (r300->screen->info.drm_minor >= 12) {
flags |= RADEON_FLUSH_KEEP_TILING_FLAGS;
}
if (r300->dirty_hw) {
r300_flush_and_cleanup(r300, flags, fence);
} else {
if (fence) {
/* We have to create a fence object, but the command stream is empty
* and we cannot emit an empty CS. Let's write to some reg. */
CS_LOCALS(r300);
OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0);
r300->rws->cs_flush(r300->cs, flags, fence, 0);
} else {
/* Even if hw is not dirty, we should at least reset the CS in case
* the space checking failed for the first draw operation. */
r300->rws->cs_flush(r300->cs, flags, NULL, 0);
}
}
/* Update Hyper-Z status. */
if (r300->hyperz_enabled) {
/* If there was a Z clear, keep Hyper-Z access. */
if (r300->num_z_clears) {
r300->hyperz_time_of_last_flush = os_time_get();
r300->num_z_clears = 0;
} else if (r300->hyperz_time_of_last_flush - os_time_get() > 2000000) {
/* If there hasn't been a Z clear for 2 seconds, revoke Hyper-Z access. */
r300->hiz_in_use = FALSE;
/* Decompress the Z buffer. */
if (r300->zmask_in_use) {
if (r300->locked_zbuffer) {
r300_decompress_zmask_locked(r300);
} else {
r300_decompress_zmask(r300);
}
if (fence && *fence)
r300->rws->fence_reference(fence, NULL);
r300_flush_and_cleanup(r300, flags, fence);
}
/* Revoke Hyper-Z access, so that some other process can take it. */
r300->rws->cs_request_feature(r300->cs, RADEON_FID_R300_HYPERZ_ACCESS,
FALSE);
r300->hyperz_enabled = FALSE;
}
}
}
开发者ID:Distrotech,项目名称:Mesa,代码行数:56,代码来源:r300_flush.c
示例16: r300_emit_ztop_state
void r300_emit_ztop_state(struct r300_context* r300,
unsigned size, void* state)
{
struct r300_ztop_state* ztop = (struct r300_ztop_state*)state;
CS_LOCALS(r300);
BEGIN_CS(size);
OUT_CS_REG(R300_ZB_ZTOP, ztop->z_buffer_top);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:10,代码来源:r300_emit.c
示例17: r300_render_draw_arrays
static void r300_render_draw_arrays(struct vbuf_render* render,
unsigned start,
unsigned count)
{
struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
uint8_t* ptr;
unsigned i;
unsigned dwords = 6;
CS_LOCALS(r300);
(void) i; (void) ptr;
DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count);
if (r300->draw_first_emitted) {
if (!r300_prepare_for_rendering(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
NULL, 6, 0, 0))
return;
} else {
if (!r300_emit_states(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
NULL, 0, 0))
return;
}
/* Uncomment to dump all VBOs rendered through this interface.
* Slow and noisy!
ptr = pipe_buffer_map(&r300render->r300->context,
r300render->vbo, PIPE_TRANSFER_READ,
&r300render->vbo_transfer);
for (i = 0; i < count; i++) {
printf("r300: Vertex %d\n", i);
draw_dump_emitted_vertex(&r300->vertex_info, ptr);
ptr += r300->vertex_info.size * 4;
printf("\n");
}
pipe_buffer_unmap(&r300render->r300->context, r300render->vbo,
r300render->vbo_transfer);
*/
BEGIN_CS(dwords);
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, r300render->prim));
OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count - 1);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300render->hwprim);
END_CS;
r300->draw_first_emitted = TRUE;
}
开发者ID:1065672644894730302,项目名称:Chromium,代码行数:55,代码来源:r300_render.c
示例18: r300_emit_vs_state
void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
{
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)state;
struct r300_vertex_program_code* code = &vs->code;
struct r300_screen* r300screen = r300->screen;
unsigned instruction_count = code->length / 4;
unsigned vtx_mem_size = r300screen->caps.is_r500 ? 128 : 72;
unsigned input_count = MAX2(util_bitcount(code->InputsRead), 1);
unsigned output_count = MAX2(util_bitcount(code->OutputsWritten), 1);
unsigned temp_count = MAX2(code->num_temporaries, 1);
unsigned pvs_num_slots = MIN3(vtx_mem_size / input_count,
vtx_mem_size / output_count, 10);
unsigned pvs_num_controllers = MIN2(vtx_mem_size / temp_count, 5);
CS_LOCALS(r300);
BEGIN_CS(size);
/* R300_VAP_PVS_CODE_CNTL_0
* R300_VAP_PVS_CONST_CNTL
* R300_VAP_PVS_CODE_CNTL_1
* See the r5xx docs for instructions on how to use these. */
OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) |
R300_PVS_XYZW_VALID_INST(instruction_count - 1) |
R300_PVS_LAST_INST(instruction_count - 1));
OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, instruction_count - 1);
OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0);
OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, code->length);
OUT_CS_TABLE(code->body.d, code->length);
OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(pvs_num_slots) |
R300_PVS_NUM_CNTLRS(pvs_num_controllers) |
R300_PVS_NUM_FPUS(r300screen->caps.num_vert_fpus) |
R300_PVS_VF_MAX_VTX_NUM(12) |
(r300->clip_halfz ? R300_DX_CLIP_SPACE_DEF : 0) |
(r300screen->caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
/* Emit flow control instructions. Even if there are no fc instructions,
* we still need to write the registers to make sure they are cleared. */
OUT_CS_REG(R300_VAP_PVS_FLOW_CNTL_OPC, code->fc_ops);
if (r300screen->caps.is_r500) {
OUT_CS_REG_SEQ(R500_VAP_PVS_FLOW_CNTL_ADDRS_LW_0, R300_VS_MAX_FC_OPS * 2);
OUT_CS_TABLE(code->fc_op_addrs.r500, R300_VS_MAX_FC_OPS * 2);
} else {
OUT_CS_REG_SEQ(R300_VAP_PVS_FLOW_CNTL_ADDRS_0, R300_VS_MAX_FC_OPS);
OUT_CS_TABLE(code->fc_op_addrs.r300, R300_VS_MAX_FC_OPS);
}
OUT_CS_REG_SEQ(R300_VAP_PVS_FLOW_CNTL_LOOP_INDEX_0, R300_VS_MAX_FC_OPS);
OUT_CS_TABLE(code->fc_loop_index, R300_VS_MAX_FC_OPS);
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:55,代码来源:r300_emit.c
示例19: r300_emit_sample_mask
void r300_emit_sample_mask(struct r300_context *r300,
unsigned size, void *state)
{
unsigned mask = (*(unsigned*)state) & ((1 << 6)-1);
CS_LOCALS(r300);
BEGIN_CS(size);
OUT_CS_REG(R300_SC_SCREENDOOR,
mask | (mask << 6) | (mask << 12) | (mask << 18));
END_CS;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:11,代码来源:r300_emit.c
示例20: r300_emit_hyperz_state
void r300_emit_hyperz_state(struct r300_context *r300,
unsigned size, void *state)
{
struct r300_hyperz_state *z = state;
CS_LOCALS(r300);
if (z->flush)
WRITE_CS_TABLE(&z->cb_flush_begin, size);
else
WRITE_CS_TABLE(&z->cb_begin, size - 2);
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:11,代码来源:r300_emit.c
注:本文中的CS_LOCALS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论