summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/3d/renderer_draw.cc2
-rw-r--r--src/3d/renderer_pipelines.cc6
-rw-r--r--src/3d/scene_loader.cc50
-rw-r--r--src/gpu/effect.cc4
-rw-r--r--src/gpu/sequence.cc10
-rw-r--r--src/gpu/texture_readback.cc36
-rw-r--r--src/tests/common/effect_test_helpers.cc6
-rw-r--r--src/tests/common/offscreen_render_target.cc4
-rw-r--r--src/util/asset_manager.cc12
-rw-r--r--tools/asset_packer.cc6
-rw-r--r--tools/cnn_test.cc34
-rw-r--r--tools/shadertoy/template.cc2
12 files changed, 86 insertions, 86 deletions
diff --git a/src/3d/renderer_draw.cc b/src/3d/renderer_draw.cc
index 2b19787..f2d1323 100644
--- a/src/3d/renderer_draw.cc
+++ b/src/3d/renderer_draw.cc
@@ -61,7 +61,7 @@ void Renderer3D::update_uniforms(const Scene& scene, const Camera& camera,
if (obj.type == ObjectType::PLANE && obj.shared_user_data) {
// Safely cast shared_user_data to PlaneData* and get distance
plane_distance =
- static_cast<PlaneData*>(obj.shared_user_data.get())->distance;
+ ((PlaneData*)(obj.shared_user_data.get()))->distance;
}
data.params =
diff --git a/src/3d/renderer_pipelines.cc b/src/3d/renderer_pipelines.cc
index fed3983..57e71ae 100644
--- a/src/3d/renderer_pipelines.cc
+++ b/src/3d/renderer_pipelines.cc
@@ -17,7 +17,7 @@ void Renderer3D::create_pipeline() {
WGPURenderPipeline Renderer3D::create_pipeline_impl(bool use_bvh) {
// Main SDF shader
size_t size;
- const char* shader_code = reinterpret_cast<const char*>(
+ const char* shader_code = (const char*)(
GetAsset(AssetId::ASSET_SHADER_RENDERER_3D, &size));
// Compose the final shader by substituting the scene query implementation
@@ -134,7 +134,7 @@ WGPURenderPipeline Renderer3D::create_pipeline_impl(bool use_bvh) {
void Renderer3D::create_mesh_pipeline() {
size_t size;
- const char* shader_code = reinterpret_cast<const char*>(
+ const char* shader_code = (const char*)(
GetAsset(AssetId::ASSET_SHADER_MESH, &size));
ShaderComposer::CompositionMap composition_map;
@@ -261,7 +261,7 @@ void Renderer3D::create_mesh_pipeline() {
void Renderer3D::create_skybox_pipeline() {
size_t size;
- const char* shader_code = reinterpret_cast<const char*>(
+ const char* shader_code = (const char*)(
GetAsset(AssetId::ASSET_SHADER_SKYBOX, &size));
std::string composed_shader =
diff --git a/src/3d/scene_loader.cc b/src/3d/scene_loader.cc
index 286edca..2c29bc3 100644
--- a/src/3d/scene_loader.cc
+++ b/src/3d/scene_loader.cc
@@ -23,11 +23,11 @@ bool SceneLoader::LoadScene(Scene& scene, const uint8_t* data, size_t size) {
size_t offset = 4;
- uint32_t num_objects = *reinterpret_cast<const uint32_t*>(data + offset);
+ uint32_t num_objects = *(const uint32_t*)(data + offset);
offset += 4;
- uint32_t num_cameras = *reinterpret_cast<const uint32_t*>(data + offset);
+ uint32_t num_cameras = *(const uint32_t*)(data + offset);
offset += 4;
- uint32_t num_lights = *reinterpret_cast<const uint32_t*>(data + offset);
+ uint32_t num_lights = *(const uint32_t*)(data + offset);
offset += 4;
// printf("SceneLoader: Loading %d objects, %d cameras, %d lights\n",
@@ -43,48 +43,48 @@ bool SceneLoader::LoadScene(Scene& scene, const uint8_t* data, size_t size) {
if (offset + 4 > size)
return false;
- uint32_t type_val = *reinterpret_cast<const uint32_t*>(data + offset);
+ uint32_t type_val = *(const uint32_t*)(data + offset);
offset += 4;
ObjectType type = (ObjectType)type_val;
if (offset + 12 + 16 + 12 + 16 > size)
return false; // Transforms + Color
- float px = *reinterpret_cast<const float*>(data + offset);
+ float px = *(const float*)(data + offset);
offset += 4;
- float py = *reinterpret_cast<const float*>(data + offset);
+ float py = *(const float*)(data + offset);
offset += 4;
- float pz = *reinterpret_cast<const float*>(data + offset);
+ float pz = *(const float*)(data + offset);
offset += 4;
vec3 pos(px, py, pz);
- float rx = *reinterpret_cast<const float*>(data + offset);
+ float rx = *(const float*)(data + offset);
offset += 4;
- float ry = *reinterpret_cast<const float*>(data + offset);
+ float ry = *(const float*)(data + offset);
offset += 4;
- float rz = *reinterpret_cast<const float*>(data + offset);
+ float rz = *(const float*)(data + offset);
offset += 4;
- float rw = *reinterpret_cast<const float*>(data + offset);
+ float rw = *(const float*)(data + offset);
offset += 4;
quat rot(rx, ry, rz, rw);
- float sx = *reinterpret_cast<const float*>(data + offset);
+ float sx = *(const float*)(data + offset);
offset += 4;
- float sy = *reinterpret_cast<const float*>(data + offset);
+ float sy = *(const float*)(data + offset);
offset += 4;
- float sz = *reinterpret_cast<const float*>(data + offset);
+ float sz = *(const float*)(data + offset);
offset += 4;
vec3 scale(sx, sy, sz);
// Color components (cr, cg, cb, ca)
- float cr = *reinterpret_cast<const float*>(data + offset);
+ float cr = *(const float*)(data + offset);
offset += 4;
- float cg = *reinterpret_cast<const float*>(data + offset);
+ float cg = *(const float*)(data + offset);
offset += 4;
- float cb = *reinterpret_cast<const float*>(data + offset);
+ float cb = *(const float*)(data + offset);
offset += 4;
// Read ca, advance offset AFTER reading ca, then construct color
- float ca = *reinterpret_cast<const float*>(data + offset);
+ float ca = *(const float*)(data + offset);
offset += 4; // Offset is now after ca
vec4 color(cr, cg, cb, ca);
@@ -94,7 +94,7 @@ bool SceneLoader::LoadScene(Scene& scene, const uint8_t* data, size_t size) {
// Check bounds before reading plane_distance
if (offset + 4 > size)
return false;
- plane_distance = *reinterpret_cast<const float*>(data + offset);
+ plane_distance = *(const float*)(data + offset);
offset += 4; // Advance offset after reading plane_distance
}
@@ -103,7 +103,7 @@ bool SceneLoader::LoadScene(Scene& scene, const uint8_t* data, size_t size) {
// either after ca (if not PLANE) or after plane_distance (if PLANE).
if (offset + 4 > size)
return false;
- uint32_t name_len = *reinterpret_cast<const uint32_t*>(data + offset);
+ uint32_t name_len = *(const uint32_t*)(data + offset);
offset += 4;
AssetId mesh_id = (AssetId)0; // Default or INVALID (if 0 is invalid)
@@ -129,11 +129,11 @@ bool SceneLoader::LoadScene(Scene& scene, const uint8_t* data, size_t size) {
// Physics properties
if (offset + 4 + 4 + 4 > size)
return false;
- float mass = *reinterpret_cast<const float*>(data + offset);
+ float mass = *(const float*)(data + offset);
offset += 4;
- float restitution = *reinterpret_cast<const float*>(data + offset);
+ float restitution = *(const float*)(data + offset);
offset += 4;
- uint32_t is_static_u32 = *reinterpret_cast<const uint32_t*>(data + offset);
+ uint32_t is_static_u32 = *(const uint32_t*)(data + offset);
offset += 4;
bool is_static = (is_static_u32 != 0);
@@ -155,9 +155,9 @@ bool SceneLoader::LoadScene(Scene& scene, const uint8_t* data, size_t size) {
// Use std::make_shared for exception safety and efficiency
obj.shared_user_data = std::make_shared<PlaneData>();
// Assign the plane distance
- // Safely cast void* to PlaneData* using static_cast on the shared_ptr's
+ // Safely cast void* to PlaneData* using C-style cast on the shared_ptr's
// get()
- static_cast<PlaneData*>(obj.shared_user_data.get())->distance =
+ ((PlaneData*)(obj.shared_user_data.get()))->distance =
plane_distance;
}
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc
index 0e53862..752dd84 100644
--- a/src/gpu/effect.cc
+++ b/src/gpu/effect.cc
@@ -49,8 +49,8 @@ void Effect::blit_input_to_output(WGPUCommandEncoder encoder,
GpuTextureCopyInfo dst_copy = {
.texture = dst, .mipLevel = 0, .origin = {0, 0, 0}};
- WGPUExtent3D extent = {static_cast<unsigned int>(width_),
- static_cast<unsigned int>(height_), 1};
+ WGPUExtent3D extent = {(unsigned int)(width_),
+ (unsigned int)(height_), 1};
wgpuCommandEncoderCopyTextureToTexture(encoder, &src_copy, &dst_copy,
&extent);
diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc
index d2f99bc..901d560 100644
--- a/src/gpu/sequence.cc
+++ b/src/gpu/sequence.cc
@@ -185,8 +185,8 @@ void NodeRegistry::create_texture(Node& node) {
WGPUTextureDescriptor desc = {};
desc.usage = usage;
desc.dimension = WGPUTextureDimension_2D;
- desc.size = {static_cast<unsigned int>(node.width),
- static_cast<unsigned int>(node.height), 1};
+ desc.size = {(unsigned int)(node.width),
+ (unsigned int)(node.height), 1};
desc.format = format;
desc.mipLevelCount = 1;
desc.sampleCount = 1;
@@ -219,10 +219,10 @@ Sequence::Sequence(const GpuContext& ctx, int width, int height)
void Sequence::preprocess(float seq_time, float beat_time, float beat_phase,
float audio_intensity) {
- params_.resolution = {static_cast<float>(width_),
- static_cast<float>(height_)};
+ params_.resolution = {(float)(width_),
+ (float)(height_)};
params_.aspect_ratio =
- static_cast<float>(width_) / static_cast<float>(height_);
+ (float)(width_) / (float)(height_);
params_.time = seq_time;
params_.beat_time = beat_time;
params_.beat_phase = beat_phase;
diff --git a/src/gpu/texture_readback.cc b/src/gpu/texture_readback.cc
index bd3c79c..211beed 100644
--- a/src/gpu/texture_readback.cc
+++ b/src/gpu/texture_readback.cc
@@ -52,12 +52,12 @@ std::vector<uint8_t> read_texture_pixels(WGPUInstance instance,
.layout =
{
.bytesPerRow = aligned_bytes_per_row,
- .rowsPerImage = static_cast<uint32_t>(height),
+ .rowsPerImage = (uint32_t)(height),
},
};
- const WGPUExtent3D copy_size = {static_cast<uint32_t>(width),
- static_cast<uint32_t>(height), 1};
+ const WGPUExtent3D copy_size = {(uint32_t)(width),
+ (uint32_t)(height), 1};
wgpuCommandEncoderCopyTextureToBuffer(encoder, &src, &dst, &copy_size);
@@ -77,7 +77,7 @@ std::vector<uint8_t> read_texture_pixels(WGPUInstance instance,
// Win32: Old callback API
MapState map_state = {};
auto map_cb = [](WGPUBufferMapAsyncStatus status, void* userdata) {
- MapState* state = static_cast<MapState*>(userdata);
+ MapState* state = (MapState*)(userdata);
state->status = status;
state->done = true;
};
@@ -90,7 +90,7 @@ std::vector<uint8_t> read_texture_pixels(WGPUInstance instance,
void* userdata, void* user2) {
(void)message;
(void)user2;
- MapState* state = static_cast<MapState*>(userdata);
+ MapState* state = (MapState*)(userdata);
state->status = status;
state->done = true;
};
@@ -117,7 +117,7 @@ std::vector<uint8_t> read_texture_pixels(WGPUInstance instance,
}
// Copy data from mapped buffer (handle row padding)
- const uint8_t* mapped_data = static_cast<const uint8_t*>(
+ const uint8_t* mapped_data = (const uint8_t*)(
wgpuBufferGetConstMappedRange(staging, 0, buffer_size));
if (mapped_data) {
// If rows are aligned, copy row by row to remove padding
@@ -209,11 +209,11 @@ std::vector<uint8_t> texture_readback_fp16_to_u8(WGPUDevice device,
.layout =
{
.bytesPerRow = aligned_bytes_per_row,
- .rowsPerImage = static_cast<uint32_t>(height),
+ .rowsPerImage = (uint32_t)(height),
},
};
- const WGPUExtent3D copy_size = {static_cast<uint32_t>(width),
- static_cast<uint32_t>(height), 1};
+ const WGPUExtent3D copy_size = {(uint32_t)(width),
+ (uint32_t)(height), 1};
wgpuCommandEncoderCopyTextureToBuffer(encoder, &src, &dst, &copy_size);
WGPUCommandBuffer commands = wgpuCommandEncoderFinish(encoder, nullptr);
@@ -226,7 +226,7 @@ std::vector<uint8_t> texture_readback_fp16_to_u8(WGPUDevice device,
#if defined(DEMO_CROSS_COMPILE_WIN32)
MapState map_state = {};
auto map_cb = [](WGPUBufferMapAsyncStatus status, void* userdata) {
- MapState* state = static_cast<MapState*>(userdata);
+ MapState* state = (MapState*)(userdata);
state->status = status;
state->done = true;
};
@@ -238,7 +238,7 @@ std::vector<uint8_t> texture_readback_fp16_to_u8(WGPUDevice device,
void* userdata, void* user2) {
(void)message;
(void)user2;
- MapState* state = static_cast<MapState*>(userdata);
+ MapState* state = (MapState*)(userdata);
state->status = status;
state->done = true;
};
@@ -259,14 +259,14 @@ std::vector<uint8_t> texture_readback_fp16_to_u8(WGPUDevice device,
}
// Convert FP16 to U8 ([-1,1] → [0,255])
- const uint16_t* mapped_data = static_cast<const uint16_t*>(
+ const uint16_t* mapped_data = (const uint16_t*)(
wgpuBufferGetConstMappedRange(staging, 0, buffer_size));
std::vector<uint8_t> pixels(width * height * 4);
if (mapped_data) {
for (int y = 0; y < height; ++y) {
- const uint16_t* src_row = reinterpret_cast<const uint16_t*>(
- reinterpret_cast<const uint8_t*>(mapped_data) +
+ const uint16_t* src_row = (const uint16_t*)(
+ (const uint8_t*)(mapped_data) +
y * aligned_bytes_per_row);
for (int x = 0; x < width; ++x) {
float r = fp16_to_float(src_row[x * 4 + 0]);
@@ -281,10 +281,10 @@ std::vector<uint8_t> texture_readback_fp16_to_u8(WGPUDevice device,
a = (a + 1.0f) * 0.5f;
int idx = (y * width + x) * 4;
- pixels[idx + 0] = static_cast<uint8_t>(b * 255.0f); // B
- pixels[idx + 1] = static_cast<uint8_t>(g * 255.0f); // G
- pixels[idx + 2] = static_cast<uint8_t>(r * 255.0f); // R
- pixels[idx + 3] = static_cast<uint8_t>(a * 255.0f); // A
+ pixels[idx + 0] = (uint8_t)(b * 255.0f); // B
+ pixels[idx + 1] = (uint8_t)(g * 255.0f); // G
+ pixels[idx + 2] = (uint8_t)(r * 255.0f); // R
+ pixels[idx + 3] = (uint8_t)(a * 255.0f); // A
}
}
}
diff --git a/src/tests/common/effect_test_helpers.cc b/src/tests/common/effect_test_helpers.cc
index 430b90f..2a40f60 100644
--- a/src/tests/common/effect_test_helpers.cc
+++ b/src/tests/common/effect_test_helpers.cc
@@ -45,9 +45,9 @@ bool all_pixels_match_color(const std::vector<uint8_t>& pixels, int width,
const uint8_t g = pixels[offset + 1];
const uint8_t r = pixels[offset + 2];
- const int diff_r = static_cast<int>(r) - static_cast<int>(target_r);
- const int diff_g = static_cast<int>(g) - static_cast<int>(target_g);
- const int diff_b = static_cast<int>(b) - static_cast<int>(target_b);
+ const int diff_r = (int)(r) - (int)(target_r);
+ const int diff_g = (int)(g) - (int)(target_g);
+ const int diff_b = (int)(b) - (int)(target_b);
if (diff_r * diff_r + diff_g * diff_g + diff_b * diff_b >
tolerance * tolerance) {
diff --git a/src/tests/common/offscreen_render_target.cc b/src/tests/common/offscreen_render_target.cc
index 33f0ae0..2b0a43b 100644
--- a/src/tests/common/offscreen_render_target.cc
+++ b/src/tests/common/offscreen_render_target.cc
@@ -20,7 +20,7 @@ OffscreenRenderTarget::OffscreenRenderTarget(WGPUInstance instance,
.usage = WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_CopySrc |
WGPUTextureUsage_TextureBinding,
.dimension = WGPUTextureDimension_2D,
- .size = {static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1},
+ .size = {(uint32_t)(width), (uint32_t)(height), 1},
.format = format,
.mipLevelCount = 1,
.sampleCount = 1,
@@ -44,7 +44,7 @@ OffscreenRenderTarget::~OffscreenRenderTarget() {
void OffscreenRenderTarget::map_callback(WGPUMapAsyncStatus status,
void* userdata) {
- MapState* state = static_cast<MapState*>(userdata);
+ MapState* state = (MapState*)(userdata);
state->status = status;
state->done = true;
}
diff --git a/src/util/asset_manager.cc b/src/util/asset_manager.cc
index 0baa063..a606b46 100644
--- a/src/util/asset_manager.cc
+++ b/src/util/asset_manager.cc
@@ -112,7 +112,7 @@ const uint8_t* GetAsset(AssetId asset_id, size_t* out_size) {
CHECK_RETURN_END
// Write header
- uint32_t* header = reinterpret_cast<uint32_t*>(generated_data);
+ uint32_t* header = (uint32_t*)(generated_data);
header[0] = (uint32_t)width;
header[1] = (uint32_t)height;
@@ -155,7 +155,7 @@ TextureAsset GetTextureAsset(AssetId asset_id) {
return {0, 0, nullptr};
}
- const uint32_t* header = reinterpret_cast<const uint32_t*>(data);
+ const uint32_t* header = (const uint32_t*)(data);
return {(int)header[0], (int)header[1], data + 8};
}
@@ -167,13 +167,13 @@ MeshAsset GetMeshAsset(AssetId asset_id) {
}
const uint8_t* ptr = data;
- uint32_t num_vertices = *reinterpret_cast<const uint32_t*>(ptr);
+ uint32_t num_vertices = *(const uint32_t*)(ptr);
ptr += sizeof(uint32_t);
- const MeshVertex* vertices = reinterpret_cast<const MeshVertex*>(ptr);
+ const MeshVertex* vertices = (const MeshVertex*)(ptr);
ptr += num_vertices * sizeof(MeshVertex);
- uint32_t num_indices = *reinterpret_cast<const uint32_t*>(ptr);
+ uint32_t num_indices = *(const uint32_t*)(ptr);
ptr += sizeof(uint32_t);
- const uint32_t* indices = reinterpret_cast<const uint32_t*>(ptr);
+ const uint32_t* indices = (const uint32_t*)(ptr);
return {num_vertices, vertices, num_indices, indices};
}
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc
index fdecb58..7e186b6 100644
--- a/tools/asset_packer.cc
+++ b/tools/asset_packer.cc
@@ -307,12 +307,12 @@ static bool ProcessMeshFile(const std::string& full_path,
buffer->resize(sizeof(uint32_t) + final_vertices.size() * sizeof(Vertex) +
sizeof(uint32_t) + final_indices.size() * sizeof(uint32_t));
uint8_t* out_ptr = buffer->data();
- *reinterpret_cast<uint32_t*>(out_ptr) = (uint32_t)final_vertices.size();
+ *(uint32_t*)(out_ptr) = (uint32_t)final_vertices.size();
out_ptr += sizeof(uint32_t);
std::memcpy(out_ptr, final_vertices.data(),
final_vertices.size() * sizeof(Vertex));
out_ptr += final_vertices.size() * sizeof(Vertex);
- *reinterpret_cast<uint32_t*>(out_ptr) = (uint32_t)final_indices.size();
+ *(uint32_t*)(out_ptr) = (uint32_t)final_indices.size();
out_ptr += sizeof(uint32_t);
std::memcpy(out_ptr, final_indices.data(),
final_indices.size() * sizeof(uint32_t));
@@ -337,7 +337,7 @@ static bool ProcessImageFile(const std::string& full_path,
// Format: [Width(4)][Height(4)][Pixels...]
buffer->resize(sizeof(uint32_t) * 2 + w * h * 4);
- uint32_t* header = reinterpret_cast<uint32_t*>(buffer->data());
+ uint32_t* header = (uint32_t*)(buffer->data());
header[0] = (uint32_t)w;
header[1] = (uint32_t)h;
std::memcpy(buffer->data() + sizeof(uint32_t) * 2, img_data, w * h * 4);
diff --git a/tools/cnn_test.cc b/tools/cnn_test.cc
index 25a1285..5694a62 100644
--- a/tools/cnn_test.cc
+++ b/tools/cnn_test.cc
@@ -176,7 +176,7 @@ static WGPUTexture load_texture(WGPUDevice device, WGPUQueue queue,
.usage = WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopyDst |
WGPUTextureUsage_RenderAttachment,
.dimension = WGPUTextureDimension_2D,
- .size = {static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1},
+ .size = {(uint32_t)(width), (uint32_t)(height), 1},
.format = WGPUTextureFormat_BGRA8Unorm,
.mipLevelCount = 1,
.sampleCount = 1,
@@ -200,10 +200,10 @@ static WGPUTexture load_texture(WGPUDevice device, WGPUQueue queue,
// Upload to GPU
const WGPUTexelCopyTextureInfo dst = {.texture = texture, .mipLevel = 0};
const WGPUTexelCopyBufferLayout layout = {
- .bytesPerRow = static_cast<uint32_t>(width * 4),
- .rowsPerImage = static_cast<uint32_t>(height)};
- const WGPUExtent3D size = {static_cast<uint32_t>(width),
- static_cast<uint32_t>(height), 1};
+ .bytesPerRow = (uint32_t)(width * 4),
+ .rowsPerImage = (uint32_t)(height)};
+ const WGPUExtent3D size = {(uint32_t)(width),
+ (uint32_t)(height), 1};
wgpuQueueWriteTexture(queue, &dst, bgra_data.data(), bgra_data.size(),
&layout, &size);
@@ -238,7 +238,7 @@ static WGPUTexture load_depth_from_alpha(WGPUDevice device, WGPUQueue queue,
const WGPUTextureDescriptor depth_desc = {
.usage = WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopyDst,
.dimension = WGPUTextureDimension_2D,
- .size = {static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1},
+ .size = {(uint32_t)(width), (uint32_t)(height), 1},
.format = WGPUTextureFormat_R32Float,
.mipLevelCount = 1,
.sampleCount = 1,
@@ -253,10 +253,10 @@ static WGPUTexture load_depth_from_alpha(WGPUDevice device, WGPUQueue queue,
const WGPUTexelCopyTextureInfo dst = {.texture = depth_texture,
.mipLevel = 0};
const WGPUTexelCopyBufferLayout layout = {
- .bytesPerRow = static_cast<uint32_t>(width * sizeof(float)),
- .rowsPerImage = static_cast<uint32_t>(height)};
- const WGPUExtent3D size = {static_cast<uint32_t>(width),
- static_cast<uint32_t>(height), 1};
+ .bytesPerRow = (uint32_t)(width * sizeof(float)),
+ .rowsPerImage = (uint32_t)(height)};
+ const WGPUExtent3D size = {(uint32_t)(width),
+ (uint32_t)(height), 1};
wgpuQueueWriteTexture(queue, &dst, depth_data.data(),
depth_data.size() * sizeof(float), &layout, &size);
@@ -474,8 +474,8 @@ readback_rgba32uint_to_bgra8(WGPUDevice device, WGPUQueue queue,
dst.layout.bytesPerRow = padded_bytes_per_row;
dst.layout.rowsPerImage = height;
- WGPUExtent3D copy_size = {static_cast<uint32_t>(width),
- static_cast<uint32_t>(height), 1};
+ WGPUExtent3D copy_size = {(uint32_t)(width),
+ (uint32_t)(height), 1};
wgpuCommandEncoderCopyTextureToBuffer(encoder, &src, &dst, &copy_size);
@@ -575,7 +575,7 @@ readback_rgba32uint_to_bgra8(WGPUDevice device, WGPUQueue queue,
return 0;
if (v >= 1.0f)
return 255;
- return static_cast<uint8_t>(v * 255.0f + 0.5f);
+ return (uint8_t)(v * 255.0f + 0.5f);
};
result[(y * width + x) * 4 + 0] = clamp_u8(b);
@@ -743,7 +743,7 @@ static bool process_cnn_v2(WGPUDevice device, WGPUQueue queue,
.usage = WGPUTextureUsage_StorageBinding |
WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc,
.dimension = WGPUTextureDimension_2D,
- .size = {static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1},
+ .size = {(uint32_t)(width), (uint32_t)(height), 1},
.format = WGPUTextureFormat_RGBA32Uint,
.mipLevelCount = 1,
.sampleCount = 1,
@@ -1350,7 +1350,7 @@ int main(int argc, char** argv) {
.usage = WGPUTextureUsage_TextureBinding |
WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_CopySrc,
.dimension = WGPUTextureDimension_2D,
- .size = {static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1},
+ .size = {(uint32_t)(width), (uint32_t)(height), 1},
.format = WGPUTextureFormat_RGBA16Float,
.mipLevelCount = 1,
.sampleCount = 1,
@@ -1385,8 +1385,8 @@ int main(int argc, char** argv) {
// Update uniforms
UniformsSequenceParams common_u = {
- .resolution = {static_cast<float>(width), static_cast<float>(height)},
- .aspect_ratio = static_cast<float>(width) / static_cast<float>(height),
+ .resolution = {(float)(width), (float)(height)},
+ .aspect_ratio = (float)(width) / (float)(height),
.time = 0.0f,
.beat_time = 0.0f,
.beat_phase = 0.0f,
diff --git a/tools/shadertoy/template.cc b/tools/shadertoy/template.cc
index 56b4ab5..fdc4f70 100644
--- a/tools/shadertoy/template.cc
+++ b/tools/shadertoy/template.cc
@@ -99,7 +99,7 @@ void ShaderToyEffect::init(MainSequence* demo) {
void ShaderToyEffect::render(WGPURenderPassEncoder pass, float time, float beat,
float intensity, float aspect_ratio) {
const UniformsSequenceParams uniforms = {
- .resolution = {static_cast<float>(width_), static_cast<float>(height_)},
+ .resolution = {(float)(width_), (float)(height_)},
.aspect_ratio = aspect_ratio,
.time = time,
.beat = beat,