Commit b18d8ec0 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Allow draw calls without vertex declaration.

parent bd41d53a
......@@ -3013,12 +3013,17 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
{
/* We need to deal with frequency data! */
struct wined3d_vertex_declaration *declaration = state->vertex_declaration;
BOOL use_vshader = use_vs(state);
BOOL generic_attributes = context->d3d_info->ffp_generic_attributes;
BOOL use_vshader = use_vs(state);
unsigned int i;
stream_info->use_map = 0;
stream_info->swizzle_map = 0;
stream_info->position_transformed = 0;
if (!declaration)
return;
stream_info->position_transformed = declaration->position_transformed;
/* Translate the declaration into strided data. */
......@@ -3113,9 +3118,9 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
/* Context activation is done by the caller. */
static void context_update_stream_info(struct wined3d_context *context, const struct wined3d_state *state)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
struct wined3d_stream_info *stream_info = &context->stream_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
const struct wined3d_gl_info *gl_info = context->gl_info;
DWORD prev_all_vbo = stream_info->all_vbo;
unsigned int i;
WORD map;
......@@ -3170,17 +3175,21 @@ static void context_update_stream_info(struct wined3d_context *context, const st
TRACE("Load array %u {%#x:%p}.\n", i, element->data.buffer_object, element->data.addr);
}
if (prev_all_vbo != stream_info->all_vbo)
context_invalidate_state(context, STATE_INDEXBUFFER);
context->use_immediate_mode_draw = FALSE;
if (stream_info->all_vbo)
return;
if (use_vs(state))
{
if (state->vertex_declaration->half_float_conv_needed && !stream_info->all_vbo)
if (state->vertex_declaration->half_float_conv_needed)
{
TRACE("Using immediate mode draw with vertex shaders for FLOAT16 conversion.\n");
context->use_immediate_mode_draw = TRUE;
}
else
{
context->use_immediate_mode_draw = FALSE;
}
}
else
{
......@@ -3188,15 +3197,10 @@ static void context_update_stream_info(struct wined3d_context *context, const st
slow_mask |= -!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
& ((1u << WINED3D_FFP_DIFFUSE) | (1u << WINED3D_FFP_SPECULAR));
if (((stream_info->position_transformed && !d3d_info->xyzrhw)
|| (stream_info->use_map & slow_mask)) && !stream_info->all_vbo)
if ((stream_info->position_transformed && !d3d_info->xyzrhw)
|| (stream_info->use_map & slow_mask))
context->use_immediate_mode_draw = TRUE;
else
context->use_immediate_mode_draw = FALSE;
}
if (prev_all_vbo != stream_info->all_vbo)
context_invalidate_state(context, STATE_INDEXBUFFER);
}
/* Context activation is done by the caller. */
......
......@@ -3482,12 +3482,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
if (!device->state.vertex_declaration)
{
WARN("Called without a valid vertex declaration set.\n");
return WINED3DERR_INVALIDCALL;
}
if (device->state.load_base_vertex_index)
{
device->state.load_base_vertex_index = 0;
......@@ -3524,14 +3518,8 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
if (!device->state.vertex_declaration)
{
WARN("Called without a valid vertex declaration set.\n");
return WINED3DERR_INVALIDCALL;
}
if (!gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] &&
device->state.load_base_vertex_index != device->state.base_vertex_index)
device->state.load_base_vertex_index != device->state.base_vertex_index)
{
device->state.load_base_vertex_index = device->state.base_vertex_index;
device_invalidate_state(device, STATE_BASEVERTEXINDEX);
......
......@@ -3544,7 +3544,8 @@ static inline BOOL use_vs(const struct wined3d_state *state)
{
/* Check state->vertex_declaration to allow this to be used before the
* stream info is validated, for example in device_update_tex_unit_map(). */
return state->shader[WINED3D_SHADER_TYPE_VERTEX] && !state->vertex_declaration->position_transformed;
return state->shader[WINED3D_SHADER_TYPE_VERTEX]
&& (!state->vertex_declaration || !state->vertex_declaration->position_transformed);
}
static inline BOOL use_ps(const struct wined3d_state *state)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment