[Mesa-dev] [PATCH 01/43] st/nine: Explicit nine requirements

Ilia Mirkin imirkin at alum.mit.edu
Sat Jan 31 10:11:41 PST 2015


On Fri, Jan 30, 2015 at 3:34 PM, Axel Davy <axel.davy at ens.fr> wrote:
> This patch raises nine requirements and disables nine for old
> hw that don't match them.
>
> Currently for these cards only games that don't have tight requirements
> would work well with nine. However nine is missing several checks
> regarding these limitations.
> To make code and future patches less heavy, dropping support for these old
> card seems a good solution.
>
> That makes r500 the only dx9 generation cards supported by nine. It seems the one
> with the less limitations for nine. Still not everything is ok, and we'll have
> for example to implement shader recompilation for these cards to include
> integer and boolean constants in the shader.
> Eventually when this is done, we can reintroduce support for older cards.
>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
>  src/gallium/state_trackers/nine/adapter9.c | 106 +++++++++++++++++------------
>  src/gallium/state_trackers/nine/device9.c  |   9 +--
>  2 files changed, 66 insertions(+), 49 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
> index 481f863..bdf547e 100644
> --- a/src/gallium/state_trackers/nine/adapter9.c
> +++ b/src/gallium/state_trackers/nine/adapter9.c
> @@ -39,6 +39,7 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
>                     struct NineUnknownParams *pParams,
>                     struct d3dadapter9_context *pCTX )
>  {
> +    struct pipe_screen *hal = pCTX->hal;
>      HRESULT hr = NineUnknown_ctor(&This->base, pParams);
>      if (FAILED(hr)) { return hr; }
>
> @@ -46,7 +47,7 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
>      nine_dump_D3DADAPTER_IDENTIFIER9(DBG_CHANNEL, &pCTX->identifier);
>
>      This->ctx = pCTX;
> -    if (!This->ctx->hal->get_param(This->ctx->hal, PIPE_CAP_CLIP_HALFZ)) {
> +    if (!hal->get_param(hal, PIPE_CAP_CLIP_HALFZ)) {
>          ERR("Driver doesn't support d3d9 coordinates\n");
>          return D3DERR_DRIVERINTERNALERROR;
>      }
> @@ -54,7 +55,44 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
>          !This->ctx->ref->get_param(This->ctx->ref, PIPE_CAP_CLIP_HALFZ)) {
>          ERR("Warning: Sotware rendering driver doesn't support d3d9 coordinates\n");
>      }
> -
> +    /* Old cards had tricks to bypass some restrictions to implement
> +     * everything and fit tight the requirements: number of constants,
> +     * number of temp registers, special behaviours, etc. Since we don't
> +     * have access to all this, we need a bit more than what dx9 required.
> +     * For example we have to use more than 32 temp registers to emulate
> +     * behaviours, while some dx9 hw don't have more. As for sm2 hardware,
> +     * we could support vs2 / ps2 for them but it needs some more care, and
> +     * as these are very old, we choose to drop support for them */
> +
> +    /* checks minimum requirements, most are vs3/ps3 strict requirements */
> +    if (!hal->get_param(hal, PIPE_CAP_SM3) ||
> +        hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +                              PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) < 256 * sizeof(float[4]) ||
> +        hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +                              PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) < 244 * sizeof(float[4]) ||
> +        hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +                              PIPE_SHADER_CAP_MAX_TEMPS) < 32 ||
> +        hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +                              PIPE_SHADER_CAP_MAX_TEMPS) < 32 ||
> +        hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +                              PIPE_SHADER_CAP_MAX_INPUTS) < 16 ||
> +        hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +                              PIPE_SHADER_CAP_MAX_INPUTS) < 10) {
> +        ERR("Your card is not supported by Gallium Nine. Minimum requirement "
> +            "is >= r500, >= nv50, >= i965\n");

">= i965 gen6" i assume? alternatively ">= snb"?

Up to you...


> +        return D3DERR_DRIVERINTERNALERROR;
> +    }
> +    /* for r500 */
> +    if (hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +                              PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) < 276 * sizeof(float[4]) || /* we put bool and int constants with float constants */
> +        hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +                              PIPE_SHADER_CAP_MAX_TEMPS) < 40 || /* we use some more temp registers */
> +        hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +                              PIPE_SHADER_CAP_MAX_TEMPS) < 40 ||
> +        hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +                              PIPE_SHADER_CAP_MAX_INPUTS) < 20) /* we don't pack inputs as much as we could */
> +        ERR("Your card is at the limit of Gallium Nine requirements. Some games "
> +            "may run into issues because requirements are too tight\n");

Can't say this sentence makes much sense to me... if you're at the
limit of the requirements, that means you're fine. I'd say something
more along the lines of

"This hardware is only partially supported by nine, some software will
have rendering issues.\n"

Of course, the latter part of the statement is probably true of even
"fully" supported cards, so... perhaps just the first half of that
sentence.

Anyways,

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>


More information about the mesa-dev mailing list