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.
This commit is contained in:
Henri Verbeet 2010-09-28 12:00:22 +02:00 committed by Alexandre Julliard
parent d6d345fa8a
commit e59fdb83a6
2 changed files with 13 additions and 9 deletions

View File

@ -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)
{

View File

@ -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 */