[Mesa-dev] [PATCH 40/84] st/nine: Change the way nine_shader gets the pipe
Axel Davy
axel.davy at ens.fr
Wed Dec 7 22:55:13 UTC 2016
The change is required with csmt, where depending on the thread
you don't access the pipe the same way.
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
src/gallium/state_trackers/nine/nine_shader.c | 3 +--
src/gallium/state_trackers/nine/nine_shader.h | 4 +++-
src/gallium/state_trackers/nine/pixelshader9.c | 9 +++++++--
src/gallium/state_trackers/nine/vertexshader9.c | 13 +++++++++----
4 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index 1208f12..5effc2c 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -3464,13 +3464,12 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col)
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);
diff --git a/src/gallium/state_trackers/nine/nine_shader.h b/src/gallium/state_trackers/nine/nine_shader.h
index 72a28b8..8d98e9e 100644
--- a/src/gallium/state_trackers/nine/nine_shader.h
+++ b/src/gallium/state_trackers/nine/nine_shader.h
@@ -114,7 +114,9 @@ nine_info_mark_const_b_used(struct nine_shader_info *info, int idx)
}
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
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index 675b7b4..92980af 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -37,6 +37,7 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
{
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);
@@ -50,6 +51,7 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
return D3D_OK;
}
device = This->base.device;
+ pipe = NineDevice9_GetPipe(device);
info.type = PIPE_SHADER_FRAGMENT;
info.byte_code = pFunction;
@@ -61,7 +63,7 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
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;
@@ -140,6 +142,9 @@ NinePixelShader9_GetFunction( struct NinePixelShader9 *This,
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;
@@ -165,7 +170,7 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
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);
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c
index b1ee7ac..947831d 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.c
+++ b/src/gallium/state_trackers/nine/vertexshader9.c
@@ -39,6 +39,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This,
{
struct NineDevice9 *device;
struct nine_shader_info info;
+ struct pipe_context *pipe;
HRESULT hr;
unsigned i;
@@ -55,6 +56,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This,
}
device = This->base.device;
+ pipe = NineDevice9_GetPipe(device);
info.type = PIPE_SHADER_VERTEX;
info.byte_code = pFunction;
@@ -68,12 +70,12 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This,
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");
@@ -168,6 +170,9 @@ NineVertexShader9_GetFunction( struct NineVertexShader9 *This,
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;
@@ -192,7 +197,7 @@ NineVertexShader9_GetVariant( struct NineVertexShader9 *This )
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);
@@ -229,7 +234,7 @@ NineVertexShader9_GetVariantProcessVertices( struct NineVertexShader9 *This,
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;
--
2.10.2
More information about the mesa-dev
mailing list