Rename RenderPassInfo to RenderPassDescriptor
This commit is contained in:
parent
6f7749cce9
commit
8d6b5d2337
|
@ -129,8 +129,8 @@ void init() {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
static int f = 0;
|
||||
f++;
|
||||
|
|
|
@ -81,12 +81,12 @@ void frame() {
|
|||
backbufferView = nxtTextureViewBuilderGetResult(builder);
|
||||
nxtTextureViewBuilderRelease(builder);
|
||||
}
|
||||
nxtRenderPassInfo renderpassInfo;
|
||||
nxtRenderPassDescriptor renderpassInfo;
|
||||
{
|
||||
nxtRenderPassInfoBuilder builder = nxtDeviceCreateRenderPassInfoBuilder(device);
|
||||
nxtRenderPassInfoBuilderSetColorAttachment(builder, 0, backbufferView, NXT_LOAD_OP_CLEAR);
|
||||
renderpassInfo = nxtRenderPassInfoBuilderGetResult(builder);
|
||||
nxtRenderPassInfoBuilderRelease(builder);
|
||||
nxtRenderPassDescriptorBuilder builder = nxtDeviceCreateRenderPassDescriptorBuilder(device);
|
||||
nxtRenderPassDescriptorBuilderSetColorAttachment(builder, 0, backbufferView, NXT_LOAD_OP_CLEAR);
|
||||
renderpassInfo = nxtRenderPassDescriptorBuilderGetResult(builder);
|
||||
nxtRenderPassDescriptorBuilderRelease(builder);
|
||||
}
|
||||
nxtCommandBuffer commands;
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ void frame() {
|
|||
nxtCommandBufferRelease(commands);
|
||||
nxtTextureTransitionUsage(backbuffer, NXT_TEXTURE_USAGE_BIT_PRESENT);
|
||||
nxtSwapChainPresent(swapchain, backbuffer);
|
||||
nxtRenderPassInfoRelease(renderpassInfo);
|
||||
nxtRenderPassDescriptorRelease(renderpassInfo);
|
||||
nxtTextureViewRelease(backbufferView);
|
||||
|
||||
DoFlush();
|
||||
|
|
|
@ -259,7 +259,7 @@ void initSim() {
|
|||
}
|
||||
}
|
||||
|
||||
nxt::CommandBuffer createCommandBuffer(const nxt::RenderPassInfo& renderPass, size_t i) {
|
||||
nxt::CommandBuffer createCommandBuffer(const nxt::RenderPassDescriptor& renderPass, size_t i) {
|
||||
static const uint32_t zeroOffsets[1] = {0};
|
||||
auto& bufferSrc = particleBuffers[i];
|
||||
auto& bufferDst = particleBuffers[(i + 1) % 2];
|
||||
|
@ -298,8 +298,8 @@ void init() {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
nxt::CommandBuffer commandBuffer = createCommandBuffer(renderPass, pingpong);
|
||||
queue.Submit(1, &commandBuffer);
|
||||
|
|
|
@ -132,8 +132,8 @@ void init() {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
.TransitionBufferUsage(buffer, nxt::BufferUsageBit::Storage)
|
||||
|
|
|
@ -278,8 +278,8 @@ void frame() {
|
|||
cameraBuffer.SetSubData(0, sizeof(CameraData), reinterpret_cast<uint8_t*>(&cameraData));
|
||||
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
.BeginRenderPass(renderPass)
|
||||
|
|
|
@ -87,8 +87,8 @@ void init() {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
static const uint32_t vertexBufferOffsets[1] = {0};
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
|
|
|
@ -92,8 +92,8 @@ void init() {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
static const uint32_t vertexBufferOffsets[1] = {0};
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
|
|
|
@ -149,8 +149,8 @@ void frame() {
|
|||
if (s.b >= 1.0f) {s.b = 0.0f;}
|
||||
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
static const uint32_t vertexBufferOffsets[1] = {0};
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
|
|
|
@ -98,8 +98,8 @@ void frame() {
|
|||
buffer.SetSubData(0, sizeof(s), reinterpret_cast<uint8_t*>(&s));
|
||||
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
.BeginRenderPass(renderPass)
|
||||
|
|
|
@ -81,8 +81,8 @@ void init() {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
static const uint32_t vertexBufferOffsets[1] = {0};
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
|
|
|
@ -166,11 +166,11 @@ void frame() {
|
|||
nxt::Texture backbuffer = swapchain.GetNextTexture();
|
||||
auto backbufferView = backbuffer.CreateTextureViewBuilder().GetResult();
|
||||
|
||||
nxt::RenderPassInfo renderPass1 = device.CreateRenderPassInfoBuilder()
|
||||
nxt::RenderPassDescriptor renderPass1 = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
||||
nxt::RenderPassInfo renderPass2 = device.CreateRenderPassInfoBuilder()
|
||||
nxt::RenderPassDescriptor renderPass2 = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, backbufferView, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
||||
|
|
|
@ -147,14 +147,14 @@ nxt::TextureView CreateDefaultDepthStencilView(const nxt::Device& device) {
|
|||
.GetResult();
|
||||
}
|
||||
|
||||
void GetNextRenderPassInfo(const nxt::Device& device,
|
||||
void GetNextRenderPassDescriptor(const nxt::Device& device,
|
||||
const nxt::SwapChain& swapchain,
|
||||
const nxt::TextureView& depthStencilView,
|
||||
nxt::Texture* backbuffer,
|
||||
nxt::RenderPassInfo* info) {
|
||||
nxt::RenderPassDescriptor* info) {
|
||||
*backbuffer = swapchain.GetNextTexture();
|
||||
auto backbufferView = backbuffer->CreateTextureViewBuilder().GetResult();
|
||||
*info = device.CreateRenderPassInfoBuilder()
|
||||
*info = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, backbufferView, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencilView, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
|
|
@ -27,8 +27,8 @@ uint64_t GetSwapChainImplementation();
|
|||
nxt::TextureFormat GetPreferredSwapChainTextureFormat();
|
||||
nxt::SwapChain GetSwapChain(const nxt::Device& device);
|
||||
nxt::TextureView CreateDefaultDepthStencilView(const nxt::Device& device);
|
||||
void GetNextRenderPassInfo(const nxt::Device& device,
|
||||
void GetNextRenderPassDescriptor(const nxt::Device& device,
|
||||
const nxt::SwapChain& swapchain,
|
||||
const nxt::TextureView& depthStencilView,
|
||||
nxt::Texture* backbuffer,
|
||||
nxt::RenderPassInfo* info);
|
||||
nxt::RenderPassDescriptor* info);
|
||||
|
|
|
@ -584,8 +584,8 @@ namespace {
|
|||
|
||||
void frame() {
|
||||
nxt::Texture backbuffer;
|
||||
nxt::RenderPassInfo renderPass;
|
||||
GetNextRenderPassInfo(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
const auto& defaultSceneNodes = scene.scenes.at(scene.defaultScene);
|
||||
nxt::CommandBufferBuilder cmd = device.CreateCommandBufferBuilder()
|
||||
|
|
12
next.json
12
next.json
|
@ -345,7 +345,7 @@
|
|||
{
|
||||
"name": "begin render pass",
|
||||
"args": [
|
||||
{"name": "info", "type": "render pass info"}
|
||||
{"name": "info", "type": "render pass descriptor"}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -592,8 +592,8 @@
|
|||
"returns": "depth stencil state builder"
|
||||
},
|
||||
{
|
||||
"name": "create render pass info builder",
|
||||
"returns": "render pass info builder"
|
||||
"name": "create render pass descriptor builder",
|
||||
"returns": "render pass descriptor builder"
|
||||
},
|
||||
{
|
||||
"name": "create input state builder",
|
||||
|
@ -814,12 +814,12 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"render pass info builder": {
|
||||
"render pass descriptor builder": {
|
||||
"category": "object",
|
||||
"methods": [
|
||||
{
|
||||
"name": "get result",
|
||||
"returns": "render pass info"
|
||||
"returns": "render pass descriptor"
|
||||
},
|
||||
{
|
||||
"name": "set color attachment",
|
||||
|
@ -858,7 +858,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"render pass info": {
|
||||
"render pass descriptor": {
|
||||
"category": "object"
|
||||
},
|
||||
"render pipeline": {
|
||||
|
|
|
@ -249,8 +249,8 @@ if (NXT_ENABLE_D3D12)
|
|||
${D3D12_DIR}/PipelineLayoutD3D12.h
|
||||
${D3D12_DIR}/QueueD3D12.cpp
|
||||
${D3D12_DIR}/QueueD3D12.h
|
||||
${D3D12_DIR}/RenderPassInfoD3D12.cpp
|
||||
${D3D12_DIR}/RenderPassInfoD3D12.h
|
||||
${D3D12_DIR}/RenderPassDescriptorD3D12.cpp
|
||||
${D3D12_DIR}/RenderPassDescriptorD3D12.h
|
||||
${D3D12_DIR}/RenderPipelineD3D12.cpp
|
||||
${D3D12_DIR}/RenderPipelineD3D12.h
|
||||
${D3D12_DIR}/ResourceAllocator.cpp
|
||||
|
@ -318,8 +318,8 @@ if (NXT_ENABLE_VULKAN)
|
|||
${VULKAN_DIR}/PipelineLayoutVk.h
|
||||
${VULKAN_DIR}/RenderPassCache.cpp
|
||||
${VULKAN_DIR}/RenderPassCache.h
|
||||
${VULKAN_DIR}/RenderPassInfoVk.cpp
|
||||
${VULKAN_DIR}/RenderPassInfoVk.h
|
||||
${VULKAN_DIR}/RenderPassDescriptorVk.cpp
|
||||
${VULKAN_DIR}/RenderPassDescriptorVk.h
|
||||
${VULKAN_DIR}/RenderPipelineVk.cpp
|
||||
${VULKAN_DIR}/RenderPipelineVk.h
|
||||
${VULKAN_DIR}/SamplerVk.cpp
|
||||
|
@ -379,8 +379,8 @@ list(APPEND BACKEND_SOURCES
|
|||
${BACKEND_DIR}/PipelineLayout.h
|
||||
${BACKEND_DIR}/Queue.cpp
|
||||
${BACKEND_DIR}/Queue.h
|
||||
${BACKEND_DIR}/RenderPassInfo.cpp
|
||||
${BACKEND_DIR}/RenderPassInfo.h
|
||||
${BACKEND_DIR}/RenderPassDescriptor.cpp
|
||||
${BACKEND_DIR}/RenderPassDescriptor.h
|
||||
${BACKEND_DIR}/RefCounted.cpp
|
||||
${BACKEND_DIR}/RefCounted.h
|
||||
${BACKEND_DIR}/Sampler.cpp
|
||||
|
|
|
@ -368,7 +368,7 @@ namespace backend {
|
|||
|
||||
case Command::BeginRenderPass: {
|
||||
BeginRenderPassCmd* cmd = mIterator.NextCommand<BeginRenderPassCmd>();
|
||||
RenderPassInfoBase* info = cmd->info.Get();
|
||||
RenderPassDescriptorBase* info = cmd->info.Get();
|
||||
if (!mState->BeginRenderPass(info)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ namespace backend {
|
|||
mAllocator.Allocate<BeginComputePassCmd>(Command::BeginComputePass);
|
||||
}
|
||||
|
||||
void CommandBufferBuilder::BeginRenderPass(RenderPassInfoBase* info) {
|
||||
void CommandBufferBuilder::BeginRenderPass(RenderPassDescriptorBase* info) {
|
||||
BeginRenderPassCmd* cmd = mAllocator.Allocate<BeginRenderPassCmd>(Command::BeginRenderPass);
|
||||
new (cmd) BeginRenderPassCmd;
|
||||
cmd->info = info;
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace backend {
|
|||
|
||||
// NXT API
|
||||
void BeginComputePass();
|
||||
void BeginRenderPass(RenderPassInfoBase* info);
|
||||
void BeginRenderPass(RenderPassDescriptorBase* info);
|
||||
void CopyBufferToBuffer(BufferBase* source,
|
||||
uint32_t sourceOffset,
|
||||
BufferBase* destination,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "backend/Forward.h"
|
||||
#include "backend/InputState.h"
|
||||
#include "backend/PipelineLayout.h"
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/RenderPipeline.h"
|
||||
#include "backend/Texture.h"
|
||||
#include "common/Assert.h"
|
||||
|
@ -166,7 +166,7 @@ namespace backend {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CommandBufferStateTracker::BeginRenderPass(RenderPassInfoBase* info) {
|
||||
bool CommandBufferStateTracker::BeginRenderPass(RenderPassDescriptorBase* info) {
|
||||
if (mAspects[VALIDATION_ASPECT_COMPUTE_PASS]) {
|
||||
mBuilder->HandleError("Cannot begin a render pass while a compute pass is active");
|
||||
return false;
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace backend {
|
|||
// State-modifying methods
|
||||
bool BeginComputePass();
|
||||
bool EndComputePass();
|
||||
bool BeginRenderPass(RenderPassInfoBase* info);
|
||||
bool BeginRenderPass(RenderPassDescriptorBase* info);
|
||||
bool EndRenderPass();
|
||||
bool SetComputePipeline(ComputePipelineBase* pipeline);
|
||||
bool SetRenderPipeline(RenderPipelineBase* pipeline);
|
||||
|
@ -106,7 +106,7 @@ namespace backend {
|
|||
std::map<BufferBase*, nxt::BufferUsageBit> mMostRecentBufferUsages;
|
||||
std::map<TextureBase*, nxt::TextureUsageBit> mMostRecentTextureUsages;
|
||||
|
||||
RenderPassInfoBase* mCurrentRenderPass = nullptr;
|
||||
RenderPassDescriptorBase* mCurrentRenderPass = nullptr;
|
||||
};
|
||||
} // namespace backend
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#ifndef BACKEND_COMMANDS_H_
|
||||
#define BACKEND_COMMANDS_H_
|
||||
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/Texture.h"
|
||||
|
||||
#include "nxt/nxtcpp.h"
|
||||
|
@ -53,7 +53,7 @@ namespace backend {
|
|||
struct BeginComputePassCmd {};
|
||||
|
||||
struct BeginRenderPassCmd {
|
||||
Ref<RenderPassInfoBase> info;
|
||||
Ref<RenderPassDescriptorBase> info;
|
||||
};
|
||||
|
||||
struct BufferCopyLocation {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "backend/InputState.h"
|
||||
#include "backend/PipelineLayout.h"
|
||||
#include "backend/Queue.h"
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/RenderPipeline.h"
|
||||
#include "backend/Sampler.h"
|
||||
#include "backend/ShaderModule.h"
|
||||
|
@ -124,8 +124,8 @@ namespace backend {
|
|||
QueueBuilder* DeviceBase::CreateQueueBuilder() {
|
||||
return new QueueBuilder(this);
|
||||
}
|
||||
RenderPassInfoBuilder* DeviceBase::CreateRenderPassInfoBuilder() {
|
||||
return new RenderPassInfoBuilder(this);
|
||||
RenderPassDescriptorBuilder* DeviceBase::CreateRenderPassDescriptorBuilder() {
|
||||
return new RenderPassDescriptorBuilder(this);
|
||||
}
|
||||
RenderPipelineBuilder* DeviceBase::CreateRenderPipelineBuilder() {
|
||||
return new RenderPipelineBuilder(this);
|
||||
|
|
|
@ -46,7 +46,8 @@ namespace backend {
|
|||
virtual InputStateBase* CreateInputState(InputStateBuilder* builder) = 0;
|
||||
virtual PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) = 0;
|
||||
virtual QueueBase* CreateQueue(QueueBuilder* builder) = 0;
|
||||
virtual RenderPassInfoBase* CreateRenderPassInfo(RenderPassInfoBuilder* builder) = 0;
|
||||
virtual RenderPassDescriptorBase* CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) = 0;
|
||||
virtual RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) = 0;
|
||||
virtual SamplerBase* CreateSampler(SamplerBuilder* builder) = 0;
|
||||
virtual ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) = 0;
|
||||
|
@ -85,7 +86,7 @@ namespace backend {
|
|||
InputStateBuilder* CreateInputStateBuilder();
|
||||
PipelineLayoutBuilder* CreatePipelineLayoutBuilder();
|
||||
QueueBuilder* CreateQueueBuilder();
|
||||
RenderPassInfoBuilder* CreateRenderPassInfoBuilder();
|
||||
RenderPassDescriptorBuilder* CreateRenderPassDescriptorBuilder();
|
||||
RenderPipelineBuilder* CreateRenderPipelineBuilder();
|
||||
SamplerBuilder* CreateSamplerBuilder();
|
||||
ShaderModuleBuilder* CreateShaderModuleBuilder();
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace backend {
|
|||
class PipelineLayoutBuilder;
|
||||
class QueueBase;
|
||||
class QueueBuilder;
|
||||
class RenderPassInfoBase;
|
||||
class RenderPassInfoBuilder;
|
||||
class RenderPassDescriptorBase;
|
||||
class RenderPassDescriptorBuilder;
|
||||
class RenderPipelineBase;
|
||||
class RenderPipelineBuilder;
|
||||
class SamplerBase;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
|
||||
#include "backend/Device.h"
|
||||
#include "backend/Texture.h"
|
||||
|
@ -21,9 +21,9 @@
|
|||
|
||||
namespace backend {
|
||||
|
||||
// RenderPassInfo
|
||||
// RenderPassDescriptor
|
||||
|
||||
RenderPassInfoBase::RenderPassInfoBase(RenderPassInfoBuilder* builder)
|
||||
RenderPassDescriptorBase::RenderPassDescriptorBase(RenderPassDescriptorBuilder* builder)
|
||||
: mColorAttachmentsSet(builder->mColorAttachmentsSet),
|
||||
mColorAttachments(builder->mColorAttachments),
|
||||
mDepthStencilAttachmentSet(builder->mDepthStencilAttachmentSet),
|
||||
|
@ -32,15 +32,15 @@ namespace backend {
|
|||
mHeight(builder->mHeight) {
|
||||
}
|
||||
|
||||
std::bitset<kMaxColorAttachments> RenderPassInfoBase::GetColorAttachmentMask() const {
|
||||
std::bitset<kMaxColorAttachments> RenderPassDescriptorBase::GetColorAttachmentMask() const {
|
||||
return mColorAttachmentsSet;
|
||||
}
|
||||
|
||||
bool RenderPassInfoBase::HasDepthStencilAttachment() const {
|
||||
bool RenderPassDescriptorBase::HasDepthStencilAttachment() const {
|
||||
return mDepthStencilAttachmentSet;
|
||||
}
|
||||
|
||||
const RenderPassColorAttachmentInfo& RenderPassInfoBase::GetColorAttachment(
|
||||
const RenderPassColorAttachmentInfo& RenderPassDescriptorBase::GetColorAttachment(
|
||||
uint32_t attachment) const {
|
||||
ASSERT(attachment < kMaxColorAttachments);
|
||||
ASSERT(mColorAttachmentsSet[attachment]);
|
||||
|
@ -48,40 +48,41 @@ namespace backend {
|
|||
return mColorAttachments[attachment];
|
||||
}
|
||||
|
||||
RenderPassColorAttachmentInfo& RenderPassInfoBase::GetColorAttachment(uint32_t attachment) {
|
||||
RenderPassColorAttachmentInfo& RenderPassDescriptorBase::GetColorAttachment(
|
||||
uint32_t attachment) {
|
||||
ASSERT(attachment < kMaxColorAttachments);
|
||||
ASSERT(mColorAttachmentsSet[attachment]);
|
||||
|
||||
return mColorAttachments[attachment];
|
||||
}
|
||||
|
||||
const RenderPassDepthStencilAttachmentInfo& RenderPassInfoBase::GetDepthStencilAttachment()
|
||||
const {
|
||||
const RenderPassDepthStencilAttachmentInfo&
|
||||
RenderPassDescriptorBase::GetDepthStencilAttachment() const {
|
||||
ASSERT(mDepthStencilAttachmentSet);
|
||||
|
||||
return mDepthStencilAttachment;
|
||||
}
|
||||
|
||||
RenderPassDepthStencilAttachmentInfo& RenderPassInfoBase::GetDepthStencilAttachment() {
|
||||
RenderPassDepthStencilAttachmentInfo& RenderPassDescriptorBase::GetDepthStencilAttachment() {
|
||||
ASSERT(mDepthStencilAttachmentSet);
|
||||
|
||||
return mDepthStencilAttachment;
|
||||
}
|
||||
|
||||
uint32_t RenderPassInfoBase::GetWidth() const {
|
||||
uint32_t RenderPassDescriptorBase::GetWidth() const {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
uint32_t RenderPassInfoBase::GetHeight() const {
|
||||
uint32_t RenderPassDescriptorBase::GetHeight() const {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
// RenderPassInfoBuilder
|
||||
// RenderPassDescriptorBuilder
|
||||
|
||||
RenderPassInfoBuilder::RenderPassInfoBuilder(DeviceBase* device) : Builder(device) {
|
||||
RenderPassDescriptorBuilder::RenderPassDescriptorBuilder(DeviceBase* device) : Builder(device) {
|
||||
}
|
||||
|
||||
RenderPassInfoBase* RenderPassInfoBuilder::GetResultImpl() {
|
||||
RenderPassDescriptorBase* RenderPassDescriptorBuilder::GetResultImpl() {
|
||||
auto CheckOrSetSize = [this](const TextureViewBase* attachment) -> bool {
|
||||
if (this->mWidth == 0) {
|
||||
ASSERT(this->mHeight == 0);
|
||||
|
@ -120,12 +121,12 @@ namespace backend {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return mDevice->CreateRenderPassInfo(this);
|
||||
return mDevice->CreateRenderPassDescriptor(this);
|
||||
}
|
||||
|
||||
void RenderPassInfoBuilder::SetColorAttachment(uint32_t attachment,
|
||||
TextureViewBase* textureView,
|
||||
nxt::LoadOp loadOp) {
|
||||
void RenderPassDescriptorBuilder::SetColorAttachment(uint32_t attachment,
|
||||
TextureViewBase* textureView,
|
||||
nxt::LoadOp loadOp) {
|
||||
if (attachment >= kMaxColorAttachments) {
|
||||
HandleError("Setting color attachment out of bounds");
|
||||
return;
|
||||
|
@ -141,11 +142,11 @@ namespace backend {
|
|||
mColorAttachments[attachment].view = textureView;
|
||||
}
|
||||
|
||||
void RenderPassInfoBuilder::SetColorAttachmentClearColor(uint32_t attachment,
|
||||
float clearR,
|
||||
float clearG,
|
||||
float clearB,
|
||||
float clearA) {
|
||||
void RenderPassDescriptorBuilder::SetColorAttachmentClearColor(uint32_t attachment,
|
||||
float clearR,
|
||||
float clearG,
|
||||
float clearB,
|
||||
float clearA) {
|
||||
if (attachment >= kMaxColorAttachments) {
|
||||
HandleError("Setting color attachment out of bounds");
|
||||
return;
|
||||
|
@ -157,9 +158,9 @@ namespace backend {
|
|||
mColorAttachments[attachment].clearColor[3] = clearA;
|
||||
}
|
||||
|
||||
void RenderPassInfoBuilder::SetDepthStencilAttachment(TextureViewBase* textureView,
|
||||
nxt::LoadOp depthLoadOp,
|
||||
nxt::LoadOp stencilLoadOp) {
|
||||
void RenderPassDescriptorBuilder::SetDepthStencilAttachment(TextureViewBase* textureView,
|
||||
nxt::LoadOp depthLoadOp,
|
||||
nxt::LoadOp stencilLoadOp) {
|
||||
if (!TextureFormatHasDepthOrStencil(textureView->GetTexture()->GetFormat())) {
|
||||
HandleError("Using color texture as depth stencil attachment");
|
||||
return;
|
||||
|
@ -171,8 +172,8 @@ namespace backend {
|
|||
mDepthStencilAttachment.view = textureView;
|
||||
}
|
||||
|
||||
void RenderPassInfoBuilder::SetDepthStencilAttachmentClearValue(float clearDepth,
|
||||
uint32_t clearStencil) {
|
||||
void RenderPassDescriptorBuilder::SetDepthStencilAttachmentClearValue(float clearDepth,
|
||||
uint32_t clearStencil) {
|
||||
mDepthStencilAttachment.clearDepth = clearDepth;
|
||||
mDepthStencilAttachment.clearStencil = clearStencil;
|
||||
}
|
|
@ -12,8 +12,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef BACKEND_RENDERPASSINFO_H_
|
||||
#define BACKEND_RENDERPASSINFO_H_
|
||||
#ifndef BACKEND_RENDERPASSDESCRIPTOR_H_
|
||||
#define BACKEND_RENDERPASSDESCRIPTOR_H_
|
||||
|
||||
#include "backend/Builder.h"
|
||||
#include "backend/Forward.h"
|
||||
|
@ -42,12 +42,12 @@ namespace backend {
|
|||
Ref<TextureViewBase> view;
|
||||
};
|
||||
|
||||
// RenderPassInfo contains the list of attachments for a renderpass along with data such as the
|
||||
// load operation and the clear values for the attachments.
|
||||
// RenderPassDescriptor contains the list of attachments for a renderpass along with data such
|
||||
// as the load operation and the clear values for the attachments.
|
||||
|
||||
class RenderPassInfoBase : public RefCounted {
|
||||
class RenderPassDescriptorBase : public RefCounted {
|
||||
public:
|
||||
RenderPassInfoBase(RenderPassInfoBuilder* builder);
|
||||
RenderPassDescriptorBase(RenderPassDescriptorBuilder* builder);
|
||||
|
||||
std::bitset<kMaxColorAttachments> GetColorAttachmentMask() const;
|
||||
bool HasDepthStencilAttachment() const;
|
||||
|
@ -72,12 +72,12 @@ namespace backend {
|
|||
uint32_t mHeight;
|
||||
};
|
||||
|
||||
class RenderPassInfoBuilder : public Builder<RenderPassInfoBase> {
|
||||
class RenderPassDescriptorBuilder : public Builder<RenderPassDescriptorBase> {
|
||||
public:
|
||||
RenderPassInfoBuilder(DeviceBase* device);
|
||||
RenderPassDescriptorBuilder(DeviceBase* device);
|
||||
|
||||
// NXT API
|
||||
RenderPassInfoBase* GetResultImpl() override;
|
||||
RenderPassDescriptorBase* GetResultImpl() override;
|
||||
void SetColorAttachment(uint32_t attachment,
|
||||
TextureViewBase* textureView,
|
||||
nxt::LoadOp loadOp);
|
||||
|
@ -92,7 +92,7 @@ namespace backend {
|
|||
void SetDepthStencilAttachmentClearValue(float clearDepth, uint32_t clearStencil);
|
||||
|
||||
private:
|
||||
friend class RenderPassInfoBase;
|
||||
friend class RenderPassDescriptorBase;
|
||||
|
||||
std::bitset<kMaxColorAttachments> mColorAttachmentsSet;
|
||||
std::array<RenderPassColorAttachmentInfo, kMaxColorAttachments> mColorAttachments;
|
|
@ -18,7 +18,7 @@
|
|||
#include "backend/DepthStencilState.h"
|
||||
#include "backend/Device.h"
|
||||
#include "backend/InputState.h"
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/Texture.h"
|
||||
#include "common/BitSetIterator.h"
|
||||
|
||||
|
@ -102,7 +102,7 @@ namespace backend {
|
|||
return mDepthStencilFormat;
|
||||
}
|
||||
|
||||
bool RenderPipelineBase::IsCompatibleWith(const RenderPassInfoBase* renderPass) const {
|
||||
bool RenderPipelineBase::IsCompatibleWith(const RenderPassDescriptorBase* renderPass) const {
|
||||
// TODO(cwallez@chromium.org): This is called on every SetPipeline command. Optimize it for
|
||||
// example by caching some "attachment compatibility" object that would make the
|
||||
// compatibility check a single pointer comparison.
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace backend {
|
|||
|
||||
// A pipeline can be used in a render pass if its attachment info matches the actual
|
||||
// attachments in the render pass. This returns whether it is the case.
|
||||
bool IsCompatibleWith(const RenderPassInfoBase* renderPass) const;
|
||||
bool IsCompatibleWith(const RenderPassDescriptorBase* renderPass) const;
|
||||
|
||||
private:
|
||||
Ref<DepthStencilStateBase> mDepthStencilState;
|
||||
|
|
|
@ -84,8 +84,8 @@ namespace backend {
|
|||
};
|
||||
|
||||
template <typename BackendTraits>
|
||||
struct ToBackendTraits<RenderPassInfoBase, BackendTraits> {
|
||||
using BackendType = typename BackendTraits::RenderPassInfoType;
|
||||
struct ToBackendTraits<RenderPassDescriptorBase, BackendTraits> {
|
||||
using BackendType = typename BackendTraits::RenderPassDescriptorType;
|
||||
};
|
||||
|
||||
template <typename BackendTraits>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "backend/d3d12/DescriptorHeapAllocator.h"
|
||||
#include "backend/d3d12/InputStateD3D12.h"
|
||||
#include "backend/d3d12/PipelineLayoutD3D12.h"
|
||||
#include "backend/d3d12/RenderPassInfoD3D12.h"
|
||||
#include "backend/d3d12/RenderPassDescriptorD3D12.h"
|
||||
#include "backend/d3d12/RenderPipelineD3D12.h"
|
||||
#include "backend/d3d12/ResourceAllocator.h"
|
||||
#include "backend/d3d12/SamplerD3D12.h"
|
||||
|
@ -265,9 +265,9 @@ namespace backend { namespace d3d12 {
|
|||
case Command::BeginRenderPass: {
|
||||
BeginRenderPassCmd* beginRenderPassCmd =
|
||||
mCommands.NextCommand<BeginRenderPassCmd>();
|
||||
RenderPassInfo* info = ToBackend(beginRenderPassCmd->info.Get());
|
||||
RenderPassDescriptor* info = ToBackend(beginRenderPassCmd->info.Get());
|
||||
|
||||
RenderPassInfo::OMSetRenderTargetArgs args =
|
||||
RenderPassDescriptor::OMSetRenderTargetArgs args =
|
||||
info->GetSubpassOMSetRenderTargetArgs();
|
||||
if (args.dsv.ptr) {
|
||||
commandList->OMSetRenderTargets(args.numRTVs, args.RTVs.data(), FALSE,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "backend/d3d12/NativeSwapChainImplD3D12.h"
|
||||
#include "backend/d3d12/PipelineLayoutD3D12.h"
|
||||
#include "backend/d3d12/QueueD3D12.h"
|
||||
#include "backend/d3d12/RenderPassInfoD3D12.h"
|
||||
#include "backend/d3d12/RenderPassDescriptorD3D12.h"
|
||||
#include "backend/d3d12/RenderPipelineD3D12.h"
|
||||
#include "backend/d3d12/ResourceAllocator.h"
|
||||
#include "backend/d3d12/ResourceUploader.h"
|
||||
|
@ -291,8 +291,9 @@ namespace backend { namespace d3d12 {
|
|||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(this, builder);
|
||||
}
|
||||
RenderPassInfoBase* Device::CreateRenderPassInfo(RenderPassInfoBuilder* builder) {
|
||||
return new RenderPassInfo(this, builder);
|
||||
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) {
|
||||
return new RenderPassDescriptor(this, builder);
|
||||
}
|
||||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace backend { namespace d3d12 {
|
|||
class InputState;
|
||||
class PipelineLayout;
|
||||
class Queue;
|
||||
class RenderPassInfo;
|
||||
class RenderPassDescriptor;
|
||||
class RenderPipeline;
|
||||
class Sampler;
|
||||
class ShaderModule;
|
||||
|
@ -64,7 +64,7 @@ namespace backend { namespace d3d12 {
|
|||
using InputStateType = InputState;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassInfoType = RenderPassInfo;
|
||||
using RenderPassDescriptorType = RenderPassDescriptor;
|
||||
using RenderPipelineType = RenderPipeline;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
|
@ -97,7 +97,8 @@ namespace backend { namespace d3d12 {
|
|||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassInfoBase* CreateRenderPassInfo(RenderPassInfoBuilder* builder) override;
|
||||
RenderPassDescriptorBase* CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) override;
|
||||
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "backend/d3d12/InputStateD3D12.h"
|
||||
#include "backend/d3d12/PipelineLayoutD3D12.h"
|
||||
#include "backend/d3d12/QueueD3D12.h"
|
||||
#include "backend/d3d12/RenderPassInfoD3D12.h"
|
||||
#include "backend/d3d12/RenderPassDescriptorD3D12.h"
|
||||
#include "backend/d3d12/RenderPipelineD3D12.h"
|
||||
#include "backend/d3d12/SamplerD3D12.h"
|
||||
#include "backend/d3d12/ShaderModuleD3D12.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "backend/d3d12/RenderPassInfoD3D12.h"
|
||||
#include "backend/d3d12/RenderPassDescriptorD3D12.h"
|
||||
|
||||
#include "backend/d3d12/D3D12Backend.h"
|
||||
#include "backend/d3d12/TextureD3D12.h"
|
||||
|
@ -20,8 +20,8 @@
|
|||
|
||||
namespace backend { namespace d3d12 {
|
||||
|
||||
RenderPassInfo::RenderPassInfo(Device* device, RenderPassInfoBuilder* builder)
|
||||
: RenderPassInfoBase(builder), mDevice(device) {
|
||||
RenderPassDescriptor::RenderPassDescriptor(Device* device, RenderPassDescriptorBuilder* builder)
|
||||
: RenderPassDescriptorBase(builder), mDevice(device) {
|
||||
// Get and fill an RTV heap with the color attachments
|
||||
uint32_t colorAttachmentCount = static_cast<uint32_t>(GetColorAttachmentMask().count());
|
||||
if (colorAttachmentCount != 0) {
|
||||
|
@ -53,7 +53,8 @@ namespace backend { namespace d3d12 {
|
|||
}
|
||||
}
|
||||
|
||||
RenderPassInfo::OMSetRenderTargetArgs RenderPassInfo::GetSubpassOMSetRenderTargetArgs() {
|
||||
RenderPassDescriptor::OMSetRenderTargetArgs
|
||||
RenderPassDescriptor::GetSubpassOMSetRenderTargetArgs() {
|
||||
OMSetRenderTargetArgs args = {};
|
||||
|
||||
size_t rtvIndex = 0;
|
||||
|
@ -70,11 +71,11 @@ namespace backend { namespace d3d12 {
|
|||
return args;
|
||||
}
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE RenderPassInfo::GetRTVDescriptor(uint32_t attachmentSlot) {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE RenderPassDescriptor::GetRTVDescriptor(uint32_t attachmentSlot) {
|
||||
return mRtvHeap.GetCPUHandle(attachmentSlot);
|
||||
}
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE RenderPassInfo::GetDSVDescriptor() {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE RenderPassDescriptor::GetDSVDescriptor() {
|
||||
return mDsvHeap.GetCPUHandle(0);
|
||||
}
|
||||
|
|
@ -12,10 +12,10 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef BACKEND_D3D12_RENDERPASSINFOD3D12_H_
|
||||
#define BACKEND_D3D12_RENDERPASSINFOD3D12_H_
|
||||
#ifndef BACKEND_D3D12_RENDERPASSDESCRIPTORD3D12_H_
|
||||
#define BACKEND_D3D12_RENDERPASSDESCRIPTORD3D12_H_
|
||||
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
|
||||
#include "backend/d3d12/DescriptorHeapAllocator.h"
|
||||
#include "backend/d3d12/d3d12_platform.h"
|
||||
|
@ -28,7 +28,7 @@ namespace backend { namespace d3d12 {
|
|||
|
||||
class Device;
|
||||
|
||||
class RenderPassInfo : public RenderPassInfoBase {
|
||||
class RenderPassDescriptor : public RenderPassDescriptorBase {
|
||||
public:
|
||||
struct OMSetRenderTargetArgs {
|
||||
unsigned int numRTVs = 0;
|
||||
|
@ -36,7 +36,7 @@ namespace backend { namespace d3d12 {
|
|||
D3D12_CPU_DESCRIPTOR_HANDLE dsv = {};
|
||||
};
|
||||
|
||||
RenderPassInfo(Device* device, RenderPassInfoBuilder* builder);
|
||||
RenderPassDescriptor(Device* device, RenderPassDescriptorBuilder* builder);
|
||||
OMSetRenderTargetArgs GetSubpassOMSetRenderTargetArgs();
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE GetRTVDescriptor(uint32_t attachmentSlot);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE GetDSVDescriptor();
|
||||
|
@ -49,4 +49,4 @@ namespace backend { namespace d3d12 {
|
|||
|
||||
}} // namespace backend::d3d12
|
||||
|
||||
#endif // BACKEND_D3D12_RENDERPASSINFOD3D12_H_
|
||||
#endif // BACKEND_D3D12_RENDERPASSDESCRIPTORD3D12_H_
|
|
@ -64,7 +64,7 @@ namespace backend { namespace metal {
|
|||
compute = nil; // This will be autoreleased.
|
||||
}
|
||||
|
||||
void BeginRenderPass(id<MTLCommandBuffer> commandBuffer, RenderPassInfo* info) {
|
||||
void BeginRenderPass(id<MTLCommandBuffer> commandBuffer, RenderPassDescriptor* info) {
|
||||
if (render != nil) {
|
||||
[render endEncoding];
|
||||
render = nil; // This will be autoreleased.
|
||||
|
@ -172,7 +172,7 @@ namespace backend { namespace metal {
|
|||
BeginRenderPassCmd* beginRenderPassCmd =
|
||||
mCommands.NextCommand<BeginRenderPassCmd>();
|
||||
|
||||
RenderPassInfo* info = ToBackend(beginRenderPassCmd->info.Get());
|
||||
RenderPassDescriptor* info = ToBackend(beginRenderPassCmd->info.Get());
|
||||
|
||||
encoders.EnsureNoBlitEncoder();
|
||||
encoders.BeginRenderPass(commandBuffer, info);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "backend/BindGroupLayout.h"
|
||||
#include "backend/Device.h"
|
||||
#include "backend/Queue.h"
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/ToBackend.h"
|
||||
#include "common/Serial.h"
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace backend { namespace metal {
|
|||
class InputState;
|
||||
class PipelineLayout;
|
||||
class Queue;
|
||||
class RenderPassInfo;
|
||||
class RenderPassDescriptor;
|
||||
class RenderPipeline;
|
||||
class Sampler;
|
||||
class ShaderModule;
|
||||
|
@ -65,7 +65,7 @@ namespace backend { namespace metal {
|
|||
using InputStateType = InputState;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassInfoType = RenderPassInfo;
|
||||
using RenderPassDescriptorType = RenderPassDescriptor;
|
||||
using RenderPipelineType = RenderPipeline;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
|
@ -98,7 +98,8 @@ namespace backend { namespace metal {
|
|||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassInfoBase* CreateRenderPassInfo(RenderPassInfoBuilder* builder) override;
|
||||
RenderPassDescriptorBase* CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) override;
|
||||
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
|
@ -154,10 +155,10 @@ namespace backend { namespace metal {
|
|||
id<MTLCommandQueue> mCommandQueue = nil;
|
||||
};
|
||||
|
||||
class RenderPassInfo : public RenderPassInfoBase {
|
||||
class RenderPassDescriptor : public RenderPassDescriptorBase {
|
||||
public:
|
||||
RenderPassInfo(RenderPassInfoBuilder* builder);
|
||||
~RenderPassInfo();
|
||||
RenderPassDescriptor(RenderPassDescriptorBuilder* builder);
|
||||
~RenderPassDescriptor();
|
||||
};
|
||||
|
||||
}} // namespace backend::metal
|
||||
|
|
|
@ -110,8 +110,9 @@ namespace backend { namespace metal {
|
|||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(builder);
|
||||
}
|
||||
RenderPassInfoBase* Device::CreateRenderPassInfo(RenderPassInfoBuilder* builder) {
|
||||
return new RenderPassInfo(builder);
|
||||
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) {
|
||||
return new RenderPassDescriptor(builder);
|
||||
}
|
||||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
|
@ -229,10 +230,11 @@ namespace backend { namespace metal {
|
|||
|
||||
// RenderPass
|
||||
|
||||
RenderPassInfo::RenderPassInfo(RenderPassInfoBuilder* builder) : RenderPassInfoBase(builder) {
|
||||
RenderPassDescriptor::RenderPassDescriptor(RenderPassDescriptorBuilder* builder)
|
||||
: RenderPassDescriptorBase(builder) {
|
||||
}
|
||||
|
||||
RenderPassInfo::~RenderPassInfo() {
|
||||
RenderPassDescriptor::~RenderPassDescriptor() {
|
||||
}
|
||||
|
||||
}} // namespace backend::metal
|
||||
|
|
|
@ -69,8 +69,9 @@ namespace backend { namespace null {
|
|||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(builder);
|
||||
}
|
||||
RenderPassInfoBase* Device::CreateRenderPassInfo(RenderPassInfoBuilder* builder) {
|
||||
return new RenderPassInfo(builder);
|
||||
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) {
|
||||
return new RenderPassDescriptor(builder);
|
||||
}
|
||||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "backend/InputState.h"
|
||||
#include "backend/PipelineLayout.h"
|
||||
#include "backend/Queue.h"
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/RenderPipeline.h"
|
||||
#include "backend/Sampler.h"
|
||||
#include "backend/ShaderModule.h"
|
||||
|
@ -50,7 +50,7 @@ namespace backend { namespace null {
|
|||
using InputState = InputStateBase;
|
||||
using PipelineLayout = PipelineLayoutBase;
|
||||
class Queue;
|
||||
using RenderPassInfo = RenderPassInfoBase;
|
||||
using RenderPassDescriptor = RenderPassDescriptorBase;
|
||||
using RenderPipeline = RenderPipelineBase;
|
||||
using Sampler = SamplerBase;
|
||||
using ShaderModule = ShaderModuleBase;
|
||||
|
@ -71,7 +71,7 @@ namespace backend { namespace null {
|
|||
using InputStateType = InputState;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassInfoType = RenderPassInfo;
|
||||
using RenderPassDescriptorType = RenderPassDescriptor;
|
||||
using RenderPipelineType = RenderPipeline;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
|
@ -106,7 +106,8 @@ namespace backend { namespace null {
|
|||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassInfoBase* CreateRenderPassInfo(RenderPassInfoBuilder* builder) override;
|
||||
RenderPassDescriptorBase* CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) override;
|
||||
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
|
|
|
@ -265,7 +265,7 @@ namespace backend { namespace opengl {
|
|||
|
||||
case Command::BeginRenderPass: {
|
||||
auto* cmd = mCommands.NextCommand<BeginRenderPassCmd>();
|
||||
RenderPassInfo* info = ToBackend(cmd->info.Get());
|
||||
RenderPassDescriptor* info = ToBackend(cmd->info.Get());
|
||||
|
||||
pushConstants.OnBeginPass();
|
||||
inputBuffers.OnBeginPass();
|
||||
|
|
|
@ -79,8 +79,9 @@ namespace backend { namespace opengl {
|
|||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(builder);
|
||||
}
|
||||
RenderPassInfoBase* Device::CreateRenderPassInfo(RenderPassInfoBuilder* builder) {
|
||||
return new RenderPassInfo(builder);
|
||||
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) {
|
||||
return new RenderPassDescriptor(builder);
|
||||
}
|
||||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
|
@ -126,9 +127,10 @@ namespace backend { namespace opengl {
|
|||
}
|
||||
}
|
||||
|
||||
// RenderPassInfo
|
||||
// RenderPassDescriptor
|
||||
|
||||
RenderPassInfo::RenderPassInfo(RenderPassInfoBuilder* builder) : RenderPassInfoBase(builder) {
|
||||
RenderPassDescriptor::RenderPassDescriptor(RenderPassDescriptorBuilder* builder)
|
||||
: RenderPassDescriptorBase(builder) {
|
||||
}
|
||||
|
||||
}} // namespace backend::opengl
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "backend/Device.h"
|
||||
#include "backend/InputState.h"
|
||||
#include "backend/Queue.h"
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
#include "backend/ToBackend.h"
|
||||
|
||||
#include "glad/glad.h"
|
||||
|
@ -45,7 +45,7 @@ namespace backend { namespace opengl {
|
|||
class PersistentPipelineState;
|
||||
class PipelineLayout;
|
||||
class Queue;
|
||||
class RenderPassInfo;
|
||||
class RenderPassDescriptor;
|
||||
class RenderPipeline;
|
||||
class Sampler;
|
||||
class ShaderModule;
|
||||
|
@ -66,7 +66,7 @@ namespace backend { namespace opengl {
|
|||
using InputStateType = InputState;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassInfoType = RenderPassInfo;
|
||||
using RenderPassDescriptorType = RenderPassDescriptor;
|
||||
using RenderPipelineType = RenderPipeline;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
|
@ -94,7 +94,8 @@ namespace backend { namespace opengl {
|
|||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassInfoBase* CreateRenderPassInfo(RenderPassInfoBuilder* builder) override;
|
||||
RenderPassDescriptorBase* CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) override;
|
||||
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
|
@ -123,9 +124,9 @@ namespace backend { namespace opengl {
|
|||
void Submit(uint32_t numCommands, CommandBuffer* const* commands);
|
||||
};
|
||||
|
||||
class RenderPassInfo : public RenderPassInfoBase {
|
||||
class RenderPassDescriptor : public RenderPassDescriptorBase {
|
||||
public:
|
||||
RenderPassInfo(RenderPassInfoBuilder* builder);
|
||||
RenderPassDescriptor(RenderPassDescriptorBuilder* builder);
|
||||
};
|
||||
|
||||
}} // namespace backend::opengl
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "backend/vulkan/BufferVk.h"
|
||||
#include "backend/vulkan/ComputePipelineVk.h"
|
||||
#include "backend/vulkan/PipelineLayoutVk.h"
|
||||
#include "backend/vulkan/RenderPassInfoVk.h"
|
||||
#include "backend/vulkan/RenderPassDescriptorVk.h"
|
||||
#include "backend/vulkan/RenderPipelineVk.h"
|
||||
#include "backend/vulkan/TextureVk.h"
|
||||
#include "backend/vulkan/VulkanBackend.h"
|
||||
|
@ -183,7 +183,7 @@ namespace backend { namespace vulkan {
|
|||
|
||||
case Command::BeginRenderPass: {
|
||||
BeginRenderPassCmd* cmd = mCommands.NextCommand<BeginRenderPassCmd>();
|
||||
RenderPassInfo* info = ToBackend(cmd->info.Get());
|
||||
RenderPassDescriptor* info = ToBackend(cmd->info.Get());
|
||||
|
||||
// NXT has an implicit transition to color attachment on render passes.
|
||||
// Transition the attachments now before we start the render pass.
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "backend/vulkan/DepthStencilStateVk.h"
|
||||
#include "backend/vulkan/InputStateVk.h"
|
||||
#include "backend/vulkan/PipelineLayoutVk.h"
|
||||
#include "backend/vulkan/RenderPassInfoVk.h"
|
||||
#include "backend/vulkan/RenderPassDescriptorVk.h"
|
||||
#include "backend/vulkan/RenderPipelineVk.h"
|
||||
#include "backend/vulkan/SamplerVk.h"
|
||||
#include "backend/vulkan/ShaderModuleVk.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "backend/vulkan/RenderPassInfoVk.h"
|
||||
#include "backend/vulkan/RenderPassDescriptorVk.h"
|
||||
|
||||
#include "backend/vulkan/FencedDeleter.h"
|
||||
#include "backend/vulkan/RenderPassCache.h"
|
||||
|
@ -22,11 +22,11 @@
|
|||
|
||||
namespace backend { namespace vulkan {
|
||||
|
||||
RenderPassInfo::RenderPassInfo(RenderPassInfoBuilder* builder)
|
||||
: RenderPassInfoBase(builder), mDevice(ToBackend(builder->GetDevice())) {
|
||||
RenderPassDescriptor::RenderPassDescriptor(RenderPassDescriptorBuilder* builder)
|
||||
: RenderPassDescriptorBase(builder), mDevice(ToBackend(builder->GetDevice())) {
|
||||
}
|
||||
|
||||
void RenderPassInfo::RecordBeginRenderPass(VkCommandBuffer commands) {
|
||||
void RenderPassDescriptor::RecordBeginRenderPass(VkCommandBuffer commands) {
|
||||
// Query a VkRenderPass from the cache
|
||||
VkRenderPass renderPass = VK_NULL_HANDLE;
|
||||
{
|
|
@ -12,10 +12,10 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef BACKEND_VULKAN_RENDERPASSINFOVK_H_
|
||||
#define BACKEND_VULKAN_RENDERPASSINFOVK_H_
|
||||
#ifndef BACKEND_VULKAN_RENDERPASSDESCRIPTORVK_H_
|
||||
#define BACKEND_VULKAN_RENDERPASSDESCRIPTORVK_H_
|
||||
|
||||
#include "backend/RenderPassInfo.h"
|
||||
#include "backend/RenderPassDescriptor.h"
|
||||
|
||||
#include "common/vulkan_platform.h"
|
||||
|
||||
|
@ -23,9 +23,9 @@ namespace backend { namespace vulkan {
|
|||
|
||||
class Device;
|
||||
|
||||
class RenderPassInfo : public RenderPassInfoBase {
|
||||
class RenderPassDescriptor : public RenderPassDescriptorBase {
|
||||
public:
|
||||
RenderPassInfo(RenderPassInfoBuilder* builder);
|
||||
RenderPassDescriptor(RenderPassDescriptorBuilder* builder);
|
||||
|
||||
// Compute all the arguments for, and record the vkCmdBeginRenderPass command.
|
||||
void RecordBeginRenderPass(VkCommandBuffer commands);
|
||||
|
@ -36,4 +36,4 @@ namespace backend { namespace vulkan {
|
|||
|
||||
}} // namespace backend::vulkan
|
||||
|
||||
#endif // BACKEND_VULKAN_RENDERPASSINFOVK_H_
|
||||
#endif // BACKEND_VULKAN_RENDERPASSDESCRIPTORVK_H_
|
|
@ -20,7 +20,7 @@
|
|||
#include "backend/vulkan/InputStateVk.h"
|
||||
#include "backend/vulkan/PipelineLayoutVk.h"
|
||||
#include "backend/vulkan/RenderPassCache.h"
|
||||
#include "backend/vulkan/RenderPassInfoVk.h"
|
||||
#include "backend/vulkan/RenderPassDescriptorVk.h"
|
||||
#include "backend/vulkan/ShaderModuleVk.h"
|
||||
#include "backend/vulkan/VulkanBackend.h"
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "backend/vulkan/NativeSwapChainImplVk.h"
|
||||
#include "backend/vulkan/PipelineLayoutVk.h"
|
||||
#include "backend/vulkan/RenderPassCache.h"
|
||||
#include "backend/vulkan/RenderPassInfoVk.h"
|
||||
#include "backend/vulkan/RenderPassDescriptorVk.h"
|
||||
#include "backend/vulkan/RenderPipelineVk.h"
|
||||
#include "backend/vulkan/SamplerVk.h"
|
||||
#include "backend/vulkan/ShaderModuleVk.h"
|
||||
|
@ -246,8 +246,9 @@ namespace backend { namespace vulkan {
|
|||
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
|
||||
return new Queue(builder);
|
||||
}
|
||||
RenderPassInfoBase* Device::CreateRenderPassInfo(RenderPassInfoBuilder* builder) {
|
||||
return new RenderPassInfo(builder);
|
||||
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) {
|
||||
return new RenderPassDescriptor(builder);
|
||||
}
|
||||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace backend { namespace vulkan {
|
|||
class InputState;
|
||||
class PipelineLayout;
|
||||
class Queue;
|
||||
class RenderPassInfo;
|
||||
class RenderPassDescriptor;
|
||||
class RenderPipeline;
|
||||
class Sampler;
|
||||
class ShaderModule;
|
||||
|
@ -69,7 +69,7 @@ namespace backend { namespace vulkan {
|
|||
using InputStateType = InputState;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QueueType = Queue;
|
||||
using RenderPassInfoType = RenderPassInfo;
|
||||
using RenderPassDescriptorType = RenderPassDescriptor;
|
||||
using RenderPipelineType = RenderPipeline;
|
||||
using SamplerType = Sampler;
|
||||
using ShaderModuleType = ShaderModule;
|
||||
|
@ -122,7 +122,8 @@ namespace backend { namespace vulkan {
|
|||
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
|
||||
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
|
||||
QueueBase* CreateQueue(QueueBuilder* builder) override;
|
||||
RenderPassInfoBase* CreateRenderPassInfo(RenderPassInfoBuilder* builder) override;
|
||||
RenderPassDescriptorBase* CreateRenderPassDescriptor(
|
||||
RenderPassDescriptorBuilder* builder) override;
|
||||
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
|
||||
SamplerBase* CreateSampler(SamplerBuilder* builder) override;
|
||||
ShaderModuleBase* CreateShaderModule(ShaderModuleBuilder* builder) override;
|
||||
|
|
|
@ -50,7 +50,7 @@ list(APPEND UNITTEST_SOURCES
|
|||
${VALIDATION_TESTS_DIR}/DynamicStateCommandValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/InputStateValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/PushConstantsValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/RenderPassInfoValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/RenderPassDescriptorValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/RenderPipelineValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/UsageValidationTests.cpp
|
||||
${VALIDATION_TESTS_DIR}/VertexBufferValidationTests.cpp
|
||||
|
|
|
@ -707,7 +707,7 @@ TEST_P(BlendStateTest, IndependentBlendState) {
|
|||
renderTargetViews[i] = renderTargets[i].CreateTextureViewBuilder().GetResult();
|
||||
}
|
||||
|
||||
nxt::RenderPassInfo renderpass = device.CreateRenderPassInfoBuilder()
|
||||
nxt::RenderPassDescriptor renderpass = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, renderTargetViews[0], nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, renderTargetViews[1], nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(2, renderTargetViews[2], nxt::LoadOp::Clear)
|
||||
|
|
|
@ -46,7 +46,7 @@ class DepthStencilStateTest : public NXTTest {
|
|||
|
||||
depthTextureView = depthTexture.CreateTextureViewBuilder().GetResult();
|
||||
|
||||
renderpass = device.CreateRenderPassInfoBuilder()
|
||||
renderpass = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthTextureView, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
@ -247,7 +247,7 @@ class DepthStencilStateTest : public NXTTest {
|
|||
DoTest(testParams, expected, expected);
|
||||
}
|
||||
|
||||
nxt::RenderPassInfo renderpass;
|
||||
nxt::RenderPassDescriptor renderpass;
|
||||
nxt::Texture renderTarget;
|
||||
nxt::Texture depthTexture;
|
||||
nxt::TextureView renderTargetView;
|
||||
|
|
|
@ -111,7 +111,7 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) {
|
|||
|
||||
// Part 1: clear once, check to make sure it's cleared
|
||||
|
||||
auto renderPassClearZero = device.CreateRenderPassInfoBuilder()
|
||||
auto renderPassClearZero = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(0, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
|
@ -123,7 +123,7 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) {
|
|||
.EndRenderPass()
|
||||
.GetResult();
|
||||
|
||||
auto renderPassClearGreen = device.CreateRenderPassInfoBuilder()
|
||||
auto renderPassClearGreen = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(0, 0.0f, 1.0f, 0.0f, 1.0f)
|
||||
.GetResult();
|
||||
|
@ -143,7 +143,7 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) {
|
|||
|
||||
// Part 2: draw a blue quad into the right half of the render target, and check result
|
||||
|
||||
auto renderPassLoad = device.CreateRenderPassInfoBuilder()
|
||||
auto renderPassLoad = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, renderTargetView, nxt::LoadOp::Load)
|
||||
.GetResult();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
class RenderPassInfoValidationTest : public ValidationTest {
|
||||
class RenderPassDescriptorValidationTest : public ValidationTest {
|
||||
};
|
||||
|
||||
nxt::TextureView Create2DAttachment(nxt::Device& device, uint32_t width, uint32_t height, nxt::TextureFormat format) {
|
||||
|
@ -36,42 +36,42 @@ nxt::TextureView Create2DAttachment(nxt::Device& device, uint32_t width, uint32_
|
|||
}
|
||||
|
||||
// A render pass with no attachments isn't valid
|
||||
TEST_F(RenderPassInfoValidationTest, Empty) {
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
TEST_F(RenderPassDescriptorValidationTest, Empty) {
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// A render pass with only one color or one depth attachment is ok
|
||||
TEST_F(RenderPassInfoValidationTest, OneAttachment) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||
// One color attachment
|
||||
{
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
// One depth-stencil attachment
|
||||
{
|
||||
nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetDepthStencilAttachment(depthStencil, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
// Test OOB color attachment indices are handled
|
||||
TEST_F(RenderPassInfoValidationTest, ColorAttachmentOutOfBounds) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||
// For setting the color attachment, control case
|
||||
{
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(kMaxColorAttachments - 1, color, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
// For setting the color attachment, OOB
|
||||
{
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(kMaxColorAttachments, color, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
@ -79,14 +79,14 @@ TEST_F(RenderPassInfoValidationTest, ColorAttachmentOutOfBounds) {
|
|||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
// For setting the clear color, control case
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(kMaxColorAttachments - 1, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
}
|
||||
// For setting the clear color, OOB
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(kMaxColorAttachments, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
|
@ -94,12 +94,12 @@ TEST_F(RenderPassInfoValidationTest, ColorAttachmentOutOfBounds) {
|
|||
}
|
||||
|
||||
// Test setting a clear value without an attachment and vice-versa is ok.
|
||||
TEST_F(RenderPassInfoValidationTest, ClearAndAttachmentMismatchIsOk) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, ClearAndAttachmentMismatchIsOk) {
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
|
||||
// For cleared attachment 0 doesn't get a color, clear color for 1 is unused
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(1, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
|
@ -107,13 +107,13 @@ TEST_F(RenderPassInfoValidationTest, ClearAndAttachmentMismatchIsOk) {
|
|||
// Clear depth stencil doesn't get values
|
||||
{
|
||||
nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetDepthStencilAttachment(depthStencil, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
// Clear values for depth-stencil when it isn't used
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachmentClearValue(0.0f, 0)
|
||||
.GetResult();
|
||||
|
@ -121,7 +121,7 @@ TEST_F(RenderPassInfoValidationTest, ClearAndAttachmentMismatchIsOk) {
|
|||
}
|
||||
|
||||
// Attachments must have the same size
|
||||
TEST_F(RenderPassInfoValidationTest, SizeMustMatch) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
||||
nxt::TextureView color1x1A = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView color1x1B = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView color2x2 = Create2DAttachment(device, 2, 2, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
|
@ -130,7 +130,7 @@ TEST_F(RenderPassInfoValidationTest, SizeMustMatch) {
|
|||
|
||||
// Control case: all the same size (1x1)
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color1x1B, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil1x1, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
|
@ -139,7 +139,7 @@ TEST_F(RenderPassInfoValidationTest, SizeMustMatch) {
|
|||
|
||||
// One of the color attachments has a different size
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color2x2, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil1x1, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
|
@ -148,7 +148,7 @@ TEST_F(RenderPassInfoValidationTest, SizeMustMatch) {
|
|||
|
||||
// The depth stencil attachment has a different size
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color1x1B, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil2x2, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
|
@ -157,20 +157,20 @@ TEST_F(RenderPassInfoValidationTest, SizeMustMatch) {
|
|||
}
|
||||
|
||||
// Attachments formats must match whether they are used for color or depth-stencil
|
||||
TEST_F(RenderPassInfoValidationTest, FormatMismatch) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
|
||||
// Using depth-stencil for color
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, depthStencil, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// Using color for depth-stencil
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassInfoBuilder())
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetDepthStencilAttachment(color, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
|
@ -54,7 +54,7 @@ class RenderPipelineValidationTest : public ValidationTest {
|
|||
return builder;
|
||||
}
|
||||
|
||||
nxt::RenderPassInfo renderpass;
|
||||
nxt::RenderPassDescriptor renderpass;
|
||||
nxt::ShaderModule vsModule;
|
||||
nxt::ShaderModule fsModule;
|
||||
nxt::InputState inputState;
|
||||
|
|
|
@ -69,7 +69,7 @@ bool ValidationTest::EndExpectDeviceError() {
|
|||
return mError;
|
||||
}
|
||||
|
||||
nxt::RenderPassInfo ValidationTest::CreateSimpleRenderPass() {
|
||||
nxt::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() {
|
||||
auto colorBuffer = device.CreateTextureBuilder()
|
||||
.SetDimension(nxt::TextureDimension::e2D)
|
||||
.SetExtent(640, 480, 1)
|
||||
|
@ -81,7 +81,7 @@ nxt::RenderPassInfo ValidationTest::CreateSimpleRenderPass() {
|
|||
auto colorView = colorBuffer.CreateTextureViewBuilder()
|
||||
.GetResult();
|
||||
|
||||
return device.CreateRenderPassInfoBuilder()
|
||||
return device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, colorView, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ ValidationTest::DummyRenderPass ValidationTest::CreateDummyRenderPass() {
|
|||
|
||||
nxt::TextureView view = AssertWillBeSuccess(dummy.attachment.CreateTextureViewBuilder()).GetResult();
|
||||
|
||||
dummy.renderPass = AssertWillBeSuccess(device.CreateRenderPassInfoBuilder())
|
||||
dummy.renderPass = AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, view, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
||||
|
|
|
@ -48,12 +48,12 @@ class ValidationTest : public testing::Test {
|
|||
void StartExpectDeviceError();
|
||||
bool EndExpectDeviceError();
|
||||
|
||||
nxt::RenderPassInfo CreateSimpleRenderPass();
|
||||
nxt::RenderPassDescriptor CreateSimpleRenderPass();
|
||||
|
||||
// Helper functions to create objects to test validation.
|
||||
|
||||
struct DummyRenderPass {
|
||||
nxt::RenderPassInfo renderPass;
|
||||
nxt::RenderPassDescriptor renderPass;
|
||||
nxt::Texture attachment;
|
||||
nxt::TextureFormat attachmentFormat;
|
||||
uint32_t width;
|
||||
|
|
|
@ -86,7 +86,7 @@ class VertexBufferValidationTest : public ValidationTest {
|
|||
.GetResult();
|
||||
}
|
||||
|
||||
nxt::RenderPassInfo renderpass;
|
||||
nxt::RenderPassDescriptor renderpass;
|
||||
nxt::ShaderModule fsModule;
|
||||
};
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace utils {
|
|||
.GetResult();
|
||||
|
||||
nxt::TextureView colorView = result.color.CreateTextureViewBuilder().GetResult();
|
||||
result.renderPassInfo = device.CreateRenderPassInfoBuilder()
|
||||
result.renderPassInfo = device.CreateRenderPassDescriptorBuilder()
|
||||
.SetColorAttachment(0, colorView, nxt::LoadOp::Clear)
|
||||
.GetResult();
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace utils {
|
|||
uint32_t height;
|
||||
nxt::Texture color;
|
||||
nxt::TextureFormat colorFormat;
|
||||
nxt::RenderPassInfo renderPassInfo;
|
||||
nxt::RenderPassDescriptor renderPassInfo;
|
||||
};
|
||||
BasicRenderPass CreateBasicRenderPass(const nxt::Device& device,
|
||||
uint32_t width,
|
||||
|
|
Loading…
Reference in New Issue