Merge changes I87bf1147,I1bfc5656 into nyc-dev
authorMika Isojärvi <misojarvi@google.com>
Mon, 21 Mar 2016 21:14:05 +0000 (21:14 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Mon, 21 Mar 2016 21:14:05 +0000 (21:14 +0000)
am: 74c6692

* commit '74c669208e3b0778082cb5bf9787925fc61c24f3':
  Enable blending for floating point formats
  Always disable blending for 32bit float formats

modules/gles31/functional/es31fDrawBuffersIndexedTests.cpp

index a9948f3..171d05c 100644 (file)
@@ -661,7 +661,9 @@ rr::RenderState createRenderState (const BlendState& preCommonBlendState, const
        else
                state.fragOps.blendMode = rr::BLENDMODE_NONE;
 
-       if (tcu::getTextureChannelClass(info.getFormat().type) != tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT && tcu::getTextureChannelClass(info.getFormat().type) != tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT)
+       if (tcu::getTextureChannelClass(info.getFormat().type) != tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT
+               && tcu::getTextureChannelClass(info.getFormat().type) != tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT
+               && tcu::getTextureChannelClass(info.getFormat().type) != tcu::TEXTURECHANNELCLASS_FLOATING_POINT)
                state.fragOps.blendMode = rr::BLENDMODE_NONE;
 
        return state;
@@ -1357,6 +1359,32 @@ void genRandomTest (de::Random& rng, BlendState& preCommon, BlendState& postComm
                BlendState                      blendState;
 
                genRandomBlendState(rng, blendState);
+
+               // 32bit float formats don't support blending in GLES32
+               if (format.type == tcu::TextureFormat::FLOAT)
+               {
+                       // If format is 32bit float post common can't enable blending
+                       if (postCommon.enableBlend && *postCommon.enableBlend)
+                       {
+                               // Either don't set enable blend or disable blending
+                               if (rng.getBool())
+                                       postCommon.enableBlend = tcu::nothing<bool>();
+                               else
+                                       postCommon.enableBlend = tcu::just(false);
+                       }
+
+                       // If post common doesn't disable blending, per attachment state or
+                       // pre common must.
+                       if (!postCommon.enableBlend)
+                       {
+                               // If pre common enables blend per attachment must disable it
+                               // If per attachment state changes blend state it must disable it
+                               if ((preCommon.enableBlend && *preCommon.enableBlend)
+                                       || blendState.enableBlend)
+                                       blendState.enableBlend = tcu::just(false);
+                       }
+               }
+
                drawBuffers.push_back(DrawBufferInfo(render, size, blendState, format));
        }
 }