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

d3d11: Avoid using wined3d_stream_output_element for validation.

Validate D3D11_SO_DECLARATION_ENTRY directly. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6b50fa31
...@@ -1124,9 +1124,9 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o ...@@ -1124,9 +1124,9 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o
WARN("Invalid semantic idx %u for stream output gap.\n", f->SemanticIndex); WARN("Invalid semantic idx %u for stream output gap.\n", f->SemanticIndex);
return E_INVALIDARG; return E_INVALIDARG;
} }
if (e->component_idx || !e->component_count) if (f->StartComponent || !f->ComponentCount)
{ {
WARN("Invalid stream output gap %u-%u.\n", e->component_idx, e->component_count); WARN("Invalid stream output gap %u-%u.\n", f->StartComponent, f->ComponentCount);
return E_INVALIDARG; return E_INVALIDARG;
} }
...@@ -1134,10 +1134,10 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o ...@@ -1134,10 +1134,10 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o
} }
else if ((output = shader_find_signature_element(os, f->SemanticName, f->SemanticIndex, f->Stream))) else if ((output = shader_find_signature_element(os, f->SemanticName, f->SemanticIndex, f->Stream)))
{ {
if (e->component_idx > 3 || e->component_count > 4 || !e->component_count if (f->StartComponent > 3 || f->ComponentCount > 4 || !f->ComponentCount
|| e->component_idx + e->component_count > 4) || f->StartComponent + f->ComponentCount > 4)
{ {
WARN("Invalid component range %u-%u.\n", e->component_idx, e->component_count); WARN("Invalid component range %u-%u.\n", f->StartComponent, f->ComponentCount);
return E_INVALIDARG; return E_INVALIDARG;
} }
...@@ -1168,17 +1168,21 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o ...@@ -1168,17 +1168,21 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o
for (i = 0; i < entry_count; ++i) for (i = 0; i < entry_count; ++i)
{ {
const struct wined3d_stream_output_element *e1 = &elements[i]; const D3D11_SO_DECLARATION_ENTRY *e1 = &entries[i];
if (e1->register_idx == WINED3D_STREAM_OUTPUT_GAP) if (!e1->SemanticName) /* gap */
continue; continue;
for (j = i + 1; j < entry_count; ++j) for (j = i + 1; j < entry_count; ++j)
{ {
const struct wined3d_stream_output_element *e2 = &elements[j]; const D3D11_SO_DECLARATION_ENTRY *e2 = &entries[j];
if (!e2->SemanticName) /* gap */
continue;
if (e1->register_idx == e2->register_idx if (e1->Stream == e2->Stream
&& e1->component_idx < e2->component_idx + e2->component_count && !strcasecmp(e1->SemanticName, e2->SemanticName)
&& e1->component_idx + e1->component_count > e2->component_idx) && e1->SemanticIndex == e2->SemanticIndex
&& e1->StartComponent < e2->StartComponent + e2->ComponentCount
&& e1->StartComponent + e1->ComponentCount > e2->StartComponent)
{ {
WARN("Stream output elements %u and %u overlap.\n", i, j); WARN("Stream output elements %u and %u overlap.\n", i, j);
return E_INVALIDARG; return E_INVALIDARG;
...@@ -1194,14 +1198,14 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o ...@@ -1194,14 +1198,14 @@ static HRESULT wined3d_so_elements_from_d3d11_so_entries(struct wined3d_stream_o
for (j = 0; j < entry_count; ++j) for (j = 0; j < entry_count; ++j)
{ {
const struct wined3d_stream_output_element *e = &elements[j]; const D3D11_SO_DECLARATION_ENTRY *e = &entries[j];
if (e->stream_idx != i) if (e->Stream != i)
continue; continue;
current_stride[e->output_slot] += 4 * e->component_count; current_stride[e->OutputSlot] += 4 * e->ComponentCount;
++element_count[e->output_slot]; ++element_count[e->OutputSlot];
if (e->register_idx == WINED3D_STREAM_OUTPUT_GAP) if (!e->SemanticName)
++gap_count[e->output_slot]; ++gap_count[e->OutputSlot];
} }
for (j = 0; j < D3D11_SO_BUFFER_SLOT_COUNT; ++j) for (j = 0; j < D3D11_SO_BUFFER_SLOT_COUNT; ++j)
......
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