aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLProgramDesc.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-01-14 09:24:09 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-14 09:24:09 -0800
commite5286e0b37abe4d0db67a6b3d87b2d5a12a70ab3 (patch)
tree506ce530275a41ca0561e0d00b3d535c58366b4e /src/gpu/gl/GrGLProgramDesc.cpp
parentfe09119dd2acb43bb9986e6edeef3a480b539473 (diff)
Beginning of support for texture rectangles.
Adds support for importing a RECTANGLE texture into Skia via GrTexureProvider::wrapBackendTexture(). Tests read/writing pixels, copySurface, and clear. Does not add support for texturing from a RECTANGLE texture as the coords will be incorrectly normalized. BUG=skia:3868 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1583863002 Review URL: https://codereview.chromium.org/1583863002
Diffstat (limited to 'src/gpu/gl/GrGLProgramDesc.cpp')
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 4c95e2b532..5edacf5721 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -7,12 +7,19 @@
#include "GrGLProgramDesc.h"
#include "GrProcessor.h"
-#include "GrGLGpu.h"
#include "GrPipeline.h"
#include "SkChecksum.h"
+#include "gl/GrGLDefines.h"
+#include "gl/GrGLTexture.h"
+#include "gl/GrGLTypes.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLCaps.h"
+static uint16_t texture_target_key(GrGLenum target) {
+ SkASSERT((uint32_t)target < SK_MaxU16);
+ return target;
+}
static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
const GrGLSLCaps& caps) {
@@ -25,10 +32,9 @@ static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count));
for (int i = 0; i < numTextures; ++i) {
const GrTextureAccess& access = proc.textureAccess(i);
- bool isExternal = (GR_GL_TEXTURE_EXTERNAL ==
- static_cast<GrGLTexture*>(access.getTexture())->target());
- k16[i] = caps.configTextureSwizzle(access.getTexture()->config()).asKey() |
- (isExternal ? 0xFF00 : 0x0000);
+ GrGLTexture* texture = static_cast<GrGLTexture*>(access.getTexture());
+ k16[i] = caps.configTextureSwizzle(texture->config()).asKey() |
+ (texture_target_key(texture->target()) << 16);
}
// zero the last 16 bits if the number of textures is odd.
if (numTextures & 0x1) {