[Cogl] [PATCH 0/3] Be more careful to disable GL_BLEND when possible

Robert Bragg robert at sixbynine.org
Thu May 30 07:40:32 PDT 2013


From: Robert Bragg <robert at linux.intel.com>

The other week Jasper St. Pierre asked about disabling blending in Cogl and our
reply was to use a blend string of "ADD(SRC_COLOR,0)" which semantically means
to ignore the destination color and so blending isn't required, which should
have been fine.

>From further discussion though it was noted that Cogl internally assumed that
using the GL blending equation ADD and setting the src and dest factors to 1
and 0 respectively would "do the right thing" and GL would know not to blend
even though we may not explicitly disable GL_BLEND. Based on this assumption
Cogl didn't bother disabling GL_BLEND if we assumed the driver should trivially
recognize that blending is effectively disabled.

After some time of being adamant this was safe for us to assume, I ended up
writing a small micro-benchmark to check and then having to eat my own words
once I realized that Mesa doesn't look out for this case.

This patch series is a follow up to that discussion and improves Cogl's own
checks for when to disable blending, makes sure we always explicitly disable
GL_BLEND if we recognize that blending is effectively disabled and adds a
conformance and unit test for the changes.

kind regards,
- Robert

Robert Bragg (3):
  pipeline: improve real_blend_enable checks
  conform: Add color attribute based blending test
  tests: Adds our first white-box unit test

 Makefile.am                                   |   2 +-
 cogl/Makefile.am                              |   8 +-
 cogl/cogl-attribute-private.h                 |   3 +
 cogl/cogl-attribute.c                         |   9 +
 cogl/cogl-context-private.h                   |   3 +-
 cogl/cogl-context.c                           |   2 +-
 cogl/cogl-pipeline-layer-state.c              |   8 +-
 cogl/cogl-pipeline-private.h                  |  22 +-
 cogl/cogl-pipeline-state.c                    |   8 +-
 cogl/cogl-pipeline.c                          | 250 ++++++++++++-------
 cogl/driver/gl/cogl-attribute-gl.c            |  28 +--
 cogl/driver/gl/cogl-clip-stack-gl.c           |   3 +-
 cogl/driver/gl/cogl-pipeline-opengl-private.h |   6 +-
 cogl/driver/gl/cogl-pipeline-opengl.c         | 128 +++++++---
 configure.ac                                  |  18 +-
 test-fixtures/test-utils.c                    | 342 ++++++++++++++++++++++++++
 test-fixtures/test-utils.h                    | 156 ++++++++++++
 tests/Makefile.am                             |  18 +-
 tests/config.env.in                           |   3 +
 tests/conform/Makefile.am                     |  11 +-
 tests/conform/config.env.in                   |   3 -
 tests/conform/run-tests.sh                    | 149 -----------
 tests/conform/test-blend.c                    |  64 +++++
 tests/conform/test-conform-main.c             |   1 +
 tests/conform/test-launcher.sh.in             |  33 ---
 tests/conform/test-utils.c                    | 325 ------------------------
 tests/conform/test-utils.h                    | 137 -----------
 tests/run-tests.sh                            | 149 +++++++++++
 tests/test-launcher.sh                        |  39 +++
 tests/unit/Makefile.am                        |  95 +++++++
 tests/unit/test-unit-main.c                   |  41 +++
 31 files changed, 1251 insertions(+), 813 deletions(-)
 create mode 100644 test-fixtures/test-utils.c
 create mode 100644 test-fixtures/test-utils.h
 create mode 100644 tests/config.env.in
 delete mode 100644 tests/conform/config.env.in
 delete mode 100755 tests/conform/run-tests.sh
 create mode 100644 tests/conform/test-blend.c
 delete mode 100755 tests/conform/test-launcher.sh.in
 delete mode 100644 tests/conform/test-utils.c
 delete mode 100644 tests/conform/test-utils.h
 create mode 100755 tests/run-tests.sh
 create mode 100755 tests/test-launcher.sh
 create mode 100644 tests/unit/Makefile.am
 create mode 100644 tests/unit/test-unit-main.c

-- 
1.8.2.1



More information about the Cogl mailing list