OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3060 void GrGLGpu::didRemoveGpuTraceMarker() { | 3060 void GrGLGpu::didRemoveGpuTraceMarker() { |
3061 if (this->caps()->gpuTracingSupport()) { | 3061 if (this->caps()->gpuTracingSupport()) { |
3062 #if GR_FORCE_GPU_TRACE_DEBUGGING | 3062 #if GR_FORCE_GPU_TRACE_DEBUGGING |
3063 SkDebugf("Pop trace marker.\n"); | 3063 SkDebugf("Pop trace marker.\n"); |
3064 #else | 3064 #else |
3065 GL_CALL(PopGroupMarker()); | 3065 GL_CALL(PopGroupMarker()); |
3066 #endif | 3066 #endif |
3067 } | 3067 } |
3068 } | 3068 } |
3069 | 3069 |
3070 GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h, | 3070 GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in
t h, |
3071 GrPixelConfig config) const { | 3071 GrPixelConfig config) const { |
3072 GrGLuint texID; | 3072 GrGLuint texID; |
3073 GL_CALL(GenTextures(1, &texID)); | 3073 GL_CALL(GenTextures(1, &texID)); |
3074 GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); | 3074 GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); |
3075 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); | 3075 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); |
3076 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, texID)); | 3076 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, texID)); |
3077 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAR
EST)); | 3077 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAR
EST)); |
3078 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAR
EST)); | 3078 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAR
EST)); |
3079 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO
_EDGE)); | 3079 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO
_EDGE)); |
3080 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO
_EDGE)); | 3080 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO
_EDGE)); |
3081 | 3081 |
3082 GrGLenum internalFormat = 0x0; // suppress warning | 3082 GrGLenum internalFormat = 0x0; // suppress warning |
3083 GrGLenum externalFormat = 0x0; // suppress warning | 3083 GrGLenum externalFormat = 0x0; // suppress warning |
3084 GrGLenum externalType = 0x0; // suppress warning | 3084 GrGLenum externalType = 0x0; // suppress warning |
3085 | 3085 |
3086 this->configToGLFormats(config, false, &internalFormat, &externalFormat, &ex
ternalType); | 3086 this->configToGLFormats(config, false, &internalFormat, &externalFormat, &ex
ternalType); |
3087 | 3087 |
3088 GL_CALL(TexImage2D(GR_GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFor
mat, | 3088 GL_CALL(TexImage2D(GR_GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFor
mat, |
3089 externalType, pixels)); | 3089 externalType, pixels)); |
3090 | 3090 |
3091 return texID; | 3091 return texID; |
3092 } | 3092 } |
3093 | 3093 |
3094 bool GrGLGpu::isBackendTexture(GrBackendObject id) const { | 3094 bool GrGLGpu::isTestingOnlyBackendTexture(GrBackendObject id) const { |
3095 GrGLuint texID = (GrGLuint)id; | 3095 GrGLuint texID = (GrGLuint)id; |
3096 | 3096 |
3097 GrGLboolean result; | 3097 GrGLboolean result; |
3098 GL_CALL_RET(result, IsTexture(texID)); | 3098 GL_CALL_RET(result, IsTexture(texID)); |
3099 | 3099 |
3100 return (GR_GL_TRUE == result); | 3100 return (GR_GL_TRUE == result); |
3101 } | 3101 } |
3102 | 3102 |
3103 void GrGLGpu::deleteBackendTexture(GrBackendObject id) const { | 3103 void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendObject id) const { |
3104 GrGLuint texID = (GrGLuint)id; | 3104 GrGLuint texID = (GrGLuint)id; |
3105 GL_CALL(DeleteTextures(1, &texID)); | 3105 GL_CALL(DeleteTextures(1, &texID)); |
3106 } | 3106 } |
3107 | 3107 |
3108 /////////////////////////////////////////////////////////////////////////////// | 3108 /////////////////////////////////////////////////////////////////////////////// |
3109 GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw( | 3109 GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw( |
3110 GrGLGpu* gpu, | 3110 GrGLGpu* gpu, |
3111 const GrGLVertexBuffer* vbuffer, | 3111 const GrGLVertexBuffer* vbuffer, |
3112 const GrGLIndexBuffer* ibuffer)
{ | 3112 const GrGLIndexBuffer* ibuffer)
{ |
3113 SkASSERT(vbuffer); | 3113 SkASSERT(vbuffer); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 this->setVertexArrayID(gpu, 0); | 3156 this->setVertexArrayID(gpu, 0); |
3157 } | 3157 } |
3158 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3158 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3159 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3159 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3160 fDefaultVertexArrayAttribState.resize(attrCount); | 3160 fDefaultVertexArrayAttribState.resize(attrCount); |
3161 } | 3161 } |
3162 attribState = &fDefaultVertexArrayAttribState; | 3162 attribState = &fDefaultVertexArrayAttribState; |
3163 } | 3163 } |
3164 return attribState; | 3164 return attribState; |
3165 } | 3165 } |
OLD | NEW |