aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2015-07-13 07:19:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-13 07:19:57 -0700
commit672bb7fc6640e3fc68107354ed4ae45a2a1e2d29 (patch)
treebc9247fd24909a5dd3c38e2114ba1628126da130 /src/gpu/gl
parentab9cb427f45cdd51a5f8f6df9c19e955e555fc13 (diff)
Remove GL-specific code from GMs and tests
TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/1232173002
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp40
-rw-r--r--src/gpu/gl/GrGLGpu.h7
2 files changed, 45 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 626a72f936..e185ef01a5 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2379,7 +2379,7 @@ bool GrGLGpu::configToGLFormats(GrPixelConfig config,
bool getSizedInternalFormat,
GrGLenum* internalFormat,
GrGLenum* externalFormat,
- GrGLenum* externalType) {
+ GrGLenum* externalType) const {
GrGLenum dontCare;
if (NULL == internalFormat) {
internalFormat = &dontCare;
@@ -3067,6 +3067,44 @@ void GrGLGpu::didRemoveGpuTraceMarker() {
}
}
+GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h,
+ GrPixelConfig config) const {
+ GrGLuint texID;
+ GL_CALL(GenTextures(1, &texID));
+ GL_CALL(ActiveTexture(GR_GL_TEXTURE0));
+ GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1));
+ GL_CALL(BindTexture(GR_GL_TEXTURE_2D, texID));
+ GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST));
+ GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST));
+ GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_EDGE));
+ GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_EDGE));
+
+ GrGLenum internalFormat = 0x0; // suppress warning
+ GrGLenum externalFormat = 0x0; // suppress warning
+ GrGLenum externalType = 0x0; // suppress warning
+
+ this->configToGLFormats(config, false, &internalFormat, &externalFormat, &externalType);
+
+ GL_CALL(TexImage2D(GR_GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFormat,
+ externalType, pixels));
+
+ return texID;
+}
+
+bool GrGLGpu::isBackendTexture(GrBackendObject id) const {
+ GrGLuint texID = (GrGLuint)id;
+
+ GrGLboolean result;
+ GL_CALL_RET(result, IsTexture(texID));
+
+ return (GR_GL_TRUE == result);
+}
+
+void GrGLGpu::deleteBackendTexture(GrBackendObject id) const {
+ GrGLuint texID = (GrGLuint)id;
+ GL_CALL(DeleteTextures(1, &texID));
+}
+
///////////////////////////////////////////////////////////////////////////////
GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw(
GrGLGpu* gpu,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index e5cd7a9a9d..368bda1797 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -112,6 +112,11 @@ public:
return &this->glContext();
}
+ GrBackendObject createBackendTexture(void* pixels, int w, int h,
+ GrPixelConfig config) const override;
+ bool isBackendTexture(GrBackendObject id) const override;
+ void deleteBackendTexture(GrBackendObject id) const override;
+
private:
GrGLGpu(GrGLContext* ctx, GrContext* context);
@@ -265,7 +270,7 @@ private:
bool getSizedInternal,
GrGLenum* internalFormat,
GrGLenum* externalFormat,
- GrGLenum* externalType);
+ GrGLenum* externalType) const;
// helper for onCreateTexture and writeTexturePixels
bool uploadTexData(const GrSurfaceDesc& desc,
bool isNewTexture,