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 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2372 SkFAIL("Unknown draw face."); | 2372 SkFAIL("Unknown draw face."); |
2373 } | 2373 } |
2374 fHWDrawFace = face; | 2374 fHWDrawFace = face; |
2375 } | 2375 } |
2376 } | 2376 } |
2377 | 2377 |
2378 bool GrGLGpu::configToGLFormats(GrPixelConfig config, | 2378 bool GrGLGpu::configToGLFormats(GrPixelConfig config, |
2379 bool getSizedInternalFormat, | 2379 bool getSizedInternalFormat, |
2380 GrGLenum* internalFormat, | 2380 GrGLenum* internalFormat, |
2381 GrGLenum* externalFormat, | 2381 GrGLenum* externalFormat, |
2382 GrGLenum* externalType) { | 2382 GrGLenum* externalType) const { |
2383 GrGLenum dontCare; | 2383 GrGLenum dontCare; |
2384 if (NULL == internalFormat) { | 2384 if (NULL == internalFormat) { |
2385 internalFormat = &dontCare; | 2385 internalFormat = &dontCare; |
2386 } | 2386 } |
2387 if (NULL == externalFormat) { | 2387 if (NULL == externalFormat) { |
2388 externalFormat = &dontCare; | 2388 externalFormat = &dontCare; |
2389 } | 2389 } |
2390 if (NULL == externalType) { | 2390 if (NULL == externalType) { |
2391 externalType = &dontCare; | 2391 externalType = &dontCare; |
2392 } | 2392 } |
(...skipping 667 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, | |
robertphillips
2015/07/10 18:45:18
tab over ?
jvanverth1
2015/07/10 19:59:44
Done.
| |
3071 GrPixelConfig config) const { | |
3072 GrGLuint texID; | |
3073 GL_CALL(GenTextures(1, &texID)); | |
3074 GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); | |
3075 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); | |
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)); | |
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)); | |
3080 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO _EDGE)); | |
3081 | |
3082 GrGLenum internalFormat, externalFormat, externalType; | |
3083 this->configToGLFormats(config, false, &internalFormat, &externalFormat, &ex ternalType); | |
3084 | |
3085 GL_CALL(TexImage2D(GR_GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFor mat, | |
3086 externalType, pixels)); | |
3087 | |
3088 return texID; | |
3089 } | |
3090 | |
3091 bool GrGLGpu::isBackendTexture(GrBackendObject id) const { | |
3092 GrGLuint texID = (GrGLuint)id; | |
3093 | |
3094 GrGLboolean result; | |
3095 GL_CALL_RET(result, IsTexture(texID)); | |
3096 | |
3097 return (GR_GL_TRUE == result); | |
3098 } | |
3099 | |
3100 void GrGLGpu::deleteBackendTexture(GrBackendObject id) const { | |
3101 GrGLuint texID = (GrGLuint)id; | |
3102 GL_CALL(DeleteTextures(1, &texID)); | |
3103 } | |
3104 | |
3070 /////////////////////////////////////////////////////////////////////////////// | 3105 /////////////////////////////////////////////////////////////////////////////// |
3071 GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw( | 3106 GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw( |
3072 GrGLGpu* gpu, | 3107 GrGLGpu* gpu, |
3073 const GrGLVertexBuffer* vbuffer, | 3108 const GrGLVertexBuffer* vbuffer, |
3074 const GrGLIndexBuffer* ibuffer) { | 3109 const GrGLIndexBuffer* ibuffer) { |
3075 SkASSERT(vbuffer); | 3110 SkASSERT(vbuffer); |
3076 GrGLuint vbufferID = vbuffer->bufferID(); | 3111 GrGLuint vbufferID = vbuffer->bufferID(); |
3077 GrGLuint* ibufferIDPtr = NULL; | 3112 GrGLuint* ibufferIDPtr = NULL; |
3078 GrGLuint ibufferID; | 3113 GrGLuint ibufferID; |
3079 if (ibuffer) { | 3114 if (ibuffer) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3118 this->setVertexArrayID(gpu, 0); | 3153 this->setVertexArrayID(gpu, 0); |
3119 } | 3154 } |
3120 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3155 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3121 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3156 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3122 fDefaultVertexArrayAttribState.resize(attrCount); | 3157 fDefaultVertexArrayAttribState.resize(attrCount); |
3123 } | 3158 } |
3124 attribState = &fDefaultVertexArrayAttribState; | 3159 attribState = &fDefaultVertexArrayAttribState; |
3125 } | 3160 } |
3126 return attribState; | 3161 return attribState; |
3127 } | 3162 } |
OLD | NEW |