mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 15:38:09 +02:00
d3d10umd: use cso_context to set vertex buffers and elements
should be no functional changes Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24117>
This commit is contained in:
parent
65cda2c0e1
commit
4eb4c9bba9
4 changed files with 30 additions and 14 deletions
|
|
@ -132,6 +132,7 @@ CreateDevice(D3D10DDI_HADAPTER hAdapter, // IN
|
||||||
struct pipe_screen *screen = pAdapter->screen;
|
struct pipe_screen *screen = pAdapter->screen;
|
||||||
struct pipe_context *pipe = screen->context_create(screen, NULL, 0);
|
struct pipe_context *pipe = screen->context_create(screen, NULL, 0);
|
||||||
pDevice->pipe = pipe;
|
pDevice->pipe = pipe;
|
||||||
|
pDevice->cso = cso_create_context(pipe, CSO_NO_VBUF);
|
||||||
|
|
||||||
pDevice->empty_vs = CreateEmptyShader(pDevice, PIPE_SHADER_VERTEX);
|
pDevice->empty_vs = CreateEmptyShader(pDevice, PIPE_SHADER_VERTEX);
|
||||||
pDevice->empty_fs = CreateEmptyShader(pDevice, PIPE_SHADER_FRAGMENT);
|
pDevice->empty_fs = CreateEmptyShader(pDevice, PIPE_SHADER_FRAGMENT);
|
||||||
|
|
@ -334,6 +335,7 @@ DestroyDevice(D3D10DDI_HDEVICE hDevice) // IN
|
||||||
|
|
||||||
pipe->bind_fs_state(pipe, NULL);
|
pipe->bind_fs_state(pipe, NULL);
|
||||||
pipe->bind_vs_state(pipe, NULL);
|
pipe->bind_vs_state(pipe, NULL);
|
||||||
|
cso_destroy_context(pDevice->cso);
|
||||||
|
|
||||||
DeleteEmptyShader(pDevice, PIPE_SHADER_FRAGMENT, pDevice->empty_fs);
|
DeleteEmptyShader(pDevice, PIPE_SHADER_FRAGMENT, pDevice->empty_fs);
|
||||||
DeleteEmptyShader(pDevice, PIPE_SHADER_VERTEX, pDevice->empty_vs);
|
DeleteEmptyShader(pDevice, PIPE_SHADER_VERTEX, pDevice->empty_vs);
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,17 @@ ClampedUAdd(unsigned a,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_velems(Device *pDevice)
|
||||||
|
{
|
||||||
|
if (!pDevice->velems_changed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cso_set_vertex_elements(pDevice->cso, &pDevice->element_layout->velems);
|
||||||
|
|
||||||
|
pDevice->velems_changed = false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have to resolve the stream output state for empty geometry shaders.
|
* We have to resolve the stream output state for empty geometry shaders.
|
||||||
* In particular we've remapped the output indices when translating the
|
* In particular we've remapped the output indices when translating the
|
||||||
|
|
@ -85,6 +96,7 @@ ResolveState(Device *pDevice)
|
||||||
}
|
}
|
||||||
pipe->bind_gs_state(pipe, gs->handle);
|
pipe->bind_gs_state(pipe, gs->handle);
|
||||||
}
|
}
|
||||||
|
update_velems(pDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,8 @@ IaSetVertexBuffers(D3D10DDI_HDEVICE hDevice,
|
||||||
|
|
||||||
/* Resubmit old and new vertex buffers.
|
/* Resubmit old and new vertex buffers.
|
||||||
*/
|
*/
|
||||||
pipe->set_vertex_buffers(pipe, PIPE_MAX_ATTRIBS, 0, false, pDevice->vertex_buffers);
|
cso_set_vertex_buffers(pDevice->cso, PIPE_MAX_ATTRIBS, 0, false, pDevice->vertex_buffers);
|
||||||
|
pDevice->velems_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -269,10 +270,9 @@ CreateElementLayout(
|
||||||
{
|
{
|
||||||
LOG_ENTRYPOINT();
|
LOG_ENTRYPOINT();
|
||||||
|
|
||||||
struct pipe_context *pipe = CastPipeContext(hDevice);
|
|
||||||
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
|
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
|
||||||
|
|
||||||
struct pipe_vertex_element elements[PIPE_MAX_ATTRIBS];
|
struct cso_velems_state elements;
|
||||||
memset(elements, 0, sizeof elements);
|
memset(elements, 0, sizeof elements);
|
||||||
|
|
||||||
unsigned num_elements = pCreateElementLayout->NumElements;
|
unsigned num_elements = pCreateElementLayout->NumElements;
|
||||||
|
|
@ -281,7 +281,7 @@ CreateElementLayout(
|
||||||
const D3D10DDIARG_INPUT_ELEMENT_DESC* pVertexElement =
|
const D3D10DDIARG_INPUT_ELEMENT_DESC* pVertexElement =
|
||||||
&pCreateElementLayout->pVertexElements[i];
|
&pCreateElementLayout->pVertexElements[i];
|
||||||
struct pipe_vertex_element *ve =
|
struct pipe_vertex_element *ve =
|
||||||
&elements[pVertexElement->InputRegister];
|
&elements.velems[pVertexElement->InputRegister];
|
||||||
|
|
||||||
ve->src_offset = pVertexElement->AlignedByteOffset;
|
ve->src_offset = pVertexElement->AlignedByteOffset;
|
||||||
ve->vertex_buffer_index = pVertexElement->InputSlot;
|
ve->vertex_buffer_index = pVertexElement->InputSlot;
|
||||||
|
|
@ -312,8 +312,8 @@ CreateElementLayout(
|
||||||
DebugPrintf("%s: gap\n", __func__);
|
DebugPrintf("%s: gap\n", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pElementLayout->handle =
|
elements.count = max_elements;
|
||||||
pipe->create_vertex_elements_state(pipe, max_elements, elements);
|
pElementLayout->velems = mem_dup(elements, sizeof(elements));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -338,7 +338,8 @@ DestroyElementLayout(D3D10DDI_HDEVICE hDevice, // IN
|
||||||
struct pipe_context *pipe = CastPipeContext(hDevice);
|
struct pipe_context *pipe = CastPipeContext(hDevice);
|
||||||
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
|
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
|
||||||
|
|
||||||
pipe->delete_vertex_elements_state(pipe, pElementLayout->handle);}
|
free(pElementLayout->velems);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -358,10 +359,8 @@ IaSetInputLayout(D3D10DDI_HDEVICE hDevice, // IN
|
||||||
{
|
{
|
||||||
LOG_ENTRYPOINT();
|
LOG_ENTRYPOINT();
|
||||||
|
|
||||||
struct pipe_context *pipe = CastPipeContext(hDevice);
|
Device *pDevice = CastDevice(hDevice);
|
||||||
void *state = CastPipeInputLayout(hInputLayout);
|
pDevice->element_layout = CastElementLayout(hInputLayout);
|
||||||
|
pDevice->velems_changed = true;
|
||||||
|
|
||||||
pipe->bind_vertex_elements_state(pipe, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "DriverIncludes.h"
|
#include "DriverIncludes.h"
|
||||||
#include "util/u_hash_table.h"
|
#include "util/u_hash_table.h"
|
||||||
|
#include "cso_cache/cso_context.h"
|
||||||
|
|
||||||
#define SUPPORT_MSAA 0
|
#define SUPPORT_MSAA 0
|
||||||
#define SUPPORT_D3D10_1 0
|
#define SUPPORT_D3D10_1 0
|
||||||
|
|
@ -67,6 +67,7 @@ struct Device
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe;
|
struct pipe_context *pipe;
|
||||||
|
|
||||||
|
struct cso_context *cso;
|
||||||
struct pipe_framebuffer_state fb;
|
struct pipe_framebuffer_state fb;
|
||||||
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
|
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
|
||||||
struct pipe_resource *index_buffer;
|
struct pipe_resource *index_buffer;
|
||||||
|
|
@ -102,6 +103,8 @@ struct Device
|
||||||
|
|
||||||
Query *pPredicate;
|
Query *pPredicate;
|
||||||
BOOL PredicateValue;
|
BOOL PredicateValue;
|
||||||
|
|
||||||
|
BOOL velems_changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -322,7 +325,7 @@ CastPipeShader(D3D10DDI_HSHADER hShader)
|
||||||
|
|
||||||
struct ElementLayout
|
struct ElementLayout
|
||||||
{
|
{
|
||||||
void *handle;
|
struct cso_velems_state *velems;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue