Exemple #1
0
_Use_decl_annotations_
HRESULT WINAPI DXUTGetD3D11AdapterDisplayMode( UINT AdapterOrdinal, UINT nOutput, DXGI_MODE_DESC* pModeDesc )
{
    if( !pModeDesc )
        return E_INVALIDARG;

    auto pD3DEnum = DXUTGetD3D11Enumeration();
    if ( !pD3DEnum )
        return E_POINTER;

    auto pOutputInfo = pD3DEnum->GetOutputInfo( AdapterOrdinal, nOutput );
    if( pOutputInfo )
    {
        pModeDesc->Width = 800;
        pModeDesc->Height = 600;
        pModeDesc->RefreshRate.Numerator = 0;
        pModeDesc->RefreshRate.Denominator = 0;
        pModeDesc->Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
        pModeDesc->Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
        pModeDesc->ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;

        DXGI_OUTPUT_DESC Desc;
        if ( FAILED(pOutputInfo->m_pOutput->GetDesc(&Desc)))
            memset( &Desc, 0, sizeof(Desc) );
        pModeDesc->Width = Desc.DesktopCoordinates.right - Desc.DesktopCoordinates.left;
        pModeDesc->Height = Desc.DesktopCoordinates.bottom - Desc.DesktopCoordinates.top;

        // This should not be required with DXGI 1.1 support for BGRA...
        if( pModeDesc->Format == DXGI_FORMAT_B8G8R8A8_UNORM )
            pModeDesc->Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    }

    return S_OK;
}
Exemple #2
0
//------------------------------------------------------------------------------
bool Inverse::ValidateInputs()
{
   if (leftNode == NULL)
      throw MathException("Inverse() - Missing input arguments.\n");
   
   Integer type, row, col;
   
   GetOutputInfo(type, row, col);
   
   // Only Real type and Matrix are valid. Vector is not a valid input
   if ((type == Gmat::REAL_TYPE) ||
       (type == Gmat::RMATRIX_TYPE && row == col))
      return true;
   
   return false;
}
// For this version, the work flow is that we first lookup the left table, and
// use the result to lookup right table. If left table is done that means right
// table is also done. So we only keep the left_child_done_ as the sign.
bool NestedLoopJoinExecutor::DExecute() {
  LOG_TRACE("********** Nested Loop %s Join executor :: 2 children ",
            GetJoinTypeString());

  // Grab info from plan node and check it
  const planner::NestedLoopJoinPlan &node =
      GetPlanNode<planner::NestedLoopJoinPlan>();

  // Pick out the left and right columns
  const std::vector<oid_t> &join_column_ids_left = node.GetJoinColumnsLeft();
  const std::vector<oid_t> &join_column_ids_right = node.GetJoinColumnsRight();

  // We should first deal with the current result. Otherwise we will cache a lot
  // data which is not good to utilize memory. After that we call child execute.
  // Since is the high level idea, each time we get tile from left, we should
  // finish this tile, and then call child[0] execute for next tile.
  for (;;) {
    //===------------------------------------------------------------------===//
    // Pick left and right tiles
    //===------------------------------------------------------------------===//

    // If we have already retrieved all left child's results in buffer
    if (left_child_done_ == true) {
      LOG_TRACE("Left is done which means all join comparison completes");
      return false;
    }

    // If left tile result is not done, continue the left tuples
    if (!left_tile_done_) {
      // Tuple result
      ContainerTuple<executor::LogicalTile> left_tuple(left_tile_.get(),
                                                       left_tile_row_itr_);

      // Grab the values
      if (!join_column_ids_left.empty() && !join_column_ids_right.empty()) {
        std::vector<type::Value> join_values;
        for (auto column_id : join_column_ids_left) {
          type::Value predicate_value = left_tuple.GetValue(column_id);
          join_values.push_back(predicate_value);
        }

        // Pass the columns and values to right executor
        LOG_TRACE("Update the new value for index predicate");
        children_[1]->UpdatePredicate(join_column_ids_right, join_values);
      }

      // Execute the right child to get the right tile
      if (children_[1]->Execute() == true) {
        LOG_TRACE("Advance the Right child.");
        std::unique_ptr<LogicalTile> right_tile(children_[1]->GetOutput());

        PL_ASSERT(right_tile != nullptr);

        // Construct output result
        auto output_tile =
            BuildOutputLogicalTile(left_tile_.get(), right_tile.get());

        // Build position list
        LogicalTile::PositionListsBuilder pos_lists_builder(left_tile_.get(),
                                                            right_tile.get());

        // Go over every pair of tuples in left and right logical tiles
        for (auto right_tile_row_itr : *right_tile) {
          // Insert a tuple into the output logical tile
          // First, copy the elements in left logical tile's tuple
          LOG_TRACE("Insert a tuple into the output logical tile");

          ContainerTuple<executor::LogicalTile> right_tuple(right_tile.get(),
              right_tile_row_itr);

          if (predicate_ != nullptr) {
            auto eval = predicate_->Evaluate(&left_tuple, &right_tuple,
                                             executor_context_);

            // Join predicate is false. Skip pair and continue.
            if (eval.IsFalse()) {
              LOG_TRACE("Not math join predicate");
              continue;
            }
            LOG_TRACE("Find a tuple with join predicate");
          }
          pos_lists_builder.AddRow(left_tile_row_itr_, right_tile_row_itr);
        }  // Outer loop of NLJ

        // Now current left tile is done
        LOG_TRACE("pos_lists_builder's size : %ld", pos_lists_builder.Size());
        if (pos_lists_builder.Size() > 0) {
          LOG_TRACE("Set output result");
          output_tile->SetPositionListsAndVisibility(
              pos_lists_builder.Release());
          SetOutput(output_tile.release());
          LOG_TRACE("result is : %s", GetOutputInfo()->GetInfo().c_str());
          return true;
        }
        continue;
      }
      // Right table is finished for the current left tuple. move to the next
      else {
        if (!left_child_done_) {
          LOG_TRACE("right child is done, but left is not, so reset right");
          children_[1]->ResetState();

          // When all right table is done, examine whether left tile is done
          // If left tile is done, next loop will directly execute child[0]
          if (left_tile_row_itr_ == left_tile_->GetTupleCount() - 1) {
            LOG_TRACE("left tile is done");
            // Set up flag and go the execute child 0 to get the next tile
            left_tile_done_ = true;
          } else {
            // Move the row to the next one in left tile
            LOG_TRACE("Advance left row");
            left_tile_row_itr_++;

            // Continue the new left row
            continue;
          }
        } else {
          LOG_TRACE("Both left and right child are done");
          right_child_done_ = true;
          return false;
        }
      }
    }  // End handle left tile

    // Otherwise, we must attempt to execute the left child to get a new left
    // tile

    // Left child is finished, no more tiles
    if (children_[0]->Execute() == false) {
      LOG_TRACE("Left child is exhausted.");
      return false;
    }
    // Cache the new tile
    else {
      // Get the left child's result
      LOG_TRACE("Retrieve a new tile from left child");
      left_tile_.reset(children_[0]->GetOutput());

      // Set the flag with init status
      left_tile_done_ = false;
      left_tile_row_itr_ = 0;
    }

    LOG_TRACE("Get a new left tile. Continue the loop.");

  }  // end the very beginning for loop
}