aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpu.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins <scroggo@google.com>2016-11-10 18:31:58 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-10 18:32:14 +0000
commit9c7edb8311409a141b0dc1d5e480c68c629f1997 (patch)
tree1e93d505c758676392d6d1de89d77e9ba15cf032 /src/gpu/GrGpu.cpp
parent805eb6c7779eb855a26d0f1e821d58ce2bf5ffd2 (diff)
Revert "Add integer texture support."
This reverts commit 434c534bd0ec08cb355fecfb6d2110197b523e74. Reason for revert: Undefined behavior. From https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN/builds/1272/steps/test_skia%20on%20Ubuntu/logs/stdio ../../../tests/IntTextureTest.cpp:51:44: runtime error: left shift of negative value -1 #0 0x2257480 in test_IntTexture(skiatest::Reporter*, sk_gpu_test::ContextInfo const&) (/b/swarm_slave/w/ir0aO1sa/out/Debug/dm+0x2257480) #1 0x1ca1066 in skiatest::RunWithGPUTestContexts(void (*)(skiatest::Reporter*, sk_gpu_test::ContextInfo const&), bool (*)(sk_gpu_test::GrContextFactory::ContextType), skiatest::Reporter*, sk_gpu_test::GrContextFactory*) (/b/swarm_slave/w/ir0aO1sa/out/Debug/dm+0x1ca1066) #2 0x1ca080d in run_test(skiatest::Test) (/b/swarm_slave/w/ir0aO1sa/out/Debug/dm+0x1ca080d) #3 0x1c9e5e9 in dm_main() (/b/swarm_slave/w/ir0aO1sa/out/Debug/dm+0x1c9e5e9) #4 0x7f2d2ba8df44 in __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:287 #5 0x1bb3028 in _start (/b/swarm_slave/w/ir0aO1sa/out/Debug/dm+0x1bb3028) SUMMARY: AddressSanitizer: undefined-behavior ../../../tests/IntTextureTest.cpp:51:44 in step returned non-zero exit code: 1 Original change's description: > Add integer texture support. > > This allows us to create integer textures and sample them from a GrProcessor's code. > > Filtering is limited to NEAREST. > > Adds tests for reading/writing pixels, copying, and drawing. These operations are not allowed to convert to fixed/float configs. > > Vulkan support is TBD. > > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4348 > > Change-Id: If38d89a03285d4bd98d1f14f9638b0320977e43d > Reviewed-on: https://skia-review.googlesource.com/4348 > Commit-Queue: Brian Salomon <bsalomon@google.com> > Reviewed-by: Chris Dalton <csmartdalton@google.com> > TBR=bsalomon@google.com,csmartdalton@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I39f1a0a0dd3e6cde1143c8cc1217d2e3d5977b21 Reviewed-on: https://skia-review.googlesource.com/4663 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r--src/gpu/GrGpu.cpp46
1 files changed, 4 insertions, 42 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index b775cf0c74..1b9be53e1f 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -104,10 +104,6 @@ static bool check_texture_creation_params(const GrCaps& caps, const GrSurfaceDes
return false;
}
- if (GrPixelConfigIsSint(desc.fConfig) && texels.count() > 1) {
- return false;
- }
-
*isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
if (*isRT && !caps.isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
return false;
@@ -266,13 +262,6 @@ bool GrGpu::copySurface(GrSurface* dst,
const SkIPoint& dstPoint) {
SkASSERT(dst && src);
this->handleDirtyContext();
- // We don't allow conversion between integer configs and float/fixed configs.
- if (GrPixelConfigIsSint(dst->config()) != GrPixelConfigIsSint(src->config())) {
- return false;
- }
- if (GrPixelConfigIsCompressed(dst->config())) {
- return false;
- }
return this->onCopySurface(dst, src, srcRect, dstPoint);
}
@@ -281,14 +270,8 @@ bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, size
ReadPixelTempDrawInfo* tempDrawInfo) {
SkASSERT(drawPreference);
SkASSERT(tempDrawInfo);
- SkASSERT(srcSurface);
SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference);
- // We don't allow conversion between integer configs and float/fixed configs.
- if (GrPixelConfigIsSint(srcSurface->config()) != GrPixelConfigIsSint(readConfig)) {
- return false;
- }
-
// We currently do not support reading into a compressed buffer
if (GrPixelConfigIsCompressed(readConfig)) {
return false;
@@ -322,7 +305,6 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height,
WritePixelTempDrawInfo* tempDrawInfo) {
SkASSERT(drawPreference);
SkASSERT(tempDrawInfo);
- SkASSERT(dstSurface);
SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference);
if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) &&
@@ -330,11 +312,6 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height,
return false;
}
- // We don't allow conversion between integer configs and float/fixed configs.
- if (GrPixelConfigIsSint(dstSurface->config()) != GrPixelConfigIsSint(srcConfig)) {
- return false;
- }
-
if (SkToBool(dstSurface->asRenderTarget())) {
if (this->caps()->useDrawInsteadOfAllRenderTargetWrites()) {
ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
@@ -366,12 +343,7 @@ bool GrGpu::readPixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, void* buffer,
size_t rowBytes) {
- SkASSERT(surface);
-
- // We don't allow conversion between integer configs and float/fixed configs.
- if (GrPixelConfigIsSint(surface->config()) != GrPixelConfigIsSint(config)) {
- return false;
- }
+ this->handleDirtyContext();
// We cannot read pixels into a compressed buffer
if (GrPixelConfigIsCompressed(config)) {
@@ -386,8 +358,6 @@ bool GrGpu::readPixels(GrSurface* surface,
return false;
}
- this->handleDirtyContext();
-
return this->onReadPixels(surface,
left, top, width, height,
config, buffer,
@@ -397,18 +367,15 @@ bool GrGpu::readPixels(GrSurface* surface,
bool GrGpu::writePixels(GrSurface* surface,
int left, int top, int width, int height,
GrPixelConfig config, const SkTArray<GrMipLevel>& texels) {
- SkASSERT(surface);
+ if (!surface) {
+ return false;
+ }
for (int currentMipLevel = 0; currentMipLevel < texels.count(); currentMipLevel++) {
if (!texels[currentMipLevel].fPixels ) {
return false;
}
}
- // We don't allow conversion between integer configs and float/fixed configs.
- if (GrPixelConfigIsSint(surface->config()) != GrPixelConfigIsSint(config)) {
- return false;
- }
-
this->handleDirtyContext();
if (this->onWritePixels(surface, left, top, width, height, config, texels)) {
SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
@@ -439,11 +406,6 @@ bool GrGpu::transferPixels(GrSurface* surface,
SkASSERT(transferBuffer);
SkASSERT(fence);
- // We don't allow conversion between integer configs and float/fixed configs.
- if (GrPixelConfigIsSint(surface->config()) != GrPixelConfigIsSint(config)) {
- return false;
- }
-
this->handleDirtyContext();
if (this->onTransferPixels(surface, left, top, width, height, config,
transferBuffer, offset, rowBytes)) {