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

Unified Diff: src/gpu/GrGpu.h

Issue 1260293004: Revert of Move draw on upload decision in GrGpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.h
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 8bb676d77994f8d1a1417f3c3d272f628ebea9aa..857efd0d65623d8d3dabdaa98521df62d07d115a 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -133,7 +133,7 @@
*/
void resolveRenderTarget(GrRenderTarget* target);
- /** Info struct returned by getReadPixelsInfo about performing intermediate draws before
+ /** Info struct returned by getReadPixelsInfo about performing intermediate draws before
reading pixels for performance or correctness. */
struct ReadPixelTempDrawInfo {
/** If the GrGpu is requesting that the caller do a draw to an intermediate surface then
@@ -173,39 +173,28 @@
kRequireDraw_DrawPreference
};
- /**
- * Used to negotiate whether and how an intermediate draw should or must be performed before
- * a readPixels call. If this returns false then GrGpu could not deduce an intermediate draw
- * that would allow a successful readPixels call. The passed width, height, and rowBytes,
- * must be non-zero and already reflect clipping to the src bounds.
- */
- bool getReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
- GrPixelConfig readConfig, DrawPreference*, ReadPixelTempDrawInfo*);
-
- /** Info struct returned by getWritePixelsInfo about performing an intermediate draw in order
- to write pixels to a GrSurface for either performance or correctness reasons. */
- struct WritePixelTempDrawInfo {
- /** If the GrGpu is requesting that the caller upload to an intermediate surface and draw
- that to the dst then this is the descriptor for the intermediate surface. The caller
- should upload the pixels such that the upper left pixel of the upload rect is at 0,0 in
- the intermediate surface.*/
- GrSurfaceDesc fTempSurfaceDesc;
- /** If set, fTempSurfaceDesc's config will be a R/B swap of the src pixel config. The caller
- should upload the pixels as is such that R and B will be swapped in the intermediate
- surface. When the intermediate is drawn to the dst the shader should swap R/B again
- such that the correct swizzle results in the dst. This is done to work around either
- performance or API restrictions in the backend 3D API implementation. */
- bool fSwapRAndB;
- };
-
- /**
- * Used to negotiate whether and how an intermediate surface should be used to write pixels to
- * a GrSurface. If this returns false then GrGpu could not deduce an intermediate draw
- * that would allow a successful transfer of the src pixels to the dst. The passed width,
- * height, and rowBytes, must be non-zero and already reflect clipping to the dst bounds.
- */
- bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes,
- GrPixelConfig srcConfig, DrawPreference*, WritePixelTempDrawInfo*);
+ /** Used to negotiates whether and how an intermediate draw should or must be performed before
+ a readPixels call. If this returns false then GrGpu could not deduce an intermediate draw
+ that would allow a successful readPixels call. */
+ virtual bool getReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight,
+ size_t rowBytes, GrPixelConfig readConfig, DrawPreference*,
+ ReadPixelTempDrawInfo *) = 0;
+
+ /**
+ * Gets a preferred 8888 config to use for writing pixel data to a surface with
+ * config surfaceConfig. The returned config must have at least as many bits per channel as the
+ * writeConfig param.
+ */
+ virtual GrPixelConfig preferredWritePixelsConfig(GrPixelConfig writeConfig,
+ GrPixelConfig surfaceConfig) const {
+ return writeConfig;
+ }
+
+ /**
+ * Called before uploading writing pixels to a GrTexture when the src pixel config doesn't
+ * match the texture's config.
+ */
+ virtual bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const = 0;
/**
* Reads a rectangle of pixels from a render target.
@@ -412,16 +401,6 @@
unsigned int* ref,
unsigned int* mask);
- static void ElevateDrawPreference(GrGpu::DrawPreference* preference,
- GrGpu::DrawPreference elevation) {
- GR_STATIC_ASSERT(GrGpu::kCallerPrefersDraw_DrawPreference > GrGpu::kNoDraw_DrawPreference);
- GR_STATIC_ASSERT(GrGpu::kGpuPrefersDraw_DrawPreference >
- GrGpu::kCallerPrefersDraw_DrawPreference);
- GR_STATIC_ASSERT(GrGpu::kRequireDraw_DrawPreference >
- GrGpu::kGpuPrefersDraw_DrawPreference);
- *preference = SkTMax(*preference, elevation);
- }
-
const GrTraceMarkerSet& getActiveTraceMarkers() const { return fActiveTraceMarkers; }
Stats fStats;
@@ -461,13 +440,6 @@
// overridden by backend-specific derived class to perform the draw call.
virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0;
- virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight,
- size_t rowBytes, GrPixelConfig readConfig, DrawPreference*,
- ReadPixelTempDrawInfo*) = 0;
- virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes,
- GrPixelConfig srcConfig, DrawPreference*,
- WritePixelTempDrawInfo*) = 0;
-
virtual bool onReadPixels(GrRenderTarget* target,
int left, int top, int width, int height,
GrPixelConfig,
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698