From: Marek Olšák Date: Mon, 26 Apr 2010 22:09:21 +0000 (+0200) Subject: r300g: add support for more unaligned vertex formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=307f28cf1e8aed0c764bb1e38752ff6f42fee2da;p=mesa.git r300g: add support for more unaligned vertex formats An aligned stride is still needed for it to work. I am slowly approaching the Sauerbraten milestone! --- diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index cc8209db6a3..edd522288bd 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1294,18 +1294,46 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe, /* Replace some formats with their aligned counterparts, * this is OK because we check for aligned strides too. */ switch (*format) { + /* Align to RGBA8. */ + case PIPE_FORMAT_R8_UNORM: + case PIPE_FORMAT_R8G8_UNORM: case PIPE_FORMAT_R8G8B8_UNORM: - *format = PIPE_FORMAT_R8G8B8X8_UNORM; + *format = PIPE_FORMAT_R8G8B8A8_UNORM; continue; + case PIPE_FORMAT_R8_SNORM: + case PIPE_FORMAT_R8G8_SNORM: case PIPE_FORMAT_R8G8B8_SNORM: *format = PIPE_FORMAT_R8G8B8A8_SNORM; continue; + case PIPE_FORMAT_R8_USCALED: + case PIPE_FORMAT_R8G8_USCALED: case PIPE_FORMAT_R8G8B8_USCALED: *format = PIPE_FORMAT_R8G8B8A8_USCALED; continue; + case PIPE_FORMAT_R8_SSCALED: + case PIPE_FORMAT_R8G8_SSCALED: case PIPE_FORMAT_R8G8B8_SSCALED: *format = PIPE_FORMAT_R8G8B8A8_SSCALED; continue; + + /* Align to RG16. */ + case PIPE_FORMAT_R16_UNORM: + *format = PIPE_FORMAT_R16G16_UNORM; + continue; + case PIPE_FORMAT_R16_SNORM: + *format = PIPE_FORMAT_R16G16_SNORM; + continue; + case PIPE_FORMAT_R16_USCALED: + *format = PIPE_FORMAT_R16G16_USCALED; + continue; + case PIPE_FORMAT_R16_SSCALED: + *format = PIPE_FORMAT_R16G16_SSCALED; + continue; + case PIPE_FORMAT_R16_FLOAT: + *format = PIPE_FORMAT_R16G16_FLOAT; + continue; + + /* Align to RGBA16. */ case PIPE_FORMAT_R16G16B16_UNORM: *format = PIPE_FORMAT_R16G16B16A16_UNORM; continue; @@ -1318,6 +1346,10 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe, case PIPE_FORMAT_R16G16B16_SSCALED: *format = PIPE_FORMAT_R16G16B16A16_SSCALED; continue; + case PIPE_FORMAT_R16G16B16_FLOAT: + *format = PIPE_FORMAT_R16G16B16A16_FLOAT; + continue; + default:; }