st/nine: Fix volumetexture dtor on ctor failure
[mesa.git] / src / gallium / state_trackers / nine / adapter9.c
index 09bfa3989ff76266ca0786ae98f7e9188668d522..0634d5918ce6df3d53cbd2f3717e32055551ee85 100644 (file)
@@ -77,7 +77,9 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
         hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
                               PIPE_SHADER_CAP_MAX_INPUTS) < 16 ||
         hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
-                              PIPE_SHADER_CAP_MAX_INPUTS) < 10) {
+                              PIPE_SHADER_CAP_MAX_INPUTS) < 10 ||
+        hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
+                              PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS) < 16) {
         ERR("Your card is not supported by Gallium Nine. Minimum requirement "
             "is >= r500, >= nv50, >= i965\n");
         return D3DERR_DRIVERINTERNALERROR;
@@ -297,7 +299,11 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
 
     bind = 0;
     if (Usage & D3DUSAGE_RENDERTARGET) bind |= PIPE_BIND_RENDER_TARGET;
-    if (Usage & D3DUSAGE_DEPTHSTENCIL) bind |= PIPE_BIND_DEPTH_STENCIL;
+    if (Usage & D3DUSAGE_DEPTHSTENCIL) {
+        if (!depth_stencil_format(CheckFormat))
+            return D3DERR_NOTAVAILABLE;
+        bind |= d3d9_get_pipe_depth_format_bindings(CheckFormat);
+    }
 
     /* API hack because setting RT[0] to NULL is forbidden */
     if (CheckFormat == D3DFMT_NULL && bind == PIPE_BIND_RENDER_TARGET &&
@@ -389,7 +395,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
         /* In error cases return only 1 quality level supported */
         *pQualityLevels = 1;
     }
-    user_assert(MultiSampleType < D3DMULTISAMPLE_16_SAMPLES, D3DERR_INVALIDCALL);
+    user_assert(MultiSampleType <= D3DMULTISAMPLE_16_SAMPLES, D3DERR_INVALIDCALL);
 
     hr = NineAdapter9_GetScreen(This, DeviceType, &screen);
     if (FAILED(hr))
@@ -596,7 +602,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
                                D3DPMISCCAPS_BLENDOP |
                                D3DPIPECAP(INDEP_BLEND_ENABLE, D3DPMISCCAPS_INDEPENDENTWRITEMASKS) |
                                D3DPMISCCAPS_PERSTAGECONSTANT |
-                               /*D3DPMISCCAPS_POSTBLENDSRGBCONVERT |*/ /* TODO */
+                               /*D3DPMISCCAPS_POSTBLENDSRGBCONVERT |*/ /* TODO: advertise if Ex and dx10 able card */
                                D3DPMISCCAPS_FOGANDSPECULARALPHA | /* Note: documentation of the flag is wrong */
                                D3DPIPECAP(BLEND_EQUATION_SEPARATE, D3DPMISCCAPS_SEPARATEALPHABLEND) |
                                D3DPIPECAP(MIXED_COLORBUFFER_FORMATS, D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) |
@@ -749,7 +755,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
         D3DSTENCILCAPS_INVERT |
         D3DSTENCILCAPS_INCR |
         D3DSTENCILCAPS_DECR |
-        D3DPIPECAP(TWO_SIDED_STENCIL, D3DSTENCILCAPS_TWOSIDED);
+        D3DSTENCILCAPS_TWOSIDED;
 
     pCaps->FVFCaps =
         8 | /* 8 textures max */
@@ -785,10 +791,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
 
     pCaps->MaxTextureBlendStages = 8; /* XXX wine */
         (DWORD)screen->get_param(screen, PIPE_CAP_BLEND_EQUATION_SEPARATE);
-    pCaps->MaxSimultaneousTextures = screen->get_shader_param(screen,
-        PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS);
-    if (pCaps->MaxSimultaneousTextures > NINE_MAX_SAMPLERS_PS)
-        pCaps->MaxSimultaneousTextures = NINE_MAX_SAMPLERS_PS;
+    pCaps->MaxSimultaneousTextures = 8;
 
     pCaps->VertexProcessingCaps = D3DVTXPCAPS_TEXGEN |
                                   D3DVTXPCAPS_TEXGEN_SPHEREMAP |