Remove GrGLSLUtil
This had a not-very-useful matrix utility in it. We've had setSkMatrix for a while, and the one other user always wanted a 4x4, which can be done with SkM44 just as easily. Change-Id: I3f00a0a1ccaf58bc9c775da4eef819af5a5fa7e8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277605 Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
26651883d0
commit
0b1e5fc8f2
@ -478,8 +478,6 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/glsl/GrGLSLShaderBuilder.cpp",
|
||||
"$_src/gpu/glsl/GrGLSLShaderBuilder.h",
|
||||
"$_src/gpu/glsl/GrGLSLUniformHandler.h",
|
||||
"$_src/gpu/glsl/GrGLSLUtil.cpp",
|
||||
"$_src/gpu/glsl/GrGLSLUtil.h",
|
||||
"$_src/gpu/glsl/GrGLSLVarying.cpp",
|
||||
"$_src/gpu/glsl/GrGLSLVarying.h",
|
||||
"$_src/gpu/glsl/GrGLSLVertexGeoBuilder.cpp",
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
#include "src/gpu/glsl/GrGLSLUtil.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
|
||||
@ -187,9 +186,7 @@ public:
|
||||
!SkMatrixPriv::CheapEqual(fViewMatrix, dgp.viewMatrix()))
|
||||
{
|
||||
fViewMatrix = dgp.viewMatrix();
|
||||
float viewMatrix[3 * 3];
|
||||
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
|
||||
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
|
||||
pdman.setSkMatrix(fViewMatrixUniform, fViewMatrix);
|
||||
}
|
||||
|
||||
if (!dgp.hasVertexColor() && dgp.color() != fColor) {
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
#include "src/gpu/glsl/GrGLSLUtil.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
|
||||
@ -33,9 +32,7 @@ public:
|
||||
!SkMatrixPriv::CheapEqual(fViewMatrix, ce.viewMatrix()))
|
||||
{
|
||||
fViewMatrix = ce.viewMatrix();
|
||||
float viewMatrix[3 * 3];
|
||||
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
|
||||
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
|
||||
pdman.setSkMatrix(fViewMatrixUniform, fViewMatrix);
|
||||
}
|
||||
|
||||
if (ce.color() != fColor) {
|
||||
@ -287,9 +284,7 @@ public:
|
||||
!SkMatrixPriv::CheapEqual(fViewMatrix, qe.viewMatrix()))
|
||||
{
|
||||
fViewMatrix = qe.viewMatrix();
|
||||
float viewMatrix[3 * 3];
|
||||
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
|
||||
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
|
||||
pdman.setSkMatrix(fViewMatrixUniform, fViewMatrix);
|
||||
}
|
||||
|
||||
if (qe.color() != fColor) {
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
#include "src/gpu/glsl/GrGLSLUtil.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
|
||||
@ -463,9 +462,7 @@ public:
|
||||
|
||||
if (dfpgp.matrix().hasPerspective() && !SkMatrixPriv::CheapEqual(fMatrix, dfpgp.matrix())) {
|
||||
fMatrix = dfpgp.matrix();
|
||||
float matrix[3 * 3];
|
||||
GrGLSLGetMatrix<3>(matrix, fMatrix);
|
||||
pdman.setMatrix3f(fMatrixUniform, matrix);
|
||||
pdman.setSkMatrix(fMatrixUniform, fMatrix);
|
||||
}
|
||||
|
||||
const SkISize& atlasDimensions = dfpgp.atlasDimensions();
|
||||
|
@ -174,7 +174,7 @@ void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix,
|
||||
fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin;
|
||||
|
||||
float glMatrix[4 * 4];
|
||||
fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix);
|
||||
fHWProjectionMatrixState.getRTAdjustedGLMatrix(glMatrix);
|
||||
SkDEBUGCODE(verify_floats(glMatrix, SK_ARRAY_COUNT(glMatrix)));
|
||||
GL_CALL(MatrixLoadf(GR_GL_PATH_PROJECTION, glMatrix));
|
||||
}
|
||||
|
@ -8,14 +8,13 @@
|
||||
#ifndef GrGLPathRendering_DEFINED
|
||||
#define GrGLPathRendering_DEFINED
|
||||
|
||||
#include "include/core/SkM44.h"
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/gpu/gl/GrGLTypes.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrPathRendering.h"
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
#include "src/gpu/glsl/GrGLSLUtil.h"
|
||||
|
||||
class GrGLNameAllocator;
|
||||
class GrGLGpu;
|
||||
class GrStyle;
|
||||
|
||||
@ -93,7 +92,7 @@ private:
|
||||
/**
|
||||
* Gets a matrix that goes from local coordinates to GL normalized device coords.
|
||||
*/
|
||||
template<int Size> void getRTAdjustedGLMatrix(float* destMatrix) {
|
||||
void getRTAdjustedGLMatrix(float* destMatrix) {
|
||||
SkMatrix combined;
|
||||
if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) {
|
||||
combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0, -SK_Scalar1,
|
||||
@ -105,7 +104,8 @@ private:
|
||||
0, 0, 1);
|
||||
}
|
||||
combined.preConcat(fViewMatrix);
|
||||
GrGLSLGetMatrix<Size>(destMatrix, combined);
|
||||
SkM44 combined44(combined);
|
||||
combined44.getColMajor(destMatrix);
|
||||
}
|
||||
};
|
||||
GrGLGpu* gpu();
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "src/gpu/glsl/GrGLSLUtil.h"
|
||||
|
||||
template<> void GrGLSLGetMatrix<3>(float* dest, const SkMatrix& src) {
|
||||
// Col 0
|
||||
dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
|
||||
dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
|
||||
dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
|
||||
|
||||
// Col 1
|
||||
dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
|
||||
dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
|
||||
dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
|
||||
|
||||
// Col 2
|
||||
dest[6] = SkScalarToFloat(src[SkMatrix::kMTransX]);
|
||||
dest[7] = SkScalarToFloat(src[SkMatrix::kMTransY]);
|
||||
dest[8] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
|
||||
}
|
||||
|
||||
template<> void GrGLSLGetMatrix<4>(float* dest, const SkMatrix& src) {
|
||||
// Col 0
|
||||
dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
|
||||
dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
|
||||
dest[2] = 0;
|
||||
dest[3] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
|
||||
|
||||
// Col 1
|
||||
dest[4] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
|
||||
dest[5] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
|
||||
dest[6] = 0;
|
||||
dest[7] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
|
||||
|
||||
// Col 2
|
||||
dest[8] = 0;
|
||||
dest[9] = 0;
|
||||
dest[10] = 1;
|
||||
dest[11] = 0;
|
||||
|
||||
// Col 3
|
||||
dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]);
|
||||
dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]);
|
||||
dest[14] = 0;
|
||||
dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrGLSLUtil_DEFINED
|
||||
#define GrGLSLUtil_DEFINED
|
||||
|
||||
class SkMatrix;
|
||||
|
||||
/**
|
||||
* Helper for converting SkMatrix to a column-major float array. We assume that all GLSL backends
|
||||
* use a column major representation for matrices.
|
||||
*/
|
||||
template<int MatrixSize> void GrGLSLGetMatrix(float* dest, const SkMatrix& src);
|
||||
|
||||
#endif
|
@ -21,7 +21,6 @@
|
||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
#include "src/gpu/glsl/GrGLSLUtil.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
@ -876,9 +875,7 @@ private:
|
||||
!SkMatrixPriv::CheapEqual(fViewMatrix, diegp.fViewMatrix))
|
||||
{
|
||||
fViewMatrix = diegp.fViewMatrix;
|
||||
float viewMatrix[3 * 3];
|
||||
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
|
||||
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
|
||||
pdman.setSkMatrix(fViewMatrixUniform, fViewMatrix);
|
||||
}
|
||||
this->setTransformDataHelper(SkMatrix::I(), pdman, transformRange);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user