aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
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/vk
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/vk')
-rw-r--r--src/gpu/vk/GrVkUniformHandler.cpp44
-rw-r--r--src/gpu/vk/GrVkUtil.cpp39
-rw-r--r--src/gpu/vk/GrVkVaryingHandler.cpp18
3 files changed, 44 insertions, 57 deletions
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index 7c11b9dc46..4a6e977a8c 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -25,11 +25,10 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) {
0x7, // kMat22f_GrSLType
0xF, // kMat33f_GrSLType
0xF, // kMat44f_GrSLType
- 0x0, // kTexture2DSampler_GrSLType, should never return this
- 0x0, // kTexture2DISampler_GrSLType, should never return this
- 0x0, // kTextureExternalSampler_GrSLType, should never return this
- 0x0, // kTexture2DSamplerRect_GrSLType, should never return this
- 0x0, // ktextureBufferSampler_GrSLType, should never return this
+ 0x0, // Sampler2D_GrSLType, should never return this
+ 0x0, // SamplerExternal_GrSLType, should never return this
+ 0x0, // Sampler2DRect_GrSLType, should never return this
+ 0x0, // SamplerBuffer_GrSLType, should never return this
0x0, // kBool_GrSLType
0x7, // kInt_GrSLType
0x7, // kUint_GrSLType
@@ -45,15 +44,14 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) {
GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
- GR_STATIC_ASSERT(9 == kTexture2DISampler_GrSLType);
- GR_STATIC_ASSERT(10 == kTextureExternalSampler_GrSLType);
- GR_STATIC_ASSERT(11 == kTexture2DRectSampler_GrSLType);
- GR_STATIC_ASSERT(12 == kTextureBufferSampler_GrSLType);
- GR_STATIC_ASSERT(13 == kBool_GrSLType);
- GR_STATIC_ASSERT(14 == kInt_GrSLType);
- GR_STATIC_ASSERT(15 == kUint_GrSLType);
- GR_STATIC_ASSERT(16 == kTexture2D_GrSLType);
- GR_STATIC_ASSERT(17 == kSampler_GrSLType);
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
+ GR_STATIC_ASSERT(12 == kBool_GrSLType);
+ GR_STATIC_ASSERT(13 == kInt_GrSLType);
+ GR_STATIC_ASSERT(14 == kUint_GrSLType);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAlignmentMask) == kGrSLTypeCount);
return kAlignmentMask[type];
}
@@ -73,7 +71,6 @@ static inline uint32_t grsltype_to_vk_size(GrSLType type) {
12 * sizeof(float), // kMat33f_GrSLType
16 * sizeof(float), // kMat44f_GrSLType
0, // kTexture2DSampler_GrSLType
- 0, // kTexture2DISampler_GrSLType
0, // kTextureExternalSampler_GrSLType
0, // kTexture2DRectSampler_GrSLType
0, // kTextureBufferSampler_GrSLType
@@ -94,15 +91,14 @@ static inline uint32_t grsltype_to_vk_size(GrSLType type) {
GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
- GR_STATIC_ASSERT(9 == kTexture2DISampler_GrSLType);
- GR_STATIC_ASSERT(10 == kTextureExternalSampler_GrSLType);
- GR_STATIC_ASSERT(11 == kTexture2DRectSampler_GrSLType);
- GR_STATIC_ASSERT(12 == kTextureBufferSampler_GrSLType);
- GR_STATIC_ASSERT(13 == kBool_GrSLType);
- GR_STATIC_ASSERT(14 == kInt_GrSLType);
- GR_STATIC_ASSERT(15 == kUint_GrSLType);
- GR_STATIC_ASSERT(16 == kTexture2D_GrSLType);
- GR_STATIC_ASSERT(17 == kSampler_GrSLType);
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
+ GR_STATIC_ASSERT(12 == kBool_GrSLType);
+ GR_STATIC_ASSERT(13 == kInt_GrSLType);
+ GR_STATIC_ASSERT(14 == kUint_GrSLType);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrSLTypeCount);
}
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
index 1d93e8d4e5..a14f827dcb 100644
--- a/src/gpu/vk/GrVkUtil.cpp
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -19,62 +19,58 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
}
switch (config) {
- case kUnknown_GrPixelConfig:
- return false;
case kRGBA_8888_GrPixelConfig:
*format = VK_FORMAT_R8G8B8A8_UNORM;
- return true;
+ break;
case kBGRA_8888_GrPixelConfig:
*format = VK_FORMAT_B8G8R8A8_UNORM;
- return true;
+ break;
case kSRGBA_8888_GrPixelConfig:
*format = VK_FORMAT_R8G8B8A8_SRGB;
- return true;
+ break;
case kSBGRA_8888_GrPixelConfig:
*format = VK_FORMAT_B8G8R8A8_SRGB;
- return true;
- case kRGBA_8888_sint_GrPixelConfig:
- *format = VK_FORMAT_R8G8B8A8_SINT;
- return true;
+ break;
case kRGB_565_GrPixelConfig:
*format = VK_FORMAT_R5G6B5_UNORM_PACK16;
- return true;
+ break;
case kRGBA_4444_GrPixelConfig:
// R4G4B4A4 is not required to be supported so we actually
// store the data is if it was B4G4R4A4 and swizzle in shaders
*format = VK_FORMAT_B4G4R4A4_UNORM_PACK16;
- return true;
+ break;
case kIndex_8_GrPixelConfig:
// No current vulkan support for this config
return false;
case kAlpha_8_GrPixelConfig:
*format = VK_FORMAT_R8_UNORM;
- return true;
+ break;
case kETC1_GrPixelConfig:
// converting to ETC2 which is a superset of ETC1
*format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
- return true;
+ break;
case kLATC_GrPixelConfig:
// No current vulkan support for this config
return false;
case kR11_EAC_GrPixelConfig:
*format = VK_FORMAT_EAC_R11_UNORM_BLOCK;
- return true;
+ break;
case kASTC_12x12_GrPixelConfig:
*format = VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
- return true;
+ break;
case kRGBA_float_GrPixelConfig:
*format = VK_FORMAT_R32G32B32A32_SFLOAT;
- return true;
+ break;
case kRGBA_half_GrPixelConfig:
*format = VK_FORMAT_R16G16B16A16_SFLOAT;
- return true;
+ break;
case kAlpha_half_GrPixelConfig:
*format = VK_FORMAT_R16_SFLOAT;
- return true;
+ break;
+ default:
+ return false;
}
- SkFAIL("Unexpected config");
- return false;
+ return true;
}
bool GrVkFormatToPixelConfig(VkFormat format, GrPixelConfig* config) {
@@ -96,9 +92,6 @@ bool GrVkFormatToPixelConfig(VkFormat format, GrPixelConfig* config) {
case VK_FORMAT_B8G8R8A8_SRGB:
*config = kSBGRA_8888_GrPixelConfig;
break;
- case VK_FORMAT_R8G8B8A8_SINT:
- *config = kRGBA_8888_sint_GrPixelConfig;
- break;
case VK_FORMAT_R5G6B5_UNORM_PACK16:
*config = kRGB_565_GrPixelConfig;
break;
diff --git a/src/gpu/vk/GrVkVaryingHandler.cpp b/src/gpu/vk/GrVkVaryingHandler.cpp
index 10c536260f..f6fed21955 100644
--- a/src/gpu/vk/GrVkVaryingHandler.cpp
+++ b/src/gpu/vk/GrVkVaryingHandler.cpp
@@ -20,7 +20,6 @@ static inline int grsltype_to_location_size(GrSLType type) {
3, // kMat33f_GrSLType
4, // kMat44f_GrSLType
0, // kTexture2DSampler_GrSLType
- 0, // kTexture2DISampler_GrSLType
0, // kTextureExternalSampler_GrSLType
0, // kTexture2DRectSampler_GrSLType
0, // kTextureBufferSampler_GrSLType
@@ -41,15 +40,14 @@ static inline int grsltype_to_location_size(GrSLType type) {
GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
- GR_STATIC_ASSERT(9 == kTexture2DISampler_GrSLType);
- GR_STATIC_ASSERT(10 == kTextureExternalSampler_GrSLType);
- GR_STATIC_ASSERT(11 == kTexture2DRectSampler_GrSLType);
- GR_STATIC_ASSERT(12 == kTextureBufferSampler_GrSLType);
- GR_STATIC_ASSERT(13 == kBool_GrSLType);
- GR_STATIC_ASSERT(14 == kInt_GrSLType);
- GR_STATIC_ASSERT(15 == kUint_GrSLType);
- GR_STATIC_ASSERT(16 == kTexture2D_GrSLType);
- GR_STATIC_ASSERT(17 == kSampler_GrSLType);
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
+ GR_STATIC_ASSERT(12 == kBool_GrSLType);
+ GR_STATIC_ASSERT(13 == kInt_GrSLType);
+ GR_STATIC_ASSERT(14 == kUint_GrSLType);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrSLTypeCount);
}