Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: src/gpu/gl/GrGLProgram.cpp

Issue 2007973002: Manually generated sRGB mipmaps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Break long columns Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | tests/SRGBMipMapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 this->setFragmentData(primProc, pipeline, &nextSamplerIdx); 76 this->setFragmentData(primProc, pipeline, &nextSamplerIdx);
77 77
78 if (primProc.getPixelLocalStorageState() != 78 if (primProc.getPixelLocalStorageState() !=
79 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) { 79 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) {
80 const GrXferProcessor& xp = pipeline.getXferProcessor(); 80 const GrXferProcessor& xp = pipeline.getXferProcessor();
81 fXferProcessor->setData(fProgramDataManager, xp); 81 fXferProcessor->setData(fProgramDataManager, xp);
82 this->bindTextures(xp, pipeline.getAllowSRGBInputs(), &nextSamplerIdx); 82 this->bindTextures(xp, pipeline.getAllowSRGBInputs(), &nextSamplerIdx);
83 } 83 }
84 } 84 }
85 85
86 void GrGLProgram::generateMipmaps(const GrPrimitiveProcessor& primProc,
87 const GrPipeline& pipeline) {
88 this->generateMipmaps(primProc, pipeline.getAllowSRGBInputs());
89
90 int numProcessors = fFragmentProcessors.count();
91 for (int i = 0; i < numProcessors; ++i) {
92 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i);
93 this->generateMipmaps(processor, pipeline.getAllowSRGBInputs());
94 }
95
96 if (primProc.getPixelLocalStorageState() !=
97 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) {
98 const GrXferProcessor& xp = pipeline.getXferProcessor();
99 this->generateMipmaps(xp, pipeline.getAllowSRGBInputs());
100 }
101 }
102
86 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, 103 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
87 const GrPipeline& pipeline, 104 const GrPipeline& pipeline,
88 int* nextSamplerIdx) { 105 int* nextSamplerIdx) {
89 int numProcessors = fFragmentProcessors.count(); 106 int numProcessors = fFragmentProcessors.count();
90 for (int i = 0; i < numProcessors; ++i) { 107 for (int i = 0; i < numProcessors; ++i) {
91 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); 108 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i);
92 fFragmentProcessors[i]->setData(fProgramDataManager, processor); 109 fFragmentProcessors[i]->setData(fProgramDataManager, processor);
93 this->setTransformData(primProc, processor, i); 110 this->setTransformData(primProc, processor, i);
94 this->bindTextures(processor, pipeline.getAllowSRGBInputs(), nextSampler Idx); 111 this->bindTextures(processor, pipeline.getAllowSRGBInputs(), nextSampler Idx);
95 } 112 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const GrTextureAccess& access = processor.textureAccess(i); 156 const GrTextureAccess& access = processor.textureAccess(i);
140 fGpu->bindTexture((*nextSamplerIdx)++, access.getParams(), 157 fGpu->bindTexture((*nextSamplerIdx)++, access.getParams(),
141 allowSRGBInputs, static_cast<GrGLTexture*>(access.getT exture())); 158 allowSRGBInputs, static_cast<GrGLTexture*>(access.getT exture()));
142 } 159 }
143 for (int i = 0; i < processor.numBuffers(); ++i) { 160 for (int i = 0; i < processor.numBuffers(); ++i) {
144 const GrBufferAccess& access = processor.bufferAccess(i); 161 const GrBufferAccess& access = processor.bufferAccess(i);
145 fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.offsetInBytes(), acces s.texelConfig(), 162 fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.offsetInBytes(), acces s.texelConfig(),
146 static_cast<GrGLBuffer*>(access.buffer())); 163 static_cast<GrGLBuffer*>(access.buffer()));
147 } 164 }
148 } 165 }
166
167 void GrGLProgram::generateMipmaps(const GrProcessor& processor,
168 bool allowSRGBInputs) {
169 for (int i = 0; i < processor.numTextures(); ++i) {
170 const GrTextureAccess& access = processor.textureAccess(i);
171 fGpu->generateMipmaps(access.getParams(), allowSRGBInputs,
172 static_cast<GrGLTexture*>(access.getTexture()));
173 }
174 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | tests/SRGBMipMapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698