Use NULL tests of the form `if (ptr)' or `if (!ptr)'.
They do not depend on the definition of the symbol NULL.
Further, they provide the opportunity for the accidental
assignment, are clear and succinct.
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
struct i915_context *i915;
i915 = CALLOC_STRUCT(i915_context);
- if (i915 == NULL)
+ if (!i915)
return NULL;
i915->iws = i915_screen(screen)->iws;
struct i915_buffer *buffer = i915_buffer(resource);
struct pipe_transfer *transfer = util_slab_alloc(&i915->transfer_pool);
- if (transfer == NULL)
+ if (!transfer)
return NULL;
transfer->resource = resource;
unsigned offset;
char *map;
- if (transfer == NULL)
+ if (!transfer)
return NULL;
transfer->b.resource = resource;
map = iws->buffer_map(iws, tex->buffer,
(transfer->b.usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE);
- if (map == NULL) {
+ if (!map) {
pipe_resource_reference(&transfer->staging_texture, NULL);
FREE(transfer);
return NULL;
}
else {
struct data_block *block = MALLOC_STRUCT(data_block);
- if (block == NULL)
+ if (!block)
return NULL;
scene->scene_size += sizeof *block;
lp_scene_queue_create(void)
{
struct lp_scene_queue *queue = CALLOC_STRUCT(lp_scene_queue);
- if (queue == NULL)
+ if (!queue)
return NULL;
queue->ring = util_ringbuffer_create( MAX_SCENE_QUEUE *
plane_sz);
tri = lp_scene_alloc_aligned( scene, *tri_size, 16 );
- if (tri == NULL)
+ if (!tri)
return NULL;
tri->inputs.stride = input_array_sz;
struct lp_geometry_shader *state;
state = CALLOC_STRUCT(lp_geometry_shader);
- if (state == NULL )
+ if (!state)
goto no_state;
/* debug */
* handle, and what we'll look after ourselves.
*/
struct lp_rast_state *state = MALLOC_STRUCT(lp_rast_state);
- if (state == NULL)
+ if (!state)
return NULL;
memcpy(&state->draw_state, rast, sizeof *rast);
goto fail;
variant = CALLOC_STRUCT(lp_setup_variant);
- if (variant == NULL)
+ if (!variant)
goto fail;
variant->no = setup_no++;
struct draw_vertex_shader *vs;
vs = draw_create_vertex_shader(llvmpipe->draw, templ);
- if (vs == NULL) {
+ if (!vs) {
return NULL;
}
unsigned stride;
nresource = CALLOC_STRUCT(noop_resource);
- if (nresource == NULL)
+ if (!nresource)
return NULL;
stride = util_format_get_stride(templ->format, templ->width0);
struct noop_resource *nresource = (struct noop_resource *)resource;
transfer = CALLOC_STRUCT(pipe_transfer);
- if (transfer == NULL)
+ if (!transfer)
return NULL;
pipe_resource_reference(&transfer->resource, resource);
transfer->level = level;
{
struct pipe_context *ctx = CALLOC_STRUCT(pipe_context);
- if (ctx == NULL)
+ if (!ctx)
return NULL;
ctx->screen = screen;
ctx->priv = priv;
}
noop_screen = CALLOC_STRUCT(noop_pipe_screen);
- if (noop_screen == NULL) {
+ if (!noop_screen) {
return NULL;
}
noop_screen->oscreen = oscreen;
{
struct pipe_blend_state *nstate = CALLOC_STRUCT(pipe_blend_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
{
struct pipe_depth_stencil_alpha_state *nstate = CALLOC_STRUCT(pipe_depth_stencil_alpha_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
{
struct pipe_rasterizer_state *nstate = CALLOC_STRUCT(pipe_rasterizer_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
{
struct pipe_sampler_state *nstate = CALLOC_STRUCT(pipe_sampler_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
{
struct pipe_sampler_view *sampler_view = CALLOC_STRUCT(pipe_sampler_view);
- if (sampler_view == NULL)
+ if (!sampler_view)
return NULL;
/* initialize base object */
pipe_resource_reference(&sampler_view->texture, texture);
{
struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
- if (surface == NULL)
+ if (!surface)
return NULL;
pipe_reference_init(&surface->reference, 1);
pipe_resource_reference(&surface->texture, texture);
{
struct pipe_vertex_element *nstate = CALLOC_STRUCT(pipe_vertex_element);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
{
struct pipe_shader_state *nstate = CALLOC_STRUCT(pipe_shader_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
else
f = fopen(filename, "r");
- if (f == NULL) {
+ if (!f) {
_debug_printf("Error opening file '%s': %s\n", filename, strerror(errno));
return 1;
}
STATIC_ASSERT(sizeof(struct mpeg12_header) == 0x100);
- if (ref1 == NULL)
+ if (!ref1)
ref1 = dest;
- if (ref2 == NULL)
+ if (!ref2)
ref2 = dest;
bo_refs[1].bo = ref1->interlaced;
bo_refs[2].bo = ref2->interlaced;
if (inst->U.I.SrcReg[i].RelAddr &&
inst->U.I.SrcReg[i].Index < 0) {
/* ARL must precede any indirect addressing. */
- if (lastARL == NULL) {
+ if (!lastARL) {
rc_error(&c->Base, "Vertex shader: Found relative addressing without ARL/ARR.");
return;
}
map = rws->buffer_map(rbuf->cs_buf, r300->cs, usage);
- if (map == NULL) {
+ if (!map) {
util_slab_free(&r300->pool_transfers, transfer);
return NULL;
}
struct r300_context* r300 = r300_context(pipe);
struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader;
- if (fs == NULL) {
+ if (!fs) {
r300->fs.state = NULL;
return;
}
struct r300_context *r300 = r300_context(pipe);
struct r300_vertex_element_state *velems = state;
- if (velems == NULL) {
+ if (!velems) {
return;
}
struct r300_context* r300 = r300_context(pipe);
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
- if (vs == NULL) {
+ if (!vs) {
r300->vs_state.state = NULL;
return;
}
{
struct compute_memory_pool* pool = (struct compute_memory_pool*)
CALLOC(sizeof(struct compute_memory_pool), 1);
- if (pool == NULL)
+ if (!pool)
return NULL;
COMPUTE_DBG(rscreen, "* compute_memory_pool_new()\n");
list_addtail(&item->link, pool->item_list);
item->start_in_dw = start_in_dw;
- if (src != NULL) {
+ if (src) {
u_box_1d(0, item->size_in_dw * 4, &box);
rctx->b.b.resource_copy_region(pipe,
new_item = (struct compute_memory_item *)
CALLOC(sizeof(struct compute_memory_item), 1);
- if (new_item == NULL)
+ if (!new_item)
return NULL;
new_item->size_in_dw = size_in_dw;
unsigned db_depth_control, alpha_test_control, alpha_ref;
struct r600_dsa_state *dsa = CALLOC_STRUCT(r600_dsa_state);
- if (dsa == NULL) {
+ if (!dsa) {
return NULL;
}
float psize_min, psize_max;
struct r600_rasterizer_state *rs = CALLOC_STRUCT(r600_rasterizer_state);
- if (rs == NULL) {
+ if (!rs) {
return NULL;
}
struct r600_pipe_sampler_state *ss = CALLOC_STRUCT(r600_pipe_sampler_state);
unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 2 : 0;
- if (ss == NULL) {
+ if (!ss) {
return NULL;
}
unsigned dim, last_layer;
uint64_t va;
- if (view == NULL)
+ if (!view)
return NULL;
/* initialize base object */
{
struct r600_bytecode_cf *cf = CALLOC_STRUCT(r600_bytecode_cf);
- if (cf == NULL)
+ if (!cf)
return NULL;
LIST_INITHEAD(&cf->list);
LIST_INITHEAD(&cf->alu);
{
struct r600_bytecode_alu *alu = CALLOC_STRUCT(r600_bytecode_alu);
- if (alu == NULL)
+ if (!alu)
return NULL;
LIST_INITHEAD(&alu->list);
return alu;
{
struct r600_bytecode_vtx *vtx = CALLOC_STRUCT(r600_bytecode_vtx);
- if (vtx == NULL)
+ if (!vtx)
return NULL;
LIST_INITHEAD(&vtx->list);
return vtx;
{
struct r600_bytecode_tex *tex = CALLOC_STRUCT(r600_bytecode_tex);
- if (tex == NULL)
+ if (!tex)
return NULL;
LIST_INITHEAD(&tex->list);
return tex;
{
struct r600_bytecode_cf *cf = r600_bytecode_cf();
- if (cf == NULL)
+ if (!cf)
return -ENOMEM;
LIST_ADDTAIL(&cf->list, &bc->cf);
if (bc->cf_last) {
struct r600_bytecode_alu *lalu;
int i, r;
- if (nalu == NULL)
+ if (!nalu)
return -ENOMEM;
memcpy(nalu, alu, sizeof(struct r600_bytecode_alu));
struct r600_bytecode_vtx *nvtx = r600_bytecode_vtx();
int r;
- if (nvtx == NULL)
+ if (!nvtx)
return -ENOMEM;
memcpy(nvtx, vtx, sizeof(struct r600_bytecode_vtx));
struct r600_bytecode_tex *ntex = r600_bytecode_tex();
int r;
- if (ntex == NULL)
+ if (!ntex)
return -ENOMEM;
memcpy(ntex, tex, sizeof(struct r600_bytecode_tex));
&format, &num_format, &format_comp, &endian);
desc = util_format_description(elements[i].src_format);
- if (desc == NULL) {
+ if (!desc) {
r600_bytecode_clear(&bc);
R600_ERR("unknown format %d\n", elements[i].src_format);
return NULL;
struct r600_screen* rscreen = (struct r600_screen *)screen;
struct radeon_winsys *ws = rscreen->b.ws;
- if (rctx == NULL)
+ if (!rctx)
return NULL;
rctx->b.b.screen = screen;
{
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
- if (rscreen == NULL)
+ if (!rscreen)
return;
if (!rscreen->b.ws->unref(rscreen->b.ws))
{
struct r600_screen *rscreen = CALLOC_STRUCT(r600_screen);
- if (rscreen == NULL) {
+ if (!rscreen) {
return NULL;
}
unsigned db_depth_control, alpha_test_control, alpha_ref;
struct r600_dsa_state *dsa = CALLOC_STRUCT(r600_dsa_state);
- if (dsa == NULL) {
+ if (!dsa) {
return NULL;
}
float psize_min, psize_max;
struct r600_rasterizer_state *rs = CALLOC_STRUCT(r600_rasterizer_state);
- if (rs == NULL) {
+ if (!rs) {
return NULL;
}
struct r600_pipe_sampler_state *ss = CALLOC_STRUCT(r600_pipe_sampler_state);
unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 4 : 0;
- if (ss == NULL) {
+ if (!ss) {
return NULL;
}
unsigned char swizzle[4], array_mode = 0;
unsigned width, height, depth, offset_level, last_level;
- if (view == NULL)
+ if (!view)
return NULL;
/* initialize base object */
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_blend_state *blend = (struct r600_blend_state *)state;
- if (blend == NULL) {
+ if (!blend) {
r600_set_cso_state_with_cb(rctx, &rctx->blend_state, NULL, NULL);
return;
}
struct r600_dsa_state *dsa = state;
struct r600_stencil_ref ref;
- if (state == NULL) {
+ if (!state) {
r600_set_cso_state_with_cb(rctx, &rctx->dsa_state, NULL, NULL);
return;
}
struct r600_rasterizer_state *rs = (struct r600_rasterizer_state *)state;
struct r600_context *rctx = (struct r600_context *)ctx;
- if (state == NULL)
+ if (!state)
return;
rctx->rasterizer = rs;
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct r600_resource *rr = (struct r600_resource *)r;
- if (r == NULL) {
+ if (!r) {
return;
}
struct r600_query_sw *query;
query = CALLOC_STRUCT(r600_query_sw);
- if (query == NULL)
+ if (!query)
return NULL;
query->b.type = query_type;
struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
rtex = CALLOC_STRUCT(r600_texture);
- if (rtex == NULL)
+ if (!rtex)
return NULL;
resource = &rtex->resource;
}
trans = CALLOC_STRUCT(r600_transfer);
- if (trans == NULL)
+ if (!trans)
return NULL;
trans->transfer.resource = texture;
trans->transfer.level = level;
/* Create the temporary texture. */
staging = (struct r600_texture*)ctx->screen->resource_create(ctx->screen, &resource);
- if (staging == NULL) {
+ if (!staging) {
R600_ERR("failed to create temporary texture to hold untiled copy\n");
FREE(trans);
return NULL;
{
struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
- if (surface == NULL)
+ if (!surface)
return NULL;
assert(templ->u.tex.first_layer <= util_max_layer(texture, templ->u.tex.level));
vb = &sctx->vertex_buffer[ve->vertex_buffer_index];
rbuffer = (struct r600_resource*)vb->buffer;
- if (rbuffer == NULL) {
+ if (!rbuffer) {
memset(desc, 0, 16);
continue;
}
#endif
int shader, i;
- if (sctx == NULL)
+ if (!sctx)
return NULL;
if (sscreen->b.debug_flags & DBG_CHECK_VM)
{
struct si_screen *sscreen = (struct si_screen *)pscreen;
- if (sscreen == NULL)
+ if (!sscreen)
return;
if (!sscreen->b.ws->unref(sscreen->b.ws))
{
struct si_screen *sscreen = CALLOC_STRUCT(si_screen);
- if (sscreen == NULL) {
+ if (!sscreen) {
return NULL;
}
struct si_pm4_state *state,
unsigned idx)
{
- if (state == NULL)
+ if (!state)
return;
if (idx != ~0 && sctx->emitted.array[idx] == state) {
uint32_t color_control = 0;
- if (blend == NULL)
+ if (!blend)
return NULL;
blend->alpha_to_one = state->alpha_to_one;
unsigned tmp, i;
float psize_min, psize_max;
- if (rs == NULL) {
+ if (!rs) {
return NULL;
}
(struct si_state_rasterizer*)sctx->queued.named.rasterizer;
struct si_state_rasterizer *rs = (struct si_state_rasterizer *)state;
- if (state == NULL)
+ if (!state)
return;
if (sctx->framebuffer.nr_samples > 1 &&
unsigned db_depth_control;
uint32_t db_stencil_control = 0;
- if (dsa == NULL) {
+ if (!dsa) {
return NULL;
}
struct si_context *sctx = (struct si_context *)ctx;
struct si_state_dsa *dsa = state;
- if (state == NULL)
+ if (!state)
return;
si_pm4_bind_state(sctx, dsa, dsa);
uint64_t va;
unsigned last_layer = state->u.tex.last_layer;
- if (view == NULL)
+ if (!view)
return NULL;
/* initialize base object */
unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 2 : 0;
unsigned border_color_type, border_color_index = 0;
- if (rstate == NULL) {
+ if (!rstate) {
return NULL;
}
struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
int i;
- if (pm4 == NULL)
+ if (!pm4)
return;
si_pm4_cmd_begin(pm4, PKT3_CONTEXT_CONTROL);
uint64_t va;
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
va = shader->bo->gpu_address;
uint64_t va;
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
va = shader->bo->gpu_address;
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
va = shader->bo->gpu_address;
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
if (gs_max_vert_out <= 128) {
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
/* If this is the GS copy shader, the GS state writes this register.
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
for (i = 0; i < info->num_inputs; i++) {
struct sp_vertex_shader *state;
state = CALLOC_STRUCT(sp_vertex_shader);
- if (state == NULL )
+ if (!state)
goto fail;
/* copy shader tokens, the ones passed in will go away.
struct sp_geometry_shader *state;
state = CALLOC_STRUCT(sp_geometry_shader);
- if (state == NULL )
+ if (!state)
goto fail;
state->shader = *templ;
map = spr->data;
}
- if (map == NULL) {
+ if (!map) {
pipe_resource_reference(&pt->resource, NULL);
FREE(spt);
return NULL;
SVGA_3D_CMD_BEGIN_GB_QUERY,
sizeof *cmd,
1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
SVGA_3D_CMD_END_GB_QUERY,
sizeof *cmd,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
SVGA_3D_CMD_WAIT_FOR_GB_QUERY,
sizeof *cmd,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
enum pipe_error ret;
svga = CALLOC_STRUCT(svga_context);
- if (svga == NULL)
+ if (!svga)
goto cleanup;
LIST_INITHEAD(&svga->dirty_buffers);
PIPE_TIMEOUT_INFINITE);
}
- if(pfence)
+ if (pfence)
svgascreen->sws->fence_reference(svgascreen->sws, pfence, fence);
svgascreen->sws->fence_reference(svgascreen->sws, &fence, NULL);
svga_hwtnl_create(struct svga_context *svga)
{
struct svga_hwtnl *hwtnl = CALLOC_STRUCT(svga_hwtnl);
- if (hwtnl == NULL)
+ if (!hwtnl)
goto fail;
hwtnl->svga = svga;
for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
unsigned j = hwtnl->cmd.vdecl_buffer_index[i];
handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer);
- if (handle == NULL)
+ if (!handle)
return PIPE_ERROR_OUT_OF_MEMORY;
vb_handle[i] = handle;
for (i = 0; i < hwtnl->cmd.prim_count; i++) {
if (hwtnl->cmd.prim_ib[i]) {
handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]);
- if (handle == NULL)
+ if (!handle)
return PIPE_ERROR_OUT_OF_MEMORY;
}
else
(void) sbuf; /* silence unused var warning */
ib_handle = svga_buffer_handle(svga, ib);
- if (ib_handle == NULL)
+ if (!ib_handle)
return PIPE_ERROR_OUT_OF_MEMORY;
}
else {
dst = pipe_buffer_create(pipe->screen, PIPE_BIND_INDEX_BUFFER,
PIPE_USAGE_IMMUTABLE, size);
- if (dst == NULL)
+ if (!dst)
goto fail;
dst_map = pipe_buffer_map(pipe, dst, PIPE_TRANSFER_WRITE, &transfer);
- if (dst_map == NULL)
+ if (!dst_map)
goto fail;
generate(0, nr, dst_map);
dst = pipe_buffer_create(pipe->screen,
PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_DEFAULT, size);
- if (dst == NULL)
+ if (!dst)
goto fail;
src_map = pipe_buffer_map(pipe, src, PIPE_TRANSFER_READ, &src_transfer);
- if (src_map == NULL)
+ if (!src_map)
goto fail;
dst_map = pipe_buffer_map(pipe, dst, PIPE_TRANSFER_WRITE, &dst_transfer);
- if (dst_map == NULL)
+ if (!dst_map)
goto fail;
translate((const char *) src_map + offset, 0, 0, nr, 0, dst_map);
rtv = svga_validate_surface_view(svga,
svga_surface(fb->cbufs[i]));
- if (rtv == NULL)
+ if (!rtv)
return PIPE_ERROR_OUT_OF_MEMORY;
ret = SVGA3D_vgpu10_ClearRenderTargetView(svga->swc,
if (flags & (SVGA3D_CLEAR_DEPTH | SVGA3D_CLEAR_STENCIL)) {
struct pipe_surface *dsv =
svga_validate_surface_view(svga, svga_surface(fb->zsbuf));
- if (dsv == NULL)
+ if (!dsv)
return PIPE_ERROR_OUT_OF_MEMORY;
ret = SVGA3D_vgpu10_ClearDepthStencilView(svga->swc, dsv, flags,
if (block_index == -1)
return NULL;
alloc_entry = CALLOC_STRUCT(svga_qmem_alloc_entry);
- if (alloc_entry == NULL)
+ if (!alloc_entry)
return NULL;
alloc_entry->block_index = block_index;
alloc_entry = svga->gb_query_map[type];
- if (alloc_entry == NULL) {
+ if (!alloc_entry) {
/**
* No query memory block has been allocated for this query type,
* allocate one now
*/
alloc_entry = allocate_query_block_entry(svga, len);
- if (alloc_entry == NULL)
+ if (!alloc_entry)
return -1;
svga->gb_query_map[type] = alloc_entry;
}
if (slot_index == -1) {
/* This query memory block is full, allocate another one */
alloc_entry = allocate_query_block_entry(svga, len);
- if (alloc_entry == NULL)
+ if (!alloc_entry)
return -1;
alloc_entry->next = svga->gb_query_map[type];
svga->gb_query_map[type] = alloc_entry;
struct svga_winsys_screen *sws = svga_screen(svga->pipe.screen)->sws;
struct svga_query *sq;
- if (q == NULL) {
+ if (!q) {
destroy_gb_query_obj(svga);
return;
}
/* Allocate the streamout data structure */
streamout = CALLOC_STRUCT(svga_stream_output);
- if (streamout == NULL)
+ if (!streamout)
return NULL;
streamout->info = *info;
assert(box->depth == 1);
transfer = CALLOC_STRUCT(pipe_transfer);
- if (transfer == NULL) {
+ if (!transfer) {
return NULL;
}
/*
* Make sure we return NULL if the map fails
*/
- if (map == NULL) {
+ if (!map) {
FREE(st);
return map;
}
data = (const float (*)[4])
pipe_buffer_map(&svga->pipe, svga->curr.constbufs[shader][0].buffer,
PIPE_TRANSFER_READ, &transfer);
- if (data == NULL) {
+ if (!data) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
/* SVGA_NEW_FS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_FS_CONST_BUFFER
/* SVGA_NEW_VS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_VS_CONST_BUFFER
/* SVGA_NEW_GS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_GS_CONST_BUFFER
/* Setup depth stencil view */
if (curr->zsbuf) {
dsv = svga_validate_surface_view(svga, svga_surface(curr->zsbuf));
- if (dsv == NULL) {
+ if (!dsv) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
}
enum pipe_error ret = PIPE_ERROR;
variant = translate_geometry_program(svga, gs, key);
- if (variant == NULL) {
+ if (!variant) {
/* some problem during translation, try the dummy shader */
const struct tgsi_token *dummy = get_dummy_geometry_shader();
if (!dummy) {
FREE((void *) gs->base.tokens);
gs->base.tokens = dummy;
variant = translate_geometry_program(svga, gs, key);
- if (variant == NULL) {
+ if (!variant) {
return PIPE_ERROR;
}
}
if (svga->curr.user_gs)
assert(svga->curr.gs);
- if (gs == NULL) {
+ if (!gs) {
if (svga->state.hw_draw.gs != NULL) {
/** The previous geometry shader is made inactive.
key.gs.aa_point = svga->curr.rast->templ.point_smooth;
- if (orig_gs != NULL) {
+ if (orig_gs) {
/* Check if the original geometry shader has stream output and
* if position is one of the outputs.
*/
streamout = orig_gs->base.stream_output;
- if (streamout != NULL) {
+ if (streamout) {
pos_out_index = streamout->pos_out_index;
key.gs.point_pos_stream_out = pos_out_index != -1;
}
key.gs.aa_point ?
&aa_point_coord_index : NULL);
- if (new_tokens == NULL) {
+ if (!new_tokens) {
/* if no new tokens are generated for whatever reason, just return */
return NULL;
}
templ.tokens = new_tokens;
templ.stream_output.num_outputs = 0;
- if (streamout != NULL) {
+ if (streamout) {
templ.stream_output = streamout->info;
/* The tgsi_add_point_sprite utility adds an extra output
* for the original point position for stream output purpose.
/* Add the new geometry shader to the head of the shader list
* pointed to by the original geometry shader.
*/
- if (orig_gs != NULL) {
+ if (orig_gs) {
gs->base.next = orig_gs->base.next;
orig_gs->base.next = &gs->base;
}
vs->base.info.output_semantic_name,
vs->base.info.output_semantic_index);
- if (orig_gs == NULL)
+ if (!orig_gs)
return NULL;
}
else {
{
struct svga_surface *bs = s->backed;
- if (bs == NULL) {
+ if (!bs) {
struct svga_texture *tex = svga_texture(s->base.texture);
struct pipe_surface *backed_view;
else
new_buf = NULL;
- if (new_buf == NULL) {
+ if (!new_buf) {
emit->ptr = err_buf;
emit->buf = err_buf;
emit->size = sizeof(err_buf);
}
variant = svga_new_shader_variant(svga);
- if (variant == NULL)
+ if (!variant)
goto fail;
variant->shader = shader;
else
new_buf = NULL;
- if (new_buf == NULL) {
+ if (!new_buf) {
emit->ptr = err_buf;
emit->buf = err_buf;
emit->size = sizeof(err_buf);
vc4_debug &= ~VC4_DEBUG_SHADERDB;
vc4 = rzalloc(NULL, struct vc4_context);
- if (vc4 == NULL)
+ if (!vc4)
return NULL;
struct pipe_context *pctx = &vc4->base;
ctx->flush(ctx, NULL, 0);
trans = util_slab_alloc(&vctx->texture_transfer_pool);
- if (trans == NULL)
+ if (!trans)
return NULL;
trans->base.resource = resource;
uint32_t handle;
surf = CALLOC_STRUCT(virgl_surface);
- if (surf == NULL)
+ if (!surf)
return NULL;
res->clean = FALSE;
uint32_t handle;
struct virgl_resource *res;
- if (state == NULL)
+ if (!state)
return NULL;
grview = CALLOC_STRUCT(virgl_sampler_view);
ctx->flush(ctx, NULL, 0);
trans = util_slab_alloc(&vctx->texture_transfer_pool);
- if (trans == NULL)
+ if (!trans)
return NULL;
trans->base.resource = resource;