aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-14 15:35:36 +0800
committerChia-I Wu <[email protected]>2013-06-14 16:02:31 +0800
commit36ffd0870642d88e0a6a2a71e6c9b44fe656cae0 (patch)
tree9af69d7cbf44eac6161308df751d587f4793251b /src/gallium
parent0d9afaad35e108f9f5f124d31c2cb7e3e052851e (diff)
ilo: add some assertions to help debugging
Assert that we do not support user vertex/index/constant buffers. Issue a warning when a sampler view is created for a resource without PIPE_BIND_SAMPLER_VIEW.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 865bc5c7bd9..3210bb4bf33 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -531,6 +531,9 @@ ilo_set_constant_buffer(struct pipe_context *pipe,
if (buf) {
const enum pipe_format elem_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ /* no PIPE_CAP_USER_CONSTANT_BUFFERS */
+ assert(!buf->user_buffer);
+
pipe_resource_reference(&cbuf->resource, buf->buffer);
ilo_gpe_init_view_surface_for_buffer(ilo->dev, ilo_buffer(buf->buffer),
@@ -760,6 +763,13 @@ ilo_set_vertex_buffers(struct pipe_context *pipe,
const struct pipe_vertex_buffer *buffers)
{
struct ilo_context *ilo = ilo_context(pipe);
+ unsigned i;
+
+ /* no PIPE_CAP_USER_VERTEX_BUFFERS */
+ if (buffers) {
+ for (i = 0; i < num_buffers; i++)
+ assert(!buffers[i].user_buffer);
+ }
util_set_vertex_buffers_mask(ilo->vb.states,
&ilo->vb.enabled_mask, buffers, start_slot, num_buffers);
@@ -774,6 +784,9 @@ ilo_set_index_buffer(struct pipe_context *pipe,
struct ilo_context *ilo = ilo_context(pipe);
if (state) {
+ /* no PIPE_CAP_USER_INDEX_BUFFERS */
+ assert(!state->user_buffer);
+
ilo->ib.state.index_size = state->index_size;
ilo->ib.state.offset = state->offset;
pipe_resource_reference(&ilo->ib.state.buffer, state->buffer);
@@ -871,7 +884,16 @@ ilo_create_sampler_view(struct pipe_context *pipe,
elem_size, templ->format, false, false, &view->surface);
}
else {
- ilo_gpe_init_view_surface_for_texture(ilo->dev, ilo_texture(res),
+ struct ilo_texture *tex = ilo_texture(res);
+
+ /* warn about degraded performance because of a missing binding flag */
+ if (tex->tiling == INTEL_TILING_NONE &&
+ !(tex->base.bind & PIPE_BIND_SAMPLER_VIEW)) {
+ ilo_warn("creating sampler view for a resource "
+ "not created for sampling\n");
+ }
+
+ ilo_gpe_init_view_surface_for_texture(ilo->dev, tex,
templ->format,
templ->u.tex.first_level,
templ->u.tex.last_level - templ->u.tex.first_level + 1,