Mesa (staging/21.0): mesa: set states in fast path for restoring light attributes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 18 16:39:24 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: cb2aa9054ad66dbdaa8d76b6e359d56e22c824f8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb2aa9054ad66dbdaa8d76b6e359d56e22c824f8

Author: Neha Bhende <bhenden at vmware.com>
Date:   Tue Mar 16 15:48:31 2021 -0700

mesa: set states in fast path for restoring light attributes

Since states were not updated in fast path for restoring light attributes,
seen darker images in solidworks2012_viewprt.trace

Fixes regression seen with solidworks2012_viewport.trace

Fixes: 7fa9d9d06c4 ("mesa: add a fast path for restoring light attributes")

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9657>
(cherry picked from commit edbbf4537bf3a8b54afa5f0d73b04a8fa418154b)

---

 .pick_status.json      |  2 +-
 src/mesa/main/attrib.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3f78c79a9e3..ecd8d4aa41a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -292,7 +292,7 @@
         "description": "mesa: set states in fast path for restoring light attributes",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "7fa9d9d06c44e9cf3d39b2ce5126bf1b0abff586"
     },
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 2a3466eac80..062c92968d4 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -928,10 +928,16 @@ _mesa_PopAttrib(void)
 
          memcpy(ctx->Light.LightSource, attr->Light.LightSource,
                 sizeof(attr->Light.LightSource));
-         memcpy(&ctx->Light.Light, &attr->Light.Light,
-                sizeof(attr->Light.Light));
          memcpy(&ctx->Light.Model, &attr->Light.Model,
                 sizeof(attr->Light.Model));
+
+         for (i = 0; i < ctx->Const.MaxLights; i++) {
+            TEST_AND_UPDATE(ctx->Light.Light[i].Enabled,
+                            attr->Light.Light[i].Enabled,
+                            GL_LIGHT0 + i);
+            memcpy(&ctx->Light.Light[i], &attr->Light.Light[i],
+                   sizeof(struct gl_light));
+         }
       }
       /* shade model */
       TEST_AND_CALL1(Light.ShadeModel, ShadeModel);



More information about the mesa-commit mailing list