@@ -79,9 +79,10 @@ watch(diagnosticsText, (newText, _) => {
7979})
8080const device = shallowRef <GPUDevice | null >(null );
8181
82- // Todo remove and replace with output type array
83- type ShaderType = " imageMain" | " printMain" | null
84- const currentDisplayMode = ref <ShaderType >(" imageMain" );
82+ const imageOutputDisplayed = ref <boolean >(false );
83+ const printOutputDisplayed = ref <boolean >(false );
84+ const shaderRunning = ref <boolean >(false );
85+
8586const uniformComponents = ref <UniformController []>([])
8687const areAnyUniformsRendered = computed (() => uniformComponents .value .filter (isControllerRendered ).length > 0 );
8788
@@ -246,7 +247,9 @@ function updateEntryPointOptions() {
246247async function doRun(forceCompile : boolean ) {
247248 smallScreenEditorVisible .value = false ;
248249 diagnosticsText .value = " " ;
249- currentDisplayMode .value = null ;
250+ imageOutputDisplayed .value = false ;
251+ printOutputDisplayed .value = false ;
252+ shaderRunning .value = false ;
250253
251254 if (! renderCanvas .value ) {
252255 throw new Error (" WebGPU is not supported in this browser" );
@@ -295,16 +298,15 @@ async function doRun(forceCompile: boolean) {
295298 if (areAnyUniformsRendered .value ) {
296299 tabContainer .value ?.setActiveTab (" uniforms" )
297300 }
298- let shaderType: ShaderType = null ;
299301 for (let outputType of compiledPlayground .outputTypes ) {
300302 if (outputType == " image" ) {
301- shaderType = " imageMain " ;
303+ imageOutputDisplayed . value = true ;
302304 } else if (outputType == " printing" ) {
303- shaderType = " printMain" ;
305+ printOutputDisplayed .value = true ;
306+ tabContainer .value ?.setActiveTab (" output" )
304307 }
305308 }
306-
307- currentDisplayMode .value = shaderType ;
309+ shaderRunning .value = true ;
308310 renderCanvas .value .onRun (compiledPlayground );
309311 }
310312}
@@ -419,7 +421,7 @@ function logError(message: string) {
419421 </Pane >
420422 <Pane class =" rightContainer" >
421423 <Splitpanes horizontal class =" resultSpace" >
422- <Pane class = " outputSpace " size =" 69" v-if =" device != null" v-show =" currentDisplayMode != null " >
424+ <Pane id = " big-screen-display " size =" 69" v-if =" device != null" v-show =" imageOutputDisplayed " >
423425 </Pane >
424426 <Pane class =" codeGenSpace" >
425427 </Pane >
@@ -429,7 +431,7 @@ function logError(message: string) {
429431 <div id =" small-screen-container" v-show =" isSmallScreen" >
430432 <div id =" small-screen-navbar" ></div >
431433 <Splitpanes horizontal class =" resultSpace slang-theme" v-show =" !smallScreenEditorVisible" >
432- <Pane id =" small-screen-display" size =" 69" v-if =" device != null" v-show =" currentDisplayMode != null " >
434+ <Pane id =" small-screen-display" size =" 69" v-if =" device != null" v-show =" imageOutputDisplayed " >
433435 </Pane >
434436 <Pane id =" small-screen-code-gen" ></Pane >
435437 </Splitpanes >
@@ -520,13 +522,11 @@ function logError(message: string) {
520522 </div >
521523 </div >
522524 </Teleport >
523- <Teleport defer :to =" isSmallScreen ? '#small-screen-display' : '.outputSpace '" v-if =" device != null" >
524- <div id =" renderOutput" v-show =" currentDisplayMode == 'imageMain' " >
525+ <Teleport defer :to =" isSmallScreen ? '#small-screen-display' : '#big-screen-display '" v-if =" device != null" >
526+ <div id =" renderOutput" v-show =" imageOutputDisplayed " >
525527 <RenderCanvas :device =" device" :show-fullscreen-toggle =" true" @log-error =" logError"
526528 @log-output =" (log) => { printedText = log }" ref =" renderCanvas" ></RenderCanvas >
527529 </div >
528- <textarea readonly class =" printSpace outputSpace"
529- v-show =" currentDisplayMode == 'printMain'" >{{ printedText }}</textarea >
530530 </Teleport >
531531 <Teleport v-if =" pageLoaded" defer :to =" isSmallScreen ? '#small-screen-code-gen' : '.codeGenSpace'" >
532532 <TabContainer ref =" tabContainer" >
@@ -539,13 +539,17 @@ function logError(message: string) {
539539 </Tab >
540540
541541 <Tab name =" uniforms" label =" Uniforms"
542- v-if =" currentDisplayMode == 'imageMain' && areAnyUniformsRendered" >
542+ v-if =" shaderRunning && areAnyUniformsRendered" >
543543 <UniformPanel :uniformComponents =" uniformComponents" />
544544 </Tab >
545545
546546 <Tab name =" diagnostics" label =" Diagnostics" v-if =" diagnosticsText != ''" >
547547 <textarea readonly class =" diagnosticSpace outputSpace" >{{ diagnosticsText }}</textarea >
548548 </Tab >
549+
550+ <Tab name =" output" label =" Output" v-if =" printOutputDisplayed" >
551+ <textarea readonly class =" printSpace outputSpace" >{{ printedText }}</textarea >
552+ </Tab >
549553 </TabContainer >
550554 </Teleport >
551555 <Teleport v-if =" pageLoaded" defer :to =" isSmallScreen ? '#small-screen-editor' : '#big-screen-editor'" >
@@ -587,7 +591,7 @@ function logError(message: string) {
587591}
588592
589593.printSpace {
590- margin-top : 10 px ;
594+ padding : 5 px ;
591595}
592596
593597.diagnosticSpace {
0 commit comments