diff options
author | Axel Davy <[email protected]> | 2016-09-17 14:16:41 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-10-10 23:43:49 +0200 |
commit | 3bf02d383fe94a69dfec3ff54ede3e3b2e9dff6b (patch) | |
tree | fc45cd758c5ceffcbe95f053430a1a778ecf9c8f /src/gallium/state_trackers/nine/vertexshader9.c | |
parent | f8c8f4424405c4789a044470e64df810720358c8 (diff) |
st/nine: Partial software vertex processing support
Software Vertex Processing allows:
. Less limitations for shaders (more loops, etc)
. Less limitations for ff (more enabled lights, 255
matrices for VertexBlend)
In particular shaders can get more constants.
This patch implements support for this (not using software
rendering, but hardware rendering, as llvmpipe and dx10+ hw
have the same limits...)
This is considered a second class path. Even apps asking for
"Mixed Vertex processing" (ie the ability to switch to swvp
on demand) do not use the feature much. Some just initialize
more constants than the normal limit at the start of the
application, but never use more than the normal limit.
When the apps do not need the software vertex processing
features, they do not seem to turn it on. This means it is
ok if that path is slow.
Thus no care has been made to make the path optimized.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/vertexshader9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/vertexshader9.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c index bc09a413fab..92f8f6bb581 100644 --- a/src/gallium/state_trackers/nine/vertexshader9.c +++ b/src/gallium/state_trackers/nine/vertexshader9.c @@ -63,12 +63,21 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This, info.fog_enable = 0; info.point_size_min = 0; info.point_size_max = 0; - info.swvp_on = false; + info.swvp_on = !!(device->params.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING); hr = nine_translate_shader(device, &info); + 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); + } + if (hr == D3DERR_INVALIDCALL) + ERR("Encountered buggy shader\n"); if (FAILED(hr)) return hr; This->byte_code.version = info.version; + This->swvp_only = info.swvp_on; This->byte_code.tokens = mem_dup(pFunction, info.byte_size); if (!This->byte_code.tokens) @@ -77,7 +86,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This, This->variant.cso = info.cso; This->last_cso = info.cso; - This->last_key = 0; + This->last_key = (uint32_t) (info.swvp_on << 9); This->const_used_size = info.const_used_size; This->lconstf = info.lconstf; @@ -168,7 +177,7 @@ NineVertexShader9_GetVariant( struct NineVertexShader9 *This ) info.fog_enable = device->state.rs[D3DRS_FOGENABLE]; info.point_size_min = asfloat(device->state.rs[D3DRS_POINTSIZE_MIN]); info.point_size_max = asfloat(device->state.rs[D3DRS_POINTSIZE_MAX]); - info.swvp_on = false; + info.swvp_on = device->swvp; hr = nine_translate_shader(This->base.device, &info); if (FAILED(hr)) |