[Mesa-dev,1/7] intel: support factors for min/max blending

Submitted by Maxence Le Doré on Jan. 3, 2014, 1:18 a.m.

Details

Message ID 1388711906-4910-1-git-send-email-maxence.ledore@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Maxence Le Doré Jan. 3, 2014, 1:18 a.m.
---
 src/mesa/drivers/dri/i915/i830_state.c | 12 ++++++++++++
 src/mesa/drivers/dri/i965/brw_util.c   | 24 +++++++++++++-----------
 2 files changed, 25 insertions(+), 11 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
index bbf0cef..6a5db43 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -303,10 +303,16 @@  i830_set_blend_state(struct gl_context * ctx)
       eqnRGB = BLENDFUNC_MIN;
       funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
       break;
+   case GL_FACTOR_MIN_AMD:
+      eqnRGB = BLENDFUNC_MIN;
+      break;
    case GL_MAX:
       eqnRGB = BLENDFUNC_MAX;
       funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
       break;
+   case GL_FACTOR_MAX_AMD:
+      eqnRGB = BLENDFUNC_MAX;
+      break;
    case GL_FUNC_SUBTRACT:
       eqnRGB = BLENDFUNC_SUB;
       break;
@@ -331,10 +337,16 @@  i830_set_blend_state(struct gl_context * ctx)
       eqnA = BLENDFUNC_MIN;
       funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
       break;
+   case GL_FACTOR_MIN_AMD:
+      eqnA = BLENDFUNC_MIN;
+      break;
    case GL_MAX:
       eqnA = BLENDFUNC_MAX;
       funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
       break;
+   case GL_FACTOR_MAX_AMD:
+      eqnA = BLENDFUNC_MAX;
+      break;
    case GL_FUNC_SUBTRACT:
       eqnA = BLENDFUNC_SUB;
       break;
diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c
index 4a303cd..292b7e5 100644
--- a/src/mesa/drivers/dri/i965/brw_util.c
+++ b/src/mesa/drivers/dri/i965/brw_util.c
@@ -40,17 +40,19 @@ 
 GLuint brw_translate_blend_equation( GLenum mode )
 {
    switch (mode) {
-   case GL_FUNC_ADD:
-      return BRW_BLENDFUNCTION_ADD;
-   case GL_MIN:
-      return BRW_BLENDFUNCTION_MIN;
-   case GL_MAX:
-      return BRW_BLENDFUNCTION_MAX;
-   case GL_FUNC_SUBTRACT:
-      return BRW_BLENDFUNCTION_SUBTRACT;
-   case GL_FUNC_REVERSE_SUBTRACT:
-      return BRW_BLENDFUNCTION_REVERSE_SUBTRACT;
-   default:
+   case GL_FUNC_ADD: 
+      return BRW_BLENDFUNCTION_ADD; 
+   case GL_MIN: 
+   case GL_FACTOR_MIN_AMD:
+      return BRW_BLENDFUNCTION_MIN; 
+   case GL_MAX: 
+   case GL_FACTOR_MAX_AMD:
+      return BRW_BLENDFUNCTION_MAX; 
+   case GL_FUNC_SUBTRACT: 
+      return BRW_BLENDFUNCTION_SUBTRACT; 
+   case GL_FUNC_REVERSE_SUBTRACT: 
+      return BRW_BLENDFUNCTION_REVERSE_SUBTRACT; 
+   default: 
       assert(0);
       return BRW_BLENDFUNCTION_ADD;
    }

Comments

On 01/02/2014 05:18 PM, Maxence Le Doré wrote:
> ---
>  src/mesa/drivers/dri/i915/i830_state.c | 12 ++++++++++++
>  src/mesa/drivers/dri/i965/brw_util.c   | 24 +++++++++++++-----------
>  2 files changed, 25 insertions(+), 11 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
> index bbf0cef..6a5db43 100644
> --- a/src/mesa/drivers/dri/i915/i830_state.c
> +++ b/src/mesa/drivers/dri/i915/i830_state.c

i915_state.c should get the same treatment.

> @@ -303,10 +303,16 @@ i830_set_blend_state(struct gl_context * ctx)
>        eqnRGB = BLENDFUNC_MIN;
>        funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>        break;
> +   case GL_FACTOR_MIN_AMD:
> +      eqnRGB = BLENDFUNC_MIN;
> +      break;
>     case GL_MAX:
>        eqnRGB = BLENDFUNC_MAX;
>        funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>        break;
> +   case GL_FACTOR_MAX_AMD:
> +      eqnRGB = BLENDFUNC_MAX;
> +      break;
>     case GL_FUNC_SUBTRACT:
>        eqnRGB = BLENDFUNC_SUB;
>        break;
> @@ -331,10 +337,16 @@ i830_set_blend_state(struct gl_context * ctx)
>        eqnA = BLENDFUNC_MIN;
>        funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>        break;
> +   case GL_FACTOR_MIN_AMD:
> +      eqnA = BLENDFUNC_MIN;
> +      break;
>     case GL_MAX:
>        eqnA = BLENDFUNC_MAX;
>        funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>        break;
> +   case GL_FACTOR_MAX_AMD:
> +      eqnA = BLENDFUNC_MAX;
> +      break;
>     case GL_FUNC_SUBTRACT:
>        eqnA = BLENDFUNC_SUB;
>        break;
> diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c
> index 4a303cd..292b7e5 100644
> --- a/src/mesa/drivers/dri/i965/brw_util.c
> +++ b/src/mesa/drivers/dri/i965/brw_util.c
> @@ -40,17 +40,19 @@
>  GLuint brw_translate_blend_equation( GLenum mode )
>  {
>     switch (mode) {
> -   case GL_FUNC_ADD:
> -      return BRW_BLENDFUNCTION_ADD;
> -   case GL_MIN:
> -      return BRW_BLENDFUNCTION_MIN;
> -   case GL_MAX:
> -      return BRW_BLENDFUNCTION_MAX;
> -   case GL_FUNC_SUBTRACT:
> -      return BRW_BLENDFUNCTION_SUBTRACT;
> -   case GL_FUNC_REVERSE_SUBTRACT:
> -      return BRW_BLENDFUNCTION_REVERSE_SUBTRACT;
> -   default:
> +   case GL_FUNC_ADD: 
> +      return BRW_BLENDFUNCTION_ADD; 
> +   case GL_MIN: 
> +   case GL_FACTOR_MIN_AMD:
> +      return BRW_BLENDFUNCTION_MIN; 
> +   case GL_MAX: 
> +   case GL_FACTOR_MAX_AMD:
> +      return BRW_BLENDFUNCTION_MAX; 
> +   case GL_FUNC_SUBTRACT: 
> +      return BRW_BLENDFUNCTION_SUBTRACT; 
> +   case GL_FUNC_REVERSE_SUBTRACT: 
> +      return BRW_BLENDFUNCTION_REVERSE_SUBTRACT; 
> +   default: 
>        assert(0);
>        return BRW_BLENDFUNCTION_ADD;
>     }
>
Thanks Ian, I got this after a rebase. Didn't know were it comes from.

2014/1/6 Ian Romanick <idr@freedesktop.org>:
> On 01/02/2014 05:18 PM, Maxence Le Doré wrote:
>> ---
>>  src/mesa/drivers/dri/i915/i830_state.c | 12 ++++++++++++
>>  src/mesa/drivers/dri/i965/brw_util.c   | 24 +++++++++++++-----------
>>  2 files changed, 25 insertions(+), 11 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
>> index bbf0cef..6a5db43 100644
>> --- a/src/mesa/drivers/dri/i915/i830_state.c
>> +++ b/src/mesa/drivers/dri/i915/i830_state.c
>
> i915_state.c should get the same treatment.
>
>> @@ -303,10 +303,16 @@ i830_set_blend_state(struct gl_context * ctx)
>>        eqnRGB = BLENDFUNC_MIN;
>>        funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>>        break;
>> +   case GL_FACTOR_MIN_AMD:
>> +      eqnRGB = BLENDFUNC_MIN;
>> +      break;
>>     case GL_MAX:
>>        eqnRGB = BLENDFUNC_MAX;
>>        funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>>        break;
>> +   case GL_FACTOR_MAX_AMD:
>> +      eqnRGB = BLENDFUNC_MAX;
>> +      break;
>>     case GL_FUNC_SUBTRACT:
>>        eqnRGB = BLENDFUNC_SUB;
>>        break;
>> @@ -331,10 +337,16 @@ i830_set_blend_state(struct gl_context * ctx)
>>        eqnA = BLENDFUNC_MIN;
>>        funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>>        break;
>> +   case GL_FACTOR_MIN_AMD:
>> +      eqnA = BLENDFUNC_MIN;
>> +      break;
>>     case GL_MAX:
>>        eqnA = BLENDFUNC_MAX;
>>        funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
>>        break;
>> +   case GL_FACTOR_MAX_AMD:
>> +      eqnA = BLENDFUNC_MAX;
>> +      break;
>>     case GL_FUNC_SUBTRACT:
>>        eqnA = BLENDFUNC_SUB;
>>        break;
>> diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c
>> index 4a303cd..292b7e5 100644
>> --- a/src/mesa/drivers/dri/i965/brw_util.c
>> +++ b/src/mesa/drivers/dri/i965/brw_util.c
>> @@ -40,17 +40,19 @@
>>  GLuint brw_translate_blend_equation( GLenum mode )
>>  {
>>     switch (mode) {
>> -   case GL_FUNC_ADD:
>> -      return BRW_BLENDFUNCTION_ADD;
>> -   case GL_MIN:
>> -      return BRW_BLENDFUNCTION_MIN;
>> -   case GL_MAX:
>> -      return BRW_BLENDFUNCTION_MAX;
>> -   case GL_FUNC_SUBTRACT:
>> -      return BRW_BLENDFUNCTION_SUBTRACT;
>> -   case GL_FUNC_REVERSE_SUBTRACT:
>> -      return BRW_BLENDFUNCTION_REVERSE_SUBTRACT;
>> -   default:
>> +   case GL_FUNC_ADD:
>> +      return BRW_BLENDFUNCTION_ADD;
>> +   case GL_MIN:
>> +   case GL_FACTOR_MIN_AMD:
>> +      return BRW_BLENDFUNCTION_MIN;
>> +   case GL_MAX:
>> +   case GL_FACTOR_MAX_AMD:
>> +      return BRW_BLENDFUNCTION_MAX;
>> +   case GL_FUNC_SUBTRACT:
>> +      return BRW_BLENDFUNCTION_SUBTRACT;
>> +   case GL_FUNC_REVERSE_SUBTRACT:
>> +      return BRW_BLENDFUNCTION_REVERSE_SUBTRACT;
>> +   default:
>>        assert(0);
>>        return BRW_BLENDFUNCTION_ADD;
>>     }
>>
>