if (!This->cso_sw) { return E_OUTOFMEMORY; }
/* Create first, it messes up our state. */
- This->hud = hud_create(This->context.pipe, This->context.cso); /* NULL result is fine */
+ This->hud = hud_create(This->context.cso, NULL); /* NULL result is fine */
/* Available memory counter. Updated only for allocations with this device
* instance. This is the Win 7 behavior.
This->cursor.software = FALSE;
This->cursor.hotspot.x = -1;
This->cursor.hotspot.y = -1;
+ This->cursor.w = This->cursor.h = 0;
+ This->cursor.visible = FALSE;
+ if (ID3DPresent_GetCursorPos(This->swapchains[0]->present, &This->cursor.pos) != S_OK) {
+ This->cursor.pos.x = 0;
+ This->cursor.pos.y = 0;
+ }
+
{
struct pipe_resource tmpl;
memset(&tmpl, 0, sizeof(tmpl));
/* Allocate upload helper for drivers that suck (from st pov ;). */
This->driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS) && !This->csmt_active;
- This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
- This->driver_caps.user_sw_cbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS);
- if (!This->driver_caps.user_cbufs)
- This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
+ This->vertex_uploader = This->csmt_active ? This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader;
This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION);
This->driver_caps.vs_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS);
This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS);
DBG("This=%p X=%d Y=%d Flags=%d\n", This, X, Y, Flags);
+ if (This->cursor.pos.x == X &&
+ This->cursor.pos.y == Y)
+ return;
+
This->cursor.pos.x = X;
This->cursor.pos.y = Y;
DBG("This=%p bShow=%d\n", This, (int) bShow);
- This->cursor.visible = bShow && (This->cursor.hotspot.x != -1);
+ /* No-op until a cursor is set in d3d */
+ if (This->cursor.hotspot.x == -1)
+ return old;
+
+ This->cursor.visible = bShow;
+ /* Note: Don't optimize by avoiding the call if This->cursor.visible
+ * hasn't changed. One has to keep in mind the app may do SetCursor
+ * calls outside d3d, thus such an optimization affects behaviour. */
if (!This->cursor.software)
This->cursor.software = ID3DPresent_SetCursor(This->swapchains[0]->present, NULL, NULL, bShow) != D3D_OK;
user_assert(screen->is_format_supported(screen, src_res->format,
src_res->target,
src_res->nr_samples,
+ src_res->nr_storage_samples,
PIPE_BIND_SAMPLER_VIEW),
D3DERR_INVALIDCALL);
user_assert(screen->is_format_supported(screen, dst_res->format,
dst_res->target,
dst_res->nr_samples,
+ dst_res->nr_storage_samples,
zs ? PIPE_BIND_DEPTH_STENCIL :
PIPE_BIND_RENDER_TARGET),
D3DERR_INVALIDCALL);
return D3D_OK;
}
+static void
+nine_D3DMATRIX_print(const D3DMATRIX *M)
+{
+ DBG("\n(%f %f %f %f)\n"
+ "(%f %f %f %f)\n"
+ "(%f %f %f %f)\n"
+ "(%f %f %f %f)\n",
+ M->m[0][0], M->m[0][1], M->m[0][2], M->m[0][3],
+ M->m[1][0], M->m[1][1], M->m[1][2], M->m[1][3],
+ M->m[2][0], M->m[2][1], M->m[2][2], M->m[2][3],
+ M->m[3][0], M->m[3][1], M->m[3][2], M->m[3][3]);
+}
+
HRESULT NINE_WINAPI
NineDevice9_SetTransform( struct NineDevice9 *This,
D3DTRANSFORMSTATETYPE State,
DBG("This=%p State=%d pMatrix=%p\n", This, State, pMatrix);
user_assert(M, D3DERR_INVALIDCALL);
+ nine_D3DMATRIX_print(pMatrix);
*M = *pMatrix;
if (unlikely(This->is_recording)) {
if (Type == D3DSBT_ALL || Type == D3DSBT_PIXELSTATE) {
dst->changed.group |=
NINE_STATE_PS | NINE_STATE_PS_CONST | NINE_STATE_BLEND |
- NINE_STATE_FF_OTHER | NINE_STATE_FF_PSSTAGES | NINE_STATE_PS_CONST |
+ NINE_STATE_FF_VS_OTHER | NINE_STATE_FF_PS_CONSTS | NINE_STATE_PS_CONST |
NINE_STATE_FB | NINE_STATE_DSA | NINE_STATE_MULTISAMPLE |
NINE_STATE_RASTERIZER | NINE_STATE_STENCIL_REF;
memcpy(dst->changed.rs,
NINE_STATE_BLEND |
NINE_STATE_DSA |
NINE_STATE_IDXBUF |
- NINE_STATE_MATERIAL |
+ NINE_STATE_FF_MATERIAL |
NINE_STATE_BLEND_COLOR |
- NINE_STATE_SAMPLE_MASK;
+ NINE_STATE_SAMPLE_MASK |
+ NINE_STATE_FF_VSTRANSF;
memset(dst->changed.rs, ~0, (D3DRS_COUNT / 32) * sizeof(uint32_t));
dst->changed.rs[D3DRS_LAST / 32] |= (1 << (D3DRS_COUNT % 32)) - 1;
dst->changed.vtxbuf = (1ULL << This->caps.MaxStreams) - 1;
dst->changed.stream_freq = dst->changed.vtxbuf;
dst->changed.ucp = (1 << PIPE_MAX_CLIP_PLANES) - 1;
dst->changed.texture = (1 << NINE_MAX_SAMPLERS) - 1;
+ /* The doc says the projection, world, view and texture matrices
+ * are saved, which would translate to:
+ * dst->ff.changed.transform[0] = 0x00FF000C;
+ * dst->ff.changed.transform[D3DTS_WORLD / 32] |= 1 << (D3DTS_WORLD % 32);
+ * However we assume they meant save everything (which is basically just the
+ * above plus the other world matrices).
+ */
+ dst->ff.changed.transform[0] = 0x00FF000C;
+ for (s = 0; s < 8; s++)
+ dst->ff.changed.transform[8+s] = ~0;
}
NineStateBlock9_Capture(NineStateBlock9(*ppSB));
if (unlikely(This->is_recording)) {
if (Type == D3DTSS_TEXTURETRANSFORMFLAGS)
- state->changed.group |= NINE_STATE_PS1X_SHADER;
- state->changed.group |= NINE_STATE_FF_PSSTAGES;
+ state->changed.group |= NINE_STATE_PS_PARAMS_MISC;
+ state->changed.group |= NINE_STATE_FF_PS_CONSTS;
state->ff.changed.tex_stage[Stage][Type / 32] |= 1 << (Type % 32);
} else
nine_context_set_texture_stage_state(This, Stage, Type, Value);
vtxbuf.stride = VertexStreamZeroStride;
vtxbuf.buffer_offset = 0;
- vtxbuf.buffer = NULL;
- vtxbuf.user_buffer = pVertexStreamZeroData;
+ vtxbuf.is_user_buffer = true;
+ vtxbuf.buffer.user = pVertexStreamZeroData;
- /* csmt is unactive when user vertex or index buffers are used, thus no
- * need to call NineDevice9_GetPipe. */
if (!This->driver_caps.user_vbufs) {
- u_upload_data(This->context.pipe->stream_uploader,
+ vtxbuf.is_user_buffer = false;
+ vtxbuf.buffer.resource = NULL;
+ u_upload_data(This->vertex_uploader,
0,
(prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * VertexStreamZeroStride, /* XXX */
4,
- vtxbuf.user_buffer,
+ pVertexStreamZeroData,
&vtxbuf.buffer_offset,
- &vtxbuf.buffer);
- u_upload_unmap(This->context.pipe->stream_uploader);
- vtxbuf.user_buffer = NULL;
+ &vtxbuf.buffer.resource);
+ u_upload_unmap(This->vertex_uploader);
}
NineBeforeDraw(This);
nine_context_draw_primitive_from_vtxbuf(This, PrimitiveType, PrimitiveCount, &vtxbuf);
NineAfterDraw(This);
- pipe_resource_reference(&vtxbuf.buffer, NULL);
+ pipe_vertex_buffer_unreference(&vtxbuf);
NineDevice9_PauseRecording(This);
NineDevice9_SetStreamSource(This, 0, NULL, 0, 0);
UINT VertexStreamZeroStride )
{
struct pipe_vertex_buffer vbuf;
- struct pipe_index_buffer ibuf;
DBG("iface %p, PrimitiveType %u, MinVertexIndex %u, NumVertices %u "
"PrimitiveCount %u, pIndexData %p, IndexDataFormat %u "
vbuf.stride = VertexStreamZeroStride;
vbuf.buffer_offset = 0;
- vbuf.buffer = NULL;
- vbuf.user_buffer = pVertexStreamZeroData;
+ vbuf.is_user_buffer = true;
+ vbuf.buffer.user = pVertexStreamZeroData;
- ibuf.index_size = (IndexDataFormat == D3DFMT_INDEX16) ? 2 : 4;
- ibuf.offset = 0;
- ibuf.buffer = NULL;
- ibuf.user_buffer = pIndexData;
+ unsigned index_size = (IndexDataFormat == D3DFMT_INDEX16) ? 2 : 4;
+ struct pipe_resource *ibuf = NULL;
if (!This->driver_caps.user_vbufs) {
const unsigned base = MinVertexIndex * VertexStreamZeroStride;
- u_upload_data(This->context.pipe->stream_uploader,
+ vbuf.is_user_buffer = false;
+ vbuf.buffer.resource = NULL;
+ u_upload_data(This->vertex_uploader,
base,
NumVertices * VertexStreamZeroStride, /* XXX */
4,
- (const uint8_t *)vbuf.user_buffer + base,
+ (const uint8_t *)pVertexStreamZeroData + base,
&vbuf.buffer_offset,
- &vbuf.buffer);
- u_upload_unmap(This->context.pipe->stream_uploader);
+ &vbuf.buffer.resource);
+ u_upload_unmap(This->vertex_uploader);
/* Won't be used: */
vbuf.buffer_offset -= base;
- vbuf.user_buffer = NULL;
}
+
+ unsigned index_offset = 0;
if (This->csmt_active) {
- u_upload_data(This->context.pipe->stream_uploader,
+ u_upload_data(This->pipe_secondary->stream_uploader,
0,
- (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * ibuf.index_size,
+ (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * index_size,
4,
- ibuf.user_buffer,
- &ibuf.offset,
- &ibuf.buffer);
- u_upload_unmap(This->context.pipe->stream_uploader);
- ibuf.user_buffer = NULL;
+ pIndexData,
+ &index_offset,
+ &ibuf);
+ u_upload_unmap(This->pipe_secondary->stream_uploader);
}
NineBeforeDraw(This);
NumVertices,
PrimitiveCount,
&vbuf,
- &ibuf);
+ ibuf,
+ ibuf ? NULL : (void*)pIndexData,
+ index_offset,
+ index_size);
NineAfterDraw(This);
- pipe_resource_reference(&vbuf.buffer, NULL);
- pipe_resource_reference(&ibuf.buffer, NULL);
+ pipe_vertex_buffer_unreference(&vbuf);
+ pipe_resource_reference(&ibuf, NULL);
NineDevice9_PauseRecording(This);
NineDevice9_SetIndices(This, NULL);
templ.bind = PIPE_BIND_STREAM_OUTPUT;
templ.usage = PIPE_USAGE_STREAM;
templ.height0 = templ.depth0 = templ.array_size = 1;
- templ.last_level = templ.nr_samples = 0;
+ templ.last_level = templ.nr_samples = templ.nr_storage_samples = 0;
resource = screen_sw->resource_create(screen_sw, &templ);
if (!resource)
draw.restart_index = 0;
draw.count_from_stream_output = NULL;
draw.indirect = NULL;
- draw.indirect_params = NULL;
draw.instance_count = 1;
- draw.indexed = FALSE;
+ draw.index_size = 0;
draw.start = 0;
draw.index_bias = 0;
draw.min_index = 0;