Some small optimizations and style issues for input state
Bug=dawn:107 Change-Id: I8ecfb39a2bff11b678bd8548ec0725ba061ef333 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6081 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
d754fb2034
commit
494552b886
|
@ -396,13 +396,8 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
D3D12_INPUT_LAYOUT_DESC RenderPipeline::ComputeInputLayout(
|
D3D12_INPUT_LAYOUT_DESC RenderPipeline::ComputeInputLayout(
|
||||||
std::array<D3D12_INPUT_ELEMENT_DESC, kMaxVertexAttributes>* inputElementDescriptors) {
|
std::array<D3D12_INPUT_ELEMENT_DESC, kMaxVertexAttributes>* inputElementDescriptors) {
|
||||||
const auto& attributesSetMask = GetAttributesSetMask();
|
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
for (auto i : IterateBitSet(attributesSetMask)) {
|
for (auto i : IterateBitSet(GetAttributesSetMask())) {
|
||||||
if (!attributesSetMask[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_INPUT_ELEMENT_DESC& inputElementDescriptor = (*inputElementDescriptors)[count++];
|
D3D12_INPUT_ELEMENT_DESC& inputElementDescriptor = (*inputElementDescriptors)[count++];
|
||||||
|
|
||||||
const VertexAttributeDescriptor& attribute = GetAttribute(i);
|
const VertexAttributeDescriptor& attribute = GetAttribute(i);
|
||||||
|
|
|
@ -365,11 +365,7 @@ namespace dawn_native { namespace metal {
|
||||||
MTLVertexDescriptor* RenderPipeline::MakeVertexDesc() {
|
MTLVertexDescriptor* RenderPipeline::MakeVertexDesc() {
|
||||||
MTLVertexDescriptor* mtlVertexDescriptor = [MTLVertexDescriptor new];
|
MTLVertexDescriptor* mtlVertexDescriptor = [MTLVertexDescriptor new];
|
||||||
|
|
||||||
const auto& attributesSetMask = GetAttributesSetMask();
|
for (uint32_t i : IterateBitSet(GetAttributesSetMask())) {
|
||||||
for (uint32_t i = 0; i < attributesSetMask.size(); ++i) {
|
|
||||||
if (!attributesSetMask[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const VertexAttributeDescriptor& info = GetAttribute(i);
|
const VertexAttributeDescriptor& info = GetAttribute(i);
|
||||||
|
|
||||||
auto attribDesc = [MTLVertexAttributeDescriptor new];
|
auto attribDesc = [MTLVertexAttributeDescriptor new];
|
||||||
|
|
|
@ -197,12 +197,8 @@ namespace dawn_native { namespace opengl {
|
||||||
void RenderPipeline::CreateVAOForInputState(const InputStateDescriptor* inputState) {
|
void RenderPipeline::CreateVAOForInputState(const InputStateDescriptor* inputState) {
|
||||||
glGenVertexArrays(1, &mVertexArrayObject);
|
glGenVertexArrays(1, &mVertexArrayObject);
|
||||||
glBindVertexArray(mVertexArrayObject);
|
glBindVertexArray(mVertexArrayObject);
|
||||||
auto& attributesSetMask = GetAttributesSetMask();
|
for (uint32_t location : IterateBitSet(GetAttributesSetMask())) {
|
||||||
for (uint32_t location = 0; location < attributesSetMask.size(); ++location) {
|
const auto& attribute = GetAttribute(location);
|
||||||
if (!attributesSetMask[location]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto attribute = GetAttribute(location);
|
|
||||||
glEnableVertexAttribArray(location);
|
glEnableVertexAttribArray(location);
|
||||||
|
|
||||||
attributesUsingInput[attribute.inputSlot][location] = true;
|
attributesUsingInput[attribute.inputSlot][location] = true;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class InputStateTest : public DawnTest {
|
||||||
};
|
};
|
||||||
dawn::RenderPipeline MakeTestPipeline(const dawn::InputStateDescriptor& inputState,
|
dawn::RenderPipeline MakeTestPipeline(const dawn::InputStateDescriptor& inputState,
|
||||||
int multiplier,
|
int multiplier,
|
||||||
std::vector<ShaderTestSpec> testSpec) {
|
const std::vector<ShaderTestSpec>& testSpec) {
|
||||||
std::ostringstream vs;
|
std::ostringstream vs;
|
||||||
vs << "#version 450\n";
|
vs << "#version 450\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue