message: OpenGL backend: fixed formatted buffer views not addressing the entire buffer
diff: @@ -40,8 +40,9 @@ namespace Diligent
  TBuffViewBase(pRefCounters, pDevice, ViewDesc, pBuffer, bIsDefaultView ),
  m_GLTexBuffer(false)
  {
  + const auto& BuffDesc = pBuffer->GetDesc();
  if ((ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE || ViewDesc.ViewType == BUFFER_VIEW_UNORDERED_ACCESS) &&
  - (pBuffer->GetDesc().Mode == BUFFER_MODE_FORMATTED || pBuffer->GetDesc().Mode == BUFFER_MODE_RAW) )
  + (BuffDesc.Mode == BUFFER_MODE_FORMATTED || BuffDesc.Mode == BUFFER_MODE_RAW))
  {
  #ifdef _MSC_VER
  # pragma warning(push)
  @@ -60,13 +61,25 @@ namespace Diligent
  const auto& BuffFmt = ViewDesc.Format;
  GLenum GLFormat = 0;
  - if(pBuffer->GetDesc().Mode == BUFFER_MODE_FORMATTED || BuffFmt.ValueType != VT_UNDEFINED)
  + if (BuffDesc.Mode == BUFFER_MODE_FORMATTED || BuffFmt.ValueType != VT_UNDEFINED)
  GLFormat = TypeToGLTexFormat( BuffFmt.ValueType, BuffFmt.NumComponents, BuffFmt.IsNormalized );
  else
  {
  GLFormat = GL_R32UI;
  }
  +
  + if (ViewDesc.ByteOffset == 0 && ViewDesc.ByteWidth == BuffDesc.uiSizeInBytes)
  glTexBuffer(GL_TEXTURE_BUFFER, GLFormat, pBuffer->GetGLHandle());
  + else
  + {
  +#if GL_ARB_texture_buffer_range
  + glTexBufferRange(GL_TEXTURE_BUFFER, GLFormat, pBuffer->GetGLHandle(), ViewDesc.ByteOffset, ViewDesc.ByteWidth);
  +#else
  + LOG_ERROR_AND_THROW("Unable to create view '", ViewDesc.Name, "' for buffer '", BuffDesc.Name,
  + "' because GL_ARB_texture_buffer_range extension is not available. "
  + "Only full-buffer views can be created on this device.");
  +#endif
  + }
  CHECK_GL_ERROR_AND_THROW( "Failed to create texture buffer" );
  ContextState.BindTexture(-1, GL_TEXTURE_BUFFER, GLObjectWrappers::GLTextureObj(false));
  