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

Side by Side Diff: include/gpu/GrCaps.h

Issue 1717393002: Add "sample locations" feature to GrProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_getmultisamp
Patch Set: comments Created 4 years, 9 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 | « no previous file | include/gpu/GrProcessor.h » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef GrCaps_DEFINED 8 #ifndef GrCaps_DEFINED
9 #define GrCaps_DEFINED 9 #define GrCaps_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrTypesPriv.h" 12 #include "GrTypesPriv.h"
13 #include "GrBlend.h" 13 #include "GrBlend.h"
14 #include "GrShaderVar.h" 14 #include "GrShaderVar.h"
15 #include "SkRefCnt.h" 15 #include "SkRefCnt.h"
16 #include "SkString.h" 16 #include "SkString.h"
17 #include "../../src/gpu/GrAllocator.h"
18 #include <functional>
17 19
18 struct GrContextOptions; 20 struct GrContextOptions;
19 21
20 class GrShaderCaps : public SkRefCnt { 22 class GrShaderCaps : public SkRefCnt {
21 public: 23 public:
22 /** Info about shader variable precision within a given shader stage. That i s, this info 24 /** Info about shader variable precision within a given shader stage. That i s, this info
23 is relevant to a float (or vecNf) variable declared with a GrSLPrecision 25 is relevant to a float (or vecNf) variable declared with a GrSLPrecision
24 in a given GrShaderType. The info here is hoisted from the OpenGL spec. */ 26 in a given GrShaderType. The info here is hoisted from the OpenGL spec. */
25 struct PrecisionInfo { 27 struct PrecisionInfo {
26 PrecisionInfo() { 28 PrecisionInfo() {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 bool supportsInstancedDraws() const { 253 bool supportsInstancedDraws() const {
252 return fSupportsInstancedDraws; 254 return fSupportsInstancedDraws;
253 } 255 }
254 256
255 bool fullClearIsFree() const { return fFullClearIsFree; } 257 bool fullClearIsFree() const { return fFullClearIsFree; }
256 258
257 /** True in environments that will issue errors if memory uploaded to buffer s 259 /** True in environments that will issue errors if memory uploaded to buffer s
258 is not initialized (even if not read by draw calls). */ 260 is not initialized (even if not read by draw calls). */
259 bool mustClearUploadedBufferData() const { return fMustClearUploadedBufferDa ta; } 261 bool mustClearUploadedBufferData() const { return fMustClearUploadedBufferDa ta; }
260 262
263 /** Info struct that contains hardware-specific multisample info. */
264 struct MultisampleSpecs {
265 /** Nonzero ID that uniquely identifies these multisample specs. */
266 uint8_t fUniqueID;
267 /** The actual number of samples the GPU will run. NOTE: this value can be greater than the
268 the render target's sample count. */
269 int fEffectiveSampleCnt;
270 /** If sample locations are supported, contains the subpixel locations a t which the GPU will
271 sample. Pixel center is at (.5, .5) and (0, 0) indicates the top lef t corner. */
272 SkAutoTDeleteArray<const SkPoint> fSampleLocations;
273 };
274
275 typedef std::function<void(int* effectiveSampleCnt, SkAutoTDeleteArray<SkPoi nt>* locations)>
276 QueryMultisampleFunctor;
277
278 /** Finds a surface descriptor's multisample specs. */
279 const MultisampleSpecs& getMultisampleSpecs(const GrSurfaceDesc&,
bsalomon 2016/03/07 19:10:06 I'm curious why this has to be on GrCaps (as oppos
Chris Dalton 2016/03/07 19:36:44 There's nothing platform specific about caching sa
280 const QueryMultisampleFunctor&) const;
281
282 /** Retrieves existing multisample specs. The provided uniqueID must have co me from a valid
283 MultisampleSpecs instance that was returned previously by this class. */
284 const MultisampleSpecs& getMultisampleSpecs(const uint8_t uniqueID) const;
285
261 protected: 286 protected:
262 /** Subclasses must call this at the end of their constructors in order to a pply caps 287 /** Subclasses must call this at the end of their constructors in order to a pply caps
263 overrides requested by the client. Note that overrides will only reduce the caps never 288 overrides requested by the client. Note that overrides will only reduce the caps never
264 expand them. */ 289 expand them. */
265 void applyOptionsOverrides(const GrContextOptions& options); 290 void applyOptionsOverrides(const GrContextOptions& options);
266 291
267 SkAutoTUnref<GrShaderCaps> fShaderCaps; 292 SkAutoTUnref<GrShaderCaps> fShaderCaps;
268 293
269 bool fNPOTTextureTileSupport : 1; 294 bool fNPOTTextureTileSupport : 1;
270 bool fMipMapSupport : 1; 295 bool fMipMapSupport : 1;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 int fMaxStencilSampleCount; 330 int fMaxStencilSampleCount;
306 int fMaxRasterSamples; 331 int fMaxRasterSamples;
307 332
308 private: 333 private:
309 virtual void onApplyOptionsOverrides(const GrContextOptions&) {}; 334 virtual void onApplyOptionsOverrides(const GrContextOptions&) {};
310 335
311 bool fSuppressPrints : 1; 336 bool fSuppressPrints : 1;
312 bool fImmediateFlush: 1; 337 bool fImmediateFlush: 1;
313 bool fDrawPathMasksToCompressedTextureSupport : 1; 338 bool fDrawPathMasksToCompressedTextureSupport : 1;
314 339
340 mutable SkTArray<const MultisampleSpecs*, true> fMultisampleSpecsMap;
341 mutable GrTAllocator<MultisampleSpecs> fMultisampleSpecsAllocator;
342
315 typedef SkRefCnt INHERITED; 343 typedef SkRefCnt INHERITED;
316 }; 344 };
317 345
318 #endif 346 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698