MSC build fix.
MSC doesn't like the use of sizeof(member) inside the same struct. So hardcode the padding, and assert that the offset is 256. Change-Id: I78bbca6871cf8227c90d00a03ccf8e3d955b7d21 Reviewed-on: https://dawn-review.googlesource.com/c/2160 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
2960ec3366
commit
6686fc8245
|
@ -12,6 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#include "common/Assert.h"
|
||||||
#include "common/Constants.h"
|
#include "common/Constants.h"
|
||||||
#include "tests/DawnTest.h"
|
#include "tests/DawnTest.h"
|
||||||
#include "utils/DawnHelpers.h"
|
#include "utils/DawnHelpers.h"
|
||||||
|
@ -124,9 +125,10 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
.GetResult();
|
.GetResult();
|
||||||
struct Data {
|
struct Data {
|
||||||
float transform[8];
|
float transform[8];
|
||||||
char padding[256 - sizeof(Data::transform)];
|
char padding[256 - 8 * sizeof(float)];
|
||||||
float color[4];
|
float color[4];
|
||||||
};
|
};
|
||||||
|
ASSERT(offsetof(Data, color) == 256);
|
||||||
constexpr float dummy = 0.0f;
|
constexpr float dummy = 0.0f;
|
||||||
Data data {
|
Data data {
|
||||||
{ 1.f, 0.f, dummy, dummy, 0.f, 1.0f, dummy, dummy },
|
{ 1.f, 0.f, dummy, dummy, 0.f, 1.0f, dummy, dummy },
|
||||||
|
@ -135,9 +137,9 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
};
|
};
|
||||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(data), dawn::BufferUsageBit::Uniform);
|
dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(data), dawn::BufferUsageBit::Uniform);
|
||||||
dawn::BufferView vertUBOBufferView =
|
dawn::BufferView vertUBOBufferView =
|
||||||
buffer.CreateBufferViewBuilder().SetExtent(offsetof(Data, transform), sizeof(Data::transform)).GetResult();
|
buffer.CreateBufferViewBuilder().SetExtent(0, sizeof(Data::transform)).GetResult();
|
||||||
dawn::BufferView fragUBOBufferView =
|
dawn::BufferView fragUBOBufferView =
|
||||||
buffer.CreateBufferViewBuilder().SetExtent(offsetof(Data, color), sizeof(Data::color)).GetResult();
|
buffer.CreateBufferViewBuilder().SetExtent(256, sizeof(Data::color)).GetResult();
|
||||||
dawn::BindGroup bindGroup = device.CreateBindGroupBuilder()
|
dawn::BindGroup bindGroup = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetBufferViews(0, 1, &vertUBOBufferView)
|
.SetBufferViews(0, 1, &vertUBOBufferView)
|
||||||
|
|
Loading…
Reference in New Issue