Unified · Split
| @@ -644,7 +644,7 @@ void Avatar::renderBillboard(RenderArgs* renderArgs) { · 643 unmodified lines | |||
| 644 | glm::vec2 texCoordBottomRight(1.0f, 1.0f); | 644 | glm::vec2 texCoordBottomRight(1.0f, 1.0f); |
| 645 | 645 | ||
| 646 | gpu::Batch& batch = *renderArgs->_batch; | 646 | gpu::Batch& batch = *renderArgs->_batch; |
| 647 | batch.setUniformTexture(0, _billboardTexture->getGPUTexture()); | 647 | batch.setResourceTexture(0, _billboardTexture->getGPUTexture()); |
| 648 | DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, true); | 648 | DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, true); |
| 649 | DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, | 649 | DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, |
| 650 | glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); | 650 | glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); |
| @@ -179,7 +179,7 @@ void ApplicationCompositor::bindCursorTexture(gpu::Batch& batch, uint8_t cursorI · 178 unmodified lines | |||
| 179 | _cursors[iconId] = DependencyManager::get<TextureCache>()-> | 179 | _cursors[iconId] = DependencyManager::get<TextureCache>()-> |
| 180 | getImageTexture(iconPath); | 180 | getImageTexture(iconPath); |
| 181 | } | 181 | } |
| 182 | batch.setUniformTexture(0, _cursors[iconId]); | 182 | batch.setResourceTexture(0, _cursors[iconId]); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | // Draws the FBO texture for the screen | 185 | // Draws the FBO texture for the screen |
| @@ -196,7 +196,7 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder(RenderArgs* renderAr · 195 unmodified lines | |||
| 196 | geometryCache->useSimpleDrawPipeline(batch); | 196 | geometryCache->useSimpleDrawPipeline(batch); |
| 197 | batch.setProjectionTransform(mat4()); | 197 | batch.setProjectionTransform(mat4()); |
| 198 | batch.setModelTransform(mat4()); | 198 | batch.setModelTransform(mat4()); |
| 199 | batch.setUniformTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture()); | 199 | batch.setResourceTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture()); |
| 200 | batch._glLineWidth(CONNECTION_STATUS_BORDER_LINE_WIDTH); | 200 | batch._glLineWidth(CONNECTION_STATUS_BORDER_LINE_WIDTH); |
| 201 | 201 | ||
| 202 | // TODO animate the disconnect border for some excitement while not connected? | 202 | // TODO animate the disconnect border for some excitement while not connected? |
| @@ -87,12 +87,12 @@ void BillboardOverlay::render(RenderArgs* args) { · 86 unmodified lines | |||
| 87 | transform.postScale(glm::vec3(getDimensions(), 1.0f)); | 87 | transform.postScale(glm::vec3(getDimensions(), 1.0f)); |
| 88 | 88 | ||
| 89 | batch->setModelTransform(transform); | 89 | batch->setModelTransform(transform); |
| 90 | batch->setUniformTexture(0, _texture->getGPUTexture()); | 90 | batch->setResourceTexture(0, _texture->getGPUTexture()); |
| 91 | 91 | ||
| 92 | DependencyManager::get<GeometryCache>()->renderQuad(*batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, | 92 | DependencyManager::get<GeometryCache>()->renderQuad(*batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, |
| 93 | glm::vec4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha)); | 93 | glm::vec4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha)); |
| 94 | 94 | ||
| 95 | batch->setUniformTexture(0, args->_whiteTexture); // restore default white color after me | 95 | batch->setResourceTexture(0, args->_whiteTexture); // restore default white color after me |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| 98 | 98 | ||
| @@ -50,7 +50,7 @@ void RenderableParticleEffectEntityItem::render(RenderArgs* args) { · 49 unmodified lines | |||
| 50 | Q_ASSERT(args->_batch); | 50 | Q_ASSERT(args->_batch); |
| 51 | gpu::Batch& batch = *args->_batch; | 51 | gpu::Batch& batch = *args->_batch; |
| 52 | if (textured) { | 52 | if (textured) { |
| 53 | batch.setUniformTexture(0, _texture->getGPUTexture()); | 53 | batch.setResourceTexture(0, _texture->getGPUTexture()); |
| 54 | } | 54 | } |
| 55 | batch.setModelTransform(getTransformToCenter()); | 55 | batch.setModelTransform(getTransformToCenter()); |
| 56 | DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, textured); | 56 | DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, textured); |
| @@ -227,15 +227,15 @@ void Batch::setUniformBuffer(uint32 slot, const BufferView& view) { · 226 unmodified lines | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | 229 | ||
| 230 | void Batch::setUniformTexture(uint32 slot, const TexturePointer& texture) { | 230 | void Batch::setResourceTexture(uint32 slot, const TexturePointer& texture) { |
| 231 | ADD_COMMAND(setUniformTexture); | 231 | ADD_COMMAND(setResourceTexture); |
| 232 | 232 | ||
| 233 | _params.push_back(_textures.cache(texture)); | 233 | _params.push_back(_textures.cache(texture)); |
| 234 | _params.push_back(slot); | 234 | _params.push_back(slot); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | void Batch::setUniformTexture(uint32 slot, const TextureView& view) { | 237 | void Batch::setResourceTexture(uint32 slot, const TextureView& view) { |
| 238 | setUniformTexture(slot, view._texture); | 238 | setResourceTexture(slot, view._texture); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | void Batch::setFramebuffer(const FramebufferPointer& framebuffer) { | 241 | void Batch::setFramebuffer(const FramebufferPointer& framebuffer) { |
| @@ -102,8 +102,8 @@ public: · 101 unmodified lines | |||
| 102 | void setUniformBuffer(uint32 slot, const BufferPointer& buffer, Offset offset, Offset size); | 102 | void setUniformBuffer(uint32 slot, const BufferPointer& buffer, Offset offset, Offset size); |
| 103 | void setUniformBuffer(uint32 slot, const BufferView& view); // not a command, just a shortcut from a BufferView | 103 | void setUniformBuffer(uint32 slot, const BufferView& view); // not a command, just a shortcut from a BufferView |
| 104 | 104 | ||
| 105 | void setUniformTexture(uint32 slot, const TexturePointer& view); | 105 | void setResourceTexture(uint32 slot, const TexturePointer& view); |
| 106 | void setUniformTexture(uint32 slot, const TextureView& view); // not a command, just a shortcut from a TextureView | 106 | void setResourceTexture(uint32 slot, const TextureView& view); // not a command, just a shortcut from a TextureView |
| 107 | 107 | ||
| 108 | // Framebuffer Stage | 108 | // Framebuffer Stage |
| 109 | void setFramebuffer(const FramebufferPointer& framebuffer); | 109 | void setFramebuffer(const FramebufferPointer& framebuffer); |
| @@ -172,7 +172,7 @@ public: · 62 unmodified lines | |||
| 172 | COMMAND_setStateBlendFactor, | 172 | COMMAND_setStateBlendFactor, |
| 173 | 173 | ||
| 174 | COMMAND_setUniformBuffer, | 174 | COMMAND_setUniformBuffer, |
| 175 | COMMAND_setUniformTexture, | 175 | COMMAND_setResourceTexture, |
| 176 | 176 | ||
| 177 | COMMAND_setFramebuffer, | 177 | COMMAND_setFramebuffer, |
| 178 | 178 | ||
| @@ -35,7 +35,7 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = · 34 unmodified lines | |||
| 35 | (&::gpu::GLBackend::do_setStateBlendFactor), | 35 | (&::gpu::GLBackend::do_setStateBlendFactor), |
| 36 | 36 | ||
| 37 | (&::gpu::GLBackend::do_setUniformBuffer), | 37 | (&::gpu::GLBackend::do_setUniformBuffer), |
| 38 | (&::gpu::GLBackend::do_setUniformTexture), | 38 | (&::gpu::GLBackend::do_setResourceTexture), |
| 39 | 39 | ||
| 40 | (&::gpu::GLBackend::do_setFramebuffer), | 40 | (&::gpu::GLBackend::do_setFramebuffer), |
| 41 | 41 | ||
| @@ -309,7 +309,7 @@ protected: · 308 unmodified lines | |||
| 309 | 309 | ||
| 310 | // Uniform Stage | 310 | // Uniform Stage |
| 311 | void do_setUniformBuffer(Batch& batch, uint32 paramOffset); | 311 | void do_setUniformBuffer(Batch& batch, uint32 paramOffset); |
| 312 | void do_setUniformTexture(Batch& batch, uint32 paramOffset); | 312 | void do_setResourceTexture(Batch& batch, uint32 paramOffset); |
| 313 | 313 | ||
| 314 | struct UniformStageState { | 314 | struct UniformStageState { |
| 315 | 315 | ||
| @@ -188,7 +188,7 @@ void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) { · 187 unmodified lines | |||
| 188 | (void) CHECK_GL_ERROR(); | 188 | (void) CHECK_GL_ERROR(); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) { | 191 | void GLBackend::do_setResourceTexture(Batch& batch, uint32 paramOffset) { |
| 192 | GLuint slot = batch._params[paramOffset + 1]._uint; | 192 | GLuint slot = batch._params[paramOffset + 1]._uint; |
| 193 | TexturePointer uniformTexture = batch._textures.get(batch._params[paramOffset + 0]._uint); | 193 | TexturePointer uniformTexture = batch._textures.get(batch._params[paramOffset + 0]._uint); |
| 194 | 194 | ||
| @@ -103,7 +103,7 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky · 102 unmodified lines | |||
| 103 | batch.setInputBuffer(gpu::Stream::POSITION, theBuffer, 0, 8); | 103 | batch.setInputBuffer(gpu::Stream::POSITION, theBuffer, 0, 8); |
| 104 | batch.setUniformBuffer(SKYBOX_CONSTANTS_SLOT, theConstants, 0, theConstants->getSize()); | 104 | batch.setUniformBuffer(SKYBOX_CONSTANTS_SLOT, theConstants, 0, theConstants->getSize()); |
| 105 | batch.setInputFormat(theFormat); | 105 | batch.setInputFormat(theFormat); |
| 106 | batch.setUniformTexture(0, skybox.getCubemap()); | 106 | batch.setResourceTexture(0, skybox.getCubemap()); |
| 107 | batch.draw(gpu::TRIANGLE_STRIP, 4); | 107 | batch.draw(gpu::TRIANGLE_STRIP, 4); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| @@ -147,7 +147,7 @@ void DeferredLightingEffect::bindSimpleProgram(gpu::Batch& batch, bool textured, · 146 unmodified lines | |||
| 147 | 147 | ||
| 148 | if (!config.isTextured()) { | 148 | if (!config.isTextured()) { |
| 149 | // If it is not textured, bind white texture and keep using textured pipeline | 149 | // 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()); |
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | 153 | ||
| @@ -244,13 +244,13 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 90 unmodified lines | |||
| 244 | 244 | ||
| 245 | batch.clearColorFramebuffer(freeFBO->getBufferMask(), glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); | 245 | batch.clearColorFramebuffer(freeFBO->getBufferMask(), glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)); |
| 246 | 246 | ||
| 247 | batch.setUniformTexture(0, textureCache->getPrimaryColorTexture()); | 247 | batch.setResourceTexture(0, textureCache->getPrimaryColorTexture()); |
| 248 | 248 | ||
| 249 | batch.setUniformTexture(1, textureCache->getPrimaryNormalTexture()); | 249 | batch.setResourceTexture(1, textureCache->getPrimaryNormalTexture()); |
| 250 | 250 | ||
| 251 | batch.setUniformTexture(2, textureCache->getPrimarySpecularTexture()); | 251 | batch.setResourceTexture(2, textureCache->getPrimarySpecularTexture()); |
| 252 | 252 | ||
| 253 | batch.setUniformTexture(3, textureCache->getPrimaryDepthTexture()); | 253 | batch.setResourceTexture(3, textureCache->getPrimaryDepthTexture()); |
| 254 | 254 | ||
| 255 | // get the viewport side (left, right, both) | 255 | // get the viewport side (left, right, both) |
| 256 | int viewport[4]; | 256 | int viewport[4]; |
| @@ -275,7 +275,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 18 unmodified lines | |||
| 275 | const LightLocations* locations = &_directionalLightLocations; | 275 | const LightLocations* locations = &_directionalLightLocations; |
| 276 | bool shadowsEnabled = _viewState->getShadowsEnabled(); | 276 | bool shadowsEnabled = _viewState->getShadowsEnabled(); |
| 277 | if (shadowsEnabled) { | 277 | if (shadowsEnabled) { |
| 278 | batch.setUniformTexture(4, textureCache->getShadowFramebuffer()->getDepthStencilBuffer()); | 278 | batch.setResourceTexture(4, textureCache->getShadowFramebuffer()->getDepthStencilBuffer()); |
| 279 | 279 | ||
| 280 | program = _directionalLightShadowMap; | 280 | program = _directionalLightShadowMap; |
| 281 | locations = &_directionalLightShadowMapLocations; | 281 | locations = &_directionalLightShadowMapLocations; |
| @@ -329,7 +329,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 47 unmodified lines | |||
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | if (useSkyboxCubemap) { | 331 | if (useSkyboxCubemap) { |
| 332 | batch.setUniformTexture(5, _skybox->getCubemap()); | 332 | batch.setResourceTexture(5, _skybox->getCubemap()); |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | if (locations->lightBufferUnit >= 0) { | 335 | if (locations->lightBufferUnit >= 0) { |
| @@ -377,11 +377,11 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 41 unmodified lines | |||
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | if (useSkyboxCubemap) { | 379 | if (useSkyboxCubemap) { |
| 380 | batch.setUniformTexture(5, nullptr); | 380 | batch.setResourceTexture(5, nullptr); |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | if (shadowsEnabled) { | 383 | if (shadowsEnabled) { |
| 384 | batch.setUniformTexture(4, nullptr); | 384 | batch.setResourceTexture(4, nullptr); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | glm::vec4 sCoefficients(sWidth / 2.0f, 0.0f, 0.0f, sMin + sWidth / 2.0f); | 387 | 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 | |||
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | // Probably not necessary in the long run because the gpu layer would unbound this texture if used as render target | 532 | // 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); | 533 | batch.setResourceTexture(0, nullptr); |
| 534 | batch.setUniformTexture(1, nullptr); | 534 | batch.setResourceTexture(1, nullptr); |
| 535 | batch.setUniformTexture(2, nullptr); | 535 | batch.setResourceTexture(2, nullptr); |
| 536 | batch.setUniformTexture(3, nullptr); | 536 | batch.setResourceTexture(3, nullptr); |
| 537 | 537 | ||
| 538 | args->_context->syncCache(); | 538 | args->_context->syncCache(); |
| 539 | args->_context->render(batch); | 539 | args->_context->render(batch); |
| @@ -551,7 +551,7 @@ void DeferredLightingEffect::copyBack(RenderArgs* args) { · 11 unmodified lines | |||
| 551 | batch.setFramebuffer(textureCache->getPrimaryFramebuffer()); | 551 | batch.setFramebuffer(textureCache->getPrimaryFramebuffer()); |
| 552 | batch.setPipeline(_blitLightBuffer); | 552 | batch.setPipeline(_blitLightBuffer); |
| 553 | 553 | ||
| 554 | batch.setUniformTexture(0, freeFBO->getRenderBuffer(0)); | 554 | batch.setResourceTexture(0, freeFBO->getRenderBuffer(0)); |
| 555 | 555 | ||
| 556 | batch.setProjectionTransform(glm::mat4()); | 556 | batch.setProjectionTransform(glm::mat4()); |
| 557 | batch.setViewTransform(Transform()); | 557 | batch.setViewTransform(Transform()); |
| @@ -2031,10 +2031,10 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 2030 unmodified lines | |||
| 2031 | } | 2031 | } |
| 2032 | static bool showDiffuse = true; | 2032 | static bool showDiffuse = true; |
| 2033 | if (showDiffuse && diffuseMap) { | 2033 | if (showDiffuse && diffuseMap) { |
| 2034 | batch.setUniformTexture(0, diffuseMap->getGPUTexture()); | 2034 | batch.setResourceTexture(0, diffuseMap->getGPUTexture()); |
| 2035 | 2035 | ||
| 2036 | } else { | 2036 | } else { |
| 2037 | batch.setUniformTexture(0, textureCache->getWhiteTexture()); | 2037 | batch.setResourceTexture(0, textureCache->getWhiteTexture()); |
| 2038 | } | 2038 | } |
| 2039 | 2039 | ||
| 2040 | if (locations->texcoordMatrices >= 0) { | 2040 | if (locations->texcoordMatrices >= 0) { |
| @@ -2050,14 +2050,14 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 9 unmodified lines | |||
| 2050 | 2050 | ||
| 2051 | if (!mesh.tangents.isEmpty()) { | 2051 | if (!mesh.tangents.isEmpty()) { |
| 2052 | Texture* normalMap = networkPart.normalTexture.data(); | 2052 | Texture* normalMap = networkPart.normalTexture.data(); |
| 2053 | batch.setUniformTexture(1, !normalMap ? | 2053 | batch.setResourceTexture(1, !normalMap ? |
| 2054 | textureCache->getBlueTexture() : normalMap->getGPUTexture()); | 2054 | textureCache->getBlueTexture() : normalMap->getGPUTexture()); |
| 2055 | 2055 | ||
| 2056 | } | 2056 | } |
| 2057 | 2057 | ||
| 2058 | if (locations->specularTextureUnit >= 0) { | 2058 | if (locations->specularTextureUnit >= 0) { |
| 2059 | Texture* specularMap = networkPart.specularTexture.data(); | 2059 | Texture* specularMap = networkPart.specularTexture.data(); |
| 2060 | batch.setUniformTexture(locations->specularTextureUnit, !specularMap ? | 2060 | batch.setResourceTexture(locations->specularTextureUnit, !specularMap ? |
| 2061 | textureCache->getWhiteTexture() : specularMap->getGPUTexture()); | 2061 | textureCache->getWhiteTexture() : specularMap->getGPUTexture()); |
| 2062 | } | 2062 | } |
| 2063 | 2063 | ||
| @@ -2074,7 +2074,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 10 unmodified lines | |||
| 2074 | GLBATCH(glUniform2f)(locations->emissiveParams, emissiveOffset, emissiveScale); | 2074 | GLBATCH(glUniform2f)(locations->emissiveParams, emissiveOffset, emissiveScale); |
| 2075 | 2075 | ||
| 2076 | Texture* emissiveMap = networkPart.emissiveTexture.data(); | 2076 | Texture* emissiveMap = networkPart.emissiveTexture.data(); |
| 2077 | batch.setUniformTexture(locations->emissiveTextureUnit, !emissiveMap ? | 2077 | batch.setResourceTexture(locations->emissiveTextureUnit, !emissiveMap ? |
| 2078 | textureCache->getWhiteTexture() : emissiveMap->getGPUTexture()); | 2078 | textureCache->getWhiteTexture() : emissiveMap->getGPUTexture()); |
| 2079 | } | 2079 | } |
| 2080 | 2080 | ||
| @@ -236,7 +236,7 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon · 235 unmodified lines | |||
| 236 | batch.setViewTransform(viewMat); | 236 | batch.setViewTransform(viewMat); |
| 237 | 237 | ||
| 238 | batch.setPipeline(getOpaquePipeline()); | 238 | batch.setPipeline(getOpaquePipeline()); |
| 239 | batch.setUniformTexture(0, args->_whiteTexture); | 239 | batch.setResourceTexture(0, args->_whiteTexture); |
| 240 | 240 | ||
| 241 | if (!inItems.empty()) { | 241 | if (!inItems.empty()) { |
| 242 | batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0); | 242 | batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0); |
| @@ -423,7 +423,7 @@ void Font3D::drawString(gpu::Batch& batch, float x, float y, const QString& str, · 422 unmodified lines | |||
| 423 | 423 | ||
| 424 | setupGPU(); | 424 | setupGPU(); |
| 425 | batch.setPipeline(_pipeline); | 425 | batch.setPipeline(_pipeline); |
| 426 | batch.setUniformTexture(_fontLoc, _texture); | 426 | batch.setResourceTexture(_fontLoc, _texture); |
| 427 | batch._glUniform1i(_outlineLoc, (effectType == TextRenderer3D::OUTLINE_EFFECT)); | 427 | batch._glUniform1i(_outlineLoc, (effectType == TextRenderer3D::OUTLINE_EFFECT)); |
| 428 | batch._glUniform4fv(_colorLoc, 1, (const GLfloat*)color); | 428 | batch._glUniform4fv(_colorLoc, 1, (const GLfloat*)color); |
| 429 | 429 | ||