summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-19 01:41:46 +0200
committerMarek Olšák <[email protected]>2012-04-24 01:39:22 +0200
commiteaf8fe3335b1c7e62275ac0fef202f51750ffba9 (patch)
tree8e3005bba146c027ccdcb318d9623705cee60d95 /src
parenta0e352f5ebac0f533481d353b7f3ba66b3a9ed7f (diff)
u_vbuf: take advantage of all new vertex fetch caps
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c19
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.h6
-rw-r--r--src/mesa/state_tracker/st_context.c4
3 files changed, 19 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 3c6dc9a3ab1..a592a1214e2 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -144,11 +144,15 @@ void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
screen->is_format_supported(screen, PIPE_FORMAT_R32_SSCALED, PIPE_BUFFER,
0, PIPE_BIND_VERTEX_BUFFER);
- caps->fetch_dword_unaligned =
+ caps->buffer_offset_unaligned =
!screen->get_param(screen,
- PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY) &&
+ PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY);
+
+ caps->buffer_stride_unaligned =
!screen->get_param(screen,
- PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY) &&
+ PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY);
+
+ caps->velem_src_offset_unaligned =
!screen->get_param(screen,
PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY);
@@ -653,14 +657,15 @@ u_vbuf_create_vertex_elements(struct u_vbuf *mgr, unsigned count,
ve->incompatible_layout_elem[i] =
ve->ve[i].src_format != format ||
- (!mgr->caps.fetch_dword_unaligned && ve->ve[i].src_offset % 4 != 0);
+ (!mgr->caps.velem_src_offset_unaligned &&
+ ve->ve[i].src_offset % 4 != 0);
ve->incompatible_layout =
ve->incompatible_layout ||
ve->incompatible_layout_elem[i];
}
/* Align the formats to the size of DWORD if needed. */
- if (!mgr->caps.fetch_dword_unaligned) {
+ if (!mgr->caps.velem_src_offset_unaligned) {
for (i = 0; i < count; i++) {
ve->native_format_size[i] = align(ve->native_format_size[i], 4);
}
@@ -704,8 +709,8 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count,
continue;
}
- if (!mgr->caps.fetch_dword_unaligned &&
- (vb->stride % 4 != 0 || vb->buffer_offset % 4 != 0)) {
+ if ((!mgr->caps.buffer_offset_unaligned && vb->buffer_offset % 4 != 0) ||
+ (!mgr->caps.buffer_stride_unaligned && vb->stride % 4 != 0)) {
mgr->incompatible_vb[i] = TRUE;
mgr->incompatible_vb_layout = TRUE;
pipe_resource_reference(&real_vb->buffer, NULL);
diff --git a/src/gallium/auxiliary/util/u_vbuf.h b/src/gallium/auxiliary/util/u_vbuf.h
index 161349970a1..59eb59a1190 100644
--- a/src/gallium/auxiliary/util/u_vbuf.h
+++ b/src/gallium/auxiliary/util/u_vbuf.h
@@ -49,9 +49,11 @@ struct u_vbuf_caps {
unsigned format_norm32:1; /* PIPE_FORMAT_*32*NORM */
unsigned format_scaled32:1; /* PIPE_FORMAT_*32*SCALED */
- /* Whether vertex fetches don't have to be dword-aligned. */
+ /* Whether vertex fetches don't have to be 4-byte-aligned. */
/* TRUE if hardware supports it. */
- unsigned fetch_dword_unaligned:1;
+ unsigned buffer_offset_unaligned:1;
+ unsigned buffer_stride_unaligned:1;
+ unsigned velem_src_offset_unaligned:1;
/* Whether the driver supports user vertex buffers. */
unsigned user_vertex_buffers:1;
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index b27f2f677b6..84aae814416 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -119,7 +119,9 @@ static void st_init_vbuf(struct st_context *st)
u_vbuf_get_caps(st->pipe->screen, &caps);
/* Create u_vbuf if there is anything unsupported. */
- if (!caps.fetch_dword_unaligned ||
+ if (!caps.buffer_offset_unaligned ||
+ !caps.buffer_stride_unaligned ||
+ !caps.velem_src_offset_unaligned ||
!caps.format_fixed32 ||
!caps.format_float16 ||
!caps.format_float64 ||