MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / SetTexture

Method SetTexture

tools/explorer/ModelView.cpp:448–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446bool ModelView::MouseScrollUpdate(double xoffset, double yoffset)
447{
448 m_camera->MouseScrollUpdate(xoffset, yoffset);
449 return true;
450}
451
452void ModelView::SetTexture(nvrhi::ITexture* texture, bool isSRGB, int slot, bool right)
453{
454 if (slot < 0 || slot >= int(c_MaxTextures))
455 {
456 assert(false);
457 return;
458 }
459
460 nvrhi::Format viewFormat = texture->getDesc().format;
461 m_convertFromSRGB[slot] = false;
462 if (isSRGB)
463 {
464 if (viewFormat == nvrhi::Format::RGBA8_UNORM)
465 viewFormat = nvrhi::Format::SRGBA8_UNORM;
466 else
467 m_convertFromSRGB[slot] = true;
468 }
469
470 uint32_t page = right ? c_MaxTextures : 0;
471 auto bindingSetItem = nvrhi::BindingSetItem::Texture_SRV(uint32_t(slot) + page, texture, viewFormat);
472 if (m_descriptors[bindingSetItem.slot] != bindingSetItem)
473 {
474 m_descriptorsValid = false;
475 m_descriptors[bindingSetItem.slot] = bindingSetItem;
476 }

Callers 1

RenderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected