History

Replacing setUniformTexture by setResourceTexture in order to differenciate the 2 types of binding points for the BUffers.

Sam Gateau committed 11 years ago

Commit 7fc9fd91 parent cac239a15 files · +38 −38Browse files

Unified · Split

15 files
  1. interface/src/avatar/Avatar.cpp +1 −1
  2. interface/src/ui/ApplicationCompositor.cpp +1 −1
  3. interface/src/ui/ApplicationOverlay.cpp +1 −1
  4. interface/src/ui/overlays/BillboardOverlay.cpp +2 −2
  5. libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +1 −1
  6. libraries/gpu/src/gpu/Batch.cpp +4 −4
  7. libraries/gpu/src/gpu/Batch.h +3 −3
  8. libraries/gpu/src/gpu/GLBackend.cpp +1 −1
  9. libraries/gpu/src/gpu/GLBackend.h +1 −1
  10. libraries/gpu/src/gpu/GLBackendPipeline.cpp +1 −1
  11. libraries/model/src/model/Skybox.cpp +1 −1
  12. libraries/render-utils/src/DeferredLightingEffect.cpp +14 −14
  13. libraries/render-utils/src/Model.cpp +5 −5
  14. libraries/render-utils/src/RenderDeferredTask.cpp +1 −1
  15. libraries/render-utils/src/TextRenderer3D.cpp +1 −1
interface/src/avatar/Avatar.cpp+1−1
@@ -644,7 +644,7 @@ void Avatar::renderBillboard(RenderArgs* renderArgs) { · 643 unmodified lines
644644 glm::vec2 texCoordBottomRight(1.0f, 1.0f);
645645
646646 gpu::Batch& batch = *renderArgs->_batch;
647− batch.setUniformTexture(0, _billboardTexture->getGPUTexture());
647+ batch.setResourceTexture(0, _billboardTexture->getGPUTexture());
648648 DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, true);
649649 DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
650650 glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
interface/src/ui/ApplicationCompositor.cpp+1−1
@@ -179,7 +179,7 @@ void ApplicationCompositor::bindCursorTexture(gpu::Batch& batch, uint8_t cursorI · 178 unmodified lines
179179 _cursors[iconId] = DependencyManager::get<TextureCache>()->
180180 getImageTexture(iconPath);
181181 }
182− batch.setUniformTexture(0, _cursors[iconId]);
182+ batch.setResourceTexture(0, _cursors[iconId]);
183183 }
184184
185185 // Draws the FBO texture for the screen
interface/src/ui/ApplicationOverlay.cpp+1−1
@@ -196,7 +196,7 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder(RenderArgs* renderAr · 195 unmodified lines
196196 geometryCache->useSimpleDrawPipeline(batch);
197197 batch.setProjectionTransform(mat4());
198198 batch.setModelTransform(mat4());
199− batch.setUniformTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());
199+ batch.setResourceTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());
200200 batch._glLineWidth(CONNECTION_STATUS_BORDER_LINE_WIDTH);
201201
202202 // TODO animate the disconnect border for some excitement while not connected?
interface/src/ui/overlays/BillboardOverlay.cpp+2−2
@@ -87,12 +87,12 @@ void BillboardOverlay::render(RenderArgs* args) { · 86 unmodified lines
8787 transform.postScale(glm::vec3(getDimensions(), 1.0f));
8888
8989 batch->setModelTransform(transform);
90− batch->setUniformTexture(0, _texture->getGPUTexture());
90+ batch->setResourceTexture(0, _texture->getGPUTexture());
9191
9292 DependencyManager::get<GeometryCache>()->renderQuad(*batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
9393 glm::vec4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha));
9494
95− batch->setUniformTexture(0, args->_whiteTexture); // restore default white color after me
95+ batch->setResourceTexture(0, args->_whiteTexture); // restore default white color after me
9696 }
9797 }
9898
libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp+1−1
@@ -50,7 +50,7 @@ void RenderableParticleEffectEntityItem::render(RenderArgs* args) { · 49 unmodified lines
5050 Q_ASSERT(args->_batch);
5151 gpu::Batch& batch = *args->_batch;
5252 if (textured) {
53− batch.setUniformTexture(0, _texture->getGPUTexture());
53+ batch.setResourceTexture(0, _texture->getGPUTexture());
5454 }
5555 batch.setModelTransform(getTransformToCenter());
5656 DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, textured);
libraries/gpu/src/gpu/Batch.cpp+4−4
@@ -227,15 +227,15 @@ void Batch::setUniformBuffer(uint32 slot, const BufferView& view) { · 226 unmodified lines
227227 }
228228
229229
230−void Batch::setUniformTexture(uint32 slot, const TexturePointer& texture) {
231− ADD_COMMAND(setUniformTexture);
230+void Batch::setResourceTexture(uint32 slot, const TexturePointer& texture) {
231+ ADD_COMMAND(setResourceTexture);
232232
233233 _params.push_back(_textures.cache(texture));
234234 _params.push_back(slot);
235235 }
236236
237−void Batch::setUniformTexture(uint32 slot, const TextureView& view) {
238− setUniformTexture(slot, view._texture);
237+void Batch::setResourceTexture(uint32 slot, const TextureView& view) {
238+ setResourceTexture(slot, view._texture);
239239 }
240240
241241 void Batch::setFramebuffer(const FramebufferPointer& framebuffer) {
libraries/gpu/src/gpu/Batch.h+3−3
@@ -102,8 +102,8 @@ public: · 101 unmodified lines
102102 void setUniformBuffer(uint32 slot, const BufferPointer& buffer, Offset offset, Offset size);
103103 void setUniformBuffer(uint32 slot, const BufferView& view); // not a command, just a shortcut from a BufferView
104104
105− void setUniformTexture(uint32 slot, const TexturePointer& view);
106− void setUniformTexture(uint32 slot, const TextureView& view); // not a command, just a shortcut from a TextureView
105+ void setResourceTexture(uint32 slot, const TexturePointer& view);
106+ void setResourceTexture(uint32 slot, const TextureView& view); // not a command, just a shortcut from a TextureView
107107
108108 // Framebuffer Stage
109109 void setFramebuffer(const FramebufferPointer& framebuffer);
@@ -172,7 +172,7 @@ public: · 62 unmodified lines
172172 COMMAND_setStateBlendFactor,
173173
174174 COMMAND_setUniformBuffer,
175− COMMAND_setUniformTexture,
175+ COMMAND_setResourceTexture,
176176
177177 COMMAND_setFramebuffer,
178178
libraries/gpu/src/gpu/GLBackend.cpp+1−1
@@ -35,7 +35,7 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = · 34 unmodified lines
3535 (&::gpu::GLBackend::do_setStateBlendFactor),
3636
3737 (&::gpu::GLBackend::do_setUniformBuffer),
38− (&::gpu::GLBackend::do_setUniformTexture),
38+ (&::gpu::GLBackend::do_setResourceTexture),
3939
4040 (&::gpu::GLBackend::do_setFramebuffer),
4141
libraries/gpu/src/gpu/GLBackend.h+1−1
@@ -309,7 +309,7 @@ protected: · 308 unmodified lines
309309
310310 // Uniform Stage
311311 void do_setUniformBuffer(Batch& batch, uint32 paramOffset);
312− void do_setUniformTexture(Batch& batch, uint32 paramOffset);
312+ void do_setResourceTexture(Batch& batch, uint32 paramOffset);
313313
314314 struct UniformStageState {
315315
libraries/gpu/src/gpu/GLBackendPipeline.cpp+1−1
@@ -188,7 +188,7 @@ void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) { · 187 unmodified lines
188188 (void) CHECK_GL_ERROR();
189189 }
190190
191−void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) {
191+void GLBackend::do_setResourceTexture(Batch& batch, uint32 paramOffset) {
192192 GLuint slot = batch._params[paramOffset + 1]._uint;
193193 TexturePointer uniformTexture = batch._textures.get(batch._params[paramOffset + 0]._uint);
194194
libraries/model/src/model/Skybox.cpp+1−1
@@ -103,7 +103,7 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky · 102 unmodified lines
103103 batch.setInputBuffer(gpu::Stream::POSITION, theBuffer, 0, 8);
104104 batch.setUniformBuffer(SKYBOX_CONSTANTS_SLOT, theConstants, 0, theConstants->getSize());
105105 batch.setInputFormat(theFormat);
106− batch.setUniformTexture(0, skybox.getCubemap());
106+ batch.setResourceTexture(0, skybox.getCubemap());
107107 batch.draw(gpu::TRIANGLE_STRIP, 4);
108108 }
109109
libraries/render-utils/src/DeferredLightingEffect.cpp+14−14
@@ -147,7 +147,7 @@ void DeferredLightingEffect::bindSimpleProgram(gpu::Batch& batch, bool textured, · 146 unmodified lines
147147
148148 if (!config.isTextured()) {
149149 // If it is not textured, bind white texture and keep using textured pipeline
150− batch.setUniformTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());
150+ batch.setResourceTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());
151151 }
152152 }
153153
@@ -244,13 +244,13 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 90 unmodified lines
244244
245245 batch.clearColorFramebuffer(freeFBO->getBufferMask(), glm::vec4(0.0f, 0.0f, 0.0f, 0.0f));
246246
247− batch.setUniformTexture(0, textureCache->getPrimaryColorTexture());
247+ batch.setResourceTexture(0, textureCache->getPrimaryColorTexture());
248248
249− batch.setUniformTexture(1, textureCache->getPrimaryNormalTexture());
249+ batch.setResourceTexture(1, textureCache->getPrimaryNormalTexture());
250250
251− batch.setUniformTexture(2, textureCache->getPrimarySpecularTexture());
251+ batch.setResourceTexture(2, textureCache->getPrimarySpecularTexture());
252252
253− batch.setUniformTexture(3, textureCache->getPrimaryDepthTexture());
253+ batch.setResourceTexture(3, textureCache->getPrimaryDepthTexture());
254254
255255 // get the viewport side (left, right, both)
256256 int viewport[4];
@@ -275,7 +275,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 18 unmodified lines
275275 const LightLocations* locations = &_directionalLightLocations;
276276 bool shadowsEnabled = _viewState->getShadowsEnabled();
277277 if (shadowsEnabled) {
278− batch.setUniformTexture(4, textureCache->getShadowFramebuffer()->getDepthStencilBuffer());
278+ batch.setResourceTexture(4, textureCache->getShadowFramebuffer()->getDepthStencilBuffer());
279279
280280 program = _directionalLightShadowMap;
281281 locations = &_directionalLightShadowMapLocations;
@@ -329,7 +329,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 47 unmodified lines
329329 }
330330
331331 if (useSkyboxCubemap) {
332− batch.setUniformTexture(5, _skybox->getCubemap());
332+ batch.setResourceTexture(5, _skybox->getCubemap());
333333 }
334334
335335 if (locations->lightBufferUnit >= 0) {
@@ -377,11 +377,11 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 41 unmodified lines
377377 }
378378
379379 if (useSkyboxCubemap) {
380− batch.setUniformTexture(5, nullptr);
380+ batch.setResourceTexture(5, nullptr);
381381 }
382382
383383 if (shadowsEnabled) {
384− batch.setUniformTexture(4, nullptr);
384+ batch.setResourceTexture(4, nullptr);
385385 }
386386
387387 glm::vec4 sCoefficients(sWidth / 2.0f, 0.0f, 0.0f, sMin + sWidth / 2.0f);
@@ -530,10 +530,10 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 142 unmodified lines
530530 }
531531
532532 // Probably not necessary in the long run because the gpu layer would unbound this texture if used as render target
533− batch.setUniformTexture(0, nullptr);
534− batch.setUniformTexture(1, nullptr);
535− batch.setUniformTexture(2, nullptr);
536− batch.setUniformTexture(3, nullptr);
533+ batch.setResourceTexture(0, nullptr);
534+ batch.setResourceTexture(1, nullptr);
535+ batch.setResourceTexture(2, nullptr);
536+ batch.setResourceTexture(3, nullptr);
537537
538538 args->_context->syncCache();
539539 args->_context->render(batch);
@@ -551,7 +551,7 @@ void DeferredLightingEffect::copyBack(RenderArgs* args) { · 11 unmodified lines
551551 batch.setFramebuffer(textureCache->getPrimaryFramebuffer());
552552 batch.setPipeline(_blitLightBuffer);
553553
554− batch.setUniformTexture(0, freeFBO->getRenderBuffer(0));
554+ batch.setResourceTexture(0, freeFBO->getRenderBuffer(0));
555555
556556 batch.setProjectionTransform(glm::mat4());
557557 batch.setViewTransform(Transform());
libraries/render-utils/src/Model.cpp+5−5
@@ -2031,10 +2031,10 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 2030 unmodified lines
20312031 }
20322032 static bool showDiffuse = true;
20332033 if (showDiffuse && diffuseMap) {
2034− batch.setUniformTexture(0, diffuseMap->getGPUTexture());
2034+ batch.setResourceTexture(0, diffuseMap->getGPUTexture());
20352035
20362036 } else {
2037− batch.setUniformTexture(0, textureCache->getWhiteTexture());
2037+ batch.setResourceTexture(0, textureCache->getWhiteTexture());
20382038 }
20392039
20402040 if (locations->texcoordMatrices >= 0) {
@@ -2050,14 +2050,14 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 9 unmodified lines
20502050
20512051 if (!mesh.tangents.isEmpty()) {
20522052 Texture* normalMap = networkPart.normalTexture.data();
2053− batch.setUniformTexture(1, !normalMap ?
2053+ batch.setResourceTexture(1, !normalMap ?
20542054 textureCache->getBlueTexture() : normalMap->getGPUTexture());
20552055
20562056 }
20572057
20582058 if (locations->specularTextureUnit >= 0) {
20592059 Texture* specularMap = networkPart.specularTexture.data();
2060− batch.setUniformTexture(locations->specularTextureUnit, !specularMap ?
2060+ batch.setResourceTexture(locations->specularTextureUnit, !specularMap ?
20612061 textureCache->getWhiteTexture() : specularMap->getGPUTexture());
20622062 }
20632063
@@ -2074,7 +2074,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 10 unmodified lines
20742074 GLBATCH(glUniform2f)(locations->emissiveParams, emissiveOffset, emissiveScale);
20752075
20762076 Texture* emissiveMap = networkPart.emissiveTexture.data();
2077− batch.setUniformTexture(locations->emissiveTextureUnit, !emissiveMap ?
2077+ batch.setResourceTexture(locations->emissiveTextureUnit, !emissiveMap ?
20782078 textureCache->getWhiteTexture() : emissiveMap->getGPUTexture());
20792079 }
20802080
libraries/render-utils/src/RenderDeferredTask.cpp+1−1
@@ -236,7 +236,7 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon · 235 unmodified lines
236236 batch.setViewTransform(viewMat);
237237
238238 batch.setPipeline(getOpaquePipeline());
239− batch.setUniformTexture(0, args->_whiteTexture);
239+ batch.setResourceTexture(0, args->_whiteTexture);
240240
241241 if (!inItems.empty()) {
242242 batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0);
libraries/render-utils/src/TextRenderer3D.cpp+1−1
@@ -423,7 +423,7 @@ void Font3D::drawString(gpu::Batch& batch, float x, float y, const QString& str, · 422 unmodified lines
423423
424424 setupGPU();
425425 batch.setPipeline(_pipeline);
426− batch.setUniformTexture(_fontLoc, _texture);
426+ batch.setResourceTexture(_fontLoc, _texture);
427427 batch._glUniform1i(_outlineLoc, (effectType == TextRenderer3D::OUTLINE_EFFECT));
428428 batch._glUniform4fv(_colorLoc, 1, (const GLfloat*)color);
429429

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t