Remove RenderPassDescriptor from BeginRenderPassCmd

This patch removes RenderPassDescriptor from BeginRenderPassCmd so that
all the backends can get the data of render pass from the non-pointer
field of BeginRenderPassCmd instead. In this patch, RenderPassDescriptor
has been removed from all Dawn backends other than the virtual function
DeviceBase::CreateRenderPassDescriptor().

This patch is one of the preparations on completely removing
RenderPassDescriptorBuilder from Dawn.

BUG=dawn:6

Change-Id: I3a78f0b2d5318c2bf85858d6fbe939b7861a2cf8
Reviewed-on: https://dawn-review.googlesource.com/c/4800
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Jiawei Shao
2019-02-18 08:56:03 +00:00
committed by Commit Bot service account
parent 7775258f98
commit 81da14f45c
15 changed files with 145 additions and 101 deletions

View File

@@ -300,7 +300,7 @@ namespace dawn_native { namespace opengl {
case Command::BeginRenderPass: {
auto* cmd = mCommands.NextCommand<BeginRenderPassCmd>();
ExecuteRenderPass(ToBackend(cmd->info.Get()));
ExecuteRenderPass(cmd);
} break;
case Command::CopyBufferToBuffer: {
@@ -460,7 +460,7 @@ namespace dawn_native { namespace opengl {
UNREACHABLE();
}
void CommandBuffer::ExecuteRenderPass(RenderPassDescriptorBase* renderPass) {
void CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass) {
GLuint fbo = 0;
// Create the framebuffer used for this render pass and calls the correct glDrawBuffers
@@ -483,8 +483,8 @@ namespace dawn_native { namespace opengl {
// Construct GL framebuffer
unsigned int attachmentCount = 0;
for (uint32_t i : IterateBitSet(renderPass->GetColorAttachmentMask())) {
TextureViewBase* textureView = renderPass->GetColorAttachment(i).view.Get();
for (uint32_t i : IterateBitSet(renderPass->colorAttachmentsSet)) {
TextureViewBase* textureView = renderPass->colorAttachments[i].view.Get();
GLuint texture = ToBackend(textureView->GetTexture())->GetHandle();
// Attach color buffers.
@@ -509,8 +509,8 @@ namespace dawn_native { namespace opengl {
}
glDrawBuffers(attachmentCount, drawBuffers.data());
if (renderPass->HasDepthStencilAttachment()) {
TextureViewBase* textureView = renderPass->GetDepthStencilAttachment().view.Get();
if (renderPass->hasDepthStencilAttachment) {
TextureViewBase* textureView = renderPass->depthStencilAttachment.view.Get();
GLuint texture = ToBackend(textureView->GetTexture())->GetHandle();
dawn::TextureFormat format = textureView->GetTexture()->GetFormat();
@@ -539,8 +539,8 @@ namespace dawn_native { namespace opengl {
// Clear framebuffer attachments as needed
{
for (uint32_t i : IterateBitSet(renderPass->GetColorAttachmentMask())) {
const auto& attachmentInfo = renderPass->GetColorAttachment(i);
for (uint32_t i : IterateBitSet(renderPass->colorAttachmentsSet)) {
const auto& attachmentInfo = renderPass->colorAttachments[i];
// Load op - color
if (attachmentInfo.loadOp == dawn::LoadOp::Clear) {
@@ -548,8 +548,8 @@ namespace dawn_native { namespace opengl {
}
}
if (renderPass->HasDepthStencilAttachment()) {
const auto& attachmentInfo = renderPass->GetDepthStencilAttachment();
if (renderPass->hasDepthStencilAttachment) {
const auto& attachmentInfo = renderPass->depthStencilAttachment;
dawn::TextureFormat attachmentFormat =
attachmentInfo.view->GetTexture()->GetFormat();
@@ -581,8 +581,8 @@ namespace dawn_native { namespace opengl {
// Set defaults for dynamic state
persistentPipelineState.SetDefaultState();
glBlendColor(0, 0, 0, 0);
glViewport(0, 0, renderPass->GetWidth(), renderPass->GetHeight());
glScissor(0, 0, renderPass->GetWidth(), renderPass->GetHeight());
glViewport(0, 0, renderPass->width, renderPass->height);
glScissor(0, 0, renderPass->width, renderPass->height);
Command type;
while (mCommands.NextCommandId(&type)) {

View File

@@ -19,7 +19,7 @@
#include "dawn_native/CommandBuffer.h"
namespace dawn_native {
class RenderPassDescriptorBase;
struct BeginRenderPassCmd;
} // namespace dawn_native
namespace dawn_native { namespace opengl {
@@ -35,7 +35,7 @@ namespace dawn_native { namespace opengl {
private:
void ExecuteComputePass();
void ExecuteRenderPass(RenderPassDescriptorBase* renderPass);
void ExecuteRenderPass(BeginRenderPassCmd* renderPass);
CommandIterator mCommands;
};