Add detection of image load/store to caps
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4861 Change-Id: Ibf70cce9f61553e830b62339551c1541dc054e8b Reviewed-on: https://skia-review.googlesource.com/4861 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
c0115e4cf3
commit
f26f7a063a
@ -64,6 +64,7 @@ public:
|
||||
bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
|
||||
bool integerSupport() const { return fIntegerSupport; }
|
||||
bool texelBufferSupport() const { return fTexelBufferSupport; }
|
||||
int imageLoadStoreSupport() const { return fImageLoadStoreSupport; }
|
||||
|
||||
/**
|
||||
* Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a
|
||||
@ -106,18 +107,18 @@ protected:
|
||||
the client. Note that overrides will only reduce the caps never expand them. */
|
||||
void applyOptionsOverrides(const GrContextOptions& options);
|
||||
|
||||
bool fShaderDerivativeSupport : 1;
|
||||
bool fGeometryShaderSupport : 1;
|
||||
bool fPathRenderingSupport : 1;
|
||||
bool fDstReadInShaderSupport : 1;
|
||||
bool fShaderDerivativeSupport : 1;
|
||||
bool fGeometryShaderSupport : 1;
|
||||
bool fPathRenderingSupport : 1;
|
||||
bool fDstReadInShaderSupport : 1;
|
||||
bool fDualSourceBlendingSupport : 1;
|
||||
bool fIntegerSupport : 1;
|
||||
bool fTexelBufferSupport : 1;
|
||||
|
||||
bool fShaderPrecisionVaries;
|
||||
bool fIntegerSupport : 1;
|
||||
bool fTexelBufferSupport : 1;
|
||||
bool fImageLoadStoreSupport : 1;
|
||||
bool fPLSPathRenderingSupport : 1;
|
||||
bool fShaderPrecisionVaries : 1;
|
||||
PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
|
||||
int fPixelLocalStorageSize;
|
||||
bool fPLSPathRenderingSupport;
|
||||
|
||||
private:
|
||||
virtual void onApplyOptionsOverrides(const GrContextOptions&) {}
|
||||
|
@ -17,7 +17,10 @@ GrShaderCaps::GrShaderCaps() {
|
||||
fDualSourceBlendingSupport = false;
|
||||
fIntegerSupport = false;
|
||||
fTexelBufferSupport = false;
|
||||
fImageLoadStoreSupport = false;
|
||||
fShaderPrecisionVaries = false;
|
||||
fPLSPathRenderingSupport = false;
|
||||
fPixelLocalStorageSize = 0;
|
||||
}
|
||||
|
||||
static const char* shader_type_to_string(GrShaderType type) {
|
||||
@ -54,6 +57,7 @@ SkString GrShaderCaps::dump() const {
|
||||
r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupport]);
|
||||
r.appendf("Integer Support : %s\n", gNY[fIntegerSupport]);
|
||||
r.appendf("Texel Buffer Support : %s\n", gNY[fTexelBufferSupport]);
|
||||
r.appendf("Image Load Store Support : %s\n", gNY[fImageLoadStoreSupport]);
|
||||
|
||||
r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVaries]);
|
||||
|
||||
|
@ -309,6 +309,33 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxSamplers);
|
||||
glslCaps->fMaxCombinedSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers);
|
||||
|
||||
if (kGL_GrGLStandard == standard) {
|
||||
glslCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(4, 2);
|
||||
if (!glslCaps->fImageLoadStoreSupport &&
|
||||
ctxInfo.hasExtension("GL_ARB_shader_image_load_store")) {
|
||||
glslCaps->fImageLoadStoreSupport = true;
|
||||
glslCaps->fImageLoadStoreExtensionString = "GL_ARB_shader_image_load_store";
|
||||
}
|
||||
} else {
|
||||
glslCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(3, 1);
|
||||
}
|
||||
if (glslCaps->fImageLoadStoreSupport) {
|
||||
// Protect ourselves against tracking huge amounts of image state.
|
||||
static constexpr int kMaxSaneImages = 4;
|
||||
GrGLint maxUnits;
|
||||
GR_GL_GetIntegerv(gli, GR_GL_MAX_IMAGE_UNITS, &maxUnits);
|
||||
GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_IMAGE_UNIFORMS, &glslCaps->fMaxVertexImages);
|
||||
GR_GL_GetIntegerv(gli, GR_GL_MAX_GEOMETRY_IMAGE_UNIFORMS, &glslCaps->fMaxGeometryImages);
|
||||
GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_IMAGE_UNIFORMS, &glslCaps->fMaxFragmentImages);
|
||||
GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_IMAGE_UNIFORMS, &glslCaps->fMaxCombinedImages);
|
||||
// We use one unit for every image uniform
|
||||
glslCaps->fMaxCombinedImages = SkTMin(SkTMin(glslCaps->fMaxCombinedImages, maxUnits),
|
||||
kMaxSaneImages);
|
||||
glslCaps->fMaxVertexImages = SkTMin(maxUnits, glslCaps->fMaxVertexImages);
|
||||
glslCaps->fMaxGeometryImages = SkTMin(maxUnits, glslCaps->fMaxGeometryImages);
|
||||
glslCaps->fMaxFragmentImages = SkTMin(maxUnits, glslCaps->fMaxFragmentImages);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* GrCaps fields
|
||||
**************************************************************************/
|
||||
|
@ -42,10 +42,15 @@ GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) {
|
||||
fSampleVariablesExtensionString = nullptr;
|
||||
fFBFetchColorName = nullptr;
|
||||
fFBFetchExtensionString = nullptr;
|
||||
fImageLoadStoreExtensionString = nullptr;
|
||||
fMaxVertexSamplers = 0;
|
||||
fMaxGeometrySamplers = 0;
|
||||
fMaxFragmentSamplers = 0;
|
||||
fMaxCombinedSamplers = 0;
|
||||
fMaxVertexImages = 0;
|
||||
fMaxGeometryImages = 0;
|
||||
fMaxFragmentImages = 0;
|
||||
fMaxCombinedImages = 0;
|
||||
fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
|
||||
}
|
||||
|
||||
@ -90,6 +95,10 @@ SkString GrGLSLCaps::dump() const {
|
||||
r.appendf("Max GS Samplers: %d\n", fMaxGeometrySamplers);
|
||||
r.appendf("Max FS Samplers: %d\n", fMaxFragmentSamplers);
|
||||
r.appendf("Max Combined Samplers: %d\n", fMaxFragmentSamplers);
|
||||
r.appendf("Max VS Images: %d\n", fMaxVertexImages);
|
||||
r.appendf("Max GS Images: %d\n", fMaxGeometryImages);
|
||||
r.appendf("Max FS Images: %d\n", fMaxFragmentImages);
|
||||
r.appendf("Max Combined Images: %d\n", fMaxFragmentImages);
|
||||
r.appendf("Advanced blend equation interaction: %s\n",
|
||||
kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
|
||||
return r;
|
||||
|
@ -144,6 +144,11 @@ public:
|
||||
return fSampleVariablesExtensionString;
|
||||
}
|
||||
|
||||
const char* imageLoadStoreExtensionString() const {
|
||||
SkASSERT(this->imageLoadStoreSupport());
|
||||
return fImageLoadStoreExtensionString;
|
||||
}
|
||||
|
||||
int maxVertexSamplers() const { return fMaxVertexSamplers; }
|
||||
|
||||
int maxGeometrySamplers() const { return fMaxGeometrySamplers; }
|
||||
@ -152,6 +157,14 @@ public:
|
||||
|
||||
int maxCombinedSamplers() const { return fMaxCombinedSamplers; }
|
||||
|
||||
int maxVertexImages() const { return fMaxVertexImages; }
|
||||
|
||||
int maxGeometryImages() const { return fMaxGeometryImages; }
|
||||
|
||||
int maxFragmentImages() const { return fMaxFragmentImages; }
|
||||
|
||||
int maxCombinedImages() const { return fMaxCombinedImages; }
|
||||
|
||||
/**
|
||||
* Given a texture's config, this determines what swizzle must be appended to accesses to the
|
||||
* texture in generated shader code. Swizzling may be implemented in texture parameters or a
|
||||
@ -215,6 +228,7 @@ private:
|
||||
const char* fNoPerspectiveInterpolationExtensionString;
|
||||
const char* fMultisampleInterpolationExtensionString;
|
||||
const char* fSampleVariablesExtensionString;
|
||||
const char* fImageLoadStoreExtensionString;
|
||||
|
||||
const char* fFBFetchColorName;
|
||||
const char* fFBFetchExtensionString;
|
||||
@ -224,6 +238,11 @@ private:
|
||||
int fMaxFragmentSamplers;
|
||||
int fMaxCombinedSamplers;
|
||||
|
||||
int fMaxVertexImages;
|
||||
int fMaxGeometryImages;
|
||||
int fMaxFragmentImages;
|
||||
int fMaxCombinedImages;
|
||||
|
||||
AdvBlendEqInteraction fAdvBlendEqInteraction;
|
||||
|
||||
GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt];
|
||||
|
Loading…
Reference in New Issue
Block a user