Add glPolygonMode support.

Mainly added because it's useful for rendering in wireframe mode.

Change-Id: I84dab43ce5b56a48d47dd16d4c98fa7648bb1f0b
Reviewed-on: https://skia-review.googlesource.com/10530
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Jim Van Verth 2017-03-30 14:28:08 -04:00 committed by Skia Commit-Bot
parent 5f80485a53
commit 609e7ccc66
8 changed files with 14 additions and 4 deletions

View File

@ -122,6 +122,7 @@ typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapTexSubImage2DProc)(GrGLenum targe
typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMemoryBarrierProc)(GrGLbitfield barriers);
typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMemoryBarrierByRegionProc)(GrGLbitfield barriers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPixelStoreiProc)(GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPolygonModeProc)(GrGLenum face, GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPopGroupMarkerProc)();
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPushGroupMarkerProc)(GrGLsizei length, const char* marker);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLQueryCounterProc)(GrGLuint id, GrGLenum target);

View File

@ -209,6 +209,7 @@ public:
GrGLFunction<GrGLMultiDrawArraysIndirectProc> fMultiDrawArraysIndirect;
GrGLFunction<GrGLMultiDrawElementsIndirectProc> fMultiDrawElementsIndirect;
GrGLFunction<GrGLPixelStoreiProc> fPixelStorei;
GrGLFunction<GrGLPolygonModeProc> fPolygonMode;
GrGLFunction<GrGLPopGroupMarkerProc> fPopGroupMarker;
GrGLFunction<GrGLPushGroupMarkerProc> fPushGroupMarker;
GrGLFunction<GrGLQueryCounterProc> fQueryCounter;

View File

@ -197,6 +197,7 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
}
GET_PROC(PixelStorei);
GET_PROC(PolygonMode);
if (extensions.has("GL_EXT_raster_multisample")) {
GET_PROC_SUFFIX(RasterSamples, EXT);
}

View File

@ -416,6 +416,11 @@
#define GR_GL_LINE_WIDTH_GRANULARITY 0x0B23
#define GR_GL_LINE_WIDTH_RANGE 0x0B22
/* PolygonMode */
#define GR_GL_POINT 0x1B00
#define GR_GL_LINE 0x1B01
#define GR_GL_FILL 0x1B02
/* Unsized formats */
#define GR_GL_STENCIL_INDEX 0x1901
#define GR_GL_DEPTH_COMPONENT 0x1902

View File

@ -394,14 +394,13 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
GL_CALL(Disable(GR_GL_COLOR_TABLE));
}
GL_CALL(Disable(GR_GL_POLYGON_OFFSET_FILL));
GL_CALL(PolygonMode(GR_GL_FRONT_AND_BACK, GR_GL_FILL));
#endif
// Since ES doesn't support glPointSize at all we always use the VS to
// set the point size
GL_CALL(Enable(GR_GL_VERTEX_PROGRAM_POINT_SIZE));
// We should set glPolygonMode(FRONT_AND_BACK,FILL) here, too. It isn't
// currently part of our gl interface. There are probably others as
// well.
}
if (kGLES_GrGLStandard == this->glStandard() &&

View File

@ -189,7 +189,8 @@ bool GrGLInterface::validate() const {
if (glVer >= GR_GL_VER(2,0)) {
if (nullptr == fFunctions.fStencilFuncSeparate ||
nullptr == fFunctions.fStencilMaskSeparate ||
nullptr == fFunctions.fStencilOpSeparate) {
nullptr == fFunctions.fStencilOpSeparate ||
nullptr == fFunctions.fPolygonMode) {
RETURN_FALSE_INTERFACE
}
}

View File

@ -119,6 +119,7 @@ GrGLTestInterface::GrGLTestInterface() {
fFunctions.fMapTexSubImage2D = bind_to_member(this, &GrGLTestInterface::mapTexSubImage2D);
fFunctions.fMinSampleShading = bind_to_member(this, &GrGLTestInterface::minSampleShading);
fFunctions.fPixelStorei = bind_to_member(this, &GrGLTestInterface::pixelStorei);
fFunctions.fPolygonMode = bind_to_member(this, &GrGLTestInterface::polygonMode);
fFunctions.fPopGroupMarker = bind_to_member(this, &GrGLTestInterface::popGroupMarker);
fFunctions.fPushGroupMarker = bind_to_member(this, &GrGLTestInterface::pushGroupMarker);
fFunctions.fQueryCounter = bind_to_member(this, &GrGLTestInterface::queryCounter);

View File

@ -120,6 +120,7 @@ public:
virtual GrGLvoid* mapTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLenum access) { return nullptr; }
virtual GrGLvoid minSampleShading(GrGLfloat value) {}
virtual GrGLvoid pixelStorei(GrGLenum pname, GrGLint param) {}
virtual GrGLvoid polygonMode(GrGLenum face, GrGLenum mode) {}
virtual GrGLvoid popGroupMarker() {}
virtual GrGLvoid pushGroupMarker(GrGLsizei length, const char* marker) {}
virtual GrGLvoid queryCounter(GrGLuint id, GrGLenum target) {}