On 9 December 2016 at 11:30, Józef Kucia jkucia@codeweavers.com wrote:
const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl_info,
enum wined3d_format_id format_id)
enum wined3d_format_id format_id, unsigned int resource_usage)
{
const struct wined3d_format *format; int idx = get_format_idx(format_id);
unsigned int i;
if (idx == -1) {
FIXME("Can't find format %s (%#x) in the format lookup table\n",
FIXME("Can't find format %s (%#x) in the format lookup table.\n",
debug_d3dformat(format_id), format_id);
return &gl_info->formats[get_format_idx(WINED3DFMT_UNKNOWN)];
- }
- format = &gl_info->formats[idx];
- if (resource_usage & WINED3DUSAGE_DEPTHSTENCIL && wined3d_format_is_typeless(format))
- {
for (i = 0; i < ARRAY_SIZE(typeless_depth_stencil_formats); ++i)
{
if (typeless_depth_stencil_formats[i].typeless_id == format_id)
return &gl_info->formats[WINED3D_FORMAT_COUNT + i];
}
FIXME("Cannot find depth/stencil typeless format %s (%#x).\n", debug_d3dformat(format_id), format_id);
/* Get the caller a valid pointer */
idx = get_format_idx(WINED3DFMT_UNKNOWN);
}return &gl_info->formats[get_format_idx(WINED3DFMT_UNKNOWN)];
- return &gl_info->formats[idx];
- return format;
}
I do have some concerns about whether returning different wined3d_format structures for different usages/bind flags is better than having different GL internal formats for different usages/bind flags within the same wined3d_format structure, but lets give it a try.