本文整理汇总了C++中ralloc_context函数的典型用法代码示例。如果您正苦于以下问题:C++ ralloc_context函数的具体用法?C++ ralloc_context怎么用?C++ ralloc_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ralloc_context函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: brw_codegen_tcs_prog
static bool
brw_codegen_tcs_prog(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct brw_program *tcp,
struct brw_tcs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
const struct brw_compiler *compiler = brw->screen->compiler;
const struct gen_device_info *devinfo = compiler->devinfo;
struct brw_stage_state *stage_state = &brw->tcs.base;
nir_shader *nir;
struct brw_tcs_prog_data prog_data;
bool start_busy = false;
double start_time = 0;
void *mem_ctx = ralloc_context(NULL);
if (tcp) {
nir = tcp->program.nir;
} else {
/* Create a dummy nir_shader. We won't actually use NIR code to
* generate assembly (it's easier to generate assembly directly),
* but the whole compiler assumes one of these exists.
*/
const nir_shader_compiler_options *options =
ctx->Const.ShaderCompilerOptions[MESA_SHADER_TESS_CTRL].NirOptions;
nir = create_passthrough_tcs(mem_ctx, compiler, options, key);
}
memset(&prog_data, 0, sizeof(prog_data));
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
*
* Note: param_count needs to be num_uniform_components * 4, since we add
* padding around uniform values below vec4 size, so the worst case is that
* every uniform is a float which gets padded to the size of a vec4.
*/
int param_count = nir->num_uniforms / 4;
prog_data.base.base.param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
prog_data.base.base.pull_param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
prog_data.base.base.nr_params = param_count;
if (tcp) {
brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_CTRL, devinfo,
shader_prog, &tcp->program,
&prog_data.base.base, 0);
prog_data.base.base.image_param =
rzalloc_array(NULL, struct brw_image_param,
tcp->program.info.num_images);
prog_data.base.base.nr_image_params = tcp->program.info.num_images;
brw_nir_setup_glsl_uniforms(nir, shader_prog, &tcp->program,
&prog_data.base.base,
compiler->scalar_stage[MESA_SHADER_TESS_CTRL]);
} else {
开发者ID:Echelon9,项目名称:mesa,代码行数:60,代码来源:brw_tcs.c
示例2: TEST
TEST(ir_variable_constructor, interface_array)
{
void *mem_ctx = ralloc_context(NULL);
static const glsl_struct_field f[] = {
{
glsl_type::vec(4),
"v",
false
}
};
const glsl_type *const interface =
glsl_type::get_interface_instance(f,
ARRAY_SIZE(f),
GLSL_INTERFACE_PACKING_STD140,
"simple_interface");
const glsl_type *const interface_array =
glsl_type::get_array_instance(interface, 2);
static const char name[] = "array_instance";
ir_variable *const v =
new(mem_ctx) ir_variable(interface_array, name, ir_var_uniform);
EXPECT_STREQ(name, v->name);
EXPECT_NE(name, v->name);
EXPECT_EQ(interface_array, v->type);
EXPECT_EQ(interface, v->get_interface_type());
}
开发者ID:DirectFB,项目名称:mesa,代码行数:31,代码来源:general_ir_test.cpp
示例3: mem_ctx
brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw,
bool debug_flag)
: mem_ctx(ralloc_context(NULL)),
generator(brw->intelScreen->compiler, brw,
mem_ctx, (void *) rzalloc(mem_ctx, struct brw_wm_prog_key),
(struct brw_stage_prog_data *) rzalloc(mem_ctx, struct brw_wm_prog_data),
0, false, MESA_SHADER_FRAGMENT)
{
if (debug_flag)
generator.enable_debug("blorp");
}
brw_blorp_eu_emitter::~brw_blorp_eu_emitter()
{
ralloc_free(mem_ctx);
}
const unsigned *
brw_blorp_eu_emitter::get_program(unsigned *program_size)
{
cfg_t cfg(&insts);
generator.generate_code(&cfg, 16);
return generator.get_assembly(program_size);
}
开发者ID:KidGundam,项目名称:Image-Synthesis,代码行数:25,代码来源:brw_blorp_blit_eu.cpp
示例4: ralloc_context
output_read_remover::output_read_remover(unsigned stage)
{
this->stage = stage;
mem_ctx = ralloc_context(NULL);
replacements = _mesa_hash_table_create(NULL, hash_table_var_hash,
_mesa_key_pointer_equal);
}
开发者ID:etnaviv,项目名称:mesa,代码行数:7,代码来源:lower_output_reads.cpp
示例5: _mesa_hash_table_create
loop_state::loop_state()
{
this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
this->mem_ctx = ralloc_context(NULL);
this->loop_found = false;
}
开发者ID:MIPS,项目名称:external-mesa3d,代码行数:7,代码来源:loop_analysis.cpp
示例6: hash_table_ctor
loop_state::loop_state()
{
this->ht = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
this->mem_ctx = ralloc_context(NULL);
this->loop_found = false;
}
开发者ID:Sheph,项目名称:mesa,代码行数:7,代码来源:loop_analysis.cpp
示例7: has_recursion_visitor
has_recursion_visitor()
: current(NULL)
{
this->mem_ctx = ralloc_context(NULL);
this->function_hash = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
}
开发者ID:johndpope,项目名称:UE4,代码行数:7,代码来源:ir_function_detect_recursion.cpp
示例8: brw_codegen_cs_prog
static bool
brw_codegen_cs_prog(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_compute_program *cp,
struct brw_cs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
const GLuint *program;
void *mem_ctx = ralloc_context(NULL);
GLuint program_size;
struct brw_cs_prog_data prog_data;
struct gl_shader *cs = prog->_LinkedShaders[MESA_SHADER_COMPUTE];
assert (cs);
memset(&prog_data, 0, sizeof(prog_data));
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
*/
int param_count = cs->num_uniform_components +
cs->NumImages * BRW_IMAGE_PARAM_SIZE;
/* The backend also sometimes adds params for texture size. */
param_count += 2 * ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits;
prog_data.base.param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
prog_data.base.pull_param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
prog_data.base.image_param =
rzalloc_array(NULL, struct brw_image_param, cs->NumImages);
prog_data.base.nr_params = param_count;
prog_data.base.nr_image_params = cs->NumImages;
program = brw_cs_emit(brw, mem_ctx, key, &prog_data,
&cp->program, prog, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
}
if (prog_data.base.total_scratch) {
brw_get_scratch_bo(brw, &brw->cs.base.scratch_bo,
prog_data.base.total_scratch * brw->max_cs_threads);
}
if (unlikely(INTEL_DEBUG & DEBUG_CS))
fprintf(stderr, "\n");
brw_upload_cache(&brw->cache, BRW_CACHE_CS_PROG,
key, sizeof(*key),
program, program_size,
&prog_data, sizeof(prog_data),
&brw->cs.base.prog_offset, &brw->cs.prog_data);
ralloc_free(mem_ctx);
return true;
}
开发者ID:dumbbell,项目名称:mesa,代码行数:59,代码来源:brw_cs.cpp
示例9: has_recursion_visitor
has_recursion_visitor()
: current(NULL)
{
progress = false;
this->mem_ctx = ralloc_context(NULL);
this->function_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
}
开发者ID:MIPS,项目名称:external-mesa3d,代码行数:8,代码来源:ir_function_detect_recursion.cpp
示例10: mem_ctx
brw_blorp_clear_program::brw_blorp_clear_program(
struct brw_context *brw,
const brw_blorp_clear_prog_key *key)
: mem_ctx(ralloc_context(NULL)),
brw(brw),
key(key)
{
brw_init_compile(brw, &func, mem_ctx);
}
开发者ID:blckshrk,项目名称:Mesa,代码行数:9,代码来源:brw_blorp_clear.cpp
示例11: test_alignment
/* Test that data values are written and read with proper alignment. */
static void
test_alignment(void)
{
void *ctx = ralloc_context(NULL);
struct blob *blob;
struct blob_reader reader;
uint8_t bytes[] = "ABCDEFGHIJKLMNOP";
size_t delta, last, num_bytes;
blob = blob_create(ctx);
/* First, write an intptr value to the blob and capture that size. This is
* the expected offset between any pair of intptr values (if written with
* alignment).
*/
blob_write_intptr(blob, (intptr_t) blob);
delta = blob->size;
last = blob->size;
/* Then loop doing the following:
*
* 1. Write an unaligned number of bytes
* 2. Verify that write results in an unaligned size
* 3. Write an intptr_t value
* 2. Verify that that write results in an aligned size
*/
for (num_bytes = 1; num_bytes < sizeof(intptr_t); num_bytes++) {
blob_write_bytes(blob, bytes, num_bytes);
expect_unequal(delta, blob->size - last, "unaligned write of bytes");
blob_write_intptr(blob, (intptr_t) blob);
expect_equal(2 * delta, blob->size - last, "aligned write of intptr");
last = blob->size;
}
/* Finally, test that reading also does proper alignment. Since we know
* that values were written with all the right alignment, all we have to do
* here is verify that correct values are read.
*/
blob_reader_init(&reader, blob->data, blob->size);
expect_equal((intptr_t) blob, blob_read_intptr(&reader),
"read of initial, aligned intptr_t");
for (num_bytes = 1; num_bytes < sizeof(intptr_t); num_bytes++) {
expect_equal_bytes(bytes, blob_read_bytes(&reader, num_bytes),
num_bytes, "unaligned read of bytes");
expect_equal((intptr_t) blob, blob_read_intptr(&reader),
"aligned read of intptr_t");
}
ralloc_free(ctx);
}
开发者ID:Echelon9,项目名称:mesa,代码行数:58,代码来源:blob_test.c
示例12: get_sampler_name
get_sampler_name(ir_dereference *last,
struct gl_shader_program *shader_program)
{
this->mem_ctx = ralloc_context(NULL);
this->shader_program = shader_program;
this->name = NULL;
this->offset = 0;
this->last = last;
}
开发者ID:nikai3d,项目名称:mesa,代码行数:9,代码来源:sampler.cpp
示例13: ralloc_context
void
set_uniform_initializer::SetUp()
{
this->mem_ctx = ralloc_context(NULL);
this->prog = rzalloc(NULL, struct gl_shader_program);
/* Set default values used by the test cases.
*/
this->actual_index = 1;
this->name = "i";
}
开发者ID:FASTCHIP,项目名称:kernel_3.4.67_lenovo_s939_mtk6592,代码行数:11,代码来源:set_uniform_initializer_tests.cpp
示例14: ralloc_context
void
link_varyings::SetUp()
{
this->mem_ctx = ralloc_context(NULL);
this->ir.make_empty();
this->consumer_inputs
= hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
this->consumer_interface_inputs
= hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
}
开发者ID:DavidYen,项目名称:VulkanTools,代码行数:12,代码来源:varyings_test.cpp
示例15: mem_ctx
brw_blorp_const_color_program::brw_blorp_const_color_program(
struct brw_context *brw,
const brw_blorp_const_color_prog_key *key)
: mem_ctx(ralloc_context(NULL)),
brw(brw),
key(key),
R0(),
R1(),
clear_rgba(),
base_mrf(0)
{
brw_init_compile(brw, &func, mem_ctx);
}
开发者ID:kaltsi,项目名称:mesa,代码行数:13,代码来源:brw_blorp_clear.cpp
示例16: brw_vs_init_compile
static void
brw_vs_init_compile(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_vertex_program *vp,
const struct brw_vs_prog_key *key,
struct brw_vs_compile *c)
{
memset(c, 0, sizeof(*c));
memcpy(&c->key, key, sizeof(*key));
c->vp = vp;
c->base.shader_prog = prog;
c->base.mem_ctx = ralloc_context(NULL);
}
开发者ID:DavidYen,项目名称:VulkanTools,代码行数:14,代码来源:brw_vs.c
示例17: ralloc_context
void
link_varyings::SetUp()
{
this->mem_ctx = ralloc_context(NULL);
this->ir.make_empty();
this->consumer_inputs =
_mesa_hash_table_create(NULL, _mesa_key_hash_string,
_mesa_key_string_equal);
this->consumer_interface_inputs =
_mesa_hash_table_create(NULL, _mesa_key_hash_string,
_mesa_key_string_equal);
}
开发者ID:ChristophHaag,项目名称:mesa-mesa,代码行数:14,代码来源:varyings_test.cpp
示例18: brw_blorp_params_get_clear_kernel
static void
brw_blorp_params_get_clear_kernel(struct brw_context *brw,
struct brw_blorp_params *params,
bool use_replicated_data)
{
struct brw_blorp_const_color_prog_key blorp_key;
memset(&blorp_key, 0, sizeof(blorp_key));
blorp_key.use_simd16_replicated_data = use_replicated_data;
if (brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
&blorp_key, sizeof(blorp_key),
¶ms->wm_prog_kernel, ¶ms->wm_prog_data))
return;
void *mem_ctx = ralloc_context(NULL);
nir_builder b;
nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_FRAGMENT, NULL);
b.shader->info.name = ralloc_strdup(b.shader, "BLORP-clear");
nir_variable *v_color = nir_variable_create(b.shader, nir_var_shader_in,
glsl_vec4_type(), "v_color");
v_color->data.location = VARYING_SLOT_VAR0;
v_color->data.interpolation = INTERP_MODE_FLAT;
nir_variable *frag_color = nir_variable_create(b.shader, nir_var_shader_out,
glsl_vec4_type(),
"gl_FragColor");
frag_color->data.location = FRAG_RESULT_COLOR;
nir_copy_var(&b, frag_color, v_color);
struct brw_wm_prog_key wm_key;
brw_blorp_init_wm_prog_key(&wm_key);
struct brw_blorp_prog_data prog_data;
unsigned program_size;
const unsigned *program =
brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, use_replicated_data,
&prog_data, &program_size);
brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
&blorp_key, sizeof(blorp_key),
program, program_size,
&prog_data, sizeof(prog_data),
¶ms->wm_prog_kernel, ¶ms->wm_prog_data);
ralloc_free(mem_ctx);
}
开发者ID:Kalamatee,项目名称:mesa,代码行数:49,代码来源:brw_blorp_clear.cpp
示例19: mem_ctx
brw_blorp_const_color_program::brw_blorp_const_color_program(
struct brw_context *brw,
const brw_blorp_const_color_prog_key *key)
: mem_ctx(ralloc_context(NULL)),
brw(brw),
key(key),
R0(),
R1(),
clear_rgba(),
base_mrf(0)
{
prog_data.first_curbe_grf = 0;
prog_data.persample_msaa_dispatch = false;
brw_init_compile(brw, &func, mem_ctx);
}
开发者ID:Sonicadvance1,项目名称:mesa,代码行数:15,代码来源:brw_blorp_clear.cpp
示例20: ralloc_context
void
common_builtin::SetUp()
{
this->mem_ctx = ralloc_context(NULL);
this->ir.make_empty();
initialize_context_to_defaults(&this->ctx, API_OPENGL_COMPAT);
this->shader = rzalloc(this->mem_ctx, gl_shader);
this->shader->Type = this->shader_type;
this->shader->Stage = _mesa_shader_enum_to_shader_stage(this->shader_type);
this->state =
new(mem_ctx) _mesa_glsl_parse_state(&this->ctx, this->shader->Stage,
this->shader);
_mesa_glsl_initialize_types(this->state);
_mesa_glsl_initialize_variables(&this->ir, this->state);
}
开发者ID:ChristophHaag,项目名称:mesa-mesa,代码行数:19,代码来源:builtin_variable_test.cpp
注:本文中的ralloc_context函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论