struct pipe_screen *screen = pAdapter->screen;
struct pipe_context *pipe = screen->context_create(screen, NULL, 0);
pDevice->pipe = pipe;
+ pDevice->cso = cso_create_context(pipe, CSO_NO_VBUF);
pDevice->empty_vs = CreateEmptyShader(pDevice, PIPE_SHADER_VERTEX);
pDevice->empty_fs = CreateEmptyShader(pDevice, PIPE_SHADER_FRAGMENT);
pipe->bind_fs_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_VERTEX, pDevice->empty_vs);
}
+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.
* In particular we've remapped the output indices when translating the
}
pipe->bind_gs_state(pipe, gs->handle);
}
+ update_velems(pDevice);
}
/* 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;
}
{
LOG_ENTRYPOINT();
- struct pipe_context *pipe = CastPipeContext(hDevice);
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
- struct pipe_vertex_element elements[PIPE_MAX_ATTRIBS];
+ struct cso_velems_state elements;
memset(elements, 0, sizeof elements);
unsigned num_elements = pCreateElementLayout->NumElements;
const D3D10DDIARG_INPUT_ELEMENT_DESC* pVertexElement =
&pCreateElementLayout->pVertexElements[i];
struct pipe_vertex_element *ve =
- &elements[pVertexElement->InputRegister];
+ &elements.velems[pVertexElement->InputRegister];
ve->src_offset = pVertexElement->AlignedByteOffset;
ve->vertex_buffer_index = pVertexElement->InputSlot;
DebugPrintf("%s: gap\n", __func__);
}
- pElementLayout->handle =
- pipe->create_vertex_elements_state(pipe, max_elements, elements);
+ elements.count = max_elements;
+ pElementLayout->velems = mem_dup(elements, sizeof(elements));
}
struct pipe_context *pipe = CastPipeContext(hDevice);
ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
- pipe->delete_vertex_elements_state(pipe, pElementLayout->handle);}
+ free(pElementLayout->velems);
+}
/*
{
LOG_ENTRYPOINT();
- struct pipe_context *pipe = CastPipeContext(hDevice);
- void *state = CastPipeInputLayout(hInputLayout);
+ Device *pDevice = CastDevice(hDevice);
+ pDevice->element_layout = CastElementLayout(hInputLayout);
+ pDevice->velems_changed = true;
- pipe->bind_vertex_elements_state(pipe, state);
}
-
-
#include "DriverIncludes.h"
#include "util/u_hash_table.h"
-
+#include "cso_cache/cso_context.h"
#define SUPPORT_MSAA 0
#define SUPPORT_D3D10_1 0
{
struct pipe_context *pipe;
+ struct cso_context *cso;
struct pipe_framebuffer_state fb;
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
struct pipe_resource *index_buffer;
Query *pPredicate;
BOOL PredicateValue;
+
+ BOOL velems_changed;
};
struct ElementLayout
{
- void *handle;
+ struct cso_velems_state *velems;
};