aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-13 12:53:07 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-13 12:53:07 +0000
commite98ade4fdee03a234f68669bea84d07db4a8527e (patch)
tree9a3480ac46cace0d773081b20965ea0597dc3cbb
parent357818cb76d9f8a6a74d1b2f9c91fb4c0b7a288c (diff)
Added Texture desc to render target
-rw-r--r--include/gpu/GrRenderTarget.h28
-rw-r--r--src/gpu/GrRenderTarget.cpp10
2 files changed, 19 insertions, 19 deletions
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index 909adb3e7d..4a2c254da2 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -37,18 +37,18 @@ public:
/**
* @return the width of the rendertarget
*/
- int width() const { return fWidth; }
+ int width() const { return fDesc.fWidth; }
/**
* @return the height of the rendertarget
*/
- int height() const { return fHeight; }
+ int height() const { return fDesc.fHeight; }
/**
* @return the pixel config. Can be kUnknown_GrPixelConfig
* if client asked us to render to a target that has a pixel
* config that isn't equivalent with one of our configs.
*/
- GrPixelConfig config() const { return fConfig; }
+ GrPixelConfig config() const { return fDesc.fConfig; }
/**
* @return the texture associated with the rendertarget, may be NULL.
@@ -72,12 +72,12 @@ public:
/**
* @return true if the render target is multisampled, false otherwise
*/
- bool isMultisampled() const { return 0 != fSampleCnt; }
+ bool isMultisampled() const { return 0 != fDesc.fSampleCnt; }
/**
* @return the number of samples-per-pixel or zero if non-MSAA.
*/
- int numSamples() const { return fSampleCnt; }
+ int numSamples() const { return fDesc.fSampleCnt; }
/**
* Call to indicate the multisample contents were modified such that the
@@ -180,12 +180,13 @@ protected:
int sampleCnt)
: INHERITED(gpu)
, fStencilBuffer(NULL)
- , fTexture(texture)
- , fWidth(width)
- , fHeight(height)
- , fConfig(config)
- , fSampleCnt(sampleCnt) {
+ , fTexture(texture) {
fResolveRect.setLargestInverted();
+
+ fDesc.fWidth = width;
+ fDesc.fHeight = height;
+ fDesc.fConfig = config;
+ fDesc.fSampleCnt = sampleCnt;
}
friend class GrTexture;
@@ -202,10 +203,9 @@ protected:
private:
GrStencilBuffer* fStencilBuffer;
GrTexture* fTexture; // not ref'ed
- int fWidth;
- int fHeight;
- GrPixelConfig fConfig;
- int fSampleCnt;
+
+ GrTextureDesc fDesc;
+
GrIRect fResolveRect;
typedef GrResource INHERITED;
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index ed1a018a02..be0844460e 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -52,15 +52,15 @@ void GrRenderTarget::resolve() {
size_t GrRenderTarget::sizeInBytes() const {
int colorBits;
- if (kUnknown_GrPixelConfig == fConfig) {
+ if (kUnknown_GrPixelConfig == fDesc.fConfig) {
colorBits = 32; // don't know, make a guess
} else {
- colorBits = GrBytesPerPixel(fConfig);
+ colorBits = GrBytesPerPixel(fDesc.fConfig);
}
- uint64_t size = fWidth;
- size *= fHeight;
+ uint64_t size = fDesc.fWidth;
+ size *= fDesc.fHeight;
size *= colorBits;
- size *= GrMax(1,fSampleCnt);
+ size *= GrMax(1, fDesc.fSampleCnt);
return (size_t)(size / 8);
}