Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(407)

Issue 5543059: Add GrDrawState::reset() function (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by bsalomon
Modified:
12 years, 8 months ago
Reviewers:
TomH
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Patch Set 1 #

Patch Set 2 : remove accidentally included file #

Patch Set 3 : remove unnecessary casts #

Patch Set 4 : add back setting rendertarget in osaa #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -58 lines) Patch
M src/gpu/GrContext.cpp View 1 2 3 6 chunks +9 lines, -24 lines 2 comments Download
M src/gpu/GrDrawState.h View 1 2 5 chunks +58 lines, -34 lines 4 comments Download

Messages

Total messages: 3
bsalomon
This is mostly done to put reset in the "right" place as a member. But ...
12 years, 8 months ago (2012-01-14 19:40:59 UTC) #1
TomH
LGTM http://codereview.appspot.com/5543059/diff/2003/src/gpu/GrContext.cpp File src/gpu/GrContext.cpp (right): http://codereview.appspot.com/5543059/diff/2003/src/gpu/GrContext.cpp#newcode776 src/gpu/GrContext.cpp:776: *drawState->viewMatrix() = vm; Do we want to note ...
12 years, 8 months ago (2012-01-17 15:17:45 UTC) #2
bsalomon
12 years, 8 months ago (2012-01-17 16:02:05 UTC) #3
Closed with r3043.

http://codereview.appspot.com/5543059/diff/2003/src/gpu/GrContext.cpp
File src/gpu/GrContext.cpp (right):

http://codereview.appspot.com/5543059/diff/2003/src/gpu/GrContext.cpp#newcode776
src/gpu/GrContext.cpp:776: *drawState->viewMatrix() = vm;
On 2012/01/17 15:17:45, TomH wrote:
> Do we want to note that calling this->setPaint() with a default paint is
> equivalent to calling this->reset() & setting the viewMatrix? Or is it?

They aren't really equivalent. The GrPaint is a subset of the GrDrawState. There
are several differences (that happen not to matter here). This code was written
before there was any way to reset the GrDrawState (or even a GrDrawState at all)
and so used a default GrPaint to get to a known baseline state for most of the
draw state.

> 
> Is it significant that sometimes we do both and sometimes we do only one? Or I
> note that we frequently call reset() and setRenderTarget() as a pair; should
> those be combined? Here we set the viewMatrix to something different, which
> seems like an unusual use case?

We might want to have a reset that takes a rt and vm since these frequently set
right after reset.  I experimented with a flag on reset to preserve the rt and
vm but the conditional added a measurable slow down.

http://codereview.appspot.com/5543059/diff/2003/src/gpu/GrDrawState.h
File src/gpu/GrDrawState.h (right):

http://codereview.appspot.com/5543059/diff/2003/src/gpu/GrDrawState.h#newcode56
src/gpu/GrDrawState.h:56: void reset() {
On 2012/01/17 15:17:45, TomH wrote:
> Could we not inline this?

Isn't it inline? (this is a header file)
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b