[PATCH 7/7] Display thumbnails only for calls that draw something

Dan McCabe zen3d.linux at gmail.com
Tue Jun 19 14:40:37 PDT 2012


On 06/19/2012 07:36 AM, José Fonseca wrote:
> Dan,
>
> Instead of name pattern matching, please use the CALL_FLAG_RENDER call
> flag to detect which calls draw anything.
>
> Currently the CALL_FLAG_RENDER flag is set on
> common/trace_parser_flags.cpp , also through pattern matching. Feel
> free to add more call names to common/trace_parser_flags.cpp if any is
> missing. The plan is to eventually code generate
> common/trace_parser_flags.cpp and have all these flags in the
> specs/*.py files.
>
> Jose
>
> On Fri, Jun 8, 2012 at 12:41 AM, Dan McCabe<zen3d.linux at gmail.com>  wrote:
>> Rather than accumulate all thumbnails that attempt to be drawn, this patch
>> filters out all calls that don't draw anything.
>>
>> The calls that draw selected are a superset of the calls that
>> SettingsDialog initializes and which is displayed by the dialog box opened
>> with "Trace | Options". There, the following calls are selected:
>>      glDraw
>>      glVertex
>>      glBegin
>>      glEnd
>>
>> To this collection of calls, this patch also selects thumbnails for:
>>    glClear
>>    glCallList
>> since the latter may result in drawing by a display list.
>>
>> To accomplish this filtering, the method isDrawCall() was added to
>> the class ApiTraceCall. This code is modelled upon similar code found
>> in ApiTraceFilter.
>> ---
>>   gui/apicalldelegate.cpp |    2 +-
>>   gui/apitracecall.cpp    |   20 ++++++++++++++++++++
>>   gui/apitracecall.h      |    2 ++
>>   3 files changed, 23 insertions(+), 1 deletions(-)
>>
>> diff --git a/gui/apicalldelegate.cpp b/gui/apicalldelegate.cpp
>> index 82b9721..2dba978 100644
>> --- a/gui/apicalldelegate.cpp
>> +++ b/gui/apicalldelegate.cpp
>> @@ -60,7 +60,7 @@ void ApiCallDelegate::paint(QPainter *painter,
>>              if (!thumbnail.isNull()) {
>>                  painter->drawImage(offset, thumbnail);
>>                  offset += QPoint(textSize.height() + thumbnail.width(), option.rect.height()/2 - textSize.height()/2);
>> -            } else {
>> +            } else if (call->isDrawCall()) {
>>                 call->missingThumbnail();
>>              }
>>              if (call->hasError()) {
>> diff --git a/gui/apitracecall.cpp b/gui/apitracecall.cpp
>> index 2450747..f458a67 100644
>> --- a/gui/apitracecall.cpp
>> +++ b/gui/apitracecall.cpp
>> @@ -1016,6 +1016,26 @@ void ApiTraceCall::missingThumbnail()
>>      m_parentFrame->parentTrace()->missingThumbnail(this);
>>   }
>>
>> +bool ApiTraceCall::isDrawCall() const
>> +{
>> +       QString function = m_signature->name();
>> +
>> +       if (function.contains(QLatin1String("glDraw"))) {
>> +               return true;
>> +       } else if (function.contains(QLatin1String("glVertex"))) {
>> +               return true;
>> +       } else if (function.contains(QLatin1String("glBegin"))) {
>> +               return true;
>> +       } else if (function.contains(QLatin1String("glEnd"))) {
>> +               return true;
>> +       } else if (function.contains(QLatin1String("glCallList"))) {
>> +               return true;
>> +       } else if (function.contains(QLatin1String("glClear"))) {
>> +               return true;
>> +       }
>> +
>> +       return false;
>> +}
>>
>>   ApiTraceFrame::ApiTraceFrame(ApiTrace *parentTrace)
>>      : ApiTraceEvent(ApiTraceEvent::Frame),
>> diff --git a/gui/apitracecall.h b/gui/apitracecall.h
>> index 345bba5..f222850 100644
>> --- a/gui/apitracecall.h
>> +++ b/gui/apitracecall.h
>> @@ -288,6 +288,8 @@ public:
>>      int binaryDataIndex() const;
>>
>>      void missingThumbnail();
>> +
>> +    bool isDrawCall() const;
>>   private:
>>      int m_index;
>>      ApiTraceCallSignature *m_signature;
>> --
>> 1.7.9.1
>>
>> _______________________________________________
>> apitrace mailing list
>> apitrace at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/apitrace

Thank you! I like that approach much better.

cheers, danm



More information about the apitrace mailing list