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 "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
10 #include "GrGLTestInterface.h" | 10 #include "GrGLTestInterface.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 break; | 316 break; |
317 case GR_GL_QUERY_COUNTER_BITS: | 317 case GR_GL_QUERY_COUNTER_BITS: |
318 *params = 32; | 318 *params = 32; |
319 break; | 319 break; |
320 default: | 320 default: |
321 SkFAIL("Unexpected pname passed GetQueryiv."); | 321 SkFAIL("Unexpected pname passed GetQueryiv."); |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
325 GrGLvoid getQueryObjecti64v(GrGLuint id, GrGLenum pname, GrGLint64 *params)
override { | 325 GrGLvoid getQueryObjecti64v(GrGLuint id, GrGLenum pname, GrGLint64 *params)
override { |
326 queryResult(id, pname, params); | 326 this->queryResult(id, pname, params); |
327 } | 327 } |
328 | 328 |
329 GrGLvoid getQueryObjectiv(GrGLuint id, GrGLenum pname, GrGLint *params) over
ride { | 329 GrGLvoid getQueryObjectiv(GrGLuint id, GrGLenum pname, GrGLint *params) over
ride { |
330 queryResult(id, pname, params); | 330 this->queryResult(id, pname, params); |
331 } | 331 } |
332 | 332 |
333 GrGLvoid getQueryObjectui64v(GrGLuint id, GrGLenum pname, GrGLuint64 *params
) override { | 333 GrGLvoid getQueryObjectui64v(GrGLuint id, GrGLenum pname, GrGLuint64 *params
) override { |
334 queryResult(id, pname, params); | 334 this->queryResult(id, pname, params); |
335 } | 335 } |
336 | 336 |
337 GrGLvoid getQueryObjectuiv(GrGLuint id, GrGLenum pname, GrGLuint *params) ov
erride { | 337 GrGLvoid getQueryObjectuiv(GrGLuint id, GrGLenum pname, GrGLuint *params) ov
erride { |
338 queryResult(id, pname, params); | 338 this->queryResult(id, pname, params); |
339 } | 339 } |
340 | 340 |
341 GrGLvoid getShaderiv(GrGLuint shader, GrGLenum pname, GrGLint* params) overr
ide { | 341 GrGLvoid getShaderiv(GrGLuint shader, GrGLenum pname, GrGLint* params) overr
ide { |
342 this->getShaderOrProgramiv(shader, pname, params); | 342 this->getShaderOrProgramiv(shader, pname, params); |
343 } | 343 } |
344 | 344 |
345 GrGLvoid getShaderInfoLog(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* len
gth, | 345 GrGLvoid getShaderInfoLog(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* len
gth, |
346 char* infolog) override { | 346 char* infolog) override { |
347 this->getInfoLog(shader, bufsize, length, infolog); | 347 this->getInfoLog(shader, bufsize, length, infolog); |
348 } | 348 } |
349 | 349 |
350 const GrGLubyte* getString(GrGLenum name) override { | 350 const GrGLubyte* getString(GrGLenum name) override { |
351 switch (name) { | 351 switch (name) { |
352 case GR_GL_EXTENSIONS: | 352 case GR_GL_EXTENSIONS: |
353 return CombinedExtensionString(); | 353 return CombinedExtensionString(); |
354 case GR_GL_VERSION: | 354 case GR_GL_VERSION: |
355 return (const GrGLubyte*)"4.0 Debug GL"; | 355 return (const GrGLubyte*)"4.0 Null GL"; |
356 case GR_GL_SHADING_LANGUAGE_VERSION: | 356 case GR_GL_SHADING_LANGUAGE_VERSION: |
357 return (const GrGLubyte*)"4.20.8 Debug GLSL"; | 357 return (const GrGLubyte*)"4.20.8 Null GLSL"; |
358 case GR_GL_VENDOR: | 358 case GR_GL_VENDOR: |
359 return (const GrGLubyte*)"Debug Vendor"; | 359 return (const GrGLubyte*)"Null Vendor"; |
360 case GR_GL_RENDERER: | 360 case GR_GL_RENDERER: |
361 return (const GrGLubyte*)"The Debug (Non-)Renderer"; | 361 return (const GrGLubyte*)"The Null (Non-)Renderer"; |
362 default: | 362 default: |
363 SkFAIL("Unexpected name passed to GetString"); | 363 SkFAIL("Unexpected name passed to GetString"); |
364 return nullptr; | 364 return nullptr; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 const GrGLubyte* getStringi(GrGLenum name, GrGLuint i) override { | 368 const GrGLubyte* getStringi(GrGLenum name, GrGLuint i) override { |
369 switch (name) { | 369 switch (name) { |
370 case GR_GL_EXTENSIONS: { | 370 case GR_GL_EXTENSIONS: { |
371 GrGLint count; | 371 GrGLint count; |
372 this->getIntegerv(GR_GL_NUM_EXTENSIONS, &count); | 372 this->getIntegerv(GR_GL_NUM_EXTENSIONS, &count); |
373 if ((GrGLint)i <= count) { | 373 if ((GrGLint)i <= count) { |
374 return (const GrGLubyte*) kExtensions[i]; | 374 return (const GrGLubyte*) kExtensions[i]; |
375 } else { | 375 } else { |
376 return nullptr; | 376 return nullptr; |
377 } | 377 } |
378 } | 378 } |
379 default: | 379 default: |
380 SkFAIL("Unexpected name passed to GetStringi"); | 380 SkFAIL("Unexpected name passed to GetStringi"); |
381 return nullptr; | 381 return nullptr; |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 GrGLvoid getTexLevelParameteriv(GrGLenum target, GrGLint level, GrGLenum pna
me, | |
386 GrGLint* params) override { | |
387 // we used to use this to query stuff about externally created textures, | |
388 // now we just require clients to tell us everything about the texture. | |
389 SkFAIL("Should never query texture parameters."); | |
390 } | |
391 | |
392 GrGLint getUniformLocation(GrGLuint program, const char* name) override { | 385 GrGLint getUniformLocation(GrGLuint program, const char* name) override { |
393 return ++fCurrUniformLocation; | 386 return ++fCurrUniformLocation; |
394 } | 387 } |
395 | 388 |
396 GrGLvoid* mapBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr le
ngth, | 389 GrGLvoid* mapBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr le
ngth, |
397 GrGLbitfield access) override { | 390 GrGLbitfield access) override { |
398 GrGLuint id = 0; | 391 GrGLuint id = 0; |
399 switch (target) { | 392 switch (target) { |
400 case GR_GL_ARRAY_BUFFER: | 393 case GR_GL_ARRAY_BUFFER: |
401 id = fCurrArrayBuffer; | 394 id = fCurrArrayBuffer; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 *params = GR_GL_TRUE; | 583 *params = GR_GL_TRUE; |
591 break; | 584 break; |
592 case GR_GL_QUERY_RESULT: | 585 case GR_GL_QUERY_RESULT: |
593 *params = 0; | 586 *params = 0; |
594 break; | 587 break; |
595 default: | 588 default: |
596 SkFAIL("Unexpected pname passed to GetQueryObject."); | 589 SkFAIL("Unexpected pname passed to GetQueryObject."); |
597 break; | 590 break; |
598 } | 591 } |
599 } | 592 } |
| 593 |
| 594 typedef GrGLTestInterface INHERITED; |
600 }; | 595 }; |
601 | 596 |
602 const char* NullInterface::kExtensions[] = { | 597 const char* NullInterface::kExtensions[] = { |
603 "GL_ARB_framebuffer_object", | 598 "GL_ARB_framebuffer_object", |
604 "GL_ARB_blend_func_extended", | 599 "GL_ARB_blend_func_extended", |
605 "GL_ARB_timer_query", | 600 "GL_ARB_timer_query", |
606 "GL_ARB_draw_buffers", | 601 "GL_ARB_draw_buffers", |
607 "GL_ARB_occlusion_query", | 602 "GL_ARB_occlusion_query", |
608 "GL_EXT_stencil_wrap", | 603 "GL_EXT_stencil_wrap", |
609 nullptr, // signifies the end of the array. | 604 nullptr, // signifies the end of the array. |
610 }; | 605 }; |
611 | 606 |
612 } // anonymous namespace | 607 } // anonymous namespace |
613 | 608 |
614 const GrGLInterface* GrGLCreateNullInterface() { return new NullInterface; } | 609 const GrGLInterface* GrGLCreateNullInterface() { return new NullInterface; } |
OLD | NEW |