Commit e9526c4f authored by roger_fong@apple.com's avatar roger_fong@apple.com

Hook into some shader symbol logic following the ANGLE update in r159533.

https://bugs.webkit.org/show_bug.cgi?id=125332.

Reviewed by Brent Fulgham.

No new functionality added.

* html/canvas/WebGLRenderingContext.cpp: Add some error checking for errors related to
    shader symbols that exist across both vertex and fragment shaders.
(WebCore::WebGLRenderingContext::linkProgram):
* platform/graphics/ANGLEWebKitBridge.cpp: Add logic for handling varyings
    and add new fields to the ANGLEShaderSymbol struct.
(WebCore::getSymbolInfo):
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/GraphicsContext3D.h: Add those same fields to the SymbolInfo struct
    as well so that we can access them from our shader source map.
    Also add a map of varyings along side the uniforms and attributes.
(WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
(WebCore::GraphicsContext3D::ShaderSourceEntry::symbolMap):
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::areProgramSymbolsValid): Will be filled in later, this method
    will use the shader source map to check for issues with unused varyings and precisions
    mismatches of shader symbols that exist across both the vertex and fragment shaders.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160223 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 135718ab
2013-12-06 Roger Fong <roger_fong@apple.com>
Hook into some shader symbol logic following the ANGLE update in r159533.
https://bugs.webkit.org/show_bug.cgi?id=125332.
Reviewed by Brent Fulgham.
No new functionality added.
* html/canvas/WebGLRenderingContext.cpp: Add some error checking for errors related to
shader symbols that exist across both vertex and fragment shaders.
(WebCore::WebGLRenderingContext::linkProgram):
* platform/graphics/ANGLEWebKitBridge.cpp: Add logic for handling varyings
and add new fields to the ANGLEShaderSymbol struct.
(WebCore::getSymbolInfo):
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/GraphicsContext3D.h: Add those same fields to the SymbolInfo struct
as well so that we can access them from our shader source map.
Also add a map of varyings along side the uniforms and attributes.
(WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
(WebCore::GraphicsContext3D::ShaderSourceEntry::symbolMap):
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::areProgramSymbolsValid): Will be filled in later, this method
will use the shader source map to check for issues with unused varyings and precisions
mismatches of shader symbols that exist across both the vertex and fragment shaders.
2013-12-06 Lukasz Gajowy <l.gajowy@samsung.com>
[ATK] Missing aria roles mappings
......@@ -3349,7 +3349,7 @@ void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec
if (!isGLES2Compliant()) {
WebGLShader* vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
WebGLShader* fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid()) {
if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->areProgramSymbolsValid(objectOrZero(vertexShader), objectOrZero(fragmentShader))) {
program->setLinkStatus(false);
return;
}
......
......@@ -58,6 +58,8 @@ static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector<ANG
case SH_ACTIVE_UNIFORMS:
symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
break;
case SH_VARYINGS:
symbolMaxNameLengthType = SH_VARYING_MAX_LENGTH;
default:
ASSERT_NOT_REACHED();
return false;
......@@ -91,6 +93,10 @@ static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector<ANG
symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &precision, &staticUse, nameBuffer.data(), mappedNameBuffer.data());
break;
case SH_VARYINGS:
symbol.symbolType = SHADER_SYMBOL_TYPE_VARYING;
ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &precision, &staticUse, nameBuffer.data(), mappedNameBuffer.data());
break;
default:
ASSERT_NOT_REACHED();
return false;
......@@ -119,6 +125,8 @@ static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector<ANG
symbol.name = name;
symbol.mappedName = mappedName;
symbol.precision = precision;
symbol.staticUse = staticUse;
symbols.append(symbol);
if (symbol.isArray) {
......
......@@ -46,7 +46,8 @@ enum ANGLEShaderType {
enum ANGLEShaderSymbolType {
SHADER_SYMBOL_TYPE_ATTRIBUTE,
SHADER_SYMBOL_TYPE_UNIFORM
SHADER_SYMBOL_TYPE_UNIFORM,
SHADER_SYMBOL_TYPE_VARYING
};
struct ANGLEShaderSymbol {
......@@ -56,6 +57,8 @@ struct ANGLEShaderSymbol {
ShDataType dataType;
int size;
bool isArray;
ShPrecisionType precision;
int staticUse;
bool isSampler() const
{
......
......@@ -758,6 +758,7 @@ public:
void useProgram(Platform3DObject);
void validateProgram(Platform3DObject);
bool areProgramSymbolsValid(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values);
......@@ -963,13 +964,17 @@ private:
SymbolInfo()
: type(0)
, size(0)
, precision(SH_PRECISION_UNDEFINED)
, staticUse(0)
{
}
SymbolInfo(GC3Denum type, int size, const String& mappedName)
SymbolInfo(GC3Denum type, int size, const String& mappedName, ShPrecisionType precision, int staticUse)
: type(type)
, size(size)
, mappedName(mappedName)
, precision(precision)
, staticUse(staticUse)
{
}
......@@ -981,6 +986,8 @@ private:
GC3Denum type;
int size;
String mappedName;
ShPrecisionType precision;
int staticUse;
};
typedef HashMap<String, SymbolInfo> ShaderSymbolMap;
......@@ -993,6 +1000,7 @@ private:
bool isValid;
ShaderSymbolMap attributeMap;
ShaderSymbolMap uniformMap;
ShaderSymbolMap varyingMap;
ShaderSourceEntry()
: type(VERTEX_SHADER)
, isValid(false)
......@@ -1001,9 +1009,11 @@ private:
ShaderSymbolMap& symbolMap(enum ANGLEShaderSymbolType symbolType)
{
ASSERT(symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE || symbolType == SHADER_SYMBOL_TYPE_UNIFORM);
ASSERT(symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE || symbolType == SHADER_SYMBOL_TYPE_UNIFORM || symbolType == SHADER_SYMBOL_TYPE_VARYING);
if (symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE)
return attributeMap;
if (symbolType == SHADER_SYMBOL_TYPE_VARYING)
return varyingMap;
return uniformMap;
}
};
......
......@@ -184,7 +184,7 @@ String Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE(Platform3DObject
size_t numSymbols = symbols.size();
for (size_t i = 0; i < numSymbols; ++i) {
ANGLEShaderSymbol shaderSymbol = symbols[i];
GraphicsContext3D::SymbolInfo symbolInfo(shaderSymbol.dataType, shaderSymbol.size, shaderSymbol.mappedName);
GraphicsContext3D::SymbolInfo symbolInfo(shaderSymbol.dataType, shaderSymbol.size, shaderSymbol.mappedName, shaderSymbol.precision, shaderSymbol.staticUse);
entry.symbolMap(shaderSymbol.symbolType).set(shaderSymbol.name, symbolInfo);
}
......
......@@ -326,6 +326,14 @@ void GraphicsContext3D::reshape(int width, int height)
::glFlush();
}
bool GraphicsContext3D::areProgramSymbolsValid(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
{
UNUSED_PARAM(vertexShader);
UNUSED_PARAM(fragmentShader);
// TODO: Fill me in.
return true;
}
IntSize GraphicsContext3D::getInternalFramebufferSize() const
{
return IntSize(m_currentWidth, m_currentHeight);
......
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