Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: src/gpu/gl/GrGLRenderTarget.cpp

Issue 2225303002: Add flag for window rectangles to GrRenderTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add GrRenderTarget flag for window rectangles Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/gpu/vk/GrVkRenderTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLRenderTarget.h" 8 #include "GrGLRenderTarget.h"
9 9
10 #include "GrGLGpu.h" 10 #include "GrGLGpu.h"
11 #include "GrGLUtil.h" 11 #include "GrGLUtil.h"
12 #include "GrGpuResourcePriv.h" 12 #include "GrGpuResourcePriv.h"
13 #include "GrRenderTargetPriv.h" 13 #include "GrRenderTargetPriv.h"
14 #include "SkTraceMemoryDump.h" 14 #include "SkTraceMemoryDump.h"
15 15
16 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) 16 #define GPUGL static_cast<GrGLGpu*>(this->getGpu())
17 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) 17 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
18 18
19 // Because this class is virtually derived from GrSurface we must explicitly cal l its constructor. 19 // Because this class is virtually derived from GrSurface we must explicitly cal l its constructor.
20 // Constructor for wrapped render targets. 20 // Constructor for wrapped render targets.
21 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, 21 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu,
22 const GrSurfaceDesc& desc, 22 const GrSurfaceDesc& desc,
23 const IDDesc& idDesc, 23 const IDDesc& idDesc,
24 GrGLStencilAttachment* stencil) 24 GrGLStencilAttachment* stencil)
25 : GrSurface(gpu, desc) 25 : GrSurface(gpu, desc)
26 , INHERITED(gpu, desc, idDesc.fSampleConfig, stencil) { 26 , INHERITED(gpu, desc, ComputeFlags(gpu->glCaps(), idDesc), stencil) {
27 this->init(desc, idDesc); 27 this->init(desc, idDesc);
28 this->registerWithCacheWrapped(); 28 this->registerWithCacheWrapped();
29 } 29 }
30 30
31 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, 31 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc,
32 const IDDesc& idDesc) 32 const IDDesc& idDesc)
33 : GrSurface(gpu, desc) 33 : GrSurface(gpu, desc)
34 , INHERITED(gpu, desc, idDesc.fSampleConfig) { 34 , INHERITED(gpu, desc, ComputeFlags(gpu->glCaps(), idDesc)) {
35 this->init(desc, idDesc); 35 this->init(desc, idDesc);
36 } 36 }
37 37
38 inline GrRenderTarget::Flags GrGLRenderTarget::ComputeFlags(const GrGLCaps& glCa ps,
39 const IDDesc& idDesc ) {
40 Flags flags = Flags::kNone;
41 if (idDesc.fIsMixedSampled) {
42 SkASSERT(glCaps.usesMixedSamples() && idDesc.fRTFBOID); // FBO 0 can't b e mixed sampled.
43 flags |= Flags::kMixedSampled;
44 }
45 if (glCaps.maxWindowRectangles() > 0 && idDesc.fRTFBOID) {
46 flags |= Flags::kWindowRectsSupport;
47 }
48 return flags;
49 }
50
38 void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { 51 void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
39 fRTFBOID = idDesc.fRTFBOID; 52 fRTFBOID = idDesc.fRTFBOID;
40 fTexFBOID = idDesc.fTexFBOID; 53 fTexFBOID = idDesc.fTexFBOID;
41 fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID; 54 fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID;
42 fRTFBOOwnership = idDesc.fRTFBOOwnership; 55 fRTFBOOwnership = idDesc.fRTFBOOwnership;
43 56
44 fViewport.fLeft = 0; 57 fViewport.fLeft = 0;
45 fViewport.fBottom = 0; 58 fViewport.fBottom = 0;
46 fViewport.fWidth = desc.fWidth; 59 fViewport.fWidth = desc.fWidth;
47 fViewport.fHeight = desc.fHeight; 60 fViewport.fHeight = desc.fHeight;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 int GrGLRenderTarget::totalSamples() const { 230 int GrGLRenderTarget::totalSamples() const {
218 int total_samples = this->msaaSamples(); 231 int total_samples = this->msaaSamples();
219 232
220 if (fTexFBOID != kUnresolvableFBOID) { 233 if (fTexFBOID != kUnresolvableFBOID) {
221 // If we own the resolve buffer then that is one more sample per pixel. 234 // If we own the resolve buffer then that is one more sample per pixel.
222 total_samples += 1; 235 total_samples += 1;
223 } 236 }
224 237
225 return total_samples; 238 return total_samples;
226 } 239 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/gpu/vk/GrVkRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698