Signed-off-by: Stefan Dösinger stefan@codeweavers.com
---
Version 2: Check for WINED3DFMT_FLAG_FLOAT instead of explicitly listing expected float formats.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/wined3d/resource.c | 6 ++++++ dlls/wined3d/utils.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 073bc5b5834..ed5d5d63250 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -668,6 +668,12 @@ void wined3d_resource_memory_colour_fill(struct wined3d_resource *resource, ((uint32_t *)dst)[x] = c[0]; } break; + case 8: + case 12: + case 16: + for (x = 0; x < w; ++x) + memcpy(((uint8_t *)map->data) + x * bpp, c, bpp); + break;
default: FIXME("Not implemented for bpp %u.\n", bpp); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 3017265ccb0..e4fcf18600e 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6119,6 +6119,27 @@ void wined3d_format_convert_from_float(const struct wined3d_format *format, cons return; }
+ /* 32 bit float formats. We don't handle D32_FLOAT and D32_FLOAT_S8X24_UINT for now. */ + if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT) && format->red_size == 32) + { + float *ret_f = ret; + + switch (format->byte_count) + { + case 16: ret_f[3] = color->a; + case 12: ret_f[2] = color->b; + case 8: ret_f[1] = color->g; + case 4: ret_f[0] = color->r; + break; + + default: + ERR("Unexpected byte count %u: Format %s\n", format->byte_count, debug_d3dformat(format_id)); + break; + } + + return; + } + FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format_id)); }