aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-02-26 10:39:34 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-26 10:39:34 -0800
commiteb79eea617d6d4ef6951206e51643ec4ef891920 (patch)
tree252c8e02512c5a40d3d092abbb72ac275f30c952
parentb2c0133caf0f03462385c19634281c351355c979 (diff)
Include glGetMultisamplefv API
-rw-r--r--include/gpu/GrCaps.h2
-rw-r--r--include/gpu/gl/GrGLFunctions.h1
-rw-r--r--include/gpu/gl/GrGLInterface.h1
-rw-r--r--src/gpu/GrCaps.cpp2
-rw-r--r--src/gpu/gl/GrGLAssembleInterface.cpp8
-rw-r--r--src/gpu/gl/GrGLCaps.cpp7
-rw-r--r--src/gpu/gl/GrGLCreateNullInterface.cpp1
-rw-r--r--src/gpu/gl/GrGLDefines.h1
-rw-r--r--src/gpu/gl/GrGLInterface.cpp8
-rw-r--r--src/gpu/gl/GrGLNoOpInterface.cpp6
-rw-r--r--src/gpu/gl/GrGLNoOpInterface.h2
-rw-r--r--src/gpu/gl/SkNullGLContext.cpp1
-rw-r--r--src/gpu/gl/debug/GrGLCreateDebugInterface.cpp1
13 files changed, 41 insertions, 0 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index e2e44a5120..60f213950e 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -144,6 +144,7 @@ public:
bool compressedTexSubImageSupport() const { return fCompressedTexSubImageSupport; }
bool oversizedStencilSupport() const { return fOversizedStencilSupport; }
bool textureBarrierSupport() const { return fTextureBarrierSupport; }
+ bool sampleLocationsSupport() const { return fSampleLocationsSupport; }
bool usesMixedSamples() const { return fUsesMixedSamples; }
bool useDrawInsteadOfClear() const { return fUseDrawInsteadOfClear; }
@@ -276,6 +277,7 @@ protected:
bool fCompressedTexSubImageSupport : 1;
bool fOversizedStencilSupport : 1;
bool fTextureBarrierSupport : 1;
+ bool fSampleLocationsSupport : 1;
bool fUsesMixedSamples : 1;
bool fSupportsInstancedDraws : 1;
bool fFullClearIsFree : 1;
diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h
index 6986f8cc03..a6b9b9a623 100644
--- a/include/gpu/gl/GrGLFunctions.h
+++ b/include/gpu/gl/GrGLFunctions.h
@@ -89,6 +89,7 @@ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetBufferParameterivProc)(GrGLenum ta
typedef GrGLenum (GR_GL_FUNCTION_TYPE* GrGLGetErrorProc)();
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetFramebufferAttachmentParameterivProc)(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetIntegervProc)(GrGLenum pname, GrGLint* params);
+typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetMultisamplefvProc)(GrGLenum pname, GrGLuint index, GrGLfloat* val);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetProgramInfoLogProc)(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetProgramivProc)(GrGLuint program, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetQueryivProc)(GrGLenum GLtarget, GrGLenum pname, GrGLint *params);
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index 1a91afb7f0..150a2bf943 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -202,6 +202,7 @@ public:
GrGLFunction<GrGLGetErrorProc> fGetError;
GrGLFunction<GrGLGetFramebufferAttachmentParameterivProc> fGetFramebufferAttachmentParameteriv;
GrGLFunction<GrGLGetIntegervProc> fGetIntegerv;
+ GrGLFunction<GrGLGetMultisamplefvProc> fGetMultisamplefv;
GrGLFunction<GrGLGetQueryObjecti64vProc> fGetQueryObjecti64v;
GrGLFunction<GrGLGetQueryObjectivProc> fGetQueryObjectiv;
GrGLFunction<GrGLGetQueryObjectui64vProc> fGetQueryObjectui64v;
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 4fb05c14a1..c544d6ef77 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -92,6 +92,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fCompressedTexSubImageSupport = false;
fOversizedStencilSupport = false;
fTextureBarrierSupport = false;
+ fSampleLocationsSupport = false;
fUsesMixedSamples = false;
fSupportsInstancedDraws = false;
fFullClearIsFree = false;
@@ -165,6 +166,7 @@ SkString GrCaps::dump() const {
r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSubImageSupport]);
r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencilSupport]);
r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSupport]);
+ r.appendf("Sample Locations Support : %s\n", gNY[fSampleLocationsSupport]);
r.appendf("Uses Mixed Samples : %s\n", gNY[fUsesMixedSamples]);
r.appendf("Supports instanced draws : %s\n", gNY[fSupportsInstancedDraws]);
r.appendf("Full screen clear is free : %s\n", gNY[fFullClearIsFree]);
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index e52d302190..27597b20bd 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -162,6 +162,9 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC(GetBufferParameteriv);
GET_PROC(GetError);
GET_PROC(GetIntegerv);
+ if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_texture_multisample")) {
+ GET_PROC(GetMultisamplefv);
+ }
GET_PROC(GetQueryObjectiv);
GET_PROC(GetQueryObjectuiv);
if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
@@ -609,6 +612,11 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC(GetBufferParameteriv);
GET_PROC(GetError);
GET_PROC(GetIntegerv);
+
+ if (version >= GR_GL_VER(3,1)) {
+ GET_PROC(GetMultisamplefv);
+ }
+
GET_PROC(GetProgramInfoLog);
GET_PROC(GetProgramiv);
GET_PROC(GetShaderInfoLog);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index da7907be9f..989c799a37 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -126,6 +126,13 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier");
}
+ if (kGL_GrGLStandard == standard) {
+ fSampleLocationsSupport = version >= GR_GL_VER(3,2) ||
+ ctxInfo.hasExtension("GL_ARB_texture_multisample");
+ } else {
+ fSampleLocationsSupport = version >= GR_GL_VER(3,1);
+ }
+
// ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support GL_RED
// and GL_RG on FBO textures.
if (kMesa_GrGLDriver != ctxInfo.driver()) {
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index f56b1d9773..17f305b6e3 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -402,6 +402,7 @@ const GrGLInterface* GrGLCreateNullInterface() {
functions->fGetBufferParameteriv = nullGLGetBufferParameteriv;
functions->fGetError = noOpGLGetError;
functions->fGetIntegerv = noOpGLGetIntegerv;
+ functions->fGetMultisamplefv = noOpGLGetMultisamplefv;
functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h
index 9be769fb85..219501c1f8 100644
--- a/src/gpu/gl/GrGLDefines.h
+++ b/src/gpu/gl/GrGLDefines.h
@@ -382,6 +382,7 @@
/* multisample */
#define GR_GL_MULTISAMPLE 0x809D
+#define GR_GL_SAMPLE_POSITION 0x8E50
/* Points */
#define GR_GL_POINT_SMOOTH 0x0B10
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index 53911bfcc9..7c7744792d 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -500,6 +500,14 @@ bool GrGLInterface::validate() const {
}
if ((kGL_GrGLStandard == fStandard &&
+ (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_texture_multisample"))) ||
+ (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) {
+ if (NULL == fFunctions.fGetMultisamplefv) {
+ RETURN_FALSE_INTERFACE
+ }
+ }
+
+ if ((kGL_GrGLStandard == fStandard &&
(glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) ||
(kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) {
if (nullptr == fFunctions.fGetProgramResourceLocation) {
diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp
index f08d737d58..3cf9ecd1e2 100644
--- a/src/gpu/gl/GrGLNoOpInterface.cpp
+++ b/src/gpu/gl/GrGLNoOpInterface.cpp
@@ -561,6 +561,12 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetInfoLog(GrGLuint program,
}
}
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetMultisamplefv(GrGLenum pname,
+ GrGLuint index,
+ GrGLfloat* val) {
+ val[0] = val[1] = 0.5f;
+}
+
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetShaderOrProgramiv(GrGLuint program,
GrGLenum pname,
GrGLint* params) {
diff --git a/src/gpu/gl/GrGLNoOpInterface.h b/src/gpu/gl/GrGLNoOpInterface.h
index 44894b763a..23168e28a3 100644
--- a/src/gpu/gl/GrGLNoOpInterface.h
+++ b/src/gpu/gl/GrGLNoOpInterface.h
@@ -363,6 +363,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetInfoLog(GrGLuint program,
GrGLsizei* length,
char* infolog);
+GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetMultisamplefv(GrGLenum pname, GrGLuint index, GrGLfloat* val);
+
// can be used for both the program and shader params
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetShaderOrProgramiv(GrGLuint program,
GrGLenum pname,
diff --git a/src/gpu/gl/SkNullGLContext.cpp b/src/gpu/gl/SkNullGLContext.cpp
index 68b19ce990..33f9a0a0a0 100644
--- a/src/gpu/gl/SkNullGLContext.cpp
+++ b/src/gpu/gl/SkNullGLContext.cpp
@@ -451,6 +451,7 @@ static GrGLInterface* create_null_interface(State* state) {
functions->fGetBufferParameteriv = nullGLGetBufferParameteriv;
functions->fGetError = noOpGLGetError;
functions->fGetIntegerv = noOpGLGetIntegerv;
+ functions->fGetMultisamplefv = noOpGLGetMultisamplefv;
functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 2118c02fa7..23e0d7e919 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -895,6 +895,7 @@ const GrGLInterface* GrGLCreateDebugInterface() {
functions->fGetBufferParameteriv = debugGLGetBufferParameteriv;
functions->fGetError = noOpGLGetError;
functions->fGetIntegerv = noOpGLGetIntegerv;
+ functions->fGetMultisamplefv = noOpGLGetMultisamplefv;
functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;