mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Update VertexInput (InputState) to match spec - Part 1
This is only a renaming: change VertexInput to VertexBuffer, and change InputState to VertexInput. The next two patches will do as follows: 1) change the structure of vertex input descriptor related stuff. 2) change num to count. BUG=dawn:80, dawn:107 Change-Id: Ie76aa653a527759a9c3b4a4792e3254689f053b8 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7420 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
820a04b9ce
commit
eea2091068
@@ -210,8 +210,8 @@ namespace dawn_native { namespace opengl {
|
||||
};
|
||||
|
||||
// Vertex buffers and index buffers are implemented as part of an OpenGL VAO that
|
||||
// corresponds to an InputState. On the contrary in Dawn they are part of the global state.
|
||||
// This means that we have to re-apply these buffers on an InputState change.
|
||||
// corresponds to an VertexInput. On the contrary in Dawn they are part of the global state.
|
||||
// This means that we have to re-apply these buffers on an VertexInput change.
|
||||
class InputBufferTracker {
|
||||
public:
|
||||
void OnSetIndexBuffer(BufferBase* buffer) {
|
||||
@@ -230,7 +230,7 @@ namespace dawn_native { namespace opengl {
|
||||
}
|
||||
|
||||
// Use 64 bit masks and make sure there are no shift UB
|
||||
static_assert(kMaxVertexInputs <= 8 * sizeof(unsigned long long) - 1, "");
|
||||
static_assert(kMaxVertexBuffers <= 8 * sizeof(unsigned long long) - 1, "");
|
||||
mDirtyVertexBuffers |= ((1ull << count) - 1ull) << startSlot;
|
||||
}
|
||||
|
||||
@@ -286,9 +286,9 @@ namespace dawn_native { namespace opengl {
|
||||
bool mIndexBufferDirty = false;
|
||||
Buffer* mIndexBuffer = nullptr;
|
||||
|
||||
std::bitset<kMaxVertexInputs> mDirtyVertexBuffers;
|
||||
std::array<Buffer*, kMaxVertexInputs> mVertexBuffers;
|
||||
std::array<uint64_t, kMaxVertexInputs> mVertexBufferOffsets;
|
||||
std::bitset<kMaxVertexBuffers> mDirtyVertexBuffers;
|
||||
std::array<Buffer*, kMaxVertexBuffers> mVertexBuffers;
|
||||
std::array<uint64_t, kMaxVertexBuffers> mVertexBufferOffsets;
|
||||
|
||||
RenderPipelineBase* mLastPipeline = nullptr;
|
||||
};
|
||||
@@ -772,7 +772,7 @@ namespace dawn_native { namespace opengl {
|
||||
inputBuffers.Apply();
|
||||
|
||||
dawn::IndexFormat indexFormat =
|
||||
lastPipeline->GetInputStateDescriptor()->indexFormat;
|
||||
lastPipeline->GetVertexInputDescriptor()->indexFormat;
|
||||
size_t formatSize = IndexFormatSize(indexFormat);
|
||||
GLenum formatType = IndexFormatType(indexFormat);
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace dawn_native { namespace opengl {
|
||||
modules[dawn::ShaderStage::Fragment] = ToBackend(descriptor->fragmentStage->module);
|
||||
|
||||
PipelineGL::Initialize(ToBackend(GetLayout()), modules);
|
||||
CreateVAOForInputState(descriptor->inputState);
|
||||
CreateVAOForVertexInput(descriptor->vertexInput);
|
||||
}
|
||||
|
||||
RenderPipeline::~RenderPipeline() {
|
||||
@@ -194,7 +194,7 @@ namespace dawn_native { namespace opengl {
|
||||
return mGlPrimitiveTopology;
|
||||
}
|
||||
|
||||
void RenderPipeline::CreateVAOForInputState(const InputStateDescriptor* inputState) {
|
||||
void RenderPipeline::CreateVAOForVertexInput(const VertexInputDescriptor* vertexInput) {
|
||||
glGenVertexArrays(1, &mVertexArrayObject);
|
||||
glBindVertexArray(mVertexArrayObject);
|
||||
for (uint32_t location : IterateBitSet(GetAttributesSetMask())) {
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace dawn_native { namespace opengl {
|
||||
void ApplyNow(PersistentPipelineState& persistentPipelineState);
|
||||
|
||||
private:
|
||||
void CreateVAOForInputState(const InputStateDescriptor* inputState);
|
||||
void CreateVAOForVertexInput(const VertexInputDescriptor* vertexInput);
|
||||
|
||||
// TODO(yunchao.he@intel.com): vao need to be deduplicated between pipelines.
|
||||
GLuint mVertexArrayObject;
|
||||
|
||||
Reference in New Issue
Block a user