Commit e59d8716 by Shahbaz Youssefi Committed by Commit Bot

GL: Expose OES_shader_io_blocks

As extra validation that new tests are indeed correct. Bug: angleproject:3580 Change-Id: I4792bd8e26f96ab6c988f2605f053ce5789a782f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2577818Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 8b4990bb
......@@ -258,8 +258,7 @@ void TOutputGLSLBase::writeLayoutQualifier(TIntermTyped *variable)
if (type.getBasicType() == EbtInterfaceBlock)
{
const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
declareInterfaceBlockLayout(interfaceBlock);
declareInterfaceBlockLayout(type);
return;
}
......@@ -1321,42 +1320,45 @@ void TOutputGLSLBase::declareStruct(const TStructure *structure)
}
}
void TOutputGLSLBase::declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock)
void TOutputGLSLBase::declareInterfaceBlockLayout(const TType &type)
{
TInfoSinkBase &out = objSink();
out << "layout(";
const TQualifier &qualifier = interfaceBlock->fields().front()->type()->getQualifier();
// 4.4.5 Uniform and Shader Storage Block Layout Qualifiers in GLSL 4.5 spec.
// Layout qualifiers can be used for uniform and shader storage blocks,
// but not for non-block uniform declarations.
if (!IsShaderIoBlock(qualifier))
if (IsShaderIoBlock(type.getQualifier()))
{
switch (interfaceBlock->blockStorage())
{
case EbsUnspecified:
case EbsShared:
// Default block storage is shared.
out << "shared";
break;
return;
}
case EbsPacked:
out << "packed";
break;
const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
TInfoSinkBase &out = objSink();
case EbsStd140:
out << "std140";
break;
out << "layout(";
case EbsStd430:
out << "std430";
break;
switch (interfaceBlock->blockStorage())
{
case EbsUnspecified:
case EbsShared:
// Default block storage is shared.
fprintf(stderr, "\n\n\nHERE\n\n\n");
out << "shared";
break;
default:
UNREACHABLE();
break;
}
case EbsPacked:
out << "packed";
break;
case EbsStd140:
out << "std140";
break;
case EbsStd430:
out << "std430";
break;
default:
UNREACHABLE();
break;
}
if (interfaceBlock->blockBinding() >= 0)
......
......@@ -96,7 +96,7 @@ class TOutputGLSLBase : public TIntermTraverser
sh::GLenum getShaderType() { return mShaderType; }
private:
void declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock);
void declareInterfaceBlockLayout(const TType &type);
void declareInterfaceBlock(const TInterfaceBlock *interfaceBlock);
void writeBuiltInFunctionTriplet(Visit visit, TOperator op, bool useEmulatedFunction);
......
......@@ -1554,6 +1554,11 @@ void GenerateCaps(const FunctionsGL *functions,
functions->isAtLeastGLES(gl::Version(3, 2)) ||
functions->hasGLExtension("GL_ARB_gpu_shader5") ||
functions->hasGLESExtension("GL_EXT_gpu_shader5");
extensions->shaderIoBlocksOES = functions->isAtLeastGL(gl::Version(3, 2)) ||
functions->isAtLeastGLES(gl::Version(3, 2)) ||
functions->hasGLESExtension("GL_OES_shader_io_blocks") ||
functions->hasGLESExtension("GL_EXT_shader_io_blocks");
extensions->shaderIoBlocksEXT = extensions->shaderIoBlocksOES;
extensions->shadowSamplersEXT = functions->isAtLeastGL(gl::Version(2, 0)) ||
functions->isAtLeastGLES(gl::Version(3, 0)) ||
......
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