struct draw_llvm_sampler_soa *sampler;
sampler = CALLOC_STRUCT(draw_llvm_sampler_soa);
- if(!sampler)
+ if (!sampler)
return NULL;
sampler->base.destroy = draw_llvm_sampler_soa_destroy;
frontend = draw->pt.frontend;
- if (frontend ) {
+ if (frontend) {
if (draw->pt.prim != prim || draw->pt.opt != opt) {
/* In certain conditions switching primitives requires us to flush
* and validate the different stages. One example is when smooth
}
}
- if(intrinsic) {
+ if (intrinsic) {
/* We need to handle nan's for floating point numbers. If one of the
* inputs is nan the other should be returned (required by both D3D10+
* and OpenCL).
}
}
- if(intrinsic) {
+ if (intrinsic) {
if (util_cpu_caps.has_sse && type.floating &&
nan_behavior != GALLIVM_NAN_BEHAVIOR_UNDEFINED &&
nan_behavior != GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN &&
}
}
- if(intrinsic)
+ if (intrinsic)
return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
}
}
}
- if(intrinsic)
+ if (intrinsic)
return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
}
logexp = LLVMBuildSIToFP(builder, logexp, vec_type, "");
}
- if(p_log2) {
+ if (p_log2) {
/* mant = 1 + (float) mantissa(x) */
mant = LLVMBuildAnd(builder, i, mantmask, "");
mant = LLVMBuildOr(builder, mant, one, "");
}
}
- if(p_exp) {
+ if (p_exp) {
exp = LLVMBuildBitCast(builder, exp, vec_type, "");
*p_exp = exp;
}
- if(p_floor_log2)
+ if (p_floor_log2)
*p_floor_log2 = logexp;
- if(p_log2)
+ if (p_log2)
*p_log2 = res;
}
LLVMValueRef *ddx,
LLVMValueRef *ddy)
{
- if(res)
+ if (res)
*res = src;
/* TODO: use interpolation coeffs for inputs */
- if(ddx)
+ if (ddx)
*ddx = lp_build_ddx(&bld->bld_base.base, src);
- if(ddy)
+ if (ddy)
*ddy = lp_build_ddy(&bld->bld_base.base, src);
}
unsigned flags, void *flush_ctx)
{
assert(buf);
- if(!buf)
+ if (!buf)
return NULL;
assert(pipe_is_referenced(&buf->reference));
return buf->vtbl->map(buf, flags, flush_ctx);
pb_unmap(struct pb_buffer *buf)
{
assert(buf);
- if(!buf)
+ if (!buf)
return;
assert(pipe_is_referenced(&buf->reference));
buf->vtbl->unmap(buf);
pb_size *offset )
{
assert(buf);
- if(!buf) {
+ if (!buf) {
base_buf = NULL;
offset = 0;
return;
pb_validate(struct pb_buffer *buf, struct pb_validate *vl, unsigned flags)
{
assert(buf);
- if(!buf)
+ if (!buf)
return PIPE_ERROR;
assert(buf->vtbl->validate);
return buf->vtbl->validate(buf, vl, flags);
pb_fence(struct pb_buffer *buf, struct pipe_fence_handle *fence)
{
assert(buf);
- if(!buf)
+ if (!buf)
return;
assert(buf->vtbl->fence);
buf->vtbl->fence(buf, fence);
pb_destroy(struct pb_buffer *buf)
{
assert(buf);
- if(!buf)
+ if (!buf)
return;
assert(!pipe_is_referenced(&buf->reference));
buf->vtbl->destroy(buf);
assert(fenced_buf->buffer);
map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_WRITE, NULL);
- if(!map)
+ if (!map)
return PIPE_ERROR;
memcpy(map, fenced_buf->data, fenced_buf->size);
assert(fenced_buf->buffer);
map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_READ, NULL);
- if(!map)
+ if (!map)
return PIPE_ERROR;
memcpy(fenced_buf->data, map, fenced_buf->size);
map = fenced_buf->data;
}
- if(map) {
+ if (map) {
++fenced_buf->mapcount;
fenced_buf->flags |= flags & PB_USAGE_CPU_READ_WRITE;
}
pipe_mutex_lock(fenced_mgr->mutex);
- if(!vl) {
+ if (!vl) {
/* invalidate */
fenced_buf->vl = NULL;
fenced_buf->validation_flags = 0;
}
fenced_buf = CALLOC_STRUCT(fenced_buffer);
- if(!fenced_buf)
+ if (!fenced_buf)
goto no_buffer;
pipe_reference_init(&fenced_buf->base.reference, 1);
{
struct fenced_manager *fenced_mgr;
- if(!provider)
+ if (!provider)
return NULL;
fenced_mgr = CALLOC_STRUCT(fenced_manager);
/* TODO: do a single allocation */
buf = CALLOC_STRUCT(malloc_buffer);
- if(!buf)
+ if (!buf)
return NULL;
pipe_reference_init(&buf->base.reference, 1);
struct pb_buffer *buf;
buf = mgr->provider1->create_buffer(mgr->provider1, size, desc);
- if(buf)
+ if (buf)
return buf;
buf = mgr->provider2->create_buffer(mgr->provider2, size, desc);
}
}
- if(buf) {
+ if (buf) {
mgr->cache_size -= buf->base.size;
LIST_DEL(&buf->head);
--mgr->numDelayed;
pipe_mutex_unlock(mgr->mutex);
buf = CALLOC_STRUCT(pb_cache_buffer);
- if(!buf)
+ if (!buf)
return NULL;
buf->buffer = mgr->provider->create_buffer(mgr->provider, size, desc);
{
struct pb_cache_manager *mgr;
- if(!provider)
+ if (!provider)
return NULL;
mgr = CALLOC_STRUCT(pb_cache_manager);
map = pb_map(buf->buffer, PB_USAGE_CPU_WRITE, NULL);
assert(map);
- if(map) {
+ if (map) {
fill_random_pattern(map, buf->underflow_size);
fill_random_pattern(map + buf->underflow_size + buf->base.size,
buf->overflow_size);
PB_USAGE_CPU_READ |
PB_USAGE_UNSYNCHRONIZED, NULL);
assert(map);
- if(map) {
+ if (map) {
boolean underflow, overflow;
pb_size min_ofs, max_ofs;
pb_debug_buffer_check(buf);
map = pb_map(buf->buffer, flags, flush_ctx);
- if(!map)
+ if (!map)
return NULL;
- if(map) {
+ if (map) {
pipe_mutex_lock(buf->mutex);
++buf->map_count;
debug_backtrace_capture(buf->map_backtrace, 1, PB_DEBUG_MAP_BACKTRACE);
assert(desc->alignment);
buf = CALLOC_STRUCT(pb_debug_buffer);
- if(!buf)
+ if (!buf)
return NULL;
real_size = mgr->underflow_size + size + mgr->overflow_size;
{
struct pb_debug_manager *mgr;
- if(!provider)
+ if (!provider)
return NULL;
mgr = CALLOC_STRUCT(pb_debug_manager);
{
struct mm_pb_manager *mm;
- if(!buffer)
+ if (!buffer)
return NULL;
mm = CALLOC_STRUCT(mm_pb_manager);
struct pb_manager *mgr;
struct pb_desc desc;
- if(!provider)
+ if (!provider)
return NULL;
memset(&desc, 0, sizeof(desc));
return PIPE_ERROR_OUT_OF_MEMORY;
map = pb_map(buf->buffer, PB_USAGE_CPU_READ, NULL);
- if(!map) {
+ if (!map) {
pb_reference(&buf->buffer, NULL);
return PIPE_ERROR;
}
struct pb_ondemand_buffer *buf;
buf = CALLOC_STRUCT(pb_ondemand_buffer);
- if(!buf)
+ if (!buf)
return NULL;
pipe_reference_init(&buf->base.reference, 1);
{
struct pb_ondemand_manager *mgr;
- if(!provider)
+ if (!provider)
return NULL;
mgr = CALLOC_STRUCT(pb_ondemand_manager);
- if(!mgr)
+ if (!mgr)
return NULL;
mgr->base.destroy = pb_ondemand_manager_destroy;
struct pool_buffer *pool_buf;
pb_size i;
- if(!provider)
+ if (!provider)
return NULL;
pool = CALLOC_STRUCT(pool_pb_manager);
pb_size bufSize;
unsigned i;
- if(!provider)
+ if (!provider)
return NULL;
mgr = CALLOC_STRUCT(pb_slab_range_manager);
unsigned flags)
{
assert(buf);
- if(!buf)
+ if (!buf)
return PIPE_ERROR;
assert(flags & PB_USAGE_GPU_READ_WRITE);
new_entries = (struct pb_validate_entry *)REALLOC(vl->entries,
vl->size*sizeof(struct pb_validate_entry),
new_size*sizeof(struct pb_validate_entry));
- if(!new_entries)
+ if (!new_entries)
return PIPE_ERROR_OUT_OF_MEMORY;
memset(new_entries + vl->size, 0, (new_size - vl->size)*sizeof(struct pb_validate_entry));
struct pb_validate *vl;
vl = CALLOC_STRUCT(pb_validate);
- if(!vl)
+ if (!vl)
return NULL;
vl->size = PB_VALIDATE_INITIAL_SIZE;
#ifdef DEBUG
const struct tgsi_opcode_info *info = tgsi_get_opcode_info( opcode );
assert(info);
- if(info) {
+ if (info) {
assert(nr_dst == info->num_dst);
assert(nr_src == info->num_src);
}
{
union tgsi_any_token *out, *insn;
- if(!label_token)
+ if (!label_token)
return;
out = get_tokens( ureg, DOMAIN_INSN, 1 );
struct util_bitmask *bm;
bm = MALLOC_STRUCT(util_bitmask);
- if(!bm)
+ if (!bm)
return NULL;
bm->words = (util_bitmask_word *)CALLOC(UTIL_BITMASK_INITIAL_WORDS, sizeof(util_bitmask_word));
new_words = (util_bitmask_word *)REALLOC((void *)bm->words,
bm->size / UTIL_BITMASK_BITS_PER_BYTE,
new_size / UTIL_BITMASK_BITS_PER_BYTE);
- if(!new_words)
+ if (!new_words)
return FALSE;
memset(new_words + bm->size/UTIL_BITMASK_BITS_PER_WORD,
struct util_cache *cache;
cache = CALLOC_STRUCT(util_cache);
- if(!cache)
+ if (!cache)
return NULL;
cache->hash = hash;
const char *result;
result = os_get_option(name);
- if(!result)
+ if (!result)
result = dfault;
if (debug_get_option_should_print())
surface->u.tex.first_layer,
PIPE_TRANSFER_READ,
0, 0, surface->width, surface->height, &transfer);
- if(!data)
+ if (!data)
return;
debug_dump_image(prefix,
transfer->box.height *
transfer->box.depth *
4*sizeof(float));
- if(!rgba)
+ if (!rgba)
goto error1;
pipe_get_tile_rgba(transfer, ptr, 0, 0,
struct bmp_info_header bmih;
unsigned x, y;
- if(!rgba)
+ if (!rgba)
goto error1;
bmfh.bfType = 0x4d42;
bmih.biClrImportant = 0;
stream = fopen(filename, "wb");
- if(!stream)
+ if (!stream)
goto error1;
fwrite(&bmfh, 14, 1, stream);
struct debug_memory_footer *ftr;
hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr));
- if(!hdr) {
+ if (!hdr) {
debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
file, line, function,
(long unsigned)size);
struct debug_memory_header *hdr;
struct debug_memory_footer *ftr;
- if(!ptr)
+ if (!ptr)
return;
hdr = header_from_data(ptr);
size_t count, size_t size )
{
void *ptr = debug_malloc( file, line, function, count * size );
- if( ptr )
+ if (ptr)
memset( ptr, 0, count * size );
return ptr;
}
struct debug_memory_footer *old_ftr, *new_ftr;
void *new_ptr;
- if(!old_ptr)
+ if (!old_ptr)
return debug_malloc( file, line, function, new_size );
if(!new_size) {
/* alloc new */
new_hdr = os_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
- if(!new_hdr) {
+ if (!new_hdr) {
debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
file, line, function,
(long unsigned)new_size);
#endif
pipe_mutex_lock(serials_mutex);
- if(!serials_hash)
+ if (!serials_hash)
serials_hash = util_hash_table_create(hash_ptr, compare_ptr);
serial = (unsigned)(uintptr_t)util_hash_table_get(serials_hash, p);
if(!serial)
void
util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_poly_stipple(FILE *stream, const struct pipe_poly_stipple *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_viewport_state(FILE *stream, const struct pipe_viewport_state *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_scissor_state(FILE *stream, const struct pipe_scissor_state *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
{
unsigned i;
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
{
unsigned i;
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
{
unsigned i;
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
{
unsigned valid_entries = 1;
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_blend_color(FILE *stream, const struct pipe_blend_color *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_stencil_ref(FILE *stream, const struct pipe_stencil_ref *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_sampler_state(FILE *stream, const struct pipe_sampler_state *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_surface(FILE *stream, const struct pipe_surface *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_transfer(FILE *stream, const struct pipe_transfer *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_vertex_buffer(FILE *stream, const struct pipe_vertex_buffer *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_vertex_element(FILE *stream, const struct pipe_vertex_element *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void
util_dump_draw_info(FILE *stream, const struct pipe_draw_info *state)
{
- if(!state) {
+ if (!state) {
util_dump_null(stream);
return;
}
void util_dump_box(FILE *stream, const struct pipe_box *box)
{
- if(!box) {
+ if (!box) {
util_dump_null(stream);
return;
}
struct handle_table *ht;
ht = MALLOC_STRUCT(handle_table);
- if(!ht)
+ if (!ht)
return NULL;
ht->objects = (void **)CALLOC(HANDLE_TABLE_INITIAL_SIZE, sizeof(void *));
new_objects = (void **)REALLOC((void *)ht->objects,
ht->size*sizeof(void *),
new_size*sizeof(void *));
- if(!new_objects)
+ if (!new_objects)
return 0;
memset(new_objects + ht->size, 0, (new_size - ht->size)*sizeof(void *));
*/
object = ht->objects[index];
- if(object) {
+ if (object) {
ht->objects[index] = NULL;
if(ht->destroy)
return 0;
assert(object);
- if(!object)
+ if (!object)
return 0;
index = handle - 1;
index = handle - 1;
object = ht->objects[index];
- if(!object)
+ if (!object)
return;
handle_table_clear(ht, index);
struct util_hash_table *ht;
ht = MALLOC_STRUCT(util_hash_table);
- if(!ht)
+ if (!ht)
return NULL;
ht->cso = cso_hash_create();
key_hash = ht->hash(key);
item = util_hash_table_find_item(ht, key, key_hash);
- if(item) {
+ if (item) {
/* TODO: key/value destruction? */
item->value = value;
return PIPE_OK;
}
item = MALLOC_STRUCT(util_hash_table_item);
- if(!item)
+ if (!item)
return PIPE_ERROR_OUT_OF_MEMORY;
item->key = key;
key_hash = ht->hash(key);
item = util_hash_table_find_item(ht, key, key_hash);
- if(!item)
+ if (!item)
return NULL;
return item->value;
}
ps = (struct pipe_surface *)CALLOC(1, surface_struct_size);
- if(!ps)
+ if (!ps)
{
*res = NULL;
return FALSE;
for(i = 0; i <= pt->last_level; ++i)
{
struct pipe_surface *ps = us->u.array[i];
- if(ps)
+ if (ps)
destroy_surface(ps);
}
FREE(us->u.array);