draw: asst. clean-ups in draw_vertex.[ch]
Signed-off-by: Brian Paul <brianp@vmware.com> Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19024>
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2007 VMware, Inc.
|
* Copyright 2007 VMware, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -45,10 +45,8 @@
|
|||||||
void
|
void
|
||||||
draw_compute_vertex_size(struct vertex_info *vinfo)
|
draw_compute_vertex_size(struct vertex_info *vinfo)
|
||||||
{
|
{
|
||||||
uint i;
|
|
||||||
|
|
||||||
vinfo->size = 0;
|
vinfo->size = 0;
|
||||||
for (i = 0; i < vinfo->num_attribs; i++)
|
for (unsigned i = 0; i < vinfo->num_attribs; i++)
|
||||||
vinfo->size += draw_translate_vinfo_size(vinfo->attrib[i].emit);
|
vinfo->size += draw_translate_vinfo_size(vinfo->attrib[i].emit);
|
||||||
|
|
||||||
assert(vinfo->size % 4 == 0);
|
assert(vinfo->size % 4 == 0);
|
||||||
@@ -60,9 +58,7 @@ draw_compute_vertex_size(struct vertex_info *vinfo)
|
|||||||
void
|
void
|
||||||
draw_dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
|
draw_dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
|
||||||
{
|
{
|
||||||
unsigned i;
|
for (unsigned i = 0; i < vinfo->num_attribs; i++) {
|
||||||
|
|
||||||
for (i = 0; i < vinfo->num_attribs; i++) {
|
|
||||||
switch (vinfo->attrib[i].emit) {
|
switch (vinfo->attrib[i].emit) {
|
||||||
case EMIT_OMIT:
|
case EMIT_OMIT:
|
||||||
debug_printf("EMIT_OMIT:");
|
debug_printf("EMIT_OMIT:");
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2007 VMware, Inc.
|
* Copyright 2007 VMware, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,7 +69,7 @@ struct vertex_info
|
|||||||
uint num_attribs;
|
uint num_attribs;
|
||||||
uint hwfmt[4]; /**< hardware format info for this format */
|
uint hwfmt[4]; /**< hardware format info for this format */
|
||||||
uint size; /**< total vertex size in dwords */
|
uint size; /**< total vertex size in dwords */
|
||||||
|
|
||||||
/* Keep this small and at the end of the struct to allow quick
|
/* Keep this small and at the end of the struct to allow quick
|
||||||
* memcmp() comparisons.
|
* memcmp() comparisons.
|
||||||
*/
|
*/
|
||||||
@@ -79,26 +79,29 @@ struct vertex_info
|
|||||||
} attrib[PIPE_MAX_SHADER_OUTPUTS];
|
} attrib[PIPE_MAX_SHADER_OUTPUTS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
draw_vinfo_size( const struct vertex_info *a )
|
draw_vinfo_size(const struct vertex_info *a)
|
||||||
{
|
{
|
||||||
return offsetof(const struct vertex_info, attrib[a->num_attribs]);
|
return offsetof(const struct vertex_info, attrib[a->num_attribs]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
draw_vinfo_compare( const struct vertex_info *a,
|
draw_vinfo_compare(const struct vertex_info *a,
|
||||||
const struct vertex_info *b )
|
const struct vertex_info *b)
|
||||||
{
|
{
|
||||||
size_t sizea = draw_vinfo_size( a );
|
size_t sizea = draw_vinfo_size(a);
|
||||||
return memcmp( a, b, sizea );
|
return memcmp(a, b, sizea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
draw_vinfo_copy( struct vertex_info *dst,
|
draw_vinfo_copy(struct vertex_info *dst,
|
||||||
const struct vertex_info *src )
|
const struct vertex_info *src)
|
||||||
{
|
{
|
||||||
size_t size = draw_vinfo_size( src );
|
size_t size = draw_vinfo_size(src);
|
||||||
memcpy( dst, src, size );
|
memcpy(dst, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -111,7 +114,7 @@ draw_vinfo_copy( struct vertex_info *dst,
|
|||||||
*/
|
*/
|
||||||
static inline uint
|
static inline uint
|
||||||
draw_emit_vertex_attr(struct vertex_info *vinfo,
|
draw_emit_vertex_attr(struct vertex_info *vinfo,
|
||||||
enum attrib_emit emit,
|
enum attrib_emit emit,
|
||||||
int src_index)
|
int src_index)
|
||||||
{
|
{
|
||||||
const uint n = vinfo->num_attribs;
|
const uint n = vinfo->num_attribs;
|
||||||
@@ -130,13 +133,17 @@ draw_emit_vertex_attr(struct vertex_info *vinfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern void draw_compute_vertex_size(struct vertex_info *vinfo);
|
void
|
||||||
|
draw_compute_vertex_size(struct vertex_info *vinfo);
|
||||||
void draw_dump_emitted_vertex(const struct vertex_info *vinfo,
|
|
||||||
const uint8_t *data);
|
|
||||||
|
|
||||||
|
|
||||||
static inline enum pipe_format draw_translate_vinfo_format(enum attrib_emit emit)
|
void
|
||||||
|
draw_dump_emitted_vertex(const struct vertex_info *vinfo,
|
||||||
|
const uint8_t *data);
|
||||||
|
|
||||||
|
|
||||||
|
static inline enum pipe_format
|
||||||
|
draw_translate_vinfo_format(enum attrib_emit emit)
|
||||||
{
|
{
|
||||||
switch (emit) {
|
switch (emit) {
|
||||||
case EMIT_OMIT:
|
case EMIT_OMIT:
|
||||||
@@ -160,7 +167,9 @@ static inline enum pipe_format draw_translate_vinfo_format(enum attrib_emit emit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned draw_translate_vinfo_size(enum attrib_emit emit)
|
|
||||||
|
static inline unsigned
|
||||||
|
draw_translate_vinfo_size(enum attrib_emit emit)
|
||||||
{
|
{
|
||||||
switch (emit) {
|
switch (emit) {
|
||||||
case EMIT_OMIT:
|
case EMIT_OMIT:
|
||||||
|
Reference in New Issue
Block a user