GrGLCaps.h revision 4b91f768b348aa1cebeb54f3ff9331938734c242
1f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com/* 2f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Copyright 2012 Google Inc. 3f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * 4f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Use of this source code is governed by a BSD-style license that can be 5f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * found in the LICENSE file. 6f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 7f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 8f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 9f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#ifndef GrGLCaps_DEFINED 10f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#define GrGLCaps_DEFINED 11f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 12c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com#include "GrDrawTargetCaps.h" 138dc7c3a839b38b73af34cc2674a06f49eb1ce527egdaniel#include "GrGLStencilAttachment.h" 14e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr#include "SkChecksum.h" 152aa1f7e6799501974532d35c1f6c3a0447121b95mtklein#include "SkTHash.h" 16a2d71482db8b6d752a51c96da74768d7dfc27932robertphillips@google.com#include "SkTArray.h" 17f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 18f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.comclass GrGLContextInfo; 19e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverthclass GrGLSLCaps; 20f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 21f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com/** 22f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Stores some capabilities of a GL context. Most are determined by the GL 23f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * version and the extensions string. It also tracks formats that have passed 24f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * the FBO completeness test. 25f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 264b91f768b348aa1cebeb54f3ff9331938734c242bsalomonclass GrGLCaps : public GrCaps { 27f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.compublic: 28bcce8926524827775539874346dd424a9510dbc9bsalomon@google.com SK_DECLARE_INST_COUNT(GrGLCaps) 29bcce8926524827775539874346dd424a9510dbc9bsalomon@google.com 308dc7c3a839b38b73af34cc2674a06f49eb1ce527egdaniel typedef GrGLStencilAttachment::Format StencilFormat; 31f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 32f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 33f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * The type of MSAA for FBOs supported. Different extensions have different 34f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * semantics of how / when a resolve is performed. 35f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 36f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com enum MSFBOType { 37f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 38f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * no support for MSAA FBOs 39f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 40fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com kNone_MSFBOType = 0, 41f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 426fc1b4998917791a73bf54428513940fe77dc058skia.committer@gmail.com * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object). 43f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 44347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kDesktop_ARB_MSFBOType, 45f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 46f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * earlier GL_EXT_framebuffer* extensions 47f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 48347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kDesktop_EXT_MSFBOType, 49f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 50a8e5a06f69b7e0cb17a4b3203f0a7a1d52aa73eccommit-bot@chromium.org * Similar to kDesktop_ARB but with additional restrictions on glBlitFramebuffer. 51a8e5a06f69b7e0cb17a4b3203f0a7a1d52aa73eccommit-bot@chromium.org */ 52a8e5a06f69b7e0cb17a4b3203f0a7a1d52aa73eccommit-bot@chromium.org kES_3_0_MSFBOType, 53a8e5a06f69b7e0cb17a4b3203f0a7a1d52aa73eccommit-bot@chromium.org /** 54f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * GL_APPLE_framebuffer_multisample ES extension 55f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 56347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kES_Apple_MSFBOType, 57f3a60c09b975f50bbd14215df10effffd2fd46e8bsalomon@google.com /** 58347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * GL_IMG_multisampled_render_to_texture. This variation does not have MSAA renderbuffers. 59347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * Instead the texture is multisampled when bound to the FBO and then resolved automatically 60347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * when read. It also defines an alternate value for GL_MAX_SAMPLES (which we call 61347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * GR_GL_MAX_SAMPLES_IMG). 62f3a60c09b975f50bbd14215df10effffd2fd46e8bsalomon@google.com */ 63347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kES_IMG_MsToTexture_MSFBOType, 64347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com /** 65347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * GL_EXT_multisampled_render_to_texture. Same as the IMG one above but uses the standard 66347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * GL_MAX_SAMPLES value. 67347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com */ 68347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kES_EXT_MsToTexture_MSFBOType, 696b0cf0273fdffbbdf69235b57b5b5a311e7f1ca6bsalomon@google.com 70ecc9d28072142ab503a237726748ec2dc4ff842fskia.committer@gmail.com kLast_MSFBOType = kES_EXT_MsToTexture_MSFBOType 716b0cf0273fdffbbdf69235b57b5b5a311e7f1ca6bsalomon@google.com }; 726b0cf0273fdffbbdf69235b57b5b5a311e7f1ca6bsalomon@google.com 7352ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org enum InvalidateFBType { 7452ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org kNone_InvalidateFBType, 7552ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org kDiscard_InvalidateFBType, //<! glDiscardFramebuffer() 7652ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org kInvalidate_InvalidateFBType, //<! glInvalidateFramebuffer() 7752ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org 7852ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org kLast_InvalidateFBType = kInvalidate_InvalidateFBType 79f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com }; 80f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 81160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org enum MapBufferType { 82160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org kNone_MapBufferType, 83160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org kMapBuffer_MapBufferType, // glMapBuffer() 84160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org kMapBufferRange_MapBufferType, // glMapBufferRange() 85160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org kChromium_MapBufferType, // GL_CHROMIUM_map_sub 86160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org 87160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org kLast_MapBufferType = kChromium_MapBufferType, 88160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org }; 89160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org 90f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 91f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Creates a GrGLCaps that advertises no support for any extensions, 92f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * formats, etc. Call init to initialize from a GrGLContextInfo. 93f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 94f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com GrGLCaps(); 95f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 96f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com GrGLCaps(const GrGLCaps& caps); 97f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 98f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com GrGLCaps& operator = (const GrGLCaps& caps); 99f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 100f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 101f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Resets the caps such that nothing is supported. 102f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 10336352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void reset() override; 104f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 105f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 106f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Initializes the GrGLCaps to the set of features supported in the current 107f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * OpenGL context accessible via ctxInfo. 108f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 1097c4c63a62e80b93df406abaa18dc4fcb47381fe6george bool init(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface); 110f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 111f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 112f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Call to note that a color config has been verified as a valid color 113f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * attachment. This may save future calls to glCheckFramebufferStatus 114f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * using isConfigVerifiedColorAttachment(). 115f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 116f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com void markConfigAsValidColorAttachment(GrPixelConfig config) { 117f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com fVerifiedColorConfigs.markVerified(config); 118f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 119f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 120f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 121f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Call to check whether a config has been verified as a valid color 122f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * attachment. 123f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 124f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool isConfigVerifiedColorAttachment(GrPixelConfig config) const { 125f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com return fVerifiedColorConfigs.isVerified(config); 126f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 127f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 128f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 129f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Call to note that a color config / stencil format pair passed 130f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * FBO status check. We may skip calling glCheckFramebufferStatus for 131f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * this combination in the future using 132f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * isColorConfigAndStencilFormatVerified(). 133f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 134f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com void markColorConfigAndStencilFormatAsVerified( 135f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com GrPixelConfig config, 1368dc7c3a839b38b73af34cc2674a06f49eb1ce527egdaniel const GrGLStencilAttachment::Format& format); 137f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 138f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 139f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Call to check whether color config / stencil format pair has already 140f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * passed FBO status check. 141f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 142f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool isColorConfigAndStencilFormatVerified( 143f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com GrPixelConfig config, 1448dc7c3a839b38b73af34cc2674a06f49eb1ce527egdaniel const GrGLStencilAttachment::Format& format) const; 145f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 146f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 147f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Reports the type of MSAA FBO support. 148f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 149f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com MSFBOType msFBOType() const { return fMSFBOType; } 150f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 151f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 152347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * Does the supported MSAA FBO extension have MSAA renderbuffers? 153347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com */ 154347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com bool usesMSAARenderBuffers() const { 155347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com return kNone_MSFBOType != fMSFBOType && 156347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kES_IMG_MsToTexture_MSFBOType != fMSFBOType && 157347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kES_EXT_MsToTexture_MSFBOType != fMSFBOType; 158347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com } 159347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com 160347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com /** 161347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * Is the MSAA FBO extension one where the texture is multisampled when bound to an FBO and 162347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com * then implicitly resolved when read. 163347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com */ 164347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com bool usesImplicitMSAAResolve() const { 165347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com return kES_IMG_MsToTexture_MSFBOType == fMSFBOType || 166347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com kES_EXT_MsToTexture_MSFBOType == fMSFBOType; 167347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com } 168347c382d580cd1bc223e11a355b6a1c65d206e34bsalomon@google.com 16908b4d29a0a29badc15129c9bc7ee8352bc75278dvbuzinov bool fbMixedSamplesSupport() const { return fFBMixedSamplesSupport; } 17008b4d29a0a29badc15129c9bc7ee8352bc75278dvbuzinov 17152ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org InvalidateFBType invalidateFBType() const { return fInvalidateFBType; } 17252ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org 173160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org /// What type of buffer mapping is supported? 174160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org MapBufferType mapBufferType() const { return fMapBufferType; } 175f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 176f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 177f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Gets an array of legal stencil formats. These formats are not guaranteed 178f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * to be supported by the driver but are legal GLenum names given the GL 179f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * version and extensions supported. 180f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 181f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com const SkTArray<StencilFormat, true>& stencilFormats() const { 182f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com return fStencilFormats; 183f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 184f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 185f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// The maximum number of fragment uniform vectors (GLES has min. 16). 186f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; } 187f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 188a15f7e5b96ee3d71fdbcb4f9cf02f6a09b4b11accommit-bot@chromium.org /// maximum number of attribute values per vertex 18960da4176425c74cf112d7e116f54a530a82d0d68bsalomon@google.com int maxVertexAttributes() const { return fMaxVertexAttributes; } 19060da4176425c74cf112d7e116f54a530a82d0d68bsalomon@google.com 191a15f7e5b96ee3d71fdbcb4f9cf02f6a09b4b11accommit-bot@chromium.org /// maximum number of texture units accessible in the fragment shader. 192a15f7e5b96ee3d71fdbcb4f9cf02f6a09b4b11accommit-bot@chromium.org int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; } 193a15f7e5b96ee3d71fdbcb4f9cf02f6a09b4b11accommit-bot@chromium.org 194f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// ES requires an extension to support RGBA8 in RenderBufferStorage 195f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool rgba8RenderbufferSupport() const { return fRGBA8RenderbufferSupport; } 196f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 197f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 198f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Depending on the ES extensions present the BGRA external format may 199f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * correspond either a BGRA or RGBA internalFormat. On desktop GL it is 200f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * RGBA. 201f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 202f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool bgraIsInternalFormat() const { return fBGRAIsInternalFormat; } 203f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 204f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// GL_ARB_texture_swizzle support 205f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool textureSwizzleSupport() const { return fTextureSwizzleSupport; } 206f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 207f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// Is there support for GL_UNPACK_ROW_LENGTH 208f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; } 209f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 210f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// Is there support for GL_UNPACK_FLIP_Y 211f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool unpackFlipYSupport() const { return fUnpackFlipYSupport; } 212f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 213f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// Is there support for GL_PACK_ROW_LENGTH 214f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool packRowLengthSupport() const { return fPackRowLengthSupport; } 215f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 216f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// Is there support for GL_PACK_REVERSE_ROW_ORDER 217f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool packFlipYSupport() const { return fPackFlipYSupport; } 218f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 219f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// Is there support for texture parameter GL_TEXTURE_USAGE 220f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool textureUsageSupport() const { return fTextureUsageSupport; } 221f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 222f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /// Is there support for glTexStorage 223f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool texStorageSupport() const { return fTexStorageSupport; } 224f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 225443e5a52b7e85070c26a068cd3b0aad126502395robertphillips@google.com /// Is there support for GL_RED and GL_R8 226443e5a52b7e85070c26a068cd3b0aad126502395robertphillips@google.com bool textureRedSupport() const { return fTextureRedSupport; } 227443e5a52b7e85070c26a068cd3b0aad126502395robertphillips@google.com 228e76b7ccb860b7ffcd86a42af8eecfe30f96493fabsalomon@google.com /// Is GL_ARB_IMAGING supported 229e76b7ccb860b7ffcd86a42af8eecfe30f96493fabsalomon@google.com bool imagingSupport() const { return fImagingSupport; } 230e76b7ccb860b7ffcd86a42af8eecfe30f96493fabsalomon@google.com 231706f66831a575bdc2b1ab1331b48b793cd487356bsalomon@google.com /// Is GL_ARB_fragment_coord_conventions supported? 232706f66831a575bdc2b1ab1331b48b793cd487356bsalomon@google.com bool fragCoordConventionsSupport() const { return fFragCoordsConventionSupport; } 233706f66831a575bdc2b1ab1331b48b793cd487356bsalomon@google.com 23407631cf14e22e772f901baf68545ee48c3d1e014bsalomon@google.com /// Is there support for Vertex Array Objects? 23507631cf14e22e772f901baf68545ee48c3d1e014bsalomon@google.com bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; } 23607631cf14e22e772f901baf68545ee48c3d1e014bsalomon@google.com 2373f801cbb67895fa9fa29498aa017a7666960a627jvanverth /// Is there support for ES2 compatability? 2383f801cbb67895fa9fa29498aa017a7666960a627jvanverth bool ES2CompatibilitySupport() const { return fES2CompatibilitySupport; } 2393f801cbb67895fa9fa29498aa017a7666960a627jvanverth 24007631cf14e22e772f901baf68545ee48c3d1e014bsalomon@google.com /// Use indices or vertices in CPU arrays rather than VBOs for dynamic content. 24196966a5a1ffc2f03eef1b5523308299aa4195f50bsalomon@google.com bool useNonVBOVertexAndIndexDynamicData() const { 24296966a5a1ffc2f03eef1b5523308299aa4195f50bsalomon@google.com return fUseNonVBOVertexAndIndexDynamicData; 24396966a5a1ffc2f03eef1b5523308299aa4195f50bsalomon@google.com } 24496966a5a1ffc2f03eef1b5523308299aa4195f50bsalomon@google.com 24507631cf14e22e772f901baf68545ee48c3d1e014bsalomon@google.com /// Does ReadPixels support the provided format/type combo? 2461d89c93b2a61a9679f444b19b6fce4325ae7df65robertphillips@google.com bool readPixelsSupported(const GrGLInterface* intf, 247fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com GrGLenum format, 248e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr GrGLenum type, 249e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr GrGLenum currFboFormat) const; 250631cdcb4a6b926b6447f328b81911a4499fb3698skia.committer@gmail.com 2512b1b8c083b969a2a798b03d1754a3fc99ea054dfbsalomon@google.com bool isCoreProfile() const { return fIsCoreProfile; } 2521d89c93b2a61a9679f444b19b6fce4325ae7df65robertphillips@google.com 2533628ad9f1357e1f185f02d0676dda0acd3de5d05commit-bot@chromium.org 25456ce48ade325f6f49acb0da31d6252806e4ed7efrobertphillips@google.com bool fullClearIsFree() const { return fFullClearIsFree; } 25556ce48ade325f6f49acb0da31d6252806e4ed7efrobertphillips@google.com 256160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org /** 257160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org * Returns a string containing the caps info. 258160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org */ 25936352bf5e38f45a70ee4f4fc132a38048d38206dmtklein SkString dump() const override; 260beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org 2616e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org /** 2626e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org * LATC can appear under one of three possible names. In order to know 2636e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org * which GL internal format to use, we need to keep track of which name 2646e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org * we found LATC under. The default is LATC. 2656e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org */ 2666e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org enum LATCAlias { 2676e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org kLATC_LATCAlias, 2686e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org kRGTC_LATCAlias, 2696e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org k3DC_LATCAlias 2706e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org }; 2716e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org 2726e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org LATCAlias latcAlias() const { return fLATCAlias; } 2736e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org 274e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); } 275e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 276f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.comprivate: 277f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com /** 278f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * Maintains a bit per GrPixelConfig. It is used to avoid redundantly 279f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com * performing glCheckFrameBufferStatus for the same config. 280f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com */ 281f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com struct VerifiedColorConfigs { 282f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com VerifiedColorConfigs() { 283f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com this->reset(); 284f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 285f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 286f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com void reset() { 287f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com for (int i = 0; i < kNumUints; ++i) { 288f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com fVerifiedColorConfigs[i] = 0; 289f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 290f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 291f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 292b8eb2e89edf914caf5479baeffcb670d3e93f496bsalomon@google.com static const int kNumUints = (kGrPixelConfigCnt + 31) / 32; 293f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com uint32_t fVerifiedColorConfigs[kNumUints]; 294f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 295f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com void markVerified(GrPixelConfig config) { 296f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT 297f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com return; 298f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#endif 299f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com int u32Idx = config / 32; 300f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com int bitIdx = config % 32; 301f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com fVerifiedColorConfigs[u32Idx] |= 1 << bitIdx; 302f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 303f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 304f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool isVerified(GrPixelConfig config) const { 305f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT 306f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com return false; 307f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#endif 308f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com int u32Idx = config / 32; 309f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com int bitIdx = config % 32; 310f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx)); 311f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com } 312f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com }; 313f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 3147388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); 3157388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org void initStencilFormats(const GrGLContextInfo&); 3166b7938f9cb250086a7c6325cf31576f894ca4a1bcommit-bot@chromium.org // This must be called after initFSAASupport(). 3177388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org void initConfigRenderableTable(const GrGLContextInfo&); 3186e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*); 31942dc8136914ee0777bb9110a5e04a75016687c0dcommit-bot@chromium.org 32017168df7798d0d12684f18df0556dc19e65b32e6bsalomon bool doReadPixelsSupported(const GrGLInterface* intf, GrGLenum format, GrGLenum type) const; 321e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr 322f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com // tracks configs that have been verified to pass the FBO completeness when 323f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com // used as a color attachment 324f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com VerifiedColorConfigs fVerifiedColorConfigs; 325f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 326f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com SkTArray<StencilFormat, true> fStencilFormats; 327f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com // tracks configs that have been verified to pass the FBO completeness when 328f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com // used as a color attachment when a particular stencil format is used 329f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com // as a stencil attachment. 330f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; 331f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 332f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com int fMaxFragmentUniformVectors; 33360da4176425c74cf112d7e116f54a530a82d0d68bsalomon@google.com int fMaxVertexAttributes; 334a15f7e5b96ee3d71fdbcb4f9cf02f6a09b4b11accommit-bot@chromium.org int fMaxFragmentTextureUnits; 33560da4176425c74cf112d7e116f54a530a82d0d68bsalomon@google.com 33652ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org MSFBOType fMSFBOType; 33752ffbf6be05eb30671529ec86268967fb85c9810commit-bot@chromium.org InvalidateFBType fInvalidateFBType; 338160b478eed1dd4924a86a87fd60c91139e08ff71commit-bot@chromium.org MapBufferType fMapBufferType; 3396e7ddaae0a077a777b8b8872ec27f8faab275536commit-bot@chromium.org LATCAlias fLATCAlias; 3406b0cf0273fdffbbdf69235b57b5b5a311e7f1ca6bsalomon@google.com 341f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fRGBA8RenderbufferSupport : 1; 342f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fBGRAIsInternalFormat : 1; 343f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fTextureSwizzleSupport : 1; 344f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fUnpackRowLengthSupport : 1; 345f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fUnpackFlipYSupport : 1; 346f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fPackRowLengthSupport : 1; 347f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fPackFlipYSupport : 1; 348f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fTextureUsageSupport : 1; 349f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com bool fTexStorageSupport : 1; 350443e5a52b7e85070c26a068cd3b0aad126502395robertphillips@google.com bool fTextureRedSupport : 1; 351e76b7ccb860b7ffcd86a42af8eecfe30f96493fabsalomon@google.com bool fImagingSupport : 1; 3521d89c93b2a61a9679f444b19b6fce4325ae7df65robertphillips@google.com bool fTwoFormatLimit : 1; 353706f66831a575bdc2b1ab1331b48b793cd487356bsalomon@google.com bool fFragCoordsConventionSupport : 1; 35407631cf14e22e772f901baf68545ee48c3d1e014bsalomon@google.com bool fVertexArrayObjectSupport : 1; 3553f801cbb67895fa9fa29498aa017a7666960a627jvanverth bool fES2CompatibilitySupport : 1; 35696966a5a1ffc2f03eef1b5523308299aa4195f50bsalomon@google.com bool fUseNonVBOVertexAndIndexDynamicData : 1; 3572b1b8c083b969a2a798b03d1754a3fc99ea054dfbsalomon@google.com bool fIsCoreProfile : 1; 35856ce48ade325f6f49acb0da31d6252806e4ed7efrobertphillips@google.com bool fFullClearIsFree : 1; 35908b4d29a0a29badc15129c9bc7ee8352bc75278dvbuzinov bool fFBMixedSamplesSupport : 1; 3605816233d237e5c214f14f1c92eda4a87c898ea11joshualitt 3612aa1f7e6799501974532d35c1f6c3a0447121b95mtklein struct ReadPixelsSupportedFormat { 3622aa1f7e6799501974532d35c1f6c3a0447121b95mtklein GrGLenum fFormat; 3632aa1f7e6799501974532d35c1f6c3a0447121b95mtklein GrGLenum fType; 3642aa1f7e6799501974532d35c1f6c3a0447121b95mtklein GrGLenum fFboFormat; 365e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr 3662aa1f7e6799501974532d35c1f6c3a0447121b95mtklein bool operator==(const ReadPixelsSupportedFormat& rhs) const { 3672aa1f7e6799501974532d35c1f6c3a0447121b95mtklein return fFormat == rhs.fFormat 3682aa1f7e6799501974532d35c1f6c3a0447121b95mtklein && fType == rhs.fType 3692aa1f7e6799501974532d35c1f6c3a0447121b95mtklein && fFboFormat == rhs.fFboFormat; 370e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr } 371e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr }; 37202f46cf878535fb79317d15ebed66dfa3f2cd772mtklein mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCache; 373e4b231428e8c14cbc82d20cfb12eb08fc45f8df6piotaixr 3744b91f768b348aa1cebeb54f3ff9331938734c242bsalomon typedef GrCaps INHERITED; 375f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com}; 376f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com 377e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 378e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverthclass GrGLSLCaps : public GrShaderCaps { 379e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverthpublic: 380e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth SK_DECLARE_INST_COUNT(GrGLSLCaps) 381e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 382e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth /** 3838917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires 3848917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton * special layout qualifiers in the fragment shader. 3858917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton */ 3868917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton enum AdvBlendEqInteraction { 3878917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advanced extension 3888917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton kAutomatic_AdvBlendEqInteraction, //<! No interaction required 3898917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_equations) out 3908917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers per equation 3918917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton 3928917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction 3938917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton }; 3948917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton 3958917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton /** 396e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * Creates a GrGLSLCaps that advertises no support for any extensions, 397e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * formats, etc. Call init to initialize from a GrGLContextInfo. 398e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth */ 399e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth GrGLSLCaps(); 400e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth ~GrGLSLCaps() override {} 401e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 402e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth GrGLSLCaps(const GrGLSLCaps& caps); 403e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 404e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth GrGLSLCaps& operator = (const GrGLSLCaps& caps); 405e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 406e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth /** 407e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * Resets the caps such that nothing is supported. 408e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth */ 409e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth void reset() override; 410e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 411e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth /** 412e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * Initializes the GrGLSLCaps to the set of features supported in the current 413e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * OpenGL context accessible via ctxInfo. 414e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth */ 4158917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton bool init(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); 416e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 417e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth /** 418e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * Some helper functions for encapsulating various extensions to read FB Buffer on openglES 419e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * 420e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect 421e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth */ 422e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth bool fbFetchSupport() const { return fFBFetchSupport; } 423e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 424e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } 425e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 426e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth const char* fbFetchColorName() const { return fFBFetchColorName; } 427e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 428e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth const char* fbFetchExtensionString() const { return fFBFetchExtensionString; } 429e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 430e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } 431e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 4328917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInteraction; } 4338917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton 4348917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton bool mustEnableAdvBlendEqs() const { 4358917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction; 4368917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton } 4378917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton 4388917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton bool mustEnableSpecificAdvBlendEqs() const { 4398917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; 4408917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton } 4418917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton 442e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth /** 443e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth * Returns a string containing the caps info. 444e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth */ 445e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth SkString dump() const override; 446e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 447e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverthprivate: 448e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth // Must be called after fGeometryShaderSupport is initialized. 449e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); 450e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 451e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth bool fDropsTileOnZeroDivide : 1; 452e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth bool fFBFetchSupport : 1; 453e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth bool fFBFetchNeedsCustomOutput : 1; 454e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 455e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth const char* fFBFetchColorName; 456e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth const char* fFBFetchExtensionString; 457e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 4588917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton AdvBlendEqInteraction fAdvBlendEqInteraction; 4598917d62ef4d9bde9ec4f879dc42b309b03a0ad98cdalton 460e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth typedef GrShaderCaps INHERITED; 461e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth}; 462e9c0fc616d2a1632c285885b9b656b68ca8d4f24jvanverth 463cfc18867d982119d9dc2888bf09f1093012daaddjvanverth 464f7fa806d84abf1cba47bfa8679e875a75d76599ebsalomon@google.com#endif 465