Changeset 148992 in webkit
- Timestamp:
- Apr 23, 2013 2:18:36 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r148988 r148992 1 2013-04-23 Dirk Schulze <krit@webkit.org> 2 3 Pick up color and mat values in custom shaders 4 https://bugs.webkit.org/show_bug.cgi?id=115046 5 6 Reviewed by Dean Jackson. 7 8 Test that the CSS defined color values and mat2-4 functions get 9 set as uniforms in shader programs. 10 11 * css3/filters/custom/custom-filter-color-expected.html: Added. 12 * css3/filters/custom/custom-filter-color.html: Added. 13 * css3/filters/custom/custom-filter-matN-expected.html: Added. 14 * css3/filters/custom/custom-filter-matN.html: Added. 15 1 16 2013-04-23 Simon Fraser <simon.fraser@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r148990 r148992 1 2013-04-23 Dirk Schulze <krit@webkit.org> 2 3 Pick up color and mat values in custom shaders 4 https://bugs.webkit.org/show_bug.cgi?id=115046 5 6 Reviewed by Dean Jackson. 7 8 The custom filter functions accept color values and mat2-4 functions 9 as parameter types. These were implemented in CSS already. 10 This patch picks up the values and applies them as uniforms to the 11 custom shader program. 12 13 Tests: css3/filters/custom/custom-filter-color.html 14 css3/filters/custom/custom-filter-matN.html 15 16 * platform/graphics/filters/CustomFilterRenderer.cpp: 17 (WebCore::CustomFilterRenderer::bindProgramColorParameters): Set uniform for color values. 18 (WebCore): 19 (WebCore::CustomFilterRenderer::bindProgramMatrixParameters): Set uniform for mat2-4 values. 20 (WebCore::CustomFilterRenderer::bindProgramParameters): Call color and matrix functions. 21 * platform/graphics/filters/CustomFilterRenderer.h: 22 (WebCore): 23 (CustomFilterRenderer): 24 1 25 2013-04-23 Jacky Jiang <zhajiang@blackberry.com> 2 26 -
trunk/Source/WebCore/platform/graphics/filters/CustomFilterRenderer.cpp
r148852 r148992 36 36 37 37 #include "CustomFilterArrayParameter.h" 38 #include "CustomFilterColorParameter.h" 38 39 #include "CustomFilterCompiledProgram.h" 39 40 #include "CustomFilterConstants.h" … … 160 161 161 162 m_context->uniform1fv(uniformLocation, parameterSize, floatVector.data()); 163 } 164 165 void CustomFilterRenderer::bindProgramColorParameters(int uniformLocation, CustomFilterColorParameter* colorParameter) 166 { 167 float r, g, b, a; 168 colorParameter->color().getRGBA(r, g, b, a); 169 170 m_context->uniform4f(uniformLocation, r, g, b, a); 171 } 172 173 void CustomFilterRenderer::bindProgramMatrixParameters(int uniformLocation, CustomFilterArrayParameter* matrixParameter) 174 { 175 unsigned parameterSize = matrixParameter->size(); 176 Vector<GC3Dfloat, 16> floatVector; 177 178 for (unsigned i = 0; i < parameterSize; ++i) 179 floatVector.append(matrixParameter->valueAt(i)); 180 181 switch (parameterSize) { 182 case 4: 183 m_context->uniformMatrix2fv(uniformLocation, 1, false, floatVector.data()); 184 break; 185 case 9: 186 m_context->uniformMatrix3fv(uniformLocation, 1, false, floatVector.data()); 187 break; 188 case 16: 189 m_context->uniformMatrix4fv(uniformLocation, 1, false, floatVector.data()); 190 break; 191 default: 192 ASSERT_NOT_REACHED(); 193 } 162 194 } 163 195 … … 217 249 break; 218 250 case CustomFilterParameter::COLOR: 251 bindProgramColorParameters(uniformLocation, static_cast<CustomFilterColorParameter*>(parameter)); 252 break; 219 253 case CustomFilterParameter::MATRIX: 220 // FIXME: Bind color and matrix to context.254 bindProgramMatrixParameters(uniformLocation, static_cast<CustomFilterArrayParameter*>(parameter)); 221 255 break; 222 256 case CustomFilterParameter::NUMBER: -
trunk/Source/WebCore/platform/graphics/filters/CustomFilterRenderer.h
r139837 r148992 45 45 46 46 class CustomFilterArrayParameter; 47 class CustomFilterColorParameter; 47 48 class CustomFilterCompiledProgram; 48 49 class CustomFilterMesh; … … 77 78 void unbindVertexAttribute(int attributeLocation); 78 79 void bindProgramArrayParameters(int uniformLocation, CustomFilterArrayParameter*); 80 void bindProgramColorParameters(int uniformLocation, CustomFilterColorParameter*); 81 void bindProgramMatrixParameters(int uniformLocation, CustomFilterArrayParameter*); 79 82 void bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter*); 80 83 void bindProgramTransformParameter(int uniformLocation, CustomFilterTransformParameter*);
Note: See TracChangeset
for help on using the changeset viewer.