summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-04-02 10:42:24 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-04-02 10:42:24 +0000
commita3f73acb9d2cdc62692af7ff93c51f910dff2d0d (patch)
tree303d205e8e6ed9676bdcbe006a402c23bf668f6c /lib/mesa/src/gallium/drivers/r300
parentf54e142455cb3c9d1662dae7e096a32a47e5409b (diff)
Merge Mesa 23.3.6
Diffstat (limited to 'lib/mesa/src/gallium/drivers/r300')
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_blit.c50
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_context.c40
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_context.h66
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_emit.c66
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_query.c10
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_render.c128
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_screen.c73
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_screen.h5
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_screen_buffer.c2
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_state.c157
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_texture.c28
-rw-r--r--lib/mesa/src/gallium/drivers/r300/r300_tgsi_to_rc.c54
12 files changed, 329 insertions, 350 deletions
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_blit.c b/lib/mesa/src/gallium/drivers/r300/r300_blit.c
index 2cbdcacd0..09a5eb3c6 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_blit.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_blit.c
@@ -101,7 +101,7 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
if (op & R300_IGNORE_RENDER_COND) {
/* Save the flag. */
r300->blitter_saved_skip_rendering = r300->skip_rendering+1;
- r300->skip_rendering = FALSE;
+ r300->skip_rendering = false;
} else {
r300->blitter_saved_skip_rendering = 0;
}
@@ -132,21 +132,21 @@ static uint32_t r300_depth_clear_cb_value(enum pipe_format format,
return uc.us | (uc.us << 16);
}
-static boolean r300_cbzb_clear_allowed(struct r300_context *r300,
- unsigned clear_buffers)
+static bool r300_cbzb_clear_allowed(struct r300_context *r300,
+ unsigned clear_buffers)
{
struct pipe_framebuffer_state *fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
/* Only color clear allowed, and only one colorbuffer. */
if ((clear_buffers & ~PIPE_CLEAR_COLOR) != 0 || fb->nr_cbufs != 1 || !fb->cbufs[0])
- return FALSE;
+ return false;
return r300_surface(fb->cbufs[0])->cbzb_allowed;
}
-static boolean r300_fast_zclear_allowed(struct r300_context *r300,
- unsigned clear_buffers)
+static bool r300_fast_zclear_allowed(struct r300_context *r300,
+ unsigned clear_buffers)
{
struct pipe_framebuffer_state *fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
@@ -154,7 +154,7 @@ static boolean r300_fast_zclear_allowed(struct r300_context *r300,
return r300_resource(fb->zsbuf->texture)->tex.zmask_dwords[fb->zsbuf->u.tex.level] != 0;
}
-static boolean r300_hiz_clear_allowed(struct r300_context *r300)
+static bool r300_hiz_clear_allowed(struct r300_context *r300)
{
struct pipe_framebuffer_state *fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
@@ -206,7 +206,7 @@ static void r300_set_clear_color(struct r300_context *r300,
}
}
-DEBUG_GET_ONCE_BOOL_OPTION(hyperz, "RADEON_HYPERZ", FALSE)
+DEBUG_GET_ONCE_BOOL_OPTION(hyperz, "RADEON_HYPERZ", false)
/* Clear currently bound buffers. */
static void r300_clear(struct pipe_context* pipe,
@@ -272,13 +272,13 @@ static void r300_clear(struct pipe_context* pipe,
/* Use fast Z clear.
* The zbuffer must be in micro-tiled mode, otherwise it locks up. */
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
- boolean zmask_clear, hiz_clear;
+ bool zmask_clear, hiz_clear;
/* If both depth and stencil are present, they must be cleared together. */
if (fb->zsbuf->texture->format == PIPE_FORMAT_S8_UINT_Z24_UNORM &&
(buffers & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) {
- zmask_clear = FALSE;
- hiz_clear = FALSE;
+ zmask_clear = false;
+ hiz_clear = false;
} else {
zmask_clear = r300_fast_zclear_allowed(r300, buffers);
hiz_clear = r300_hiz_clear_allowed(r300);
@@ -292,7 +292,7 @@ static void r300_clear(struct pipe_context* pipe,
r300->hyperz_enabled =
r300->rws->cs_request_feature(&r300->cs,
RADEON_FID_R300_HYPERZ_ACCESS,
- TRUE);
+ true);
if (r300->hyperz_enabled) {
/* Need to emit HyperZ buffer regs for the first time. */
r300_mark_fb_state_dirty(r300, R300_CHANGED_HYPERZ_FLAG);
@@ -330,7 +330,7 @@ static void r300_clear(struct pipe_context* pipe,
r300->cmask_access =
r300->rws->cs_request_feature(&r300->cs,
RADEON_FID_R300_CMASK_ACCESS,
- TRUE);
+ true);
}
/* Setup the clear. */
@@ -367,7 +367,7 @@ static void r300_clear(struct pipe_context* pipe,
width = surf->cbzb_width;
height = surf->cbzb_height;
- r300->cbzb_clear = TRUE;
+ r300->cbzb_clear = true;
r300_mark_fb_state_dirty(r300, R300_CHANGED_HYPERZ_FLAG);
}
@@ -399,22 +399,22 @@ static void r300_clear(struct pipe_context* pipe,
/* Emit clear packets. */
r300_emit_gpu_flush(r300, r300->gpu_flush.size, r300->gpu_flush.state);
- r300->gpu_flush.dirty = FALSE;
+ r300->gpu_flush.dirty = false;
if (r300->zmask_clear.dirty) {
r300_emit_zmask_clear(r300, r300->zmask_clear.size,
r300->zmask_clear.state);
- r300->zmask_clear.dirty = FALSE;
+ r300->zmask_clear.dirty = false;
}
if (r300->hiz_clear.dirty) {
r300_emit_hiz_clear(r300, r300->hiz_clear.size,
r300->hiz_clear.state);
- r300->hiz_clear.dirty = FALSE;
+ r300->hiz_clear.dirty = false;
}
if (r300->cmask_clear.dirty) {
r300_emit_cmask_clear(r300, r300->cmask_clear.size,
r300->cmask_clear.state);
- r300->cmask_clear.dirty = FALSE;
+ r300->cmask_clear.dirty = false;
}
} else {
assert(0);
@@ -422,7 +422,7 @@ static void r300_clear(struct pipe_context* pipe,
/* Disable CBZB clear. */
if (r300->cbzb_clear) {
- r300->cbzb_clear = FALSE;
+ r300->cbzb_clear = false;
hyperz->zb_depthclearvalue = hyperz_dcv;
r300_mark_fb_state_dirty(r300, R300_CHANGED_HYPERZ_FLAG);
}
@@ -489,7 +489,7 @@ void r300_decompress_zmask(struct r300_context *r300)
if (!r300->zmask_in_use || r300->locked_zbuffer)
return;
- r300->zmask_decompress = TRUE;
+ r300->zmask_decompress = true;
r300_mark_atom_dirty(r300, &r300->hyperz_state);
r300_blitter_begin(r300, R300_DECOMPRESS);
@@ -497,8 +497,8 @@ void r300_decompress_zmask(struct r300_context *r300)
r300->dsa_decompress_zmask);
r300_blitter_end(r300);
- r300->zmask_decompress = FALSE;
- r300->zmask_in_use = FALSE;
+ r300->zmask_decompress = false;
+ r300->zmask_in_use = false;
r300_mark_atom_dirty(r300, &r300->hyperz_state);
}
@@ -629,7 +629,7 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
switch (util_format_get_blocksize(dst_templ.format)) {
case 8:
/* one 4x4 pixel block has 8 bytes.
- * we set 1 pixel = 4 bytes ===> 1 block corrensponds to 2 pixels. */
+ * we set 1 pixel = 4 bytes ===> 1 block corresponds to 2 pixels. */
dst_templ.format = PIPE_FORMAT_R8G8B8A8_UNORM;
dst_width0 = dst_width0 / 2;
src_width0 = src_width0 / 2;
@@ -685,14 +685,14 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
util_blitter_blit_generic(r300->blitter, dst_view, &dstbox,
src_view, src_box, src_width0, src_height0,
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
- FALSE, FALSE, 0);
+ false, false, 0);
r300_blitter_end(r300);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
}
-static boolean r300_is_simple_msaa_resolve(const struct pipe_blit_info *info)
+static bool r300_is_simple_msaa_resolve(const struct pipe_blit_info *info)
{
unsigned dst_width = u_minify(info->dst.resource->width0, info->dst.level);
unsigned dst_height = u_minify(info->dst.resource->height0, info->dst.level);
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_context.c b/lib/mesa/src/gallium/drivers/r300/r300_context.c
index 9ca39d5db..3df744fad 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_context.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_context.c
@@ -75,10 +75,10 @@ static void r300_destroy_context(struct pipe_context* context)
struct r300_context* r300 = r300_context(context);
if (r300->cs.priv && r300->hyperz_enabled) {
- r300->rws->cs_request_feature(&r300->cs, RADEON_FID_R300_HYPERZ_ACCESS, FALSE);
+ r300->rws->cs_request_feature(&r300->cs, RADEON_FID_R300_HYPERZ_ACCESS, false);
}
if (r300->cs.priv && r300->cmask_access) {
- r300->rws->cs_request_feature(&r300->cs, RADEON_FID_R300_CMASK_ACCESS, FALSE);
+ r300->rws->cs_request_feature(&r300->cs, RADEON_FID_R300_CMASK_ACCESS, false);
}
if (r300->blitter)
@@ -142,21 +142,21 @@ static void r300_flush_callback(void *data, unsigned flags,
r300->atomname.state = NULL; \
r300->atomname.size = atomsize; \
r300->atomname.emit = r300_emit_##atomname; \
- r300->atomname.dirty = FALSE; \
+ r300->atomname.dirty = false; \
} while (0)
#define R300_ALLOC_ATOM(atomname, statetype) \
do { \
r300->atomname.state = CALLOC_STRUCT(statetype); \
if (r300->atomname.state == NULL) \
- return FALSE; \
+ return false; \
} while (0)
-static boolean r300_setup_atoms(struct r300_context* r300)
+static bool r300_setup_atoms(struct r300_context* r300)
{
- boolean is_rv350 = r300->screen->caps.is_rv350;
- boolean is_r500 = r300->screen->caps.is_r500;
- boolean has_tcl = r300->screen->caps.has_tcl;
+ bool is_rv350 = r300->screen->caps.is_rv350;
+ bool is_r500 = r300->screen->caps.is_r500;
+ bool has_tcl = r300->screen->caps.has_tcl;
/* Create the actual atom list.
*
@@ -244,11 +244,11 @@ static boolean r300_setup_atoms(struct r300_context* r300)
}
/* Some non-CSO atoms don't use the state pointer. */
- r300->fb_state_pipelined.allow_null_state = TRUE;
- r300->fs_rc_constant_state.allow_null_state = TRUE;
- r300->pvs_flush.allow_null_state = TRUE;
- r300->query_start.allow_null_state = TRUE;
- r300->texture_cache_inval.allow_null_state = TRUE;
+ r300->fb_state_pipelined.allow_null_state = true;
+ r300->fs_rc_constant_state.allow_null_state = true;
+ r300->pvs_flush.allow_null_state = true;
+ r300->query_start.allow_null_state = true;
+ r300->texture_cache_inval.allow_null_state = true;
/* Some states must be marked as dirty here to properly set up
* hardware in the first command stream. */
@@ -258,7 +258,7 @@ static boolean r300_setup_atoms(struct r300_context* r300)
r300_mark_atom_dirty(r300, &r300->texture_cache_inval);
r300_mark_atom_dirty(r300, &r300->textures_state);
- return TRUE;
+ return true;
}
/* Not every gallium frontend calls every driver function before the first draw
@@ -389,12 +389,12 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
slab_create_child(&r300->pool_transfers, &r300screen->pool_transfers);
- r300->ctx = rws->ctx_create(rws, RADEON_CTX_PRIORITY_MEDIUM);
+ r300->ctx = rws->ctx_create(rws, RADEON_CTX_PRIORITY_MEDIUM, false);
if (!r300->ctx)
goto fail;
- if (!rws->cs_create(&r300->cs, r300->ctx, AMD_IP_GFX, r300_flush_callback, r300, false))
+ if (!rws->cs_create(&r300->cs, r300->ctx, AMD_IP_GFX, r300_flush_callback, r300))
goto fail;
if (!r300screen->caps.has_tcl) {
@@ -407,9 +407,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
/* Disable converting points/lines to triangles. */
draw_wide_line_threshold(r300->draw, 10000000.f);
draw_wide_point_threshold(r300->draw, 10000000.f);
- draw_wide_point_sprites(r300->draw, FALSE);
- draw_enable_line_stipple(r300->draw, TRUE);
- draw_enable_point_sprites(r300->draw, FALSE);
+ draw_wide_point_sprites(r300->draw, false);
+ draw_enable_line_stipple(r300->draw, true);
+ draw_enable_point_sprites(r300->draw, false);
}
if (!r300_setup_atoms(r300))
@@ -474,7 +474,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
vb.depth0 = 1;
r300->dummy_vb.buffer.resource = screen->resource_create(screen, &vb);
- r300->context.set_vertex_buffers(&r300->context, 0, 1, 0, false, &r300->dummy_vb);
+ r300->context.set_vertex_buffers(&r300->context, 1, 0, false, &r300->dummy_vb);
}
{
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_context.h b/lib/mesa/src/gallium/drivers/r300/r300_context.h
index 4745dd68e..adce1d772 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_context.h
+++ b/lib/mesa/src/gallium/drivers/r300/r300_context.h
@@ -65,9 +65,9 @@ struct r300_atom {
/* Upper bound on number of dwords to emit. */
unsigned size;
/* Whether this atom should be emitted. */
- boolean dirty;
+ bool dirty;
/* Whether this atom may be emitted with state == NULL. */
- boolean allow_null_state;
+ bool allow_null_state;
};
struct r300_aa_state {
@@ -114,9 +114,9 @@ struct r300_dsa_state {
uint32_t alpha_function;
/* Whether a two-sided stencil is enabled. */
- boolean two_sided;
+ bool two_sided;
/* Whether a fallback should be used for a two-sided stencil ref value. */
- boolean two_sided_stencil_ref;
+ bool two_sided_stencil_ref;
};
struct r300_hyperz_state {
@@ -155,7 +155,7 @@ struct r300_rs_state {
unsigned cull_mode_index;
/* Whether polygon offset is enabled. */
- boolean polygon_offset_enable;
+ bool polygon_offset_enable;
/* This is emitted in the draw function. */
uint32_t color_control; /* R300_GA_COLOR_CONTROL: 0x4278 */
@@ -291,7 +291,7 @@ struct r300_query {
* after end_query and flush. */
unsigned num_results;
/* if begin has been emitted */
- boolean begin_emitted;
+ bool begin_emitted;
/* The buffer where query results are stored. */
struct pb_buffer *buf;
@@ -320,7 +320,7 @@ struct r300_surface {
uint32_t cbzb_format; /* ZB_FORMAT. */
/* Whether the CBZB clear is allowed on the surface. */
- boolean cbzb_allowed;
+ bool cbzb_allowed;
unsigned colormask_swizzle;
};
@@ -364,17 +364,17 @@ struct r300_texture_desc {
/* Whether this texture has non-power-of-two dimensions.
* It can be either a regular texture or a rectangle one. */
- boolean is_npot;
+ bool is_npot;
/* This flag says that hardware must use the stride for addressing
* instead of the width. */
- boolean uses_stride_addressing;
+ bool uses_stride_addressing;
/* Whether CBZB fast color clear is allowed on the miplevel. */
- boolean cbzb_allowed[R300_MAX_TEXTURE_LEVELS];
+ bool cbzb_allowed[R300_MAX_TEXTURE_LEVELS];
/* Zbuffer compression info for each miplevel. */
- boolean zcomp8x8[R300_MAX_TEXTURE_LEVELS];
+ bool zcomp8x8[R300_MAX_TEXTURE_LEVELS];
/* If zero, then disable Z compression/HiZ. */
unsigned zmask_dwords[R300_MAX_TEXTURE_LEVELS];
unsigned hiz_dwords[R300_MAX_TEXTURE_LEVELS];
@@ -565,31 +565,31 @@ struct r300_context {
/* Flag indicating whether or not the HW is dirty. */
uint32_t dirty_hw;
/* Whether polygon offset is enabled. */
- boolean polygon_offset_enabled;
+ bool polygon_offset_enabled;
/* Z buffer bit depth. */
uint32_t zbuffer_bpp;
/* Whether rendering is conditional and should be skipped. */
- boolean skip_rendering;
+ bool skip_rendering;
/* The flag above saved by blitter. */
unsigned char blitter_saved_skip_rendering;
/* Point sprites texcoord index, 1 bit per texcoord */
int sprite_coord_enable;
/* Whether we are drawing points, to disable sprite coord if not */
- boolean is_point;
+ bool is_point;
/* Whether two-sided color selection is enabled (AKA light_twoside). */
- boolean two_sided_color;
- boolean flatshade;
- boolean clip_halfz;
+ bool two_sided_color;
+ bool flatshade;
+ bool clip_halfz;
/* Whether fast color clear is enabled. */
- boolean cbzb_clear;
+ bool cbzb_clear;
/* Whether fragment shader needs to be validated. */
enum r300_fs_validity_status fs_status;
/* Framebuffer multi-write. */
- boolean fb_multiwrite;
+ bool fb_multiwrite;
unsigned num_samples;
- boolean msaa_enable;
- boolean alpha_to_one;
- boolean alpha_to_coverage;
+ bool msaa_enable;
+ bool alpha_to_one;
+ bool alpha_to_coverage;
void *dsa_decompress_zmask;
@@ -606,30 +606,30 @@ struct r300_context {
int vs_const_base;
/* Vertex array state info */
- boolean vertex_arrays_dirty;
- boolean vertex_arrays_indexed;
+ bool vertex_arrays_dirty;
+ bool vertex_arrays_indexed;
int vertex_arrays_offset;
int vertex_arrays_instance_id;
- boolean instancing_enabled;
+ bool instancing_enabled;
/* Hyper-Z stats. */
- boolean hyperz_enabled; /* Whether it owns Hyper-Z access. */
+ bool hyperz_enabled; /* Whether it owns Hyper-Z access. */
int64_t hyperz_time_of_last_flush; /* Time of the last flush with Z clear. */
unsigned num_z_clears; /* Since the last flush. */
/* ZMask state. */
- boolean zmask_in_use; /* Whether ZMASK is enabled. */
- boolean zmask_decompress; /* Whether ZMASK is being decompressed. */
+ bool zmask_in_use; /* Whether ZMASK is enabled. */
+ bool zmask_decompress; /* Whether ZMASK is being decompressed. */
struct pipe_surface *locked_zbuffer; /* Unbound zbuffer which still has data in ZMASK. */
/* HiZ state. */
- boolean hiz_in_use; /* Whether HIZ is enabled. */
+ bool hiz_in_use; /* Whether HIZ is enabled. */
enum r300_hiz_func hiz_func; /* HiZ function. Can be either MIN or MAX. */
uint32_t hiz_clear_value; /* HiZ clear value. */
/* CMASK state. */
- boolean cmask_access;
- boolean cmask_in_use;
+ bool cmask_access;
+ bool cmask_in_use;
uint32_t color_clear_value; /* RGBA8 or RGBA1010102 */
uint32_t color_clear_value_ar; /* RGBA16F */
uint32_t color_clear_value_gb; /* RGBA16F */
@@ -681,7 +681,7 @@ static inline struct r300_vertex_shader *r300_vs(struct r300_context *r300)
static inline void r300_mark_atom_dirty(struct r300_context *r300,
struct r300_atom *atom)
{
- atom->dirty = TRUE;
+ atom->dirty = true;
if (!r300->first_dirty) {
r300->first_dirty = atom;
@@ -785,7 +785,7 @@ void r300_update_derived_state(struct r300_context* r300);
void r500_dump_rs_block(struct r300_rs_block *rs);
-static inline boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
+static inline bool CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
{
return SCREEN_DBG_ON(ctx->screen, flags);
}
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_emit.c b/lib/mesa/src/gallium/drivers/r300/r300_emit.c
index 08cd54487..ad0e4c0eb 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_emit.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_emit.c
@@ -83,7 +83,7 @@ void r300_emit_dsa_state(struct r300_context* r300, unsigned size, void* state)
struct r300_dsa_state* dsa = (struct r300_dsa_state*)state;
struct pipe_framebuffer_state* fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
- boolean is_r500 = r300->screen->caps.is_r500;
+ bool is_r500 = r300->screen->caps.is_r500;
CS_LOCALS(r300);
uint32_t alpha_func = dsa->alpha_function;
@@ -659,7 +659,7 @@ void r300_emit_query_start(struct r300_context *r300, unsigned size, void*state)
}
OUT_CS_REG(R300_ZB_ZPASS_DATA, 0);
END_CS;
- query->begin_emitted = TRUE;
+ query->begin_emitted = true;
}
static void r300_emit_query_end_frag_pipes(struct r300_context *r300,
@@ -755,7 +755,7 @@ void r300_emit_query_end(struct r300_context* r300)
if (!query)
return;
- if (query->begin_emitted == FALSE)
+ if (query->begin_emitted == false)
return;
if (caps->family == CHIP_RV530) {
@@ -766,7 +766,7 @@ void r300_emit_query_end(struct r300_context* r300)
} else
r300_emit_query_end_frag_pipes(r300, query);
- query->begin_emitted = FALSE;
+ query->begin_emitted = false;
query->num_results += query->num_pipes;
/* XXX grab all the results and reset the counter. */
@@ -895,7 +895,7 @@ void r300_emit_textures_state(struct r300_context *r300,
struct r300_texture_sampler_state *texstate;
struct r300_resource *tex;
unsigned i;
- boolean has_us_format = r300->screen->caps.has_us_format;
+ bool has_us_format = r300->screen->caps.has_us_format;
CS_LOCALS(r300);
BEGIN_CS(size);
@@ -928,7 +928,7 @@ void r300_emit_textures_state(struct r300_context *r300,
}
void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
- boolean indexed, int instance_id)
+ bool indexed, int instance_id)
{
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
struct pipe_vertex_element *velem = r300->velems->velem;
@@ -953,18 +953,18 @@ void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
size1 = hw_format_size[i];
size2 = hw_format_size[i+1];
- OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) |
- R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride));
- OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
- OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride);
+ OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(velem[i].src_stride) |
+ R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(velem[i+1].src_stride));
+ OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * velem[i].src_stride);
+ OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * velem[i+1].src_stride);
}
if (vertex_array_count & 1) {
vb1 = &vbuf[velem[i].vertex_buffer_index];
size1 = hw_format_size[i];
- OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride));
- OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
+ OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(velem[i].src_stride));
+ OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * velem[i].src_stride);
}
for (i = 0; i < vertex_array_count; i++) {
@@ -982,18 +982,18 @@ void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
if (velem[i].instance_divisor) {
stride1 = 0;
offset1 = vb1->buffer_offset + velem[i].src_offset +
- (instance_id / velem[i].instance_divisor) * vb1->stride;
+ (instance_id / velem[i].instance_divisor) * velem[i].src_stride;
} else {
- stride1 = vb1->stride;
- offset1 = vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride;
+ stride1 = velem[i].src_stride;
+ offset1 = vb1->buffer_offset + velem[i].src_offset + offset * velem[i].src_stride;
}
if (velem[i+1].instance_divisor) {
stride2 = 0;
offset2 = vb2->buffer_offset + velem[i+1].src_offset +
- (instance_id / velem[i+1].instance_divisor) * vb2->stride;
+ (instance_id / velem[i+1].instance_divisor) * velem[i+1].src_stride;
} else {
- stride2 = vb2->stride;
- offset2 = vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride;
+ stride2 = velem[i+1].src_stride;
+ offset2 = vb2->buffer_offset + velem[i+1].src_offset + offset * velem[i+1].src_stride;
}
OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(stride1) |
@@ -1009,10 +1009,10 @@ void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
if (velem[i].instance_divisor) {
stride1 = 0;
offset1 = vb1->buffer_offset + velem[i].src_offset +
- (instance_id / velem[i].instance_divisor) * vb1->stride;
+ (instance_id / velem[i].instance_divisor) * velem[i].src_stride;
} else {
- stride1 = vb1->stride;
- offset1 = vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride;
+ stride1 = velem[i].src_stride;
+ offset1 = vb1->buffer_offset + velem[i].src_offset + offset * velem[i].src_stride;
}
OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(stride1));
@@ -1027,7 +1027,7 @@ void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
END_CS;
}
-void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, boolean indexed)
+void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, bool indexed)
{
CS_LOCALS(r300);
@@ -1233,7 +1233,7 @@ void r300_emit_hiz_clear(struct r300_context *r300, unsigned size, void *state)
END_CS;
/* Mark the current zbuffer's hiz ram as in use. */
- r300->hiz_in_use = TRUE;
+ r300->hiz_in_use = true;
r300->hiz_func = HIZ_FUNC_NONE;
r300_mark_atom_dirty(r300, &r300->hyperz_state);
}
@@ -1255,7 +1255,7 @@ void r300_emit_zmask_clear(struct r300_context *r300, unsigned size, void *state
END_CS;
/* Mark the current zbuffer's zmask as in use. */
- r300->zmask_in_use = TRUE;
+ r300->zmask_in_use = true;
r300_mark_atom_dirty(r300, &r300->hyperz_state);
}
@@ -1276,7 +1276,7 @@ void r300_emit_cmask_clear(struct r300_context *r300, unsigned size, void *state
END_CS;
/* Mark the current zbuffer's zmask as in use. */
- r300->cmask_in_use = TRUE;
+ r300->cmask_in_use = true;
r300_mark_fb_state_dirty(r300, R300_CHANGED_CMASK_ENABLE);
}
@@ -1300,9 +1300,9 @@ void r300_emit_texture_cache_inval(struct r300_context* r300, unsigned size, voi
END_CS;
}
-boolean r300_emit_buffer_validate(struct r300_context *r300,
- boolean do_validate_vertex_buffers,
- struct pipe_resource *index_buffer)
+bool r300_emit_buffer_validate(struct r300_context *r300,
+ bool do_validate_vertex_buffers,
+ struct pipe_resource *index_buffer)
{
struct pipe_framebuffer_state *fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
@@ -1311,7 +1311,7 @@ boolean r300_emit_buffer_validate(struct r300_context *r300,
(struct r300_textures_state*)r300->textures_state.state;
struct r300_resource *tex;
unsigned i;
- boolean flushed = FALSE;
+ bool flushed = false;
validate:
if (r300->fb_state.dirty) {
@@ -1404,13 +1404,13 @@ validate:
if (!r300->rws->cs_validate(&r300->cs)) {
/* Ooops, an infinite loop, give up. */
if (flushed)
- return FALSE;
+ return false;
- flushed = TRUE;
+ flushed = true;
goto validate;
}
- return TRUE;
+ return true;
}
unsigned r300_get_num_dirty_dwords(struct r300_context *r300)
@@ -1452,7 +1452,7 @@ void r300_emit_dirty_state(struct r300_context* r300)
foreach_dirty_atom(r300, atom) {
if (atom->dirty) {
atom->emit(r300, atom->size, atom->state);
- atom->dirty = FALSE;
+ atom->dirty = false;
}
}
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_query.c b/lib/mesa/src/gallium/drivers/r300/r300_query.c
index fc780685a..00514d0e1 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_query.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_query.c
@@ -149,9 +149,9 @@ static bool r300_get_query_result(struct pipe_context* pipe,
if (q->type == PIPE_QUERY_GPU_FINISHED) {
if (wait) {
- r300->rws->buffer_wait(r300->rws, q->buf, PIPE_TIMEOUT_INFINITE,
+ r300->rws->buffer_wait(r300->rws, q->buf, OS_TIMEOUT_INFINITE,
RADEON_USAGE_READWRITE);
- vresult->b = TRUE;
+ vresult->b = true;
} else {
vresult->b = r300->rws->buffer_wait(r300->rws, q->buf, 0, RADEON_USAGE_READWRITE);
}
@@ -162,7 +162,7 @@ static bool r300_get_query_result(struct pipe_context* pipe,
PIPE_MAP_READ |
(!wait ? PIPE_MAP_DONTBLOCK : 0));
if (!map)
- return FALSE;
+ return false;
/* Sum up the results. */
temp = 0;
@@ -178,7 +178,7 @@ static bool r300_get_query_result(struct pipe_context* pipe,
} else {
vresult->u64 = temp;
}
- return TRUE;
+ return true;
}
static void r300_render_condition(struct pipe_context *pipe,
@@ -190,7 +190,7 @@ static void r300_render_condition(struct pipe_context *pipe,
union pipe_query_result result;
bool wait;
- r300->skip_rendering = FALSE;
+ r300->skip_rendering = false;
if (query) {
wait = mode == PIPE_RENDER_COND_WAIT ||
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_render.c b/lib/mesa/src/gallium/drivers/r300/r300_render.c
index bf9a09521..59dc0bc4c 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_render.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_render.c
@@ -41,6 +41,7 @@
#include "r300_emit.h"
#include "r300_reg.h"
#include "r300_vs.h"
+#include "r300_fs.h"
#include <limits.h>
@@ -96,12 +97,12 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
if (rs->rs.flatshade_first) {
switch (mode) {
- case PIPE_PRIM_TRIANGLE_FAN:
+ case MESA_PRIM_TRIANGLE_FAN:
color_control |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_SECOND;
break;
- case PIPE_PRIM_QUADS:
- case PIPE_PRIM_QUAD_STRIP:
- case PIPE_PRIM_POLYGON:
+ case MESA_PRIM_QUADS:
+ case MESA_PRIM_QUAD_STRIP:
+ case MESA_PRIM_POLYGON:
color_control |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST;
break;
default:
@@ -162,7 +163,7 @@ static void r300_split_index_bias(struct r300_context *r300, int index_bias,
max_neg_bias = INT_MAX;
for (i = 0; i < r300->velems->count; i++) {
vb = &vbufs[velem[i].vertex_buffer_index];
- size = (vb->buffer_offset + velem[i].src_offset) / vb->stride;
+ size = (vb->buffer_offset + velem[i].src_offset) / velem[i].src_stride;
max_neg_bias = MIN2(max_neg_bias, size);
}
@@ -192,14 +193,14 @@ enum r300_prepare_flags {
* \param cs_dwords The number of dwords to reserve in CS.
* \return TRUE if the CS was flushed
*/
-static boolean r300_reserve_cs_dwords(struct r300_context *r300,
- enum r300_prepare_flags flags,
- unsigned cs_dwords)
+static bool r300_reserve_cs_dwords(struct r300_context *r300,
+ enum r300_prepare_flags flags,
+ unsigned cs_dwords)
{
- boolean flushed = FALSE;
- boolean emit_states = flags & PREP_EMIT_STATES;
- boolean emit_vertex_arrays = flags & PREP_EMIT_VARRAYS;
- boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_VARRAYS_SWTCL;
+ bool flushed = false;
+ bool emit_states = flags & PREP_EMIT_STATES;
+ bool emit_vertex_arrays = flags & PREP_EMIT_VARRAYS;
+ bool emit_vertex_arrays_swtcl = flags & PREP_EMIT_VARRAYS_SWTCL;
/* Add dirty state, index offset, and AOS. */
if (emit_states)
@@ -219,7 +220,7 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
/* Reserve requested CS space. */
if (!r300->rws->cs_check_space(&r300->cs, cs_dwords)) {
r300_flush(&r300->context, PIPE_FLUSH_ASYNC, NULL);
- flushed = TRUE;
+ flushed = true;
}
return flushed;
@@ -235,17 +236,17 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
* \param instance_id Index of instance to render
* \return TRUE if rendering should be skipped
*/
-static boolean r300_emit_states(struct r300_context *r300,
- enum r300_prepare_flags flags,
- struct pipe_resource *index_buffer,
- int buffer_offset,
- int index_bias, int instance_id)
+static bool r300_emit_states(struct r300_context *r300,
+ enum r300_prepare_flags flags,
+ struct pipe_resource *index_buffer,
+ int buffer_offset,
+ int index_bias, int instance_id)
{
- boolean emit_states = flags & PREP_EMIT_STATES;
- boolean emit_vertex_arrays = flags & PREP_EMIT_VARRAYS;
- boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_VARRAYS_SWTCL;
- boolean indexed = flags & PREP_INDEXED;
- boolean validate_vbos = flags & PREP_VALIDATE_VBOS;
+ bool emit_states = flags & PREP_EMIT_STATES;
+ bool emit_vertex_arrays = flags & PREP_EMIT_VARRAYS;
+ bool emit_vertex_arrays_swtcl = flags & PREP_EMIT_VARRAYS_SWTCL;
+ bool indexed = flags & PREP_INDEXED;
+ bool validate_vbos = flags & PREP_VALIDATE_VBOS;
/* Validate buffers and emit dirty state if needed. */
if (emit_states || (emit_vertex_arrays && validate_vbos)) {
@@ -253,7 +254,7 @@ static boolean r300_emit_states(struct r300_context *r300,
index_buffer)) {
fprintf(stderr, "r300: CS space validation failed. "
"(not enough memory?) Skipping rendering.\n");
- return FALSE;
+ return false;
}
}
@@ -274,7 +275,7 @@ static boolean r300_emit_states(struct r300_context *r300,
r300->vertex_arrays_instance_id != instance_id)) {
r300_emit_vertex_arrays(r300, buffer_offset, indexed, instance_id);
- r300->vertex_arrays_dirty = FALSE;
+ r300->vertex_arrays_dirty = false;
r300->vertex_arrays_indexed = indexed;
r300->vertex_arrays_offset = buffer_offset;
r300->vertex_arrays_instance_id = instance_id;
@@ -283,7 +284,7 @@ static boolean r300_emit_states(struct r300_context *r300,
if (emit_vertex_arrays_swtcl)
r300_emit_vertex_arrays_swtcl(r300, indexed);
- return TRUE;
+ return true;
}
/**
@@ -298,13 +299,13 @@ static boolean r300_emit_states(struct r300_context *r300,
* \param instance_id The instance to render.
* \return TRUE if rendering should be skipped
*/
-static boolean r300_prepare_for_rendering(struct r300_context *r300,
- enum r300_prepare_flags flags,
- struct pipe_resource *index_buffer,
- unsigned cs_dwords,
- int buffer_offset,
- int index_bias,
- int instance_id)
+static bool r300_prepare_for_rendering(struct r300_context *r300,
+ enum r300_prepare_flags flags,
+ struct pipe_resource *index_buffer,
+ unsigned cs_dwords,
+ int buffer_offset,
+ int index_bias,
+ int instance_id)
{
/* Make sure there is enough space in the command stream and emit states. */
if (r300_reserve_cs_dwords(r300, flags, cs_dwords))
@@ -314,20 +315,20 @@ static boolean r300_prepare_for_rendering(struct r300_context *r300,
index_bias, instance_id);
}
-static boolean immd_is_good_idea(struct r300_context *r300,
- unsigned count)
+static bool immd_is_good_idea(struct r300_context *r300,
+ unsigned count)
{
if (DBG_ON(r300, DBG_NO_IMMD)) {
- return FALSE;
+ return false;
}
if (count * r300->velems->vertex_size_dwords > IMMD_DWORDS) {
- return FALSE;
+ return false;
}
/* Buffers can only be used for read by r300 (except query buffers, but
* those can't be bound by an gallium frontend as vertex buffers). */
- return TRUE;
+ return true;
}
/*****************************************************************************
@@ -371,7 +372,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300,
size[i] = r300->velems->format_size[i] / 4;
vbi = velem->vertex_buffer_index;
vbuf = &r300->vertex_buffer[vbi];
- stride[i] = vbuf->stride / 4;
+ stride[i] = velem->src_stride / 4;
/* Map the buffer. */
if (!map[vbi]) {
@@ -404,7 +405,7 @@ static void r300_emit_draw_arrays(struct r300_context *r300,
unsigned mode,
unsigned count)
{
- boolean alt_num_verts = count > 65535;
+ bool alt_num_verts = count > 65535;
CS_LOCALS(r300);
if (count >= (1 << 24)) {
@@ -436,7 +437,7 @@ static void r300_emit_draw_elements(struct r300_context *r300,
uint16_t *imm_indices3)
{
uint32_t count_dwords, offset_dwords;
- boolean alt_num_verts = count > 65535;
+ bool alt_num_verts = count > 65535;
CS_LOCALS(r300);
if (count >= (1 << 24)) {
@@ -454,7 +455,7 @@ static void r300_emit_draw_elements(struct r300_context *r300,
* in the command stream. This will increase start by 3 and make it
* even. We can then proceed without a fallback. */
if (indexSize == 2 && (start & 1) &&
- mode == PIPE_PRIM_TRIANGLES) {
+ mode == MESA_PRIM_TRIANGLES) {
BEGIN_CS(4);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 2);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (3 << 16) |
@@ -595,7 +596,7 @@ static void r300_draw_elements(struct r300_context *r300,
struct pipe_resource* orgIndexBuffer = indexBuffer;
unsigned start = draw->start;
unsigned count = draw->count;
- boolean alt_num_verts = r300->screen->caps.is_r500 &&
+ bool alt_num_verts = r300->screen->caps.is_r500 &&
count > 65536;
unsigned short_count;
int buffer_offset = 0, index_offset = 0; /* for index bias emulation */
@@ -617,7 +618,7 @@ static void r300_draw_elements(struct r300_context *r300,
PIPE_MAP_READ |
PIPE_MAP_UNSYNCHRONIZED);
- if (info->mode == PIPE_PRIM_TRIANGLES) {
+ if (info->mode == MESA_PRIM_TRIANGLES) {
memcpy(indices3, ptr + start, 6);
} else {
/* Copy the mapped index buffer directly to the upload buffer.
@@ -681,7 +682,7 @@ static void r300_draw_arrays(struct r300_context *r300,
const struct pipe_draw_start_count_bias *draw,
int instance_id)
{
- boolean alt_num_verts = r300->screen->caps.is_r500 &&
+ bool alt_num_verts = r300->screen->caps.is_r500 &&
draw->count > 65536;
unsigned start = draw->start;
unsigned count = draw->count;
@@ -751,7 +752,7 @@ static unsigned r300_max_vertex_count(struct r300_context *r300)
/* We're not interested in constant and per-instance attribs. */
if (!vb->buffer.resource ||
- !vb->stride ||
+ !velems[i].src_stride ||
velems[i].instance_divisor) {
continue;
}
@@ -773,7 +774,7 @@ static unsigned r300_max_vertex_count(struct r300_context *r300)
size -= value;
/* Compute the max count. */
- max_count = 1 + size / vb->stride;
+ max_count = 1 + size / velems[i].src_stride;
result = MIN2(result, max_count);
}
return result;
@@ -801,11 +802,13 @@ static void r300_draw_vbo(struct pipe_context* pipe,
return;
}
- if (r300->sprite_coord_enable != 0)
- if ((info.mode == PIPE_PRIM_POINTS) != r300->is_point) {
+ if (r300->sprite_coord_enable != 0 ||
+ r300_fs(r300)->shader->inputs.pcoord != ATTR_UNUSED) {
+ if ((info.mode == MESA_PRIM_POINTS) != r300->is_point) {
r300->is_point = !r300->is_point;
r300_mark_atom_dirty(r300, &r300->rs_block_state);
}
+ }
r300_update_derived_state(r300);
@@ -888,11 +891,14 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
info->index_size, ~0);
}
- if (r300->sprite_coord_enable != 0)
- if ((info->mode == PIPE_PRIM_POINTS) != r300->is_point) {
+ if (r300->sprite_coord_enable != 0 ||
+ r300_fs(r300)->shader->inputs.pcoord != ATTR_UNUSED) {
+ if ((info->mode == MESA_PRIM_POINTS) != r300->is_point) {
r300->is_point = !r300->is_point;
r300_mark_atom_dirty(r300, &r300->rs_block_state);
}
+ }
+
r300_update_derived_state(r300);
@@ -933,9 +939,9 @@ r300_render_get_vertex_info(struct vbuf_render* render)
return &r300->vertex_info;
}
-static boolean r300_render_allocate_vertices(struct vbuf_render* render,
- ushort vertex_size,
- ushort count)
+static bool r300_render_allocate_vertices(struct vbuf_render* render,
+ uint16_t vertex_size,
+ uint16_t count)
{
struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
@@ -955,7 +961,7 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
RADEON_DOMAIN_GTT,
RADEON_FLAG_NO_INTERPROCESS_SHARING);
if (!r300->vbo) {
- return FALSE;
+ return false;
}
r300->draw_vbo_offset = 0;
r300render->vbo_ptr = rws->buffer_map(rws, r300->vbo, &r300->cs,
@@ -963,7 +969,7 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
}
r300render->vertex_size = vertex_size;
- return TRUE;
+ return true;
}
static void* r300_render_map_vertices(struct vbuf_render* render)
@@ -978,8 +984,8 @@ static void* r300_render_map_vertices(struct vbuf_render* render)
}
static void r300_render_unmap_vertices(struct vbuf_render* render,
- ushort min,
- ushort max)
+ uint16_t min,
+ uint16_t max)
{
struct r300_render* r300render = r300_render(render);
struct r300_context* r300 = r300render->r300;
@@ -1002,7 +1008,7 @@ static void r300_render_release_vertices(struct vbuf_render* render)
}
static void r300_render_set_primitive(struct vbuf_render* render,
- enum pipe_prim_type prim)
+ enum mesa_prim prim)
{
struct r300_render* r300render = r300_render(render);
@@ -1045,7 +1051,7 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
}
static void r300_render_draw_elements(struct vbuf_render* render,
- const ushort* indices,
+ const uint16_t* indices,
uint count)
{
struct r300_render* r300render = r300_render(render);
@@ -1195,7 +1201,7 @@ void r300_blitter_draw_rectangle(struct blitter_context *blitter,
r300_update_derived_state(r300);
/* Mark some states we don't care about as non-dirty. */
- r300->viewport_state.dirty = FALSE;
+ r300->viewport_state.dirty = false;
if (!r300_prepare_for_rendering(r300, PREP_EMIT_STATES, NULL, dwords, 0, 0, -1))
goto done;
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_screen.c b/lib/mesa/src/gallium/drivers/r300/r300_screen.c
index a4ce4d877..5aed10e87 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_screen.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_screen.c
@@ -26,6 +26,7 @@
#include "util/format/u_format_s3tc.h"
#include "util/u_screen.h"
#include "util/u_memory.h"
+#include "util/hex.h"
#include "util/os_time.h"
#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
@@ -35,6 +36,7 @@
#include "r300_screen_buffer.h"
#include "r300_state_inlines.h"
#include "r300_public.h"
+#include "compiler/r300_nir.h"
#include "draw/draw_context.h"
@@ -105,7 +107,7 @@ static void r300_disk_cache_create(struct r300_screen* r300screen)
return;
_mesa_sha1_final(&ctx, sha1);
- disk_cache_format_hex_id(cache_id, sha1, 20 * 2);
+ mesa_bytes_to_hex(cache_id, sha1, 20);
r300screen->disk_shader_cache =
disk_cache_create(r300_get_family_name(r300screen),
@@ -122,7 +124,7 @@ static struct disk_cache* r300_get_disk_shader_cache(struct pipe_screen* pscreen
static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
{
struct r300_screen* r300screen = r300_screen(pscreen);
- boolean is_r500 = r300screen->caps.is_r500;
+ bool is_r500 = r300screen->caps.is_r500;
switch (param) {
/* Supported features (boolean caps). */
@@ -143,6 +145,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_CLIP_HALFZ:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
case PIPE_CAP_LEGACY_MATH_RULES:
+ case PIPE_CAP_TGSI_TEXCOORD:
return 1;
case PIPE_CAP_TEXTURE_TRANSFER_MODES:
@@ -249,12 +252,10 @@ static int r300_get_shader_param(struct pipe_screen *pscreen,
enum pipe_shader_cap param)
{
struct r300_screen* r300screen = r300_screen(pscreen);
- boolean is_r400 = r300screen->caps.is_r400;
- boolean is_r500 = r300screen->caps.is_r500;
+ bool is_r400 = r300screen->caps.is_r400;
+ bool is_r500 = r300screen->caps.is_r500;
switch (param) {
- case PIPE_SHADER_CAP_PREFERRED_IR:
- return (r300screen->debug & DBG_USE_TGSI) ? PIPE_SHADER_IR_TGSI : PIPE_SHADER_IR_NIR;
case PIPE_SHADER_CAP_SUPPORTED_IRS:
return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI);
default:
@@ -310,7 +311,6 @@ static int r300_get_shader_param(struct pipe_screen *pscreen,
case PIPE_SHADER_CAP_FP16_CONST_BUFFERS:
case PIPE_SHADER_CAP_INT16:
case PIPE_SHADER_CAP_GLSL_16BIT_CONSTS:
- case PIPE_SHADER_CAP_DROUND_SUPPORTED:
case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS:
case PIPE_SHADER_CAP_MAX_SHADER_IMAGES:
case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS:
@@ -399,7 +399,6 @@ static int r300_get_shader_param(struct pipe_screen *pscreen,
case PIPE_SHADER_CAP_INT64_ATOMICS:
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
- case PIPE_SHADER_CAP_DROUND_SUPPORTED:
case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS:
case PIPE_SHADER_CAP_MAX_SHADER_IMAGES:
case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS:
@@ -492,18 +491,18 @@ static int r300_get_video_param(struct pipe_screen *screen,
.lower_bitops = true, \
.lower_extract_byte = true, \
.lower_extract_word = true, \
+ .lower_fceil = true, \
.lower_fdiv = true, \
.lower_fdph = true, \
.lower_ffloor = true, \
.lower_flrp32 = true, \
.lower_flrp64 = true, \
.lower_fmod = true, \
- .lower_fround_even = true, \
.lower_fsign = true, \
+ .lower_fsqrt = true, \
.lower_ftrunc = true, \
.lower_insert_byte = true, \
.lower_insert_word = true, \
- .lower_rotate = true, \
.lower_uniforms_to_ubo = true, \
.lower_vector_cmp = true, \
.no_integers = true, \
@@ -511,6 +510,7 @@ static int r300_get_video_param(struct pipe_screen *screen,
static const nir_shader_compiler_options r500_vs_compiler_options = {
COMMON_NIR_OPTIONS,
+ .has_fused_comp_and_csel = true,
/* Have HW loops support and 1024 max instr count, but don't unroll *too*
* hard.
@@ -574,7 +574,7 @@ r300_get_compiler_options(struct pipe_screen *pscreen,
* Whether the format matches:
* PIPE_FORMAT_?10?10?10?2_UNORM
*/
-static inline boolean
+static inline bool
util_format_is_rgba1010102_variant(const struct util_format_description *desc)
{
static const unsigned size[4] = {10, 10, 10, 2};
@@ -583,17 +583,17 @@ util_format_is_rgba1010102_variant(const struct util_format_description *desc)
if (desc->block.width != 1 ||
desc->block.height != 1 ||
desc->block.bits != 32)
- return FALSE;
+ return false;
for (chan = 0; chan < 4; ++chan) {
if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
- return FALSE;
+ return false;
if (desc->channel[chan].size != size[chan])
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
static bool r300_is_blending_supported(struct r300_screen *rscreen,
@@ -642,26 +642,26 @@ static bool r300_is_format_supported(struct pipe_screen* screen,
unsigned usage)
{
uint32_t retval = 0;
- boolean is_r500 = r300_screen(screen)->caps.is_r500;
- boolean is_r400 = r300_screen(screen)->caps.is_r400;
- boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM ||
- format == PIPE_FORMAT_R10G10B10X2_SNORM ||
- format == PIPE_FORMAT_B10G10R10A2_UNORM ||
- format == PIPE_FORMAT_B10G10R10X2_UNORM ||
- format == PIPE_FORMAT_R10SG10SB10SA2U_NORM;
- boolean is_ati1n = format == PIPE_FORMAT_RGTC1_UNORM ||
- format == PIPE_FORMAT_RGTC1_SNORM ||
- format == PIPE_FORMAT_LATC1_UNORM ||
- format == PIPE_FORMAT_LATC1_SNORM;
- boolean is_ati2n = format == PIPE_FORMAT_RGTC2_UNORM ||
- format == PIPE_FORMAT_RGTC2_SNORM ||
- format == PIPE_FORMAT_LATC2_UNORM ||
- format == PIPE_FORMAT_LATC2_SNORM;
- boolean is_half_float = format == PIPE_FORMAT_R16_FLOAT ||
- format == PIPE_FORMAT_R16G16_FLOAT ||
- format == PIPE_FORMAT_R16G16B16_FLOAT ||
- format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
- format == PIPE_FORMAT_R16G16B16X16_FLOAT;
+ bool is_r500 = r300_screen(screen)->caps.is_r500;
+ bool is_r400 = r300_screen(screen)->caps.is_r400;
+ bool is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM ||
+ format == PIPE_FORMAT_R10G10B10X2_SNORM ||
+ format == PIPE_FORMAT_B10G10R10A2_UNORM ||
+ format == PIPE_FORMAT_B10G10R10X2_UNORM ||
+ format == PIPE_FORMAT_R10SG10SB10SA2U_NORM;
+ bool is_ati1n = format == PIPE_FORMAT_RGTC1_UNORM ||
+ format == PIPE_FORMAT_RGTC1_SNORM ||
+ format == PIPE_FORMAT_LATC1_UNORM ||
+ format == PIPE_FORMAT_LATC1_SNORM;
+ bool is_ati2n = format == PIPE_FORMAT_RGTC2_UNORM ||
+ format == PIPE_FORMAT_RGTC2_SNORM ||
+ format == PIPE_FORMAT_LATC2_UNORM ||
+ format == PIPE_FORMAT_LATC2_SNORM;
+ bool is_half_float = format == PIPE_FORMAT_R16_FLOAT ||
+ format == PIPE_FORMAT_R16G16_FLOAT ||
+ format == PIPE_FORMAT_R16G16B16_FLOAT ||
+ format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
+ format == PIPE_FORMAT_R16G16B16X16_FLOAT;
const struct util_format_description *desc;
if (MAX2(1, sample_count) != MAX2(1, storage_sample_count))
@@ -835,13 +835,14 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws,
if (SCREEN_DBG_ON(r300screen, DBG_NO_HIZ))
r300screen->caps.hiz_ram = 0;
if (SCREEN_DBG_ON(r300screen, DBG_NO_TCL))
- r300screen->caps.has_tcl = FALSE;
+ r300screen->caps.has_tcl = false;
r300screen->rws = rws;
r300screen->screen.destroy = r300_destroy_screen;
r300screen->screen.get_name = r300_get_name;
r300screen->screen.get_vendor = r300_get_vendor;
r300screen->screen.get_compiler_options = r300_get_compiler_options;
+ r300screen->screen.finalize_nir = r300_finalize_nir;
r300screen->screen.get_device_vendor = r300_get_device_vendor;
r300screen->screen.get_disk_shader_cache = r300_get_disk_shader_cache;
r300screen->screen.get_screen_fd = r300_screen_get_fd;
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_screen.h b/lib/mesa/src/gallium/drivers/r300/r300_screen.h
index bcaea3cfb..721de566e 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_screen.h
+++ b/lib/mesa/src/gallium/drivers/r300/r300_screen.h
@@ -103,12 +103,11 @@ radeon_winsys(struct pipe_screen *screen) {
#define DBG_NO_ZMASK (1 << 21)
#define DBG_NO_HIZ (1 << 22)
#define DBG_NO_CMASK (1 << 23)
-#define DBG_USE_TGSI (1 << 24)
#define DBG_NO_TCL (1 << 25)
/*@}*/
-static inline boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
+static inline bool SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
{
- return (screen->debug & flags) ? TRUE : FALSE;
+ return (screen->debug & flags) ? true : false;
}
static inline void SCREEN_DBG(struct r300_screen * screen, unsigned flags,
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_screen_buffer.c b/lib/mesa/src/gallium/drivers/r300/r300_screen_buffer.c
index 9a884e556..2b119a83e 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -128,7 +128,7 @@ r300_buffer_transfer_map( struct pipe_context *context,
/* We changed the buffer, now we need to bind it where the old one was bound. */
for (i = 0; i < r300->nr_vertex_buffers; i++) {
if (r300->vertex_buffer[i].buffer.resource == &rbuf->b) {
- r300->vertex_arrays_dirty = TRUE;
+ r300->vertex_arrays_dirty = true;
break;
}
}
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_state.c b/lib/mesa/src/gallium/drivers/r300/r300_state.c
index 09300ff3b..a01772804 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_state.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_state.c
@@ -46,8 +46,8 @@
#include "r300_fs.h"
#include "r300_texture.h"
#include "r300_vs.h"
-#include "nir.h"
-#include "nir/nir_to_tgsi.h"
+#include "compiler/r300_nir.h"
+#include "compiler/nir_to_rc.h"
/* r300_state: Functions used to initialize state context by translating
* Gallium state objects into semi-native r300 state objects. */
@@ -58,8 +58,8 @@
r300_mark_atom_dirty(r300, &(atom)); \
}
-static boolean blend_discard_if_src_alpha_0(unsigned srcRGB, unsigned srcA,
- unsigned dstRGB, unsigned dstA)
+static bool blend_discard_if_src_alpha_0(unsigned srcRGB, unsigned srcA,
+ unsigned dstRGB, unsigned dstA)
{
/* If the blend equation is ADD or REVERSE_SUBTRACT,
* SRC_ALPHA == 0, and the following state is set, the colorbuffer
@@ -79,8 +79,8 @@ static boolean blend_discard_if_src_alpha_0(unsigned srcRGB, unsigned srcA,
dstA == PIPE_BLENDFACTOR_ONE);
}
-static boolean blend_discard_if_src_alpha_1(unsigned srcRGB, unsigned srcA,
- unsigned dstRGB, unsigned dstA)
+static bool blend_discard_if_src_alpha_1(unsigned srcRGB, unsigned srcA,
+ unsigned dstRGB, unsigned dstA)
{
/* If the blend equation is ADD or REVERSE_SUBTRACT,
* SRC_ALPHA == 1, and the following state is set, the colorbuffer
@@ -98,8 +98,8 @@ static boolean blend_discard_if_src_alpha_1(unsigned srcRGB, unsigned srcA,
dstA == PIPE_BLENDFACTOR_ONE);
}
-static boolean blend_discard_if_src_color_0(unsigned srcRGB, unsigned srcA,
- unsigned dstRGB, unsigned dstA)
+static bool blend_discard_if_src_color_0(unsigned srcRGB, unsigned srcA,
+ unsigned dstRGB, unsigned dstA)
{
/* If the blend equation is ADD or REVERSE_SUBTRACT,
* SRC_COLOR == (0,0,0), and the following state is set, the colorbuffer
@@ -113,8 +113,8 @@ static boolean blend_discard_if_src_color_0(unsigned srcRGB, unsigned srcA,
(dstA == PIPE_BLENDFACTOR_ONE);
}
-static boolean blend_discard_if_src_color_1(unsigned srcRGB, unsigned srcA,
- unsigned dstRGB, unsigned dstA)
+static bool blend_discard_if_src_color_1(unsigned srcRGB, unsigned srcA,
+ unsigned dstRGB, unsigned dstA)
{
/* If the blend equation is ADD or REVERSE_SUBTRACT,
* SRC_COLOR == (1,1,1), and the following state is set, the colorbuffer
@@ -128,8 +128,8 @@ static boolean blend_discard_if_src_color_1(unsigned srcRGB, unsigned srcA,
(dstA == PIPE_BLENDFACTOR_ONE);
}
-static boolean blend_discard_if_src_alpha_color_0(unsigned srcRGB, unsigned srcA,
- unsigned dstRGB, unsigned dstA)
+static bool blend_discard_if_src_alpha_color_0(unsigned srcRGB, unsigned srcA,
+ unsigned dstRGB, unsigned dstA)
{
/* If the blend equation is ADD or REVERSE_SUBTRACT,
* SRC_ALPHA_COLOR == (0,0,0,0), and the following state is set,
@@ -151,8 +151,8 @@ static boolean blend_discard_if_src_alpha_color_0(unsigned srcRGB, unsigned srcA
dstA == PIPE_BLENDFACTOR_ONE);
}
-static boolean blend_discard_if_src_alpha_color_1(unsigned srcRGB, unsigned srcA,
- unsigned dstRGB, unsigned dstA)
+static bool blend_discard_if_src_alpha_color_1(unsigned srcRGB, unsigned srcA,
+ unsigned dstRGB, unsigned dstA)
{
/* If the blend equation is ADD or REVERSE_SUBTRACT,
* SRC_ALPHA_COLOR == (1,1,1,1), and the following state is set,
@@ -274,7 +274,7 @@ static unsigned arra_cmask(unsigned mask)
static unsigned blend_read_enable(unsigned eqRGB, unsigned eqA,
unsigned dstRGB, unsigned dstA,
unsigned srcRGB, unsigned srcA,
- boolean src_alpha_optz)
+ bool src_alpha_optz)
{
unsigned blend_control = 0;
@@ -397,8 +397,8 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
( r300_translate_blend_factor(srcRGBX) << R300_SRC_BLEND_SHIFT) |
( r300_translate_blend_factor(dstRGBX) << R300_DST_BLEND_SHIFT);
- blend_eq = r300_translate_blend_function(eqRGB, TRUE);
- blend_eq_noclamp = r300_translate_blend_function(eqRGB, FALSE);
+ blend_eq = r300_translate_blend_function(eqRGB, true);
+ blend_eq_noclamp = r300_translate_blend_function(eqRGB, false);
blend_control |= blend_eq;
blend_control_noalpha |= blend_eq;
@@ -409,11 +409,11 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
blend_control |= blend_read_enable(eqRGB, eqA, dstRGB, dstA,
srcRGB, srcA, r300screen->caps.is_r500);
blend_control_noclamp |= blend_read_enable(eqRGB, eqA, dstRGB, dstA,
- srcRGB, srcA, FALSE);
+ srcRGB, srcA, false);
blend_control_noalpha |= blend_read_enable(eqRGB, eqA, dstRGBX, dstA,
srcRGBX, srcA, r300screen->caps.is_r500);
blend_control_noalpha_noclamp |= blend_read_enable(eqRGB, eqA, dstRGBX, dstA,
- srcRGBX, srcA, FALSE);
+ srcRGBX, srcA, false);
/* Optimization: discard pixels which don't change the colorbuffer.
* It cannot be used with FP16 AA. */
@@ -430,8 +430,8 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
alpha_blend_control = alpha_blend_control_noclamp =
(r300_translate_blend_factor(srcA) << R300_SRC_BLEND_SHIFT) |
(r300_translate_blend_factor(dstA) << R300_DST_BLEND_SHIFT);
- alpha_blend_control |= r300_translate_blend_function(eqA, TRUE);
- alpha_blend_control_noclamp |= r300_translate_blend_function(eqA, FALSE);
+ alpha_blend_control |= r300_translate_blend_function(eqA, true);
+ alpha_blend_control_noclamp |= r300_translate_blend_function(eqA, false);
}
if (srcA != srcRGBX || dstA != dstRGBX || eqA != eqRGB) {
blend_control_noalpha |= R300_SEPARATE_ALPHA_ENABLE;
@@ -440,8 +440,8 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
alpha_blend_control_noalpha = alpha_blend_control_noalpha_noclamp =
(r300_translate_blend_factor(srcA) << R300_SRC_BLEND_SHIFT) |
(r300_translate_blend_factor(dstA) << R300_DST_BLEND_SHIFT);
- alpha_blend_control_noalpha |= r300_translate_blend_function(eqA, TRUE);
- alpha_blend_control_noalpha_noclamp |= r300_translate_blend_function(eqA, FALSE);
+ alpha_blend_control_noalpha |= r300_translate_blend_function(eqA, true);
+ alpha_blend_control_noalpha_noclamp |= r300_translate_blend_function(eqA, false);
}
}
@@ -477,7 +477,7 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
};
for (i = 0; i < COLORMASK_NUM_SWIZZLES; i++) {
- boolean has_alpha = i != COLORMASK_RGBX && i != COLORMASK_BGRX;
+ bool has_alpha = i != COLORMASK_RGBX && i != COLORMASK_BGRX;
BEGIN_CB(blend->cb_clamp[i], 8);
OUT_CB_REG(R300_RB3D_ROPCNTL, rop);
@@ -529,8 +529,8 @@ static void r300_bind_blend_state(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
struct r300_blend_state *blend = (struct r300_blend_state*)state;
- boolean last_alpha_to_one = r300->alpha_to_one;
- boolean last_alpha_to_coverage = r300->alpha_to_coverage;
+ bool last_alpha_to_one = r300->alpha_to_one;
+ bool last_alpha_to_coverage = r300->alpha_to_coverage;
UPDATE_STATE(state, r300->blend_state);
@@ -679,7 +679,7 @@ static void r300_set_clip_state(struct pipe_context* pipe,
static void* r300_create_dsa_state(struct pipe_context* pipe,
const struct pipe_depth_stencil_alpha_state* state)
{
- boolean is_r500 = r300_screen(pipe->screen)->caps.is_r500;
+ bool is_r500 = r300_screen(pipe->screen)->caps.is_r500;
struct r300_dsa_state* dsa = CALLOC_STRUCT(r300_dsa_state);
CB_LOCALS;
uint32_t alpha_value_fp16 = 0;
@@ -721,7 +721,7 @@ static void* r300_create_dsa_state(struct pipe_context* pipe,
(state->stencil[0].writemask << R300_STENCILWRITEMASK_SHIFT);
if (state->stencil[1].enabled) {
- dsa->two_sided = TRUE;
+ dsa->two_sided = true;
z_buffer_control |= R300_STENCIL_FRONT_BACK;
z_stencil_control |=
@@ -907,7 +907,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
struct pipe_framebuffer_state *current_state = r300->fb_state.state;
unsigned max_width, max_height, i;
uint32_t zbuffer_bpp = 0;
- boolean unlock_zbuffer = FALSE;
+ bool unlock_zbuffer = false;
if (r300->screen->caps.is_r500) {
max_width = max_height = 4096;
@@ -929,7 +929,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
if (!pipe_surface_equal(current_state->zsbuf, state->zsbuf)) {
/* Decompress the currently bound zbuffer before we bind another one. */
r300_decompress_zmask(r300);
- r300->hiz_in_use = FALSE;
+ r300->hiz_in_use = false;
}
} else {
/* We don't bind another zbuffer, so lock the current one. */
@@ -942,10 +942,10 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
/* We are binding some other zbuffer, so decompress the locked one,
* it gets unlocked automatically. */
r300_decompress_zmask_locked_unsafe(r300);
- r300->hiz_in_use = FALSE;
+ r300->hiz_in_use = false;
} else {
/* We are binding the locked zbuffer again, so unlock it. */
- unlock_zbuffer = TRUE;
+ unlock_zbuffer = true;
}
}
}
@@ -1047,7 +1047,7 @@ static void* r300_create_fs_state(struct pipe_context* pipe,
if (fs->state.type == PIPE_SHADER_IR_NIR) {
if (r300->screen->caps.is_r500)
NIR_PASS_V(shader->ir.nir, r300_transform_fs_trig_input);
- fs->state.tokens = nir_to_tgsi(shader->ir.nir, pipe->screen);
+ fs->state.tokens = nir_to_rc(shader->ir.nir, pipe->screen);
} else {
assert(fs->state.type == PIPE_SHADER_IR_TGSI);
/* we need to keep a local copy of the tokens */
@@ -1164,7 +1164,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
float point_texcoord_bottom = 0;/* R300_GA_POINT_T0: 0x4204 */
float point_texcoord_right = 1; /* R300_GA_POINT_S1: 0x4208 */
float point_texcoord_top = 0; /* R300_GA_POINT_T1: 0x420c */
- boolean vclamp = !r300_context(pipe)->screen->caps.is_r500;
+ bool vclamp = !r300_context(pipe)->screen->caps.is_r500;
CB_LOCALS;
/* Copy rasterizer state. */
@@ -1281,17 +1281,15 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
clip_rule = state->scissor ? 0xAAAA : 0xFFFF;
/* Point sprites coord mode */
- if (rs->rs.sprite_coord_enable) {
- switch (state->sprite_coord_mode) {
- case PIPE_SPRITE_COORD_UPPER_LEFT:
- point_texcoord_top = 0.0f;
- point_texcoord_bottom = 1.0f;
- break;
- case PIPE_SPRITE_COORD_LOWER_LEFT:
- point_texcoord_top = 1.0f;
- point_texcoord_bottom = 0.0f;
- break;
- }
+ switch (state->sprite_coord_mode) {
+ case PIPE_SPRITE_COORD_UPPER_LEFT:
+ point_texcoord_top = 0.0f;
+ point_texcoord_bottom = 1.0f;
+ break;
+ case PIPE_SPRITE_COORD_LOWER_LEFT:
+ point_texcoord_top = 1.0f;
+ point_texcoord_bottom = 0.0f;
+ break;
}
if (r300_screen(pipe->screen)->caps.has_tcl) {
@@ -1364,10 +1362,10 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
struct r300_context* r300 = r300_context(pipe);
struct r300_rs_state* rs = (struct r300_rs_state*)state;
int last_sprite_coord_enable = r300->sprite_coord_enable;
- boolean last_two_sided_color = r300->two_sided_color;
- boolean last_msaa_enable = r300->msaa_enable;
- boolean last_flatshade = r300->flatshade;
- boolean last_clip_halfz = r300->clip_halfz;
+ bool last_two_sided_color = r300->two_sided_color;
+ bool last_msaa_enable = r300->msaa_enable;
+ bool last_flatshade = r300->flatshade;
+ bool last_clip_halfz = r300->clip_halfz;
if (r300->draw && rs) {
draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
@@ -1381,12 +1379,12 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
r300->flatshade = rs->rs.flatshade;
r300->clip_halfz = rs->rs.clip_halfz;
} else {
- r300->polygon_offset_enabled = FALSE;
+ r300->polygon_offset_enabled = false;
r300->sprite_coord_enable = 0;
- r300->two_sided_color = FALSE;
- r300->msaa_enable = FALSE;
- r300->flatshade = FALSE;
- r300->clip_halfz = FALSE;
+ r300->two_sided_color = false;
+ r300->msaa_enable = false;
+ r300->flatshade = false;
+ r300->clip_halfz = false;
}
UPDATE_STATE(state, r300->rs_state);
@@ -1426,7 +1424,7 @@ static void*
{
struct r300_context* r300 = r300_context(pipe);
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
- boolean is_r500 = r300->screen->caps.is_r500;
+ bool is_r500 = r300->screen->caps.is_r500;
int lod_bias;
sampler->state = *state;
@@ -1559,7 +1557,7 @@ static void r300_set_sampler_views(struct pipe_context* pipe,
struct r300_resource *texture;
unsigned i, real_num_views = 0, view_index = 0;
unsigned tex_units = r300->screen->caps.num_tex_units;
- boolean dirty_tex = FALSE;
+ bool dirty_tex = false;
assert(start == 0); /* non-zero not handled yet */
@@ -1595,7 +1593,7 @@ static void r300_set_sampler_views(struct pipe_context* pipe,
}
/* A new sampler view (= texture)... */
- dirty_tex = TRUE;
+ dirty_tex = true;
/* Set the texrect factor in the fragment shader.
* Needed for RECT and NPOT fallback. */
@@ -1635,8 +1633,8 @@ r300_create_sampler_view_custom(struct pipe_context *pipe,
{
struct r300_sampler_view *view = CALLOC_STRUCT(r300_sampler_view);
struct r300_resource *tex = r300_resource(texture);
- boolean is_r500 = r300_screen(pipe->screen)->caps.is_r500;
- boolean dxtc_swizzle = r300_screen(pipe->screen)->caps.dxtc_swizzle;
+ bool is_r500 = r300_screen(pipe->screen)->caps.is_r500;
+ bool dxtc_swizzle = r300_screen(pipe->screen)->caps.dxtc_swizzle;
if (view) {
unsigned hwformat;
@@ -1773,7 +1771,7 @@ static void r300_set_viewport_states(struct pipe_context* pipe,
}
static void r300_set_vertex_buffers_hwtcl(struct pipe_context* pipe,
- unsigned start_slot, unsigned count,
+ unsigned count,
unsigned unbind_num_trailing_slots,
bool take_ownership,
const struct pipe_vertex_buffer* buffers)
@@ -1782,21 +1780,21 @@ static void r300_set_vertex_buffers_hwtcl(struct pipe_context* pipe,
util_set_vertex_buffers_count(r300->vertex_buffer,
&r300->nr_vertex_buffers,
- buffers, start_slot, count,
+ buffers, count,
unbind_num_trailing_slots, take_ownership);
/* There must be at least one vertex buffer set, otherwise it locks up. */
if (!r300->nr_vertex_buffers) {
util_set_vertex_buffers_count(r300->vertex_buffer,
&r300->nr_vertex_buffers,
- &r300->dummy_vb, 0, 1, 0, false);
+ &r300->dummy_vb, 1, 0, false);
}
- r300->vertex_arrays_dirty = TRUE;
+ r300->vertex_arrays_dirty = true;
}
static void r300_set_vertex_buffers_swtcl(struct pipe_context* pipe,
- unsigned start_slot, unsigned count,
+ unsigned count,
unsigned unbind_num_trailing_slots,
bool take_ownership,
const struct pipe_vertex_buffer* buffers)
@@ -1806,9 +1804,9 @@ static void r300_set_vertex_buffers_swtcl(struct pipe_context* pipe,
util_set_vertex_buffers_count(r300->vertex_buffer,
&r300->nr_vertex_buffers,
- buffers, start_slot, count,
+ buffers, count,
unbind_num_trailing_slots, take_ownership);
- draw_set_vertex_buffers(r300->draw, start_slot, count,
+ draw_set_vertex_buffers(r300->draw, count,
unbind_num_trailing_slots, buffers);
if (!buffers)
@@ -1816,10 +1814,10 @@ static void r300_set_vertex_buffers_swtcl(struct pipe_context* pipe,
for (i = 0; i < count; i++) {
if (buffers[i].is_user_buffer) {
- draw_set_mapped_vertex_buffer(r300->draw, start_slot + i,
+ draw_set_mapped_vertex_buffer(r300->draw, i,
buffers[i].buffer.user, ~0);
} else if (buffers[i].buffer.resource) {
- draw_set_mapped_vertex_buffer(r300->draw, start_slot + i,
+ draw_set_mapped_vertex_buffer(r300->draw, i,
r300_resource(buffers[i].buffer.resource)->malloced_buffer, ~0);
}
}
@@ -1929,7 +1927,7 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
r300->vertex_stream_state.size = (1 + velems->vertex_stream.count) * 2;
- r300->vertex_arrays_dirty = TRUE;
+ r300->vertex_arrays_dirty = true;
}
static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
@@ -1947,20 +1945,21 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
vs->state = *shader;
if (vs->state.type == PIPE_SHADER_IR_NIR) {
- static const struct nir_to_tgsi_options swtcl_options = {0};
- static const struct nir_to_tgsi_options hwtcl_r300_options = {
+ static const struct nir_to_rc_options swtcl_options = {0};
+ static const struct nir_to_rc_options hwtcl_r300_options = {
.lower_cmp = true,
.lower_fabs = true,
.ubo_vec4_max = 0x00ff,
+ .unoptimized_ra = true,
};
- static const struct nir_to_tgsi_options hwtcl_r500_options = {
- .lower_cmp = true,
+ static const struct nir_to_rc_options hwtcl_r500_options = {
.ubo_vec4_max = 0x00ff,
+ .unoptimized_ra = true,
};
- const struct nir_to_tgsi_options *ntt_options;
+ const struct nir_to_rc_options *ntr_options;
if (r300->screen->caps.has_tcl) {
if (r300->screen->caps.is_r500) {
- ntt_options = &hwtcl_r500_options;
+ ntr_options = &hwtcl_r500_options;
/* Only nine should set both NTT shader name and
* use_legacy_math_rules and D3D9 already mandates
@@ -1973,12 +1972,12 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
}
}
else
- ntt_options = &hwtcl_r300_options;
+ ntr_options = &hwtcl_r300_options;
} else {
- ntt_options = &swtcl_options;
+ ntr_options = &swtcl_options;
}
- vs->state.tokens = nir_to_tgsi_options(shader->ir.nir, pipe->screen,
- ntt_options);
+ vs->state.tokens = nir_to_rc_options(shader->ir.nir, pipe->screen,
+ ntr_options);
} else {
assert(vs->state.type == PIPE_SHADER_IR_TGSI);
/* we need to keep a local copy of the tokens */
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_texture.c b/lib/mesa/src/gallium/drivers/r300/r300_texture.c
index b5b85ffb6..40f63a846 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_texture.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_texture.c
@@ -100,7 +100,7 @@ static unsigned r300_get_endian_swap(enum pipe_format format)
unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
const unsigned char *swizzle_view,
- boolean dxtc_swizzle)
+ bool dxtc_swizzle)
{
unsigned i;
unsigned char swizzle[4];
@@ -164,13 +164,13 @@ unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
* makes available X, Y, Z, W, ZERO, and ONE for swizzling. */
uint32_t r300_translate_texformat(enum pipe_format format,
const unsigned char *swizzle_view,
- boolean is_r500,
- boolean dxtc_swizzle)
+ bool is_r500,
+ bool dxtc_swizzle)
{
uint32_t result = 0;
const struct util_format_description *desc;
int i;
- boolean uniform = TRUE;
+ bool uniform = true;
const uint32_t sign_bit[4] = {
R300_TX_FORMAT_SIGNED_W,
R300_TX_FORMAT_SIGNED_Z,
@@ -241,10 +241,10 @@ uint32_t r300_translate_texformat(enum pipe_format format,
format != PIPE_FORMAT_LATC1_UNORM &&
format != PIPE_FORMAT_LATC1_SNORM) {
result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view,
- TRUE);
+ true);
} else {
result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view,
- FALSE);
+ false);
}
/* S3TC formats. */
@@ -587,7 +587,7 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
uint32_t modifier = 0;
int i;
const struct util_format_description *desc;
- boolean uniform_sign;
+ bool uniform_sign;
format = r300_unbyteswap_array_format(format);
desc = util_format_description(format);
@@ -659,10 +659,10 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
}
/* Add sign. */
- uniform_sign = TRUE;
+ uniform_sign = true;
for (i = 0; i < desc->nr_channels; i++)
if (desc->channel[i].type != UTIL_FORMAT_TYPE_SIGNED)
- uniform_sign = FALSE;
+ uniform_sign = false;
if (uniform_sign)
modifier |= R300_OUT_SIGN(0xf);
@@ -872,21 +872,21 @@ static uint32_t r300_translate_colormask_swizzle(enum pipe_format format)
}
}
-boolean r300_is_colorbuffer_format_supported(enum pipe_format format)
+bool r300_is_colorbuffer_format_supported(enum pipe_format format)
{
return r300_translate_colorformat(format) != ~0 &&
r300_translate_out_fmt(format) != ~0 &&
r300_translate_colormask_swizzle(format) != ~0;
}
-boolean r300_is_zs_format_supported(enum pipe_format format)
+bool r300_is_zs_format_supported(enum pipe_format format)
{
return r300_translate_zsformat(format) != ~0;
}
-boolean r300_is_sampler_format_supported(enum pipe_format format)
+bool r300_is_sampler_format_supported(enum pipe_format format)
{
- return r300_translate_texformat(format, NULL, TRUE, FALSE) != ~0;
+ return r300_translate_texformat(format, NULL, true, false) != ~0;
}
void r300_texture_setup_format_state(struct r300_screen *screen,
@@ -899,7 +899,7 @@ void r300_texture_setup_format_state(struct r300_screen *screen,
{
struct pipe_resource *pt = &tex->b;
struct r300_texture_desc *desc = &tex->tex;
- boolean is_r500 = screen->caps.is_r500;
+ bool is_r500 = screen->caps.is_r500;
unsigned width, height, depth;
unsigned txwidth, txheight, txdepth;
diff --git a/lib/mesa/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/lib/mesa/src/gallium/drivers/r300/r300_tgsi_to_rc.c
index 026f52dd0..82842c5fd 100644
--- a/lib/mesa/src/gallium/drivers/r300/r300_tgsi_to_rc.c
+++ b/lib/mesa/src/gallium/drivers/r300/r300_tgsi_to_rc.c
@@ -54,7 +54,6 @@ static unsigned translate_opcode(unsigned opcode)
case TGSI_OPCODE_MAD: return RC_OPCODE_MAD;
case TGSI_OPCODE_LRP: return RC_OPCODE_LRP;
case TGSI_OPCODE_FRC: return RC_OPCODE_FRC;
- case TGSI_OPCODE_FLR: return RC_OPCODE_FLR;
case TGSI_OPCODE_ROUND: return RC_OPCODE_ROUND;
case TGSI_OPCODE_EX2: return RC_OPCODE_EX2;
case TGSI_OPCODE_LG2: return RC_OPCODE_LG2;
@@ -63,10 +62,6 @@ static unsigned translate_opcode(unsigned opcode)
case TGSI_OPCODE_DDX: return RC_OPCODE_DDX;
case TGSI_OPCODE_DDY: return RC_OPCODE_DDY;
case TGSI_OPCODE_KILL: return RC_OPCODE_KILP;
- /* case TGSI_OPCODE_PK2H: return RC_OPCODE_PK2H; */
- /* case TGSI_OPCODE_PK2US: return RC_OPCODE_PK2US; */
- /* case TGSI_OPCODE_PK4B: return RC_OPCODE_PK4B; */
- /* case TGSI_OPCODE_PK4UB: return RC_OPCODE_PK4UB; */
case TGSI_OPCODE_SEQ: return RC_OPCODE_SEQ;
case TGSI_OPCODE_SGT: return RC_OPCODE_SGT;
case TGSI_OPCODE_SIN: return RC_OPCODE_SIN;
@@ -75,17 +70,9 @@ static unsigned translate_opcode(unsigned opcode)
case TGSI_OPCODE_TEX: return RC_OPCODE_TEX;
case TGSI_OPCODE_TXD: return RC_OPCODE_TXD;
case TGSI_OPCODE_TXP: return RC_OPCODE_TXP;
- /* case TGSI_OPCODE_UP2H: return RC_OPCODE_UP2H; */
- /* case TGSI_OPCODE_UP2US: return RC_OPCODE_UP2US; */
- /* case TGSI_OPCODE_UP4B: return RC_OPCODE_UP4B; */
- /* case TGSI_OPCODE_UP4UB: return RC_OPCODE_UP4UB; */
case TGSI_OPCODE_ARR: return RC_OPCODE_ARR;
- /* case TGSI_OPCODE_CAL: return RC_OPCODE_CAL; */
- /* case TGSI_OPCODE_RET: return RC_OPCODE_RET; */
- case TGSI_OPCODE_SSG: return RC_OPCODE_SSG;
case TGSI_OPCODE_CMP: return RC_OPCODE_CMP;
case TGSI_OPCODE_TXB: return RC_OPCODE_TXB;
- /* case TGSI_OPCODE_DIV: return RC_OPCODE_DIV; */
case TGSI_OPCODE_DP2: return RC_OPCODE_DP2;
case TGSI_OPCODE_TXL: return RC_OPCODE_TXL;
case TGSI_OPCODE_BRK: return RC_OPCODE_BRK;
@@ -94,27 +81,8 @@ static unsigned translate_opcode(unsigned opcode)
case TGSI_OPCODE_ELSE: return RC_OPCODE_ELSE;
case TGSI_OPCODE_ENDIF: return RC_OPCODE_ENDIF;
case TGSI_OPCODE_ENDLOOP: return RC_OPCODE_ENDLOOP;
- /* case TGSI_OPCODE_PUSHA: return RC_OPCODE_PUSHA; */
- /* case TGSI_OPCODE_POPA: return RC_OPCODE_POPA; */
- case TGSI_OPCODE_CEIL: return RC_OPCODE_CEIL;
- /* case TGSI_OPCODE_I2F: return RC_OPCODE_I2F; */
- /* case TGSI_OPCODE_NOT: return RC_OPCODE_NOT; */
case TGSI_OPCODE_TRUNC: return RC_OPCODE_TRUNC;
- /* case TGSI_OPCODE_SHL: return RC_OPCODE_SHL; */
- /* case TGSI_OPCODE_ISHR: return RC_OPCODE_SHR; */
- /* case TGSI_OPCODE_AND: return RC_OPCODE_AND; */
- /* case TGSI_OPCODE_OR: return RC_OPCODE_OR; */
- /* case TGSI_OPCODE_MOD: return RC_OPCODE_MOD; */
- /* case TGSI_OPCODE_XOR: return RC_OPCODE_XOR; */
- /* case TGSI_OPCODE_TXF: return RC_OPCODE_TXF; */
- /* case TGSI_OPCODE_TXQ: return RC_OPCODE_TXQ; */
case TGSI_OPCODE_CONT: return RC_OPCODE_CONT;
- /* case TGSI_OPCODE_EMIT: return RC_OPCODE_EMIT; */
- /* case TGSI_OPCODE_ENDPRIM: return RC_OPCODE_ENDPRIM; */
- /* case TGSI_OPCODE_BGNLOOP2: return RC_OPCODE_BGNLOOP2; */
- /* case TGSI_OPCODE_BGNSUB: return RC_OPCODE_BGNSUB; */
- /* case TGSI_OPCODE_ENDLOOP2: return RC_OPCODE_ENDLOOP2; */
- /* case TGSI_OPCODE_ENDSUB: return RC_OPCODE_ENDSUB; */
case TGSI_OPCODE_NOP: return RC_OPCODE_NOP;
case TGSI_OPCODE_KILL_IF: return RC_OPCODE_KIL;
}
@@ -164,7 +132,7 @@ static void transform_dstreg(
dst->WriteMask = src->Register.WriteMask;
if (src->Register.Indirect) {
- ttr->error = TRUE;
+ ttr->error = true;
fprintf(stderr, "r300: Relative addressing of destination operands "
"is unsupported.\n");
}
@@ -176,9 +144,15 @@ static void transform_srcreg(
struct tgsi_full_src_register * src)
{
dst->File = translate_register_file(src->Register.File);
- dst->Index = translate_register_index(ttr, src->Register.File, src->Register.Index);
+ int index = translate_register_index(ttr, src->Register.File, src->Register.Index);
/* Negative offsets to relative addressing should have been lowered in NIR */
- assert(dst->Index >= 0);
+ assert(index >= 0);
+ /* Also check for overflow */
+ if (index >= RC_REGISTER_MAX_INDEX) {
+ ttr->error = true;
+ fprintf(stderr, "r300: Register index too high.\n");
+ }
+ dst->Index = index;
dst->RelAddr = src->Register.Indirect;
dst->Swizzle = tgsi_util_get_full_src_register_swizzle(src, 0);
dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 1) << 3;
@@ -254,12 +228,12 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst
dst = rc_insert_new_instruction(ttr->compiler, ttr->compiler->Program.Instructions.Prev);
dst->U.I.Opcode = translate_opcode(src->Instruction.Opcode);
- if (!ttr->compiler->is_r500 && dst->U.I.Opcode == RC_OPCODE_BGNLOOP && ttr->error == FALSE) {
- ttr->error = TRUE;
+ if (!ttr->compiler->is_r500 && dst->U.I.Opcode == RC_OPCODE_BGNLOOP && ttr->error == false) {
+ ttr->error = true;
fprintf(stderr, "r300: Dynamic loops are not supported on R3xx/R4xx.\n");
}
- if (!ttr->compiler->is_r500 && dst->U.I.Opcode == RC_OPCODE_IF && ttr->error == FALSE) {
- ttr->error = TRUE;
+ if (!ttr->compiler->is_r500 && dst->U.I.Opcode == RC_OPCODE_IF && ttr->error == false) {
+ ttr->error = true;
fprintf(stderr, "r300: Branches are not supported on R3xx/R4xx.\n");
}
@@ -302,7 +276,7 @@ void r300_tgsi_to_rc(struct tgsi_to_rc * ttr,
unsigned imm_index = 0;
int i;
- ttr->error = FALSE;
+ ttr->error = false;
/* Allocate constants placeholders.
*