| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGLProgram.h" | 8 #include "GrGLProgram.h" |
| 9 | 9 |
| 10 #include "GrAllocator.h" | 10 #include "GrAllocator.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 void GrGLProgram::abandon() { | 90 void GrGLProgram::abandon() { |
| 91 fVShaderID = 0; | 91 fVShaderID = 0; |
| 92 fGShaderID = 0; | 92 fGShaderID = 0; |
| 93 fFShaderID = 0; | 93 fFShaderID = 0; |
| 94 fProgramID = 0; | 94 fProgramID = 0; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void GrGLProgram::overrideBlend(GrBlendCoeff* srcCoeff, | 97 void GrGLProgram::overrideBlend(GrBlendCoeff* srcCoeff, |
| 98 GrBlendCoeff* dstCoeff) const { | 98 GrBlendCoeff* dstCoeff) const { |
| 99 switch (fDesc.fCoverageOutput) { | 99 switch (fDesc.getHeader().fCoverageOutput) { |
| 100 case GrGLProgramDesc::kModulate_CoverageOutput: | 100 case GrGLProgramDesc::kModulate_CoverageOutput: |
| 101 break; | 101 break; |
| 102 // The prog will write a coverage value to the secondary | 102 // The prog will write a coverage value to the secondary |
| 103 // output and the dst is blended by one minus that value. | 103 // output and the dst is blended by one minus that value. |
| 104 case GrGLProgramDesc::kSecondaryCoverage_CoverageOutput: | 104 case GrGLProgramDesc::kSecondaryCoverage_CoverageOutput: |
| 105 case GrGLProgramDesc::kSecondaryCoverageISA_CoverageOutput: | 105 case GrGLProgramDesc::kSecondaryCoverageISA_CoverageOutput: |
| 106 case GrGLProgramDesc::kSecondaryCoverageISC_CoverageOutput: | 106 case GrGLProgramDesc::kSecondaryCoverageISC_CoverageOutput: |
| 107 *dstCoeff = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; | 107 *dstCoeff = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
| 108 break; | 108 break; |
| 109 case GrGLProgramDesc::kCombineWithDst_CoverageOutput: | 109 case GrGLProgramDesc::kCombineWithDst_CoverageOutput: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 blend_term_string(&colorStr, colorCoeff, filterColor, inColor, inColor); | 214 blend_term_string(&colorStr, colorCoeff, filterColor, inColor, inColor); |
| 215 blend_term_string(&constStr, uniformCoeff, filterColor, inColor, filterColor
); | 215 blend_term_string(&constStr, uniformCoeff, filterColor, inColor, filterColor
); |
| 216 | 216 |
| 217 SkString sum; | 217 SkString sum; |
| 218 GrGLSLAddf<4>(&sum, colorStr.c_str(), constStr.c_str()); | 218 GrGLSLAddf<4>(&sum, colorStr.c_str(), constStr.c_str()); |
| 219 builder->fsCodeAppendf("\t%s = %s;\n", outputVar, sum.c_str()); | 219 builder->fsCodeAppendf("\t%s = %s;\n", outputVar, sum.c_str()); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 GrSLConstantVec GrGLProgram::genInputColor(GrGLShaderBuilder* builder, SkString*
inColor) { | 223 GrSLConstantVec GrGLProgram::genInputColor(GrGLShaderBuilder* builder, SkString*
inColor) { |
| 224 switch (fDesc.fColorInput) { | 224 switch (fDesc.getHeader().fColorInput) { |
| 225 case GrGLProgramDesc::kAttribute_ColorInput: { | 225 case GrGLProgramDesc::kAttribute_ColorInput: { |
| 226 builder->addAttribute(kVec4f_GrSLType, COL_ATTR_NAME); | 226 builder->addAttribute(kVec4f_GrSLType, COL_ATTR_NAME); |
| 227 const char *vsName, *fsName; | 227 const char *vsName, *fsName; |
| 228 builder->addVarying(kVec4f_GrSLType, "Color", &vsName, &fsName); | 228 builder->addVarying(kVec4f_GrSLType, "Color", &vsName, &fsName); |
| 229 builder->vsCodeAppendf("\t%s = " COL_ATTR_NAME ";\n", vsName); | 229 builder->vsCodeAppendf("\t%s = " COL_ATTR_NAME ";\n", vsName); |
| 230 *inColor = fsName; | 230 *inColor = fsName; |
| 231 return kNone_GrSLConstantVec; | 231 return kNone_GrSLConstantVec; |
| 232 } | 232 } |
| 233 case GrGLProgramDesc::kUniform_ColorInput: { | 233 case GrGLProgramDesc::kUniform_ColorInput: { |
| 234 const char* name; | 234 const char* name; |
| 235 fUniformHandles.fColorUni = builder->addUniform(GrGLShaderBuilder::k
Fragment_ShaderType, | 235 fUniformHandles.fColorUni = builder->addUniform(GrGLShaderBuilder::k
Fragment_ShaderType, |
| 236 kVec4f_GrSLType, "Co
lor", &name); | 236 kVec4f_GrSLType, "Co
lor", &name); |
| 237 *inColor = name; | 237 *inColor = name; |
| 238 return kNone_GrSLConstantVec; | 238 return kNone_GrSLConstantVec; |
| 239 } | 239 } |
| 240 case GrGLProgramDesc::kTransBlack_ColorInput: | 240 case GrGLProgramDesc::kTransBlack_ColorInput: |
| 241 inColor->reset(); | 241 inColor->reset(); |
| 242 return kZeros_GrSLConstantVec; | 242 return kZeros_GrSLConstantVec; |
| 243 case GrGLProgramDesc::kSolidWhite_ColorInput: | 243 case GrGLProgramDesc::kSolidWhite_ColorInput: |
| 244 inColor->reset(); | 244 inColor->reset(); |
| 245 return kOnes_GrSLConstantVec; | 245 return kOnes_GrSLConstantVec; |
| 246 default: | 246 default: |
| 247 GrCrash("Unknown color type."); | 247 GrCrash("Unknown color type."); |
| 248 return kNone_GrSLConstantVec; | 248 return kNone_GrSLConstantVec; |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 GrSLConstantVec GrGLProgram::genInputCoverage(GrGLShaderBuilder* builder, SkStri
ng* inCoverage) { | 252 GrSLConstantVec GrGLProgram::genInputCoverage(GrGLShaderBuilder* builder, SkStri
ng* inCoverage) { |
| 253 switch (fDesc.fCoverageInput) { | 253 switch (fDesc.getHeader().fCoverageInput) { |
| 254 case GrGLProgramDesc::kAttribute_ColorInput: { | 254 case GrGLProgramDesc::kAttribute_ColorInput: { |
| 255 builder->addAttribute(kVec4f_GrSLType, COV_ATTR_NAME); | 255 builder->addAttribute(kVec4f_GrSLType, COV_ATTR_NAME); |
| 256 const char *vsName, *fsName; | 256 const char *vsName, *fsName; |
| 257 builder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &fsName); | 257 builder->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &fsName); |
| 258 builder->vsCodeAppendf("\t%s = " COV_ATTR_NAME ";\n", vsName); | 258 builder->vsCodeAppendf("\t%s = " COV_ATTR_NAME ";\n", vsName); |
| 259 *inCoverage = fsName; | 259 *inCoverage = fsName; |
| 260 return kNone_GrSLConstantVec; | 260 return kNone_GrSLConstantVec; |
| 261 } | 261 } |
| 262 case GrGLProgramDesc::kUniform_ColorInput: { | 262 case GrGLProgramDesc::kUniform_ColorInput: { |
| 263 const char* name; | 263 const char* name; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 275 return kOnes_GrSLConstantVec; | 275 return kOnes_GrSLConstantVec; |
| 276 default: | 276 default: |
| 277 GrCrash("Unknown color type."); | 277 GrCrash("Unknown color type."); |
| 278 return kNone_GrSLConstantVec; | 278 return kNone_GrSLConstantVec; |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 void GrGLProgram::genGeometryShader(GrGLShaderBuilder* builder) const { | 282 void GrGLProgram::genGeometryShader(GrGLShaderBuilder* builder) const { |
| 283 #if GR_GL_EXPERIMENTAL_GS | 283 #if GR_GL_EXPERIMENTAL_GS |
| 284 // TODO: The builder should add all this glue code. | 284 // TODO: The builder should add all this glue code. |
| 285 if (fDesc.fExperimentalGS) { | 285 if (fDesc.getHeader().fExperimentalGS) { |
| 286 GrAssert(fContext.info().glslGeneration() >= k150_GrGLSLGeneration); | 286 GrAssert(fContext.info().glslGeneration() >= k150_GrGLSLGeneration); |
| 287 builder->fGSHeader.append("layout(triangles) in;\n" | 287 builder->fGSHeader.append("layout(triangles) in;\n" |
| 288 "layout(triangle_strip, max_vertices = 6) out
;\n"); | 288 "layout(triangle_strip, max_vertices = 6) out
;\n"); |
| 289 builder->gsCodeAppend("\tfor (int i = 0; i < 3; ++i) {\n" | 289 builder->gsCodeAppend("\tfor (int i = 0; i < 3; ++i) {\n" |
| 290 "\t\tgl_Position = gl_in[i].gl_Position;\n"); | 290 "\t\tgl_Position = gl_in[i].gl_Position;\n"); |
| 291 if (fDesc.fEmitsPointSize) { | 291 if (fDesc.getHeader().fEmitsPointSize) { |
| 292 builder->gsCodeAppend("\t\tgl_PointSize = 1.0;\n"); | 292 builder->gsCodeAppend("\t\tgl_PointSize = 1.0;\n"); |
| 293 } | 293 } |
| 294 GrAssert(builder->fGSInputs.count() == builder->fGSOutputs.count()); | 294 GrAssert(builder->fGSInputs.count() == builder->fGSOutputs.count()); |
| 295 int count = builder->fGSInputs.count(); | 295 int count = builder->fGSInputs.count(); |
| 296 for (int i = 0; i < count; ++i) { | 296 for (int i = 0; i < count; ++i) { |
| 297 builder->gsCodeAppendf("\t\t%s = %s[i];\n", | 297 builder->gsCodeAppendf("\t\t%s = %s[i];\n", |
| 298 builder->fGSOutputs[i].getName().c_str(), | 298 builder->fGSOutputs[i].getName().c_str(), |
| 299 builder->fGSInputs[i].getName().c_str()); | 299 builder->fGSInputs[i].getName().c_str()); |
| 300 } | 300 } |
| 301 builder->gsCodeAppend("\t\tEmitVertex();\n" | 301 builder->gsCodeAppend("\t\tEmitVertex();\n" |
| 302 "\t}\n" | 302 "\t}\n" |
| 303 "\tEndPrimitive();\n"); | 303 "\tEndPrimitive();\n"); |
| 304 } | 304 } |
| 305 #endif | 305 #endif |
| 306 } | 306 } |
| 307 | 307 |
| 308 const char* GrGLProgram::adjustInColor(const SkString& inColor) const { | 308 const char* GrGLProgram::adjustInColor(const SkString& inColor) const { |
| 309 if (inColor.size()) { | 309 if (inColor.size()) { |
| 310 return inColor.c_str(); | 310 return inColor.c_str(); |
| 311 } else { | 311 } else { |
| 312 if (GrGLProgramDesc::kSolidWhite_ColorInput == fDesc.fColorInput) { | 312 if (GrGLProgramDesc::kSolidWhite_ColorInput == fDesc.getHeader().fColorI
nput) { |
| 313 return GrGLSLOnesVecf(4); | 313 return GrGLSLOnesVecf(4); |
| 314 } else { | 314 } else { |
| 315 return GrGLSLZerosVecf(4); | 315 return GrGLSLZerosVecf(4); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 namespace { | 320 namespace { |
| 321 // prints a shader using params similar to glShaderSource | 321 // prints a shader using params similar to glShaderSource |
| 322 void print_shader(GrGLint stringCnt, | 322 void print_shader(GrGLint stringCnt, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 GrPrintf(shader.c_str()); | 405 GrPrintf(shader.c_str()); |
| 406 GrPrintf("\n"); | 406 GrPrintf("\n"); |
| 407 } | 407 } |
| 408 | 408 |
| 409 if (!(fVShaderID = compile_shader(fContext, GR_GL_VERTEX_SHADER, shader))) { | 409 if (!(fVShaderID = compile_shader(fContext, GR_GL_VERTEX_SHADER, shader))) { |
| 410 return false; | 410 return false; |
| 411 } | 411 } |
| 412 | 412 |
| 413 fGShaderID = 0; | 413 fGShaderID = 0; |
| 414 #if GR_GL_EXPERIMENTAL_GS | 414 #if GR_GL_EXPERIMENTAL_GS |
| 415 if (fDesc.fExperimentalGS) { | 415 if (fDesc.getHeader().fExperimentalGS) { |
| 416 builder.getShader(GrGLShaderBuilder::kGeometry_ShaderType, &shader); | 416 builder.getShader(GrGLShaderBuilder::kGeometry_ShaderType, &shader); |
| 417 if (c_PrintShaders) { | 417 if (c_PrintShaders) { |
| 418 GrPrintf(shader.c_str()); | 418 GrPrintf(shader.c_str()); |
| 419 GrPrintf("\n"); | 419 GrPrintf("\n"); |
| 420 } | 420 } |
| 421 if (!(fGShaderID = compile_shader(fContext, GR_GL_GEOMETRY_SHADER, shade
r))) { | 421 if (!(fGShaderID = compile_shader(fContext, GR_GL_GEOMETRY_SHADER, shade
r))) { |
| 422 return false; | 422 return false; |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 #endif | 425 #endif |
| 426 | 426 |
| 427 builder.getShader(GrGLShaderBuilder::kFragment_ShaderType, &shader); | 427 builder.getShader(GrGLShaderBuilder::kFragment_ShaderType, &shader); |
| 428 if (c_PrintShaders) { | 428 if (c_PrintShaders) { |
| 429 GrPrintf(shader.c_str()); | 429 GrPrintf(shader.c_str()); |
| 430 GrPrintf("\n"); | 430 GrPrintf("\n"); |
| 431 } | 431 } |
| 432 if (!(fFShaderID = compile_shader(fContext, GR_GL_FRAGMENT_SHADER, shader)))
{ | 432 if (!(fFShaderID = compile_shader(fContext, GR_GL_FRAGMENT_SHADER, shader)))
{ |
| 433 return false; | 433 return false; |
| 434 } | 434 } |
| 435 | 435 |
| 436 return true; | 436 return true; |
| 437 } | 437 } |
| 438 | 438 |
| 439 bool GrGLProgram::genProgram(const GrEffectStage* stages[]) { | 439 bool GrGLProgram::genProgram(const GrEffectStage* stages[]) { |
| 440 GrAssert(0 == fProgramID); | 440 GrAssert(0 == fProgramID); |
| 441 | 441 |
| 442 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
| 443 |
| 442 GrGLShaderBuilder builder(fContext.info(), fUniformManager, fDesc); | 444 GrGLShaderBuilder builder(fContext.info(), fUniformManager, fDesc); |
| 443 | 445 |
| 444 // the dual source output has no canonical var name, have to | 446 // the dual source output has no canonical var name, have to |
| 445 // declare an output, which is incompatible with gl_FragColor/gl_FragData. | 447 // declare an output, which is incompatible with gl_FragColor/gl_FragData. |
| 446 bool dualSourceOutputWritten = false; | 448 bool dualSourceOutputWritten = false; |
| 447 | 449 |
| 448 GrGLShaderVar colorOutput; | 450 GrGLShaderVar colorOutput; |
| 449 bool isColorDeclared = GrGLSLSetupFSColorOuput(fContext.info().glslGeneratio
n(), | 451 bool isColorDeclared = GrGLSLSetupFSColorOuput(fContext.info().glslGeneratio
n(), |
| 450 declared_color_output_name(), | 452 declared_color_output_name(), |
| 451 &colorOutput); | 453 &colorOutput); |
| 452 if (isColorDeclared) { | 454 if (isColorDeclared) { |
| 453 builder.fFSOutputs.push_back(colorOutput); | 455 builder.fFSOutputs.push_back(colorOutput); |
| 454 } | 456 } |
| 455 | 457 |
| 456 const char* viewMName; | 458 const char* viewMName; |
| 457 fUniformHandles.fViewMatrixUni = builder.addUniform(GrGLShaderBuilder::kVert
ex_ShaderType, | 459 fUniformHandles.fViewMatrixUni = builder.addUniform(GrGLShaderBuilder::kVert
ex_ShaderType, |
| 458 kMat33f_GrSLType, "ViewM
", &viewMName); | 460 kMat33f_GrSLType, "ViewM
", &viewMName); |
| 459 | 461 |
| 460 | 462 |
| 461 builder.vsCodeAppendf("\tvec3 pos3 = %s * vec3(%s, 1);\n" | 463 builder.vsCodeAppendf("\tvec3 pos3 = %s * vec3(%s, 1);\n" |
| 462 "\tgl_Position = vec4(pos3.xy, 0, pos3.z);\n", | 464 "\tgl_Position = vec4(pos3.xy, 0, pos3.z);\n", |
| 463 viewMName, builder.positionAttribute().getName().c_str
()); | 465 viewMName, builder.positionAttribute().getName().c_str
()); |
| 464 | 466 |
| 465 // incoming color to current stage being processed. | 467 // incoming color to current stage being processed. |
| 466 SkString inColor; | 468 SkString inColor; |
| 467 GrSLConstantVec knownColorValue = this->genInputColor(&builder, &inColor); | 469 GrSLConstantVec knownColorValue = this->genInputColor(&builder, &inColor); |
| 468 | 470 |
| 469 // we output point size in the GS if present | 471 // we output point size in the GS if present |
| 470 if (fDesc.fEmitsPointSize | 472 if (header.fEmitsPointSize |
| 471 #if GR_GL_EXPERIMENTAL_GS | 473 #if GR_GL_EXPERIMENTAL_GS |
| 472 && !fDesc.fExperimentalGS | 474 && !header.fExperimentalGS |
| 473 #endif | 475 #endif |
| 474 ) { | 476 ) { |
| 475 builder.vsCodeAppend("\tgl_PointSize = 1.0;\n"); | 477 builder.vsCodeAppend("\tgl_PointSize = 1.0;\n"); |
| 476 } | 478 } |
| 477 | 479 |
| 478 // Get the coeffs for the Mode-based color filter, determine if color is nee
ded. | 480 // Get the coeffs for the Mode-based color filter, determine if color is nee
ded. |
| 479 SkXfermode::Coeff colorCoeff; | 481 SkXfermode::Coeff colorCoeff; |
| 480 SkXfermode::Coeff filterColorCoeff; | 482 SkXfermode::Coeff filterColorCoeff; |
| 481 SkAssertResult( | 483 SkAssertResult( |
| 482 SkXfermode::ModeAsCoeff(static_cast<SkXfermode::Mode>(fDesc.fColorFilter
Xfermode), | 484 SkXfermode::ModeAsCoeff(static_cast<SkXfermode::Mode>(header.fColorFilte
rXfermode), |
| 483 &filterColorCoeff, | 485 &filterColorCoeff, |
| 484 &colorCoeff)); | 486 &colorCoeff)); |
| 485 bool needColor, needFilterColor; | 487 bool needColor, needFilterColor; |
| 486 need_blend_inputs(filterColorCoeff, colorCoeff, &needFilterColor, &needColor
); | 488 need_blend_inputs(filterColorCoeff, colorCoeff, &needFilterColor, &needColor
); |
| 487 | 489 |
| 488 // used in order for builder to return the per-stage uniform handles. | 490 // used in order for builder to return the per-stage uniform handles. |
| 489 SkTArray<GrGLUniformManager::UniformHandle, true>* stageUniformArrays[GrDraw
State::kNumStages]; | 491 SkTArray<GrGLUniformManager::UniformHandle, true>* stageUniformArrays[GrDraw
State::kNumStages]; |
| 490 | 492 |
| 491 if (needColor) { | 493 if (needColor) { |
| 492 for (int s = 0; s < fDesc.fFirstCoverageStage; ++s) { | 494 for (int s = 0; s < fDesc.numColorEffects(); ++s) { |
| 493 stageUniformArrays[s] = &fUniformHandles.fEffectSamplerUnis[s]; | 495 stageUniformArrays[s] = &fUniformHandles.fEffectSamplerUnis[s]; |
| 494 } | 496 } |
| 495 | 497 |
| 496 builder.emitEffects(stages, | 498 builder.emitEffects(stages, |
| 497 fDesc.fEffectKeys, | 499 fDesc.effectKeys(), |
| 498 fDesc.fFirstCoverageStage, | 500 fDesc.numColorEffects(), |
| 499 &inColor, | 501 &inColor, |
| 500 &knownColorValue, | 502 &knownColorValue, |
| 501 stageUniformArrays, | 503 stageUniformArrays, |
| 502 fEffects); | 504 fEffects); |
| 503 } | 505 } |
| 504 | 506 |
| 505 // Insert the color filter. This will soon be replaced by a color effect. | 507 // Insert the color filter. This will soon be replaced by a color effect. |
| 506 if (SkXfermode::kDst_Mode != fDesc.fColorFilterXfermode) { | 508 if (SkXfermode::kDst_Mode != header.fColorFilterXfermode) { |
| 507 const char* colorFilterColorUniName = NULL; | 509 const char* colorFilterColorUniName = NULL; |
| 508 fUniformHandles.fColorFilterUni = builder.addUniform(GrGLShaderBuilder::
kFragment_ShaderType, | 510 fUniformHandles.fColorFilterUni = builder.addUniform(GrGLShaderBuilder::
kFragment_ShaderType, |
| 509 kVec4f_GrSLType, "F
ilterColor", | 511 kVec4f_GrSLType, "F
ilterColor", |
| 510 &colorFilterColorUn
iName); | 512 &colorFilterColorUn
iName); |
| 511 | 513 |
| 512 builder.fsCodeAppend("\tvec4 filteredColor;\n"); | 514 builder.fsCodeAppend("\tvec4 filteredColor;\n"); |
| 513 const char* color; | 515 const char* color; |
| 514 // add_color_filter requires a real input string. | 516 // add_color_filter requires a real input string. |
| 515 if (knownColorValue == kOnes_GrSLConstantVec) { | 517 if (knownColorValue == kOnes_GrSLConstantVec) { |
| 516 color = GrGLSLOnesVecf(4); | 518 color = GrGLSLOnesVecf(4); |
| 517 } else if (knownColorValue == kZeros_GrSLConstantVec) { | 519 } else if (knownColorValue == kZeros_GrSLConstantVec) { |
| 518 color = GrGLSLZerosVecf(4); | 520 color = GrGLSLZerosVecf(4); |
| 519 } else { | 521 } else { |
| 520 color = inColor.c_str(); | 522 color = inColor.c_str(); |
| 521 } | 523 } |
| 522 add_color_filter(&builder, "filteredColor", filterColorCoeff, | 524 add_color_filter(&builder, "filteredColor", filterColorCoeff, |
| 523 colorCoeff, colorFilterColorUniName, color); | 525 colorCoeff, colorFilterColorUniName, color); |
| 524 inColor = "filteredColor"; | 526 inColor = "filteredColor"; |
| 525 } | 527 } |
| 526 | 528 |
| 527 /////////////////////////////////////////////////////////////////////////// | 529 /////////////////////////////////////////////////////////////////////////// |
| 528 // compute the partial coverage | 530 // compute the partial coverage |
| 529 SkString inCoverage; | 531 SkString inCoverage; |
| 530 GrSLConstantVec knownCoverageValue = this->genInputCoverage(&builder, &inCov
erage); | 532 GrSLConstantVec knownCoverageValue = this->genInputCoverage(&builder, &inCov
erage); |
| 531 | 533 |
| 532 for (int s = fDesc.fFirstCoverageStage, i = 0; s < GrDrawState::kNumStages;
++s, ++i) { | 534 for (int s = 0; s < fDesc.numCoverageEffects(); ++s) { |
| 533 stageUniformArrays[i] = &fUniformHandles.fEffectSamplerUnis[s]; | 535 stageUniformArrays[s] = &fUniformHandles.fEffectSamplerUnis[s + fDesc.nu
mColorEffects()]; |
| 534 } | 536 } |
| 535 | 537 |
| 536 builder.emitEffects(stages + fDesc.fFirstCoverageStage, | 538 builder.emitEffects(stages + fDesc.numColorEffects(), |
| 537 fDesc.fEffectKeys + fDesc.fFirstCoverageStage, | 539 fDesc.getEffectKeys() + fDesc.numColorEffects(), |
| 538 GrDrawState::kNumStages - fDesc.fFirstCoverageStage, | 540 fDesc.numCoverageEffects(), |
| 539 &inCoverage, | 541 &inCoverage, |
| 540 &knownCoverageValue, | 542 &knownCoverageValue, |
| 541 stageUniformArrays, | 543 stageUniformArrays, |
| 542 fEffects + fDesc.fFirstCoverageStage); | 544 fEffects + fDesc.numColorEffects()); |
| 543 | 545 |
| 544 // discard if coverage is zero | 546 // discard if coverage is zero |
| 545 if (fDesc.fDiscardIfZeroCoverage && kOnes_GrSLConstantVec != knownCoverageVa
lue) { | 547 if (header.fDiscardIfZeroCoverage && kOnes_GrSLConstantVec != knownCoverageV
alue) { |
| 546 if (kZeros_GrSLConstantVec == knownCoverageValue) { | 548 if (kZeros_GrSLConstantVec == knownCoverageValue) { |
| 547 // This is unfortunate. | 549 // This is unfortunate. |
| 548 builder.fsCodeAppend("\tdiscard;\n"); | 550 builder.fsCodeAppend("\tdiscard;\n"); |
| 549 } else { | 551 } else { |
| 550 builder.fsCodeAppendf("\tif (all(lessThanEqual(%s, vec4(0.0)))) {\n\
t\tdiscard;\n\t}\n", | 552 builder.fsCodeAppendf("\tif (all(lessThanEqual(%s, vec4(0.0)))) {\n\
t\tdiscard;\n\t}\n", |
| 551 inCoverage.c_str()); | 553 inCoverage.c_str()); |
| 552 } | 554 } |
| 553 } | 555 } |
| 554 | 556 |
| 555 GrGLProgramDesc::CoverageOutput coverageOutput = | 557 GrGLProgramDesc::CoverageOutput coverageOutput = |
| 556 static_cast<GrGLProgramDesc::CoverageOutput>(fDesc.fCoverageOutput); | 558 static_cast<GrGLProgramDesc::CoverageOutput>(header.fCoverageOutput); |
| 557 if (GrGLProgramDesc::CoverageOutputUsesSecondaryOutput(coverageOutput)) { | 559 if (GrGLProgramDesc::CoverageOutputUsesSecondaryOutput(coverageOutput)) { |
| 558 builder.fFSOutputs.push_back().set(kVec4f_GrSLType, | 560 builder.fFSOutputs.push_back().set(kVec4f_GrSLType, |
| 559 GrGLShaderVar::kOut_TypeModifier, | 561 GrGLShaderVar::kOut_TypeModifier, |
| 560 dual_source_output_name()); | 562 dual_source_output_name()); |
| 561 // default coeff to ones for kCoverage_DualSrcOutput | 563 // default coeff to ones for kCoverage_DualSrcOutput |
| 562 SkString coeff; | 564 SkString coeff; |
| 563 GrSLConstantVec knownCoeffValue = kOnes_GrSLConstantVec; | 565 GrSLConstantVec knownCoeffValue = kOnes_GrSLConstantVec; |
| 564 if (GrGLProgramDesc::kSecondaryCoverageISA_CoverageOutput == fDesc.fCove
rageOutput) { | 566 if (GrGLProgramDesc::kSecondaryCoverageISA_CoverageOutput == header.fCov
erageOutput) { |
| 565 // Get (1-A) into coeff | 567 // Get (1-A) into coeff |
| 566 SkString inColorAlpha; | 568 SkString inColorAlpha; |
| 567 GrGLSLGetComponent4f(&inColorAlpha, | 569 GrGLSLGetComponent4f(&inColorAlpha, |
| 568 inColor.c_str(), | 570 inColor.c_str(), |
| 569 kA_GrColorComponentFlag, | 571 kA_GrColorComponentFlag, |
| 570 knownColorValue, | 572 knownColorValue, |
| 571 true); | 573 true); |
| 572 knownCoeffValue = GrGLSLSubtractf<1>(&coeff, | 574 knownCoeffValue = GrGLSLSubtractf<1>(&coeff, |
| 573 NULL, | 575 NULL, |
| 574 inColorAlpha.c_str(), | 576 inColorAlpha.c_str(), |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 } | 682 } |
| 681 GL_CALL(AttachShader(fProgramID, fFShaderID)); | 683 GL_CALL(AttachShader(fProgramID, fFShaderID)); |
| 682 | 684 |
| 683 if (bindColorOut) { | 685 if (bindColorOut) { |
| 684 GL_CALL(BindFragDataLocation(fProgramID, 0, declared_color_output_name()
)); | 686 GL_CALL(BindFragDataLocation(fProgramID, 0, declared_color_output_name()
)); |
| 685 } | 687 } |
| 686 if (bindDualSrcOut) { | 688 if (bindDualSrcOut) { |
| 687 GL_CALL(BindFragDataLocationIndexed(fProgramID, 0, 1, dual_source_output
_name())); | 689 GL_CALL(BindFragDataLocationIndexed(fProgramID, 0, 1, dual_source_output
_name())); |
| 688 } | 690 } |
| 689 | 691 |
| 692 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
| 693 |
| 690 // Bind the attrib locations to same values for all shaders | 694 // Bind the attrib locations to same values for all shaders |
| 691 GL_CALL(BindAttribLocation(fProgramID, | 695 GL_CALL(BindAttribLocation(fProgramID, |
| 692 fDesc.fPositionAttributeIndex, | 696 header.fPositionAttributeIndex, |
| 693 builder.positionAttribute().c_str())); | 697 builder.positionAttribute().c_str())); |
| 694 if (-1 != fDesc.fLocalCoordAttributeIndex) { | 698 if (-1 != header.fLocalCoordAttributeIndex) { |
| 695 GL_CALL(BindAttribLocation(fProgramID, | 699 GL_CALL(BindAttribLocation(fProgramID, |
| 696 fDesc.fLocalCoordAttributeIndex, | 700 header.fLocalCoordAttributeIndex, |
| 697 builder.localCoordsAttribute().c_str())); | 701 builder.localCoordsAttribute().c_str())); |
| 698 } | 702 } |
| 699 if (-1 != fDesc.fColorAttributeIndex) { | 703 if (-1 != header.fColorAttributeIndex) { |
| 700 GL_CALL(BindAttribLocation(fProgramID, fDesc.fColorAttributeIndex, COL_A
TTR_NAME)); | 704 GL_CALL(BindAttribLocation(fProgramID, header.fColorAttributeIndex, COL_
ATTR_NAME)); |
| 701 } | 705 } |
| 702 if (-1 != fDesc.fCoverageAttributeIndex) { | 706 if (-1 != header.fCoverageAttributeIndex) { |
| 703 GL_CALL(BindAttribLocation(fProgramID, fDesc.fCoverageAttributeIndex, CO
V_ATTR_NAME)); | 707 GL_CALL(BindAttribLocation(fProgramID, header.fCoverageAttributeIndex, C
OV_ATTR_NAME)); |
| 704 } | 708 } |
| 705 | 709 |
| 706 const GrGLShaderBuilder::AttributePair* attribEnd = builder.getEffectAttribu
tes().end(); | 710 const GrGLShaderBuilder::AttributePair* attribEnd = builder.getEffectAttribu
tes().end(); |
| 707 for (const GrGLShaderBuilder::AttributePair* attrib = builder.getEffectAttri
butes().begin(); | 711 for (const GrGLShaderBuilder::AttributePair* attrib = builder.getEffectAttri
butes().begin(); |
| 708 attrib != attribEnd; | 712 attrib != attribEnd; |
| 709 ++attrib) { | 713 ++attrib) { |
| 710 GL_CALL(BindAttribLocation(fProgramID, attrib->fIndex, attrib->fName.c_
str())); | 714 GL_CALL(BindAttribLocation(fProgramID, attrib->fIndex, attrib->fName.c_
str())); |
| 711 } | 715 } |
| 712 | 716 |
| 713 GL_CALL(LinkProgram(fProgramID)); | 717 GL_CALL(LinkProgram(fProgramID)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 fUniformManager.setSampler(handle, texUnitIdx); | 758 fUniformManager.setSampler(handle, texUnitIdx); |
| 755 ++texUnitIdx; | 759 ++texUnitIdx; |
| 756 } | 760 } |
| 757 } | 761 } |
| 758 } | 762 } |
| 759 } | 763 } |
| 760 | 764 |
| 761 /////////////////////////////////////////////////////////////////////////////// | 765 /////////////////////////////////////////////////////////////////////////////// |
| 762 | 766 |
| 763 void GrGLProgram::setData(GrGpuGL* gpu, | 767 void GrGLProgram::setData(GrGpuGL* gpu, |
| 764 GrColor color, | 768 GrDrawState::BlendOptFlags blendOpts, |
| 765 GrColor coverage, | 769 const GrEffectStage* stages[], |
| 766 const GrDeviceCoordTexture* dstCopy, | 770 const GrDeviceCoordTexture* dstCopy, |
| 767 SharedGLState* sharedState) { | 771 SharedGLState* sharedState) { |
| 768 const GrDrawState& drawState = gpu->getDrawState(); | 772 const GrDrawState& drawState = gpu->getDrawState(); |
| 769 | 773 |
| 774 GrColor color; |
| 775 GrColor coverage; |
| 776 if (blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag) { |
| 777 color = 0; |
| 778 coverage = 0; |
| 779 } else if (blendOpts & GrDrawState::kEmitCoverage_BlendOptFlag) { |
| 780 color = 0xffffffff; |
| 781 coverage = drawState.getCoverage(); |
| 782 } else { |
| 783 color = drawState.getColor(); |
| 784 coverage = drawState.getCoverage(); |
| 785 } |
| 786 |
| 770 this->setColor(drawState, color, sharedState); | 787 this->setColor(drawState, color, sharedState); |
| 771 this->setCoverage(drawState, coverage, sharedState); | 788 this->setCoverage(drawState, coverage, sharedState); |
| 772 this->setMatrixAndRenderTargetHeight(drawState); | 789 this->setMatrixAndRenderTargetHeight(drawState); |
| 773 | 790 |
| 774 // Setup the SkXfermode::Mode-based colorfilter uniform if necessary | 791 // Setup the SkXfermode::Mode-based colorfilter uniform if necessary |
| 775 if (GrGLUniformManager::kInvalidUniformHandle != fUniformHandles.fColorFilte
rUni && | 792 if (GrGLUniformManager::kInvalidUniformHandle != fUniformHandles.fColorFilte
rUni && |
| 776 fColorFilterColor != drawState.getColorFilterColor()) { | 793 fColorFilterColor != drawState.getColorFilterColor()) { |
| 777 GrGLfloat c[4]; | 794 GrGLfloat c[4]; |
| 778 GrColorToRGBAFloat(drawState.getColorFilterColor(), c); | 795 GrColorToRGBAFloat(drawState.getColorFilterColor(), c); |
| 779 fUniformManager.set4fv(fUniformHandles.fColorFilterUni, 0, 1, c); | 796 fUniformManager.set4fv(fUniformHandles.fColorFilterUni, 0, 1, c); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 796 static GrTextureParams kParams; // the default is clamp, nearest fil
tering. | 813 static GrTextureParams kParams; // the default is clamp, nearest fil
tering. |
| 797 gpu->bindTexture(texUnitIdx, kParams, texture); | 814 gpu->bindTexture(texUnitIdx, kParams, texture); |
| 798 ++texUnitIdx; | 815 ++texUnitIdx; |
| 799 } else { | 816 } else { |
| 800 GrAssert(GrGLUniformManager::kInvalidUniformHandle == | 817 GrAssert(GrGLUniformManager::kInvalidUniformHandle == |
| 801 fUniformHandles.fDstCopyScaleUni); | 818 fUniformHandles.fDstCopyScaleUni); |
| 802 GrAssert(GrGLUniformManager::kInvalidUniformHandle == | 819 GrAssert(GrGLUniformManager::kInvalidUniformHandle == |
| 803 fUniformHandles.fDstCopySamplerUni); | 820 fUniformHandles.fDstCopySamplerUni); |
| 804 } | 821 } |
| 805 } else { | 822 } else { |
| 806 GrAssert(GrGLUniformManager::kInvalidUniformHandle == | 823 GrAssert(GrGLUniformManager::kInvalidUniformHandle == fUniformHandles.fD
stCopyTopLeftUni); |
| 807 fUniformHandles.fDstCopyTopLeftUni); | 824 GrAssert(GrGLUniformManager::kInvalidUniformHandle == fUniformHandles.fD
stCopyScaleUni); |
| 808 GrAssert(GrGLUniformManager::kInvalidUniformHandle == | 825 GrAssert(GrGLUniformManager::kInvalidUniformHandle == fUniformHandles.fD
stCopySamplerUni); |
| 809 fUniformHandles.fDstCopyScaleUni); | |
| 810 GrAssert(GrGLUniformManager::kInvalidUniformHandle == | |
| 811 fUniformHandles.fDstCopySamplerUni); | |
| 812 } | 826 } |
| 813 for (int s = 0; s < GrDrawState::kNumStages; ++s) { | |
| 814 if (NULL != fEffects[s]) { | |
| 815 const GrEffectStage& stage = drawState.getStage(s); | |
| 816 GrAssert(NULL != stage.getEffect()); | |
| 817 | 827 |
| 818 bool explicitLocalCoords = -1 != fDesc.fLocalCoordAttributeIndex; | 828 int numEffects = fDesc.numTotalEffects(); |
| 819 GrDrawEffect drawEffect(stage, explicitLocalCoords); | 829 for (int e = 0; e < numEffects; ++e) { |
| 820 fEffects[s]->setData(fUniformManager, drawEffect); | 830 GrAssert(NULL != stages[e]); |
| 821 int numSamplers = fUniformHandles.fEffectSamplerUnis[s].count(); | 831 // We may have omitted the GrGLEffect because of the color filter logic
in genProgram. |
| 832 // This can be removed when the color filter is an effect. |
| 833 if (NULL != fEffects[e]) { |
| 834 bool explicitLocalCoords = -1 != fDesc.getHeader().fLocalCoordAttrib
uteIndex; |
| 835 GrDrawEffect drawEffect(*stages[e], explicitLocalCoords); |
| 836 fEffects[e]->setData(fUniformManager, drawEffect); |
| 837 int numSamplers = fUniformHandles.fEffectSamplerUnis[e].count(); |
| 822 for (int u = 0; u < numSamplers; ++u) { | 838 for (int u = 0; u < numSamplers; ++u) { |
| 823 UniformHandle handle = fUniformHandles.fEffectSamplerUnis[s][u]; | 839 UniformHandle handle = fUniformHandles.fEffectSamplerUnis[e][u]; |
| 824 if (GrGLUniformManager::kInvalidUniformHandle != handle) { | 840 if (GrGLUniformManager::kInvalidUniformHandle != handle) { |
| 825 const GrTextureAccess& access = (*stage.getEffect())->textur
eAccess(u); | 841 const GrTextureAccess& access = (*stages[e]->getEffect())->t
extureAccess(u); |
| 826 GrGLTexture* texture = static_cast<GrGLTexture*>(access.getT
exture()); | 842 GrGLTexture* texture = static_cast<GrGLTexture*>(access.getT
exture()); |
| 827 gpu->bindTexture(texUnitIdx, access.getParams(), texture); | 843 gpu->bindTexture(texUnitIdx, access.getParams(), texture); |
| 828 ++texUnitIdx; | 844 ++texUnitIdx; |
| 829 } | 845 } |
| 830 } | 846 } |
| 831 } | 847 } |
| 832 } | 848 } |
| 833 } | 849 } |
| 834 | 850 |
| 835 void GrGLProgram::setColor(const GrDrawState& drawState, | 851 void GrGLProgram::setColor(const GrDrawState& drawState, |
| 836 GrColor color, | 852 GrColor color, |
| 837 SharedGLState* sharedState) { | 853 SharedGLState* sharedState) { |
| 854 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
| 838 if (!drawState.hasColorVertexAttribute()) { | 855 if (!drawState.hasColorVertexAttribute()) { |
| 839 switch (fDesc.fColorInput) { | 856 switch (header.fColorInput) { |
| 840 case GrGLProgramDesc::kAttribute_ColorInput: | 857 case GrGLProgramDesc::kAttribute_ColorInput: |
| 841 GrAssert(-1 != fDesc.fColorAttributeIndex); | 858 GrAssert(-1 != header.fColorAttributeIndex); |
| 842 if (sharedState->fConstAttribColor != color || | 859 if (sharedState->fConstAttribColor != color || |
| 843 sharedState->fConstAttribColorIndex != fDesc.fColorAttribute
Index) { | 860 sharedState->fConstAttribColorIndex != header.fColorAttribut
eIndex) { |
| 844 // OpenGL ES only supports the float varieties of glVertexAt
trib | 861 // OpenGL ES only supports the float varieties of glVertexAt
trib |
| 845 GrGLfloat c[4]; | 862 GrGLfloat c[4]; |
| 846 GrColorToRGBAFloat(color, c); | 863 GrColorToRGBAFloat(color, c); |
| 847 GL_CALL(VertexAttrib4fv(fDesc.fColorAttributeIndex, c)); | 864 GL_CALL(VertexAttrib4fv(header.fColorAttributeIndex, c)); |
| 848 sharedState->fConstAttribColor = color; | 865 sharedState->fConstAttribColor = color; |
| 849 sharedState->fConstAttribColorIndex = fDesc.fColorAttributeI
ndex; | 866 sharedState->fConstAttribColorIndex = header.fColorAttribute
Index; |
| 850 } | 867 } |
| 851 break; | 868 break; |
| 852 case GrGLProgramDesc::kUniform_ColorInput: | 869 case GrGLProgramDesc::kUniform_ColorInput: |
| 853 if (fColor != color) { | 870 if (fColor != color) { |
| 854 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 871 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
| 855 GrGLfloat c[4]; | 872 GrGLfloat c[4]; |
| 856 GrColorToRGBAFloat(color, c); | 873 GrColorToRGBAFloat(color, c); |
| 857 GrAssert(GrGLUniformManager::kInvalidUniformHandle != | 874 GrAssert(GrGLUniformManager::kInvalidUniformHandle != |
| 858 fUniformHandles.fColorUni); | 875 fUniformHandles.fColorUni); |
| 859 fUniformManager.set4fv(fUniformHandles.fColorUni, 0, 1, c); | 876 fUniformManager.set4fv(fUniformHandles.fColorUni, 0, 1, c); |
| 860 fColor = color; | 877 fColor = color; |
| 861 } | 878 } |
| 862 sharedState->fConstAttribColorIndex = -1; | 879 sharedState->fConstAttribColorIndex = -1; |
| 863 break; | 880 break; |
| 864 case GrGLProgramDesc::kSolidWhite_ColorInput: | 881 case GrGLProgramDesc::kSolidWhite_ColorInput: |
| 865 case GrGLProgramDesc::kTransBlack_ColorInput: | 882 case GrGLProgramDesc::kTransBlack_ColorInput: |
| 866 sharedState->fConstAttribColorIndex = -1; | 883 sharedState->fConstAttribColorIndex = -1; |
| 867 break; | 884 break; |
| 868 default: | 885 default: |
| 869 GrCrash("Unknown color type."); | 886 GrCrash("Unknown color type."); |
| 870 } | 887 } |
| 871 } else { | 888 } else { |
| 872 sharedState->fConstAttribColorIndex = -1; | 889 sharedState->fConstAttribColorIndex = -1; |
| 873 } | 890 } |
| 874 } | 891 } |
| 875 | 892 |
| 876 void GrGLProgram::setCoverage(const GrDrawState& drawState, | 893 void GrGLProgram::setCoverage(const GrDrawState& drawState, |
| 877 GrColor coverage, | 894 GrColor coverage, |
| 878 SharedGLState* sharedState) { | 895 SharedGLState* sharedState) { |
| 896 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
| 879 if (!drawState.hasCoverageVertexAttribute()) { | 897 if (!drawState.hasCoverageVertexAttribute()) { |
| 880 switch (fDesc.fCoverageInput) { | 898 switch (header.fCoverageInput) { |
| 881 case GrGLProgramDesc::kAttribute_ColorInput: | 899 case GrGLProgramDesc::kAttribute_ColorInput: |
| 882 if (sharedState->fConstAttribCoverage != coverage || | 900 if (sharedState->fConstAttribCoverage != coverage || |
| 883 sharedState->fConstAttribCoverageIndex != fDesc.fCoverageAtt
ributeIndex) { | 901 sharedState->fConstAttribCoverageIndex != header.fCoverageAt
tributeIndex) { |
| 884 // OpenGL ES only supports the float varieties of glVertexA
ttrib | 902 // OpenGL ES only supports the float varieties of glVertexA
ttrib |
| 885 GrGLfloat c[4]; | 903 GrGLfloat c[4]; |
| 886 GrColorToRGBAFloat(coverage, c); | 904 GrColorToRGBAFloat(coverage, c); |
| 887 GL_CALL(VertexAttrib4fv(fDesc.fCoverageAttributeIndex, c)); | 905 GL_CALL(VertexAttrib4fv(header.fCoverageAttributeIndex, c)); |
| 888 sharedState->fConstAttribCoverage = coverage; | 906 sharedState->fConstAttribCoverage = coverage; |
| 889 sharedState->fConstAttribCoverageIndex = fDesc.fCoverageAttr
ibuteIndex; | 907 sharedState->fConstAttribCoverageIndex = header.fCoverageAtt
ributeIndex; |
| 890 } | 908 } |
| 891 break; | 909 break; |
| 892 case GrGLProgramDesc::kUniform_ColorInput: | 910 case GrGLProgramDesc::kUniform_ColorInput: |
| 893 if (fCoverage != coverage) { | 911 if (fCoverage != coverage) { |
| 894 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 912 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
| 895 GrGLfloat c[4]; | 913 GrGLfloat c[4]; |
| 896 GrColorToRGBAFloat(coverage, c); | 914 GrColorToRGBAFloat(coverage, c); |
| 897 GrAssert(GrGLUniformManager::kInvalidUniformHandle != | 915 GrAssert(GrGLUniformManager::kInvalidUniformHandle != |
| 898 fUniformHandles.fCoverageUni); | 916 fUniformHandles.fCoverageUni); |
| 899 fUniformManager.set4fv(fUniformHandles.fCoverageUni, 0, 1, c
); | 917 fUniformManager.set4fv(fUniformHandles.fCoverageUni, 0, 1, c
); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 SkScalarToFloat(m[SkMatrix::kMTransX]), | 970 SkScalarToFloat(m[SkMatrix::kMTransX]), |
| 953 SkScalarToFloat(m[SkMatrix::kMTransY]), | 971 SkScalarToFloat(m[SkMatrix::kMTransY]), |
| 954 SkScalarToFloat(m[SkMatrix::kMPersp2]) | 972 SkScalarToFloat(m[SkMatrix::kMPersp2]) |
| 955 }; | 973 }; |
| 956 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, mt); | 974 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, mt); |
| 957 fMatrixState.fViewMatrix = drawState.getViewMatrix(); | 975 fMatrixState.fViewMatrix = drawState.getViewMatrix(); |
| 958 fMatrixState.fRenderTargetSize = size; | 976 fMatrixState.fRenderTargetSize = size; |
| 959 fMatrixState.fRenderTargetOrigin = rt->origin(); | 977 fMatrixState.fRenderTargetOrigin = rt->origin(); |
| 960 } | 978 } |
| 961 } | 979 } |
| OLD | NEW |