Skip to content

Commit

Permalink
Add: GPU対応・非対応周りを実装
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Jan 26, 2023
1 parent c8336bd commit 625fba2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
25 changes: 17 additions & 8 deletions src/components/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,18 @@
toggle-color="primary"
toggle-text-color="display-on-primary"
:options="engineUseGpuOptions"
:disable="!allEngineCanUseGPU"
:disable="!canEngineUseGpu(selectedEngineId)"
>
<q-tooltip
anchor="center start"
self="center right"
transition-show="jump-left"
transition-hide="jump-right"
:target="!allEngineCanUseGPU"
:target="!canEngineUseGpu(selectedEngineId)"
>
お使いのエンジンはCPU版のためGPUモードを利用できません。
{{
engineInfos[selectedEngineId].name
}}はCPU版のためGPUモードを利用できません。
</q-tooltip>
</q-btn-toggle>
</q-card-actions>
Expand Down Expand Up @@ -731,10 +733,6 @@ export default defineComponent({
set: (val) => emit("update:modelValue", val),
});
const allEngineCanUseGPU = computed(
() => store.getters.ALL_ENGINE_CAN_USE_GPU
);
const engineUseGpu = computed({
get: () => {
let useGpu;
Expand Down Expand Up @@ -1038,11 +1036,22 @@ export default defineComponent({
return options;
});
const canEngineUseGpu = (engineIdOrGlobal: string) => {
if (engineIdOrGlobal === "global") {
return engineIds.value.some((engineId) =>
store.getters.ENGINE_CAN_USE_GPU(engineId)
);
} else {
return store.getters.ENGINE_CAN_USE_GPU;
}
};
return {
settingDialogOpenedComputed,
allEngineCanUseGPU,
engineUseGpu,
canEngineUseGpu,
engineIds,
engineInfos,
selectedEngineId,
engineUseGpuOptions,
renderEngineNameLabel,
Expand Down
9 changes: 0 additions & 9 deletions src/store/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,4 @@ export const engineStore = createPartialStore<EngineStoreTypes>({
return supportedDevices?.cuda || supportedDevices?.dml;
},
},

// TODO:エンジン毎の設定が可能になれば消す
ALL_ENGINE_CAN_USE_GPU: {
getter: (state, getters) => {
return state.engineIds.every((engineId) =>
getters.ENGINE_CAN_USE_GPU(engineId)
);
},
},
});
4 changes: 0 additions & 4 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,10 +821,6 @@ export type EngineStoreTypes = {
ENGINE_CAN_USE_GPU: {
getter: (engineId: string) => boolean;
};

ALL_ENGINE_CAN_USE_GPU: {
getter: boolean;
};
};

/*
Expand Down

0 comments on commit 625fba2

Please sign in to comment.