DescriptionThis patch implements the diffuse and specular lighting filters in Ganesh. There are three light types for each: distant, point and spot, whose code generation lives in a GrGLLight class hierarchy. This similar to the CPU implementation, where each light type provides a function to compute the vector from the surface plane to the light (surfaceToLight) and to compute the light colour (emitLightColour). Instead of templated member functions, as in the CPU implementation, these are virtual functions to emit the light-specific GLSL code.
All of the code for the GPU path lives in the same file as that for the CPU path, SkLightingImageFilter.cpp. In order to provide Ganesh a hook to access it, SkImageFilter now has a asNewCustomStage() virtual, which allows an image filter to return a GrCustomStage representing that filter.
Note that this patch does not handle the border conditions correctly (the [top|bottom][Left|Right]Normal() functions in the CPU implementation). That will come in a future patch.
Patch Set 1 #Patch Set 2 : Fix for SK_SCALAR_IS_FIXED build #
Total comments: 6
Patch Set 3 : Interim version, to fix the GrGLLight singleton problem #Patch Set 4 : Implemented asCustomStage(), moved all effect code to SkLightImageFilter #
Total comments: 4
Patch Set 5 : Move applyCustomStage into SkGpuDevice.cpp; improve comments #Patch Set 6 : Add test cases to GrGpuGL_unittest.cpp #
Total comments: 1
Patch Set 7 : asNewCustomStage(), GrStringBuilder -> SkString, _VariableLifetime -> _ShaderType #
MessagesTotal messages: 31
|