   HLSL - Get Viewport
  Is there a way to get the viewport dimensions in HLSL?I know there is a way to set states for things like depth, alpha, etc. And that doesn't directly show up in the reference docs, so I am wondering if I can get the viewport values too?If I can, I could move all the these calculations that happen in my render method to the shader and add techniques for rendering 2D UI style, or billboarded. (which is my hope)//-------------------------------------------------------------------void Image2D::Render(){   // Get the original matrices   D3DXMATRIX origProjection;   D3DXMATRIX origView;   m_effectManager.GetViewMatrix(origView);   m_effectManager.GetProjectionMatrix(origProjection);   // Create new matrices for rendering 2D   D3DXMATRIXnewProjection;D3DXMATRIXnewView;   D3DXMATRIXworld;   UINT numViewports = 1;   D3D10_VIEWPORT viewport;   m_device.RSGetViewports(&numViewports, &viewport);   D3DXMatrixOrthoLH(&newProjection, static_cast<float>(viewport.Width), static_cast<float>(viewport.Height), 0.0f, 1.0f);   D3DXMatrixIdentity(&newView);   m_effectManager.SetProjectionMatrix(newProjection);   m_effectManager.SetViewMatrix(newView);   // Set the world matrix and material   Effect *    effect    = NULL;   Technique * technique = NULL;   Pass * pass = NULL;   try   { effect    = &(m_effectManager.GetChildEffect("image")); technique = &(effect->GetTechnique("RenderWithAlpha")); pass = &(technique->GetPass(0)); effect->SetWorldMatrix(m_world); effect->SetMaterial(*m_material);   }   catch(BaseException & e)   { throw e;   }   // Bind the input layout   m_device.IASetInputLayout(m_inputLayout);   m_device.IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);   // Bind the vertex buffers   std::vector<ID3D10Buffer *> vertexBuffers;   vertexBuffers.push_back( m_quadBuffers[0]->GetD3DBuffer() );   vertexBuffers.push_back( m_quadBuffers[1]->GetD3DBuffer() );   std::vector<unsigned> offsets;   offsets.push_back(0);   offsets.push_back(0);   m_device.IASetVertexBuffers(0, static_cast<UINT>(vertexBuffers.size()), &vertexBuffers[0],  &m_strides[0],  &offsets[0]);   // Calculate the frame to be rendered   CalculateAnimationFrame();   unsigned startVertex = (m_currentFrameIndex) * 4;   // Apply the pass   pass->Apply();   // Draw   m_device.Draw(4, startVertex);   // Restore the original matrices   m_effectManager.SetProjectionMatrix(origProjection);   m_effectManager.SetViewMatrix(origView);}