Commit 7acd0617 authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Make the list of commands which require GL state restore explicit.

Make the list of commands which require consistent GL state in the
RasterDecoder explicit instead of defaulting to it for unhandled
commands. Its easy to add a new command and miss updating this list.
This makes sure you get a compile time error to avoid this.

R=piman@chromium.org

Bug: 894200
Change-Id: I71407d33c3339342d9ebf26b6ce94e475324a37e
Reviewed-on: https://chromium-review.googlesource.com/c/1308714
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604076}
parent 3bb4c578
...@@ -283,6 +283,10 @@ bool AllowedBetweenBeginEndRaster(CommandId command) { ...@@ -283,6 +283,10 @@ bool AllowedBetweenBeginEndRaster(CommandId command) {
// are completely indifferent to GL state. Others require that GL state // are completely indifferent to GL state. Others require that GL state
// matches GrContext state tracking. // matches GrContext state tracking.
bool PermitsInconsistentContextState(CommandId command) { bool PermitsInconsistentContextState(CommandId command) {
// Note that state restoration is expensive. If you're adding any new command
// which is frequently used between multiple RasterCHROMIUMs for tiled
// rasterization, make sure to add it to the whitelist below for commands
// which don't need consistent GL state.
switch (command) { switch (command) {
case kBeginQueryEXT: case kBeginQueryEXT:
case kBeginRasterCHROMIUMImmediate: case kBeginRasterCHROMIUMImmediate:
...@@ -302,10 +306,29 @@ bool PermitsInconsistentContextState(CommandId command) { ...@@ -302,10 +306,29 @@ bool PermitsInconsistentContextState(CommandId command) {
case kSetActiveURLCHROMIUM: case kSetActiveURLCHROMIUM:
case kUnlockTransferCacheEntryINTERNAL: case kUnlockTransferCacheEntryINTERNAL:
case kWaitSyncTokenCHROMIUM: case kWaitSyncTokenCHROMIUM:
case kTraceBeginCHROMIUM:
case kTraceEndCHROMIUM:
return true; return true;
default: case kGetIntegerv:
case kLoseContextCHROMIUM:
case kUnpremultiplyAndDitherCopyCHROMIUM:
case kCreateTexture:
case kSetColorSpaceMetadata:
case kProduceTextureDirectImmediate:
case kTexParameteri:
case kBindTexImage2DCHROMIUM:
case kReleaseTexImage2DCHROMIUM:
case kTexStorage2D:
case kCopySubTexture:
return false;
case kNumCommands:
case kOneBeforeStartPoint:
NOTREACHED();
return false; return false;
} }
NOTREACHED();
return false;
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment