Henri Verbeet : wined3d: Simply refuse to create shaders if they' re disabled.

Alexandre Julliard julliard at winehq.org
Tue Sep 28 11:13:35 CDT 2010


Module: wine
Branch: master
Commit: e59fdb83a672b6efcede100d24d658f151b5b53c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e59fdb83a672b6efcede100d24d658f151b5b53c

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Sep 28 12:00:22 2010 +0200

wined3d: Simply refuse to create shaders if they're disabled.

The functionality is a bit questionable in the first place, but there is some
use in the part that limits the maximum reported shader versions.

---

 dlls/wined3d/device.c          |   15 ++++++++++-----
 dlls/wined3d/wined3d_private.h |    7 +++----
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0967bd8..c1ce5f8 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -408,8 +408,7 @@ static void device_trace_strided_stream_info(const struct wined3d_stream_info *s
 void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info)
 {
     struct wined3d_stream_info *stream_info = &device->strided_streams;
-    IWineD3DStateBlockImpl *stateblock = device->stateBlock;
-    BOOL vs = stateblock->state.vertex_shader && device->vs_selected_mode != SHADER_NONE;
+    const struct wined3d_state *state = &device->stateBlock->state;
     BOOL fixup = FALSE;
 
     if (device->up_strided)
@@ -422,12 +421,12 @@ void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_
     else
     {
         TRACE("============================= Vertex Declaration =============================\n");
-        device_stream_info_from_declaration(device, vs, stream_info, &fixup);
+        device_stream_info_from_declaration(device, !!state->vertex_shader, stream_info, &fixup);
     }
 
-    if (vs && !stream_info->position_transformed)
+    if (state->vertex_shader && !stream_info->position_transformed)
     {
-        if (stateblock->state.vertex_declaration->half_float_conv_needed && !fixup)
+        if (state->vertex_declaration->half_float_conv_needed && !fixup)
         {
             TRACE("Using drawStridedSlow with vertex shaders for FLOAT16 conversion.\n");
             device->useDrawStridedSlow = TRUE;
@@ -1515,6 +1514,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
     IWineD3DVertexShaderImpl *object;
     HRESULT hr;
 
+    if (This->vs_selected_mode == SHADER_NONE)
+        return WINED3DERR_INVALIDCALL;
+
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
@@ -1575,6 +1577,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface
     IWineD3DPixelShaderImpl *object;
     HRESULT hr;
 
+    if (This->ps_selected_mode == SHADER_NONE)
+        return WINED3DERR_INVALIDCALL;
+
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 663a9d4..036d6f4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3023,14 +3023,13 @@ static inline BOOL use_vs(IWineD3DStateBlockImpl *stateblock)
      * IWineD3DDeviceImpl_FindTexUnitMap(). This is safe because
      * stateblock->vertexShader implies a vertex declaration instead of ddraw
      * style strided data. */
-    return (stateblock->state.vertex_shader
-            && !stateblock->state.vertex_declaration->position_transformed
-            && stateblock->device->vs_selected_mode != SHADER_NONE);
+    return stateblock->state.vertex_shader
+            && !stateblock->state.vertex_declaration->position_transformed;
 }
 
 static inline BOOL use_ps(IWineD3DStateBlockImpl *stateblock)
 {
-    return (stateblock->state.pixel_shader && stateblock->device->ps_selected_mode != SHADER_NONE);
+    return !!stateblock->state.pixel_shader;
 }
 
 /* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */




More information about the wine-cvs mailing list