Skip to content

Commit 3ba90ef

Browse files
committed
#75 wip: xboxビルドテスト v59
1 parent 8484049 commit 3ba90ef

2 files changed

Lines changed: 35 additions & 12 deletions

File tree

templates/xbox/src/bindings/Canvas2D.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,15 +761,26 @@ void InstallAccessors(v8::Isolate* isolate, v8::Local<v8::Object> obj)
761761
Self(info.This())->state.MEMBER = v->BooleanValue(info.GetIsolate()); }).Check()
762762

763763
// fillStyle / strokeStyle: gradient/pattern オブジェクトも受け取り代表色へ解決。
764-
// getter は代入した文字列(色)をそのまま返す (player は色正規化に読み戻しを使う)。
764+
// 重要: getter は「代入した色を #rrggbb に正規化して」返す (ブラウザ準拠)。
765+
// player は色文字列の数値化に読み戻しを使う (@next2d/filters の
766+
// $convertColorStringToNumber は `+("0x"+ctx.fillStyle.slice(1))` で解釈するため、
767+
// getter が "rgb(191,255,255)" 等の生文字列を返すと NaN になり、その色を使う
768+
// グラデーション (スライム body 等) が黒くなる)。パース済み RGBA を hex 化して保持する。
765769
obj->SetNativeDataProperty(ctx, Str(isolate, "fillStyle"),
766770
[](v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) {
767771
info.GetReturnValue().Set(v8util::Str(info.GetIsolate(), Self(info.This())->state.fill_style_str));
768772
},
769773
[](v8::Local<v8::Name>, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) {
770774
Canvas2D* c = Self(info.This());
771775
c->state.fill = ColorFromValue(info.GetIsolate(), value);
772-
if (value->IsString()) c->state.fill_style_str = ToStdString(info.GetIsolate(), value);
776+
if (value->IsString()) {
777+
char hex[8];
778+
std::snprintf(hex, sizeof(hex), "#%02x%02x%02x",
779+
static_cast<unsigned>(c->state.fill.r),
780+
static_cast<unsigned>(c->state.fill.g),
781+
static_cast<unsigned>(c->state.fill.b));
782+
c->state.fill_style_str = hex;
783+
}
773784
}).Check();
774785
obj->SetNativeDataProperty(ctx, Str(isolate, "strokeStyle"),
775786
[](v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -778,7 +789,14 @@ void InstallAccessors(v8::Isolate* isolate, v8::Local<v8::Object> obj)
778789
[](v8::Local<v8::Name>, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) {
779790
Canvas2D* c = Self(info.This());
780791
c->state.stroke = ColorFromValue(info.GetIsolate(), value);
781-
if (value->IsString()) c->state.stroke_style_str = ToStdString(info.GetIsolate(), value);
792+
if (value->IsString()) {
793+
char hex[8];
794+
std::snprintf(hex, sizeof(hex), "#%02x%02x%02x",
795+
static_cast<unsigned>(c->state.stroke.r),
796+
static_cast<unsigned>(c->state.stroke.g),
797+
static_cast<unsigned>(c->state.stroke.b));
798+
c->state.stroke_style_str = hex;
799+
}
782800
}).Check();
783801

784802
N2D_STR_PROP("font", font);

templates/xbox/src/bindings/webgpu/WebGPU.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -759,20 +759,25 @@ static void Encoder_BeginRenderPass(const v8::FunctionCallbackInfo<v8::Value>& a
759759
att.clearValue = { F64(isolate, c, "r"), F64(isolate, c, "g"),
760760
F64(isolate, c, "b"), F64(isolate, c, "a") };
761761
}
762-
// «診断» 背景クリアパスの clearValue を記録する。
763-
// スライムの白→透明グラデが黒くなる原因が「surface が透明(0,0,0,0)で
764-
// クリアされているか」を確定させる。ゲームは stage.bgColor="#6dd4ff" を
765-
// 設定しているので、正しく反映されていれば (0.43,0.83,1.0,1.0) 付近の
766-
// 不透明シアンになるはず。(0,0,0,0) なら bgColor が player に届いていない。
762+
// «診断» クリアパスをフレーム・ハートビートとして記録する。
763+
// (1) 冒頭数回は clearValue を出す (背景クリア色の確認: シアン #6dd4ff か透明か)。
764+
// → メインアタッチメントが不透明シアンなら bgColor は効いている。
765+
// (2) 以降は一定間隔で通し番号だけ出す。ローディングで止まる #2 の切り分け用:
766+
// この行が途切れたら「描画ループが止まった=JS フリーズ」、
767+
// 出続けるなら「描画は継続=表示/合成の問題」と判別できる。
767768
if (att.loadOp == wgpu::LoadOp::Clear) {
768-
static int clear_log = 0;
769-
if (clear_log < 12) {
770-
++clear_log;
769+
static int clear_seen = 0;
770+
++clear_seen;
771+
if (clear_seen <= 8) {
771772
char buf[128];
772773
std::snprintf(buf, sizeof(buf),
773-
"[gpu] clear pass rgba=(%.3f,%.3f,%.3f,%.3f)",
774+
"[gpu] clear#%d rgba=(%.3f,%.3f,%.3f,%.3f)", clear_seen,
774775
att.clearValue.r, att.clearValue.g, att.clearValue.b, att.clearValue.a);
775776
v8util::AppendErrorLog(buf);
777+
} else if (clear_seen % 240 == 0) {
778+
char buf[64];
779+
std::snprintf(buf, sizeof(buf), "[gpu] heartbeat clear#%d", clear_seen);
780+
v8util::AppendErrorLog(buf);
776781
}
777782
}
778783
color_attachments.push_back(att);

0 commit comments

Comments
 (0)