d3d10umd: Fix compilation

Fixes: 4eb4c9bba ("d3d10umd: use cso_context to set vertex buffers and elements")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10054
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26370>
(cherry picked from commit 75fa621d34)
This commit is contained in:
Max R 2023-11-28 17:35:31 +03:00 committed by Eric Engestrom
parent 7979ca07ec
commit 6468166ae2
4 changed files with 14 additions and 25 deletions

View file

@ -1374,7 +1374,7 @@
"description": "d3d10umd: Fix compilation",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "4eb4c9bba97d659eb199cf41fb607d02caf6c748",
"notes": null

View file

@ -59,9 +59,12 @@ update_velems(Device *pDevice)
if (!pDevice->velems_changed)
return;
for (unsigned i = 0; i < pDevice->velems.count; i++)
pDevice->element_layout->velems.velems[i].src_stride = pDevice->vertex_strides[pDevice->element_layout->velems.velems[i].vertex_buffer_index];
cso_set_vertex_elements(pDevice->cso, &pDevice->element_layout->velems);
if(pDevice->element_layout) {
struct cso_velems_state *state = &pDevice->element_layout->state;
for (unsigned i = 0; i < state->count; i++)
state->velems[i].src_stride = pDevice->vertex_strides[state->velems[i].vertex_buffer_index];
cso_set_vertex_elements(pDevice->cso, state);
}
pDevice->velems_changed = false;
}

View file

@ -126,7 +126,6 @@ IaSetVertexBuffers(D3D10DDI_HDEVICE hDevice,
LOG_ENTRYPOINT();
Device *pDevice = CastDevice(hDevice);
struct pipe_context *pipe = pDevice->pipe;
unsigned i;
for (i = 0; i < NumBuffers; i++) {
@ -169,7 +168,7 @@ IaSetVertexBuffers(D3D10DDI_HDEVICE hDevice,
/* XXX this is odd... */
if (!vb->is_user_buffer && !vb->buffer.resource) {
pDevice->vertex_strides[i]->stride = 0;
pDevice->vertex_strides[i] = 0;
vb->buffer_offset = 0;
vb->is_user_buffer = true;
vb->buffer.user = dummy;
@ -271,9 +270,7 @@ CreateElementLayout(
LOG_ENTRYPOINT();
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
struct cso_velems_state elements;
memset(elements, 0, sizeof elements);
memset(pElementLayout, 0, sizeof *pElementLayout);
unsigned num_elements = pCreateElementLayout->NumElements;
unsigned max_elements = 0;
@ -281,7 +278,7 @@ CreateElementLayout(
const D3D10DDIARG_INPUT_ELEMENT_DESC* pVertexElement =
&pCreateElementLayout->pVertexElements[i];
struct pipe_vertex_element *ve =
&elements.velems[pVertexElement->InputRegister];
&pElementLayout->state.velems[pVertexElement->InputRegister];
ve->src_offset = pVertexElement->AlignedByteOffset;
ve->vertex_buffer_index = pVertexElement->InputSlot;
@ -312,8 +309,7 @@ CreateElementLayout(
DebugPrintf("%s: gap\n", __func__);
}
elements.count = max_elements;
pElementLayout->velems = mem_dup(elements, sizeof(elements));
pElementLayout->state.count = max_elements;
}
@ -335,10 +331,6 @@ DestroyElementLayout(D3D10DDI_HDEVICE hDevice, // IN
{
LOG_ENTRYPOINT();
struct pipe_context *pipe = CastPipeContext(hDevice);
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
free(pElementLayout->velems);
}

View file

@ -62,6 +62,7 @@ struct Shader
};
struct Query;
struct ElementLayout;
struct Device
{
@ -105,6 +106,7 @@ struct Device
Query *pPredicate;
BOOL PredicateValue;
ElementLayout *element_layout;
BOOL velems_changed;
};
@ -326,7 +328,7 @@ CastPipeShader(D3D10DDI_HSHADER hShader)
struct ElementLayout
{
struct cso_velems_state *velems;
struct cso_velems_state state;
};
@ -336,14 +338,6 @@ CastElementLayout(D3D10DDI_HELEMENTLAYOUT hElementLayout)
return static_cast<ElementLayout *>(hElementLayout.pDrvPrivate);
}
static inline void *
CastPipeInputLayout(D3D10DDI_HELEMENTLAYOUT hElementLayout)
{
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
return pElementLayout ? pElementLayout->handle : NULL;
}
struct SamplerState
{
void *handle;