From 0115f356eec22b30a78847ac47caebae4c436b68 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 18 Aug 2016 11:02:15 +0100 Subject: [PATCH] nouveau: Enable EXT_texture_env_dot3 on NV10 and NV20 GL_DOT3_RGB_EXT and GL_DOT3_RGBA_EXT. are nearly identical to GL_DOT3_RGB and GL_DOT3_RGBA. The only difference is the _EXT versions do not apply the post-scale. Just smash logscale to 0 so that RC_OUT_SCALE_1 is always used. NOTE: I have not actually tested this. Signed-off-by: Ian Romanick Acked-by: Ilia Mirkin --- src/mesa/drivers/dri/nouveau/nv10_context.c | 1 + src/mesa/drivers/dri/nouveau/nv10_state_frag.c | 16 +++++++++++++++- src/mesa/drivers/dri/nouveau/nv20_context.c | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 00a935880e0..7a86ba2358d 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -448,6 +448,7 @@ nv10_context_create(struct nouveau_screen *screen, gl_api api, ctx->Extensions.ARB_texture_env_crossbar = true; ctx->Extensions.ARB_texture_env_combine = true; ctx->Extensions.ARB_texture_env_dot3 = true; + ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.NV_fog_distance = true; ctx->Extensions.NV_texture_rectangle = true; if (ctx->Mesa_DXTn) { diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c index e78eac353bd..c6e4bb0d587 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c @@ -276,6 +276,20 @@ setup_combiner(struct combiner_state *rc) rc->out = RC_OUT_DOT_AB; break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + INPUT_ARG(rc, A, 0, NORMALIZE); + INPUT_ARG(rc, B, 1, NORMALIZE); + + rc->out = RC_OUT_DOT_AB; + + /* The EXT version of the DOT3 extension does not support the + * scale factor, but the ARB version (and the version in + * OpenGL 1.3) does. + */ + rc->logscale = 0; + break; + default: assert(0); } @@ -305,7 +319,7 @@ nv10_get_general_combiner(struct gl_context *ctx, int i, if (ctx->Texture.Unit[i]._Current) { INIT_COMBINER(RGB, ctx, &rc_c, i); - if (rc_c.mode == GL_DOT3_RGBA) + if (rc_c.mode == GL_DOT3_RGBA || rc_c.mode == GL_DOT3_RGBA_EXT) rc_a = rc_c; else INIT_COMBINER(A, ctx, &rc_a, i); diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index 14329a2326c..ec638c036b1 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_context.c +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c @@ -459,6 +459,7 @@ nv20_context_create(struct nouveau_screen *screen, gl_api api, ctx->Extensions.ARB_texture_env_crossbar = true; ctx->Extensions.ARB_texture_env_combine = true; ctx->Extensions.ARB_texture_env_dot3 = true; + ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.NV_fog_distance = true; ctx->Extensions.NV_texture_rectangle = true; if (ctx->Mesa_DXTn) { -- 2.30.2