screen, info->type, PIPE_SHADER_CAP_##n)
HRESULT
-nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info)
+nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info, struct pipe_context *pipe)
{
struct shader_translator *tx;
HRESULT hr = D3D_OK;
const unsigned processor = info->type;
struct pipe_screen *screen = info->process_vertices ? device->screen_sw : device->screen;
- struct pipe_context *pipe = info->process_vertices ? device->pipe_sw : NineDevice9_GetPipe(device);
user_assert(processor != ~0, D3DERR_INVALIDCALL);
}
HRESULT
-nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *);
+nine_translate_shader(struct NineDevice9 *device,
+ struct nine_shader_info *,
+ struct pipe_context *);
struct nine_shader_variant
{
struct NineDevice9 *device;
struct nine_shader_info info;
+ struct pipe_context *pipe;
HRESULT hr;
DBG("This=%p pParams=%p pFunction=%p cso=%p\n", This, pParams, pFunction, cso);
return D3D_OK;
}
device = This->base.device;
+ pipe = NineDevice9_GetPipe(device);
info.type = PIPE_SHADER_FRAGMENT;
info.byte_code = pFunction;
info.projected = 0;
info.process_vertices = false;
- hr = nine_translate_shader(device, &info);
+ hr = nine_translate_shader(device, &info, pipe);
if (FAILED(hr))
return hr;
This->byte_code.version = info.version;
void *
NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
{
+ /* GetVariant is called from nine_context, thus we can
+ * get pipe directly */
+ struct pipe_context *pipe = This->base.device->context.pipe;
void *cso;
uint64_t key;
info.projected = (key >> 48) & 0xffff;
info.process_vertices = false;
- hr = nine_translate_shader(This->base.device, &info);
+ hr = nine_translate_shader(This->base.device, &info, pipe);
if (FAILED(hr))
return NULL;
nine_shader_variant_add(&This->variant, key, info.cso);
{
struct NineDevice9 *device;
struct nine_shader_info info;
+ struct pipe_context *pipe;
HRESULT hr;
unsigned i;
}
device = This->base.device;
+ pipe = NineDevice9_GetPipe(device);
info.type = PIPE_SHADER_VERTEX;
info.byte_code = pFunction;
info.swvp_on = !!(device->params.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING);
info.process_vertices = false;
- hr = nine_translate_shader(device, &info);
+ hr = nine_translate_shader(device, &info, pipe);
if (hr == D3DERR_INVALIDCALL &&
(device->params.BehaviorFlags & D3DCREATE_MIXED_VERTEXPROCESSING)) {
/* Retry with a swvp shader. It will require swvp to be on. */
info.swvp_on = true;
- hr = nine_translate_shader(device, &info);
+ hr = nine_translate_shader(device, &info, pipe);
}
if (hr == D3DERR_INVALIDCALL)
ERR("Encountered buggy shader\n");
void *
NineVertexShader9_GetVariant( struct NineVertexShader9 *This )
{
+ /* GetVariant is called from nine_context, thus we can
+ * get pipe directly */
+ struct pipe_context *pipe = This->base.device->context.pipe;
void *cso;
uint64_t key;
info.swvp_on = device->swvp;
info.process_vertices = false;
- hr = nine_translate_shader(This->base.device, &info);
+ hr = nine_translate_shader(This->base.device, &info, pipe);
if (FAILED(hr))
return NULL;
nine_shader_variant_add(&This->variant, key, info.cso);
info.swvp_on = true;
info.vdecl_out = vdecl_out;
info.process_vertices = true;
- hr = nine_translate_shader(This->base.device, &info);
+ hr = nine_translate_shader(This->base.device, &info, This->base.device->pipe_sw);
if (FAILED(hr))
return NULL;
*so = info.so;