| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 combined.set(SkMatrix::kMScaleY, | 46 combined.set(SkMatrix::kMScaleY, |
| 47 combined[SkMatrix::kMPersp1] - combined[SkMatrix::kMScaleY]); | 47 combined[SkMatrix::kMPersp1] - combined[SkMatrix::kMScaleY]); |
| 48 combined.set(SkMatrix::kMTransY, | 48 combined.set(SkMatrix::kMTransY, |
| 49 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]); | 49 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]); |
| 50 } | 50 } |
| 51 return combined; | 51 return combined; |
| 52 } | 52 } |
| 53 | 53 |
| 54 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 54 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 55 | 55 |
| 56 GrGLProgram::GrGLProgram(GrGpuGL* gpu, | 56 GrGLProgram::GrGLProgram(GrGLGpu* gpu, |
| 57 const GrProgramDesc& desc, | 57 const GrProgramDesc& desc, |
| 58 const BuiltinUniformHandles& builtinUniforms, | 58 const BuiltinUniformHandles& builtinUniforms, |
| 59 GrGLuint programID, | 59 GrGLuint programID, |
| 60 const UniformInfoArray& uniforms, | 60 const UniformInfoArray& uniforms, |
| 61 GrGLInstalledGeoProc* geometryProcessor, | 61 GrGLInstalledGeoProc* geometryProcessor, |
| 62 GrGLInstalledXferProc* xferProcessor, | 62 GrGLInstalledXferProc* xferProcessor, |
| 63 GrGLInstalledFragProcs* fragmentProcessors) | 63 GrGLInstalledFragProcs* fragmentProcessors) |
| 64 : fColor(GrColor_ILLEGAL) | 64 : fColor(GrColor_ILLEGAL) |
| 65 , fCoverage(0) | 65 , fCoverage(0) |
| 66 , fDstCopyTexUnit(-1) | 66 , fDstCopyTexUnit(-1) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); | 232 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); |
| 233 | 233 |
| 234 GrGLfloat rtAdjustmentVec[4]; | 234 GrGLfloat rtAdjustmentVec[4]; |
| 235 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); | 235 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); |
| 236 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); | 236 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 ////////////////////////////////////////////////////////////////////////////////
///////// | 240 ////////////////////////////////////////////////////////////////////////////////
///////// |
| 241 | 241 |
| 242 GrGLNvprProgramBase::GrGLNvprProgramBase(GrGpuGL* gpu, | 242 GrGLNvprProgramBase::GrGLNvprProgramBase(GrGLGpu* gpu, |
| 243 const GrProgramDesc& desc, | 243 const GrProgramDesc& desc, |
| 244 const BuiltinUniformHandles& builtinUni
forms, | 244 const BuiltinUniformHandles& builtinUni
forms, |
| 245 GrGLuint programID, | 245 GrGLuint programID, |
| 246 const UniformInfoArray& uniforms, | 246 const UniformInfoArray& uniforms, |
| 247 GrGLInstalledGeoProc* primProc, | 247 GrGLInstalledGeoProc* primProc, |
| 248 GrGLInstalledXferProc* xferProcessor, | 248 GrGLInstalledXferProc* xferProcessor, |
| 249 GrGLInstalledFragProcs* fragmentProcess
ors) | 249 GrGLInstalledFragProcs* fragmentProcess
ors) |
| 250 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, | 250 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, |
| 251 xferProcessor, fragmentProcessors) { | 251 xferProcessor, fragmentProcessors) { |
| 252 } | 252 } |
| 253 | 253 |
| 254 void GrGLNvprProgramBase::onSetMatrixAndRenderTargetHeight(const GrOptDrawState&
optState) { | 254 void GrGLNvprProgramBase::onSetMatrixAndRenderTargetHeight(const GrOptDrawState&
optState) { |
| 255 SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType())); | 255 SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType())); |
| 256 const GrRenderTarget* rt = optState.getRenderTarget(); | 256 const GrRenderTarget* rt = optState.getRenderTarget(); |
| 257 SkISize size; | 257 SkISize size; |
| 258 size.set(rt->width(), rt->height()); | 258 size.set(rt->width(), rt->height()); |
| 259 fGpu->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), size,
rt->origin()); | 259 fGpu->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), size,
rt->origin()); |
| 260 } | 260 } |
| 261 | 261 |
| 262 ////////////////////////////////////////////////////////////////////////////////
///////// | 262 ////////////////////////////////////////////////////////////////////////////////
///////// |
| 263 | 263 |
| 264 GrGLNvprProgram::GrGLNvprProgram(GrGpuGL* gpu, | 264 GrGLNvprProgram::GrGLNvprProgram(GrGLGpu* gpu, |
| 265 const GrProgramDesc& desc, | 265 const GrProgramDesc& desc, |
| 266 const BuiltinUniformHandles& builtinUniforms, | 266 const BuiltinUniformHandles& builtinUniforms, |
| 267 GrGLuint programID, | 267 GrGLuint programID, |
| 268 const UniformInfoArray& uniforms, | 268 const UniformInfoArray& uniforms, |
| 269 GrGLInstalledGeoProc* primProc, | 269 GrGLInstalledGeoProc* primProc, |
| 270 GrGLInstalledXferProc* xferProcessor, | 270 GrGLInstalledXferProc* xferProcessor, |
| 271 GrGLInstalledFragProcs* fragmentProcessors, | 271 GrGLInstalledFragProcs* fragmentProcessors, |
| 272 const SeparableVaryingInfoArray& separableVaryi
ngs) | 272 const SeparableVaryingInfoArray& separableVaryi
ngs) |
| 273 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, | 273 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, |
| 274 xferProcessor, fragmentProcessors) { | 274 xferProcessor, fragmentProcessors) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID
, | 307 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID
, |
| 308 fragmentIn
put.fLocation, | 308 fragmentIn
put.fLocation, |
| 309 GR_GL_OBJE
CT_LINEAR, | 309 GR_GL_OBJE
CT_LINEAR, |
| 310 components
, | 310 components
, |
| 311 transform)
; | 311 transform)
; |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 ////////////////////////////////////////////////////////////////////////////////
////// | 315 ////////////////////////////////////////////////////////////////////////////////
////// |
| 316 | 316 |
| 317 GrGLLegacyNvprProgram::GrGLLegacyNvprProgram(GrGpuGL* gpu, | 317 GrGLLegacyNvprProgram::GrGLLegacyNvprProgram(GrGLGpu* gpu, |
| 318 const GrProgramDesc& desc, | 318 const GrProgramDesc& desc, |
| 319 const BuiltinUniformHandles& builti
nUniforms, | 319 const BuiltinUniformHandles& builti
nUniforms, |
| 320 GrGLuint programID, | 320 GrGLuint programID, |
| 321 const UniformInfoArray& uniforms, | 321 const UniformInfoArray& uniforms, |
| 322 GrGLInstalledGeoProc* primProc, | 322 GrGLInstalledGeoProc* primProc, |
| 323 GrGLInstalledXferProc* xp, | 323 GrGLInstalledXferProc* xp, |
| 324 GrGLInstalledFragProcs* fps, | 324 GrGLInstalledFragProcs* fps, |
| 325 int texCoordSetCnt) | 325 int texCoordSetCnt) |
| 326 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, xp, f
ps) | 326 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, xp, f
ps) |
| 327 , fTexCoordSetCnt(texCoordSetCnt) { | 327 , fTexCoordSetCnt(texCoordSetCnt) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 341 for (int t = 0; t < numTransforms; ++t) { | 341 for (int t = 0; t < numTransforms; ++t) { |
| 342 const SkMatrix& transform = get_transform_matrix(proc, t); | 342 const SkMatrix& transform = get_transform_matrix(proc, t); |
| 343 GrGLPathRendering::PathTexGenComponents components = | 343 GrGLPathRendering::PathTexGenComponents components = |
| 344 GrGLPathRendering::kST_PathTexGenComponents; | 344 GrGLPathRendering::kST_PathTexGenComponents; |
| 345 if (proc.isPerspectiveCoordTransform(t)) { | 345 if (proc.isPerspectiveCoordTransform(t)) { |
| 346 components = GrGLPathRendering::kSTR_PathTexGenComponents; | 346 components = GrGLPathRendering::kSTR_PathTexGenComponents; |
| 347 } | 347 } |
| 348 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); | 348 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); |
| 349 } | 349 } |
| 350 } | 350 } |
| OLD | NEW |