replace 0 with NULL for NULL pointers
This updates many places where 0 is used as NULL pointer. There are a few warnings left when I build the default configuration but they either relate to code outside of mesa or where "None" is used instead. Found with static analysis (smatch) Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12174>
This commit is contained in:
parent
60c711833f
commit
7daba1fe65
|
@ -124,7 +124,7 @@ static const struct ac_rtld_symbol *find_symbol(const struct util_dynarray *symb
|
||||||
if ((symbol->part_idx == ~0u || symbol->part_idx == part_idx) && !strcmp(name, symbol->name))
|
if ((symbol->part_idx == ~0u || symbol->part_idx == part_idx) && !strcmp(name, symbol->name))
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_symbol_by_align(const void *lhsp, const void *rhsp)
|
static int compare_symbol_by_align(const void *lhsp, const void *rhsp)
|
||||||
|
|
|
@ -1884,7 +1884,7 @@ static EGLSync EGLAPIENTRY
|
||||||
eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *int_list)
|
eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *int_list)
|
||||||
{
|
{
|
||||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||||
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
|
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
|
||||||
|
|
||||||
EGLSync sync;
|
EGLSync sync;
|
||||||
EGLAttrib *attrib_list;
|
EGLAttrib *attrib_list;
|
||||||
|
@ -1913,7 +1913,7 @@ static EGLSync EGLAPIENTRY
|
||||||
eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
|
eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
|
||||||
{
|
{
|
||||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||||
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
|
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
|
||||||
return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
|
return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
|
||||||
EGL_BAD_ATTRIBUTE);
|
EGL_BAD_ATTRIBUTE);
|
||||||
}
|
}
|
||||||
|
@ -1923,7 +1923,7 @@ EGLSync EGLAPIENTRY
|
||||||
eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
|
eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
|
||||||
{
|
{
|
||||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||||
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
|
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
|
||||||
return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
|
return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
|
||||||
EGL_BAD_PARAMETER);
|
EGL_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
@ -2197,7 +2197,7 @@ eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list)
|
||||||
_EGLImage *img;
|
_EGLImage *img;
|
||||||
EGLImage ret;
|
EGLImage ret;
|
||||||
|
|
||||||
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
|
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
|
||||||
|
|
||||||
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR);
|
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR);
|
||||||
if (!disp->Extensions.MESA_drm_image)
|
if (!disp->Extensions.MESA_drm_image)
|
||||||
|
@ -2299,7 +2299,7 @@ eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image)
|
||||||
_EGLImage *img;
|
_EGLImage *img;
|
||||||
struct wl_buffer *ret;
|
struct wl_buffer *ret;
|
||||||
|
|
||||||
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
|
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL);
|
||||||
|
|
||||||
_EGL_CHECK_DISPLAY(disp, NULL);
|
_EGL_CHECK_DISPLAY(disp, NULL);
|
||||||
if (!disp->Extensions.WL_create_wayland_buffer_from_image)
|
if (!disp->Extensions.WL_create_wayland_buffer_from_image)
|
||||||
|
|
|
@ -178,7 +178,7 @@ struct cso_hash_iter cso_hash_insert(struct cso_hash *hash,
|
||||||
struct cso_node **nextNode = cso_hash_find_node(hash, key);
|
struct cso_node **nextNode = cso_hash_find_node(hash, key);
|
||||||
struct cso_node *node = cso_hash_create_node(hash, key, data, nextNode);
|
struct cso_node *node = cso_hash_create_node(hash, key, data, nextNode);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
struct cso_hash_iter null_iter = {hash, 0};
|
struct cso_hash_iter null_iter = {hash, NULL};
|
||||||
return null_iter;
|
return null_iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +188,8 @@ struct cso_hash_iter cso_hash_insert(struct cso_hash *hash,
|
||||||
|
|
||||||
void cso_hash_init(struct cso_hash *hash)
|
void cso_hash_init(struct cso_hash *hash)
|
||||||
{
|
{
|
||||||
hash->fakeNext = 0;
|
hash->fakeNext = NULL;
|
||||||
hash->buckets = 0;
|
hash->buckets = NULL;
|
||||||
hash->size = 0;
|
hash->size = 0;
|
||||||
hash->userNumBits = (short)MinNumBits;
|
hash->userNumBits = (short)MinNumBits;
|
||||||
hash->numBits = 0;
|
hash->numBits = 0;
|
||||||
|
|
|
@ -253,11 +253,11 @@ draw_unfilled_prepare_outputs( struct draw_context *draw,
|
||||||
struct draw_stage *stage )
|
struct draw_stage *stage )
|
||||||
{
|
{
|
||||||
struct unfilled_stage *unfilled = unfilled_stage(stage);
|
struct unfilled_stage *unfilled = unfilled_stage(stage);
|
||||||
const struct pipe_rasterizer_state *rast = draw ? draw->rasterizer : 0;
|
const struct pipe_rasterizer_state *rast = draw ? draw->rasterizer : NULL;
|
||||||
boolean is_unfilled = (rast &&
|
boolean is_unfilled = (rast &&
|
||||||
(rast->fill_front != PIPE_POLYGON_MODE_FILL ||
|
(rast->fill_front != PIPE_POLYGON_MODE_FILL ||
|
||||||
rast->fill_back != PIPE_POLYGON_MODE_FILL));
|
rast->fill_back != PIPE_POLYGON_MODE_FILL));
|
||||||
const struct draw_fragment_shader *fs = draw ? draw->fs.fragment_shader : 0;
|
const struct draw_fragment_shader *fs = draw ? draw->fs.fragment_shader : NULL;
|
||||||
|
|
||||||
if (is_unfilled && fs && fs->info.uses_frontface) {
|
if (is_unfilled && fs && fs->info.uses_frontface) {
|
||||||
unfilled->face_slot = draw_alloc_extra_vertex_attrib(
|
unfilled->face_slot = draw_alloc_extra_vertex_attrib(
|
||||||
|
|
|
@ -215,7 +215,7 @@ pb_get_base_buffer(struct pb_buffer *buf,
|
||||||
assert(buf);
|
assert(buf);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
base_buf = NULL;
|
base_buf = NULL;
|
||||||
offset = 0;
|
offset = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(pipe_is_referenced(&buf->reference));
|
assert(pipe_is_referenced(&buf->reference));
|
||||||
|
|
|
@ -76,7 +76,7 @@ init_heap(void)
|
||||||
exec_heap = u_mmInit( 0, EXEC_HEAP_SIZE );
|
exec_heap = u_mmInit( 0, EXEC_HEAP_SIZE );
|
||||||
|
|
||||||
if (!exec_mem)
|
if (!exec_mem)
|
||||||
exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE,
|
exec_mem = (unsigned char *) mmap(NULL, EXEC_HEAP_SIZE,
|
||||||
PROT_EXEC | PROT_READ | PROT_WRITE,
|
PROT_EXEC | PROT_READ | PROT_WRITE,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
|
|
||||||
|
|
|
@ -2192,7 +2192,7 @@ const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg,
|
||||||
if (nr_tokens)
|
if (nr_tokens)
|
||||||
*nr_tokens = ureg->domain[DOMAIN_DECL].count;
|
*nr_tokens = ureg->domain[DOMAIN_DECL].count;
|
||||||
|
|
||||||
ureg->domain[DOMAIN_DECL].tokens = 0;
|
ureg->domain[DOMAIN_DECL].tokens = NULL;
|
||||||
ureg->domain[DOMAIN_DECL].size = 0;
|
ureg->domain[DOMAIN_DECL].size = 0;
|
||||||
ureg->domain[DOMAIN_DECL].order = 0;
|
ureg->domain[DOMAIN_DECL].order = 0;
|
||||||
ureg->domain[DOMAIN_DECL].count = 0;
|
ureg->domain[DOMAIN_DECL].count = 0;
|
||||||
|
|
|
@ -2369,7 +2369,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
|
||||||
fb_state.height = dstsurf->height;
|
fb_state.height = dstsurf->height;
|
||||||
fb_state.nr_cbufs = 1;
|
fb_state.nr_cbufs = 1;
|
||||||
fb_state.cbufs[0] = dstsurf;
|
fb_state.cbufs[0] = dstsurf;
|
||||||
fb_state.zsbuf = 0;
|
fb_state.zsbuf = NULL;
|
||||||
pipe->set_framebuffer_state(pipe, &fb_state);
|
pipe->set_framebuffer_state(pipe, &fb_state);
|
||||||
pipe->set_sample_mask(pipe, ~0);
|
pipe->set_sample_mask(pipe, ~0);
|
||||||
if (pipe->set_min_samples)
|
if (pipe->set_min_samples)
|
||||||
|
@ -2453,7 +2453,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
|
||||||
fb_state.width = dstsurf->width;
|
fb_state.width = dstsurf->width;
|
||||||
fb_state.height = dstsurf->height;
|
fb_state.height = dstsurf->height;
|
||||||
fb_state.nr_cbufs = 0;
|
fb_state.nr_cbufs = 0;
|
||||||
fb_state.cbufs[0] = 0;
|
fb_state.cbufs[0] = NULL;
|
||||||
fb_state.zsbuf = dstsurf;
|
fb_state.zsbuf = dstsurf;
|
||||||
pipe->set_framebuffer_state(pipe, &fb_state);
|
pipe->set_framebuffer_state(pipe, &fb_state);
|
||||||
pipe->set_sample_mask(pipe, ~0);
|
pipe->set_sample_mask(pipe, ~0);
|
||||||
|
@ -2780,7 +2780,7 @@ void util_blitter_custom_color(struct blitter_context *blitter,
|
||||||
fb_state.height = dstsurf->height;
|
fb_state.height = dstsurf->height;
|
||||||
fb_state.nr_cbufs = 1;
|
fb_state.nr_cbufs = 1;
|
||||||
fb_state.cbufs[0] = dstsurf;
|
fb_state.cbufs[0] = dstsurf;
|
||||||
fb_state.zsbuf = 0;
|
fb_state.zsbuf = NULL;
|
||||||
pipe->set_framebuffer_state(pipe, &fb_state);
|
pipe->set_framebuffer_state(pipe, &fb_state);
|
||||||
pipe->set_sample_mask(pipe, ~0);
|
pipe->set_sample_mask(pipe, ~0);
|
||||||
if (pipe->set_min_samples)
|
if (pipe->set_min_samples)
|
||||||
|
|
|
@ -99,7 +99,7 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
|
||||||
unsigned *out_stride)
|
unsigned *out_stride)
|
||||||
{
|
{
|
||||||
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
|
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
|
||||||
struct nouveau_bo *bo = 0;
|
struct nouveau_bo *bo = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (whandle->offset != 0) {
|
if (whandle->offset != 0) {
|
||||||
|
|
|
@ -86,7 +86,7 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle)
|
||||||
return sd;
|
return sd;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,31 +87,31 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
|
||||||
/* Lists of instruction transformations. */
|
/* Lists of instruction transformations. */
|
||||||
struct radeon_program_transformation force_alpha_to_one[] = {
|
struct radeon_program_transformation force_alpha_to_one[] = {
|
||||||
{ &rc_force_output_alpha_to_one, c },
|
{ &rc_force_output_alpha_to_one, c },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_program_transformation rewrite_tex[] = {
|
struct radeon_program_transformation rewrite_tex[] = {
|
||||||
{ &radeonTransformTEX, c },
|
{ &radeonTransformTEX, c },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_program_transformation rewrite_if[] = {
|
struct radeon_program_transformation rewrite_if[] = {
|
||||||
{ &r500_transform_IF, 0 },
|
{ &r500_transform_IF, NULL },
|
||||||
{0, 0}
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_program_transformation native_rewrite_r500[] = {
|
struct radeon_program_transformation native_rewrite_r500[] = {
|
||||||
{ &radeonTransformALU, 0 },
|
{ &radeonTransformALU, NULL },
|
||||||
{ &radeonTransformDeriv, 0 },
|
{ &radeonTransformDeriv, NULL },
|
||||||
{ &radeonTransformTrigScale, 0 },
|
{ &radeonTransformTrigScale, NULL },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_program_transformation native_rewrite_r300[] = {
|
struct radeon_program_transformation native_rewrite_r300[] = {
|
||||||
{ &radeonTransformALU, 0 },
|
{ &radeonTransformALU, NULL },
|
||||||
{ &radeonStubDeriv, 0 },
|
{ &radeonStubDeriv, NULL },
|
||||||
{ &r300_transform_trig_simple, 0 },
|
{ &r300_transform_trig_simple, NULL },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List of compiler passes. */
|
/* List of compiler passes. */
|
||||||
|
|
|
@ -865,7 +865,7 @@ static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, voi
|
||||||
|
|
||||||
const struct rc_swizzle_caps r300_vertprog_swizzle_caps = {
|
const struct rc_swizzle_caps r300_vertprog_swizzle_caps = {
|
||||||
.IsNative = &swizzle_is_native,
|
.IsNative = &swizzle_is_native,
|
||||||
.Split = 0 /* should never be called */
|
.Split = NULL /* should never be called */
|
||||||
};
|
};
|
||||||
|
|
||||||
void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||||
|
@ -875,15 +875,15 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||||
|
|
||||||
/* Lists of instruction transformations. */
|
/* Lists of instruction transformations. */
|
||||||
struct radeon_program_transformation alu_rewrite_r500[] = {
|
struct radeon_program_transformation alu_rewrite_r500[] = {
|
||||||
{ &r300_transform_vertex_alu, 0 },
|
{ &r300_transform_vertex_alu, NULL },
|
||||||
{ &r300_transform_trig_scale_vertex, 0 },
|
{ &r300_transform_trig_scale_vertex, NULL },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_program_transformation alu_rewrite_r300[] = {
|
struct radeon_program_transformation alu_rewrite_r300[] = {
|
||||||
{ &r300_transform_vertex_alu, 0 },
|
{ &r300_transform_vertex_alu, NULL },
|
||||||
{ &r300_transform_trig_simple, 0 },
|
{ &r300_transform_trig_simple, NULL },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Note: These passes have to be done seperately from ALU rewrite,
|
/* Note: These passes have to be done seperately from ALU rewrite,
|
||||||
|
@ -891,13 +891,13 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||||
* or non-native modifiers will not be treated properly.
|
* or non-native modifiers will not be treated properly.
|
||||||
*/
|
*/
|
||||||
struct radeon_program_transformation emulate_modifiers[] = {
|
struct radeon_program_transformation emulate_modifiers[] = {
|
||||||
{ &transform_nonnative_modifiers, 0 },
|
{ &transform_nonnative_modifiers, NULL },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_program_transformation resolve_src_conflicts[] = {
|
struct radeon_program_transformation resolve_src_conflicts[] = {
|
||||||
{ &transform_source_conflicts, 0 },
|
{ &transform_source_conflicts, NULL },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List of compiler passes. */
|
/* List of compiler passes. */
|
||||||
|
|
|
@ -121,7 +121,7 @@ static unsigned char * get_used_ptr(struct deadcode_state *s, rc_register_file f
|
||||||
if (file == RC_FILE_OUTPUT || file == RC_FILE_TEMPORARY) {
|
if (file == RC_FILE_OUTPUT || file == RC_FILE_TEMPORARY) {
|
||||||
if (index >= RC_REGISTER_MAX_INDEX) {
|
if (index >= RC_REGISTER_MAX_INDEX) {
|
||||||
rc_error(s->C, "%s: index %i is out of bounds for file %i\n", __FUNCTION__, index, file);
|
rc_error(s->C, "%s: index %i is out of bounds for file %i\n", __FUNCTION__, index, file);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file == RC_FILE_OUTPUT)
|
if (file == RC_FILE_OUTPUT)
|
||||||
|
@ -133,13 +133,13 @@ static unsigned char * get_used_ptr(struct deadcode_state *s, rc_register_file f
|
||||||
} else if (file == RC_FILE_SPECIAL) {
|
} else if (file == RC_FILE_SPECIAL) {
|
||||||
if (index >= RC_NUM_SPECIAL_REGISTERS) {
|
if (index >= RC_NUM_SPECIAL_REGISTERS) {
|
||||||
rc_error(s->C, "%s: special file index %i out of bounds\n", __FUNCTION__, index);
|
rc_error(s->C, "%s: special file index %i out of bounds\n", __FUNCTION__, index);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &s->R.Special[index];
|
return &s->R.Special[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mark_used(struct deadcode_state * s, rc_register_file file, unsigned int index, unsigned int mask)
|
static void mark_used(struct deadcode_state * s, rc_register_file file, unsigned int index, unsigned int mask)
|
||||||
|
|
|
@ -112,7 +112,7 @@ static struct proxy_info * get_proxy_info(struct state_and_proxies * sap,
|
||||||
if (file == RC_FILE_TEMPORARY) {
|
if (file == RC_FILE_TEMPORARY) {
|
||||||
return &sap->Proxies->Temporary[index];
|
return &sap->Proxies->Temporary[index];
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,11 +161,11 @@ static struct reg_value ** get_reg_valuep(struct schedule_state * s,
|
||||||
rc_register_file file, unsigned int index, unsigned int chan)
|
rc_register_file file, unsigned int index, unsigned int chan)
|
||||||
{
|
{
|
||||||
if (file != RC_FILE_TEMPORARY)
|
if (file != RC_FILE_TEMPORARY)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
if (index >= RC_REGISTER_MAX_INDEX) {
|
if (index >= RC_REGISTER_MAX_INDEX) {
|
||||||
rc_error(s->C, "%s: index %i out of bounds\n", __FUNCTION__, index);
|
rc_error(s->C, "%s: index %i out of bounds\n", __FUNCTION__, index);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &s->Temporary[index].Values[chan];
|
return &s->Temporary[index].Values[chan];
|
||||||
|
@ -477,7 +477,7 @@ static void emit_all_tex(struct schedule_state * s, struct rc_instruction * befo
|
||||||
readytex = readytex->NextReady;
|
readytex = readytex->NextReady;
|
||||||
}
|
}
|
||||||
readytex = s->ReadyTEX;
|
readytex = s->ReadyTEX;
|
||||||
s->ReadyTEX = 0;
|
s->ReadyTEX = NULL;
|
||||||
while(readytex){
|
while(readytex){
|
||||||
DBG("%i: commit TEX writes\n", readytex->Instruction->IP);
|
DBG("%i: commit TEX writes\n", readytex->Instruction->IP);
|
||||||
commit_update_writes(s, readytex);
|
commit_update_writes(s, readytex);
|
||||||
|
|
|
@ -240,7 +240,7 @@ static void transform_CEIL(struct radeon_compiler* c,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, negate(inst->U.I.SrcReg[0]));
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dst, negate(inst->U.I.SrcReg[0]));
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
|
emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
|
||||||
inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index));
|
inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index));
|
||||||
rc_remove_instruction(inst);
|
rc_remove_instruction(inst);
|
||||||
|
@ -278,7 +278,7 @@ static void transform_FLR(struct radeon_compiler* c,
|
||||||
struct rc_instruction* inst)
|
struct rc_instruction* inst)
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, inst->U.I.SrcReg[0]);
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dst, inst->U.I.SrcReg[0]);
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
|
emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
|
||||||
inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
|
inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
|
||||||
rc_remove_instruction(inst);
|
rc_remove_instruction(inst);
|
||||||
|
@ -294,8 +294,8 @@ static void transform_TRUNC(struct radeon_compiler* c,
|
||||||
* y * sgn(x) = (x < 0 ? -y : y)
|
* y * sgn(x) = (x < 0 ? -y : y)
|
||||||
*/
|
*/
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, absolute(inst->U.I.SrcReg[0]));
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dst, absolute(inst->U.I.SrcReg[0]));
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, absolute(inst->U.I.SrcReg[0]),
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, absolute(inst->U.I.SrcReg[0]),
|
||||||
negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
|
negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg, inst->U.I.SrcReg[0],
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg, inst->U.I.SrcReg[0],
|
||||||
negate(srcreg(RC_FILE_TEMPORARY, dst.Index)), srcreg(RC_FILE_TEMPORARY, dst.Index));
|
negate(srcreg(RC_FILE_TEMPORARY, dst.Index)), srcreg(RC_FILE_TEMPORARY, dst.Index));
|
||||||
|
@ -334,7 +334,7 @@ static void transform_LIT(struct radeon_compiler* c,
|
||||||
struct rc_instruction * inst_mov;
|
struct rc_instruction * inst_mov;
|
||||||
|
|
||||||
inst_mov = emit1(c, inst,
|
inst_mov = emit1(c, inst,
|
||||||
RC_OPCODE_MOV, 0, inst->U.I.DstReg,
|
RC_OPCODE_MOV, NULL, inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, rc_find_free_temporary(c)));
|
srcreg(RC_FILE_TEMPORARY, rc_find_free_temporary(c)));
|
||||||
|
|
||||||
inst->U.I.DstReg.File = RC_FILE_TEMPORARY;
|
inst->U.I.DstReg.File = RC_FILE_TEMPORARY;
|
||||||
|
@ -348,25 +348,25 @@ static void transform_LIT(struct radeon_compiler* c,
|
||||||
/* tmp.x = max(0.0, Src.x); */
|
/* tmp.x = max(0.0, Src.x); */
|
||||||
/* tmp.y = max(0.0, Src.y); */
|
/* tmp.y = max(0.0, Src.y); */
|
||||||
/* tmp.w = clamp(Src.z, -128+eps, 128-eps); */
|
/* tmp.w = clamp(Src.z, -128+eps, 128-eps); */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
|
emit2(c, inst->Prev, RC_OPCODE_MAX, NULL,
|
||||||
dstregtmpmask(temp, RC_MASK_XYW),
|
dstregtmpmask(temp, RC_MASK_XYW),
|
||||||
inst->U.I.SrcReg[0],
|
inst->U.I.SrcReg[0],
|
||||||
swizzle(srcreg(RC_FILE_CONSTANT, constant),
|
swizzle(srcreg(RC_FILE_CONSTANT, constant),
|
||||||
RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, constant_swizzle&3));
|
RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, constant_swizzle&3));
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MIN, 0,
|
emit2(c, inst->Prev, RC_OPCODE_MIN, NULL,
|
||||||
dstregtmpmask(temp, RC_MASK_Z),
|
dstregtmpmask(temp, RC_MASK_Z),
|
||||||
swizzle_wwww(srctemp),
|
swizzle_wwww(srctemp),
|
||||||
negate(srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle)));
|
negate(srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle)));
|
||||||
|
|
||||||
/* tmp.w = Pow(tmp.y, tmp.w) */
|
/* tmp.w = Pow(tmp.y, tmp.w) */
|
||||||
emit1(c, inst->Prev, RC_OPCODE_LG2, 0,
|
emit1(c, inst->Prev, RC_OPCODE_LG2, NULL,
|
||||||
dstregtmpmask(temp, RC_MASK_W),
|
dstregtmpmask(temp, RC_MASK_W),
|
||||||
swizzle_yyyy(srctemp));
|
swizzle_yyyy(srctemp));
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MUL, 0,
|
emit2(c, inst->Prev, RC_OPCODE_MUL, NULL,
|
||||||
dstregtmpmask(temp, RC_MASK_W),
|
dstregtmpmask(temp, RC_MASK_W),
|
||||||
swizzle_wwww(srctemp),
|
swizzle_wwww(srctemp),
|
||||||
swizzle_zzzz(srctemp));
|
swizzle_zzzz(srctemp));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_EX2, 0,
|
emit1(c, inst->Prev, RC_OPCODE_EX2, NULL,
|
||||||
dstregtmpmask(temp, RC_MASK_W),
|
dstregtmpmask(temp, RC_MASK_W),
|
||||||
swizzle_wwww(srctemp));
|
swizzle_wwww(srctemp));
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ static void transform_LRP(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0,
|
emit3(c, inst->Prev, RC_OPCODE_ADD, NULL,
|
||||||
dst,
|
dst,
|
||||||
negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[2], inst->U.I.SrcReg[2]);
|
negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[2], inst->U.I.SrcReg[2]);
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, &inst->U.I,
|
emit3(c, inst->Prev, RC_OPCODE_MAD, &inst->U.I,
|
||||||
|
@ -408,8 +408,8 @@ static void transform_POW(struct radeon_compiler* c,
|
||||||
tempdst.WriteMask = RC_MASK_W;
|
tempdst.WriteMask = RC_MASK_W;
|
||||||
tempsrc.Swizzle = RC_SWIZZLE_WWWW;
|
tempsrc.Swizzle = RC_SWIZZLE_WWWW;
|
||||||
|
|
||||||
emit1(c, inst->Prev, RC_OPCODE_LG2, 0, tempdst, swizzle_xxxx(inst->U.I.SrcReg[0]));
|
emit1(c, inst->Prev, RC_OPCODE_LG2, NULL, tempdst, swizzle_xxxx(inst->U.I.SrcReg[0]));
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MUL, 0, tempdst, tempsrc, swizzle_xxxx(inst->U.I.SrcReg[1]));
|
emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, tempdst, tempsrc, swizzle_xxxx(inst->U.I.SrcReg[1]));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_EX2, &inst->U.I, inst->U.I.DstReg, tempsrc);
|
emit1(c, inst->Prev, RC_OPCODE_EX2, &inst->U.I, inst->U.I.DstReg, tempsrc);
|
||||||
|
|
||||||
rc_remove_instruction(inst);
|
rc_remove_instruction(inst);
|
||||||
|
@ -435,7 +435,7 @@ static void transform_ROUND(struct radeon_compiler* c,
|
||||||
/* add = src + .5 */
|
/* add = src + .5 */
|
||||||
add_index = rc_find_free_temporary(c);
|
add_index = rc_find_free_temporary(c);
|
||||||
add_dst = dstregtmpmask(add_index, mask);
|
add_dst = dstregtmpmask(add_index, mask);
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, add_dst, inst->U.I.SrcReg[0],
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, add_dst, inst->U.I.SrcReg[0],
|
||||||
builtin_half);
|
builtin_half);
|
||||||
add_src = srcreg(RC_FILE_TEMPORARY, add_dst.Index);
|
add_src = srcreg(RC_FILE_TEMPORARY, add_dst.Index);
|
||||||
|
|
||||||
|
@ -443,11 +443,11 @@ static void transform_ROUND(struct radeon_compiler* c,
|
||||||
/* frac = FRC(add) */
|
/* frac = FRC(add) */
|
||||||
frac_index = rc_find_free_temporary(c);
|
frac_index = rc_find_free_temporary(c);
|
||||||
frac_dst = dstregtmpmask(frac_index, mask);
|
frac_dst = dstregtmpmask(frac_index, mask);
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, frac_dst, add_src);
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, frac_dst, add_src);
|
||||||
frac_src = srcreg(RC_FILE_TEMPORARY, frac_dst.Index);
|
frac_src = srcreg(RC_FILE_TEMPORARY, frac_dst.Index);
|
||||||
|
|
||||||
/* dst = add - frac */
|
/* dst = add - frac */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, inst->U.I.DstReg,
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, inst->U.I.DstReg,
|
||||||
add_src, negate(frac_src));
|
add_src, negate(frac_src));
|
||||||
rc_remove_instruction(inst);
|
rc_remove_instruction(inst);
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ static void transform_SEQ(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
||||||
negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_zero, builtin_one);
|
negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_zero, builtin_one);
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ static void transform_SGE(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
|
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ static void transform_SGT(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
|
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ static void transform_SLE(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
|
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ static void transform_SLT(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
|
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ static void transform_SNE(struct radeon_compiler* c,
|
||||||
{
|
{
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
|
||||||
negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_one, builtin_zero);
|
negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_one, builtin_zero);
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ static void transform_SSG(struct radeon_compiler* c,
|
||||||
|
|
||||||
/* 0 < x */
|
/* 0 < x */
|
||||||
dst0 = try_to_reuse_dst(c, inst);
|
dst0 = try_to_reuse_dst(c, inst);
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, 0,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, NULL,
|
||||||
dst0,
|
dst0,
|
||||||
negate(inst->U.I.SrcReg[0]),
|
negate(inst->U.I.SrcReg[0]),
|
||||||
builtin_one,
|
builtin_one,
|
||||||
|
@ -552,7 +552,7 @@ static void transform_SSG(struct radeon_compiler* c,
|
||||||
|
|
||||||
/* x < 0 */
|
/* x < 0 */
|
||||||
tmp1 = rc_find_free_temporary(c);
|
tmp1 = rc_find_free_temporary(c);
|
||||||
emit3(c, inst->Prev, RC_OPCODE_CMP, 0,
|
emit3(c, inst->Prev, RC_OPCODE_CMP, NULL,
|
||||||
dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask),
|
dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask),
|
||||||
inst->U.I.SrcReg[0],
|
inst->U.I.SrcReg[0],
|
||||||
builtin_one,
|
builtin_one,
|
||||||
|
@ -560,7 +560,7 @@ static void transform_SSG(struct radeon_compiler* c,
|
||||||
|
|
||||||
/* Either both are zero, or one of them is one and the other is zero. */
|
/* Either both are zero, or one of them is one and the other is zero. */
|
||||||
/* result = tmp0 - tmp1 */
|
/* result = tmp0 - tmp1 */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst0.Index),
|
srcreg(RC_FILE_TEMPORARY, dst0.Index),
|
||||||
negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
|
negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
|
||||||
|
@ -634,13 +634,13 @@ static void transform_r300_vertex_CMP(struct radeon_compiler* c,
|
||||||
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
|
||||||
|
|
||||||
/* SLT tmp0, src0, 0.0 */
|
/* SLT tmp0, src0, 0.0 */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
|
||||||
dst,
|
dst,
|
||||||
inst->U.I.SrcReg[0], builtin_zero);
|
inst->U.I.SrcReg[0], builtin_zero);
|
||||||
|
|
||||||
/* LRP dst, tmp0, src1, src2 */
|
/* LRP dst, tmp0, src1, src2 */
|
||||||
transform_LRP(c,
|
transform_LRP(c,
|
||||||
emit3(c, inst->Prev, RC_OPCODE_LRP, 0,
|
emit3(c, inst->Prev, RC_OPCODE_LRP, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1], inst->U.I.SrcReg[2]));
|
srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1], inst->U.I.SrcReg[2]));
|
||||||
|
|
||||||
|
@ -681,12 +681,12 @@ static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c,
|
||||||
|
|
||||||
/* MOV dst, src */
|
/* MOV dst, src */
|
||||||
dst.WriteMask = RC_MASK_XYZW;
|
dst.WriteMask = RC_MASK_XYZW;
|
||||||
emit1(c, inst->Prev, RC_OPCODE_MOV, 0,
|
emit1(c, inst->Prev, RC_OPCODE_MOV, NULL,
|
||||||
dst,
|
dst,
|
||||||
inst->U.I.SrcReg[0]);
|
inst->U.I.SrcReg[0]);
|
||||||
|
|
||||||
/* MAX dst.y, src, 0.00...001 */
|
/* MAX dst.y, src, 0.00...001 */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
|
emit2(c, inst->Prev, RC_OPCODE_MAX, NULL,
|
||||||
dstregtmpmask(dst.Index, RC_MASK_Y),
|
dstregtmpmask(dst.Index, RC_MASK_Y),
|
||||||
srcreg(RC_FILE_TEMPORARY, dst.Index),
|
srcreg(RC_FILE_TEMPORARY, dst.Index),
|
||||||
srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
|
srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
|
||||||
|
@ -701,19 +701,19 @@ static void transform_r300_vertex_SEQ(struct radeon_compiler *c,
|
||||||
int tmp = rc_find_free_temporary(c);
|
int tmp = rc_find_free_temporary(c);
|
||||||
|
|
||||||
/* x <= y */
|
/* x <= y */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SGE, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SGE, NULL,
|
||||||
dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask),
|
dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask),
|
||||||
inst->U.I.SrcReg[0],
|
inst->U.I.SrcReg[0],
|
||||||
inst->U.I.SrcReg[1]);
|
inst->U.I.SrcReg[1]);
|
||||||
|
|
||||||
/* y <= x */
|
/* y <= x */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SGE, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SGE, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
inst->U.I.SrcReg[1],
|
inst->U.I.SrcReg[1],
|
||||||
inst->U.I.SrcReg[0]);
|
inst->U.I.SrcReg[0]);
|
||||||
|
|
||||||
/* x && y = x * y */
|
/* x && y = x * y */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MUL, 0,
|
emit2(c, inst->Prev, RC_OPCODE_MUL, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, tmp),
|
srcreg(RC_FILE_TEMPORARY, tmp),
|
||||||
srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index));
|
srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index));
|
||||||
|
@ -728,19 +728,19 @@ static void transform_r300_vertex_SNE(struct radeon_compiler *c,
|
||||||
int tmp = rc_find_free_temporary(c);
|
int tmp = rc_find_free_temporary(c);
|
||||||
|
|
||||||
/* x < y */
|
/* x < y */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
|
||||||
dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask),
|
dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask),
|
||||||
inst->U.I.SrcReg[0],
|
inst->U.I.SrcReg[0],
|
||||||
inst->U.I.SrcReg[1]);
|
inst->U.I.SrcReg[1]);
|
||||||
|
|
||||||
/* y < x */
|
/* y < x */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
inst->U.I.SrcReg[1],
|
inst->U.I.SrcReg[1],
|
||||||
inst->U.I.SrcReg[0]);
|
inst->U.I.SrcReg[0]);
|
||||||
|
|
||||||
/* x || y = max(x, y) */
|
/* x || y = max(x, y) */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
|
emit2(c, inst->Prev, RC_OPCODE_MAX, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, tmp),
|
srcreg(RC_FILE_TEMPORARY, tmp),
|
||||||
srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index));
|
srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index));
|
||||||
|
@ -780,21 +780,21 @@ static void transform_r300_vertex_SSG(struct radeon_compiler* c,
|
||||||
|
|
||||||
/* 0 < x */
|
/* 0 < x */
|
||||||
dst0 = try_to_reuse_dst(c, inst);
|
dst0 = try_to_reuse_dst(c, inst);
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
|
||||||
dst0,
|
dst0,
|
||||||
builtin_zero,
|
builtin_zero,
|
||||||
inst->U.I.SrcReg[0]);
|
inst->U.I.SrcReg[0]);
|
||||||
|
|
||||||
/* x < 0 */
|
/* x < 0 */
|
||||||
tmp1 = rc_find_free_temporary(c);
|
tmp1 = rc_find_free_temporary(c);
|
||||||
emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
|
emit2(c, inst->Prev, RC_OPCODE_SLT, NULL,
|
||||||
dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask),
|
dstregtmpmask(tmp1, inst->U.I.DstReg.WriteMask),
|
||||||
inst->U.I.SrcReg[0],
|
inst->U.I.SrcReg[0],
|
||||||
builtin_zero);
|
builtin_zero);
|
||||||
|
|
||||||
/* Either both are zero, or one of them is one and the other is zero. */
|
/* Either both are zero, or one of them is one and the other is zero. */
|
||||||
/* result = tmp0 - tmp1 */
|
/* result = tmp0 - tmp1 */
|
||||||
emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
|
emit2(c, inst->Prev, RC_OPCODE_ADD, NULL,
|
||||||
inst->U.I.DstReg,
|
inst->U.I.DstReg,
|
||||||
srcreg(RC_FILE_TEMPORARY, dst0.Index),
|
srcreg(RC_FILE_TEMPORARY, dst0.Index),
|
||||||
negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
|
negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
|
||||||
|
@ -888,18 +888,18 @@ static void sin_approx(
|
||||||
{
|
{
|
||||||
unsigned int tempreg = rc_find_free_temporary(c);
|
unsigned int tempreg = rc_find_free_temporary(c);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY),
|
emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
|
||||||
swizzle_xxxx(src),
|
swizzle_xxxx(src),
|
||||||
srcreg(RC_FILE_CONSTANT, constants[0]));
|
srcreg(RC_FILE_CONSTANT, constants[0]));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_X),
|
||||||
swizzle_yyyy(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
swizzle_yyyy(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
||||||
absolute(swizzle_xxxx(src)),
|
absolute(swizzle_xxxx(src)),
|
||||||
swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_Y),
|
||||||
swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
||||||
absolute(swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg))),
|
absolute(swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg))),
|
||||||
negate(swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg))));
|
negate(swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg))));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dst,
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dst,
|
||||||
swizzle_yyyy(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
swizzle_yyyy(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
||||||
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[0])),
|
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[0])),
|
||||||
swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
swizzle_xxxx(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
||||||
|
@ -929,13 +929,13 @@ int r300_transform_trig_simple(struct radeon_compiler* c,
|
||||||
/* MAD tmp.x, src, 1/(2*PI), 0.75 */
|
/* MAD tmp.x, src, 1/(2*PI), 0.75 */
|
||||||
/* FRC tmp.x, tmp.x */
|
/* FRC tmp.x, tmp.x */
|
||||||
/* MAD tmp.z, tmp.x, 2*PI, -PI */
|
/* MAD tmp.z, tmp.x, 2*PI, -PI */
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
|
||||||
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
||||||
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
|
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
|
||||||
swizzle_xxxx(srcreg(RC_FILE_CONSTANT, constants[1])));
|
swizzle_xxxx(srcreg(RC_FILE_CONSTANT, constants[1])));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W),
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(tempreg, RC_MASK_W),
|
||||||
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
|
||||||
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
||||||
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
|
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
|
||||||
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
|
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
|
||||||
|
@ -944,13 +944,13 @@ int r300_transform_trig_simple(struct radeon_compiler* c,
|
||||||
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
||||||
constants);
|
constants);
|
||||||
} else if (inst->U.I.Opcode == RC_OPCODE_SIN) {
|
} else if (inst->U.I.Opcode == RC_OPCODE_SIN) {
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
|
||||||
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
||||||
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
|
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
|
||||||
swizzle_yyyy(srcreg(RC_FILE_CONSTANT, constants[1])));
|
swizzle_yyyy(srcreg(RC_FILE_CONSTANT, constants[1])));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W),
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(tempreg, RC_MASK_W),
|
||||||
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_W),
|
||||||
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
|
||||||
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
|
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
|
||||||
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
|
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
|
||||||
|
@ -961,13 +961,13 @@ int r300_transform_trig_simple(struct radeon_compiler* c,
|
||||||
} else {
|
} else {
|
||||||
struct rc_dst_register dst;
|
struct rc_dst_register dst;
|
||||||
|
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
|
||||||
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
||||||
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
|
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
|
||||||
swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W));
|
swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_XY),
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
|
||||||
srcreg(RC_FILE_TEMPORARY, tempreg));
|
srcreg(RC_FILE_TEMPORARY, tempreg));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(tempreg, RC_MASK_XY),
|
||||||
srcreg(RC_FILE_TEMPORARY, tempreg),
|
srcreg(RC_FILE_TEMPORARY, tempreg),
|
||||||
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
|
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
|
||||||
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
|
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
|
||||||
|
@ -1029,10 +1029,10 @@ int radeonTransformTrigScale(struct radeon_compiler* c,
|
||||||
temp = rc_find_free_temporary(c);
|
temp = rc_find_free_temporary(c);
|
||||||
constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle);
|
constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle);
|
||||||
|
|
||||||
emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(temp, RC_MASK_W),
|
emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, dstregtmpmask(temp, RC_MASK_W),
|
||||||
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
||||||
srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
|
srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(temp, RC_MASK_W),
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(temp, RC_MASK_W),
|
||||||
srcreg(RC_FILE_TEMPORARY, temp));
|
srcreg(RC_FILE_TEMPORARY, temp));
|
||||||
|
|
||||||
r300_transform_SIN_COS(c, inst, temp);
|
r300_transform_SIN_COS(c, inst, temp);
|
||||||
|
@ -1063,13 +1063,13 @@ int r300_transform_trig_scale_vertex(struct radeon_compiler *c,
|
||||||
temp = rc_find_free_temporary(c);
|
temp = rc_find_free_temporary(c);
|
||||||
constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons);
|
constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons);
|
||||||
|
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(temp, RC_MASK_W),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(temp, RC_MASK_W),
|
||||||
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
swizzle_xxxx(inst->U.I.SrcReg[0]),
|
||||||
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_XXXX),
|
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_XXXX),
|
||||||
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_YYYY));
|
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_YYYY));
|
||||||
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(temp, RC_MASK_W),
|
emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(temp, RC_MASK_W),
|
||||||
srcreg(RC_FILE_TEMPORARY, temp));
|
srcreg(RC_FILE_TEMPORARY, temp));
|
||||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(temp, RC_MASK_W),
|
emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(temp, RC_MASK_W),
|
||||||
srcreg(RC_FILE_TEMPORARY, temp),
|
srcreg(RC_FILE_TEMPORARY, temp),
|
||||||
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_ZZZZ),
|
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_ZZZZ),
|
||||||
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_WWWW));
|
srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_WWWW));
|
||||||
|
@ -1189,7 +1189,7 @@ int rc_force_output_alpha_to_one(struct radeon_compiler *c,
|
||||||
tmp = rc_find_free_temporary(c);
|
tmp = rc_find_free_temporary(c);
|
||||||
|
|
||||||
/* Insert MOV after inst, set alpha to 1. */
|
/* Insert MOV after inst, set alpha to 1. */
|
||||||
emit1(c, inst, RC_OPCODE_MOV, 0, inst->U.I.DstReg,
|
emit1(c, inst, RC_OPCODE_MOV, NULL, inst->U.I.DstReg,
|
||||||
srcregswz(RC_FILE_TEMPORARY, tmp, RC_SWIZZLE_XYZ1));
|
srcregswz(RC_FILE_TEMPORARY, tmp, RC_SWIZZLE_XYZ1));
|
||||||
|
|
||||||
/* Re-route the destination of inst to the source of mov. */
|
/* Re-route the destination of inst to the source of mov. */
|
||||||
|
|
|
@ -881,7 +881,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
|
||||||
view->swizzle, FALSE);
|
view->swizzle, FALSE);
|
||||||
} else {
|
} else {
|
||||||
texstate->format.format1 |=
|
texstate->format.format1 |=
|
||||||
r300_get_swizzle_combined(depth_swizzle, 0, FALSE);
|
r300_get_swizzle_combined(depth_swizzle, NULL, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -900,7 +900,7 @@ boolean r300_is_zs_format_supported(enum pipe_format format)
|
||||||
|
|
||||||
boolean r300_is_sampler_format_supported(enum pipe_format format)
|
boolean r300_is_sampler_format_supported(enum pipe_format format)
|
||||||
{
|
{
|
||||||
return r300_translate_texformat(format, 0, TRUE, FALSE) != ~0;
|
return r300_translate_texformat(format, NULL, TRUE, FALSE) != ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void r300_texture_setup_format_state(struct r300_screen *screen,
|
void r300_texture_setup_format_state(struct r300_screen *screen,
|
||||||
|
|
|
@ -50,7 +50,7 @@ static void svga_flush( struct pipe_context *pipe,
|
||||||
svga_context_flush(svga, fence);
|
svga_context_flush(svga, fence);
|
||||||
|
|
||||||
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n",
|
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n",
|
||||||
__FUNCTION__, fence ? *fence : 0x0);
|
__FUNCTION__, fence ? *fence : NULL);
|
||||||
|
|
||||||
/* Enable to dump BMPs of the color/depth buffers each frame */
|
/* Enable to dump BMPs of the color/depth buffers each frame */
|
||||||
if (0) {
|
if (0) {
|
||||||
|
|
|
@ -335,7 +335,7 @@ renderer_bind_destination(struct xa_context *r,
|
||||||
fb.height = surface->height;
|
fb.height = surface->height;
|
||||||
fb.nr_cbufs = 1;
|
fb.nr_cbufs = 1;
|
||||||
fb.cbufs[0] = surface;
|
fb.cbufs[0] = surface;
|
||||||
fb.zsbuf = 0;
|
fb.zsbuf = NULL;
|
||||||
|
|
||||||
/* Viewport just touches the bit we're interested in:
|
/* Viewport just touches the bit we're interested in:
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -154,7 +154,7 @@ create_vs(struct pipe_context *pipe, unsigned vs_traits)
|
||||||
|
|
||||||
ureg = ureg_create(PIPE_SHADER_VERTEX);
|
ureg = ureg_create(PIPE_SHADER_VERTEX);
|
||||||
if (ureg == NULL)
|
if (ureg == NULL)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
const0 = ureg_DECL_constant(ureg, 0);
|
const0 = ureg_DECL_constant(ureg, 0);
|
||||||
const1 = ureg_DECL_constant(ureg, 1);
|
const1 = ureg_DECL_constant(ureg, 1);
|
||||||
|
@ -368,7 +368,7 @@ create_fs(struct pipe_context *pipe, unsigned fs_traits)
|
||||||
|
|
||||||
ureg = ureg_create(PIPE_SHADER_FRAGMENT);
|
ureg = ureg_create(PIPE_SHADER_FRAGMENT);
|
||||||
if (ureg == NULL)
|
if (ureg == NULL)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
if (is_yuv)
|
if (is_yuv)
|
||||||
return create_yuv_shader(pipe, ureg);
|
return create_yuv_shader(pipe, ureg);
|
||||||
|
@ -462,7 +462,7 @@ static inline void *
|
||||||
shader_from_cache(struct pipe_context *pipe,
|
shader_from_cache(struct pipe_context *pipe,
|
||||||
unsigned type, struct cso_hash *hash, unsigned key)
|
unsigned type, struct cso_hash *hash, unsigned key)
|
||||||
{
|
{
|
||||||
void *shader = 0;
|
void *shader = NULL;
|
||||||
|
|
||||||
struct cso_hash_iter iter = cso_hash_find(hash, key);
|
struct cso_hash_iter iter = cso_hash_find(hash, key);
|
||||||
|
|
||||||
|
|
|
@ -103,9 +103,9 @@ alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size)
|
||||||
if (dri_sw_dt->shmid < 0)
|
if (dri_sw_dt->shmid < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
addr = (char *) shmat(dri_sw_dt->shmid, 0, 0);
|
addr = (char *) shmat(dri_sw_dt->shmid, NULL, 0);
|
||||||
/* mark the segment immediately for deletion to avoid leaks */
|
/* mark the segment immediately for deletion to avoid leaks */
|
||||||
shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
|
shmctl(dri_sw_dt->shmid, IPC_RMID, NULL);
|
||||||
|
|
||||||
if (addr == (char *) -1)
|
if (addr == (char *) -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -173,7 +173,7 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
|
||||||
if (dri_sw_dt->shmid >= 0) {
|
if (dri_sw_dt->shmid >= 0) {
|
||||||
#ifdef HAVE_SYS_SHM_H
|
#ifdef HAVE_SYS_SHM_H
|
||||||
shmdt(dri_sw_dt->data);
|
shmdt(dri_sw_dt->data);
|
||||||
shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
|
shmctl(dri_sw_dt->shmid, IPC_RMID, NULL);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
align_free(dri_sw_dt->data);
|
align_free(dri_sw_dt->data);
|
||||||
|
|
|
@ -266,7 +266,7 @@ kms_sw_displaytarget_map(struct sw_winsys *ws,
|
||||||
prot = (flags == PIPE_MAP_READ) ? PROT_READ : (PROT_READ | PROT_WRITE);
|
prot = (flags == PIPE_MAP_READ) ? PROT_READ : (PROT_READ | PROT_WRITE);
|
||||||
void **ptr = (flags == PIPE_MAP_READ) ? &kms_sw_dt->ro_mapped : &kms_sw_dt->mapped;
|
void **ptr = (flags == PIPE_MAP_READ) ? &kms_sw_dt->ro_mapped : &kms_sw_dt->mapped;
|
||||||
if (*ptr == MAP_FAILED) {
|
if (*ptr == MAP_FAILED) {
|
||||||
void *tmp = mmap(0, kms_sw_dt->size, prot, MAP_SHARED,
|
void *tmp = mmap(NULL, kms_sw_dt->size, prot, MAP_SHARED,
|
||||||
kms_sw->fd, map_req.offset);
|
kms_sw->fd, map_req.offset);
|
||||||
if (tmp == MAP_FAILED)
|
if (tmp == MAP_FAILED)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -176,7 +176,7 @@ gbm_dri_bo_map_dumb(struct gbm_dri_bo *bo)
|
||||||
if (ret)
|
if (ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bo->map = mmap(0, bo->size, PROT_WRITE,
|
bo->map = mmap(NULL, bo->size, PROT_WRITE,
|
||||||
MAP_SHARED, bo->base.gbm->v0.fd, map_arg.offset);
|
MAP_SHARED, bo->base.gbm->v0.fd, map_arg.offset);
|
||||||
if (bo->map == MAP_FAILED) {
|
if (bo->map == MAP_FAILED) {
|
||||||
bo->map = NULL;
|
bo->map = NULL;
|
||||||
|
|
|
@ -411,7 +411,7 @@ DRI2GetBuffers(Display * dpy, XID drawable,
|
||||||
CARD32 *p;
|
CARD32 *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
XextCheckExtension(dpy, info, dri2ExtensionName, NULL);
|
||||||
|
|
||||||
LockDisplay(dpy);
|
LockDisplay(dpy);
|
||||||
GetReqExtra(DRI2GetBuffers, count * 4, req);
|
GetReqExtra(DRI2GetBuffers, count * 4, req);
|
||||||
|
@ -470,7 +470,7 @@ DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
|
||||||
CARD32 *p;
|
CARD32 *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
XextCheckExtension(dpy, info, dri2ExtensionName, NULL);
|
||||||
|
|
||||||
LockDisplay(dpy);
|
LockDisplay(dpy);
|
||||||
GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
|
GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
|
||||||
|
|
|
@ -710,7 +710,7 @@ static void show_fps(struct dri2_drawable *draw)
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
uint64_t current_time;
|
uint64_t current_time;
|
||||||
|
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, NULL);
|
||||||
current_time = (uint64_t)tv.tv_sec*1000000 + (uint64_t)tv.tv_usec;
|
current_time = (uint64_t)tv.tv_sec*1000000 + (uint64_t)tv.tv_usec;
|
||||||
|
|
||||||
draw->frames++;
|
draw->frames++;
|
||||||
|
|
|
@ -575,7 +575,7 @@ drisw_create_context_attribs(struct glx_screen *base,
|
||||||
pcp->driContext =
|
pcp->driContext =
|
||||||
(*psc->swrast->createContextAttribs) (psc->driScreen,
|
(*psc->swrast->createContextAttribs) (psc->driScreen,
|
||||||
dca.api,
|
dca.api,
|
||||||
config ? config->driConfig : 0,
|
config ? config->driConfig : NULL,
|
||||||
shared,
|
shared,
|
||||||
num_ctx_attribs / 2,
|
num_ctx_attribs / 2,
|
||||||
ctx_attribs,
|
ctx_attribs,
|
||||||
|
|
|
@ -204,7 +204,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||||
if (oldGC != &dummyContext) {
|
if (oldGC != &dummyContext) {
|
||||||
if (--oldGC->thread_refcount == 0) {
|
if (--oldGC->thread_refcount == 0) {
|
||||||
oldGC->vtable->unbind(oldGC, gc);
|
oldGC->vtable->unbind(oldGC, gc);
|
||||||
oldGC->currentDpy = 0;
|
oldGC->currentDpy = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@
|
||||||
gc = __glXGetCurrentContext(); \
|
gc = __glXGetCurrentContext(); \
|
||||||
pc = gc->pc; \
|
pc = gc->pc; \
|
||||||
/* Muffle compilers */ \
|
/* Muffle compilers */ \
|
||||||
cmdlen = 0; (void)cmdlen; \
|
cmdlen = 0; (void)cmdlen; \
|
||||||
compsize = 0; (void)compsize; \
|
compsize = 0; (void)compsize; \
|
||||||
pixelHeaderPC = 0; (void)pixelHeaderPC
|
pixelHeaderPC = NULL; (void)pixelHeaderPC
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Variable sized command support macro. This macro is used by calls
|
** Variable sized command support macro. This macro is used by calls
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
#define __GLX_SINGLE_LOAD_VARIABLES() \
|
#define __GLX_SINGLE_LOAD_VARIABLES() \
|
||||||
pc = gc->pc; \
|
pc = gc->pc; \
|
||||||
/* Muffle compilers */ \
|
/* Muffle compilers */ \
|
||||||
pixelHeaderPC = 0; (void)pixelHeaderPC; \
|
pixelHeaderPC = NULL; (void)pixelHeaderPC; \
|
||||||
compsize = 0; (void)compsize; \
|
compsize = 0; (void)compsize; \
|
||||||
cmdlen = 0; (void)cmdlen
|
cmdlen = 0; (void)cmdlen
|
||||||
|
|
||||||
|
|
|
@ -143,20 +143,20 @@ glXQueryRendererStringMESA(Display *dpy, int screen,
|
||||||
struct glx_screen *psc;
|
struct glx_screen *psc;
|
||||||
|
|
||||||
if (dpy == NULL)
|
if (dpy == NULL)
|
||||||
return False;
|
return NULL;
|
||||||
|
|
||||||
/* This probably means the caller passed the wrong display pointer or
|
/* This probably means the caller passed the wrong display pointer or
|
||||||
* screen number.
|
* screen number.
|
||||||
*/
|
*/
|
||||||
psc = GetGLXScreenConfigs(dpy, screen);
|
psc = GetGLXScreenConfigs(dpy, screen);
|
||||||
if (psc == NULL)
|
if (psc == NULL)
|
||||||
return False;
|
return NULL;
|
||||||
|
|
||||||
/* Right now only a single renderer per display / screen combination is
|
/* Right now only a single renderer per display / screen combination is
|
||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
if (renderer != 0)
|
if (renderer != 0)
|
||||||
return False;
|
return NULL;
|
||||||
|
|
||||||
return __glXQueryRendererString(psc, attribute);
|
return __glXQueryRendererString(psc, attribute);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ glXQueryCurrentRendererStringMESA(int attribute)
|
||||||
struct glx_context *gc = __glXGetCurrentContext();
|
struct glx_context *gc = __glXGetCurrentContext();
|
||||||
|
|
||||||
if (gc == &dummyContext)
|
if (gc == &dummyContext)
|
||||||
return False;
|
return NULL;
|
||||||
|
|
||||||
return __glXQueryRendererString(gc->psc, attribute);
|
return __glXQueryRendererString(gc->psc, attribute);
|
||||||
}
|
}
|
||||||
|
|
|
@ -647,7 +647,7 @@ __indirect_glGetString(GLenum name)
|
||||||
GLubyte *s = NULL;
|
GLubyte *s = NULL;
|
||||||
|
|
||||||
if (!dpy)
|
if (!dpy)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Return the cached copy if the string has already been fetched
|
** Return the cached copy if the string has already been fetched
|
||||||
|
@ -671,7 +671,7 @@ __indirect_glGetString(GLenum name)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
__glXSetError(gc, GL_INVALID_ENUM);
|
__glXSetError(gc, GL_INVALID_ENUM);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2369,7 +2369,7 @@ void GLAPIENTRY
|
||||||
_mesa_NamedBufferStorageMemEXT(GLuint buffer, GLsizeiptr size,
|
_mesa_NamedBufferStorageMemEXT(GLuint buffer, GLsizeiptr size,
|
||||||
GLuint memory, GLuint64 offset)
|
GLuint memory, GLuint64 offset)
|
||||||
{
|
{
|
||||||
inlined_buffer_storage(GL_NONE, buffer, size, GL_NONE, 0, memory, offset,
|
inlined_buffer_storage(GL_NONE, buffer, size, NULL, 0, memory, offset,
|
||||||
true, true, false, "glNamedBufferStorageMemEXT");
|
true, true, false, "glNamedBufferStorageMemEXT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2378,7 +2378,7 @@ void GLAPIENTRY
|
||||||
_mesa_NamedBufferStorageMemEXT_no_error(GLuint buffer, GLsizeiptr size,
|
_mesa_NamedBufferStorageMemEXT_no_error(GLuint buffer, GLsizeiptr size,
|
||||||
GLuint memory, GLuint64 offset)
|
GLuint memory, GLuint64 offset)
|
||||||
{
|
{
|
||||||
inlined_buffer_storage(GL_NONE, buffer, size, GL_NONE, 0, memory, offset,
|
inlined_buffer_storage(GL_NONE, buffer, size, NULL, 0, memory, offset,
|
||||||
true, true, true, "glNamedBufferStorageMemEXT");
|
true, true, true, "glNamedBufferStorageMemEXT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ GLubyte*
|
||||||
_mesa_make_extension_string(struct gl_context *ctx)
|
_mesa_make_extension_string(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
/* The extension string. */
|
/* The extension string. */
|
||||||
char *exts = 0;
|
char *exts = NULL;
|
||||||
/* Length of extension string. */
|
/* Length of extension string. */
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
/* Number of extensions */
|
/* Number of extensions */
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
||||||
!is_index_type_valid(type) ||
|
!is_index_type_valid(type) ||
|
||||||
(!user_buffer_mask && !has_user_indices))) {
|
(!user_buffer_mask && !has_user_indices))) {
|
||||||
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
||||||
basevertex, 0, 0, NULL);
|
basevertex, NULL, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
||||||
if (vertex_count < 0) {
|
if (vertex_count < 0) {
|
||||||
/* Just call the driver to set the error. */
|
/* Just call the driver to set the error. */
|
||||||
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
||||||
basevertex, 0, 0, NULL);
|
basevertex, NULL, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vertex_count == 0)
|
if (vertex_count == 0)
|
||||||
|
@ -1059,7 +1059,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
||||||
if (total_count == 0 || num_vertices == 0) {
|
if (total_count == 0 || num_vertices == 0) {
|
||||||
/* Nothing to do, but call the driver to set possible GL errors. */
|
/* Nothing to do, but call the driver to set possible GL errors. */
|
||||||
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
||||||
basevertex, 0, 0, NULL);
|
basevertex, NULL, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,7 +1075,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
||||||
if (vertex_count < 0) {
|
if (vertex_count < 0) {
|
||||||
/* Just call the driver to set the error. */
|
/* Just call the driver to set the error. */
|
||||||
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
||||||
basevertex, 0, 0, NULL);
|
basevertex, NULL, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vertex_count == 0)
|
if (vertex_count == 0)
|
||||||
|
@ -1087,7 +1087,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
||||||
if (total_count == 0) {
|
if (total_count == 0) {
|
||||||
/* Nothing to do, but call the driver to set possible GL errors. */
|
/* Nothing to do, but call the driver to set possible GL errors. */
|
||||||
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
|
||||||
basevertex, 0, 0, NULL);
|
basevertex, NULL, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -707,7 +707,7 @@ st_UnmapTextureImage(struct gl_context *ctx,
|
||||||
|
|
||||||
itransfer->temp_data = NULL;
|
itransfer->temp_data = NULL;
|
||||||
itransfer->temp_stride = 0;
|
itransfer->temp_stride = 0;
|
||||||
itransfer->map = 0;
|
itransfer->map = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
st_texture_image_unmap(st, stImage, slice);
|
st_texture_image_unmap(st, stImage, slice);
|
||||||
|
|
|
@ -91,7 +91,7 @@ util_dynarray_ensure_cap(struct util_dynarray *buf, unsigned newcap)
|
||||||
data = realloc(buf->data, capacity);
|
data = realloc(buf->data, capacity);
|
||||||
}
|
}
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
buf->data = data;
|
buf->data = data;
|
||||||
buf->capacity = capacity;
|
buf->capacity = capacity;
|
||||||
|
@ -105,12 +105,12 @@ MUST_CHECK static inline void *
|
||||||
util_dynarray_resize_bytes(struct util_dynarray *buf, unsigned nelts, size_t eltsize)
|
util_dynarray_resize_bytes(struct util_dynarray *buf, unsigned nelts, size_t eltsize)
|
||||||
{
|
{
|
||||||
if (unlikely(nelts > UINT_MAX / eltsize))
|
if (unlikely(nelts > UINT_MAX / eltsize))
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
unsigned newsize = nelts * eltsize;
|
unsigned newsize = nelts * eltsize;
|
||||||
void *p = util_dynarray_ensure_cap(buf, newsize);
|
void *p = util_dynarray_ensure_cap(buf, newsize);
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
buf->size = newsize;
|
buf->size = newsize;
|
||||||
|
|
||||||
|
@ -133,12 +133,12 @@ util_dynarray_grow_bytes(struct util_dynarray *buf, unsigned ngrow, size_t eltsi
|
||||||
|
|
||||||
if (unlikely(ngrow > (UINT_MAX / eltsize) ||
|
if (unlikely(ngrow > (UINT_MAX / eltsize) ||
|
||||||
growbytes > UINT_MAX - buf->size))
|
growbytes > UINT_MAX - buf->size))
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
unsigned newsize = buf->size + growbytes;
|
unsigned newsize = buf->size + growbytes;
|
||||||
void *p = util_dynarray_ensure_cap(buf, newsize);
|
void *p = util_dynarray_ensure_cap(buf, newsize);
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
buf->size = newsize;
|
buf->size = newsize;
|
||||||
|
|
||||||
|
|
|
@ -165,8 +165,8 @@ SliceBlock(struct mem_block *p,
|
||||||
p->next_free->prev_free = p->prev_free;
|
p->next_free->prev_free = p->prev_free;
|
||||||
p->prev_free->next_free = p->next_free;
|
p->prev_free->next_free = p->next_free;
|
||||||
|
|
||||||
p->next_free = 0;
|
p->next_free = NULL;
|
||||||
p->prev_free = 0;
|
p->prev_free = NULL;
|
||||||
|
|
||||||
p->reserved = reserved;
|
p->reserved = reserved;
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -272,7 +272,7 @@ findOption(const driOptionCache *cache, const char *name)
|
||||||
/* this is just the starting point of the linear search for the option */
|
/* this is just the starting point of the linear search for the option */
|
||||||
for (i = 0; i < size; ++i, hash = (hash+1) & mask) {
|
for (i = 0; i < size; ++i, hash = (hash+1) & mask) {
|
||||||
/* if we hit an empty entry then the option is not defined (yet) */
|
/* if we hit an empty entry then the option is not defined (yet) */
|
||||||
if (cache->info[hash].name == 0)
|
if (cache->info[hash].name == NULL)
|
||||||
break;
|
break;
|
||||||
else if (!strcmp(name, cache->info[hash].name))
|
else if (!strcmp(name, cache->info[hash].name))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue