static enum pipe_error emit_hw_fs(struct svga_context *svga, unsigned dirty) { struct svga_shader_variant *variant = NULL; enum pipe_error ret = PIPE_OK; struct svga_fragment_shader *fs = svga->curr.fs; struct svga_fs_compile_key key; /* SVGA_NEW_BLEND * SVGA_NEW_TEXTURE_BINDING * SVGA_NEW_RAST * SVGA_NEW_NEED_SWTNL * SVGA_NEW_SAMPLER * SVGA_NEW_FRAME_BUFFER */ ret = make_fs_key( svga, fs, &key ); if (ret != PIPE_OK) return ret; variant = search_fs_key( fs, &key ); if (!variant) { ret = compile_fs( svga, fs, &key, &variant ); if (ret != PIPE_OK) return ret; } assert(variant); if (variant != svga->state.hw_draw.fs) { if (svga_have_gb_objects(svga)) { /* * Bind is necessary here only because pipebuffer_fenced may move * the shader contents around.... */ ret = SVGA3D_BindGBShader(svga->swc, variant->gb_shader); if (ret != PIPE_OK) return ret; ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS, variant->gb_shader); if (ret != PIPE_OK) return ret; svga->rebind.fs = FALSE; } else { ret = SVGA3D_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS, variant->id); if (ret != PIPE_OK) return ret; } svga->dirty |= SVGA_NEW_FS_VARIANT; svga->state.hw_draw.fs = variant; } return PIPE_OK; }
static int emit_hw_fs( struct svga_context *svga, unsigned dirty ) { struct svga_shader_result *result = NULL; unsigned id = SVGA3D_INVALID_ID; int ret = 0; struct svga_fragment_shader *fs = svga->curr.fs; struct svga_fs_compile_key key; /* SVGA_NEW_BLEND * SVGA_NEW_TEXTURE_BINDING * SVGA_NEW_RAST * SVGA_NEW_NEED_SWTNL * SVGA_NEW_SAMPLER */ ret = make_fs_key( svga, &key ); if (ret) return ret; result = search_fs_key( fs, &key ); if (!result) { ret = compile_fs( svga, fs, &key, &result ); if (ret) return ret; } assert (result); id = result->id; assert(id != SVGA3D_INVALID_ID); if (result != svga->state.hw_draw.fs) { ret = SVGA3D_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS, id ); if (ret) return ret; svga->dirty |= SVGA_NEW_FS_RESULT; svga->state.hw_draw.fs = result; } return 0; }
static enum pipe_error emit_hw_fs(struct svga_context *svga, unsigned dirty) { struct svga_shader_variant *variant = NULL; enum pipe_error ret = PIPE_OK; struct svga_fragment_shader *fs = svga->curr.fs; struct svga_compile_key key; /* SVGA_NEW_BLEND * SVGA_NEW_TEXTURE_BINDING * SVGA_NEW_RAST * SVGA_NEW_NEED_SWTNL * SVGA_NEW_SAMPLER * SVGA_NEW_FRAME_BUFFER * SVGA_NEW_DEPTH_STENCIL_ALPHA * SVGA_NEW_VS */ ret = make_fs_key(svga, fs, &key); if (ret != PIPE_OK) return ret; variant = svga_search_shader_key(&fs->base, &key); if (!variant) { ret = compile_fs(svga, fs, &key, &variant); if (ret != PIPE_OK) return ret; } assert(variant); if (variant != svga->state.hw_draw.fs) { ret = svga_set_shader(svga, SVGA3D_SHADERTYPE_PS, variant); if (ret != PIPE_OK) return ret; svga->rebind.flags.fs = FALSE; svga->dirty |= SVGA_NEW_FS_VARIANT; svga->state.hw_draw.fs = variant; } return PIPE_OK; }
void main (int argc, char ** argv) { while (1) { int err; if (argc != 2) { puts ("usage: mkromfs <dir>"); err = 1; break; } printf ("Starting from %s directory.\n", argv [1]); puts ("\nParsing file system..."); list_init (&_inodes); inode_build_t * root_node = inode_alloc (NULL, argv [1]); if (!root_node) break; root_node->flags = INODE_DIR; err = parse_dir (NULL, root_node, argv [1]); if (err) break; puts ("End of parsing."); printf ("\nTotal inodes: %u\n", _inodes.count); puts ("\nCompiling file system..."); err = compile_fs (); if (err) break; puts ("End of compilation."); break; } }