|
Lines 52-58
a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp_sec1
|
| 52 |
#endif |
52 |
#endif |
| 53 |
|
53 |
|
| 54 |
#if ENABLE(CSS_SHADERS) |
54 |
#if ENABLE(CSS_SHADERS) |
|
|
55 |
#include "WebCustomFilterOperation.h" |
| 55 |
#include "WebCustomFilterProgram.h" |
56 |
#include "WebCustomFilterProgram.h" |
|
|
57 |
#include "WebCustomFilterProgramProxy.h" |
| 56 |
#include <WebCore/CustomFilterArrayParameter.h> |
58 |
#include <WebCore/CustomFilterArrayParameter.h> |
| 57 |
#include <WebCore/CustomFilterConstants.h> |
59 |
#include <WebCore/CustomFilterConstants.h> |
| 58 |
#include <WebCore/CustomFilterNumberParameter.h> |
60 |
#include <WebCore/CustomFilterNumberParameter.h> |
|
Lines 142-164
void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder& encoder,
a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp_sec2
|
| 142 |
break; |
144 |
break; |
| 143 |
case FilterOperation::VALIDATED_CUSTOM: { |
145 |
case FilterOperation::VALIDATED_CUSTOM: { |
| 144 |
const ValidatedCustomFilterOperation* customOperation = static_cast<const ValidatedCustomFilterOperation*>(filter); |
146 |
const ValidatedCustomFilterOperation* customOperation = static_cast<const ValidatedCustomFilterOperation*>(filter); |
| 145 |
|
|
|
| 146 |
ASSERT(customOperation->validatedProgram()); |
147 |
ASSERT(customOperation->validatedProgram()); |
| 147 |
RefPtr<CustomFilterValidatedProgram> program = customOperation->validatedProgram(); |
148 |
RefPtr<CustomFilterValidatedProgram> program = customOperation->validatedProgram(); |
| 148 |
ASSERT(program->isInitialized()); |
149 |
ASSERT(program->isInitialized()); |
| 149 |
ASSERT(program->platformCompiledProgram()); |
150 |
ASSERT(program->platformCompiledProgram()); |
| 150 |
// FIXME: We should only serialize the object if it was not serialized before, |
151 |
ASSERT(program->platformCompiledProgram()->client()); |
| 151 |
// otherwise only the ID of the program should be written to the stream. |
152 |
WebCustomFilterProgramProxy* customFilterProgramProxy = static_cast<WebCustomFilterProgramProxy*>(program->platformCompiledProgram()->client()); |
| 152 |
// https://bugs.webkit.org/show_bug.cgi?id=101801 |
|
|
| 153 |
encoder << program->validatedVertexShader(); |
| 154 |
encoder << program->validatedFragmentShader(); |
| 155 |
const CustomFilterProgramInfo& programInfo = program->programInfo(); |
153 |
const CustomFilterProgramInfo& programInfo = program->programInfo(); |
| 156 |
encoder.encodeEnum(programInfo.programType()); |
154 |
// FIXME: CustomFilterOperation should not need the meshType, it should just be encoded in the program itself. |
| 157 |
const CustomFilterProgramMixSettings& mixSettings = programInfo.mixSettings(); |
155 |
// https://bugs.webkit.org/show_bug.cgi?id=102529 |
| 158 |
encoder.encodeEnum(mixSettings.blendMode); |
|
|
| 159 |
encoder.encodeEnum(mixSettings.compositeOperator); |
| 160 |
encoder.encodeEnum(programInfo.meshType()); |
156 |
encoder.encodeEnum(programInfo.meshType()); |
| 161 |
|
157 |
encoder << customFilterProgramProxy->wasSentToUIProcess(); |
|
|
158 |
encoder << customFilterProgramProxy->id(); |
| 159 |
if (!customFilterProgramProxy->wasSentToUIProcess()) { |
| 160 |
customFilterProgramProxy->setWasSentToUIProcess(true); |
| 161 |
encoder << program->validatedVertexShader(); |
| 162 |
encoder << program->validatedFragmentShader(); |
| 163 |
encoder.encodeEnum(programInfo.programType()); |
| 164 |
const CustomFilterProgramMixSettings& mixSettings = programInfo.mixSettings(); |
| 165 |
encoder.encodeEnum(mixSettings.blendMode); |
| 166 |
encoder.encodeEnum(mixSettings.compositeOperator); |
| 167 |
} |
| 162 |
CustomFilterParameterList parameters = customOperation->parameters(); |
168 |
CustomFilterParameterList parameters = customOperation->parameters(); |
| 163 |
encoder << static_cast<uint32_t>(parameters.size()); |
169 |
encoder << static_cast<uint32_t>(parameters.size()); |
| 164 |
for (size_t i = 0; i < parameters.size(); ++i) { |
170 |
for (size_t i = 0; i < parameters.size(); ++i) { |
|
Lines 264-287
bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder,
a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp_sec3
|
| 264 |
ASSERT_NOT_REACHED(); |
270 |
ASSERT_NOT_REACHED(); |
| 265 |
break; |
271 |
break; |
| 266 |
case FilterOperation::VALIDATED_CUSTOM: { |
272 |
case FilterOperation::VALIDATED_CUSTOM: { |
| 267 |
String vertexShaderString; |
273 |
// FIXME: CustomFilterOperation should not need the meshType. |
| 268 |
String fragmentShaderString; |
274 |
// https://bugs.webkit.org/show_bug.cgi?id=102529 |
| 269 |
CustomFilterProgramType programType; |
|
|
| 270 |
CustomFilterProgramMixSettings mixSettings; |
| 271 |
CustomFilterMeshType meshType; |
275 |
CustomFilterMeshType meshType; |
| 272 |
if (!decoder->decode(vertexShaderString)) |
276 |
if (!decoder->decodeEnum(meshType)) |
| 273 |
return false; |
|
|
| 274 |
if (!decoder->decode(fragmentShaderString)) |
| 275 |
return false; |
| 276 |
if (!decoder->decodeEnum(programType)) |
| 277 |
return false; |
| 278 |
if (!decoder->decodeEnum(mixSettings.blendMode)) |
| 279 |
return false; |
277 |
return false; |
| 280 |
if (!decoder->decodeEnum(mixSettings.compositeOperator)) |
278 |
bool programWasSentToUIProcessBefore = false; |
|
|
279 |
int programId = 0; |
| 280 |
if (!decoder->decode(programWasSentToUIProcessBefore)) |
| 281 |
return false; |
281 |
return false; |
| 282 |
if (!decoder->decodeEnum(meshType)) |
282 |
if (!decoder->decode(programId)) |
| 283 |
return false; |
283 |
return false; |
| 284 |
RefPtr<CustomFilterProgram> program = WebCustomFilterProgram::create(vertexShaderString, fragmentShaderString, programType, mixSettings, meshType); |
284 |
RefPtr<CustomFilterProgram> program; |
|
|
285 |
if (!programWasSentToUIProcessBefore) { |
| 286 |
String vertexShaderString; |
| 287 |
String fragmentShaderString; |
| 288 |
CustomFilterProgramType programType; |
| 289 |
CustomFilterProgramMixSettings mixSettings; |
| 290 |
if (!decoder->decode(vertexShaderString)) |
| 291 |
return false; |
| 292 |
if (!decoder->decode(fragmentShaderString)) |
| 293 |
return false; |
| 294 |
if (!decoder->decodeEnum(programType)) |
| 295 |
return false; |
| 296 |
if (!decoder->decodeEnum(mixSettings.blendMode)) |
| 297 |
return false; |
| 298 |
if (!decoder->decodeEnum(mixSettings.compositeOperator)) |
| 299 |
return false; |
| 300 |
program = WebCustomFilterProgram::create(vertexShaderString, fragmentShaderString, programType, mixSettings, meshType); |
| 301 |
} |
| 285 |
|
302 |
|
| 286 |
uint32_t parametersSize; |
303 |
uint32_t parametersSize; |
| 287 |
if (!decoder->decodeUInt32(parametersSize)) |
304 |
if (!decoder->decodeUInt32(parametersSize)) |
|
Lines 347-354
bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder,
a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp_sec4
|
| 347 |
if (!decoder->decodeEnum(meshBoxType)) |
364 |
if (!decoder->decodeEnum(meshBoxType)) |
| 348 |
return false; |
365 |
return false; |
| 349 |
|
366 |
|
| 350 |
// At this point the Shaders are already validated, so we just use CustomFilterOperation for transportation. |
367 |
// At this point the Shaders are already validated, so we just use WebCustomFilterOperation for transportation. |
| 351 |
filter = CustomFilterOperation::create(program.release(), parameters, meshRows, meshColumns, meshBoxType, meshType); |
368 |
filter = WebCustomFilterOperation::create(program.release(), programId, parameters, meshRows, meshColumns, meshBoxType, meshType); |
| 352 |
break; |
369 |
break; |
| 353 |
} |
370 |
} |
| 354 |
#endif |
371 |
#endif |