从C+获取浮动纹理+;AMP而不是无类型 我想用一个最有效的方式在一个UWP应用中显示一个用C++ AMP生成的图像。 我的方法是将C++ AMP数据移动到可以在UWP显示的ID3D11TraceUR2D中。 为此,我将数据复制到使用以下工具创建的纹理: unsigned int bitsPerScalarElement = 32; auto ampTexture = Concurrency::graphics::texture<Concurrency::graphics::float_4, 2>(m_width, m_height, bitsPerScalarElement); unsigned int-bitsperscaleRelation=32; 自动放大纹理=并发::图形::纹理(m_宽度、m_高度、比特率);

从C+获取浮动纹理+;AMP而不是无类型 我想用一个最有效的方式在一个UWP应用中显示一个用C++ AMP生成的图像。 我的方法是将C++ AMP数据移动到可以在UWP显示的ID3D11TraceUR2D中。 为此,我将数据复制到使用以下工具创建的纹理: unsigned int bitsPerScalarElement = 32; auto ampTexture = Concurrency::graphics::texture<Concurrency::graphics::float_4, 2>(m_width, m_height, bitsPerScalarElement); unsigned int-bitsperscaleRelation=32; 自动放大纹理=并发::图形::纹理(m_宽度、m_高度、比特率);,uwp,directx-11,c++-amp,Uwp,Directx 11,C++ Amp,但是,这会导致使用DXGI_格式_R32G32B32A32_无类型纹理格式的纹理。 我希望这是DXGI_格式_R32G32B32A32_FLOAT,否则UWP将无法显示它。它抱怨“位图像素格式不受支持” 根据,我应该只需要在创建纹理时设置BitsPerScalRelation来选择类型,但它对我不起作用 有人能帮我吗 以下是验证返回格式的测试程序: #include "pch.h" #include <iostream> #include <amp.h> #includ

但是,这会导致使用DXGI_格式_R32G32B32A32_无类型纹理格式的纹理。 我希望这是DXGI_格式_R32G32B32A32_FLOAT,否则UWP将无法显示它。它抱怨“位图像素格式不受支持”

根据,我应该只需要在创建纹理时设置BitsPerScalRelation来选择类型,但它对我不起作用

有人能帮我吗

以下是验证返回格式的测试程序:

#include "pch.h"
#include <iostream>

#include <amp.h>
#include <amp_graphics.h>

#include <d3d11.h>
#include <wrl.h>

int main()
{
    unsigned int bitsPerScalarElement = 32;
    auto ampTexture = Concurrency::graphics::texture<Concurrency::graphics::float_4, 2>(500, 500, bitsPerScalarElement);

    Microsoft::WRL::ComPtr<ID3D11Texture2D> d3dTexture;
    auto hr = Concurrency::graphics::direct3d::get_texture(ampTexture)->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&d3dTexture);
    D3D11_TEXTURE2D_DESC texDesc;
    d3dTexture->GetDesc(&texDesc);

    std::cout << "Format: " << texDesc.Format << "\n";
}
#包括“pch.h”
#包括
#包括
#包括
#包括
#包括
int main()
{
无符号整数比特率=32;
auto-ampTexture=Concurrency::graphics::texture(500500,BitsPerScalRelation);
微软::WRL::ComPtr d3dTexture;
auto hr=Concurrency::graphics::direct3d::get_-texture(ampTexture)->QueryInterface(uu-uuidof(ID3D11Texture2D),(void**)和d3dTexture);
D3D11_TEXTURE2D_DESC texDesc;
d3dTexture->GetDesc(&texDesc);

std::难道你的意思是当你使用
并发::graphics::texture
创建纹理时,它返回DXGI_格式\u R32G32B32A32_无类型格式?当我测试它时,我没有发现它返回DXGI_格式\u R32G32B32A32_无类型格式,你能显示更多关于结果的细节以及如何识别它是否是无类型格式吗?另外,当我通过链接创建direct3d设备来创建纹理,它可以创建DXGI_格式的纹理,你试过了吗?它对你有用吗?你只想使用
Concurrency::graphics::texture
方法来创建纹理吗?我已经用纹理格式的完整测试程序更新了我的问题。Y您还需要在VS2017中使用“no”而不是“/permissive-”关闭一致性模式,否则包含的amp_graphics.h将无法编译(错误C3861:“_Texture_base”:找不到标识符)。