Fix alpha textures in NV ES3 contexts on Windows.
Make unit tests iterate over all the rendering GL context types rather than using kNative. Fix the extension printing when gStartupSpew is set. R=jvanverth@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/398183002
This commit is contained in:
parent
e57452debd
commit
e904c09a3a
@ -65,6 +65,8 @@ public:
|
|||||||
return fInterface->hasExtension(ext);
|
return fInterface->hasExtension(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GrGLExtensions& extensions() const { return fInterface->fExtensions; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the information
|
* Reset the information
|
||||||
*/
|
*/
|
||||||
|
@ -219,6 +219,9 @@ GrGLVendor GrGLGetVendorFromString(const char* vendorString) {
|
|||||||
if (0 == strcmp(vendorString, "Qualcomm")) {
|
if (0 == strcmp(vendorString, "Qualcomm")) {
|
||||||
return kQualcomm_GrGLVendor;
|
return kQualcomm_GrGLVendor;
|
||||||
}
|
}
|
||||||
|
if (0 == strcmp(vendorString, "NVIDIA Corporation")) {
|
||||||
|
return kNVIDIA_GrGLVendor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return kOther_GrGLVendor;
|
return kOther_GrGLVendor;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ enum GrGLVendor {
|
|||||||
kImagination_GrGLVendor,
|
kImagination_GrGLVendor,
|
||||||
kIntel_GrGLVendor,
|
kIntel_GrGLVendor,
|
||||||
kQualcomm_GrGLVendor,
|
kQualcomm_GrGLVendor,
|
||||||
|
kNVIDIA_GrGLVendor,
|
||||||
|
|
||||||
kOther_GrGLVendor
|
kOther_GrGLVendor
|
||||||
};
|
};
|
||||||
|
@ -137,9 +137,7 @@ GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context)
|
|||||||
GrPrintf("------ RENDERER %s\n", renderer);
|
GrPrintf("------ RENDERER %s\n", renderer);
|
||||||
GrPrintf("------ VERSION %s\n", version);
|
GrPrintf("------ VERSION %s\n", version);
|
||||||
GrPrintf("------ EXTENSIONS\n");
|
GrPrintf("------ EXTENSIONS\n");
|
||||||
#if 0 // TODO: Reenable this after GrGLInterface's extensions can be accessed safely.
|
|
||||||
ctx.extensions().print();
|
ctx.extensions().print();
|
||||||
#endif
|
|
||||||
GrPrintf("\n");
|
GrPrintf("\n");
|
||||||
GrPrintf(this->glCaps().dump().c_str());
|
GrPrintf(this->glCaps().dump().c_str());
|
||||||
}
|
}
|
||||||
@ -574,13 +572,21 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrGLenum internalFormat;
|
GrGLenum internalFormat;
|
||||||
GrGLenum externalFormat;
|
GrGLenum externalFormat = 0x0; // suprress warning
|
||||||
GrGLenum externalType;
|
GrGLenum externalType = 0x0;// suprress warning
|
||||||
|
|
||||||
// glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized
|
// glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized
|
||||||
// format for glTexImage, unlike ES3 and desktop. However, we allow the driver to decide the
|
// format for glTexImage, unlike ES3 and desktop. However, we allow the driver to decide the
|
||||||
// size of the internal format whenever possible and so only use a sized internal format when
|
// size of the internal format whenever possible and so only use a sized internal format when
|
||||||
// using texture storage.
|
// using texture storage.
|
||||||
if (!this->configToGLFormats(dataConfig, useTexStorage, &internalFormat,
|
bool useSizedFormat = useTexStorage;
|
||||||
|
// At least some versions of the desktop ES3 drivers for NVIDIA won't accept GL_RED in
|
||||||
|
// glTexImage2D for the internal format but will accept GL_R8.
|
||||||
|
if (!useSizedFormat && kNVIDIA_GrGLVendor == this->glContext().vendor() &&
|
||||||
|
kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_VER(3, 0)) {
|
||||||
|
useSizedFormat = true;
|
||||||
|
}
|
||||||
|
if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat,
|
||||||
&externalFormat, &externalType)) {
|
&externalFormat, &externalType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -681,23 +681,37 @@ static PixelPtr get_surface_ptr(SkSurface* surface, bool useGpu) {
|
|||||||
|
|
||||||
static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||||
SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10);
|
SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10);
|
||||||
SkSurface* surface;
|
|
||||||
bool useGpu = NULL != factory;
|
bool useGpu = NULL != factory;
|
||||||
|
int cnt;
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
if (useGpu) {
|
if (useGpu) {
|
||||||
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
|
cnt = GrContextFactory::kGLContextTypeCnt;
|
||||||
|
} else {
|
||||||
|
cnt = 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
SkASSERT(!useGpu);
|
||||||
|
cnt = 1;
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < cnt; ++i) {
|
||||||
|
SkSurface* surface;
|
||||||
|
#if SK_SUPPORT_GPU
|
||||||
|
if (useGpu) {
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
GrContext* context = factory->get(glCtxType);
|
||||||
if (NULL == context) {
|
if (NULL == context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = SkSurface::NewRenderTarget(context, imageSpec);
|
surface = SkSurface::NewRenderTarget(context, imageSpec);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
surface = SkSurface::NewRaster(imageSpec);
|
surface = SkSurface::NewRaster(imageSpec);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
SkASSERT(!useGpu);
|
|
||||||
surface = SkSurface::NewRaster(imageSpec);
|
|
||||||
#endif
|
|
||||||
SkASSERT(NULL != surface);
|
SkASSERT(NULL != surface);
|
||||||
SkAutoTUnref<SkSurface> aur(surface);
|
SkAutoTUnref<SkSurface> aur(surface);
|
||||||
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface));
|
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface));
|
||||||
@ -744,29 +758,44 @@ static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac
|
|||||||
PixelPtr pixels5 = get_surface_ptr(surface, useGpu);
|
PixelPtr pixels5 = get_surface_ptr(surface, useGpu);
|
||||||
REPORTER_ASSERT(reporter, pixels4 == pixels5);
|
REPORTER_ASSERT(reporter, pixels4 == pixels5);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||||
SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10);
|
SkImageInfo imageSpec = SkImageInfo::MakeN32Premul(10, 10);
|
||||||
SkSurface* surface;
|
SkSurface* surface;
|
||||||
SkSurface* alternateSurface;
|
SkSurface* alternateSurface;
|
||||||
bool useGpu = NULL != factory;
|
bool useGpu = NULL != factory;
|
||||||
|
int cnt;
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
if (useGpu) {
|
if (useGpu) {
|
||||||
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
|
cnt = GrContextFactory::kGLContextTypeCnt;
|
||||||
if (NULL == context) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
surface = SkSurface::NewRenderTarget(context, imageSpec);
|
|
||||||
alternateSurface = SkSurface::NewRenderTarget(context, imageSpec);
|
|
||||||
} else {
|
} else {
|
||||||
surface = SkSurface::NewRaster(imageSpec);
|
cnt = 1;
|
||||||
alternateSurface = SkSurface::NewRaster(imageSpec);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
SkASSERT(!useGpu);
|
SkASSERT(!useGpu);
|
||||||
|
cnt = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int i = 0; i < cnt; ++i) {
|
||||||
|
#if SK_SUPPORT_GPU
|
||||||
|
if (useGpu) {
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
GrContext* context = factory->get(glCtxType);
|
||||||
|
if (NULL == context) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
surface = SkSurface::NewRenderTarget(context, imageSpec);
|
||||||
|
alternateSurface = SkSurface::NewRenderTarget(context, imageSpec);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
surface = SkSurface::NewRaster(imageSpec);
|
surface = SkSurface::NewRaster(imageSpec);
|
||||||
alternateSurface = SkSurface::NewRaster(imageSpec);
|
alternateSurface = SkSurface::NewRaster(imageSpec);
|
||||||
#endif
|
}
|
||||||
SkASSERT(NULL != surface);
|
SkASSERT(NULL != surface);
|
||||||
SkASSERT(NULL != alternateSurface);
|
SkASSERT(NULL != alternateSurface);
|
||||||
SkAutoTUnref<SkSurface> aur1(surface);
|
SkAutoTUnref<SkSurface> aur1(surface);
|
||||||
@ -787,6 +816,7 @@ static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext
|
|||||||
REPORTER_ASSERT(reporter, get_surface_ptr(surface, useGpu) == pixels1);
|
REPORTER_ASSERT(reporter, get_surface_ptr(surface, useGpu) == pixels1);
|
||||||
REPORTER_ASSERT(reporter, get_surface_ptr(alternateSurface, useGpu) != pixels2);
|
REPORTER_ASSERT(reporter, get_surface_ptr(alternateSurface, useGpu) != pixels2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void TestDeferredCanvasCreateCompatibleDevice(skiatest::Reporter* reporter) {
|
static void TestDeferredCanvasCreateCompatibleDevice(skiatest::Reporter* reporter) {
|
||||||
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(100, 100));
|
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(100, 100));
|
||||||
|
@ -147,6 +147,10 @@ bool GrGpuGL::programUnitTest(int maxStages) {
|
|||||||
dummyDesc.fHeight = 22;
|
dummyDesc.fHeight = 22;
|
||||||
SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0));
|
SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0));
|
||||||
|
|
||||||
|
if (!dummyTexture1 || ! dummyTexture2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static const int NUM_TESTS = 512;
|
static const int NUM_TESTS = 512;
|
||||||
|
|
||||||
SkRandom random;
|
SkRandom random;
|
||||||
|
@ -49,10 +49,17 @@ static void create_layers(skiatest::Reporter* reporter,
|
|||||||
// locking & unlocking textures).
|
// locking & unlocking textures).
|
||||||
// TODO: need to add checks on VRAM usage!
|
// TODO: need to add checks on VRAM usage!
|
||||||
DEF_GPUTEST(GpuLayerCache, reporter, factory) {
|
DEF_GPUTEST(GpuLayerCache, reporter, factory) {
|
||||||
|
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
|
||||||
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GrContext* context = factory->get(glCtxType);
|
||||||
|
|
||||||
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
|
|
||||||
if (NULL == context) {
|
if (NULL == context) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkPictureRecorder recorder;
|
SkPictureRecorder recorder;
|
||||||
@ -136,5 +143,6 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
|
|||||||
// TODO: add VRAM/resource cache check here
|
// TODO: add VRAM/resource cache check here
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,17 +16,17 @@ DEF_GPUTEST(GrContextFactory, reporter, factory) {
|
|||||||
|
|
||||||
// Before we ask for a context, we expect the GL context to not be there.
|
// Before we ask for a context, we expect the GL context to not be there.
|
||||||
REPORTER_ASSERT(reporter,
|
REPORTER_ASSERT(reporter,
|
||||||
NULL == factory->getGLContext(GrContextFactory::kNative_GLContextType));
|
NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType));
|
||||||
|
|
||||||
// After we ask for a context, we expect that the GL context to be there.
|
// After we ask for a context, we expect that the GL context to be there.
|
||||||
factory->get(GrContextFactory::kNative_GLContextType);
|
factory->get(GrContextFactory::kNull_GLContextType);
|
||||||
REPORTER_ASSERT(reporter,
|
REPORTER_ASSERT(reporter,
|
||||||
factory->getGLContext(GrContextFactory::kNative_GLContextType) != NULL);
|
factory->getGLContext(GrContextFactory::kNull_GLContextType) != NULL);
|
||||||
|
|
||||||
// If we did not ask for a context with the particular GL context, we would
|
// If we did not ask for a context with the particular GL context, we would
|
||||||
// expect the particular GL context to not be there.
|
// expect the particular GL context to not be there.
|
||||||
REPORTER_ASSERT(reporter,
|
REPORTER_ASSERT(reporter,
|
||||||
NULL == factory->getGLContext(GrContextFactory::kNull_GLContextType));
|
NULL == factory->getGLContext(GrContextFactory::kDebug_GLContextType));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,7 +92,18 @@ void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) {
|
DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) {
|
||||||
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
|
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
|
||||||
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GrContext* context = factory->get(glCtxType);
|
||||||
|
|
||||||
|
if (NULL == context) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// GPU -> GPU
|
// GPU -> GPU
|
||||||
gpuToGpu(reporter, context);
|
gpuToGpu(reporter, context);
|
||||||
@ -104,5 +115,6 @@ DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) {
|
|||||||
// RASTER -> GPU
|
// RASTER -> GPU
|
||||||
rasterToGpu(reporter, context);
|
rasterToGpu(reporter, context);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -780,8 +780,18 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
|
|||||||
|
|
||||||
static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
|
static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
|
||||||
GrContextFactory* factory) {
|
GrContextFactory* factory) {
|
||||||
|
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
|
||||||
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GrContext* context = factory->get(glCtxType);
|
||||||
|
|
||||||
|
if (NULL == context) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
static const int kWidth = 100;
|
static const int kWidth = 100;
|
||||||
static const int kHeight = 100;
|
static const int kHeight = 100;
|
||||||
@ -905,6 +915,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -170,11 +170,26 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
|
|||||||
const SkColor color = SK_ColorRED;
|
const SkColor color = SK_ColorRED;
|
||||||
const SkPMColor pmcolor = SkPreMultiplyColor(color);
|
const SkPMColor pmcolor = SkPreMultiplyColor(color);
|
||||||
|
|
||||||
GrContext* context = NULL;
|
int cnt;
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
context = factory->get(GrContextFactory::kNative_GLContextType);
|
cnt = GrContextFactory::kGLContextTypeCnt;
|
||||||
|
#else
|
||||||
|
cnt = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (int i= 0; i < cnt; ++i) {
|
||||||
|
GrContext* context = NULL;
|
||||||
|
#if SK_SUPPORT_GPU
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
context = factory->get(glCtxType);
|
||||||
|
|
||||||
|
if (NULL == context) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
|
for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
|
||||||
SkImageInfo info, requestInfo;
|
SkImageInfo info, requestInfo;
|
||||||
size_t rowBytes;
|
size_t rowBytes;
|
||||||
@ -204,6 +219,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType surfaceType,
|
static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType surfaceType,
|
||||||
GrContext* context) {
|
GrContext* context) {
|
||||||
@ -429,7 +445,12 @@ DEF_GPUTEST(Surface, reporter, factory) {
|
|||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
TestGetTexture(reporter, kRaster_SurfaceType, NULL);
|
TestGetTexture(reporter, kRaster_SurfaceType, NULL);
|
||||||
if (NULL != factory) {
|
if (NULL != factory) {
|
||||||
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
|
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
|
||||||
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
||||||
|
if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
GrContext* context = factory->get(glCtxType);
|
||||||
if (NULL != context) {
|
if (NULL != context) {
|
||||||
TestSurfaceInCache(reporter, kGpu_SurfaceType, context);
|
TestSurfaceInCache(reporter, kGpu_SurfaceType, context);
|
||||||
TestSurfaceInCache(reporter, kGpuScratch_SurfaceType, context);
|
TestSurfaceInCache(reporter, kGpuScratch_SurfaceType, context);
|
||||||
@ -447,5 +468,6 @@ DEF_GPUTEST(Surface, reporter, factory) {
|
|||||||
TestGetTexture(reporter, kGpuScratch_SurfaceType, context);
|
TestGetTexture(reporter, kGpuScratch_SurfaceType, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user