mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Add basic supports of storage textures on OpenGL
This patch adds the basic supports of read-only and write-only storage textures on OpenGL backend. Currently on OpenGL backend we only support using either a layer of a texture or the entire texture as either read- only or write-only storage texture. BUG=dawn:267 TEST=dawn_end2end_tests Change-Id: I235b98d8d961a17739ea35eec9726dcc80889c4b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22180 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
da6dccd7c5
commit
0e5301c23e
@@ -14,11 +14,54 @@
|
||||
|
||||
#include "dawn_native/opengl/BindGroupGL.h"
|
||||
|
||||
#include "dawn_native/Texture.h"
|
||||
#include "dawn_native/opengl/BindGroupLayoutGL.h"
|
||||
#include "dawn_native/opengl/DeviceGL.h"
|
||||
|
||||
namespace dawn_native { namespace opengl {
|
||||
|
||||
MaybeError ValidateGLBindGroupDescriptor(const BindGroupDescriptor* descriptor) {
|
||||
const BindGroupLayoutBase::BindingMap& bindingMap = descriptor->layout->GetBindingMap();
|
||||
for (uint32_t i = 0; i < descriptor->entryCount; ++i) {
|
||||
const BindGroupEntry& entry = descriptor->entries[i];
|
||||
|
||||
const auto& it = bindingMap.find(BindingNumber(entry.binding));
|
||||
BindingIndex bindingIndex = it->second;
|
||||
ASSERT(bindingIndex < descriptor->layout->GetBindingCount());
|
||||
|
||||
const BindingInfo& bindingInfo = descriptor->layout->GetBindingInfo(bindingIndex);
|
||||
switch (bindingInfo.type) {
|
||||
case wgpu::BindingType::ReadonlyStorageTexture:
|
||||
case wgpu::BindingType::WriteonlyStorageTexture: {
|
||||
ASSERT(entry.textureView != nullptr);
|
||||
const uint32_t textureViewLayerCount = entry.textureView->GetLayerCount();
|
||||
if (textureViewLayerCount != 1 &&
|
||||
textureViewLayerCount !=
|
||||
entry.textureView->GetTexture()->GetArrayLayers()) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Currently the OpenGL backend only supports either binding a layer or "
|
||||
"the entire texture as storage texture.");
|
||||
}
|
||||
} break;
|
||||
|
||||
case wgpu::BindingType::UniformBuffer:
|
||||
case wgpu::BindingType::StorageBuffer:
|
||||
case wgpu::BindingType::ReadonlyStorageBuffer:
|
||||
case wgpu::BindingType::SampledTexture:
|
||||
case wgpu::BindingType::Sampler:
|
||||
case wgpu::BindingType::ComparisonSampler:
|
||||
break;
|
||||
|
||||
case wgpu::BindingType::StorageTexture:
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
BindGroup::BindGroup(Device* device, const BindGroupDescriptor* descriptor)
|
||||
: BindGroupBase(this, device, descriptor) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user