summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/device9.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/nine/device9.c')
-rw-r--r--src/gallium/state_trackers/nine/device9.c53
1 files changed, 44 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index dce908e7f8f..7d4a2a9c4b0 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -263,6 +263,24 @@ NineDevice9_ctor( struct NineDevice9 *This,
nine_bind(&This->context.rt[i], This->state.rt[i]);
}
+ /* Initialize CSMT */
+ if (pCTX->csmt_force == 1)
+ This->csmt_active = true;
+ else if (pCTX->csmt_force == 0)
+ This->csmt_active = false;
+ else
+ /* r600 and radeonsi are thread safe. */
+ This->csmt_active = strstr(pScreen->get_name(pScreen), "AMD") != NULL;
+
+ if (This->csmt_active) {
+ This->csmt_ctx = nine_csmt_create(This);
+ if (!This->csmt_ctx)
+ return E_OUTOFMEMORY;
+ }
+
+ if (This->csmt_active)
+ DBG("\033[1;32mCSMT is active\033[0m\n");
+
/* Initialize a dummy VBO to be used when a vertex declaration does not
* specify all the inputs needed by vertex shader, on win default behavior
* is to pass 0,0,0,0 to the shader */
@@ -444,8 +462,8 @@ NineDevice9_ctor( struct NineDevice9 *This,
/* Allocate upload helper for drivers that suck (from st pov ;). */
- This->driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS);
- This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS);
+ This->driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS) && !This->csmt_active;
+ This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_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);
@@ -487,6 +505,8 @@ NineDevice9_ctor( struct NineDevice9 *This,
nine_state_init_sw(This);
ID3DPresentGroup_Release(This->present);
+ if (This->csmt_active)
+ nine_csmt_process(This);
return D3D_OK;
}
@@ -499,6 +519,13 @@ NineDevice9_dtor( struct NineDevice9 *This )
DBG("This=%p\n", This);
+ /* Do not call nine_csmt_process here. The device is dead! */
+ if (This->csmt_active && This->csmt_ctx) {
+ nine_csmt_destroy(This, This->csmt_ctx);
+ This->csmt_active = FALSE;
+ This->csmt_ctx = NULL;
+ }
+
nine_ff_fini(This);
nine_state_destroy_sw(This);
nine_state_clear(&This->state, TRUE);
@@ -564,7 +591,7 @@ NineDevice9_GetScreen( struct NineDevice9 *This )
struct pipe_context *
NineDevice9_GetPipe( struct NineDevice9 *This )
{
- return This->context.pipe;
+ return nine_context_get_pipe(This);
}
const D3DCAPS9 *
@@ -3251,7 +3278,9 @@ NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
pConstantData,
Vector4fCount * 4 * sizeof(state->vs_const_f[0]));
- nine_context_set_vertex_shader_constant_f(This, StartRegister, pConstantData, Vector4fCount);
+ nine_context_set_vertex_shader_constant_f(This, StartRegister, pConstantData,
+ Vector4fCount * 4 * sizeof(state->vs_const_f[0]),
+ Vector4fCount);
return D3D_OK;
}
@@ -3317,7 +3346,8 @@ NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
&This->range_pool);
state->changed.group |= NINE_STATE_VS_CONST;
} else
- nine_context_set_vertex_shader_constant_i(This, StartRegister, pConstantData, Vector4iCount);
+ nine_context_set_vertex_shader_constant_i(This, StartRegister, pConstantData,
+ Vector4iCount * sizeof(int[4]), Vector4iCount);
return D3D_OK;
}
@@ -3391,7 +3421,8 @@ NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
&This->range_pool);
state->changed.group |= NINE_STATE_VS_CONST;
} else
- nine_context_set_vertex_shader_constant_b(This, StartRegister, pConstantData, BoolCount);
+ nine_context_set_vertex_shader_constant_b(This, StartRegister, pConstantData,
+ sizeof(BOOL) * BoolCount, BoolCount);
return D3D_OK;
}
@@ -3655,7 +3686,9 @@ NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
pConstantData,
Vector4fCount * 4 * sizeof(state->ps_const_f[0]));
- nine_context_set_pixel_shader_constant_f(This, StartRegister, pConstantData, Vector4fCount);
+ nine_context_set_pixel_shader_constant_f(This, StartRegister, pConstantData,
+ Vector4fCount * 4 * sizeof(state->ps_const_f[0]),
+ Vector4fCount);
return D3D_OK;
}
@@ -3717,7 +3750,8 @@ NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
state->changed.ps_const_i |= ((1 << Vector4iCount) - 1) << StartRegister;
state->changed.group |= NINE_STATE_PS_CONST;
} else
- nine_context_set_pixel_shader_constant_i(This, StartRegister, pConstantData, Vector4iCount);
+ nine_context_set_pixel_shader_constant_i(This, StartRegister, pConstantData,
+ sizeof(state->ps_const_i[0]) * Vector4iCount, Vector4iCount);
return D3D_OK;
}
@@ -3785,7 +3819,8 @@ NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
state->changed.ps_const_b |= ((1 << BoolCount) - 1) << StartRegister;
state->changed.group |= NINE_STATE_PS_CONST;
} else
- nine_context_set_pixel_shader_constant_b(This, StartRegister, pConstantData, BoolCount);
+ nine_context_set_pixel_shader_constant_b(This, StartRegister, pConstantData,
+ sizeof(BOOL) * BoolCount, BoolCount);
return D3D_OK;
}