Fix RHI texture binding and add pure quad test
This commit is contained in:
@@ -122,6 +122,38 @@ TEST_P(RHITestFixture, Device_CreateUnorderedAccessView) {
|
||||
delete texture;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, Device_CreateShaderResourceView_FromInitialDataTexture) {
|
||||
TextureDesc texDesc = {};
|
||||
texDesc.width = 1;
|
||||
texDesc.height = 1;
|
||||
texDesc.depth = 1;
|
||||
texDesc.mipLevels = 1;
|
||||
texDesc.arraySize = 1;
|
||||
texDesc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
||||
texDesc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
|
||||
texDesc.sampleCount = 1;
|
||||
texDesc.sampleQuality = 0;
|
||||
texDesc.flags = 0;
|
||||
|
||||
const uint8_t pixel[4] = { 255, 255, 255, 255 };
|
||||
RHITexture* texture = GetDevice()->CreateTexture(texDesc, pixel, sizeof(pixel), 4);
|
||||
ASSERT_NE(texture, nullptr);
|
||||
|
||||
ResourceViewDesc viewDesc = {};
|
||||
viewDesc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
||||
viewDesc.dimension = ResourceViewDimension::Texture2D;
|
||||
|
||||
RHIResourceView* srv = GetDevice()->CreateShaderResourceView(texture, viewDesc);
|
||||
ASSERT_NE(srv, nullptr);
|
||||
EXPECT_TRUE(srv->IsValid());
|
||||
EXPECT_EQ(srv->GetViewType(), ResourceViewType::ShaderResource);
|
||||
|
||||
srv->Shutdown();
|
||||
delete srv;
|
||||
texture->Shutdown();
|
||||
delete texture;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, Device_CreateVertexBufferView) {
|
||||
BufferDesc bufferDesc = {};
|
||||
bufferDesc.size = 256;
|
||||
|
||||
Reference in New Issue
Block a user