小编sev*_*ens的帖子

AWS + Serverless - 如何获取 Cognito 用户池生成的密钥

我一直在关注https://serverless-stack.com/chapters/configure-cognito-user-pool-in-serverless.html 上的无服务器教程

我有以下无服务器 yaml snippit

Resources:
  CognitoUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      # Generate a name based on the stage
      UserPoolName: ${self:custom.stage}-moochless-user-pool
      # Set email as an alias
      UsernameAttributes:
      - email
      AutoVerifiedAttributes:
      - email

  CognitoUserPoolClient:
    Type: AWS::Cognito::UserPoolClient
    Properties:
      # Generate an app client name based on the stage
      ClientName: ${self:custom.stage}-user-pool-client
      UserPoolId:
        Ref: CognitoUserPool
      ExplicitAuthFlows:
      - ADMIN_NO_SRP_AUTH
      # >>>>> HOW DO I GET THIS VALUE IN OUTPUT <<<<<
      GenerateSecret: true

# Print out the Id of the User Pool that is …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-cognito serverless

5
推荐指数
1
解决办法
2191
查看次数

金属有后缓冲吗?

我正在追踪我的Metal应用程序中的一些视觉弹出,并且相信这是因为我直接绘制到帧缓冲区,而不是后缓冲区

  // this is when I've finished passing commands to the render buffer and issue the draw command.  I believe this sends all the images directly to the framebuffer instead of using a backbuffer
  [renderEncoder endEncoding];
  [mtlCommandBuffer presentDrawable:frameDrawable];
  [mtlCommandBuffer commit];
  [mtlCommandBuffer release];
  //[frameDrawable present];   // This line isn't needed (and I believe is performed by presentDrawable
Run Code Online (Sandbox Code Playgroud)

几个谷歌后来,我还没有找到任何金属背缓冲的文档.我知道我可以自己滚动,但我不相信金属不支持后缓冲.

这是我如何设置CAMetalLayer对象的代码片段.

+ (id)layerClass
{
    return [CAMetalLayer class];
}

- (void)initCommon
{
    self.opaque          = YES;
    self.backgroundColor = nil;
    ...
}

-(id <CAMetalDrawable>)getMetalLayer
{
    id …
Run Code Online (Sandbox Code Playgroud)

ios metal

4
推荐指数
1
解决办法
984
查看次数

将纹理数组发送到 Metal 的最佳方式

我有下面的着色器(为了长度和清晰度而删除了一些部分),并且希望找到更好的方法来做到这一点。我想将尺寸可变的纹理数组发送到我的金属着色器。我将对顶点位置进行一些计算,然后找出要使用的纹理。

目前我只是硬编码了一些东西并使用了几个 if 语句,但这很丑陋(而且我猜速度不快)。有什么方法可以计算i然后用作i纹理下标(如tex[i].sample)?

// Current code - its ugly
fragment half4 SimpleTextureFragment(VertextOut inFrag [[stage_in]],
                                   texture2d<half>  tex0   [[ texture(0) ]]
                                   texture2d<half>  tex1   [[ texture(1) ]]
                                   texture2d<half>  tex2   [[ texture(2) ]]
                                   ...
                                   texture2d<half>  texN   [[ texture(N) ]]
                                     )
{
   constexpr sampler quad_sampler;
   int i = (Compute_Correct_Texture_to_Use);
   if(i==0)
   {
      half4 color = tex0.sample(quad_sampler, inFrag.tex_coord);
   }
   else if(i==1)
   {
      half4 color = tex1.sample(quad_sampler, inFrag.tex_coord);
   }
   ...
   else if(i==n)
   {
      half4 color = texN.sample(quad_sampler, inFrag.tex_coord);
   }
   return color; …
Run Code Online (Sandbox Code Playgroud)

ios metal

2
推荐指数
1
解决办法
3592
查看次数

金属渲染真的很慢 - 如何加快速度

我有一个非常慢的工作金属应用程序,需要运行得更快.我相信问题是我创建了太多的MTLCommandBuffer对象.

我创建这么多MTLCommandBuffer对象的原因是我需要向像素着色器发送不同的统一值.我粘贴了一些代码来说明下面的问题.

  for (int obj_i = 0 ; obj_i < n ; ++obj_i)
  {
     // I create one render command buffer per object I draw so I can use  different uniforms
     id <MTLCommandBuffer> mtlCommandBuffer = [metal_info.g_commandQueue commandBuffer];
     id <MTLRenderCommandEncoder> renderCommand = [mtlCommandBuffer renderCommandEncoderWithDescriptor:<#(MTLRenderPassDescriptor *)#>]

     // glossing over details, but this call has per object specific data
     memcpy([global_uniform_buffer contents], per_object_data, sizeof(per_data_object));

     [renderCommand setVertexBuffer:object_vertices  offset:0 atIndex:0];
     // I am reusing a single buffer for all shader calls
     // this is killing performance …
Run Code Online (Sandbox Code Playgroud)

ios metal

2
推荐指数
1
解决办法
1299
查看次数