Commit 366df2b2 by Geoff Lang Committed by Commit Bot

Vulkan: Support external texture binding points.

BUG=angleproject:2668 BUG=angleproject:3023 Change-Id: Idab0c4cbe1c7ed203ace50f1a6701dba11a40242 Reviewed-on: https://chromium-review.googlesource.com/c/1422548 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 77874e2c
...@@ -42,7 +42,7 @@ class TOutputGLSLBase : public TIntermTraverser ...@@ -42,7 +42,7 @@ class TOutputGLSLBase : public TIntermTraverser
void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr); void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr);
virtual void writeLayoutQualifier(TIntermTyped *variable); virtual void writeLayoutQualifier(TIntermTyped *variable);
void writeInvariantQualifier(const TType &type); void writeInvariantQualifier(const TType &type);
void writeVariableType(const TType &type, const TSymbol *symbol); virtual void writeVariableType(const TType &type, const TSymbol *symbol);
virtual bool writeVariablePrecision(TPrecision precision) = 0; virtual bool writeVariablePrecision(TPrecision precision) = 0;
void writeFunctionParameters(const TFunction *func); void writeFunctionParameters(const TFunction *func);
const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion); const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "compiler/translator/OutputVulkanGLSL.h" #include "compiler/translator/OutputVulkanGLSL.h"
#include "compiler/translator/BaseTypes.h"
#include "compiler/translator/Symbol.h" #include "compiler/translator/Symbol.h"
#include "compiler/translator/util.h" #include "compiler/translator/util.h"
...@@ -99,6 +100,19 @@ void TOutputVulkanGLSL::writeQualifier(TQualifier qualifier, const TSymbol *symb ...@@ -99,6 +100,19 @@ void TOutputVulkanGLSL::writeQualifier(TQualifier qualifier, const TSymbol *symb
out << "@@ QUALIFIER-" << symbol->name().data() << " @@ "; out << "@@ QUALIFIER-" << symbol->name().data() << " @@ ";
} }
void TOutputVulkanGLSL::writeVariableType(const TType &type, const TSymbol *symbol)
{
TType overrideType(type);
// External textures are treated as 2D textures in the vulkan back-end
if (type.getBasicType() == EbtSamplerExternalOES)
{
overrideType.setBasicType(EbtSampler2D);
}
TOutputGLSL::writeVariableType(overrideType, symbol);
}
void TOutputVulkanGLSL::writeStructType(const TStructure *structure) void TOutputVulkanGLSL::writeStructType(const TStructure *structure)
{ {
if (!structDeclared(structure)) if (!structDeclared(structure))
......
...@@ -32,6 +32,7 @@ class TOutputVulkanGLSL : public TOutputGLSL ...@@ -32,6 +32,7 @@ class TOutputVulkanGLSL : public TOutputGLSL
protected: protected:
void writeLayoutQualifier(TIntermTyped *variable) override; void writeLayoutQualifier(TIntermTyped *variable) override;
void writeQualifier(TQualifier qualifier, const TSymbol *symbol) override; void writeQualifier(TQualifier qualifier, const TSymbol *symbol) override;
void writeVariableType(const TType &type, const TSymbol *symbol) override;
}; };
} // namespace sh } // namespace sh
...@@ -51,8 +51,7 @@ void RendererVk::ensureCapsInitialized() const ...@@ -51,8 +51,7 @@ void RendererVk::ensureCapsInitialized() const
mNativeExtensions.translatedShaderSource = true; mNativeExtensions.translatedShaderSource = true;
mNativeExtensions.eglImage = true; mNativeExtensions.eglImage = true;
// TODO(geofflang): Support GL_OES_EGL_image_external. http://anglebug.com/2668 mNativeExtensions.eglImageExternal = true;
mNativeExtensions.eglImageExternal = false;
// TODO(geofflang): Support GL_OES_EGL_image_external_essl3. http://anglebug.com/2668 // TODO(geofflang): Support GL_OES_EGL_image_external_essl3. http://anglebug.com/2668
mNativeExtensions.eglImageExternalEssl3 = false; mNativeExtensions.eglImageExternalEssl3 = false;
......
...@@ -712,6 +712,7 @@ VkImageType GetImageType(gl::TextureType textureType) ...@@ -712,6 +712,7 @@ VkImageType GetImageType(gl::TextureType textureType)
case gl::TextureType::_2DMultisample: case gl::TextureType::_2DMultisample:
case gl::TextureType::_2DMultisampleArray: case gl::TextureType::_2DMultisampleArray:
case gl::TextureType::CubeMap: case gl::TextureType::CubeMap:
case gl::TextureType::External:
return VK_IMAGE_TYPE_2D; return VK_IMAGE_TYPE_2D;
case gl::TextureType::_3D: case gl::TextureType::_3D:
return VK_IMAGE_TYPE_3D; return VK_IMAGE_TYPE_3D;
...@@ -728,6 +729,7 @@ VkImageViewType GetImageViewType(gl::TextureType textureType) ...@@ -728,6 +729,7 @@ VkImageViewType GetImageViewType(gl::TextureType textureType)
{ {
case gl::TextureType::_2D: case gl::TextureType::_2D:
case gl::TextureType::_2DMultisample: case gl::TextureType::_2DMultisample:
case gl::TextureType::External:
return VK_IMAGE_VIEW_TYPE_2D; return VK_IMAGE_VIEW_TYPE_2D;
case gl::TextureType::_2DArray: case gl::TextureType::_2DArray:
case gl::TextureType::_2DMultisampleArray: case gl::TextureType::_2DMultisampleArray:
......
...@@ -517,8 +517,7 @@ TEST_P(ImageTest, ANGLEExtensionAvailability) ...@@ -517,8 +517,7 @@ TEST_P(ImageTest, ANGLEExtensionAvailability)
else if (IsVulkan()) else if (IsVulkan())
{ {
EXPECT_TRUE(hasOESExt()); EXPECT_TRUE(hasOESExt());
// TODO(geofflang): Support GL_OES_EGL_image_external. http://anglebug.com/2668 EXPECT_TRUE(hasExternalExt());
EXPECT_FALSE(hasExternalExt());
EXPECT_TRUE(hasBaseExt()); EXPECT_TRUE(hasBaseExt());
EXPECT_TRUE(has2DTextureExt()); EXPECT_TRUE(has2DTextureExt());
EXPECT_TRUE(hasCubemapExt()); EXPECT_TRUE(hasCubemapExt());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment