[Mesa-dev] [PATCH 07/12] st/nine: Add format checks to create_zs_or_rt_surface

Axel Davy axel.davy at ens.fr
Sun Feb 7 23:13:14 UTC 2016


Returns INVALIDCALL when trying to create a surface
of unsupported format.

In practice, apps are supposed to check for format
support before trying to create a render target
of that format. However some bad behaving apps
could just try to create the surface and deduce if
it failed that it wasn't supported.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/device9.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index b6e75b4..3ebff3a 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1126,6 +1126,9 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
                                                templ.nr_samples, templ.bind,
                                                FALSE);
 
+    if (templ.format == PIPE_FORMAT_NONE && Format != D3DFMT_NULL)
+        return D3DERR_INVALIDCALL;
+
     desc.Format = Format;
     desc.Type = D3DRTYPE_SURFACE;
     desc.Usage = 0;
-- 
2.7.0



More information about the mesa-dev mailing list