summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-04-19 01:41:46 +0200
committerMarek Olšák <maraeo@gmail.com>2012-04-24 01:39:22 +0200
commiteaf8fe3335b1c7e62275ac0fef202f51750ffba9 (patch)
tree8e3005bba146c027ccdcb318d9623705cee60d95 /src/gallium/auxiliary
parenta0e352f5ebac0f533481d353b7f3ba66b3a9ed7f (diff)
downloadexternal_mesa3d-eaf8fe3335b1c7e62275ac0fef202f51750ffba9.zip
external_mesa3d-eaf8fe3335b1c7e62275ac0fef202f51750ffba9.tar.gz
external_mesa3d-eaf8fe3335b1c7e62275ac0fef202f51750ffba9.tar.bz2
u_vbuf: take advantage of all new vertex fetch caps
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c19
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.h6
2 files changed, 16 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 3c6dc9a..a592a12 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 1613499..59eb59a 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;